From aba3015f0095cb554733e96e8997c77f260e73b9 Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Tue, 27 Jun 2023 12:04:24 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E5=90=8C=E6=AD=A5=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=88=B0=E8=80=81=E7=B3=BB=E7=BB=9F=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../springblade/common/utils/CommonUtil.java | 11 ++ .../oldproject/entity/ServiceNumEntity.java | 11 +- .../oldproject/feign/IServiceNumClient.java | 5 + .../comfac/service/IAsyncDataService.java | 4 +- .../service/impl/AsyncDataServiceImpl.java | 146 ++++++++++-------- .../controller/MtFactoryDataController.java | 4 +- .../impl/MtFactoryDataServiceImpl.java | 8 +- .../controller/PanFactoryDataController.java | 8 +- .../pan/service/IPanFactoryDataService.java | 4 +- .../impl/PanFactoryDataServiceImpl.java | 17 +- .../factory/receiver/DealWithDataHandler.java | 3 +- .../oldproject/feign/ServiceNumClient.java | 6 + .../service/IServiceNumService.java | 2 + .../service/impl/ServiceNumServiceImpl.java | 8 + 14 files changed, 155 insertions(+), 82 deletions(-) diff --git a/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java b/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java index 9432d8745..c4a9d7c80 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java +++ b/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java @@ -19,6 +19,7 @@ package org.springblade.common.utils; import lombok.extern.log4j.Log4j2; import org.springframework.util.StringUtils; +import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.format.DateTimeFormatter; @@ -96,4 +97,14 @@ public class CommonUtil { return UUID.randomUUID().toString().replace("-", ""); } + + public static Date StringToDate(String value) { + try { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return format.parse(value); + } catch (Exception e) { + return null; + } + } + } diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/ServiceNumEntity.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/ServiceNumEntity.java index 7fe686071..1b8303ede 100644 --- a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/ServiceNumEntity.java +++ b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/ServiceNumEntity.java @@ -17,14 +17,12 @@ package com.logpm.oldproject.entity; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.core.mp.base.BaseEntity; -import org.springblade.core.tenant.mp.TenantEntity; import java.time.LocalDate; @@ -49,11 +47,13 @@ public class ServiceNumEntity { * 服务号 */ @ApiModelProperty(value = "服务号") + @TableField("serviceNum") private String serviceNum; /** * 订单数量 */ @ApiModelProperty(value = "订单数量") + @TableField("total") private String total; /** * 包数量 @@ -64,26 +64,31 @@ public class ServiceNumEntity { * 商场名 */ @ApiModelProperty(value = "商场名") + @TableField("storeName") private String storeName; /** * 商场编号 */ @ApiModelProperty(value = "商场编号") + @TableField("storeNo") private String storeNo; /** * 顾客姓名 */ @ApiModelProperty(value = "顾客姓名") + @TableField("customerName") private String customerName; /** * 顾客电话 */ @ApiModelProperty(value = "顾客电话") + @TableField("customerPhone") private String customerPhone; /** * 顾客地址 */ @ApiModelProperty(value = "顾客地址") + @TableField("customerRoad") private String customerRoad; /** * 是否干仓配 diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IServiceNumClient.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IServiceNumClient.java index 5d475757b..dabe0e0d7 100644 --- a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IServiceNumClient.java +++ b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IServiceNumClient.java @@ -18,8 +18,10 @@ package com.logpm.oldproject.feign; import com.logpm.oldproject.entity.ServiceNumEntity; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; import java.util.List; @@ -53,4 +55,7 @@ public interface IServiceNumClient { */ @PostMapping(API_PREFIX + "/addServiceNum") Boolean addServiceNum(@RequestBody List serviceNumEntity); + + @GetMapping(API_PREFIX + "/findByserviceNum") + ServiceNumEntity findByserviceNum(@RequestParam String sn); } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/IAsyncDataService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/IAsyncDataService.java index 976320984..9294e59b1 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/IAsyncDataService.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/IAsyncDataService.java @@ -3,9 +3,9 @@ package com.logpm.factory.comfac.service; public interface IAsyncDataService { - void handlerPanDataToHt(); + void handlerPanDataToHt(Long orderId); - void handlerMtDataToHt(); + void handlerMtDataToHt(Long mainId); } 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 bff2b418b..6e247798c 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 @@ -57,11 +57,12 @@ public class AsyncDataServiceImpl implements IAsyncDataService { */ @Override @Async - public void handlerPanDataToHt() { + public void handlerPanDataToHt(Long id) { log.info("################handlerDataToHt: 处理皮阿诺订单数据到"); //查询需要同步的订单 QueryWrapper orderQueryWrapper = new QueryWrapper<>(); orderQueryWrapper.eq("status",1) + .eq("id",id) .eq("is_deleted",0); List panFactoryOrders = panFactoryOrderService.list(orderQueryWrapper); List serviceNumEntityList = new ArrayList<>(); @@ -69,53 +70,59 @@ public class AsyncDataServiceImpl implements IAsyncDataService { for (PanFactoryOrder panFactoryOrder:panFactoryOrders){ Long orderId = panFactoryOrder.getId(); log.info("#########handlerDataToHt: 当前处理的订单id={}",orderId); - - //添加订单信息 - 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(""); //门店编码 - advanceEntity.setStoreName(""); //门店名称 - 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(0);// 导入人 - advanceEntity.setCreateTime(LocalDate.now()); //添加时间 - advanceEntity.setCarsNum(StringUtil.isBlank(panFactoryOrder.getDeliveryNumber())?"":panFactoryOrder.getDeliveryNumber()); //派车单--snm 可以为空 - advanceEntity.setDeleteTime(0); // 删除时间 - advanceEntity.setWaybillNo("");//运单号 可以为空 - Integer id = PanFactoryEnum.getId(panFactoryOrder.getPlantId()); - advanceEntity.setWarehouseId(id); //导入人仓库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); + 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(); + } if(advanceId > 0){ //更改订单状态 panFactoryOrder.setStatus(0); @@ -130,6 +137,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 = panPackageInfoService.list(packageQueryWrapper); for(PanPackageInfo panPackageInfo:packages){ @@ -222,41 +230,49 @@ public class AsyncDataServiceImpl implements IAsyncDataService { } } - ServiceNumEntity serviceNum = new ServiceNumEntity(); - serviceNum.setServiceNum(StringUtil.isBlank(panFactoryOrder.getServiceNum())?"":panFactoryOrder.getServiceNum()); //服务号 - serviceNum.setTotal("1"); //订单数量 - serviceNum.setDetailTotal(Objects.isNull(panFactoryOrder.getServiceCount())?"":panFactoryOrder.getServiceCount()+""); // 包数量 - serviceNum.setStoreName(StringUtil.isBlank(panFactoryOrder.getUserName())?"":panFactoryOrder.getUserName()); //商场名 - serviceNum.setStoreNo(""); // 商场编号 - serviceNum.setCustomerName(StringUtil.isBlank(panFactoryOrder.getCustomerName())?"":panFactoryOrder.getCustomerName());//顾客姓名 - serviceNum.setCustomerPhone(StringUtil.isBlank(panFactoryOrder.getCustomerNumber())?"":panFactoryOrder.getCustomerNumber()); //顾客电话 - serviceNum.setCustomerRoad(""); //顾客地址 - serviceNum.setIsOpai(1); //是否干仓配 - serviceNum.setCompleteSet("V"); //齐套标识:Y=齐套,N=未齐套,V=未知 + String sn = StringUtil.isBlank(panFactoryOrder.getServiceNum()) ? "" : panFactoryOrder.getServiceNum(); + ServiceNumEntity serviceNum = serviceNumClient.findByserviceNum(sn); + if(Objects.isNull(serviceNum)){ + serviceNum = new ServiceNumEntity(); + serviceNum.setServiceNum(sn); //服务号 + serviceNum.setTotal("1"); //订单数量 + serviceNum.setDetailTotal(Objects.isNull(panFactoryOrder.getServiceCount())?"":panFactoryOrder.getServiceCount()+""); // 包数量 + serviceNum.setStoreName(StringUtil.isBlank(panFactoryOrder.getUserName())?"":panFactoryOrder.getUserName()); //商场名 + serviceNum.setStoreNo(StringUtil.isBlank(panFactoryOrder.getUserId())?"":panFactoryOrder.getUserId()); // 商场编号 + serviceNum.setCustomerName(StringUtil.isBlank(panFactoryOrder.getCustomerName())?"":panFactoryOrder.getCustomerName());//顾客姓名 + serviceNum.setCustomerPhone(StringUtil.isBlank(panFactoryOrder.getCustomerNumber())?"":panFactoryOrder.getCustomerNumber()); //顾客电话 + serviceNum.setCustomerRoad(StringUtil.isBlank(panFactoryOrder.getCustomerAddress())?"":panFactoryOrder.getCustomerAddress()); //顾客地址 + 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("#############handlerDataToHt: 当前服务号已存在数据serviceNum={}",sn); + } + } + if(!serviceNumEntityList.isEmpty()){ + serviceNumClient.addServiceNum(serviceNumEntityList); } - serviceNumClient.addServiceNum(serviceNumEntityList); log.info("##############handlerDataToHt: 处理数据完成"); } @Override @Async - public void handlerMtDataToHt() { + public void handlerMtDataToHt(Long mainId) { log.info("################handlerMtDataToHt: 处理梦天订单数据到"); //查询需要同步的订单 QueryWrapper orderQueryWrapper = new QueryWrapper<>(); orderQueryWrapper.eq("status",1) + .eq("main_id",mainId) .eq("is_deleted",0); List mtFactoryOrders = mtFactoryOrderService.list(orderQueryWrapper); List serviceNumEntityList = new ArrayList<>(); log.info("#########handlerMtDataToHt: 待处理的订单数量为{}",mtFactoryOrders.size()); + MtFactoryOrderMain mtFactoryOrderMain = mtFactoryOrderMainService.getById(mainId); for (MtFactoryOrder mtFactoryOrder:mtFactoryOrders){ Long orderId = mtFactoryOrder.getId(); - Long mainId = mtFactoryOrder.getMainId(); - MtFactoryOrderMain mtFactoryOrderMain = mtFactoryOrderMainService.getById(mainId); log.info("#########handlerMtDataToHt: 当前处理的订单id={}",orderId); 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 61dfbe617..99a993e1b 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 @@ -34,6 +34,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; +import java.util.Map; /** * 梦天数据 控制器 @@ -79,7 +80,8 @@ public class MtFactoryDataController extends BladeController { if(code == 200){ orderStatusLog.setStatus(0); //开启异步线程处理数据 - asyncDataService.handlerMtDataToHt(); + Map map = (Map) r.getData(); + 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 dea456c1e..cf27750b6 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 @@ -55,6 +55,7 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { //先判断该发货单编码是否已经存在 QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("invoice_order_code",invoiceOrderCode); + Long mainId = null; MtFactoryOrderMain mtFactoryOrderMain = mtFactoryOrderMainService.getOne(queryWrapper); if(!Objects.isNull(mtFactoryOrderMain)){ log.warn("#############dealWithData: 数据已存在 invoiceOrderCode={}",invoiceOrderCode); @@ -64,7 +65,7 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { BeanUtil.copyProperties(mtFactoryDataDTO,mtFactoryOrderMain); boolean saveMain = mtFactoryOrderMainService.save(mtFactoryOrderMain); if(saveMain){ - Long mainId = mtFactoryOrderMain.getId();//发货单id + mainId = mtFactoryOrderMain.getId();//发货单id List orderList = mtFactoryDataDTO.getOrderList();//所有订单数据 for(MtFactoryOrderDTO mtFactoryOrderDTO:orderList){ String orderCode = mtFactoryOrderDTO.getOrderCode(); @@ -99,7 +100,10 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { log.warn("#############dealWithData: 保存发货单失败 invoiceOrderCode={}",invoiceOrderCode); throw new CustomerException(405,"保存发货单失败"); } - return R.success("接收成功"); + Map map = new HashMap<>(); + map.put("mainId",mainId); + + return R.data(map); } @Override 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 66a19ef66..3cf67812b 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 @@ -139,8 +139,9 @@ public class PanFactoryDataController extends BladeController { factoryOrderDTO.setORDER_ATTRIBUTES(order_attributes); } + Long orderId = null; try{ - panFactoryDataService.saveData(factoryOrderDTO); + orderId = panFactoryDataService.saveData(factoryOrderDTO); panOrderStatusLog.setStatus(0); }catch (Exception e){ log.warn("############data: 保存数据失败 orderNo={}",orderNo); @@ -151,7 +152,10 @@ public class PanFactoryDataController extends BladeController { panOrderStatusLogService.saveOrUpdate(panOrderStatusLog); //开启异步线程处理数据 - syncDataService.handlerPanDataToHt(); + if(!Objects.isNull(orderId)){ + syncDataService.handlerPanDataToHt(orderId); + } + return Resp.successOrderNo(factoryOrderDTO.getOrderNo(),factoryOrderDTO.getDeliveryNumber(),"SUCCESS"); } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/IPanFactoryDataService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/IPanFactoryDataService.java index f0549aedd..7a24a6fa3 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/IPanFactoryDataService.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/IPanFactoryDataService.java @@ -16,7 +16,7 @@ public interface IPanFactoryDataService { R handleStatusData(OrderStatusDTO orderStatusDTO); - void handleDataToPlatform(String unitNo); + void handleDataToPlatform(String unitNo,String operationTime); - void saveData(PanFactoryOrderDTO factoryOrderDTO); + Long saveData(PanFactoryOrderDTO factoryOrderDTO); } 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 ac1508880..7c98827e3 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 @@ -36,6 +36,7 @@ import lombok.AllArgsConstructor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springblade.common.exception.CustomerException; +import org.springblade.common.utils.CommonUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Service; @@ -287,7 +288,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { @Transactional @Override - public void handleDataToPlatform(String unitNo) { + public void handleDataToPlatform(String unitNo,String operationTime) { logger.info("############handleDataToPlatform: 处理数据到platform unitNo={}",unitNo); //先查询包件是否已存入到新系统数据库 DistributionParcelListEntity distributionParcelListEntity = distributionParcelListClient.findByPacketBarCode(unitNo); @@ -315,6 +316,10 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { } OrderEntity orderEntity = orderEntityList.get(0); Integer warehouseId = orderEntity.getWarehouseId();//仓库id + Date date = CommonUtil.StringToDate(operationTime); + Date now = new Date(); + + //根据仓库id查询仓库 String warehouseName = warehouseClient.selectNameById(warehouseId); @@ -324,7 +329,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { distributionStockArticleEntity.setMallName(advanceEntity.getStoreName()); distributionStockArticleEntity.setDescriptionGoods(advanceEntity.getFirstPackName()); distributionStockArticleEntity.setWarehouse(warehouseName); - distributionStockArticleEntity.setWarehouseEntryTime(null);//TODO 入库时间没找到 + distributionStockArticleEntity.setWarehouseEntryTime(date); distributionStockArticleEntity.setStoreTime(0);//TODO distributionStockArticleEntity.setTotalNumber(advanceEntity.getTotal()); distributionStockArticleEntity.setHandQuantity(0);//TODO @@ -334,7 +339,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { distributionStockArticleEntity.setCustomerName(orderEntity.getContact()); distributionStockArticleEntity.setCustomerTelephone(orderEntity.getPhone()); distributionStockArticleEntity.setCustomerAddress(orderEntity.getAddress()); - distributionStockArticleEntity.setGenre(2); + distributionStockArticleEntity.setGenre(1); distributionStockArticleEntity.setState(2); if(size > 1){ distributionStockArticleEntity.setReserve1("multiple"); @@ -369,7 +374,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { @Transactional @Override - public void saveData(PanFactoryOrderDTO factoryOrderDTO) { + public Long saveData(PanFactoryOrderDTO factoryOrderDTO) { QueryWrapper qw = new QueryWrapper<>(); qw.eq("order_no",factoryOrderDTO.getOrderNo()); @@ -382,6 +387,8 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { //保存订单数据 factoryOrderService.save(factoryOrder); }else{ + factoryOrder.setStatus(1); + factoryOrderService.saveOrUpdate(factoryOrder); flag = true; } @@ -427,6 +434,8 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { packageListService.saveBatch(panPackagelist); + return factoryOrder.getId(); + } private void checkListunitNo(PanPackageList packages, List panPackageInfos) { diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java index 69a5740d9..d5aacf3b4 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java @@ -43,6 +43,7 @@ public class DealWithDataHandler { OrderStatusDTO orderStatusDTO = (OrderStatusDTO) map.get("messageData"); String status = orderStatusDTO.getStatus(); String unitNo = orderStatusDTO.getUnitNo(); + String operationTime = orderStatusDTO.getOperationTime(); if("4".equals(status)){ //继续判断是否到达目的仓 String currentWarehouseId = orderStatusDTO.getCurrentWarehouse();//当前仓Id @@ -58,7 +59,7 @@ public class DealWithDataHandler { // channel.basicAck(deliveryTag,false); }else{ //真正的处理需要的数据 - panFactoryDataService.handleDataToPlatform(unitNo); + panFactoryDataService.handleDataToPlatform(unitNo,operationTime); } } diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/ServiceNumClient.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/ServiceNumClient.java index a83f80e69..f14f17b33 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/ServiceNumClient.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/ServiceNumClient.java @@ -46,6 +46,12 @@ public class ServiceNumClient implements IServiceNumClient { return serviceNumService.addServiceNum(serviceNumEntity); } + @Override + @GetMapping(API_PREFIX + "/findByserviceNum") + public ServiceNumEntity findByserviceNum(String sn) { + return serviceNumService.findByserviceNum(sn); + } + // @Override // @GetMapping(TOP) // public BladePage top(Integer current, Integer size) { diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IServiceNumService.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IServiceNumService.java index 1e3bd08e9..ecbeb14ed 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IServiceNumService.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IServiceNumService.java @@ -32,4 +32,6 @@ public interface IServiceNumService { //添加 Boolean addServiceNum(List serviceNum); + ServiceNumEntity findByserviceNum(String sn); + } diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/ServiceNumServiceImpl.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/ServiceNumServiceImpl.java index 6a6af20e6..6a807fde3 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/ServiceNumServiceImpl.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/ServiceNumServiceImpl.java @@ -16,6 +16,7 @@ */ package com.logpm.oldproject.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.logpm.oldproject.entity.ServiceNumEntity; import com.logpm.oldproject.mapper.ServiceNumMapper; import com.logpm.oldproject.service.IServiceNumService; @@ -44,4 +45,11 @@ public class ServiceNumServiceImpl implements IServiceNumService { } return true; } + + @Override + public ServiceNumEntity findByserviceNum(String sn) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("serviceNum",sn); + return serviceNumMapper.selectOne(queryWrapper); + } }