lengfaqiang 2 лет назад
Родитель
Сommit
4ed6f7e254

+ 2 - 0
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/model/param/LogisticsConsignmentParam.java

@@ -25,6 +25,8 @@ public class LogisticsConsignmentParam {
     /**
      *总量
      */
+    @Digits(integer = 10,fraction = 2,message = "总量格式不正确")
+    @DecimalMin(value = "0.00",message = "分配总量量不能小于{value}")
     private BigDecimal amount;
     /**
      * 分配承运量

+ 1 - 1
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/AcceptCarriageOrderService.java

@@ -151,7 +151,7 @@ public class AcceptCarriageOrderService {
         if (!bo.getIsFullDose()) {
             BigDecimal amount = bo.getAmount();
             BigDecimal carryingCapacity = bo.getCarryingCapacity();
-            if (carryingCapacity.compareTo(amount) < 0) {
+            if (amount.compareTo(carryingCapacity) < 0) {
                 log.error("运订单分包托运-可分配量分配错误:{}", bo.getLOrderId());
                 throw new RuntimeException("可分配量分配错误");
             }

+ 4 - 4
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/LogisticsConsignmentService.java

@@ -153,18 +153,18 @@ public class LogisticsConsignmentService {
         OrderDetailRes tradeOrder = tradeOrderInfoService.getOrderDetailById(Long.parseLong(bo.getTOrderId()));
         if (tradeOrder == null) {
             log.error("订单id查找失败:{}", bo.getTOrderId());
-            throw new RuntimeException("单据错误,数据不存在");
+            throw new BusinessException("单据错误,数据不存在");
         }
         KwtLogisticsOrder order = new KwtLogisticsOrder();
         if (!bo.getIsFullDose()) {
             BigDecimal amount = bo.getAmount();
             BigDecimal carryingCapacity = bo.getCarryingCapacity();
-            if (carryingCapacity.compareTo(amount) < 0) {
+            if (amount.compareTo(carryingCapacity) < 0) {
                 log.error("可分配量分配错误:{}", bo.getTOrderId());
-                throw new RuntimeException("可分配量分配错误");
+                throw new BusinessException("可分配量分配错误");
             }
             if (ArrayUtil.isEmpty(bo.getCarryingCapacity())) {
-                throw new RuntimeException("不是全量分配时,分配量不能为空!");
+                throw new BusinessException("不是全量分配时,分配量不能为空!");
             }
             order.setAmount(bo.getCarryingCapacity());
         } else {