Browse Source

2B 对账单子

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

2
blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java

@ -9,7 +9,7 @@ public interface ModuleNameConstant {
/**
* 如果不需要 ""
*/
public static final String DEVAUTH ="-pref";
public static final String DEVAUTH ="";
/**
* 工厂对接服务名称

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

@ -322,6 +322,11 @@ public abstract class FanoutConstants {
interface QUEUE {
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 {
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 java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@ -40,6 +41,13 @@ public class DistributionSignforVO implements Serializable {
* 签收车次
*/
private String trainNumber;
/**
* 配送时间
*/
private Date deliveryTime;
/**
* 预约单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.math.BigDecimal;
import java.util.Date;
/**
* 提送数据
@ -138,4 +139,14 @@ public class PackageData implements Serializable {
*/
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 org.springblade.common.model.PackageData;
import java.util.Date;
import java.util.List;
@Data
@ -12,6 +13,28 @@ public class PickUpByScanVO {
* 自提单号
*/
private String pickupBatch;
//
// /**
// * 车次号
// */
// private String trainNumber;
/**
* 车牌号
*/
private String carNumber;
/**
* 司机名称
*/
private String driverName;
/**
* 配送时间
*/
private Date deliveryTime;
/**
* 自提明细数据

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
@PostMapping("/updateStockup")
@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());
// // 复核作业节点推送
@ -783,7 +783,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
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();
@ -798,6 +798,11 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
org.springblade.common.model.DistributionReCheckSignVO distributionLoadVO = new org.springblade.common.model.DistributionReCheckSignVO();
distributionLoadVO.setReservationCode(reservationEntity.getReservationCode());
distributionLoadVO.setDeliveryTime(deliveryListEntity.getCreateTime());
distributionLoadVO.setTrainNumber(deliveryListEntity.getTrainNumber());
distributionLoadVO.setVehicleName(deliveryListEntity.getVehicleName());
distributionLoadVO.setDriverName(deliveryListEntity.getDriverName());
nodeFanoutMsg.setMain(distributionLoadVO);
@ -808,6 +813,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
for (DistributionLoadscanEntity distributionLoadscanEntity : list) {
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) {
packageData.setPackageCode(distributionLoadscanEntity.getOrderPackageCode());
@ -816,6 +823,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
DistributionParcelListEntity distributionParcelListEntity1 = distributionParcelListService.selectByOrderPackageCode(distributionLoadscanEntity.getOrderPackageCode(), distributionLoadscanEntity.getWarehouseId());
if (Func.isNotEmpty(distributionParcelListEntity1)) {
packageData.setBrand(distributionParcelListEntity1.getBrandName());
packageData.setWaybillNumber(distributionParcelListEntity1.getWaybillNumber());
packageData.setOrderCode(distributionParcelListEntity1.getOrderCode());
}
} else {
// 零担
@ -7086,7 +7095,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
buildArgsToPushMq(distributionSignfor);
if (isSuccess) {
//整理签收数据回退干线
handletrunklineWaybillSignLog(distributionSignfor.getReservationId());
// handletrunklineWaybillSignLog(distributionSignfor.getReservationId());
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) {
log.error("推送失败:{}", e);
log.error("推送失败:", e);
}
for (DistributionBillLadingScanEntity ladingScanEntity : ladingScanEntities) {
if (ladingScanEntity.getStockArticleId() != null) {
@ -4034,15 +4034,15 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
//释放库存品
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));
//整理运单信息
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());
//推送该自提单的包件运单信息
@ -4163,13 +4163,17 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
nodeFanoutMsg.setTenantId(myCurrentWarehouse.getTenantId());
PickUpByReCheckVO pickUpByReCheckVO = new PickUpByReCheckVO();
pickUpByReCheckVO.setPickupBatch(billLadingEntity.getPickupBatch());
pickUpByReCheckVO.setCarNumber(billLadingEntity.getPickUpPlate());
pickUpByReCheckVO.setDriverName(billLadingEntity.getConsignee());
pickUpByReCheckVO.setDeliveryTime(billLadingEntity.getPickUpTime());
List<PackageData> packageDataList = new ArrayList<>();
pickUpByReCheckVO.setPackageDataList(packageDataList);
ladingScanEntities.forEach(t -> {
PackageData packageData = new PackageData();
packageData.setSignUser(t.getScanUser());
packageData.setSignTime(t.getCreateTime());
if ("1".equals(t.getMaterialType())) {
// 库存
Long stockListId = t.getStockListId();
@ -4182,10 +4186,16 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
packageData.setMaterialCode(byId.getCargoNumber());
packageData.setNumber(t.getQuantity());
packageData.setPackageType(PackageTypeEnums.INV);
}
} 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.setNumber(1);
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">
and create_time &lt;= #{param.endDate}
</if>
and departure_warehouse_id in
and destination_warehouse_id in
<foreach collection="param.warehouseIds" item="item" open="(" separator="," close=")">
#{item}
</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)
from logpm_warehouse_waybill
where 1=1
and departure_warehouse_id in
and destination_warehouse_id in
<foreach collection="param.warehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
@ -45,7 +45,7 @@
<if test="param.endDate != null">
and create_time &lt;= #{param.endDate}
</if>
and departure_warehouse_id in
and destination_warehouse_id in
<foreach collection="param.warehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
@ -909,7 +909,7 @@
</select>
<select id="findTotalNumByWarWarehouseId"
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(sum(total_count),0) totalCount
from logpm_warehouse_waybill
@ -920,11 +920,12 @@
<if test="param.endDate != null">
and create_time &lt;= #{param.endDate}
</if>
and departure_warehouse_id in
and destination_warehouse_id in
<foreach collection="param.warehouseIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY departure_warehouse_id
AND YEAR(create_time) = YEAR(CURDATE())
GROUP BY destination_warehouse_id
</select>
<select id="handOrderDataByWarehouseId" resultType="com.logpm.report.vo.IndexHandOrderDataByWarehouseIdVO">
select

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

@ -417,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);
}
if (payWay.equals("1") || payWay.equals("2")) {
//如果是现付和到付需要直接生成结算单
createBalanceOrder(waybillEntity);
}
// if (payWay.equals("1") || payWay.equals("2")) {
// //如果是现付和到付需要直接生成结算单
// createBalanceOrder(waybillEntity);
// }
log.info("#########checkWaybillIncomingData: 运单审核处理收入结算数据 结束 waybillId={}", waybillId);
}

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

@ -641,8 +641,13 @@
lww.consignee_name consigneePerson,
lww.consignee_mobile consigneeMobile,
lww.consignee_address consigneeAddress,
lsoi.sign_status signStatus,
lsoi.sign_date signDate,
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,

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

@ -59,4 +59,7 @@ public interface IStatisticsOrderInfoService extends BaseService<StatisticsOrder
R createReconciliationWaybillId(List<Long> waybillIds);
R createFinishWaybillId(List<Long> waybillIds);
boolean calculateRealCostByWaybillId(Long id);
}

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

@ -11,7 +11,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.logpm.basicdata.entity.BasicdataClientEntity;
import com.logpm.basicdata.entity.BasicdataPriceTemplateEntity;
import com.logpm.basicdata.feign.IBasicdataClientClient;
import com.logpm.basicdata.feign.IBasicdataPriceClient;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.basicdata.vo.BasicdatPriceApiVO;
@ -68,6 +70,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
private final IBasicdataWarehouseClient warehouseClient;
private final IStatisticsBalanceRecordService balanceRecordService;
private final IWarehouseWaybillClient warehouseWaybillClient;
private final IBasicdataClientClient basicdataClientClient;
@Override
public List<StatisticsOrderInfoEntity> findListByWaybillId(Long waybillId) {
@ -712,6 +715,79 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
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
public StatisticsPackageFeeInfoVO findPackageListByOrderIds(List<Long> orderInfoIdsList) {
return baseMapper.findPackageListByOrderIds(orderInfoIdsList);
@ -942,7 +1018,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
reconciliationOrder.setOtherFee(BigDecimal.ZERO);
reconciliationOrder.setIsAftersale(0);
reconciliationOrder.setAftersalesFee(BigDecimal.ZERO);
// reconciliationOrder.setH(BigDecimal.ZERO);
reconciliationOrder.setCreateUserName(AuthUtil.getNickName());
@ -972,6 +1048,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
}
@Transactional
@Override
public R createFinishWaybillId(List<Long> waybillIds) {
@ -1036,10 +1113,13 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
balanceOrderInfoEntity.setIsAftersale(0);
balanceOrderInfoEntity.setAftersalesFee(BigDecimal.ZERO);
balanceOrderInfoEntity.setBalanceStatus(0);
balanceOrderInfoEntity.setBalanceStatus(2);
balanceOrderInfoEntity.setHasBalanceFee(balanceOrderInfoEntity.getTotalBalanceFee());
balanceOrderInfoEntity.setBalanceUserName(AuthUtil.getUserName());
balanceOrderInfoEntity.setBalanceTime(new Date(System.currentTimeMillis()));
balanceOrderInfoEntity.setHasBalanceFee(BigDecimal.ZERO);
balanceOrderInfoEntity.setNoBalanceFee(totalFee);
// balanceOrderInfoEntity.setHasBalanceFee(BigDecimal.ZERO);
balanceOrderInfoEntity.setNoBalanceFee(BigDecimal.ZERO);
balanceOrderInfoEntity.setAbnormalBalanceStatus(0);
balanceOrderInfoEntity.setAbnormalBalanceFee(BigDecimal.ZERO);
@ -1067,8 +1147,36 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
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("操作成功");

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

Loading…
Cancel
Save