diff --git a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsDistributionPackageEntity.java b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsDistributionPackageEntity.java index f86ed09d1..cd08e40ca 100644 --- a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsDistributionPackageEntity.java +++ b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/StatisticsDistributionPackageEntity.java @@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode; import org.springblade.core.tenant.mp.TenantEntity; import java.math.BigDecimal; +import java.util.Date; @Data @TableName("logpm_statistics_distribution_package") @@ -128,5 +129,5 @@ public class StatisticsDistributionPackageEntity extends TenantEntity { private Long orderInfoId; private Integer isSign;//是否签收 0否 1是 - + private Date signTime; //签收时间 } diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/TrunklineCarsLoadScanEntity.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/TrunklineCarsLoadScanEntity.java index 7871388b3..cf011241f 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/TrunklineCarsLoadScanEntity.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/entity/TrunklineCarsLoadScanEntity.java @@ -109,6 +109,9 @@ public class TrunklineCarsLoadScanEntity extends TenantEntity { @ApiModelProperty(name = "是否补录 0否 1是",notes = "") private Integer isSupple ; + @ApiModelProperty(name = "签收人名称",notes = "") + private String signUserName; + /** 签收时间 */ @ApiModelProperty(name = "签收时间",notes = "") private Date signTime; diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/OpenOrderVO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/OpenOrderVO.java index b44ff6c7a..60b9dbf7c 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/OpenOrderVO.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/OpenOrderVO.java @@ -55,6 +55,7 @@ public class OpenOrderVO implements Serializable { private List transportTypeList;//运输方式 private String defaultPayWay; + private String defaultDeliveryWay;//默认送货方式 private String openOrderDate;//开单时间 private String openOrderUserName;//开单人 diff --git a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/SignOrderDetailVO.java b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/SignOrderDetailVO.java index a1a665397..2412eb77c 100644 --- a/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/SignOrderDetailVO.java +++ b/blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/SignOrderDetailVO.java @@ -3,6 +3,7 @@ package com.logpm.trunkline.vo; import lombok.Data; import java.io.Serializable; +import java.util.Date; @Data public class SignOrderDetailVO implements Serializable { @@ -21,6 +22,9 @@ public class SignOrderDetailVO implements Serializable { private Integer type; private Integer num; private Integer unloadNum; + private String signUserName; + private Date signTime; + private Date unloadTime; private String remark; private Long signOrderId; diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/ExportWarehouseWaybillVO.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/ExportWarehouseWaybillVO.java index 7b091c341..f787258d1 100644 --- a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/ExportWarehouseWaybillVO.java +++ b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/ExportWarehouseWaybillVO.java @@ -1,5 +1,6 @@ package com.logpm.warehouse.vo; +import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; @@ -149,10 +150,12 @@ public class ExportWarehouseWaybillVO implements Serializable { @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") private Date documentMakingTime; + @ExcelIgnore private Integer pickupCompleteOrNot; @ExcelProperty(value = "提货是否整车") private String pickupCompleteOrNotStr; + @ExcelIgnore private Integer trunklineCompleteOrNot; @ExcelProperty(value = "干线是否整车") private String trunklineCompleteOrNotStr; @@ -161,6 +164,7 @@ public class ExportWarehouseWaybillVO implements Serializable { private String waybillStatus; + @ExcelIgnore private Integer freezeStatus; @ExcelProperty(value = "是否冻结") private String freezeStatusStr; @@ -172,7 +176,7 @@ public class ExportWarehouseWaybillVO implements Serializable { @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") private Date freezeTime; - + @ExcelIgnore private Integer abolishStatus; @ExcelProperty(value = "是否作废") private String abolishStatusStr; diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/aspect/AsyncAnnotationAspect.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/aspect/AsyncAnnotationAspect.java new file mode 100644 index 000000000..e7d184443 --- /dev/null +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/aspect/AsyncAnnotationAspect.java @@ -0,0 +1,51 @@ +package com.logpm.statistics.aspect; + +import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.reflect.MethodSignature; +import org.springblade.common.annotations.LogpmAsync; +import org.springblade.core.secure.utils.AuthUtil; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Method; + +@Aspect +@Component +@Slf4j +@Order(-1) +public class AsyncAnnotationAspect { + + /** + * 定义一个切点,匹配所有带有@LogpmAsync("asyncExecutor")注解的方法。 + * 注意:实际上Spring Framework自带对@LogpmAsync("asyncExecutor")的处理,直接这样配置可能会导致预期之外的行为。 + */ + @Around("@annotation(org.springblade.common.annotations.LogpmAsync)") + public Object logAroundAsyncMethods(ProceedingJoinPoint joinPoint) throws Throwable { + + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + Method method = signature.getMethod(); + + LogpmAsync myAsync = method.getAnnotation(LogpmAsync.class); + String annotationValue = myAsync.value(); + log.info(">>>>>>>>>>>>>>>>>> annotationValue={}",annotationValue); + + log.info("@LogpmAsync注解的值为asyncExecutor,进行数据源切换 "); + + // 在方法执行前的操作 + String tenantId = AuthUtil.getTenantId(); + log.info(">> tenandId {} ",tenantId); + DynamicDataSourceContextHolder.push(tenantId); + + // 执行原方法 + Object result = joinPoint.proceed(); + + // 在方法执行后的操作 + DynamicDataSourceContextHolder.poll(); + return result; + } + +} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/aspect/RabbitAnnotationAspect.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/aspect/RabbitAnnotationAspect.java new file mode 100644 index 000000000..4595ad5a0 --- /dev/null +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/aspect/RabbitAnnotationAspect.java @@ -0,0 +1,48 @@ +package com.logpm.statistics.aspect; + +import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.springblade.core.secure.utils.AuthUtil; +import org.springframework.stereotype.Component; + +@Aspect +@Component +@Slf4j +public class RabbitAnnotationAspect { + + + /** + * 该方法为一个切面,用于对标记了@RabbitListener注解的方法进行增强,主要增加了日志记录和数据源上下文处理的功能。 + * + * @param joinPoint 切面的连接点,表示当前被拦截的方法。 + * @return 返回被拦截方法的执行结果。 + * @throws Throwable 如果执行过程中发生异常,则抛出。 + */ + @Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitListener)") + public Object rabbitMethods(ProceedingJoinPoint joinPoint) throws Throwable { + // 在方法执行前,获取当前租户ID并设置到数据源上下文中 + String tenantId = AuthUtil.getTenantId(); + DynamicDataSourceContextHolder.push(tenantId); + // 执行原方法 + Object result = joinPoint.proceed(); + // 在方法执行后,从数据源上下文中移除租户ID + DynamicDataSourceContextHolder.poll(); + return result; + } + + @Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitHandler)") + public Object rabbitHandlerMethods(ProceedingJoinPoint joinPoint) throws Throwable { + // 在方法执行前,获取当前租户ID并设置到数据源上下文中 + String tenantId = AuthUtil.getTenantId(); + DynamicDataSourceContextHolder.push(tenantId); + // 执行原方法 + Object result = joinPoint.proceed(); + // 在方法执行后,从数据源上下文中移除租户ID + DynamicDataSourceContextHolder.poll(); + return result; + } + +} diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/controller/MerchantStatisticsController.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/controller/MerchantStatisticsController.java index 3bf2b0c7c..5b08ab1f0 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/controller/MerchantStatisticsController.java +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/controller/MerchantStatisticsController.java @@ -54,6 +54,34 @@ public class MerchantStatisticsController { } } + @ResponseBody + @PostMapping("/findOrderDetail") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "查询订单详情", notes = "传入merchantStatisticsDTO") + public R findOrderDetail(@RequestBody MerchantStatisticsDTO merchantStatisticsDTO) { + String method = "############findOrderDetail: "; + log.info(method+"请求参数{}",merchantStatisticsDTO); + try{ + Long orderInfoId = merchantStatisticsDTO.getOrderInfoId(); + if(Objects.isNull(orderInfoId)){ + log.warn(method+"请选择正确的订单 orderInfoId={}",orderInfoId); + return R.fail(405,"请选择正确的订单"); + } + + StatisticsOrderInfoVO statisticsOrderInfoVO = statisticsOrderInfoService.findOrderDetail(orderInfoId); + + return R.data(statisticsOrderInfoVO); + }catch (CustomerException e){ + log.error(e.message,e); + return R.fail(e.code,e.message); + }catch (Exception e){ + log.error(method+"系统异常",e); + return R.fail(500,"系统异常"); + } + } + + + @ResponseBody @PostMapping("/findChangesRecordList") @ApiOperationSupport(order = 1) diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/PackageFanoutListener.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/PackageFanoutListener.java index 764d1ffe3..e183d8ad0 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/PackageFanoutListener.java +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/PackageFanoutListener.java @@ -52,6 +52,7 @@ public class PackageFanoutListener { Set orderInfoSet = new HashSet<>(); statisticsDistributionList.forEach(statisticsDistributionPackageEntity -> { statisticsDistributionPackageEntity.setIsSign(1); + statisticsDistributionPackageEntity.setSignTime(new Date()); String typeService = statisticsDistributionPackageEntity.getTypeService(); if("3".equals(typeService)){ statisticsDistributionPackageEntity.setRealDeliveryFee(BigDecimal.ZERO); diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/WaybillFanoutListener.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/WaybillFanoutListener.java index 24aa3a1e5..a3b7d3f1c 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/WaybillFanoutListener.java +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/WaybillFanoutListener.java @@ -19,6 +19,7 @@ import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -48,6 +49,7 @@ public class WaybillFanoutListener { Long waybillId = jsonObject.getLong("waybillId"); String waybillNo = jsonObject.getStr("waybillNo"); String typeService = jsonObject.getStr("typeService");//服务类型 + Integer waybillType = jsonObject.getInt("waybillType"); List statisticsTrunklinePackageEntities = new ArrayList<>(); List statisticsWarehousePackageEntities = new ArrayList<>(); @@ -64,7 +66,6 @@ public class WaybillFanoutListener { statisticsTrunklinePackageEntity.setTypeService(typeService); statisticsTrunklinePackageEntity.setWaybillId(waybillId); statisticsTrunklinePackageEntity.setWaybillNo(waybillNo); - Integer waybillType = json.getInt("waybillType"); if(waybillType.equals(1)){ statisticsTrunklinePackageEntity.setGoodsType(1); }else if (waybillType.equals(2)){ @@ -126,6 +127,8 @@ public class WaybillFanoutListener { statisticsWarehousePackageEntity.setTotalNum(json.getInt("totalNum")); statisticsWarehousePackageEntity.setTotalWeight(json.getBigDecimal("totalWeight")); statisticsWarehousePackageEntity.setTotalVolume(json.getBigDecimal("totalVolume")); + statisticsWarehousePackageEntity.setOpenPrice(json.getBigDecimal("warehouseServiceFee")); + statisticsWarehousePackageEntity.setTotalPrice(json.getBigDecimal("warehouseServiceFee")); statisticsWarehousePackageEntity.setWarehouseServiceFee(json.getBigDecimal("warehouseServiceFee")); statisticsWarehousePackageEntity.setRealWarehouseServiceFee(json.getBigDecimal("warehouseServiceFee")); statisticsWarehousePackageEntity.setWarehouseFee(json.getBigDecimal("warehouseFee")); @@ -159,6 +162,8 @@ public class WaybillFanoutListener { statisticsDistributionPackageEntity.setTotalNum(json.getInt("totalNum")); statisticsDistributionPackageEntity.setTotalWeight(json.getBigDecimal("totalWeight")); statisticsDistributionPackageEntity.setTotalVolume(json.getBigDecimal("totalVolume")); + statisticsDistributionPackageEntity.setOpenPrice(json.getBigDecimal("deliveryServiceFee")); + statisticsDistributionPackageEntity.setTotalPrice(json.getBigDecimal("deliveryServiceFee")); statisticsDistributionPackageEntity.setDeliveryServiceFee(json.getBigDecimal("deliveryServiceFee")); statisticsDistributionPackageEntity.setRealDeliveryServiceFee(json.getBigDecimal("deliveryServiceFee")); statisticsDistributionPackageEntity.setDeliveryFee(json.getBigDecimal("deliveryFee")); @@ -204,6 +209,9 @@ public class WaybillFanoutListener { statisticsOrderInfoEntity.setWaybillNo(waybillNo); statisticsOrderInfoEntity.setOrderCode(key); statisticsOrderInfoEntity.setTypeService(typeService); + statisticsOrderInfoEntity.setSignStatus(0); + statisticsOrderInfoEntity.setConfirmStatisticsOrder(0); + statisticsOrderInfoEntity.setChangesFee(BigDecimal.ZERO); orderInfoEntities.add(statisticsOrderInfoEntity); }); @@ -220,33 +228,46 @@ public class WaybillFanoutListener { statisticsTrunklinePackageEntity.setOrderInfoId(orderInfoId); }); statisticsTrunklinePackageSaveList.addAll(statisticsTrunklinePackageEntityList); - }); - statisticsTrunklinePackageService.saveBatch(statisticsTrunklinePackageSaveList); - - orderInfoEntities.forEach(statisticsOrderInfoEntity -> { - String orderCode = statisticsOrderInfoEntity.getOrderCode(); - Long orderInfoId = statisticsOrderInfoEntity.getId(); List statisticsWarehousePackageEntityList= warehouseMap.get(orderCode); statisticsWarehousePackageEntityList.forEach(statisticsWarehousePackageEntity -> { statisticsWarehousePackageEntity.setOrderInfoId(orderInfoId); }); statisticsWarehousePackageSaveList.addAll(statisticsWarehousePackageEntityList); - }); - - statisticsWarehousePackageService.saveBatch(statisticsWarehousePackageSaveList); - - orderInfoEntities.forEach(statisticsOrderInfoEntity -> { - String orderCode = statisticsOrderInfoEntity.getOrderCode(); - Long orderInfoId = statisticsOrderInfoEntity.getId(); List statisticsDistributionPackageEntityList= distributionMap.get(orderCode); statisticsDistributionPackageEntityList.forEach(statisticsDistributionPackageEntity -> { statisticsDistributionPackageEntity.setOrderInfoId(orderInfoId); }); statisticsDistributionPackageSaveList.addAll(statisticsDistributionPackageEntityList); - }); + }); + statisticsTrunklinePackageService.saveBatch(statisticsTrunklinePackageSaveList); + statisticsWarehousePackageService.saveBatch(statisticsWarehousePackageSaveList); statisticsDistributionPackageService.saveBatch(statisticsDistributionPackageSaveList); +// orderInfoEntities.forEach(statisticsOrderInfoEntity -> { +// String orderCode = statisticsOrderInfoEntity.getOrderCode(); +// Long orderInfoId = statisticsOrderInfoEntity.getId(); +// List statisticsWarehousePackageEntityList= warehouseMap.get(orderCode); +// statisticsWarehousePackageEntityList.forEach(statisticsWarehousePackageEntity -> { +// statisticsWarehousePackageEntity.setOrderInfoId(orderInfoId); +// }); +// statisticsWarehousePackageSaveList.addAll(statisticsWarehousePackageEntityList); +// }); +// +// statisticsWarehousePackageService.saveBatch(statisticsWarehousePackageSaveList); +// +// orderInfoEntities.forEach(statisticsOrderInfoEntity -> { +// String orderCode = statisticsOrderInfoEntity.getOrderCode(); +// Long orderInfoId = statisticsOrderInfoEntity.getId(); +// List statisticsDistributionPackageEntityList= distributionMap.get(orderCode); +// statisticsDistributionPackageEntityList.forEach(statisticsDistributionPackageEntity -> { +// statisticsDistributionPackageEntity.setOrderInfoId(orderInfoId); +// }); +// statisticsDistributionPackageSaveList.addAll(statisticsDistributionPackageEntityList); +// }); +// +// statisticsDistributionPackageService.saveBatch(statisticsDistributionPackageSaveList); + log.info("处理完成:{}", msg); } diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.java index 813153e10..4cdc33d8c 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.java +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.java @@ -16,4 +16,6 @@ public interface StatisticsOrderInfoMapper extends BaseMapper pageList(IPage page, @Param("param") MerchantStatisticsDTO merchantStatisticsDTO); List findStatementListByOrderInfoIds(@Param("orderInfoIds") List orderInfoIds); + + StatisticsOrderInfoVO findOrderDetail(@Param("orderInfoId") Long orderInfoId); } diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml index 8ebe0fd77..f013c28ee 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml @@ -104,7 +104,7 @@ left join (select ltwr.waybill_id from logpm_trunkline_waybill_return ltwr group by ltwr.waybill_id) twr on twr.waybill_id = lww.id left join logpm_statistics_trunkline_package lstp on lstp.order_info_id = lsoi.id left join logpm_statistics_warehouse_package lswp on lswp.order_info_id = lstp.order_info_id and lswp.order_package_code = lstp.order_package_code - left join logpm_statistics_distribution_package lsdp on lsdp.order_info_id = lswp.order_info_id = lsdp.order_package_code = lswp.order_package_code + left join logpm_statistics_distribution_package lsdp on lsdp.order_info_id = lswp.order_info_id and lsdp.order_package_code = lswp.order_package_code left join logpm_statistics_changes_record lscr on lscr.order_info_id = lsoi.id where 1=1 diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsOrderInfoService.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsOrderInfoService.java index 7f025e074..448139174 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsOrderInfoService.java +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsOrderInfoService.java @@ -24,4 +24,6 @@ public interface IStatisticsOrderInfoService extends BaseService orderInfoIds = new ArrayList<>(); + orderInfoIds.add(orderInfoId); + List statementListByOrderInfoIds = baseMapper.findStatementListByOrderInfoIds(orderInfoIds); + return statementListByOrderInfoIds.get(0); + } + private void updateOrderChangesFee(Long orderInfoId) { StatisticsOrderInfoEntity statisticsOrderInfoEntity = baseMapper.selectById(orderInfoId); diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/OpenOrderController.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/OpenOrderController.java index c4192f864..134da4d2a 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/OpenOrderController.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/OpenOrderController.java @@ -9,7 +9,6 @@ import com.logpm.trunkline.dto.AdvanceDTO; import com.logpm.trunkline.dto.OpenLabelDTO; import com.logpm.trunkline.dto.OpenOrderDTO; import com.logpm.trunkline.dto.WaybillDetailDTO; -import com.logpm.trunkline.entity.TrunklineAdvanceEntity; import com.logpm.trunkline.service.ICarsLoadAsyncService; import com.logpm.trunkline.service.IOpenOrderService; import com.logpm.trunkline.service.ITrunklineCarsLoadService; @@ -1691,4 +1690,37 @@ public class OpenOrderController { } + @ResponseBody + @PostMapping("/findWaybillDes") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "查询运单目的仓", notes = "传入openOrderDTO") + public R findWaybillDes(@RequestBody OpenOrderDTO openOrderDTO) { + String method = "############findWaybillDes: "; + log.info(method + "请求参数{}", openOrderDTO); + Long departureWarehouseId = openOrderDTO.getDepartureWarehouseId(); + Long consigneeId = openOrderDTO.getConsigneeId(); + + + try{ + + if(Objects.isNull(departureWarehouseId)){ + log.warn(method+"发站仓id为空 departureWarehouseId={}",departureWarehouseId); + return R.fail(405,"发站仓id为空"); + } + if(Objects.isNull(consigneeId)){ + log.warn(method+"收货单位id不能为空 consigneeId={}",consigneeId); + return R.fail(405,"收货单位id不能为空"); + } + + return openOrderService.findWaybillDes(departureWarehouseId,consigneeId); + }catch (CustomerException e){ + log.error(e.message,e); + return R.fail(e.code,e.message); + }catch (Exception e){ + log.error(method+"系统异常",e); + return R.fail(500,"系统异常"); + } + } + + } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.xml index 6afe2abe9..6e0c835b7 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadMapper.xml @@ -446,8 +446,10 @@ lww.remark remark, ROUND(lww.total_freight/lww.total_count,2) price from logpm_distribution_stock_article ldsa - left join logpm_warehouse_waybill lww on lww.waybill_no = ldsa.waybill_number + left join logpm_warehouse_waybill lww on lww.waybill_no = ldsa.waybill_number where ldsa.is_zero = 1 + and lww.destination_warehouse_id != #{param.warehouseId} + and ldsa.hand_quantity > 0 and ldsa.warehouse_id = #{param.warehouseId} and ldsa.order_code not in diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml index d960d9758..e1635eb5c 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineCarsLoadScanMapper.xml @@ -773,7 +773,7 @@ select ltcls.*, ltco.sign_order_id signOrderId from logpm_trunkline_cars_load_scan ltcls - left join logpm_trunkline_cars_order ltco on ltco.waybill_id = ltcls.waybill_id and ltco.order_code = ltcls.order_code and ltcls.warehouse_id = ltco.warehouse_id + left join logpm_trunkline_cars_order ltco on ltco.waybill_id = ltcls.waybill_id and ltco.order_code = ltcls.order_code and ltcls.warehouse_id = ltco.node_id where ltcls.scan_status = '1' and ltcls.id in diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineLoadSignOrderMapper.xml b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineLoadSignOrderMapper.xml index ba7844624..f0492bf19 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineLoadSignOrderMapper.xml +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineLoadSignOrderMapper.xml @@ -66,6 +66,9 @@ ltcls.unload_num unloadNum, ltcls.remark remak, ltcls.load_code carsNo, + ltcls.sign_user_name signUserName, + ltcls.sign_time signTime, + ltcls.unload_time unloadTime, ltco.sign_order_id signOrderId from logpm_trunkline_cars_order ltco left join logpm_trunkline_cars_load_scan ltcls on ltco.load_id = ltcls.load_id and ltco.node_id = ltcls.warehouse_id and ltcls.order_code = ltco.order_code and ltcls.waybill_no = ltco.waybill_no diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderService.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderService.java index c1dae0a2a..d6dcb0b8a 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderService.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderService.java @@ -87,6 +87,8 @@ public interface IOpenOrderService { R abolishWaybill(List waybillIds, Long warehouseId, String warehouseName, String abolishReson); + R findWaybillDes(Long departureWarehouseId, Long consigneeId); + // R findWaybillInfo(String waybillNo); } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderAsyncServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderAsyncServiceImpl.java index eb360b6e6..f459e6378 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderAsyncServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderAsyncServiceImpl.java @@ -354,8 +354,14 @@ public class OpenOrderAsyncServiceImpl implements IOpenOrderAsyncService { BigDecimal otherFee = waybillEntity.getOtherFee(); BigDecimal otherPrice = otherFee.divide(new BigDecimal(totalCount), 2, RoundingMode.HALF_UP); BigDecimal rebate = waybillEntity.getRebate(); + if(Objects.isNull(rebate)){ + rebate = BigDecimal.ZERO; + } BigDecimal rebatePrice = rebate.divide(new BigDecimal(totalCount), 2, RoundingMode.HALF_UP); BigDecimal thirdOperationFee = waybillEntity.getThirdOperationFee(); + if(Objects.isNull(thirdOperationFee)){ + thirdOperationFee = BigDecimal.ZERO; + } BigDecimal thirdOperationPrice = thirdOperationFee.divide(new BigDecimal(totalCount), 2, RoundingMode.HALF_UP); BigDecimal xPay = waybillEntity.getXPay(); BigDecimal xPayPrice = xPay.divide(new BigDecimal(totalCount), 2, RoundingMode.HALF_UP); @@ -395,8 +401,16 @@ public class OpenOrderAsyncServiceImpl implements IOpenOrderAsyncService { json.put("productId",advanceDetailVO.getGoodsId()); json.put("productName",goodsName); json.put("totalNum",advanceDetailVO.getQuantity()); + BigDecimal weight = advanceDetailVO.getWeight(); + if(Objects.isNull(weight)){ + weight = BigDecimal.ZERO; + } json.put("totalWeight",advanceDetailVO.getWeight()); - json.put("totalVolume",advanceDetailVO.getVolume()); + BigDecimal volume = advanceDetailVO.getVolume(); + if(Objects.isNull(volume)){ + volume = BigDecimal.ZERO; + } + json.put("totalVolume",volume); WarehouseWayBillDetail warehouseWayBillDetail = detailsMap.get(goodsName); if(!Objects.isNull(warehouseWayBillDetail)){ @@ -404,9 +418,13 @@ public class OpenOrderAsyncServiceImpl implements IOpenOrderAsyncService { if(num > 0){ json.put("freightFee",warehouseWayBillDetail.getPrice()); openPrice = openPrice.add(warehouseWayBillDetail.getPrice()); + BigDecimal deliveryPrice = warehouseWayBillDetail.getDeliveryPrice(); + if(Objects.isNull(deliveryPrice)){ + deliveryPrice = BigDecimal.ZERO; + } json.put("deliveryFee",warehouseWayBillDetail.getDeliveryPrice()); json.put("deliveryServiceFee",warehouseWayBillDetail.getDeliveryPrice()); - openPrice = openPrice.add(warehouseWayBillDetail.getDeliveryPrice()); + openPrice = openPrice.add(deliveryPrice); warehouseWayBillDetail.setNum(num-1); detailsMap.put(goodsName,warehouseWayBillDetail); } @@ -434,7 +452,7 @@ public class OpenOrderAsyncServiceImpl implements IOpenOrderAsyncService { json.put("dPay",dPayPrice); json.put("hPay",hPayPrice); json.put("yPay",yPayPrice); - openPrice = openPrice.add(installPrice).add(insurancePrice).add(claimingPrice).add(otherPrice).add(rebatePrice).add(thirdOperationPrice).add(xPayPrice).add(dPayPrice).add(hPayPrice).add(yPayPrice); + openPrice = openPrice.add(installPrice).add(insurancePrice).add(claimingPrice).add(otherPrice).add(rebatePrice).add(thirdOperationPrice); json.put("openPrice",openPrice); jsonList.add(json); }); @@ -450,29 +468,41 @@ public class OpenOrderAsyncServiceImpl implements IOpenOrderAsyncService { // 使用 BigDecimal 的 add 方法来正确累加总价,确保精度 otherTotalPriceList.add(warehouseWayBillDetail.getPrice().multiply(new BigDecimal(num))); - otherTotalDeliveryPriceList.add(warehouseWayBillDetail.getDeliveryPrice().multiply(new BigDecimal(num))); + BigDecimal deliveryPrice = warehouseWayBillDetail.getDeliveryPrice(); + if(Objects.isNull(deliveryPrice)){ + deliveryPrice = BigDecimal.ZERO; + } + otherTotalDeliveryPriceList.add(deliveryPrice.multiply(new BigDecimal(num))); } }); int otherNum = atomicOtherNum.get(); + + BigDecimal p = BigDecimal.ZERO; + BigDecimal dp = BigDecimal.ZERO; //otherTotalPriceList元素求和 - BigDecimal otherTotalPrice = otherTotalPriceList.stream().reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal p = otherTotalPrice.divide(new BigDecimal(otherNum), 2, RoundingMode.HALF_UP); - BigDecimal otherTotalDeliveryPrice = otherTotalDeliveryPriceList.stream().reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal dp = otherTotalDeliveryPrice.divide(new BigDecimal(otherNum), 2, RoundingMode.HALF_UP); + if(otherNum > 0){ + BigDecimal otherTotalPrice = otherTotalPriceList.stream().reduce(BigDecimal.ZERO, BigDecimal::add); + p = otherTotalPrice.divide(new BigDecimal(otherNum), 2, RoundingMode.HALF_UP); + BigDecimal otherTotalDeliveryPrice = otherTotalDeliveryPriceList.stream().reduce(BigDecimal.ZERO, BigDecimal::add); + dp = otherTotalDeliveryPrice.divide(new BigDecimal(otherNum), 2, RoundingMode.HALF_UP); + } + + BigDecimal finalP = p; + BigDecimal finalDp = dp; jsonList.forEach(json -> { BigDecimal op = json.getBigDecimal("openPrice"); BigDecimal freightFee = json.getBigDecimal("freightFee"); if(Objects.isNull(freightFee)){ - json.put("freightFee",p); - op = op.add(p); + json.put("freightFee", finalP); + op = op.add(finalP); } BigDecimal deliveryFee = json.getBigDecimal("deliveryFee"); if(Objects.isNull(deliveryFee)){ - json.put("deliveryFee",dp); - json.put("deliveryServiceFee",dp); - op = op.add(dp); + json.put("deliveryFee", finalDp); + json.put("deliveryServiceFee", finalDp); + op = op.add(finalDp); } json.put("openPrice",op); }); 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 40ce4c1eb..3011afb98 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 @@ -178,6 +178,16 @@ public class OpenOrderServiceImpl implements IOpenOrderService { areaId = badeRegionAreaId; } + openOrderVO.setDefaultDeliveryWay("2"); + Integer typeService = basicdataClientEntity.getTypeService(); + if (typeService == 1){ + openOrderVO.setDefaultDeliveryWay("2"); + }else if(typeService == 2){ + openOrderVO.setDefaultDeliveryWay("3"); + }else if(typeService == 3){ + openOrderVO.setDefaultDeliveryWay("1"); + } + openOrderVO.setDeparture(name); openOrderVO.setDepartureCode(areaId); openOrderVO.setDepartureArray(departureArray); @@ -197,9 +207,12 @@ public class OpenOrderServiceImpl implements IOpenOrderService { openOrderVO.setConsigneeMobile(basicdataClientEntity.getPhone()); openOrderVO.setConsigneeAddress(basicdataClientEntity.getDetailedly()); if(!Objects.isNull(advanceEntity)){ - openOrderVO.setConsigneeName(advanceEntity.getConsigneePerson()); - openOrderVO.setConsigneeMobile(advanceEntity.getConsigneeMobile()); - openOrderVO.setConsigneeAddress(advanceEntity.getConsigneeAddress()); + String consigneePerson = advanceEntity.getConsigneePerson(); + if(!StringUtil.isBlank(consigneePerson)){ + openOrderVO.setConsigneeName(consigneePerson); + openOrderVO.setConsigneeMobile(advanceEntity.getConsigneeMobile()); + openOrderVO.setConsigneeAddress(advanceEntity.getConsigneeAddress()); + } } List destinationArray = new ArrayList<>(); @@ -3128,6 +3141,21 @@ public class OpenOrderServiceImpl implements IOpenOrderService { return R.success("作废成功"); } + @Override + public R findWaybillDes(Long departureWarehouseId, Long consigneeId) { + + Map map = new HashMap<>(); + map.put("destinationWarehouseId",null); + map.put("destinationWarehouseName",null); + + BasicdataStorageServicesEntity basicdataStorageServicesEntity = basicdataStorageServicesClient.findEntityBySendWarehouseIdAndClientId(departureWarehouseId, consigneeId); + if (!Objects.isNull(basicdataStorageServicesEntity)) { + map.put("destinationWarehouseId",basicdataStorageServicesEntity.getServeWarehouseId()); + map.put("destinationWarehouseName",basicdataStorageServicesEntity.getServeWarehouseName()); + } + return R.data(map); + } + private List verifyData(OpenOrderDTO openOrderDTO, WarehouseWaybillEntity waybillEntity) { log.info("###################verifyData: 验证改单数据"); StringBuilder stringBuilder = new StringBuilder(); 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 1ea2ef978..a5e6c386a 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 @@ -2938,6 +2938,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl !"1".equals(e.getScanStatus())).collect(Collectors.toList()); + list = list.stream().filter(e -> "1".equals(e.getScanStatus())).collect(Collectors.toList()); List orderPackageCodes = new ArrayList<>(); @@ -4340,6 +4350,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl PROCESSED_REQUEST_HASH = new ThreadLocal<>(); + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + if (handler instanceof HandlerMethod) { + HandlerMethod hm = (HandlerMethod) handler; + RepeatSubmit annotation = hm.getMethodAnnotation(RepeatSubmit.class); + if (annotation != null) { + // 计算当前请求参数的MD5哈希值 + String currentRequestHash = calculateRequestHash(request.getParameterMap()); + // 检查是否已处理过相同参数组合的请求 + if (PROCESSED_REQUEST_HASH.get() != null && PROCESSED_REQUEST_HASH.get().equals(currentRequestHash)) { + // 阻止重复提交 + response.sendError(HttpServletResponse.SC_CONFLICT, "Duplicate submit detected"); + return false; + } + // 保存当前请求的哈希值 + PROCESSED_REQUEST_HASH.set(currentRequestHash); + } + } + return true; + } + + @Override + public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { + // 清理当前请求的哈希值 + PROCESSED_REQUEST_HASH.remove(); + } + + @Override + public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { + // 可选清理操作,postHandle中已处理 + } + + /** + * 计算请求参数的MD5哈希值。 + * @param parameters 请求参数Map + * @return 参数哈希值字符串 + */ + private String calculateRequestHash(Map parameters) { + // 将参数按key排序并拼接为字符串 + String sortedParams = parameters.entrySet().stream() + .sorted(Map.Entry.comparingByKey()) + .map(entry -> entry.getKey() + "=" + String.join(",", entry.getValue())) + .collect(Collectors.joining("&")); + // 计算并返回MD5摘要 + return DigestUtils.md5Hex(sortedParams); + } +}