|
@@ -48,9 +48,6 @@ import com.sckw.payment.api.feign.PaymentFeignService;
|
|
|
import com.sckw.payment.api.model.feign.WalletPayableDto;
|
|
import com.sckw.payment.api.model.feign.WalletPayableDto;
|
|
|
import com.sckw.product.api.dubbo.GoodsInfoService;
|
|
import com.sckw.product.api.dubbo.GoodsInfoService;
|
|
|
import com.sckw.product.api.model.KwpGoods;
|
|
import com.sckw.product.api.model.KwpGoods;
|
|
|
-import com.sckw.stream.enums.MessageEnum;
|
|
|
|
|
-import com.sckw.stream.model.SckwMessage;
|
|
|
|
|
-import com.sckw.stream.model.UserInfo;
|
|
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
import com.sckw.system.api.RemoteUserService;
|
|
import com.sckw.system.api.RemoteUserService;
|
|
|
import com.sckw.system.api.feign.DataPermissionFeignService;
|
|
import com.sckw.system.api.feign.DataPermissionFeignService;
|
|
@@ -79,7 +76,6 @@ import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.cloud.stream.function.StreamBridge;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@@ -135,8 +131,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
KwtLogisticsOrderGoodsService kwtLogisticsOrderGoodsService;
|
|
KwtLogisticsOrderGoodsService kwtLogisticsOrderGoodsService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
KwtWaybillOrderSubtaskService waybillOrderSubtaskService;
|
|
KwtWaybillOrderSubtaskService waybillOrderSubtaskService;
|
|
|
- @Autowired
|
|
|
|
|
- KwtCommonService commonService;
|
|
|
|
|
|
|
+
|
|
|
@Resource
|
|
@Resource
|
|
|
private UrlConfigProperties urlConfigProperties;
|
|
private UrlConfigProperties urlConfigProperties;
|
|
|
private final KwtWaybillOrderAddressRepository waybillOrderAddressRepository;
|
|
private final KwtWaybillOrderAddressRepository waybillOrderAddressRepository;
|
|
@@ -151,8 +146,8 @@ public class KwtWaybillOrderV1Service {
|
|
|
private final KwtWaybillOrderTicketRepository kwtWaybillOrderTicketRepository;
|
|
private final KwtWaybillOrderTicketRepository kwtWaybillOrderTicketRepository;
|
|
|
private final KwtWaybillOrderNodeRepository kwtWaybillOrderNodeRepository;
|
|
private final KwtWaybillOrderNodeRepository kwtWaybillOrderNodeRepository;
|
|
|
private final VehicleTraceClient vehicleTraceClient;
|
|
private final VehicleTraceClient vehicleTraceClient;
|
|
|
- @Resource
|
|
|
|
|
- private StreamBridge streamBridge;
|
|
|
|
|
|
|
+// @Resource
|
|
|
|
|
+// private StreamBridge streamBridge;
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
private RemoteSystemService remoteSystemService;
|
|
private RemoteSystemService remoteSystemService;
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false, timeout = 6000)
|
|
@DubboReference(version = "1.0.0", group = "design", check = false, timeout = 6000)
|
|
@@ -1396,80 +1391,80 @@ public class KwtWaybillOrderV1Service {
|
|
|
**/
|
|
**/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public HttpResult refuseSendCarV1(OperateWaybillDto params) {
|
|
public HttpResult refuseSendCarV1(OperateWaybillDto params) {
|
|
|
- /*1、校验*/
|
|
|
|
|
- Long wOrderId = params.getWOrderId();
|
|
|
|
|
- //运单信息
|
|
|
|
|
- KwtWaybillOrderV1 waybillOrder = waybillOrderV1Dao.selectById(wOrderId);
|
|
|
|
|
- if (waybillOrder == null) {
|
|
|
|
|
- return HttpResult.error("运单" + wOrderId + "不存在,请确认!");
|
|
|
|
|
- }
|
|
|
|
|
- //待接单的车辆运单才能拒绝接单
|
|
|
|
|
- if (!waybillOrder.getStatus().equals(CarWaybillEnum.PENDING_ORDER.getCode())) {
|
|
|
|
|
- return HttpResult.error("运单" + waybillOrder.getWOrderNo() + "当前状态已不能拒绝接单!");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /*2、更新运单状态*/
|
|
|
|
|
- waybillOrder.setStatus(CarWaybillEnum.REJECT_ORDER.getCode());
|
|
|
|
|
- waybillOrderV1Dao.updateById(waybillOrder);
|
|
|
|
|
-
|
|
|
|
|
- /*3、新增运单状态记录*/
|
|
|
|
|
- setWaybillOrderTrack(waybillOrder.getId(), null, null, params.getOperateTime(), waybillOrder.getStatus(), params.getRemark());
|
|
|
|
|
-
|
|
|
|
|
- //4、运单子单更新状态
|
|
|
|
|
- List<KwtWaybillOrderSubtask> orderSubtasks = waybillOrderSubtaskDao.findByWOrderId(wOrderId);
|
|
|
|
|
- for (KwtWaybillOrderSubtask subtask : orderSubtasks) {
|
|
|
|
|
- //更新运单子单状态
|
|
|
|
|
- subtask.setStatus(waybillOrder.getStatus());
|
|
|
|
|
- waybillOrderSubtaskDao.updateById(subtask);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- //循环运单不对物流订单委托量变更
|
|
|
|
|
- if (waybillOrder.getType() == Global.NUMERICAL_TWO) {
|
|
|
|
|
- return HttpResult.ok();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /*5、回退物流订单委托量(循环运单)*/
|
|
|
|
|
- /*5.1、装货址委派量entrustAmount回退*/
|
|
|
|
|
- //运单装货地址
|
|
|
|
|
- List<KwtWaybillOrderAddress> orderAddresses = waybillOrderAddressDao.findByAddresses(wOrderId, AddressTypeEnum.SHIPMENT.getCode());
|
|
|
|
|
- for (KwtWaybillOrderAddress address : orderAddresses) {
|
|
|
|
|
- //物流订单-装卸货地址运量信息
|
|
|
|
|
- KwtLogisticsOrderAmount logisticsOrderAmount = logisticsOrderAmountDao.findByLAddressId(address.getLAddressId());
|
|
|
|
|
- //承运订单地址已委派量=承运订单地址原委派量-+当前车辆运单地址委派量
|
|
|
|
|
- BigDecimal entrustAmount = logisticsOrderAmount.getEntrustAmount() == null ? NumberConstant.ZERO_TWO : logisticsOrderAmount.getEntrustAmount();
|
|
|
|
|
- logisticsOrderAmount.setEntrustAmount(entrustAmount.subtract(address.getEntrustAmount()));
|
|
|
|
|
- logisticsOrderAmountDao.updateById(logisticsOrderAmount);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /*5.2、物流订单委派量entrustAmount回退*/
|
|
|
|
|
- for (KwtWaybillOrderSubtask subtask : orderSubtasks) {
|
|
|
|
|
- //物流订单
|
|
|
|
|
- KwtLogisticsOrder logisticsOrder = logisticsOrderDao.selectById(subtask.getLOrderId());
|
|
|
|
|
- //承运订单已委派量=承运订单原委派量-当前车辆运单委派量
|
|
|
|
|
- BigDecimal entrustAmount = logisticsOrder.getEntrustAmount() == null ? NumberConstant.ZERO_TWO : logisticsOrder.getEntrustAmount();
|
|
|
|
|
- logisticsOrder.setEntrustAmount(entrustAmount.subtract(subtask.getEntrustAmount()));
|
|
|
|
|
- logisticsOrderDao.updateById(logisticsOrder);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /*6发送消息**/
|
|
|
|
|
- List<UserInfo> users = new ArrayList<>() {{
|
|
|
|
|
- add(new UserInfo(waybillOrder.getCreateBy(), waybillOrder.getEntId()));
|
|
|
|
|
- }};
|
|
|
|
|
- Map<String, Object> msgParams = new HashMap<>() {{
|
|
|
|
|
- put("orderNo", waybillOrder.getWOrderNo());
|
|
|
|
|
- put("driverName", waybillOrder.getDriverName());
|
|
|
|
|
- }};
|
|
|
|
|
- SckwMessage msg = new SckwMessage();
|
|
|
|
|
- msg.setRequestId(UUIDUtils.get32UUID());
|
|
|
|
|
- msg.setMessageEnum(MessageEnum.WAYBILL_REFUSE_SENDCAR_TRIP);
|
|
|
|
|
- msg.setParams(msgParams);
|
|
|
|
|
- msg.setMsgUrls(new HashMap<>(Global.NUMERICAL_SIXTEEN) {{
|
|
|
|
|
- put("app", refuseSendCarAppUrl);
|
|
|
|
|
- put("pc", refuseSendCarPcUrl);
|
|
|
|
|
- }});
|
|
|
|
|
- msg.setUserInfos(users);
|
|
|
|
|
- msg.setCreateBy(LoginUserHolder.getUserId());
|
|
|
|
|
- streamBridge.send("sckw-message", JSON.toJSONString(msg));
|
|
|
|
|
|
|
+// /*1、校验*/
|
|
|
|
|
+// Long wOrderId = params.getWOrderId();
|
|
|
|
|
+// //运单信息
|
|
|
|
|
+// KwtWaybillOrderV1 waybillOrder = waybillOrderV1Dao.selectById(wOrderId);
|
|
|
|
|
+// if (waybillOrder == null) {
|
|
|
|
|
+// return HttpResult.error("运单" + wOrderId + "不存在,请确认!");
|
|
|
|
|
+// }
|
|
|
|
|
+// //待接单的车辆运单才能拒绝接单
|
|
|
|
|
+// if (!waybillOrder.getStatus().equals(CarWaybillEnum.PENDING_ORDER.getCode())) {
|
|
|
|
|
+// return HttpResult.error("运单" + waybillOrder.getWOrderNo() + "当前状态已不能拒绝接单!");
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// /*2、更新运单状态*/
|
|
|
|
|
+// waybillOrder.setStatus(CarWaybillEnum.REJECT_ORDER.getCode());
|
|
|
|
|
+// waybillOrderV1Dao.updateById(waybillOrder);
|
|
|
|
|
+//
|
|
|
|
|
+// /*3、新增运单状态记录*/
|
|
|
|
|
+// setWaybillOrderTrack(waybillOrder.getId(), null, null, params.getOperateTime(), waybillOrder.getStatus(), params.getRemark());
|
|
|
|
|
+//
|
|
|
|
|
+// //4、运单子单更新状态
|
|
|
|
|
+// List<KwtWaybillOrderSubtask> orderSubtasks = waybillOrderSubtaskDao.findByWOrderId(wOrderId);
|
|
|
|
|
+// for (KwtWaybillOrderSubtask subtask : orderSubtasks) {
|
|
|
|
|
+// //更新运单子单状态
|
|
|
|
|
+// subtask.setStatus(waybillOrder.getStatus());
|
|
|
|
|
+// waybillOrderSubtaskDao.updateById(subtask);
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// //循环运单不对物流订单委托量变更
|
|
|
|
|
+// if (waybillOrder.getType() == Global.NUMERICAL_TWO) {
|
|
|
|
|
+// return HttpResult.ok();
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// /*5、回退物流订单委托量(循环运单)*/
|
|
|
|
|
+// /*5.1、装货址委派量entrustAmount回退*/
|
|
|
|
|
+// //运单装货地址
|
|
|
|
|
+// List<KwtWaybillOrderAddress> orderAddresses = waybillOrderAddressDao.findByAddresses(wOrderId, AddressTypeEnum.SHIPMENT.getCode());
|
|
|
|
|
+// for (KwtWaybillOrderAddress address : orderAddresses) {
|
|
|
|
|
+// //物流订单-装卸货地址运量信息
|
|
|
|
|
+// KwtLogisticsOrderAmount logisticsOrderAmount = logisticsOrderAmountDao.findByLAddressId(address.getLAddressId());
|
|
|
|
|
+// //承运订单地址已委派量=承运订单地址原委派量-+当前车辆运单地址委派量
|
|
|
|
|
+// BigDecimal entrustAmount = logisticsOrderAmount.getEntrustAmount() == null ? NumberConstant.ZERO_TWO : logisticsOrderAmount.getEntrustAmount();
|
|
|
|
|
+// logisticsOrderAmount.setEntrustAmount(entrustAmount.subtract(address.getEntrustAmount()));
|
|
|
|
|
+// logisticsOrderAmountDao.updateById(logisticsOrderAmount);
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// /*5.2、物流订单委派量entrustAmount回退*/
|
|
|
|
|
+// for (KwtWaybillOrderSubtask subtask : orderSubtasks) {
|
|
|
|
|
+// //物流订单
|
|
|
|
|
+// KwtLogisticsOrder logisticsOrder = logisticsOrderDao.selectById(subtask.getLOrderId());
|
|
|
|
|
+// //承运订单已委派量=承运订单原委派量-当前车辆运单委派量
|
|
|
|
|
+// BigDecimal entrustAmount = logisticsOrder.getEntrustAmount() == null ? NumberConstant.ZERO_TWO : logisticsOrder.getEntrustAmount();
|
|
|
|
|
+// logisticsOrder.setEntrustAmount(entrustAmount.subtract(subtask.getEntrustAmount()));
|
|
|
|
|
+// logisticsOrderDao.updateById(logisticsOrder);
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// /*6发送消息**/
|
|
|
|
|
+// List<UserInfo> users = new ArrayList<>() {{
|
|
|
|
|
+// add(new UserInfo(waybillOrder.getCreateBy(), waybillOrder.getEntId()));
|
|
|
|
|
+// }};
|
|
|
|
|
+// Map<String, Object> msgParams = new HashMap<>() {{
|
|
|
|
|
+// put("orderNo", waybillOrder.getWOrderNo());
|
|
|
|
|
+// put("driverName", waybillOrder.getDriverName());
|
|
|
|
|
+// }};
|
|
|
|
|
+// SckwMessage msg = new SckwMessage();
|
|
|
|
|
+// msg.setRequestId(UUIDUtils.get32UUID());
|
|
|
|
|
+// msg.setMessageEnum(MessageEnum.WAYBILL_REFUSE_SENDCAR_TRIP);
|
|
|
|
|
+// msg.setParams(msgParams);
|
|
|
|
|
+// msg.setMsgUrls(new HashMap<>(Global.NUMERICAL_SIXTEEN) {{
|
|
|
|
|
+// put("app", refuseSendCarAppUrl);
|
|
|
|
|
+// put("pc", refuseSendCarPcUrl);
|
|
|
|
|
+// }});
|
|
|
|
|
+// msg.setUserInfos(users);
|
|
|
|
|
+// msg.setCreateBy(LoginUserHolder.getUserId());
|
|
|
|
|
+// streamBridge.send("sckw-message", JSON.toJSONString(msg));
|
|
|
return HttpResult.ok();
|
|
return HttpResult.ok();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1530,74 +1525,74 @@ public class KwtWaybillOrderV1Service {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public HttpResult refuseDepartureV1(OperateWaybillDto params) {
|
|
public HttpResult refuseDepartureV1(OperateWaybillDto params) {
|
|
|
/*1、校验*/
|
|
/*1、校验*/
|
|
|
- Long wOrderId = params.getWOrderId();
|
|
|
|
|
- //运单信息
|
|
|
|
|
- KwtWaybillOrderV1 waybillOrder = waybillOrderV1Dao.selectById(wOrderId);
|
|
|
|
|
- if (waybillOrder == null) {
|
|
|
|
|
- return HttpResult.error("运单" + wOrderId + "不存在,请确认!");
|
|
|
|
|
- }
|
|
|
|
|
- //待出车的车辆运单才能拒绝出车
|
|
|
|
|
- if (!waybillOrder.getStatus().equals(CarWaybillEnum.PENDING_VEHICLE.getCode())) {
|
|
|
|
|
- return HttpResult.error("运单" + waybillOrder.getWOrderNo() + "当前状态不能拒绝出车!");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /*2、更新运单状态*/
|
|
|
|
|
- waybillOrder.setStatus(CarWaybillEnum.REFUSE_TRAFFIC.getCode());
|
|
|
|
|
- waybillOrderV1Dao.updateById(waybillOrder);
|
|
|
|
|
-
|
|
|
|
|
- //3、运单子单更新状态
|
|
|
|
|
- List<KwtWaybillOrderSubtask> orderSubtasks = waybillOrderSubtaskDao.findByWOrderId(wOrderId);
|
|
|
|
|
- for (KwtWaybillOrderSubtask subtask : orderSubtasks) {
|
|
|
|
|
- //更新运单子单状态
|
|
|
|
|
- subtask.setStatus(waybillOrder.getStatus());
|
|
|
|
|
- waybillOrderSubtaskDao.updateById(subtask);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /*4、新增运单状态记录*/
|
|
|
|
|
- setWaybillOrderTrack(waybillOrder.getId(), null, null, params.getOperateTime(), waybillOrder.getStatus(), params.getRemark());
|
|
|
|
|
-
|
|
|
|
|
- /*5、回退物流订单委托量*/
|
|
|
|
|
- /*5.1、装货址委派量entrustAmount回退*/
|
|
|
|
|
- //运单装货地址
|
|
|
|
|
- List<KwtWaybillOrderAddress> orderAddresses = waybillOrderAddressDao.findByAddresses(wOrderId, AddressTypeEnum.SHIPMENT.getCode());
|
|
|
|
|
- for (KwtWaybillOrderAddress address : orderAddresses) {
|
|
|
|
|
- //物流订单-装卸货地址运量信息
|
|
|
|
|
- KwtLogisticsOrderAmount logisticsOrderAmount = logisticsOrderAmountDao.findByLAddressId(address.getLAddressId());
|
|
|
|
|
- //承运订单地址已委派量=承运订单地址原委派量-当前车辆运单地址委派量
|
|
|
|
|
- BigDecimal entrustAmount = logisticsOrderAmount.getEntrustAmount() == null ? NumberConstant.ZERO_TWO : logisticsOrderAmount.getEntrustAmount();
|
|
|
|
|
- logisticsOrderAmount.setEntrustAmount(entrustAmount.subtract(address.getEntrustAmount()));
|
|
|
|
|
- logisticsOrderAmountDao.updateById(logisticsOrderAmount);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /*5.2、物流订单委派量entrustAmount回退*/
|
|
|
|
|
- for (KwtWaybillOrderSubtask subtask : orderSubtasks) {
|
|
|
|
|
- //物流订单
|
|
|
|
|
- KwtLogisticsOrder logisticsOrder = logisticsOrderDao.selectById(subtask.getLOrderId());
|
|
|
|
|
- //承运订单已委派量=承运订单原委派量-当前车辆运单委派量
|
|
|
|
|
- BigDecimal entrustAmount = logisticsOrder.getEntrustAmount() == null ? NumberConstant.ZERO_TWO : logisticsOrder.getEntrustAmount();
|
|
|
|
|
- logisticsOrder.setEntrustAmount(entrustAmount.subtract(subtask.getEntrustAmount()));
|
|
|
|
|
- logisticsOrderDao.updateById(logisticsOrder);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /*6、发送消息**/
|
|
|
|
|
- List<UserInfo> users = new ArrayList<>() {{
|
|
|
|
|
- add(new UserInfo(waybillOrder.getCreateBy(), waybillOrder.getEntId()));
|
|
|
|
|
- }};
|
|
|
|
|
- Map<String, Object> msgParams = new HashMap<>() {{
|
|
|
|
|
- put("orderNo", waybillOrder.getWOrderNo());
|
|
|
|
|
- put("driverName", waybillOrder.getDriverName());
|
|
|
|
|
- }};
|
|
|
|
|
- SckwMessage msg = new SckwMessage();
|
|
|
|
|
- msg.setRequestId(UUIDUtils.get32UUID());
|
|
|
|
|
- msg.setMessageEnum(MessageEnum.WAYBIL_CONFIRM_DEPARTURE);
|
|
|
|
|
- msg.setParams(msgParams);
|
|
|
|
|
- msg.setMsgUrls(new HashMap<>(Global.NUMERICAL_SIXTEEN) {{
|
|
|
|
|
- put("app", refuseSendCarAppUrl);
|
|
|
|
|
- put("pc", refuseSendCarPcUrl);
|
|
|
|
|
- }});
|
|
|
|
|
- msg.setUserInfos(users);
|
|
|
|
|
- msg.setCreateBy(LoginUserHolder.getUserId());
|
|
|
|
|
- streamBridge.send("sckw-message", JSON.toJSONString(msg));
|
|
|
|
|
|
|
+// Long wOrderId = params.getWOrderId();
|
|
|
|
|
+// //运单信息
|
|
|
|
|
+// KwtWaybillOrderV1 waybillOrder = waybillOrderV1Dao.selectById(wOrderId);
|
|
|
|
|
+// if (waybillOrder == null) {
|
|
|
|
|
+// return HttpResult.error("运单" + wOrderId + "不存在,请确认!");
|
|
|
|
|
+// }
|
|
|
|
|
+// //待出车的车辆运单才能拒绝出车
|
|
|
|
|
+// if (!waybillOrder.getStatus().equals(CarWaybillEnum.PENDING_VEHICLE.getCode())) {
|
|
|
|
|
+// return HttpResult.error("运单" + waybillOrder.getWOrderNo() + "当前状态不能拒绝出车!");
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// /*2、更新运单状态*/
|
|
|
|
|
+// waybillOrder.setStatus(CarWaybillEnum.REFUSE_TRAFFIC.getCode());
|
|
|
|
|
+// waybillOrderV1Dao.updateById(waybillOrder);
|
|
|
|
|
+//
|
|
|
|
|
+// //3、运单子单更新状态
|
|
|
|
|
+// List<KwtWaybillOrderSubtask> orderSubtasks = waybillOrderSubtaskDao.findByWOrderId(wOrderId);
|
|
|
|
|
+// for (KwtWaybillOrderSubtask subtask : orderSubtasks) {
|
|
|
|
|
+// //更新运单子单状态
|
|
|
|
|
+// subtask.setStatus(waybillOrder.getStatus());
|
|
|
|
|
+// waybillOrderSubtaskDao.updateById(subtask);
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// /*4、新增运单状态记录*/
|
|
|
|
|
+// setWaybillOrderTrack(waybillOrder.getId(), null, null, params.getOperateTime(), waybillOrder.getStatus(), params.getRemark());
|
|
|
|
|
+//
|
|
|
|
|
+// /*5、回退物流订单委托量*/
|
|
|
|
|
+// /*5.1、装货址委派量entrustAmount回退*/
|
|
|
|
|
+// //运单装货地址
|
|
|
|
|
+// List<KwtWaybillOrderAddress> orderAddresses = waybillOrderAddressDao.findByAddresses(wOrderId, AddressTypeEnum.SHIPMENT.getCode());
|
|
|
|
|
+// for (KwtWaybillOrderAddress address : orderAddresses) {
|
|
|
|
|
+// //物流订单-装卸货地址运量信息
|
|
|
|
|
+// KwtLogisticsOrderAmount logisticsOrderAmount = logisticsOrderAmountDao.findByLAddressId(address.getLAddressId());
|
|
|
|
|
+// //承运订单地址已委派量=承运订单地址原委派量-当前车辆运单地址委派量
|
|
|
|
|
+// BigDecimal entrustAmount = logisticsOrderAmount.getEntrustAmount() == null ? NumberConstant.ZERO_TWO : logisticsOrderAmount.getEntrustAmount();
|
|
|
|
|
+// logisticsOrderAmount.setEntrustAmount(entrustAmount.subtract(address.getEntrustAmount()));
|
|
|
|
|
+// logisticsOrderAmountDao.updateById(logisticsOrderAmount);
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// /*5.2、物流订单委派量entrustAmount回退*/
|
|
|
|
|
+// for (KwtWaybillOrderSubtask subtask : orderSubtasks) {
|
|
|
|
|
+// //物流订单
|
|
|
|
|
+// KwtLogisticsOrder logisticsOrder = logisticsOrderDao.selectById(subtask.getLOrderId());
|
|
|
|
|
+// //承运订单已委派量=承运订单原委派量-当前车辆运单委派量
|
|
|
|
|
+// BigDecimal entrustAmount = logisticsOrder.getEntrustAmount() == null ? NumberConstant.ZERO_TWO : logisticsOrder.getEntrustAmount();
|
|
|
|
|
+// logisticsOrder.setEntrustAmount(entrustAmount.subtract(subtask.getEntrustAmount()));
|
|
|
|
|
+// logisticsOrderDao.updateById(logisticsOrder);
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// /*6、发送消息**/
|
|
|
|
|
+// List<UserInfo> users = new ArrayList<>() {{
|
|
|
|
|
+// add(new UserInfo(waybillOrder.getCreateBy(), waybillOrder.getEntId()));
|
|
|
|
|
+// }};
|
|
|
|
|
+// Map<String, Object> msgParams = new HashMap<>() {{
|
|
|
|
|
+// put("orderNo", waybillOrder.getWOrderNo());
|
|
|
|
|
+// put("driverName", waybillOrder.getDriverName());
|
|
|
|
|
+// }};
|
|
|
|
|
+// SckwMessage msg = new SckwMessage();
|
|
|
|
|
+// msg.setRequestId(UUIDUtils.get32UUID());
|
|
|
|
|
+// msg.setMessageEnum(MessageEnum.WAYBIL_CONFIRM_DEPARTURE);
|
|
|
|
|
+// msg.setParams(msgParams);
|
|
|
|
|
+// msg.setMsgUrls(new HashMap<>(Global.NUMERICAL_SIXTEEN) {{
|
|
|
|
|
+// put("app", refuseSendCarAppUrl);
|
|
|
|
|
+// put("pc", refuseSendCarPcUrl);
|
|
|
|
|
+// }});
|
|
|
|
|
+// msg.setUserInfos(users);
|
|
|
|
|
+// msg.setCreateBy(LoginUserHolder.getUserId());
|
|
|
|
|
+// streamBridge.send("sckw-message", JSON.toJSONString(msg));
|
|
|
return HttpResult.ok();
|
|
return HttpResult.ok();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2241,13 +2236,13 @@ public class KwtWaybillOrderV1Service {
|
|
|
//从中台查询轨迹信息
|
|
//从中台查询轨迹信息
|
|
|
VehicleDataDTO vehicleDataDTO = new VehicleDataDTO();
|
|
VehicleDataDTO vehicleDataDTO = new VehicleDataDTO();
|
|
|
vehicleDataDTO.setWOrderNo(waybillOrder.getWOrderNo());
|
|
vehicleDataDTO.setWOrderNo(waybillOrder.getWOrderNo());
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
try {
|
|
try {
|
|
|
// 使用 Feign 调用查询车辆轨迹列表
|
|
// 使用 Feign 调用查询车辆轨迹列表
|
|
|
com.sckw.transport.api.model.dto.VehicleDataDTO vehicleDataDTO1 = new com.sckw.transport.api.model.dto.VehicleDataDTO();
|
|
com.sckw.transport.api.model.dto.VehicleDataDTO vehicleDataDTO1 = new com.sckw.transport.api.model.dto.VehicleDataDTO();
|
|
|
vehicleDataDTO.setWOrderNo(waybillOrder.getWOrderNo());
|
|
vehicleDataDTO.setWOrderNo(waybillOrder.getWOrderNo());
|
|
|
BaseIotResult<List<com.sckw.transport.api.model.dto.VehicleReturnData>> result = vehicleTraceClient.queryVehicleDataList(vehicleDataDTO1);
|
|
BaseIotResult<List<com.sckw.transport.api.model.dto.VehicleReturnData>> result = vehicleTraceClient.queryVehicleDataList(vehicleDataDTO1);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (result != null && org.apache.commons.lang3.StringUtils.equals(result.getCode(), "0") && result.getData() != null) {
|
|
if (result != null && org.apache.commons.lang3.StringUtils.equals(result.getCode(), "0") && result.getData() != null) {
|
|
|
List<com.sckw.transport.api.model.dto.VehicleReturnData> vehicleReturn = result.getData();
|
|
List<com.sckw.transport.api.model.dto.VehicleReturnData> vehicleReturn = result.getData();
|
|
|
List<VehicleRouteData> vehicleReturnData = vehicleReturn.stream().map(x->{
|
|
List<VehicleRouteData> vehicleReturnData = vehicleReturn.stream().map(x->{
|
|
@@ -3017,21 +3012,21 @@ public class KwtWaybillOrderV1Service {
|
|
|
Long entId =LoginUserHolder.getEntId();
|
|
Long entId =LoginUserHolder.getEntId();
|
|
|
//entIds.add(entId);
|
|
//entIds.add(entId);
|
|
|
log.debug("获取企业ID集合: {}", entIds);
|
|
log.debug("获取企业ID集合: {}", entIds);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
CompletableFuture<Set<Long>> logOrderIdsFuture = CompletableFuture.supplyAsync(() -> {
|
|
CompletableFuture<Set<Long>> logOrderIdsFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
log.debug("开始查询物流订单ID,参数: {}, 企业ID: {}", JSON.toJSONString(req), entIds);
|
|
log.debug("开始查询物流订单ID,参数: {}, 企业ID: {}", JSON.toJSONString(req), entIds);
|
|
|
Set<Long> result = getLogOrderIds(req, entIds,entId);
|
|
Set<Long> result = getLogOrderIds(req, entIds,entId);
|
|
|
log.debug("物流订单ID查询完成,结果数量: {}", result.size());
|
|
log.debug("物流订单ID查询完成,结果数量: {}", result.size());
|
|
|
return result;
|
|
return result;
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
CompletableFuture<Set<Long>> billOrderIdsFuture = CompletableFuture.supplyAsync(() -> {
|
|
CompletableFuture<Set<Long>> billOrderIdsFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
log.debug("开始查询运单ID,参数: {}", req);
|
|
log.debug("开始查询运单ID,参数: {}", req);
|
|
|
Set<Long> result = getBillOrderIds(req);
|
|
Set<Long> result = getBillOrderIds(req);
|
|
|
log.debug("运单ID查询完成,结果数量: {}", result.size());
|
|
log.debug("运单ID查询完成,结果数量: {}", result.size());
|
|
|
return result;
|
|
return result;
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
CompletableFuture<Map<String, Map<String, String>>> dictFuture = CompletableFuture.supplyAsync(() -> {
|
|
CompletableFuture<Map<String, Map<String, String>>> dictFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
log.debug("开始查询字典数据");
|
|
log.debug("开始查询字典数据");
|
|
|
Map<String, Map<String, String>> result = queryDictionaryData();
|
|
Map<String, Map<String, String>> result = queryDictionaryData();
|
|
@@ -3063,7 +3058,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 分页查询子运单信息
|
|
// 分页查询子运单信息
|
|
|
- log.info("开始分页查询子运单信息,物流订单ID数量: {}, 运单ID数量: {}, 状态: {}",
|
|
|
|
|
|
|
+ log.info("开始分页查询子运单信息,物流订单ID数量: {}, 运单ID数量: {}, 状态: {}",
|
|
|
logOrderIds.size(), billOrderIds.size(), status);
|
|
logOrderIds.size(), billOrderIds.size(), status);
|
|
|
List<Integer> waybillOrderStatus = getWaybillOrderStatus();
|
|
List<Integer> waybillOrderStatus = getWaybillOrderStatus();
|
|
|
IPage<KwtWaybillOrderSubtask> page = waybillOrderSubtaskRepository.queryByPage(
|
|
IPage<KwtWaybillOrderSubtask> page = waybillOrderSubtaskRepository.queryByPage(
|
|
@@ -3093,7 +3088,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
log.debug("开始查询物流订单,物流订单ID数量: {}", orderIds.getLogicsOrderIds().size());
|
|
log.debug("开始查询物流订单,物流订单ID数量: {}", orderIds.getLogicsOrderIds().size());
|
|
|
- CompletableFuture<List<KwtLogisticsOrder>> logisticsOrderFuture = CompletableFuture.supplyAsync(() ->
|
|
|
|
|
|
|
+ CompletableFuture<List<KwtLogisticsOrder>> logisticsOrderFuture = CompletableFuture.supplyAsync(() ->
|
|
|
logisticsOrderRepository.queryByLogOrderIds(orderIds.getLogicsOrderIds()), traceTaskExecutor)
|
|
logisticsOrderRepository.queryByLogOrderIds(orderIds.getLogicsOrderIds()), traceTaskExecutor)
|
|
|
.exceptionally(ex -> {
|
|
.exceptionally(ex -> {
|
|
|
log.error("查询物流订单失败", ex);
|
|
log.error("查询物流订单失败", ex);
|
|
@@ -3158,8 +3153,8 @@ public class KwtWaybillOrderV1Service {
|
|
|
log.debug("开始查询贸易合同商品");
|
|
log.debug("开始查询贸易合同商品");
|
|
|
CompletableFuture<List<TradeContractGoodsDto>> contractGoodsFuture =
|
|
CompletableFuture<List<TradeContractGoodsDto>> contractGoodsFuture =
|
|
|
tradeOrderContractFuture.thenCombine(goodsIdsFuture, (contracts, goodsIds) -> {
|
|
tradeOrderContractFuture.thenCombine(goodsIdsFuture, (contracts, goodsIds) -> {
|
|
|
- log.debug("贸易合同和商品ID准备完成,合同数量: {}, 商品ID数量: {}",
|
|
|
|
|
- Optional.ofNullable(contracts).map(List::size).orElse(0),
|
|
|
|
|
|
|
+ log.debug("贸易合同和商品ID准备完成,合同数量: {}, 商品ID数量: {}",
|
|
|
|
|
+ Optional.ofNullable(contracts).map(List::size).orElse(0),
|
|
|
goodsIds.size());
|
|
goodsIds.size());
|
|
|
Set<Long> contractIds = Optional.ofNullable(contracts)
|
|
Set<Long> contractIds = Optional.ofNullable(contracts)
|
|
|
.orElse(List.of())
|
|
.orElse(List.of())
|
|
@@ -3574,7 +3569,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
}
|
|
}
|
|
|
return subBillIdAddressIdKeyAndOrderTrackMap;
|
|
return subBillIdAddressIdKeyAndOrderTrackMap;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 批量查询运单的离场节点
|
|
* 批量查询运单的离场节点
|
|
|
* @param wOrderIds 运单ID集合
|
|
* @param wOrderIds 运单ID集合
|
|
@@ -3583,11 +3578,11 @@ public class KwtWaybillOrderV1Service {
|
|
|
@NotNull
|
|
@NotNull
|
|
|
private Map<Long, KwtWaybillOrderNode> getOffsiteNodeMap(Set<Long> wOrderIds) {
|
|
private Map<Long, KwtWaybillOrderNode> getOffsiteNodeMap(Set<Long> wOrderIds) {
|
|
|
Map<Long, KwtWaybillOrderNode> offsiteNodeMap = Maps.newHashMap();
|
|
Map<Long, KwtWaybillOrderNode> offsiteNodeMap = Maps.newHashMap();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (CollectionUtils.isEmpty(wOrderIds)) {
|
|
if (CollectionUtils.isEmpty(wOrderIds)) {
|
|
|
return offsiteNodeMap;
|
|
return offsiteNodeMap;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 查询所有运单的节点数据,过滤出状态为“已离场”的节点
|
|
// 查询所有运单的节点数据,过滤出状态为“已离场”的节点
|
|
|
List<KwtWaybillOrderNode> nodes = kwtWaybillOrderNodeRepository.list(
|
|
List<KwtWaybillOrderNode> nodes = kwtWaybillOrderNodeRepository.list(
|
|
|
Wrappers.<KwtWaybillOrderNode>lambdaQuery()
|
|
Wrappers.<KwtWaybillOrderNode>lambdaQuery()
|
|
@@ -3595,18 +3590,18 @@ public class KwtWaybillOrderV1Service {
|
|
|
.eq(KwtWaybillOrderNode::getOrderStatus, CarWaybillV1Enum.WAIT_LOADING.getCode())
|
|
.eq(KwtWaybillOrderNode::getOrderStatus, CarWaybillV1Enum.WAIT_LOADING.getCode())
|
|
|
.orderByAsc(KwtWaybillOrderNode::getCreateTime)
|
|
.orderByAsc(KwtWaybillOrderNode::getCreateTime)
|
|
|
);
|
|
);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (CollectionUtils.isNotEmpty(nodes)) {
|
|
if (CollectionUtils.isNotEmpty(nodes)) {
|
|
|
// 每个运单只取最后一条离场记录
|
|
// 每个运单只取最后一条离场记录
|
|
|
offsiteNodeMap = nodes.stream()
|
|
offsiteNodeMap = nodes.stream()
|
|
|
.collect(Collectors.toMap(
|
|
.collect(Collectors.toMap(
|
|
|
KwtWaybillOrderNode::getWOrderId,
|
|
KwtWaybillOrderNode::getWOrderId,
|
|
|
Function.identity(),
|
|
Function.identity(),
|
|
|
- (existing, replacement) ->
|
|
|
|
|
|
|
+ (existing, replacement) ->
|
|
|
existing.getCreateTime().before(replacement.getCreateTime()) ? existing : replacement
|
|
existing.getCreateTime().before(replacement.getCreateTime()) ? existing : replacement
|
|
|
));
|
|
));
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
return offsiteNodeMap;
|
|
return offsiteNodeMap;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -3635,19 +3630,19 @@ public class KwtWaybillOrderV1Service {
|
|
|
|
|
|
|
|
// 如果企业ID集合不为空,根据企业ID、托运方/承运方ID过滤物流订单ID
|
|
// 如果企业ID集合不为空,根据企业ID、托运方/承运方ID过滤物流订单ID
|
|
|
if (CollectionUtils.isNotEmpty(entIds)) {
|
|
if (CollectionUtils.isNotEmpty(entIds)) {
|
|
|
- log.debug("开始根据企业ID集合查询物流订单ID,企业ID集合: {}, 托运方ID: {}, 承运方ID: {}",
|
|
|
|
|
|
|
+ log.debug("开始根据企业ID集合查询物流订单ID,企业ID集合: {}, 托运方ID: {}, 承运方ID: {}",
|
|
|
entIds, req.getConsignorId(), req.getCarrierId());
|
|
entIds, req.getConsignorId(), req.getCarrierId());
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
Set<Long> orderIdsByEnt = getLogOrderIdsByEntIds(
|
|
Set<Long> orderIdsByEnt = getLogOrderIdsByEntIds(
|
|
|
- entIds,
|
|
|
|
|
- req.getConsignorId(),
|
|
|
|
|
- req.getCarrierId(),
|
|
|
|
|
- entId,
|
|
|
|
|
|
|
+ entIds,
|
|
|
|
|
+ req.getConsignorId(),
|
|
|
|
|
+ req.getCarrierId(),
|
|
|
|
|
+ entId,
|
|
|
currentUserScopeEntIds
|
|
currentUserScopeEntIds
|
|
|
);
|
|
);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
log.debug("根据企业ID及角色权限过滤后,获取到的物流订单ID数量: {}", orderIdsByEnt.size());
|
|
log.debug("根据企业ID及角色权限过滤后,获取到的物流订单ID数量: {}", orderIdsByEnt.size());
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (CollectionUtils.isNotEmpty(orderIdsByEnt)) {
|
|
if (CollectionUtils.isNotEmpty(orderIdsByEnt)) {
|
|
|
logOrderIds.addAll(orderIdsByEnt);
|
|
logOrderIds.addAll(orderIdsByEnt);
|
|
|
log.debug("已将过滤后的物流订单ID加入结果集,当前物流订单ID总数: {}", logOrderIds.size());
|
|
log.debug("已将过滤后的物流订单ID加入结果集,当前物流订单ID总数: {}", logOrderIds.size());
|
|
@@ -3859,16 +3854,16 @@ public class KwtWaybillOrderV1Service {
|
|
|
*/
|
|
*/
|
|
|
private Set<Long> applyDataPermissionFilterToLogOrderIds(Set<Long> logOrderIds) {
|
|
private Set<Long> applyDataPermissionFilterToLogOrderIds(Set<Long> logOrderIds) {
|
|
|
log.debug("开始应用数据权限过滤,原始物流订单ID数量: {}", CollectionUtils.isEmpty(logOrderIds) ? 0 : logOrderIds.size());
|
|
log.debug("开始应用数据权限过滤,原始物流订单ID数量: {}", CollectionUtils.isEmpty(logOrderIds) ? 0 : logOrderIds.size());
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 1. 获取当前用户的数据权限配置
|
|
// 1. 获取当前用户的数据权限配置
|
|
|
DataPermissionDTO perm = fetchDataPermissionForCurrentUser();
|
|
DataPermissionDTO perm = fetchDataPermissionForCurrentUser();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 如果无需过滤或权限配置为空,直接返回原始ID集合
|
|
// 如果无需过滤或权限配置为空,直接返回原始ID集合
|
|
|
if (perm == null || !perm.needFilter()) {
|
|
if (perm == null || !perm.needFilter()) {
|
|
|
log.debug("无需进行数据权限过滤,直接返回原始ID集合");
|
|
log.debug("无需进行数据权限过滤,直接返回原始ID集合");
|
|
|
return logOrderIds;
|
|
return logOrderIds;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 如果原始ID集合为空,直接返回
|
|
// 如果原始ID集合为空,直接返回
|
|
|
if (CollectionUtils.isEmpty(logOrderIds)) {
|
|
if (CollectionUtils.isEmpty(logOrderIds)) {
|
|
|
log.debug("原始物流订单ID集合为空,无需过滤");
|
|
log.debug("原始物流订单ID集合为空,无需过滤");
|
|
@@ -3880,25 +3875,25 @@ public class KwtWaybillOrderV1Service {
|
|
|
// 2. 处理企业维度的数据权限
|
|
// 2. 处理企业维度的数据权限
|
|
|
if (!perm.isAllVisible()) {
|
|
if (!perm.isAllVisible()) {
|
|
|
log.debug("非全量可见模式,开始执行企业维度权限过滤");
|
|
log.debug("非全量可见模式,开始执行企业维度权限过滤");
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 如果可见企业ID列表为空,说明该企业维度下无权限,返回空集合
|
|
// 如果可见企业ID列表为空,说明该企业维度下无权限,返回空集合
|
|
|
if (CollectionUtils.isEmpty(perm.getVisibleEntIds())) {
|
|
if (CollectionUtils.isEmpty(perm.getVisibleEntIds())) {
|
|
|
log.warn("当前用户可见企业ID列表为空,过滤结果为空");
|
|
log.warn("当前用户可见企业ID列表为空,过滤结果为空");
|
|
|
return Sets.newHashSet();
|
|
return Sets.newHashSet();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 查询可见企业ID关联的所有物流订单单位信息
|
|
// 查询可见企业ID关联的所有物流订单单位信息
|
|
|
List<KwtLogisticsOrderUnit> units =
|
|
List<KwtLogisticsOrderUnit> units =
|
|
|
kwtLogisticsOrderUnitRepository.queryByEntIds(new HashSet<>(perm.getVisibleEntIds()));
|
|
kwtLogisticsOrderUnitRepository.queryByEntIds(new HashSet<>(perm.getVisibleEntIds()));
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 提取这些单位关联的物流订单ID
|
|
// 提取这些单位关联的物流订单ID
|
|
|
Set<Long> entScopeLogOrderIds = units.stream()
|
|
Set<Long> entScopeLogOrderIds = units.stream()
|
|
|
.map(KwtLogisticsOrderUnit::getLOrderId)
|
|
.map(KwtLogisticsOrderUnit::getLOrderId)
|
|
|
.filter(Objects::nonNull)
|
|
.filter(Objects::nonNull)
|
|
|
.collect(Collectors.toSet());
|
|
.collect(Collectors.toSet());
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
log.debug("企业维度过滤:可见企业关联的物流订单ID数量: {}", entScopeLogOrderIds.size());
|
|
log.debug("企业维度过滤:可见企业关联的物流订单ID数量: {}", entScopeLogOrderIds.size());
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 取交集:只保留既在原始列表中,又在可见企业关联列表中的ID
|
|
// 取交集:只保留既在原始列表中,又在可见企业关联列表中的ID
|
|
|
result.retainAll(entScopeLogOrderIds);
|
|
result.retainAll(entScopeLogOrderIds);
|
|
|
log.debug("企业维度过滤后剩余ID数量: {}", result.size());
|
|
log.debug("企业维度过滤后剩余ID数量: {}", result.size());
|
|
@@ -3952,7 +3947,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
.map(KwtLogisticsOrder::getTOrderId)
|
|
.map(KwtLogisticsOrder::getTOrderId)
|
|
|
.filter(Objects::nonNull)
|
|
.filter(Objects::nonNull)
|
|
|
.collect(Collectors.toSet());
|
|
.collect(Collectors.toSet());
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (CollectionUtils.isEmpty(tradeIds)) {
|
|
if (CollectionUtils.isEmpty(tradeIds)) {
|
|
|
log.debug("物流订单中未关联有效的贸易订单ID,返回空集合");
|
|
log.debug("物流订单中未关联有效的贸易订单ID,返回空集合");
|
|
|
return Sets.newHashSet();
|
|
return Sets.newHashSet();
|
|
@@ -4004,7 +3999,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
.filter(order -> order.getTOrderId() != null && allowedTradeIds.contains(order.getTOrderId()))
|
|
.filter(order -> order.getTOrderId() != null && allowedTradeIds.contains(order.getTOrderId()))
|
|
|
.map(KwtLogisticsOrder::getId)
|
|
.map(KwtLogisticsOrder::getId)
|
|
|
.collect(Collectors.toSet());
|
|
.collect(Collectors.toSet());
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
log.debug("个人数据权限过滤完成,最终保留物流订单ID数量: {}", finalResult.size());
|
|
log.debug("个人数据权限过滤完成,最终保留物流订单ID数量: {}", finalResult.size());
|
|
|
return finalResult;
|
|
return finalResult;
|
|
|
}
|
|
}
|
|
@@ -4028,13 +4023,13 @@ public class KwtWaybillOrderV1Service {
|
|
|
private Set<Long> getCurrentUserProxyScopeEntIds() {
|
|
private Set<Long> getCurrentUserProxyScopeEntIds() {
|
|
|
// 获取当前登录用户的企业ID
|
|
// 获取当前登录用户的企业ID
|
|
|
Long currentEntId = LoginUserHolder.getEntId();
|
|
Long currentEntId = LoginUserHolder.getEntId();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 校验企业ID是否存在
|
|
// 校验企业ID是否存在
|
|
|
if (Objects.isNull(currentEntId)) {
|
|
if (Objects.isNull(currentEntId)) {
|
|
|
log.warn("运单代理关系过滤失败,当前登录企业ID为空");
|
|
log.warn("运单代理关系过滤失败,当前登录企业ID为空");
|
|
|
return Collections.emptySet();
|
|
return Collections.emptySet();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
log.debug("开始获取当前用户代理范围企业ID,currentEntId: {}", currentEntId);
|
|
log.debug("开始获取当前用户代理范围企业ID,currentEntId: {}", currentEntId);
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -4050,10 +4045,10 @@ public class KwtWaybillOrderV1Service {
|
|
|
log.debug("查询到关联代理企业ID数量: {}", CollectionUtils.isEmpty(proxyEntIds) ? 0 : proxyEntIds.size());
|
|
log.debug("查询到关联代理企业ID数量: {}", CollectionUtils.isEmpty(proxyEntIds) ? 0 : proxyEntIds.size());
|
|
|
return proxyEntIds;
|
|
return proxyEntIds;
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
log.info("获取当前用户代理范围企业ID完成,currentEntId: {}, 结果数量: {}", currentEntId, proxyScopeEntIds.size());
|
|
log.info("获取当前用户代理范围企业ID完成,currentEntId: {}, 结果数量: {}", currentEntId, proxyScopeEntIds.size());
|
|
|
return proxyScopeEntIds;
|
|
return proxyScopeEntIds;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
// 记录异常日志,防止因远程服务调用失败导致主流程中断
|
|
// 记录异常日志,防止因远程服务调用失败导致主流程中断
|
|
|
log.error("运单代理关系过滤范围查询失败,currentEntId={}", currentEntId, e);
|
|
log.error("运单代理关系过滤范围查询失败,currentEntId={}", currentEntId, e);
|
|
@@ -4097,7 +4092,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
log.debug("当前企业[{}]为供应商类型,开始构建可见企业范围", currentEntId);
|
|
log.debug("当前企业[{}]为供应商类型,开始构建可见企业范围", currentEntId);
|
|
|
// 供应商可见自身
|
|
// 供应商可见自身
|
|
|
scopeEntIds.add(currentEntId);
|
|
scopeEntIds.add(currentEntId);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 如果提供了代理企业查询函数,则获取关联的代理企业
|
|
// 如果提供了代理企业查询函数,则获取关联的代理企业
|
|
|
if (Objects.nonNull(proxySupplier)) {
|
|
if (Objects.nonNull(proxySupplier)) {
|
|
|
try {
|
|
try {
|
|
@@ -4148,7 +4143,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
static boolean hasEnterpriseType(List<EntTypeResDto> entTypeList, Long entId, Integer entType) {
|
|
static boolean hasEnterpriseType(List<EntTypeResDto> entTypeList, Long entId, Integer entType) {
|
|
|
// 1. 基础参数校验:若企业ID、目标类型为空,或类型列表为空,直接返回false
|
|
// 1. 基础参数校验:若企业ID、目标类型为空,或类型列表为空,直接返回false
|
|
|
if (Objects.isNull(entId) || Objects.isNull(entType) || CollectionUtils.isEmpty(entTypeList)) {
|
|
if (Objects.isNull(entId) || Objects.isNull(entType) || CollectionUtils.isEmpty(entTypeList)) {
|
|
|
- log.debug("判断企业类型失败:参数无效,entId={}, entType={}, listSize={}",
|
|
|
|
|
|
|
+ log.debug("判断企业类型失败:参数无效,entId={}, entType={}, listSize={}",
|
|
|
entId, entType, entTypeList == null ? 0 : entTypeList.size());
|
|
entId, entType, entTypeList == null ? 0 : entTypeList.size());
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -4161,7 +4156,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
|
|
|
|
|
// 3. 记录调试日志,便于追踪权限过滤逻辑
|
|
// 3. 记录调试日志,便于追踪权限过滤逻辑
|
|
|
log.debug("判断企业类型结果:entId={}, targetEntType={}, result={}", entId, entType, result);
|
|
log.debug("判断企业类型结果:entId={}, targetEntType={}, result={}", entId, entType, result);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -4184,8 +4179,8 @@ public class KwtWaybillOrderV1Service {
|
|
|
// 确定当前用户可见的企业ID范围:如果代理关系查询结果为空,则默认仅包含当前登录企业ID,确保数据权限过滤的有效性
|
|
// 确定当前用户可见的企业ID范围:如果代理关系查询结果为空,则默认仅包含当前登录企业ID,确保数据权限过滤的有效性
|
|
|
Set<Long> finalCurrentUserScopeEntIds = CollectionUtils.isNotEmpty(currentUserScopeEntIds)
|
|
Set<Long> finalCurrentUserScopeEntIds = CollectionUtils.isNotEmpty(currentUserScopeEntIds)
|
|
|
? currentUserScopeEntIds : Collections.singleton(entId);
|
|
? currentUserScopeEntIds : Collections.singleton(entId);
|
|
|
-
|
|
|
|
|
- log.debug("开始根据企业权限过滤物流订单单位,可见企业ID集合: {}, 待过滤单位数量: {}",
|
|
|
|
|
|
|
+
|
|
|
|
|
+ log.debug("开始根据企业权限过滤物流订单单位,可见企业ID集合: {}, 待过滤单位数量: {}",
|
|
|
finalCurrentUserScopeEntIds, unitList.size());
|
|
finalCurrentUserScopeEntIds, unitList.size());
|
|
|
|
|
|
|
|
// 过滤出属于当前用户可见企业范围内的物流订单单位,并提取对应的物流订单ID集合
|
|
// 过滤出属于当前用户可见企业范围内的物流订单单位,并提取对应的物流订单ID集合
|
|
@@ -4283,7 +4278,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
* 对物流订单ID集合进行交集操作
|
|
* 对物流订单ID集合进行交集操作
|
|
|
* 如果原集合为空,则添加新集合的所有元素
|
|
* 如果原集合为空,则添加新集合的所有元素
|
|
|
* 如果原集合不为空,则保留原集合与新集合的交集
|
|
* 如果原集合不为空,则保留原集合与新集合的交集
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* @param logOrderIds 原物流订单ID集合
|
|
* @param logOrderIds 原物流订单ID集合
|
|
|
* @param newOrderIds 新物流订单ID集合
|
|
* @param newOrderIds 新物流订单ID集合
|
|
|
*/
|
|
*/
|
|
@@ -4314,7 +4309,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
|| !req.getKeywords().contains("代理")) {
|
|
|| !req.getKeywords().contains("代理")) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
log.debug("检测到关键字包含'代理',设置代理标识并清空关键字");
|
|
log.debug("检测到关键字包含'代理',设置代理标识并清空关键字");
|
|
|
// 设置代理标识为真
|
|
// 设置代理标识为真
|
|
|
req.setAgentFlag(Global.YES);
|
|
req.setAgentFlag(Global.YES);
|
|
@@ -4343,13 +4338,13 @@ public class KwtWaybillOrderV1Service {
|
|
|
if (Objects.isNull(req) || StringUtils.isBlank(req.getKeywords())) {
|
|
if (Objects.isNull(req) || StringUtils.isBlank(req.getKeywords())) {
|
|
|
return billOrderIds;
|
|
return billOrderIds;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
log.debug("开始执行关键字过滤,关键字: {}", req.getKeywords());
|
|
log.debug("开始执行关键字过滤,关键字: {}", req.getKeywords());
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 1. 查询命中关键字的运单ID集合
|
|
// 1. 查询命中关键字的运单ID集合
|
|
|
Set<Long> keywordBillOrderIds = queryBillOrderIdsByKeywords(req.getKeywords());
|
|
Set<Long> keywordBillOrderIds = queryBillOrderIdsByKeywords(req.getKeywords());
|
|
|
log.debug("关键字查询到的运单ID数量: {}", CollectionUtils.isEmpty(keywordBillOrderIds) ? 0 : keywordBillOrderIds.size());
|
|
log.debug("关键字查询到的运单ID数量: {}", CollectionUtils.isEmpty(keywordBillOrderIds) ? 0 : keywordBillOrderIds.size());
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 2. 合并结果(取交集或并集,取决于是否有其他限制条件)
|
|
// 2. 合并结果(取交集或并集,取决于是否有其他限制条件)
|
|
|
return mergeKeywordBillOrderIds(billOrderIds, keywordBillOrderIds, hasBillOrderRestrictedCondition);
|
|
return mergeKeywordBillOrderIds(billOrderIds, keywordBillOrderIds, hasBillOrderRestrictedCondition);
|
|
|
}
|
|
}
|
|
@@ -4368,7 +4363,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
*/
|
|
*/
|
|
|
private Set<Long> queryBillOrderIdsByKeywords(String keywords) {
|
|
private Set<Long> queryBillOrderIdsByKeywords(String keywords) {
|
|
|
Set<Long> keywordBillOrderIds = Sets.newLinkedHashSet();
|
|
Set<Long> keywordBillOrderIds = Sets.newLinkedHashSet();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 1. 根据运单号模糊查询
|
|
// 1. 根据运单号模糊查询
|
|
|
List<KwtWaybillOrder> waybillOrders = kwtWaybillOrderRepository.queryListByWOrderNo(keywords);
|
|
List<KwtWaybillOrder> waybillOrders = kwtWaybillOrderRepository.queryListByWOrderNo(keywords);
|
|
|
if (CollectionUtils.isNotEmpty(waybillOrders)) {
|
|
if (CollectionUtils.isNotEmpty(waybillOrders)) {
|
|
@@ -4379,7 +4374,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
keywordBillOrderIds.addAll(orderIdsByNo);
|
|
keywordBillOrderIds.addAll(orderIdsByNo);
|
|
|
log.debug("通过运单号查询到ID数量: {}", orderIdsByNo.size());
|
|
log.debug("通过运单号查询到ID数量: {}", orderIdsByNo.size());
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 2. 根据商品名称查询
|
|
// 2. 根据商品名称查询
|
|
|
// 先获取包含该商品的物流订单ID
|
|
// 先获取包含该商品的物流订单ID
|
|
|
Set<Long> logOrderIdsByGoods = getLogOrderIdsByGoodsName(keywords);
|
|
Set<Long> logOrderIdsByGoods = getLogOrderIdsByGoodsName(keywords);
|
|
@@ -4395,11 +4390,11 @@ public class KwtWaybillOrderV1Service {
|
|
|
log.debug("通过商品名称查询到ID数量: {}", orderIdsByGoods.size());
|
|
log.debug("通过商品名称查询到ID数量: {}", orderIdsByGoods.size());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 通过贸易订单代理商名称关键字查询关联的运单ID
|
|
// 通过贸易订单代理商名称关键字查询关联的运单ID
|
|
|
log.debug("开始通过代理商名称关键字查询运单ID,关键字: {}", keywords);
|
|
log.debug("开始通过代理商名称关键字查询运单ID,关键字: {}", keywords);
|
|
|
Set<Long> orderIdsByAgentFirmName = queryBillOrderIdsByAgentFirmName(keywords);
|
|
Set<Long> orderIdsByAgentFirmName = queryBillOrderIdsByAgentFirmName(keywords);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 如果查询到匹配的运单ID,则合并到结果集中
|
|
// 如果查询到匹配的运单ID,则合并到结果集中
|
|
|
if (CollectionUtils.isNotEmpty(orderIdsByAgentFirmName)) {
|
|
if (CollectionUtils.isNotEmpty(orderIdsByAgentFirmName)) {
|
|
|
keywordBillOrderIds.addAll(orderIdsByAgentFirmName);
|
|
keywordBillOrderIds.addAll(orderIdsByAgentFirmName);
|
|
@@ -4430,9 +4425,9 @@ public class KwtWaybillOrderV1Service {
|
|
|
log.debug("通过代理商名称查询运单:关键字为空,返回空集合");
|
|
log.debug("通过代理商名称查询运单:关键字为空,返回空集合");
|
|
|
return Sets.newHashSet();
|
|
return Sets.newHashSet();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
log.info("开始通过代理商名称关键字查询运单,keywords: {}", keywords);
|
|
log.info("开始通过代理商名称关键字查询运单,keywords: {}", keywords);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
try {
|
|
try {
|
|
|
// 1. 根据代理商名称查询物流订单企业表中的代理单位记录
|
|
// 1. 根据代理商名称查询物流订单企业表中的代理单位记录
|
|
|
List<KwtLogisticsOrderUnit> agentUnits = kwtLogisticsOrderUnitRepository.queryByFirmNameAndUnitType(
|
|
List<KwtLogisticsOrderUnit> agentUnits = kwtLogisticsOrderUnitRepository.queryByFirmNameAndUnitType(
|
|
@@ -4445,7 +4440,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
|
|
|
|
|
// 2. 提取物流订单ID
|
|
// 2. 提取物流订单ID
|
|
|
Set<Long> logOrderIds = extractAgentLogOrderIdsByAgentFirmName(agentUnits, keywords);
|
|
Set<Long> logOrderIds = extractAgentLogOrderIdsByAgentFirmName(agentUnits, keywords);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (CollectionUtils.isEmpty(logOrderIds)) {
|
|
if (CollectionUtils.isEmpty(logOrderIds)) {
|
|
|
log.warn("物流订单代理单位记录中物流订单ID为空,无法继续查询子运单,keywords: {}", keywords);
|
|
log.warn("物流订单代理单位记录中物流订单ID为空,无法继续查询子运单,keywords: {}", keywords);
|
|
|
return Sets.newHashSet();
|
|
return Sets.newHashSet();
|
|
@@ -4460,10 +4455,10 @@ public class KwtWaybillOrderV1Service {
|
|
|
.map(KwtWaybillOrderSubtask::getWOrderId)
|
|
.map(KwtWaybillOrderSubtask::getWOrderId)
|
|
|
.filter(Objects::nonNull)
|
|
.filter(Objects::nonNull)
|
|
|
.collect(Collectors.toSet());
|
|
.collect(Collectors.toSet());
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
log.info("通过代理商名称[{}]查询运单完成,最终匹配运单ID数量: {}", keywords, resultBillOrderIds.size());
|
|
log.info("通过代理商名称[{}]查询运单完成,最终匹配运单ID数量: {}", keywords, resultBillOrderIds.size());
|
|
|
return resultBillOrderIds;
|
|
return resultBillOrderIds;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
// 异常捕获:记录警告日志,避免因远程服务波动导致主流程中断,返回空集合表示无匹配数据
|
|
// 异常捕获:记录警告日志,避免因远程服务波动导致主流程中断,返回空集合表示无匹配数据
|
|
|
log.warn("通过代理商名称关键字查询运单发生异常,keywords: {}, 错误信息: {}", keywords, e.getMessage(), e);
|
|
log.warn("通过代理商名称关键字查询运单发生异常,keywords: {}, 错误信息: {}", keywords, e.getMessage(), e);
|
|
@@ -4530,12 +4525,12 @@ public class KwtWaybillOrderV1Service {
|
|
|
if (CollectionUtils.isEmpty(keywordBillOrderIds)) {
|
|
if (CollectionUtils.isEmpty(keywordBillOrderIds)) {
|
|
|
return Sets.newHashSet();
|
|
return Sets.newHashSet();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 如果之前没有施加其他限制条件,且之前的ID集合也为空,说明这是第一个有效过滤条件,直接返回关键字结果
|
|
// 如果之前没有施加其他限制条件,且之前的ID集合也为空,说明这是第一个有效过滤条件,直接返回关键字结果
|
|
|
if (CollectionUtils.isEmpty(billOrderIds) && !hasBillOrderRestrictedCondition) {
|
|
if (CollectionUtils.isEmpty(billOrderIds) && !hasBillOrderRestrictedCondition) {
|
|
|
return Sets.newHashSet(keywordBillOrderIds);
|
|
return Sets.newHashSet(keywordBillOrderIds);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 取交集:保留既在原有结果中,又命中关键字的ID
|
|
// 取交集:保留既在原有结果中,又命中关键字的ID
|
|
|
Set<Long> result = Sets.newHashSet(billOrderIds);
|
|
Set<Long> result = Sets.newHashSet(billOrderIds);
|
|
|
result.retainAll(keywordBillOrderIds);
|
|
result.retainAll(keywordBillOrderIds);
|
|
@@ -4660,11 +4655,11 @@ public class KwtWaybillOrderV1Service {
|
|
|
// 4. 执行交集运算:保留既在前序结果中,又满足当前条件的运单ID。
|
|
// 4. 执行交集运算:保留既在前序结果中,又满足当前条件的运单ID。
|
|
|
Set<Long> result = Sets.newHashSet(billOrderIds);
|
|
Set<Long> result = Sets.newHashSet(billOrderIds);
|
|
|
result.retainAll(conditionOrderIds);
|
|
result.retainAll(conditionOrderIds);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 5. 记录日志:监控交集运算后的数据量变化,便于排查数据过滤逻辑。
|
|
// 5. 记录日志:监控交集运算后的数据量变化,便于排查数据过滤逻辑。
|
|
|
- log.debug("运单多条件交集合并完成,当前条件ID数量: {}, 前序ID数量: {}, 合并后剩余ID数量: {}",
|
|
|
|
|
|
|
+ log.debug("运单多条件交集合并完成,当前条件ID数量: {}, 前序ID数量: {}, 合并后剩余ID数量: {}",
|
|
|
conditionOrderIds.size(), billOrderIds.size(), result.size());
|
|
conditionOrderIds.size(), billOrderIds.size(), result.size());
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -4793,13 +4788,13 @@ public class KwtWaybillOrderV1Service {
|
|
|
waybillOrderNodeMap.getOrDefault(record.getWOrderId() + "-" + CarWaybillV1Enum.COMPLETION_LOADING.getCode(),
|
|
waybillOrderNodeMap.getOrDefault(record.getWOrderId() + "-" + CarWaybillV1Enum.COMPLETION_LOADING.getCode(),
|
|
|
new KwtWaybillOrderNode());
|
|
new KwtWaybillOrderNode());
|
|
|
waybillOrderResp.setLoadingTime(DateUtils.format(loadTrack.getCreateTime(),DateUtils.DATE_TIME_PATTERN));
|
|
waybillOrderResp.setLoadingTime(DateUtils.format(loadTrack.getCreateTime(),DateUtils.DATE_TIME_PATTERN));
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 从节点表中获取离场时间
|
|
// 从节点表中获取离场时间
|
|
|
KwtWaybillOrderNode offsiteNode = wOrderIdAndOffsiteNodeMap.get(record.getWOrderId());
|
|
KwtWaybillOrderNode offsiteNode = wOrderIdAndOffsiteNodeMap.get(record.getWOrderId());
|
|
|
if (offsiteNode != null) {
|
|
if (offsiteNode != null) {
|
|
|
waybillOrderResp.setOffsiteTime(DateUtils.format(offsiteNode.getCreateTime(), DateUtils.DATE_TIME_PATTERN));
|
|
waybillOrderResp.setOffsiteTime(DateUtils.format(offsiteNode.getCreateTime(), DateUtils.DATE_TIME_PATTERN));
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
waybillOrderResp.setUnloadingTime(DateUtils.format(unloadTrack.getCreateTime(),DateUtils.DATE_TIME_PATTERN));
|
|
waybillOrderResp.setUnloadingTime(DateUtils.format(unloadTrack.getCreateTime(),DateUtils.DATE_TIME_PATTERN));
|
|
|
if (Objects.equals(record.getStatus(), CarWaybillV1Enum.COMPLETED.getCode())){
|
|
if (Objects.equals(record.getStatus(), CarWaybillV1Enum.COMPLETED.getCode())){
|
|
|
waybillOrderResp.setCompleteTime(DateUtils.format(record.getUpdateTime(),DateUtils.DATE_TIME_PATTERN));
|
|
waybillOrderResp.setCompleteTime(DateUtils.format(record.getUpdateTime(),DateUtils.DATE_TIME_PATTERN));
|
|
@@ -4933,9 +4928,9 @@ public class KwtWaybillOrderV1Service {
|
|
|
log.debug("所有并行查询完成");
|
|
log.debug("所有并行查询完成");
|
|
|
|
|
|
|
|
// 获取查询结果
|
|
// 获取查询结果
|
|
|
- return buildWaybillOrderDetailResp(billOrder, subtask, logOrder, truckFuture.join(),
|
|
|
|
|
- fleetFuture.join(), addressFuture.join(), ticketFuture.join(), userFuture.join(),
|
|
|
|
|
- goodsFuture.join(), orderDetailFuture.join(), unitFuture.join(),
|
|
|
|
|
|
|
+ return buildWaybillOrderDetailResp(billOrder, subtask, logOrder, truckFuture.join(),
|
|
|
|
|
+ fleetFuture.join(), addressFuture.join(), ticketFuture.join(), userFuture.join(),
|
|
|
|
|
+ goodsFuture.join(), orderDetailFuture.join(), unitFuture.join(),
|
|
|
nodeFuture.join(), waybillSubtaskFuture.join(),contractFuture.join());
|
|
nodeFuture.join(), waybillSubtaskFuture.join(),contractFuture.join());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -5021,10 +5016,10 @@ public class KwtWaybillOrderV1Service {
|
|
|
/**
|
|
/**
|
|
|
* 构建运单详情响应对象
|
|
* 构建运单详情响应对象
|
|
|
*/
|
|
*/
|
|
|
- private WaybillOrderDetailResp buildWaybillOrderDetailResp(KwtWaybillOrder billOrder,
|
|
|
|
|
- KwtWaybillOrderSubtask subtask,
|
|
|
|
|
|
|
+ private WaybillOrderDetailResp buildWaybillOrderDetailResp(KwtWaybillOrder billOrder,
|
|
|
|
|
+ KwtWaybillOrderSubtask subtask,
|
|
|
KwtLogisticsOrder logOrder,
|
|
KwtLogisticsOrder logOrder,
|
|
|
- RTruckVo truck,
|
|
|
|
|
|
|
+ RTruckVo truck,
|
|
|
RFleetVo fleet,
|
|
RFleetVo fleet,
|
|
|
List<KwtLogisticsOrderAddress> kwtWaybillOrderAddresses,
|
|
List<KwtLogisticsOrderAddress> kwtWaybillOrderAddresses,
|
|
|
List<KwtWaybillOrderTicket> orderTicketList,
|
|
List<KwtWaybillOrderTicket> orderTicketList,
|
|
@@ -5094,7 +5089,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
* 获取合同采购单位信息
|
|
* 获取合同采购单位信息
|
|
|
*/
|
|
*/
|
|
|
private List<TradeContractUnitDto> getTradeContractUnits(OrderDetailVo orderDetailVo) {
|
|
private List<TradeContractUnitDto> getTradeContractUnits(OrderDetailVo orderDetailVo) {
|
|
|
- if (Objects.nonNull(orderDetailVo) && Objects.nonNull(orderDetailVo.getContractInfo())
|
|
|
|
|
|
|
+ if (Objects.nonNull(orderDetailVo) && Objects.nonNull(orderDetailVo.getContractInfo())
|
|
|
&& Objects.nonNull(orderDetailVo.getContractInfo().getContractId())) {
|
|
&& Objects.nonNull(orderDetailVo.getContractInfo().getContractId())) {
|
|
|
log.debug("查询合同单位信息,合同ID: {}", orderDetailVo.getContractInfo().getContractId());
|
|
log.debug("查询合同单位信息,合同ID: {}", orderDetailVo.getContractInfo().getContractId());
|
|
|
return remoteContractService.queryContractUnitByContractId(
|
|
return remoteContractService.queryContractUnitByContractId(
|
|
@@ -5112,7 +5107,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
.filter(Objects::nonNull)
|
|
.filter(Objects::nonNull)
|
|
|
.collect(Collectors.toMap(
|
|
.collect(Collectors.toMap(
|
|
|
x -> x.getLOrderId() + "-" + x.getAddressType(),
|
|
x -> x.getLOrderId() + "-" + x.getAddressType(),
|
|
|
- Function.identity(),
|
|
|
|
|
|
|
+ Function.identity(),
|
|
|
(x, y) -> x));
|
|
(x, y) -> x));
|
|
|
}
|
|
}
|
|
|
return Maps.newHashMap();
|
|
return Maps.newHashMap();
|
|
@@ -5127,7 +5122,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
.filter(Objects::nonNull)
|
|
.filter(Objects::nonNull)
|
|
|
.collect(Collectors.toMap(
|
|
.collect(Collectors.toMap(
|
|
|
x -> x.getLOrderId() + "-" + x.getUnitType(),
|
|
x -> x.getLOrderId() + "-" + x.getUnitType(),
|
|
|
- Function.identity(),
|
|
|
|
|
|
|
+ Function.identity(),
|
|
|
(x, y) -> x));
|
|
(x, y) -> x));
|
|
|
}
|
|
}
|
|
|
return Maps.newHashMap();
|
|
return Maps.newHashMap();
|
|
@@ -5139,7 +5134,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
private List<KwtWaybillOrderNode> processNodes(List<KwtWaybillOrderNode> nodes) {
|
|
private List<KwtWaybillOrderNode> processNodes(List<KwtWaybillOrderNode> nodes) {
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(nodes)) {
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(nodes)) {
|
|
|
return nodes.stream()
|
|
return nodes.stream()
|
|
|
- .filter(x -> Objects.nonNull(x) && Objects.nonNull(x.getWeighbridgeId()) &&
|
|
|
|
|
|
|
+ .filter(x -> Objects.nonNull(x) && Objects.nonNull(x.getWeighbridgeId()) &&
|
|
|
Objects.nonNull(x.getRemark()) && x.getRemark().contains("称重"))
|
|
Objects.nonNull(x.getRemark()) && x.getRemark().contains("称重"))
|
|
|
.sorted(Comparator.comparing(KwtWaybillOrderNode::getCreateTime))
|
|
.sorted(Comparator.comparing(KwtWaybillOrderNode::getCreateTime))
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
@@ -5173,7 +5168,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
.filter(Objects::nonNull)
|
|
.filter(Objects::nonNull)
|
|
|
.collect(Collectors.toMap(
|
|
.collect(Collectors.toMap(
|
|
|
ticket -> ticket.getWOrderId() + "-" + ticket.getType(),
|
|
ticket -> ticket.getWOrderId() + "-" + ticket.getType(),
|
|
|
- Function.identity(),
|
|
|
|
|
|
|
+ Function.identity(),
|
|
|
(x, y) -> x));
|
|
(x, y) -> x));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -5182,7 +5177,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 构建运单详情响应对象
|
|
* 构建运单详情响应对象
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* @param subtask 运单子任务信息
|
|
* @param subtask 运单子任务信息
|
|
|
* @param billOrder 运单主信息
|
|
* @param billOrder 运单主信息
|
|
|
* @param logOrder 物流订单信息
|
|
* @param logOrder 物流订单信息
|
|
@@ -6303,11 +6298,11 @@ public class KwtWaybillOrderV1Service {
|
|
|
*/
|
|
*/
|
|
|
public WaybillOrderNodeVo queryWaybillOrderNodeTimeline(WaybillOrderNodeReq req) {
|
|
public WaybillOrderNodeVo queryWaybillOrderNodeTimeline(WaybillOrderNodeReq req) {
|
|
|
log.info("查询运单节点轨迹,请求参数:{}", JSON.toJSONString(req));
|
|
log.info("查询运单节点轨迹,请求参数:{}", JSON.toJSONString(req));
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 查询节点轨迹数据
|
|
// 查询节点轨迹数据
|
|
|
List<KwtWaybillOrderNode> nodes = kwtWaybillOrderNodeRepository.queryNodesByOrderId(
|
|
List<KwtWaybillOrderNode> nodes = kwtWaybillOrderNodeRepository.queryNodesByOrderId(
|
|
|
req.getWOrderId(), req.getWSubtaskId());
|
|
req.getWOrderId(), req.getWSubtaskId());
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (CollectionUtils.isEmpty(nodes)) {
|
|
if (CollectionUtils.isEmpty(nodes)) {
|
|
|
return new WaybillOrderNodeVo();
|
|
return new WaybillOrderNodeVo();
|
|
|
}
|
|
}
|
|
@@ -6442,7 +6437,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
log.debug("selectMinStatusEarliestNode: 节点列表为空,返回 null");
|
|
log.debug("selectMinStatusEarliestNode: 节点列表为空,返回 null");
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 2. 提取最小原始状态码
|
|
// 2. 提取最小原始状态码
|
|
|
// 在同一阶段映射下,可能存在多个原始业务状态,取数值最小的作为基准(通常代表初始状态)
|
|
// 在同一阶段映射下,可能存在多个原始业务状态,取数值最小的作为基准(通常代表初始状态)
|
|
|
Integer minStatus = nodes.stream()
|
|
Integer minStatus = nodes.stream()
|
|
@@ -6450,35 +6445,35 @@ public class KwtWaybillOrderV1Service {
|
|
|
.filter(Objects::nonNull)
|
|
.filter(Objects::nonNull)
|
|
|
.min(Integer::compareTo)
|
|
.min(Integer::compareTo)
|
|
|
.orElse(null);
|
|
.orElse(null);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (Objects.isNull(minStatus)) {
|
|
if (Objects.isNull(minStatus)) {
|
|
|
log.warn("selectMinStatusEarliestNode: 无法从节点列表中提取有效的最小状态码,节点数量: {}", nodes.size());
|
|
log.warn("selectMinStatusEarliestNode: 无法从节点列表中提取有效的最小状态码,节点数量: {}", nodes.size());
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
log.debug("selectMinStatusEarliestNode: 提取到最小状态码: {}", minStatus);
|
|
log.debug("selectMinStatusEarliestNode: 提取到最小状态码: {}", minStatus);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 3. 筛选具有最小状态码且创建时间最早的节点
|
|
// 3. 筛选具有最小状态码且创建时间最早的节点
|
|
|
WaybillOrderNodeVo.WaybillOrderNode selected = nodes.stream()
|
|
WaybillOrderNodeVo.WaybillOrderNode selected = nodes.stream()
|
|
|
.filter(node -> Objects.equals(node.getOrderStatus(), minStatus))
|
|
.filter(node -> Objects.equals(node.getOrderStatus(), minStatus))
|
|
|
.min(Comparator.comparing(node -> parseWaybillNodeCreateTime(node.getCreateTime())))
|
|
.min(Comparator.comparing(node -> parseWaybillNodeCreateTime(node.getCreateTime())))
|
|
|
.orElse(null);
|
|
.orElse(null);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (Objects.isNull(selected)) {
|
|
if (Objects.isNull(selected)) {
|
|
|
log.warn("selectMinStatusEarliestNode: 状态码为 {} 的节点中未找到有效创建时间的节点", minStatus);
|
|
log.warn("selectMinStatusEarliestNode: 状态码为 {} 的节点中未找到有效创建时间的节点", minStatus);
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
- log.debug("selectMinStatusEarliestNode: 选中节点 ID: {}, 状态: {}, 创建时间: {}",
|
|
|
|
|
|
|
+ log.debug("selectMinStatusEarliestNode: 选中节点 ID: {}, 状态: {}, 创建时间: {}",
|
|
|
selected.getId(), selected.getOrderStatus(), selected.getCreateTime());
|
|
selected.getId(), selected.getOrderStatus(), selected.getCreateTime());
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 4. 映射前端时间轴阶段信息
|
|
// 4. 映射前端时间轴阶段信息
|
|
|
// 将原始业务状态转换为前端展示用的阶段序号(phaseOrder)和阶段名称(phaseLabel)
|
|
// 将原始业务状态转换为前端展示用的阶段序号(phaseOrder)和阶段名称(phaseLabel)
|
|
|
WaybillTimelinePhaseEnum.resolve(minStatus).ifPresent(phase -> {
|
|
WaybillTimelinePhaseEnum.resolve(minStatus).ifPresent(phase -> {
|
|
|
- log.debug("selectMinStatusEarliestNode: 映射前端阶段,原始状态: {} -> 阶段序号: {}, 阶段名称: {}",
|
|
|
|
|
|
|
+ log.debug("selectMinStatusEarliestNode: 映射前端阶段,原始状态: {} -> 阶段序号: {}, 阶段名称: {}",
|
|
|
minStatus, phase.getPhaseOrder(), phase.getPhaseLabel());
|
|
minStatus, phase.getPhaseOrder(), phase.getPhaseLabel());
|
|
|
selected.setOrderStatus(phase.getPhaseOrder());
|
|
selected.setOrderStatus(phase.getPhaseOrder());
|
|
|
selected.setOrderStatusName(phase.getPhaseLabel());
|
|
selected.setOrderStatusName(phase.getPhaseLabel());
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
return selected;
|
|
return selected;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -6494,7 +6489,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
* 构建状态描述文本
|
|
* 构建状态描述文本
|
|
|
* 格式:车辆【川A5478C】司机【张三】装载货物【铁矿石】【参运】【28.70吨】
|
|
* 格式:车辆【川A5478C】司机【张三】装载货物【铁矿石】【参运】【28.70吨】
|
|
|
*/
|
|
*/
|
|
|
- private String buildStatusDescription(KwtWaybillOrderNode node,
|
|
|
|
|
|
|
+ private String buildStatusDescription(KwtWaybillOrderNode node,
|
|
|
KwtWaybillOrderSubtask subtask,
|
|
KwtWaybillOrderSubtask subtask,
|
|
|
Map<Long, KwtLogisticsOrderGoods> goodsMap,
|
|
Map<Long, KwtLogisticsOrderGoods> goodsMap,
|
|
|
Map<String, String> unitMap) {
|
|
Map<String, String> unitMap) {
|
|
@@ -6552,7 +6547,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
if (status == null || subtask == null) {
|
|
if (status == null || subtask == null) {
|
|
|
return "";
|
|
return "";
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 根据状态返回不同的重量
|
|
// 根据状态返回不同的重量
|
|
|
// CarWaybillV1Enum: 1-已接单, 5-到达装货点, 10-已装货, 15-已离场, 20-已卸货, 25-已完成, 30-审核驳回, 99-已取消
|
|
// CarWaybillV1Enum: 1-已接单, 5-到达装货点, 10-已装货, 15-已离场, 20-已卸货, 25-已完成, 30-审核驳回, 99-已取消
|
|
|
if (status.equals(CarWaybillV1Enum.WAIT_LOADING.getCode())) {
|
|
if (status.equals(CarWaybillV1Enum.WAIT_LOADING.getCode())) {
|
|
@@ -6565,7 +6560,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
// 20-已卸货-卸货显示实卸量
|
|
// 20-已卸货-卸货显示实卸量
|
|
|
return String.valueOf(subtask.getUnloadAmount());
|
|
return String.valueOf(subtask.getUnloadAmount());
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
return "";
|
|
return "";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -6581,7 +6576,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
// 暂时返回经纬度格式
|
|
// 暂时返回经纬度格式
|
|
|
return String.format("经度:%s, 纬度:%s", lng, lat);
|
|
return String.format("经度:%s, 纬度:%s", lng, lat);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 根据运单号模糊查询运单ID和运单号列表
|
|
* 根据运单号模糊查询运单ID和运单号列表
|
|
|
*
|
|
*
|
|
@@ -6591,7 +6586,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
public List<WaybillOrderSimpleVo> queryWaybillOrderListByWOrderNo(String wOrderNo) {
|
|
public List<WaybillOrderSimpleVo> queryWaybillOrderListByWOrderNo(String wOrderNo) {
|
|
|
// 查询运单数据
|
|
// 查询运单数据
|
|
|
List<KwtWaybillOrder> waybillOrders = kwtWaybillOrderRepository.queryWaybillOrderListByWOrderNo(wOrderNo);
|
|
List<KwtWaybillOrder> waybillOrders = kwtWaybillOrderRepository.queryWaybillOrderListByWOrderNo(wOrderNo);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 转换为VO
|
|
// 转换为VO
|
|
|
return waybillOrders.stream()
|
|
return waybillOrders.stream()
|
|
|
.map(order -> {
|
|
.map(order -> {
|