785834757 2 anni fa
parent
commit
31a2abe107

+ 8 - 5
src/main/java/com/ydtech/modules/fee/service/impl/CostsCalServiceImpl.java

@@ -190,20 +190,23 @@ public class CostsCalServiceImpl implements CostsCalcService {
         //计算出口费用
 
         //分销管理比例总和
-        BigDecimal retailStoreProportion = insFeeOrderNew.getFirstDetailProportion().add(insFeeOrderNew.getSecondDetailProportion()).add(insFeeOrderNew.getThirdDetailProportion());
+        BigDecimal retailStoreProportion = insFeeOrderNew.getFirstDetailProportion().add(insFeeOrderNew.getSecondDetailProportion()).
+                add(insFeeOrderNew.getThirdDetailProportion());
 
 
-        //交强入口比例总和
-        BigDecimal jqEntranceProportion = insFeeOrderNew.getJqSuperviseCostsProportion().add(insFeeOrderNew.getJqOtherCostsProportion());
         //交强机构管理费
         BigDecimal jqDeptProportion = insFeeOrderNew.getJqDeptProportionLevel1().add(insFeeOrderNew.getJqDeptProportionLevel2()).add(insFeeOrderNew.getJqDeptProportionLevel3()).add(insFeeOrderNew.getJqDeptProportionLevel4()).add(insFeeOrderNew.getJqDeptProportionLevel5());
+
+        //交强入口比例总和
+        BigDecimal jqEntranceProportion = insFeeOrderNew.getJqSuperviseCostsProportion().add(insFeeOrderNew.getJqOtherCostsProportion()).divide(taxRadio,2, RoundingMode.HALF_DOWN);
+
         //交强出口总比例
         BigDecimal jqExportProportion = jqEntranceProportion.subtract(jqDeptProportion).subtract(retailStoreProportion);
         //交强出口金额
         subOrderExportFeeVo.setJqExportCosts(insFeeOrderNew.getJqPremium().multiply(taxRadio).multiply(jqExportProportion.divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN));
 
         //商业入口比例总和
-        BigDecimal syEntranceProportion = insFeeOrderNew.getSySuperviseCostsProportion().add(insFeeOrderNew.getSyOtherCostsProportion());
+        BigDecimal syEntranceProportion = insFeeOrderNew.getSySuperviseCostsProportion().add(insFeeOrderNew.getSyOtherCostsProportion()).divide(taxRadio,2, RoundingMode.HALF_DOWN);
         //商业部门管理比例总和
         BigDecimal syDeptProportion = insFeeOrderNew.getSyDeptProportionLevel1().add(insFeeOrderNew.getSyDeptProportionLevel2()).add(insFeeOrderNew.getSyDeptProportionLevel3()).add(insFeeOrderNew.getSyDeptProportionLevel4()).add(insFeeOrderNew.getSyDeptProportionLevel5());
         //商业出口比例总和
@@ -212,7 +215,7 @@ public class CostsCalServiceImpl implements CostsCalcService {
         subOrderExportFeeVo.setSyExportCosts(insFeeOrderNew.getSyPremium().multiply(taxRadio).multiply(syExportProportion.divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN));
 
         //非车入口比例总和
-        BigDecimal noEntranceProportion = insFeeOrderNew.getNoSuperviseCostsProportion().add(insFeeOrderNew.getNoOtherCostsProportion());
+        BigDecimal noEntranceProportion = insFeeOrderNew.getNoSuperviseCostsProportion().add(insFeeOrderNew.getNoOtherCostsProportion()).divide(taxRadio,2, RoundingMode.HALF_DOWN);
         //非车部门比例总和
         BigDecimal noDeptProportion = insFeeOrderNew.getNoDeptProportionLevel1().add(insFeeOrderNew.getNoDeptProportionLevel2()).add(insFeeOrderNew.getNoDeptProportionLevel3()).add(insFeeOrderNew.getNoDeptProportionLevel4()).add(insFeeOrderNew.getNoDeptProportionLevel5());
         //非车出口比例总和

+ 25 - 23
src/main/java/com/ydtech/modules/order/aop/aspect/QuoteVerificationAspect.java

@@ -74,30 +74,32 @@ public class QuoteVerificationAspect {
     @AfterReturning(pointcut = "@annotation(com.ydtech.modules.order.aop.QuoteVerification)", returning = "result")
     public void doAfter(HttpResult<QuoteRespVo> result){
         //计算费用因子
-        InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(result.getData().getCompanyId());
-        InsAreaCompanyAccidentalDriving insAreaCompanyAccidentalDriving = insAreaCompanyAccidentalDrivingService.getByCompanyId(insAreaCompany.getId());
-        insAreaCompany.setAccidentalDriving(insAreaCompanyAccidentalDriving);
-        InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
-
-        //再进行费用因子判断
-        try {
-            feeRuleSchemeNewService.verificationCostFactor(insAreaCompany, insOrders);
-            InsFeeOrderNew insFeeOrderNew = insFeeOrderNewService.getInsFeeOrderNewByCompanyId(insAreaCompany.getId());
-            if(insFeeOrderNew == null){
-                throw new RuntimeException("费用因子匹配失败");
+        if(result.getCode() == 200) {
+            InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(result.getData().getCompanyId());
+            InsAreaCompanyAccidentalDriving insAreaCompanyAccidentalDriving = insAreaCompanyAccidentalDrivingService.getByCompanyId(insAreaCompany.getId());
+            insAreaCompany.setAccidentalDriving(insAreaCompanyAccidentalDriving);
+            InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
+
+            //再进行费用因子判断
+            try {
+                feeRuleSchemeNewService.verificationCostFactor(insAreaCompany, insOrders);
+                InsFeeOrderNew insFeeOrderNew = insFeeOrderNewService.getInsFeeOrderNewByCompanyId(insAreaCompany.getId());
+                if (insFeeOrderNew == null) {
+                    throw new RuntimeException("费用因子匹配失败");
+                }
+                //出口
+                SubOrderExportFeeVo subOrderExportFeeVo = costsCalcService.getExportFee(insFeeOrderNew);
+
+                result.getData().setJqExportFee(subOrderExportFeeVo.getJqExportCosts());
+                result.getData().setSyExportFee(subOrderExportFeeVo.getSyExportCosts());
+                result.getData().setNoExportFee(subOrderExportFeeVo.getNoExportCosts());
+                result.getData().setSumExportFee(subOrderExportFeeVo.getJqExportCosts()
+                        .add(subOrderExportFeeVo.getSyExportCosts())
+                        .add(subOrderExportFeeVo.getNoExportCosts()));
+
+            } catch (Exception ignored) {
+                System.out.printf("费用因子匹配失败:" + ignored.getMessage());
             }
-            //出口
-            SubOrderExportFeeVo subOrderExportFeeVo = costsCalcService.getExportFee(insFeeOrderNew);
-
-            result.getData().setJqExportFee(subOrderExportFeeVo.getJqExportCosts());
-            result.getData().setSyExportFee(subOrderExportFeeVo.getSyExportCosts());
-            result.getData().setNoExportFee(subOrderExportFeeVo.getNoExportCosts());
-            result.getData().setSumExportFee(subOrderExportFeeVo.getJqExportCosts()
-                    .add(subOrderExportFeeVo.getSyExportCosts())
-                    .add(subOrderExportFeeVo.getNoExportCosts()));
-
-        } catch (Exception ignored) {
-            System.out.printf("费用因子匹配失败:" + ignored.getMessage());
         }
     }
 

+ 4 - 1
src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java

@@ -765,7 +765,10 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
 
         List<String> companyIds = insAreaCompanyEditingDtos.stream().map(x -> x.getCompanyId()).collect(Collectors.toList());
 
-        List<InsFeeOrderNew> insFeeOrderNews = insFeeOrderNewService.getInsFeeOrderNewListByCompanyId(companyIds);
+        List<InsFeeOrderNew> insFeeOrderNews = new ArrayList<>();
+        if(!companyIds.isEmpty()) {
+            insFeeOrderNewService.getInsFeeOrderNewListByCompanyId(companyIds);
+        }
 
         //计算费用
         insFeeOrderNews.forEach(insFeeOrderNew -> {