|
|
@@ -16,10 +16,7 @@ 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;
|
|
|
-import com.sckw.core.utils.IdWorker;
|
|
|
-import com.sckw.core.utils.RegularUtils;
|
|
|
-import com.sckw.core.utils.StringUtils;
|
|
|
+import com.sckw.core.utils.*;
|
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.response.HttpResult;
|
|
|
@@ -154,33 +151,35 @@ public class AcceptCarriageOrderService {
|
|
|
KwtLogisticsOrder logisticsOrder = logisticsOrderMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrder>()
|
|
|
.eq(KwtLogisticsOrder::getId, bo.getLOrderId()));
|
|
|
if (logisticsOrder == null) {
|
|
|
- log.error("订单id查找失败:{},订单编号:{}", bo.getOrderId(), bo.getLOrderNo());
|
|
|
+ log.error("订单id查找失败:{},订单编号:{}", bo.getLOrderId(), bo.getLOrderNo());
|
|
|
throw new RuntimeException("单据错误,数据不存在");
|
|
|
}
|
|
|
//todo 校验当前登录角色是否具有4P物流角色
|
|
|
EntCacheResDto entCacheResDto = remoteSystemService.queryEntCacheById(LoginUserHolder.getEntId());
|
|
|
- if (entCacheResDto == null) {
|
|
|
- log.info("承运订单-分包托运 用户id:{}", LoginUserHolder.getUserId());
|
|
|
- throw new RuntimeException("企业信息查询异常");
|
|
|
- }
|
|
|
- if (!entCacheResDto.getEntTypes().contains(String.valueOf(NumberConstant.THREE))) {
|
|
|
- throw new RuntimeException("当前用户企业不具有分包功能权限!");
|
|
|
- }
|
|
|
+// if (entCacheResDto == null) {
|
|
|
+// log.info("承运订单-分包托运 用户id:{}", LoginUserHolder.getUserId());
|
|
|
+// throw new RuntimeException("企业信息查询异常");
|
|
|
+// }
|
|
|
+// if (!entCacheResDto.getEntTypes().contains(String.valueOf(NumberConstant.THREE))) {
|
|
|
+// throw new RuntimeException("当前用户企业不具有分包功能权限!");
|
|
|
+// }
|
|
|
KwtLogisticsOrder order = new KwtLogisticsOrder();
|
|
|
if (!bo.getIsFullDose()) {
|
|
|
Long amount = bo.getAmount();
|
|
|
Long carryingCapacity = bo.getCarryingCapacity();
|
|
|
if (carryingCapacity > amount) {
|
|
|
- log.error("运订单分包托运-可分配量分配错误:{}", bo.getOrderId());
|
|
|
+ log.error("运订单分包托运-可分配量分配错误:{}", bo.getLOrderId());
|
|
|
throw new RuntimeException("可分配量分配错误");
|
|
|
}
|
|
|
if (ArrayUtil.isEmpty(bo.getCarryingCapacity())) {
|
|
|
throw new RuntimeException("不是全量分配时,分配量不能为空!");
|
|
|
}
|
|
|
order.setAmount(new BigDecimal(bo.getCarryingCapacity()));
|
|
|
+ order.setUnit(bo.getCarryingCapacityUnit());
|
|
|
} else {
|
|
|
order.setAmount(new BigDecimal(NumberConstant.ZERO));
|
|
|
order.setSubcontractAmount(new BigDecimal(NumberConstant.ZERO));
|
|
|
+ order.setUnit(bo.getCarryingCapacityUnit());
|
|
|
}
|
|
|
String lOrderNo = com.sckw.transport.utils.StringUtils.getLOrderNo();
|
|
|
Long orderId = new IdWorker(NumberConstant.ONE).nextId();
|
|
|
@@ -229,13 +228,26 @@ public class AcceptCarriageOrderService {
|
|
|
throw new RuntimeException("生成物流托运合同异常");
|
|
|
}
|
|
|
insertSubcontractLogisticsGoods(bo, lOrderNo, orderId);
|
|
|
- insertSubcontractLogisticsOrder(bo, lOrderNo, order, orderId, pids, orderStatus);
|
|
|
+ insertSubcontractLogisticsOrder(bo, lOrderNo, order, orderId, pids, orderStatus,logisticsOrder);
|
|
|
insertSubcontractLogisticsOrderContract(bo, orderId);
|
|
|
insertSubcontractLogisticsOrderUnit(bo, orderId);
|
|
|
insertSubcontractLogisticsOrderAddress(bo, orderId, logisticsOrder);
|
|
|
insertLogisticsOrderTrack(bo, orderId, orderStatus);
|
|
|
//修改上级分配量以及可分配量委托量等
|
|
|
logisticsOrder.setSubcontractAmount(logisticsOrder.getSubcontractAmount().add(new BigDecimal(bo.getCarryingCapacity())));
|
|
|
+ logisticsOrderMapper.updateById(logisticsOrder);
|
|
|
+ //修改父级mongodb数据
|
|
|
+ //更新mongodb
|
|
|
+ SckwLogisticsOrder sckwLogisticsOrder = mongoTemplate.findById(logisticsOrder.getId(), SckwLogisticsOrder.class);
|
|
|
+ SckwLogisticsOrder updateParam = BeanUtils.copyProperties(sckwLogisticsOrder, SckwLogisticsOrder.class);
|
|
|
+ updateParam.setSubcontractAmount(logisticsOrder.getSubcontractAmount().add(new BigDecimal(bo.getCarryingCapacity())))
|
|
|
+ .setUpdateTime(new Date()).setUpdateBy(LoginUserHolder.getUserId()).setUpdateByName(LoginUserHolder.getUserName());
|
|
|
+ SckwBusSum busSum = new SckwBusSum();
|
|
|
+ busSum.setBusSumType(BusinessTypeEnum.LOGISTICS_ORDER_TYPE.getName());
|
|
|
+ busSum.setMethod(NumberConstant.TWO);
|
|
|
+ busSum.setObject(updateParam);
|
|
|
+ streamBridge.send("sckw-busSum", com.alibaba.fastjson2.JSON.toJSONString(busSum));
|
|
|
+ //新增当前分包mongodb数据
|
|
|
subcontractSendMongoDB(lOrderNo, orderId, bo, logisticsOrder, orderStatus);
|
|
|
return HttpResult.ok();
|
|
|
}
|
|
|
@@ -289,7 +301,7 @@ public class AcceptCarriageOrderService {
|
|
|
KwpGoods goods = goodsInfoService.getGoodsById(Long.parseLong(bo.getGoodsId()));
|
|
|
logisticsOrder.setGoodsType(goods == null ? null : goods.getGoodsType());
|
|
|
logisticsOrder.setGoodsSpec(goods == null ? null : goods.getSpec());
|
|
|
- logisticsOrder.setContractId(Integer.parseInt(bo.getContractId()));
|
|
|
+ logisticsOrder.setContractId(bo.getContractId());
|
|
|
logisticsOrder.setContractNo(bo.getContractNo());
|
|
|
logisticsOrder.setContractName(bo.getContractName());
|
|
|
logisticsOrder.setContractSigningWay(bo.getPayment());
|
|
|
@@ -480,16 +492,17 @@ public class AcceptCarriageOrderService {
|
|
|
|
|
|
/**
|
|
|
* 分包托运-承运订单-主体
|
|
|
- *
|
|
|
- * @param bo
|
|
|
- * @param lOrderNo
|
|
|
- * @param order
|
|
|
- * @param orderId
|
|
|
- * @param pids
|
|
|
+ * @param bo 页面填写分包数据
|
|
|
+ * @param lOrderNo 当前分包物流订单编号
|
|
|
+ * @param order 父级物流订单数据
|
|
|
+ * @param orderId 当前订单主键id
|
|
|
+ * @param pids 组装的pids
|
|
|
+ * @param orderStatus 当前单据状态
|
|
|
+ * @param logisticsOrder 父级物流订单
|
|
|
*/
|
|
|
private void insertSubcontractLogisticsOrder(SubcontractConsignmentDTO bo, String lOrderNo,
|
|
|
KwtLogisticsOrder order,
|
|
|
- Long orderId, String pids, Integer orderStatus) {
|
|
|
+ Long orderId, String pids, Integer orderStatus,KwtLogisticsOrder logisticsOrder) {
|
|
|
order.setId(orderId);
|
|
|
order.setEntId(LoginUserHolder.getEntId());
|
|
|
order.setTOrderId(order.getTOrderId());
|
|
|
@@ -506,7 +519,7 @@ public class AcceptCarriageOrderService {
|
|
|
order.setAmount(new BigDecimal(bo.getCarryingCapacity()));
|
|
|
order.setBillingMode(bo.getBillingMode());
|
|
|
order.setLoss(new BigDecimal(bo.getLoss()));
|
|
|
- order.setLossUnit(bo.getLossUnit());
|
|
|
+// order.setLossUnit(bo.getLossUnit());
|
|
|
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()));
|
|
|
@@ -523,6 +536,7 @@ public class AcceptCarriageOrderService {
|
|
|
order.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
order.setUpdateTime(new Date());
|
|
|
order.setStatus(orderStatus);
|
|
|
+ /**补充默认值*/
|
|
|
BigDecimal decimal = new BigDecimal(NumberConstant.ZERO);
|
|
|
order.setEntrustAmount(decimal);
|
|
|
order.setSubcontractAmount(decimal);
|
|
|
@@ -531,6 +545,8 @@ public class AcceptCarriageOrderService {
|
|
|
order.setIgnoreAmount(decimal);
|
|
|
order.setDeficitPrice(decimal);
|
|
|
order.setDeficitAmount(decimal);
|
|
|
+ order.setTOrderId(logisticsOrder.getTOrderId());
|
|
|
+ order.setTOrderNo(logisticsOrder.getTOrderNo());
|
|
|
kwtLogisticsOrderMapper.insert(order);
|
|
|
}
|
|
|
|