Explorar o código

费用显示负数 费用出现负数报出异常

785834757 %!s(int64=2) %!d(string=hai) anos
pai
achega
84e8359ebe

+ 5 - 0
src/main/java/com/ydtech/modules/fee/service/FeeRuleSchemeService.java

@@ -6,6 +6,8 @@ import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
 import com.ydtech.modules.order.entity.vo.FeeOrderNewVo;
 import com.ydtech.modules.order.entity.vo.QueryOrderFeeResultVo;
 import com.ydtech.modules.order.entity.vo.QueryOrderFeeVo;
+import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -75,4 +77,7 @@ public interface FeeRuleSchemeService {
      */
     public FeeOrderNewVo.ExportFee calcExportFee(BigDecimal premium, BigDecimal superviseCostsProportion, BigDecimal entranceTotalProportion,
                                                  BigDecimal deptTotalProportion,BigDecimal retailTotalProportion,BigDecimal taxRate);
+
+
+    FeeOrderNewVo newConvertOrderFeeVoData(InsFeeOrderNew insFeeOrderNew, PtlAgreementProductCostsNew ptlAgreementProductCostsNew);
 }

+ 4 - 4
src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceImpl.java

@@ -2810,10 +2810,10 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
         BigDecimal noTaxEntranceTotalProportion = entranceTotalProportion.divide(taxRate,2,RoundingMode.DOWN);
         //出口的总比例
         BigDecimal exportTotalProportion = noTaxEntranceTotalProportion.subtract(deptTotalProportion).subtract(retailTotalProportion);
-        if(exportTotalProportion.compareTo(BigDecimal.ZERO) < 0 ){
-            //出口比例为负数了
-            exportTotalProportion = new BigDecimal(0);
-        }
+//        if(exportTotalProportion.compareTo(BigDecimal.ZERO) < 0 ){
+//            //出口比例为负数了
+//            exportTotalProportion = new BigDecimal(0);
+//        }
         //如果手续费 大于 总比例 则出口手续费等于总比例
         if(superviseCostsProportion.compareTo(exportTotalProportion) >= 0 ){
             superviseCostsProportion = exportTotalProportion;

+ 20 - 0
src/main/java/com/ydtech/modules/order/aop/aspect/AuditVerificationAspect.java

@@ -5,10 +5,12 @@ import com.alibaba.fastjson.JSONObject;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.admin.service.SysUserRoleService;
 import com.ydtech.modules.fee.service.FeeRuleSchemeNewService;
+import com.ydtech.modules.fee.service.FeeRuleSchemeService;
 import com.ydtech.modules.order.components.InsOrdersComponents;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsAreaCompanyAccidentalDriving;
 import com.ydtech.modules.order.entity.InsOrders;
+import com.ydtech.modules.order.entity.vo.FeeOrderNewVo;
 import com.ydtech.modules.order.entity.vo.SpecialAuditVo;
 import com.ydtech.modules.order.service.InsAreaCompanyAccidentalDrivingService;
 import com.ydtech.modules.order.service.InsAreaCompanyService;
@@ -16,7 +18,9 @@ import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.modules.protocol.service.PtlAgreementDeptService;
 import com.ydtech.modules.protocol.service.impl.TaxSourceServiceImpl;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew;
 import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
+import com.ydtech.modules.protocols.service.PtlAgreementProductCostsNewService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.aspectj.lang.JoinPoint;
@@ -24,6 +28,8 @@ import org.aspectj.lang.annotation.Aspect;
 import org.aspectj.lang.annotation.Before;
 import org.springframework.stereotype.Component;
 
+import java.math.BigDecimal;
+
 @Slf4j
 @Aspect
 @Component
@@ -32,6 +38,8 @@ public class AuditVerificationAspect {
 
     private final FeeRuleSchemeNewService feeRuleSchemeNewService;
 
+    private final FeeRuleSchemeService feeRuleSchemeService;
+
     private final InsAreaCompanyService insAreaCompanyService;
 
     private final InsOrdersService insOrdersService;
@@ -40,6 +48,8 @@ public class AuditVerificationAspect {
 
     private final InsFeeOrderNewService insFeeOrderNewService;
 
+    private final PtlAgreementProductCostsNewService ptlAgreementProductCostsNewService;
+
     @Before("@annotation(com.ydtech.modules.order.aop.AuditVerification)")
     public void doBefore(JoinPoint point) {
         Object[] args = point.getArgs();
@@ -61,6 +71,16 @@ public class AuditVerificationAspect {
             if(insFeeOrderNewByCompanyId == null){
                 throw new SystemException("费用信息不匹配");
             }
+            PtlAgreementProductCostsNew costsNew = ptlAgreementProductCostsNewService.getById(insFeeOrderNewByCompanyId.getCostsId());
+
+            //出口费用是否出现负数 如果出现提示异常
+            FeeOrderNewVo feeOrderNewVo = feeRuleSchemeService.newConvertOrderFeeVoData(insFeeOrderNewByCompanyId, costsNew);
+            if(feeOrderNewVo.getExportFee().get(0).getTotalAmount().compareTo(BigDecimal.ZERO) < 0 ||
+                    feeOrderNewVo.getExportFee().get(1).getTotalAmount().compareTo(BigDecimal.ZERO) < 0 ||
+                    feeOrderNewVo.getExportFee().get(2).getTotalAmount().compareTo(BigDecimal.ZERO) < 0){
+                throw new SystemException("费用信息异常");
+            }
+
             //再进行费用因子判断
             try {
                 //先进行承保规则判断