|
@@ -15,6 +15,7 @@ import com.jzg.commons.entity.po.*;
|
|
|
import com.jzg.commons.entity.quote.vo.QuoteVo;
|
|
import com.jzg.commons.entity.quote.vo.QuoteVo;
|
|
|
import com.jzg.commons.entity.quote.vo.aggregated.QuoteResultsVo;
|
|
import com.jzg.commons.entity.quote.vo.aggregated.QuoteResultsVo;
|
|
|
import com.jzg.commons.entity.vo.*;
|
|
import com.jzg.commons.entity.vo.*;
|
|
|
|
|
+import com.jzg.commons.util.BigDecimalUtil;
|
|
|
import com.jzg.quotation.commons.client.OrgClient;
|
|
import com.jzg.quotation.commons.client.OrgClient;
|
|
|
import com.jzg.quotation.summary.aop.FactorMatch;
|
|
import com.jzg.quotation.summary.aop.FactorMatch;
|
|
|
import com.jzg.quotation.summary.client.PtlNewAgreementClient;
|
|
import com.jzg.quotation.summary.client.PtlNewAgreementClient;
|
|
@@ -230,6 +231,7 @@ public class QuoteVerificationAspect {
|
|
|
insFeeOrders.setJyPremium(insOrdersCosts.getJyPremium());
|
|
insFeeOrders.setJyPremium(insOrdersCosts.getJyPremium());
|
|
|
insFeeOrders.setTotalPremium(insOrdersCosts.getSumPremium());
|
|
insFeeOrders.setTotalPremium(insOrdersCosts.getSumPremium());
|
|
|
// 获取协议是平台协议还是私有协议 1 平台协议 2 私有协议
|
|
// 获取协议是平台协议还是私有协议 1 平台协议 2 私有协议
|
|
|
|
|
+ AgreementVo agreement = agreementInfoVo.getAgreement();
|
|
|
String agreementType = agreementInfoVo.getAgreement().getAgreementType();
|
|
String agreementType = agreementInfoVo.getAgreement().getAgreementType();
|
|
|
BigDecimal jqEntranceFeeRatio = convertPercent(agreementInfoVo.getAgreement().getJqEntranceFeeRatio());
|
|
BigDecimal jqEntranceFeeRatio = convertPercent(agreementInfoVo.getAgreement().getJqEntranceFeeRatio());
|
|
|
BigDecimal syEntranceFeeRatio = convertPercent(agreementInfoVo.getAgreement().getSyEntranceFeeRatio());
|
|
BigDecimal syEntranceFeeRatio = convertPercent(agreementInfoVo.getAgreement().getSyEntranceFeeRatio());
|
|
@@ -249,32 +251,36 @@ public class QuoteVerificationAspect {
|
|
|
BigDecimal syFollowRatio = calculateFollowRatio(syCostType, syEntranceFeeRatio);
|
|
BigDecimal syFollowRatio = calculateFollowRatio(syCostType, syEntranceFeeRatio);
|
|
|
BigDecimal jyFollowRatio = calculateFollowRatio(jyCostType, jyEntranceFeeRatio);
|
|
BigDecimal jyFollowRatio = calculateFollowRatio(jyCostType, jyEntranceFeeRatio);
|
|
|
|
|
|
|
|
- // 5. 根据协议类型确定税率因子(平台协议为1,私有协议为1/1.06)
|
|
|
|
|
- BigDecimal taxFactor = "1".equals(agreementType)
|
|
|
|
|
- ? BigDecimal.ONE
|
|
|
|
|
- : new BigDecimal("1").divide(new BigDecimal("1.06"), 10, RoundingMode.HALF_EVEN);
|
|
|
|
|
|
|
+ // modify by lipf ,2026年6月17日15:30:54 是否除以1.06,不再根据平台协议还是私有协议进行判断,而是根据协议的是否含税来进行判断
|
|
|
|
|
+ String withTax = agreement.getWithTax();
|
|
|
|
|
+ BigDecimal taxFactor = new BigDecimal("1");
|
|
|
|
|
+ if ("0".equals(withTax)) {
|
|
|
|
|
+ // 不含税:保费 / 1.06
|
|
|
|
|
+ taxFactor = new BigDecimal("1.06");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
// 6. 统一处理各险种的费用计算(应收、应付、各类费用)
|
|
// 6. 统一处理各险种的费用计算(应收、应付、各类费用)
|
|
|
processInsuranceType(
|
|
processInsuranceType(
|
|
|
insOrdersCosts.getJqPremium(), jqCostType, jqEntranceFeeRatio, jqFollowRatio, taxFactor,
|
|
insOrdersCosts.getJqPremium(), jqCostType, jqEntranceFeeRatio, jqFollowRatio, taxFactor,
|
|
|
insFeeOrders,
|
|
insFeeOrders,
|
|
|
InsFeeOrders::setJqReceivablePremium, InsFeeOrders::setJqPayablePremium,
|
|
InsFeeOrders::setJqReceivablePremium, InsFeeOrders::setJqPayablePremium,
|
|
|
- InsFeeOrders::setJqCommissionPremium, InsFeeOrders::setJqFollowPremium, InsFeeOrders::setJqAdditionalPremium
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ InsFeeOrders::setJqCommissionPremium, InsFeeOrders::setJqFollowPremium, InsFeeOrders::setJqAdditionalPremium,
|
|
|
|
|
+ InsFeeOrders::setJqKeepPointRatio,InsFeeOrders::setJqKeepPointPremium);
|
|
|
|
|
|
|
|
processInsuranceType(
|
|
processInsuranceType(
|
|
|
insOrdersCosts.getSyPremium(), syCostType, syEntranceFeeRatio, syFollowRatio, taxFactor,
|
|
insOrdersCosts.getSyPremium(), syCostType, syEntranceFeeRatio, syFollowRatio, taxFactor,
|
|
|
insFeeOrders,
|
|
insFeeOrders,
|
|
|
InsFeeOrders::setSyReceivablePremium, InsFeeOrders::setSyPayablePremium,
|
|
InsFeeOrders::setSyReceivablePremium, InsFeeOrders::setSyPayablePremium,
|
|
|
- InsFeeOrders::setSyCommissionPremium, InsFeeOrders::setSyFollowPremium, InsFeeOrders::setSyAdditionalPremium
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ InsFeeOrders::setSyCommissionPremium, InsFeeOrders::setSyFollowPremium, InsFeeOrders::setSyAdditionalPremium,
|
|
|
|
|
+ InsFeeOrders::setSyKeepPointRatio,InsFeeOrders::setSyKeepPointPremium);
|
|
|
|
|
|
|
|
processInsuranceType(
|
|
processInsuranceType(
|
|
|
insOrdersCosts.getJyPremium(), jyCostType, jyEntranceFeeRatio, jyFollowRatio, taxFactor,
|
|
insOrdersCosts.getJyPremium(), jyCostType, jyEntranceFeeRatio, jyFollowRatio, taxFactor,
|
|
|
insFeeOrders,
|
|
insFeeOrders,
|
|
|
InsFeeOrders::setJyReceivablePremium, InsFeeOrders::setJyPayablePremium,
|
|
InsFeeOrders::setJyReceivablePremium, InsFeeOrders::setJyPayablePremium,
|
|
|
- InsFeeOrders::setJyCommissionPremium, InsFeeOrders::setJyFollowPremium, InsFeeOrders::setJyAdditionalPremium
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ InsFeeOrders::setJyCommissionPremium, InsFeeOrders::setJyFollowPremium, InsFeeOrders::setJyAdditionalPremium,
|
|
|
|
|
+ InsFeeOrders::setJyKeepPointRatio,InsFeeOrders::setJyKeepPointPremium);
|
|
|
|
|
|
|
|
|
|
|
|
|
// 7. 计算总应收、总应付、保存费用比例 入库
|
|
// 7. 计算总应收、总应付、保存费用比例 入库
|
|
@@ -332,6 +338,8 @@ public class QuoteVerificationAspect {
|
|
|
* @param setCommission 手续费setter
|
|
* @param setCommission 手续费setter
|
|
|
* @param setFollow 跟单费setter
|
|
* @param setFollow 跟单费setter
|
|
|
* @param setAdditional 加投费setter
|
|
* @param setAdditional 加投费setter
|
|
|
|
|
+ * @param keepPointRate 留点比例
|
|
|
|
|
+ * @param keepPointPremium 留点费用
|
|
|
*/
|
|
*/
|
|
|
private void processInsuranceType(
|
|
private void processInsuranceType(
|
|
|
BigDecimal premium,
|
|
BigDecimal premium,
|
|
@@ -344,7 +352,9 @@ public class QuoteVerificationAspect {
|
|
|
BiConsumer<InsFeeOrders, BigDecimal> setPayable,
|
|
BiConsumer<InsFeeOrders, BigDecimal> setPayable,
|
|
|
BiConsumer<InsFeeOrders, BigDecimal> setCommission,
|
|
BiConsumer<InsFeeOrders, BigDecimal> setCommission,
|
|
|
BiConsumer<InsFeeOrders, BigDecimal> setFollow,
|
|
BiConsumer<InsFeeOrders, BigDecimal> setFollow,
|
|
|
- BiConsumer<InsFeeOrders, BigDecimal> setAdditional
|
|
|
|
|
|
|
+ BiConsumer<InsFeeOrders, BigDecimal> setAdditional,
|
|
|
|
|
+ BiConsumer<InsFeeOrders, BigDecimal> keepPointRate,
|
|
|
|
|
+ BiConsumer<InsFeeOrders, BigDecimal> keepPointPremium
|
|
|
) {
|
|
) {
|
|
|
// 若险种配置为空,默认应收应付为0
|
|
// 若险种配置为空,默认应收应付为0
|
|
|
if (costType == null || premium == null) {
|
|
if (costType == null || premium == null) {
|
|
@@ -358,7 +368,7 @@ public class QuoteVerificationAspect {
|
|
|
BigDecimal addThrowPercent = convertPercent(costType.getAddThrow());
|
|
BigDecimal addThrowPercent = convertPercent(costType.getAddThrow());
|
|
|
BigDecimal exportPercent = convertPercent(costType.getExport());
|
|
BigDecimal exportPercent = convertPercent(costType.getExport());
|
|
|
|
|
|
|
|
- // 计算应收金额(保费 * 税率因子 * (入口比例 + 加投比例 + 跟单比例))
|
|
|
|
|
|
|
+ // 计算应收金额
|
|
|
BigDecimal taxablePremium = premium.multiply(taxFactor);
|
|
BigDecimal taxablePremium = premium.multiply(taxFactor);
|
|
|
|
|
|
|
|
// 计算应付金额(保费 * 出口比例,保留2位小数)
|
|
// 计算应付金额(保费 * 出口比例,保留2位小数)
|
|
@@ -370,14 +380,23 @@ public class QuoteVerificationAspect {
|
|
|
BigDecimal follow = taxablePremium.multiply(followRatio).setScale(5, RoundingMode.HALF_EVEN);
|
|
BigDecimal follow = taxablePremium.multiply(followRatio).setScale(5, RoundingMode.HALF_EVEN);
|
|
|
setCommission.accept(insFeeOrders, commission);
|
|
setCommission.accept(insFeeOrders, commission);
|
|
|
setFollow.accept(insFeeOrders, commission);
|
|
setFollow.accept(insFeeOrders, commission);
|
|
|
- setAdditional.accept(insFeeOrders, taxablePremium.multiply(addThrowPercent).setScale(5, RoundingMode.HALF_EVEN));
|
|
|
|
|
|
|
+ // modify by lipf, 2026年6月16日15:35:09 加投比例,不需要根据平台/私有进行1.06的计算
|
|
|
|
|
|
|
|
- BigDecimal receivable = taxablePremium.add(commission)
|
|
|
|
|
- .add(follow)
|
|
|
|
|
-// .add(taxablePremium.multiply(addThrowPercent))
|
|
|
|
|
-// .add(taxablePremium.multiply(followRatio))
|
|
|
|
|
- .setScale(5, RoundingMode.HALF_EVEN);
|
|
|
|
|
|
|
+ BigDecimal addAmount = premium.multiply(addThrowPercent).setScale(5, RoundingMode.HALF_EVEN);
|
|
|
|
|
+ setAdditional.accept(insFeeOrders,addAmount);
|
|
|
|
|
+
|
|
|
|
|
+ BigDecimal receivable = BigDecimalUtil.add(commission,follow);
|
|
|
|
|
+ receivable = receivable.setScale(5, RoundingMode.HALF_EVEN);
|
|
|
setReceivable.accept(insFeeOrders, receivable);
|
|
setReceivable.accept(insFeeOrders, receivable);
|
|
|
|
|
+
|
|
|
|
|
+ // 设置留点比例 入口比例+加投比例-出口比例
|
|
|
|
|
+ BigDecimal keepPointRateCal = BigDecimalUtil.subtract(BigDecimalUtil.add(BigDecimalUtil.multiply(inletPercent,taxFactor),addThrowPercent),exportPercent)
|
|
|
|
|
+ .setScale(5,RoundingMode.HALF_EVEN);
|
|
|
|
|
+ keepPointRate.accept(insFeeOrders, keepPointRateCal);
|
|
|
|
|
+ // 设置留点比例和留点费用
|
|
|
|
|
+ BigDecimal keepPointAmount = BigDecimalUtil.subtract(BigDecimalUtil.add(receivable,addAmount),payable)
|
|
|
|
|
+ .setScale(5,RoundingMode.HALF_EVEN);
|
|
|
|
|
+ keepPointPremium.accept(insFeeOrders,keepPointAmount);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|