Переглянути джерело

Merge branch 'master' into wrq_dev

wangrq 3 тижнів тому
батько
коміт
19a6bbd6a7
24 змінених файлів з 340 додано та 122 видалено
  1. 21 1
      commons/src/main/java/com/jzg/commons/entity/account/po/SysUserAccountChangeLog.java
  2. 11 0
      commons/src/main/java/com/jzg/commons/entity/dto/CostManagementVo.java
  3. 3 0
      commons/src/main/java/com/jzg/commons/entity/dto/PtlAgreementCostAdd.java
  4. 15 1
      commons/src/main/java/com/jzg/commons/entity/dto/PtlAgreementCostParam.java
  5. 3 0
      commons/src/main/java/com/jzg/commons/entity/user/vo/UserInfoWithPhone.java
  6. 0 1
      commons/src/main/java/com/jzg/commons/util/BuildDescUtils.java
  7. 39 1
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsFeeAuditServiceImpl.java
  8. 7 7
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsOrdersServiceImpl.java
  9. 2 1
      tenant/insurance/quotation-summary/src/main/resources/mapper/InsFeeAuditMapper.xml
  10. 10 0
      tenant/organization/src/main/java/com/jzg/organization/controller/SysUserJzgInfoController.java
  11. 62 60
      tenant/organization/src/main/java/com/jzg/organization/mapper/SysUserAccountIncomeLogMapper.java
  12. 19 0
      tenant/organization/src/main/java/com/jzg/organization/service/SysUserJzgInfoService.java
  13. 3 0
      tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostExternalServiceImpl.java
  14. 31 5
      tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostServiceImpl.java
  15. 3 3
      tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementUndwrtRulesServiceImpl.java
  16. 10 14
      tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlSchemeServiceImpl.java
  17. 1 0
      tenant/organization/src/main/java/com/jzg/organization/service/impl/ReceivableServiceImpl.java
  18. 1 0
      tenant/organization/src/main/java/com/jzg/organization/service/impl/SysAmountAuditingServiceImpl.java
  19. 51 5
      tenant/organization/src/main/java/com/jzg/organization/service/impl/SysUserJzgInfoServiceImpl.java
  20. 15 13
      tenant/organization/src/main/java/com/jzg/organization/service/impl/SysUserServiceImpl.java
  21. 26 3
      tenant/organization/src/main/resources/mapper/PtlAgreementCostMapper.xml
  22. 1 1
      tenant/organization/src/main/resources/mapper/PtlAgreementDispatchAfterActionMapper.xml
  23. 4 5
      tenant/organization/src/main/resources/mapper/ReceivableMapper.xml
  24. 2 1
      tenant/organization/src/main/resources/mapper/SysUserJzgInfoMapper.xml

+ 21 - 1
commons/src/main/java/com/jzg/commons/entity/account/po/SysUserAccountChangeLog.java

@@ -81,10 +81,26 @@ public class SysUserAccountChangeLog extends BaseModel {
     @Schema(description = "操作类型")
     private int operType;
 
-    @ExcelProperty("操作类型")
+    @ExcelIgnore
     @TableField(exist = false)
     private String operTypeName;
 
+    @ExcelProperty("收支类型")
+    @TableField(exist = false)
+    private String operClassName;
+
+
+    @ExcelIgnore
+    private static Map<Integer,String> operClassMap = new  HashMap<Integer,String>();
+    static {
+        operClassMap.put(1,"收入");
+        operClassMap.put(2,"收入");
+        operClassMap.put(3,"支出");
+        operClassMap.put(4,"支出");
+        operClassMap.put(5,"支出");
+    }
+
+
     @ExcelIgnore
     private static Map<Integer,String> operTypeMap = new  HashMap<Integer,String>();
     static {
@@ -99,6 +115,10 @@ public class SysUserAccountChangeLog extends BaseModel {
         return operTypeMap.getOrDefault(this.operType, Objects.toString(this.operType));
     }
 
+    public String getOperClassName(){
+        return operClassMap.getOrDefault(this.operType, Objects.toString(this.operType));
+    }
+
     @ExcelProperty("关联订单ID")
     @Schema(description = "关联订单ID")
     private String relatedOrderId;

+ 11 - 0
commons/src/main/java/com/jzg/commons/entity/dto/CostManagementVo.java

@@ -6,12 +6,23 @@ import com.jzg.commons.entity.vo.PtlAgreementCostRuleVo;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
+import java.time.LocalDateTime;
 import java.util.List;
 
 @Data
 @Schema(description = "费用管理")
 public class CostManagementVo {
 
+
+    @Schema(description = "审核人姓名")
+    private String auditPersonName;
+
+    @Schema(description = "审核人")
+    private String auditPerson;
+
+    @Schema(description = "审核时间")
+    private LocalDateTime auditTime;
+
     @Schema(description = "协议ID")
     private String ptlAgreementId;
 

+ 3 - 0
commons/src/main/java/com/jzg/commons/entity/dto/PtlAgreementCostAdd.java

@@ -2,6 +2,7 @@ package com.jzg.commons.entity.dto;
 
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jzg.commons.entity.po.PtlAgreementUndwrtRulesDictLabal;
 import io.swagger.v3.oas.annotations.media.Schema;
 import jakarta.validation.constraints.NotBlank;
 import jakarta.validation.constraints.NotNull;
@@ -86,6 +87,8 @@ public class PtlAgreementCostAdd {
         @Schema(description = "操作符")
         private String operator;
 
+        @Schema(description = "协议承保规则字典")
+        private List<PtlAgreementUndwrtRulesDictLabal> dictLabal;
 
     }
 

+ 15 - 1
commons/src/main/java/com/jzg/commons/entity/dto/PtlAgreementCostParam.java

@@ -12,6 +12,12 @@ import java.util.List;
 public class PtlAgreementCostParam extends PageRequest {
 
 
+    @Schema(description = "审核人")
+    private String auditPerson;
+
+    @Schema(description = "审核人的登录手机号,对应sysUser表的userName")
+    private List<String> phones;
+
     @Schema(description = "输入代码,名称,简称查找")
     private String agreement;
 
@@ -22,7 +28,7 @@ public class PtlAgreementCostParam extends PageRequest {
     private String rulesName;
 
     @Schema(description = "费用规则")
-    private String costRules;
+    private String[] costRules;
 
     @Schema(description = "费用规则")
     private List<String> costRulesList;
@@ -51,6 +57,9 @@ public class PtlAgreementCostParam extends PageRequest {
     @Schema(description = "保险公司")
     private String companyId;
 
+    @Schema(description = "保险机构合集")
+    private List<String> companyIdList;
+
     @Schema(description = "对接人")
     private String contactPerson;
 
@@ -67,4 +76,9 @@ public class PtlAgreementCostParam extends PageRequest {
     @Schema(description = "复制的新的ids")
     private List<String> newCostIds;
 
+    @Schema(description = "审核时间-起始时间")
+    private String auditTimeBegin;
+    @Schema(description = "审核时间-终止时间")
+    private String auditTimeEnd;
+
 }

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

@@ -26,5 +26,8 @@ public class UserInfoWithPhone implements Serializable {
 
     private String deptName;
 
+    // 手机号 ,sys_user 表的mobile
+    private String mobile;
+
 
 }

+ 0 - 1
commons/src/main/java/com/jzg/commons/util/BuildDescUtils.java

@@ -24,7 +24,6 @@ public class BuildDescUtils {
             if (ptlAgreementUndwrtRulesAttr == null) {
                 continue;
             }
-            //ptlAgreementUndwrtRulesAttr.setDictLabal(link.getDictLabal());
 
             String attrType = ptlAgreementUndwrtRulesAttr.getAttrType();
 

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

@@ -1,6 +1,7 @@
 package com.jzg.quotation.summary.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.ReUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSONObject;
@@ -175,6 +176,10 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
 //            feeAuditVo.setPartnerCompanyName(allCompanyHierarchyPaths.get(Objects.toString(feeAuditVo.getPartnerCompanyId(),"")));
 //            feeAuditVo.setPartnerCompanySimplyName(allCompanyHierarchyPaths.get(Objects.toString(feeAuditVo.getPartnerCompanyId(),"")));
             feeAuditVo.setPartnerCompanySimplyName(feeAuditVo.getPartnerCompanyName());
+            // auditUser 非空时,判断是名称还是手机号
+            feeAuditVo.setAuditUser(getUserNameByMobile(feeAuditVo.getAuditUser()));
+            feeAuditVo.setCreateBy(getUserNameByMobile(feeAuditVo.getCreateBy()));
+
             // 循环每条数据,查询 ins_fee_orders 并计算权益金额
             // 查询订单的 ins_fee_orders 数据
             InsFeeOrders insFeeOrders = feeOrdersService.getById(feeAuditVo.getOrderNo());
@@ -198,7 +203,7 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
         return page;
     }
 
-      public List<FeeAuditVo> queryList(FeeAuditParam param) {
+    public List<FeeAuditVo> queryList(FeeAuditParam param) {
         log.info("订单审核-任务中心,查询待审核任务。 param=[{}]", JSONUtil.toJsonStr(param));
         // 获取选中的保险公司条件
         String companyId = param.getCompanyId();
@@ -1214,4 +1219,37 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
         log.info("查询审核明细:{},{},{},{}, 查询出[{}]条记录", systemCode,  userName,  pageNo,pageSize, CollUtil.size(res.getRecords()));
         return res.getRecords();
     }
+
+
+    /**
+     * 根据用户手机号查询名称
+     * @param mobile
+     * @return
+     */
+    private String getUserNameByMobile(String mobile) {
+        if (StringUtils.isNotBlank(mobile)) {
+            // 国内手机号正则:1开头,第二位3-9,共11位数字
+            String mobileRegex = "^1[3-9]\\d{9}$";
+            if (ReUtil.contains(mobileRegex, mobile)) {
+                // auditUser 是手机号:先从 sys_user 表根据 mobile 查询数据
+                HttpResult<SysUser> sysUserResult = orgClient.getUserOnlyIdByMobile(mobile);
+                if (sysUserResult != null && sysUserResult.isSuccess() && sysUserResult.getData() != null) {
+                    SysUser sysUser = sysUserResult.getData();
+                    String userName = sysUser.getUsername();
+                    // 如果 sys_user 的 username 字段是手机号,则再去 sys_user_jzg_info 根据 user_id 查询数据,展示 name
+                    if (StringUtils.isNotBlank(userName) && userName.matches(mobileRegex)) {
+                        HttpResult<SysUserJzgInfo> jzgInfoResult = orgClient.getUserInfo(sysUser.getId());
+                        if (jzgInfoResult != null && jzgInfoResult.isSuccess() && jzgInfoResult.getData() != null
+                                && StringUtils.isNotBlank(jzgInfoResult.getData().getName())) {
+                            return jzgInfoResult.getData().getName();
+                        }
+                    } else if (StringUtils.isNotBlank(userName)) {
+                        // 如果 sys_user 的 username 是名称,则直接展示
+                        return userName;
+                    }
+                }
+            }
+        }
+        return StrUtil.EMPTY;
+    }
 }

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

@@ -1096,31 +1096,31 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             switch (code) {
                 case 1:
                     // 报价成功
-                    data.put("1", orderMaps.get("1"));
+                    data.put("1", Objects.isNull(orderMaps.get("1")) ? new ArrayList<>() : orderMaps.get("1"));
                     break;
                 case 2:
                     // 核保中
-                    data.put("2", orderMaps.get("2"));
+                    data.put("2", Objects.isNull(orderMaps.get("2")) ? new ArrayList<>() : orderMaps.get("2"));
                     break;
                 case 3:
                     // 未报价
-                    data.put("3", null);
+                    data.put("3", Objects.isNull(orderMaps.get("3")) ? new ArrayList<>() : orderMaps.get("3"));
                     break;
                 case 4:
                     // 待缴费
-                    data.put("4", orderMaps.get("4"));
+                    data.put("4", Objects.isNull(orderMaps.get("4")) ? new ArrayList<>() : orderMaps.get("4"));
                     break;
                 case 5:
                     // 已承保
-                    data.put("5", orderMaps.get("5"));
+                    data.put("5", Objects.isNull(orderMaps.get("5")) ? new ArrayList<>() : orderMaps.get("5"));
                     break;
                 case 6:
                     // 报价失败
-                    data.put("6", orderMaps.get("6"));
+                    data.put("6", Objects.isNull(orderMaps.get("6")) ? new ArrayList<>() : orderMaps.get("6"));
                     break;
                 case 7:
                     // 核保失败
-                    data.put("7", orderMaps.get("7"));
+                    data.put("7", Objects.isNull(orderMaps.get("7")) ? new ArrayList<>() : orderMaps.get("7"));
                     break;
             }
         }

+ 2 - 1
tenant/insurance/quotation-summary/src/main/resources/mapper/InsFeeAuditMapper.xml

@@ -65,7 +65,8 @@
         ioc.jq_premium as jqPremium, ioc.sy_premium as syPremium, ioc.jy_premium as jyPremium,
         ioc.sum_premium as sumPremium,sd.name as deptName,ifa.create_time as createTime,
         ifa.create_by as createBy,io.pay_time as payTime, ifa.audit_time as auditTime,
-        ifa.audit_user as auditUser, ifa.refuse,
+        ifa.audit_user as auditUser,
+        ifa.refuse,
         ifa.is_problem, ifa.problem_reason,
         ifa.problem_time,
         CASE ifa.is_problem

+ 10 - 0
tenant/organization/src/main/java/com/jzg/organization/controller/SysUserJzgInfoController.java

@@ -60,5 +60,15 @@ public class SysUserJzgInfoController {
         return HttpResult.ok(sysUserJzgInfoService.queryUserInfo(systemCode));
     }
 
+    /**
+     * 查询用户基础信息
+     * Map<String, String> key 是sys_user 表的userName 字段, value是 sys_user_jzg_info 表的name字段
+     * @author lipf
+     * @date 2026/7/24 14:10
+     */
+    @PostMapping("/api/v1/organization/queryUserInfoUserName2Name")
+    HttpResult<Map<String, String>> queryUserInfoUserName2Name(@RequestParam("systemCode") String systemCode){
+        return HttpResult.ok(sysUserJzgInfoService.queryUserInfoUserName2Name(systemCode));
+    }
 
 }

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

@@ -23,66 +23,68 @@ public interface SysUserAccountIncomeLogMapper extends BaseMapper<SysUserAccount
     @Select("""
         
             select * from(
-        	SELECT
-        		a.system_code ,
-        		ioci.license_no,
-        		io.signing_time AS signTime,
-        		saa.auditing_time AS payTime,
-        		a.user_id,
-        		a.jzg_info_id,
-        		a.user_name,
-        		a.amount,
-        		a.amount_before,
-        		a.amount_after,
-        		a.oper_type,
-        		a.related_order_id,
-        		a.bank_card_id_to,
-        		a.bank_card_no_to,
-        		a.bank_card_id_in,
-        		a.bank_card_no_in,
-        		a.is_delete,
-        		a.create_time,
-        		a.remark,
-        		a.related_amount_auditing_id,
-        		a.status
-        	FROM
-        		sys_user_account_change_log a
-        	LEFT JOIN ins_orders_car_info ioci ON
-        		a.related_order_id = ioci.order_no
-        	LEFT JOIN ins_orders io ON
-        		a.related_order_id = io.id
-        	LEFT JOIN sys_amount_auditing saa
-        	ON
-        		saa.id = a.related_amount_auditing_id
-        		AND saa.system_code = 'G111'
-        union ALL
-        	select
-        		saa.system_code ,
-        		null as license_no,
-        		null as signTime,
-        		null as payTime,
-        		saa.user_id,
-        		null as zg_info_id,
-        		su.username as user_name,
-        		saa.amount,
-        		(saa.amount + saa.balance_amount) as amount_before,
-        		saa.balance_amount as amount_after,
-        		5 as oper_type,
-        		null as related_order_id,
-        		null as bank_card_id_to,
-        		null as bank_card_no_to,
-        		null as bank_card_id_in,
-        		null as bank_card_no_in,
-        		null as is_delete,
-        		saa.create_time,
-        		'提现中' as remark,
-        		null as related_amount_auditing_id,
-        		10 as status
-        	from
-        		sys_amount_auditing saa
-        	    left join sys_user su on saa.user_id = su.id
-        	where
-        		saa.auditing_status = 0
+	SELECT
+                a.system_code,
+                ioci.license_no,
+                io.signing_time AS signTime,
+                saa.auditing_time AS payTime,
+                a.user_id,
+                a.jzg_info_id,
+                a.user_name,
+                a.amount,
+                a.amount_before,
+                a.amount_after,
+                a.oper_type,
+                a.related_order_id,
+                a.bank_card_id_to,
+                a.bank_card_no_to,
+                a.bank_card_id_in,
+                a.bank_card_no_in,
+                a.is_delete,
+                a.create_time,
+                a.remark,
+                a.related_amount_auditing_id,
+                a.status
+            FROM
+                sys_user_account_change_log a
+            LEFT JOIN ins_orders_car_info ioci ON
+                a.related_order_id = ioci.order_no
+            LEFT JOIN ins_orders io ON
+                a.related_order_id = io.id
+            LEFT JOIN sys_amount_auditing saa
+                ON
+                saa.id = a.related_amount_auditing_id
+            WHERE
+                a.system_code = #{systemCode}
+         UNION ALL
+            SELECT
+                saa.system_code,
+                NULL AS license_no,
+                NULL AS signTime,
+                NULL AS payTime,
+                saa.user_id
+                ,
+                NULL AS zg_info_id,
+                su.username AS user_name,
+                0 - saa.amount as amount,
+                saa.amount + saa.balance_amount AS amount_before,
+                saa.balance_amount AS amount_after,
+                5 AS oper_type,
+                NULL AS related_order_id,
+                NULL AS bank_card_id_to,
+                NULL AS bank_card_no_to,
+                NULL AS bank_card_id_in,
+                NULL AS bank_card_no_in,
+                NULL AS is_delete,
+                saa.create_time,
+                '提现中' AS remark,
+                NULL AS related_amount_auditing_id,
+                10 AS status
+            FROM
+                sys_amount_auditing saa
+               LEFT JOIN sys_user su ON saa.user_id = su.id
+            WHERE
+                saa.auditing_status = 0
         ) mm
         where
         	mm.user_id =  #{ywyUserId}

+ 19 - 0
tenant/organization/src/main/java/com/jzg/organization/service/SysUserJzgInfoService.java

@@ -79,4 +79,23 @@ public interface SysUserJzgInfoService extends IService<SysUserJzgInfo> {
      * @date 2026/7/24 14:10
      */
     Map<String, UserInfoWithPhone> queryUserInfo(String systemCode);
+
+    /**
+     * 查询用户基础信息
+     * Map<String, String> key 是sys_user 表的userName 字段, value是 sys_user_jzg_info 表的name字段
+     * @author lipf
+     * @date 2026/7/24 14:10
+     */
+    Map<String, String> queryUserInfoUserName2Name(String systemCode);
+
+    /**
+     * 根据用户姓名查询用户的手机号
+     *
+     * @param userName 用户名
+     * @return List<String> 用户姓名列表
+     * @author lipf
+     * @date 2026/8/13 14:36
+     */
+    List<String> queryPhonesByUserName(String userName);
+
 }

+ 3 - 0
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostExternalServiceImpl.java

@@ -2,6 +2,7 @@ package com.jzg.organization.service.impl;
 
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.json.JSONUtil;
 import com.alibaba.nacos.common.utils.CollectionUtils;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -182,6 +183,8 @@ public class PtlAgreementCostExternalServiceImpl extends ServiceImpl<PtlAgreemen
 
     @Override
     public HttpResult pageList(CostExternalPageParam pageParam) {
+        log.info("查询外部协议费用。 pageParam=[{}]", JSONUtil.toJsonStr(pageParam));
+
         return HttpResult.ok(baseMapper.pageList(pageParam.getPage(),pageParam));
     }
 

+ 31 - 5
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostServiceImpl.java

@@ -1,6 +1,7 @@
 package com.jzg.organization.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
@@ -9,7 +10,6 @@ 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.Constants;
-import com.jzg.commons.constants.ProductsType;
 import com.jzg.commons.constants.ReturnInformation;
 import com.jzg.commons.core.base.BaseController;
 import com.jzg.commons.core.base.StateResult;
@@ -25,6 +25,7 @@ import com.jzg.commons.util.BuildDescUtils;
 import com.jzg.commons.util.ListUtils;
 import com.jzg.commons.util.StringUtils;
 import com.jzg.commons.util.idgen.IdGenerate;
+import com.jzg.organization.client.EsmInsCompanyClient;
 import com.jzg.organization.mapper.PtlAgreementCostMapper;
 import com.jzg.organization.mapper.PtlAgreementCostRuleMapper;
 import com.jzg.organization.mapper.PtlAgreementCostTypeMapper;
@@ -44,12 +45,10 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 import static com.jzg.commons.constants.RedisKeyConstants.DICT_REDIS_KEY;
@@ -73,6 +72,8 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
 
     @Autowired
     private PtlAgreementCostTypeService ptlAgreementCostTypeService;
+    @Autowired
+    private EsmInsCompanyClient esmInsCompanyClient;
 
     @Autowired
     RedissonClient redissonClient;
@@ -95,6 +96,8 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
 
     @Autowired
     private PtlAgreementService ptlAgreementService;
+    @Autowired
+    private SysUserJzgInfoService sysUserJzgInfoService;
 
     /**
      * 报价配置/费用管理/新增费用
@@ -379,6 +382,28 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
     @Override
     public HttpResult<Page<CostManagementVo>> pageList(PtlAgreementCostParam costParam) {
         log.info("查询协议费用信息:costParam=[{}]", JSONUtil.toJsonStr(costParam));
+
+//        String auditTimeBegin = costParam.getAuditTimeBegin();
+//        String auditTimeEnd = costParam.getAuditTimeEnd();
+//        if(StrUtil.isNotEmpty(auditTimeBegin)){
+//            LocalDate begin = LocalDate.parse(auditTimeBegin, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+//            LocalDateTime localDateTime = begin.atStartOfDay();
+//            costParam.setAuditTimeBegin(localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+//        }
+//        if(StrUtil.isNotEmpty(auditTimeEnd)){
+//            LocalDate end = LocalDate.parse(auditTimeEnd, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+//            LocalDateTime localDateTime = end.plusDays(1).atStartOfDay();
+//            costParam.setAuditTimeEnd(localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+//        }
+        if(StrUtil.isNotEmpty(costParam.getCompanyId())){
+            HttpResult<List<String>> res = esmInsCompanyClient.queryOwnAndSubCompandyIds(costParam.getCompanyId());
+            costParam.setCompanyIdList(res.getData());
+        }
+        String auditPerson = costParam.getAuditPerson();
+        List<String> phones = sysUserJzgInfoService.queryPhonesByUserName(auditPerson);
+        costParam.setPhones(phones);
+
+        Map<String, String> userName2Name = sysUserJzgInfoService.queryUserInfoUserName2Name(baseController.getSystemCode());
         Page<CostManagementVo> costManagementVoPage = baseMapper.pageList(costParam.getPage(), costParam);
         costManagementVoPage.getRecords().forEach(item->{
             if(item.getCostRules() != null && !item.getCostRules().isEmpty()){
@@ -387,6 +412,7 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
             if(item.getRuleDescription() != null && !item.getRuleDescription().isEmpty()){
                 item.setRuleDescription(item.getRuleDescription().substring(0,item.getRuleDescription().length()-1));
             }
+            item.setAuditPersonName(userName2Name.getOrDefault(item.getAuditPerson(),item.getAuditPerson()));
         });
         return HttpResult.ok(costManagementVoPage);
     }

+ 3 - 3
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementUndwrtRulesServiceImpl.java

@@ -107,8 +107,8 @@ public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreement
                             vo.setIsValid(1);  // 已失效
                         }
                     }));
-                    rulesVo.setCostVoList(allCostVos);
                 }
+                rulesVo.setCostVoList(allCostVos);
             }
         }
         return rulesVos;
@@ -590,8 +590,8 @@ public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreement
             sourceRuleIds = List.of(ruleId);
         }
 
-        // 批量复制:多条规则共享同一个新 parentId
-        String newParentId = sourceRuleIds.size() > 1 ? IdGenerate.nextId() : null;
+        // 复制时给新规则重新生成 parentId,避免与原规则共享 parent_id
+        String newParentId = IdGenerate.nextId();
         List<RulesGroupParam> groups = new ArrayList<>();
 
         // 获取属性映射(用于组装返回结果)

+ 10 - 14
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlSchemeServiceImpl.java

@@ -438,27 +438,22 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
         //   3. 关联账号必须可用 (useStatus == "0") 且可报价 (quoteStatus == "0")
         // 过滤后如果某保司没有任何有效协议,会被下面的 removeIf 自动排除
         if (CollUtil.isNotEmpty(companyList)) {
-            // 1. 收集所有需要校验的归属账号 id(去重)
+            // 1. 收集所有需要校验的归属账号 id
             List<String> attributionIds = companyList.stream()
                     .flatMap(c -> Optional.ofNullable(c.getAgreements()).orElse(Collections.emptyList()).stream())
                     .map(PtlAgreement::getAttributionId)
                     .filter(StrUtil::isNotBlank)
-                    .distinct()
                     .collect(Collectors.toList());
 
             // 2. 并行批量查询归属账号,构建 id -> 账号信息 索引(避免逐协议串行 RPC)
-            Map<String, PtlAgreementAttribution> attributionMap;
+            Map<String, PtlAgreementAttribution> attributionMap = Map.of();
             if (CollUtil.isNotEmpty(attributionIds)) {
-                attributionMap = attributionIds.parallelStream().collect(HashMap::new, (map, id) -> {
-                    try {
-                        HttpResult<PtlAgreementAttribution> res = platformClient.getAgreementAttribution2(id);
-                        if (res.getCode() == 200 && res.getData() != null) {
-                            map.put(id, res.getData());
-                        }
-                    } catch (Exception e) {
-                        log.warn("批量查询协议归属账号[{}]异常,默认保留", id, e);
+                HttpResult<List<PtlAgreementAttribution>> batchRes = platformClient.getAgreementAttributionByIds(attributionIds);
+                for (PtlAgreementAttribution attr : batchRes.getData()) {
+                    if (attr != null && StrUtil.isBlank(attr.getId())) {
+                        attributionMap.put(attr.getId(), attr);
                     }
-                }, HashMap::putAll);
+                }
             } else {
                 attributionMap = Collections.emptyMap();
             }
@@ -469,6 +464,7 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
                 if (CollUtil.isEmpty(agreements)) {
                     continue;
                 }
+                Map<String, PtlAgreementAttribution> finalAttributionMap = attributionMap;
                 List<PtlAgreement> validAgreements = agreements.stream()
                         // 协议自身状态
                         .filter(a -> a.getIsEnable() != null && a.getIsEnable() == 0)
@@ -479,7 +475,7 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
                             if (StrUtil.isBlank(attributionId)) {
                                 return true; // 没有关联账号,不做账号校验
                             }
-                            PtlAgreementAttribution attr = attributionMap.get(attributionId);
+                            PtlAgreementAttribution attr = finalAttributionMap.get(attributionId);
                             if (attr == null) {
                                 return true; // 查不到账号信息,默认保留
                             }
@@ -560,8 +556,8 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
                     dispatchAttrVo.setCompanyId(vo.getCompanyId());
                     dispatchAttrVo.setSectionGroups(grouped);
                     dispatchAttrVos.add(dispatchAttrVo);
+                    dispatchRuleVos.getDispatchAttrVos().addAll(dispatchAttrVos);
                 }
-                dispatchRuleVos.getDispatchAttrVos().addAll(dispatchAttrVos);
             }
         } catch (Exception e) {
             log.warn("批量查询协议调度异常", e);

+ 1 - 0
tenant/organization/src/main/java/com/jzg/organization/service/impl/ReceivableServiceImpl.java

@@ -3997,6 +3997,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                     .set(InsPlyIncome::getAgreementName, agreementVo.getAgreementName())
                     .set(InsPlyIncome::getContactPerson, agreementVo.getDockingPerson())
                     .set(InsPlyIncome::getContactPersonPhone, agreementVo.getDockingPhone())
+                    .set(InsPlyIncome::getAgreementType, agreementVo.getAgreementType())
                     .in(InsPlyIncome::getId, updateIncomeIds);
             baseMapper.update(null, incomeUpdateWrapper);
             log.info("修改ins_ply_income保司信息完成,未对账数据条数: {}", updateIncomeIds.size());

+ 1 - 0
tenant/organization/src/main/java/com/jzg/organization/service/impl/SysAmountAuditingServiceImpl.java

@@ -141,6 +141,7 @@ public class SysAmountAuditingServiceImpl extends ServiceImpl<SysAmountAuditingM
         }else{
             LambdaQueryWrapper<SysAmountAuditing> wrapper = new LambdaQueryWrapper<>();
             wrapper.like(SysAmountAuditing::getReceiveUser, receiveUser);
+            wrapper.eq(SysAmountAuditing::getAuditingStatus, "0");
             long count = this.count(wrapper);
             if(count >= 10){
                 AssertionUtils.isFail(true, "超出10次领取限制,请先审核后再领取订单!");

+ 51 - 5
tenant/organization/src/main/java/com/jzg/organization/service/impl/SysUserJzgInfoServiceImpl.java

@@ -6,20 +6,19 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.jzg.commons.entity.dto.PartnerReviewParam;
+import com.jzg.commons.entity.po.SysUser;
 import com.jzg.commons.entity.po.SysUserJzgInfo;
 import com.jzg.commons.entity.user.vo.UserInfoWithPhone;
 import com.jzg.commons.entity.vo.PartnerRecommenderVo;
 import com.jzg.organization.mapper.SysUserJzgInfoMapper;
+import com.jzg.organization.mapper.SysUserMapper;
 import com.jzg.organization.service.SysUserJzgInfoService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
@@ -35,6 +34,8 @@ public class SysUserJzgInfoServiceImpl extends ServiceImpl<SysUserJzgInfoMapper,
 
     @Autowired
     private SysUserJzgInfoMapper sysUserJzgInfoMapper;
+    @Autowired
+    private SysUserMapper sysUserMapper;
 
 
     /**
@@ -146,16 +147,61 @@ public class SysUserJzgInfoServiceImpl extends ServiceImpl<SysUserJzgInfoMapper,
      * 查询用户基础信息
      *
      * @param systemCode
+     * @return  Map<String, UserInfoWithPhone> key是用户登录名
      * @author lipf
      * @date 2026/7/24 14:10
      */
     @Override
     public Map<String, UserInfoWithPhone> queryUserInfo(String systemCode) {
         List<UserInfoWithPhone> userInfos = baseMapper.queryUserInfos(systemCode);
-
         Map<String, UserInfoWithPhone> res = userInfos.stream().filter(action -> StrUtil.isNotEmpty(action.getUserName()))
                 .collect(Collectors.toMap(UserInfoWithPhone::getUserName, Function.identity(), (oldItem, newItem) -> oldItem));
         log.info("查询租户[{}]下有效的用户[{}]个", systemCode, CollUtil.size(res));
         return res;
     }
+
+    /**
+     * 查询用户基础信息
+     * Map<String, String> key 是sys_user 表的userName 字段, value是 sys_user_jzg_info 表的name字段
+     *
+     * @param systemCode 租户代码
+     * @author lipf
+     * @date 2026/7/24 14:10
+     */
+    @Override
+    public Map<String, String> queryUserInfoUserName2Name(String systemCode) {
+        List<UserInfoWithPhone> userInfos = baseMapper.queryUserInfos(systemCode);
+        Map<String, String> res = new HashMap<>();
+        for (UserInfoWithPhone userInfo : userInfos) {
+            res.put(userInfo.getUserName(),userInfo.getName());
+            res.put(userInfo.getMobile(),userInfo.getName());
+        }
+        return res;
+    }
+
+    /**
+     * 根据用户姓名查询用户的手机号
+     *
+     * @param userName 用户名
+     * @return List<String> 用户姓名列表
+     * @author lipf
+     * @date 2026/8/13 14:36
+     */
+    @Override
+    public List<String> queryPhonesByUserName(String userName) {
+        LambdaQueryWrapper<SysUserJzgInfo> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(SysUserJzgInfo::getName,userName);
+        List<SysUserJzgInfo> sysUserJzgInfos = baseMapper.selectList(queryWrapper);
+        if(CollUtil.isEmpty(sysUserJzgInfos)){
+            return Collections.emptyList();
+        }
+        List<String> phones = new ArrayList<>();
+        for (SysUserJzgInfo sysUserJzgInfo : sysUserJzgInfos) {
+            SysUser sysUser = sysUserMapper.selectById(sysUserJzgInfo.getUserId());
+            if(sysUser !=  null){
+                phones.add(sysUser.getUsername());
+            }
+        }
+        return phones;
+    }
 }

+ 15 - 13
tenant/organization/src/main/java/com/jzg/organization/service/impl/SysUserServiceImpl.java

@@ -1347,19 +1347,21 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     @Override
     public SalesmanVo getUserInfoBySystemCodeAndUserId(String userId) {
         SalesmanVo salesmanVo = sysUserJzgInfoMapper.getUserInfoBySystemCodeAndUserId(userId);
-        String leaderId = salesmanVo.getLeaderId();
-        if(StrUtil.isEmpty(leaderId)){
-            return salesmanVo;
-        }
-        SysUserJzgInfo sysUserJzgInfo = sysUserJzgInfoMapper.selectById(leaderId);
-        if(sysUserJzgInfo == null){
-            return salesmanVo;
-        }
-        String leaderUserId = sysUserJzgInfo.getUserId();
-        salesmanVo.setRealQuoteUserManagerId(leaderUserId);
-        SysUser sysUser = sysUserMapper.selectById(leaderUserId);
-        if(sysUser != null){
-            salesmanVo.setRealQuoteUserManagerUseName(sysUser.getUsername());
+        if(Objects.nonNull(salesmanVo)){
+            String leaderId = salesmanVo.getLeaderId();
+            if(StrUtil.isEmpty(leaderId)){
+                return salesmanVo;
+            }
+            SysUserJzgInfo sysUserJzgInfo = sysUserJzgInfoMapper.selectById(leaderId);
+            if(sysUserJzgInfo == null){
+                return salesmanVo;
+            }
+            String leaderUserId = sysUserJzgInfo.getUserId();
+            salesmanVo.setRealQuoteUserManagerId(leaderUserId);
+            SysUser sysUser = sysUserMapper.selectById(leaderUserId);
+            if(sysUser != null){
+                salesmanVo.setRealQuoteUserManagerUseName(sysUser.getUsername());
+            }
         }
         return salesmanVo;
     }

+ 26 - 3
tenant/organization/src/main/resources/mapper/PtlAgreementCostMapper.xml

@@ -357,6 +357,8 @@
 
     <select id="pageList" resultMap="CostManagementVoMap">
         SELECT
+            pc.audit_time,
+            pc.audit_person,
             pc.product_id,
             pc.product_name,
             pc.cost_rules,
@@ -400,6 +402,24 @@
         LEFT JOIN esm_ins_company eic on eic.id = pa.company_id  AND eic.is_delete = 0
         <where>
             pc.is_delete = 0
+            <if test="costParam.phones != null and costParam.phones.size() > 0 ">
+                and pc.audit_person in
+                <foreach collection="costParam.phones" separator="," open="(" close=")" item="phone">
+                    #{phone}
+                </foreach>
+            </if>
+            <if test="costParam.auditTimeBegin != null and costParam.auditTimeBegin != ''">
+                and pc.audit_time &gt;= #{costParam.auditTimeBegin}
+            </if>
+            <if test="costParam.auditTimeEnd != null and costParam.auditTimeEnd != ''">
+                and pc.audit_time &lt; #{costParam.auditTimeEnd}
+            </if>
+            <if test="costParam.companyIdList != null and costParam.companyIdList.size() >0">
+                and pa.partner_company_id in
+                <foreach collection="costParam.companyIdList" item="partnerCompnayId" open="(" close=")" separator=",">
+                    #{partnerCompnayId}
+                </foreach>
+            </if>
             <if test="costParam.agreement != null and costParam.agreement != ''">
                 AND (pa.agreement_title  like concat('%',#{costParam.agreement},'%') or
                 pa.agreement_code  like concat('%',#{costParam.agreement},'%') or
@@ -426,15 +446,18 @@
                     AND pr_raw.rule_description LIKE concat('%',#{costParam.rulesName},'%')
                 )
             </if>
-            <if test="costParam.costRules != null and costParam.costRules != ''">
-                AND pc.cost_describe like concat('%',#{costParam.costRules},'%')
-            </if>
             <if test="costParam.costRulesList != null and costParam.costRulesList.size() > 0">
                 AND
                 <foreach collection="costParam.costRulesList" item="keyword" separator="AND">
                     pc.cost_describe LIKE CONCAT('%', #{keyword}, '%')
                 </foreach>
             </if>
+            <if test="costParam.costRules != null and costParam.costRules.length > 0">
+                AND
+                <foreach collection="costParam.costRules" item="keyword" separator="AND">
+                    pc.cost_rules LIKE CONCAT('%', #{keyword}, '%')
+                </foreach>
+            </if>
             <if test="costParam.agreementStatus != null and costParam.agreementStatus != ''">
                 AND pc.is_enabled = #{costParam.agreementStatus}
             </if>

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

@@ -6,7 +6,7 @@
 
     <resultMap id="ActionMap" type="com.jzg.commons.entity.agreement.dispatch.dto.PtlAgreementDispatchAfterAction">
         <id property="id" column="id"/>
-        <result property="companyId" column="companyId"/>
+        <result property="companyId" column="company_id"/>
         <result property="actionCode" column="action_code"/>
         <result property="actionJson" column="action_json"
                 typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>

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

@@ -378,7 +378,7 @@
             AND ipi.license_no LIKE CONCAT('%', #{receivableQueryVo.licenseNo}, '%')
         </if>
         <if test="receivableQueryVo.companyId != null and receivableQueryVo.companyId != ''">
-            AND ipi.company_id = #{receivableQueryVo.companyId}
+            AND (ipi.partner_company_id = #{receivableQueryVo.companyId} or ipi.company_id = #{receivableQueryVo.companyId})
         </if>
         <if test="receivableQueryVo.businessSource != null and receivableQueryVo.businessSource != ''">
             AND ipi.business_source = #{receivableQueryVo.businessSource}
@@ -723,7 +723,7 @@
                 </foreach>
             </if>
             <if test="settlementQueryVo.contactPerson != null and settlementQueryVo.contactPerson != ''">
-                AND io.contact_person = #{settlementQueryVo.contactPerson}
+                AND io.docking_person = #{settlementQueryVo.contactPerson}
             </if>
             <if test="settlementQueryVo.invoiceTypes != null and settlementQueryVo.invoiceTypes != ''">
                 AND ipii.invoice_type IN
@@ -1971,9 +1971,8 @@
             <if test="settlementReportQueryVo.receiver != null and settlementReportQueryVo.receiver != ''">
                 AND ipi.contact_person = #{settlementReportQueryVo.receiver}
             </if>
-            <if test="settlementReportQueryVo.startTime != null and settlementReportQueryVo.startTime != ''">
-                AND ipi.signing_time BETWEEN #{settlementReportQueryVo.startTime} AND #{settlementReportQueryVo.endTime}
-                AND (ipii.invoice_time BETWEEN #{settlementReportQueryVo.startTime} AND #{settlementReportQueryVo.endTime}
+            <if test="settlementReportQueryVo.startTime != null and settlementReportQueryVo.startTime != '' and settlementReportQueryVo.endTime != null and settlementReportQueryVo.endTime != ''">
+                AND ((ipii.invoice_time BETWEEN #{settlementReportQueryVo.startTime} AND #{settlementReportQueryVo.endTime})
                 OR ipii.invoice_time IS NULL)
             </if>
         </where>

+ 2 - 1
tenant/organization/src/main/resources/mapper/SysUserJzgInfoMapper.xml

@@ -499,9 +499,10 @@
         suji.id as jzg_info_id,
         suji.system_code,
         su.username ,
+        su.mobile,
         suji.name ,
         suji.dept_id ,
-        sd.name
+        sd.name as deptName
         from
         sys_user su
         left join sys_user_jzg_info suji on