From 782edad5b32b78bce3559b645bb1617a01d398fb Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Wed, 12 Jun 2024 13:35:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=90=8C=E6=AD=A5=EF=BC=8C?= =?UTF-8?q?=E6=94=B9=E6=88=90=E6=97=B6=E9=97=B4=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plan/controller/ProOrderController.java | 4 +- .../com/op/plan/service/IProOrderService.java | 2 +- .../service/impl/ProOrderServiceImpl.java | 40 ++++++++++++------- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java index 2bc863f3..e3242b79 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderController.java @@ -287,8 +287,8 @@ public class ProOrderController extends BaseController { */ @Log(title = "手动执行同步SAP订单", businessType = BusinessType.INSERT) @PostMapping("/syncSAP") - public void syncSAP() { - proOrderService.syncSAP(); + public void syncSAP(@RequestBody ProOrder proOrder) { + proOrderService.syncSAP(proOrder); } @Log(title = "自动同步SAP订单", businessType = BusinessType.INSERT) diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderService.java b/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderService.java index 2edcec22..6b209060 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderService.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderService.java @@ -97,7 +97,7 @@ public interface IProOrderService { public AjaxResult getOrderList(String id); - public void syncSAP(); + public void syncSAP(ProOrder proOrder); /** * 处理表格信息 diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java index 1a2bfe57..d56438a4 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java @@ -439,7 +439,7 @@ public class ProOrderServiceImpl implements IProOrderService { */ @Override @DS("#header.poolName") - public void syncSAP() { + public void syncSAP(ProOrder proOrder) { SapShopOrderQuery sapqo = new SapShopOrderQuery(); // sapqo.setCreateTime(DateUtils.addDays(DateUtils.getNowDate(),-4)); // //获取当前所选工厂 @@ -447,22 +447,32 @@ public class ProOrderServiceImpl implements IProOrderService { String key = "#header.poolName"; sapqo.setWerk(request.getHeader(key.substring(8)).replace("ds_","")); - SapProOrder maxCreateTime = proOrderMapper.getMaxCreatetime(); - if(maxCreateTime == null ){ - sapqo.setErdat(DateFormatUtils.format(new Date(), "yyyyMMdd"));//S_ERDAT(创建日期) 例如:20230923 - }else{ - sapqo.setErdat(maxCreateTime.getCreateTimeStr());//S_ERDAT(创建日期) 例如:20230923 - } - - logger.info("手动订单同步:【参数】"+ JSONObject.toJSONString(sapqo)); - //取>=20230923的sap数据 - R> rSapProOrder = remoteSapService.shopOrderSync(sapqo);//sap只能同步指定日期的数据 +// SapProOrder maxCreateTime = proOrderMapper.getMaxCreatetime(); +// if(maxCreateTime == null ){ +// sapqo.setErdat(DateFormatUtils.format(new Date(), "yyyyMMdd"));//S_ERDAT(创建日期) 例如:20230923 +// }else{ +// sapqo.setErdat(maxCreateTime.getCreateTimeStr());//S_ERDAT(创建日期) 例如:20230923 +// } - List newOrders = rSapProOrder.getData(); - if(CollectionUtils.isEmpty(newOrders)){ - System.out.println("无"+sapqo.getErdat()+"之后的最新订单"); + if(StringUtils.isEmpty(proOrder.getPlanDateStart())||StringUtils.isEmpty(proOrder.getPlanDateEnd())){ + logger.error("手动订单同步:【参数】时间范围缺失"+ JSONObject.toJSONString(sapqo)); }else { - syncSAPFunc(newOrders, "Job"); + Map dataParams = new HashMap<>(); + dataParams.put("planDateStart", proOrder.getPlanDateStart()); + dataParams.put("planDateEnd", proOrder.getPlanDateEnd()); + sapqo.setParams(dataParams); + + logger.info("手动订单同步:【参数】" + JSONObject.toJSONString(sapqo)); + //取>=20230923的sap数据 + R> rSapProOrder = remoteSapService.shopOrderSync(sapqo);//sap只能同步指定日期的数据 + + List newOrders = rSapProOrder.getData(); + if (CollectionUtils.isEmpty(newOrders)) { + System.out.println("无" + sapqo.getErdat() + "之后的最新订单"); + } else { + logger.info("手动订单同步:【结果】" + JSONObject.toJSONString(newOrders)); + syncSAPFunc(newOrders, "Job"); + } } }