|
@@ -122,49 +122,8 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
@Override
|
|
|
public McR test() {
|
|
|
log.info("test");
|
|
|
- String[] customerCodes = {"AG10004", "AG10003", "AG10002", "AG10001"};
|
|
|
- String[] updateConditions = {"月结30天","票到30天","月结30天","月结30天"};
|
|
|
-
|
|
|
- List<Map> data = (List<Map>) ydClient.queryData(YDParam.builder()
|
|
|
- .formUuid("FORM-CD79B9602FA44073B85C640CFB7A6880UWFA")
|
|
|
- .build(), YDConf.FORM_QUERY.retrieve_list).getData();
|
|
|
-
|
|
|
- List<Map> collect = data.stream().map(map -> {
|
|
|
- Map formData = (Map) map.get("formData");
|
|
|
- String condition = formData.get("textField_m3mukxci").toString();//收款条件
|
|
|
- int level = (int)formData.get("numberField_m3mukxcj");//等级
|
|
|
- String erpCode = formData.get("textField_m3o14fuk").toString();//erp编码
|
|
|
-
|
|
|
- Map result = new HashMap<>();
|
|
|
- result.put("condition", condition);
|
|
|
- result.put("level", level);
|
|
|
- result.put("erpCode", erpCode);
|
|
|
-
|
|
|
- return result;
|
|
|
- }).collect(Collectors.toList());
|
|
|
-
|
|
|
-
|
|
|
- for (int i = 0; i < customerCodes.length; i++) {
|
|
|
- String customerCode = customerCodes[i];
|
|
|
- int level = 0;
|
|
|
- String erpCode = "";
|
|
|
-
|
|
|
- for (Map map : collect) {
|
|
|
- if (map.get("condition").toString().equals(updateConditions[i])){
|
|
|
- level = (int) map.get("level");
|
|
|
- erpCode = map.get("erpCode").toString();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- ydClient.operateData(YDParam.builder()
|
|
|
- .formUuid("FORM-C20F12A6BF6145A4A451F35CC2C78AFC7PB8")
|
|
|
- .searchFieldJson(JSON.toJSONString(UtilMap.map("textField_lwpqbm7a",customerCode)))
|
|
|
- .formDataJson(JSON.toJSONString(UtilMap.map("selectField_lwpqbm7r, numberField_m3n011zm, textField_m3o22635",updateConditions[i],level,erpCode)))
|
|
|
-// .updateFormDataJson(JSON.toJSONString(UtilMap.map("selectField_lwpqbm7r, numberField_m3n011zm, textField_m3o22635",updateConditions[i],level,erpCode)))
|
|
|
- .build(), YDConf.FORM_OPERATION.upsert);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
+ Map map = new HashMap();
|
|
|
+ String aaa = map.get("aaa").toString();
|
|
|
return McR.success();
|
|
|
}
|
|
|
|
|
@@ -655,6 +614,13 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
param.put("userId","344749020127590108");//wzy
|
|
|
param.put("fileUrl",fileURL);
|
|
|
|
|
|
+// Map mcBody = new HashMap();
|
|
|
+// mcBody.put("params",param);
|
|
|
+// mcBody.put("headers",ddClient.initTokenHeader());
|
|
|
+// mcBody.put("url","https://api.dingtalk.com/v1.0/yida/apps/temporaryUrls/" + ydConf.getAppType());
|
|
|
+//
|
|
|
+// UtilHttp.doPost("http://127.0.0.1/mc/api/request/downloadFile",null,null,mcBody);
|
|
|
+
|
|
|
fileURL = ((DDR_New) UtilHttp.doGet("https://api.dingtalk.com/v1.0/yida/apps/temporaryUrls/" + ydConf.getAppType(), ddClient.initTokenHeader(), param, DDR_New.class)).getResult().toString();
|
|
|
|
|
|
URL url = new URL(fileURL);
|
|
@@ -1388,50 +1354,65 @@ public class LingmingguangziServiceImpl implements LingmingguangziService {
|
|
|
return McR.errorParam("formInstId不能为空");
|
|
|
}
|
|
|
String formInstId = map.get("formInstId").toString();
|
|
|
- //查询客户信息
|
|
|
+ //查询线索信息
|
|
|
DDR_New ddrNew = ydClient.queryData(YDParam.builder()
|
|
|
.formInstId(formInstId)
|
|
|
.build(), YDConf.FORM_QUERY.retrieve_id);
|
|
|
|
|
|
Map formData = ddrNew.getFormData();
|
|
|
|
|
|
- String customerName = getString(formData.get("textField_lwpqbm7b"));//客户名称
|
|
|
- String customerCode = getString(formData.get("textField_lwpqbm7a"));//客户代码
|
|
|
- String contacts = getString(formData.get("textField_lwpqbm7u"));//联系人
|
|
|
- String phone = getString(formData.get("textField_lwpqbm7v"));//电话
|
|
|
-
|
|
|
- if (!contacts.isEmpty()){
|
|
|
- //新增联系人
|
|
|
- Map contactFormData = new HashMap();
|
|
|
-
|
|
|
- List<Map> customer = new ArrayList<>();
|
|
|
- Map customerMap = new HashMap();
|
|
|
- customerMap.put("appType",ydConf.getAppType());
|
|
|
- customerMap.put("formUuid","FORM-C20F12A6BF6145A4A451F35CC2C78AFC7PB8");
|
|
|
- customerMap.put("formType","receipt");
|
|
|
- customerMap.put("instanceId",formInstId);
|
|
|
- customerMap.put("title",customerName);
|
|
|
- customerMap.put("subTitle","");
|
|
|
- customer.add(customerMap);
|
|
|
-
|
|
|
- if (Objects.isNull(formData.get("selectField_m32pszh3"))){
|
|
|
- contactFormData.put("selectField_lzmh4hf8","意向客户");
|
|
|
- contactFormData.put("associationFormField_lzto0clw",customer);
|
|
|
- }else {
|
|
|
- contactFormData.put("selectField_lzmh4hf8","订单客户");
|
|
|
- contactFormData.put("associationFormField_lzto0clv",customer);
|
|
|
- }
|
|
|
-
|
|
|
- contactFormData.put("textField_lwpquxe4",contacts);
|
|
|
- contactFormData.put("multiSelectField_m278ty7s",new String[]{"电话"});
|
|
|
- contactFormData.put("textField_lwpquxe9",phone);
|
|
|
- contactFormData.put("textField_m0z0e88f",customerName);
|
|
|
- contactFormData.put("textField_m0z0e88e",customerCode);
|
|
|
+ String customerName = getString(formData.get("textField_m2ipea64"));//客户名称
|
|
|
+ String customerCode = getString(formData.get("textField_m50vl2jt"));//客户编号
|
|
|
+ String contacts = getString(formData.get("textField_m2ipea63"));//联系人
|
|
|
+ String phone = getString(formData.get("textField_m2ipea65"));//电话
|
|
|
|
|
|
- ydClient.operateData(YDParam.builder()
|
|
|
- .formUuid("FORM-98CB0F02BCB14C5CB86A404012879C34GQ5P")
|
|
|
- .formDataJson(JSON.toJSONString(contactFormData))
|
|
|
- .build(), YDConf.FORM_OPERATION.create);
|
|
|
+ List<Map> data = (List<Map>) ydClient.queryData(YDParam.builder()
|
|
|
+ .formUuid("FORM-221A9483B28448089ACBA5B4748D6288KMG5")
|
|
|
+ .searchFieldJson(JSONObject.toJSONString(UtilMap.map("textField_m4u3lrdv, textField_lwpquxe4", customerCode, contacts)))
|
|
|
+ .build(), YDConf.FORM_QUERY.retrieve_list).getData();
|
|
|
+ if (!data.isEmpty()){
|
|
|
+ Map updateFormData = (Map) data.get(0).get("formData");
|
|
|
+ String updateFormInstId = data.get(0).get("formInstanceId").toString();
|
|
|
+ List<String> types = (List<String>) updateFormData.get("multiSelectField_m278ty7s");
|
|
|
+ if (types.contains("电话")){
|
|
|
+ return McR.success("联系人已存在");
|
|
|
+ }else{
|
|
|
+ types.add("电话");
|
|
|
+ updateFormData.put("multiSelectField_m278ty7s",types);
|
|
|
+ updateFormData.put("textField_lwpquxe9",phone);
|
|
|
+
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formInstId(updateFormInstId)
|
|
|
+ .updateFormDataJson(JSON.toJSONString(updateFormData))
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if (!contacts.isEmpty()){
|
|
|
+ //新增联系人
|
|
|
+ Map contactFormData = new HashMap();
|
|
|
+
|
|
|
+ List<Map> customer = new ArrayList<>();
|
|
|
+ Map customerMap = new HashMap();
|
|
|
+ customerMap.put("appType",ydConf.getAppType());
|
|
|
+ customerMap.put("formUuid","FORM-6F1E2DCFB3F5448EBDD4994551EBF690DVIT");
|
|
|
+ customerMap.put("formType","receipt");
|
|
|
+ customerMap.put("instanceId",formInstId);
|
|
|
+ customerMap.put("title",customerName);
|
|
|
+ customerMap.put("subTitle","");
|
|
|
+ customer.add(customerMap);
|
|
|
+
|
|
|
+ contactFormData.put("associationFormField_m4qdcril",customer);
|
|
|
+ contactFormData.put("textField_lwpquxe4",contacts);
|
|
|
+ contactFormData.put("multiSelectField_m278ty7s",new String[]{"电话"});
|
|
|
+ contactFormData.put("textField_lwpquxe9",phone);
|
|
|
+ contactFormData.put("textField_m0z0e88f",customerName);
|
|
|
+ contactFormData.put("textField_m4u3lrdv",customerCode);
|
|
|
+
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formUuid("FORM-221A9483B28448089ACBA5B4748D6288KMG5")
|
|
|
+ .formDataJson(JSON.toJSONString(contactFormData))
|
|
|
+ .build(), YDConf.FORM_OPERATION.create);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return McR.success();
|