|
@@ -21,6 +21,7 @@ import com.malk.utils.UtilMap;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.slf4j.MDC;
|
|
import org.slf4j.MDC;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
@@ -46,6 +47,9 @@ public class KdYdCustomerServiceImpl extends ServiceImpl<KdYdCustomerMapper, KdY
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private KdYdCustomerLiaisonMapper kdYdCustomerLiaisonMapper;
|
|
private KdYdCustomerLiaisonMapper kdYdCustomerLiaisonMapper;
|
|
|
|
|
|
|
|
|
|
+ @Value(value = "${kd.host}")
|
|
|
|
|
+ private String kdHost;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public Map<String, Object> insertCustomer(Map map) {
|
|
public Map<String, Object> insertCustomer(Map map) {
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
Map<String, Object> result = new HashMap<>();
|
|
@@ -62,21 +66,20 @@ public class KdYdCustomerServiceImpl extends ServiceImpl<KdYdCustomerMapper, KdY
|
|
|
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
|
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
|
|
Map<String, Object> formParams = new HashMap<>();
|
|
Map<String, Object> formParams = new HashMap<>();
|
|
|
Map<String, Object> djbh = new HashMap<>();
|
|
Map<String, Object> djbh = new HashMap<>();
|
|
|
- djbh.put("khbm", bm);
|
|
|
|
|
|
|
+ djbh.put("djbh", bm);
|
|
|
result.put("data", djbh);
|
|
result.put("data", djbh);
|
|
|
String jsonStr = JSON.toJSONString(result);
|
|
String jsonStr = JSON.toJSONString(result);
|
|
|
|
|
|
|
|
formParams.put("jsons", jsonStr);
|
|
formParams.put("jsons", jsonStr);
|
|
|
|
|
|
|
|
System.out.println("====" + formParams);
|
|
System.out.println("====" + formParams);
|
|
|
- HttpResponse response = HttpRequest.post("http://113.45.187.194:70/xk/dyzn/WsBasedyzn.asmx/hgdjydtbdeletecust")
|
|
|
|
|
|
|
+ HttpResponse response = HttpRequest.post(kdHost+"/xk/dyzn/WsBasedyzn.asmx/")//todo 待完善接口
|
|
|
.headerMap(headers, true)
|
|
.headerMap(headers, true)
|
|
|
.form(formParams)
|
|
.form(formParams)
|
|
|
.timeout(30000) // 30秒超时
|
|
.timeout(30000) // 30秒超时
|
|
|
.execute();
|
|
.execute();
|
|
|
|
|
|
|
|
String responseBody = response.body();
|
|
String responseBody = response.body();
|
|
|
- System.out.println("====" + responseBody);
|
|
|
|
|
// 返回删除操作的格式
|
|
// 返回删除操作的格式
|
|
|
result.put("table", "KD_YD_CUSTOMER");
|
|
result.put("table", "KD_YD_CUSTOMER");
|
|
|
result.put("action", "del");
|
|
result.put("action", "del");
|
|
@@ -96,9 +99,7 @@ public class KdYdCustomerServiceImpl extends ServiceImpl<KdYdCustomerMapper, KdY
|
|
|
|
|
|
|
|
// === 提取主表字段 ===
|
|
// === 提取主表字段 ===
|
|
|
String khmc = UtilMap.getString(formData, "textField_lqanqe6j");
|
|
String khmc = UtilMap.getString(formData, "textField_lqanqe6j");
|
|
|
-// String khmc = "测试1111222";
|
|
|
|
|
String khbm = UtilMap.getString(formData, "textField_meqhqqvg");
|
|
String khbm = UtilMap.getString(formData, "textField_meqhqqvg");
|
|
|
-// String khbm = "kh2121212";
|
|
|
|
|
String xssx = UtilMap.getString(formData, "selectField_megi74y7");
|
|
String xssx = UtilMap.getString(formData, "selectField_megi74y7");
|
|
|
String khxypj = UtilMap.getString(formData, "selectField_mewirdx4");
|
|
String khxypj = UtilMap.getString(formData, "selectField_mewirdx4");
|
|
|
String khsx = UtilMap.getString(formData, "selectField_megi74y8");
|
|
String khsx = UtilMap.getString(formData, "selectField_megi74y8");
|
|
@@ -107,9 +108,7 @@ public class KdYdCustomerServiceImpl extends ServiceImpl<KdYdCustomerMapper, KdY
|
|
|
String khfz = UtilMap.getString(formData, "selectField_lqanqe6q");
|
|
String khfz = UtilMap.getString(formData, "selectField_lqanqe6q");
|
|
|
String fptt = UtilMap.getString(formData, "textField_llujklkr");
|
|
String fptt = UtilMap.getString(formData, "textField_llujklkr");
|
|
|
String nsdjh = UtilMap.getString(formData, "textField_meqhqqvm");
|
|
String nsdjh = UtilMap.getString(formData, "textField_meqhqqvm");
|
|
|
-// String nsdjh = "24234234";
|
|
|
|
|
String khyh = UtilMap.getString(formData, "textField_meqhqqvn");
|
|
String khyh = UtilMap.getString(formData, "textField_meqhqqvn");
|
|
|
-// String khyh = "建设银行";
|
|
|
|
|
String yhzh = UtilMap.getString(formData, "textField_meqhqqvs");
|
|
String yhzh = UtilMap.getString(formData, "textField_meqhqqvs");
|
|
|
String jxslx = UtilMap.getString(formData, "selectField_mis6kl56");
|
|
String jxslx = UtilMap.getString(formData, "selectField_mis6kl56");
|
|
|
String kplx = UtilMap.getString(formData, "selectField_lwopqbye");
|
|
String kplx = UtilMap.getString(formData, "selectField_lwopqbye");
|
|
@@ -125,8 +124,6 @@ public class KdYdCustomerServiceImpl extends ServiceImpl<KdYdCustomerMapper, KdY
|
|
|
String qyxygl = UtilMap.getString(formData, "radioField_mfxs7rd2");
|
|
String qyxygl = UtilMap.getString(formData, "radioField_mfxs7rd2");
|
|
|
String mrsl = UtilMap.getString(formData, "selectField_mfxrryt3");
|
|
String mrsl = UtilMap.getString(formData, "selectField_mfxrryt3");
|
|
|
String sfl = UtilMap.getString(formData, "selectField_mfxrryt2");
|
|
String sfl = UtilMap.getString(formData, "selectField_mfxrryt2");
|
|
|
- String sfjtkh = UtilMap.getString(formData, "radioField_mhe8e937");
|
|
|
|
|
- String dyjtkh = UtilMap.getString(formData, "textField_mis6kl57");
|
|
|
|
|
|
|
|
|
|
// 构建主表数据
|
|
// 构建主表数据
|
|
|
Map<String, Object> customData = new HashMap<>();
|
|
Map<String, Object> customData = new HashMap<>();
|
|
@@ -142,7 +139,7 @@ public class KdYdCustomerServiceImpl extends ServiceImpl<KdYdCustomerMapper, KdY
|
|
|
customData.put("nsdjh", nsdjh);
|
|
customData.put("nsdjh", nsdjh);
|
|
|
customData.put("khyh", khyh);
|
|
customData.put("khyh", khyh);
|
|
|
customData.put("yhzh", yhzh);
|
|
customData.put("yhzh", yhzh);
|
|
|
- customData.put("khlx", jxslx);
|
|
|
|
|
|
|
+ customData.put("jxslx", jxslx);
|
|
|
customData.put("kplx", kplx);
|
|
customData.put("kplx", kplx);
|
|
|
customData.put("kplxdh", kplxdh);
|
|
customData.put("kplxdh", kplxdh);
|
|
|
customData.put("kptxdz", kptxdz);
|
|
customData.put("kptxdz", kptxdz);
|
|
@@ -156,8 +153,6 @@ public class KdYdCustomerServiceImpl extends ServiceImpl<KdYdCustomerMapper, KdY
|
|
|
customData.put("qyxygl", qyxygl);
|
|
customData.put("qyxygl", qyxygl);
|
|
|
customData.put("mrsl", mrsl);
|
|
customData.put("mrsl", mrsl);
|
|
|
customData.put("sfl", sfl);
|
|
customData.put("sfl", sfl);
|
|
|
- customData.put("sfjtkh", sfjtkh);
|
|
|
|
|
- customData.put("dyjtkh", dyjtkh);
|
|
|
|
|
|
|
|
|
|
// 处理子表数据
|
|
// 处理子表数据
|
|
|
List<Map<String, Object>> contactList = new ArrayList<>();
|
|
List<Map<String, Object>> contactList = new ArrayList<>();
|
|
@@ -174,7 +169,6 @@ public class KdYdCustomerServiceImpl extends ServiceImpl<KdYdCustomerMapper, KdY
|
|
|
String zw = safeGetString(item, "textField_l3s6ubht");
|
|
String zw = safeGetString(item, "textField_l3s6ubht");
|
|
|
String gddh = safeGetString(item, "textField_mfxu5dnk");
|
|
String gddh = safeGetString(item, "textField_mfxu5dnk");
|
|
|
String bm = safeGetString(item, "textField_mfkp33s5");
|
|
String bm = safeGetString(item, "textField_mfkp33s5");
|
|
|
-// String bm = "LXR239234112";
|
|
|
|
|
String yx = safeGetString(item, "textField_lqbzc3gr");
|
|
String yx = safeGetString(item, "textField_lqbzc3gr");
|
|
|
|
|
|
|
|
// 添加到联系人列表
|
|
// 添加到联系人列表
|
|
@@ -200,16 +194,16 @@ public class KdYdCustomerServiceImpl extends ServiceImpl<KdYdCustomerMapper, KdY
|
|
|
// 构建form参数
|
|
// 构建form参数
|
|
|
Map<String, Object> formParams = new HashMap<>();
|
|
Map<String, Object> formParams = new HashMap<>();
|
|
|
formParams.put("jsons", jsonStr);
|
|
formParams.put("jsons", jsonStr);
|
|
|
- System.out.println("formParams"+formParams);
|
|
|
|
|
|
|
+// 发送请求
|
|
|
HttpResponse response = null;
|
|
HttpResponse response = null;
|
|
|
- if ("add".equals(action)) {
|
|
|
|
|
- response = HttpRequest.post("http://113.45.187.194:70/xk/dyzn/WsBasedyzn.asmx/hgdjydtbcreatecust")
|
|
|
|
|
|
|
+ if (action == "add") {
|
|
|
|
|
+ response = HttpRequest.post(kdHost+"/xk/dyzn/WsBasedyzn.asmx/")//todo 修改接口
|
|
|
.headerMap(headers, true)
|
|
.headerMap(headers, true)
|
|
|
.form(formParams)
|
|
.form(formParams)
|
|
|
.timeout(30000) // 30秒超时
|
|
.timeout(30000) // 30秒超时
|
|
|
.execute();
|
|
.execute();
|
|
|
} else {
|
|
} else {
|
|
|
- response = HttpRequest.post("http://113.45.187.194:70/xk/dyzn/WsBasedyzn.asmx/hgdjydtbupdatecust")
|
|
|
|
|
|
|
+ response = HttpRequest.post(kdHost+"/xk/dyzn/WsBasedyzn.asmx/")
|
|
|
.headerMap(headers, true)
|
|
.headerMap(headers, true)
|
|
|
.form(formParams)
|
|
.form(formParams)
|
|
|
.timeout(30000) // 30秒超时
|
|
.timeout(30000) // 30秒超时
|
|
@@ -217,32 +211,40 @@ public class KdYdCustomerServiceImpl extends ServiceImpl<KdYdCustomerMapper, KdY
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
String responseBody = response.body();
|
|
String responseBody = response.body();
|
|
|
- System.out.println("responseBody" + responseBody);
|
|
|
|
|
try {
|
|
try {
|
|
|
// 一行代码提取
|
|
// 一行代码提取
|
|
|
-// String jdbh = JSON.parseArray(responseBody)
|
|
|
|
|
-// .getJSONObject(0)
|
|
|
|
|
-// .getJSONObject("data")
|
|
|
|
|
-// .getString("djbh");
|
|
|
|
|
|
|
+ String jdbh = JSON.parseArray(responseBody)
|
|
|
|
|
+ .getJSONObject(0)
|
|
|
|
|
+ .getJSONObject("data")
|
|
|
|
|
+ .getString("djbh");
|
|
|
String msg = JSON.parseArray(responseBody)
|
|
String msg = JSON.parseArray(responseBody)
|
|
|
.getJSONObject(0)
|
|
.getJSONObject(0)
|
|
|
.getString("msg");
|
|
.getString("msg");
|
|
|
- String code = JSON.parseArray(responseBody)
|
|
|
|
|
- .getJSONObject(0)
|
|
|
|
|
- .getString("code");
|
|
|
|
|
ydClient.operateData(
|
|
ydClient.operateData(
|
|
|
YDParam.builder()
|
|
YDParam.builder()
|
|
|
.formInstanceId(formInstId)
|
|
.formInstanceId(formInstId)
|
|
|
- .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("textField_ml08nk3y, textareaField_mkxqgrvq", code, msg)))
|
|
|
|
|
|
|
+ .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("textareaField_mkxqgrvq, textField_mjs6fuwo", msg, jdbh)))
|
|
|
.useLatestVersion(true).build(),
|
|
.useLatestVersion(true).build(),
|
|
|
YDConf.FORM_OPERATION.update);
|
|
YDConf.FORM_OPERATION.update);
|
|
|
-//
|
|
|
|
|
|
|
+// Map<String, Object> updatePayload = new HashMap<>();
|
|
|
|
|
+// updatePayload.put("tableField_mfkks8ww", updatedTableRowsForYD);
|
|
|
|
|
+// ydClient.operateData(
|
|
|
|
|
+// YDParam.builder()
|
|
|
|
|
+// .formInstanceId(formInstId)
|
|
|
|
|
+// .updateFormDataJson(JSONObject.toJSONString(updatePayload))
|
|
|
|
|
+// .useLatestVersion(true)
|
|
|
|
|
+// .build(),
|
|
|
|
|
+// YDConf.FORM_OPERATION.update
|
|
|
|
|
+// );
|
|
|
log.info("回写数据到宜搭成功,formInstId: {}", formInstId);
|
|
log.info("回写数据到宜搭成功,formInstId: {}", formInstId);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
log.warn("回写数据到宜搭失败,formInstId: {}, 错误: {}", formInstId, e.getMessage());
|
|
log.warn("回写数据到宜搭失败,formInstId: {}, 错误: {}", formInstId, e.getMessage());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 构建返回结果
|
|
|
|
|
+ result.put("table", "KD_YD_CUSTOMER");
|
|
|
|
|
+ result.put("action", action != null ? action : "add");
|
|
|
result.put("data", customData);
|
|
result.put("data", customData);
|
|
|
|
|
|
|
|
log.info("客户信息同步成功: formInstId={}, khmc={}, khbm={}", formInstId, khmc, khbm);
|
|
log.info("客户信息同步成功: formInstId={}, khmc={}, khbm={}", formInstId, khmc, khbm);
|