|
|
@@ -7,11 +7,18 @@ import com.ydtech.exception.SystemException;
|
|
|
import com.ydtech.modules.admin.model.SysUser;
|
|
|
import com.ydtech.modules.admin.service.SysUserService;
|
|
|
import com.ydtech.modules.base.controller.BaseController;
|
|
|
+import com.ydtech.modules.esm.model.EsmRetail;
|
|
|
+import com.ydtech.modules.esm.model.EsmUserReferrer;
|
|
|
+import com.ydtech.modules.esm.service.EsmRetailService;
|
|
|
+import com.ydtech.modules.fee.dto.vo.ReCalcuLateProportion;
|
|
|
+import com.ydtech.modules.fee.dto.vo.RetailProportion;
|
|
|
import com.ydtech.modules.fee.dto.vo.RetailStoreFee;
|
|
|
import com.ydtech.modules.fee.service.CostsCalcService;
|
|
|
+import com.ydtech.modules.fee.service.FeeRuleSchemeNewService;
|
|
|
import com.ydtech.modules.fee.service.FeeRuleSchemeService;
|
|
|
import com.ydtech.modules.order.entity.InsAreaCompany;
|
|
|
import com.ydtech.modules.order.entity.InsOrders;
|
|
|
+import com.ydtech.modules.order.entity.vo.DistributionLevelVo;
|
|
|
import com.ydtech.modules.order.entity.vo.FeeOrderNewRecordVo;
|
|
|
import com.ydtech.modules.order.entity.vo.FeeOrderNewVo;
|
|
|
import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
|
@@ -1096,10 +1103,20 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
|
|
|
@Autowired
|
|
|
FeeRuleSchemeService feeRuleSchemeService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ FeeRuleSchemeNewService feeRuleSchemeNewService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ EsmRetailService esmRetailService;
|
|
|
+
|
|
|
+
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public FeeOrderNewVo costsAdjust(FeeOrderNewRecordVo feeOrderNewRecordVo) {
|
|
|
FeeOrderNewVo feeOrderNewVo = feeOrderNewRecordVo.getFeeOrderNewVoNew();
|
|
|
+
|
|
|
+ //region 费用校验
|
|
|
+
|
|
|
//验证费用是否匹配
|
|
|
if (feeOrderNewVo.getEntranceFee().get(0).getSuperviseCosts().add(feeOrderNewVo.getEntranceFee().get(0).getOtherCostsProportion())
|
|
|
.compareTo(feeOrderNewVo.getEntranceFee().get(0).getTotalProportion()) != 0) {
|
|
|
@@ -1118,9 +1135,14 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
|
|
|
if(!modifyCostsHistory(feeOrderNewRecordVo)){
|
|
|
throw new SystemException("调整费用失败");
|
|
|
}
|
|
|
+
|
|
|
+ //endregion
|
|
|
+
|
|
|
String feeId = feeOrderNewRecordVo.getFeeId();
|
|
|
InsFeeOrderNew insFeeOrderNew = insFeeOrderNewService.getById(feeId);
|
|
|
-
|
|
|
+ InsAreaCompany insAreaCompany = insAreaCompanyService.getById(insFeeOrderNew.getInsOrderNo());
|
|
|
+ InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
|
|
|
+ SysUser sysUser = sysUserService.findByUserId(insOrders.getUserid());
|
|
|
|
|
|
|
|
|
//查询协议是否包含税
|
|
|
@@ -1130,127 +1152,387 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
|
|
|
taxRadio = new BigDecimal("1.06");
|
|
|
}
|
|
|
|
|
|
- //分销费用信息 使用比例
|
|
|
- InsAreaCompany insAreaCompany = insAreaCompanyService.getById(insFeeOrderNew.getInsOrderNo());
|
|
|
- InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
|
|
|
- SysUser sysUser = sysUserService.findByUserId(insOrders.getUserid());
|
|
|
- RetailStoreFee retailStoreFee = costsCalcService.getRetailStoreFee(sysUser.getId(),
|
|
|
- insFeeOrderNew.getJqPremium().add(insFeeOrderNew.getSyPremium()).add(insFeeOrderNew.getNoPremium()));
|
|
|
|
|
|
|
|
|
List<FeeOrderNewVo.EntranceFee> entranceFeeList = new ArrayList<>();
|
|
|
List<FeeOrderNewVo.DeptManagerFee> deptManagerFeeList = new ArrayList<>();
|
|
|
List<FeeOrderNewVo.ExportFee> exportFeeList = new ArrayList<>();
|
|
|
+ List<FeeOrderNewVo.RetailFee> retailFeeList = new ArrayList<>();
|
|
|
|
|
|
//region 入口费用
|
|
|
//交强入口费用
|
|
|
- FeeOrderNewVo.EntranceFee jqEntranceFee = feeRuleSchemeService.calcEntranceFee(insFeeOrderNew.getJqPremium(),
|
|
|
+ FeeOrderNewVo.EntranceFee jqEntranceFee = feeRuleSchemeService.calcEntranceFee(
|
|
|
+ insFeeOrderNew.getJqPremium(),
|
|
|
feeOrderNewVo.getEntranceFee().get(0).getSuperviseCosts(),
|
|
|
- feeOrderNewVo.getEntranceFee().get(0).getOtherCostsProportion(), taxRadio);
|
|
|
+ feeOrderNewVo.getEntranceFee().get(0).getOtherCostsProportion(),
|
|
|
+ taxRadio);
|
|
|
+
|
|
|
jqEntranceFee.setInsuranceType("交强险");
|
|
|
entranceFeeList.add(jqEntranceFee);
|
|
|
|
|
|
//商业入口费用
|
|
|
FeeOrderNewVo.EntranceFee syEntranceFee = feeRuleSchemeService.calcEntranceFee(insFeeOrderNew.getSyPremium(),
|
|
|
feeOrderNewVo.getEntranceFee().get(1).getSuperviseCosts(),
|
|
|
- feeOrderNewVo.getEntranceFee().get(1).getOtherCostsProportion(), taxRadio);
|
|
|
+ feeOrderNewVo.getEntranceFee().get(1).getOtherCostsProportion(),
|
|
|
+ taxRadio);
|
|
|
+
|
|
|
syEntranceFee.setInsuranceType("商业险");
|
|
|
entranceFeeList.add(syEntranceFee);
|
|
|
|
|
|
//非车入口费用
|
|
|
FeeOrderNewVo.EntranceFee noEntranceFee = feeRuleSchemeService.calcEntranceFee(insFeeOrderNew.getNoPremium(),
|
|
|
feeOrderNewVo.getEntranceFee().get(2).getSuperviseCosts(),
|
|
|
- feeOrderNewVo.getEntranceFee().get(2).getOtherCostsProportion(), taxRadio);
|
|
|
+ feeOrderNewVo.getEntranceFee().get(2).getOtherCostsProportion(),
|
|
|
+ taxRadio);
|
|
|
+
|
|
|
noEntranceFee.setInsuranceType("非车险");
|
|
|
entranceFeeList.add(noEntranceFee);
|
|
|
|
|
|
//endregion
|
|
|
|
|
|
+ //region 重新计算管理费比例和分销比例
|
|
|
+
|
|
|
+ List<EsmRetail> esmRetailList = esmRetailService.selectList(" where t.deptid=? and t.status = '1' ",
|
|
|
+ new Object[]{sysUser.getDeptId()});
|
|
|
+
|
|
|
+ Integer retailLevel = 0;
|
|
|
+
|
|
|
+ PtlAgreementProductCostsExport ptlAgreementProductCostsExport = new PtlAgreementProductCostsExport();
|
|
|
+
|
|
|
+ //默认分销比例设置
|
|
|
+ RetailProportion retailProportion = new RetailProportion();
|
|
|
+ if(!Objects.isNull(esmRetailList) && !esmRetailList.isEmpty())
|
|
|
+ {
|
|
|
+ retailLevel = Integer.parseInt(esmRetailList.get(0).getRetailtype());
|
|
|
+ //赋值默认的分销比例
|
|
|
+ retailProportion.setProportion(esmRetailList.get(0).getDisrate1(),esmRetailList.get(0).getDisrate2(),esmRetailList.get(0).getDisrate3());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //获取交强机构管理费总比例
|
|
|
+ BigDecimal jqDeptProportion =
|
|
|
+ feeOrderNewVo.getDeptManagerFee().get(0).getDeptProportionLevelOne()
|
|
|
+ .add(feeOrderNewVo.getDeptManagerFee().get(0).getDeptProportionLevelTwo())
|
|
|
+ .add(feeOrderNewVo.getDeptManagerFee().get(0).getDeptProportionLevelThree())
|
|
|
+ .add(feeOrderNewVo.getDeptManagerFee().get(0).getDeptProportionLevelFoure())
|
|
|
+ .add(feeOrderNewVo.getDeptManagerFee().get(0).getDeptProportionLevelFive());
|
|
|
+ //获取商业机构管理费总比例
|
|
|
+ BigDecimal syDeptProportion =
|
|
|
+ feeOrderNewVo.getDeptManagerFee().get(1).getDeptProportionLevelOne()
|
|
|
+ .add(feeOrderNewVo.getDeptManagerFee().get(1).getDeptProportionLevelTwo())
|
|
|
+ .add(feeOrderNewVo.getDeptManagerFee().get(1).getDeptProportionLevelThree())
|
|
|
+ .add(feeOrderNewVo.getDeptManagerFee().get(1).getDeptProportionLevelFoure())
|
|
|
+ .add(feeOrderNewVo.getDeptManagerFee().get(1).getDeptProportionLevelFive());
|
|
|
+ //获取非车机构管理费总比例
|
|
|
+ BigDecimal noDeptProportion =
|
|
|
+ feeOrderNewVo.getDeptManagerFee().get(2).getDeptProportionLevelOne()
|
|
|
+ .add(feeOrderNewVo.getDeptManagerFee().get(2).getDeptProportionLevelTwo())
|
|
|
+ .add(feeOrderNewVo.getDeptManagerFee().get(2).getDeptProportionLevelThree())
|
|
|
+ .add(feeOrderNewVo.getDeptManagerFee().get(2).getDeptProportionLevelFoure())
|
|
|
+ .add(feeOrderNewVo.getDeptManagerFee().get(2).getDeptProportionLevelFive());
|
|
|
+
|
|
|
+ ptlAgreementProductCostsExport.setJqExportRadioLevel1(feeOrderNewVo.getDeptManagerFee().get(0).getDeptProportionLevelOne());
|
|
|
+ ptlAgreementProductCostsExport.setJqExportRadioLevel2(feeOrderNewVo.getDeptManagerFee().get(0).getDeptProportionLevelTwo());
|
|
|
+ ptlAgreementProductCostsExport.setJqExportRadioLevel3(feeOrderNewVo.getDeptManagerFee().get(0).getDeptProportionLevelThree());
|
|
|
+ ptlAgreementProductCostsExport.setJqExportRadioLevel4(feeOrderNewVo.getDeptManagerFee().get(0).getDeptProportionLevelFoure());
|
|
|
+ ptlAgreementProductCostsExport.setJqExportRadioLevel5(feeOrderNewVo.getDeptManagerFee().get(0).getDeptProportionLevelFive());
|
|
|
+
|
|
|
+ ptlAgreementProductCostsExport.setSyExportRadioLevel1(feeOrderNewVo.getDeptManagerFee().get(1).getDeptProportionLevelOne());
|
|
|
+ ptlAgreementProductCostsExport.setSyExportRadioLevel2(feeOrderNewVo.getDeptManagerFee().get(1).getDeptProportionLevelTwo());
|
|
|
+ ptlAgreementProductCostsExport.setSyExportRadioLevel3(feeOrderNewVo.getDeptManagerFee().get(1).getDeptProportionLevelThree());
|
|
|
+ ptlAgreementProductCostsExport.setSyExportRadioLevel4(feeOrderNewVo.getDeptManagerFee().get(1).getDeptProportionLevelFoure());
|
|
|
+ ptlAgreementProductCostsExport.setSyExportRadioLevel5(feeOrderNewVo.getDeptManagerFee().get(1).getDeptProportionLevelFive());
|
|
|
+
|
|
|
+ ptlAgreementProductCostsExport.setNoCarExportRadioLevel1(feeOrderNewVo.getDeptManagerFee().get(2).getDeptProportionLevelOne());
|
|
|
+ ptlAgreementProductCostsExport.setNoCarExportRadioLevel2(feeOrderNewVo.getDeptManagerFee().get(2).getDeptProportionLevelTwo());
|
|
|
+ ptlAgreementProductCostsExport.setNoCarExportRadioLevel3(feeOrderNewVo.getDeptManagerFee().get(2).getDeptProportionLevelThree());
|
|
|
+ ptlAgreementProductCostsExport.setNoCarExportRadioLevel4(feeOrderNewVo.getDeptManagerFee().get(2).getDeptProportionLevelFoure());
|
|
|
+ ptlAgreementProductCostsExport.setNoCarExportRadioLevel5(feeOrderNewVo.getDeptManagerFee().get(2).getDeptProportionLevelFive());
|
|
|
+
|
|
|
+
|
|
|
+ //获取交强分销总比例
|
|
|
+ BigDecimal jqRetailProportion = retailProportion.getJqRetailLevel1Proportion()
|
|
|
+ .add(retailProportion.getJqRetailLevel2Proportion())
|
|
|
+ .add(retailProportion.getJqRetailLevel3Proportion());
|
|
|
+
|
|
|
+ //获取商业分销总比例
|
|
|
+ BigDecimal syRetailProportion = retailProportion.getSyRetailLevel1Proportion()
|
|
|
+ .add(retailProportion.getSyRetailLevel2Proportion())
|
|
|
+ .add(retailProportion.getSyRetailLevel3Proportion());
|
|
|
+
|
|
|
+ //获取非车分销总比例
|
|
|
+ BigDecimal noRetailProportion = retailProportion.getNoRetailLevel1Proportion()
|
|
|
+ .add(retailProportion.getNoRetailLevel2Proportion())
|
|
|
+ .add(retailProportion.getNoRetailLevel3Proportion());
|
|
|
+
|
|
|
+ //重新计算比例 入口是否超出支付的比例
|
|
|
+ ReCalcuLateProportion jqReCalcuLateProportion = feeRuleSchemeNewService.recalculateProportion(
|
|
|
+ feeOrderNewVo.getEntranceFee().get(0).getTotalProportion(),
|
|
|
+ jqDeptProportion,
|
|
|
+ jqRetailProportion,
|
|
|
+ taxRadio,
|
|
|
+ retailLevel,
|
|
|
+ ptlAgreementProductCostsExport,
|
|
|
+ retailProportion,
|
|
|
+ "jq");
|
|
|
+
|
|
|
+ ReCalcuLateProportion syReCalcuLateProportion = feeRuleSchemeNewService.recalculateProportion(
|
|
|
+ feeOrderNewVo.getEntranceFee().get(1).getTotalProportion(),
|
|
|
+ syDeptProportion,
|
|
|
+ syRetailProportion,
|
|
|
+ taxRadio,
|
|
|
+ retailLevel,
|
|
|
+ ptlAgreementProductCostsExport,
|
|
|
+ retailProportion,
|
|
|
+ "sy");
|
|
|
+
|
|
|
+ ReCalcuLateProportion noReCalcuLateProportion = feeRuleSchemeNewService.recalculateProportion(
|
|
|
+ feeOrderNewVo.getEntranceFee().get(2).getTotalProportion(),
|
|
|
+ noDeptProportion,
|
|
|
+ noRetailProportion,
|
|
|
+ taxRadio,
|
|
|
+ retailLevel,
|
|
|
+ ptlAgreementProductCostsExport,
|
|
|
+ retailProportion,
|
|
|
+ "no");
|
|
|
+
|
|
|
+ retailProportion.setProportion(jqReCalcuLateProportion,syReCalcuLateProportion,noReCalcuLateProportion);
|
|
|
+// ptlAgreementProductCostsExportService.updateById(ptlAgreementProductCostsExport);
|
|
|
+
|
|
|
+
|
|
|
+ //endregion
|
|
|
+
|
|
|
+ //region 计算分销费用
|
|
|
+
|
|
|
+ //获取分销比例
|
|
|
+
|
|
|
+ //分销总比例
|
|
|
+ BigDecimal jqRetailRadio = new BigDecimal("0");
|
|
|
+ BigDecimal syRetailRadio = new BigDecimal("0");
|
|
|
+ BigDecimal noRetailRadio = new BigDecimal("0");
|
|
|
+
|
|
|
+ FeeOrderNewVo.RetailFee retailFeeLevel3 = new FeeOrderNewVo.RetailFee();
|
|
|
+ FeeOrderNewVo.RetailFee retailFeeLevel2 = new FeeOrderNewVo.RetailFee();
|
|
|
+ FeeOrderNewVo.RetailFee retailFeeLevel1 = new FeeOrderNewVo.RetailFee();
|
|
|
+
|
|
|
+ if (esmRetailList != null && !esmRetailList.isEmpty()) {
|
|
|
+ EsmRetail esmRetail = esmRetailList.get(0);
|
|
|
+ //分销等级
|
|
|
+ insFeeOrderNew.setDistributionStatus(esmRetailList.get(0).getRetailtype());
|
|
|
+
|
|
|
+ if (esmRetail != null) {
|
|
|
+ if (Integer.parseInt(esmRetail.getRetailtype()) >= 3) {
|
|
|
+ insFeeOrderNew.setThirdDetailProportion(retailProportion.getJqRetailLevel3Proportion());
|
|
|
+ retailFeeLevel3 = feeRuleSchemeService.calcRetail(insFeeOrderNew.getJqPremium(),
|
|
|
+ insFeeOrderNew.getJqCostsProportion(),
|
|
|
+ insFeeOrderNew.getSyPremium(),
|
|
|
+ insFeeOrderNew.getSyCostsProportion().add(insFeeOrderNew.getSyOtherCostsProportion()),
|
|
|
+ insFeeOrderNew.getNoPremium(),
|
|
|
+ insFeeOrderNew.getNoCostsProportion().add(insFeeOrderNew.getNoOtherCostsProportion()),
|
|
|
+ retailProportion.getJqRetailLevel3Proportion(),
|
|
|
+ retailProportion.getSyRetailLevel3Proportion(),
|
|
|
+ retailProportion.getNoRetailLevel3Proportion());
|
|
|
+ if(insFeeOrderNew.getFirstLevelUserId() != null){
|
|
|
+ SysUser byId = sysUserService.getById(insFeeOrderNew.getThreeLevelUserId());
|
|
|
+ retailFeeLevel3.setUserName(byId.getName()+"("+byId.getId()+")");
|
|
|
+ }
|
|
|
+ insFeeOrderNew.setThirdDetailPremiums(retailFeeLevel3.getTotalRetailPremiums());
|
|
|
+ }else{
|
|
|
+ insFeeOrderNew.setThirdDetailProportion(new BigDecimal(0));
|
|
|
+ }
|
|
|
+ if (Integer.parseInt(esmRetail.getRetailtype()) >= 2) {
|
|
|
+ insFeeOrderNew.setSecondDetailProportion(retailProportion.getJqRetailLevel2Proportion());
|
|
|
+ retailFeeLevel2 = feeRuleSchemeService.calcRetail(insFeeOrderNew.getJqPremium(),
|
|
|
+ insFeeOrderNew.getJqCostsProportion(),
|
|
|
+ insFeeOrderNew.getSyPremium(),
|
|
|
+ insFeeOrderNew.getSyCostsProportion(),
|
|
|
+ insFeeOrderNew.getNoPremium(),
|
|
|
+ insFeeOrderNew.getNoCostsProportion(),
|
|
|
+ retailProportion.getJqRetailLevel2Proportion(),
|
|
|
+ retailProportion.getSyRetailLevel2Proportion(),
|
|
|
+ retailProportion.getNoRetailLevel2Proportion());
|
|
|
+
|
|
|
+ insFeeOrderNew.setSecondDetailPremiums(retailFeeLevel2.getTotalRetailPremiums());
|
|
|
+ if(insFeeOrderNew.getTwoLevelUserId() != null) {
|
|
|
+ SysUser byId = sysUserService.getById(insFeeOrderNew.getTwoLevelUserId());
|
|
|
+ retailFeeLevel2.setUserName(byId.getName() + "(" + byId.getId() + ")");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ insFeeOrderNew.setSecondDetailProportion(new BigDecimal(0));
|
|
|
+ }
|
|
|
+ if (Integer.parseInt(esmRetail.getRetailtype()) >= 1) {
|
|
|
+ insFeeOrderNew.setFirstDetailProportion(retailProportion.getJqRetailLevel1Proportion());
|
|
|
+ retailFeeLevel1 = feeRuleSchemeService.calcRetail(insFeeOrderNew.getJqPremium(),
|
|
|
+ insFeeOrderNew.getJqCostsProportion(),
|
|
|
+ insFeeOrderNew.getSyPremium(),
|
|
|
+ insFeeOrderNew.getSyCostsProportion(),
|
|
|
+ insFeeOrderNew.getNoPremium(),
|
|
|
+ insFeeOrderNew.getNoCostsProportion(),
|
|
|
+ retailProportion.getJqRetailLevel1Proportion(),
|
|
|
+ retailProportion.getSyRetailLevel1Proportion(),
|
|
|
+ retailProportion.getNoRetailLevel1Proportion());
|
|
|
+
|
|
|
+ insFeeOrderNew.setFirstDetailPremiums(retailFeeLevel1.getTotalRetailPremiums());
|
|
|
+ if(insFeeOrderNew.getFirstLevelUserId() != null) {
|
|
|
+ SysUser byId = sysUserService.getById(insFeeOrderNew.getFirstLevelUserId());
|
|
|
+ retailFeeLevel1.setUserName(byId.getName() + "(" + byId.getId() + ")");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ insFeeOrderNew.setFirstDetailProportion(new BigDecimal(0));
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ insFeeOrderNew.setFirstDetailPremiums(new BigDecimal(0));
|
|
|
+ insFeeOrderNew.setSecondDetailPremiums(new BigDecimal(0));
|
|
|
+ insFeeOrderNew.setThirdDetailPremiums(new BigDecimal(0));
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ insFeeOrderNew.setFirstDetailProportion(new BigDecimal(0));
|
|
|
+ insFeeOrderNew.setSecondDetailProportion(new BigDecimal(0));
|
|
|
+ insFeeOrderNew.setThirdDetailProportion(new BigDecimal(0));
|
|
|
+ }
|
|
|
+ jqRetailRadio = jqRetailRadio.add(retailFeeLevel1.getJqRetailProportion())
|
|
|
+ .add(retailFeeLevel2.getJqRetailProportion())
|
|
|
+ .add(retailFeeLevel3.getJqRetailProportion());
|
|
|
+
|
|
|
+ syRetailRadio = syRetailRadio.add(retailFeeLevel1.getSyRetailProportion())
|
|
|
+ .add(retailFeeLevel2.getSyRetailProportion())
|
|
|
+ .add(retailFeeLevel3.getSyRetailProportion());
|
|
|
+
|
|
|
+ noRetailRadio = noRetailRadio.add(retailFeeLevel1.getNoRetailProportion())
|
|
|
+ .add(retailFeeLevel2.getNoRetailProportion())
|
|
|
+ .add(retailFeeLevel3.getNoRetailProportion());
|
|
|
+
|
|
|
+ retailFeeLevel1.setInsuranceType("一级分销");
|
|
|
+ retailFeeLevel2.setInsuranceType("二级分销");
|
|
|
+ retailFeeLevel3.setInsuranceType("三级分销");
|
|
|
+
|
|
|
+ retailFeeList.add(retailFeeLevel1);
|
|
|
+ retailFeeList.add(retailFeeLevel2);
|
|
|
+ retailFeeList.add(retailFeeLevel3);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ insFeeOrderNew.assignRetail(retailFeeLevel1,retailFeeLevel2,retailFeeLevel3);
|
|
|
+
|
|
|
+ //endregion
|
|
|
+
|
|
|
+ //region 设置机构管理费
|
|
|
+
|
|
|
+ //交强机构管理费
|
|
|
+ BigDecimal jqDeptRadio =
|
|
|
+ jqReCalcuLateProportion.getDept_level_1_proportion()
|
|
|
+ .add(jqReCalcuLateProportion.getDept_level_2_proportion())
|
|
|
+ .add(jqReCalcuLateProportion.getDept_level_3_proportion())
|
|
|
+ .add(jqReCalcuLateProportion.getDept_level_4_proportion())
|
|
|
+ .add(jqReCalcuLateProportion.getDept_level_5_proportion());
|
|
|
+
|
|
|
+ FeeOrderNewVo.DeptManagerFee jqDeptManagerFee = feeRuleSchemeService.calcDeptManagerFee(
|
|
|
+ insFeeOrderNew.getJqPremium(),
|
|
|
+ jqReCalcuLateProportion.getDept_level_1_proportion(),
|
|
|
+ jqReCalcuLateProportion.getDept_level_2_proportion(),
|
|
|
+ jqReCalcuLateProportion.getDept_level_3_proportion(),
|
|
|
+ jqReCalcuLateProportion.getDept_level_4_proportion(),
|
|
|
+ jqReCalcuLateProportion.getDept_level_5_proportion());
|
|
|
|
|
|
- //region 部门管理费用
|
|
|
- //交强部门管理费用
|
|
|
- FeeOrderNewVo.DeptManagerFee jqDeptManagerFee = feeRuleSchemeService.calcDeptManagerFee(insFeeOrderNew.getJqPremium(),
|
|
|
- feeOrderNewVo.getDeptManagerFee().get(0).getDeptProportionLevelOne(),
|
|
|
- feeOrderNewVo.getDeptManagerFee().get(0).getDeptProportionLevelTwo(),
|
|
|
- feeOrderNewVo.getDeptManagerFee().get(0).getDeptProportionLevelThree(),
|
|
|
- feeOrderNewVo.getDeptManagerFee().get(0).getDeptProportionLevelFoure(),
|
|
|
- feeOrderNewVo.getDeptManagerFee().get(0).getDeptProportionLevelFive());
|
|
|
jqDeptManagerFee.setInsuranceType("交强险");
|
|
|
deptManagerFeeList.add(jqDeptManagerFee);
|
|
|
|
|
|
- //商业部门管理费用
|
|
|
- FeeOrderNewVo.DeptManagerFee syDeptManagerFee = feeRuleSchemeService.calcDeptManagerFee(insFeeOrderNew.getSyPremium(),
|
|
|
- feeOrderNewVo.getDeptManagerFee().get(1).getDeptProportionLevelOne(),
|
|
|
- feeOrderNewVo.getDeptManagerFee().get(1).getDeptProportionLevelTwo(),
|
|
|
- feeOrderNewVo.getDeptManagerFee().get(1).getDeptProportionLevelThree(),
|
|
|
- feeOrderNewVo.getDeptManagerFee().get(1).getDeptProportionLevelFoure(),
|
|
|
- feeOrderNewVo.getDeptManagerFee().get(1).getDeptProportionLevelFive());
|
|
|
+ BigDecimal syDeptRadio =
|
|
|
+ syReCalcuLateProportion.getDept_level_1_proportion()
|
|
|
+ .add(syReCalcuLateProportion.getDept_level_2_proportion())
|
|
|
+ .add(syReCalcuLateProportion.getDept_level_3_proportion())
|
|
|
+ .add(syReCalcuLateProportion.getDept_level_4_proportion())
|
|
|
+ .add(syReCalcuLateProportion.getDept_level_5_proportion());
|
|
|
+
|
|
|
+ FeeOrderNewVo.DeptManagerFee syDeptManagerFee = feeRuleSchemeService.calcDeptManagerFee(
|
|
|
+ insFeeOrderNew.getSyPremium(),
|
|
|
+ syReCalcuLateProportion.getDept_level_1_proportion(),
|
|
|
+ syReCalcuLateProportion.getDept_level_2_proportion(),
|
|
|
+ syReCalcuLateProportion.getDept_level_3_proportion(),
|
|
|
+ syReCalcuLateProportion.getDept_level_4_proportion(),
|
|
|
+ syReCalcuLateProportion.getDept_level_5_proportion());
|
|
|
+
|
|
|
syDeptManagerFee.setInsuranceType("商业险");
|
|
|
deptManagerFeeList.add(syDeptManagerFee);
|
|
|
|
|
|
- //非车部门管理费用
|
|
|
- FeeOrderNewVo.DeptManagerFee noDeptManagerFee = feeRuleSchemeService.calcDeptManagerFee(insFeeOrderNew.getNoPremium(),
|
|
|
- feeOrderNewVo.getDeptManagerFee().get(2).getDeptProportionLevelOne(),
|
|
|
- feeOrderNewVo.getDeptManagerFee().get(2).getDeptProportionLevelTwo(),
|
|
|
- feeOrderNewVo.getDeptManagerFee().get(2).getDeptProportionLevelThree(),
|
|
|
- feeOrderNewVo.getDeptManagerFee().get(2).getDeptProportionLevelFoure(),
|
|
|
- feeOrderNewVo.getDeptManagerFee().get(2).getDeptProportionLevelFive());
|
|
|
+ BigDecimal noDeptRadio =
|
|
|
+ noReCalcuLateProportion.getDept_level_1_proportion()
|
|
|
+ .add(noReCalcuLateProportion.getDept_level_2_proportion())
|
|
|
+ .add(noReCalcuLateProportion.getDept_level_3_proportion())
|
|
|
+ .add(noReCalcuLateProportion.getDept_level_4_proportion())
|
|
|
+ .add(noReCalcuLateProportion.getDept_level_5_proportion());
|
|
|
+
|
|
|
+ FeeOrderNewVo.DeptManagerFee noDeptManagerFee = feeRuleSchemeService.calcDeptManagerFee(
|
|
|
+ insFeeOrderNew.getNoPremium(),
|
|
|
+ noReCalcuLateProportion.getDept_level_1_proportion(),
|
|
|
+ noReCalcuLateProportion.getDept_level_2_proportion(),
|
|
|
+ noReCalcuLateProportion.getDept_level_3_proportion(),
|
|
|
+ noReCalcuLateProportion.getDept_level_4_proportion(),
|
|
|
+ noReCalcuLateProportion.getDept_level_5_proportion());
|
|
|
+
|
|
|
noDeptManagerFee.setInsuranceType("非车险");
|
|
|
deptManagerFeeList.add(noDeptManagerFee);
|
|
|
|
|
|
+ insFeeOrderNew.assignDept(jqDeptManagerFee,syDeptManagerFee,noDeptManagerFee);
|
|
|
|
|
|
- BigDecimal jqDeptManagerTotalProportion = jqDeptManagerFee.getDeptProportionLevelOne().add(jqDeptManagerFee.getDeptProportionLevelTwo())
|
|
|
- .add(jqDeptManagerFee.getDeptProportionLevelThree()).add(jqDeptManagerFee.getDeptProportionLevelFoure())
|
|
|
- .add(jqDeptManagerFee.getDeptProportionLevelFive());
|
|
|
-
|
|
|
- BigDecimal syDeptManagerTotalProportion = syDeptManagerFee.getDeptProportionLevelOne().add(syDeptManagerFee.getDeptProportionLevelTwo())
|
|
|
- .add(syDeptManagerFee.getDeptProportionLevelThree()).add(syDeptManagerFee.getDeptProportionLevelFoure())
|
|
|
- .add(syDeptManagerFee.getDeptProportionLevelFive());
|
|
|
-
|
|
|
- BigDecimal noDeptManagerTotalProportion = noDeptManagerFee.getDeptProportionLevelOne().add(noDeptManagerFee.getDeptProportionLevelTwo())
|
|
|
- .add(noDeptManagerFee.getDeptProportionLevelThree()).add(noDeptManagerFee.getDeptProportionLevelFoure())
|
|
|
- .add(noDeptManagerFee.getDeptProportionLevelFive());
|
|
|
|
|
|
//endregion
|
|
|
|
|
|
-
|
|
|
//region 出口费用
|
|
|
//查费用里的手续费
|
|
|
InsFeeOrderNew insFeeOrderNewServiceById = insFeeOrderNewService.getById(feeOrderNewRecordVo.getFeeId());
|
|
|
PtlAgreementProductCostsNew costsNew = ptlAgreementProductCostsNewService.getById(insFeeOrderNewServiceById.getCostsId());
|
|
|
//交强出口费用
|
|
|
- FeeOrderNewVo.ExportFee jqExportFee = feeRuleSchemeService.calcExportFee(insFeeOrderNew.getJqPremium(), new BigDecimal(costsNew.getJqCostsExportProportion()),
|
|
|
- feeOrderNewVo.getEntranceFee().get(0).getTotalProportion(), jqDeptManagerTotalProportion, retailStoreFee.getRetailStoreRadio(), taxRadio);
|
|
|
+ FeeOrderNewVo.ExportFee jqExportFee = feeRuleSchemeService.calcExportFee(
|
|
|
+ insFeeOrderNew.getJqPremium(),
|
|
|
+ new BigDecimal(costsNew.getJqCostsExportProportion()),
|
|
|
+ feeOrderNewVo.getEntranceFee().get(0).getTotalProportion(),
|
|
|
+ jqDeptRadio,
|
|
|
+ jqRetailRadio,
|
|
|
+ taxRadio);
|
|
|
+
|
|
|
jqExportFee.setInsuranceType("交强险");
|
|
|
exportFeeList.add(jqExportFee);
|
|
|
|
|
|
|
|
|
//商业出口费用
|
|
|
- FeeOrderNewVo.ExportFee syExportFee = feeRuleSchemeService.calcExportFee(insFeeOrderNew.getSyPremium(), new BigDecimal(costsNew.getSyCostsExportProportion()),
|
|
|
- feeOrderNewVo.getEntranceFee().get(1).getTotalProportion(), syDeptManagerTotalProportion, retailStoreFee.getRetailStoreRadio(), taxRadio);
|
|
|
+ FeeOrderNewVo.ExportFee syExportFee = feeRuleSchemeService.calcExportFee(
|
|
|
+ insFeeOrderNew.getSyPremium(),
|
|
|
+ new BigDecimal(costsNew.getSyCostsExportProportion()),
|
|
|
+ feeOrderNewVo.getEntranceFee().get(1).getTotalProportion(),
|
|
|
+ syDeptRadio,
|
|
|
+ syRetailRadio,
|
|
|
+ taxRadio);
|
|
|
+
|
|
|
syExportFee.setInsuranceType("商业险");
|
|
|
exportFeeList.add(syExportFee);
|
|
|
|
|
|
|
|
|
//非车出口费用
|
|
|
- FeeOrderNewVo.ExportFee noExportFee = feeRuleSchemeService.calcExportFee(insFeeOrderNew.getNoPremium(), new BigDecimal(costsNew.getNoCostsExportProportion()),
|
|
|
- feeOrderNewVo.getEntranceFee().get(2).getTotalProportion(), noDeptManagerTotalProportion, retailStoreFee.getRetailStoreRadio(), taxRadio);
|
|
|
+ FeeOrderNewVo.ExportFee noExportFee = feeRuleSchemeService.calcExportFee(
|
|
|
+ insFeeOrderNew.getNoPremium(),
|
|
|
+ new BigDecimal(costsNew.getNoCostsExportProportion()),
|
|
|
+ feeOrderNewVo.getEntranceFee().get(2).getTotalProportion(),
|
|
|
+ noDeptRadio,
|
|
|
+ noRetailRadio,
|
|
|
+ taxRadio);
|
|
|
+
|
|
|
noExportFee.setInsuranceType("非车险");
|
|
|
exportFeeList.add(noExportFee);
|
|
|
|
|
|
//endregion
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
FeeOrderNewVo resultFeeOrderNewVo = new FeeOrderNewVo();
|
|
|
resultFeeOrderNewVo.setEntranceFee(entranceFeeList);
|
|
|
resultFeeOrderNewVo.setExportFee(exportFeeList);
|
|
|
-
|
|
|
+// resultFeeOrderNewVo.setRetailFee(distributionLevelVoList);
|
|
|
|
|
|
|
|
|
//ins_fee_order_new 保存新的费用
|
|
|
+ //入口
|
|
|
insFeeOrderNew.setJqCostsProportion(entranceFeeList.get(0).getTotalProportion());
|
|
|
insFeeOrderNew.setJqCostsPremiums(entranceFeeList.get(0).getTotalAmount());
|
|
|
insFeeOrderNew.setJqSuperviseCostsProportion(entranceFeeList.get(0).getSuperviseCosts());
|
|
|
@@ -1323,24 +1605,64 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
|
|
|
insFeeOrderNew.setNoExportOtherCostsProportion(exportFeeList.get(2).getOtherCostsProportion());
|
|
|
insFeeOrderNew.setNoExportOtherCostsPremiums(exportFeeList.get(2).getOtherCostsPremiums());
|
|
|
|
|
|
- //region 计算差值
|
|
|
- //入口 - 出口 - 机构管理费 5级 - 分销费 = 差值
|
|
|
+ //分销费用
|
|
|
+ insFeeOrderNew.setJqRetailProportionLevel1(retailFeeLevel1.getJqRetailProportion());
|
|
|
+ insFeeOrderNew.setJqRetailPremiumsLevel1(retailFeeLevel1.getJqRetailPremiums());
|
|
|
+ insFeeOrderNew.setJqRetailProportionLevel2(retailFeeLevel2.getJqRetailProportion());
|
|
|
+ insFeeOrderNew.setJqRetailPremiumsLevel2(retailFeeLevel2.getJqRetailPremiums());
|
|
|
+ insFeeOrderNew.setJqRetailProportionLevel3(retailFeeLevel3.getJqRetailProportion());
|
|
|
+ insFeeOrderNew.setJqRetailPremiumsLevel3(retailFeeLevel3.getJqRetailPremiums());
|
|
|
+
|
|
|
+ insFeeOrderNew.setSyRetailProportionLevel1(retailFeeLevel1.getSyRetailProportion());
|
|
|
+ insFeeOrderNew.setSyRetailPremiumsLevel1(retailFeeLevel1.getSyRetailPremiums());
|
|
|
+ insFeeOrderNew.setSyRetailProportionLevel2(retailFeeLevel2.getSyRetailProportion());
|
|
|
+ insFeeOrderNew.setSyRetailPremiumsLevel2(retailFeeLevel2.getSyRetailPremiums());
|
|
|
+ insFeeOrderNew.setSyRetailProportionLevel3(retailFeeLevel3.getSyRetailProportion());
|
|
|
+ insFeeOrderNew.setSyRetailPremiumsLevel3(retailFeeLevel3.getSyRetailPremiums());
|
|
|
+
|
|
|
+ insFeeOrderNew.setNoRetailProportionLevel1(retailFeeLevel1.getNoRetailProportion());
|
|
|
+ insFeeOrderNew.setNoRetailPremiumsLevel1(retailFeeLevel1.getNoRetailPremiums());
|
|
|
+ insFeeOrderNew.setNoRetailProportionLevel2(retailFeeLevel2.getNoRetailProportion());
|
|
|
+ insFeeOrderNew.setNoRetailPremiumsLevel2(retailFeeLevel2.getNoRetailPremiums());
|
|
|
+ insFeeOrderNew.setNoRetailProportionLevel3(retailFeeLevel3.getNoRetailProportion());
|
|
|
+ insFeeOrderNew.setNoRetailPremiumsLevel3(retailFeeLevel3.getNoRetailPremiums());
|
|
|
+
|
|
|
+ insFeeOrderNew.setFirstDetailPremiums(
|
|
|
+ retailFeeLevel1.getJqRetailPremiums()
|
|
|
+ .add(retailFeeLevel1.getSyRetailPremiums())
|
|
|
+ .add(retailFeeLevel1.getNoRetailPremiums())
|
|
|
+ );
|
|
|
+
|
|
|
+ insFeeOrderNew.setSecondDetailPremiums(
|
|
|
+ retailFeeLevel2.getJqRetailPremiums()
|
|
|
+ .add(retailFeeLevel2.getSyRetailPremiums())
|
|
|
+ .add(retailFeeLevel2.getNoRetailPremiums())
|
|
|
+ );
|
|
|
+
|
|
|
+ insFeeOrderNew.setThirdDetailPremiums(
|
|
|
+ retailFeeLevel3.getJqRetailPremiums()
|
|
|
+ .add(retailFeeLevel3.getSyRetailPremiums())
|
|
|
+ .add(retailFeeLevel3.getNoRetailPremiums())
|
|
|
+ );
|
|
|
+
|
|
|
+ //region 计算利润差值
|
|
|
+ //入口 - 出口 - 机构管理费 1-5级 - 分销费 = 差值
|
|
|
|
|
|
//分销交强费用
|
|
|
//分开算 1 2 3 级
|
|
|
- BigDecimal jqFirst = insFeeOrderNew.getJqPremium().multiply(insFeeOrderNew.getFirstDetailProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
|
|
|
- BigDecimal jqSecond = insFeeOrderNew.getJqPremium().multiply(insFeeOrderNew.getSecondDetailProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
|
|
|
- BigDecimal jqThird = insFeeOrderNew.getJqPremium().multiply(insFeeOrderNew.getThirdDetailProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
|
|
|
+ BigDecimal jqFirst = insFeeOrderNew.getJqPremium().multiply(insFeeOrderNew.getJqRetailProportionLevel1().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
|
|
|
+ BigDecimal jqSecond = insFeeOrderNew.getJqPremium().multiply(insFeeOrderNew.getJqRetailProportionLevel2().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
|
|
|
+ BigDecimal jqThird = insFeeOrderNew.getJqPremium().multiply(insFeeOrderNew.getJqRetailProportionLevel3().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
|
|
|
BigDecimal jqFenXiao = jqFirst.add(jqSecond).add(jqThird);
|
|
|
//分销商业费用
|
|
|
- BigDecimal syFirst = insFeeOrderNew.getSyPremium().multiply(insFeeOrderNew.getFirstDetailProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
|
|
|
- BigDecimal sySecond = insFeeOrderNew.getSyPremium().multiply(insFeeOrderNew.getSecondDetailProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
|
|
|
- BigDecimal syThird = insFeeOrderNew.getSyPremium().multiply(insFeeOrderNew.getThirdDetailProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
|
|
|
+ BigDecimal syFirst = insFeeOrderNew.getSyPremium().multiply(insFeeOrderNew.getSyRetailProportionLevel1().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
|
|
|
+ BigDecimal sySecond = insFeeOrderNew.getSyPremium().multiply(insFeeOrderNew.getSyRetailProportionLevel2().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
|
|
|
+ BigDecimal syThird = insFeeOrderNew.getSyPremium().multiply(insFeeOrderNew.getSyRetailProportionLevel3().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
|
|
|
BigDecimal syFenXiao = syFirst.add(sySecond).add(syThird);
|
|
|
//分销非车费用
|
|
|
- BigDecimal noFirst = insFeeOrderNew.getNoPremium().multiply(insFeeOrderNew.getFirstDetailProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
|
|
|
- BigDecimal noSecond = insFeeOrderNew.getNoPremium().multiply(insFeeOrderNew.getSecondDetailProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
|
|
|
- BigDecimal noThird = insFeeOrderNew.getNoPremium().multiply(insFeeOrderNew.getThirdDetailProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
|
|
|
+ BigDecimal noFirst = insFeeOrderNew.getNoPremium().multiply(insFeeOrderNew.getNoRetailProportionLevel1().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
|
|
|
+ BigDecimal noSecond = insFeeOrderNew.getNoPremium().multiply(insFeeOrderNew.getNoRetailProportionLevel2().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
|
|
|
+ BigDecimal noThird = insFeeOrderNew.getNoPremium().multiply(insFeeOrderNew.getNoRetailProportionLevel3().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
|
|
|
BigDecimal noFenXiao = noFirst.add(noSecond).add(noThird);
|
|
|
|
|
|
|
|
|
@@ -1362,6 +1684,7 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
|
|
|
insFeeOrderNew.setSyProfitMarginPremiums(syDifference);
|
|
|
deptManagerFeeList.get(1).setProfitMarginPremiums(syDifference);
|
|
|
|
|
|
+
|
|
|
BigDecimal noDifference = noEntranceFee.getTotalAmount().subtract(
|
|
|
(noExportFee.getSuperviseCostsPremiums().add(noExportFee.getOtherCostsPremiums())))
|
|
|
.subtract(
|
|
|
@@ -1371,15 +1694,17 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
|
|
|
|
|
|
insFeeOrderNew.setNoProfitMarginPremiums(noDifference);
|
|
|
deptManagerFeeList.get(2).setProfitMarginPremiums(noDifference);
|
|
|
+
|
|
|
//endregion
|
|
|
resultFeeOrderNewVo.setDeptManagerFee(deptManagerFeeList);
|
|
|
-
|
|
|
+ resultFeeOrderNewVo.setRetailFee(retailFeeList);
|
|
|
//保存新的比例
|
|
|
insFeeOrderNewService.updateById(insFeeOrderNew);
|
|
|
return resultFeeOrderNewVo;
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 修改费用历史记录
|
|
|
* @return
|