Przeglądaj źródła

报价费用bug修复

lipf 3 miesięcy temu
rodzic
commit
232cf2144e

+ 4 - 0
commons/src/main/java/com/jzg/commons/entity/po/PtlAgreementCostRule.java

@@ -8,11 +8,15 @@ import com.jzg.commons.core.base.BaseModel;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
+import java.io.Serial;
+
 @Data
 @Schema(description = "协议费用管理规则")
 @TableName("ptl_agreement_cost_rule")
 public class PtlAgreementCostRule extends BaseModel {
 
+    @Serial
+    private static final long serialVersionUID = 6453347371073301817L;
     @TableId(type = IdType.ASSIGN_ID)
     private String id;
 

+ 3 - 0
commons/src/main/java/com/jzg/commons/entity/vo/AgreementVo.java

@@ -5,6 +5,7 @@ import com.jzg.commons.core.base.BaseModel;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
+import java.io.Serial;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 
@@ -12,6 +13,8 @@ import java.time.LocalDateTime;
 @Data
 public class AgreementVo extends BaseModel {
 
+    @Serial
+    private static final long serialVersionUID = -7102028681863699045L;
     /** 主键 */
     @Schema(description = "主键")
     private String id;

+ 28 - 14
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/aop/aspect/QuoteVerificationAspect.java

@@ -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.aggregated.QuoteResultsVo;
 import com.jzg.commons.entity.vo.*;
+import com.jzg.commons.util.BigDecimalUtil;
 import com.jzg.quotation.commons.client.OrgClient;
 import com.jzg.quotation.summary.aop.FactorMatch;
 import com.jzg.quotation.summary.client.PtlNewAgreementClient;
@@ -259,22 +260,22 @@ public class QuoteVerificationAspect {
                 insOrdersCosts.getJqPremium(), jqCostType, jqEntranceFeeRatio, jqFollowRatio, taxFactor,
                 insFeeOrders,
                 InsFeeOrders::setJqReceivablePremium, InsFeeOrders::setJqPayablePremium,
-                InsFeeOrders::setJqCommissionPremium, InsFeeOrders::setJqFollowPremium, InsFeeOrders::setJqAdditionalPremium
-        );
+                InsFeeOrders::setJqCommissionPremium, InsFeeOrders::setJqFollowPremium, InsFeeOrders::setJqAdditionalPremium,
+                InsFeeOrders::setJqKeepPointRatio,InsFeeOrders::setJqKeepPointPremium);
 
         processInsuranceType(
                 insOrdersCosts.getSyPremium(), syCostType, syEntranceFeeRatio, syFollowRatio, taxFactor,
                 insFeeOrders,
                 InsFeeOrders::setSyReceivablePremium, InsFeeOrders::setSyPayablePremium,
-                InsFeeOrders::setSyCommissionPremium, InsFeeOrders::setSyFollowPremium, InsFeeOrders::setSyAdditionalPremium
-        );
+                InsFeeOrders::setSyCommissionPremium, InsFeeOrders::setSyFollowPremium, InsFeeOrders::setSyAdditionalPremium,
+                InsFeeOrders::setSyKeepPointRatio,InsFeeOrders::setSyKeepPointPremium);
 
         processInsuranceType(
                 insOrdersCosts.getJyPremium(), jyCostType, jyEntranceFeeRatio, jyFollowRatio, taxFactor,
                 insFeeOrders,
                 InsFeeOrders::setJyReceivablePremium, InsFeeOrders::setJyPayablePremium,
-                InsFeeOrders::setJyCommissionPremium, InsFeeOrders::setJyFollowPremium, InsFeeOrders::setJyAdditionalPremium
-        );
+                InsFeeOrders::setJyCommissionPremium, InsFeeOrders::setJyFollowPremium, InsFeeOrders::setJyAdditionalPremium,
+                InsFeeOrders::setJyKeepPointRatio,InsFeeOrders::setJyKeepPointPremium);
 
 
         // 7. 计算总应收、总应付、保存费用比例 入库
@@ -332,6 +333,8 @@ public class QuoteVerificationAspect {
      * @param setCommission   手续费setter
      * @param setFollow       跟单费setter
      * @param setAdditional   加投费setter
+     * @param keepPointRate 留点比例
+     * @param keepPointPremium 留点费用
      */
     private void processInsuranceType(
             BigDecimal premium,
@@ -344,7 +347,9 @@ public class QuoteVerificationAspect {
             BiConsumer<InsFeeOrders, BigDecimal> setPayable,
             BiConsumer<InsFeeOrders, BigDecimal> setCommission,
             BiConsumer<InsFeeOrders, BigDecimal> setFollow,
-            BiConsumer<InsFeeOrders, BigDecimal> setAdditional
+            BiConsumer<InsFeeOrders, BigDecimal> setAdditional,
+            BiConsumer<InsFeeOrders, BigDecimal> keepPointRate,
+            BiConsumer<InsFeeOrders, BigDecimal> keepPointPremium
     ) {
         // 若险种配置为空,默认应收应付为0
         if (costType == null || premium == null) {
@@ -358,7 +363,7 @@ public class QuoteVerificationAspect {
         BigDecimal addThrowPercent = convertPercent(costType.getAddThrow());
         BigDecimal exportPercent = convertPercent(costType.getExport());
 
-        // 计算应收金额(保费 * 税率因子 * (入口比例 + 加投比例 + 跟单比例))
+        // 计算应收金额
         BigDecimal taxablePremium = premium.multiply(taxFactor);
 
         // 计算应付金额(保费 * 出口比例,保留2位小数)
@@ -370,14 +375,23 @@ public class QuoteVerificationAspect {
         BigDecimal follow = taxablePremium.multiply(followRatio).setScale(5, RoundingMode.HALF_EVEN);
         setCommission.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);
+
+        // 设置留点比例 入口比例+加投比例-出口比例
+        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);
     }
 
     /**

+ 0 - 1
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/controller/UnifyOrderManager.java

@@ -286,7 +286,6 @@ public class UnifyOrderManager {
             if (CollUtil.isNotEmpty(quoteVo.getKindInfoVo())) {
                 QuoteInfoConverter.converterKindInfoVo(quoteVo.getKindInfoVo(), quoteKindMappingMap.get(QuoteRuleCategory.KIND.getCode()), quoteVo.getCarInfoVo());
             }
-            log.info("报价后数据");
             log.info("调用保险公司的api进行报价:报价参数: quoteVO=[{}]", JSONUtil.toJsonStr(quoteVo));
             quoteResultsVo = quoteService.quote(quoteVo);
             log.info("调用保险公司的api进行报价:报价结果: quoteResultsVo=[{}]", JSONUtil.toJsonStr(quoteResultsVo));

+ 6 - 0
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/InsFeeOrdersService.java

@@ -25,6 +25,12 @@ public interface InsFeeOrdersService extends IService<InsFeeOrders> {
 
     HttpResult updateAvailableAmount(String orderNo,BigDecimal availableAmount);
 
+    /**
+     * 订单审核时调整费用
+     *
+     * @author jiakai
+     * @date 2026/6/17 11:08
+     */
     CostCalculateRespVO computedCostInfo(PtlAgreementCostRatioVo param);
 
     /**

+ 21 - 16
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsFeeOrdersServiceImpl.java

@@ -69,8 +69,15 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
         return baseController.getUserSystemCode();
     }
 
+    /**
+     * 订单审核时调整费用
+     *
+     * @author jiakai
+     * @date 2026/6/17 11:08
+     */
     @Override
     public CostCalculateRespVO computedCostInfo(PtlAgreementCostRatioVo ptlAgreementCostRatioVo) {
+        log.info("订单审核时调整费用: ptlAgreementCostRatioVo=[{}]", JSONUtil.toJsonStr(ptlAgreementCostRatioVo));
         // 常量定义 保留小数5位
         InsFeeOrders insFeeOrders = getInsFeeOrders(ptlAgreementCostRatioVo);
         // 拼接返回值
@@ -93,8 +100,6 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
     private InsFeeOrders getInsFeeOrders(PtlAgreementCostRatioVo ptlAgreementCostRatioVo) {
         // 常量定义 保留小数5位
         final int SCALE = 5;
-        final BigDecimal TAX_RATE = new BigDecimal("1.06");
-
         // 获取订单信息
         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();
 
         // 更新对象中的比例字段
-        copyRatio(ptlAgreementCostRatioVo, insFeeOrders, withTax);
+        BigDecimal taxRate = copyRatio(ptlAgreementCostRatioVo, insFeeOrders, withTax);
 
         // 核心:规则重新计算所有费用
         // 1. 交强险
-        calculatePremiumByRule(insFeeOrders,
-                "jq", jqPremium,
+        calculatePremiumByRule(insFeeOrders, "jq", jqPremium,
                 insFeeOrders.getJqCommissionRatio(), insFeeOrders.getJqInletRatio(), insFeeOrders.getJqFollowRatio(),
                 insFeeOrders.getJqAdditionalRatio(), insFeeOrders.getJqKeepPointRatio(), insFeeOrders.getJqExportRatio(), insFeeOrders.getJqExportKeepPointRatio(),
-                withTax, TAX_RATE, SCALE);
+                withTax, taxRate, SCALE);
 
         // 2. 商业险
         calculatePremiumByRule(insFeeOrders, "sy", syPremium,
                 insFeeOrders.getSyCommissionRatio(), insFeeOrders.getSyInletRatio(), insFeeOrders.getSyFollowRatio(),
                 insFeeOrders.getSyAdditionalRatio(), insFeeOrders.getSyKeepPointRatio(), insFeeOrders.getSyExportRatio(), insFeeOrders.getSyExportKeepPointRatio(),
-                withTax, TAX_RATE, SCALE);
+                withTax, taxRate, SCALE);
 
         // 3. 驾乘险
         calculatePremiumByRule(insFeeOrders, "jy", jyPremium,
                 insFeeOrders.getJyCommissionRatio(), insFeeOrders.getJyInletRatio(), insFeeOrders.getJyFollowRatio(),
                 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());
@@ -176,7 +180,7 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
         // 出口直接乘
         BigDecimal export = premium.multiply(exportRatio).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);
 
         // 赋值到实体(自动匹配 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) {
             // 不含税:保费 / 1.06
-            bigDecimal =  new BigDecimal("1.06");
+            taxFactor =  new BigDecimal("1.06");
         }
         // 手续费比例
         BigDecimal jqCommissionRatio = covertPercent(ptlAgreementCostRatioVo.getJqCommissionRatio());
@@ -309,7 +313,7 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
         insFeeOrders.setJqInletRatio(jqInletRatio);
         insFeeOrders.setSyInletRatio(syInletRatio);
         insFeeOrders.setJyInletRatio(jyInletRatio);
-        // 跟单比例
+        // 跟单比例 
         BigDecimal jqFollowRatio = jqInletRatio.subtract(jqCommissionRatio);
         BigDecimal syFollowRatio = syInletRatio.subtract(syCommissionRatio);
         BigDecimal jyFollowRatio = jyInletRatio.subtract(jyCommissionRatio);
@@ -331,9 +335,9 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
         insFeeOrders.setSyExportRatio(syExportRatio);
         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.setSyKeepPointRatio(syKeepPointRatio);
@@ -342,6 +346,7 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
         insFeeOrders.setJqExportKeepPointRatio(covertPercent(ptlAgreementCostRatioVo.getJqExportKeepPointRatio()));
         insFeeOrders.setSyExportKeepPointRatio(covertPercent(ptlAgreementCostRatioVo.getSyExportKeepPointRatio()));
         insFeeOrders.setJyExportKeepPointRatio(covertPercent(ptlAgreementCostRatioVo.getJyExportKeepPointRatio()));
+        return taxFactor;
     }
 
 

+ 2 - 0
tenant/organization/src/main/java/com/jzg/organization/service/impl/SysUserServiceImpl.java

@@ -217,6 +217,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
                 jzgInfoId = userInfoJzgInfo.getId();
             }
             log.info("查看成员下的业务员信息:成员的序号:jzgInfoId=[{}]", jzgInfoId);
+            // modify by lipf 查询成员下业务员的时候,不进行分页
+            page.setSize(Long.MAX_VALUE);
             userInfoList = sysUserJzgInfoMapper.queryYwy(page, sysUserInfoListVo, systemCode, jzgInfoId
             );
         }else if("1".equals(sysUserInfoListVo.getIsMember())){