|
|
@@ -124,11 +124,17 @@ public class AcceptCarriageOrderService {
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public HttpResult subcontractConsignment(SubcontractConsignmentDTO bo) {
|
|
|
+ HttpResult httpResult = ValidUtil.serviceValid(bo);
|
|
|
+ if (!String.valueOf(HttpStatus.SUCCESS_CODE).equals(String.valueOf(httpResult.getCode()))) {
|
|
|
+ httpResult.setMsg(httpResult.getMsg());
|
|
|
+ httpResult.setCode(HttpStatus.GLOBAL_EXCEPTION_CODE);
|
|
|
+ return httpResult;
|
|
|
+ }
|
|
|
KwtLogisticsOrder logisticsOrder = logisticsOrderMapper.selectOne(new LambdaQueryWrapper<KwtLogisticsOrder>()
|
|
|
.eq(KwtLogisticsOrder::getId, bo.getLOrderId()));
|
|
|
if (logisticsOrder == null) {
|
|
|
log.error("订单id查找失败:{},订单编号:{}", bo.getLOrderId(), bo.getLOrderNo());
|
|
|
- throw new RuntimeException("单据错误,数据不存在");
|
|
|
+ throw new BusinessException("单据错误,数据不存在");
|
|
|
}
|
|
|
//todo 校验当前登录角色是否具有4P物流角色
|
|
|
EntCacheResDto entCacheResDto = remoteSystemService.queryEntCacheById(LoginUserHolder.getEntId());
|
|
|
@@ -268,7 +274,7 @@ public class AcceptCarriageOrderService {
|
|
|
logisticsOrder.setSubcontractAmount(new BigDecimal(NumberConstant.ZERO));
|
|
|
logisticsOrder.setCarryingCapacity(0L);
|
|
|
}
|
|
|
- logisticsOrder.setLoss(bo.getLoss() == null ? null : new BigDecimal(bo.getLoss()));
|
|
|
+ logisticsOrder.setLoss(bo.getLoss() == null ? null : bo.getLoss());
|
|
|
logisticsOrder.setLossUnit(bo.getLossUnit());
|
|
|
logisticsOrder.setGoodsPrice(bo.getGoodsPrice() == null ? null : new BigDecimal(bo.getGoodsPrice()));
|
|
|
BigDecimal decimal = new BigDecimal(NumberConstant.ZERO);
|
|
|
@@ -518,7 +524,7 @@ public class AcceptCarriageOrderService {
|
|
|
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.setLoss(bo.getLoss());
|
|
|
// 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());
|
|
|
@@ -955,16 +961,27 @@ public class AcceptCarriageOrderService {
|
|
|
.set(KwtWaybillOrder::getUpdateBy, LoginUserHolder.getUserId())
|
|
|
.set(KwtWaybillOrder::getUpdateTime, new Date()));
|
|
|
/**变更单据状态*/
|
|
|
- KwtWaybillOrderTrack orderTrack = new KwtWaybillOrderTrack();
|
|
|
- orderTrack.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
- orderTrack.setWOrderId(Long.parseLong(id));
|
|
|
- orderTrack.setStatus(CarWaybillEnum.REVOKED.getCode());
|
|
|
- orderTrack.setDelFlag(NumberConstant.ZERO);
|
|
|
- orderTrack.setCreateBy(LoginUserHolder.getUserId());
|
|
|
- orderTrack.setCreateTime(new Date());
|
|
|
- orderTrack.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
- orderTrack.setUpdateTime(new Date());
|
|
|
- waybillOrderTrackMapper.insert(orderTrack);
|
|
|
+ KwtWaybillOrderTrack waybillOrderTrack = waybillOrderTrackMapper.selectOne(new LambdaQueryWrapper<KwtWaybillOrderTrack>()
|
|
|
+ .eq(KwtWaybillOrderTrack::getWOrderId, id)
|
|
|
+ .eq(KwtWaybillOrderTrack::getStatus, CarWaybillEnum.REVOKED.getCode())
|
|
|
+ );
|
|
|
+ if (waybillOrderTrack == null) {
|
|
|
+ KwtWaybillOrderTrack orderTrack = new KwtWaybillOrderTrack();
|
|
|
+ orderTrack.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
+ orderTrack.setWOrderId(Long.parseLong(id));
|
|
|
+ orderTrack.setStatus(CarWaybillEnum.REVOKED.getCode());
|
|
|
+ orderTrack.setDelFlag(NumberConstant.ZERO);
|
|
|
+ orderTrack.setCreateBy(LoginUserHolder.getUserId());
|
|
|
+ orderTrack.setCreateTime(new Date());
|
|
|
+ orderTrack.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
+ orderTrack.setUpdateTime(new Date());
|
|
|
+ waybillOrderTrackMapper.insert(orderTrack);
|
|
|
+ }else {
|
|
|
+ waybillOrderTrack.setUpdateTime(new Date());
|
|
|
+ waybillOrderTrack.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
+ waybillOrderTrackMapper.updateById(waybillOrderTrack);
|
|
|
+ }
|
|
|
+
|
|
|
/**修改mongodb*/
|
|
|
//mongodb更新订单状态
|
|
|
SckwWaybillOrder updateParam = new SckwWaybillOrder();
|
|
|
@@ -972,9 +989,21 @@ public class AcceptCarriageOrderService {
|
|
|
.setUpdateBy(LoginUserHolder.getUserId()).setUpdateByName(LoginUserHolder.getUserName()).setUpdateTime(new Date());
|
|
|
SckwBusSum busSum = new SckwBusSum();
|
|
|
busSum.setBusSumType(BusinessTypeEnum.WAYBILL_ORDER_TYPE.getName());
|
|
|
- busSum.setMethod(2);
|
|
|
+ busSum.setMethod(NumberConstant.TWO);
|
|
|
busSum.setObject(updateParam);
|
|
|
streamBridge.send("sckw-busSum", com.alibaba.fastjson2.JSON.toJSONString(busSum));
|
|
|
+ SckwLogisticsOrder order = new SckwLogisticsOrder();
|
|
|
+ order.set_id(logisticsOrder.getId());
|
|
|
+ order.setLOrderId(logisticsOrder.getId());
|
|
|
+ order.setEntrustAmount(entrustAmount);
|
|
|
+ order.setSubcontractAmount(subcontractAmount);
|
|
|
+ order.setUpdateByName(LoginUserHolder.getUserName());
|
|
|
+ order.setUpdateTime(new Date());
|
|
|
+ SckwBusSum orderBusSum = new SckwBusSum();
|
|
|
+ orderBusSum.setBusSumType(BusinessTypeEnum.LOGISTICS_ORDER_TYPE.getName());
|
|
|
+ orderBusSum.setMethod(NumberConstant.TWO);
|
|
|
+ orderBusSum.setObject(order);
|
|
|
+ streamBridge.send("sckw-busSum", com.alibaba.fastjson2.JSON.toJSONString(busSum));
|
|
|
result.put("status", HttpStatus.SUCCESS_CODE);
|
|
|
result.put("message", "取消成功");
|
|
|
list.add(result);
|