Browse Source

Merge branch 'dev-xx' into dev

fix-sign
pref_mail@163.com 4 months ago
parent
commit
a4912a7b28
  1. 10
      blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java
  2. 8
      blade-biz-common/src/main/java/org/springblade/common/model/DistributionSignforVO.java
  3. 11
      blade-biz-common/src/main/java/org/springblade/common/model/PackageData.java
  4. 23
      blade-biz-common/src/main/java/org/springblade/common/model/workNode/PickUpByScanVO.java
  5. 5
      blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/MerchantStatisticsDTO.java
  6. 14
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWaybillEntity.java
  7. 1
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionStockupAppController.java
  8. 15
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java
  9. 22
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java
  10. 13
      blade-service/logpm-report/src/main/java/com/logpm/report/mapper/WarehouseIndexMapper.xml
  11. 72
      blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/controller/MerchantStatisticsController.java
  12. 8
      blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/WaybillCheckListener.java
  13. 3
      blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.java
  14. 176
      blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml
  15. 6
      blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsOrderInfoService.java
  16. 661
      blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsOrderInfoServiceImpl.java
  17. 1
      blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/vo/StatisticsPackageFeeInfoVO.java
  18. 161
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/waybil/StatusLogListener.java
  19. 19
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillTrackServiceImpl.java

10
blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java

@ -322,6 +322,11 @@ public abstract class FanoutConstants {
interface QUEUE { interface QUEUE {
String REPORT = "fanout.distribution.DeliveryAndrecheck.report" + ModuleNameConstant.DEVAUTH; String REPORT = "fanout.distribution.DeliveryAndrecheck.report" + ModuleNameConstant.DEVAUTH;
String waybillStatusLog = "fanout.distribution.DeliveryAndrecheck.waybill.log" + ModuleNameConstant.DEVAUTH;
} }
} }
@ -396,6 +401,11 @@ public abstract class FanoutConstants {
interface QUEUE { interface QUEUE {
String REPORT = "fanout.BillSignReview.billsignreview.report" + ModuleNameConstant.DEVAUTH; String REPORT = "fanout.BillSignReview.billsignreview.report" + ModuleNameConstant.DEVAUTH;
//增加运单状态的变更日志
String waybillStatusLog = "fanout.BillSignReview.waybill.log" + ModuleNameConstant.DEVAUTH;
} }
} }

8
blade-biz-common/src/main/java/org/springblade/common/model/DistributionSignforVO.java

@ -3,6 +3,7 @@ package org.springblade.common.model;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -40,6 +41,13 @@ public class DistributionSignforVO implements Serializable {
* 签收车次 * 签收车次
*/ */
private String trainNumber; private String trainNumber;
/**
* 配送时间
*/
private Date deliveryTime;
/** /**
* 预约单ID * 预约单ID
*/ */

11
blade-biz-common/src/main/java/org/springblade/common/model/PackageData.java

@ -8,6 +8,7 @@ import org.springblade.common.enums.PackageTypeEnums;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
/** /**
* 提送数据 * 提送数据
@ -138,4 +139,14 @@ public class PackageData implements Serializable {
*/ */
private String systemType ; private String systemType ;
/**
* 签收时间
*/
private Date signTime;
/**
* 签收人
*/
private String signUser;//签收人
} }

23
blade-biz-common/src/main/java/org/springblade/common/model/workNode/PickUpByScanVO.java

@ -3,6 +3,7 @@ package org.springblade.common.model.workNode;
import lombok.Data; import lombok.Data;
import org.springblade.common.model.PackageData; import org.springblade.common.model.PackageData;
import java.util.Date;
import java.util.List; import java.util.List;
@Data @Data
@ -12,6 +13,28 @@ public class PickUpByScanVO {
* 自提单号 * 自提单号
*/ */
private String pickupBatch; private String pickupBatch;
//
// /**
// * 车次号
// */
// private String trainNumber;
/**
* 车牌号
*/
private String carNumber;
/**
* 司机名称
*/
private String driverName;
/**
* 配送时间
*/
private Date deliveryTime;
/** /**
* 自提明细数据 * 自提明细数据

5
blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/MerchantStatisticsDTO.java

@ -24,7 +24,12 @@ public class MerchantStatisticsDTO implements Serializable {
private Integer confirmStatisticsOrder;//对账状态 0 1 private Integer confirmStatisticsOrder;//对账状态 0 1
private List<Long> reconciliationOrderIds; private List<Long> reconciliationOrderIds;
private List<Long> orderInfoIds; private List<Long> orderInfoIds;
/**
* 运单ID集合
*/
private List<Long> waybillIds;
private Long balanceOrderInfoId; private Long balanceOrderInfoId;

14
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseWaybillEntity.java

@ -547,6 +547,20 @@ public class WarehouseWaybillEntity extends TenantEntity {
@ApiModelProperty(value = "文员复核时间 ") @ApiModelProperty(value = "文员复核时间 ")
private Date signCheckTime; private Date signCheckTime;
/**
*付款状态(null) 10 未付款 20 部分付款 30 已付款
*/
@ApiModelProperty(value = "付款状态")
private String payStatus;
/**
* 结算状态nul 10未结算 20 部分结算 30 已结算
*/
@ApiModelProperty(value = "结算状态")
private String settlementStatus;

1
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/api/DistributionStockupAppController.java

@ -754,7 +754,6 @@ public class DistributionStockupAppController extends BladeController {
} }
//todo 这里代码没有写完 等TJJ 和CYZ 空了来写
@ResponseBody @ResponseBody
@PostMapping("/updateStockup") @PostMapping("/updateStockup")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)

15
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

@ -757,7 +757,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
// 推送作业节点数据 // 推送作业节点数据
NodeFanoutMsg<org.springblade.common.model.DistributionReCheckSignVO> nodeFanoutMsg = buildNodeFanoutMsgByReCheck(reservationEntity); NodeFanoutMsg<org.springblade.common.model.DistributionReCheckSignVO> nodeFanoutMsg = buildNodeFanoutMsgByReCheck(deliveryListEntity,reservationEntity);
iDistributionNodeWorkService.signForCheck(nodeFanoutMsg, AuthUtil.getUser()); iDistributionNodeWorkService.signForCheck(nodeFanoutMsg, AuthUtil.getUser());
// // 复核作业节点推送 // // 复核作业节点推送
@ -783,7 +783,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
distributionPlanLogService.save(distributionPlanLogEntity); distributionPlanLogService.save(distributionPlanLogEntity);
} }
private NodeFanoutMsg<org.springblade.common.model.DistributionReCheckSignVO> buildNodeFanoutMsgByReCheck(DistributionReservationEntity reservationEntity) { private NodeFanoutMsg<org.springblade.common.model.DistributionReCheckSignVO> buildNodeFanoutMsgByReCheck(DistributionDeliveryListEntity deliveryListEntity,DistributionReservationEntity reservationEntity) {
// 查询当前预约单下的定制品和零担签收数据 // 查询当前预约单下的定制品和零担签收数据
NodeFanoutMsg<org.springblade.common.model.DistributionReCheckSignVO> nodeFanoutMsg = new NodeFanoutMsg(); NodeFanoutMsg<org.springblade.common.model.DistributionReCheckSignVO> nodeFanoutMsg = new NodeFanoutMsg();
@ -798,6 +798,11 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
org.springblade.common.model.DistributionReCheckSignVO distributionLoadVO = new org.springblade.common.model.DistributionReCheckSignVO(); org.springblade.common.model.DistributionReCheckSignVO distributionLoadVO = new org.springblade.common.model.DistributionReCheckSignVO();
distributionLoadVO.setReservationCode(reservationEntity.getReservationCode()); distributionLoadVO.setReservationCode(reservationEntity.getReservationCode());
distributionLoadVO.setDeliveryTime(deliveryListEntity.getCreateTime());
distributionLoadVO.setTrainNumber(deliveryListEntity.getTrainNumber());
distributionLoadVO.setVehicleName(deliveryListEntity.getVehicleName());
distributionLoadVO.setDriverName(deliveryListEntity.getDriverName());
nodeFanoutMsg.setMain(distributionLoadVO); nodeFanoutMsg.setMain(distributionLoadVO);
@ -808,6 +813,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
for (DistributionLoadscanEntity distributionLoadscanEntity : list) { for (DistributionLoadscanEntity distributionLoadscanEntity : list) {
PackageData packageData = new PackageData(); PackageData packageData = new PackageData();
packageData.setSignTime(org.springblade.core.tool.utils.DateUtil.parse(distributionLoadscanEntity.getSigningTime(),"yyyy-mm-dd hh:mm:ss"));
packageData.setSignUser(distributionLoadscanEntity.getSigningUser());
// 不是零担 // 不是零担
if (distributionLoadscanEntity.getIsZero() == null || distributionLoadscanEntity.getIsZero() == 0) { if (distributionLoadscanEntity.getIsZero() == null || distributionLoadscanEntity.getIsZero() == 0) {
packageData.setPackageCode(distributionLoadscanEntity.getOrderPackageCode()); packageData.setPackageCode(distributionLoadscanEntity.getOrderPackageCode());
@ -816,6 +823,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
DistributionParcelListEntity distributionParcelListEntity1 = distributionParcelListService.selectByOrderPackageCode(distributionLoadscanEntity.getOrderPackageCode(), distributionLoadscanEntity.getWarehouseId()); DistributionParcelListEntity distributionParcelListEntity1 = distributionParcelListService.selectByOrderPackageCode(distributionLoadscanEntity.getOrderPackageCode(), distributionLoadscanEntity.getWarehouseId());
if (Func.isNotEmpty(distributionParcelListEntity1)) { if (Func.isNotEmpty(distributionParcelListEntity1)) {
packageData.setBrand(distributionParcelListEntity1.getBrandName()); packageData.setBrand(distributionParcelListEntity1.getBrandName());
packageData.setWaybillNumber(distributionParcelListEntity1.getWaybillNumber());
packageData.setOrderCode(distributionParcelListEntity1.getOrderCode());
} }
} else { } else {
// 零担 // 零担
@ -7092,7 +7101,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
buildArgsToPushMq(distributionSignfor); buildArgsToPushMq(distributionSignfor);
if (isSuccess) { if (isSuccess) {
//整理签收数据回退干线 //整理签收数据回退干线
handletrunklineWaybillSignLog(distributionSignfor.getReservationId()); // handletrunklineWaybillSignLog(distributionSignfor.getReservationId());
this.updateById(distributionSignfor); this.updateById(distributionSignfor);

22
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java

@ -3968,7 +3968,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
} }
} }
} catch (Exception e) { } catch (Exception e) {
log.error("推送失败:{}", e); log.error("推送失败:", e);
} }
for (DistributionBillLadingScanEntity ladingScanEntity : ladingScanEntities) { for (DistributionBillLadingScanEntity ladingScanEntity : ladingScanEntities) {
if (ladingScanEntity.getStockArticleId() != null) { if (ladingScanEntity.getStockArticleId() != null) {
@ -4034,15 +4034,15 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
//释放库存品 //释放库存品
updateStock(s, scanEntityList); updateStock(s, scanEntityList);
} }
Integer num = baseMapper.selectBillLadingLoading(billLadingEntity.getId()); Integer num = baseMapper.selectBillLadingLoading(distrilbutionBillLadingEntity.getId());
//自提复核日志 //自提复核日志
handleDExamineDistributionPlanLog(billLadingEntity, AuthUtil.getUser(), myCurrentWarehouse, num); handleDExamineDistributionPlanLog(distrilbutionBillLadingEntity, AuthUtil.getUser(), myCurrentWarehouse, num);
// 回传老系统自提数据 // 回传老系统自提数据
sendOldSystem(Long.parseLong(s)); sendOldSystem(Long.parseLong(s));
//整理运单信息 //整理运单信息
handletrunklineWaybillSignLog(billLadingEntity.getId()); // handletrunklineWaybillSignLog(billLadingEntity.getId());
NodeFanoutMsg<PickUpByReCheckVO> nodeFanoutMsg = buildPickUpByReCheckVO(billLadingEntity, ladingScanEntities, myCurrentWarehouse); NodeFanoutMsg<PickUpByReCheckVO> nodeFanoutMsg = buildPickUpByReCheckVO(distrilbutionBillLadingEntity, ladingScanEntities, myCurrentWarehouse);
iDistributionNodeWorkService.billofladingSignforCheck(nodeFanoutMsg, AuthUtil.getUser()); iDistributionNodeWorkService.billofladingSignforCheck(nodeFanoutMsg, AuthUtil.getUser());
//推送该自提单的包件运单信息 //推送该自提单的包件运单信息
@ -4163,13 +4163,17 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
nodeFanoutMsg.setTenantId(myCurrentWarehouse.getTenantId()); nodeFanoutMsg.setTenantId(myCurrentWarehouse.getTenantId());
PickUpByReCheckVO pickUpByReCheckVO = new PickUpByReCheckVO(); PickUpByReCheckVO pickUpByReCheckVO = new PickUpByReCheckVO();
pickUpByReCheckVO.setPickupBatch(billLadingEntity.getPickupBatch()); pickUpByReCheckVO.setPickupBatch(billLadingEntity.getPickupBatch());
pickUpByReCheckVO.setCarNumber(billLadingEntity.getPickUpPlate());
pickUpByReCheckVO.setDriverName(billLadingEntity.getConsignee());
pickUpByReCheckVO.setDeliveryTime(billLadingEntity.getPickUpTime());
List<PackageData> packageDataList = new ArrayList<>(); List<PackageData> packageDataList = new ArrayList<>();
pickUpByReCheckVO.setPackageDataList(packageDataList); pickUpByReCheckVO.setPackageDataList(packageDataList);
ladingScanEntities.forEach(t -> { ladingScanEntities.forEach(t -> {
PackageData packageData = new PackageData(); PackageData packageData = new PackageData();
packageData.setSignUser(t.getScanUser());
packageData.setSignTime(t.getCreateTime());
if ("1".equals(t.getMaterialType())) { if ("1".equals(t.getMaterialType())) {
// 库存 // 库存
Long stockListId = t.getStockListId(); Long stockListId = t.getStockListId();
@ -4182,10 +4186,16 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
packageData.setMaterialCode(byId.getCargoNumber()); packageData.setMaterialCode(byId.getCargoNumber());
packageData.setNumber(t.getQuantity()); packageData.setNumber(t.getQuantity());
packageData.setPackageType(PackageTypeEnums.INV); packageData.setPackageType(PackageTypeEnums.INV);
} }
} else if ("2".equals(t.getMaterialType())) { } else if ("2".equals(t.getMaterialType())) {
//定制品 //定制品
DistributionParcelListEntity byId = distributionParcelListService.getById(t.getParcelListId());
if (Func.isNotEmpty(byId)) {
packageData.setOrderCode(byId.getOrderCode());
packageData.setWaybillNumber(byId.getWaybillNumber());
}
packageData.setPackageCode(t.getPacketBarCode()); packageData.setPackageCode(t.getPacketBarCode());
packageData.setNumber(1); packageData.setNumber(1);
packageData.setPackageType(PackageTypeEnums.CMP); packageData.setPackageType(PackageTypeEnums.CMP);

13
blade-service/logpm-report/src/main/java/com/logpm/report/mapper/WarehouseIndexMapper.xml

@ -13,7 +13,7 @@
<if test="param.endDate != null"> <if test="param.endDate != null">
and create_time &lt;= #{param.endDate} and create_time &lt;= #{param.endDate}
</if> </if>
and departure_warehouse_id in and destination_warehouse_id in
<foreach collection="param.warehouseIds" item="item" open="(" separator="," close=")"> <foreach collection="param.warehouseIds" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
@ -24,7 +24,7 @@
select IFNULL(sum(IFNULL(x_pay,0)+IFNULL(d_pay,0)+IFNULL(y_pay,0)+IFNULL(h_pay,0)),0) select IFNULL(sum(IFNULL(x_pay,0)+IFNULL(d_pay,0)+IFNULL(y_pay,0)+IFNULL(h_pay,0)),0)
from logpm_warehouse_waybill from logpm_warehouse_waybill
where 1=1 where 1=1
and departure_warehouse_id in and destination_warehouse_id in
<foreach collection="param.warehouseIds" item="item" open="(" separator="," close=")"> <foreach collection="param.warehouseIds" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
@ -45,7 +45,7 @@
<if test="param.endDate != null"> <if test="param.endDate != null">
and create_time &lt;= #{param.endDate} and create_time &lt;= #{param.endDate}
</if> </if>
and departure_warehouse_id in and destination_warehouse_id in
<foreach collection="param.warehouseIds" item="item" open="(" separator="," close=")"> <foreach collection="param.warehouseIds" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
@ -924,7 +924,7 @@
</select> </select>
<select id="findTotalNumByWarWarehouseId" <select id="findTotalNumByWarWarehouseId"
resultType="com.logpm.report.vo.indexCount.IndexOpenItemDataByWarWarehouseIdVO"> resultType="com.logpm.report.vo.indexCount.IndexOpenItemDataByWarWarehouseIdVO">
select departure_warehouse_id as warehouseId,departure_warehouse_name as warehouseName , select destination_warehouse_id as warehouseId,destination_warehouse_name as warehouseName ,
IFNULL(count(id),0) totalNum, IFNULL(count(id),0) totalNum,
IFNULL(sum(total_count),0) totalCount IFNULL(sum(total_count),0) totalCount
from logpm_warehouse_waybill from logpm_warehouse_waybill
@ -935,11 +935,12 @@
<if test="param.endDate != null"> <if test="param.endDate != null">
and create_time &lt;= #{param.endDate} and create_time &lt;= #{param.endDate}
</if> </if>
and departure_warehouse_id in and destination_warehouse_id in
<foreach collection="param.warehouseIds" item="item" open="(" separator="," close=")"> <foreach collection="param.warehouseIds" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
GROUP BY departure_warehouse_id AND YEAR(create_time) = YEAR(CURDATE())
GROUP BY destination_warehouse_id
</select> </select>
<select id="handOrderDataByWarehouseId" resultType="com.logpm.report.vo.IndexHandOrderDataByWarehouseIdVO"> <select id="handOrderDataByWarehouseId" resultType="com.logpm.report.vo.IndexHandOrderDataByWarehouseIdVO">
select select

72
blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/controller/MerchantStatisticsController.java

@ -100,6 +100,55 @@ public class MerchantStatisticsController {
} }
} }
@ResponseBody
@PostMapping("/createFinishWaybillId")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "批量结算完成", notes = "传入merchantStatisticsDTO")
public R createFinishWaybillId(@RequestBody MerchantStatisticsDTO merchantStatisticsDTO) {
String method = "############createReconciliationOrder: ";
log.info(method + "请求参数{}", merchantStatisticsDTO);
try {
List<Long> waybillIds = merchantStatisticsDTO.getWaybillIds();
if (CollUtil.isEmpty(waybillIds)) {
log.warn(method + "请选择正确的订单 merchantStatisticsDTO={}", merchantStatisticsDTO);
return R.fail(405, "请选择正确的订单");
}
return statisticsOrderInfoService.createFinishWaybillId(waybillIds);
} 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("/createReconciliationwWaybillId")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "创建对账单", notes = "传入merchantStatisticsDTO")
public R createReconciliationwWaybillId(@RequestBody MerchantStatisticsDTO merchantStatisticsDTO) {
String method = "############createReconciliationOrder: ";
log.info(method + "请求参数{}", merchantStatisticsDTO);
try {
List<Long> waybillIds = merchantStatisticsDTO.getWaybillIds();
if (CollUtil.isEmpty(waybillIds)) {
log.warn(method + "请选择正确的订单 merchantStatisticsDTO={}", merchantStatisticsDTO);
return R.fail(405, "请选择正确的订单");
}
return statisticsOrderInfoService.createReconciliationWaybillId(waybillIds);
} 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 @ResponseBody
@PostMapping("/pageReconciliationList") @PostMapping("/pageReconciliationList")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ -368,4 +417,27 @@ public class MerchantStatisticsController {
} }
@ResponseBody
@PatchMapping("/calculateRealCostByWaybillId/{id}")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "计算实际费用", notes = "计算实际费用")
public R<Boolean> calculateRealCostByWaybillId(@PathVariable("id") Long id) {
String method = "############calculateRealCost: ";
log.info(method + "请求参数{}", id);
try {
return R.status(statisticsOrderInfoService.calculateRealCostByWaybillId(id));
} 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, "系统异常");
}
}
} }

8
blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/listener/mq/WaybillCheckListener.java

@ -85,10 +85,10 @@ public class WaybillCheckListener {
log.warn("###############checkWaybillIncomingData: 运单类型不正确 waybillId={} waybillType={}", waybillId, waybillType); log.warn("###############checkWaybillIncomingData: 运单类型不正确 waybillId={} waybillType={}", waybillId, waybillType);
} }
if (payWay.equals("1") || payWay.equals("2")) { // if (payWay.equals("1") || payWay.equals("2")) {
//如果是现付和到付需要直接生成结算单 // //如果是现付和到付需要直接生成结算单
createBalanceOrder(waybillEntity); // createBalanceOrder(waybillEntity);
} // }
log.info("#########checkWaybillIncomingData: 运单审核处理收入结算数据 结束 waybillId={}", waybillId); log.info("#########checkWaybillIncomingData: 运单审核处理收入结算数据 结束 waybillId={}", waybillId);
} }

3
blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.java

@ -28,6 +28,7 @@ public interface StatisticsOrderInfoMapper extends BaseMapper<StatisticsOrderInf
StatisticsPackageFeeInfoVO findPackageListByOrderIds(@Param("orderInfoIds") List<Long> orderInfoIdsList); StatisticsPackageFeeInfoVO findPackageListByOrderIds(@Param("orderInfoIds") List<Long> orderInfoIdsList);
List<StatisticsPackageFeeInfoVO> findPackageListByOrderIdsGroupById(@Param("orderInfoIds") List<Long> orderInfoIdList); List<StatisticsPackageFeeInfoVO> findPackageListByOrderIdsGroupById(@Param("orderInfoIds") List<Long> orderInfoIdList);
List<StatisticsPackageFeeInfoVO> findPackageListByOrderIdsGroupByWaybillId(@Param("waybillIds") Set<Long> orderInfoIdList);
List<Long> findOrderInfoIdListByReconciliationOrderIds(@Param("reconciliationOrderIds") List<Long> reconciliationOrderIds); List<Long> findOrderInfoIdListByReconciliationOrderIds(@Param("reconciliationOrderIds") List<Long> reconciliationOrderIds);
@ -48,4 +49,6 @@ public interface StatisticsOrderInfoMapper extends BaseMapper<StatisticsOrderInf
void deleteDataByWaybillId(@Param("waybillId") Long waybillId); void deleteDataByWaybillId(@Param("waybillId") Long waybillId);
List<AdvanceDetailDTO> selectAdvinceDetail(@Param("waybillIds") Set<Long> waybillIds, @Param("orderCodes") Set<String> orderCodes); List<AdvanceDetailDTO> selectAdvinceDetail(@Param("waybillIds") Set<Long> waybillIds, @Param("orderCodes") Set<String> orderCodes);
IPage<StatisticsOrderInfoVO> pageList2B(IPage<Object> page, @Param("param") MerchantStatisticsDTO merchantStatisticsDTO);
} }

176
blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml

@ -498,6 +498,52 @@
group by lstp.order_info_id group by lstp.order_info_id
</select> </select>
<select id="findPackageListByOrderIdsGroupByWaybillId" resultType="com.logpm.statistics.vo.StatisticsPackageFeeInfoVO">
select
lstp.waybill_id,
GROUP_CONCAT(DISTINCT lswp.product_name ORDER BY lswp.product_name) goodsName,
IFNULL(sum(lstp.num),0) totalNum,
IFNULL(sum(lstp.weight),0) totalWeight,
IFNULL(sum(lstp.volume),0) totalVolume,
IFNULL(sum(lstp.system_freight_price),0)+IFNULL(sum(lstp.system_pickup_price),0)+IFNULL(sum(lswp.warehouse_service_fee),0)+IFNULL(sum(lsdp.delivery_service_fee),0)
sysTotalFee,
IFNULL(sum(lstp.freight_price),0)+IFNULL(sum(lstp.pickup_price),0)+IFNULL(sum(lswp.warehouse_service_fee),0)+IFNULL(sum(lsdp.delivery_service_fee),0)
totalFee,
IFNULL(sum(lstp.system_freight_price),0) systemFreightPrice,
IFNULL(sum(lstp.freight_price),0) freightPrice,
IFNULL(sum(lstp.system_pickup_price),0) systemPickupPrice,
IFNULL(sum(lstp.pickup_price),0) pickupPrice,
IFNULL(sum(lswp.warehouse_service_fee),0) warehouseServiceFee,
IFNULL(sum(lswp.warehouse_fee),0) warehouseFee,
IFNULL(sum(lswp.warehouse_manage_fee),0) warehouseManageFee,
IFNULL(sum(lswp.warehouse_sorting_fee),0) warehouseSortingFee,
IFNULL(sum(lswp.warehouse_operating_fee),0) warehouseOperatingFee,
IFNULL(sum(lsdp.system_delivery_fee),0) systemDeliveryFee,
IFNULL(sum(lsdp.delivery_service_fee),0) deliveryServiceFee,
IFNULL(sum(lsdp.delivery_fee),0) deliveryFee,
IFNULL(sum(lsdp.delivery_loading_fee),0) deliveryLoadingFee,
IFNULL(sum(lsdp.delivery_sorting_fee),0) deliverySortingFee,
IFNULL(sum(lsdp.delivery_upfloor_fee),0) deliveryUpfloorFee,
IFNULL(sum(lsdp.delivery_move_fee),0) deliveryMoveFee,
IFNULL(sum(lsdp.delivery_other_fee),0) deliveryOtherFee,
IFNULL(sum(lsdp.delivery_crossing_fee),0) deliveryCrossingFee,
IFNULL(sum(lsdp.sign_num),0) signNum,
max(lsdp.sign_time) signTime
from logpm_statistics_trunkline_package lstp
left join logpm_statistics_warehouse_package lswp on lswp.order_info_id = lstp.order_info_id and
IFNULL(lswp.order_package_code,'0') = IFNULL(lstp.order_package_code,'0') and IFNULL(lswp.product_id,1) =
IFNULL(lstp.product_id,1)
left join logpm_statistics_distribution_package lsdp on lsdp.order_info_id = lswp.order_info_id and
IFNULL(lsdp.order_package_code,'0') = IFNULL(lswp.order_package_code,'0') and IFNULL(lswp.product_id,1) =
IFNULL(lsdp.product_id,1)
where lstp.waybill_id in
<foreach collection="waybillIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
group by lstp.waybill_id
</select>
<select id="findOrderInfoIdListByReconciliationOrderIds" resultType="Long"> <select id="findOrderInfoIdListByReconciliationOrderIds" resultType="Long">
select id select id
from logpm_statistics_order_info lsoi from logpm_statistics_order_info lsoi
@ -577,6 +623,136 @@
#{item} #{item}
</foreach> </foreach>
</select>
<select id="pageList2B" resultType="com.logpm.statistics.vo.StatisticsOrderInfoVO">
select lsoi.id orderInfoId,
lsoi.brand_id brandId,
lsoi.brand brand,
lsoi.waybill_id waybillId,
lsoi.waybill_no waybillNo,
lsoi.order_code orderCode,
lsoi.type_service typeService,
lww.shipper shipper,
lww.shipper_name shipperPerson,
lww.shipper_mobile shipperMobile,
lww.shipper_address shipperAddress,
lww.consignee consignee,
lww.consignee_name consigneePerson,
lww.consignee_mobile consigneeMobile,
lww.consignee_address consigneeAddress,
case lww.waybill_status
when 100 then 2
when 90 then 1
else 0
end
as signStatus,
lww.sign_time signDate,
lww.create_time openTime,
lww.departure departure,
lww.destination destination,
lsoi.departure_warehouse_id departureWarehouseId,
lsoi.departure_warehouse_name departureWarehouseName,
lsoi.destination_warehouse_id destinationWarehouseId,
lsoi.destination_warehouse_name destinationWarehouseName,
lww.delivery_method deliveryMethod,
lww.customer_train customerTrain,
lww.pay_type payType,
lww.pay_way payWay,
lsoi.create_reconciliation_order_status createReconciliationOrderStatus,
lsoi.create_reconciliation_user_name createReconciliationUserName,
lsoi.create_reconciliation_date createReconciliationDate,
lsoi.cycle cycle,
lsoi.warehouse_fee_interval warehouseFeeInterval,
lsoi.sync_fee_status syncFeeStatus,
lsoi.sync_fee_date syncFeeDate,
lbc.clean_obj_type cleanObjType
from logpm_statistics_order_info lsoi
left join logpm_basicdata_client lbc on lbc.id = lsoi.consignee_id
left join logpm_warehouse_waybill lww on lww.id = lsoi.waybill_id
where 1=1
and lsoi.create_reconciliation_order_status = 0
<if test="param.listType == 1">
and lsoi.type_service != '2'
</if>
<if test="param.listType == 2">
and lsoi.type_service = '2'
</if>
<if test="param.consignee != null and param.consignee != '' ">
and Locate(#{param.consignee},lww.consignee) > 0
</if>
<if test="param.confirmStatisticsOrder != null">
and lsoi.confirm_statistics_order = #{param.confirmStatisticsOrder}
</if>
<if test="param.syncFeeSstatus != null">
and lsoi.sync_fee_status = #{param.syncFeeSstatus}
</if>
<if test="param.signStatus != null">
and lsoi.sign_status = #{param.signStatus}
</if>
<if test="param.waybillNo != null and param.waybillNo != '' ">
and Locate(#{param.waybillNo},lww.waybill_no) > 0
</if>
<if test="param.orderCode != null and param.orderCode != '' ">
and Locate(#{param.orderCode},lww.order_no) > 0
</if>
<if test="param.shipper != null and param.shipper != '' ">
and Locate(#{param.shipper},lww.shipper) > 0
</if>
<if test="param.departureWarehouseName != null and param.departureWarehouseName != '' ">
and Locate(#{param.departureWarehouseName},lsoi.departure_warehouse_name) > 0
</if>
<if test="param.destinationWarehouseName != null and param.destinationWarehouseName != '' ">
and Locate(#{param.destinationWarehouseName},lsoi.destination_warehouse_name) > 0
</if>
<if test="param.typeService != null">
and lsoi.type_service = #{param.typeService}
</if>
<if test="param.openTimeStart != null">
and lww.document_making_time &gt;= #{param.openTimeStart}
</if>
<if test="param.openTimeEnd != null">
and lww.document_making_time &lt;= #{param.openTimeEnd}
</if>
<if test="param.signTimeStart != null">
and lsoi.sign_date &gt;= #{param.signTimeStart}
</if>
<if test="param.signTimeEnd != null">
and lsoi.sign_date &lt;= #{param.signTimeEnd}
</if>
<if test="param.syncFeeDateStart != null">
and lsoi.sync_fee_date &gt;= #{param.syncFeeDateStart}
</if>
<if test="param.syncFeeDateEnd != null">
and lsoi.sync_fee_date &lt;= #{param.syncFeeDateEnd}
</if>
<if test="param.shipperPerson != null and param.shipperPerson != '' ">
and Locate(#{param.shipperPerson},lww.shipper_person) > 0
</if>
<if test="param.shipperMoblie != null and param.shipperMoblie != '' ">
and Locate(#{param.shipperMoblie},lww.shipper_mobile) > 0
</if>
<if test="param.consigneePerson != null and param.consigneePerson != '' ">
and Locate(#{param.consigneePerson},lww.consignee_person) > 0
</if>
<if test="param.consigneeMobile != null and param.consigneeMobile != '' ">
and Locate(#{param.consigneeMobile},lww.consignee_mobile) > 0
</if>
<if test="param.cleanObjType != null and param.cleanObjType != '' ">
and lbc.clean_obj_type = #{param.cleanObjType}
</if>
<if test="param.payType != null and param.payType != '' ">
and lww.pay_type = #{param.payType}
</if>
<if test="param.payWay != null and param.payWay != '' ">
and lww.pay_way = #{param.payWay}
</if>
and lsoi.destination_warehouse_id in
<foreach collection="param.warehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
group by lsoi.waybill_id
</select> </select>
<delete id="deleteDataByWaybillId" > <delete id="deleteDataByWaybillId" >

6
blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/IStatisticsOrderInfoService.java

@ -56,4 +56,10 @@ public interface IStatisticsOrderInfoService extends BaseService<StatisticsOrder
void orderInfoService(Long waybillId); void orderInfoService(Long waybillId);
R createReconciliationWaybillId(List<Long> waybillIds);
R createFinishWaybillId(List<Long> waybillIds);
boolean calculateRealCostByWaybillId(Long id);
} }

661
blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsOrderInfoServiceImpl.java

@ -6,11 +6,14 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.logpm.basicdata.entity.BasicdataClientEntity;
import com.logpm.basicdata.entity.BasicdataPriceTemplateEntity; import com.logpm.basicdata.entity.BasicdataPriceTemplateEntity;
import com.logpm.basicdata.feign.IBasicdataClientClient;
import com.logpm.basicdata.feign.IBasicdataPriceClient; import com.logpm.basicdata.feign.IBasicdataPriceClient;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.basicdata.vo.BasicdatPriceApiVO; import com.logpm.basicdata.vo.BasicdatPriceApiVO;
@ -28,8 +31,11 @@ import com.logpm.statistics.entity.*;
import com.logpm.statistics.mapper.StatisticsOrderInfoMapper; import com.logpm.statistics.mapper.StatisticsOrderInfoMapper;
import com.logpm.statistics.service.*; import com.logpm.statistics.service.*;
import com.logpm.statistics.vo.*; import com.logpm.statistics.vo.*;
import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import com.logpm.warehouse.feign.IWarehouseWaybillClient;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.springblade.common.enums.BooleanZeroOneEnums; import org.springblade.common.enums.BooleanZeroOneEnums;
import org.springblade.common.exception.CustomerException; import org.springblade.common.exception.CustomerException;
import org.springblade.common.utils.CommonUtil; import org.springblade.common.utils.CommonUtil;
@ -63,6 +69,8 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
private final IStatisticsAftersalesOrderRecordService aftersalesOrderRecordService; private final IStatisticsAftersalesOrderRecordService aftersalesOrderRecordService;
private final IBasicdataWarehouseClient warehouseClient; private final IBasicdataWarehouseClient warehouseClient;
private final IStatisticsBalanceRecordService balanceRecordService; private final IStatisticsBalanceRecordService balanceRecordService;
private final IWarehouseWaybillClient warehouseWaybillClient;
private final IBasicdataClientClient basicdataClientClient;
@Override @Override
public List<StatisticsOrderInfoEntity> findListByWaybillId(Long waybillId) { public List<StatisticsOrderInfoEntity> findListByWaybillId(Long waybillId) {
@ -88,13 +96,165 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
List<Long> warehouseIds = warehouseClient.getWarehouseIds(); List<Long> warehouseIds = warehouseClient.getWarehouseIds();
if(!warehouseIds.isEmpty()){ if (!warehouseIds.isEmpty()) {
merchantStatisticsDTO.setWarehouseIds(warehouseIds); merchantStatisticsDTO.setWarehouseIds(warehouseIds);
} }
//区分 2B 和 2C 的订单
if (merchantStatisticsDTO.getListType() == 1) {
//2B
return getStatisticsOrderInfoVOIPage2B(merchantStatisticsDTO, page);
} else {
// 2C
return getStatisticsOrderInfoVOIPage2C(merchantStatisticsDTO, page);
}
}
private IPage<StatisticsOrderInfoVO> getStatisticsOrderInfoVOIPage2B(MerchantStatisticsDTO merchantStatisticsDTO, IPage<Object> page) {
// IPage<StatisticsOrderInfoVO> statisticsOrderInfoVOIPage = baseMapper.pageList(page, merchantStatisticsDTO);
IPage<StatisticsOrderInfoVO> statisticsOrderInfoVOIPage = baseMapper.pageList2B(page, merchantStatisticsDTO);
List<StatisticsOrderInfoVO> records = statisticsOrderInfoVOIPage.getRecords();
if (CollUtil.isEmpty(records)) {
return statisticsOrderInfoVOIPage;
}
//把records中所有的orderInfoId放入一个集合
// List<Long> orderInfoIdList = records.stream().map(StatisticsOrderInfoVO::getOrderInfoId).collect(Collectors.toList());
// 得到运单ID集合
Set<Long> waybillIds = records.stream().map(StatisticsOrderInfoVO::getWaybillId).collect(Collectors.toSet());
// 查询运单明细集合
List<WaybillDetailByWaybillNoVo> waybillDetailByWaybillId = baseMapper.findWaybillDetailByWaybillId(waybillIds);
//得到运单号
Set<String> orderCodeSet = records.stream().map(StatisticsOrderInfoVO::getOrderCode).collect(Collectors.toSet());
// 通过运单号进行分组
Map<Long, List<WaybillDetailByWaybillNoVo>> waybillDetailByWaybillIdMap = waybillDetailByWaybillId.stream().collect(Collectors.groupingBy(WaybillDetailByWaybillNoVo::getWaybillId));
Map<Long, StatisticsPackageFeeInfoVO> orderPackageInfoMap;
if (CollUtil.isNotEmpty(waybillIds)) {
List<StatisticsPackageFeeInfoVO> orderPackageInfoList = baseMapper.findPackageListByOrderIdsGroupByWaybillId(waybillIds);
//把orderPackageInfoList转化成以orderInfoId为key的Map
if (CollUtil.isNotEmpty(orderPackageInfoList)) {
orderPackageInfoMap = orderPackageInfoList.stream()
.collect(Collectors.toMap(StatisticsPackageFeeInfoVO::getWaybillId, statisticsPackageFeeInfoVO -> statisticsPackageFeeInfoVO));
} else {
orderPackageInfoMap = null;
}
} else {
orderPackageInfoMap = null;
}
List<AdvanceDetailDTO> advanceDetailDTOS = baseMapper.selectAdvinceDetail(waybillIds, orderCodeSet);
records.forEach(statisticsOrderInfoVO -> {
// Long waybillId = statisticsOrderInfoVO.getWaybillId();
Long waybillId = statisticsOrderInfoVO.getWaybillId();
String orderCode = statisticsOrderInfoVO.getOrderCode();
// 查询站存单上的
List<AdvanceDetailDTO> advanceDetailDTOList = advanceDetailDTOS.stream().
filter(advanceDetailDTO -> advanceDetailDTO.getWaybillId().equals(waybillId) && advanceDetailDTO.getOrderCode().equals(orderCode)).collect(Collectors.toList());
// 对advanceDetailDTOList 按照 incomeCategoryName 进分组 并统计数量
Map<String, List<AdvanceDetailDTO>> collect = advanceDetailDTOList.stream().filter(advanceDetailDTO -> !Objects.isNull(advanceDetailDTO.getIncomeCategoryName())).collect(Collectors.groupingBy(AdvanceDetailDTO::getIncomeCategoryName));
Long waybillId1 = statisticsOrderInfoVO.getWaybillId();
if (orderPackageInfoMap != null) {
StatisticsPackageFeeInfoVO statisticsPackageFeeInfoVO = orderPackageInfoMap.get(waybillId1);
if (statisticsPackageFeeInfoVO != null) {
// statisticsPackageFeeInfoVO.setGoodsName(statisticsOrderInfoVO.getGoodsName());
BeanUtil.copy(statisticsPackageFeeInfoVO, statisticsOrderInfoVO);
if (StringUtil.isNotBlank(statisticsOrderInfoVO.getGoodsName())) {
// String[] split = statisticsOrderInfoVO.getGoodsName().split(",");
List<WaybillDetailByWaybillNoVo> waybillDetailByWaybillNoVos = waybillDetailByWaybillIdMap.get(statisticsOrderInfoVO.getWaybillId());
StringBuffer sb = new StringBuffer();
StringBuffer sb1 = new StringBuffer();
StringBuffer sb3 = new StringBuffer();
if (collect.isEmpty()) {
if (!waybillDetailByWaybillNoVos.isEmpty()) {
for (WaybillDetailByWaybillNoVo waybillDetailByWaybillNoVo : waybillDetailByWaybillNoVos) {
if (!sb3.toString().isEmpty()) {
sb3.append(",");
}
sb3.append(waybillDetailByWaybillNoVo.getProductName());
if (!sb.toString().isEmpty()) {
sb.append(",");
}
sb.append(waybillDetailByWaybillNoVo.getNum());
if (!sb1.toString().isEmpty()) {
sb1.append(",");
}
sb1.append(waybillDetailByWaybillNoVo.getPrice());
}
}
} else {
collect.keySet().forEach(s -> {
if (!sb3.toString().isEmpty()) {
sb3.append(",");
}
sb3.append(s);
List<AdvanceDetailDTO> advanceDetailDTOS1 = collect.get(s);
Optional<WaybillDetailByWaybillNoVo> first = waybillDetailByWaybillNoVos.stream().filter(waybillDetailByWaybillNoVo -> waybillDetailByWaybillNoVo.getProductName().equals(s)).findFirst();
if (first.isPresent()) {
WaybillDetailByWaybillNoVo waybillDetailByWaybillNoVo = first.get();
if (!sb.toString().isEmpty()) {
sb.append(",");
}
//统计 advanceDetailDTOS1 这个集合种 quantity 的和值
int sum = advanceDetailDTOS1.stream().mapToInt(AdvanceDetailDTO::getQuantity).sum();
sb.append(sum);
if (!sb1.toString().isEmpty()) {
sb1.append(",");
}
sb1.append(waybillDetailByWaybillNoVo.getPrice());
}
});
}
statisticsOrderInfoVO.setGoodsName(sb3.toString());
statisticsOrderInfoVO.setGoodsNum(sb.toString());
statisticsOrderInfoVO.setGoodsPrice(sb1.toString());
}
}
}
});
statisticsOrderInfoVOIPage.setRecords(records);
return statisticsOrderInfoVOIPage;
}
@NotNull
private IPage<StatisticsOrderInfoVO> getStatisticsOrderInfoVOIPage2C(MerchantStatisticsDTO merchantStatisticsDTO, IPage<Object> page) {
IPage<StatisticsOrderInfoVO> statisticsOrderInfoVOIPage = baseMapper.pageList(page, merchantStatisticsDTO); IPage<StatisticsOrderInfoVO> statisticsOrderInfoVOIPage = baseMapper.pageList(page, merchantStatisticsDTO);
List<StatisticsOrderInfoVO> records = statisticsOrderInfoVOIPage.getRecords(); List<StatisticsOrderInfoVO> records = statisticsOrderInfoVOIPage.getRecords();
if(CollUtil.isEmpty(records)){ if (CollUtil.isEmpty(records)) {
return statisticsOrderInfoVOIPage; return statisticsOrderInfoVOIPage;
} }
@ -114,10 +274,10 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
Map<Long, List<WaybillDetailByWaybillNoVo>> waybillDetailByWaybillIdMap = waybillDetailByWaybillId.stream().collect(Collectors.groupingBy(WaybillDetailByWaybillNoVo::getWaybillId)); Map<Long, List<WaybillDetailByWaybillNoVo>> waybillDetailByWaybillIdMap = waybillDetailByWaybillId.stream().collect(Collectors.groupingBy(WaybillDetailByWaybillNoVo::getWaybillId));
Map<Long, StatisticsPackageFeeInfoVO> orderPackageInfoMap; Map<Long, StatisticsPackageFeeInfoVO> orderPackageInfoMap;
if(CollUtil.isNotEmpty(orderInfoIdList)){ if (CollUtil.isNotEmpty(orderInfoIdList)) {
List<StatisticsPackageFeeInfoVO> orderPackageInfoList = baseMapper.findPackageListByOrderIdsGroupById(orderInfoIdList); List<StatisticsPackageFeeInfoVO> orderPackageInfoList = baseMapper.findPackageListByOrderIdsGroupById(orderInfoIdList);
//把orderPackageInfoList转化成以orderInfoId为key的Map //把orderPackageInfoList转化成以orderInfoId为key的Map
if(CollUtil.isNotEmpty(orderPackageInfoList)){ if (CollUtil.isNotEmpty(orderPackageInfoList)) {
orderPackageInfoMap = orderPackageInfoList.stream() orderPackageInfoMap = orderPackageInfoList.stream()
.collect(Collectors.toMap(StatisticsPackageFeeInfoVO::getOrderInfoId, statisticsPackageFeeInfoVO -> statisticsPackageFeeInfoVO)); .collect(Collectors.toMap(StatisticsPackageFeeInfoVO::getOrderInfoId, statisticsPackageFeeInfoVO -> statisticsPackageFeeInfoVO));
} else { } else {
@ -127,7 +287,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
orderPackageInfoMap = null; orderPackageInfoMap = null;
} }
List<AdvanceDetailDTO> advanceDetailDTOS=baseMapper.selectAdvinceDetail(waybillIds, orderCodeSet); List<AdvanceDetailDTO> advanceDetailDTOS = baseMapper.selectAdvinceDetail(waybillIds, orderCodeSet);
records.forEach(statisticsOrderInfoVO -> { records.forEach(statisticsOrderInfoVO -> {
// Long waybillId = statisticsOrderInfoVO.getWaybillId(); // Long waybillId = statisticsOrderInfoVO.getWaybillId();
@ -144,14 +304,14 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
Map<String, List<AdvanceDetailDTO>> collect = advanceDetailDTOList.stream().filter(advanceDetailDTO -> !Objects.isNull(advanceDetailDTO.getIncomeCategoryName())).collect(Collectors.groupingBy(AdvanceDetailDTO::getIncomeCategoryName)); Map<String, List<AdvanceDetailDTO>> collect = advanceDetailDTOList.stream().filter(advanceDetailDTO -> !Objects.isNull(advanceDetailDTO.getIncomeCategoryName())).collect(Collectors.groupingBy(AdvanceDetailDTO::getIncomeCategoryName));
Long orderInfoId = statisticsOrderInfoVO.getOrderInfoId(); Long orderInfoId = statisticsOrderInfoVO.getOrderInfoId();
if(orderPackageInfoMap!=null){ if (orderPackageInfoMap != null) {
StatisticsPackageFeeInfoVO statisticsPackageFeeInfoVO = orderPackageInfoMap.get(orderInfoId); StatisticsPackageFeeInfoVO statisticsPackageFeeInfoVO = orderPackageInfoMap.get(orderInfoId);
if(statisticsPackageFeeInfoVO!=null){ if (statisticsPackageFeeInfoVO != null) {
// statisticsPackageFeeInfoVO.setGoodsName(statisticsOrderInfoVO.getGoodsName()); // statisticsPackageFeeInfoVO.setGoodsName(statisticsOrderInfoVO.getGoodsName());
BeanUtil.copy(statisticsPackageFeeInfoVO, statisticsOrderInfoVO); BeanUtil.copy(statisticsPackageFeeInfoVO, statisticsOrderInfoVO);
if(StringUtil.isNotBlank(statisticsOrderInfoVO.getGoodsName())){ if (StringUtil.isNotBlank(statisticsOrderInfoVO.getGoodsName())) {
// String[] split = statisticsOrderInfoVO.getGoodsName().split(","); // String[] split = statisticsOrderInfoVO.getGoodsName().split(",");
List<WaybillDetailByWaybillNoVo> waybillDetailByWaybillNoVos = waybillDetailByWaybillIdMap.get(statisticsOrderInfoVO.getWaybillId()); List<WaybillDetailByWaybillNoVo> waybillDetailByWaybillNoVos = waybillDetailByWaybillIdMap.get(statisticsOrderInfoVO.getWaybillId());
@ -159,23 +319,23 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
StringBuffer sb1 = new StringBuffer(); StringBuffer sb1 = new StringBuffer();
StringBuffer sb3 = new StringBuffer(); StringBuffer sb3 = new StringBuffer();
if(collect.isEmpty()){ if (collect.isEmpty()) {
if(!waybillDetailByWaybillNoVos.isEmpty()){ if (waybillDetailByWaybillNoVos != null && !waybillDetailByWaybillNoVos.isEmpty()) {
for (WaybillDetailByWaybillNoVo waybillDetailByWaybillNoVo : waybillDetailByWaybillNoVos) { for (WaybillDetailByWaybillNoVo waybillDetailByWaybillNoVo : waybillDetailByWaybillNoVos) {
if(!sb3.toString().isEmpty()){ if (!sb3.toString().isEmpty()) {
sb3.append(","); sb3.append(",");
} }
sb3.append(waybillDetailByWaybillNoVo.getProductName()); sb3.append(waybillDetailByWaybillNoVo.getProductName());
if(!sb.toString().isEmpty()){ if (!sb.toString().isEmpty()) {
sb.append(","); sb.append(",");
} }
sb.append(waybillDetailByWaybillNoVo.getNum()); sb.append(waybillDetailByWaybillNoVo.getNum());
if(!sb1.toString().isEmpty()){ if (!sb1.toString().isEmpty()) {
sb1.append(","); sb1.append(",");
} }
sb1.append(waybillDetailByWaybillNoVo.getPrice()); sb1.append(waybillDetailByWaybillNoVo.getPrice());
@ -184,19 +344,21 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
} }
}else{ } else {
collect.keySet().forEach(s -> { collect.keySet().forEach(s -> {
if(!sb3.toString().isEmpty()){ if (!sb3.toString().isEmpty()) {
sb3.append(","); sb3.append(",");
} }
sb3.append(s); sb3.append(s);
List<AdvanceDetailDTO> advanceDetailDTOS1 = collect.get(s); List<AdvanceDetailDTO> advanceDetailDTOS1 = collect.get(s);
if (waybillDetailByWaybillNoVos != null) {
Optional<WaybillDetailByWaybillNoVo> first = waybillDetailByWaybillNoVos.stream().filter(waybillDetailByWaybillNoVo -> waybillDetailByWaybillNoVo.getProductName().equals(s)).findFirst(); Optional<WaybillDetailByWaybillNoVo> first = waybillDetailByWaybillNoVos.stream().filter(waybillDetailByWaybillNoVo -> waybillDetailByWaybillNoVo.getProductName().equals(s)).findFirst();
if(first.isPresent()){ if (first.isPresent()) {
WaybillDetailByWaybillNoVo waybillDetailByWaybillNoVo = first.get(); WaybillDetailByWaybillNoVo waybillDetailByWaybillNoVo = first.get();
if(!sb.toString().isEmpty()){ if (!sb.toString().isEmpty()) {
sb.append(","); sb.append(",");
} }
@ -204,11 +366,13 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
int sum = advanceDetailDTOS1.stream().mapToInt(AdvanceDetailDTO::getQuantity).sum(); int sum = advanceDetailDTOS1.stream().mapToInt(AdvanceDetailDTO::getQuantity).sum();
sb.append(sum); sb.append(sum);
if(!sb1.toString().isEmpty()){ if (!sb1.toString().isEmpty()) {
sb1.append(","); sb1.append(",");
} }
sb1.append(waybillDetailByWaybillNoVo.getPrice()); sb1.append(waybillDetailByWaybillNoVo.getPrice());
} }
}
}); });
@ -223,7 +387,6 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
} }
}); });
statisticsOrderInfoVOIPage.setRecords(records); statisticsOrderInfoVOIPage.setRecords(records);
return statisticsOrderInfoVOIPage; return statisticsOrderInfoVOIPage;
} }
@ -244,7 +407,6 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
List<StatisticsChangesRecordEntity> list = changesRecordService.list(queryWrapper); List<StatisticsChangesRecordEntity> list = changesRecordService.list(queryWrapper);
if (CollUtil.isNotEmpty(list)) { if (CollUtil.isNotEmpty(list)) {
// 获取list中所有元素的id // 获取list中所有元素的id
@ -318,9 +480,9 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
for (StatisticsReconciliationOrderInfoEntity statisticsReconciliationOrderInfoEntity : statisticsReconciliationOrderInfoEntities) { for (StatisticsReconciliationOrderInfoEntity statisticsReconciliationOrderInfoEntity : statisticsReconciliationOrderInfoEntities) {
Integer checkStatus = statisticsReconciliationOrderInfoEntity.getCheckStatus(); Integer checkStatus = statisticsReconciliationOrderInfoEntity.getCheckStatus();
String reconciliationOrderNo = statisticsReconciliationOrderInfoEntity.getReconciliationOrderNo(); String reconciliationOrderNo = statisticsReconciliationOrderInfoEntity.getReconciliationOrderNo();
if(checkStatus == 1){ if (checkStatus == 1) {
log.warn("############checkBalance: 对账单已经确认对账 reconciliationOrderNo={}",reconciliationOrderNo); log.warn("############checkBalance: 对账单已经确认对账 reconciliationOrderNo={}", reconciliationOrderNo);
return R.fail(405,"对账单["+reconciliationOrderNo+"]已经确认对账"); return R.fail(405, "对账单[" + reconciliationOrderNo + "]已经确认对账");
} }
} }
@ -341,7 +503,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
destinationWarehouseIdSet.add(destinationWarehouseId); destinationWarehouseIdSet.add(destinationWarehouseId);
Integer isAftersale = statisticsReconciliationOrderInfoEntity.getIsAftersale(); Integer isAftersale = statisticsReconciliationOrderInfoEntity.getIsAftersale();
if(isAftersale != 1){ if (isAftersale != 1) {
isAftersale = 1; isAftersale = 1;
} }
String orderCode = statisticsReconciliationOrderInfoEntity.getOrderCode(); String orderCode = statisticsReconciliationOrderInfoEntity.getOrderCode();
@ -356,12 +518,12 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
brandSet.addAll(Arrays.asList(splitBrand)); brandSet.addAll(Arrays.asList(splitBrand));
}); });
if(consigneeIdSet.size() > 1){ if (consigneeIdSet.size() > 1) {
log.warn("############checkBalance: 对账单商家不相同={} ", consigneeIdSet); log.warn("############checkBalance: 对账单商家不相同={} ", consigneeIdSet);
throw new CustomerException(405, "对账单商家不相同"); throw new CustomerException(405, "对账单商家不相同");
} }
if(destinationWarehouseIdSet.size() > 1){ if (destinationWarehouseIdSet.size() > 1) {
log.warn("############checkBalance: destinationWarehouseIdSet={} ", destinationWarehouseIdSet); log.warn("############checkBalance: destinationWarehouseIdSet={} ", destinationWarehouseIdSet);
throw new CustomerException(405, "对账单目的仓不相同"); throw new CustomerException(405, "对账单目的仓不相同");
} }
@ -379,7 +541,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
BigDecimal totalFeeAddAfter = freightPrice.add(pickupPrice).add(deliveryServiceFee).add(warehouseServiceFee).add(changesFee).add(aftersalesFee); BigDecimal totalFeeAddAfter = freightPrice.add(pickupPrice).add(deliveryServiceFee).add(warehouseServiceFee).add(changesFee).add(aftersalesFee);
String balanceOrderNo = "JSD"+System.currentTimeMillis(); String balanceOrderNo = "JSD" + System.currentTimeMillis();
StatisticsBalanceOrderInfoEntity statisticsBalanceOrderInfoEntity = new StatisticsBalanceOrderInfoEntity(); StatisticsBalanceOrderInfoEntity statisticsBalanceOrderInfoEntity = new StatisticsBalanceOrderInfoEntity();
statisticsBalanceOrderInfoEntity.setBalanceOrderNo(balanceOrderNo); statisticsBalanceOrderInfoEntity.setBalanceOrderNo(balanceOrderNo);
@ -441,7 +603,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
updateEntity.setConfirmBalanceDate(new Date()); updateEntity.setConfirmBalanceDate(new Date());
updateOrderInfoList.add(updateEntity); updateOrderInfoList.add(updateEntity);
}); });
if(CollUtil.isNotEmpty(updateOrderInfoList)){ if (CollUtil.isNotEmpty(updateOrderInfoList)) {
updateBatchById(updateOrderInfoList); updateBatchById(updateOrderInfoList);
} }
@ -456,7 +618,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
updateEntity.setCheckTime(new Date()); updateEntity.setCheckTime(new Date());
updateReconciliationInfoList.add(updateEntity); updateReconciliationInfoList.add(updateEntity);
}); });
if(CollUtil.isNotEmpty(updateReconciliationInfoList)){ if (CollUtil.isNotEmpty(updateReconciliationInfoList)) {
reconciliationOrderInfoService.updateBatchById(updateReconciliationInfoList); reconciliationOrderInfoService.updateBatchById(updateReconciliationInfoList);
} }
@ -469,7 +631,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
//把records中所有的orderInfoId放入一个集合 //把records中所有的orderInfoId放入一个集合
List<Long> orderInfoIdList = records.stream().map(StatisticsOrderInfoVO::getOrderInfoId).collect(Collectors.toList()); List<Long> orderInfoIdList = records.stream().map(StatisticsOrderInfoVO::getOrderInfoId).collect(Collectors.toList());
if(CollUtil.isNotEmpty(orderInfoIdList)){ if (CollUtil.isNotEmpty(orderInfoIdList)) {
List<StatisticsPackageFeeInfoVO> orderPackageInfoList = baseMapper.findPackageListByOrderIdsGroupById(orderInfoIdList); List<StatisticsPackageFeeInfoVO> orderPackageInfoList = baseMapper.findPackageListByOrderIdsGroupById(orderInfoIdList);
//把orderPackageInfoList转化成以orderInfoId为key的Map //把orderPackageInfoList转化成以orderInfoId为key的Map
Map<Long, StatisticsPackageFeeInfoVO> orderPackageInfoMap = orderPackageInfoList.stream() Map<Long, StatisticsPackageFeeInfoVO> orderPackageInfoMap = orderPackageInfoList.stream()
@ -541,7 +703,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
// 模版是否有配送 // 模版是否有配送
if (StrUtil.contains(serviceType, "4")) { if (StrUtil.contains(serviceType, "4")) {
if (CollUtil.isNotEmpty(distributionPackageEntities)) { if (CollUtil.isNotEmpty(distributionPackageEntities)) {
calculateDispatchCost(template, typeService, distributionPackageEntities, dispatch, dispatchIsMinCost,brandId,consigneeId); calculateDispatchCost(template, typeService, distributionPackageEntities, dispatch, dispatchIsMinCost, brandId, consigneeId);
} }
} }
} }
@ -553,6 +715,79 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
return Boolean.TRUE; return Boolean.TRUE;
} }
@Override
public boolean calculateRealCostByWaybillId(Long id) {
WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillId(id);
if (ObjectUtil.isEmpty(waybillEntity)) {
log.warn("#############calculateRealCostByWaybillId: 运单信息不存在");
throw new CustomerException(405, "运单信息不存在");
}
Long brandId = waybillEntity.getBrandId();
Long consigneeId = waybillEntity.getConsigneeId();
if (!ObjectUtil.isAllNotEmpty(brandId, consigneeId)) {
log.warn("#############calculateRealCost: 品牌{} 收货单位{}", brandId, consigneeId);
throw new CustomerException(405, "结算单信息不完整,缺少品牌和收货单位,请联系系统管理员。");
}
Date createTime = waybillEntity.getCreateTime();
// 根据 品牌 收货单位 开单时间 获取价格体系
PriceClientVO price = priceClient.price(BasicdatPriceApiVO.builder()
.clientId(consigneeId.toString())
.brandId(brandId.toString())
.time(DateUtil.formatDate(createTime))
.build());
if (ObjectUtil.isEmpty(price)) {
log.warn("#############calculateRealCost: 未维护价格,无法计算。");
throw new CustomerException(405, "未维护价格,无法计算。");
}
log.info("获取的价格:{}", JSONUtil.toJsonStr(price));
// 查询包件数据
List<StatisticsDistributionPackageEntity> distributionPackageEntities = distributionPackageService.list(new QueryWrapper<StatisticsDistributionPackageEntity>().lambda().eq(StatisticsDistributionPackageEntity::getWaybillId, id));
// 校验是否全部配送完成
if (CollUtil.isEmpty(distributionPackageEntities) || distributionPackageEntities.stream().anyMatch(distributionPackageEntity -> distributionPackageEntity.getIsSign() == null || NumberUtil.equals(0, distributionPackageEntity.getIsSign()))) {
log.warn("#############calculateRealCost: 订单未全部配送完成,无法计算。");
throw new CustomerException(405, "订单未全部配送完成,无法计算。");
}
List<StatisticsWarehousePackageEntity> warehousePackageEntities = warehousePackageService.list(new QueryWrapper<StatisticsWarehousePackageEntity>().lambda().eq(StatisticsWarehousePackageEntity::getWaybillId, id));
PriceDispatchVO dispatch = price.getDispatch();
PriceWarehouseVO warehouse = price.getWarehouse();
BasicdataPriceTemplateEntity template = price.getTemplate();
if (ObjectUtil.isEmpty(template)) {
log.warn("#############calculateRealCost: 未维护模版,无法计算。");
throw new CustomerException(405, "未维护模版,无法计算。");
}
String serviceType = template.getServiceType();
Integer dispatchIsMinCost = template.getDispatchIsMinCost();
BasicdataClientEntity entityById = basicdataClientClient.findEntityById(consigneeId);
// 模版的服务类型
String typeService = String.valueOf(entityById.getTypeService());
if (StrUtil.isNotEmpty(serviceType)) {
// 模版是否有仓储
if (StrUtil.contains(serviceType, "3")) {
if (CollUtil.isNotEmpty(warehousePackageEntities)) {
calculateWarehouseCost(warehouse, warehousePackageEntities, template);
}
}
// 模版是否有配送
if (StrUtil.contains(serviceType, "4")) {
if (CollUtil.isNotEmpty(distributionPackageEntities)) {
calculateDispatchCost(template, typeService, distributionPackageEntities, dispatch, dispatchIsMinCost, brandId, consigneeId);
}
}
}
lambdaUpdate().set(StatisticsOrderInfoEntity::getSyncFeeStatus, 1).set(StatisticsOrderInfoEntity::getSyncFeeDate, new Date()).eq(StatisticsOrderInfoEntity::getWaybillId, id).update();
// orderInfoEntity.setSyncFeeStatus(1);
// orderInfoEntity.setSyncFeeDate(new Date());
// updateById(orderInfoEntity);
return Boolean.TRUE; }
@Override @Override
public StatisticsPackageFeeInfoVO findPackageListByOrderIds(List<Long> orderInfoIdsList) { public StatisticsPackageFeeInfoVO findPackageListByOrderIds(List<Long> orderInfoIdsList) {
return baseMapper.findPackageListByOrderIds(orderInfoIdsList); return baseMapper.findPackageListByOrderIds(orderInfoIdsList);
@ -564,9 +799,9 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
// StatisticsReconciliationOrderInfoEntity reconciliationOrder = baseMapper.findReconciliationOrderInfoByOrderIds(orderInfoIds); // StatisticsReconciliationOrderInfoEntity reconciliationOrder = baseMapper.findReconciliationOrderInfoByOrderIds(orderInfoIds);
List<StatisticsOrderInfoEntity> orderInfoEntities = baseMapper.selectBatchIds(orderInfoIds); List<StatisticsOrderInfoEntity> orderInfoEntities = baseMapper.selectBatchIds(orderInfoIds);
if(CollUtil.isEmpty(orderInfoEntities)){ if (CollUtil.isEmpty(orderInfoEntities)) {
log.warn("############createReconciliationOrder: 未找到对应订单信息"); log.warn("############createReconciliationOrder: 未找到对应订单信息");
return R.fail(405,"未找到对应订单信息"); return R.fail(405, "未找到对应订单信息");
} }
@ -577,24 +812,24 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
Integer syncFeeStatus = orderInfoEntity.getSyncFeeStatus(); Integer syncFeeStatus = orderInfoEntity.getSyncFeeStatus();
Long orderId = orderInfoEntity.getId(); Long orderId = orderInfoEntity.getId();
String orderCode = orderInfoEntity.getOrderCode(); String orderCode = orderInfoEntity.getOrderCode();
if(syncFeeStatus == 0){ if (syncFeeStatus == 0) {
log.warn("############createReconciliationOrder: 订单还未计算价格的数据 orderId={}",orderId); log.warn("############createReconciliationOrder: 订单还未计算价格的数据 orderId={}", orderId);
return R.fail(405,"订单["+orderCode+"]未计算价格的数据"); return R.fail(405, "订单[" + orderCode + "]未计算价格的数据");
} }
} }
//判断orderInfoEntities中所有元素通过consigneeId进行分组 //判断orderInfoEntities中所有元素通过consigneeId进行分组
Map<Long, List<StatisticsOrderInfoEntity>> groupByConsigneeId = orderInfoEntities.stream().collect(Collectors.groupingBy(StatisticsOrderInfoEntity::getConsigneeId)); Map<Long, List<StatisticsOrderInfoEntity>> groupByConsigneeId = orderInfoEntities.stream().collect(Collectors.groupingBy(StatisticsOrderInfoEntity::getConsigneeId));
int consigneeSize = groupByConsigneeId.keySet().size(); int consigneeSize = groupByConsigneeId.keySet().size();
if(consigneeSize > 1){ if (consigneeSize > 1) {
log.warn("############createReconciliationOrder: 订单不属于同一个商家"); log.warn("############createReconciliationOrder: 订单不属于同一个商家");
return R.fail(405,"订单不属于同一个商家"); return R.fail(405, "订单不属于同一个商家");
} }
Map<Long, List<StatisticsOrderInfoEntity>> groupByDestinationWarehouseId = orderInfoEntities.stream().collect(Collectors.groupingBy(StatisticsOrderInfoEntity::getDestinationWarehouseId)); Map<Long, List<StatisticsOrderInfoEntity>> groupByDestinationWarehouseId = orderInfoEntities.stream().collect(Collectors.groupingBy(StatisticsOrderInfoEntity::getDestinationWarehouseId));
int destinationWarehouseIdSize = groupByDestinationWarehouseId.keySet().size(); int destinationWarehouseIdSize = groupByDestinationWarehouseId.keySet().size();
if(destinationWarehouseIdSize > 1){ if (destinationWarehouseIdSize > 1) {
log.warn("############createReconciliationOrder: 订单不属于同一个目的仓"); log.warn("############createReconciliationOrder: 订单不属于同一个目的仓");
return R.fail(405,"订单不属于同一个目的仓"); return R.fail(405, "订单不属于同一个目的仓");
} }
StatisticsPackageFeeInfoVO orderPackageTotalVO = baseMapper.findPackageListByOrderIds(orderInfoIds); StatisticsPackageFeeInfoVO orderPackageTotalVO = baseMapper.findPackageListByOrderIds(orderInfoIds);
BigDecimal freightPrice = orderPackageTotalVO.getFreightPrice(); BigDecimal freightPrice = orderPackageTotalVO.getFreightPrice();
@ -612,7 +847,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
Long destinationWarehouseId = statisticsOrderInfoEntity.getDestinationWarehouseId(); Long destinationWarehouseId = statisticsOrderInfoEntity.getDestinationWarehouseId();
String destinationWarehouseName = statisticsOrderInfoEntity.getDestinationWarehouseName(); String destinationWarehouseName = statisticsOrderInfoEntity.getDestinationWarehouseName();
String reconciliationOrdeCode = "DZD"+System.currentTimeMillis(); String reconciliationOrdeCode = "DZD" + System.currentTimeMillis();
StatisticsReconciliationOrderInfoEntity reconciliationOrder = new StatisticsReconciliationOrderInfoEntity(); StatisticsReconciliationOrderInfoEntity reconciliationOrder = new StatisticsReconciliationOrderInfoEntity();
reconciliationOrder.setReconciliationOrderNo(reconciliationOrdeCode); reconciliationOrder.setReconciliationOrderNo(reconciliationOrdeCode);
@ -663,7 +898,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
boolean saveFlag = reconciliationOrderInfoService.save(reconciliationOrder); boolean saveFlag = reconciliationOrderInfoService.save(reconciliationOrder);
if(saveFlag){ if (saveFlag) {
Long reconciliationOrderId = reconciliationOrder.getId(); Long reconciliationOrderId = reconciliationOrder.getId();
List<StatisticsOrderInfoEntity> updateList = new ArrayList<>(); List<StatisticsOrderInfoEntity> updateList = new ArrayList<>();
orderInfoEntities.forEach(orderInfoEntity -> { orderInfoEntities.forEach(orderInfoEntity -> {
@ -682,6 +917,272 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
return R.success("生成成功"); return R.success("生成成功");
} }
@Override
public R createReconciliationWaybillId(List<Long> waybillIds) {
// List<StatisticsOrderInfoEntity> orderInfoEntities = baseMapper.selectBatchIds(orderInfoIds);
LambdaQueryWrapper<StatisticsOrderInfoEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(StatisticsOrderInfoEntity::getWaybillId, waybillIds);
queryWrapper.eq(StatisticsOrderInfoEntity::getConfirmBalanceOrderStatus, 0);
List<StatisticsOrderInfoEntity> orderInfoEntities = baseMapper.selectList(queryWrapper);
if (CollUtil.isEmpty(orderInfoEntities)) {
log.warn("############createReconciliationOrder: 未找到对应订单信息");
return R.fail(405, "未找到对应订单信息");
}
List<Long> orderInfoIds = orderInfoEntities.stream().map(StatisticsOrderInfoEntity::getId).collect(Collectors.toList());
for (StatisticsOrderInfoEntity orderInfoEntity : orderInfoEntities) {
if (orderInfoEntity.getTypeService() != null && orderInfoEntity.getTypeService() != 2) {
continue;
}
Integer syncFeeStatus = orderInfoEntity.getSyncFeeStatus();
Long orderId = orderInfoEntity.getId();
String orderCode = orderInfoEntity.getOrderCode();
if (syncFeeStatus == 0) {
log.warn("############createReconciliationOrder: 订单还未计算价格的数据 orderId={}", orderId);
return R.fail(405, "订单[" + orderCode + "]未计算价格的数据");
}
}
//判断orderInfoEntities中所有元素通过consigneeId进行分组
Map<Long, List<StatisticsOrderInfoEntity>> groupByConsigneeId = orderInfoEntities.stream().collect(Collectors.groupingBy(StatisticsOrderInfoEntity::getConsigneeId));
int consigneeSize = groupByConsigneeId.keySet().size();
if (consigneeSize > 1) {
log.warn("############createReconciliationOrder: 订单不属于同一个商家");
return R.fail(405, "订单不属于同一个商家");
}
Map<Long, List<StatisticsOrderInfoEntity>> groupByDestinationWarehouseId = orderInfoEntities.stream().collect(Collectors.groupingBy(StatisticsOrderInfoEntity::getDestinationWarehouseId));
int destinationWarehouseIdSize = groupByDestinationWarehouseId.keySet().size();
if (destinationWarehouseIdSize > 1) {
log.warn("############createReconciliationOrder: 订单不属于同一个目的仓");
return R.fail(405, "订单不属于同一个目的仓");
}
StatisticsPackageFeeInfoVO orderPackageTotalVO = baseMapper.findPackageListByOrderIds(orderInfoIds);
BigDecimal freightPrice = orderPackageTotalVO.getFreightPrice();
BigDecimal systemFreightPrice = orderPackageTotalVO.getSystemFreightPrice();
BigDecimal pickupPrice = orderPackageTotalVO.getPickupPrice();
BigDecimal systemPickupPrice = orderPackageTotalVO.getSystemPickupPrice();
BigDecimal warehouseServiceFee = orderPackageTotalVO.getWarehouseServiceFee();
BigDecimal deliveryServiceFee = orderPackageTotalVO.getDeliveryServiceFee();
BigDecimal totalFee = freightPrice.add(pickupPrice).add(warehouseServiceFee).add(deliveryServiceFee);
BigDecimal sysTotalFee = systemFreightPrice.add(systemPickupPrice).add(warehouseServiceFee).add(deliveryServiceFee);
StatisticsOrderInfoEntity statisticsOrderInfoEntity = orderInfoEntities.get(0);
Long consigneeId = statisticsOrderInfoEntity.getConsigneeId();
String consignee = statisticsOrderInfoEntity.getConsignee();
Long destinationWarehouseId = statisticsOrderInfoEntity.getDestinationWarehouseId();
String destinationWarehouseName = statisticsOrderInfoEntity.getDestinationWarehouseName();
String reconciliationOrdeCode = "DZD" + System.currentTimeMillis();
StatisticsReconciliationOrderInfoEntity reconciliationOrder = new StatisticsReconciliationOrderInfoEntity();
reconciliationOrder.setReconciliationOrderNo(reconciliationOrdeCode);
//把orderInfoEntities中所有waybillNo去重拼接起来
reconciliationOrder.setWaybillNo(orderInfoEntities.stream().map(StatisticsOrderInfoEntity::getWaybillNo).distinct().collect(Collectors.joining(",")));
// 增加运单的制单时间
// reconciliationOrder.setWaybillCreateTime(orderInfoEntities.get(0).getWaybillCreateTime());
reconciliationOrder.setOrderCode(orderInfoEntities.stream().map(StatisticsOrderInfoEntity::getOrderCode).distinct().collect(Collectors.joining(",")));
reconciliationOrder.setBrand(orderInfoEntities.stream().map(StatisticsOrderInfoEntity::getBrand).distinct().collect(Collectors.joining(",")));
reconciliationOrder.setConsigneeId(consigneeId);
reconciliationOrder.setConsignee(consignee);
reconciliationOrder.setDestinationWarehouseName(destinationWarehouseName);
reconciliationOrder.setDestinationWarehouseId(destinationWarehouseId);
reconciliationOrder.setTotalNum(orderPackageTotalVO.getTotalNum());
reconciliationOrder.setTotalWeight(orderPackageTotalVO.getTotalWeight());
reconciliationOrder.setTotalVolume(orderPackageTotalVO.getTotalVolume());
reconciliationOrder.setSystemTotalFee(sysTotalFee);
reconciliationOrder.setRealTotalFee(totalFee);
reconciliationOrder.setPickupFee(pickupPrice);
reconciliationOrder.setFreightFee(freightPrice);
reconciliationOrder.setWarehouseServiceFee(warehouseServiceFee);
reconciliationOrder.setWarehouseFee(orderPackageTotalVO.getWarehouseFee());
reconciliationOrder.setWarehouseManageFee(orderPackageTotalVO.getWarehouseManageFee());
reconciliationOrder.setWarehouseSortingFee(orderPackageTotalVO.getWarehouseSortingFee());
reconciliationOrder.setWarehouseOperatingFee(orderPackageTotalVO.getWarehouseOperatingFee());
reconciliationOrder.setDeliveryFee(orderPackageTotalVO.getDeliveryFee());
reconciliationOrder.setDeliveryServiceFee(deliveryServiceFee);
reconciliationOrder.setDeliveryLoadingFee(orderPackageTotalVO.getDeliveryLoadingFee());
reconciliationOrder.setDeliverySortingFee(orderPackageTotalVO.getDeliverySortingFee());
reconciliationOrder.setDeliveryUpfloorFee(orderPackageTotalVO.getDeliveryUpfloorFee());
reconciliationOrder.setDeliveryMoveFee(orderPackageTotalVO.getDeliveryMoveFee());
reconciliationOrder.setDeliveryOtherFee(orderPackageTotalVO.getDeliveryOtherFee());
reconciliationOrder.setDeliveryCrossingFee(orderPackageTotalVO.getDeliveryCrossingFee());
reconciliationOrder.setInstallFee(BigDecimal.ZERO);
reconciliationOrder.setOtherFee(BigDecimal.ZERO);
reconciliationOrder.setIsAftersale(0);
// reconciliationOrder.setH(BigDecimal.ZERO);
reconciliationOrder.setCreateUserName(AuthUtil.getNickName());
reconciliationOrder.setIsChanges(0);
reconciliationOrder.setChangesFee(BigDecimal.ZERO);
reconciliationOrder.setCheckStatus(0);
boolean saveFlag = reconciliationOrderInfoService.save(reconciliationOrder);
if (saveFlag) {
Long reconciliationOrderId = reconciliationOrder.getId();
List<StatisticsOrderInfoEntity> updateList = new ArrayList<>();
orderInfoEntities.forEach(orderInfoEntity -> {
StatisticsOrderInfoEntity updateEntity = new StatisticsOrderInfoEntity();
updateEntity.setId(orderInfoEntity.getId());
updateEntity.setCreateReconciliationOrderStatus(1);
updateEntity.setCreateReconciliationUserName(AuthUtil.getNickName());
updateEntity.setCreateReconciliationDate(new Date());
updateEntity.setReconciliationOrderId(reconciliationOrderId);
updateEntity.setReconciliationOrderNo(reconciliationOrdeCode);
updateList.add(updateEntity);
});
updateBatchById(updateList);
}
return R.success("生成成功");
}
@Transactional
@Override
public R createFinishWaybillId(List<Long> waybillIds) {
for (Long waybillId : waybillIds) {
WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillId(waybillId);
if (Objects.isNull(waybillEntity)) {
log.error("############createBalanceOrder: 运单不存在 waybillId={}", waybillId);
}
// List<WarehouseWayBillDetail> wayBillDetailList = warehouseWaybillDetailClient.findByWaybillId(waybillId);
//把wayBillDetailList中所有productName用逗号拼起来
// String productTypeNum = wayBillDetailList.stream().map(t->t.getProductName()+"("+t.getNum()+")").collect(Collectors.joining(","));
// String productTypePrice = wayBillDetailList.stream().map(t->t.getProductName()+"("+t.getPrice()+")").collect(Collectors.joining(","));
List<StatisticsOrderInfoEntity> orderInfoEntityList = this.findListByWaybillId(waybillId);
//把orderInfoEntityList中所有id放入一个list,以便查询所有包件信息
List<Long> orderInfoIdsList = orderInfoEntityList.stream().map(StatisticsOrderInfoEntity::getId).collect(Collectors.toList());
StatisticsPackageFeeInfoVO trunklinePackageFeeVO = this.findPackageListByOrderIds(orderInfoIdsList);
String balanceOrderCode = "JSD" + System.currentTimeMillis();
BigDecimal freightPrice = trunklinePackageFeeVO.getFreightPrice();
BigDecimal pickupPrice = trunklinePackageFeeVO.getPickupPrice();
BigDecimal warehouseServiceFee = trunklinePackageFeeVO.getWarehouseServiceFee();
BigDecimal deliveryServiceFee = trunklinePackageFeeVO.getDeliveryServiceFee();
BigDecimal totalFee = freightPrice.add(pickupPrice).add(warehouseServiceFee).add(deliveryServiceFee);
StatisticsBalanceOrderInfoEntity balanceOrderInfoEntity = new StatisticsBalanceOrderInfoEntity();
balanceOrderInfoEntity.setBalanceOrderNo(balanceOrderCode);
balanceOrderInfoEntity.setBrand(waybillEntity.getBrand());
balanceOrderInfoEntity.setWaybillNo(waybillEntity.getWaybillNo());
//把orderInfoEntityList中所有orderCode用逗号拼起来
balanceOrderInfoEntity.setOrderCode(orderInfoEntityList.stream().map(StatisticsOrderInfoEntity::getOrderCode).collect(Collectors.joining(",")));
balanceOrderInfoEntity.setTypeService(waybillEntity.getServiceType());
balanceOrderInfoEntity.setTotalBalanceFee(totalFee);
balanceOrderInfoEntity.setRealTotalFee(totalFee);
balanceOrderInfoEntity.setTotalCount(trunklinePackageFeeVO.getTotalNum());
balanceOrderInfoEntity.setTotalWeight(trunklinePackageFeeVO.getTotalWeight());
balanceOrderInfoEntity.setTotalVolume(trunklinePackageFeeVO.getTotalVolume());
balanceOrderInfoEntity.setConsigneeId(waybillEntity.getConsigneeId());
balanceOrderInfoEntity.setConsignee(waybillEntity.getConsignee());
balanceOrderInfoEntity.setPickupFee(pickupPrice);
balanceOrderInfoEntity.setFreightFee(freightPrice);
balanceOrderInfoEntity.setWarehouseServiceFee(warehouseServiceFee);
balanceOrderInfoEntity.setWarehouseFee(trunklinePackageFeeVO.getWarehouseFee());
balanceOrderInfoEntity.setWarehouseManageFee(trunklinePackageFeeVO.getWarehouseManageFee());
balanceOrderInfoEntity.setWarehouseSortingFee(trunklinePackageFeeVO.getWarehouseSortingFee());
balanceOrderInfoEntity.setWarehouseOperatingFee(trunklinePackageFeeVO.getWarehouseOperatingFee());
balanceOrderInfoEntity.setDeliveryFee(trunklinePackageFeeVO.getDeliveryFee());
balanceOrderInfoEntity.setDeliveryServiceFee(deliveryServiceFee);
balanceOrderInfoEntity.setDeliveryLoadingFee(trunklinePackageFeeVO.getDeliveryLoadingFee());
balanceOrderInfoEntity.setDeliverySortingFee(trunklinePackageFeeVO.getDeliverySortingFee());
balanceOrderInfoEntity.setDeliveryUpfloorFee(trunklinePackageFeeVO.getDeliveryUpfloorFee());
balanceOrderInfoEntity.setDeliveryMoveFee(trunklinePackageFeeVO.getDeliveryMoveFee());
balanceOrderInfoEntity.setDeliveryCrossingFee(trunklinePackageFeeVO.getDeliveryCrossingFee());
balanceOrderInfoEntity.setDeliveryOtherFee(trunklinePackageFeeVO.getDeliveryOtherFee());
balanceOrderInfoEntity.setOtherFee(BigDecimal.ZERO);
balanceOrderInfoEntity.setInstallFee(BigDecimal.ZERO);
balanceOrderInfoEntity.setIsAftersale(0);
balanceOrderInfoEntity.setAftersalesFee(BigDecimal.ZERO);
balanceOrderInfoEntity.setBalanceStatus(2);
balanceOrderInfoEntity.setHasBalanceFee(balanceOrderInfoEntity.getTotalBalanceFee());
balanceOrderInfoEntity.setBalanceUserName(AuthUtil.getUserName());
balanceOrderInfoEntity.setBalanceTime(new Date(System.currentTimeMillis()));
// balanceOrderInfoEntity.setHasBalanceFee(BigDecimal.ZERO);
balanceOrderInfoEntity.setNoBalanceFee(BigDecimal.ZERO);
balanceOrderInfoEntity.setAbnormalBalanceStatus(0);
balanceOrderInfoEntity.setAbnormalBalanceFee(BigDecimal.ZERO);
balanceOrderInfoEntity.setDestinationWarehouseId(waybillEntity.getDestinationWarehouseId());
balanceOrderInfoEntity.setDestinationWarehouseName(waybillEntity.getDestinationWarehouseName());
boolean saveFlag = balanceOrderInfoService.save(balanceOrderInfoEntity);
if (saveFlag) {
Long balanceOrderId = balanceOrderInfoEntity.getId();
List<StatisticsOrderInfoEntity> updateOrderInfoList = new ArrayList<>();
orderInfoEntityList.forEach(orderInfoEntity -> {
StatisticsOrderInfoEntity updateEntity = new StatisticsOrderInfoEntity();
updateEntity.setId(orderInfoEntity.getId());
updateEntity.setBalanceOrderId(balanceOrderId);
updateEntity.setBalanceOrderNo(balanceOrderCode);
updateEntity.setCreateReconciliationOrderStatus(1);
updateEntity.setCreateReconciliationUserName(AuthUtil.getNickName());
updateEntity.setCreateReconciliationDate(new Date());
updateEntity.setConfirmBalanceOrderStatus(1);
updateEntity.setConfirmBalanceDate(new Date());
updateEntity.setConfirmBalanceUserName(AuthUtil.getNickName());
updateOrderInfoList.add(updateEntity);
});
if (CollUtil.isNotEmpty(updateOrderInfoList)) {
this.updateBatchById(updateOrderInfoList);
}
}
// 保存结算记录
StatisticsBalanceRecordEntity balanceRecordEntity = new StatisticsBalanceRecordEntity();
balanceRecordEntity.setBalanceOrderInfoId(balanceOrderInfoEntity.getId());
balanceRecordEntity.setBalanceUserName(AuthUtil.getNickName());
balanceRecordEntity.setBalanceRemark("批量完成结算");
balanceRecordEntity.setBalanceFee(totalFee);
balanceRecordService.save(balanceRecordEntity);
}
// 批量更新运单状态
List<WarehouseWaybillEntity> te = warehouseWaybillClient.findListByWaybillIds(waybillIds);
List<WarehouseWaybillEntity> data = new ArrayList<>();
te.forEach(waybillEntity ->{
WarehouseWaybillEntity t = new WarehouseWaybillEntity();
t.setId(waybillEntity.getId());
t.setPayStatus("30");
t.setSettlementStatus("30");
data.add(t);
});
warehouseWaybillClient.updateList(data);
return R.success("操作成功");
}
@Override @Override
public R findAftersalesOrderList(Long consigneeId) { public R findAftersalesOrderList(Long consigneeId) {
@ -696,21 +1197,21 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
Long reconciliationOrderId = merchantStatisticsDTO.getReconciliationOrderId(); Long reconciliationOrderId = merchantStatisticsDTO.getReconciliationOrderId();
StatisticsReconciliationOrderInfoEntity reconciliationOrderInfo = reconciliationOrderInfoService.getById(reconciliationOrderId); StatisticsReconciliationOrderInfoEntity reconciliationOrderInfo = reconciliationOrderInfoService.getById(reconciliationOrderId);
if(Objects.isNull(reconciliationOrderInfo)){ if (Objects.isNull(reconciliationOrderInfo)) {
log.warn("#########addAftersalesToReconciliationOrder: 对账单信息不存在 reconciliationOrderId={}",reconciliationOrderId); log.warn("#########addAftersalesToReconciliationOrder: 对账单信息不存在 reconciliationOrderId={}", reconciliationOrderId);
return R.fail(405,"对账单信息不存在"); return R.fail(405, "对账单信息不存在");
} }
Integer checkStatus = reconciliationOrderInfo.getCheckStatus(); Integer checkStatus = reconciliationOrderInfo.getCheckStatus();
if(checkStatus == 1){ if (checkStatus == 1) {
log.warn("#########addAftersalesToReconciliationOrder: 对账单已经确认对账 reconciliationOrderId={}",reconciliationOrderId); log.warn("#########addAftersalesToReconciliationOrder: 对账单已经确认对账 reconciliationOrderId={}", reconciliationOrderId);
return R.fail(405,"对账单已经确认对账"); return R.fail(405, "对账单已经确认对账");
} }
List<AftersalesOrderDTO> aftersalesOrderDTOS = merchantStatisticsDTO.getAftersalesOrderDTOS(); List<AftersalesOrderDTO> aftersalesOrderDTOS = merchantStatisticsDTO.getAftersalesOrderDTOS();
if(CollUtil.isEmpty(aftersalesOrderDTOS)){ if (CollUtil.isEmpty(aftersalesOrderDTOS)) {
log.warn("#########addAftersalesToReconciliationOrder: 请选择售后单 aftersalesOrderDTOS={}",aftersalesOrderDTOS); log.warn("#########addAftersalesToReconciliationOrder: 请选择售后单 aftersalesOrderDTOS={}", aftersalesOrderDTOS);
return R.fail(405,"请选择售后单"); return R.fail(405, "请选择售后单");
} }
//把aftersalesOrderDTOS中所有元素的aftersalesFee 求和 //把aftersalesOrderDTOS中所有元素的aftersalesFee 求和
@ -728,7 +1229,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
aftersalesOrderRecordService.saveBatch(aftersalesOrderRecordEntities); aftersalesOrderRecordService.saveBatch(aftersalesOrderRecordEntities);
//对账单加上售后金额 //对账单加上售后金额
reconciliationOrderInfoService.addAftersalesFeeById(reconciliationOrderId,aftersalesFee); reconciliationOrderInfoService.addAftersalesFeeById(reconciliationOrderId, aftersalesFee);
return R.success("添加成功"); return R.success("添加成功");
@ -755,17 +1256,17 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
@Override @Override
public R cancleOrderInfoBindReconcilitionOrder(Long reconciliationOrderId, List<Long> orderInfoIds) { public R cancleOrderInfoBindReconcilitionOrder(Long reconciliationOrderId, List<Long> orderInfoIds) {
StatisticsReconciliationOrderInfoEntity reconciliationOrderInfo = reconciliationOrderInfoService.getById(reconciliationOrderId); StatisticsReconciliationOrderInfoEntity reconciliationOrderInfo = reconciliationOrderInfoService.getById(reconciliationOrderId);
if(Objects.isNull(reconciliationOrderInfo)){ if (Objects.isNull(reconciliationOrderInfo)) {
log.warn("#########cancleOrderInfoBindReconcilitionOrder: 对账单信息不存在 reconciliationOrderId={}",reconciliationOrderId); log.warn("#########cancleOrderInfoBindReconcilitionOrder: 对账单信息不存在 reconciliationOrderId={}", reconciliationOrderId);
return R.fail(405,"对账单信息不存在"); return R.fail(405, "对账单信息不存在");
} }
Integer checkStatus = reconciliationOrderInfo.getCheckStatus(); Integer checkStatus = reconciliationOrderInfo.getCheckStatus();
if(checkStatus == 1){ if (checkStatus == 1) {
log.warn("#########cancleOrderInfoBindReconcilitionOrder: 对账单已确认对账 reconciliationOrderId={}",reconciliationOrderId); log.warn("#########cancleOrderInfoBindReconcilitionOrder: 对账单已确认对账 reconciliationOrderId={}", reconciliationOrderId);
return R.fail(405,"对账单已确认对账"); return R.fail(405, "对账单已确认对账");
} }
baseMapper.clearReconcilitionOrderInfoByOrderInfoIds(orderInfoIds,AuthUtil.getNickName(),new Date()); baseMapper.clearReconcilitionOrderInfoByOrderInfoIds(orderInfoIds, AuthUtil.getNickName(), new Date());
//重新计算对账单的数据 //重新计算对账单的数据
calculateReconcilitionOrder(reconciliationOrderInfo); calculateReconcilitionOrder(reconciliationOrderInfo);
@ -801,19 +1302,19 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
List<Long> balanceOrderIds = baseMapper.findBalanceOrderIdListByWaybillId(waybillId); List<Long> balanceOrderIds = baseMapper.findBalanceOrderIdListByWaybillId(waybillId);
if(CollUtil.isNotEmpty(balanceOrderIds)){ if (CollUtil.isNotEmpty(balanceOrderIds)) {
QueryWrapper<StatisticsBalanceRecordEntity> balanceAbnormalEntityQueryWrapper = new QueryWrapper<>(); QueryWrapper<StatisticsBalanceRecordEntity> balanceAbnormalEntityQueryWrapper = new QueryWrapper<>();
balanceAbnormalEntityQueryWrapper.in("balance_order_info_id", balanceOrderIds); balanceAbnormalEntityQueryWrapper.in("balance_order_info_id", balanceOrderIds);
List<StatisticsBalanceRecordEntity> list = balanceRecordService.list(balanceAbnormalEntityQueryWrapper); List<StatisticsBalanceRecordEntity> list = balanceRecordService.list(balanceAbnormalEntityQueryWrapper);
if(CollUtil.isNotEmpty(list)){ if (CollUtil.isNotEmpty(list)) {
return 1; return 1;
}else{ } else {
return 0; return 0;
} }
}else{ } else {
return 0; return 0;
} }
} }
@ -849,11 +1350,11 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
List<Long> orderInfoIds = baseMapper.findOrderInfoIdListByReconciliationOrderIds(reconciliationOrderIdList); List<Long> orderInfoIds = baseMapper.findOrderInfoIdListByReconciliationOrderIds(reconciliationOrderIdList);
if(CollUtil.isNotEmpty(orderInfoIds)){ if (CollUtil.isNotEmpty(orderInfoIds)) {
List<StatisticsOrderInfoEntity> orderInfoEntities = baseMapper.selectBatchIds(orderInfoIds); List<StatisticsOrderInfoEntity> orderInfoEntities = baseMapper.selectBatchIds(orderInfoIds);
if(CollUtil.isEmpty(orderInfoEntities)){ if (CollUtil.isEmpty(orderInfoEntities)) {
log.warn("############calculateReconcilitionOrder: 未找到对应订单信息"); log.warn("############calculateReconcilitionOrder: 未找到对应订单信息");
throw new CustomerException(405,"未找到对应订单信息"); throw new CustomerException(405, "未找到对应订单信息");
} }
@ -861,24 +1362,24 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
Integer syncFeeStatus = orderInfoEntity.getSyncFeeStatus(); Integer syncFeeStatus = orderInfoEntity.getSyncFeeStatus();
Long orderId = orderInfoEntity.getId(); Long orderId = orderInfoEntity.getId();
String orderCode = orderInfoEntity.getOrderCode(); String orderCode = orderInfoEntity.getOrderCode();
if(syncFeeStatus == 0){ if (syncFeeStatus == 0) {
log.warn("############calculateReconcilitionOrder: 订单还未同步数据 orderId={}",orderId); log.warn("############calculateReconcilitionOrder: 订单还未同步数据 orderId={}", orderId);
throw new CustomerException(405,"订单["+orderCode+"]还未同步数据"); throw new CustomerException(405, "订单[" + orderCode + "]还未同步数据");
} }
} }
//判断orderInfoEntities中所有元素通过consigneeId进行分组 //判断orderInfoEntities中所有元素通过consigneeId进行分组
Map<Long, List<StatisticsOrderInfoEntity>> groupByConsigneeId = orderInfoEntities.stream().collect(Collectors.groupingBy(StatisticsOrderInfoEntity::getConsigneeId)); Map<Long, List<StatisticsOrderInfoEntity>> groupByConsigneeId = orderInfoEntities.stream().collect(Collectors.groupingBy(StatisticsOrderInfoEntity::getConsigneeId));
int consigneeSize = groupByConsigneeId.keySet().size(); int consigneeSize = groupByConsigneeId.keySet().size();
if(consigneeSize > 1){ if (consigneeSize > 1) {
log.warn("############calculateReconcilitionOrder: 订单不属于同一个商家"); log.warn("############calculateReconcilitionOrder: 订单不属于同一个商家");
throw new CustomerException(405,"订单不属于同一个商家"); throw new CustomerException(405, "订单不属于同一个商家");
} }
Map<Long, List<StatisticsOrderInfoEntity>> groupByDestinationWarehouseId = orderInfoEntities.stream().collect(Collectors.groupingBy(StatisticsOrderInfoEntity::getDestinationWarehouseId)); Map<Long, List<StatisticsOrderInfoEntity>> groupByDestinationWarehouseId = orderInfoEntities.stream().collect(Collectors.groupingBy(StatisticsOrderInfoEntity::getDestinationWarehouseId));
int destinationWarehouseIdSize = groupByDestinationWarehouseId.keySet().size(); int destinationWarehouseIdSize = groupByDestinationWarehouseId.keySet().size();
if(destinationWarehouseIdSize > 1){ if (destinationWarehouseIdSize > 1) {
log.warn("############calculateReconcilitionOrder: 订单不属于同一个目的仓"); log.warn("############calculateReconcilitionOrder: 订单不属于同一个目的仓");
throw new CustomerException(405,"订单不属于同一个目的仓"); throw new CustomerException(405, "订单不属于同一个目的仓");
} }
StatisticsPackageFeeInfoVO orderPackageTotalVO = baseMapper.findPackageListByOrderIds(orderInfoIds); StatisticsPackageFeeInfoVO orderPackageTotalVO = baseMapper.findPackageListByOrderIds(orderInfoIds);
BigDecimal freightPrice = orderPackageTotalVO.getFreightPrice(); BigDecimal freightPrice = orderPackageTotalVO.getFreightPrice();
@ -928,13 +1429,11 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
reconciliationOrderInfo.setChangesFee(changesFee); reconciliationOrderInfo.setChangesFee(changesFee);
reconciliationOrderInfoService.updateById(reconciliationOrderInfo); reconciliationOrderInfoService.updateById(reconciliationOrderInfo);
}else{ } else {
reconciliationOrderInfoService.removeById(reconciliationOrderId); reconciliationOrderInfoService.removeById(reconciliationOrderId);
} }
} }
private void calculateWarehouseCost(PriceWarehouseVO warehouse, List<StatisticsWarehousePackageEntity> warehousePackageEntities, BasicdataPriceTemplateEntity template) { private void calculateWarehouseCost(PriceWarehouseVO warehouse, List<StatisticsWarehousePackageEntity> warehousePackageEntities, BasicdataPriceTemplateEntity template) {
@ -1002,13 +1501,13 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
List<StatisticsDistributionPackageEntity> distributionPackageEntities1 = distributionPackageService.list(Wrappers.<StatisticsDistributionPackageEntity>lambdaQuery() List<StatisticsDistributionPackageEntity> distributionPackageEntities1 = distributionPackageService.list(Wrappers.<StatisticsDistributionPackageEntity>lambdaQuery()
.in(StatisticsDistributionPackageEntity::getTrainNumber, trainNumberSet)); .in(StatisticsDistributionPackageEntity::getTrainNumber, trainNumberSet));
for (String s : trainNumberSet) { for (String s : trainNumberSet) {
if(CollUtil.isNotEmpty(distributionPackageEntities1)){ if (CollUtil.isNotEmpty(distributionPackageEntities1)) {
List<StatisticsDistributionPackageEntity> packageEntities = distributionPackageEntities1.stream() List<StatisticsDistributionPackageEntity> packageEntities = distributionPackageEntities1.stream()
.filter(entity -> ObjectUtil.equals(s, entity.getTrainNumber())) .filter(entity -> ObjectUtil.equals(s, entity.getTrainNumber()))
.filter(entity -> ObjectUtil.equals(entity.getBrandId(), brandId)) .filter(entity -> ObjectUtil.equals(entity.getBrandId(), brandId))
.filter(entity -> ObjectUtil.equals(entity.getConsigneeId(), consigneeId)) .filter(entity -> ObjectUtil.equals(entity.getConsigneeId(), consigneeId))
.collect(Collectors.toList()); .collect(Collectors.toList());
if(CollUtil.isNotEmpty(packageEntities)){ if (CollUtil.isNotEmpty(packageEntities)) {
buildDispatchCostToPackage(dispatchMinCostType, packageEntities, minCost, additionalCost); buildDispatchCostToPackage(dispatchMinCostType, packageEntities, minCost, additionalCost);
} }
} }
@ -1054,7 +1553,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
PriceDispatchBasicVO priceDispatchBasicVO = pieceList.get(0); PriceDispatchBasicVO priceDispatchBasicVO = pieceList.get(0);
// TODO 如果是遗留件 按遗留件单价来计算 目前只有欧派有遗留件 // TODO 如果是遗留件 按遗留件单价来计算 目前只有欧派有遗留件
Double price1 = priceDispatchBasicVO.getPrice(); Double price1 = priceDispatchBasicVO.getPrice();
log.info("基础按件价格:{}",price1); log.info("基础按件价格:{}", price1);
// 配送费 = 按件单价 // 配送费 = 按件单价
statisticsDistributionPackageEntity.setDeliveryFee(NumberUtil.toBigDecimal(price1)); statisticsDistributionPackageEntity.setDeliveryFee(NumberUtil.toBigDecimal(price1));
} }
@ -1075,7 +1574,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
BigDecimal totalVolume = statisticsDistributionPackageEntity.getVolume(); BigDecimal totalVolume = statisticsDistributionPackageEntity.getVolume();
// 配送费 = 按方单价 * 体积 // 配送费 = 按方单价 * 体积
if (ObjectUtil.isNotEmpty(totalVolume)) { if (ObjectUtil.isNotEmpty(totalVolume)) {
log.info("基础按方价格:{}",NumberUtil.toBigDecimal(price1).multiply(totalVolume)); log.info("基础按方价格:{}", NumberUtil.toBigDecimal(price1).multiply(totalVolume));
statisticsDistributionPackageEntity.setDeliveryFee(NumberUtil.toBigDecimal(price1).multiply(totalVolume)); statisticsDistributionPackageEntity.setDeliveryFee(NumberUtil.toBigDecimal(price1).multiply(totalVolume));
} }
} }
@ -1096,7 +1595,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
BigDecimal totalWeight = statisticsDistributionPackageEntity.getWeight(); BigDecimal totalWeight = statisticsDistributionPackageEntity.getWeight();
// 配送费 = 按重量单价 * 重量 // 配送费 = 按重量单价 * 重量
if (ObjectUtil.isNotEmpty(totalWeight)) { if (ObjectUtil.isNotEmpty(totalWeight)) {
log.info("基础按重量价格:{}",totalWeight); log.info("基础按重量价格:{}", totalWeight);
statisticsDistributionPackageEntity.setDeliveryFee(NumberUtil.toBigDecimal(price1).multiply(totalWeight)); statisticsDistributionPackageEntity.setDeliveryFee(NumberUtil.toBigDecimal(price1).multiply(totalWeight));
} }
} }

1
blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/vo/StatisticsPackageFeeInfoVO.java

@ -10,6 +10,7 @@ import java.util.Date;
public class StatisticsPackageFeeInfoVO implements Serializable { public class StatisticsPackageFeeInfoVO implements Serializable {
private Long orderInfoId; private Long orderInfoId;
private Long waybillId;
private String goodsName;//物料品类 private String goodsName;//物料品类

161
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/waybil/StatusLogListener.java

@ -0,0 +1,161 @@
package com.logpm.trunkline.mq.waybil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.logpm.trunkline.dto.WaybillLogDTO;
import com.logpm.trunkline.feign.ITrunklineWaybillTrackClient;
import com.logpm.trunkline.mapper.TrunklineWaybillPackageMapper;
import com.logpm.trunkline.service.ITrunklineWaybillPackageService;
import com.logpm.trunkline.service.ITrunklineWaybillTrackService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.broadcast.FanoutConstants;
import org.springblade.common.enums.BizOperationEnums;
import org.springblade.common.model.DistributionReCheckSignVO;
import org.springblade.common.model.NodeFanoutMsg;
import org.springblade.common.model.PackageData;
import org.springblade.common.model.workNode.PickUpByReCheckVO;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
/**
* 运单日志和状态变更
*/
@Slf4j
@Component
@AllArgsConstructor
public class StatusLogListener {
private final ITrunklineWaybillTrackClient trunklineWaybillTrackClient ;
@RabbitListener(bindings = @QueueBinding(
value = @Queue(name = FanoutConstants.DeliveryOfPickup.BillSignReview.QUEUE.waybillStatusLog, durable = "true"),
exchange = @Exchange(name = FanoutConstants.DeliveryOfPickup.BillSignReview.EXCHANGE, type = ExchangeTypes.FANOUT)
))
@Transactional(rollbackFor = Exception.class)
public void statusPickUpLog(String msg) {
log.info("自提复核处理运单日志和状态: {}", msg);
if (StrUtil.isEmpty(msg)) {
return;
}
NodeFanoutMsg bean = JSONUtil.toBean(msg, NodeFanoutMsg.class);
Object main = bean.getMain();
JSONObject entries = JSONUtil.parseObj(main);
PickUpByReCheckVO vo = JSONUtil.toBean(entries, PickUpByReCheckVO.class);
Long warehouseId = bean.getWarehouseId();
BizOperationEnums bizOperation = bean.getBizOperation();
List<PackageData> details = vo.getPackageDataList();
// 按照运单号进行分组 后面的集合 按照创建时间进行排序
Map<String, List<PackageData>> map = details.stream().collect(Collectors.groupingBy(PackageData::getWaybillNumber));
// 根据运单号 统计 每个运单的数量
Map<String, Integer> waybillCountMap = new HashMap<>();
for (PackageData packageData : details) {
String waybillNumber = packageData.getWaybillNumber();
waybillCountMap.put(waybillNumber, waybillCountMap.getOrDefault(waybillNumber, 0) + packageData.getNumber());
}
Set<String> strings = waybillCountMap.keySet();
for (String waybillNumber : strings) {
WaybillLogDTO t = new WaybillLogDTO();
List<PackageData> packageDataList = map.get(waybillNumber);
if (packageDataList != null && !packageDataList.isEmpty()) {
packageDataList.sort(Comparator.comparing(PackageData::getSignTime));
// 获取排序第一个
t.setSignUser(packageDataList.get(0).getSignUser());
t.setSignTime(packageDataList.get(0).getSignTime());
}
t.setWaybillNo(waybillNumber);
t.setWarehouseName(bean.getWarehouse());
t.setWarehouseId(warehouseId);
t.setTrainNumber(vo.getPickupBatch());
t.setCarNumber(vo.getCarNumber());
t.setDriverName(vo.getDriverName());
t.setDeliveryTime(vo.getDeliveryTime());
t.setNum(waybillCountMap.get(waybillNumber));
t.setSignOrderCode(vo.getPickupBatch());
t.setType(3);
trunklineWaybillTrackClient.addSignWaybillLog(t);
}
}
/**
* 配送签收复核
* @param msg
*/
@RabbitListener(bindings = @QueueBinding(
value = @Queue(name = FanoutConstants.distribution.DeliveryAndrecheck.QUEUE.waybillStatusLog, durable = "true"),
exchange = @Exchange(name = FanoutConstants.distribution.DeliveryAndrecheck.EXCHANGE, type = ExchangeTypes.FANOUT)
))
@Transactional(rollbackFor = Exception.class)
public void statusDekiveryLog(String msg) {
log.info("商/市配送 复核处理运单日志和状态: {}", msg);
if (StrUtil.isEmpty(msg)) {
return;
}
NodeFanoutMsg bean = JSONUtil.toBean(msg, NodeFanoutMsg.class);
Object main = bean.getMain();
JSONObject entries = JSONUtil.parseObj(main);
DistributionReCheckSignVO vo = JSONUtil.toBean(entries, DistributionReCheckSignVO.class);
Long warehouseId = bean.getWarehouseId();
BizOperationEnums bizOperation = bean.getBizOperation();
List<PackageData> details = vo.getPackageDataList();
// 按照运单号进行分组 后面的集合 按照创建时间进行排序
Map<String, List<PackageData>> map = details.stream().collect(Collectors.groupingBy(PackageData::getWaybillNumber));
// 根据运单号 统计 每个运单的数量
Map<String, Integer> waybillCountMap = new HashMap<>();
for (PackageData packageData : details) {
String waybillNumber = packageData.getWaybillNumber();
waybillCountMap.put(waybillNumber, waybillCountMap.getOrDefault(waybillNumber, 0) + packageData.getNumber());
}
Set<String> strings = waybillCountMap.keySet();
for (String waybillNumber : strings) {
WaybillLogDTO t = new WaybillLogDTO();
List<PackageData> packageDataList = map.get(waybillNumber);
if (packageDataList != null && !packageDataList.isEmpty()) {
packageDataList.sort(Comparator.comparing(PackageData::getSignTime));
// 获取排序第一个
t.setSignUser(packageDataList.get(0).getSignUser());
t.setSignTime(packageDataList.get(0).getSignTime());
}
t.setWaybillNo(waybillNumber);
t.setWarehouseName(bean.getWarehouse());
t.setWarehouseId(warehouseId);
t.setTrainNumber(vo.getTrainNumber());
t.setCarNumber(vo.getVehicleName());
t.setDriverName(vo.getDriverName());
t.setDeliveryTime(vo.getDeliveryTime());
t.setNum(waybillCountMap.get(waybillNumber));
t.setSignOrderCode(vo.getReservationCode());
t.setType(3);
trunklineWaybillTrackClient.addSignWaybillLog(t);
}
}
}

19
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillTrackServiceImpl.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.trunkline.dto.OpenOrderDTO; import com.logpm.trunkline.dto.OpenOrderDTO;
import com.logpm.trunkline.dto.WaybillLogDTO; import com.logpm.trunkline.dto.WaybillLogDTO;
import com.logpm.trunkline.entity.TrunklineWaybillTrackEntity; import com.logpm.trunkline.entity.TrunklineWaybillTrackEntity;
import com.logpm.trunkline.mapper.TrunklineWaybillPackageMapper;
import com.logpm.trunkline.mapper.TrunklineWaybillTrackMapper; import com.logpm.trunkline.mapper.TrunklineWaybillTrackMapper;
import com.logpm.trunkline.service.IOpenOrderAsyncService; import com.logpm.trunkline.service.IOpenOrderAsyncService;
import com.logpm.trunkline.service.ITrunklineWaybillOrderService; import com.logpm.trunkline.service.ITrunklineWaybillOrderService;
@ -27,12 +28,13 @@ import java.util.Objects;
@Service @Service
@AllArgsConstructor @AllArgsConstructor
public class TrunklineWaybillTrackServiceImpl extends BaseServiceImpl<TrunklineWaybillTrackMapper, TrunklineWaybillTrackEntity> implements ITrunklineWaybillTrackService { public class TrunklineWaybillTrackServiceImpl extends BaseServiceImpl<TrunklineWaybillTrackMapper, TrunklineWaybillTrackEntity> implements ITrunklineWaybillTrackService {
private final IWarehouseWaybillClient warehouseWaybillClient; private final IWarehouseWaybillClient warehouseWaybillClient;
private final IOpenOrderAsyncService openOrderAsyncService; private final IOpenOrderAsyncService openOrderAsyncService;
private final ITrunklineWaybillOrderService waybillOrderService;
private final ITrunklineWaybillPackageService trunklineWaybillPackageService; private final ITrunklineWaybillPackageService trunklineWaybillPackageService;
private final TrunklineWaybillPackageMapper trunklineWaybillPackageMapper;
@Override @Override
public List<TrunklineWaybillTrackEntity> findWaybillLog(Long waybillId, String trackType) { public List<TrunklineWaybillTrackEntity> findWaybillLog(Long waybillId, String trackType) {
return baseMapper.findWaybillLog(waybillId,trackType); return baseMapper.findWaybillLog(waybillId,trackType);
@ -59,6 +61,11 @@ public class TrunklineWaybillTrackServiceImpl extends BaseServiceImpl<TrunklineW
String nickName = waybillLogDTO.getNickName(); String nickName = waybillLogDTO.getNickName();
if(StringUtil.isNotBlank(waybillNo)){ if(StringUtil.isNotBlank(waybillNo)){
Integer packageStatus = trunklineWaybillPackageMapper.findMaxPackageStatus(waybillNo);
log.info(">>>>",packageStatus+" **");
WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNo); WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNo);
if(Objects.isNull(warehouseWaybillEntity)){ if(Objects.isNull(warehouseWaybillEntity)){
log.warn("未找到运单信息 waybillNo:{}",waybillNo); log.warn("未找到运单信息 waybillNo:{}",waybillNo);
@ -78,6 +85,7 @@ public class TrunklineWaybillTrackServiceImpl extends BaseServiceImpl<TrunklineW
updateWaybill.setSignCheckUserName(nickName); updateWaybill.setSignCheckUserName(nickName);
updateWaybill.setSignCheckTime(new Date()); updateWaybill.setSignCheckTime(new Date());
warehouseWaybillClient.updateEntity(updateWaybill); warehouseWaybillClient.updateEntity(updateWaybill);
warehouseWaybillEntity.setSignNum(updateWaybill.getSignNum());
if(waybillType == 1){ if(waybillType == 1){
//订制品运单 //订制品运单
@ -87,12 +95,8 @@ public class TrunklineWaybillTrackServiceImpl extends BaseServiceImpl<TrunklineW
}else if(waybillType == 2){ }else if(waybillType == 2){
//零担运单 //零担运单
addZeroWaybillTrackLog(waybillLogDTO,warehouseWaybillEntity); addZeroWaybillTrackLog(waybillLogDTO,warehouseWaybillEntity);
} }
} }
} catch (Exception e) { } catch (Exception e) {
log.error("添加签收日志失败",e); log.error("添加签收日志失败",e);
@ -134,7 +138,6 @@ public class TrunklineWaybillTrackServiceImpl extends BaseServiceImpl<TrunklineW
default: default:
typeStr = "未知签收"; typeStr = "未知签收";
} }
if(type == 3){ if(type == 3){
//如果是配送签收需要补录配送装车记录 //如果是配送签收需要补录配送装车记录
String operationRemark = warehouseName+" 配送装车"+num+"件,车次号:"+trainNumber+",司机:"+driverName+",车牌号:"+carNumber+",装车人"+ loadingUser+",配送时间"+ CommonUtil.dateToStringGeneral(deliveryTime); String operationRemark = warehouseName+" 配送装车"+num+"件,车次号:"+trainNumber+",司机:"+driverName+",车牌号:"+carNumber+",装车人"+ loadingUser+",配送时间"+ CommonUtil.dateToStringGeneral(deliveryTime);
@ -146,6 +149,7 @@ public class TrunklineWaybillTrackServiceImpl extends BaseServiceImpl<TrunklineW
openOrderAsyncService.saveLog(waybillId,waybillNo,"100",warehouseName+" "+typeStr,operationRemark,nickName,userId,warehouseId,warehouseName); openOrderAsyncService.saveLog(waybillId,waybillNo,"100",warehouseName+" "+typeStr,operationRemark,nickName,userId,warehouseId,warehouseName);
trunklineWaybillPackageService.updateWaybillStatus(warehouseWaybillEntity); trunklineWaybillPackageService.updateWaybillStatus(warehouseWaybillEntity);
} }
private void addPackageWaybillTrackLog(WaybillLogDTO waybillLogDTO,Long waybillId) { private void addPackageWaybillTrackLog(WaybillLogDTO waybillLogDTO,Long waybillId) {
@ -185,7 +189,6 @@ public class TrunklineWaybillTrackServiceImpl extends BaseServiceImpl<TrunklineW
default: default:
typeStr = "未知签收"; typeStr = "未知签收";
} }
if(type == 3){ if(type == 3){
//如果是配送签收需要补录配送装车记录 //如果是配送签收需要补录配送装车记录
String operationRemark = warehouseName+" 配送装车"+num+"件,车次号:"+trainNumber+",司机:"+driverName+",车牌号:"+carNumber+",装车人"+ loadingUser+",配送时间"+ CommonUtil.dateToStringGeneral(deliveryTime); String operationRemark = warehouseName+" 配送装车"+num+"件,车次号:"+trainNumber+",司机:"+driverName+",车牌号:"+carNumber+",装车人"+ loadingUser+",配送时间"+ CommonUtil.dateToStringGeneral(deliveryTime);

Loading…
Cancel
Save