|
|
|
@ -22,6 +22,7 @@ import org.springblade.common.enums.PackageTypeEnums;
|
|
|
|
|
import org.springblade.common.model.DistributionTaskVO; |
|
|
|
|
import org.springblade.common.model.NodeFanoutMsg; |
|
|
|
|
import org.springblade.common.model.PackageData; |
|
|
|
|
import org.springblade.common.model.PlanDriverbindCarVO; |
|
|
|
|
import org.springblade.common.model.ReservationVO; |
|
|
|
|
import org.springframework.amqp.core.ExchangeTypes; |
|
|
|
|
import org.springframework.amqp.rabbit.annotation.Exchange; |
|
|
|
@ -33,6 +34,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 配送计划生成明细报表 |
|
|
|
@ -68,9 +70,15 @@ public class PlanReportListener {
|
|
|
|
|
BizOperationEnums bizOperation = bean.getBizOperation(); |
|
|
|
|
List<ReservationVO> reservationVOList = vo.getReservationVOList(); |
|
|
|
|
if (CollUtil.isNotEmpty(reservationVOList)) { |
|
|
|
|
Set<String> reservationSet = new HashSet<>(); |
|
|
|
|
List<PlanDriverbindCarVO> planDriverbindCars = vo.getPlanDriverbindCars(); |
|
|
|
|
String vehicleName = ""; |
|
|
|
|
String driverName = ""; |
|
|
|
|
if(CollUtil.isNotEmpty(planDriverbindCars)){ |
|
|
|
|
// 用逗号拼接 车辆和司机
|
|
|
|
|
vehicleName = planDriverbindCars.stream().map(PlanDriverbindCarVO::getCarPlate).collect(Collectors.joining(",")); |
|
|
|
|
driverName = planDriverbindCars.stream().map(PlanDriverbindCarVO::getDriverName).collect(Collectors.joining(",")); |
|
|
|
|
} |
|
|
|
|
Map<String, QualityDeliverEntity> invMap = new HashMap<>(); |
|
|
|
|
Map<String, QualityDeliverEntity> ltlMap = new HashMap<>(); |
|
|
|
|
for (ReservationVO reservationVO : reservationVOList) { |
|
|
|
|
List<PackageData> details = reservationVO.getPackageDataList(); |
|
|
|
|
if (BizOperationEnums.MODIFY.equals(bizOperation) || BizOperationEnums.DELETE.equals(bizOperation)) { |
|
|
|
@ -100,8 +108,8 @@ public class PlanReportListener {
|
|
|
|
|
.deliveryTime(DateUtil.parseDate(vo.getTaskTime())) |
|
|
|
|
.deliveryType(vo.getType()) |
|
|
|
|
.deliveryKind(vo.getKind()) |
|
|
|
|
.vehicleName(vo.getVehicleName()) |
|
|
|
|
.driverName(vo.getDriverName()) |
|
|
|
|
.vehicleName(vehicleName) |
|
|
|
|
.driverName(driverName) |
|
|
|
|
.distributionCompany(vo.getDistributionCompany()) |
|
|
|
|
.deliveryPlanTime(bean.getOperatorTime()) |
|
|
|
|
.deliveryCreateUserName(bean.getOperator()) |
|
|
|
@ -125,14 +133,13 @@ public class PlanReportListener {
|
|
|
|
|
qualityDeliverEntity.setConditions(2); |
|
|
|
|
qualityDeliverEntity.setPlanNum(detail.getNumber()); |
|
|
|
|
if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) { |
|
|
|
|
// ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build();
|
|
|
|
|
// factoryDataClient.sendMessage(SendMsg.builder()
|
|
|
|
|
// .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE)
|
|
|
|
|
// .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY)
|
|
|
|
|
// .message(JSONUtil.toJsonStr(dto))
|
|
|
|
|
// .delay(3000)
|
|
|
|
|
// .build());
|
|
|
|
|
ltlMap.put(detail.getOrderCode()+detail.getProductName(), qualityDeliverEntity); |
|
|
|
|
ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); |
|
|
|
|
factoryDataClient.sendMessage(SendMsg.builder() |
|
|
|
|
.exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) |
|
|
|
|
.routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) |
|
|
|
|
.message(JSONUtil.toJsonStr(dto)) |
|
|
|
|
.delay(3000) |
|
|
|
|
.build()); |
|
|
|
|
} |
|
|
|
|
} else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.INV)) { |
|
|
|
|
invMap.put(detail.getMallName()+detail.getMaterialCode(), qualityDeliverEntity); |
|
|
|
@ -145,13 +152,6 @@ public class PlanReportListener {
|
|
|
|
|
qualityDeliverEntity.setPlanNum(1); |
|
|
|
|
if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) { |
|
|
|
|
invMap.put(detail.getMallName()+detail.getMaterialCode(), qualityDeliverEntity); |
|
|
|
|
// ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build();
|
|
|
|
|
// factoryDataClient.sendMessage(SendMsg.builder()
|
|
|
|
|
// .exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE)
|
|
|
|
|
// .routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY)
|
|
|
|
|
// .message(JSONUtil.toJsonStr(dto))
|
|
|
|
|
// .delay(3000)
|
|
|
|
|
// .build());
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -168,17 +168,6 @@ public class PlanReportListener {
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (CollUtil.isNotEmpty(ltlMap)) { |
|
|
|
|
for (Map.Entry<String, QualityDeliverEntity> entry : ltlMap.entrySet()) { |
|
|
|
|
QualityDeliverEntity qualityDeliverEntity = entry.getValue(); |
|
|
|
|
qualityDeliverService.update(qualityDeliverEntity, Wrappers.<QualityDeliverEntity>lambdaUpdate() |
|
|
|
|
.eq(QualityDeliverEntity::getPlanReservationCode,qualityDeliverEntity.getPlanReservationCode()) |
|
|
|
|
.eq(QualityDeliverEntity::getOrderCode,qualityDeliverEntity.getOrderCode()) |
|
|
|
|
.eq(QualityDeliverEntity::getCostCategory,qualityDeliverEntity.getCostCategory()) |
|
|
|
|
.lt(QualityDeliverEntity::getBizStatus, 110) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|