|
|
@@ -6,24 +6,29 @@ import com.sckw.core.model.constant.Global;
|
|
|
import com.sckw.core.model.enums.CarWaybillEnum;
|
|
|
import com.sckw.core.model.enums.LogisticsOrderEnum;
|
|
|
import com.sckw.core.utils.BeanUtils;
|
|
|
+import com.sckw.core.utils.CollectionUtils;
|
|
|
import com.sckw.core.utils.IdWorker;
|
|
|
import com.sckw.core.utils.StringUtils;
|
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.response.HttpResult;
|
|
|
import com.sckw.mongo.enums.BusinessTypeEnum;
|
|
|
+import com.sckw.mongo.model.SckwLogisticsOrder;
|
|
|
import com.sckw.mongo.model.SckwWaybillOrder;
|
|
|
import com.sckw.stream.model.SckwBusSum;
|
|
|
import com.sckw.transport.dao.*;
|
|
|
import com.sckw.transport.model.*;
|
|
|
+import com.sckw.transport.model.dto.ConfirmRefuseSendCarDto;
|
|
|
import com.sckw.transport.model.dto.SendCarDto1;
|
|
|
import jakarta.annotation.Resource;
|
|
|
+import org.checkerframework.checker.units.qual.K;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.cloud.stream.function.StreamBridge;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -85,17 +90,17 @@ public class KwtWaybillOrderService {
|
|
|
setLogisticsBySendCar(logisticsOrder.getId(), ranksAmount);
|
|
|
|
|
|
/**Mongodb数据存储**/
|
|
|
- for (SckwWaybillOrder waybillOrder:sckwWaybillOrders) {
|
|
|
- //rabbitMq业务汇总数据发送/消费对象
|
|
|
- SckwBusSum busSum = new SckwBusSum();
|
|
|
- //业务汇总类型
|
|
|
- busSum.setBusSumType(BusinessTypeEnum.WAYBILL_ORDER_TYPE.getName());
|
|
|
- //操作对象(1新增/2修改)
|
|
|
- busSum.setMethod(1);
|
|
|
- //业务汇总数据对象
|
|
|
- busSum.setObject(waybillOrder);
|
|
|
- streamBridge.send("sckw-busSum", busSum);
|
|
|
- }
|
|
|
+ for (SckwWaybillOrder waybillOrder:sckwWaybillOrders) {
|
|
|
+ //rabbitMq业务汇总数据发送/消费对象
|
|
|
+ SckwBusSum busSum = new SckwBusSum();
|
|
|
+ //业务汇总类型
|
|
|
+ busSum.setBusSumType(BusinessTypeEnum.WAYBILL_ORDER_TYPE.getName());
|
|
|
+ //操作对象(1新增/2修改/3替换数据)
|
|
|
+ busSum.setMethod(1);
|
|
|
+ //业务汇总数据对象
|
|
|
+ busSum.setObject(waybillOrder);
|
|
|
+ streamBridge.send("sckw-busSum", busSum);
|
|
|
+ }
|
|
|
|
|
|
/**发送消息**/
|
|
|
return HttpResult.ok();
|
|
|
@@ -181,7 +186,7 @@ public class KwtWaybillOrderService {
|
|
|
/**数据存储**/
|
|
|
if (sendCarDto.getType() == Global.NUMERICAL_ONE) {
|
|
|
for (int i=0; i<sendCarDto.getCount(); i++) {
|
|
|
- //趟次派车存储
|
|
|
+ //车辆运单存储
|
|
|
ranksSave(waybillOrder, loadAddress, unloadAddress);
|
|
|
|
|
|
/**SckwWaybillOrder数据组装**/
|
|
|
@@ -191,28 +196,29 @@ public class KwtWaybillOrderService {
|
|
|
}
|
|
|
} else {
|
|
|
//循环派车存储
|
|
|
- boolean bool = circulateSave(waybillOrder);
|
|
|
- if (bool) {
|
|
|
+ KwtLogisticsOrderCirculate circulate = circulateSave(waybillOrder);
|
|
|
+ if (circulate != null) {
|
|
|
/**SckwWaybillOrder数据组装**/
|
|
|
SckwWaybillOrder mongoOrder = setSckwWaybillOrder(sendCarDto, waybillOrder, logisticsOrder, loadAddress,
|
|
|
unloadAddress, checkEnt, carrierEnt, goods);
|
|
|
+ mongoOrder.set_id(circulate.getId());
|
|
|
sckwWaybillOrders.add(mongoOrder);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**Mongodb数据存储
|
|
|
- for (SckwWaybillOrder waybillOrder:sckwWaybillOrders) {
|
|
|
- //rabbitMq业务汇总数据发送/消费对象
|
|
|
- SckwBusSum busSum = new SckwBusSum();
|
|
|
- //业务汇总类型
|
|
|
- busSum.setBusSumType(BusinessTypeEnum.WAYBILL_ORDER_TYPE.getName());
|
|
|
- //操作对象(1新增/2修改)
|
|
|
- busSum.setMethod(1);
|
|
|
- //业务汇总数据对象
|
|
|
- busSum.setObject(waybillOrder);
|
|
|
- streamBridge.send("sckw-busSum", busSum);
|
|
|
- }**/
|
|
|
+ for (SckwWaybillOrder waybillOrder:sckwWaybillOrders) {
|
|
|
+ //rabbitMq业务汇总数据发送/消费对象
|
|
|
+ SckwBusSum busSum = new SckwBusSum();
|
|
|
+ //业务汇总类型
|
|
|
+ busSum.setBusSumType(BusinessTypeEnum.WAYBILL_ORDER_TYPE.getName());
|
|
|
+ //操作对象(1新增/2修改/3替换数据)
|
|
|
+ busSum.setMethod(1);
|
|
|
+ //业务汇总数据对象
|
|
|
+ busSum.setObject(waybillOrder);
|
|
|
+ streamBridge.send("sckw-busSum", busSum);
|
|
|
+ }**/
|
|
|
|
|
|
return HttpResult.ok(sckwWaybillOrders);
|
|
|
}
|
|
|
@@ -252,18 +258,18 @@ public class KwtWaybillOrderService {
|
|
|
* @author zk
|
|
|
* @date 2023/7/21
|
|
|
**/
|
|
|
- public boolean circulateSave(KwtWaybillOrder waybillOrder) {
|
|
|
+ public KwtLogisticsOrderCirculate circulateSave(KwtWaybillOrder waybillOrder) {
|
|
|
//循环派车信息
|
|
|
KwtLogisticsOrderCirculate circulate = logisticsOrderCirculateDao.findCirculate(waybillOrder.getLOrderId(),
|
|
|
- waybillOrder.getTruckNo(), waybillOrder.getDriverId());
|
|
|
+ waybillOrder.getTruckId(), waybillOrder.getDriverId(), 0);
|
|
|
if (circulate == null || circulate.getStatus() == Global.UN_READ) {
|
|
|
circulate = new KwtLogisticsOrderCirculate();
|
|
|
BeanUtils.copyProperties(waybillOrder, circulate);
|
|
|
circulate.setWOrderId(null);
|
|
|
int count = logisticsOrderCirculateDao.insert(circulate);
|
|
|
- return count > 0 ? true : false;
|
|
|
+ return count > 0 ? null : circulate;
|
|
|
}
|
|
|
- return false;
|
|
|
+ return circulate;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -454,8 +460,8 @@ public class KwtWaybillOrderService {
|
|
|
public void setLogisticsBySendCar(Long lOrderId, BigDecimal ranksAmount) {
|
|
|
/**
|
|
|
状态判断是否是分包承运单(不考虑该承运单下级分包)
|
|
|
- 存在:更新当前承运订单状态及委派量entrustAmount,并且校验承运订单所有父级状态是否需要修改(是修改状态,否则不修改)
|
|
|
- 不存在:更新当前承运订单状态及委派量entrustAmount
|
|
|
+ 存在:更新当前承运订单状态及委派量entrustAmount,并且校验承运订单所有父级状态是否需要修改(是修改状态,否则不修改)
|
|
|
+ 不存在:更新当前承运订单状态及委派量entrustAmount
|
|
|
**/
|
|
|
//承运单信息
|
|
|
KwtLogisticsOrder logisticsOrder = logisticsOrderDao.selectById(lOrderId);
|
|
|
@@ -508,30 +514,85 @@ public class KwtWaybillOrderService {
|
|
|
* @author zk
|
|
|
* @date 2023/7/24
|
|
|
**/
|
|
|
- public HttpResult cancelSendCar(String ids){
|
|
|
+ public HttpResult cancelSendCar(List<Long> ids){
|
|
|
/**数据校验**/
|
|
|
- if (StringUtils.isBlank(ids)) {
|
|
|
+ if (CollectionUtils.isEmpty(ids)) {
|
|
|
return HttpResult.error("请选择需要撤回的车辆运单!");
|
|
|
}
|
|
|
- //校验运单ID是否有效/运单当前状态是否可以撤销
|
|
|
- String[] idArray = ids.split(",");
|
|
|
- for (String id : idArray) {
|
|
|
+ //1校验运单ID是否有效/2循环派车才能撤回/3运单当前状态是否可以撤回
|
|
|
+ for (Long id : ids) {
|
|
|
KwtWaybillOrder order = waybillOrderDao.selectById(id);
|
|
|
+ //1校验运单ID是否有效
|
|
|
if (order != null) {
|
|
|
- if (order.getStatus() != CarWaybillEnum.PENDING_ORDER.getCode()); {
|
|
|
- return HttpResult.error("运单"+order.getWOrderNo()+"当前已不能撤回!");
|
|
|
+ //3待接单的车辆运单才能撤回
|
|
|
+ if (order.getStatus() != CarWaybillEnum.PENDING_ORDER.getCode()) {
|
|
|
+ return HttpResult.error("运单"+order.getWOrderNo()+"当前状态已不能撤回!");
|
|
|
}
|
|
|
} else {
|
|
|
- return HttpResult.error("选择撤回的数据已不存在!");
|
|
|
+ //循环派车信息
|
|
|
+ KwtLogisticsOrderCirculate circulate = logisticsOrderCirculateDao.selectById(id);
|
|
|
+ //2循环派车才能撤回
|
|
|
+ if (circulate != null) {
|
|
|
+ return HttpResult.error("循环派车单不能撤回!");
|
|
|
+ }
|
|
|
+ return HttpResult.error("选择撤回车辆运单的数据不存在!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**业务处理**/
|
|
|
- for (String id : idArray) {
|
|
|
+ for (Long id : ids) {
|
|
|
KwtWaybillOrder order = waybillOrderDao.selectById(id);
|
|
|
if (order != null) {
|
|
|
- if (order.getStatus() == CarWaybillEnum.PENDING_ORDER.getCode()); {
|
|
|
- //----------------------
|
|
|
+ //待接单的车辆运单才能撤回
|
|
|
+ if (order.getStatus() == CarWaybillEnum.PENDING_ORDER.getCode()) {
|
|
|
+ /**1更新车辆运单**/
|
|
|
+ order.setStatus(CarWaybillEnum.REVOKED.getCode());
|
|
|
+ waybillOrderDao.updateById(order);
|
|
|
+
|
|
|
+ /**2新增运单状态记录**/
|
|
|
+ setWaybillOrderTrack(order.getId(), order.getStatus());
|
|
|
+
|
|
|
+ /**3回退承运订单entrustAmount**/
|
|
|
+ KwtLogisticsOrder logisticsOrder = logisticsOrderDao.selectById(order.getLOrderId());
|
|
|
+ //承运订单已委派量=承运订单原委派量+当前车辆运单委派量
|
|
|
+ BigDecimal entrustAmount = logisticsOrder.getEntrustAmount() == null ? new BigDecimal(Global.AMOUNT) : logisticsOrder.getEntrustAmount();
|
|
|
+ logisticsOrder.setEntrustAmount(entrustAmount.subtract(order.getEntrustAmount()));
|
|
|
+ logisticsOrderDao.updateById(logisticsOrder);
|
|
|
+
|
|
|
+ /**4Mongodb数据更新**/
|
|
|
+ //1车辆运单
|
|
|
+ SckwWaybillOrder wOrder = new SckwWaybillOrder();
|
|
|
+ wOrder.set_id(order.getId());
|
|
|
+ wOrder.setWOrderId(order.getId());
|
|
|
+ wOrder.setStatus(order.getStatus());
|
|
|
+ wOrder.setUpdateTime(order.getUpdateTime());
|
|
|
+ wOrder.setUpdateBy(order.getUpdateBy());
|
|
|
+ //rabbitMq业务汇总数据发送/消费对象
|
|
|
+ SckwBusSum busSum = new SckwBusSum();
|
|
|
+ //业务汇总类型
|
|
|
+ busSum.setBusSumType(BusinessTypeEnum.WAYBILL_ORDER_TYPE.getName());
|
|
|
+ //操作对象(1新增/2修改/3替换数据)
|
|
|
+ busSum.setMethod(2);
|
|
|
+ //业务汇总数据对象
|
|
|
+ busSum.setObject(wOrder);
|
|
|
+ streamBridge.send("sckw-busSum", busSum);
|
|
|
+
|
|
|
+ //2承运订单
|
|
|
+ SckwLogisticsOrder lOrder = new SckwLogisticsOrder();
|
|
|
+ lOrder.set_id(logisticsOrder.getId());
|
|
|
+ lOrder.setLOrderId(logisticsOrder.getId());
|
|
|
+ lOrder.setEntrustAmount(logisticsOrder.getEntrustAmount());
|
|
|
+ lOrder.setUpdateTime(logisticsOrder.getUpdateTime());
|
|
|
+ lOrder.setUpdateBy(logisticsOrder.getUpdateBy());
|
|
|
+ //业务汇总类型
|
|
|
+ busSum.setBusSumType(BusinessTypeEnum.LOGISTICS_ORDER_TYPE.getName());
|
|
|
+ //操作对象(1新增/2修改/3替换数据)
|
|
|
+ busSum.setMethod(2);
|
|
|
+ //业务汇总数据对象
|
|
|
+ busSum.setObject(lOrder);
|
|
|
+ streamBridge.send("sckw-busSum", busSum);
|
|
|
+
|
|
|
+ /**5发送消息**/
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
@@ -539,6 +600,236 @@ public class KwtWaybillOrderService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return HttpResult.ok();
|
|
|
+ return HttpResult.ok("车辆运单撤回成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param params {}
|
|
|
+ * @description 确认接单
|
|
|
+ * @author zk
|
|
|
+ * @date 2023/7/25
|
|
|
+ **/
|
|
|
+ public HttpResult confirmSendCar(ConfirmRefuseSendCarDto params) {
|
|
|
+ /**趟次派车**/
|
|
|
+ /**趟次派车**/
|
|
|
+ if (params.getType() == Global.NUMERICAL_ONE) {
|
|
|
+ /**数据校验**/
|
|
|
+ KwtWaybillOrder order = waybillOrderDao.selectById(params.getWOrderId());
|
|
|
+ if (order == null) {
|
|
|
+ return HttpResult.error("车辆趟次运单不存在!");
|
|
|
+ }
|
|
|
+ //待接单车辆运单才能拒绝接单
|
|
|
+ if (order.getStatus() != CarWaybillEnum.PENDING_ORDER.getCode()) {
|
|
|
+ return HttpResult.error("车辆运单当前状态已不能拒绝接单!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**业务处理**/
|
|
|
+ /**1更新车辆运单**/
|
|
|
+ order.setStatus(CarWaybillEnum.PENDING_VEHICLE.getCode());
|
|
|
+ waybillOrderDao.updateById(order);
|
|
|
+
|
|
|
+ /**2新增运单状态记录**/
|
|
|
+ setWaybillOrderTrack(order.getId(), order.getStatus());
|
|
|
+
|
|
|
+ /**3Mongodb数据更新**/
|
|
|
+ //1车辆运单
|
|
|
+ SckwWaybillOrder wOrder = new SckwWaybillOrder();
|
|
|
+ wOrder.set_id(order.getId());
|
|
|
+ wOrder.setWOrderId(order.getId());
|
|
|
+ wOrder.setStatus(order.getStatus());
|
|
|
+ wOrder.setUpdateTime(order.getUpdateTime());
|
|
|
+ wOrder.setUpdateBy(order.getUpdateBy());
|
|
|
+ //rabbitMq业务汇总数据发送/消费对象
|
|
|
+ SckwBusSum busSum = new SckwBusSum();
|
|
|
+ //业务汇总类型
|
|
|
+ busSum.setBusSumType(BusinessTypeEnum.WAYBILL_ORDER_TYPE.getName());
|
|
|
+ //操作对象(1新增/2修改/3替换数据)
|
|
|
+ busSum.setMethod(2);
|
|
|
+ //业务汇总数据对象
|
|
|
+ busSum.setObject(wOrder);
|
|
|
+ streamBridge.send("sckw-busSum", busSum);
|
|
|
+
|
|
|
+ /**4发送消息**/
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**循环派车**/
|
|
|
+ if (params.getType() == Global.NUMERICAL_TWO) {
|
|
|
+ /**数据校验**/
|
|
|
+ KwtLogisticsOrderCirculate circulate = logisticsOrderCirculateDao.findCirculate(params.getLOrderId(),
|
|
|
+ params.getTruckId(), params.getDriverId(), 0);
|
|
|
+ if (circulate == null) {
|
|
|
+ return HttpResult.error("车辆循环运单不存在!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**获取基础信息**/
|
|
|
+ //装货地址
|
|
|
+ KwtWaybillOrderAddress loadAddress = this.getAddress(params.getLOrderId(), Global.NUMERICAL_ONE);
|
|
|
+ //卸货地址
|
|
|
+ KwtWaybillOrderAddress unloadAddress = this.getAddress(params.getLOrderId(), Global.NUMERICAL_TWO);
|
|
|
+ //KwtWaybillOrder数据组装
|
|
|
+ KwtWaybillOrder waybillOrder = new KwtWaybillOrder();
|
|
|
+ waybillOrder.setEntId(LoginUserHolder.getEntId());
|
|
|
+ waybillOrder.setLOrderId(params.getLOrderId());
|
|
|
+ waybillOrder.setType(params.getType());
|
|
|
+ waybillOrder.setStartTime(circulate.getStartTime());
|
|
|
+ waybillOrder.setEndTime(circulate.getEndTime());
|
|
|
+ waybillOrder.setTruckId(circulate.getTruckId());
|
|
|
+ waybillOrder.setTruckNo(circulate.getTruckNo());
|
|
|
+ waybillOrder.setDriverId(circulate.getDriverId());
|
|
|
+ waybillOrder.setDriverName(circulate.getDriverName());
|
|
|
+ waybillOrder.setDriverPhone(circulate.getDriverPhone());
|
|
|
+ waybillOrder.setDriverIdcard(circulate.getDriverIdcard());
|
|
|
+ waybillOrder.setEntrustAmount(circulate.getEntrustAmount());
|
|
|
+ waybillOrder.setStatus(CarWaybillEnum.PENDING_VEHICLE.getCode());
|
|
|
+
|
|
|
+ /**业务处理**/
|
|
|
+ /**1车辆运单存储**/
|
|
|
+ ranksSave(waybillOrder, loadAddress, unloadAddress);
|
|
|
+
|
|
|
+ /**2更新承运订单信息**/
|
|
|
+ //承运单信息
|
|
|
+ KwtLogisticsOrder logisticsOrder = logisticsOrderDao.selectById(waybillOrder.getLOrderId());
|
|
|
+ //承运订单已委派量:承运订单历史委派量+当前运单委派量
|
|
|
+ BigDecimal entrustAmount = logisticsOrder.getEntrustAmount() == null ? new BigDecimal(Global.AMOUNT) : logisticsOrder.getEntrustAmount();
|
|
|
+ logisticsOrder.setEntrustAmount(entrustAmount.add(waybillOrder.getEntrustAmount()));
|
|
|
+ logisticsOrderDao.updateById(logisticsOrder);
|
|
|
+
|
|
|
+ /**3更新循环派车数据**/
|
|
|
+ circulate.setWOrderId(waybillOrder.getId());
|
|
|
+ logisticsOrderCirculateDao.updateById(circulate);
|
|
|
+
|
|
|
+ /**4Mongodb数据更新**/
|
|
|
+ SckwWaybillOrder wOrder = new SckwWaybillOrder();
|
|
|
+ wOrder.set_id(circulate.getId());
|
|
|
+ wOrder.setWOrderId(waybillOrder.getId());
|
|
|
+ wOrder.setStatus(waybillOrder.getStatus());
|
|
|
+ wOrder.setUpdateTime(waybillOrder.getUpdateTime());
|
|
|
+ wOrder.setUpdateBy(waybillOrder.getUpdateBy());
|
|
|
+ //rabbitMq业务汇总数据发送/消费对象
|
|
|
+ SckwBusSum busSum = new SckwBusSum();
|
|
|
+ //业务汇总类型
|
|
|
+ busSum.setBusSumType(BusinessTypeEnum.WAYBILL_ORDER_TYPE.getName());
|
|
|
+ //操作对象(1新增/2修改/3替换数据)
|
|
|
+ busSum.setMethod(3);
|
|
|
+ //业务汇总数据对象
|
|
|
+ busSum.setObject(wOrder);
|
|
|
+ streamBridge.send("sckw-busSum", busSum);
|
|
|
+
|
|
|
+ /**5发送消息**/
|
|
|
+ }
|
|
|
+ return HttpResult.ok("确认接单成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param params {}
|
|
|
+ * @description 拒绝接单
|
|
|
+ * @author zk
|
|
|
+ * @date 2023/7/25
|
|
|
+ **/
|
|
|
+ public HttpResult refuseSendCar(ConfirmRefuseSendCarDto params) {
|
|
|
+ /**趟次派车**/
|
|
|
+ if (params.getType() == Global.NUMERICAL_ONE) {
|
|
|
+ /**数据校验**/
|
|
|
+ KwtWaybillOrder order = waybillOrderDao.selectById(params.getWOrderId());
|
|
|
+ if (order == null) {
|
|
|
+ return HttpResult.error("车辆趟次运单不存在!");
|
|
|
+ }
|
|
|
+ //待接单车辆运单才能拒绝接单
|
|
|
+ if (order.getStatus() != CarWaybillEnum.PENDING_ORDER.getCode()) {
|
|
|
+ return HttpResult.error("车辆运单当前状态已不能拒绝接单!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**业务处理**/
|
|
|
+ /**1更新车辆运单**/
|
|
|
+ order.setStatus(CarWaybillEnum.REVOKED.getCode());
|
|
|
+ waybillOrderDao.updateById(order);
|
|
|
+
|
|
|
+ /**2新增运单状态记录**/
|
|
|
+ setWaybillOrderTrack(order.getId(), order.getStatus());
|
|
|
+
|
|
|
+ /**3回退承运订单entrustAmount**/
|
|
|
+ KwtLogisticsOrder logisticsOrder = logisticsOrderDao.selectById(order.getLOrderId());
|
|
|
+ //承运订单已委派量=承运订单原委派量+当前车辆运单委派量
|
|
|
+ BigDecimal entrustAmount = logisticsOrder.getEntrustAmount() == null ? new BigDecimal(Global.AMOUNT) : logisticsOrder.getEntrustAmount();
|
|
|
+ logisticsOrder.setEntrustAmount(entrustAmount.subtract(order.getEntrustAmount()));
|
|
|
+ logisticsOrderDao.updateById(logisticsOrder);
|
|
|
+
|
|
|
+ /**4Mongodb数据更新**/
|
|
|
+ //1车辆运单
|
|
|
+ SckwWaybillOrder wOrder = new SckwWaybillOrder();
|
|
|
+ wOrder.set_id(order.getId());
|
|
|
+ wOrder.setWOrderId(order.getId());
|
|
|
+ wOrder.setStatus(order.getStatus());
|
|
|
+ wOrder.setUpdateTime(order.getUpdateTime());
|
|
|
+ wOrder.setUpdateBy(order.getUpdateBy());
|
|
|
+ //rabbitMq业务汇总数据发送/消费对象
|
|
|
+ SckwBusSum busSum = new SckwBusSum();
|
|
|
+ //业务汇总类型
|
|
|
+ busSum.setBusSumType(BusinessTypeEnum.WAYBILL_ORDER_TYPE.getName());
|
|
|
+ //操作对象(1新增/2修改/3替换数据)
|
|
|
+ busSum.setMethod(2);
|
|
|
+ //业务汇总数据对象
|
|
|
+ busSum.setObject(wOrder);
|
|
|
+ streamBridge.send("sckw-busSum", busSum);
|
|
|
+
|
|
|
+ //2承运订单
|
|
|
+ SckwLogisticsOrder lOrder = new SckwLogisticsOrder();
|
|
|
+ lOrder.set_id(logisticsOrder.getId());
|
|
|
+ lOrder.setLOrderId(logisticsOrder.getId());
|
|
|
+ lOrder.setEntrustAmount(logisticsOrder.getEntrustAmount());
|
|
|
+ lOrder.setUpdateTime(logisticsOrder.getUpdateTime());
|
|
|
+ lOrder.setUpdateBy(logisticsOrder.getUpdateBy());
|
|
|
+ //业务汇总类型
|
|
|
+ busSum.setBusSumType(BusinessTypeEnum.LOGISTICS_ORDER_TYPE.getName());
|
|
|
+ //操作对象(1新增/2修改/3替换数据)
|
|
|
+ busSum.setMethod(2);
|
|
|
+ //业务汇总数据对象
|
|
|
+ busSum.setObject(lOrder);
|
|
|
+ streamBridge.send("sckw-busSum", busSum);
|
|
|
+
|
|
|
+ /**5发送消息**/
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**循环派车**/
|
|
|
+ if (params.getType() == Global.NUMERICAL_TWO) {
|
|
|
+ /**数据校验**/
|
|
|
+ KwtLogisticsOrderCirculate circulate = logisticsOrderCirculateDao.findCirculate(params.getLOrderId(),
|
|
|
+ params.getTruckId(), params.getDriverId(), 0);
|
|
|
+ if (circulate == null) {
|
|
|
+ return HttpResult.error("车辆循环运单不存在!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**1更新循环单状态为失效**/
|
|
|
+ circulate.setStatus(Global.YES);
|
|
|
+ logisticsOrderCirculateDao.updateById(circulate);
|
|
|
+
|
|
|
+ /**2Mongodb数据更新**/
|
|
|
+ SckwWaybillOrder wOrder = new SckwWaybillOrder();
|
|
|
+ wOrder.set_id(circulate.getId());
|
|
|
+ wOrder.setStatus(CarWaybillEnum.REJECT_ORDER.getCode());
|
|
|
+ wOrder.setUpdateTime(circulate.getUpdateTime());
|
|
|
+ wOrder.setUpdateBy(circulate.getUpdateBy());
|
|
|
+ //rabbitMq业务汇总数据发送/消费对象
|
|
|
+ SckwBusSum busSum = new SckwBusSum();
|
|
|
+ //业务汇总类型
|
|
|
+ busSum.setBusSumType(BusinessTypeEnum.WAYBILL_ORDER_TYPE.getName());
|
|
|
+ //操作对象(1新增/2修改/3替换数据)
|
|
|
+ busSum.setMethod(2);
|
|
|
+ //业务汇总数据对象
|
|
|
+ busSum.setObject(wOrder);
|
|
|
+ streamBridge.send("sckw-busSum", busSum);
|
|
|
+
|
|
|
+ /**3发送消息**/
|
|
|
+ }
|
|
|
+
|
|
|
+ return HttpResult.ok("拒绝接单成功!");
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|