|
@@ -69,8 +69,15 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
|
|
|
return baseController.getUserSystemCode();
|
|
return baseController.getUserSystemCode();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 订单审核时调整费用
|
|
|
|
|
+ *
|
|
|
|
|
+ * @author jiakai
|
|
|
|
|
+ * @date 2026/6/17 11:08
|
|
|
|
|
+ */
|
|
|
@Override
|
|
@Override
|
|
|
public CostCalculateRespVO computedCostInfo(PtlAgreementCostRatioVo ptlAgreementCostRatioVo) {
|
|
public CostCalculateRespVO computedCostInfo(PtlAgreementCostRatioVo ptlAgreementCostRatioVo) {
|
|
|
|
|
+ log.info("订单审核时调整费用: ptlAgreementCostRatioVo=[{}]", JSONUtil.toJsonStr(ptlAgreementCostRatioVo));
|
|
|
// 常量定义 保留小数5位
|
|
// 常量定义 保留小数5位
|
|
|
InsFeeOrders insFeeOrders = getInsFeeOrders(ptlAgreementCostRatioVo);
|
|
InsFeeOrders insFeeOrders = getInsFeeOrders(ptlAgreementCostRatioVo);
|
|
|
// 拼接返回值
|
|
// 拼接返回值
|
|
@@ -93,8 +100,6 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
|
|
|
private InsFeeOrders getInsFeeOrders(PtlAgreementCostRatioVo ptlAgreementCostRatioVo) {
|
|
private InsFeeOrders getInsFeeOrders(PtlAgreementCostRatioVo ptlAgreementCostRatioVo) {
|
|
|
// 常量定义 保留小数5位
|
|
// 常量定义 保留小数5位
|
|
|
final int SCALE = 5;
|
|
final int SCALE = 5;
|
|
|
- final BigDecimal TAX_RATE = new BigDecimal("1.06");
|
|
|
|
|
-
|
|
|
|
|
// 获取订单信息
|
|
// 获取订单信息
|
|
|
InsOrders insOrders = insOrdersService.getById(ptlAgreementCostRatioVo.getOrderNo());
|
|
InsOrders insOrders = insOrdersService.getById(ptlAgreementCostRatioVo.getOrderNo());
|
|
|
// 获取订单费用信息
|
|
// 获取订单费用信息
|
|
@@ -113,27 +118,26 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
|
|
|
BigDecimal jyPremium = insOrdersCosts.getJyPremium() == null ? BigDecimal.ZERO : insOrdersCosts.getJyPremium();
|
|
BigDecimal jyPremium = insOrdersCosts.getJyPremium() == null ? BigDecimal.ZERO : insOrdersCosts.getJyPremium();
|
|
|
|
|
|
|
|
// 更新对象中的比例字段
|
|
// 更新对象中的比例字段
|
|
|
- copyRatio(ptlAgreementCostRatioVo, insFeeOrders, withTax);
|
|
|
|
|
|
|
+ BigDecimal taxRate = copyRatio(ptlAgreementCostRatioVo, insFeeOrders, withTax);
|
|
|
|
|
|
|
|
// 核心:规则重新计算所有费用
|
|
// 核心:规则重新计算所有费用
|
|
|
// 1. 交强险
|
|
// 1. 交强险
|
|
|
- calculatePremiumByRule(insFeeOrders,
|
|
|
|
|
- "jq", jqPremium,
|
|
|
|
|
|
|
+ calculatePremiumByRule(insFeeOrders, "jq", jqPremium,
|
|
|
insFeeOrders.getJqCommissionRatio(), insFeeOrders.getJqInletRatio(), insFeeOrders.getJqFollowRatio(),
|
|
insFeeOrders.getJqCommissionRatio(), insFeeOrders.getJqInletRatio(), insFeeOrders.getJqFollowRatio(),
|
|
|
insFeeOrders.getJqAdditionalRatio(), insFeeOrders.getJqKeepPointRatio(), insFeeOrders.getJqExportRatio(), insFeeOrders.getJqExportKeepPointRatio(),
|
|
insFeeOrders.getJqAdditionalRatio(), insFeeOrders.getJqKeepPointRatio(), insFeeOrders.getJqExportRatio(), insFeeOrders.getJqExportKeepPointRatio(),
|
|
|
- withTax, TAX_RATE, SCALE);
|
|
|
|
|
|
|
+ withTax, taxRate, SCALE);
|
|
|
|
|
|
|
|
// 2. 商业险
|
|
// 2. 商业险
|
|
|
calculatePremiumByRule(insFeeOrders, "sy", syPremium,
|
|
calculatePremiumByRule(insFeeOrders, "sy", syPremium,
|
|
|
insFeeOrders.getSyCommissionRatio(), insFeeOrders.getSyInletRatio(), insFeeOrders.getSyFollowRatio(),
|
|
insFeeOrders.getSyCommissionRatio(), insFeeOrders.getSyInletRatio(), insFeeOrders.getSyFollowRatio(),
|
|
|
insFeeOrders.getSyAdditionalRatio(), insFeeOrders.getSyKeepPointRatio(), insFeeOrders.getSyExportRatio(), insFeeOrders.getSyExportKeepPointRatio(),
|
|
insFeeOrders.getSyAdditionalRatio(), insFeeOrders.getSyKeepPointRatio(), insFeeOrders.getSyExportRatio(), insFeeOrders.getSyExportKeepPointRatio(),
|
|
|
- withTax, TAX_RATE, SCALE);
|
|
|
|
|
|
|
+ withTax, taxRate, SCALE);
|
|
|
|
|
|
|
|
// 3. 驾乘险
|
|
// 3. 驾乘险
|
|
|
calculatePremiumByRule(insFeeOrders, "jy", jyPremium,
|
|
calculatePremiumByRule(insFeeOrders, "jy", jyPremium,
|
|
|
insFeeOrders.getJyCommissionRatio(), insFeeOrders.getJyInletRatio(), insFeeOrders.getJyFollowRatio(),
|
|
insFeeOrders.getJyCommissionRatio(), insFeeOrders.getJyInletRatio(), insFeeOrders.getJyFollowRatio(),
|
|
|
insFeeOrders.getJyAdditionalRatio(), insFeeOrders.getJyKeepPointRatio(), insFeeOrders.getJyExportRatio(), insFeeOrders.getJyExportKeepPointRatio(),
|
|
insFeeOrders.getJyAdditionalRatio(), insFeeOrders.getJyKeepPointRatio(), insFeeOrders.getJyExportRatio(), insFeeOrders.getJyExportKeepPointRatio(),
|
|
|
- withTax, TAX_RATE, SCALE);
|
|
|
|
|
|
|
+ withTax, taxRate, SCALE);
|
|
|
|
|
|
|
|
// 重新统计总应收、总应付
|
|
// 重新统计总应收、总应付
|
|
|
BigDecimal totalPayable = insFeeOrders.getJqPayablePremium().add(insFeeOrders.getSyPayablePremium()).add(insFeeOrders.getJyPayablePremium());
|
|
BigDecimal totalPayable = insFeeOrders.getJqPayablePremium().add(insFeeOrders.getSyPayablePremium()).add(insFeeOrders.getJyPayablePremium());
|
|
@@ -176,7 +180,7 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
|
|
|
// 出口直接乘
|
|
// 出口直接乘
|
|
|
BigDecimal export = premium.multiply(exportRatio).setScale(scale, RoundingMode.HALF_EVEN);
|
|
BigDecimal export = premium.multiply(exportRatio).setScale(scale, RoundingMode.HALF_EVEN);
|
|
|
BigDecimal exportKeepPoint = premium.multiply(exportKeepPointRatio).setScale(scale, RoundingMode.HALF_EVEN);
|
|
BigDecimal exportKeepPoint = premium.multiply(exportKeepPointRatio).setScale(scale, RoundingMode.HALF_EVEN);
|
|
|
- // 留点比例直接乘
|
|
|
|
|
|
|
+ // 留点比例直接乘, modify by lipf ,留点比例在infFeeOrder中计算得到。这里直接使用 2026年6月16日17:32:09
|
|
|
BigDecimal keepPoint = premium.multiply(keepPointRatio).setScale(scale, RoundingMode.HALF_EVEN);
|
|
BigDecimal keepPoint = premium.multiply(keepPointRatio).setScale(scale, RoundingMode.HALF_EVEN);
|
|
|
|
|
|
|
|
// 赋值到实体(自动匹配 jq / sy / jy)
|
|
// 赋值到实体(自动匹配 jq / sy / jy)
|
|
@@ -289,11 +293,11 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 保存比例
|
|
// 保存比例
|
|
|
- private void copyRatio(PtlAgreementCostRatioVo ptlAgreementCostRatioVo, InsFeeOrders insFeeOrders, Integer withTax) {
|
|
|
|
|
- BigDecimal bigDecimal = new BigDecimal("1");
|
|
|
|
|
|
|
+ private BigDecimal copyRatio(PtlAgreementCostRatioVo ptlAgreementCostRatioVo, InsFeeOrders insFeeOrders, Integer withTax) {
|
|
|
|
|
+ BigDecimal taxFactor = new BigDecimal("1");
|
|
|
if (withTax == 0) {
|
|
if (withTax == 0) {
|
|
|
// 不含税:保费 / 1.06
|
|
// 不含税:保费 / 1.06
|
|
|
- bigDecimal = new BigDecimal("1.06");
|
|
|
|
|
|
|
+ taxFactor = new BigDecimal("1.06");
|
|
|
}
|
|
}
|
|
|
// 手续费比例
|
|
// 手续费比例
|
|
|
BigDecimal jqCommissionRatio = covertPercent(ptlAgreementCostRatioVo.getJqCommissionRatio());
|
|
BigDecimal jqCommissionRatio = covertPercent(ptlAgreementCostRatioVo.getJqCommissionRatio());
|
|
@@ -309,7 +313,7 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
|
|
|
insFeeOrders.setJqInletRatio(jqInletRatio);
|
|
insFeeOrders.setJqInletRatio(jqInletRatio);
|
|
|
insFeeOrders.setSyInletRatio(syInletRatio);
|
|
insFeeOrders.setSyInletRatio(syInletRatio);
|
|
|
insFeeOrders.setJyInletRatio(jyInletRatio);
|
|
insFeeOrders.setJyInletRatio(jyInletRatio);
|
|
|
- // 跟单比例
|
|
|
|
|
|
|
+ // 跟单比例
|
|
|
BigDecimal jqFollowRatio = jqInletRatio.subtract(jqCommissionRatio);
|
|
BigDecimal jqFollowRatio = jqInletRatio.subtract(jqCommissionRatio);
|
|
|
BigDecimal syFollowRatio = syInletRatio.subtract(syCommissionRatio);
|
|
BigDecimal syFollowRatio = syInletRatio.subtract(syCommissionRatio);
|
|
|
BigDecimal jyFollowRatio = jyInletRatio.subtract(jyCommissionRatio);
|
|
BigDecimal jyFollowRatio = jyInletRatio.subtract(jyCommissionRatio);
|
|
@@ -331,9 +335,9 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
|
|
|
insFeeOrders.setSyExportRatio(syExportRatio);
|
|
insFeeOrders.setSyExportRatio(syExportRatio);
|
|
|
insFeeOrders.setJyExportRatio(jyExportRatio);
|
|
insFeeOrders.setJyExportRatio(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);
|
|
|
|
|
|
|
+ BigDecimal jqKeepPointRatio = (jqInletRatio.divide(taxFactor, 5, RoundingMode.HALF_EVEN)).add(jqAdditionalRatio).subtract(jqExportRatio);
|
|
|
|
|
+ BigDecimal syKeepPointRatio = (syInletRatio.divide(taxFactor, 5, RoundingMode.HALF_EVEN)).add(syAdditionalRatio).subtract(syExportRatio);
|
|
|
|
|
+ BigDecimal jyKeepPointRatio = (jyInletRatio.divide(taxFactor, 5, RoundingMode.HALF_EVEN)).add(jyAdditionalRatio).subtract(jyExportRatio);
|
|
|
// 留点比例
|
|
// 留点比例
|
|
|
insFeeOrders.setJqKeepPointRatio(jqKeepPointRatio);
|
|
insFeeOrders.setJqKeepPointRatio(jqKeepPointRatio);
|
|
|
insFeeOrders.setSyKeepPointRatio(syKeepPointRatio);
|
|
insFeeOrders.setSyKeepPointRatio(syKeepPointRatio);
|
|
@@ -342,6 +346,7 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
|
|
|
insFeeOrders.setJqExportKeepPointRatio(covertPercent(ptlAgreementCostRatioVo.getJqExportKeepPointRatio()));
|
|
insFeeOrders.setJqExportKeepPointRatio(covertPercent(ptlAgreementCostRatioVo.getJqExportKeepPointRatio()));
|
|
|
insFeeOrders.setSyExportKeepPointRatio(covertPercent(ptlAgreementCostRatioVo.getSyExportKeepPointRatio()));
|
|
insFeeOrders.setSyExportKeepPointRatio(covertPercent(ptlAgreementCostRatioVo.getSyExportKeepPointRatio()));
|
|
|
insFeeOrders.setJyExportKeepPointRatio(covertPercent(ptlAgreementCostRatioVo.getJyExportKeepPointRatio()));
|
|
insFeeOrders.setJyExportKeepPointRatio(covertPercent(ptlAgreementCostRatioVo.getJyExportKeepPointRatio()));
|
|
|
|
|
+ return taxFactor;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|