Ver código fonte

路径新增、修改接口逻辑调整

yzc 1 ano atrás
pai
commit
309ffd5676

+ 1 - 0
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/vo/req/AddLineFreightRateParam.java

@@ -58,6 +58,7 @@ public class AddLineFreightRateParam {
      */
     @Digits(integer = 10, fraction = 6, message = "运输总价格式错误")
     @DecimalMin(value = "0", message = "运输总价不能小于零")
+    @NotNull(message = "运输总价不能为空")
     private BigDecimal transportAmount;
 
     /**

+ 1 - 0
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/model/vo/req/UpdateLineFreightRateParam.java

@@ -66,6 +66,7 @@ public class UpdateLineFreightRateParam {
      */
     @Digits(integer = 10, fraction = 6, message = "运输总价格式错误")
     @DecimalMin(value = "0", message = "运输总价不能小于零")
+    @NotNull(message = "运输总价不能为空")
     private BigDecimal transportAmount;
 
     /**

+ 0 - 29
sckw-modules/sckw-manage/src/main/java/com/sckw/manage/service/KwmLineFreightRateService.java

@@ -26,8 +26,6 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.stereotype.Service;
 
-import java.math.BigDecimal;
-import java.math.RoundingMode;
 import java.util.*;
 
 /**
@@ -54,20 +52,6 @@ public class KwmLineFreightRateService {
      * @date 2024/3/1 11:14
      */
     public void add(AddLineFreightRateParam addLineFreightRateParam) {
-        if (Objects.nonNull(addLineFreightRateParam.getTransportPrice()) && Objects.nonNull(addLineFreightRateParam.getTransportAmount())) {
-            BigDecimal amount = addLineFreightRateParam.getTransportMileage().multiply(addLineFreightRateParam.getTransportPrice())
-                    .setScale(6, RoundingMode.HALF_UP);
-            if (amount.compareTo(addLineFreightRateParam.getTransportAmount()) != 0) {
-                throw new BusinessException("运输单价*运输里程不等于运输总价!");
-            }
-        }
-        if (Objects.nonNull(addLineFreightRateParam.getTransportPrice()) && Objects.isNull(addLineFreightRateParam.getTransportAmount())) {
-            throw new BusinessException("运输总价不能为空");
-        }
-        if (Objects.isNull(addLineFreightRateParam.getTransportPrice()) && Objects.nonNull(addLineFreightRateParam.getTransportAmount())) {
-            throw new BusinessException("运输单价不能为空");
-        }
-
         Long entId = LoginUserHolder.getEntId();
         Long count = countByEntIdAndName(entId, addLineFreightRateParam.getName(), null);
         if (count > 0) {
@@ -100,19 +84,6 @@ public class KwmLineFreightRateService {
      */
     public void update(UpdateLineFreightRateParam param) {
         Long entId = LoginUserHolder.getEntId();
-        if (Objects.nonNull(param.getTransportPrice()) && Objects.nonNull(param.getTransportAmount())) {
-            BigDecimal amount = param.getTransportMileage().multiply(param.getTransportPrice())
-                    .setScale(6, RoundingMode.HALF_UP);
-            if (amount.compareTo(param.getTransportAmount()) != 0) {
-                throw new BusinessException("运输单价*运输里程不等于运输总价!");
-            }
-        }
-        if (Objects.nonNull(param.getTransportPrice()) && Objects.isNull(param.getTransportAmount())) {
-            throw new BusinessException("运输总价不能为空");
-        }
-        if (Objects.isNull(param.getTransportPrice()) && Objects.nonNull(param.getTransportAmount())) {
-            throw new BusinessException("运输单价不能为空");
-        }
         KwmLineFreightRate lineFreightRate = getById(param.getId());
         if (Objects.isNull(lineFreightRate)) {
             throw new BusinessException("路径信息不存在!");