Răsfoiți Sursa

Merge remote-tracking branch 'origin/master'

wanghao 4 luni în urmă
părinte
comite
56efa572df
21 a modificat fișierele cu 469 adăugiri și 83 ștergeri
  1. 8 0
      commons/src/main/java/com/jzg/commons/core/page/HttpResult.java
  2. 4 0
      commons/src/main/java/com/jzg/commons/entity/finance/po/InsPlyIncome.java
  3. 16 0
      commons/src/main/java/com/jzg/commons/entity/finance/vo/InvoiceReceivableExportExcelVo.java
  4. 16 0
      commons/src/main/java/com/jzg/commons/entity/finance/vo/JyExcelVo.java
  5. 16 0
      commons/src/main/java/com/jzg/commons/entity/finance/vo/OtherExcelVo.java
  6. 4 0
      commons/src/main/java/com/jzg/commons/entity/finance/vo/ReceivableExportExcelVo.java
  7. 14 2
      commons/src/main/java/com/jzg/commons/entity/finance/vo/SettlementReportQueryVo.java
  8. 15 0
      commons/src/main/java/com/jzg/commons/entity/finance/vo/SuperviseExcelVo.java
  9. 10 0
      commons/src/main/java/com/jzg/commons/entity/quote/vo/base/OrderBase.java
  10. 11 0
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/controller/InsOrdersController.java
  11. 3 0
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/controller/UnifyOrderManager.java
  12. 2 2
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/InsOrdersService.java
  13. 6 1
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsOrdersServiceImpl.java
  14. 4 9
      tenant/insurance/quotation-summary/src/main/resources/mapper/InsFeeAuditMapper.xml
  15. 26 0
      tenant/organization/src/main/java/com/jzg/organization/client/InsOrdersClient.java
  16. 1 1
      tenant/organization/src/main/java/com/jzg/organization/controller/AmountAuditingController.java
  17. 75 4
      tenant/organization/src/main/java/com/jzg/organization/controller/ReceivableController.java
  18. 8 0
      tenant/organization/src/main/java/com/jzg/organization/mapper/ReceivableMapper.java
  19. 8 1
      tenant/organization/src/main/java/com/jzg/organization/service/ReceivableService.java
  20. 192 62
      tenant/organization/src/main/java/com/jzg/organization/service/impl/ReceivableServiceImpl.java
  21. 30 1
      tenant/organization/src/main/resources/mapper/ReceivableMapper.xml

+ 8 - 0
commons/src/main/java/com/jzg/commons/core/page/HttpResult.java

@@ -51,6 +51,14 @@ public class HttpResult<T> implements Serializable {
         return r;
     }
 
+    public static <T> HttpResult<T> error(String msg, T data) {
+        HttpResult<T> r = new HttpResult<>();
+        r.setCode(HttpStatus.SC_INTERNAL_SERVER_ERROR);
+        r.setData(data);
+        r.setMsg(msg);
+        return r;
+    }
+
     public static <T> HttpResult<T> error(T data) {
         HttpResult<T> r = new HttpResult<>();
         r.setCode(HttpStatus.SC_INTERNAL_SERVER_ERROR);

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

@@ -230,6 +230,10 @@ public class InsPlyIncome extends BaseModel {
     @Schema(description = "对接人手机号")
     private String contactPersonPhone;
 
+    public String getDockingPerson(){
+        return this.contactPerson + "-" + this.contactPersonPhone;
+    }
+
     @Schema(description = "系统code")
     @ExcelProperty("系统code")
     private String systemCode;

+ 16 - 0
commons/src/main/java/com/jzg/commons/entity/finance/vo/InvoiceReceivableExportExcelVo.java

@@ -105,6 +105,14 @@ public class InvoiceReceivableExportExcelVo extends BaseModel  {
     @ExcelProperty(value = "公司编码", index = 17)
     private String companyId;
 
+    @Schema(description = "对接人")
+    @ExcelProperty(value = "对接人", index = 18)
+    private String contactPerson;
+
+    @Schema(description = "对接人手机号")
+    @ExcelProperty(value = "对接人手机号", index = 19)
+    private String contactPersonPhone;
+
     @Schema(description = "错误信息")
     @ExcelIgnore
     private String errorMessage;
@@ -149,6 +157,14 @@ public class InvoiceReceivableExportExcelVo extends BaseModel  {
             resultVo.setMessage("协议类型不能为空");
             return resultVo;
         }
+        if (StrUtil.isBlank(this.getContactPerson())) {
+            resultVo.setMessage("对接人不能为空");
+            return resultVo;
+        }
+        if (StrUtil.isBlank(this.getAgreementType())) {
+            resultVo.setMessage("对接人手机号不能为空");
+            return resultVo;
+        }
 
         // 交强险:有保单号 → 手续费、跟单费必填
         if (StrUtil.isNotBlank(this.getJqPolicyNo())

+ 16 - 0
commons/src/main/java/com/jzg/commons/entity/finance/vo/JyExcelVo.java

@@ -1,5 +1,6 @@
 package com.jzg.commons.entity.finance.vo;
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
@@ -28,6 +29,12 @@ public class JyExcelVo {
     @Schema(description = "驾意险保单号")
     private String jyPolicyNo;
 
+    @Schema(description = "订单号")
+    private String orderNo;
+
+    @Schema(description = "协议类型")
+    private String agreementType;
+
     @Schema(description = "驾意险保费")
     private BigDecimal jyPremium;
 
@@ -37,6 +44,15 @@ public class JyExcelVo {
     @Schema(description = "驾意险跟单费比例")
     private BigDecimal jyOtherRatio;
 
+    @Schema(description = "对接人")
+    @ExcelProperty(value = "对接人")
+    private String contactPerson;
+
+    @Schema(description = "对接人手机号")
+    @ExcelProperty(value = "对接人手机号")
+    private String contactPersonPhone;
+
+
     @Schema(description = "错误信息")
     private String errorMessage;
 

+ 16 - 0
commons/src/main/java/com/jzg/commons/entity/finance/vo/OtherExcelVo.java

@@ -1,5 +1,6 @@
 package com.jzg.commons.entity.finance.vo;
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
@@ -28,6 +29,12 @@ public class OtherExcelVo {
     @Schema(description = "交强险保单号")
     private String jqPolicyNo;
 
+    @Schema(description = "订单号")
+    private String orderNo;
+
+    @Schema(description = "协议类型")
+    private String agreementType;
+
     @Schema(description = "交强险保费")
     private BigDecimal jqPremium;
 
@@ -43,6 +50,15 @@ public class OtherExcelVo {
     @Schema(description = "商业险跟单费比例")
     private BigDecimal syOtherRatio;
 
+    @Schema(description = "对接人")
+    @ExcelProperty(value = "对接人")
+    private String contactPerson;
+
+    @Schema(description = "对接人手机号")
+    @ExcelProperty(value = "对接人手机号")
+    private String contactPersonPhone;
+
+
     @Schema(description = "错误信息")
     private String errorMessage;
 

+ 4 - 0
commons/src/main/java/com/jzg/commons/entity/finance/vo/ReceivableExportExcelVo.java

@@ -139,6 +139,10 @@ public class ReceivableExportExcelVo {
     @ExcelProperty(value = "产品名称", index = 24)
     private String productName;
 
+    @Schema(description = "对接人手机号")
+    @ExcelProperty(value = "对接人手机号", index = 25)
+    private String dockingPersonPhone;
+
     @Schema(description = "错误信息")
     private String errorMessage;
 

+ 14 - 2
commons/src/main/java/com/jzg/commons/entity/finance/vo/SettlementReportQueryVo.java

@@ -16,12 +16,24 @@ public class SettlementReportQueryVo extends PageRequest {
     @Schema(description = "保险公司id")
     private String companyId;
 
-    @Schema(description = "开始时间")
+    @Schema(description = "创建开始时间")
     private String startTime;
 
-    @Schema(description = "结束时间")
+    @Schema(description = "创建结束时间")
     private String endTime;
 
+    @Schema(description = "开票开始时间")
+    private String invoiceStartTime;
+
+    @Schema(description = "开票结束时间")
+    private String invoiceEndTime;
+
+    @Schema(description = "结算开始时间")
+    private String settlementStartTime;
+
+    @Schema(description = "开票结束时间")
+    private String settlementEndTime;
+
     @Schema(description = "结算状态")
     private String status;
 

+ 15 - 0
commons/src/main/java/com/jzg/commons/entity/finance/vo/SuperviseExcelVo.java

@@ -1,5 +1,6 @@
 package com.jzg.commons.entity.finance.vo;
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
@@ -25,6 +26,12 @@ public class SuperviseExcelVo {
     @Schema(description = "车牌号")
     private String licenseNo;
 
+    @Schema(description = "订单号")
+    private String orderNo;
+
+    @Schema(description = "协议类型")
+    private String agreementType;
+
     @Schema(description = "交强险保单号")
     private String jqPolicyNo;
 
@@ -43,6 +50,14 @@ public class SuperviseExcelVo {
     @Schema(description = "商业险手续费比例")
     private BigDecimal sySuperviseRatio;
 
+    @Schema(description = "对接人")
+    @ExcelProperty(value = "对接人")
+    private String contactPerson;
+
+    @Schema(description = "对接人手机号")
+    @ExcelProperty(value = "对接人手机号")
+    private String contactPersonPhone;
+
     @Schema(description = "错误信息")
     private String errorMessage;
 

+ 10 - 0
commons/src/main/java/com/jzg/commons/entity/quote/vo/base/OrderBase.java

@@ -85,6 +85,16 @@ public class OrderBase implements Serializable {
      */
     private String dispatchId;
 
+    /**
+     * 对接人姓名
+     */
+    private String dockingPerson;
+
+    /**
+     * 对接人联系方式
+     */
+    private String dockingPersonPhone;
+
     /**
      * 获取保险公司编码
      */

+ 11 - 0
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/controller/InsOrdersController.java

@@ -1,6 +1,7 @@
 package com.jzg.quotation.summary.controller;
 
 
+import cn.hutool.core.util.NumberUtil;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -98,6 +99,16 @@ public class InsOrdersController extends BaseController {
         return HttpResult.ok(insOrdersService.selectById(id));
     }
 
+    @PostMapping("/selectInsOrdersById/{id}")
+    @Operation(summary = "通过ID查询订单信息")
+    public HttpResult<InsOrdersVo> selectInsOrdersById(@NotNull(message = "id不能为空") @PathVariable String id) {
+        InsOrdersVo insOrdersVo = null;
+        if (NumberUtil.isLong(id)){
+            insOrdersVo = insOrdersService.selectById(Long.parseLong(id));
+        }
+        return HttpResult.ok(insOrdersVo);
+    }
+
     @PostMapping("pageList")
     @Operation(summary = "订单分页列表")
     public HttpResult pageList(@RequestBody InsOrdersParam insOrdersParam) {

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

@@ -255,6 +255,9 @@ public class UnifyOrderManager {
         }
         quoteVo.getOrder().setAgreementId(ptlAgreement.getId());
         quoteVo.getOrder().setApiType(ptlAgreement.getApiType());
+        // add by lilpf 2026年6月1日09:03:34 为订单添加对接人和对接人联系方式
+        quoteVo.getOrder().setDockingPerson(ptlAgreement.getDockingPerson());
+        quoteVo.getOrder().setDockingPersonPhone(ptlAgreement.getDockingPhone());
         // 设置人员区划. (将投保人的地址信息,按照行政区域进行划分)
         insOrdersService.setUserAreaCode(quoteVo);
         log.debug("设置人员区域后信息是:quoteVo=[{}]", JSONUtil.toJsonStr(quoteVo));

+ 2 - 2
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/InsOrdersService.java

@@ -57,8 +57,8 @@ public interface InsOrdersService extends IService<InsOrders> {
     /**
      * 根据报价参数生成订单  返回订单号
      *
-     * @param quoteVo
-     * @param companyName
+     * @param quoteVo 报价信息
+     * @param companyName 保险公司名称
      * @return String
      */
     String generateOrders(QuoteVo quoteVo, String companyName);

+ 6 - 1
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsOrdersServiceImpl.java

@@ -51,7 +51,6 @@ import com.jzg.quotation.commons.client.OrgClient;
 import com.jzg.quotation.commons.client.PartnerDistributionClient;
 import com.jzg.quotation.commons.client.PlatformClient;
 import com.jzg.quotation.commons.utils.BeanCopyUtil;
-import com.jzg.quotation.commons.utils.DateTimeUtil;
 import com.jzg.quotation.commons.utils.SnowFlakeUtil;
 import com.jzg.quotation.summary.consumer.template.OrderMessageTemplate;
 import com.jzg.quotation.summary.entity.bo.DataValueBo;
@@ -1027,6 +1026,9 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             insOrders.setId(IdGenerate.nextId());
         }
 
+        // add by lipf 2026年6月1日09:08:07 填充对接人信息
+        insOrders.setDockingPerson(quoteVo.getOrder().getDockingPerson());
+        insOrders.setDockingPersonPhone(quoteVo.getOrder().getDockingPersonPhone());
         insOrders.setQuoteNo(quoteVo.getOrder().getQuoteNo());
         insOrders.setAgreementId(quoteVo.getOrder().getAgreementId());
         insOrders.setOrderStatus(InsOrderStatusEnum.QUOTE_ING.getCode()); // 订单状态 报价中
@@ -1107,6 +1109,9 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         oldOrder.setProductId(insOrders.getProductId());
         oldOrder.setProductName(insOrders.getProductName());
 
+        // modify by lipf 2026年6月1日09:10:01 填充对接人信息
+        insOrders.setDockingPerson(quoteVo.getOrder().getDockingPerson());
+        insOrders.setDockingPersonPhone(quoteVo.getOrder().getDockingPersonPhone());
         insOrders.setQuoteNo(quoteVo.getOrder().getQuoteNo());
         insOrders.setAgreementId(quoteVo.getOrder().getAgreementId());
         insOrders.setOrderStatus(InsOrderStatusEnum.QUOTE_ING.getCode()); // 订单状态 报价中

+ 4 - 9
tenant/insurance/quotation-summary/src/main/resources/mapper/InsFeeAuditMapper.xml

@@ -27,7 +27,7 @@
     </sql>
     <select id="queryPage" resultType="com.jzg.commons.entity.orders.vo.FeeAuditVo">
         SELECT
-                qsu.username ,    -- 业务员登录账号
+        qsu.username ,    -- 业务员登录账号
         ifa.order_no as orderNo,
         io.company_id,
         io.company_name as companyName,
@@ -80,14 +80,9 @@
                 LEFT JOIN ins_orders_costs ioc on ioc.order_no = io.id
                 LEFT JOIN ins_orders_external_policy ioep on ioep.order_no = io.id
         <where>
-            <choose>
-                <when test="param.receiveUser != null and param.receiveUser != ''">
-                    and ifa.receive_user = #{param.receiveUser}
-                </when>
-                <otherwise>
-                    and ifa.receive_user is NULL
-                </otherwise>
-            </choose>
+            <if test="param.receiveUser != null and param.receiveUser != ''">
+                and ifa.receive_user = #{param.receiveUser}
+            </if>
             <if test="param.auditType != null">
                 and ifa.audit_type = #{param.auditType}
             </if>

+ 26 - 0
tenant/organization/src/main/java/com/jzg/organization/client/InsOrdersClient.java

@@ -0,0 +1,26 @@
+package com.jzg.organization.client;
+
+import com.jzg.commons.core.page.HttpResult;
+import com.jzg.commons.entity.quote.vo.orders.InsOrdersVo;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+/**
+ * 订单接口
+ */
+@FeignClient(name = "quotation-summary")
+public interface InsOrdersClient {
+
+    /**
+     * 订单列表通过订单号查询
+     * @param id 订单号
+     * @return List<InsFeeOrders>
+     */
+    @PostMapping("/supplementOrder/selectInsOrdersById/{id}")
+    HttpResult<InsOrdersVo> selectById(@PathVariable String id);
+
+
+}

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

@@ -37,7 +37,7 @@ public class AmountAuditingController extends BaseController {
     @PostMapping("/auditList")
     @Operation(summary = "提现申请列表分页")
     public HttpResult<Page<AmountAuditVo>> auditList(@RequestBody AmountAuditParam param){
-        log.info("应付账款-体现申请-查询:param=[{}]", JSONUtil.toJsonStr(param));
+        log.info("应付账款-提现申请-查询:param=[{}]", JSONUtil.toJsonStr(param));
         Page<AmountAuditVo> result = sysAmountAuditingService.queryPage(param);
         return HttpResult.ok(result);
     }

+ 75 - 4
tenant/organization/src/main/java/com/jzg/organization/controller/ReceivableController.java

@@ -1,6 +1,8 @@
 package com.jzg.organization.controller;
 
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.jzg.commons.core.base.BaseController;
 import com.jzg.commons.core.page.HttpResult;
@@ -72,7 +74,8 @@ public class ReceivableController {
 
     @PostMapping("addReceivable")
     @Operation(summary = "添加应收记录")
-    public HttpResult addReceivable(@RequestBody AddReceivableVo addReceivableVo){
+    public HttpResult<String> addReceivable(@RequestBody AddReceivableVo addReceivableVo){
+        log.info("添加应收记录:addReceivableVo=[{}]", JSONUtil.toJsonStr(addReceivableVo));
         boolean result = receivableService.saveAuditedOrder(addReceivableVo);
         return result ? HttpResult.ok("添加成功") : HttpResult.error("添加失败");
     }
@@ -93,6 +96,26 @@ public class ReceivableController {
         return HttpResult.ok(new InsPlyIncomeVO(data, receivablePageIds));
     }
 
+    @PostMapping("getCommissionReceivableTotalAmount")
+    @Operation(summary = "获取私有协议手续费应收费用总金额")
+    public HttpResult<BigDecimal> getCommissionReceivableTotalAmount(@RequestBody ReceivableQueryVo receivableQueryVo){
+        if (StrUtil.isBlank(receivableQueryVo.getQueryType())){
+            receivableQueryVo.setQueryType("2");
+        }
+        // 协议类型 1 平台协议  2 私有协议
+        if (StrUtil.isBlank(receivableQueryVo.getAgreementType())){
+            receivableQueryVo.setAgreementType("2");
+        }
+        HttpResult<Page<InsPlyIncome>> ok = HttpResult.ok(receivableService.getReceivablePage(receivableQueryVo));
+        Page<InsPlyIncome> data = ok.getData();
+        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)
+                .reduce(BigDecimal.ZERO, BigDecimal::add);
+        return HttpResult.ok(reduce);
+    }
+
     @PostMapping("/exportTemplateReceivableList")
     @Operation(summary = "导出模板私有协议手续费")
     public HttpResult<String> exportTemplateReceivableList(){
@@ -136,8 +159,12 @@ public class ReceivableController {
     @PostMapping("getOtherReceivableList")
     @Operation(summary = "获取私有协议跟单费列表")
     public HttpResult<InsPlyIncomeVO> getOtherReceivableList(@RequestBody ReceivableQueryVo receivableQueryVo){
-        receivableQueryVo.setQueryType("2");
-        receivableQueryVo.setAgreementType("2");
+        if (StrUtil.isBlank(receivableQueryVo.getQueryType())){
+            receivableQueryVo.setQueryType("2");
+        }
+        if (StrUtil.isBlank(receivableQueryVo.getAgreementType())) {
+            receivableQueryVo.setAgreementType("2");
+        }
         //return HttpResult.ok(receivableService.getReceivablePage(receivableQueryVo));
         HttpResult<Page<InsPlyIncome>> ok = HttpResult.ok(receivableService.getReceivablePage(receivableQueryVo));
         Page<InsPlyIncome> data = ok.getData();
@@ -145,6 +172,25 @@ public class ReceivableController {
         return HttpResult.ok(new InsPlyIncomeVO(data, receivablePageIds));
     }
 
+    @PostMapping("getOtherReceivableTotalAmount")
+    @Operation(summary = "获取私有协议跟单费应收费用总金额")
+    public HttpResult<BigDecimal> getOtherReceivableTotalAmount(@RequestBody ReceivableQueryVo receivableQueryVo){
+        if (StrUtil.isBlank(receivableQueryVo.getQueryType())){
+            receivableQueryVo.setQueryType("2");
+        }
+        if (StrUtil.isBlank(receivableQueryVo.getAgreementType())) {
+            receivableQueryVo.setAgreementType("2");
+        }
+        HttpResult<Page<InsPlyIncome>> ok = HttpResult.ok(receivableService.getReceivablePage(receivableQueryVo));
+        Page<InsPlyIncome> data = ok.getData();
+        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)
+                .reduce(BigDecimal.ZERO, BigDecimal::add);
+        return HttpResult.ok(reduce);
+    }
+
     @PostMapping("getJyCommissionReceivableList")
     @Operation(summary = "获取私有协议驾意险手续费列表")
     public HttpResult<InsPlyIncomeVO> getJyCommissionReceivableList(@RequestBody ReceivableQueryVo receivableQueryVo){
@@ -326,6 +372,25 @@ public class ReceivableController {
         return HttpResult.ok(new InsPlyIncomeVO(data, receivablePageIds));
     }
 
+    @PostMapping("/getPlatFormReceivableTotalAmount")
+    @Operation(summary = "获取平台协议总金额")
+    public HttpResult<BigDecimal> getPlatFormReceivableTotalAmount(@RequestBody ReceivableQueryVo receivableQueryVo){
+        if (StrUtil.isBlank(receivableQueryVo.getQueryType())){
+            receivableQueryVo.setQueryType("1");
+        }
+        // 协议类型 1 平台协议  2 私有协议
+        if (StrUtil.isBlank(receivableQueryVo.getAgreementType())){
+            receivableQueryVo.setAgreementType("1");
+        }
+        Page<InsPlyIncome> data = receivableService.getPlatFormReceivableList(receivableQueryVo);
+        if (null == data || CollUtil.isEmpty(data.getRecords())){
+            return HttpResult.ok(BigDecimal.ZERO);
+        }
+        BigDecimal reduce = data.getRecords().stream().map(income -> null != income.getInsFeeOrders().getTotalReceivablePremium() ? income.getInsFeeOrders().getTotalReceivablePremium() : BigDecimal.ZERO)
+                .reduce(BigDecimal.ZERO, BigDecimal::add);
+        return HttpResult.ok(reduce);
+    }
+
     @PostMapping("/exportTemplatePlatFormReceivable")
     @Operation(summary = "导出平台协议模板")
     public HttpResult exportTemplatePlatFormReceivable() throws IOException {
@@ -410,6 +475,12 @@ public class ReceivableController {
         return HttpResult.ok(receivableService.platformSettlementExcel(page,settlementQueryVo));
     }
 
+    @DeleteMapping("/deleteSettlementById/{id}")
+    @Operation(summary = "删除结算记录")
+    public HttpResult<Boolean> deleteSettlementById(@PathVariable String id) {
+        return HttpResult.ok(receivableService.deleteSettlementById(id) ? "删除成功":"删除失败");
+    }
+
 
     @PostMapping("exportSuperviseSettlementExcel")
     @Operation(summary = "导出应收手续费结算记录excel文件")
@@ -506,7 +577,7 @@ public class ReceivableController {
     @PostMapping("companySuperviseSettlementReport")
     @Operation(summary = "保险公司结算报表")
     public HttpResult<List<CompanySuperviseSettlementReportDto>> companySuperviseSettlementReport(@RequestBody SettlementReportQueryVo settlementReportQueryVo) {
-        return HttpResult.ok(receivableService.companySuperviseSettlementReport(settlementReportQueryVo));
+        return receivableService.companySuperviseSettlementReport(settlementReportQueryVo);
     }
 
     @PostMapping("receiverSettlementReport")

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

@@ -195,4 +195,12 @@ public interface ReceivableMapper extends BaseMapper<InsPlyIncome> {
     Page<InvoiceRecordResult> getInvoiceRecordList(Page page, @Param("invoiceRecordQueryVo") InvoiceRecordQueryVo invoiceRecordQueryVo);
 
     List<CompanySuperviseSettlementReportDto> selectAllCompanyReports(@Param("queryVo") SettlementReportQueryVo queryVo);
+
+    /**
+     * 查询累计应收的金额
+     *
+     * @author lipf
+     * @date 2026/6/1 16:57
+     */
+    List<CompanySuperviseSettlementReportDto> queryCumulativeAccountsReceivable(@Param("systemCode") String systemCode);
 }

+ 8 - 1
tenant/organization/src/main/java/com/jzg/organization/service/ReceivableService.java

@@ -290,7 +290,7 @@ public interface ReceivableService extends IService<InsPlyIncome> {
      * @author lipf
      * @date 2026/4/30 14:48
      */
-    List<CompanySuperviseSettlementReportDto> companySuperviseSettlementReport(SettlementReportQueryVo settlementReportQueryVo);
+    HttpResult<List<CompanySuperviseSettlementReportDto>> companySuperviseSettlementReport(SettlementReportQueryVo settlementReportQueryVo);
 
     /**
      * 对接人结算报表
@@ -385,4 +385,11 @@ public interface ReceivableService extends IService<InsPlyIncome> {
      * @return
      */
     ImportUpdateExcelResultVo importAccountsReceivableInvoice(MultipartFile file);
+
+    /**
+     * 删除结算记录
+     * @param id
+     * @return
+     */
+    boolean deleteSettlementById(String id);
 }

+ 192 - 62
tenant/organization/src/main/java/com/jzg/organization/service/impl/ReceivableServiceImpl.java

@@ -23,12 +23,14 @@ import com.jzg.commons.entity.po.EsmInsCompany;
 import com.jzg.commons.entity.po.InsFeeOrders;
 import com.jzg.commons.entity.po.PtlAgreement;
 import com.jzg.commons.entity.po.SysUploadFiles;
+import com.jzg.commons.entity.quote.vo.orders.InsOrdersVo;
 import com.jzg.commons.exception.ServiceException;
 import com.jzg.commons.exception.SystemException;
 import com.jzg.commons.util.*;
 import com.jzg.commons.util.idgen.IdGenerate;
 import com.jzg.organization.client.EsmInsCompanyClient;
 import com.jzg.organization.client.InsFeeOrdersClient;
+import com.jzg.organization.client.InsOrdersClient;
 import com.jzg.organization.excel.listener.*;
 import com.jzg.organization.mapper.*;
 import com.jzg.organization.service.ReceivableService;
@@ -107,6 +109,8 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
 
     @Autowired
     private InsFeeOrdersClient insFeeOrdersClient;
+    @Autowired
+    private InsOrdersClient insOrdersClient;
 
     @Value("${upload.file.path}")
     private String uploadPath;
@@ -1067,6 +1071,28 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                 continue;
             }
 
+            // 查询订单
+            HttpResult<InsOrdersVo> insOrdersVoHttpResult = insOrdersClient.selectById(vo.getOrderNo());
+            InsOrdersVo data = insOrdersVoHttpResult.getData();
+            if (null == data){
+                failedNumber++;
+                vo.setErrorMessage("订单号不存在");
+                failedExcel.add(vo);
+                continue;
+            }
+
+            // 查询数据库中是否已存在该协议
+            PtlAgreement ptlAgreement = ptlAgreementMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>()
+                    .eq(PtlAgreement::getId, data.getAgreementId()));
+
+            // 数据库不存在 → 直接失败
+            if (Objects.isNull(ptlAgreement) || !ptlAgreement.getAgreementType().toString().equals(vo.getAgreementType())) {
+                failedNumber++;
+                vo.setErrorMessage("协议编码在协议中不存在");
+                failedExcel.add(vo);
+                continue;
+            }
+
             // 封装修改数据
             InsPlyIncome insPlyIncome = new InsPlyIncome();
             insPlyIncome.setId(existIncome.getId());
@@ -1081,6 +1107,12 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
             insPlyIncome.setJySuperviseCostsProportion(vo.getJySuperviseCostsProportion());
             insPlyIncome.setJyOtherCostsProportion(vo.getJyOtherCostsProportion());
             insPlyIncome.setContactPerson(vo.getDockingPerson());
+            insPlyIncome.setContactPersonPhone(vo.getDockingPersonPhone());
+            // 协议编号
+            insPlyIncome.setAgreementId(ptlAgreement.getId());
+            insPlyIncome.setAgreementName(ptlAgreement.getAgreementName());
+            insPlyIncome.setAgreementType(ptlAgreement.getAgreementType().toString());
+            insPlyIncome.setSystemCode(ptlAgreement.getSystemCode());
 
             // 加入修改列表
             updateExcel.add(insPlyIncome);
@@ -1187,13 +1219,22 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                 continue;
             }
 
+            // 查询订单
+            HttpResult<InsOrdersVo> insOrdersVoHttpResult = insOrdersClient.selectById(vo.getOrderNo());
+            InsOrdersVo data = insOrdersVoHttpResult.getData();
+            if (null == data){
+                failedNumber++;
+                vo.setErrorMessage("订单号不存在");
+                failedExcel.add(vo);
+                continue;
+            }
+
             // 查询数据库中是否已存在该协议
             PtlAgreement ptlAgreement = ptlAgreementMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>()
-                    .eq(PtlAgreement::getAgreementCode, vo.getAgreementCode())
-                    .eq(PtlAgreement::getAgreementType, vo.getAgreementType()));
+                    .eq(PtlAgreement::getId, data.getAgreementId()));
 
             // 数据库不存在 → 直接失败
-            if (Objects.isNull(ptlAgreement)) {
+            if (Objects.isNull(ptlAgreement) || !ptlAgreement.getAgreementType().toString().equals(vo.getAgreementType())) {
                 failedNumber++;
                 vo.setErrorMessage("协议编码在协议中不存在");
                 failedExcel.add(vo);
@@ -1224,12 +1265,16 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
             insPlyIncome.setAgreementId(ptlAgreement.getId());
             insPlyIncome.setAgreementName(ptlAgreement.getAgreementName());
             insPlyIncome.setAgreementType(ptlAgreement.getAgreementType().toString());
+            insPlyIncome.setSystemCode(ptlAgreement.getSystemCode());
             // 险种编号
             insPlyIncome.setProductId(vo.getProductId());
             // 险种名称
             insPlyIncome.setProductName(vo.getProductName());
             // 被保险人姓名
             insPlyIncome.setInsuredPerson(vo.getInsuredPerson());
+            // 对接人信息
+            insPlyIncome.setContactPerson(vo.getContactPerson());
+            insPlyIncome.setContactPersonPhone(vo.getContactPersonPhone());
 
             // 数据库不存在 → 直接失败
             if (Objects.isNull(existIncome)) {
@@ -1290,6 +1335,12 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
         return importExcelResultVo;
     }
 
+    @Override
+    public boolean deleteSettlementById(String id) {
+        log.info("私有协议-结算记录-删除: id=[{}]",id);
+        return insPlyIncomeInvoiceSettlementMapper.deleteById(id) > 0;
+    }
+
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -1458,10 +1509,21 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                 continue;
             }
 
-            //匹配协议号
+            // 查询订单
+            HttpResult<InsOrdersVo> insOrdersVoHttpResult = insOrdersClient.selectById(vo.getOrderNo());
+            InsOrdersVo data = insOrdersVoHttpResult.getData();
+            if (null == data){
+                failedNumber++;
+                vo.setErrorMessage("订单号不存在");
+                failedExcel.add(vo);
+                continue;
+            }
+
+            // 查询数据库中是否已存在该协议
             PtlAgreement ptlAgreement = ptlAgreementMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>()
-                    .eq(PtlAgreement::getAgreementCode, vo.getAgreementCode()));
-            if (Objects.isNull(ptlAgreement)) {
+                    .eq(PtlAgreement::getId, data.getAgreementId()));
+
+            if (Objects.isNull(ptlAgreement) || !ptlAgreement.getAgreementType().toString().equals(vo.getAgreementType())) {
                 failedNumber++;
                 vo.setErrorMessage("匹配协议编号失败");
                 failedExcel.add(vo);
@@ -1508,11 +1570,17 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
             insPlyIncome.setCompanyId(matchCompany.getId());
             insPlyIncome.setCompanyName(matchCompany.getName());
 //            insPlyIncome.setSigningTime(signDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-            insPlyIncome.setAgreementId(ptlAgreement.getId());
             insPlyIncome.setLicenseNo(vo.getLicenseNo());
             insPlyIncome.setJqPolicyNo(vo.getJqPolicyNo());
             insPlyIncome.setJqPremium(vo.getJqPremium().toString());
             insPlyIncome.setJqSuperviseCostsProportion(vo.getJqSuperviseRatio().toString());
+            insPlyIncome.setContactPerson(vo.getContactPerson());
+            insPlyIncome.setContactPersonPhone(vo.getContactPersonPhone());
+            // 协议编号
+            insPlyIncome.setAgreementId(ptlAgreement.getId());
+            insPlyIncome.setAgreementName(ptlAgreement.getAgreementName());
+            insPlyIncome.setAgreementType(ptlAgreement.getAgreementType().toString());
+            insPlyIncome.setSystemCode(ptlAgreement.getSystemCode());
             successExcel.add(insPlyIncome);
         }
 
@@ -1552,10 +1620,20 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                 continue;
             }
 
-            //匹配协议号
+            // 查询订单
+            HttpResult<InsOrdersVo> insOrdersVoHttpResult = insOrdersClient.selectById(vo.getOrderNo());
+            InsOrdersVo data = insOrdersVoHttpResult.getData();
+            if (null == data){
+                failedNumber++;
+                vo.setErrorMessage("订单号不存在");
+                failedExcel.add(vo);
+                continue;
+            }
+
+            // 查询数据库中是否已存在该协议
             PtlAgreement ptlAgreement = ptlAgreementMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>()
-                    .eq(PtlAgreement::getAgreementCode, vo.getAgreementCode()));
-            if (Objects.isNull(ptlAgreement)) {
+                    .eq(PtlAgreement::getId, data.getAgreementId()));
+            if (Objects.isNull(ptlAgreement) || !ptlAgreement.getAgreementType().toString().equals(vo.getAgreementType())) {
                 failedNumber++;
                 vo.setErrorMessage("匹配协议编号失败");
                 failedExcel.add(vo);
@@ -1601,11 +1679,17 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
             insPlyIncome.setId(IdGenerate.nextId());
             insPlyIncome.setCompanyId(matchCompany.getId());
 //            insPlyIncome.setSigningTime(signDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-            insPlyIncome.setAgreementId(ptlAgreement.getId());
             insPlyIncome.setLicenseNo(vo.getLicenseNo());
             insPlyIncome.setJqPolicyNo(vo.getJqPolicyNo());
             insPlyIncome.setJqPremium(vo.getJqPremium().toString());
             insPlyIncome.setJqOtherCostsProportion(vo.getJqOtherRatio().toString());
+            insPlyIncome.setContactPerson(vo.getContactPerson());
+            insPlyIncome.setContactPersonPhone(vo.getContactPersonPhone());
+            // 协议编号
+            insPlyIncome.setAgreementId(ptlAgreement.getId());
+            insPlyIncome.setAgreementName(ptlAgreement.getAgreementName());
+            insPlyIncome.setAgreementType(ptlAgreement.getAgreementType().toString());
+            insPlyIncome.setSystemCode(ptlAgreement.getSystemCode());
             successExcel.add(insPlyIncome);
         }
 
@@ -1670,6 +1754,28 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                 continue;
             }
 
+            // 查询订单
+            HttpResult<InsOrdersVo> insOrdersVoHttpResult = insOrdersClient.selectById(vo.getOrderNo());
+            InsOrdersVo data = insOrdersVoHttpResult.getData();
+            if (null == data){
+                failedNumber++;
+                vo.setErrorMessage("订单号不存在");
+                failedExcel.add(vo);
+                continue;
+            }
+
+            // 查询数据库中是否已存在该协议
+            PtlAgreement ptlAgreement = ptlAgreementMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>()
+                    .eq(PtlAgreement::getId, data.getAgreementId()));
+
+            // 数据库不存在 → 直接失败
+            if (Objects.isNull(ptlAgreement) || !ptlAgreement.getAgreementType().toString().equals(vo.getAgreementType())) {
+                failedNumber++;
+                vo.setErrorMessage("协议编码在协议中不存在");
+                failedExcel.add(vo);
+                continue;
+            }
+
             // 3. 查询数据库中是否已存在该保单号
             InsPlyIncome existIncome = baseMapper.selectOne(new LambdaQueryWrapper<InsPlyIncome>()
                     .eq(InsPlyIncome::getJqPolicyNo, vo.getJqPolicyNo()));
@@ -1708,6 +1814,12 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
             insPlyIncome.setJySuperviseCostsProportion(vo.getJySuperviseCostsProportion());
             insPlyIncome.setJyOtherCostsProportion(vo.getJyOtherCostsProportion());
             insPlyIncome.setContactPerson(vo.getDockingPerson());
+            insPlyIncome.setContactPersonPhone(vo.getDockingPersonPhone());
+            // 协议编号
+            insPlyIncome.setAgreementId(ptlAgreement.getId());
+            insPlyIncome.setAgreementName(ptlAgreement.getAgreementName());
+            insPlyIncome.setAgreementType(ptlAgreement.getAgreementType().toString());
+            insPlyIncome.setSystemCode(ptlAgreement.getSystemCode());
 
             // 加入修改列表
             updateExcel.add(insPlyIncome);
@@ -1763,10 +1875,20 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                 continue;
             }
 
-            //匹配协议号
+            // 查询订单
+            HttpResult<InsOrdersVo> insOrdersVoHttpResult = insOrdersClient.selectById(vo.getOrderNo());
+            InsOrdersVo data = insOrdersVoHttpResult.getData();
+            if (null == data){
+                failedNumber++;
+                vo.setErrorMessage("订单号不存在");
+                failedExcel.add(vo);
+                continue;
+            }
+
+            // 查询数据库中是否已存在该协议
             PtlAgreement ptlAgreement = ptlAgreementMapper.selectOne(new LambdaQueryWrapper<PtlAgreement>()
-                    .eq(PtlAgreement::getAgreementCode, vo.getAgreementCode()));
-            if (Objects.isNull(ptlAgreement)) {
+                    .eq(PtlAgreement::getId, data.getAgreementId()));
+            if (Objects.isNull(ptlAgreement) || !ptlAgreement.getAgreementType().toString().equals(vo.getAgreementType())) {
                 failedNumber++;
                 vo.setErrorMessage("匹配协议编号失败");
                 failedExcel.add(vo);
@@ -1818,6 +1940,13 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
             insPlyIncome.setJyPremium(vo.getJyPremium().toString());
             insPlyIncome.setJySuperviseCostsProportion(vo.getJySuperviseRatio().toString());
             insPlyIncome.setJyOtherCostsProportion(vo.getJyOtherRatio().toString());
+            insPlyIncome.setContactPerson(vo.getContactPerson());
+            insPlyIncome.setContactPersonPhone(vo.getContactPersonPhone());
+            // 协议编号
+            insPlyIncome.setAgreementId(ptlAgreement.getId());
+            insPlyIncome.setAgreementName(ptlAgreement.getAgreementName());
+            insPlyIncome.setAgreementType(ptlAgreement.getAgreementType().toString());
+            insPlyIncome.setSystemCode(ptlAgreement.getSystemCode());
             successExcel.add(insPlyIncome);
         }
 
@@ -2406,55 +2535,56 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
      * @date 2026/5/23 16:28
      */
     @Override
-    public List<CompanySuperviseSettlementReportDto> companySuperviseSettlementReport(
+    public HttpResult<List<CompanySuperviseSettlementReportDto>> companySuperviseSettlementReport(
             SettlementReportQueryVo queryVo) {
-        log.info("保险公司结算报表查询:{}", JSONUtil.toJsonStr(queryVo));
-        // 查询所有公司
-        List<CompanySuperviseSettlementReportDto> allCompanies =
-                baseMapper.selectAllCompanyReports(queryVo);
-        if (CollUtil.isEmpty(allCompanies)) {
-            return Collections.emptyList();
-        }
-        // 查询应开票金额
-        Map<String, BigDecimal> superviseAmountMap =
-                baseMapper.getSuperviseAmount()
-                        .stream()
-                        .collect(Collectors.toMap(
-                                InvoiceAmountDto::getCompanyId,
-                                dto -> defaultZero(dto.getSuperviseAmount())
-                        ));
-        // companyId -> dto
-        Map<String, CompanySuperviseSettlementReportDto> companyMap =
-                allCompanies.stream()
-                        .collect(Collectors.toMap(
-                                CompanySuperviseSettlementReportDto::getCompanyId,
-                                Function.identity(),
-                                (a, b) -> a
-                        ));
-        // 构建树
-        List<CompanySuperviseSettlementReportDto> roots = new ArrayList<>();
-        for (CompanySuperviseSettlementReportDto dto : allCompanies) {
-            initAmount(dto);
-            if (StrUtil.isBlank(dto.getParentId())
-                    || "0".equals(dto.getParentId())) {
-
-                roots.add(dto);
-                continue;
-            }
-            CompanySuperviseSettlementReportDto parent =
-                    companyMap.get(dto.getParentId());
-            if (parent != null) {
-                if (parent.getChildren() == null) {
-                    parent.setChildren(new ArrayList<>());
-                }
-                parent.getChildren().add(dto);
-            }
-        }
-        // 自底向上汇总
-        for (CompanySuperviseSettlementReportDto root : roots) {
-            aggregate(root, superviseAmountMap);
-        }
-        return roots;
+        return null;
+//        log.info("保险公司结算报表查询:{}", JSONUtil.toJsonStr(queryVo));
+//        // 查询所有公司
+//        List<CompanySuperviseSettlementReportDto> allCompanies =
+//                baseMapper.selectAllCompanyReports(queryVo);
+//        if (CollUtil.isEmpty(allCompanies)) {
+//            return Collections.emptyList();
+//        }
+//        // 查询应开票金额
+//        Map<String, BigDecimal> superviseAmountMap =
+//                baseMapper.getSuperviseAmount()
+//                        .stream()
+//                        .collect(Collectors.toMap(
+//                                InvoiceAmountDto::getCompanyId,
+//                                dto -> defaultZero(dto.getSuperviseAmount())
+//                        ));
+//        // companyId -> dto
+//        Map<String, CompanySuperviseSettlementReportDto> companyMap =
+//                allCompanies.stream()
+//                        .collect(Collectors.toMap(
+//                                CompanySuperviseSettlementReportDto::getCompanyId,
+//                                Function.identity(),
+//                                (a, b) -> a
+//                        ));
+//        // 构建树
+//        List<CompanySuperviseSettlementReportDto> roots = new ArrayList<>();
+//        for (CompanySuperviseSettlementReportDto dto : allCompanies) {
+//            initAmount(dto);
+//            if (StrUtil.isBlank(dto.getParentId())
+//                    || "0".equals(dto.getParentId())) {
+//
+//                roots.add(dto);
+//                continue;
+//            }
+//            CompanySuperviseSettlementReportDto parent =
+//                    companyMap.get(dto.getParentId());
+//            if (parent != null) {
+//                if (parent.getChildren() == null) {
+//                    parent.setChildren(new ArrayList<>());
+//                }
+//                parent.getChildren().add(dto);
+//            }
+//        }
+//        // 自底向上汇总
+//        for (CompanySuperviseSettlementReportDto root : roots) {
+//            aggregate(root, superviseAmountMap);
+//        }
+//        return roots;
     }
 
 

+ 30 - 1
tenant/organization/src/main/resources/mapper/ReceivableMapper.xml

@@ -166,7 +166,10 @@
         io.product_name,
         io.pay_time,
         io.signing_time,
-        ifa.audit_status
+        ifa.audit_status,
+        io.docking_person as contact_person,
+        io.docking_person_phone as contact_person_phone,
+        pa.system_code
         FROM
         ins_orders io
         LEFT JOIN ins_orders_policy iop ON io.id = iop.order_no
@@ -599,6 +602,11 @@
         LEFT JOIN ins_orders io ON ipi.order_no = io.id
         LEFT JOIN ptl_agreement agree ON io.agreement_id = agree.id
         WHERE 1 = 1
+        AND ipiis.is_delete = 0
+        AND ipii.is_delete = 0
+        AND ipi.is_delete = 0
+        AND io.is_delete = 0
+        AND agree.is_delete = 0
         <if test="settlementQueryVo.settlementIds != null and settlementQueryVo.settlementIds != ''">
             AND ipiis.id IN
             <foreach collection="settlementQueryVo.settlementIds" item="settlementId" open="(" separator="," close=")">
@@ -1525,6 +1533,27 @@
             resultType="com.jzg.commons.entity.finance.po.InsPlyIncomeInvoiceSettlement">
         select * from ins_ply_income_invoice_settlement ipiis where ipiis.invoice_id = #{invoiceId}
     </select>
+    <select id="queryCumulativeAccountsReceivable"
+            resultType="com.jzg.commons.entity.finance.dto.CompanySuperviseSettlementReportDto">
+        select
+        eic.parent_id,
+        ipi.company_id,
+        ipi.system_code,
+        COALESCE ( SUM( ipi.jq_receivable_premium + ipi.sy_receivable_premium + ipi.jy_receivable_premium ),
+        0 ) AS total_receivable,
+        COALESCE ( SUM( ipi.jq_receivable_premium + ipi.sy_receivable_premium + ipi.jy_receivable_premium ),
+        0 ) AS total_follow_fee
+        from
+        ins_ply_income ipi
+        left join  esm_ins_company eic
+        on eic.id = ipi.company_id
+        group by
+        eic.parent_id,
+        ipi.company_id,
+        ipi.system_code
+        having company_id is not null
+        and ipi.system_code = #{systemCode}
+    </select>
 
     <!--    <select id="getReceivableList" resultType="com.jzg.commons.entity.finance.po.InsPlyIncome">-->
 <!--        SELECT-->