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

报价页面费用审核查询条件前后端联调

lipf 1 месяц назад
Родитель
Сommit
bc69aa9107

+ 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/PtlAgreementCostParam.java

@@ -15,6 +15,9 @@ public class PtlAgreementCostParam extends PageRequest {
     @Schema(description = "审核人")
     private String auditPerson;
 
+    @Schema(description = "审核人的登录手机号,对应sysUser表的userName")
+    private List<String> phones;
+
     @Schema(description = "输入代码,名称,简称查找")
     private String agreement;
 

+ 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;
+
 
 }

+ 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));
+    }
 
 }

+ 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);
+
 }

+ 22 - 17
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;
@@ -48,10 +48,7 @@ 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;
@@ -99,6 +96,8 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
 
     @Autowired
     private PtlAgreementService ptlAgreementService;
+    @Autowired
+    private SysUserJzgInfoService sysUserJzgInfoService;
 
     /**
      * 报价配置/费用管理/新增费用
@@ -384,22 +383,27 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
     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")));
-        }
+//        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()){
@@ -408,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);
     }

+ 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;
+    }
 }

+ 7 - 2
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,8 +402,11 @@
         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.auditPerson != null and costParam.auditPerson != '' ">
-                and pc.audit_person = #{costParam.auditPerson}
+            <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}

+ 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