From d6e52121baa6ce478a33f463486b33735c4ef274 Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Thu, 29 Jun 2023 16:29:50 +0800 Subject: [PATCH 1/5] =?UTF-8?q?1.=E6=A2=A6=E5=A4=A9=E6=8E=A5=E6=94=B6?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BF=9D=E5=AD=98=E9=80=BB=E8=BE=91=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=202.=E7=9A=AE=E9=98=BF=E8=AF=BA=E4=B8=8D=E5=AD=98?= =?UTF-8?q?=E5=85=A5=E5=8C=85=E4=BB=B6=E6=95=B0=E9=87=8F=E4=B8=BA0?= =?UTF-8?q?=E7=9A=84=E6=96=B0=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../factory/snm/entity/MtPackageInfo.java | 3 + .../controller/MtFactoryDataController.java | 7 +- .../impl/MtFactoryDataServiceImpl.java | 102 +++++++++--------- .../impl/PanFactoryDataServiceImpl.java | 5 + 4 files changed, 67 insertions(+), 50 deletions(-) diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtPackageInfo.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtPackageInfo.java index 2aa02f582..17a4a53eb 100644 --- a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtPackageInfo.java +++ b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/snm/entity/MtPackageInfo.java @@ -54,4 +54,7 @@ public class MtPackageInfo extends BaseEntity { @ApiModelProperty(value = "订单id") private Long orderId; + @ApiModelProperty(value = "订单自编码") + private String orderCode; + } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/controller/MtFactoryDataController.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/controller/MtFactoryDataController.java index 99a993e1b..4ffa454cb 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/controller/MtFactoryDataController.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/controller/MtFactoryDataController.java @@ -77,11 +77,14 @@ public class MtFactoryDataController extends BladeController { R r = mtFactoryDataService.dealWithData(mtFactoryDataDTO); int code = r.getCode(); + Map map = (Map) r.getData(); + Long mainId = map.get("mainId"); if(code == 200){ orderStatusLog.setStatus(0); //开启异步线程处理数据 - Map map = (Map) r.getData(); - asyncDataService.handlerMtDataToHt(map.get("mainId")); + if(mainId != 0){ + asyncDataService.handlerMtDataToHt(map.get("mainId")); + } }else{ orderStatusLog.setStatus(2); } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java index a81d456d1..216845067 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java @@ -68,59 +68,65 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { log.warn("#############dealWithData: 数据已存在 invoiceOrderCode={}",invoiceOrderCode); return R.fail(405,"发货单已存在"); } - mtFactoryOrderMain = new MtFactoryOrderMain(); - BeanUtil.copyProperties(mtFactoryDataDTO,mtFactoryOrderMain); - boolean saveMain = mtFactoryOrderMainService.save(mtFactoryOrderMain); - if(saveMain){ - mainId = mtFactoryOrderMain.getId();//发货单id - List orderList = mtFactoryDataDTO.getOrderList();//所有订单数据 - for(MtFactoryOrderDTO mtFactoryOrderDTO:orderList){ - String orderCode = mtFactoryOrderDTO.getOrderCode(); - MtFactoryOrder mtFactoryOrder = new MtFactoryOrder(); - BeanUtil.copyProperties(mtFactoryOrderDTO,mtFactoryOrder); - mtFactoryOrder.setMainId(mainId); - boolean saveOrder = mtFactoryOrderService.save(mtFactoryOrder); - if(saveOrder){ - //根据订单自编码去查是否有已存在的包件,有就舍去 - Long orderId = mtFactoryOrder.getId(); - QueryWrapper qw = new QueryWrapper<>(); - qw.eq("order_id",orderId); - List existPackages = mtPackageInfoService.list(qw); - List packageInfos = mtFactoryOrderDTO.getPackageInfos(); - for(MtPackageInfo mtPackageInfo:existPackages){ - String packageCode = mtPackageInfo.getPackageCode(); - for (MtPackageInfoDTO mtPackageInfoDTO:packageInfos){ - String pc = mtPackageInfoDTO.getPackageCode(); - if(packageCode.equals(pc)){ - packageInfos.remove(mtPackageInfoDTO); - break; - } - } - } - List list = new ArrayList<>(); - for(MtPackageInfoDTO mtPackageInfoDTO:packageInfos){ - MtPackageInfo mtPackageInfo = new MtPackageInfo(); - BeanUtil.copyProperties(mtPackageInfoDTO,mtPackageInfo); - mtPackageInfo.setOrderId(orderId); - list.add(mtPackageInfo); - } - //保存包件信息 - boolean b = mtPackageInfoService.saveBatch(list); - if(b){ - log.info("#############dealWithData: 保存数据成功"); - }else{ - log.warn("#############dealWithData: 保存数据失败 orderCode={}",orderCode); - throw new CustomerException(405,"保存数据失败"); + //先取出所有发车单下面的订单 + List orderList = mtFactoryDataDTO.getOrderList();//所有订单数据 + for(MtFactoryOrderDTO mtFactoryOrderDTO:orderList){ + String orderCode = mtFactoryOrderDTO.getOrderCode();//订单自编码 + //先取出订单下面的包件进行判断是否存在 + List packageInfos = mtFactoryOrderDTO.getPackageInfos(); + //查询出该订单自编码下面的目前存在的所有包件 + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("order_code",orderCode); + List existPackages = mtPackageInfoService.list(qw); + for(MtPackageInfo mtPackageInfo:existPackages){ + String packageCode = mtPackageInfo.getPackageCode(); + for (MtPackageInfoDTO mtPackageInfoDTO:packageInfos){ + String pc = mtPackageInfoDTO.getPackageCode(); + if(packageCode.equals(pc)){ + packageInfos.remove(mtPackageInfoDTO); + break; } + } + } + //判断是否有新的包件 + if(packageInfos.size() == 0){ + //如果没有新增包件就直接下一条数据 + continue; + } + //如果有新增包件就去存入订单发车单,和订单信息 + if(Objects.isNull(mtFactoryOrderMain)){ + mtFactoryOrderMain = new MtFactoryOrderMain(); + BeanUtil.copyProperties(mtFactoryDataDTO,mtFactoryOrderMain); + boolean saveMain = mtFactoryOrderMainService.save(mtFactoryOrderMain); + if(saveMain){ + mainId = mtFactoryOrderMain.getId(); }else{ - log.warn("#############dealWithData: 保存订单失败 orderCode={}",orderCode); - throw new CustomerException(405,"保存订单失败"); + log.warn("##################dealWithData: 保存头信息失败invoiceOrderCode={} ",invoiceOrderCode); + throw new CustomerException(405,"保存数据失败"); } } - }else{ - log.warn("#############dealWithData: 保存发货单失败 invoiceOrderCode={}",invoiceOrderCode); - throw new CustomerException(405,"保存发货单失败"); + //保存订单信息 + MtFactoryOrder mtFactoryOrder = new MtFactoryOrder(); + BeanUtil.copyProperties(mtFactoryOrderDTO,mtFactoryOrder); + mtFactoryOrder.setMainId(mainId); + boolean saveOrder = mtFactoryOrderService.save(mtFactoryOrder); + Long orderId = mtFactoryOrder.getId(); + if(saveOrder){ + List list = new ArrayList<>(); + for(MtPackageInfoDTO mtPackageInfoDTO:packageInfos){ + MtPackageInfo mtPackageInfo = new MtPackageInfo(); + BeanUtil.copyProperties(mtPackageInfoDTO,mtPackageInfo); + mtPackageInfo.setOrderId(orderId); + mtPackageInfo.setOrderCode(orderCode); + list.add(mtPackageInfo); + } + //保存包件信息 + boolean b = mtPackageInfoService.saveBatch(list); + }else{ + log.warn("##################dealWithData: 保存订单信息失败orderCode={} ",orderCode); + throw new CustomerException(405,"保存数据失败"); + } } Map map = new HashMap<>(); map.put("mainId",mainId); diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java index c5b5a8419..dac7a1560 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java @@ -436,6 +436,11 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { } } factoryOrderDTO.setORDER_ATTRIBUTES(order_attributes); + + if(order_attributes.size() == 0){ + logger.info("###########saveData: 没有新增包件,不保存信息"); + return null; + } } PanFactoryOrder factoryOrder = new PanFactoryOrder(); From b93d4ae4f48cede293d18146d8b3312745ed1276 Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Thu, 29 Jun 2023 16:47:53 +0800 Subject: [PATCH 2/5] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logpm/oldproject/feign/INewDistributionContactClient.java | 4 ++-- .../factory/mt/service/impl/MtFactoryDataServiceImpl.java | 2 +- .../logpm/oldproject/feign/NewDistributionContactClient.java | 4 ++-- .../oldproject/service/INewDistributionContactService.java | 2 +- .../service/impl/NewDistributionContactServiceImpl.java | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/INewDistributionContactClient.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/INewDistributionContactClient.java index cd8604f9a..a78c0032c 100644 --- a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/INewDistributionContactClient.java +++ b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/INewDistributionContactClient.java @@ -35,6 +35,6 @@ public interface INewDistributionContactClient { String API_PREFIX = "/client"; String TOP = API_PREFIX + "/top"; - @GetMapping(API_PREFIX + "/fingById") - NewDistributionContactEntity fingById(@RequestParam Integer NewDistributionContactId); + @GetMapping(API_PREFIX + "/fingByNewDistributionContactId") + NewDistributionContactEntity fingByNewDistributionContactId(@RequestParam Integer NewDistributionContactId); } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java index 216845067..0c3319ffa 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java @@ -318,7 +318,7 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { List receiveBodyList = receiveInfoDTO.getReceiveBodyList(); List receivePhotoList = receiveInfoDTO.getReceivePhotoList(); //查询签收人 - NewDistributionContactEntity newDistributionContactEntity = newDistributionContactClient.fingById(newDistributionContactId); + NewDistributionContactEntity newDistributionContactEntity = newDistributionContactClient.fingByNewDistributionContactId(newDistributionContactId); String receiver = null; if (!Objects.isNull(newDistributionContactEntity)){ receiver = newDistributionContactEntity.getContact(); diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/NewDistributionContactClient.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/NewDistributionContactClient.java index b66bb4178..c942bccd1 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/NewDistributionContactClient.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/NewDistributionContactClient.java @@ -14,7 +14,7 @@ public class NewDistributionContactClient implements INewDistributionContactClie private final INewDistributionContactService newDistributionContactService; @Override - public NewDistributionContactEntity fingById(Integer NewDistributionContactId) { - return newDistributionContactService.fingById(NewDistributionContactId); + public NewDistributionContactEntity fingByNewDistributionContactId(Integer NewDistributionContactId) { + return newDistributionContactService.fingByNewDistributionContactId(NewDistributionContactId); } } diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/INewDistributionContactService.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/INewDistributionContactService.java index 157fc93ff..3137b3584 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/INewDistributionContactService.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/INewDistributionContactService.java @@ -4,5 +4,5 @@ import com.logpm.oldproject.entity.NewDistributionContactEntity; public interface INewDistributionContactService { - NewDistributionContactEntity fingById(Integer newDistributionContactId); + NewDistributionContactEntity fingByNewDistributionContactId(Integer newDistributionContactId); } diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/NewDistributionContactServiceImpl.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/NewDistributionContactServiceImpl.java index c9f734766..f4ce1c4d4 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/NewDistributionContactServiceImpl.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/NewDistributionContactServiceImpl.java @@ -13,7 +13,7 @@ public class NewDistributionContactServiceImpl implements INewDistributionContac private final NewDistributionContactMapper newDistributionContactMapper; @Override - public NewDistributionContactEntity fingById(Integer newDistributionContactId) { + public NewDistributionContactEntity fingByNewDistributionContactId(Integer newDistributionContactId) { return newDistributionContactMapper.selectById(newDistributionContactId); } } From c60d6efeea4199322dbf4fd95e8a1a84be824f9d Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Thu, 29 Jun 2023 17:02:47 +0800 Subject: [PATCH 3/5] =?UTF-8?q?1.=E4=BB=A3=E7=A0=81=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/logpm/basicdata/BasicDataApplication.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/BasicDataApplication.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/BasicDataApplication.java index b38103373..c98b3bd15 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/BasicDataApplication.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/BasicDataApplication.java @@ -1,7 +1,6 @@ package com.logpm.basicdata; -import org.springblade.common.constant.LauncherConstant; import org.springblade.common.constant.ModuleNameConstant; import org.springblade.core.cloud.client.BladeCloudApplication; import org.springblade.core.launch.BladeApplication; @@ -15,7 +14,7 @@ import org.springblade.core.launch.BladeApplication; public class BasicDataApplication { public static void main(String[] args) { - BladeApplication.run(ModuleNameConstant.APPLICATION_BASICDATA_NAME.concat("-lmy"), BasicDataApplication.class, args); + BladeApplication.run(ModuleNameConstant.APPLICATION_BASICDATA_NAME, BasicDataApplication.class, args); } From 9d697c94622d1f76bf567ca7d0af679772dc583c Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Thu, 29 Jun 2023 17:03:55 +0800 Subject: [PATCH 4/5] =?UTF-8?q?1.=E4=BB=A3=E7=A0=81=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logpm/basicdata/feign/IBasicdataStoreBusinessClient.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataStoreBusinessClient.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataStoreBusinessClient.java index ccd03c30b..51f75674a 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataStoreBusinessClient.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataStoreBusinessClient.java @@ -16,8 +16,9 @@ */ package com.logpm.basicdata.feign; -import org.springblade.core.mp.support.BladePage; import com.logpm.basicdata.entity.BasicdataStoreBusinessEntity; +import org.springblade.common.constant.ModuleNameConstant; +import org.springblade.core.mp.support.BladePage; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -29,7 +30,7 @@ import org.springframework.web.bind.annotation.RequestParam; * @since 2023-06-19 */ @FeignClient( - value = "blade-basicdataStoreBusiness" + value = ModuleNameConstant.APPLICATION_BASICDATA_NAME ) public interface IBasicdataStoreBusinessClient { From c846f015ad83d808172764afaccf2eb0b8fc6708 Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Thu, 29 Jun 2023 17:40:29 +0800 Subject: [PATCH 5/5] =?UTF-8?q?1.=E6=9F=A5=E8=AF=A2=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/logpm/oldproject/mapper/AdvanceMapper.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceMapper.xml b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceMapper.xml index 352c56a09..504620074 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceMapper.xml +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceMapper.xml @@ -20,6 +20,7 @@ delete_administrators_id = 0 and orderSelfNum = #{orderSelfNum} + limit 1