|
|
@@ -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("路径信息不存在!");
|