|
@@ -919,7 +919,7 @@ public class LiLinServiceImpl implements LiLinService {
|
|
|
log.info("开始对账单同步,accountNo: {}", accountNo);
|
|
log.info("开始对账单同步,accountNo: {}", accountNo);
|
|
|
|
|
|
|
|
// 准备时间范围
|
|
// 准备时间范围
|
|
|
- String dayFromId = LocalDate.now().minusDays(12).format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
|
|
|
|
|
|
+ String dayFromId = LocalDate.now().minusDays(8).format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
|
|
String dayToId = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
|
String dayToId = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
|
|
|
|
|
|
|
// 构建 POST 请求体
|
|
// 构建 POST 请求体
|
|
@@ -1455,25 +1455,19 @@ public class LiLinServiceImpl implements LiLinService {
|
|
|
"已审批已付款",
|
|
"已审批已付款",
|
|
|
"SelectField",
|
|
"SelectField",
|
|
|
YDSearch.Type.RADIO_FIELD,
|
|
YDSearch.Type.RADIO_FIELD,
|
|
|
- YDSearch.Operator.EQ)
|
|
|
|
|
-// new YDSearch("radioField_mimhsd0h", "否", "是否创建付款通知", YDSearch.Type.RADIO_FIELD, YDSearch.Operator.EQ)
|
|
|
|
|
|
|
+ YDSearch.Operator.EQ),
|
|
|
|
|
+ new YDSearch("radioField_mimhsd0h", "否", "是否创建付款通知", YDSearch.Type.RADIO_FIELD, YDSearch.Operator.EQ)
|
|
|
)))
|
|
)))
|
|
|
.build(), YDConf.FORM_QUERY.retrieve_list_all).getData();
|
|
.build(), YDConf.FORM_QUERY.retrieve_list_all).getData();
|
|
|
-// List<Map> list = (List<Map>) ydClient.queryData(YDParam.builder()
|
|
|
|
|
-// .formUuid("FORM-754586D31BF6414586E5C20DB3774A7320CV")
|
|
|
|
|
-// .searchFieldJson(JSONObject.toJSONString(Arrays.asList(
|
|
|
|
|
-// new YDSearch("textField_m9ze3rjg",
|
|
|
|
|
-// "CGFK20251027560",
|
|
|
|
|
-// "电子凭证号",
|
|
|
|
|
-// YDSearch.Type.TEXT_FIELD,
|
|
|
|
|
-// YDSearch.Operator.EQ)
|
|
|
|
|
-// )))
|
|
|
|
|
-// .build(), YDConf.FORM_QUERY.retrieve_list_all).getData();
|
|
|
|
|
|
|
+
|
|
|
if (list == null || list.isEmpty()) {
|
|
if (list == null || list.isEmpty()) {
|
|
|
log.info("没有找到需要处理的单据");
|
|
log.info("没有找到需要处理的单据");
|
|
|
return McR.success("无待处理数据");
|
|
return McR.success("无待处理数据");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ int successCount = 0;
|
|
|
|
|
+ int failCount = 0;
|
|
|
|
|
+
|
|
|
for (Map item : list) {
|
|
for (Map item : list) {
|
|
|
try {
|
|
try {
|
|
|
String formInstanceId = getStringValue(item, "formInstanceId");
|
|
String formInstanceId = getStringValue(item, "formInstanceId");
|
|
@@ -1483,13 +1477,6 @@ public class LiLinServiceImpl implements LiLinService {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
Map data = (Map) item.get("formData");
|
|
Map data = (Map) item.get("formData");
|
|
|
- // 获取源表单详情
|
|
|
|
|
-// Map data = (Map) ydClient.queryData(YDParam.builder()
|
|
|
|
|
-// .formInstId(formInstanceId)
|
|
|
|
|
-// .appType(ydConf.getAppType())
|
|
|
|
|
-// .systemToken(ydConf.getSystemToken())
|
|
|
|
|
-// .userId(ddConf.getOperator())
|
|
|
|
|
-// .build(), YDConf.FORM_QUERY.retrieve_id).getFormData();
|
|
|
|
|
|
|
|
|
|
if (data == null) {
|
|
if (data == null) {
|
|
|
log.warn("formInstanceId={} 的 formData 为空,跳过", formInstanceId);
|
|
log.warn("formInstanceId={} 的 formData 为空,跳过", formInstanceId);
|
|
@@ -1513,6 +1500,8 @@ public class LiLinServiceImpl implements LiLinService {
|
|
|
// 如果目标表单中已存在该流水号,则跳过,不再新增
|
|
// 如果目标表单中已存在该流水号,则跳过,不再新增
|
|
|
if (list1 != null && !list1.isEmpty()) {
|
|
if (list1 != null && !list1.isEmpty()) {
|
|
|
log.info("已存在重复数据,跳过插入:mainInstructionId={}", mainInstructionId);
|
|
log.info("已存在重复数据,跳过插入:mainInstructionId={}", mainInstructionId);
|
|
|
|
|
+ updateSourceBillStatus(formInstanceId, "是");
|
|
|
|
|
+ successCount++;
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1598,31 +1587,23 @@ public class LiLinServiceImpl implements LiLinService {
|
|
|
formData.put("textField_mdsk7rlm", mainInstructionId); // 主流水号用于去重
|
|
formData.put("textField_mdsk7rlm", mainInstructionId); // 主流水号用于去重
|
|
|
formData.put("employeeField_m8yf6gkl", Arrays.asList("275412081437800471"));
|
|
formData.put("employeeField_m8yf6gkl", Arrays.asList("275412081437800471"));
|
|
|
|
|
|
|
|
- // 执行新增
|
|
|
|
|
-// ydClient.operateData(YDParam.builder()
|
|
|
|
|
-// .formUuid("FORM-6B8A683A23524D3596C8C6CA13327EF3552K")
|
|
|
|
|
-// .appType("APP_RPH7R3LF3SMXLRDY1ZJW")
|
|
|
|
|
-// .systemToken("7M866K91D4LVACB4EADAZ5UJG7IN3OGA33WAMNT")
|
|
|
|
|
-// .noExecuteExpression(false)
|
|
|
|
|
-//// .searchCondition(JSONObject.toJSONString(UtilMap.map("textField_mdsk7rlm", mainInstructionId)))
|
|
|
|
|
-// .searchCondition(JSONObject.toJSONString(Arrays.asList(new YDSearch(
|
|
|
|
|
-// "textField_mdsk7rlm", mainInstructionId, "付款通知单流水号", YDSearch.Type.TEXT_FIELD, YDSearch.Operator.EQ))))
|
|
|
|
|
-// .formDataJson(JSONObject.toJSONString(formData))
|
|
|
|
|
-// .build(), YDConf.FORM_OPERATION.upsert);
|
|
|
|
|
try {
|
|
try {
|
|
|
-// ydClient.operateData(YDParam.builder()
|
|
|
|
|
-// .formInstId(formInstanceId)
|
|
|
|
|
-// .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("radioField_mimhsd0h","是")))
|
|
|
|
|
-// .build(), YDConf.FORM_OPERATION.update);
|
|
|
|
|
|
|
+
|
|
|
ydClient.operateData(YDParam.builder()
|
|
ydClient.operateData(YDParam.builder()
|
|
|
.formUuid("FORM-6B8A683A23524D3596C8C6CA13327EF3552K")
|
|
.formUuid("FORM-6B8A683A23524D3596C8C6CA13327EF3552K")
|
|
|
.formDataJson(JSON.toJSONString(formData))
|
|
.formDataJson(JSON.toJSONString(formData))
|
|
|
// .userId("275412081437800471")
|
|
// .userId("275412081437800471")
|
|
|
.build(), YDConf.FORM_OPERATION.create);
|
|
.build(), YDConf.FORM_OPERATION.create);
|
|
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
|
|
+ .formInstId(formInstanceId)
|
|
|
|
|
+ .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("radioField_mimhsd0h","是")))
|
|
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
|
|
|
|
|
log.info("成功插入新数据:mainInstructionId={}, 付款类型={}", mainInstructionId, fklx);
|
|
log.info("成功插入新数据:mainInstructionId={}, 付款类型={}", mainInstructionId, fklx);
|
|
|
|
|
+ successCount++;
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
log.info("处理单据异常:mainInstructionId={}, error={}", mainInstructionId, e.getMessage(), e);
|
|
log.info("处理单据异常:mainInstructionId={}, error={}", mainInstructionId, e.getMessage(), e);
|
|
|
|
|
+ failCount++;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1699,7 +1680,17 @@ public class LiLinServiceImpl implements LiLinService {
|
|
|
}
|
|
}
|
|
|
return McR.success();
|
|
return McR.success();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ private void updateSourceBillStatus(String formInstanceId, String status) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
|
|
+ .formInstId(formInstanceId)
|
|
|
|
|
+ .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("radioField_mimhsd0h", status)))
|
|
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("更新源单据状态失败:formInstanceId={}", formInstanceId, e);
|
|
|
|
|
+ throw e; // 抛出异常让上层处理
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
private Object getAss(String title, String id) {
|
|
private Object getAss(String title, String id) {
|
|
|
return UtilMap.map("appType, formUuid, formType, instanceId, title, subTitle", "APP_RPH7R3LF3SMXLRDY1ZJW", "FORM-754586D31BF6414586E5C20DB3774A7320CV", "receipt", id, title, "");
|
|
return UtilMap.map("appType, formUuid, formType, instanceId, title, subTitle", "APP_RPH7R3LF3SMXLRDY1ZJW", "FORM-754586D31BF6414586E5C20DB3774A7320CV", "receipt", id, title, "");
|
|
|
}
|
|
}
|