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

Merge remote-tracking branch 'origin/master'

Qchen 2 месяцев назад
Родитель
Сommit
28d94b89ac
25 измененных файлов с 300 добавлено и 74 удалено
  1. 50 0
      commons/src/main/java/com/jzg/commons/constants/InvoiceTypeEnum.java
  2. 4 0
      commons/src/main/java/com/jzg/commons/entity/account/po/SysUserAccountChangeLog.java
  3. 4 1
      commons/src/main/java/com/jzg/commons/entity/finance/dto/CompanySuperviseSettlementReportDto.java
  4. 20 0
      commons/src/main/java/com/jzg/commons/entity/finance/po/InsPlyIncome.java
  5. 3 0
      commons/src/main/java/com/jzg/commons/entity/finance/vo/SettlementReportQueryVo.java
  6. 1 0
      commons/src/main/java/com/jzg/commons/service/impl/OperatorTrajectoryServiceImpl.java
  7. 14 0
      commons/src/main/java/com/jzg/quotation/commons/constant/SpElMapping.java
  8. 0 1
      commons/src/main/java/com/jzg/quotation/commons/utils/SpElFieldExtractor.java
  9. 1 1
      commons/src/main/java/com/jzg/quotation/summary/aop/aspect/OrderOperationLog.java
  10. 2 0
      commons/src/main/java/com/jzg/quotation/summary/constants/QuoteNumberConstant.java
  11. 1 0
      tenant/insurance/quotation-ansheng/src/main/java/com/jzg/quotation/ansheng/crawler/service/impl/AnShengCrawlerRequestImpl.java
  12. 48 0
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/aop/OrderOperationLogAspect.java
  13. 9 1
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/controller/InsFeeAuditController.java
  14. 1 3
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/controller/InsOrderAdjustController.java
  15. 2 2
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/controller/UnifyOrderManager.java
  16. 21 6
      tenant/insurance/quotation-taikang/src/main/java/com/jzg/quotation/taikang/crawler/service/impl/TKQuotationBaseServiceImpl.java
  17. 15 2
      tenant/insurance/quotation-taishan/src/main/java/com/jzg/quotation/taishan/crawler/component/TaiShanCrawlerCacheComponent.java
  18. 2 1
      tenant/insurance/quotation-taishan/src/main/java/com/jzg/quotation/taishan/crawler/component/TaiShanCrawlerRequestComponent.java
  19. 21 14
      tenant/insurance/quotation-taishan/src/main/java/com/jzg/quotation/taishan/crawler/service/impl/TaiShanCrawlerRequestImpl.java
  20. 1 0
      tenant/organization/src/main/java/com/jzg/organization/controller/InsFeeFollowOrderReconciliationController.java
  21. 12 2
      tenant/organization/src/main/java/com/jzg/organization/controller/ReceivableController.java
  22. 1 1
      tenant/organization/src/main/java/com/jzg/organization/mapper/ReceivableMapper.java
  23. 1 1
      tenant/organization/src/main/java/com/jzg/organization/mapper/SysUserAccountIncomeLogMapper.java
  24. 58 33
      tenant/organization/src/main/java/com/jzg/organization/service/impl/ReceivableServiceImpl.java
  25. 8 5
      tenant/organization/src/main/resources/mapper/ReceivableMapper.xml

+ 50 - 0
commons/src/main/java/com/jzg/commons/constants/InvoiceTypeEnum.java

@@ -0,0 +1,50 @@
+package com.jzg.commons.constants;
+
+/**
+ * 费用类型枚举
+ */
+public enum InvoiceTypeEnum {
+
+    /** 1、手续费 */
+    FEE_1("1", "手续费"),
+    /** 2、跟单费 */
+    FEE_2("2", "跟单费"),
+    /** 3、驾意险手续费 */
+    FEE_3("3", "驾意险手续费"),
+    /** 4、驾意险跟单费 */
+    FEE_4("4", "驾意险跟单费"),
+    /** 5、平台应收-车险 */
+    FEE_5("5", "平台应收-车险"),
+    /** 6、平台应收-非车险 */
+    FEE_6("6", "平台应收-非车险");
+
+    // 编码(String类型)
+    private final String code;
+    // 名称(String类型)
+    private final String desc;
+
+    InvoiceTypeEnum(String code, String desc) {
+        this.code = code;
+        this.desc = desc;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    /**
+     * 根据code获取枚举
+     */
+    public static InvoiceTypeEnum getByCode(String code) {
+        for (InvoiceTypeEnum value : values()) {
+            if (value.getCode().equals(code)) {
+                return value;
+            }
+        }
+        return null;
+    }
+}

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

@@ -47,6 +47,10 @@ public class SysUserAccountChangeLog extends BaseModel {
     @Schema(description = "jzg_info表的序号")
     private String jzgInfoId;
 
+    @ExcelProperty("车牌号")
+    @Schema(description = "车牌号")
+    private String licenseNo;
+
     @ExcelProperty("操作前金额")
     @Schema(description = "操作前金额")
     private BigDecimal amountBefore;

+ 4 - 1
commons/src/main/java/com/jzg/commons/entity/finance/dto/CompanySuperviseSettlementReportDto.java

@@ -40,9 +40,12 @@ public class CompanySuperviseSettlementReportDto implements Serializable {
     @Schema(description = "累计应收金额(跟单费页面展示)")
     private String totalFollowFee;
 
-    @Schema(description = "应收手续费")
+    @Schema(description = "应收手续费(车险)")
     private String superviseFee;
 
+    @Schema(description = "应收手续费(非车险)")
+    private String superviseFee4Other;
+
 
     @Schema(description = "应收跟单费")
     private String followFee;

+ 20 - 0
commons/src/main/java/com/jzg/commons/entity/finance/po/InsPlyIncome.java

@@ -199,6 +199,26 @@ public class InsPlyIncome extends BaseModel {
     @ExcelProperty("总应收金额")
     private String receivableAmount;
 
+    @TableField(exist = false)
+    @Schema(description = "车险应收手续费")
+    @ExcelProperty("车险应收手续费")
+    private String carInsuranceSuperviseCostsPremiums;
+
+    @TableField(exist = false)
+    @Schema(description = "非车险应收手续费")
+    @ExcelProperty("非车险应收手续费")
+    private String nonCarInsuranceSuperviseCostsPremiums;
+
+    @TableField(exist = false)
+    @Schema(description = "车险应收跟单费")
+    @ExcelProperty("车险应收跟单费")
+    private String carInsuranceOtherCostsPremiums;
+
+    @TableField(exist = false)
+    @Schema(description = "非车险应收跟单费")
+    @ExcelProperty("非车险应收跟单费")
+    private String nonCarInsuranceOtherCostsPremiums;
+
     @Schema(description = "手续费是否已经结算")
     @ExcelIgnore
     private String superviseSettlement;

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

@@ -13,6 +13,9 @@ import java.util.List;
 
 @Data
 public class SettlementReportQueryVo extends PageRequest {
+    @Schema(description = "应收项/10车险20非车险30全部")
+    private String accountsReceivable;
+
     @Schema(description = "保险公司id")
     private String companyId;
 

+ 1 - 0
commons/src/main/java/com/jzg/commons/service/impl/OperatorTrajectoryServiceImpl.java

@@ -66,6 +66,7 @@ public class OperatorTrajectoryServiceImpl implements OperatorTrajectoryService
         lambdaQueryWrapper.like(StringUtils.isNotEmpty(logParam.getOperator()),OperatorTrajectory::getCreateBy,logParam.getOperator());
         lambdaQueryWrapper.like(StringUtils.isNotEmpty(logParam.getFunction()),OperatorTrajectory::getModuleName,logParam.getFunction());
         lambdaQueryWrapper.like(StringUtils.isNotEmpty(logParam.getContent()),OperatorTrajectory::getOperationContent,logParam.getContent());
+        lambdaQueryWrapper.orderByDesc(OperatorTrajectory::getCreateTime);
         if (CollectionUtils.isNotEmpty(logParam.getOperatingTime())) {
             List<LocalDate> dates = logParam.getOperatingTime();
             if (dates.size() >= 2) {

+ 14 - 0
commons/src/main/java/com/jzg/quotation/commons/constant/SpElMapping.java

@@ -0,0 +1,14 @@
+package com.jzg.quotation.commons.constant;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class SpElMapping {
+
+    private String fieldName;   // 最终生成日志的字段名,如 "orderId"
+    private String spel;        // SpEL 表达式,如 "#ret.data.orderId"
+}

+ 0 - 1
tenant/insurance/quotation-commons/src/main/java/com/jzg/quotation/commons/utils/SpElFieldExtractor.java → commons/src/main/java/com/jzg/quotation/commons/utils/SpElFieldExtractor.java

@@ -1,6 +1,5 @@
 package com.jzg.quotation.commons.utils;
 
-import com.alibaba.fastjson2.JSON;
 import com.jzg.quotation.commons.constant.SpElMapping;
 import org.springframework.expression.EvaluationContext;
 import org.springframework.expression.ExpressionParser;

+ 1 - 1
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/aop/OrderOperationLog.java → commons/src/main/java/com/jzg/quotation/summary/aop/aspect/OrderOperationLog.java

@@ -1,4 +1,4 @@
-package com.jzg.quotation.summary.aop;
+package com.jzg.quotation.summary.aop.aspect;
 
 import com.jzg.quotation.summary.constants.QuoteNumberConstant;
 

+ 2 - 0
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/constants/QuoteNumberConstant.java → commons/src/main/java/com/jzg/quotation/summary/constants/QuoteNumberConstant.java

@@ -93,6 +93,8 @@ public class QuoteNumberConstant {
         OPT_TYPE_12(12,"批改审核"),
         OPT_TYPE_13(13,"撤销批改"),
         OPT_TYPE_14(14,"订单审核"),
+        OPT_TYPE_15(15,"费用调整"),
+        OPT_TYPE_16(16,"批量修改比例"),
         ;
         private Integer code;
         private String desc;

+ 1 - 0
tenant/insurance/quotation-ansheng/src/main/java/com/jzg/quotation/ansheng/crawler/service/impl/AnShengCrawlerRequestImpl.java

@@ -535,6 +535,7 @@ public class AnShengCrawlerRequestImpl implements AnShengCrawlerRequest {
                     }
                 } else if ("0".equals(baseMark)) {
                     String reason = queryFailure(targetPolicyNos, httpHeaders);
+                    resultVo.setOrderStatus(InsOrderStatusEnum.AUDIT_FAIL);
                     resultVo.setErrorMsg(reason);
                 } else if ("1".equals(baseMark)) {
                     log.info("人工处理中,请稍等...");

+ 48 - 0
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/aop/OrderOperationLogAspect.java

@@ -14,6 +14,7 @@ import com.jzg.commons.entity.quote.vo.aggregated.*;
 import com.jzg.commons.entity.vo.AdjustAllRefundVo;
 import com.jzg.quotation.commons.constant.SpElMapping;
 import com.jzg.quotation.commons.utils.SpElFieldExtractor;
+import com.jzg.quotation.summary.aop.aspect.OrderOperationLog;
 import com.jzg.quotation.summary.constants.QuoteNumberConstant;
 import com.jzg.quotation.summary.service.InsOrderAdjustService;
 import com.jzg.quotation.summary.service.InsOrdersCarInfoService;
@@ -64,6 +65,7 @@ public class OrderOperationLogAspect {
         // 获取方法信息和参数
         MethodSignature signature = (MethodSignature) joinPoint.getSignature();
         Object[] args = joinPoint.getArgs();
+        logger.info("订单相关的参数:args=[{}]", JSONUtil.toJsonStr(args));
         String[] paramNames = signature.getParameterNames();
         // 设置 SpEL 上下文
         EvaluationContext context = new StandardEvaluationContext();
@@ -152,10 +154,56 @@ public class OrderOperationLogAspect {
                 HttpResult<String> res = (HttpResult)result;
                 this.dealApproveOrders(res.getData(),res,log);
                 break;
+            // 费用调整
+            case 15:
+                logger.info("费用调整log.orderSpEl()=[{}]",log.orderSpEl());
+                result = joinPoint.proceed();
+                String orderNo01 = "001";
+                this.saveCostInfo(orderNo01,result,log);
+                break;
+            // 批量修改比例
+            case 16:
+                logger.info("批量修改比例.log.orderSpEl()=[{}]",log.orderSpEl());
+                result = joinPoint.proceed();
+                String orderNo02 = "002";
+                this.batchModify(orderNo02,result,log);
+                break;
         }
         return result;
     }
 
+    /**
+     * 批量修改比例
+     *
+     * @author lipf
+     * @date 2026/7/8 15:29
+     */
+    private void batchModify(String orderNo, Object result, OrderOperationLog log) {
+        InsOrdersTrack track = new InsOrdersTrack();
+        track.setModule("应收订单");
+        track.setSubModule("");
+        track.setOptType(16);
+        track.setOrderNo(orderNo);
+        track.setResult(JSONUtil.toJsonStr(result));
+        traceService.save(track);
+    }
+
+    /**
+     * 保存费用信息
+     * @author lipf
+     * @date 2026/7/8 15:28
+     */
+    private void saveCostInfo(String orderNo, Object result, OrderOperationLog log) {
+        InsOrdersTrack track = new InsOrdersTrack();
+        track.setModule("订单审核");
+        track.setSubModule("我的审核");
+        track.setOptType(15);
+        track.setOrderNo(orderNo);
+        track.setResult(JSONUtil.toJsonStr(result));
+        traceService.save(track);
+    }
+
+
     /**
      * 订单审核(通过/驳回)
      *

+ 9 - 1
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/controller/InsFeeAuditController.java

@@ -12,7 +12,7 @@ import com.jzg.commons.entity.orders.vo.AuditCostInfoVo;
 import com.jzg.commons.entity.orders.vo.FeeAuditVo;
 import com.jzg.commons.entity.quote.vo.aggregated.QuoteEchoVo;
 import com.jzg.commons.entity.vo.PtlAgreementCostRatioVo;
-import com.jzg.quotation.summary.aop.OrderOperationLog;
+import com.jzg.quotation.summary.aop.aspect.OrderOperationLog;
 import com.jzg.quotation.summary.constants.QuoteNumberConstant;
 import com.jzg.quotation.summary.service.InsFeeAuditService;
 import io.swagger.v3.oas.annotations.Operation;
@@ -184,6 +184,14 @@ public class InsFeeAuditController {
      * 保存调整的费用
      * @return HttpResult<String>
      */
+    @OrderOperationLog(
+            module = "订单审核",
+            subModule = "我的审核",
+            optType = QuoteNumberConstant.QuoteOptType.OPT_TYPE_15,
+            description = "费用调整",
+            orderSpEl = "#quoteVo",
+            feedbackSpEl = "#ret.code + ' - ' + #ret.msg+ ' - ' + #ret.data"
+    )
     @PostMapping("/saveCostInfo")
     @Operation(summary = "保存调整的费用")
     public HttpResult<String> saveCostInfo(@RequestBody PtlAgreementCostRatioVo param){

+ 1 - 3
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/controller/InsOrderAdjustController.java

@@ -8,15 +8,13 @@ import com.jzg.commons.core.base.BaseController;
 import com.jzg.commons.core.page.HttpResult;
 import com.jzg.commons.entity.dto.*;
 import com.jzg.commons.entity.orders.po.InsOrderAdjust;
-import com.jzg.commons.entity.orders.po.InsOrderAdjustInfo;
 import com.jzg.commons.entity.orders.po.InsOrders;
-import com.jzg.commons.entity.vo.AdjustAllRefundInfoVo;
 import com.jzg.commons.entity.vo.AdjustAllRefundVo;
 import com.jzg.commons.entity.vo.OrderAdjustVo;
 import com.jzg.commons.util.AssertionUtils;
 import com.jzg.commons.util.EasyExcelUtils;
 import com.jzg.commons.util.ServletUtils;
-import com.jzg.quotation.summary.aop.OrderOperationLog;
+import com.jzg.quotation.summary.aop.aspect.OrderOperationLog;
 import com.jzg.quotation.summary.constants.QuoteNumberConstant;
 import com.jzg.quotation.summary.service.InsOrderAdjustInfoService;
 import com.jzg.quotation.summary.service.InsOrderAdjustService;

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

@@ -52,7 +52,7 @@ import com.jzg.quotation.commons.service.QuotationCrawlerBaseService;
 import com.jzg.quotation.commons.utils.SnowFlakeUtil;
 import com.jzg.quotation.guoren.crawler.service.GuoRenCrawlerRequest;
 import com.jzg.quotation.summary.aop.AuditVerification;
-import com.jzg.quotation.summary.aop.OrderOperationLog;
+import com.jzg.quotation.summary.aop.aspect.OrderOperationLog;
 import com.jzg.quotation.summary.aop.QuoteVerification;
 import com.jzg.quotation.summary.async.AsyncGetPayLink;
 import com.jzg.quotation.summary.classifier.QuoteInfoParameterFilling;
@@ -343,7 +343,7 @@ public class UnifyOrderManager {
             Throwable root = e.getCause() != null ? e.getCause() : e;
             String errMsg = root.getMessage() != null ? root.getMessage() : "系统异常,报价失败";
             // 去除异常类名前缀
-            if (errMsg.matches("^[a-zA-Z0-9.]+Exception:.*")) {
+            if (errMsg.matches("[a-zA-Z0-9.]+Exception:[\\s\\S]*")) {
                 errMsg = errMsg.substring(errMsg.indexOf(":") + 1).trim();
             }
             try {

+ 21 - 6
tenant/insurance/quotation-taikang/src/main/java/com/jzg/quotation/taikang/crawler/service/impl/TKQuotationBaseServiceImpl.java

@@ -237,7 +237,7 @@ public class TKQuotationBaseServiceImpl implements TKQuotationBaseService {
         // uploadImage(insuranceUploadImageVo);
 
         // 核保结果
-        underwritingResultsVo.setUnderwritingResult(tkEntranceFor000038Result.getData().getSpResMsg()+",原因:"+tkEntranceFor000038Result.getCheckReason());
+        underwritingResultsVo.setUnderwritingResult(tkEntranceFor000038Result.getData().getSpResMsg() + ",原因:" + tkEntranceFor000038Result.getCheckReason());
         // 核保状态
         underwritingResultsVo.setUnderwritingStatus(InsOrderStatusEnum.STAFF_PROCESS);
     }
@@ -533,15 +533,30 @@ public class TKQuotationBaseServiceImpl implements TKQuotationBaseService {
         } else if (orderStatus.equals("X")) {
             orderStatusResultVo.setOrderStatus(InsOrderStatusEnum.ORDER_CLOSE);
         }
-        String proposalNoCI = tkEntranceFor000086Result.getQuotationNoCI();
-        String proposalNoBI = tkEntranceFor000086Result.getQuotationNoBI();
+        orderStatusResultVo.setJqPolicyno(tkEntranceFor000086Result.getQuotationNoCI());
+        orderStatusResultVo.setSyPolicyno(tkEntranceFor000086Result.getQuotationNoBI());
 
         // 交强险投保单号
-        orderStatusResultVo.setJqApplyNo(proposalNoCI);
+        if (tkEntranceFor000086Result.getOrderInfoVoBZ() != null) {
+            orderStatusResultVo.setJqApplyNo(tkEntranceFor000086Result.getOrderInfoVoBZ().getJqProposalNo());
+        }
         // 商业投保单号
-        orderStatusResultVo.setSyApplyNo(proposalNoBI);
+        if (tkEntranceFor000086Result.getOrderInfoVoCI() != null) {
+            orderStatusResultVo.setSyApplyNo(tkEntranceFor000086Result.getOrderInfoVoCI().getSyProposalNo());
+        }
         // 驾意险投保单号
-        // orderStatusResultVo.setJyApplyNo(JYProposalNo);
+        if (tkEntranceFor000086Result.getDriverAccidentVo() != null) {
+            orderStatusResultVo.setJyApplyNo(tkEntranceFor000086Result.getDriverAccidentVo().getProposalNo());
+        }
+
+        // 获取支付链接
+        if ("D".equals(orderStatus)) {
+            PaymentLinkVo paymentLinkVo = new PaymentLinkVo();
+            paymentLinkVo.setOrder(orderStatusVo.getOrder());
+            PaymentLinkResultsVo paymentLink = getPaymentLink(paymentLinkVo);
+            orderStatusResultVo.setPaymentLink(paymentLink.getPaymentLink());
+        }
+
         return orderStatusResultVo;
     }
 

+ 15 - 2
tenant/insurance/quotation-taishan/src/main/java/com/jzg/quotation/taishan/crawler/component/TaiShanCrawlerCacheComponent.java

@@ -1,7 +1,11 @@
 package com.jzg.quotation.taishan.crawler.component;
 
+import com.jzg.commons.exception.SystemException;
 import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.redisson.api.RBucket;
 import org.redisson.api.RedissonClient;
+import org.redisson.client.codec.StringCodec;
 import org.springframework.stereotype.Component;
 
 import java.time.Duration;
@@ -12,6 +16,7 @@ import java.util.Map;
  * @author: wenks
  * @date: 2025/3/31 15:15
  **/
+@Slf4j
 @Component
 @RequiredArgsConstructor
 public class TaiShanCrawlerCacheComponent {
@@ -54,7 +59,8 @@ public class TaiShanCrawlerCacheComponent {
      * @param authorization   登陆cookie
      */
     public void cacheAuthorization(String username, String authorization) {
-        redissonClient.getBucket(TS_LOGIN_AUTH + username).set(authorization, Duration.ofDays(TS_LOGIN_AUTH_TIME));
+        RBucket<String> bucket = redissonClient.getBucket(TS_LOGIN_AUTH + username, StringCodec.INSTANCE);
+        bucket.set(authorization, Duration.ofDays(TS_LOGIN_AUTH_TIME));
     }
 
 
@@ -65,7 +71,14 @@ public class TaiShanCrawlerCacheComponent {
      * @return 登录cookie
      */
     public String getAuthorization(String username) {
-        return (String) redissonClient.getBucket(TS_LOGIN_AUTH + username).get();
+        try {
+            RBucket<String> bucket = redissonClient.getBucket(TS_LOGIN_AUTH + username, StringCodec.INSTANCE);
+            return bucket.get();
+        } catch (Exception e) {
+            log.warn("泰山登录缓存读取失败,将重新登录,username={}", username, e);
+            redissonClient.getBucket(TS_LOGIN_AUTH + username).delete();
+            throw new SystemException("泰山登录缓存读取失败,请重新登录");
+        }
     }
 
 

+ 2 - 1
tenant/insurance/quotation-taishan/src/main/java/com/jzg/quotation/taishan/crawler/component/TaiShanCrawlerRequestComponent.java

@@ -315,7 +315,8 @@ public class TaiShanCrawlerRequestComponent {
         TaiShanCrawlerQuotationResponse response = post(RequestUrl.PRICE, request, TaiShanCrawlerQuotationResponse.class, headers);
 
         TaiShanCrawlerQuotationResponse.ResultDTO.ExceptionDTO exception = response.getResult().getException();
-        ResultEnum.verify(exception.getCode(), exception.getMsg());
+        String errorMessage = response.getResult() != null ? exception.getMsg() : response.getMessage();
+        ResultEnum.verify(exception.getCode(), errorMessage);
 
         // 通过状态码获取处理器处理
         ResponseMessageAbstractHandler responseMessageAbstractHandler =

+ 21 - 14
tenant/insurance/quotation-taishan/src/main/java/com/jzg/quotation/taishan/crawler/service/impl/TaiShanCrawlerRequestImpl.java

@@ -184,22 +184,29 @@ public class TaiShanCrawlerRequestImpl implements TaiShanCrawlerRequest {
                 }
             }
             log.info("taiShanCrawlerQuotationSaveResponse参数的值:{}", JSON.toJSONString(taiShanCrawlerQuotationSaveResponse));
-            TaiShanCrawlerQuotationSaveResponse.Result.Exception saveException = taiShanCrawlerQuotationSaveResponse.getResult().getException();
-            if (saveException.getCode().equals("H1")){
-                TaiShanCrawlerOrder taiShanCrawlerOrder = new TaiShanCrawlerOrder();
-                taiShanCrawlerOrder.setOrdersNo(quoteVo.getOrder().getOrdersNo());
-                taiShanCrawlerOrderService.save(taiShanCrawlerQuotationSaveResponse, taiShanCrawlerOrder);
-                success = true;
-
-                //风险管控
-                String proposalNo = taiShanCrawlerQuotationSaveResponse.getResult().getCompulsoryInsurance().getProductInfo().getProposalNo();
-                TaiShanCrawlerRiskManagementRequest taiShanCrawlerRiskManagementRequest = new TaiShanCrawlerRiskManagementRequest(proposalNo);
-                taiShanCrawlerRiskManagementResponse = taiShanCrawlerRequestComponent.getRiskManagement(taiShanCrawlerRiskManagementRequest, headers);
-            }else{
-                errMsg = saveException.getMsg();
+            if (taiShanCrawlerQuotationSaveResponse.getResult() != null) {
+                TaiShanCrawlerQuotationSaveResponse.Result.Exception saveException = taiShanCrawlerQuotationSaveResponse.getResult().getException();
+                if (saveException.getCode().equals("H1")){
+                    TaiShanCrawlerOrder taiShanCrawlerOrder = new TaiShanCrawlerOrder();
+                    taiShanCrawlerOrder.setOrdersNo(quoteVo.getOrder().getOrdersNo());
+                    taiShanCrawlerOrderService.save(taiShanCrawlerQuotationSaveResponse, taiShanCrawlerOrder);
+                    success = true;
+
+                    //风险管控
+                    String proposalNo = taiShanCrawlerQuotationSaveResponse.getResult().getCompulsoryInsurance().getProductInfo().getProposalNo();
+                    TaiShanCrawlerRiskManagementRequest taiShanCrawlerRiskManagementRequest = new TaiShanCrawlerRiskManagementRequest(proposalNo);
+                    taiShanCrawlerRiskManagementResponse = taiShanCrawlerRequestComponent.getRiskManagement(taiShanCrawlerRiskManagementRequest, headers);
+                }else{
+                    errMsg = saveException.getMsg();
+                    throw new SystemException(errMsg);
+                }
+            }else {
+                errMsg = taiShanCrawlerQuotationSaveResponse.getMessage();
+                throw new SystemException(errMsg);
             }
         }else{
-            errMsg = exception.getMsg();
+            errMsg = taiShanCrawlerQuotationResponse.getResult() != null ? exception.getMsg() : taiShanCrawlerQuotationResponse.getMessage();
+            throw new SystemException(errMsg);
         }
         return TaiShanCrawlerQuoteResultsVoBuild.buildQuoteResultsVo(quoteVo,
                 taiShanCrawlerQuotationSaveResponse,

+ 1 - 0
tenant/organization/src/main/java/com/jzg/organization/controller/InsFeeFollowOrderReconciliationController.java

@@ -43,6 +43,7 @@ public class InsFeeFollowOrderReconciliationController {
                 .eq("month", saveDTO.getMonth())
                 .eq("partner_company_id", saveDTO.getPartnerCompanyId())
                 .eq("system_code", baseController.getSystemCode())
+                .eq("invoice_type", saveDTO.getInvoiceType())
                 .last("LIMIT 1"); // 取一条即可,或者根据业务取最新的
         InsFeeFollowOrderReconciliation insFeeFollowOrderReconciliation = reconciliationService.getOne(insFeeFollowOrderReconciliationQueryWrapper);
 

+ 12 - 2
tenant/organization/src/main/java/com/jzg/organization/controller/ReceivableController.java

@@ -15,6 +15,8 @@ import com.jzg.commons.entity.orders.po.InsOrderAdjust;
 import com.jzg.commons.request.RequestSingleParam;
 import com.jzg.commons.util.AssertionUtils;
 import com.jzg.organization.service.ReceivableService;
+import com.jzg.quotation.summary.aop.aspect.OrderOperationLog;
+import com.jzg.quotation.summary.constants.QuoteNumberConstant;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import org.slf4j.Logger;
@@ -117,7 +119,7 @@ public class ReceivableController {
         if (null == data || CollUtil.isEmpty(data.getRecords())){
             return HttpResult.ok(BigDecimal.ZERO);
         }
-        BigDecimal reduce = data.getRecords().stream().map(income -> StrUtil.isNotBlank(income.getSuperviseCostsPremiums()) ? new BigDecimal(income.getSuperviseCostsPremiums()) : BigDecimal.ZERO)
+        BigDecimal reduce = data.getRecords().stream().map(income -> StrUtil.isNotBlank(income.getCarInsuranceSuperviseCostsPremiums()) ? new BigDecimal(income.getCarInsuranceSuperviseCostsPremiums()) : BigDecimal.ZERO)
                 .reduce(BigDecimal.ZERO, BigDecimal::add);
         return HttpResult.ok(reduce);
     }
@@ -196,7 +198,7 @@ public class ReceivableController {
         if (null == data || CollUtil.isEmpty(data.getRecords())){
             return HttpResult.ok(BigDecimal.ZERO);
         }
-        BigDecimal reduce = data.getRecords().stream().map(income -> StrUtil.isNotBlank(income.getOtherCostsPremiums()) ? new BigDecimal(income.getOtherCostsPremiums()) : BigDecimal.ZERO)
+        BigDecimal reduce = data.getRecords().stream().map(income -> StrUtil.isNotBlank(income.getCarInsuranceOtherCostsPremiums()) ? new BigDecimal(income.getCarInsuranceOtherCostsPremiums()) : BigDecimal.ZERO)
                 .reduce(BigDecimal.ZERO, BigDecimal::add);
         return HttpResult.ok(reduce);
     }
@@ -542,6 +544,14 @@ public class ReceivableController {
      * @author lipf
      * @date 2026/5/27 20:25
      */
+    @OrderOperationLog(
+            module = "私有协议应收",
+            subModule = "订单审核",
+            optType = QuoteNumberConstant.QuoteOptType.OPT_TYPE_16,
+            description = "费用调整",
+            orderSpEl = "#quoteVo",
+            feedbackSpEl = "#ret.code + ' - ' + #ret.msg+ ' - ' + #ret.data"
+    )
     @PostMapping("batchModify")
     @Operation(summary = "批量修改")
     public HttpResult<String> batchModify(@RequestBody BatchModifyVo batchModifyVo){

+ 1 - 1
tenant/organization/src/main/java/com/jzg/organization/mapper/ReceivableMapper.java

@@ -250,7 +250,7 @@ public interface ReceivableMapper extends BaseMapper<InsPlyIncome> {
      */
     //@MapKey("companyId")
     List<CalRes> queryInvoicedAmount(@Param("systemCode") String systemCode,
-                                     @Param("invoiceType") List<Integer> invoiceType,
+                                     @Param("invoiceType") List<String> invoiceType,
                                      @Param("invoiceStartDate") String invoiceStartDate,
                                      @Param("invoiceEndDate") String invoiceEndDate,
                                      @Param("agreementType") String agreementType);

+ 1 - 1
tenant/organization/src/main/java/com/jzg/organization/mapper/SysUserAccountIncomeLogMapper.java

@@ -20,6 +20,6 @@ public interface SysUserAccountIncomeLogMapper extends BaseMapper<SysUserAccount
      * @author lipf
      * @date 2026/6/8 17:25
      */
-    @Select("select * from sys_user_account_change_log a where a.user_id = #{ywyUserId} and a.create_time >= #{beginDate} and a.create_time < #{endDate} and a.is_delete = 0 order by a.create_time desc")
+    @Select("select ioci.license_no , a.* from sys_user_account_change_log a  left join ins_orders_car_info ioci on a.related_order_id = ioci.order_no where a.user_id = #{ywyUserId} and a.create_time >= #{beginDate} and a.create_time < #{endDate} and a.is_delete = 0 order by a.create_time desc")
     List<SysUserAccountChangeLog> queryYwyIORecs(String ywyUserId, LocalDate beginDate, LocalDate endDate);
 }

+ 58 - 33
tenant/organization/src/main/java/com/jzg/organization/service/impl/ReceivableServiceImpl.java

@@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jzg.commons.constants.InvoiceTypeEnum;
 import com.jzg.commons.constants.ProductsType;
 import com.jzg.commons.constants.dict.InsOrderStatusEnum;
 import com.jzg.commons.core.base.BaseController;
@@ -327,8 +328,23 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
         Page<InsPlyIncome> page = baseMapper.getReceivablePage(page1, receivableQueryVo);
         List<InsPlyIncomeOrder> res = page.getRecords().stream()
                 .map(action -> new InsPlyIncomeOrder(action.getId(), action.getOrderNo())).toList();
-        BigDecimal totalAmount = page.getRecords().stream()
-                .map(action -> new BigDecimal(Objects.toString(action.getReceivableAmount(), "0"))).reduce(BigDecimal.ZERO, BigDecimal::add);
+        BigDecimal totalAmount = BigDecimal.ZERO;
+        if (InvoiceTypeEnum.FEE_3.getCode().equals(receivableQueryVo.getInvoiceType())){
+            totalAmount = page.getRecords().stream()
+                    .map(action -> new BigDecimal(Objects.toString(action.getNonCarInsuranceSuperviseCostsPremiums(), "0"))).reduce(BigDecimal.ZERO, BigDecimal::add);
+        } else if (InvoiceTypeEnum.FEE_4.getCode().equals(receivableQueryVo.getInvoiceType())){
+            totalAmount = page.getRecords().stream()
+                    .map(action -> new BigDecimal(Objects.toString(action.getNonCarInsuranceOtherCostsPremiums(), "0"))).reduce(BigDecimal.ZERO, BigDecimal::add);
+        }else if (InvoiceTypeEnum.FEE_1.getCode().equals(receivableQueryVo.getInvoiceType())){
+            totalAmount = page.getRecords().stream()
+                    .map(action -> new BigDecimal(Objects.toString(action.getCarInsuranceSuperviseCostsPremiums(), "0"))).reduce(BigDecimal.ZERO, BigDecimal::add);
+        }else if (InvoiceTypeEnum.FEE_2.getCode().equals(receivableQueryVo.getInvoiceType())){
+            totalAmount = page.getRecords().stream()
+                    .map(action -> new BigDecimal(Objects.toString(action.getCarInsuranceOtherCostsPremiums(), "0"))).reduce(BigDecimal.ZERO, BigDecimal::add);
+        }else{
+            totalAmount = page.getRecords().stream()
+                    .map(action -> new BigDecimal(Objects.toString(action.getReceivableAmount(), "0"))).reduce(BigDecimal.ZERO, BigDecimal::add);
+        }
 
         InsPlyIncomeVO vo = new InsPlyIncomeVO(null, res,Objects.toString(totalAmount,"0"));
         log.info("获取私有/平台协议手续费应收列表的id集合。receivableQueryVo=[{}]. ids.size=[{}]", JSONUtil.toJsonStr(receivableQueryVo), CollUtil.size(res));
@@ -4065,7 +4081,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                 for (int month = 1; month <= 12; month++) {
                     InsFeeFollowOrderVo vo = buildFollowOrderVo(
                             year, month, firstItem, partnerCompanyId,
-                            monthReceivableMap, invoicedMap
+                            monthReceivableMap, invoicedMap, followInvoicePageListVo
                     );
                     result.add(vo);
                 }
@@ -4195,7 +4211,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
     private InsFeeFollowOrderVo buildFollowOrderVo(Integer year, int month, InsPlyIncomeDto firstItem,
                                                    String partnerCompanyId,
                                                    Map<Integer, BigDecimal> monthReceivableMap,
-                                                   Map<String, BigDecimal> invoicedMap) {
+                                                   Map<String, BigDecimal> invoicedMap, FollowInvoicePageListVo followInvoicePageListVo) {
 
         String systemCode = baseController.getSystemCode();
         // 获取当月应收保费,默认为0
@@ -4221,6 +4237,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                 .eq("month", month)
                 .eq("partner_company_id", partnerCompanyId)
                 .eq("system_code", systemCode)
+                .eq("invoice_type", followInvoicePageListVo.getInvoiceType())
                 .last("LIMIT 1"); // 取一条即可,或者根据业务取最新的
         InsFeeFollowOrder dbOrder = insFeeFollowOrderMapper.selectOne(queryWrapper);
         if (dbOrder != null) {
@@ -4237,6 +4254,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                     .eq("month", month)
                     .eq("partner_company_id", partnerCompanyId)
                     .eq("system_code", systemCode)
+                    .eq("invoice_type", followInvoicePageListVo.getInvoiceType())
                     .last("LIMIT 1"); // 取一条即可,或者根据业务取最新的
             InsFeeFollowOrderReconciliation insFeeFollowOrderReconciliation = insFeeFollowOrderReconciliationMapper.selectOne(insFeeFollowOrderReconciliationQueryWrapper);
             if (null != insFeeFollowOrderReconciliation){
@@ -5255,8 +5273,26 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
         String systemCode = baseController.getSystemCode();
         log.info("保险公司结算报表查询-区分租户并且按照日期进行过滤:systemCode=[{}],queryVo=[{}]", systemCode, JSONUtil.toJsonStr(queryVo));
         // 1. 先将有数据的保险公司进行汇总
-        // 累计应收金额, 应收手续费(手续费), 应收手续费(手续费)
+        // 累计应收金额, 应收手续费(手续费)
         List<CompanySuperviseSettlementReportDto> allCompaniesIncomeDatas = baseMapper.queryCumulativeAccountsReceivable(systemCode, queryVo);
+        
+        // 车险
+        if("10".equals(queryVo.getAccountsReceivable())){
+            // 默认情况下,superviseFee 得到的就是车险的手续费
+            allCompaniesIncomeDatas = allCompaniesIncomeDatas.stream().toList();
+        }else if("20".equals(queryVo.getAccountsReceivable())){
+            allCompaniesIncomeDatas = allCompaniesIncomeDatas.stream().peek(action->{
+                // 统计非车的手续费
+              action.setSuperviseFee(action.getSuperviseFee4Other());
+            }).toList();
+        }else if(StrUtil.isEmpty(queryVo.getAccountsReceivable())){
+                // 统计总的手续费
+            allCompaniesIncomeDatas = allCompaniesIncomeDatas.stream().peek(action->{
+                // 统计非车的手续费
+                action.setSuperviseFee(action.getTotalReceivable());
+            }).toList();
+        }
+
         // for test, 查看一家公司的数据,将不可变对象变成 可变对象
 //        allCompaniesIncomeDatas = allCompaniesIncomeDatas.stream().filter(action-> "1738811735599338932".equals(action.getCompanyId())).toList();
 //        allCompaniesIncomeDatas = new ArrayList<>(allCompaniesIncomeDatas);
@@ -5292,20 +5328,12 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
             BigDecimal totalReceivable = groupList.stream()
                     .map(x -> new BigDecimal(x.getTotalReceivable()))
                     .reduce(BigDecimal.ZERO, BigDecimal::add);
-            BigDecimal totalFollowFee = groupList.stream()
-                    .map(x -> new BigDecimal(x.getTotalFollowFee()))
-                    .reduce(BigDecimal.ZERO, BigDecimal::add);
+
             BigDecimal superviseFee = groupList.stream()
                     .map(x -> new BigDecimal(x.getSuperviseFee()))
                     .reduce(BigDecimal.ZERO, BigDecimal::add);
-            BigDecimal followFee = groupList.stream()
-                    .map(x -> new BigDecimal(x.getFollowFee()))
-                    .reduce(BigDecimal.ZERO, BigDecimal::add);
-
             sumDto.setTotalReceivable(totalReceivable.toString());
-            sumDto.setTotalFollowFee(totalFollowFee.toString());
             sumDto.setSuperviseFee(superviseFee.toString());
-            sumDto.setFollowFee(followFee.toString());
             sumDto.setParentId(first.getParentId());
             resultList.add(sumDto);
         }
@@ -5404,22 +5432,25 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
         // 已开票(手续费)
         // 已开票(跟单费)
 
+        List<String> invoiceTypes = List.of("1","3");
+
+
+        if("10".equals(queryVo.getAccountsReceivable())){
+            invoiceTypes = List.of("1");
+        }else if("20".equals(queryVo.getAccountsReceivable())){
+            invoiceTypes = List.of("3");
+        }
+
         List<CalRes> calRes;
-        calRes = baseMapper.queryInvoicedAmount(systemCode, List.of(1, 3), queryVo.getInvoiceStartTime(), queryVo.getInvoiceEndTime(), queryVo.getAgreementType());
+        calRes = baseMapper.queryInvoicedAmount(systemCode, invoiceTypes, queryVo.getInvoiceStartTime(), queryVo.getInvoiceEndTime(), queryVo.getAgreementType());
         Map<String, BigDecimal> sxfInvoicedAmountMap = calRes.stream().collect(Collectors.toMap(CalRes::getCompanyId, CalRes::getAmount, (o1,o2)->o1));
         Map<String, BigDecimal> sxfOverinflatedAmountMap = calRes.stream().collect(Collectors.toMap(CalRes::getCompanyId, CalRes::getOverinflatedAmount, (o1,o2)->o1));
-        calRes = baseMapper.queryInvoicedAmount(systemCode, List.of(2, 4), queryVo.getInvoiceStartTime(), queryVo.getInvoiceEndTime(), queryVo.getAgreementType());
-        Map<String, BigDecimal> gdfInvoicedAmountMap = calRes.stream().collect(Collectors.toMap(CalRes::getCompanyId, CalRes::getAmount, (o1,o2)->o1));
 
         // 结算费用 
-        List<CalRes> sxfList = baseMapper.querySettledAmount(systemCode, queryVo.getInvoiceStartTime(), queryVo.getInvoiceEndTime(), queryVo.getAgreementType(), CollUtil.newArrayList("1", "3"));
-        List<CalRes> gdfList = baseMapper.querySettledAmount(systemCode, queryVo.getInvoiceStartTime(), queryVo.getInvoiceEndTime(), queryVo.getAgreementType(), CollUtil.newArrayList("2", "4"));
+        List<CalRes> sxfList = baseMapper.querySettledAmount(systemCode, queryVo.getInvoiceStartTime(), queryVo.getInvoiceEndTime(), queryVo.getAgreementType(), invoiceTypes);
         Map<String, BigDecimal> sxfSettledAmountMap = CollUtil.isNotEmpty(sxfList) ? sxfList.stream().collect(Collectors.toMap(CalRes::getCompanyId, CalRes::getSettlement, (o1,o2)->o1)) : new HashMap<>();
         // 手续费的回款差额汇总
         Map<String, BigDecimal> sxfSettledDiffAmountMap = CollUtil.isNotEmpty(sxfList) ? sxfList.stream().collect(Collectors.toMap(CalRes::getCompanyId, CalRes::getOverinflatedAmount, (o1,o2)->o1)) : new HashMap<>();
-        Map<String, BigDecimal> gdfSettledAmountMap = CollUtil.isNotEmpty(gdfList) ? gdfList.stream().collect(Collectors.toMap(CalRes::getCompanyId, CalRes::getSettlement, (o1,o2)->o1)) : new HashMap<>();
-        // 跟单费的回款差额汇总
-        Map<String, BigDecimal> gdfSettledDiffAmountMap = CollUtil.isNotEmpty(gdfList) ? gdfList.stream().collect(Collectors.toMap(CalRes::getCompanyId, CalRes::getOverinflatedAmount, (o1,o2)->o1)) : new HashMap<>();
 
         // 计算已开票和未开票
         for (String companyId : companyMap.keySet()) {
@@ -5429,37 +5460,27 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
             companySuperviseSettlementReportDto.setSxfInvoicedAmount(Objects.toString(sxf,BigDecimal.ZERO+""));
             BigDecimal sxfOverinflatedAmount = sxfOverinflatedAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
             companySuperviseSettlementReportDto.setTotalOverinflatedAmount(Objects.toString(sxfOverinflatedAmount,BigDecimal.ZERO+""));
-            BigDecimal gdf = gdfInvoicedAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
-            companySuperviseSettlementReportDto.setGdfInvoicedAmount(Objects.toString(gdf,BigDecimal.ZERO+""));
             // 平台就没有未结算的,只要结算就是已结算的
             companySuperviseSettlementReportDto.setPtInvoicedAmount(companySuperviseSettlementReportDto.getTotalReceivable());
 
             CompanySuperviseSettlementReportDto dto;
             dto = companyMap.get(companyId);
             companySuperviseSettlementReportDto.setSxfUnInvoicedAmount(BigDecimalUtil.subtract(new BigDecimal(dto.getSuperviseFee()),BigDecimalUtil.subtract(sxf, new BigDecimal(dto.getTotalOverinflatedAmount()))).toString());
-            companySuperviseSettlementReportDto.setGdfUnInvoicedAmount(BigDecimalUtil.subtract(new BigDecimal(dto.getFollowFee()),BigDecimalUtil.subtract(gdf,new BigDecimal(dto.getTotalOverinflatedAmount()))).toString());
             companySuperviseSettlementReportDto.setPtUnInvoicedAmount(BigDecimal.ZERO.toString());
 
             BigDecimal sxfS = sxfSettledAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
-            BigDecimal gdfS = gdfSettledAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
             BigDecimal overinflatedAmount = sxfOverinflatedAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
             companySuperviseSettlementReportDto.setSxfSettledAmount(Objects.toString(sxfS, BigDecimal.ZERO+""));
             companySuperviseSettlementReportDto.setSxfUnSettledAmount(BigDecimalUtil.subtract(sxf,BigDecimalUtil.add(sxfS,sxfSettledDiffAmountMap.getOrDefault(companyId, BigDecimal.ZERO))).toString());
             companySuperviseSettlementReportDto.setTotalOverinflatedAmount(Objects.toString(overinflatedAmount, BigDecimal.ZERO+""));
             companySuperviseSettlementReportDto.setSettlementPaymentDifference(Objects.toString(sxfSettledDiffAmountMap.getOrDefault(companyId, BigDecimal.ZERO)) );
-
-            companySuperviseSettlementReportDto.setGdfSettledAmount(Objects.toString(gdfS, BigDecimal.ZERO+""));
-            companySuperviseSettlementReportDto.setGdfUnSettledAmount(BigDecimalUtil.subtract(gdf,gdfS).toString());
-
             // 当起始日期有值的时候,计算的没有意义
             if(StrUtil.isNotEmpty(queryVo.getInvoiceStartTime())){
                 companySuperviseSettlementReportDto.setSxfUnInvoicedAmount("-");
-                companySuperviseSettlementReportDto.setGdfUnInvoicedAmount("-");
                 companySuperviseSettlementReportDto.setPtUnInvoicedAmount("-");
             }
             if(StrUtil.isNotEmpty(queryVo.getSettlementStartTime())){
                 companySuperviseSettlementReportDto.setSxfUnSettledAmount("-");
-                companySuperviseSettlementReportDto.setGdfUnSettledAmount("-");
             }
         }
         return new ArrayList<>(companyMap.values().stream().toList());
@@ -5590,6 +5611,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
             tree.setParentId(dto.getParentId());
             // 将原对象的其他属性放入扩展字段
             tree.putExtra("companyName",dto.getCompanyName());
+            tree.putExtra("companyId",dto.getCompanyId());
             tree.putExtra("totalReceivable",dto.getTotalReceivable());
             tree.putExtra("totalFollowFee",dto.getTotalFollowFee());
             tree.putExtra("superviseFee",dto.getSuperviseFee());
@@ -5606,6 +5628,9 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
             tree.putExtra("gdfUnSettledAmount",dto.getGdfUnSettledAmount());
             tree.putExtra("totalOverinflatedAmount",dto.getTotalOverinflatedAmount());
             tree.putExtra("settlementPaymentDifference",dto.getSettlementPaymentDifference());
+
+
+
         });
         log.info("树形结构构建:一级数据[{}]个", CollUtil.size(build));
         return build;
@@ -5709,7 +5734,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                     InsPlyIncomeInvoiceSettlementVo insPlyIncomeInvoiceSettlementVo = baseMapper.querySettledAmountByInvoiceIds(invoiceIdList);
                     action.setSettledAmount(Objects.toString(insPlyIncomeInvoiceSettlementVo.getActualReceivedAmount(),"0"));
                     action.setTotalPaymentDifference(insPlyIncomeInvoiceSettlementVo.getSettlementPaymentDifference());
-                    action.setUnSettledAmount(BigDecimalUtil.subtract(new BigDecimal(action.getTotalReceivable()),insPlyIncomeInvoiceSettlementVo.getActualReceivedAmount()).toString());
+                    action.setUnSettledAmount(BigDecimalUtil.subtract(new BigDecimal(action.getTotalReceivable()),BigDecimalUtil.subtract(insPlyIncomeInvoiceSettlementVo.getActualReceivedAmount(),insPlyIncomeInvoiceSettlementVo.getSettlementPaymentDifference())).toString());
                 }else{
                     action.setSettledAmount("0");
                     action.setUnSettledAmount(BigDecimalUtil.subtract(new BigDecimal(action.getTotalReceivable()),BigDecimal.ZERO).toString());

+ 8 - 5
tenant/organization/src/main/resources/mapper/ReceivableMapper.xml

@@ -230,6 +230,10 @@
         (COALESCE(ipi.jq_supervise_costs_premiums, 0) + COALESCE(ipi.sy_supervise_costs_premiums, 0) + COALESCE(ipi.jy_supervise_costs_premiums, 0)) AS superviseCostsPremiums,
         -- 3. 总应收跟单费 (修复了括号位置错误,并为最后一个字段补充了默认值 0)
         (COALESCE(ipi.jq_other_costs_premiums, 0) + COALESCE(ipi.sy_other_costs_premiums, 0) + COALESCE(ipi.jy_other_costs_premiums, 0)) AS otherCostsPremiums,
+        (COALESCE(ipi.jq_supervise_costs_premiums, 0) + COALESCE(ipi.sy_supervise_costs_premiums, 0)) AS carInsuranceSuperviseCostsPremiums,
+        COALESCE(ipi.jy_supervise_costs_premiums, 0) AS nonCarInsuranceSuperviseCostsPremiums,
+        (COALESCE(ipi.jq_other_costs_premiums, 0) + COALESCE(ipi.sy_other_costs_premiums, 0)) AS carInsuranceOtherCostsPremiums,
+        COALESCE(ipi.jy_other_costs_premiums, 0) AS nonCarInsuranceOtherCostsPremiums,
         (COALESCE(ipi.jq_supervise_costs_proportion, 0) + COALESCE(ipi.jq_other_costs_proportion, 0)) AS jqTotalProportion,
         (COALESCE(ipi.sy_supervise_costs_proportion, 0) + COALESCE(ipi.sy_other_costs_proportion, 0)) AS syTotalProportion,
         (COALESCE(ipi.jy_supervise_costs_proportion, 0) + COALESCE(ipi.jy_other_costs_proportion, 0)) AS jyTotalProportion,
@@ -335,7 +339,7 @@
                 #{id}
             </foreach>
         </if>
-        <if test="receivableQueryVo.queryType!= null and (receivableQueryVo.queryType == 3 or receivableQueryVo.queryType == 4)">
+        <if test="receivableQueryVo.invoiceType!= null and (receivableQueryVo.invoiceType == 3 or receivableQueryVo.invoiceType == 4)">
             AND ipi.jy_premium != 0
         </if>
         <if test="receivableQueryVo.licenseNo != null and receivableQueryVo.licenseNo != ''">
@@ -661,7 +665,7 @@
         MAX(ipiis.actual_received_amount) AS actual_received_amount,
         MAX(ipiis.receive_payment_date) AS receive_payment_date,
         MAX(ipiis.create_by) AS create_by,
-        MAX(ipiis.create_time) AS create_time
+        MAX(ipiis.create_time) AS create_time, ipiis.settlement_payment_difference , ipiis.settlement_payment_reason, ipii.receivable_supervise_premium
         FROM ins_ply_income_invoice_settlement ipiis
         LEFT JOIN ins_ply_income_invoice ipii ON ipii.id = ipiis.invoice_id AND ipii.is_delete = 0
         LEFT JOIN ins_ply_income_invoice_link ipil ON ipil.invoice_id = ipiis.invoice_id AND ipil.is_delete = 0
@@ -1917,9 +1921,8 @@
         ipi.company_id,
         ipi.system_code,
         sum(COALESCE(ipi.jq_supervise_costs_premiums, 0)+ COALESCE(ipi.sy_supervise_costs_premiums,0)+coalesce(ipi.jy_supervise_costs_premiums,0 )+COALESCE(ipi.jq_other_costs_premiums, 0)+ COALESCE(ipi.sy_other_costs_premiums,0)+coalesce(ipi.jy_other_costs_premiums,0 )) as totalReceivable ,
-        sum(COALESCE(ipi.jq_supervise_costs_premiums, 0)+ COALESCE(ipi.sy_supervise_costs_premiums,0)+coalesce(ipi.jy_supervise_costs_premiums,0 )+COALESCE(ipi.jq_other_costs_premiums, 0)+ COALESCE(ipi.sy_other_costs_premiums,0)+coalesce(ipi.jy_other_costs_premiums,0 )) as totalFollowFee,
-        sum(COALESCE(ipi.jq_supervise_costs_premiums, 0)+ COALESCE(ipi.sy_supervise_costs_premiums,0)+coalesce(ipi.jy_supervise_costs_premiums,0 )) as superviseFee,
-        sum(COALESCE(ipi.jq_other_costs_premiums, 0)+ COALESCE(ipi.sy_other_costs_premiums,0)+coalesce(ipi.jy_other_costs_premiums,0 )) as followFee
+        sum(COALESCE(ipi.jq_other_costs_premiums, 0)+ COALESCE(ipi.sy_other_costs_premiums,0)+coalesce(ipi.jy_other_costs_premiums,0 )) as superviseFee4Other ,
+        sum(COALESCE(ipi.jq_supervise_costs_premiums, 0)+ COALESCE(ipi.sy_supervise_costs_premiums,0)+coalesce(ipi.jy_supervise_costs_premiums,0 )) as superviseFee
         from
         ins_ply_income ipi
         left join esm_ins_company eic on eic.id = ipi.company_id AND eic.is_delete = 0