Procházet zdrojové kódy

修改报价 费用bug

785834757 před 2 roky
rodič
revize
f1742502a1

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

@@ -30,6 +30,7 @@ import com.ydtech.modules.protocol.entity.po.*;
 import com.ydtech.modules.protocol.service.*;
 import com.ydtech.modules.protocol.service.*;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
 import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew;
 import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew;
+import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.math.NumberUtils;
 import org.apache.commons.lang3.math.NumberUtils;
@@ -76,6 +77,8 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
     @Resource
     @Resource
     private PtlAgreementUndwrtRulesService ptlAgreementUndwrtRulesService;
     private PtlAgreementUndwrtRulesService ptlAgreementUndwrtRulesService;
 
 
+    @Resource
+    private InsFeeOrderNewService insFeeOrderNewService;
 
 
     /**
     /**
      * 根据跟单信息,以及配置的费用因子,获取合适的跟单费用
      * 根据跟单信息,以及配置的费用因子,获取合适的跟单费用
@@ -2713,6 +2716,22 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
         noExportFee.setInsuranceType("非车险");
         noExportFee.setInsuranceType("非车险");
         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());
+
         feeOrderNewVo.setEntranceFee(entranceFeeList);
         feeOrderNewVo.setEntranceFee(entranceFeeList);
         feeOrderNewVo.setExportFee(exportFeeList);
         feeOrderNewVo.setExportFee(exportFeeList);
         feeOrderNewVo.setDeptManagerFee(deptManagerFeeList);
         feeOrderNewVo.setDeptManagerFee(deptManagerFeeList);
@@ -2728,16 +2747,16 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
     public FeeOrderNewVo.EntranceFee calcEntranceFee(BigDecimal premium, BigDecimal superviseCostsProportion, BigDecimal otherCostsProportion, BigDecimal taxRate){
     public FeeOrderNewVo.EntranceFee calcEntranceFee(BigDecimal premium, BigDecimal superviseCostsProportion, BigDecimal otherCostsProportion, BigDecimal taxRate){
         FeeOrderNewVo.EntranceFee entranceFee = new FeeOrderNewVo.EntranceFee();
         FeeOrderNewVo.EntranceFee entranceFee = new FeeOrderNewVo.EntranceFee();
         entranceFee.setPremium(premium);
         entranceFee.setPremium(premium);
-        premium = premium.divide(taxRate,2,RoundingMode.DOWN);
+        premium = premium.divide(taxRate,5,RoundingMode.HALF_UP);
         //手续费
         //手续费
-        entranceFee.setSuperviseCostsPremiums(premium.multiply(superviseCostsProportion.divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN));
+        entranceFee.setSuperviseCostsPremiums(premium.multiply(superviseCostsProportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_UP));
         entranceFee.setSuperviseCosts(superviseCostsProportion);
         entranceFee.setSuperviseCosts(superviseCostsProportion);
         //跟单费
         //跟单费
-        entranceFee.setOtherCostsPremiums(premium.multiply(otherCostsProportion.divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN));
+        entranceFee.setOtherCostsPremiums(premium.multiply(otherCostsProportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_UP));
         entranceFee.setOtherCostsProportion(otherCostsProportion);
         entranceFee.setOtherCostsProportion(otherCostsProportion);
         //总费用比例
         //总费用比例
         BigDecimal totalCostsProportion = superviseCostsProportion.add(otherCostsProportion);
         BigDecimal totalCostsProportion = superviseCostsProportion.add(otherCostsProportion);
-        entranceFee.setTotalAmount(premium.multiply(totalCostsProportion.divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN));
+        entranceFee.setTotalAmount(premium.multiply(totalCostsProportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_UP));
         entranceFee.setTotalProportion(totalCostsProportion);
         entranceFee.setTotalProportion(totalCostsProportion);
         return entranceFee;
         return entranceFee;
     }
     }
@@ -2756,19 +2775,19 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
                                                            BigDecimal level3Proportion,BigDecimal level4Proportion,BigDecimal level5Proportion){
                                                            BigDecimal level3Proportion,BigDecimal level4Proportion,BigDecimal level5Proportion){
         FeeOrderNewVo.DeptManagerFee deptManagerFee = new FeeOrderNewVo.DeptManagerFee();
         FeeOrderNewVo.DeptManagerFee deptManagerFee = new FeeOrderNewVo.DeptManagerFee();
         //一级管理费
         //一级管理费
-        deptManagerFee.setDeptPremiumsLevelOne(premium.multiply(level1Proportion.divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN));
+        deptManagerFee.setDeptPremiumsLevelOne(premium.multiply(level1Proportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_UP));
         deptManagerFee.setDeptProportionLevelOne(level1Proportion);
         deptManagerFee.setDeptProportionLevelOne(level1Proportion);
         //二级管理费
         //二级管理费
-        deptManagerFee.setDeptPremiumsLevelTwo(premium.multiply(level2Proportion.divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN));
+        deptManagerFee.setDeptPremiumsLevelTwo(premium.multiply(level2Proportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_UP));
         deptManagerFee.setDeptProportionLevelTwo(level2Proportion);
         deptManagerFee.setDeptProportionLevelTwo(level2Proportion);
         //三级管理费
         //三级管理费
-        deptManagerFee.setDeptPremiumsLevelThree(premium.multiply(level3Proportion.divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN));
+        deptManagerFee.setDeptPremiumsLevelThree(premium.multiply(level3Proportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_UP));
         deptManagerFee.setDeptProportionLevelThree(level3Proportion);
         deptManagerFee.setDeptProportionLevelThree(level3Proportion);
         //四级管理费
         //四级管理费
-        deptManagerFee.setDeptPremiumsLevelFoure(premium.multiply(level4Proportion.divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN));
+        deptManagerFee.setDeptPremiumsLevelFoure(premium.multiply(level4Proportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_UP));
         deptManagerFee.setDeptProportionLevelFoure(level4Proportion);
         deptManagerFee.setDeptProportionLevelFoure(level4Proportion);
         //五级管理费
         //五级管理费
-        deptManagerFee.setDeptPremiumsLevelFive(premium.multiply(level5Proportion.divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN));
+        deptManagerFee.setDeptPremiumsLevelFive(premium.multiply(level5Proportion.divide(new BigDecimal(100))).setScale(5,BigDecimal.ROUND_HALF_UP));
         deptManagerFee.setDeptProportionLevelFive(level5Proportion);
         deptManagerFee.setDeptProportionLevelFive(level5Proportion);
         return deptManagerFee;
         return deptManagerFee;
     }
     }
@@ -2806,9 +2825,9 @@ public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
             exportFee.setOtherCostsProportion(exportTotalProportion.subtract(superviseCostsProportion));
             exportFee.setOtherCostsProportion(exportTotalProportion.subtract(superviseCostsProportion));
             exportFee.setSuperviseCosts(superviseCostsProportion);
             exportFee.setSuperviseCosts(superviseCostsProportion);
         }
         }
-        exportFee.setSuperviseCostsPremiums(premium.multiply(exportFee.getSuperviseCosts().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN));
-        exportFee.setOtherCostsPremiums(premium.multiply(exportFee.getOtherCostsProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN));
-        exportFee.setTotalAmount(premium.multiply(exportFee.getTotalProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN));
+        exportFee.setSuperviseCostsPremiums(premium.multiply(exportFee.getSuperviseCosts().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_HALF_UP));
+        exportFee.setOtherCostsPremiums(premium.multiply(exportFee.getOtherCostsProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_HALF_UP));
+        exportFee.setTotalAmount(premium.multiply(exportFee.getTotalProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_HALF_UP));
         return exportFee;
         return exportFee;
     }
     }
 
 

+ 9 - 0
src/main/java/com/ydtech/modules/protocols/service/InsFeeOrderNewService.java

@@ -3,6 +3,7 @@ package com.ydtech.modules.protocols.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
 
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -28,4 +29,12 @@ public interface InsFeeOrderNewService extends IService<InsFeeOrderNew> {
      */
      */
     List<InsFeeOrderNew> getByUserIdAndOrderStatusAndNoCheck(String userId);
     List<InsFeeOrderNew> getByUserIdAndOrderStatusAndNoCheck(String userId);
 
 
+    /**
+     * 更新一级机构管理费用
+     * @param insOrderNo
+     * @param jqPremium
+     * @return
+     */
+    boolean updateLevelDeptManager(String insOrderNo, BigDecimal jqPremium, BigDecimal syPremium, BigDecimal noPremium);
+
 }
 }

+ 12 - 0
src/main/java/com/ydtech/modules/protocols/service/impl/InsFeeOrderNewServiceImpl.java

@@ -7,6 +7,7 @@ import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
 import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
 import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -49,4 +50,15 @@ public class InsFeeOrderNewServiceImpl extends ServiceImpl<InsFeeOrderNewMapper,
     public List<InsFeeOrderNew> getByUserIdAndOrderStatusAndNoCheck(String userId) {
     public List<InsFeeOrderNew> getByUserIdAndOrderStatusAndNoCheck(String userId) {
         return baseMapper.getByUserIdAndOrderStatusAndNoCheck(userId);
         return baseMapper.getByUserIdAndOrderStatusAndNoCheck(userId);
     }
     }
+
+    @Override
+    public boolean updateLevelDeptManager(String insOrderNo, BigDecimal jqPremium, BigDecimal syPremium, BigDecimal noPremium) {
+        InsFeeOrderNew insFeeOrderNew = baseMapper.selectOne(new LambdaQueryWrapper<InsFeeOrderNew>()
+                .eq(InsFeeOrderNew::getInsOrderNo, insOrderNo));
+        insFeeOrderNew.setJqDeptPremiumsLevel1(jqPremium);
+        insFeeOrderNew.setSyDeptPremiumsLevel1(syPremium);
+        insFeeOrderNew.setNoDeptPremiumsLevel1(noPremium);
+        baseMapper.updateById(insFeeOrderNew);
+        return true;
+    }
 }
 }