|
|
@@ -1,5 +1,6 @@
|
|
|
package com.malk.eastar.schedule;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.malk.eastar.service.AitableService;
|
|
|
import com.malk.eastar.service.DDCoreClient;
|
|
|
@@ -196,6 +197,78 @@ public class ScheduleTask3 {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 同步销售项目数据(解决客户缺失问题)
|
|
|
+ */
|
|
|
+// @Scheduled(cron = "0 0 18 * * ?")
|
|
|
+ public void syncSaleProjectData20260701() {
|
|
|
+ //查询有原系统PI号的宜搭销售项目数据
|
|
|
+ List<Map> ltcSaleProjectData = new ArrayList<>();
|
|
|
+ try {
|
|
|
+ log.info("查询销售台账记录");
|
|
|
+ Map params = new HashMap<>();
|
|
|
+ params.put("piCodePrefix","Eastar");
|
|
|
+ ltcSaleProjectData = yidaService.queryLtcSaleProjectData(params);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("查询销售台账记录异常",e);
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询所有宜搭客户数据
|
|
|
+ List<Map> ltcCustomerData = new ArrayList<>();
|
|
|
+ try {
|
|
|
+ log.info("查询客户名册所有记录");
|
|
|
+ ltcCustomerData = yidaService.queryLtcAllCustomerData();
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("查询客户名册异常",e);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //更新销售项目的客户
|
|
|
+ String customer;
|
|
|
+ String customerNew;
|
|
|
+ JSONArray customerAss;
|
|
|
+ String projectName;
|
|
|
+ String customerName;
|
|
|
+ String instanceIdOld;
|
|
|
+ String instanceIdNew;
|
|
|
+ for(Map ltcSaleProjectRecord : ltcSaleProjectData){
|
|
|
+ projectName = ltcSaleProjectRecord.get("projectName").toString();
|
|
|
+ System.out.println("projectName="+projectName);
|
|
|
+ customerName = "";
|
|
|
+ customer = ltcSaleProjectRecord.get("customer").toString();
|
|
|
+ customerNew = customer.replace("\\\"", "\"");
|
|
|
+ customerNew = customerNew.substring(1, customerNew.length()-1);
|
|
|
+ customerAss = JSONArray.parseArray(customerNew);
|
|
|
+ instanceIdOld = customerAss.getJSONObject(0).get("instanceId").toString();
|
|
|
+ instanceIdNew = "";
|
|
|
+ //更新关联表单instanceId(客户)
|
|
|
+ for (int i = 0; i < ltcCustomerData.size(); i++) {
|
|
|
+ if(ltcCustomerData.get(i).get("customerCode").equals(customerAss.getJSONObject(0).get("subTitle"))){
|
|
|
+ customerName = ltcCustomerData.get(i).get("customerName").toString();
|
|
|
+ instanceIdNew = ltcCustomerData.get(i).get("formInstId").toString();
|
|
|
+ customerAss.getJSONObject(0).put("instanceId",instanceIdNew);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println("projectName="+projectName+",customerName="+customerName+",instanceIdOld="+instanceIdOld+",instanceIdNew="+instanceIdNew);
|
|
|
+ try {
|
|
|
+ log.info("更新销售台账记录");
|
|
|
+ yidaService.updateLtcSaleProjectRelatedCustomer(ltcSaleProjectRecord.get("formInstId").toString(),customerAss);
|
|
|
+ Thread.sleep(3000);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("更新销售台账记录异常",e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ log.info("同步销售项目数据(解决客户缺失问题)完成");
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 同步销售项目整体阶段
|
|
|
*/
|