四个变更单加要货计划明细新增字段
This commit is contained in:
parent
a12d7374d2
commit
14a2c49c8c
@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import org.springframework.web.client.RestClientException;
|
import org.springframework.web.client.RestClientException;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -185,7 +186,7 @@ public class DesignController {
|
|||||||
//erpDesignMap.put("bizuser_number", "ID-000011");//人员编码
|
//erpDesignMap.put("bizuser_number", "ID-000011");//人员编码
|
||||||
erpDesignMap.put("bizuser_number", ownerCode);//人员编码
|
erpDesignMap.put("bizuser_number", ownerCode);//人员编码
|
||||||
erpDesignMap.put("bizorg_number", orgCode);//采购组织
|
erpDesignMap.put("bizorg_number", orgCode);//采购组织
|
||||||
erpDesignMap.put("project_number", "SJ20250424-0033");//todo 项目号(商机)
|
erpDesignMap.put("project_number", designDocData.getString("project_id__c") != null ? designDocData.getString("project_id__c") : "");//项目号(商机)
|
||||||
erpDesignMap.put("contractno", designDocData.getString("sales_contract_number__c__r"));//合同号
|
erpDesignMap.put("contractno", designDocData.getString("sales_contract_number__c__r"));//合同号
|
||||||
erpDesignMap.put("crmid", designDocId);//crm唯一id
|
erpDesignMap.put("crmid", designDocId);//crm唯一id
|
||||||
erpDesignMap.put("comment", designDocData.getString("remark__c") != null ? designDocData.getString("remark__c") : "");//备注
|
erpDesignMap.put("comment", designDocData.getString("remark__c") != null ? designDocData.getString("remark__c") : "");//备注
|
||||||
@ -364,201 +365,203 @@ public class DesignController {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设计文件更新接口
|
* 设计文件变更接口
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @Author weiloong_zhang
|
* @Author weiloong_zhang
|
||||||
*/
|
*/
|
||||||
@PostMapping("/syncUp/designDoc")
|
@PostMapping("/sync/designDocBG")
|
||||||
public void upDesignDoc() {
|
public void upDesignDoc() {
|
||||||
CrmRequestUtil crmRequestUtil = new CrmRequestUtil();
|
CrmRequestUtil crmRequestUtil = new CrmRequestUtil();
|
||||||
log.info("开始同步设计文件");
|
|
||||||
|
|
||||||
JSONObject getDesignDoc = crmRequestUtil.getCRMList(Arrays.asList(
|
JSONObject getDesignBGDoc = crmRequestUtil.getCRMList(Arrays.asList(
|
||||||
new Filter("EQ", "name", Arrays.asList("SJWJ250509-0003"))
|
new Filter("EQ", "name", Arrays.asList("2025-06-13-00007"))
|
||||||
), "design_file__c");
|
), "design_file__c__changeObj__c");
|
||||||
|
|
||||||
JSONObject designDocRes = new JSONObject();
|
System.out.println("设计文件变更接口请求为:" + JSON.parseObject(JSON.toJSONString(getDesignBGDoc)));
|
||||||
|
|
||||||
|
JSONObject designBGDocRes = new JSONObject();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
designDocRes = restTemplate.postForObject(URLConstant.GET_CUSTOMIZE_LIST_URL, getDesignDoc, JSONObject.class);
|
designBGDocRes = restTemplate.postForObject(URLConstant.GET_CUSTOMIZE_LIST_URL, getDesignBGDoc, JSONObject.class);
|
||||||
} catch (RestClientException e) {
|
} catch (RestClientException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!"success".equals(designDocRes.getString("errorDescription")) || designDocRes.getJSONObject("data").getJSONArray("dataList").isEmpty()) {
|
System.out.println("设计文件变更结果为:" + JSON.parseObject(JSON.toJSONString(designBGDocRes)));
|
||||||
log.info("查询失败或者不存在符合条件的数据");
|
|
||||||
|
if (!"success".equals(designBGDocRes.getString("errorDescription")) || designBGDocRes.getJSONObject("data").getJSONArray("dataList").isEmpty()) {
|
||||||
|
log.info("未找到设计文件变更数据或者查询失败");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("查询成功,继续向下执行");
|
log.info("当前设计文件变更数据存在");
|
||||||
|
for (Object designBGDocObj : designBGDocRes.getJSONObject("data").getJSONArray("dataList")) {
|
||||||
|
JSONObject designBGDocData = JSON.parseObject(JSON.toJSONString(designBGDocObj));
|
||||||
|
|
||||||
for (Object designDocObj : designDocRes.getJSONObject("data").getJSONArray("dataList")) {
|
System.out.println("当前正在处理的设计文件变更数据为:" + designBGDocData);
|
||||||
JSONObject designDocData = JSON.parseObject(JSON.toJSONString(designDocObj));
|
|
||||||
|
|
||||||
System.out.println("当前正在处理的设计文件数据为:" + designDocData);
|
//开始截取关键数据
|
||||||
|
String designBGDocId = designBGDocData.getString("_id");
|
||||||
|
String designBGDocName = designBGDocData.getString("name");
|
||||||
|
String createTime = designBGDocData.getString("create_time");
|
||||||
|
String originalName = designBGDocData.getString("original_data__r");
|
||||||
|
String originalId = designBGDocData.getString("original_data");
|
||||||
|
|
||||||
//当前设计文件的唯一id
|
//开始判断该单据是否已经执行过
|
||||||
String designDocId = designDocData.getString("_id");
|
JSONObject isLogRes = new JSONObject();
|
||||||
|
|
||||||
//当前单据的编号
|
|
||||||
String designDocName = designDocData.getString("name");
|
|
||||||
|
|
||||||
//当前单据的创建时间
|
|
||||||
String createTime = designDocData.getString("create_time");
|
|
||||||
|
|
||||||
//开始查询该单据是否已经集成过
|
|
||||||
JSONObject isLog = new JSONObject();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
isLog = restTemplate.getForObject("http://localhost:18085/Log/query/log_data?table=send_log_sjwj&log_type=DFUP&dataId=" + designDocId + "&mark=" + createTime, JSONObject.class);
|
isLogRes = restTemplate.getForObject("http://localhost:18085/Log/query/log_data?table=send_log_sjwj&log_type=DFBG&dataId=" + designBGDocId + "&mark=" + createTime, JSONObject.class);
|
||||||
} catch (RestClientException e) {
|
} catch (RestClientException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
//判断是否已经执行过
|
if (!isLogRes.getJSONArray("data").isEmpty()) {
|
||||||
if (!isLog.getJSONArray("data").isEmpty()) {
|
log.info("当前数据已经执行过了,将不再向下执行");
|
||||||
log.info("当前单据已经集成过了,将不再向下执行");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("当前单据没有集成过,将开始向下执行");
|
log.info("日志不存在,将继续向下执行");
|
||||||
|
|
||||||
//开始封装传输至ERP中的请求
|
//开始封装主表数据
|
||||||
String erpId = designDocData.getString("erp_id__c") != null ? designDocData.getString("erp_id__c") : "";
|
Map designBGDocMap = new HashMap();
|
||||||
|
|
||||||
if ("".equals(erpId)) {
|
//开始获取部门数据
|
||||||
log.info("当前单据erp_id__c为空,不再向下执行");
|
//获取部门
|
||||||
continue;
|
String ownerDept = designBGDocData.getString("owner_department_id") != null ? designBGDocData.getString("owner_department_id") : "";
|
||||||
}
|
|
||||||
|
|
||||||
Map erpDesignMap = new HashMap<>();
|
JSONObject getDept = crmRequestUtil.getCRMList(Arrays.asList(
|
||||||
erpDesignMap.put("id", erpId);//erpId
|
new Filter("EQ", "_id", Arrays.asList(ownerDept))
|
||||||
erpDesignMap.put("billno", designDocName);//设计文件编号
|
|
||||||
|
|
||||||
//判断组织编码
|
|
||||||
String orgCode = "";
|
|
||||||
if (designDocData.getString("erp_organization_sales_con__c__v") != null && !"".equals(designDocData.getString("erp_organization_sales_con__c__v"))) {
|
|
||||||
orgCode = designDocData.getString("erp_organization_sales_con__c__v");
|
|
||||||
} else if (designDocData.getString("erp_organization_pre_contr__c__v") != null && !"".equals(designDocData.getString("erp_organization_pre_contr__c__v"))) {
|
|
||||||
orgCode = designDocData.getString("erp_organization_pre_contr__c__v");
|
|
||||||
} else {
|
|
||||||
log.info("当前单据没有组织编码,将不再向下执行");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
erpDesignMap.put("org_number", orgCode);//组织编码
|
|
||||||
erpDesignMap.put("billtype_number", "pm_requirapplybill_STD_BT_S");//单据类型
|
|
||||||
erpDesignMap.put("biztype_name", "物料类采购");//业务类型
|
|
||||||
|
|
||||||
//开始获取单据日期
|
|
||||||
long bizTime = designDocData.getLong("document_date__c");
|
|
||||||
Date date = new Date(bizTime);
|
|
||||||
|
|
||||||
erpDesignMap.put("biztime", date);//单据日期
|
|
||||||
|
|
||||||
//部门编码
|
|
||||||
String deptCode = "";
|
|
||||||
|
|
||||||
List deptIdList = designDocData.getJSONArray("data_own_department");
|
|
||||||
|
|
||||||
//开始查询部门编码
|
|
||||||
JSONObject deptReq = crmRequestUtil.getCRMList(Arrays.asList(
|
|
||||||
new Filter("EQ", "_id", deptIdList)
|
|
||||||
), "DepartmentObj");
|
), "DepartmentObj");
|
||||||
|
|
||||||
JSONObject deptRes = new JSONObject();
|
JSONObject deptRes = new JSONObject();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
deptRes = restTemplate.postForObject(URLConstant.GET_CRM_LIST_URL, deptReq, JSONObject.class);
|
deptRes = restTemplate.postForObject(URLConstant.GET_CRM_LIST_URL, getDept, JSONObject.class);
|
||||||
} catch (RestClientException e) {
|
} catch (RestClientException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("success".equals(deptRes.getString("errorDescription")) && !deptRes.getJSONObject("data").getJSONArray("dataList").isEmpty()) {
|
if (!"success".equals(deptRes.getString("errorDescription")) || deptRes.getJSONObject("data").getJSONArray("dataList").isEmpty()) {
|
||||||
JSONObject deptData = deptRes.getJSONObject("data").getJSONArray("dataList").getJSONObject(0);
|
log.info("不存在该部门,将不再向下执行");
|
||||||
deptCode = deptData.getString("field_Vj6sf__c") != null ? deptData.getString("field_Vj6sf__c") : "";
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//erpDesignMap.put("dept_number", "ZHY");//部门编码
|
String deptERPCode = deptRes.getJSONObject("data").getJSONArray("dataList").getJSONObject(0).getString("field_Vj6sf__c");
|
||||||
erpDesignMap.put("dept_number", deptCode);//部门编码
|
designBGDocMap.put("dept", "ZHY");//部门编码
|
||||||
|
//designBGDocMap.put("dept", deptERPCode);//部门
|
||||||
|
|
||||||
//获取负责人编码
|
//申请日期
|
||||||
String ownerCode = "";
|
long changeDate = designBGDocData.getLong("changed_time");
|
||||||
|
|
||||||
List ownerIdList = designDocData.getJSONArray("owner");
|
Date changeDateFormat = new Date(changeDate);
|
||||||
|
designBGDocMap.put("biztime", changeDateFormat);//申请日期
|
||||||
|
//申请人
|
||||||
|
List ownerId = designBGDocData.getJSONArray("change_owner") != null ? designBGDocData.getJSONArray("change_owner") : new ArrayList<>();
|
||||||
|
|
||||||
JSONObject ownerReq = crmRequestUtil.getCRMList(Arrays.asList(
|
JSONObject getOwner = crmRequestUtil.getCRMList(Arrays.asList(
|
||||||
new Filter("EQ", "user_id", ownerIdList)
|
new Filter("EQ", "user_id", ownerId)
|
||||||
), "PersonnelObj");
|
), "PersonnelObj");
|
||||||
|
|
||||||
JSONObject ownerRes = new JSONObject();
|
JSONObject ownerRes = new JSONObject();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ownerRes = restTemplate.postForObject(URLConstant.GET_CRM_LIST_URL, ownerReq, JSONObject.class);
|
ownerRes = restTemplate.postForObject(URLConstant.GET_CRM_LIST_URL, getOwner, JSONObject.class);
|
||||||
} catch (RestClientException e) {
|
} catch (RestClientException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("success".equals(ownerRes.getString("errorDescription")) && !ownerRes.getJSONObject("data").getJSONArray("dataList").isEmpty()) {
|
if (!"success".equals(ownerRes.getString("errorDescription")) || ownerRes.getJSONObject("data").getJSONArray("dataList").isEmpty()) {
|
||||||
JSONObject ownerData = ownerRes.getJSONObject("data").getJSONArray("dataList").getJSONObject(0);
|
log.info("负责人不存在或者请求失败");
|
||||||
ownerCode = ownerData.getString("field_T1xid__c") != null ? ownerData.getString("field_T1xid__c") : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
//erpDesignMap.put("bizuser_number", "ID-000011");//人员编码
|
|
||||||
erpDesignMap.put("bizuser_number", ownerCode);//人员编码
|
|
||||||
erpDesignMap.put("bizorg_number", orgCode);//采购组织
|
|
||||||
erpDesignMap.put("project_number", designDocData.getString("project_id__c"));//todo 项目号(商机)
|
|
||||||
erpDesignMap.put("contractno", designDocData.getString("sales_contract_number__c__r"));//合同号
|
|
||||||
erpDesignMap.put("crmid", designDocId);//crm唯一id
|
|
||||||
erpDesignMap.put("comment", designDocData.getString("remark__c") != null ? designDocData.getString("remark__c") : "");//备注
|
|
||||||
|
|
||||||
|
|
||||||
//开始获取设计文件明细
|
|
||||||
JSONObject getDesignDocDetail = crmRequestUtil.getCRMList(Arrays.asList(
|
|
||||||
new Filter("EQ", "design_file__c", Arrays.asList(designDocId))
|
|
||||||
), "design_file_details__c");
|
|
||||||
|
|
||||||
JSONObject designDocDetailRes = new JSONObject();
|
|
||||||
|
|
||||||
try {
|
|
||||||
designDocDetailRes = restTemplate.postForObject(URLConstant.GET_CUSTOMIZE_LIST_URL, getDesignDocDetail, JSONObject.class);
|
|
||||||
} catch (RestClientException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!"success".equals(designDocDetailRes.getString("errorDescription")) || designDocDetailRes.getJSONObject("data").getJSONArray("dataList").isEmpty()) {
|
|
||||||
log.info("查询失败或不存在当前设计文件明细");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
List designDocList = new ArrayList<>();
|
System.out.println("负责人数据为:" + ownerRes);
|
||||||
|
|
||||||
for (Object designDocDetailObj : designDocDetailRes.getJSONObject("data").getJSONArray("dataList")) {
|
String ownerUserId = ownerRes.getJSONObject("data").getJSONArray("dataList").getJSONObject(0).getString("field_T1xid__c");
|
||||||
JSONObject designDocDetailData = JSON.parseObject(JSON.toJSONString(designDocDetailObj));
|
designBGDocData.put("bizuser", "ID-000016");//负责人
|
||||||
|
//designBGDocMap.put("bizuser", ownerUserId);//申请人
|
||||||
System.out.println("当前正在处理的设计文件明细数据为:" + designDocDetailData);
|
|
||||||
|
|
||||||
//开始封装设计文件明细
|
|
||||||
Map designDocDetailMap = new HashMap<>();
|
|
||||||
designDocDetailMap.put("materialmasterid_number", designDocDetailData.getString("material_name__c"));//设计文件明细
|
|
||||||
designDocDetailMap.put("qty", designDocDetailData.getBigDecimal("quantity__c") != null ? designDocDetailData.getBigDecimal("quantity__c") : 0);//数量
|
|
||||||
designDocDetailMap.put("materialtype", designDocDetailData.getString("customer_material_type__c"));//客指供应类型
|
|
||||||
designDocDetailMap.put("crmentryid", designDocDetailData.getString("_id"));//crm明细行id
|
|
||||||
designDocDetailMap.put("entrycomment", designDocDetailData.getString("remark__c") != null ? designDocDetailData.getString("remark__c") : "");//备注
|
|
||||||
designDocDetailMap.put("supplier_number", "G08000001");//todo 建议供应商
|
|
||||||
|
|
||||||
designDocList.add(designDocDetailMap);
|
|
||||||
|
|
||||||
|
//采购组织
|
||||||
|
//判断组织编码
|
||||||
|
String orgCode = "";
|
||||||
|
if (designBGDocData.getString("change_erp_organization_sales_con__c") != null && !"".equals(designBGDocData.getString("change_erp_organization_sales_con__c"))) {
|
||||||
|
orgCode = designBGDocData.getString("change_erp_organization_sales_con__c");
|
||||||
|
} else if (designBGDocData.getString("change_erp_organization_pre_contr__c") != null && !"".equals(designBGDocData.getString("change_erp_organization_pre_contr__c"))) {
|
||||||
|
orgCode = designBGDocData.getString("change_erp_organization_pre_contr__c");
|
||||||
|
} else {
|
||||||
|
log.info("当前单据没有组织编码,将不再向下执行");
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
erpDesignMap.put("billentry", designDocList);
|
designBGDocMap.put("bizorg", orgCode);//采购组织
|
||||||
|
//销售合同号
|
||||||
|
designBGDocMap.put("contractno", designBGDocData.getString("change_sales_contract_number__c__r") != null ? designBGDocData.getString("change_sales_contract_number__c__r") : "");
|
||||||
|
//项目号
|
||||||
|
designBGDocMap.put("project", designBGDocData.getString("change_project_id__c") != null ? designBGDocData.getString("change_project_id__c") : "");
|
||||||
|
//CRMID
|
||||||
|
designBGDocMap.put("crmid", originalId);
|
||||||
|
//ERPID
|
||||||
|
designBGDocMap.put("erpId", designBGDocData.getString("change_erp_id__c") != null ? designBGDocData.getString("change_erp_id__c") : "");
|
||||||
|
|
||||||
Map erpContractData = new HashMap<>();
|
String changeReason = designBGDocData.getString("changed_reason") != null ? designBGDocData.getString("changed_reason") : "";
|
||||||
erpContractData.put("data", Arrays.asList(erpDesignMap));//请求体
|
|
||||||
|
|
||||||
System.out.println("erp请求为:" + JSON.parseObject(JSON.toJSONString(erpContractData)));
|
//开始获取EP明细
|
||||||
|
JSONObject getDesignDocDetails = crmRequestUtil.getCRMList(Arrays.asList(
|
||||||
|
new Filter("EQ", "changed_data", Arrays.asList(designBGDocId))
|
||||||
|
), "design_file_details__c__changeObj__c");
|
||||||
|
|
||||||
|
JSONObject designDocDetailsRes = new JSONObject();
|
||||||
|
|
||||||
|
try {
|
||||||
|
designDocDetailsRes = restTemplate.postForObject(URLConstant.GET_CUSTOMIZE_LIST_URL, getDesignDocDetails, JSONObject.class);
|
||||||
|
} catch (RestClientException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!"success".equals(designDocDetailsRes.getString("errorDescription")) || designDocDetailsRes.getJSONObject("data").getJSONArray("dataList").isEmpty()) {
|
||||||
|
log.info("请求失败或者该变更单不存在明细,将不再向下执行");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("设计文件变更单明细存在,将继续向下执行");
|
||||||
|
|
||||||
|
List designDocDetailList = new ArrayList();
|
||||||
|
|
||||||
|
for (Object designDocDetailObj : designDocDetailsRes.getJSONObject("data").getJSONArray("dataList")) {
|
||||||
|
JSONObject designDocDetailData = JSON.parseObject(JSON.toJSONString(designDocDetailObj));
|
||||||
|
|
||||||
|
System.out.println("设计文件变更单明细数据为:" + designDocDetailData);
|
||||||
|
|
||||||
|
//开始封装设计文件变更单明细数据
|
||||||
|
Map designDocDetailMap = new HashMap();
|
||||||
|
//物料编码
|
||||||
|
designDocDetailMap.put("material", designDocDetailData.getString("change_material_id__c__r") != null ? designDocDetailData.getString("change_material_id__c__r") : "");
|
||||||
|
//数量
|
||||||
|
designDocDetailMap.put("qty", designDocDetailData.getBigDecimal("change_quantity__c") != null ? designDocDetailData.getBigDecimal("change_quantity__c") : BigDecimal.ZERO);
|
||||||
|
//需求原因
|
||||||
|
designDocDetailMap.put("reqdes", changeReason);
|
||||||
|
//todo 建议供应商
|
||||||
|
designDocDetailMap.put("supplier", "");
|
||||||
|
//项目号
|
||||||
|
designDocDetailMap.put("project", designDocDetailData.getString("change_project_details__c__r") != null ? designDocDetailData.getString("change_project_details__c__r") : "");
|
||||||
|
//需求日期
|
||||||
|
long reqDate = designDocDetailData.getLong("create_time");
|
||||||
|
Date reqDateDate = new Date(reqDate);
|
||||||
|
designDocDetailMap.put("reqdate", reqDateDate);
|
||||||
|
//CRM行ID
|
||||||
|
designDocDetailMap.put("crmEntryId", designDocDetailData.getString("original_detail_data"));
|
||||||
|
//ERP行明细
|
||||||
|
designDocDetailMap.put("entryId", designDocDetailData.getString("change_erp_line_id__c") != null ? designDocDetailData.getString("change_erp_line_id__c") : "");
|
||||||
|
|
||||||
|
designDocDetailList.add(designDocDetailMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
//开始封装明细
|
||||||
|
designBGDocMap.put("entryList", designDocDetailList);
|
||||||
|
|
||||||
|
//开始获取ERPToken
|
||||||
String accessToken = new KDTokenController().getKDAccessTokenTest();
|
String accessToken = new KDTokenController().getKDAccessTokenTest();
|
||||||
|
|
||||||
if (accessToken == null || accessToken.equals("")) {
|
if (accessToken == null || accessToken.equals("")) {
|
||||||
@ -572,61 +575,62 @@ public class DesignController {
|
|||||||
headers.set("accessToken", accessToken);
|
headers.set("accessToken", accessToken);
|
||||||
headers.set("Idempotency-Key", uuid);
|
headers.set("Idempotency-Key", uuid);
|
||||||
|
|
||||||
HttpEntity designDocReqEntity = new HttpEntity(erpContractData, headers);
|
HttpEntity designDocReqEntity = new HttpEntity(designBGDocMap, headers);
|
||||||
|
|
||||||
System.out.println("请求为:" + JSON.parseObject(JSON.toJSONString(designDocReqEntity)));
|
System.out.println(JSON.parseObject(JSON.toJSONString(designDocReqEntity)));
|
||||||
|
|
||||||
//开始向金蝶发起请求
|
String designUrl = ERPURLConstant.ERP_URL + "/ierp/kapi/v2/f9w5/pssc/requirapply/change";
|
||||||
String designPlanUrl = ERPURLConstant.ERP_URL + "/ierp/kapi/v2/f9w5/pssc/pm_requirapplybill/requirapplybillSave";
|
|
||||||
|
|
||||||
JSONObject erpDesignDocRes = new JSONObject();
|
JSONObject designDocRes = new JSONObject();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
erpDesignDocRes = restTemplate.postForObject(designPlanUrl, designDocReqEntity, JSONObject.class);
|
designDocRes = restTemplate.postForObject(designUrl, designDocReqEntity, JSONObject.class);
|
||||||
} catch (RestClientException e) {
|
} catch (RestClientException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("设计文件结果为:" + JSON.parseObject(JSON.toJSONString(erpDesignDocRes)));
|
System.out.println(JSON.parseObject(JSON.toJSONString(designDocRes)));
|
||||||
|
|
||||||
//开始封装回写程序
|
//开始封装回写程序
|
||||||
Map backReqMap = new HashMap();
|
Map backReqMap = new HashMap();
|
||||||
backReqMap.put("_id", designDocId);
|
backReqMap.put("_id", originalId);
|
||||||
backReqMap.put("dataObjectApiName", "design_file__c");
|
backReqMap.put("dataObjectApiName", "design_file__c");
|
||||||
|
|
||||||
//开始封装日志
|
//开始封装日志
|
||||||
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", "DFUP");
|
logMap.put("log_type", "DFBG");
|
||||||
logMap.put("syn_type", "0");
|
logMap.put("syn_type", "0");
|
||||||
logMap.put("data_name", designDocName);
|
logMap.put("data_name", designBGDocName);
|
||||||
logMap.put("data_id", designDocId);
|
logMap.put("data_id", designBGDocId);
|
||||||
logMap.put("mark", createTime);
|
logMap.put("mark", createTime);
|
||||||
logMap.put("send_body", JSON.toJSONString(designDocReqEntity));
|
logMap.put("send_body", JSON.toJSONString(designDocReqEntity));
|
||||||
logMap.put("send_res", JSON.toJSONString(erpDesignDocRes));
|
logMap.put("send_res", JSON.toJSONString(designDocRes));
|
||||||
logMap.put("tableName", "send_log_sjwj");
|
logMap.put("tableName", "send_log_sjwj");
|
||||||
|
|
||||||
//判断是否执行成功
|
//判断是否执行成功
|
||||||
if ("0".equals(erpDesignDocRes.getString("errorCode"))) {
|
if ("0".equals(designDocRes.getString("errorCode"))) {
|
||||||
//同步成功
|
//同步成功
|
||||||
logMap.put("log_status", "0");
|
logMap.put("log_status", "0");
|
||||||
logMap.put("res_body", "同步成功");
|
logMap.put("res_body", "同步成功");
|
||||||
backReqMap.put("erp_id__c", erpDesignDocRes.getJSONObject("data").getJSONArray("result").getJSONObject(0).getString("id"));
|
//backReqMap.put("updated_erp_id__c", contractRes.getJSONObject("data").getJSONArray("result").getJSONObject(0).getString("id"));
|
||||||
backReqMap.put("sync_status__c", "option_sync_success__c");
|
backReqMap.put("sync_status__c", "option_sync_success__c");
|
||||||
backReqMap.put("response_info__c", "同步成功");
|
backReqMap.put("response_info__c", "变更同步成功");
|
||||||
|
|
||||||
|
//开始审核
|
||||||
|
// KingDeeUtils kingDeeUtils = new KingDeeUtils();
|
||||||
|
// kingDeeUtils.audit(contractRes.getJSONObject("data").getJSONArray("result").getJSONObject(0).getString("id"), "conm_salcontract");
|
||||||
} else {
|
} else {
|
||||||
//同步失败
|
//同步失败
|
||||||
logMap.put("log_status", "1");
|
logMap.put("log_status", "1");
|
||||||
logMap.put("res_body", "同步失败:" + erpDesignDocRes.getString("message"));
|
logMap.put("res_body", "同步失败:" + designDocRes.getString("message"));
|
||||||
backReqMap.put("sync_status__c", "option_sync_failure__c");
|
backReqMap.put("sync_status__c", "option_sync_failure__c");
|
||||||
backReqMap.put("response_info__c", erpDesignDocRes.getString("message"));
|
backReqMap.put("response_info__c", "变更失败:" + designDocRes.getString("message"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//开始回写
|
//开始回写
|
||||||
JSONObject backReq = crmRequestUtil.updateCRM(backReqMap);
|
JSONObject backReq = crmRequestUtil.updateCRM(backReqMap);
|
||||||
|
|
||||||
System.out.println("回写请求为:" + JSON.parseObject(JSON.toJSONString(backReq)));
|
|
||||||
|
|
||||||
JSONObject backRes = new JSONObject();
|
JSONObject backRes = new JSONObject();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -638,15 +642,14 @@ public class DesignController {
|
|||||||
System.out.println("回写结果为:" + backRes);
|
System.out.println("回写结果为:" + backRes);
|
||||||
|
|
||||||
//开始记录日志
|
//开始记录日志
|
||||||
JSONObject logResMap = new JSONObject();
|
JSONObject logRes = new JSONObject();
|
||||||
try {
|
try {
|
||||||
logResMap = restTemplate.postForObject("http://localhost:18085/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();
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("日志插入结果为:" + logResMap);
|
System.out.println("日志插入结果为:" + logRes);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import org.springframework.web.client.RestClientException;
|
import org.springframework.web.client.RestClientException;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@ -36,7 +37,7 @@ public class FrameContractController {
|
|||||||
* @return void
|
* @return void
|
||||||
* @Author weiloong_zhang
|
* @Author weiloong_zhang
|
||||||
*/
|
*/
|
||||||
@PostMapping
|
@PostMapping("/sync/framContract")
|
||||||
public void syncFrameContract() {
|
public void syncFrameContract() {
|
||||||
CrmRequestUtil crmRequestUtil = new CrmRequestUtil();
|
CrmRequestUtil crmRequestUtil = new CrmRequestUtil();
|
||||||
|
|
||||||
@ -311,8 +312,18 @@ public class FrameContractController {
|
|||||||
//解锁
|
//解锁
|
||||||
if ("1".equals(frameContractData.getString("lock_status"))) {
|
if ("1".equals(frameContractData.getString("lock_status"))) {
|
||||||
log.info("解锁");
|
log.info("解锁");
|
||||||
crmRequestUtil.unlockCRM(frameContractId, "framework_contract__c");
|
JSONObject unlockReq = crmRequestUtil.unlockCRM(frameContractId, "framework_contract__c");
|
||||||
|
|
||||||
|
JSONObject unlockRes = new JSONObject();
|
||||||
|
|
||||||
|
try {
|
||||||
|
unlockRes = restTemplate.postForObject(URLConstant.UNLOCK_CRM_URL, unlockReq, JSONObject.class);
|
||||||
|
} catch (RestClientException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
System.out.println(unlockRes);
|
||||||
|
}
|
||||||
|
|
||||||
JSONObject backReq = crmRequestUtil.updateCRM(backReqMap);
|
JSONObject backReq = crmRequestUtil.updateCRM(backReqMap);
|
||||||
|
|
||||||
JSONObject backRes = new JSONObject();
|
JSONObject backRes = new JSONObject();
|
||||||
@ -337,4 +348,251 @@ public class FrameContractController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 框架合同变更
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @Author weiloong_zhang
|
||||||
|
*/
|
||||||
|
@PostMapping("/sync/frameContractBG")
|
||||||
|
public void syncFrameContractBG() {
|
||||||
|
CrmRequestUtil crmRequestUtil = new CrmRequestUtil();
|
||||||
|
|
||||||
|
JSONObject getFrameContract = crmRequestUtil.getCRMList(Arrays.asList(
|
||||||
|
new Filter("EQ", "name", Arrays.asList("2025-06-13-00002"))
|
||||||
|
), "framework_contract__c__changeObj__c");
|
||||||
|
|
||||||
|
JSONObject frameContractBGRes = new JSONObject();
|
||||||
|
|
||||||
|
try {
|
||||||
|
frameContractBGRes = restTemplate.postForObject(URLConstant.GET_CUSTOMIZE_LIST_URL, getFrameContract, JSONObject.class);
|
||||||
|
} catch (RestClientException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!"success".equals(frameContractBGRes.getString("errorDescription")) || frameContractBGRes.getJSONObject("data").getJSONArray("dataList").isEmpty()) {
|
||||||
|
log.info("未找到框架合同变更或者查询失败");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("当前框架合同变更数据存在,将继续向下执行");
|
||||||
|
|
||||||
|
for (Object frameContractBGObj : frameContractBGRes.getJSONObject("data").getJSONArray("dataList")) {
|
||||||
|
JSONObject frameContractBGData = JSON.parseObject(JSON.toJSONString(frameContractBGObj));
|
||||||
|
|
||||||
|
System.out.println("当前正在处理的框架合同变更数据为:" + frameContractBGData);
|
||||||
|
|
||||||
|
//开始截取关键数据
|
||||||
|
String frameContractBGId = frameContractBGData.getString("_id");
|
||||||
|
String frameContractBGName = frameContractBGData.getString("name");
|
||||||
|
String createTime = frameContractBGData.getString("create_time");
|
||||||
|
String originalContractName = frameContractBGData.getString("original_data__r");
|
||||||
|
String originalContractId = frameContractBGData.getString("original_data");
|
||||||
|
|
||||||
|
//开始查询是否执行过了
|
||||||
|
JSONObject isLogRes = new JSONObject();
|
||||||
|
|
||||||
|
try {
|
||||||
|
isLogRes = restTemplate.getForObject("http://localhost:18085/Log/query/log_data?table=send_log_htxx&log_type=KJHTBG&dataId=" + frameContractBGId + "&mark=" + createTime, JSONObject.class);
|
||||||
|
} catch (RestClientException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isLogRes.getJSONArray("data").isEmpty()) {
|
||||||
|
log.info("当前数据已经执行过了,将不再向下执行");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("日志不存在,将继续向下执行");
|
||||||
|
|
||||||
|
Map frameContractBGMap = new HashMap();
|
||||||
|
frameContractBGMap.put("billno", frameContractBGName);//合同编号
|
||||||
|
|
||||||
|
//开始获取商机编号
|
||||||
|
String businessId = frameContractBGData.getString("change_business_opportunity__c") != null ? frameContractBGData.getString("change_business_opportunity__c") : "";
|
||||||
|
|
||||||
|
//根据商机唯一性ID获取商机编号
|
||||||
|
JSONObject getBusiness = crmRequestUtil.getCRMList(Arrays.asList(
|
||||||
|
new Filter("EQ", "_id", Arrays.asList(businessId))
|
||||||
|
), "NewOpportunityObj");
|
||||||
|
|
||||||
|
JSONObject businessRes = new JSONObject();
|
||||||
|
|
||||||
|
try {
|
||||||
|
businessRes = restTemplate.postForObject(URLConstant.GET_CUSTOMIZE_LIST_URL, getBusiness, JSONObject.class);
|
||||||
|
} catch (RestClientException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!"success".equals(businessRes.getString("errorDescription")) || businessRes.getJSONObject("data").getJSONArray("dataList").isEmpty()) {
|
||||||
|
log.info("不存在该商机,将不再向下执行");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String projectCode = businessRes.getJSONObject("data").getJSONArray("dataList").getJSONObject(0).getString("opportunity_id__c");
|
||||||
|
|
||||||
|
frameContractBGMap.put("project", projectCode);//项目号
|
||||||
|
frameContractBGMap.put("billname", frameContractBGData.getString("change_project_name__c") != null ? frameContractBGData.getString("change_project_name__c") : "");//合同名称
|
||||||
|
frameContractBGMap.put("srcbillnumber", originalContractName);//来源单单号
|
||||||
|
frameContractBGMap.put("srcsysbillid", originalContractId);//来源单ID
|
||||||
|
frameContractBGMap.put("crmid", originalContractId);//CRMID
|
||||||
|
|
||||||
|
//获取部门
|
||||||
|
String ownerDept = frameContractBGData.getString("owner_department_id") != null ? frameContractBGData.getString("owner_department_id") : "";
|
||||||
|
|
||||||
|
JSONObject getDept = crmRequestUtil.getCRMList(Arrays.asList(
|
||||||
|
new Filter("EQ", "_id", Arrays.asList(ownerDept))
|
||||||
|
), "DepartmentObj");
|
||||||
|
|
||||||
|
JSONObject deptRes = new JSONObject();
|
||||||
|
|
||||||
|
try {
|
||||||
|
deptRes = restTemplate.postForObject(URLConstant.GET_CRM_LIST_URL, getDept, JSONObject.class);
|
||||||
|
} catch (RestClientException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!"success".equals(deptRes.getString("errorDescription")) || deptRes.getJSONObject("data").getJSONArray("dataList").isEmpty()) {
|
||||||
|
log.info("不存在该部门,将不再向下执行");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String deptERPCode = deptRes.getJSONObject("data").getJSONArray("dataList").getJSONObject(0).getString("field_Vj6sf__c");
|
||||||
|
//YQBGMap.put("dept", deptERPCode);//部门编码
|
||||||
|
frameContractBGMap.put("dept", "ZHY");//部门编码
|
||||||
|
|
||||||
|
List ownerId = frameContractBGData.getJSONArray("change_owner") != null ? frameContractBGData.getJSONArray("change_owner") : new ArrayList<>();
|
||||||
|
|
||||||
|
JSONObject getOwner = crmRequestUtil.getCRMList(Arrays.asList(
|
||||||
|
new Filter("EQ", "user_id", ownerId)
|
||||||
|
), "PersonnelObj");
|
||||||
|
|
||||||
|
JSONObject ownerRes = new JSONObject();
|
||||||
|
|
||||||
|
try {
|
||||||
|
ownerRes = restTemplate.postForObject(URLConstant.GET_CRM_LIST_URL, getOwner, JSONObject.class);
|
||||||
|
} catch (RestClientException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!"success".equals(ownerRes.getString("errorDescription")) || ownerRes.getJSONObject("data").getJSONArray("dataList").isEmpty()) {
|
||||||
|
log.info("负责人不存在或者请求失败");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("负责人数据为:" + ownerRes);
|
||||||
|
|
||||||
|
String ownerUserId = ownerRes.getJSONObject("data").getJSONArray("dataList").getJSONObject(0).getString("field_T1xid__c");
|
||||||
|
//YQBGMap.put("operator", ownerUserId);//负责人
|
||||||
|
frameContractBGMap.put("operator", "ID-000016");//负责人
|
||||||
|
|
||||||
|
//质保期
|
||||||
|
frameContractBGMap.put("warranty", frameContractBGData.getBigDecimal("change_warranty_period_months__c") != null ? frameContractBGData.getBigDecimal("warranty_period") : BigDecimal.ZERO);
|
||||||
|
//订货客户
|
||||||
|
frameContractBGMap.put("customer", frameContractBGData.getString("change_billing_customer_code__c") != null ? frameContractBGData.getString("change_billing_customer_code__c") : "");
|
||||||
|
//产品线
|
||||||
|
frameContractBGMap.put("productLine", frameContractBGData.getString("change_product_line__c") != null ? frameContractBGData.getString("change_product_line__c") : "");
|
||||||
|
//安装方式
|
||||||
|
frameContractBGMap.put("installationmethod", frameContractBGData.getString("change_installation_method__c") != null ? frameContractBGData.getString("change_installation_method__c") : "");
|
||||||
|
//行业类型
|
||||||
|
frameContractBGMap.put("industrytype", frameContractBGData.getString("change_industry_type__c") != null ? frameContractBGData.getString("change_industry_type__c") : "");
|
||||||
|
//省
|
||||||
|
frameContractBGMap.put("province", frameContractBGData.getString("change_field_t3fgo__c__r") != null ? frameContractBGData.getString("change_field_t3fgo__c__r") : "");
|
||||||
|
//市
|
||||||
|
frameContractBGMap.put("city", frameContractBGData.getString("change_field_ngwth__c__r") != null ? frameContractBGData.getString("change_field_ngwth__c__r") : "");
|
||||||
|
//区
|
||||||
|
frameContractBGMap.put("county", frameContractBGData.getString("change_field_K5p2C__c__r") != null ? frameContractBGData.getString("change_field_K5p2C__c__r") : "");
|
||||||
|
|
||||||
|
//开始获取token
|
||||||
|
String accessToken = new KDTokenController().getKDAccessTokenTest();
|
||||||
|
|
||||||
|
if (accessToken == null || accessToken.equals("")) {
|
||||||
|
log.info("金蝶token为空或不存在");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String uuid = UUID.randomUUID().toString().replace("-", "");
|
||||||
|
//开始封装请求头
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
headers.set("accessToken", accessToken);
|
||||||
|
headers.set("Idempotency-Key", uuid);
|
||||||
|
|
||||||
|
HttpEntity contractReqEntity = new HttpEntity(frameContractBGMap, headers);
|
||||||
|
|
||||||
|
System.out.println(JSON.parseObject(JSON.toJSONString(contractReqEntity)));
|
||||||
|
|
||||||
|
String contractUrl = ERPURLConstant.ERP_URL + "/ierp/kapi/v2/f9w5/conm/salcontract/change";
|
||||||
|
|
||||||
|
JSONObject contractRes = new JSONObject();
|
||||||
|
|
||||||
|
try {
|
||||||
|
contractRes = restTemplate.postForObject(contractUrl, contractReqEntity, JSONObject.class);
|
||||||
|
} catch (RestClientException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(JSON.parseObject(JSON.toJSONString(contractRes)));
|
||||||
|
|
||||||
|
//开始封装回写程序
|
||||||
|
Map backReqMap = new HashMap();
|
||||||
|
backReqMap.put("_id", originalContractId);
|
||||||
|
backReqMap.put("dataObjectApiName", "framework_contract__c");
|
||||||
|
|
||||||
|
//开始封装日志
|
||||||
|
Map logMap = new HashMap<>();
|
||||||
|
logMap.put("log_id", UUID.randomUUID().toString().replace("-", ""));
|
||||||
|
logMap.put("log_type", "KJHTBG");
|
||||||
|
logMap.put("syn_type", "0");
|
||||||
|
logMap.put("data_name", frameContractBGName);
|
||||||
|
logMap.put("data_id", frameContractBGId);
|
||||||
|
logMap.put("mark", createTime);
|
||||||
|
logMap.put("send_body", JSON.toJSONString(contractReqEntity));
|
||||||
|
logMap.put("send_res", JSON.toJSONString(contractRes));
|
||||||
|
logMap.put("tableName", "send_log_htxx");
|
||||||
|
|
||||||
|
//判断是否执行成功
|
||||||
|
if ("0".equals(contractRes.getString("errorCode"))) {
|
||||||
|
//同步成功
|
||||||
|
logMap.put("log_status", "0");
|
||||||
|
logMap.put("res_body", "同步成功");
|
||||||
|
//backReqMap.put("updated_erp_id__c", contractRes.getJSONObject("data").getJSONArray("result").getJSONObject(0).getString("id"));
|
||||||
|
backReqMap.put("sync_status__c", "option_sync_success__c");
|
||||||
|
backReqMap.put("response_info__c", "变更同步成功");
|
||||||
|
|
||||||
|
//开始审核
|
||||||
|
// KingDeeUtils kingDeeUtils = new KingDeeUtils();
|
||||||
|
// kingDeeUtils.audit(contractRes.getJSONObject("data").getJSONArray("result").getJSONObject(0).getString("id"), "conm_salcontract");
|
||||||
|
} else {
|
||||||
|
//同步失败
|
||||||
|
logMap.put("log_status", "1");
|
||||||
|
logMap.put("res_body", "同步失败:" + contractRes.getString("message"));
|
||||||
|
backReqMap.put("sync_status__c", "option_sync_failure__c");
|
||||||
|
backReqMap.put("response_info__c", "变更失败:" + contractRes.getString("message"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//开始回写
|
||||||
|
JSONObject backReq = crmRequestUtil.updateCRM(backReqMap);
|
||||||
|
|
||||||
|
JSONObject backRes = new JSONObject();
|
||||||
|
|
||||||
|
try {
|
||||||
|
backRes = restTemplate.postForObject(URLConstant.UPDATE_CRM_CUSTOMIZE, backReq, JSONObject.class);
|
||||||
|
} catch (RestClientException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("回写结果为:" + backRes);
|
||||||
|
|
||||||
|
//开始记录日志
|
||||||
|
JSONObject logRes = new JSONObject();
|
||||||
|
try {
|
||||||
|
logRes = restTemplate.postForObject("http://localhost:18085/Log/insert/log_data", logMap, JSONObject.class);
|
||||||
|
} catch (RestClientException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("日志插入结果为:" + logRes);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -272,6 +272,7 @@ public class GoodsPlanController {
|
|||||||
erpGoodsPlanDetailReq.put("f9w5_contractno", goodsPlanDetailData.getString("sales_contract_number__c__r") != null ? goodsPlanDetailData.getString("sales_contract_number__c__r") : "");//销售合同编号
|
erpGoodsPlanDetailReq.put("f9w5_contractno", goodsPlanDetailData.getString("sales_contract_number__c__r") != null ? goodsPlanDetailData.getString("sales_contract_number__c__r") : "");//销售合同编号
|
||||||
erpGoodsPlanDetailReq.put("f9w5_tracknumber_number", trackingNum);//跟踪号
|
erpGoodsPlanDetailReq.put("f9w5_tracknumber_number", trackingNum);//跟踪号
|
||||||
erpGoodsPlanDetailReq.put("f9w5_programversion_number", goodsPlanDetailData.getString("program_version_number__c"));//程序版本
|
erpGoodsPlanDetailReq.put("f9w5_programversion_number", goodsPlanDetailData.getString("program_version_number__c"));//程序版本
|
||||||
|
erpGoodsPlanDetailReq.put("f9w5_smplatform_number", goodsPlanDetailData.getString("platform_name_code__c") != null ? goodsPlanDetailData.getString("platform_name_code__c") : "");
|
||||||
|
|
||||||
//开始查询项目号
|
//开始查询项目号
|
||||||
String projectId = goodsPlanDetailData.getString("project_name__c") != null ? goodsPlanDetailData.getString("project_name__c") : "";
|
String projectId = goodsPlanDetailData.getString("project_name__c") != null ? goodsPlanDetailData.getString("project_name__c") : "";
|
||||||
|
@ -335,7 +335,7 @@ public class PreContractController {
|
|||||||
CrmRequestUtil crmRequestUtil = new CrmRequestUtil();
|
CrmRequestUtil crmRequestUtil = new CrmRequestUtil();
|
||||||
|
|
||||||
JSONObject preContractBGReq = crmRequestUtil.getCRMList(Arrays.asList(
|
JSONObject preContractBGReq = crmRequestUtil.getCRMList(Arrays.asList(
|
||||||
new Filter("EQ", "name", Arrays.asList("2025-06-12-00003"))
|
new Filter("EQ", "name", Arrays.asList("2025-06-13-00004"))
|
||||||
), "pre_signed_contract__c__changeObj__c");
|
), "pre_signed_contract__c__changeObj__c");
|
||||||
|
|
||||||
JSONObject preContractBGRes = new JSONObject();
|
JSONObject preContractBGRes = new JSONObject();
|
||||||
|
@ -516,7 +516,7 @@ public class XSHTController {
|
|||||||
CrmRequestUtil crmRequestUtil = new CrmRequestUtil();
|
CrmRequestUtil crmRequestUtil = new CrmRequestUtil();
|
||||||
|
|
||||||
JSONObject getContract = crmRequestUtil.getCRMList(Arrays.asList(
|
JSONObject getContract = crmRequestUtil.getCRMList(Arrays.asList(
|
||||||
new Filter("EQ", "name", Arrays.asList("2025-06-12-00001"))
|
new Filter("EQ", "name", Arrays.asList("2025-06-13-00004"))
|
||||||
), "SaleContractChangeObj");
|
), "SaleContractChangeObj");
|
||||||
|
|
||||||
JSONObject contractBGRes = new JSONObject();
|
JSONObject contractBGRes = new JSONObject();
|
||||||
@ -808,7 +808,7 @@ public class XSHTController {
|
|||||||
//同步成功
|
//同步成功
|
||||||
logMap.put("log_status", "0");
|
logMap.put("log_status", "0");
|
||||||
logMap.put("res_body", "同步成功");
|
logMap.put("res_body", "同步成功");
|
||||||
//backReqMap.put("updated_erp_id__c", contractRes.getJSONObject("data").getJSONArray("result").getJSONObject(0).getString("id"));
|
//backReqMap.put("sales_contract_ERPID__c", contractRes.getJSONObject("data").getString("pkId"));
|
||||||
backReqMap.put("sync_status__c", "option_sync_success__c");
|
backReqMap.put("sync_status__c", "option_sync_success__c");
|
||||||
backReqMap.put("response_info__c", "变更同步成功");
|
backReqMap.put("response_info__c", "变更同步成功");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user