diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/dto/ReportIncomingDTO.java b/blade-service/logpm-report/src/main/java/com/logpm/report/dto/ReportIncomingDTO.java index 763fbaaa6..9585cc1d8 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/dto/ReportIncomingDTO.java +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/dto/ReportIncomingDTO.java @@ -4,6 +4,7 @@ import lombok.Data; import java.io.Serializable; import java.util.Date; +import java.util.List; @Data public class ReportIncomingDTO implements Serializable { @@ -21,10 +22,10 @@ public class ReportIncomingDTO implements Serializable { private String year; private String month; - private String businessLine; - private String departureWarehouseName; - private String destinationWarehouseName; - private String brand; + private List businessLines; + private List departureWarehouseIds; + private List destinationWarehouseIds; + private List brands; private String consignee; diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportIncomingMapper.xml b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportIncomingMapper.xml index efe3279a8..9c58830af 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportIncomingMapper.xml +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportIncomingMapper.xml @@ -28,17 +28,29 @@ left join logpm_warehouse_warehouse waw on waw.id = lww.destination_warehouse_id where lww.document_making_time > '2024-10-22 00:00:00' and lww.departure_warehouse_id != 1847456188105195522 - - and waw.business_line like concat('%',#{param.businessLine},'%') + + and waw.business_line in + + #{item} + - - and lww.departure_warehouse_name like concat('%',#{param.departureWarehouseName},'%') - - - and lww.destination_warehouse_name like concat('%',#{param.destinationWarehouseName},'%') - - - and lww.brand like concat('%',#{param.brand},'%') + + and lww.departure_warehouse_id in + + #{item} + + + + and lww.destination_warehouse_id in + + #{item} + + + + and lww.brand in + + #{item} + and lww.document_making_time >= #{param.startTime} @@ -70,17 +82,29 @@ left join logpm_distribution_parcel_number ldpn on ldpn.parcel_list_id = ldpl.id where lww.document_making_time > '2024-10-22 00:00:00' and lww.departure_warehouse_id != 1847456188105195522 - - and waw.business_line like concat('%',#{param.businessLine},'%') - - - and lww.departure_warehouse_name like concat('%',#{param.departureWarehouseName},'%') - - - and lww.destination_warehouse_name like concat('%',#{param.destinationWarehouseName},'%') - - - and lww.brand like concat('%',#{param.brand},'%') + + and waw.business_line in + + #{item} + + + + and lww.departure_warehouse_id in + + #{item} + + + + and lww.destination_warehouse_id in + + #{item} + + + + and lww.brand in + + #{item} + and lww.document_making_time >= #{param.startTime} @@ -120,17 +144,29 @@ left join logpm_warehouse_warehouse waw on waw.id = lww.destination_warehouse_id where lww.document_making_time > '2024-10-22 00:00:00' and lww.departure_warehouse_id != 1847456188105195522 - - and waw.business_line like concat('%',#{param.businessLine},'%') - - - and lww.departure_warehouse_name like concat('%',#{param.departureWarehouseName},'%') - - - and lww.destination_warehouse_name like concat('%',#{param.destinationWarehouseName},'%') - - - and lww.brand like concat('%',#{param.brand},'%') + + and waw.business_line in + + #{item} + + + + and lww.departure_warehouse_id in + + #{item} + + + + and lww.destination_warehouse_id in + + #{item} + + + + and lww.brand in + + #{item} + and lww.document_making_time >= #{param.startTime} @@ -170,20 +206,32 @@ left join logpm_warehouse_warehouse waw on waw.id = lww.destination_warehouse_id where lww.document_making_time > '2024-10-22 00:00:00' and lww.departure_warehouse_id != 1847456188105195522 - - and waw.business_line like concat('%',#{param.businessLine},'%') - - - and lww.departure_warehouse_name like concat('%',#{param.departureWarehouseName},'%') - - - and lww.destination_warehouse_name like concat('%',#{param.destinationWarehouseName},'%') + + and waw.business_line in + + #{item} + + + + and lww.departure_warehouse_id in + + #{item} + + + + and lww.destination_warehouse_id in + + #{item} + and lww.consignee like concat('%',#{param.consignee},'%') - - and lww.brand like concat('%',#{param.brand},'%') + + and lww.brand in + + #{item} + and lww.document_making_time >= #{param.startTime} @@ -216,20 +264,32 @@ left join logpm_distribution_parcel_number ldpn on ldpn.parcel_list_id = ldpl.id where lww.document_making_time > '2024-10-22 00:00:00' and lww.departure_warehouse_id != 1847456188105195522 - - and waw.business_line like concat('%',#{param.businessLine},'%') - - - and lww.departure_warehouse_name like concat('%',#{param.departureWarehouseName},'%') - - - and lww.destination_warehouse_name like concat('%',#{param.destinationWarehouseName},'%') + + and waw.business_line in + + #{item} + + + + and lww.departure_warehouse_id in + + #{item} + + + + and lww.destination_warehouse_id in + + #{item} + and lww.consignee like concat('%',#{param.consignee},'%') - - and lww.brand like concat('%',#{param.brand},'%') + + and lww.brand in + + #{item} + and lww.document_making_time >= #{param.startTime} @@ -269,20 +329,32 @@ left join logpm_warehouse_warehouse waw on waw.id = lww.destination_warehouse_id where lww.document_making_time > '2024-10-22 00:00:00' and lww.departure_warehouse_id != 1847456188105195522 - - and waw.business_line like concat('%',#{param.businessLine},'%') - - - and lww.departure_warehouse_name like concat('%',#{param.departureWarehouseName},'%') - - - and lww.destination_warehouse_name like concat('%',#{param.destinationWarehouseName},'%') + + and waw.business_line in + + #{item} + + + + and lww.departure_warehouse_id in + + #{item} + + + + and lww.destination_warehouse_id in + + #{item} + and lww.consignee like concat('%',#{param.consignee},'%') - - and lww.brand like concat('%',#{param.brand},'%') + + and lww.brand in + + #{item} + and lww.document_making_time >= #{param.startTime} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsBalanceOrderInfoServiceImpl.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsBalanceOrderInfoServiceImpl.java index 76304414b..ab50870b1 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsBalanceOrderInfoServiceImpl.java +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsBalanceOrderInfoServiceImpl.java @@ -17,7 +17,6 @@ import com.logpm.statistics.vo.StatisticsBalanceOrderInfoVO; import com.logpm.statistics.vo.StatisticsBalanceRecordVO; import com.logpm.warehouse.entity.WarehouseWaybillEntity; import com.logpm.warehouse.feign.IWarehouseWaybillClient; -import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.common.exception.CustomerException; import org.springblade.core.mp.base.BaseServiceImpl; @@ -283,7 +282,9 @@ public R findBalanceDetail(Long balanceOrderId) { @Override public void deleteBanlanceOrderByIds(List balanceOrderIds) { - baseMapper.deleteBanlanceOrderByIds(balanceOrderIds); + if(CollUtil.isNotEmpty(balanceOrderIds)){ + baseMapper.deleteBanlanceOrderByIds(balanceOrderIds); + } } @Override diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsReconciliationOrderInfoServiceImpl.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsReconciliationOrderInfoServiceImpl.java index d9ea1861e..8fe49c783 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsReconciliationOrderInfoServiceImpl.java +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsReconciliationOrderInfoServiceImpl.java @@ -1,5 +1,6 @@ package com.logpm.statistics.service.impl; +import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.logpm.basicdata.feign.IBasicdataWarehouseClient; @@ -61,6 +62,8 @@ public class StatisticsReconciliationOrderInfoServiceImpl extends BaseServiceImp @Override public void deleteRencilitionOrderByIds(List rencilitionOrderIds) { - baseMapper.deleteRencilitionOrderByIds(rencilitionOrderIds); + if(CollUtil.isNotEmpty(rencilitionOrderIds)){ + baseMapper.deleteRencilitionOrderByIds(rencilitionOrderIds); + } } } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java index a575c73b1..77449c766 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java @@ -5457,6 +5457,10 @@ public class OpenOrderServiceImpl implements IOpenOrderService { stringBuilder.append("收货单位:").append(consignee).append("-->").append(newConsignee).append(";"); waybillEntity.setConsignee(newConsignee); waybillEntity.setConsigneeId(newConsigneeId); + BasicdataClientEntity basicdataClient = basicdataClientClient.findEntityById(newConsigneeId); + if(!Objects.isNull(basicdataClient)){ + waybillEntity.setServiceType(basicdataClient.getTypeService()); + } } String newConsigneeName = openOrderDTO.getConsigneeName(); diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java index 5234b7a03..c91438939 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java @@ -2575,8 +2575,21 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl distinctList = addList.stream() + .collect(Collectors.toMap( + entity -> entity.getOrderCode() + "-" + entity.getWaybillNo(), // 复合键 + entity -> entity, + (existing, replacement) -> existing // 保留第一个出现的元素 + )) + .values() + .stream() + .collect(Collectors.toList()); + + log.info("##############saveNew: loadId={} 处理后新增的订单集合 {}",loadId,distinctList); - for (TrunklineCarsOrderDTO trunklineCarsOrderDTO : addList) { + for (TrunklineCarsOrderDTO trunklineCarsOrderDTO : distinctList) { TrunklineCarsOrderEntity trunklineCarsOrderEntity = new TrunklineCarsOrderEntity(); BeanUtil.copy(trunklineCarsOrderDTO, trunklineCarsOrderEntity); Integer realNum = trunklineCarsOrderDTO.getRealNum(); @@ -11296,47 +11309,50 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl records = pageList.getRecords(); //把records中所有元素的id放入一个List List idList = records.stream().map(TrunklineCarsLoadVO::getId).collect(Collectors.toList()); - List carsLoadLinePhotoEntities = carsLoadLinePhotoService.findListByLoadIdListAndWarehouseId(idList,warehouseId); - Map> map = new HashMap<>(); - if(CollUtil.isNotEmpty(carsLoadLinePhotoEntities)){ - //把carsLoadLinePhotoEntities中所有元素通过loadId进行分组 - map = carsLoadLinePhotoEntities.stream().collect(Collectors.groupingBy(TrunklineCarsLoadLinePhotoEntity::getLoadId)); - } - - for (TrunklineCarsLoadVO trunklineCarsLoadVO : records) { - Long loadId = trunklineCarsLoadVO.getId(); - TrunklineCarsLoadLineEntity carsLoadLineEntity = trunklineCarsLoadLineService.findEntityByLoadIdAndNodeId(loadId, warehouseId); - Integer sort = carsLoadLineEntity.getSort(); - String nodeStatus1 = carsLoadLineEntity.getNodeStatus(); - String unloadStatus = carsLoadLineEntity.getUnloadStatus(); - trunklineCarsLoadVO.setUnloadStatus(unloadStatus); - TrunklineCarsLoadLineEntity upCarsLoadLineEntity = trunklineCarsLoadLineService.findEntityByLoadIdAndSort(loadId, sort - 1); - String nodeStatus = upCarsLoadLineEntity.getNodeStatus(); - trunklineCarsLoadVO.setLastStartCarStatus(0); - if (!"20".equals(nodeStatus)) { + if(CollUtil.isNotEmpty(idList)){ + List carsLoadLinePhotoEntities = carsLoadLinePhotoService.findListByLoadIdListAndWarehouseId(idList,warehouseId); + Map> map = new HashMap<>(); + if(CollUtil.isNotEmpty(carsLoadLinePhotoEntities)){ + //把carsLoadLinePhotoEntities中所有元素通过loadId进行分组 + map = carsLoadLinePhotoEntities.stream().collect(Collectors.groupingBy(TrunklineCarsLoadLinePhotoEntity::getLoadId)); + } + + for (TrunklineCarsLoadVO trunklineCarsLoadVO : records) { + Long loadId = trunklineCarsLoadVO.getId(); + TrunklineCarsLoadLineEntity carsLoadLineEntity = trunklineCarsLoadLineService.findEntityByLoadIdAndNodeId(loadId, warehouseId); + Integer sort = carsLoadLineEntity.getSort(); + String nodeStatus1 = carsLoadLineEntity.getNodeStatus(); + String unloadStatus = carsLoadLineEntity.getUnloadStatus(); + trunklineCarsLoadVO.setUnloadStatus(unloadStatus); + TrunklineCarsLoadLineEntity upCarsLoadLineEntity = trunklineCarsLoadLineService.findEntityByLoadIdAndSort(loadId, sort - 1); + String nodeStatus = upCarsLoadLineEntity.getNodeStatus(); trunklineCarsLoadVO.setLastStartCarStatus(0); - } else { - if (!"20".equals(nodeStatus1)) { - trunklineCarsLoadVO.setLastStartCarStatus(1); - } else { + if (!"20".equals(nodeStatus)) { trunklineCarsLoadVO.setLastStartCarStatus(0); + } else { + if (!"20".equals(nodeStatus1)) { + trunklineCarsLoadVO.setLastStartCarStatus(1); + } else { + trunklineCarsLoadVO.setLastStartCarStatus(0); + } } - } // if("20".equals(nodeStatus)){ // trunklineCarsLoadVO.setLastStartCarStatus(1); // }else{ // trunklineCarsLoadVO.setLastStartCarStatus(0); // } - Integer realLoadingNumber = trunklineCarsLoadVO.getRealLoadingNumber(); - Integer unloadNumber = trunklineCarsLoadVO.getUnloadNumber(); - Integer stockCarNumber = trunklineCarsLoadVO.getStockNumber(); - trunklineCarsLoadVO.setRealLoadingNumber(stockCarNumber); - trunklineCarsLoadVO.setTotalLoadingNum(realLoadingNumber); + Integer realLoadingNumber = trunklineCarsLoadVO.getRealLoadingNumber(); + Integer unloadNumber = trunklineCarsLoadVO.getUnloadNumber(); + Integer stockCarNumber = trunklineCarsLoadVO.getStockNumber(); + trunklineCarsLoadVO.setRealLoadingNumber(stockCarNumber); + trunklineCarsLoadVO.setTotalLoadingNum(realLoadingNumber); - List trunklineCarsLoadLinePhotoEntities = map.get(loadId); - trunklineCarsLoadVO.setCarsLoadLinePhotoEntities(trunklineCarsLoadLinePhotoEntities); + List trunklineCarsLoadLinePhotoEntities = map.get(loadId); + trunklineCarsLoadVO.setCarsLoadLinePhotoEntities(trunklineCarsLoadLinePhotoEntities); + } } + pageList.setRecords(records); return R.data(pageList); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillPackageServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillPackageServiceImpl.java index 2261f6630..7cb1a3fc0 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillPackageServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillPackageServiceImpl.java @@ -1,6 +1,7 @@ package com.logpm.trunkline.service.impl; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSONObject; @@ -355,6 +356,7 @@ public class TrunklineWaybillPackageServiceImpl extends BaseServiceImpl waybillPackageEntities = new ArrayList<>(); - Set waybillIds = new HashSet<>(); + Map waybillMap = new HashMap<>(); QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.in("order_package_code",orderPackageCodes) .eq("is_deleted",0); @@ -376,18 +378,35 @@ public class TrunklineWaybillPackageServiceImpl extends BaseServiceImpl updateList = new ArrayList<>(); for (TrunklineWaybillPackageEntity trunklineWaybillPackageEntity : trunklineWaybillPackageEntities) { TrunklineWaybillPackageEntity updateEntity = new TrunklineWaybillPackageEntity(); + Long waybillId = trunklineWaybillPackageEntity.getWaybillId(); + WarehouseWaybillEntity waybillEntity = waybillMap.get(waybillId); + if(Objects.isNull(waybillEntity)){ + waybillEntity = warehouseWaybillClient.findByWaybillId(waybillId); + waybillMap.put(waybillId,waybillEntity); + if(NumberUtil.equals(30,packageStatus)){ + if(!Objects.isNull(waybillEntity)){ + Long destinationWarehouseId = waybillEntity.getDestinationWarehouseId(); + if(!NumberUtil.equals(destinationWarehouseId,warehouseId)){ + packageStatus = 20; + } + }else{ + packageStatus = 20; + } + } + } updateEntity.setId(trunklineWaybillPackageEntity.getId()); updateEntity.setPackageStatus(packageStatus); updateList.add(updateEntity); - waybillIds.add(trunklineWaybillPackageEntity.getWaybillId()); } updateBatchById(updateList); - for (Long waybillId : waybillIds) { - WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillId(waybillId); - updateWaybillStatus(waybillEntity); - } + waybillMap.keySet().forEach(waybillId -> { + WarehouseWaybillEntity waybillEntity = waybillMap.get(waybillId); + if(!Objects.isNull(waybillEntity)){ + updateWaybillStatus(waybillEntity); + } + }); } } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/receiver/ErrorQueueHandler.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/receiver/ErrorQueueHandler.java index 35d03fc50..c22ce47c3 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/receiver/ErrorQueueHandler.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/receiver/ErrorQueueHandler.java @@ -1,7 +1,5 @@ package com.logpm.warehouse.receiver; -import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; -import com.logpm.warehouse.entity.WarehouseLog; import com.logpm.warehouse.service.IWarehouseLogService; import com.rabbitmq.client.Channel; import lombok.extern.slf4j.Slf4j; @@ -12,7 +10,6 @@ import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.io.IOException; import java.util.Map; @@ -32,26 +29,29 @@ public class ErrorQueueHandler { @RabbitHandler public void warehouseErrorHandler(Map map, Message message, Channel channel) { // 如果手动ACK,消息会被监听消费,但是消息在队列中依旧存在,如果 未配置 acknowledge-mode 默认是会在消费完毕后自动ACK掉 - final long deliveryTag = message.getMessageProperties().getDeliveryTag(); - try { - Long logId = (Long) map.get("logId"); - UpdateWrapper updateWrapper = new UpdateWrapper<>(); - updateWrapper.set("status",2) - .eq("id",logId); - boolean updateFlag = warehouseLogService.update(updateWrapper); - if(updateFlag){ - channel.basicAck(deliveryTag, false); - }else{ - channel.basicReject(deliveryTag,true); - } - } catch (Exception e) { - try { - // 处理失败,重新压入MQ - channel.basicReject(deliveryTag,true); - } catch (IOException e1) { - e1.printStackTrace(); - } - - } + + log.warn("#################warehouseErrorHandler: message={}",message); + +// final long deliveryTag = message.getMessageProperties().getDeliveryTag(); +// try { +// Long logId = (Long) map.get("logId"); +// UpdateWrapper updateWrapper = new UpdateWrapper<>(); +// updateWrapper.set("status",2) +// .eq("id",logId); +// boolean updateFlag = warehouseLogService.update(updateWrapper); +// if(updateFlag){ +// channel.basicAck(deliveryTag, false); +// }else{ +// channel.basicReject(deliveryTag,true); +// } +// } catch (Exception e) { +// try { +// // 处理失败,重新压入MQ +// channel.basicReject(deliveryTag,true); +// } catch (IOException e1) { +// e1.printStackTrace(); +// } +// +// } } }