From f71ff76fe77bf6d97d36b46e85b0706e47474ecf Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Wed, 20 Sep 2023 14:05:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?1.=E6=AC=A7=E6=B4=BE=E6=94=B6=E8=B4=A7?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oupai/entity/FactoryPackageEntity.java | 4 +- .../receiver/OpReceivingDataHandler.java | 71 ++++++++++--------- .../impl/OuPaiFactoryDataServiceImpl.java | 2 +- .../service/impl/OuPaiFactoryServiceImpl.java | 56 ++++++++++----- 4 files changed, 80 insertions(+), 53 deletions(-) diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryPackageEntity.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryPackageEntity.java index f6e4aec10..3f157ce7e 100644 --- a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryPackageEntity.java +++ b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/entity/FactoryPackageEntity.java @@ -120,7 +120,9 @@ public class FactoryPackageEntity extends BaseEntity { @ApiModelProperty(name = "预留5",notes = "") private String reserve5 ; - + /** oid */ + @ApiModelProperty(name = "oid",notes = "") + private String oid ; } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/receiver/OpReceivingDataHandler.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/receiver/OpReceivingDataHandler.java index e444aa025..059e54e4c 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/receiver/OpReceivingDataHandler.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/receiver/OpReceivingDataHandler.java @@ -1,8 +1,6 @@ package com.logpm.factory.oupai.receiver; -import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import com.logpm.factory.oupai.entity.OpOrderStatusLogEntity; import com.logpm.factory.pan.service.IPanFactoryDataService; import com.rabbitmq.client.Channel; import lombok.extern.slf4j.Slf4j; @@ -34,38 +32,43 @@ public class OpReceivingDataHandler { public void opReceivingDataHandler(Map map, Message message, Channel channel) throws IOException { // 如果手动ACK,消息会被监听消费,但是消息在队列中依旧存在,如果 未配置 acknowledge-mode 默认是会在消费完毕后自动ACK掉 log.info("##################opReceivingDataHandler: 处理欧派收货数据到新系统"); - OpOrderStatusLogEntity opOrderStatusLogEntity = (OpOrderStatusLogEntity) map.get("messageData"); - String args = opOrderStatusLogEntity.getResponseBody(); - JSONObject jsonObject = JSONObject.parseObject(args); - JSONArray jsonArray = jsonObject.getJSONArray("value"); - for (int i = 0; i < jsonArray.size(); i++) { - JSONObject valueObject = jsonArray.getJSONObject(i); - JSONArray packages = valueObject.getJSONArray("Packages"); - for (int j = 0; j < packages.size(); j++) { - JSONObject packageJSON = packages.getJSONObject(j); - String packageStatus = packageJSON.getString("PackageStatus"); - String orderPackageCode = packageJSON.getString("Code"); - String receivingTime=null; - try{ - receivingTime = packageJSON.getString("CreateTime"); - }catch (Exception e){ - log.error(e.getMessage()); - } - log.info("##################opReceivingDataHandler: 处理欧派收货数据到新系统,packageStatus:{},orderPackageCode:{},receivingTime{}", - packageStatus,orderPackageCode,receivingTime); - //判断是否是已入库 - if("已在库".equals(packageStatus)){ - //真正的处理需要的数据 - try { - panFactoryDataService.handleDataToPlatform(orderPackageCode, receivingTime); - } catch (Exception e) { - log.error("##################opReceivingDataHandler: 处理欧派收货数据到新系统,packageStatus:{},orderPackageCode:{},receivingTime{}", - packageStatus,orderPackageCode,receivingTime); - log.error(e.getMessage()); - - } - } - } + String jsonStr = (String) map.get("messageData"); + JSONObject object = JSONObject.parseObject(jsonStr); + String orderPackageCode = object.getString("orderPackageCode"); + String receivingTime = object.getString("receivingTime"); + //真正的处理需要的数据 + try { + panFactoryDataService.handleDataToPlatform(orderPackageCode, receivingTime); + } catch (Exception e) { + log.error("##################opReceivingDataHandler: 处理欧派收货数据到新系统,orderPackageCode:{},receivingTime{}", + orderPackageCode,receivingTime); + log.error(e.getMessage()); } + + +// String args = opOrderStatusLogEntity.getResponseBody(); +// JSONObject jsonObject = JSONObject.parseObject(args); +// JSONArray jsonArray = jsonObject.getJSONArray("value"); +// for (int i = 0; i < jsonArray.size(); i++) { +// JSONObject valueObject = jsonArray.getJSONObject(i); +// JSONArray packages = valueObject.getJSONArray("Packages"); +// for (int j = 0; j < packages.size(); j++) { +// JSONObject packageJSON = packages.getJSONObject(j); +// String packageStatus = packageJSON.getString("PackageStatus"); +// String orderPackageCode = packageJSON.getString("Code"); +// String receivingTime=null; +// try{ +// receivingTime = packageJSON.getString("CreateTime"); +// }catch (Exception e){ +// log.error(e.getMessage()); +// } +// log.info("##################opReceivingDataHandler: 处理欧派收货数据到新系统,packageStatus:{},orderPackageCode:{},receivingTime{}", +// packageStatus,orderPackageCode,receivingTime); +// //判断是否是已入库 +// if("已在库".equals(packageStatus)){ +// +// } +// } +// } } } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryDataServiceImpl.java index 3a59541e3..f70834684 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryDataServiceImpl.java @@ -49,7 +49,7 @@ public class OuPaiFactoryDataServiceImpl implements IOuPaiFactoryDataService { code = ouPaiFactoryService.savaOuPaiSignBillByCode(orderCode,event); }else if(event == 6){ //签收单部分签收 - code = ouPaiFactoryService.savaOuPaiSignBillByCode(orderCode,event); +// code = ouPaiFactoryService.savaOuPaiSignBillByCode(orderCode,event); } return code; } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java index 4d3ffc086..97868eb98 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java @@ -5,17 +5,14 @@ import cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.logpm.factory.comfac.service.IAsyncDataService; import com.logpm.factory.oupai.entity.*; import com.logpm.factory.oupai.mapper.ReceivingOrderMapper; import com.logpm.factory.oupai.service.*; -import com.logpm.factory.oupai.vo.OpOrderStatusLogVO; import com.logpm.factory.props.OuPaiProperties; import lombok.extern.slf4j.Slf4j; import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.disk.DiskFileItem; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.io.IOUtils; import org.jetbrains.annotations.NotNull; @@ -27,7 +24,6 @@ import org.springblade.core.oss.model.BladeFile; import org.springblade.core.tool.api.R; import org.springblade.resource.feign.IOssClient; import org.springframework.amqp.rabbit.core.RabbitTemplate; -import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.stereotype.Service; @@ -89,25 +85,50 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { @Override public String saveOuPaiPackageStatusByCode(String orderCode, Integer event) { // - String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/ReceivingOrder?$filter=Code eq '" + orderCode + "'&select=Code,Type,Status,Plate,PackagesCount,ReceivePackageCount,PlateNum,CarNumber,CarrierCode,SendTime,ArrivalTime,ReceiveTime,CreateTime,ReturnNumber\n" + - "&$expand=" + - "Packages($select=Code,PdaNumber,FirstClassCode,FirstClassName,SecondClassCode,SecondClassName,ThirdClassCode,ThirdClassName,BuyIn,CosourcingCode,CosourcingUnit,SortingCenter,DistributionCenter,Length,Width,Height,Weight,OrderDetail,Order,PathIndex,PathDetail,DeliveryOrders,ReceivingOrders,LPN,LpnSerialNum,IsEntruck,ReservationOrder,OutGoingOrderDetail,SignBill,IsInventory,Inventories,InventoryInDetails,Freeze,OutGoingOrderDetailInventoryDetail,From,Creator,CreateTime,ShipTime,CarNumber,DeliveryMethod,DeliveryReceiver,DeliveryReceiverPhone,ReturnNumber,GroupType,CarrierCode,CarrierName,PackageDetailNames,ReceivingTime,SendTime,ExceptionSignRemark,Descript,SignTime,OutOrder,IsReceiveByHand,PackageStatus,PackageDetailNames;" + - "$expand=Order($select=" + - "Code,SelfCode,ContractNumber,ServiceNumber,OrderClass,OrderType,Status,FactoryShipStatus,FactorySendQty,WarehouseReceiveStatus,WarehouseReceiveQty,ReservationStatus,Store,MatingCode,IsMating,FirstClassCode,Leave,Customer,Province,City,CustomerAddress,CustomerPhone,ShopReceiver,BrandCode,BrandName,From,OutGoingTime,CreateTime,Freeze,FirstShipTime,MatingShipTime,FirstReceiveTime,MatingReceiveTime;\n" + - "$expand=Store($select=Name,Code))" + - "&$expand=PackageDetails($select=Code,Name,Type,Unit,OrgCode)" + - "&$expand=CurrentWarehouse($select=Name,Code)" + - "&$expand=SendWarehouse($select=Name,Code)" + - ")&$expand=FromWarehouse($select=Name,Code)&$expand=CurrentWarehouse($select=Name,Code)&$expand=EndWarehouse($select=Name,Code)"; +// String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/ReceivingOrder?$filter=Code eq '" + orderCode + "'&select=Code,Type,Status,Plate,PackagesCount,ReceivePackageCount,PlateNum,CarNumber,CarrierCode,SendTime,ArrivalTime,ReceiveTime,CreateTime,ReturnNumber\n" + +// "&$expand=" + +// "Packages($select=Code,PdaNumber,FirstClassCode,FirstClassName,SecondClassCode,SecondClassName,ThirdClassCode,ThirdClassName,BuyIn,CosourcingCode,CosourcingUnit,SortingCenter,DistributionCenter,Length,Width,Height,Weight,OrderDetail,Order,PathIndex,PathDetail,DeliveryOrders,ReceivingOrders,LPN,LpnSerialNum,IsEntruck,ReservationOrder,OutGoingOrderDetail,SignBill,IsInventory,Inventories,InventoryInDetails,Freeze,OutGoingOrderDetailInventoryDetail,From,Creator,CreateTime,ShipTime,CarNumber,DeliveryMethod,DeliveryReceiver,DeliveryReceiverPhone,ReturnNumber,GroupType,CarrierCode,CarrierName,PackageDetailNames,ReceivingTime,SendTime,ExceptionSignRemark,Descript,SignTime,OutOrder,IsReceiveByHand,PackageStatus,PackageDetailNames;" + +// "$expand=Order($select=" + +// "Code,SelfCode,ContractNumber,ServiceNumber,OrderClass,OrderType,Status,FactoryShipStatus,FactorySendQty,WarehouseReceiveStatus,WarehouseReceiveQty,ReservationStatus,Store,MatingCode,IsMating,FirstClassCode,Leave,Customer,Province,City,CustomerAddress,CustomerPhone,ShopReceiver,BrandCode,BrandName,From,OutGoingTime,CreateTime,Freeze,FirstShipTime,MatingShipTime,FirstReceiveTime,MatingReceiveTime;\n" + +// "$expand=Store($select=Name,Code))" + +// "&$expand=PackageDetails($select=Code,Name,Type,Unit,OrgCode)" + +// "&$expand=CurrentWarehouse($select=Name,Code)" + +// "&$expand=SendWarehouse($select=Name,Code)" + +// ")&$expand=FromWarehouse($select=Name,Code)&$expand=CurrentWarehouse($select=Name,Code)&$expand=EndWarehouse($select=Name,Code)"; +// +// handlePackageData(url, event); + //orderCode现在是包件码 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("oid",orderCode); + FactoryPackageEntity packageEntity = factoryPackageService.getOne(queryWrapper); + packageEntity.setPackageStatus(5); + factoryPackageService.updateById(packageEntity); + + JSONObject jo = new JSONObject(); + jo.put("orderPackageCode",orderCode); + jo.put("receivingTime",CommonUtil.dateToString(packageEntity.getUpdateTime())); + + //真正的处理需要的数据 + Map map = new HashMap<>(); + map.put("messageId", CommonUtil.getUUID()); + map.put("type", "Push"); + map.put("messageData", jo.toJSONString()); + map.put("createTime", new Date().getTime()); + try { + rabbitTemplate.convertAndSend(RabbitConstant.OUPAI_RECEIVING_EXCHANGE, RabbitConstant.OUPAI_RECEIVING_ROUTING, map); + } catch (Exception e) { + log.error("############saveOuPaiPackageStatusByCode: {}", e.getMessage()); + } + + log.info("############saveOuPaiPackageStatusByCode: 数据处理结束"); - handlePackageData(url, event); return orderCode; } @Override public String saveOuPaiOutGoingOrderByCode(String orderCode, Integer event) { // - String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/OutGoingOrder?$filter=Code eq 'PS20230802-6'" + + String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/OutGoingOrder?$filter=Code eq '"+orderCode+"'" + "&$select=Code,Status,Truck,DriverPhone,Platform,DeliveryDate,Creator,CreateTime,IsAdjust,SendTime," + "Customers,Volume" + "&$expand=Warehouse($select=Code,Name)" + @@ -459,6 +480,7 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { factoryPackageEntity = new FactoryPackageEntity(); factoryPackageEntity.setOrderId(orderId); factoryPackageEntity.setCode(packageCode); + factoryPackageEntity.setOid(packageEntity.getString("Oid")); factoryPackageEntity.setFirstClassCode(packageEntity.getString("FirstClassCode")); factoryPackageEntity.setFirstClassName(packageEntity.getString("FirstClassName")); factoryPackageEntity.setSecondClassCode(packageEntity.getString("SecondClassCode")); @@ -577,7 +599,7 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService { String url = ouPaiProperties.getUri() + "tims_odata_api/api/odata/ReceivingOrder?$filter=Code eq '" + code + "'&select=Code,Type,Status,Plate,PackagesCount,ReceivePackageCount,PlateNum,CarNumber,CarrierCode,SendTime,ArrivalTime,ReceiveTime,CreateTime,ReturnNumber\n" + "&$expand=" + - "Packages($select=Code,PdaNumber,FirstClassCode,FirstClassName,SecondClassCode,SecondClassName,ThirdClassCode,ThirdClassName,BuyIn,CosourcingCode,CosourcingUnit,SortingCenter,DistributionCenter,Length,Width,Height,Weight,OrderDetail,Order,PathIndex,PathDetail,DeliveryOrders,ReceivingOrders,LPN,LpnSerialNum,IsEntruck,ReservationOrder,OutGoingOrderDetail,SignBill,IsInventory,Inventories,InventoryInDetails,Freeze,OutGoingOrderDetailInventoryDetail,From,Creator,CreateTime,ShipTime,CarNumber,DeliveryMethod,DeliveryReceiver,DeliveryReceiverPhone,ReturnNumber,GroupType,CarrierCode,CarrierName,PackageDetailNames,ReceivingTime,SendTime,ExceptionSignRemark,Descript,SignTime,OutOrder,IsReceiveByHand,PackageStatus,PackageDetailNames;" + + "Packages($select=Oid,Code,PdaNumber,FirstClassCode,FirstClassName,SecondClassCode,SecondClassName,ThirdClassCode,ThirdClassName,BuyIn,CosourcingCode,CosourcingUnit,SortingCenter,DistributionCenter,Length,Width,Height,Weight,OrderDetail,Order,PathIndex,PathDetail,DeliveryOrders,ReceivingOrders,LPN,LpnSerialNum,IsEntruck,ReservationOrder,OutGoingOrderDetail,SignBill,IsInventory,Inventories,InventoryInDetails,Freeze,OutGoingOrderDetailInventoryDetail,From,Creator,CreateTime,ShipTime,CarNumber,DeliveryMethod,DeliveryReceiver,DeliveryReceiverPhone,ReturnNumber,GroupType,CarrierCode,CarrierName,PackageDetailNames,ReceivingTime,SendTime,ExceptionSignRemark,Descript,SignTime,OutOrder,IsReceiveByHand,PackageStatus,PackageDetailNames;" + "$expand=Order($select=" + "Code,SelfCode,ContractNumber,ServiceNumber,OrderClass,OrderType,Status,FactoryShipStatus,FactorySendQty,WarehouseReceiveStatus,WarehouseReceiveQty,ReservationStatus,Store,MatingCode,IsMating,FirstClassCode,Leave,Customer,Province,City,CustomerAddress,CustomerPhone,ShopReceiver,BrandCode,BrandName,From,OutGoingTime,CreateTime,Freeze,FirstShipTime,MatingShipTime,FirstReceiveTime,MatingReceiveTime;\n" + "$expand=Store($select=Name,Code;$expand=Shop))" + From d5aa468800ef3d7f726323dd25270975cbcd0f02 Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Wed, 20 Sep 2023 14:11:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?1.=E5=95=86=E9=85=8D=E9=85=8D=E9=80=81?= =?UTF-8?q?=E5=8D=95=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DistributionDeliveryListServiceImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java index a80b2c0c0..adb4e12bd 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java @@ -3287,7 +3287,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl set = total.keySet(); for (String key:set){ - if(!"合计件数".equals(key)){ + if(!"合计数量".equals(key)){ numObj.put(key,0); for (Map m:mapList){ String thirdProduct = (String)m.get("thirdProduct"); @@ -3338,7 +3338,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl