From d325ceb06a9baae406f59aa938f3fdb165f617a5 Mon Sep 17 00:00:00 2001 From: guojunyun Date: Wed, 19 Nov 2025 16:30:20 +0800 Subject: [PATCH 1/4] =?UTF-8?q?erp=E6=8F=90=E4=BA=A4=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E6=88=90=E5=8A=9F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/contract/ContractController.java | 8 ++++---- .../service/contract/ContractServiceImpl.java | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/controller/admin/contract/ContractController.java b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/controller/admin/contract/ContractController.java index 02217758..821fa3de 100644 --- a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/controller/admin/contract/ContractController.java +++ b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/controller/admin/contract/ContractController.java @@ -26,7 +26,9 @@ import org.springframework.web.bind.annotation.*; import java.util.List; +import static com.zt.plat.framework.common.pojo.CommonResult.error; import static com.zt.plat.framework.common.pojo.CommonResult.success; +import static com.zt.plat.module.contractorder.enums.ErrorCodeConstants.CONTRACT_SUBMIT_ERP_FAIL; @Slf4j @Tag(name = "管理后台 - 合同管理") @@ -153,10 +155,8 @@ public class ContractController implements BusinessControllerMarker { @Operation(summary = "提交ERP") @PreAuthorize("@ss.hasPermission('base:contract:erp')") public CommonResult submitErp(@RequestParam("id") Long id) { -// JSONObject res = contractService.submitErp(id); -// return res.getBool("success") ? success(res) : error(CONTRACT_SUBMIT_ERP_FAIL.getCode(), res.getStr("data")); - // TODO ERP默认返回成功处理 SZHGYL-251 - return success(new JSONObject().putOnce("success", true)); + JSONObject res = contractService.submitErp(id); + return res.getBool("success") ? success(res) : error(CONTRACT_SUBMIT_ERP_FAIL.getCode(), res.getStr("data")); } @GetMapping("/list/up-not-relation") diff --git a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contract/ContractServiceImpl.java b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contract/ContractServiceImpl.java index d304cede..47fcd089 100644 --- a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contract/ContractServiceImpl.java +++ b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contract/ContractServiceImpl.java @@ -1628,6 +1628,7 @@ public class ContractServiceImpl implements ContractService { // TODO 暂时返回成功 erpResult.putOnce("success", true); + erpResult.putOnce("data", "success"); /*HashMap result = erpContractService.submitErp(erpContractVO); if ("E".equals(result.get("flag"))) { erpResult.putOnce("success", false); From 8b187a6ff83671df4f01336f00259b4e009ed1ff Mon Sep 17 00:00:00 2001 From: liss <1780094091@qq.com> Date: Wed, 19 Nov 2025 16:45:36 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=AE=A2=E5=95=86erp=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/base/enums/ErrorCodeConstants.java | 2 +- .../service/erp/ErpCustomerServiceImpl.java | 111 +++++++++++++----- .../resources/mapper/ErpCustomerMapper.xml | 2 +- 3 files changed, 82 insertions(+), 33 deletions(-) diff --git a/zt-module-base/zt-module-base-api/src/main/java/com/zt/plat/module/base/enums/ErrorCodeConstants.java b/zt-module-base/zt-module-base-api/src/main/java/com/zt/plat/module/base/enums/ErrorCodeConstants.java index 0113c886..98cc53a5 100644 --- a/zt-module-base/zt-module-base-api/src/main/java/com/zt/plat/module/base/enums/ErrorCodeConstants.java +++ b/zt-module-base/zt-module-base-api/src/main/java/com/zt/plat/module/base/enums/ErrorCodeConstants.java @@ -25,7 +25,7 @@ public interface ErrorCodeConstants { ErrorCode BUSINESS_RULE_NOT_EXISTS = new ErrorCode(1_027_100_001, "规则模型不存在"); - ErrorCode BUSINESS_ALGORITHM_NOT_EXISTS = new ErrorCode(1_027_100_002, "算法模型不存在"); + ErrorCode BUSINESS_ALGORITHM_NOT_EXISTS = new ErrorCode(1_027_100_002, "算法模型不存在"); ErrorCode BUSINESS_DIMENSION_NOT_EXISTS = new ErrorCode(1_027_200_001, "经营指标维度不存在"); ErrorCode BUSINESS_INDICATOR_NOT_EXISTS = new ErrorCode(1_027_200_002, "经营指标不存在"); ErrorCode BUSINESS_DICTIONARY_TYPE_NOT_EXISTS = new ErrorCode(1_027_200_003, "业务字典类型不存在"); diff --git a/zt-module-erp/zt-module-erp-server/src/main/java/com/zt/plat/module/erp/service/erp/ErpCustomerServiceImpl.java b/zt-module-erp/zt-module-erp-server/src/main/java/com/zt/plat/module/erp/service/erp/ErpCustomerServiceImpl.java index f0b3ca00..f7e6f069 100644 --- a/zt-module-erp/zt-module-erp-server/src/main/java/com/zt/plat/module/erp/service/erp/ErpCustomerServiceImpl.java +++ b/zt-module-erp/zt-module-erp-server/src/main/java/com/zt/plat/module/erp/service/erp/ErpCustomerServiceImpl.java @@ -119,44 +119,93 @@ public class ErpCustomerServiceImpl implements ErpCustomerService { initialize(key); } //循环近五年日期, - JSONArray dataArrayALL = new JSONArray(); - LocalDate endDate = LocalDate.now(); - LocalDate startDate = endDate.minusYears(5); - for (LocalDate date = startDate; !date.isAfter(endDate); date = date.plusDays(1)) { - // 构建req参数 - Map req = new HashMap<>(); - List> datumList = new ArrayList<>(); - Map datumEntry = new HashMap<>(); - // 构建datum参数数组 - datumEntry.put("sign", "I"); - datumEntry.put("option", "EQ"); - // 把每次循环的日期,放在这里 - datumEntry.put("low", date.toString()); - datumList.add(datumEntry); - req.put(funcnrEnum.getDatekey(), datumList); +// JSONArray dataArrayALL = new JSONArray(); +// LocalDate endDate = LocalDate.now(); +// LocalDate startDate = endDate.minusYears(5); +// for (LocalDate date = startDate; !date.isAfter(endDate); date = date.plusDays(1)) { + // 构建req参数 + Map req = new HashMap<>(); + List> datumList = new ArrayList<>(); + Map datumEntry = new HashMap<>(); + // 构建datum参数数组 + datumEntry.put("sign", "I"); + datumEntry.put("option", "EQ"); + // 把每次循环的日期,放在这里 + datumEntry.put("low", LocalDate.now().toString()); + datumList.add(datumEntry); + req.put(funcnrEnum.getDatekey(), datumList); - // 1. 调用ERP接口获取数据 - for (OftenEnum.ModeTypeEnum type : OftenEnum.ModeTypeEnum.values()) { - req.put("MODE", type.modetype); - HashMap dataFromERP = erpConfig.fetchDataFromERP(funcnr, req); - JSONArray dataArray = (JSONArray) dataFromERP.get(funcnrEnum.getDatakey()); - if (dataArray == null || dataArray.isEmpty()) { - continue; - } - dataArrayALL.addAll(dataArray); - } - } - if (dataArrayALL.isEmpty()) { + // 1. 调用ERP接口获取数据 + HashMap dataFromERP = erpConfig.fetchDataFromERP(funcnr, req); + JSONArray dataArray = (JSONArray) dataFromERP.get("E_RESP"); +// if (dataArray == null || dataArray.isEmpty()) { +// continue; +// } +// dataArrayALL.addAll(dataArray); +// } + if (dataArray.isEmpty()) { return; } // 2. 处理数据,区分新增和更新 - ProcessingResult result = processData(dataArrayALL, funcnrEnum); + ProcessingResult result = processData(dataArray, funcnrEnum); // 3. 批量保存数据 saveData(result); } + +// @Override +// @Transactional +// @XxlJob("getErpCustomerTask") +// public void callErpRfcInterface() { +// OftenEnum.FuncnrEnum funcnrEnum = OftenEnum.FuncnrEnum.客商信息; +// String funcnr = funcnrEnum.getFuncnr(); +// +// String key = "erp" + funcnrEnum.getFuncnr(); +// List allnumbers = myRedisConfig.getRedisCache(key); +// List numbers = null; +// if (allnumbers != null) { +// //取前100的数据 +// numbers = allnumbers.stream().limit(100).collect(Collectors.toList()); +// JSONArray dataArrayALL = new JSONArray(); +// //循环近五年日期, +// for (String number : numbers) { +// // 构建req参数 +// Map req = new HashMap<>(); +// List> datumList = new ArrayList<>(); +// Map datumEntry = new HashMap<>(); +// // 构建datum参数数组 +// datumEntry.put("sign", "I"); +// datumEntry.put("option", "EQ"); +// // 把每次循环的日期,放在这里 +// datumEntry.put("low", number); +// datumList.add(datumEntry); +// req.put("PARTNER", datumList); +// +// // 1. 调用ERP接口获取数据 +// for (OftenEnum.ModeTypeEnum type : OftenEnum.ModeTypeEnum.values()) { +// req.put("MODE", type.modetype); +// HashMap dataFromERP = erpConfig.fetchDataFromERP(funcnr, req); +// JSONArray dataArray = (JSONArray) dataFromERP.get("E_RESP"); +// if (dataArray == null || dataArray.isEmpty()) { +// continue; +// } +// dataArrayALL.addAll(dataArray); +// } +// } +// if (dataArrayALL.isEmpty()) { +// return; +// } +// +// // 2. 处理数据,区分新增和更新 +// ProcessingResult result = processData(dataArrayALL, funcnrEnum); +// +// // 3. 批量保存数据 +// saveData(result); +// } +// } + /** * 处理数据,区分新增和更新 */ @@ -171,7 +220,7 @@ public class ErpCustomerServiceImpl implements ErpCustomerService { for (int i = 0; i < dataArray.size(); i++) { JSONObject dataJson = dataArray.getJSONObject(i); if (dataJson != null) { - String number = dataJson.getString(funcnr.getDatakey()); + String number = dataJson.getString("PARTNER"); if (number != null) { number = number.trim(); } @@ -191,7 +240,7 @@ public class ErpCustomerServiceImpl implements ErpCustomerService { } DO.setIsGiveback(dataJson.getString("XDELE")); DO.setIsProvisional(dataJson.getString("XBLCK")); - DO.setTaxNumber(dataJson.getString("TAXNO")); + DO.setTaxNumber(dataJson.getString("TAXNUM")); if (comnumbers.contains(number)) { // 更新 @@ -217,7 +266,7 @@ public class ErpCustomerServiceImpl implements ErpCustomerService { if (!result.toUpdate.isEmpty()) { erpCustomerMapper.updateBatchByNumber(result.toUpdate); } - myRedisConfig.updateRedisCache(result.key, result.allnumbers); +// myRedisConfig.updateRedisCache(result.key, result.allnumbers); } /** diff --git a/zt-module-erp/zt-module-erp-server/src/main/resources/mapper/ErpCustomerMapper.xml b/zt-module-erp/zt-module-erp-server/src/main/resources/mapper/ErpCustomerMapper.xml index f7830924..7921051f 100644 --- a/zt-module-erp/zt-module-erp-server/src/main/resources/mapper/ErpCustomerMapper.xml +++ b/zt-module-erp/zt-module-erp-server/src/main/resources/mapper/ErpCustomerMapper.xml @@ -23,7 +23,7 @@ IS_PRVS = #{item.isProvisional}, TAX_NUM = #{item.taxNumber}, - WHERE NUM = #{item.downCenterNumber} + WHERE NUM = #{item.number} \ No newline at end of file From feb7b490c93e266773c1988424e6ba0b16638a5d Mon Sep 17 00:00:00 2001 From: guojunyun Date: Wed, 19 Nov 2025 17:26:09 +0800 Subject: [PATCH 3/4] =?UTF-8?q?SZHGYL-289=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/contract/ContractServiceImpl.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contract/ContractServiceImpl.java b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contract/ContractServiceImpl.java index 47fcd089..0afb1dfd 100644 --- a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contract/ContractServiceImpl.java +++ b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contract/ContractServiceImpl.java @@ -1193,6 +1193,11 @@ public class ContractServiceImpl implements ContractService { contractIds = getContractIds(queryReqVO.getContractName(), queryReqVO.getContractPaperNumber()); } + // 未查询到相关合同 + if (CollectionUtils.isEmpty(contractIds)) { + return new PageResult<>(); + } + // 分页查询 IPage ipage = contractNotMapper.selectNots( new Page().setCurrent(queryReqVO.getPageNo()).setSize(queryReqVO.getPageSize()), @@ -1215,6 +1220,11 @@ public class ContractServiceImpl implements ContractService { contractIds = getContractIds(queryReqVO.getContractName(), queryReqVO.getContractPaperNumber()); } + // 未查询到相关合同 + if (CollectionUtils.isEmpty(contractIds)) { + return new PageResult<>(); + } + // 分页查询 IPage ipage = contractDemoteMapper.selectDemotes( new Page<>().setCurrent(queryReqVO.getPageNo()).setSize(queryReqVO.getPageSize()), @@ -1237,6 +1247,11 @@ public class ContractServiceImpl implements ContractService { contractIds = getContractIds(queryReqVO.getContractName(), queryReqVO.getContractPaperNumber()); } + // 未查询到相关合同 + if (CollectionUtils.isEmpty(contractIds)) { + return new PageResult<>(); + } + // 分页查询 IPage ipage = contractFormulaMapper.selectFormulas( new Page<>().setCurrent(queryReqVO.getPageNo()).setSize(queryReqVO.getPageSize()), From cff5a9d31d128de232be406c5d4390dc545f2075 Mon Sep 17 00:00:00 2001 From: guojunyun Date: Wed, 19 Nov 2025 17:56:59 +0800 Subject: [PATCH 4/4] =?UTF-8?q?supplierNumber=E8=B5=8B=E5=80=BC=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contractorder/service/contract/ContractServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contract/ContractServiceImpl.java b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contract/ContractServiceImpl.java index 0afb1dfd..5c8564ff 100644 --- a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contract/ContractServiceImpl.java +++ b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contract/ContractServiceImpl.java @@ -1852,7 +1852,7 @@ public class ContractServiceImpl implements ContractService { infoRespVO.setCompanyBankAccount(contractMainDO.getSalesBankAccount()); infoRespVO.setCompanyAccountNumber(contractMainDO.getSalesAccountNumber()); infoRespVO.setCompanyTaxNumber(contractMainDO.getSalesTaxNumber()); - infoRespVO.setSupplierName(contractMainDO.getPurchaseCompanyNumber()); + infoRespVO.setSupplierNumber(contractMainDO.getPurchaseCompanyNumber()); infoRespVO.setSupplierName(contractMainDO.getPurchaseCompanyName()); infoRespVO.setSupplierAccountName(contractMainDO.getPurchaseAccountName()); infoRespVO.setSupplierBankAccount(contractMainDO.getPurchaseBankAccount()); @@ -1866,7 +1866,7 @@ public class ContractServiceImpl implements ContractService { infoRespVO.setCompanyBankAccount(contractMainDO.getPurchaseBankAccount()); infoRespVO.setCompanyAccountNumber(contractMainDO.getPurchaseAccountNumber()); infoRespVO.setCompanyTaxNumber(contractMainDO.getPurchaseTaxNumber()); - infoRespVO.setSupplierName(contractMainDO.getSalesCompanyNumber()); + infoRespVO.setSupplierNumber(contractMainDO.getSalesCompanyNumber()); infoRespVO.setSupplierName(contractMainDO.getSalesCompanyName()); infoRespVO.setSupplierAccountName(contractMainDO.getSalesAccountName()); infoRespVO.setSupplierBankAccount(contractMainDO.getSalesBankAccount());