|
|
@@ -9,7 +9,9 @@ import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.sckw.core.common.enums.NumberConstant;
|
|
|
import com.sckw.core.common.enums.StringConstant;
|
|
|
-import com.sckw.core.common.enums.enums.DictEnum;
|
|
|
+import com.sckw.core.common.enums.enums.DictTypeEnum;
|
|
|
+import com.sckw.core.model.enums.CarWaybillEnum;
|
|
|
+import com.sckw.core.model.enums.LogisticsOrderEnum;
|
|
|
import com.sckw.core.model.page.PageHelperUtil;
|
|
|
import com.sckw.core.model.page.PageResult;
|
|
|
import com.sckw.core.utils.CollectionUtils;
|
|
|
@@ -22,25 +24,16 @@ import com.sckw.mongo.enums.BusinessTypeEnum;
|
|
|
import com.sckw.mongo.model.SckwLogisticsOrder;
|
|
|
import com.sckw.mongo.model.SckwWaybillOrder;
|
|
|
import com.sckw.order.api.dubbo.TradeOrderInfoService;
|
|
|
-import com.sckw.order.api.model.AddressInfoDetail;
|
|
|
-import com.sckw.order.api.model.OrderDetailRes;
|
|
|
import com.sckw.product.api.dubbo.GoodsInfoService;
|
|
|
import com.sckw.product.api.model.KwpGoods;
|
|
|
import com.sckw.stream.model.SckwBusSum;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
-import com.sckw.transport.common.enums.CarWaybillEnum;
|
|
|
-import com.sckw.transport.common.enums.LogisticsOrderEnum;
|
|
|
import com.sckw.transport.dao.*;
|
|
|
import com.sckw.transport.model.*;
|
|
|
-import com.sckw.transport.model.dto.CarListDTO;
|
|
|
import com.sckw.transport.model.dto.OrderTakingDTO;
|
|
|
-import com.sckw.transport.model.dto.SendCarDTO;
|
|
|
+import com.sckw.transport.model.dto.SubcontractConsignmentDTO;
|
|
|
import com.sckw.transport.model.param.AcceptCarriageOrderQuery;
|
|
|
-import com.sckw.transport.model.param.LogisticsConsignmentParam;
|
|
|
-import com.sckw.transport.model.vo.AcceptCarriageOrderVO;
|
|
|
-import com.sckw.transport.model.vo.CarWaybillVO;
|
|
|
-import com.sckw.transport.model.vo.ConsignmentVO;
|
|
|
-import com.sckw.transport.model.vo.WaybillDetailVO;
|
|
|
+import com.sckw.transport.model.vo.*;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
@@ -140,10 +133,11 @@ public class AcceptCarriageOrderService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public HttpResult subcontractConsignment(LogisticsConsignmentParam bo) {
|
|
|
- OrderDetailRes tradeOrder = tradeOrderInfoService.getOrderDetailById(Long.parseLong(bo.getTOrderId()));
|
|
|
- if (tradeOrder == null) {
|
|
|
- log.error("订单id查找失败:{}", bo.getTOrderId());
|
|
|
+ public HttpResult subcontractConsignment(SubcontractConsignmentDTO bo) {
|
|
|
+ KwtLogisticsOrder logisticsOrder = logisticsOrderMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrder>()
|
|
|
+ .eq(KwtLogisticsOrder::getId, bo.getLOrderId()));
|
|
|
+ if (logisticsOrder == null) {
|
|
|
+ log.error("订单id查找失败:{},订单编号:{}", bo.getOrderId(), bo.getLOrderNo());
|
|
|
throw new RuntimeException("单据错误,数据不存在");
|
|
|
}
|
|
|
KwtLogisticsOrder order = new KwtLogisticsOrder();
|
|
|
@@ -151,7 +145,7 @@ public class AcceptCarriageOrderService {
|
|
|
Long amount = bo.getAmount();
|
|
|
Long carryingCapacity = bo.getCarryingCapacity();
|
|
|
if (carryingCapacity > amount) {
|
|
|
- log.error("运订单分包托运-可分配量分配错误:{}", bo.getTOrderId());
|
|
|
+ log.error("运订单分包托运-可分配量分配错误:{}", bo.getOrderId());
|
|
|
throw new RuntimeException("可分配量分配错误");
|
|
|
}
|
|
|
if (ArrayUtil.isEmpty(bo.getCarryingCapacity())) {
|
|
|
@@ -174,8 +168,6 @@ public class AcceptCarriageOrderService {
|
|
|
if (count >= NumberConstant.TWO) {
|
|
|
throw new RuntimeException("分包次数已达上限!");
|
|
|
}
|
|
|
- KwtLogisticsOrder logisticsOrder = logisticsOrderMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrder>()
|
|
|
- .eq(KwtLogisticsOrder::getId, bo.getLOrderId()));
|
|
|
String pids = logisticsOrder.getPids();
|
|
|
if (StringUtils.isNotBlank(pids)) {
|
|
|
pids = pids + StringConstant.SEMICOLON + orderId;
|
|
|
@@ -183,36 +175,34 @@ public class AcceptCarriageOrderService {
|
|
|
pids = bo.getLOrderId() + StringConstant.SEMICOLON + orderId;
|
|
|
}
|
|
|
insertSubcontractLogisticsGoods(bo, lOrderNo, orderId);
|
|
|
- insertSubcontractLogisticsOrder(bo, lOrderNo, order, tradeOrder, orderId, pids);
|
|
|
+ insertSubcontractLogisticsOrder(bo, lOrderNo, order, orderId, pids);
|
|
|
insertSubcontractLogisticsOrderContract(bo, orderId);
|
|
|
insertSubcontractLogisticsOrderUnit(bo, orderId);
|
|
|
- insertSubcontractLogisticsOrderAddress(bo, orderId);
|
|
|
+ insertSubcontractLogisticsOrderAddress(bo, orderId, logisticsOrder);
|
|
|
insertLogisticsOrderTrack(bo, orderId);
|
|
|
//修改上级分配量以及可分配量委托量等
|
|
|
logisticsOrder.setSubcontractAmount(logisticsOrder.getSubcontractAmount().add(new BigDecimal(bo.getCarryingCapacity())));
|
|
|
- subcontractSendMongoDB(lOrderNo, orderId, bo, tradeOrder);
|
|
|
+ subcontractSendMongoDB(lOrderNo, orderId, bo, logisticsOrder);
|
|
|
return HttpResult.ok();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 推送数据到MongoDB
|
|
|
*
|
|
|
- * @param lOrderNo 物流订单编号
|
|
|
- * @param orderId 物流订单id
|
|
|
- * @param bo 页面传输实体
|
|
|
- * @param tradeOrder 贸易订单信息
|
|
|
+ * @param lOrderNo 物流订单编号
|
|
|
+ * @param orderId 物流订单id
|
|
|
+ * @param bo 页面传输实体
|
|
|
+ * @param kwtLogisticsOrder 物流订单数据(上一级)
|
|
|
*/
|
|
|
- private void subcontractSendMongoDB(String lOrderNo, Long orderId, LogisticsConsignmentParam bo, OrderDetailRes tradeOrder) {
|
|
|
+ private void subcontractSendMongoDB(String lOrderNo, Long orderId, SubcontractConsignmentDTO bo, KwtLogisticsOrder kwtLogisticsOrder) {
|
|
|
SckwLogisticsOrder logisticsOrder = new SckwLogisticsOrder();
|
|
|
logisticsOrder.setLOrderId(orderId);
|
|
|
logisticsOrder.setLOrderNo(lOrderNo);
|
|
|
logisticsOrder.setLOrderPid(Long.parseLong(bo.getLOrderId()));
|
|
|
- logisticsOrder.setTOrderId(tradeOrder.getId());
|
|
|
- logisticsOrder.setTOrderNo("D" + com.sckw.transport.utils.StringUtils.getWaybillNoUtil());
|
|
|
logisticsOrder.setSettlementCycle(bo.getSettlementCycle());
|
|
|
logisticsOrder.setPrice(new BigDecimal(bo.getPrice()));
|
|
|
- logisticsOrder.setPriceType(remoteSystemService.queryDictByTypeAndValue(DictEnum.PRICE_TYPE_0.getType(), bo.getPriceType()) == null ?
|
|
|
- null : Long.parseLong(remoteSystemService.queryDictByTypeAndValue(DictEnum.PRICE_TYPE_0.getType(), bo.getPriceType()).getValue()));
|
|
|
+ logisticsOrder.setPriceType(remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.PRICE_TYPE.getType(), bo.getPriceType()) == null ?
|
|
|
+ null : Long.parseLong(remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.PRICE_TYPE.getType(), bo.getPriceType()).getValue()));
|
|
|
if (!bo.getIsFullDose()) {
|
|
|
if (ArrayUtil.isEmpty(bo.getCarryingCapacity())) {
|
|
|
throw new RuntimeException("不是全量分配时,分配量不能为空!");
|
|
|
@@ -255,28 +245,31 @@ public class AcceptCarriageOrderService {
|
|
|
logisticsOrder.setCarrierEntId(Long.parseLong(bo.getConsignCompanyId()));
|
|
|
logisticsOrder.setCarrierFirmName(bo.getConsignCompany());
|
|
|
logisticsOrder.setCarrierContacts(bo.getConsignContacts());
|
|
|
- List<AddressInfoDetail> addressInfo = tradeOrder.getAddressInfo();
|
|
|
- for (AddressInfoDetail detail : addressInfo) {
|
|
|
- if (String.valueOf(NumberConstant.ONE).equals(detail.getAddressType())) {
|
|
|
- logisticsOrder.setLoadType(Long.parseLong(detail.getType()));
|
|
|
- logisticsOrder.setLoadCityCode(detail.getCityCode());
|
|
|
- logisticsOrder.setLoadCityName(detail.getCityName());
|
|
|
- logisticsOrder.setLoadDetailAddress(detail.getDetailAddress());
|
|
|
- logisticsOrder.setLoadLat(detail.getLat());
|
|
|
- logisticsOrder.setLoadPhone(detail.getPhone());
|
|
|
- logisticsOrder.setLoadLng(detail.getLng());
|
|
|
- logisticsOrder.setLoadContacts(detail.getContacts());
|
|
|
- }
|
|
|
- if (String.valueOf(NumberConstant.TWO).equals(detail.getAddressType())) {
|
|
|
- logisticsOrder.setUnloadType(Long.parseLong(detail.getType()));
|
|
|
- logisticsOrder.setUnloadPhone(detail.getPhone());
|
|
|
- logisticsOrder.setUnloadCityCode(detail.getCityCode());
|
|
|
- logisticsOrder.setUnloadCityName(detail.getCityName());
|
|
|
- logisticsOrder.setUnloadDetailAddress(detail.getDetailAddress());
|
|
|
- logisticsOrder.setUnloadLat(detail.getLat());
|
|
|
- logisticsOrder.setUnloadLng(detail.getLng());
|
|
|
- logisticsOrder.setUnloadContacts(detail.getContacts());
|
|
|
- }
|
|
|
+ KwtLogisticsOrderAddress orderLoadAddress = logisticsOrderAddressMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrderAddress>()
|
|
|
+ .eq(KwtLogisticsOrderAddress::getLOrderId, kwtLogisticsOrder.getId())
|
|
|
+ .eq(KwtLogisticsOrderAddress::getAddressType, NumberConstant.ONE));
|
|
|
+ KwtLogisticsOrderAddress orderUnLoadAddress = logisticsOrderAddressMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrderAddress>()
|
|
|
+ .eq(KwtLogisticsOrderAddress::getLOrderId, kwtLogisticsOrder.getId())
|
|
|
+ .eq(KwtLogisticsOrderAddress::getAddressType, NumberConstant.TWO));
|
|
|
+ if (!ObjectUtils.isEmpty(orderLoadAddress)) {
|
|
|
+ logisticsOrder.setLoadType(orderLoadAddress.getType());
|
|
|
+ logisticsOrder.setLoadCityCode(orderLoadAddress.getCityCode());
|
|
|
+ logisticsOrder.setLoadCityName(orderLoadAddress.getCityName());
|
|
|
+ logisticsOrder.setLoadDetailAddress(orderLoadAddress.getDetailAddress());
|
|
|
+ logisticsOrder.setLoadLat(orderLoadAddress.getLat());
|
|
|
+ logisticsOrder.setLoadPhone(orderLoadAddress.getPhone());
|
|
|
+ logisticsOrder.setLoadLng(orderLoadAddress.getLng());
|
|
|
+ logisticsOrder.setLoadContacts(orderLoadAddress.getContacts());
|
|
|
+ }
|
|
|
+ if (!ObjectUtils.isEmpty(orderUnLoadAddress)) {
|
|
|
+ logisticsOrder.setUnloadType(orderUnLoadAddress.getType());
|
|
|
+ logisticsOrder.setUnloadPhone(orderUnLoadAddress.getPhone());
|
|
|
+ logisticsOrder.setUnloadCityCode(orderUnLoadAddress.getCityCode());
|
|
|
+ logisticsOrder.setUnloadCityName(orderUnLoadAddress.getCityName());
|
|
|
+ logisticsOrder.setUnloadDetailAddress(orderUnLoadAddress.getDetailAddress());
|
|
|
+ logisticsOrder.setUnloadLat(orderUnLoadAddress.getLat());
|
|
|
+ logisticsOrder.setUnloadLng(orderUnLoadAddress.getLng());
|
|
|
+ logisticsOrder.setUnloadContacts(orderUnLoadAddress.getContacts());
|
|
|
}
|
|
|
//TODO 生成时并无时间
|
|
|
// logisticsOrder.setLoadTime();
|
|
|
@@ -307,7 +300,7 @@ public class AcceptCarriageOrderService {
|
|
|
* @param bo
|
|
|
* @param orderId
|
|
|
*/
|
|
|
- private void insertLogisticsOrderTrack(LogisticsConsignmentParam bo, Long orderId) {
|
|
|
+ private void insertLogisticsOrderTrack(SubcontractConsignmentDTO bo, Long orderId) {
|
|
|
KwtLogisticsOrderTrack entity = new KwtLogisticsOrderTrack();
|
|
|
entity.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
entity.setLOrderId(orderId);
|
|
|
@@ -325,55 +318,52 @@ public class AcceptCarriageOrderService {
|
|
|
*
|
|
|
* @param bo
|
|
|
* @param orderId
|
|
|
+ * @param logisticsOrder
|
|
|
*/
|
|
|
- private void insertSubcontractLogisticsOrderAddress(LogisticsConsignmentParam bo, Long orderId) {
|
|
|
+ private void insertSubcontractLogisticsOrderAddress(SubcontractConsignmentDTO bo, Long orderId, KwtLogisticsOrder logisticsOrder) {
|
|
|
KwtLogisticsOrderAddress loadOrderAddress = new KwtLogisticsOrderAddress();
|
|
|
KwtLogisticsOrderAddress unloadOrderAddress = new KwtLogisticsOrderAddress();
|
|
|
- OrderDetailRes orderDetailRes = tradeOrderInfoService.getOrderDetailById(Long.parseLong(bo.getTOrderId()));
|
|
|
- if (ObjectUtils.isEmpty(orderDetailRes)) {
|
|
|
- log.info("dubbp 查询数据 error :orderId:{}", bo.getTOrderId());
|
|
|
- throw new RuntimeException("dubbp 查询销售订单数据查找失败!");
|
|
|
+ KwtLogisticsOrderAddress orderLoadAddress = logisticsOrderAddressMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrderAddress>()
|
|
|
+ .eq(KwtLogisticsOrderAddress::getLOrderId, logisticsOrder.getId())
|
|
|
+ .eq(KwtLogisticsOrderAddress::getAddressType, NumberConstant.ONE));
|
|
|
+ KwtLogisticsOrderAddress orderUnLoadAddress = logisticsOrderAddressMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrderAddress>()
|
|
|
+ .eq(KwtLogisticsOrderAddress::getLOrderId, logisticsOrder.getId())
|
|
|
+ .eq(KwtLogisticsOrderAddress::getAddressType, NumberConstant.TWO));
|
|
|
+ if (!ObjectUtils.isEmpty(orderLoadAddress)) {
|
|
|
+ loadOrderAddress.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
+ loadOrderAddress.setAddressType(NumberConstant.ONE);
|
|
|
+ loadOrderAddress.setDetailAddress(orderLoadAddress.getDetailAddress());
|
|
|
+ loadOrderAddress.setContacts(orderLoadAddress.getContacts());
|
|
|
+ loadOrderAddress.setLOrderId(orderId);
|
|
|
+ loadOrderAddress.setLat(orderLoadAddress.getLat());
|
|
|
+ loadOrderAddress.setFence(orderLoadAddress.getFence());
|
|
|
+ loadOrderAddress.setCityName(orderLoadAddress.getCityName());
|
|
|
+ loadOrderAddress.setEntryType(NumberConstant.FOUR);
|
|
|
+ loadOrderAddress.setCreateTime(new Date());
|
|
|
+ loadOrderAddress.setPhone(orderLoadAddress.getPhone());
|
|
|
+ loadOrderAddress.setCreateBy(LoginUserHolder.getUserId());
|
|
|
+ loadOrderAddress.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
+ loadOrderAddress.setUpdateTime(new Date());
|
|
|
+ logisticsOrderAddressMapper.insert(loadOrderAddress);
|
|
|
}
|
|
|
- List<AddressInfoDetail> addressInfo = orderDetailRes.getAddressInfo();
|
|
|
- if (CollectionUtils.isNotEmpty(addressInfo)) {
|
|
|
- for (AddressInfoDetail detail : addressInfo) {
|
|
|
- if (String.valueOf(NumberConstant.ONE).equals(detail.getAddressType())) {
|
|
|
- loadOrderAddress.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
- loadOrderAddress.setAddressType(NumberConstant.ONE);
|
|
|
- loadOrderAddress.setDetailAddress(detail.getDetailAddress());
|
|
|
- loadOrderAddress.setContacts(detail.getContacts());
|
|
|
- loadOrderAddress.setLOrderId(orderId);
|
|
|
- loadOrderAddress.setLat(detail.getLat());
|
|
|
- loadOrderAddress.setFence(detail.getFence());
|
|
|
- loadOrderAddress.setCityName(detail.getCityName());
|
|
|
- loadOrderAddress.setEntryType(NumberConstant.FOUR);
|
|
|
- loadOrderAddress.setCreateTime(new Date());
|
|
|
- loadOrderAddress.setPhone(detail.getPhone());
|
|
|
- loadOrderAddress.setCreateBy(LoginUserHolder.getUserId());
|
|
|
- loadOrderAddress.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
- loadOrderAddress.setUpdateTime(new Date());
|
|
|
- }
|
|
|
- if (String.valueOf(NumberConstant.TWO).equals(detail.getAddressType())) {
|
|
|
- unloadOrderAddress.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
- unloadOrderAddress.setAddressType(NumberConstant.TWO);
|
|
|
- unloadOrderAddress.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
- unloadOrderAddress.setContacts(detail.getContacts());
|
|
|
- unloadOrderAddress.setLOrderId(orderId);
|
|
|
- unloadOrderAddress.setLat(detail.getLat());
|
|
|
- unloadOrderAddress.setFence(detail.getFence());
|
|
|
- unloadOrderAddress.setCityName(detail.getCityName());
|
|
|
- unloadOrderAddress.setEntryType(NumberConstant.FOUR);
|
|
|
- unloadOrderAddress.setPhone(detail.getPhone());
|
|
|
- unloadOrderAddress.setDetailAddress(detail.getDetailAddress());
|
|
|
- unloadOrderAddress.setCreateTime(new Date());
|
|
|
- unloadOrderAddress.setCreateBy(LoginUserHolder.getUserId());
|
|
|
- unloadOrderAddress.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
- unloadOrderAddress.setUpdateTime(new Date());
|
|
|
- }
|
|
|
- }
|
|
|
+ if (!ObjectUtils.isEmpty(orderUnLoadAddress)) {
|
|
|
+ unloadOrderAddress.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
+ unloadOrderAddress.setAddressType(NumberConstant.TWO);
|
|
|
+ unloadOrderAddress.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
+ unloadOrderAddress.setContacts(orderUnLoadAddress.getContacts());
|
|
|
+ unloadOrderAddress.setLOrderId(orderId);
|
|
|
+ unloadOrderAddress.setLat(orderUnLoadAddress.getLat());
|
|
|
+ unloadOrderAddress.setFence(orderUnLoadAddress.getFence());
|
|
|
+ unloadOrderAddress.setCityName(orderUnLoadAddress.getCityName());
|
|
|
+ unloadOrderAddress.setEntryType(NumberConstant.FOUR);
|
|
|
+ unloadOrderAddress.setPhone(orderUnLoadAddress.getPhone());
|
|
|
+ unloadOrderAddress.setDetailAddress(orderUnLoadAddress.getDetailAddress());
|
|
|
+ unloadOrderAddress.setCreateTime(new Date());
|
|
|
+ unloadOrderAddress.setCreateBy(LoginUserHolder.getUserId());
|
|
|
+ unloadOrderAddress.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
+ unloadOrderAddress.setUpdateTime(new Date());
|
|
|
+ logisticsOrderAddressMapper.insert(unloadOrderAddress);
|
|
|
}
|
|
|
- logisticsOrderAddressMapper.insert(loadOrderAddress);
|
|
|
- logisticsOrderAddressMapper.insert(unloadOrderAddress);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -382,7 +372,7 @@ public class AcceptCarriageOrderService {
|
|
|
* @param bo
|
|
|
* @param orderId
|
|
|
*/
|
|
|
- private void insertSubcontractLogisticsOrderUnit(LogisticsConsignmentParam bo, Long orderId) {
|
|
|
+ private void insertSubcontractLogisticsOrderUnit(SubcontractConsignmentDTO bo, Long orderId) {
|
|
|
KwtLogisticsOrderUnit checkUnit = new KwtLogisticsOrderUnit()
|
|
|
.setLOrderId(orderId)
|
|
|
.setId(new IdWorker(NumberConstant.ONE).nextId())
|
|
|
@@ -420,7 +410,7 @@ public class AcceptCarriageOrderService {
|
|
|
* @param bo
|
|
|
* @param orderId
|
|
|
*/
|
|
|
- private void insertSubcontractLogisticsOrderContract(LogisticsConsignmentParam bo, Long orderId) {
|
|
|
+ private void insertSubcontractLogisticsOrderContract(SubcontractConsignmentDTO bo, Long orderId) {
|
|
|
KwtLogisticsOrderContract kwtLogisticsOrderContract = new KwtLogisticsOrderContract();
|
|
|
kwtLogisticsOrderContract.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
kwtLogisticsOrderContract.setLOrderId(orderId);
|
|
|
@@ -439,17 +429,16 @@ public class AcceptCarriageOrderService {
|
|
|
* @param bo
|
|
|
* @param lOrderNo
|
|
|
* @param order
|
|
|
- * @param tradeOrder
|
|
|
* @param orderId
|
|
|
* @param pids
|
|
|
*/
|
|
|
- private void insertSubcontractLogisticsOrder(LogisticsConsignmentParam bo, String lOrderNo,
|
|
|
- KwtLogisticsOrder order, OrderDetailRes tradeOrder,
|
|
|
+ private void insertSubcontractLogisticsOrder(SubcontractConsignmentDTO bo, String lOrderNo,
|
|
|
+ KwtLogisticsOrder order,
|
|
|
Long orderId, String pids) {
|
|
|
order.setId(orderId);
|
|
|
order.setEntId(LoginUserHolder.getEntId());
|
|
|
- order.setTOrderId(Long.parseLong(bo.getTOrderId()));
|
|
|
- order.setTOrderNo(bo.getTOrderNo());
|
|
|
+ order.setTOrderId(order.getTOrderId());
|
|
|
+ order.setTOrderNo(order.getTOrderNo());
|
|
|
order.setLOrderNo(lOrderNo);
|
|
|
//分包时,存放分包上级id
|
|
|
order.setPid(Long.parseLong(bo.getLOrderId()));
|
|
|
@@ -457,22 +446,22 @@ public class AcceptCarriageOrderService {
|
|
|
order.setPids(pids);
|
|
|
order.setSettlementCycle(bo.getSettlementCycle());
|
|
|
order.setPrice(new BigDecimal(bo.getPrice()));
|
|
|
- order.setPriceType(remoteSystemService.queryDictByTypeAndValue(DictEnum.PRICE_TYPE_0.getType(), bo.getPriceType()) == null ?
|
|
|
- null : Long.parseLong(remoteSystemService.queryDictByTypeAndValue(DictEnum.PRICE_TYPE_0.getType(), bo.getPriceType()).getValue()));
|
|
|
+ order.setPriceType(remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.PRICE_TYPE.getType(), bo.getPriceType()) == null ?
|
|
|
+ null : Long.parseLong(remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.PRICE_TYPE.getType(), bo.getPriceType()).getValue()));
|
|
|
order.setAmount(new BigDecimal(bo.getCarryingCapacity()));
|
|
|
order.setBillingMode(bo.getBillingMode());
|
|
|
order.setLoss(new BigDecimal(bo.getLoss()));
|
|
|
order.setLossUnit(bo.getLossUnit());
|
|
|
- order.setLossUnit(remoteSystemService.queryDictByTypeAndValue(DictEnum.UNIT_TYPE_0.getType(), bo.getLossUnit()) == null ?
|
|
|
- null : remoteSystemService.queryDictByTypeAndValue(DictEnum.UNIT_TYPE_0.getType(), bo.getLossUnit()).getValue());
|
|
|
+ order.setLossUnit(remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.UNIT_TYPE.getType(), bo.getLossUnit()) == null ?
|
|
|
+ null : remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.UNIT_TYPE.getType(), bo.getLossUnit()).getValue());
|
|
|
order.setGoodsPrice(new BigDecimal(bo.getGoodsPrice()));
|
|
|
- order.setGoodsPriceUnit(remoteSystemService.queryDictByTypeAndValue(DictEnum.PRICE_TYPE_0.getType(), bo.getGoodsPriceUnit()) == null ?
|
|
|
- null : remoteSystemService.queryDictByTypeAndValue(DictEnum.PRICE_TYPE_0.getType(), bo.getGoodsPriceUnit()).getValue());
|
|
|
+ order.setGoodsPriceUnit(remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.PRICE_TYPE.getType(), bo.getGoodsPriceUnit()) == null ?
|
|
|
+ null : remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.PRICE_TYPE.getType(), bo.getGoodsPriceUnit()).getValue());
|
|
|
order.setGoodsPriceUnit(bo.getGoodsPriceUnit());
|
|
|
order.setStartTime(bo.getShipmentsDateTime());
|
|
|
- order.setEntTime(bo.getReceiveGoodsDateTime());
|
|
|
+ order.setEndTime(bo.getReceiveGoodsDateTime());
|
|
|
order.setRemark(bo.getRemark());
|
|
|
- order.setPayment(Long.parseLong(tradeOrder.getTrading()));
|
|
|
+ order.setPayment(order.getPayment());
|
|
|
order.setTaxRate(new BigDecimal(bo.getTaxRate()));
|
|
|
order.setCreateBy(LoginUserHolder.getUserId());
|
|
|
order.setCreateTime(new Date());
|
|
|
@@ -497,7 +486,7 @@ public class AcceptCarriageOrderService {
|
|
|
* @param lOrderNo
|
|
|
* @param orderId
|
|
|
*/
|
|
|
- private void insertSubcontractLogisticsGoods(LogisticsConsignmentParam bo, String lOrderNo, Long orderId) {
|
|
|
+ private void insertSubcontractLogisticsGoods(SubcontractConsignmentDTO bo, String lOrderNo, Long orderId) {
|
|
|
KwtLogisticsOrderGoods kwtLogisticsOrderGoods = new KwtLogisticsOrderGoods();
|
|
|
kwtLogisticsOrderGoods.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
kwtLogisticsOrderGoods.setGoodsId(Long.parseLong(bo.getGoodsId()));
|
|
|
@@ -553,125 +542,123 @@ public class AcceptCarriageOrderService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 派车
|
|
|
- *
|
|
|
- * @param sendCarDTO
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public HttpResult commitSendCar(SendCarDTO sendCarDTO) {
|
|
|
- log.info("承运订单提交派车信息详情:{}", JSONObject.toJSONString(sendCarDTO));
|
|
|
- HttpResult result = new HttpResult();
|
|
|
- KwtLogisticsOrder logisticsOrder = logisticsOrderMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrder>()
|
|
|
- .eq(StringUtils.isNotBlank(sendCarDTO.getLOrderId()), KwtLogisticsOrder::getId, sendCarDTO.getLOrderId()));
|
|
|
- if (logisticsOrder == null) {
|
|
|
- result.setCode(HttpStatus.GLOBAL_EXCEPTION_CODE);
|
|
|
- result.setMsg("单据不存在!");
|
|
|
- return result;
|
|
|
- }
|
|
|
- List<SckwWaybillOrder> list = new ArrayList<>();
|
|
|
- if (String.valueOf(NumberConstant.ONE).equals(sendCarDTO.getType())) {
|
|
|
- for (CarListDTO car : sendCarDTO.getCarList()) {
|
|
|
- if (ObjectUtils.isEmpty(car.getCount())) {
|
|
|
- throw new RuntimeException("趟次派车时,趟次次数不能为空");
|
|
|
- }
|
|
|
- for (int i = 0; i < car.getCount(); i++) {
|
|
|
- Long wOrderId = new IdWorker(NumberConstant.ONE).nextId();
|
|
|
- String wOrderNo = com.sckw.transport.utils.StringUtils.getWaybillNoUtil() + i;
|
|
|
- KwtWaybillOrder waybillOrder = new KwtWaybillOrder();
|
|
|
- String type = String.valueOf(NumberConstant.ZERO);
|
|
|
- waybillOrder.setType(type);
|
|
|
- waybillOrder.setEntrustAmount(new BigDecimal(car.getLoadAmount()));
|
|
|
- insertWaybillOrder(waybillOrder, wOrderId, wOrderNo, logisticsOrder, car, sendCarDTO, list, type);
|
|
|
- //insertWaybillOrderTicket(id,wOrderNo,logisticsOrder,sendCarDTO);
|
|
|
-// insertWaybillOrderTrack(wOrderId);
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (String.valueOf(NumberConstant.TWO).equals(sendCarDTO.getType())) {
|
|
|
- for (CarListDTO car : sendCarDTO.getCarList()) {
|
|
|
- if (ObjectUtils.isEmpty(sendCarDTO.getWaitingVolume())) {
|
|
|
- throw new RuntimeException("循环派车时,剩余可运量不能为空");
|
|
|
- }
|
|
|
- for (int i = 0; i < car.getCount(); i++) {
|
|
|
- KwtLogisticsOrderCirculate circulate = new KwtLogisticsOrderCirculate();
|
|
|
- circulate.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
- circulate.setEntId(logisticsOrder.getEntId());
|
|
|
- circulate.setLOrderId(Long.parseLong(sendCarDTO.getLOrderId()));
|
|
|
- circulate.setTruckNo(car.getTruckNo());
|
|
|
- circulate.setDriverId(Long.parseLong(car.getDriverId()));
|
|
|
- circulate.setActualAmount(new BigDecimal(car.getLoadAmount()));
|
|
|
- circulate.setEntrustAmount(new BigDecimal(sendCarDTO.getWaitingVolume()));
|
|
|
- circulate.setEntrustDate(new Date());
|
|
|
- circulate.setCreateBy(LoginUserHolder.getUserId());
|
|
|
- circulate.setCreateTime(new Date());
|
|
|
- circulate.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
- circulate.setUpdateTime(new Date());
|
|
|
- circulate.setType(String.valueOf(NumberConstant.ONE));
|
|
|
- logisticsOrderCirculateMapper.insert(circulate);
|
|
|
- sendMongoDbData(list, logisticsOrder, car, sendCarDTO, String.valueOf(NumberConstant.ONE));
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- result.setCode(HttpStatus.GLOBAL_EXCEPTION_CODE);
|
|
|
- result.setMsg("派车类型错误!");
|
|
|
- return result;
|
|
|
- }
|
|
|
- if (CollectionUtils.isNotEmpty(list)) {
|
|
|
- for (SckwWaybillOrder sckwWaybillOrder : list) {
|
|
|
- //rabbitMq业务汇总数据发送/消费对象
|
|
|
- SckwBusSum busSum = new SckwBusSum();
|
|
|
- //业务汇总类型
|
|
|
- busSum.setBusSumType(BusinessTypeEnum.WAYBILL_ORDER_TYPE.getName());
|
|
|
- //操作对象(1新增/2修改)
|
|
|
- busSum.setMethod(1);
|
|
|
- //业务汇总数据对象
|
|
|
- busSum.setObject(sckwWaybillOrder);
|
|
|
- streamBridge.send("sckw-busSum", JSON.toJSONString(busSum));
|
|
|
- }
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- private void sendMongoDbData(List<SckwWaybillOrder> list, KwtLogisticsOrder logisticsOrder
|
|
|
- , CarListDTO carListDTO, SendCarDTO sendCarDTO, String type) {
|
|
|
- //放入mongodb实体
|
|
|
- SckwWaybillOrder waybillCarDTO = new SckwWaybillOrder();
|
|
|
- waybillCarDTO.set_id(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
- waybillCarDTO.setStatus(CarWaybillEnum.PENDING_ORDER.getCode().toString());
|
|
|
- waybillCarDTO.setType(type);
|
|
|
- waybillCarDTO.setLOrderId(StringUtils.isBlank(sendCarDTO.getLOrderId()) ? null : Long.parseLong(sendCarDTO.getLOrderId()));
|
|
|
- waybillCarDTO.setLOrderNo(sendCarDTO.getLOrderNo());
|
|
|
- waybillCarDTO.setTOrderId(logisticsOrder.getTOrderId());
|
|
|
- waybillCarDTO.setTOrderNo(logisticsOrder.getTOrderNo());
|
|
|
- waybillCarDTO.setEntId(logisticsOrder.getEntId());
|
|
|
- waybillCarDTO.setFirmName(remoteSystemService.queryEntCacheById(logisticsOrder.getEntId()).getFirmName());
|
|
|
- waybillCarDTO.setTruckNo(carListDTO.getTruckNo());
|
|
|
- //todo 司机dubbo查询
|
|
|
-// waybillCarDTO.setTruckType();
|
|
|
-// waybillCarDTO.setTruckEnergyType();
|
|
|
-// waybillCarDTO.setTruckColor()
|
|
|
-// waybillCarDTO.setTruckTrailerNo();
|
|
|
-// waybillCarDTO.setTruckFleetName();
|
|
|
- waybillCarDTO.setDriverId(StringUtils.isBlank(carListDTO.getDriverId()) ? null : Long.parseLong(carListDTO.getDriverId()));
|
|
|
-// waybillCarDTO.setDriverPhone();
|
|
|
-// waybillCarDTO.setDriverIdcard();
|
|
|
- waybillCarDTO.setDriverName(carListDTO.getDriverName());
|
|
|
- waybillCarDTO.setStartTime(sendCarDTO.getLoadDateTime());
|
|
|
- waybillCarDTO.setEndTime(sendCarDTO.getUnloadDateTime());
|
|
|
- waybillCarDTO.setFleetId(carListDTO.getFleetId());
|
|
|
- waybillCarDTO.setFleetName(carListDTO.getFleetName());
|
|
|
- waybillCarDTO.setGoodsName(sendCarDTO.getGoodsName());
|
|
|
- waybillCarDTO.setGoodsId(StringUtils.isBlank(sendCarDTO.getGoodsId()) ? null : Integer.valueOf(sendCarDTO.getGoodsId()));
|
|
|
- waybillCarDTO.setLoadingCity(sendCarDTO.getLoadCity());
|
|
|
- waybillCarDTO.setLoadTime(sendCarDTO.getLoadDateTime());
|
|
|
- waybillCarDTO.setLoadingAddress(sendCarDTO.getLoadAddress());
|
|
|
- waybillCarDTO.setUnloadingCity(sendCarDTO.getUnloadCity());
|
|
|
- waybillCarDTO.setUnloadTime(sendCarDTO.getUnloadDateTime());
|
|
|
- waybillCarDTO.setUnloadingAddress(sendCarDTO.getUnloadAddress());
|
|
|
- waybillCarDTO.setDelFlag(Integer.valueOf(NumberConstant.ZERO));
|
|
|
- list.add(waybillCarDTO);
|
|
|
- }
|
|
|
+// /**
|
|
|
+// * 派车
|
|
|
+// *
|
|
|
+// * @param sendCarDTO
|
|
|
+// * @return
|
|
|
+// */
|
|
|
+// @Transactional(rollbackFor = Exception.class)
|
|
|
+// public HttpResult commitSendCar(SendCarDTO sendCarDTO) {
|
|
|
+// log.info("承运订单提交派车信息详情:{}", JSONObject.toJSONString(sendCarDTO));
|
|
|
+// HttpResult result = new HttpResult();
|
|
|
+// KwtLogisticsOrder logisticsOrder = logisticsOrderMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrder>()
|
|
|
+// .eq(StringUtils.isNotBlank(sendCarDTO.getLOrderId()), KwtLogisticsOrder::getId, sendCarDTO.getLOrderId()));
|
|
|
+// if (logisticsOrder == null) {
|
|
|
+// result.setCode(HttpStatus.GLOBAL_EXCEPTION_CODE);
|
|
|
+// result.setMsg("单据不存在!");
|
|
|
+// return result;
|
|
|
+// }
|
|
|
+// List<SckwWaybillOrder> list = new ArrayList<>();
|
|
|
+// if (String.valueOf(NumberConstant.ONE).equals(sendCarDTO.getType())) {
|
|
|
+// for (CarListDTO car : sendCarDTO.getCarList()) {
|
|
|
+// if (ObjectUtils.isEmpty(car.getCount())) {
|
|
|
+// throw new RuntimeException("趟次派车时,趟次次数不能为空");
|
|
|
+// }
|
|
|
+// for (int i = 0; i < car.getCount(); i++) {
|
|
|
+// Long wOrderId = new IdWorker(NumberConstant.ONE).nextId();
|
|
|
+// String wOrderNo = com.sckw.transport.utils.StringUtils.getWaybillNoUtil() + i;
|
|
|
+// KwtWaybillOrder waybillOrder = new KwtWaybillOrder();
|
|
|
+// String type = String.valueOf(NumberConstant.ZERO);
|
|
|
+// waybillOrder.setType(type);
|
|
|
+// waybillOrder.setEntrustAmount(new BigDecimal(car.getLoadAmount()));
|
|
|
+// insertWaybillOrder(waybillOrder, wOrderId, wOrderNo, logisticsOrder, car, sendCarDTO, list, type);
|
|
|
+// //insertWaybillOrderTicket(id,wOrderNo,logisticsOrder,sendCarDTO);
|
|
|
+//// insertWaybillOrderTrack(wOrderId);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } else if (String.valueOf(NumberConstant.TWO).equals(sendCarDTO.getType())) {
|
|
|
+// for (CarListDTO car : sendCarDTO.getCarList()) {
|
|
|
+// if (ObjectUtils.isEmpty(sendCarDTO.getWaitingVolume())) {
|
|
|
+// throw new RuntimeException("循环派车时,剩余可运量不能为空");
|
|
|
+// }
|
|
|
+// KwtLogisticsOrderCirculate circulate = new KwtLogisticsOrderCirculate();
|
|
|
+// circulate.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
+// circulate.setEntId(logisticsOrder.getEntId());
|
|
|
+// circulate.setLOrderId(Long.parseLong(sendCarDTO.getLOrderId()));
|
|
|
+// circulate.setTruckNo(car.getTruckNo());
|
|
|
+// circulate.setDriverId(Long.parseLong(car.getDriverId()));
|
|
|
+// circulate.setActualAmount(new BigDecimal(car.getLoadAmount()));
|
|
|
+// circulate.setEntrustAmount(new BigDecimal(sendCarDTO.getWaitingVolume()));
|
|
|
+// circulate.setEntrustDate(new Date());
|
|
|
+// circulate.setCreateBy(LoginUserHolder.getUserId());
|
|
|
+// circulate.setCreateTime(new Date());
|
|
|
+// circulate.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
+// circulate.setUpdateTime(new Date());
|
|
|
+// circulate.setType(String.valueOf(NumberConstant.ONE));
|
|
|
+// logisticsOrderCirculateMapper.insert(circulate);
|
|
|
+// sendMongoDbData(list, logisticsOrder, car, sendCarDTO, String.valueOf(NumberConstant.ONE));
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// result.setCode(HttpStatus.GLOBAL_EXCEPTION_CODE);
|
|
|
+// result.setMsg("派车类型错误!");
|
|
|
+// return result;
|
|
|
+// }
|
|
|
+// if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+// for (SckwWaybillOrder sckwWaybillOrder : list) {
|
|
|
+// //rabbitMq业务汇总数据发送/消费对象
|
|
|
+// SckwBusSum busSum = new SckwBusSum();
|
|
|
+// //业务汇总类型
|
|
|
+// busSum.setBusSumType(BusinessTypeEnum.WAYBILL_ORDER_TYPE.getName());
|
|
|
+// //操作对象(1新增/2修改)
|
|
|
+// busSum.setMethod(1);
|
|
|
+// //业务汇总数据对象
|
|
|
+// busSum.setObject(sckwWaybillOrder);
|
|
|
+// streamBridge.send("sckw-busSum", JSON.toJSONString(busSum));
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return result;
|
|
|
+// }
|
|
|
+//
|
|
|
+// private void sendMongoDbData(List<SckwWaybillOrder> list, KwtLogisticsOrder logisticsOrder
|
|
|
+// , CarListDTO carListDTO, SendCarDTO sendCarDTO, String type) {
|
|
|
+// //放入mongodb实体
|
|
|
+// SckwWaybillOrder waybillCarDTO = new SckwWaybillOrder();
|
|
|
+// waybillCarDTO.set_id(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
+// waybillCarDTO.setStatus(CarWaybillEnum.PENDING_ORDER.getCode().toString());
|
|
|
+// waybillCarDTO.setType(type);
|
|
|
+// waybillCarDTO.setLOrderId(StringUtils.isBlank(sendCarDTO.getLOrderId()) ? null : Long.parseLong(sendCarDTO.getLOrderId()));
|
|
|
+// waybillCarDTO.setLOrderNo(sendCarDTO.getLOrderNo());
|
|
|
+// waybillCarDTO.setTOrderId(logisticsOrder.getTOrderId());
|
|
|
+// waybillCarDTO.setTOrderNo(logisticsOrder.getTOrderNo());
|
|
|
+// waybillCarDTO.setEntId(logisticsOrder.getEntId());
|
|
|
+// waybillCarDTO.setFirmName(remoteSystemService.queryEntCacheById(logisticsOrder.getEntId()).getFirmName());
|
|
|
+// waybillCarDTO.setTruckNo(carListDTO.getTruckNo());
|
|
|
+// //todo 司机dubbo查询
|
|
|
+//// waybillCarDTO.setTruckType();
|
|
|
+//// waybillCarDTO.setTruckEnergyType();
|
|
|
+//// waybillCarDTO.setTruckColor()
|
|
|
+//// waybillCarDTO.setTruckTrailerNo();
|
|
|
+//// waybillCarDTO.setTruckFleetName();
|
|
|
+// waybillCarDTO.setDriverId(StringUtils.isBlank(carListDTO.getDriverId()) ? null : Long.parseLong(carListDTO.getDriverId()));
|
|
|
+//// waybillCarDTO.setDriverPhone();
|
|
|
+//// waybillCarDTO.setDriverIdcard();
|
|
|
+// waybillCarDTO.setDriverName(carListDTO.getDriverName());
|
|
|
+// waybillCarDTO.setStartTime(sendCarDTO.getLoadDateTime());
|
|
|
+// waybillCarDTO.setEndTime(sendCarDTO.getUnloadDateTime());
|
|
|
+// waybillCarDTO.setFleetId(carListDTO.getFleetId());
|
|
|
+// waybillCarDTO.setFleetName(carListDTO.getFleetName());
|
|
|
+// waybillCarDTO.setGoodsName(sendCarDTO.getGoodsName());
|
|
|
+// waybillCarDTO.setGoodsId(StringUtils.isBlank(sendCarDTO.getGoodsId()) ? null : Integer.valueOf(sendCarDTO.getGoodsId()));
|
|
|
+// waybillCarDTO.setLoadingCity(sendCarDTO.getLoadCity());
|
|
|
+// waybillCarDTO.setLoadTime(sendCarDTO.getLoadDateTime());
|
|
|
+// waybillCarDTO.setLoadingAddress(sendCarDTO.getLoadAddress());
|
|
|
+// waybillCarDTO.setUnloadingCity(sendCarDTO.getUnloadCity());
|
|
|
+// waybillCarDTO.setUnloadTime(sendCarDTO.getUnloadDateTime());
|
|
|
+// waybillCarDTO.setUnloadingAddress(sendCarDTO.getUnloadAddress());
|
|
|
+// waybillCarDTO.setDelFlag(Integer.valueOf(NumberConstant.ZERO));
|
|
|
+// list.add(waybillCarDTO);
|
|
|
+// }
|
|
|
|
|
|
/**
|
|
|
* 保存车辆运单状态信息
|
|
|
@@ -689,18 +676,18 @@ public class AcceptCarriageOrderService {
|
|
|
track.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
waybillOrderTrackMapper.insert(track);
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 保存车辆装卸单信息
|
|
|
- *
|
|
|
- * @param id
|
|
|
- * @param wOrderNo
|
|
|
- * @param logisticsOrder
|
|
|
- * @param carListDTO
|
|
|
- */
|
|
|
- private void insertWaybillOrderTicket(Long id, String wOrderNo, KwtLogisticsOrder logisticsOrder, CarListDTO carListDTO) {
|
|
|
-
|
|
|
- }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 保存车辆装卸单信息
|
|
|
+// *
|
|
|
+// * @param id
|
|
|
+// * @param wOrderNo
|
|
|
+// * @param logisticsOrder
|
|
|
+// * @param carListDTO
|
|
|
+// */
|
|
|
+// private void insertWaybillOrderTicket(Long id, String wOrderNo, KwtLogisticsOrder logisticsOrder, CarListDTO carListDTO) {
|
|
|
+//
|
|
|
+// }
|
|
|
|
|
|
/**
|
|
|
* 派车主体保存
|
|
|
@@ -710,81 +697,82 @@ public class AcceptCarriageOrderService {
|
|
|
* @param carListDTO
|
|
|
* @param sendCarDTO
|
|
|
*/
|
|
|
- private void insertWaybillOrder(KwtWaybillOrder waybillOrder, Long id, String wOrderNo,
|
|
|
- KwtLogisticsOrder logisticsOrder, CarListDTO carListDTO, SendCarDTO sendCarDTO,
|
|
|
- List<SckwWaybillOrder> list, String type) {
|
|
|
- waybillOrder.setId(id);
|
|
|
- waybillOrder.setEntId(logisticsOrder.getEntId());
|
|
|
- waybillOrder.setLOrderId(Long.parseLong(sendCarDTO.getLOrderId()));
|
|
|
- waybillOrder.setWOrderNo(wOrderNo);
|
|
|
- waybillOrder.setStartTime(sendCarDTO.getLoadDateTime());
|
|
|
- waybillOrder.setEndTime(sendCarDTO.getUnloadDateTime());
|
|
|
- waybillOrder.setDriverId(Long.parseLong(carListDTO.getDriverId()));
|
|
|
- waybillOrder.setTruckNo(carListDTO.getTruckNo());
|
|
|
- waybillOrder.setRemark(sendCarDTO.getRemark());
|
|
|
- waybillOrder.setStatus(NumberConstant.ZERO);
|
|
|
- waybillOrder.setCreateBy(LoginUserHolder.getUserId());
|
|
|
- Date createTime = new Date();
|
|
|
- waybillOrder.setCreateTime(createTime);
|
|
|
- waybillOrder.setUpdateTime(new Date());
|
|
|
- waybillOrder.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
- waybillOrder.setStatus(CarWaybillEnum.PENDING_ORDER.getCode());
|
|
|
- waybillOrderMapper.insert(waybillOrder);
|
|
|
-
|
|
|
- //状态表保存
|
|
|
- KwtWaybillOrderTrack track = new KwtWaybillOrderTrack();
|
|
|
- track.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
- track.setWOrderId(id);
|
|
|
- track.setStatus(CarWaybillEnum.PENDING_ORDER.getCode());
|
|
|
- track.setCreateTime(new Date());
|
|
|
- track.setUpdateTime(new Date());
|
|
|
- track.setCreateBy(LoginUserHolder.getUserId());
|
|
|
- track.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
- waybillOrderTrackMapper.insert(track);
|
|
|
-
|
|
|
- //放入mongodb实体
|
|
|
- SckwWaybillOrder waybillCarDTO = new SckwWaybillOrder();
|
|
|
- waybillCarDTO.setStatus(CarWaybillEnum.PENDING_ORDER.getCode().toString());
|
|
|
- waybillCarDTO.setType(type);
|
|
|
- waybillCarDTO.setWOrderId(id);
|
|
|
- waybillCarDTO.setWOrderNo(wOrderNo);
|
|
|
- waybillCarDTO.setLOrderId(StringUtils.isBlank(sendCarDTO.getLOrderId()) ? null : Long.parseLong(sendCarDTO.getLOrderId()));
|
|
|
- waybillCarDTO.setLOrderNo(sendCarDTO.getLOrderNo());
|
|
|
- waybillCarDTO.setTOrderId(logisticsOrder.getTOrderId());
|
|
|
- waybillCarDTO.setTOrderNo(logisticsOrder.getTOrderNo());
|
|
|
- waybillCarDTO.setEntId(logisticsOrder.getEntId());
|
|
|
- waybillCarDTO.setFirmName(remoteSystemService.queryEntCacheById(logisticsOrder.getEntId()).getFirmName());
|
|
|
- waybillCarDTO.setTruckNo(carListDTO.getTruckNo());
|
|
|
- //todo 司机dubbo查询
|
|
|
-// waybillCarDTO.setTruckType();
|
|
|
-// waybillCarDTO.setTruckEnergyType();
|
|
|
-// waybillCarDTO.setTruckColor()
|
|
|
-// waybillCarDTO.setTruckTrailerNo();
|
|
|
-// waybillCarDTO.setTruckFleetName();
|
|
|
- waybillCarDTO.setDriverId(StringUtils.isBlank(carListDTO.getDriverId()) ? null : Long.parseLong(carListDTO.getDriverId()));
|
|
|
-// waybillCarDTO.setDriverPhone();
|
|
|
-// waybillCarDTO.setDriverIdcard();
|
|
|
- waybillCarDTO.setDriverName(carListDTO.getDriverName());
|
|
|
- waybillCarDTO.setSendCarTime(createTime);
|
|
|
- waybillCarDTO.setStartTime(sendCarDTO.getLoadDateTime());
|
|
|
- waybillCarDTO.setEndTime(sendCarDTO.getUnloadDateTime());
|
|
|
- waybillCarDTO.setFleetId(carListDTO.getFleetId());
|
|
|
- waybillCarDTO.setFleetName(carListDTO.getFleetName());
|
|
|
- waybillCarDTO.setGoodsName(sendCarDTO.getGoodsName());
|
|
|
- waybillCarDTO.setGoodsId(StringUtils.isBlank(sendCarDTO.getGoodsId()) ? null : Integer.valueOf(sendCarDTO.getGoodsId()));
|
|
|
- waybillCarDTO.setEntrustAmount(waybillOrder.getEntrustAmount());
|
|
|
- waybillCarDTO.setLoadingCity(sendCarDTO.getLoadCity());
|
|
|
- waybillCarDTO.setLoadTime(sendCarDTO.getLoadDateTime());
|
|
|
- waybillCarDTO.setLoadingAddress(sendCarDTO.getLoadAddress());
|
|
|
- waybillCarDTO.setUnloadingCity(sendCarDTO.getUnloadCity());
|
|
|
- waybillCarDTO.setUnloadTime(sendCarDTO.getUnloadDateTime());
|
|
|
- waybillCarDTO.setUnloadingAddress(sendCarDTO.getUnloadAddress());
|
|
|
- waybillCarDTO.setDelFlag(Integer.valueOf(NumberConstant.ZERO));
|
|
|
- list.add(waybillCarDTO);
|
|
|
- }
|
|
|
+// private void insertWaybillOrder(KwtWaybillOrder waybillOrder, Long id, String wOrderNo,
|
|
|
+// KwtLogisticsOrder logisticsOrder, CarListDTO carListDTO, SendCarDTO sendCarDTO,
|
|
|
+// List<SckwWaybillOrder> list, String type) {
|
|
|
+// waybillOrder.setId(id);
|
|
|
+// waybillOrder.setEntId(logisticsOrder.getEntId());
|
|
|
+// waybillOrder.setLOrderId(Long.parseLong(sendCarDTO.getLOrderId()));
|
|
|
+// waybillOrder.setWOrderNo(wOrderNo);
|
|
|
+// waybillOrder.setStartTime(sendCarDTO.getLoadDateTime());
|
|
|
+// waybillOrder.setEndTime(sendCarDTO.getUnloadDateTime());
|
|
|
+// waybillOrder.setDriverId(Long.parseLong(carListDTO.getDriverId()));
|
|
|
+// waybillOrder.setTruckNo(carListDTO.getTruckNo());
|
|
|
+// waybillOrder.setRemark(sendCarDTO.getRemark());
|
|
|
+// waybillOrder.setStatus(NumberConstant.ZERO);
|
|
|
+// waybillOrder.setCreateBy(LoginUserHolder.getUserId());
|
|
|
+// Date createTime = new Date();
|
|
|
+// waybillOrder.setCreateTime(createTime);
|
|
|
+// waybillOrder.setUpdateTime(new Date());
|
|
|
+// waybillOrder.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
+// waybillOrder.setStatus(CarWaybillEnum.PENDING_ORDER.getCode());
|
|
|
+// waybillOrderMapper.insert(waybillOrder);
|
|
|
+//
|
|
|
+// //状态表保存
|
|
|
+// KwtWaybillOrderTrack track = new KwtWaybillOrderTrack();
|
|
|
+// track.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
+// track.setWOrderId(id);
|
|
|
+// track.setStatus(CarWaybillEnum.PENDING_ORDER.getCode());
|
|
|
+// track.setCreateTime(new Date());
|
|
|
+// track.setUpdateTime(new Date());
|
|
|
+// track.setCreateBy(LoginUserHolder.getUserId());
|
|
|
+// track.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
+// waybillOrderTrackMapper.insert(track);
|
|
|
+//
|
|
|
+// //放入mongodb实体
|
|
|
+// SckwWaybillOrder waybillCarDTO = new SckwWaybillOrder();
|
|
|
+// waybillCarDTO.setStatus(CarWaybillEnum.PENDING_ORDER.getCode().toString());
|
|
|
+// waybillCarDTO.setType(type);
|
|
|
+// waybillCarDTO.setWOrderId(id);
|
|
|
+// waybillCarDTO.setWOrderNo(wOrderNo);
|
|
|
+// waybillCarDTO.setLOrderId(StringUtils.isBlank(sendCarDTO.getLOrderId()) ? null : Long.parseLong(sendCarDTO.getLOrderId()));
|
|
|
+// waybillCarDTO.setLOrderNo(sendCarDTO.getLOrderNo());
|
|
|
+// waybillCarDTO.setTOrderId(logisticsOrder.getTOrderId());
|
|
|
+// waybillCarDTO.setTOrderNo(logisticsOrder.getTOrderNo());
|
|
|
+// waybillCarDTO.setEntId(logisticsOrder.getEntId());
|
|
|
+// waybillCarDTO.setFirmName(remoteSystemService.queryEntCacheById(logisticsOrder.getEntId()).getFirmName());
|
|
|
+// waybillCarDTO.setTruckNo(carListDTO.getTruckNo());
|
|
|
+// //todo 司机dubbo查询
|
|
|
+//// waybillCarDTO.setTruckType();
|
|
|
+//// waybillCarDTO.setTruckEnergyType();
|
|
|
+//// waybillCarDTO.setTruckColor()
|
|
|
+//// waybillCarDTO.setTruckTrailerNo();
|
|
|
+//// waybillCarDTO.setTruckFleetName();
|
|
|
+// waybillCarDTO.setDriverId(StringUtils.isBlank(carListDTO.getDriverId()) ? null : Long.parseLong(carListDTO.getDriverId()));
|
|
|
+//// waybillCarDTO.setDriverPhone();
|
|
|
+//// waybillCarDTO.setDriverIdcard();
|
|
|
+// waybillCarDTO.setDriverName(carListDTO.getDriverName());
|
|
|
+// waybillCarDTO.setSendCarTime(createTime);
|
|
|
+// waybillCarDTO.setStartTime(sendCarDTO.getLoadDateTime());
|
|
|
+// waybillCarDTO.setEndTime(sendCarDTO.getUnloadDateTime());
|
|
|
+// waybillCarDTO.setFleetId(carListDTO.getFleetId());
|
|
|
+// waybillCarDTO.setFleetName(carListDTO.getFleetName());
|
|
|
+// waybillCarDTO.setGoodsName(sendCarDTO.getGoodsName());
|
|
|
+// waybillCarDTO.setGoodsId(StringUtils.isBlank(sendCarDTO.getGoodsId()) ? null : Integer.valueOf(sendCarDTO.getGoodsId()));
|
|
|
+// waybillCarDTO.setEntrustAmount(waybillOrder.getEntrustAmount());
|
|
|
+// waybillCarDTO.setLoadingCity(sendCarDTO.getLoadCity());
|
|
|
+// waybillCarDTO.setLoadTime(sendCarDTO.getLoadDateTime());
|
|
|
+// waybillCarDTO.setLoadingAddress(sendCarDTO.getLoadAddress());
|
|
|
+// waybillCarDTO.setUnloadingCity(sendCarDTO.getUnloadCity());
|
|
|
+// waybillCarDTO.setUnloadTime(sendCarDTO.getUnloadDateTime());
|
|
|
+// waybillCarDTO.setUnloadingAddress(sendCarDTO.getUnloadAddress());
|
|
|
+// waybillCarDTO.setDelFlag(Integer.valueOf(NumberConstant.ZERO));
|
|
|
+// list.add(waybillCarDTO);
|
|
|
+// }
|
|
|
|
|
|
/**
|
|
|
* 承运订单-获取运单详情
|
|
|
+ *
|
|
|
* @param wOrderId
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -792,7 +780,7 @@ public class AcceptCarriageOrderService {
|
|
|
SckwWaybillOrder sckwWaybillOrder = mongoTemplate.findById(Long.parseLong(wOrderId), SckwWaybillOrder.class);
|
|
|
WaybillDetailVO vo = new WaybillDetailVO();
|
|
|
if (!ObjectUtils.isEmpty(sckwWaybillOrder)) {
|
|
|
- vo.setFleetName(sckwWaybillOrder.getFleetName());
|
|
|
+ //vo.setFleetName(sckwWaybillOrder.getFleetName());
|
|
|
vo.setTruckNo(sckwWaybillOrder.getTruckNo());
|
|
|
vo.setDriverName(sckwWaybillOrder.getDriverName());
|
|
|
vo.setSendCarWeigh(sckwWaybillOrder.getEntrustAmount());
|
|
|
@@ -809,4 +797,31 @@ public class AcceptCarriageOrderService {
|
|
|
}
|
|
|
return HttpResult.ok(vo);
|
|
|
}
|
|
|
+
|
|
|
+ public HttpResult getSubcontractConsignment(String lOrderId, Integer page, Integer pageSize) {
|
|
|
+ Integer newPage = page - 1;
|
|
|
+ List<SubcontractConsignmentVO> list = logisticsOrderMapper.getSubcontractConsignment(lOrderId, newPage, pageSize);
|
|
|
+ //联查数据
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ for (SubcontractConsignmentVO subcontractConsignmentVO : list) {
|
|
|
+// subcontractConsignmentVO.setPriceType(getDictData(DictEnum.PRICE_TYPE_0.getType(), subcontractConsignmentVO.getPriceType()));
|
|
|
+// subcontractConsignmentVO.setLossUnit(getDictData(DictEnum.TRANSPORT_TYPE_0.getType(), subcontractConsignmentVO.getLossUnit()));
|
|
|
+// subcontractConsignmentVO.setGoodsPriceUnit(getDictData(DictEnum.PRICE_TYPE_0.getType(), subcontractConsignmentVO.getGoodsPriceUnit()));
|
|
|
+// subcontractConsignmentVO.setContractSigningWay(getDictData(DictEnum.CONTRACT_STATUS_1.getType(), subcontractConsignmentVO.getContractSigningWay()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getDictData(String type, String value) {
|
|
|
+ if (ObjectUtils.isEmpty(value)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (remoteSystemService.queryDictByTypeAndValue(type, value) == null) {
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ return remoteSystemService.queryDictByTypeAndValue(type, value).getLabel();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|