涉及变更操作以及部分字段更新
This commit is contained in:
parent
01950969e5
commit
846e3bd84d
@ -18,6 +18,8 @@ import org.springframework.web.client.RestClientException;
|
|||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -409,8 +411,15 @@ public class DesignController {
|
|||||||
public void upDesignDoc() {
|
public void upDesignDoc() {
|
||||||
CrmRequestUtil crmRequestUtil = new CrmRequestUtil();
|
CrmRequestUtil crmRequestUtil = new CrmRequestUtil();
|
||||||
|
|
||||||
|
long twoDaysAgo = LocalDateTime.now()
|
||||||
|
.minusDays(1)
|
||||||
|
.atZone(ZoneId.systemDefault())
|
||||||
|
.toInstant()
|
||||||
|
.toEpochMilli();
|
||||||
|
|
||||||
JSONObject getDesignBGDoc = crmRequestUtil.getCRMList(Arrays.asList(
|
JSONObject getDesignBGDoc = crmRequestUtil.getCRMList(Arrays.asList(
|
||||||
new Filter("EQ", "name", Arrays.asList("2025-06-20-00015"))
|
//new Filter("EQ", "name", Arrays.asList("2025-06-24-00007")),
|
||||||
|
new Filter("GT", "create_time", Arrays.asList(String.valueOf(twoDaysAgo)))
|
||||||
), "design_file__c__changeObj__c");
|
), "design_file__c__changeObj__c");
|
||||||
|
|
||||||
System.out.println("设计文件变更接口请求为:" + JSON.parseObject(JSON.toJSONString(getDesignBGDoc)));
|
System.out.println("设计文件变更接口请求为:" + JSON.parseObject(JSON.toJSONString(getDesignBGDoc)));
|
||||||
@ -484,8 +493,8 @@ public class DesignController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String deptERPCode = deptRes.getJSONObject("data").getJSONArray("dataList").getJSONObject(0).getString("field_Vj6sf__c");
|
String deptERPCode = deptRes.getJSONObject("data").getJSONArray("dataList").getJSONObject(0).getString("field_Vj6sf__c");
|
||||||
designBGDocMap.put("dept", "ZHY");//部门编码
|
//designBGDocMap.put("dept", "ZHY");//部门编码
|
||||||
//designBGDocMap.put("dept", deptERPCode);//部门
|
designBGDocMap.put("dept", deptERPCode);//部门
|
||||||
|
|
||||||
//申请日期
|
//申请日期
|
||||||
long changeDate = designBGDocData.getLong("changed_time");
|
long changeDate = designBGDocData.getLong("changed_time");
|
||||||
@ -515,8 +524,8 @@ public class DesignController {
|
|||||||
System.out.println("负责人数据为:" + ownerRes);
|
System.out.println("负责人数据为:" + ownerRes);
|
||||||
|
|
||||||
String ownerUserId = ownerRes.getJSONObject("data").getJSONArray("dataList").getJSONObject(0).getString("field_T1xid__c");
|
String ownerUserId = ownerRes.getJSONObject("data").getJSONArray("dataList").getJSONObject(0).getString("field_T1xid__c");
|
||||||
designBGDocData.put("bizuser", "ID-000016");//负责人
|
//designBGDocData.put("bizuser", "ID-000016");//负责人
|
||||||
//designBGDocMap.put("bizuser", ownerUserId);//申请人
|
designBGDocMap.put("bizuser", ownerUserId);//申请人
|
||||||
|
|
||||||
//采购组织
|
//采购组织
|
||||||
//判断组织编码
|
//判断组织编码
|
||||||
@ -581,6 +590,28 @@ public class DesignController {
|
|||||||
designDocDetailMap.put("supplier", "");
|
designDocDetailMap.put("supplier", "");
|
||||||
//项目号
|
//项目号
|
||||||
designDocDetailMap.put("project", designDocDetailData.getString("change_project_details__c__r") != null ? designDocDetailData.getString("change_project_details__c__r") : "");
|
designDocDetailMap.put("project", designDocDetailData.getString("change_project_details__c__r") != null ? designDocDetailData.getString("change_project_details__c__r") : "");
|
||||||
|
//客指料类型
|
||||||
|
designDocDetailMap.put("materialType", designDocDetailData.getString("change_customer_material_type__c") != null ? designDocDetailData.getString("change_customer_material_type__c") : "");
|
||||||
|
//是否现场直发
|
||||||
|
String isSiteDirectStr = designDocDetailData.getString("change_is_direct_delivery__c") != null ? designDocDetailData.getString("change_is_direct_delivery__c") : "";
|
||||||
|
|
||||||
|
switch (isSiteDirectStr) {
|
||||||
|
case "yes":
|
||||||
|
designDocDetailMap.put("isDirectDelivery", "YES");
|
||||||
|
break;
|
||||||
|
case "no":
|
||||||
|
designDocDetailMap.put("isDirectDelivery", "NO");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
designDocDetailMap.put("isDirectDelivery", "");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//直发现场时间
|
||||||
|
long siteDirectTime = designDocDetailData.getLong("change_direct_delivery_time__c") != null ? designDocDetailData.getLong("change_direct_delivery_time__c") : 0;
|
||||||
|
designDocDetailMap.put("deliveryTime", new Date(siteDirectTime));
|
||||||
|
//直发现场地点
|
||||||
|
designDocDetailMap.put("deliveryLocation", designDocDetailData.getString("change_direct_delivery_location__c") != null ? designDocDetailData.getString("change_direct_delivery_location__c") : "");
|
||||||
//需求日期
|
//需求日期
|
||||||
long reqDate = designDocDetailData.getLong("create_time");
|
long reqDate = designDocDetailData.getLong("create_time");
|
||||||
Date reqDateDate = new Date(reqDate);
|
Date reqDateDate = new Date(reqDate);
|
||||||
@ -594,7 +625,7 @@ public class DesignController {
|
|||||||
//行ID
|
//行ID
|
||||||
log.info("新增行");
|
log.info("新增行");
|
||||||
designDocDetailMap.put("changeType", "add");
|
designDocDetailMap.put("changeType", "add");
|
||||||
designDocDetailMap.put("crmEntryId", designDocDetailData.getString("_id"));
|
designDocDetailMap.put("crmEntryId", designDocDetailData.getString("original_detail_data"));
|
||||||
designDocDetailMap.put("lineType", "010");
|
designDocDetailMap.put("lineType", "010");
|
||||||
} else if (changeType.equals("update")) {
|
} else if (changeType.equals("update")) {
|
||||||
//变更类型为删除或者修改,获取源单的行id
|
//变更类型为删除或者修改,获取源单的行id
|
||||||
|
@ -18,6 +18,8 @@ import org.springframework.web.client.RestClientException;
|
|||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@ -359,8 +361,15 @@ public class FrameContractController {
|
|||||||
public void syncFrameContractBG() {
|
public void syncFrameContractBG() {
|
||||||
CrmRequestUtil crmRequestUtil = new CrmRequestUtil();
|
CrmRequestUtil crmRequestUtil = new CrmRequestUtil();
|
||||||
|
|
||||||
|
long twoDaysAgo = LocalDateTime.now()
|
||||||
|
.minusDays(1)
|
||||||
|
.atZone(ZoneId.systemDefault())
|
||||||
|
.toInstant()
|
||||||
|
.toEpochMilli();
|
||||||
|
|
||||||
JSONObject getFrameContract = crmRequestUtil.getCRMList(Arrays.asList(
|
JSONObject getFrameContract = crmRequestUtil.getCRMList(Arrays.asList(
|
||||||
new Filter("EQ", "name", Arrays.asList("2025-06-13-00002"))
|
//new Filter("EQ", "name", Arrays.asList("2025-06-13-00002"))
|
||||||
|
new Filter("GT", "create_time", Arrays.asList(String.valueOf(twoDaysAgo)))
|
||||||
), "framework_contract__c__changeObj__c");
|
), "framework_contract__c__changeObj__c");
|
||||||
|
|
||||||
JSONObject frameContractBGRes = new JSONObject();
|
JSONObject frameContractBGRes = new JSONObject();
|
||||||
|
@ -727,9 +727,9 @@ public class InvoiceController {
|
|||||||
|
|
||||||
JSONObject getInvoice = crmRequestUtil.getCRMList(Arrays.asList(
|
JSONObject getInvoice = crmRequestUtil.getCRMList(Arrays.asList(
|
||||||
//new Filter("EQ", "name", Arrays.asList("2025-06-14-0005")),
|
//new Filter("EQ", "name", Arrays.asList("2025-06-14-0005")),
|
||||||
new Filter("GT", "last_modified_time", Arrays.asList(String.valueOf(twoDaysAgo))),
|
new Filter("EQ", "life_status", Arrays.asList("invalid")),
|
||||||
new Filter("EQ", "life_status", Arrays.asList("invalid"))
|
new Filter("GT", "last_modified_time", Arrays.asList(String.valueOf(twoDaysAgo)))
|
||||||
), "ExpenseClaimFormObj");
|
), "InvoiceApplicationObj");
|
||||||
|
|
||||||
JSONObject invoiceRes = new JSONObject();
|
JSONObject invoiceRes = new JSONObject();
|
||||||
|
|
||||||
@ -828,7 +828,7 @@ public class InvoiceController {
|
|||||||
JSONObject logRes = new JSONObject();
|
JSONObject logRes = new JSONObject();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logRes = restTemplate.postForObject("http://localhost:18088/Log/insert/log_data", logMap, JSONObject.class);
|
logRes = restTemplate.postForObject("http://localhost:18085/Log/insert/log_data", logMap, JSONObject.class);
|
||||||
} catch (RestClientException e) {
|
} catch (RestClientException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@ import org.springframework.web.client.RestClientException;
|
|||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -334,8 +336,15 @@ public class PreContractController {
|
|||||||
public void bgPreContract() {
|
public void bgPreContract() {
|
||||||
CrmRequestUtil crmRequestUtil = new CrmRequestUtil();
|
CrmRequestUtil crmRequestUtil = new CrmRequestUtil();
|
||||||
|
|
||||||
|
long twoDaysAgo = LocalDateTime.now()
|
||||||
|
.minusDays(1)
|
||||||
|
.atZone(ZoneId.systemDefault())
|
||||||
|
.toInstant()
|
||||||
|
.toEpochMilli();
|
||||||
|
|
||||||
JSONObject preContractBGReq = crmRequestUtil.getCRMList(Arrays.asList(
|
JSONObject preContractBGReq = crmRequestUtil.getCRMList(Arrays.asList(
|
||||||
new Filter("EQ", "name", Arrays.asList("2025-06-13-00004"))
|
//new Filter("EQ", "name", Arrays.asList("2025-06-13-00004")),
|
||||||
|
new Filter("GT", "create_time", Arrays.asList(String.valueOf(twoDaysAgo)))
|
||||||
), "pre_signed_contract__c__changeObj__c");
|
), "pre_signed_contract__c__changeObj__c");
|
||||||
|
|
||||||
JSONObject preContractBGRes = new JSONObject();
|
JSONObject preContractBGRes = new JSONObject();
|
||||||
|
@ -733,7 +733,7 @@ public class ReimbursementController {
|
|||||||
JSONObject isLogRes = new JSONObject();
|
JSONObject isLogRes = new JSONObject();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
isLogRes = restTemplate.getForObject("http://localhost:18085/Log/query/log_data?table=send_log_fybx&log_type=CL&dataId=" + erpId + "&mark=" + bizDate, JSONObject.class);
|
isLogRes = restTemplate.getForObject("http://localhost:18085/Log/query/log_data?table=send_log_fybx&log_type=CLFY&dataId=" + erpId + "&mark=" + bizDate, JSONObject.class);
|
||||||
} catch (RestClientException e) {
|
} catch (RestClientException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -906,7 +906,7 @@ public class ReimbursementController {
|
|||||||
//开始封装日志
|
//开始封装日志
|
||||||
Map logMap = new HashMap<>();
|
Map logMap = new HashMap<>();
|
||||||
logMap.put("log_id", UUID.randomUUID().toString().replace("-", ""));
|
logMap.put("log_id", UUID.randomUUID().toString().replace("-", ""));
|
||||||
logMap.put("log_type", "FY");
|
logMap.put("log_type", "CLFY");
|
||||||
logMap.put("data_name", billNo);
|
logMap.put("data_name", billNo);
|
||||||
logMap.put("data_id", erpId);
|
logMap.put("data_id", erpId);
|
||||||
logMap.put("mark", bizDate);
|
logMap.put("mark", bizDate);
|
||||||
|
@ -19,6 +19,8 @@ import org.springframework.web.client.RestClientException;
|
|||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -515,8 +517,15 @@ public class XSHTController {
|
|||||||
public void XSHTBGSync() {
|
public void XSHTBGSync() {
|
||||||
CrmRequestUtil crmRequestUtil = new CrmRequestUtil();
|
CrmRequestUtil crmRequestUtil = new CrmRequestUtil();
|
||||||
|
|
||||||
|
long twoDaysAgo = LocalDateTime.now()
|
||||||
|
.minusDays(1)
|
||||||
|
.atZone(ZoneId.systemDefault())
|
||||||
|
.toInstant()
|
||||||
|
.toEpochMilli();
|
||||||
|
|
||||||
JSONObject getContract = crmRequestUtil.getCRMList(Arrays.asList(
|
JSONObject getContract = crmRequestUtil.getCRMList(Arrays.asList(
|
||||||
new Filter("EQ", "name", Arrays.asList("2025-06-18-00007"))
|
//new Filter("EQ", "name", Arrays.asList("ZHY25062476-04")),
|
||||||
|
new Filter("GT", "create_time", Arrays.asList(String.valueOf(twoDaysAgo)))
|
||||||
), "SaleContractChangeObj");
|
), "SaleContractChangeObj");
|
||||||
|
|
||||||
JSONObject contractBGRes = new JSONObject();
|
JSONObject contractBGRes = new JSONObject();
|
||||||
@ -622,8 +631,8 @@ public class XSHTController {
|
|||||||
|
|
||||||
//开始获取部门
|
//开始获取部门
|
||||||
String deptERPCode = deptRes.getJSONObject("data").getJSONArray("dataList").getJSONObject(0).getString("field_Vj6sf__c");
|
String deptERPCode = deptRes.getJSONObject("data").getJSONArray("dataList").getJSONObject(0).getString("field_Vj6sf__c");
|
||||||
//contractBGMap.put("dept", deptERPCode);//部门编码
|
contractBGMap.put("dept", deptERPCode);//部门编码
|
||||||
contractBGMap.put("dept", "zyierp");//部门编码
|
//contractBGMap.put("dept", "zyierp");//部门编码
|
||||||
|
|
||||||
List ownerId = contractBGData.getJSONArray("owner") != null ? contractBGData.getJSONArray("owner") : new ArrayList<>();
|
List ownerId = contractBGData.getJSONArray("owner") != null ? contractBGData.getJSONArray("owner") : new ArrayList<>();
|
||||||
|
|
||||||
@ -647,8 +656,8 @@ public class XSHTController {
|
|||||||
System.out.println("负责人数据为:" + ownerRes);
|
System.out.println("负责人数据为:" + ownerRes);
|
||||||
|
|
||||||
String ownerUserId = ownerRes.getJSONObject("data").getJSONArray("dataList").getJSONObject(0).getString("field_T1xid__c");
|
String ownerUserId = ownerRes.getJSONObject("data").getJSONArray("dataList").getJSONObject(0).getString("field_T1xid__c");
|
||||||
//contractBGMap.put("operator", ownerUserId);//负责人
|
contractBGMap.put("operator", ownerUserId);//负责人
|
||||||
contractBGMap.put("operator", "ID-000016");//负责人
|
//contractBGMap.put("operator", "ID-000016");//负责人
|
||||||
|
|
||||||
//是否招投标
|
//是否招投标
|
||||||
Boolean isBidding = null;
|
Boolean isBidding = null;
|
||||||
@ -753,11 +762,11 @@ public class XSHTController {
|
|||||||
String changeType = contractBGDetailData.getString("changed_type") != null ? contractBGDetailData.getString("changed_type") : "";
|
String changeType = contractBGDetailData.getString("changed_type") != null ? contractBGDetailData.getString("changed_type") : "";
|
||||||
|
|
||||||
if (changeType.equals("add")) {
|
if (changeType.equals("add")) {
|
||||||
log.info("删除行");
|
log.info("新增行");
|
||||||
//变更类型为新增,获取当前的行ID
|
//变更类型为新增,获取当前的行ID
|
||||||
contractBGDetailMap.put("changeType", "add");
|
contractBGDetailMap.put("changeType", "add");
|
||||||
//行ID
|
//行ID
|
||||||
contractBGDetailMap.put("crmentryid", contractBGDetailData.getString("_id"));
|
contractBGDetailMap.put("crmentryid", contractBGDetailData.getString("original_detail_data"));
|
||||||
//物料编码
|
//物料编码
|
||||||
String material = contractBGDetailData.getString("change_product_id") != null ? contractBGDetailData.getString("change_product_id") : "";
|
String material = contractBGDetailData.getString("change_product_id") != null ? contractBGDetailData.getString("change_product_id") : "";
|
||||||
|
|
||||||
|
@ -56,26 +56,30 @@ public class CrmTask {
|
|||||||
* @return void
|
* @return void
|
||||||
* @Author weiloong_zhang
|
* @Author weiloong_zhang
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 0/1 * * * ?")
|
// @Scheduled(cron = "0 0/1 * * * ?")
|
||||||
private void configureTasks() throws Exception {
|
// private void configureTasks() throws Exception {
|
||||||
System.out.println("开始同步ERP数据");
|
// System.out.println("开始同步ERP数据");
|
||||||
crmTokenController.tokenReSync();
|
// crmTokenController.tokenReSync();
|
||||||
preContractController.syncContract();
|
// preContractController.syncContract();
|
||||||
frameContractController.syncFrameContract();
|
// preContractController.bgPreContract();
|
||||||
xshtController.syncXSHT();
|
// frameContractController.syncFrameContract();
|
||||||
xshtController.isComplete();
|
// frameContractController.syncFrameContractBG();
|
||||||
designController.syncDesign();
|
// xshtController.syncXSHT();
|
||||||
goodsPlanController.syncGoodsPlan();
|
// xshtController.XSHTBGSync();
|
||||||
invoiceController.syncInvoice();
|
// xshtController.isComplete();
|
||||||
invoiceController.syncRedInvoice();
|
// designController.syncDesign();
|
||||||
invoiceController.deleteInvoice();
|
// designController.upDesignDoc();
|
||||||
qualityBackController.qualityFeedBack();
|
// goodsPlanController.syncGoodsPlan();
|
||||||
tenderingController.syncTendering();
|
// invoiceController.syncInvoice();
|
||||||
bankInfoController.syncBankInfo();
|
// invoiceController.syncRedInvoice();
|
||||||
reimbursementController.syncReimbursement();
|
// invoiceController.deleteInvoice();
|
||||||
reimbursementController.syncPublicExpenses();
|
// qualityBackController.qualityFeedBack();
|
||||||
reimbursementController.syncTravelExpenses();
|
// tenderingController.syncTendering();
|
||||||
System.out.println("ERP数据执行完毕");
|
// bankInfoController.syncBankInfo();
|
||||||
}
|
// reimbursementController.syncReimbursement();
|
||||||
|
// reimbursementController.syncPublicExpenses();
|
||||||
|
// reimbursementController.syncTravelExpenses();
|
||||||
|
// System.out.println("ERP数据执行完毕");
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,16 +35,16 @@ public class CrmTaskTZ {
|
|||||||
* @return void
|
* @return void
|
||||||
* @Author weiloong_zhang
|
* @Author weiloong_zhang
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 0/2 * * * ?")
|
// @Scheduled(cron = "0 0/2 * * * ?")
|
||||||
private void configureTasks() throws Exception {
|
// private void configureTasks() throws Exception {
|
||||||
System.out.println("开始同步台账数据");
|
// System.out.println("开始同步台账数据");
|
||||||
projectInitiateController.syncProjectInitiate();
|
// projectInitiateController.syncProjectInitiate();
|
||||||
deliveryReqController.syncDeliveryReq();
|
// deliveryReqController.syncDeliveryReq();
|
||||||
deliveryReqController.syncRefund();
|
// deliveryReqController.syncRefund();
|
||||||
deviceInstallController.syncDeviceInstall();
|
// deviceInstallController.syncDeviceInstall();
|
||||||
deviceInstallController.upDeviceInstall();
|
// deviceInstallController.upDeviceInstall();
|
||||||
xshtController.syncSaleOrder();
|
// xshtController.syncSaleOrder();
|
||||||
yqhtController.syncYQHT();
|
// yqhtController.syncYQHT();
|
||||||
System.out.println("台账执行完毕");
|
// System.out.println("台账执行完毕");
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user