Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

Qchen 2 месяцев назад
Родитель
Сommit
b83f0bc848

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

@@ -51,6 +51,9 @@ public class FollowCompanyFeeVO {
     /** 累计应收  totalReceivable */
     private BigDecimal totalReceivable;
 
+    /** 对账金额  totalReceivable */
+    private BigDecimal totalReconciliationAmount;
+
     /**
      * 开票记录id
      */

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

@@ -23,6 +23,9 @@ public class SchemeResultVo {
         private String companyId;
         private String productId;
         private String schemeType;
+        private String energyType;
+        private String vehicleType;
+        private String carnature;
         List<SchemeInfoVo> infos = new ArrayList<>();
     }
 

+ 2 - 0
commons/src/main/java/com/jzg/commons/entity/vo/RuleAttrMappingVo.java

@@ -51,6 +51,8 @@ public class RuleAttrMappingVo {
 //        ruleAttrMappingVoList.add(new RuleAttrMappingVo("VehicleUseCode", VehicleUseCode.getByCode(insOrdersCarInfo.getVehicleUseCode())));
         ruleAttrMappingVoList.add(new RuleAttrMappingVo("VehicleUseCode", insOrdersCarInfo.getVehicleUseCode()));
         //车辆种类
+        ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarKindCode", insOrdersCarInfo.getCarKindCode()));
+        //使用性质
         ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarNatureCode", insOrdersCarInfo.getCarNatureCode()));
         //车辆类型
         ruleAttrMappingVoList.add(new RuleAttrMappingVo("CarTypeCode", insOrdersCarInfo.getCarTypeCode()));

+ 4 - 2
tenant/insurance/quotation-hengbang/src/main/java/com/jzg/quotation/hengbang/crawler/component/HengBangCrawlerRequestComponent.java

@@ -332,8 +332,10 @@ public class HengBangCrawlerRequestComponent {
                     if (StrUtil.isNotBlank(detail) && detail.contains("重复投保")) {
                         String time = extractDuplicateEndTime(detail);
                         if (time != null) {
-                            calculationRequest.setBegintimeCi(DateUtil.toUtcDateTime(time));
-                            calculationRequest.setBegintimeBi(DateUtil.toUtcDateTime(time));
+                            String utcTime = DateUtil.toUtcDateTime(time);
+                            calculationRequest.setBegintimeCi(utcTime);
+                            calculationRequest.setBegintimeBi(utcTime);
+                            calculationRequest.setBegintimeAccident(utcTime);
                             return getCalculationResult(calculationRequest, headers);
                         } else {
                             return StrUtil.isNotBlank(detail) ? detail : responseBody;

+ 4 - 2
tenant/insurance/quotation-hengbang/src/main/java/com/jzg/quotation/hengbang/crawler/service/Impl/HengBangCrawlerRequestImpl.java

@@ -186,8 +186,10 @@ public class HengBangCrawlerRequestImpl implements HengBangCrawlerRequest {
             if (time == null) {
                 break;
             }
-            calculationRequest.setBegintimeCi(DateUtil.toUtcDateTime(time));
-            calculationRequest.setBegintimeBi(DateUtil.toUtcDateTime(time));
+            String utcTime = DateUtil.toUtcDateTime(time);
+            calculationRequest.setBegintimeCi(utcTime);
+            calculationRequest.setBegintimeBi(utcTime);
+            calculationRequest.setBegintimeAccident(utcTime);
             resJsonObj = callCalculation(calculationRequest, headers);
             if (resJsonObj == null) {
                 return buildErrorResult(quoteVo);

+ 4 - 2
tenant/insurance/quotation-taikang/src/main/java/com/jzg/quotation/taikang/crawler/build/TkCrawlerQuoteResultsBuild.java

@@ -65,9 +65,11 @@ public class TkCrawlerQuoteResultsBuild {
             errorMessage = other.getMessageBZ().get(0) + "\n" + other.getMessageBZ().get(1);
         } else if (preciseInitResult.getPremium() == null) {
             errorMessage = other.getNotice();
-        } else if (other.getNotice() != null && !other.getNotice().isEmpty()) {
-            errorMessage = other.getNotice();
         }
+        // 直接有提示跳过,应该属于警告信息(目前只遇到选择的三者险是300万,初始化依然提示:规则管控提示$商业三者险保额请选择300万以上),后续看是否有其他情况影响报价,如果出现其他情况,对这个提示单独处理放行
+        // else if (other.getNotice() != null && !other.getNotice().isEmpty()) {
+        //     errorMessage = other.getNotice();
+        // }
 
         if (errorMessage == null) {
             return null;

+ 1 - 1
tenant/insurance/quotation-taikang/src/main/java/com/jzg/quotation/taikang/crawler/service/TKSimpleService.java

@@ -686,7 +686,7 @@ public class TKSimpleService {
 
         // 使用 autoSetter 设置可选字段(优先使用公司系统值,其次使用车型查询值)
         CodeUtil.autoSetter(car::setLicenseNo, commonCarInfoVo::getLicenseNo, tkCarModel::getLicenseNo);
-        CodeUtil.autoSetter(car::setTransferDate, commonCarInfoVo::getTransferDate, null);
+        // CodeUtil.autoSetter(car::setTransferDate, commonCarInfoVo::getTransferDate, null);
         CodeUtil.autoSetter(car::setPurchasePrice, commonCarInfoVo::getPurchasePrice, tkCarModel::getReplacementValue);
         CodeUtil.autoSetter(car::setSelectedSeat, commonCarInfoVo::getSeatCount, () -> tkCarModel.getVehicleJingyou().getSeat());
         CodeUtil.autoSetter(car::setExhaustScale, commonCarInfoVo::getDisplacement, tkCarModel::getDisplacement);

+ 8 - 18
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlSchemeServiceImpl.java

@@ -541,6 +541,14 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
         List<SchemeResultVo.SchemeVo> schemeInsuranceInfo = ptlSchemeMapper.getSchemeInsuranceInfo(companyId, productId);
         List<SchemeResultVo.SchemeVo> schemeDrivingInfo = ptlSchemeMapper.getSchemeDrivingInfo(companyId, productId);
 
+        // 过滤类型
+        List<SchemeResultVo.SchemeVo> newSchemeList = schemeInsuranceInfo.stream()
+                .filter(scheme -> scheme.getVehicleType().contains(vehicleType)
+                        && scheme.getEnergyType().contains(energyType)
+                        && scheme.getCarnature().contains(carnature))
+                .collect(Collectors.toList());
+
+        schemeInsuranceInfo = newSchemeList;
 
         // 创建一个 Map,Key: info.id, Value: List<Driving>
         Map<String, List<SchemeResultVo.Driving>> drivingMap = new HashMap<>();
@@ -636,24 +644,6 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
         if (optionalScheme != null && optionalScheme.getKinds() != null) {
             optionalScheme.getKinds().removeIf(kind -> "J1".equals(kind.getKindCode()));
         }
-
-        //过滤 能源类型 使用性质 车辆种类
-        List<PtlScheme> ptlSchemes = ptlSchemeMapper.selectList(new LambdaQueryWrapper<PtlScheme>().
-                eq(PtlScheme::getCompanyId, companyId).eq(PtlScheme::getEnergyType, energyType).
-                eq(PtlScheme::getCarnature, carnature).eq(PtlScheme::getVehicleType, vehicleType).
-                eq(PtlScheme::getProductId, productId).eq(PtlScheme::getIsDelete, 0));
-        Map<String, PtlScheme> collectPtlSchemes = ptlSchemes.stream().collect(Collectors.toMap(PtlScheme::getId, Function.identity()));
-        AssertionUtils.isFail(collectPtlSchemes.isEmpty(), "没有可报价的方案配置信息");
-        List<String> schemeInfoIds = new ArrayList<>();
-        for (SchemeResultVo.SchemeInfoVo schemeInfo : schemeResultVo.getSchemes()) {
-            schemeInfoIds.add(schemeInfo.getId());
-        }
-        List<PtlSchemeInfo> ptlSchemeInfos = ptlSchemeInfoMapper.selectList(new LambdaQueryWrapper<PtlSchemeInfo>().in(PtlSchemeInfo::getId, schemeInfoIds));
-        List<String> schemeIds = new ArrayList<>();
-        for (PtlSchemeInfo ptlSchemeInfo : ptlSchemeInfos) {
-            schemeIds.add(ptlSchemeInfo.getSchemeId());
-        }
-        schemeResultVo.getSchemes().removeIf(s -> !schemeIds.contains(s.getId()));
         return schemeResultVo;
     }
 

+ 30 - 5
tenant/organization/src/main/java/com/jzg/organization/service/impl/ReceivableServiceImpl.java

@@ -802,7 +802,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
         Map<String, List<FollowCompanyFeeVO>> followGroupMap = followCompanyFeeVos.stream()
                 .collect(Collectors.groupingBy(this::buildGroupKey));
 
-        // 【核心优化】提前收集所有需要查询的ID,批量查询,彻底解决循环N+1
+        // 提前收集所有需要查询的ID,批量查询,彻底解决循环N+1
         Set<String> allFollowIds = new HashSet<>();
         Set<String> allSettlementIds = new HashSet<>();
         followGroupMap.values().forEach(list -> {
@@ -841,7 +841,12 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
             BigDecimal receivablePremium = Optional.ofNullable(firstFollow)
                     .map(InsFeeFollowOrder::getReceivablePremium)
                     .orElse(BigDecimal.ZERO);
+            // 对账金额
+            BigDecimal reconciliationAmount = Optional.ofNullable(firstFollow)
+                    .map(InsFeeFollowOrder::getReconciliationAmount)
+                    .orElse(BigDecimal.ZERO);
             vo.setTotalReceivable(receivablePremium);
+            vo.setTotalReconciliationAmount(reconciliationAmount);
 
             // 已开票总额
             BigDecimal totalInvoiced = followIds.stream()
@@ -850,7 +855,8 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                     .map(InsFeeFollowOrder::getInvoiced)
                     .reduce(BigDecimal.ZERO, BigDecimal::add);
             vo.setTotalInvoiced(totalInvoiced);
-            vo.setTotalUnInvoiced(receivablePremium.subtract(totalInvoiced));
+            // 根据需求,未开票总金额 = 对账金额 - 已开票金额
+            vo.setTotalUnInvoiced(reconciliationAmount.subtract(totalInvoiced));
 
             // 已结算总额
             BigDecimal totalSettlementAmount = settlementIds.stream()
@@ -1111,7 +1117,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                 platformCompanyFeeVo.setTotalPaymentDifference(BigDecimal.ZERO);
             }
             //platformCompanyFeeVo.setTotalUnSettlementAmount(BigDecimalUtil.subtract(BigDecimalUtil.subtract(platformCompanyFeeVo.getTotalReceivable(),platformCompanyFeeVo.getTotalSettlementAmount()), platformCompanyFeeVo.getTotalPaymentDifference()));
-            platformCompanyFeeVo.setTotalUnSettlementAmount(BigDecimalUtil.subtract(platformCompanyFeeVo.getTotalReceivable(),platformCompanyFeeVo.getTotalSettlementAmount()));
+            platformCompanyFeeVo.setTotalUnSettlementAmount(BigDecimalUtil.subtract(platformCompanyFeeVo.getTotalReceivable(),BigDecimalUtil.subtract(platformCompanyFeeVo.getTotalSettlementAmount(),platformCompanyFeeVo.getTotalPaymentDifference())));
         }
         if (StrUtil.isNotBlank(settlementReportQueryVo.getStatus())){
             if ("1".equals(settlementReportQueryVo.getStatus())){
@@ -3971,12 +3977,31 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                     if (StrUtil.isEmpty(search)) {
                         return true;
                     }
+                    List<String> companyIds = Arrays.asList(search.split(","));
+                    HttpResult parentIds = null;
+                    if (companyIds.size() <= 2){
+                        parentIds = esmInsCompanyClient.getParentIds(companyIds);
+                    }
                     if ("等于".equalsIgnoreCase(type) || "包含".equalsIgnoreCase(type)) {
-                        List<String> companyIds = Arrays.asList(search.split(","));
+                        if (null != parentIds && parentIds.isSuccess()){
+                            List<String> data = (List<String>) parentIds.getData();
+                            if (CollUtil.isNotEmpty(data) && data.contains(insPlyIncome.getPartnerCompanyId())){
+                                return true;
+                            }else{
+                                return false;
+                            }
+                        }
                         return companyIds.contains(insPlyIncome.getPartnerCompanyId());
                     }
                     if ("不等于".equalsIgnoreCase(type) || "不包含".equalsIgnoreCase(type)) {
-                        List<String> companyIds = Arrays.asList(search.split(","));
+                        if (null != parentIds && parentIds.isSuccess()){
+                            List<String> data = (List<String>) parentIds.getData();
+                            if (CollUtil.isNotEmpty(data) && !data.contains(insPlyIncome.getPartnerCompanyId())){
+                                return true;
+                            }else{
+                                return false;
+                            }
+                        }
                         return !companyIds.contains(insPlyIncome.getPartnerCompanyId());
                     }
                     return true;

+ 6 - 0
tenant/organization/src/main/resources/mapper/PtlSchemeMapper.xml

@@ -6,6 +6,9 @@
         <id column="id" property="id"/>
         <result column="company_id" property="companyId"/>
         <result column="product_id" property="productId"/>
+        <result column="energy_type" property="energyType"/>
+        <result column="vehicle_type" property="vehicleType"/>
+        <result column="carnature" property="carnature"/>
         <collection property="infos" ofType="com.jzg.commons.entity.scheme.vo.SchemeResultVo$SchemeInfoVo"  javaType="java.util.List">
             <id column="scheme_info_id" property="id"/>
             <result column="scheme_name" property="schemeName"/>
@@ -119,6 +122,9 @@
             ps.company_id,
             ps.product_id,
             ps.product_name,
+            ps.energy_type,
+            ps.vehicle_type,
+            ps.carnature,
             psi.id AS scheme_info_id,
             psi.scheme_type,
             psi.scheme_name,

+ 3 - 6
tenant/organization/src/main/resources/mapper/ReceivableMapper.xml

@@ -1574,16 +1574,13 @@
             <if test="invoiceRecordQueryVo.invoiceParty != null and invoiceRecordQueryVo.invoiceParty != ''">
                 AND ipii.invoice_party = #{invoiceRecordQueryVo.invoiceParty}
             </if>
+            <if test="invoiceRecordQueryVo.settlementStatus != null and invoiceRecordQueryVo.settlementStatus != ''">
+                AND ipii.status = #{invoiceRecordQueryVo.settlementStatus}
+            </if>
             <if test="invoiceRecordQueryVo.companyNameSimple != null and invoiceRecordQueryVo.companyNameSimple != ''">
                 AND eic.id = #{invoiceRecordQueryVo.companyNameSimple}
             </if>
         </where>
-        <if test="invoiceRecordQueryVo.settlementStatus != null and invoiceRecordQueryVo.settlementStatus != ''">
-            HAVING CASE
-            WHEN ipii.receivable_supervise_premium = SUM(ipiis.actual_received_amount) THEN '1'
-            ELSE '0'
-            END = #{invoiceRecordQueryVo.settlementStatus}
-        </if>
         GROUP BY
         ipii.id,
         ipii.receivable_supervise_premium,