Просмотр исходного кода

优化:
订单审核,订单详情商业入口手续费费用计算不对

jiakai 3 месяцев назад
Родитель
Сommit
5d3a68cd01

+ 2 - 2
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/aop/aspect/QuoteVerificationAspect.java

@@ -315,7 +315,7 @@ public class QuoteVerificationAspect {
             return BigDecimal.ZERO;
         }
         BigDecimal inletPercent = convertPercent(costType.getInlet());
-        return inletPercent.subtract(entranceFeeRatio).setScale(5);
+        return inletPercent.subtract(entranceFeeRatio).setScale(5, RoundingMode.HALF_UP);
     }
 
     /**
@@ -366,7 +366,7 @@ public class QuoteVerificationAspect {
                 .setScale(5, RoundingMode.HALF_EVEN);
 
         // 计算应付金额(保费 * 出口比例,保留2位小数)
-        BigDecimal payable = premium.multiply(exportPercent.setScale(2, RoundingMode.DOWN));
+        BigDecimal payable = premium.multiply(exportPercent.setScale(5, RoundingMode.DOWN));
 
         // 计算各类费用并设置到订单对象
         setReceivable.accept(insFeeOrders, receivable);

+ 10 - 5
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsFeeOrdersServiceImpl.java

@@ -110,7 +110,7 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
         BigDecimal jyPremium = insOrdersCosts.getJyPremium() == null ? BigDecimal.ZERO : insOrdersCosts.getJyPremium();
 
         // 更新对象中的比例字段
-        copyRatio(ptlAgreementCostRatioVo, insFeeOrders);
+        copyRatio(ptlAgreementCostRatioVo, insFeeOrders, withTax);
 
         // 核心:规则重新计算所有费用
         // 1. 交强险
@@ -286,7 +286,12 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
     }
 
     // 保存比例
-    private void copyRatio(PtlAgreementCostRatioVo ptlAgreementCostRatioVo, InsFeeOrders insFeeOrders) {
+    private void copyRatio(PtlAgreementCostRatioVo ptlAgreementCostRatioVo, InsFeeOrders insFeeOrders, Integer withTax) {
+        BigDecimal bigDecimal = new BigDecimal("1");
+        if (withTax == 0) {
+            // 不含税:保费 / 1.06
+            bigDecimal =  new BigDecimal("1.06");
+        }
         // 手续费比例
         BigDecimal jqCommissionRatio = covertPercent(ptlAgreementCostRatioVo.getJqCommissionRatio());
         BigDecimal syCommissionRatio = covertPercent(ptlAgreementCostRatioVo.getSyCommissionRatio());
@@ -323,9 +328,9 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
         insFeeOrders.setSyExportRatio(syExportRatio);
         insFeeOrders.setJyExportRatio(jyExportRatio);
         // 需求:入口 + 加投 - 出口 = 留点
-        BigDecimal jqKeepPointRatio = jqInletRatio.add(jqAdditionalRatio).subtract(jqExportRatio);
-        BigDecimal syKeepPointRatio = syInletRatio.add(syAdditionalRatio).subtract(syExportRatio);
-        BigDecimal jyKeepPointRatio = jyInletRatio.add(jyAdditionalRatio).subtract(jyExportRatio);
+        BigDecimal jqKeepPointRatio = (jqInletRatio.divide(bigDecimal, 5, RoundingMode.HALF_EVEN)).add(jqAdditionalRatio).subtract(jqExportRatio);
+        BigDecimal syKeepPointRatio = (syInletRatio.divide(bigDecimal, 5, RoundingMode.HALF_EVEN)).add(syAdditionalRatio).subtract(syExportRatio);
+        BigDecimal jyKeepPointRatio = (jyInletRatio.divide(bigDecimal, 5, RoundingMode.HALF_EVEN)).add(jyAdditionalRatio).subtract(jyExportRatio);
         // 留点比例
         insFeeOrders.setJqKeepPointRatio(jqKeepPointRatio);
         insFeeOrders.setSyKeepPointRatio(syKeepPointRatio);