|
|
@@ -28,6 +28,7 @@ import com.sckw.order.api.dubbo.TradeOrderInfoService;
|
|
|
import com.sckw.order.api.model.*;
|
|
|
import com.sckw.product.api.dubbo.GoodsInfoService;
|
|
|
import com.sckw.product.api.model.KwpGoods;
|
|
|
+import com.sckw.redis.config.RedisLockUtil;
|
|
|
import com.sckw.stream.model.SckwBusSum;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
import com.sckw.system.api.model.dto.res.EntCacheResDto;
|
|
|
@@ -68,6 +69,9 @@ public class LogisticsConsignmentService {
|
|
|
@Resource
|
|
|
private StreamBridge streamBridge;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ RedisLockUtil redisLockUtil;
|
|
|
+
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
RemoteSystemService remoteSystemService;
|
|
|
|
|
|
@@ -116,22 +120,26 @@ public class LogisticsConsignmentService {
|
|
|
if (HttpStatus.SUCCESS_CODE != httpResult.getCode()) {
|
|
|
return HttpResult.error(httpResult.getMsg());
|
|
|
}
|
|
|
- checkParamData(bo);
|
|
|
+ HttpResult checked = checkParamData(bo);
|
|
|
+ if (checked.getCode() != HttpStatus.SUCCESS_CODE) {
|
|
|
+ return HttpResult.error(checked.getMsg());
|
|
|
+ }
|
|
|
logisticsConsignmentInsert(bo);
|
|
|
return HttpResult.ok();
|
|
|
}
|
|
|
|
|
|
- private void checkParamData(LogisticsConsignmentParam bo) {
|
|
|
+ private HttpResult checkParamData(LogisticsConsignmentParam bo) {
|
|
|
if (!ObjectUtils.isEmpty(bo.getLoss())) {
|
|
|
if (bo.getLoss().compareTo(new BigDecimal("0.00")) < 0) {
|
|
|
- throw new RuntimeException("合理损耗填写时,必须大于0");
|
|
|
+ return HttpResult.error("合理损耗填写时,必须大于0");
|
|
|
}
|
|
|
}
|
|
|
if (!ObjectUtils.isEmpty(bo.getGoodsPrice())) {
|
|
|
if (bo.getGoodsPrice().compareTo(new BigDecimal("0.00")) < 0) {
|
|
|
- throw new RuntimeException("扣亏货值填写时,必须大于0");
|
|
|
+ return HttpResult.error("扣亏货值填写时,必须大于0");
|
|
|
}
|
|
|
}
|
|
|
+ return HttpResult.ok();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -146,12 +154,17 @@ public class LogisticsConsignmentService {
|
|
|
if (HttpStatus.SUCCESS_CODE != httpResult.getCode()) {
|
|
|
return HttpResult.error(httpResult.getMsg());
|
|
|
}
|
|
|
- checkParamData(bo);
|
|
|
+ HttpResult checked = checkParamData(bo);
|
|
|
+ if (checked.getCode() != HttpStatus.SUCCESS_CODE) {
|
|
|
+ return HttpResult.error(checked.getMsg());
|
|
|
+ }
|
|
|
logisticsConsignmentInsert(bo);
|
|
|
return HttpResult.ok();
|
|
|
}
|
|
|
|
|
|
void logisticsConsignmentInsert(LogisticsConsignmentParam bo) {
|
|
|
+ Long count = kwtLogisticsOrderMapper.selectCount(new LambdaQueryWrapper<KwtLogisticsOrder>().eq(KwtLogisticsOrder::getTOrderId, bo.getTOrderId()));
|
|
|
+ String lOrderNo = OrderGenerateSeqNoUtils.getSeqNo(RedisOrderGenerateEnum.LOGISTICS_ORDER, OrderRuleEnum.LOGISTICS_ORDER, "1", "0", String.valueOf(count + 1));
|
|
|
OrderDetailRes tradeOrder = tradeOrderInfoService.getOrderDetailById(Long.parseLong(bo.getTOrderId()));
|
|
|
if (tradeOrder == null) {
|
|
|
log.error("订单id查找失败:{}", bo.getTOrderId());
|
|
|
@@ -177,8 +190,6 @@ public class LogisticsConsignmentService {
|
|
|
order.setAmount(new BigDecimal("0.00"));
|
|
|
order.setSubcontractAmount(new BigDecimal("0.00"));
|
|
|
}
|
|
|
- Long count = kwtLogisticsOrderMapper.selectCount(new LambdaQueryWrapper<KwtLogisticsOrder>().eq(KwtLogisticsOrder::getTOrderId, bo.getTOrderId()));
|
|
|
- String lOrderNo = OrderGenerateSeqNoUtils.getSeqNo(RedisOrderGenerateEnum.LOGISTICS_ORDER, OrderRuleEnum.LOGISTICS_ORDER, "1", "0", String.valueOf(count + 1));
|
|
|
Long orderId = new IdWorker(NumberConstant.ONE).nextId();
|
|
|
Integer orderStatus = LogisticsOrderEnum.PENDING_ORDER.getCode();
|
|
|
insertLogisticsGoods(bo, lOrderNo, orderId);
|
|
|
@@ -236,7 +247,7 @@ public class LogisticsConsignmentService {
|
|
|
logisticsOrder.setSubcontractAmount(new BigDecimal("0.00"));
|
|
|
logisticsOrder.setCarryingCapacity(new BigDecimal("0.00"));
|
|
|
}
|
|
|
- logisticsOrder.setLoss(bo.getLoss() == null ? null :bo.getLoss());
|
|
|
+ logisticsOrder.setLoss(bo.getLoss() == null ? null : bo.getLoss());
|
|
|
logisticsOrder.setLossUnit(bo.getLossUnit());
|
|
|
logisticsOrder.setGoodsPrice(bo.getGoodsPrice() == null ? null : bo.getGoodsPrice());
|
|
|
BigDecimal decimal = new BigDecimal(NumberConstant.ZERO);
|