Parcourir la source

费用修改bug

785834757 il y a 2 ans
Parent
commit
44dda99206

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

@@ -2605,10 +2605,6 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
         List<FeeOrderNewVo.ExportFee> exportFeeList = new ArrayList<>();
         List<FeeOrderNewVo.ExportFee> exportFeeList = new ArrayList<>();
         List<FeeOrderNewVo.DeptManagerFee> deptManagerFeeList = new ArrayList<>();
         List<FeeOrderNewVo.DeptManagerFee> deptManagerFeeList = new ArrayList<>();
 
 
-        FeeOrderNewVo.EntranceFee jqEntranceFee,syEntranceFee,noEntranceFee;
-        FeeOrderNewVo.ExportFee jqExportFee,syExportFee,noExportFee;
-        FeeOrderNewVo.DeptManagerFee jqDeptManagerFee,syDeptManagerFee,noDeptManagerFee;
-
         //查询协议是否包含税
         //查询协议是否包含税
         PtlAgreement ptlAgreement = ptlAgreementService.getById(insFeeOrderNew.getAgreementId());
         PtlAgreement ptlAgreement = ptlAgreementService.getById(insFeeOrderNew.getAgreementId());
         BigDecimal taxRadio = new BigDecimal("1.00");
         BigDecimal taxRadio = new BigDecimal("1.00");
@@ -2628,95 +2624,98 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
             sumRetail = sumRetail.add(insFeeOrderNew.getThirdDetailProportion());
             sumRetail = sumRetail.add(insFeeOrderNew.getThirdDetailProportion());
         }
         }
 
 
-        //交强入口费用
-        jqEntranceFee = calcEntranceFee(insFeeOrderNew.getJqPremium(),insFeeOrderNew.getJqSuperviseCostsProportion(),insFeeOrderNew.getJqOtherCostsProportion(),taxRadio);
-        jqEntranceFee.setInsuranceType("交强险");  // 险种
-        jqEntranceFee.setExportSuperviseCosts(insFeeOrderNew.getJqCostsExportProportion());  // 出口费比例
+        //region 入口费用
+        //交强
+        FeeOrderNewVo.EntranceFee jqEntranceFee = this.assignEntranceFee("交强险", insFeeOrderNew.getJqPremium(), insFeeOrderNew.getJqSuperviseCostsProportion(),
+                insFeeOrderNew.getJqOtherCostsProportion(), insFeeOrderNew.getJqCostsProportion(), insFeeOrderNew.getJqSuperviseCostsPremiums(),
+                insFeeOrderNew.getJqOtherCostsPremiums(), insFeeOrderNew.getJqCostsPremiums());
         entranceFeeList.add(jqEntranceFee);
         entranceFeeList.add(jqEntranceFee);
 
 
-        //交强机构管理费比例
-        jqDeptManagerFee = calcDeptManagerFee(insFeeOrderNew.getJqPremium(),insFeeOrderNew.getJqDeptProportionLevel1(),
-                insFeeOrderNew.getJqDeptProportionLevel2(),insFeeOrderNew.getJqDeptProportionLevel3(),
-                insFeeOrderNew.getJqDeptProportionLevel4(),insFeeOrderNew.getJqDeptProportionLevel5());
-        jqDeptManagerFee.setInsuranceType("交强险");
-        deptManagerFeeList.add(jqDeptManagerFee);
+        //商业
+        FeeOrderNewVo.EntranceFee syEntranceFee = this.assignEntranceFee("商业险", insFeeOrderNew.getSyPremium(), insFeeOrderNew.getSySuperviseCostsProportion(),
+                insFeeOrderNew.getSyOtherCostsProportion(), insFeeOrderNew.getSyCostsProportion(), insFeeOrderNew.getSySuperviseCostsPremiums(),
+                insFeeOrderNew.getSyOtherCostsPremiums(), insFeeOrderNew.getSyCostsPremiums());
+        entranceFeeList.add(syEntranceFee);
 
 
-        //交强机构管理费总比例
-        BigDecimal jqDeptManagerRadio = jqDeptManagerFee.getDeptProportionLevelOne().add(jqDeptManagerFee.getDeptProportionLevelTwo())
-                .add(jqDeptManagerFee.getDeptProportionLevelThree()).add(jqDeptManagerFee.getDeptProportionLevelFoure())
-                .add(jqDeptManagerFee.getDeptProportionLevelFive());
+        //非车
+        FeeOrderNewVo.EntranceFee noEntranceFee = this.assignEntranceFee("非车险", insFeeOrderNew.getNoPremium(), insFeeOrderNew.getNoSuperviseCostsProportion(),
+                insFeeOrderNew.getNoOtherCostsProportion(), insFeeOrderNew.getNoCostsProportion(), insFeeOrderNew.getNoSuperviseCostsPremiums(),
+                insFeeOrderNew.getNoOtherCostsPremiums(), insFeeOrderNew.getNoCostsPremiums());
+        entranceFeeList.add(noEntranceFee);
+        //endregion
 
 
-        //交强出口费用
-        jqExportFee = calcExportFee(insFeeOrderNew.getJqPremium(),insFeeOrderNew.getJqCostsExportProportion(),jqEntranceFee.getTotalProportion(),
-                jqDeptManagerRadio,sumRetail,taxRadio);
-        jqExportFee.setInsuranceType("交强险");
-        exportFeeList.add(jqExportFee);
 
 
-        //商业入口
-        syEntranceFee = calcEntranceFee(insFeeOrderNew.getSyPremium(),insFeeOrderNew.getSySuperviseCostsProportion(),insFeeOrderNew.getSyOtherCostsProportion(),taxRadio);
-        syEntranceFee.setInsuranceType("商业险");  // 险种
-        syEntranceFee.setExportSuperviseCosts(insFeeOrderNew.getSyCostsExportProportion());  // 出口费比例
-        entranceFeeList.add(syEntranceFee);
+        //region 机构管理对象
+
+        //交强
+        FeeOrderNewVo.DeptManagerFee jqDeptManagerFee = this.assignDeptFee("交强险",
+                insFeeOrderNew.getJqDeptProportionLevel1(), insFeeOrderNew.getJqDeptPremiumsLevel1(),
+                insFeeOrderNew.getJqDeptProportionLevel2(), insFeeOrderNew.getJqDeptPremiumsLevel2(),
+                insFeeOrderNew.getJqDeptProportionLevel3(), insFeeOrderNew.getJqDeptPremiumsLevel3(),
+                insFeeOrderNew.getJqDeptProportionLevel4(), insFeeOrderNew.getJqDeptPremiumsLevel4(),
+                insFeeOrderNew.getJqDeptProportionLevel5(), insFeeOrderNew.getJqDeptPremiumsLevel5());
+        deptManagerFeeList.add(jqDeptManagerFee);
 
 
-        // 商业管理费
-        syDeptManagerFee = calcDeptManagerFee(insFeeOrderNew.getSyPremium(),insFeeOrderNew.getSyDeptProportionLevel1(),
-                insFeeOrderNew.getSyDeptProportionLevel2(),insFeeOrderNew.getSyDeptProportionLevel3(),
-                insFeeOrderNew.getSyDeptProportionLevel4(),insFeeOrderNew.getSyDeptProportionLevel5());
-        syDeptManagerFee.setInsuranceType("商业险");
+        //商业
+        FeeOrderNewVo.DeptManagerFee syDeptManagerFee = this.assignDeptFee("商业险",
+                insFeeOrderNew.getSyDeptProportionLevel1(), insFeeOrderNew.getSyDeptPremiumsLevel1(),
+                insFeeOrderNew.getSyDeptProportionLevel2(), insFeeOrderNew.getSyDeptPremiumsLevel2(),
+                insFeeOrderNew.getSyDeptProportionLevel3(), insFeeOrderNew.getSyDeptPremiumsLevel3(),
+                insFeeOrderNew.getSyDeptProportionLevel4(), insFeeOrderNew.getSyDeptPremiumsLevel4(),
+                insFeeOrderNew.getSyDeptProportionLevel5(), insFeeOrderNew.getSyDeptPremiumsLevel5());
         deptManagerFeeList.add(syDeptManagerFee);
         deptManagerFeeList.add(syDeptManagerFee);
 
 
+        //非车
+        FeeOrderNewVo.DeptManagerFee noDeptManagerFee = this.assignDeptFee("非车险",
+                insFeeOrderNew.getNoDeptProportionLevel1(), insFeeOrderNew.getNoDeptPremiumsLevel1(),
+                insFeeOrderNew.getNoDeptProportionLevel2(), insFeeOrderNew.getNoDeptPremiumsLevel2(),
+                insFeeOrderNew.getNoDeptProportionLevel3(), insFeeOrderNew.getNoDeptPremiumsLevel3(),
+                insFeeOrderNew.getNoDeptProportionLevel4(), insFeeOrderNew.getNoDeptPremiumsLevel4(),
+                insFeeOrderNew.getNoDeptProportionLevel5(), insFeeOrderNew.getNoDeptPremiumsLevel5());
+        deptManagerFeeList.add(noDeptManagerFee);
+
+        //endregion
+
+        //region 机构管理对象 费用总比例计算
+        //交强机构管理费总比例
+        BigDecimal jqDeptManagerRadio = jqDeptManagerFee.getDeptProportionLevelOne().add(jqDeptManagerFee.getDeptProportionLevelTwo())
+                .add(jqDeptManagerFee.getDeptProportionLevelThree()).add(jqDeptManagerFee.getDeptProportionLevelFoure())
+                .add(jqDeptManagerFee.getDeptProportionLevelFive());
 
 
         //商业机构管理费总比例
         //商业机构管理费总比例
         BigDecimal syDeptManagerRadio = syDeptManagerFee.getDeptProportionLevelOne().add(syDeptManagerFee.getDeptProportionLevelTwo())
         BigDecimal syDeptManagerRadio = syDeptManagerFee.getDeptProportionLevelOne().add(syDeptManagerFee.getDeptProportionLevelTwo())
                 .add(syDeptManagerFee.getDeptProportionLevelThree()).add(syDeptManagerFee.getDeptProportionLevelFoure())
                 .add(syDeptManagerFee.getDeptProportionLevelThree()).add(syDeptManagerFee.getDeptProportionLevelFoure())
                 .add(syDeptManagerFee.getDeptProportionLevelFive());
                 .add(syDeptManagerFee.getDeptProportionLevelFive());
 
 
-        //商业出口费用
-        syExportFee = calcExportFee(insFeeOrderNew.getSyPremium(),insFeeOrderNew.getSyCostsExportProportion(),syEntranceFee.getTotalProportion(),
-                syDeptManagerRadio,sumRetail,taxRadio);
-        syExportFee.setInsuranceType("商业险");
-        exportFeeList.add(syExportFee);
-
-
-        //非车入口
-        noEntranceFee = calcEntranceFee(insFeeOrderNew.getNoPremium(),insFeeOrderNew.getNoSuperviseCostsProportion(),insFeeOrderNew.getNoOtherCostsProportion(),taxRadio);
-        noEntranceFee.setInsuranceType("非车险");  // 险种
-        noEntranceFee.setExportSuperviseCosts(insFeeOrderNew.getNoCostsExportProportion());  // 出口费比例
-        entranceFeeList.add(noEntranceFee);
-
-        //非车五级管理费
-        noDeptManagerFee = calcDeptManagerFee(insFeeOrderNew.getNoPremium(),insFeeOrderNew.getNoDeptProportionLevel1(),
-                insFeeOrderNew.getNoDeptProportionLevel2(),insFeeOrderNew.getNoDeptProportionLevel3(),
-                insFeeOrderNew.getNoDeptProportionLevel4(),insFeeOrderNew.getNoDeptProportionLevel5());
-        noDeptManagerFee.setInsuranceType("非车险");
-        deptManagerFeeList.add(noDeptManagerFee);
-
         //非车机构管理费总比例
         //非车机构管理费总比例
         BigDecimal noDeptManagerRadio = noDeptManagerFee.getDeptProportionLevelOne().add(noDeptManagerFee.getDeptProportionLevelTwo())
         BigDecimal noDeptManagerRadio = noDeptManagerFee.getDeptProportionLevelOne().add(noDeptManagerFee.getDeptProportionLevelTwo())
                 .add(noDeptManagerFee.getDeptProportionLevelThree()).add(noDeptManagerFee.getDeptProportionLevelFoure())
                 .add(noDeptManagerFee.getDeptProportionLevelThree()).add(noDeptManagerFee.getDeptProportionLevelFoure())
                 .add(noDeptManagerFee.getDeptProportionLevelFive());
                 .add(noDeptManagerFee.getDeptProportionLevelFive());
+        //endregion
+
 
 
-        //非车出口费用
-        noExportFee = calcExportFee(insFeeOrderNew.getNoPremium(),insFeeOrderNew.getNoCostsExportProportion(),noEntranceFee.getTotalProportion(),
-                noDeptManagerRadio,sumRetail,taxRadio);
-        noExportFee.setInsuranceType("非车险");
+        //region 出口费用
+        //交强
+        FeeOrderNewVo.ExportFee jqExportFee = this.assignExportFee("交强险",
+                insFeeOrderNew.getJqPremium(), insFeeOrderNew.getJqCostsExportProportion(), insFeeOrderNew.getJqExportOtherCostsProportion(),
+                insFeeOrderNew.getJqExportOtherCostsProportion(), insFeeOrderNew.getJqExportOtherCostsPremiums());
+        exportFeeList.add(jqExportFee);
+
+        //交强
+        FeeOrderNewVo.ExportFee syExportFee = this.assignExportFee("商业险",
+                insFeeOrderNew.getSyPremium(), insFeeOrderNew.getSyCostsExportProportion(), insFeeOrderNew.getSyExportOtherCostsProportion(),
+                insFeeOrderNew.getSyExportOtherCostsProportion(), insFeeOrderNew.getSyExportOtherCostsPremiums());
+        exportFeeList.add(syExportFee);
+
+
+        //交强
+        FeeOrderNewVo.ExportFee noExportFee = this.assignExportFee("非车险",
+                insFeeOrderNew.getNoPremium(), insFeeOrderNew.getNoCostsExportProportion(), insFeeOrderNew.getNoExportOtherCostsProportion(),
+                insFeeOrderNew.getNoExportOtherCostsProportion(), insFeeOrderNew.getNoExportOtherCostsPremiums());
         exportFeeList.add(noExportFee);
         exportFeeList.add(noExportFee);
 
 
-        //计算交强一级机构管理费  入口总费用 - 出口总费用  - 二三四五级机构管理费 - 分销费用
-        jqDeptManagerFee.setDeptPremiumsLevelOne(jqEntranceFee.getTotalAmount().subtract(jqExportFee.getTotalAmount())
-                .subtract(jqDeptManagerFee.getDeptPremiumsLevelTwo()).subtract(jqDeptManagerFee.getDeptPremiumsLevelThree())
-                .subtract(jqDeptManagerFee.getDeptPremiumsLevelFoure()).subtract(jqDeptManagerFee.getDeptPremiumsLevelFive()));
-        //计算商业一级机构管理费  入口总费用 - 出口总费用  - 二三四五级机构管理费 - 分销费用
-        syDeptManagerFee.setDeptPremiumsLevelOne(syEntranceFee.getTotalAmount().subtract(syExportFee.getTotalAmount())
-                .subtract(syDeptManagerFee.getDeptPremiumsLevelTwo()).subtract(syDeptManagerFee.getDeptPremiumsLevelThree())
-                .subtract(syDeptManagerFee.getDeptPremiumsLevelFoure()).subtract(syDeptManagerFee.getDeptPremiumsLevelFive()));
-        //计算非车一级机构管理费
-        noDeptManagerFee.setDeptPremiumsLevelOne(noEntranceFee.getTotalAmount().subtract(noExportFee.getTotalAmount())
-                .subtract(noDeptManagerFee.getDeptPremiumsLevelTwo()).subtract(noDeptManagerFee.getDeptPremiumsLevelThree())
-                .subtract(noDeptManagerFee.getDeptPremiumsLevelFoure()).subtract(noDeptManagerFee.getDeptPremiumsLevelFive()));
-
-        insFeeOrderNewService.updateLevelDeptManager(insFeeOrderNew.getInsOrderNo(),jqDeptManagerFee.getDeptPremiumsLevelOne(),
-                syDeptManagerFee.getDeptPremiumsLevelOne(),noDeptManagerFee.getDeptPremiumsLevelOne());
+
+        //endregion
 
 
         feeOrderNewVo.setEntranceFee(entranceFeeList);
         feeOrderNewVo.setEntranceFee(entranceFeeList);
         feeOrderNewVo.setExportFee(exportFeeList);
         feeOrderNewVo.setExportFee(exportFeeList);
@@ -2857,4 +2856,104 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
         }
         }
         return null;
         return null;
     }
     }
+
+    /**
+     * 从insFeeOrderNew表中拉取入口费用
+     * @param title     险种
+     * @param premium   保费
+     * @param superviseCostsProportion  手续费比例
+     * @param otherCostsProportion      跟单比例
+     * @param costsProportion           总比例
+     * @param superviseCostsPremiums    手续费
+     * @param otherCostsPremiums        跟单费
+     * @param costsPremiums             总费用
+     * @return
+     */
+    public FeeOrderNewVo.EntranceFee assignEntranceFee(String title,BigDecimal premium,BigDecimal superviseCostsProportion,BigDecimal otherCostsProportion,
+                                                       BigDecimal costsProportion,BigDecimal superviseCostsPremiums,BigDecimal otherCostsPremiums,
+                                                       BigDecimal costsPremiums){
+        FeeOrderNewVo.EntranceFee entranceFee = new FeeOrderNewVo.EntranceFee();
+        entranceFee.setInsuranceType(title);
+        //保费
+        entranceFee.setPremium(premium);
+        //手续费比例
+        entranceFee.setSuperviseCosts(superviseCostsProportion);
+        //跟单比例
+        entranceFee.setOtherCostsProportion(otherCostsProportion);
+        //总比例
+        entranceFee.setTotalProportion(costsProportion);
+        //手续费
+        entranceFee.setSuperviseCostsPremiums(superviseCostsPremiums);
+        //跟单费
+        entranceFee.setOtherCostsPremiums(otherCostsPremiums);
+        //总费用
+        entranceFee.setTotalAmount(costsPremiums);
+        return entranceFee;
+    }
+
+    /**
+     * 从insFeeOrderNew表中拉取机构管理费用
+     * @param title
+     * @param level1Proportion  1级机构管理比例
+     * @param level1Premium     1级机构管理费用
+     * @param level2Proportion
+     * @param level2Premium
+     * @param level3Proportion
+     * @param level3Premium
+     * @param level4Proportion
+     * @param level4Premium
+     * @param level5Proportion
+     * @param level5Premium
+     * @return
+     */
+    public FeeOrderNewVo.DeptManagerFee assignDeptFee(String title,BigDecimal level1Proportion,BigDecimal level1Premium,
+                                                   BigDecimal level2Proportion,BigDecimal level2Premium,
+                                                   BigDecimal level3Proportion,BigDecimal level3Premium,
+                                                   BigDecimal level4Proportion,BigDecimal level4Premium,
+                                                   BigDecimal level5Proportion,BigDecimal level5Premium){
+        FeeOrderNewVo.DeptManagerFee deptManagerFee = new FeeOrderNewVo.DeptManagerFee();
+        deptManagerFee.setInsuranceType(title);
+        deptManagerFee.setDeptProportionLevelOne(level1Proportion);
+        deptManagerFee.setDeptPremiumsLevelOne(level1Premium);
+        deptManagerFee.setDeptProportionLevelTwo(level2Proportion);
+        deptManagerFee.setDeptPremiumsLevelTwo(level2Premium);
+        deptManagerFee.setDeptProportionLevelThree(level3Proportion);
+        deptManagerFee.setDeptPremiumsLevelThree(level3Premium);
+        deptManagerFee.setDeptProportionLevelFoure(level4Proportion);
+        deptManagerFee.setDeptPremiumsLevelFoure(level4Premium);
+        deptManagerFee.setDeptProportionLevelFive(level5Proportion);
+        deptManagerFee.setDeptPremiumsLevelFive(level5Premium);
+        return deptManagerFee;
+    }
+
+    /**
+     * 出口费用赋值
+     * @param title
+     * @param premium
+     * @param superviseCostsProportion
+     * @param otherCostsProportion
+     * @param superviseCostsPremiums
+     * @param otherCostsPremiums
+     * @return
+     */
+    public FeeOrderNewVo.ExportFee assignExportFee(String title,BigDecimal premium,BigDecimal superviseCostsProportion,BigDecimal otherCostsProportion,
+                                                       BigDecimal superviseCostsPremiums,BigDecimal otherCostsPremiums){
+        FeeOrderNewVo.ExportFee exportFee = new FeeOrderNewVo.ExportFee();
+        exportFee.setInsuranceType(title);
+        //保费
+        exportFee.setPremium(premium);
+        //手续费比例
+        exportFee.setSuperviseCosts(superviseCostsProportion);
+        //跟单比例
+        exportFee.setOtherCostsProportion(otherCostsProportion);
+        //总比例
+        exportFee.setTotalProportion(superviseCostsProportion.add(otherCostsProportion));
+        //手续费
+        exportFee.setSuperviseCostsPremiums(superviseCostsPremiums);
+        //跟单费
+        exportFee.setOtherCostsPremiums(otherCostsPremiums);
+        //总费用
+        exportFee.setTotalAmount(superviseCostsPremiums.add(otherCostsPremiums));
+        return exportFee;
+    }
 }
 }