From f661a13649a7c4e5da58361125d94f2cb46797ca Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Tue, 27 Jun 2023 16:03:10 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E9=87=8D=E5=A4=8D=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E4=B8=8D=E5=90=8C=E5=8C=85=E4=BB=B6=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=BF=9D=E5=AD=98=E5=92=8C=E6=8E=A8=E9=80=81=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/AsyncDataServiceImpl.java | 133 +++++++++--------- .../impl/MtFactoryDataServiceImpl.java | 15 ++ .../controller/PanFactoryDataController.java | 29 ---- .../impl/PanFactoryDataServiceImpl.java | 65 ++++++--- 4 files changed, 124 insertions(+), 118 deletions(-) diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java index 6e247798c..3577a09b7 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/AsyncDataServiceImpl.java @@ -70,59 +70,52 @@ public class AsyncDataServiceImpl implements IAsyncDataService { for (PanFactoryOrder panFactoryOrder:panFactoryOrders){ Long orderId = panFactoryOrder.getId(); log.info("#########handlerDataToHt: 当前处理的订单id={}",orderId); - String orderNo = panFactoryOrder.getOrderNo();//订单自编码 - AdvanceEntity advanceEntity = iAdvanceClient.getQueryDataOne(orderNo); - Integer advanceId = null; - if(Objects.isNull(advanceEntity)){ - //添加订单信息 - advanceEntity = new AdvanceEntity(); - advanceEntity.setOrderSelfNum(StringUtil.isBlank(panFactoryOrder.getOrderNo())?"":panFactoryOrder.getOrderNo()); //订单自编号 - advanceEntity.setSiteName(PanFactoryEnum.getMes(panFactoryOrder.getPlantId())); // 基地 - advanceEntity.setArea(StringUtil.isBlank(panFactoryOrder.getReceiverArea())?"":panFactoryOrder.getReceiverArea()); // 区域 - advanceEntity.setOrderTypeName(""); //订单类型名称 可以为空 - advanceEntity.setOrderClassName("工厂"); //订单类型 可以为空 - advanceEntity.setType(FactoryConstant.PIANO); - advanceEntity.setTotal(panFactoryOrder.getServiceCount()); //订单总数据 - advanceEntity.setMctsTruck(StringUtil.isBlank(panFactoryOrder.getDeliveryNumber())?"":panFactoryOrder.getDeliveryNumber()); //车次 - advanceEntity.setMtdsNo("");// MTDS单号 可以为空 - advanceEntity.setFirstPackName(""); //一级品类 - advanceEntity.setFirstPackCode(""); //一级品类 - advanceEntity.setDealerName(""); //商场名称 - advanceEntity.setDealerCode(StringUtil.isBlank(panFactoryOrder.getUserId())?"":panFactoryOrder.getUserId()); //商场编码 - advanceEntity.setDueDate(""); // 交期 - advanceEntity.setIsOpai(0); //是否干仓配 - advanceEntity.setOrderNum("");//MSCS订单号 可以为空 - advanceEntity.setCarrierName("汇通");//承运商 可以为空 - advanceEntity.setCustomerName(StringUtil.isBlank(panFactoryOrder.getCustomerName())?"":panFactoryOrder.getCustomerName()); //顾客名称 - advanceEntity.setCustomerPhone(StringUtil.isBlank(panFactoryOrder.getCustomerNumber())?"":panFactoryOrder.getCustomerNumber()); // 顾客电话 - advanceEntity.setCustomerRoad(StringUtil.isBlank(panFactoryOrder.getCustomerAddress())?"":panFactoryOrder.getCustomerAddress());//顾客地址 - advanceEntity.setSystemType("线上"); //订单类型 - advanceEntity.setStoreNo(StringUtil.isBlank(panFactoryOrder.getUserId())?"":panFactoryOrder.getUserId()); //门店编码 - advanceEntity.setStoreName(StringUtil.isBlank(panFactoryOrder.getUserName())?"":panFactoryOrder.getUserName()); //门店名称 - advanceEntity.setSerialKey(""); //序列号 - advanceEntity.setServiceNum(StringUtil.isBlank(panFactoryOrder.getServiceNum())?"":panFactoryOrder.getServiceNum()); //服务号 - advanceEntity.setMatingCode("");//齐套模式 可以为空 - advanceEntity.setContractNum("");//合同号 可以为空 - advanceEntity.setLeaveBehind("");//遗留:Y=是,N=否 - advanceEntity.setSenderMobile(StringUtil.isBlank(panFactoryOrder.getSenderMobile())?"":panFactoryOrder.getSenderMobile());//发货人电话 可以为空 - advanceEntity.setSenderAddress(StringUtil.isBlank(panFactoryOrder.getSenderAddress())?"":panFactoryOrder.getSenderAddress()); //发货地址 可以为空 - advanceEntity.setSenderName(StringUtil.isBlank(panFactoryOrder.getSendFactory())?"":panFactoryOrder.getSendFactory()); //发货工厂名称 可以为空 - advanceEntity.setAdministratorsId(1078);// 导入人 - advanceEntity.setCreateTime(LocalDate.now()); //添加时间 - advanceEntity.setCarsNum(StringUtil.isBlank(panFactoryOrder.getDeliveryNumber())?"":panFactoryOrder.getDeliveryNumber()); //派车单--snm 可以为空 - advanceEntity.setDeleteTime(0); // 删除时间 - advanceEntity.setWaybillNo("");//运单号 可以为空 - Integer warehouseId = PanFactoryEnum.getId(panFactoryOrder.getPlantId()); - advanceEntity.setWarehouseId(warehouseId); //导入人仓库id - advanceEntity.setWaybillStatus(Byte.parseByte("1"));//开单状态:1=未开单,2=已开单 - advanceEntity.setOldId(0);// - advanceEntity.setFreeze(Byte.parseByte("1"));//冻结状态:1=正常,2=冻结 - advanceEntity.setDeleteReason("");//删除原因 - advanceEntity.setDeleteAdministratorsId(0);//删除用户 - advanceId = iAdvanceClient.addAdvanceClient(advanceEntity); - }else{ - advanceId = advanceEntity.getId(); - } + //添加订单信息 + AdvanceEntity advanceEntity = new AdvanceEntity(); + advanceEntity.setOrderSelfNum(StringUtil.isBlank(panFactoryOrder.getOrderNo())?"":panFactoryOrder.getOrderNo()); //订单自编号 + advanceEntity.setSiteName(PanFactoryEnum.getMes(panFactoryOrder.getPlantId())); // 基地 + advanceEntity.setArea(StringUtil.isBlank(panFactoryOrder.getReceiverArea())?"":panFactoryOrder.getReceiverArea()); // 区域 + advanceEntity.setOrderTypeName(""); //订单类型名称 可以为空 + advanceEntity.setOrderClassName("工厂"); //订单类型 可以为空 + advanceEntity.setType(FactoryConstant.PIANO); + advanceEntity.setTotal(panFactoryOrder.getServiceCount()); //订单总数据 + advanceEntity.setMctsTruck(StringUtil.isBlank(panFactoryOrder.getDeliveryNumber())?"":panFactoryOrder.getDeliveryNumber()); //车次 + advanceEntity.setMtdsNo("");// MTDS单号 可以为空 + advanceEntity.setFirstPackName(""); //一级品类 + advanceEntity.setFirstPackCode(""); //一级品类 + advanceEntity.setDealerName(""); //商场名称 + advanceEntity.setDealerCode(StringUtil.isBlank(panFactoryOrder.getUserId())?"":panFactoryOrder.getUserId()); //商场编码 + advanceEntity.setDueDate(""); // 交期 + advanceEntity.setIsOpai(0); //是否干仓配 + advanceEntity.setOrderNum("");//MSCS订单号 可以为空 + advanceEntity.setCarrierName("汇通");//承运商 可以为空 + advanceEntity.setCustomerName(StringUtil.isBlank(panFactoryOrder.getCustomerName())?"":panFactoryOrder.getCustomerName()); //顾客名称 + advanceEntity.setCustomerPhone(StringUtil.isBlank(panFactoryOrder.getCustomerNumber())?"":panFactoryOrder.getCustomerNumber()); // 顾客电话 + advanceEntity.setCustomerRoad(StringUtil.isBlank(panFactoryOrder.getCustomerAddress())?"":panFactoryOrder.getCustomerAddress());//顾客地址 + advanceEntity.setSystemType("线上"); //订单类型 + advanceEntity.setStoreNo(StringUtil.isBlank(panFactoryOrder.getUserId())?"":panFactoryOrder.getUserId()); //门店编码 + advanceEntity.setStoreName(StringUtil.isBlank(panFactoryOrder.getUserName())?"":panFactoryOrder.getUserName()); //门店名称 + advanceEntity.setSerialKey(""); //序列号 + advanceEntity.setServiceNum(StringUtil.isBlank(panFactoryOrder.getServiceNum())?"":panFactoryOrder.getServiceNum()); //服务号 + advanceEntity.setMatingCode("");//齐套模式 可以为空 + advanceEntity.setContractNum("");//合同号 可以为空 + advanceEntity.setLeaveBehind("");//遗留:Y=是,N=否 + advanceEntity.setSenderMobile(StringUtil.isBlank(panFactoryOrder.getSenderMobile())?"":panFactoryOrder.getSenderMobile());//发货人电话 可以为空 + advanceEntity.setSenderAddress(StringUtil.isBlank(panFactoryOrder.getSenderAddress())?"":panFactoryOrder.getSenderAddress()); //发货地址 可以为空 + advanceEntity.setSenderName(StringUtil.isBlank(panFactoryOrder.getSendFactory())?"":panFactoryOrder.getSendFactory()); //发货工厂名称 可以为空 + advanceEntity.setAdministratorsId(1078);// 导入人 + advanceEntity.setCreateTime(LocalDate.now()); //添加时间 + advanceEntity.setCarsNum(StringUtil.isBlank(panFactoryOrder.getDeliveryNumber())?"":panFactoryOrder.getDeliveryNumber()); //派车单--snm 可以为空 + advanceEntity.setDeleteTime(0); // 删除时间 + advanceEntity.setWaybillNo("");//运单号 可以为空 + Integer warehouseId = PanFactoryEnum.getId(panFactoryOrder.getPlantId()); + advanceEntity.setWarehouseId(warehouseId); //导入人仓库id + advanceEntity.setWaybillStatus(Byte.parseByte("1"));//开单状态:1=未开单,2=已开单 + advanceEntity.setOldId(0);// + advanceEntity.setFreeze(Byte.parseByte("1"));//冻结状态:1=正常,2=冻结 + advanceEntity.setDeleteReason("");//删除原因 + advanceEntity.setDeleteAdministratorsId(0);//删除用户 + Integer advanceId = iAdvanceClient.addAdvanceClient(advanceEntity); if(advanceId > 0){ //更改订单状态 panFactoryOrder.setStatus(0); @@ -336,6 +329,7 @@ public class AsyncDataServiceImpl implements IAsyncDataService { //通过订单id查询对应的包件 QueryWrapper packageQueryWrapper = new QueryWrapper<>(); packageQueryWrapper.eq("order_id",orderId) + .eq("status",1) .eq("is_deleted",0); List packages = mtPackageInfoService.list(packageQueryWrapper); for(MtPackageInfo mtPackageInfo:packages){ @@ -396,20 +390,27 @@ public class AsyncDataServiceImpl implements IAsyncDataService { } } - ServiceNumEntity serviceNum = new ServiceNumEntity(); - serviceNum.setServiceNum(StringUtil.isBlank(mtFactoryOrderMain.getInvoiceOrderCode())?"":mtFactoryOrderMain.getInvoiceOrderCode()); //服务号 - serviceNum.setTotal("1"); //订单数量 - serviceNum.setDetailTotal(Objects.isNull(mtFactoryOrder.getQuantity())?"":mtFactoryOrder.getQuantity()+""); // 包数量 - serviceNum.setStoreName(StringUtil.isBlank(mtFactoryOrder.getExclusiveName())?"":mtFactoryOrder.getExclusiveName()); //商场名 - serviceNum.setStoreNo(StringUtil.isBlank(mtFactoryOrder.getExclusiveCode())?"":mtFactoryOrder.getExclusiveCode()); // 商场编号 - serviceNum.setCustomerName(StringUtil.isBlank(mtFactoryOrder.getCustomName())?"":mtFactoryOrder.getCustomName());//顾客姓名 - serviceNum.setCustomerPhone(StringUtil.isBlank(mtFactoryOrder.getCustomPhone())?"":mtFactoryOrder.getCustomPhone()); //顾客电话 - serviceNum.setCustomerRoad(StringUtil.isBlank(mtFactoryOrder.getCustomAddress())?"":mtFactoryOrder.getCustomAddress()); //顾客地址 - serviceNum.setIsOpai(1); //是否干仓配 - serviceNum.setCompleteSet("V"); //齐套标识:Y=齐套,N=未齐套,V=未知 + String sn = StringUtil.isBlank(mtFactoryOrder.getMainOrderCode()) ? "" : mtFactoryOrder.getMainOrderCode(); + ServiceNumEntity serviceNum = serviceNumClient.findByserviceNum(sn); + if(Objects.isNull(serviceNum)){ + serviceNum = new ServiceNumEntity(); + serviceNum.setServiceNum(StringUtil.isBlank(mtFactoryOrder.getMainOrderCode())?"":mtFactoryOrder.getMainOrderCode()); //服务号 + serviceNum.setTotal("1"); //订单数量 + serviceNum.setDetailTotal(Objects.isNull(mtFactoryOrder.getQuantity())?"":mtFactoryOrder.getQuantity()+""); // 包数量 + serviceNum.setStoreName(StringUtil.isBlank(mtFactoryOrder.getExclusiveName())?"":mtFactoryOrder.getExclusiveName()); //商场名 + serviceNum.setStoreNo(StringUtil.isBlank(mtFactoryOrder.getExclusiveCode())?"":mtFactoryOrder.getExclusiveCode()); // 商场编号 + serviceNum.setCustomerName(StringUtil.isBlank(mtFactoryOrder.getCustomName())?"":mtFactoryOrder.getCustomName());//顾客姓名 + serviceNum.setCustomerPhone(StringUtil.isBlank(mtFactoryOrder.getCustomPhone())?"":mtFactoryOrder.getCustomPhone()); //顾客电话 + serviceNum.setCustomerRoad(StringUtil.isBlank(mtFactoryOrder.getCustomAddress())?"":mtFactoryOrder.getCustomAddress()); //顾客地址 + serviceNum.setIsOpai(1); //是否干仓配 + serviceNum.setCompleteSet("V"); //齐套标识:Y=齐套,N=未齐套,V=未知 // serviceNum.setCreateTime(LocalDate.now()); - serviceNum.setDeleteTime(0); - serviceNumEntityList.add(serviceNum); + serviceNum.setDeleteTime(0); + serviceNumEntityList.add(serviceNum); + }else{ + log.info("#############handlerMtDataToHt: 当前服务号已存在数据serviceNum={}",sn); + } + } serviceNumClient.addServiceNum(serviceNumEntityList); log.info("##############handlerMtDataToHt: 处理数据完成"); 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 cf27750b6..1d9246871 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 @@ -74,8 +74,23 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { 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(); diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/controller/PanFactoryDataController.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/controller/PanFactoryDataController.java index 3cf67812b..d2a3e474a 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/controller/PanFactoryDataController.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/controller/PanFactoryDataController.java @@ -17,20 +17,16 @@ package com.logpm.factory.pan.controller; import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.logpm.factory.comfac.service.IAsyncDataService; import com.logpm.factory.comfac.service.IOrderStatusLogService; import com.logpm.factory.pan.dto.PanFactoryOrderDTO; -import com.logpm.factory.pan.dto.PanPackageInfoDTO; import com.logpm.factory.pan.service.IPanFactoryDataService; import com.logpm.factory.pan.service.IPanFactoryOrderService; import com.logpm.factory.pan.service.IPanPackageInfoService; import com.logpm.factory.pan.service.IPanPackageListService; import com.logpm.factory.snm.bean.Resp; import com.logpm.factory.snm.entity.OrderStatusLog; -import com.logpm.factory.snm.entity.PanFactoryOrder; -import com.logpm.factory.snm.entity.PanPackageInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; @@ -41,7 +37,6 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; -import java.util.List; import java.util.Objects; /** @@ -115,30 +110,6 @@ public class PanFactoryDataController extends BladeController { //判断数据是否已存入 String orderNo = factoryOrderDTO.getOrderNo(); - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("order_no",orderNo); - PanFactoryOrder one = factoryOrderService.getOne(queryWrapper); - if(!Objects.isNull(one)){ -// log.warn("############data: 订单数据已存在 orderNo={}",orderNo); -// return Resp.fail(400,"订单数据已存在"); - //如果订单已存在就去验证订单下面的包件信息 - List order_attributes = factoryOrderDTO.getORDER_ATTRIBUTES(); - QueryWrapper qw = new QueryWrapper<>(); - qw.eq("order_no",orderNo); - List list = packageInfoService.list(qw); - for(PanPackageInfo panPackageInfo:list){ - String unitNo = panPackageInfo.getUnitNo(); - for(int i = 0; i qw = new QueryWrapper<>(); - qw.eq("order_no",factoryOrderDTO.getOrderNo()); - //先查询订单是否存在 - PanFactoryOrder factoryOrder = factoryOrderService.getOne(qw); - boolean flag = false; - if(Objects.isNull(factoryOrder)){ - factoryOrder = new PanFactoryOrder(); - BeanUtil.copyProperties(factoryOrderDTO,factoryOrder); - //保存订单数据 - factoryOrderService.save(factoryOrder); - }else{ - factoryOrder.setStatus(1); - factoryOrderService.saveOrUpdate(factoryOrder); - flag = true; +// QueryWrapper qw = new QueryWrapper<>(); +// qw.eq("order_no",factoryOrderDTO.getOrderNo()); +// //先查询订单是否存在 +// PanFactoryOrder factoryOrder = factoryOrderService.getOne(qw); +// boolean flag = false; +// if(Objects.isNull(factoryOrder)){ +// factoryOrder = new PanFactoryOrder(); +// BeanUtil.copyProperties(factoryOrderDTO,factoryOrder); +// //保存订单数据 +// factoryOrderService.save(factoryOrder); +// }else{ +// factoryOrder.setStatus(1); +// factoryOrderService.saveOrUpdate(factoryOrder); +// flag = true; +// } + + String orderNo = factoryOrderDTO.getOrderNo(); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("order_no",orderNo); + PanFactoryOrder one = factoryOrderService.getOne(queryWrapper); + if(!Objects.isNull(one)){ + //如果订单已存在就去验证订单下面的包件信息 + List order_attributes = factoryOrderDTO.getORDER_ATTRIBUTES(); + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("order_no",orderNo); + List list = packageInfoService.list(qw); + for(PanPackageInfo panPackageInfo:list){ + String unitNo = panPackageInfo.getUnitNo(); + for(int i = 0; i packageInfos = factoryOrderDTO.getORDER_ATTRIBUTES(); List panPackageInfos = new ArrayList<>(); @@ -405,11 +429,6 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { PanPackageInfo packageInfo = new PanPackageInfo(); BeanUtil.copyProperties(dto,packageInfo); packageInfo.setOrderId(factoryOrder.getId()); - if(flag){ - packageInfo.setReissueStatus(1); - }else{ - packageInfo.setReissueStatus(0); - } panPackageInfos.add(packageInfo); //保存包件信息数据