Explorar el Código

feat:20260122 处理空指针异常和修改子表单的控件编码为正式表的

zw hace 1 semana
padre
commit
d484217653

+ 1 - 1
mjava-RJK/mjava-rjk/src/main/java/com/malk/rjk/mapping/DuildBusinessCustom.java

@@ -180,7 +180,7 @@ public class DuildBusinessCustom {
             businessCustom.put("khyhkh", bankcardNumber);
         }
 
-        JsonNode subTableDetails = bizObjectNode.path("D150508sylqgyf7kyrma7ikoad");// 购买产品明细-子表单
+        JsonNode subTableDetails = bizObjectNode.path("D150508productDetails");// 购买产品明细-子表单
         StringBuilder subTableStringBuilder = new StringBuilder();
         if (subTableDetails.isArray()) {
             for (int i = 0; i < subTableDetails.size(); i++) {

+ 2 - 2
mjava-RJK/mjava-rjk/src/main/java/com/malk/rjk/mapping/DuildContactCustom.java

@@ -313,7 +313,7 @@ public class DuildContactCustom {
                 log.warn("hjykpje 字段转换失败: {}", hjykpjeStr);
             }
         }
-        JsonNode membershipCardDetails = bizObjectNode.path("D150508sgg7hj6i7ae2zk0ow6sbd");//会员卡明细-子表单
+        JsonNode membershipCardDetails = bizObjectNode.path("D150508Feaf0c0b14ecc4ab9888f741c106212c1");//会员卡明细-子表单
         StringBuilder membershipCardStringBuilder = new StringBuilder();
         if (membershipCardDetails.isArray()) {
             for (int i = 0; i < membershipCardDetails.size(); i++) {
@@ -339,7 +339,7 @@ public class DuildContactCustom {
 //            System.out.println("会员卡明细字段: " + membershipCardArrayString);
         }
 
-        JsonNode customerTagDetails = bizObjectNode.path("D150508st8zyrxlei0u6cfrgrut9");//客户标签-子表单
+        JsonNode customerTagDetails = bizObjectNode.path("D150508F7db8076628f1470aa37e4b9319e3ce09");//客户标签-子表单
         // 使用列表来收集标签名称
         List<String> curedSymptomsList = new ArrayList<>();    // 已治愈症状标签列表
         List<String> uncuredSymptomsList = new ArrayList<>();  // 未治愈症状标签列表

+ 39 - 47
mjava-RJK/mjava-rjk/src/main/java/com/malk/rjk/server/impl/RjkServerImpl.java

@@ -314,7 +314,9 @@ public class RjkServerImpl implements RjkServer {
         }
 
         JSONObject contactCustom = duildContactCustom.ContactCustom(bizObjectNode);
-        body.put("contact_custom", contactCustom);
+        if (contactCustom != null){
+            body.put("contact_custom", contactCustom);
+        }
 
         String resp = doWeilingPost(url, body.toJSONString());
         log.info("卫瓴联系人创建响应(多个手机号), phones={}, resp={}", phones, resp);
@@ -331,50 +333,36 @@ public class RjkServerImpl implements RjkServer {
         JSONObject body = new JSONObject();
         JSONObject ctbody = new JSONObject();
         String userName = bizObjectNode.path("F0000001").asText();//客户昵称
-        if (userName != null && !userName.isEmpty()){
-            body.put("user_name", userName);
-        }
+        body.put("user_name", userName);
+
 
         String position = bizObjectNode.path("F0000123").asText();//这里是职位,F0000123对应的是职业
-        if (position != null && !position.isEmpty()){
-            body.put("position", position);
-        }
+        body.put("position", position);
 
         String genderStr = bizObjectNode.path("F0000107").asText();
         int gender = Integer.parseInt(getGenderValueByLabel(genderStr)) ;
-        if (genderStr != null && !genderStr.isEmpty()){
-            body.put("gender", gender);
-        }
+        body.put("gender", gender);
+
 
         // 年龄字段 - 只有存在时才添加
         JsonNode ageNode = bizObjectNode.path("F0000214");
-        if (!ageNode.isMissingNode()) {
-            int age = ageNode.asInt();
-            body.put("age", age);
-        }
+        int age = ageNode.asInt();
+        body.put("age", age);
 
         String wxId = bizObjectNode.path("F0000192").asText();//这里是微信ID,F0000192对应的是微信
-        if (wxId != null && !wxId.isEmpty()){
-            body.put("wx_id", wxId);
-        }
-//        String qq = bizObjectNode.path("F0000192").asText("");//qq
+        body.put("wx_id", wxId);
+
+//      String qq = bizObjectNode.path("F0000192").asText("");//qq
         String email = bizObjectNode.path("F0000195").asText();
-        if (email != null && !email.isEmpty()){
-            body.put("email", email);
-        }
+        body.put("email", email);
 
-//        String remark = bizObjectNode.path("F0000164").asText();
-//        if (remark != null && !remark.isEmpty()){
-//            body.put("remark", remark);
-//        }
+//      String remark = bizObjectNode.path("F0000164").asText();//        if (remark != null && !remark.isEmpty()){
+//      body.put("remark", remark);
 
         body.put("contact_id", contactId);//必需
-        if (genderStr != null && !genderStr.isEmpty()){
-            body.put("gender", gender);
-        }
 
         JSONObject contactCustom = duildContactCustom.ContactCustom(bizObjectNode);
-//        System.out.println("contactCustom的值是: "+ contactCustom);
+//      System.out.println("contactCustom的值是: "+ contactCustom);
         body.put("contact_custom", contactCustom);
 
         String owner = bizObjectNode.path("OwnerId").asText();//氚云客户经理同步卫瓴归属人逻辑
@@ -586,14 +574,28 @@ public class RjkServerImpl implements RjkServer {
 
         JSONObject body = new JSONObject();
 
-        //todo 企业id
-        String stageStr = bizObjectNode.path("F0000093").asText();
-        int stageValue = Integer.parseInt(getStageValueByLabel(stageStr));
         String Creator = bizObjectNode.path("CreatedBy").asText();
         String createUserId = getUserIdByName(Creator);
+        body.put("create_user_id", createUserId);//写死了 应该传createUserId -D8Gy9-20l6rJAfJIHJbQ6DuBA0bZOU5-XhteFfCCzUw
+
         String createTimeStr = bizObjectNode.path("CreatedTime").asText();
         long createTime = convertToTimestamp(createTimeStr);
-        String customerDataIds = bizObjectNode.path("F0000101").asText();
+        body.put("create_time", createTime);
+
+        String customerDataIds = bizObjectNode.path("F0000101").asText();//卫瓴客户数据ID
+        JSONArray relatedCustomers = new JSONArray();
+        JSONArray customerDataIdsArray = new JSONArray();
+        customerDataIdsArray.add(customerDataIds);//写死了 应该传customerDataIds
+
+        JSONObject way = new JSONObject();
+        way.put("type", 0);          // 0-联系人(根据卫瓴文档)
+        way.put("ids", customerDataIdsArray);
+        relatedCustomers.add(way);
+
+        body.put("related_customers", relatedCustomers);//必需-商机关联的外部相关人
+
+        String stageStr = bizObjectNode.path("F0000093").asText();
+        int stageValue = Integer.parseInt(getStageValueByLabel(stageStr));
 //        String fromChannelStr = bizObjectNode.path("F0000097").asText("");
 //        int fromChannelId = Integer.parseInt(getSourceValueByLabel(fromChannelStr));
         String customerName = bizObjectNode.path("F0000002").asText();//客户名称
@@ -619,21 +621,11 @@ public class RjkServerImpl implements RjkServer {
             body.put("stage", 1);
         }
 
-        JSONArray relatedCustomers = new JSONArray();
-        JSONArray customerDataIdsArray = new JSONArray();
-        customerDataIdsArray.add(customerDataIds);//写死了 应该传customerDataIds
-
-            JSONObject way = new JSONObject();
-            way.put("type", 0);          // 0-联系人(根据卫瓴文档)
-            way.put("ids", customerDataIdsArray);
-            relatedCustomers.add(way);
-
-        body.put("related_customers", relatedCustomers);//必需-商机关联的外部相关人
-//        body.put("company_id", "VtOjbpW4Qo6ZdR6y1Ogu_pI4aFP36GdwC4X-eVw-2xA");
-        body.put("create_user_id", createUserId);//写死了 应该传createUserId -D8Gy9-20l6rJAfJIHJbQ6DuBA0bZOU5-XhteFfCCzUw
-        body.put("create_time", createTime);
         JSONObject businessCustom = duildBusinessCustom.BusinessCustom(bizObjectNode);
-        body.put("business_custom", businessCustom);
+        if (businessCustom != null){
+            body.put("business_custom", businessCustom);
+        }
+
         String resp = doWeilingPost(url, body.toJSONString());
         log.info("卫瓴商机新增响应: {}", resp);
         return JSON.parseObject(resp);