소스 검색

1\任务记录需要增加根据员工手机号搜索

yfh 1 주 전
부모
커밋
eabc53ce0e

+ 4 - 0
fs-service/src/main/java/com/fs/company/mapper/CompanyUserMapper.java

@@ -1,5 +1,7 @@
 package com.fs.company.mapper;
 
+import com.fs.common.annotation.DataSource;
+import com.fs.common.enums.DataSourceType;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.param.CompanyUserAreaParam;
 import com.fs.company.param.CompanyUserQwParam;
@@ -248,4 +250,6 @@ public interface CompanyUserMapper
 
     List<CompanyUser> getAllUserListLimit(@Param("companyId") Long companyId,
                                           @Param("keywords") String keywords);
+    @DataSource(DataSourceType.MASTER)
+    CompanyUser selectCompanyUserByPhone(String phone);
 }

+ 2 - 0
fs-service/src/main/java/com/fs/company/service/ICompanyUserService.java

@@ -144,4 +144,6 @@ public interface ICompanyUserService {
     List<Long> selectUserAllCompanyUserId(Long companyUserId);
 
     List<CompanyUser> getAllUserListLimit(Long companyId, String keywords);
+
+    CompanyUser selectCompanyUserByPhone(String phone);
 }

+ 5 - 0
fs-service/src/main/java/com/fs/company/service/impl/CompanyUserServiceImpl.java

@@ -443,4 +443,9 @@ public class CompanyUserServiceImpl implements ICompanyUserService
     public List<CompanyUser> getAllUserListLimit(Long companyId, String keywords) {
         return companyUserMapper.getAllUserListLimit(companyId,keywords);
     }
+
+    @Override
+    public CompanyUser selectCompanyUserByPhone(String phone) {
+        return companyUserMapper.selectCompanyUserByPhone(phone);
+    }
 }

+ 5 - 0
fs-service/src/main/java/com/fs/sop/params/QwSopLogsParam.java

@@ -51,4 +51,9 @@ public class QwSopLogsParam {
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private String sendTime;
+
+    /**
+     * 手机号
+     */
+    private String phone;
 }

+ 34 - 5
fs-service/src/main/java/com/fs/sop/service/impl/QwSopLogsServiceImpl.java

@@ -1,13 +1,17 @@
 package com.fs.sop.service.impl;
 
 
+import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.redis.RedisCache;
 import com.fs.common.utils.StringUtils;
+import com.fs.company.domain.CompanyUser;
+import com.fs.company.service.ICompanyUserService;
 import com.fs.course.config.CourseConfig;
 import com.fs.course.domain.FsCourseWatchLog;
 import com.fs.course.service.IFsCourseWatchLogService;
+import com.fs.course.service.IFsUserCompanyUserService;
 import com.fs.fastGpt.service.IFastGptChatSessionService;
 import com.fs.qw.domain.QwExternalContact;
 import com.fs.qw.domain.QwUser;
@@ -99,6 +103,9 @@ public class QwSopLogsServiceImpl implements IQwSopLogsService
     @Autowired
     private IFastGptChatSessionService fastGptChatSessionService;
 
+    @Autowired
+    private ICompanyUserService companyUserService;
+
 
     /**
      * 查询企业微信SOP  定时任务
@@ -129,16 +136,38 @@ public class QwSopLogsServiceImpl implements IQwSopLogsService
      */
     @Override
     public List<QwSopLogsListCVO> selectQwSopLogsListBySopId(QwSopLogsParam param) {
+        if (param == null || param.getType() == null) {
+            return Collections.emptyList();
+        }
 
-        switch (param.getType()){
-            //个微
+        switch (param.getType()) {
+            // 个微
             case 1:
                 return qwSopLogsMapper.selectQwSopLogsListByGwSopId(param);
-            //企微
+            // 企微
             case 2:
-                return qwSopLogsMapper.selectQwSopLogsListByQwSopId(param);
+                return handleQwSopLogs(param);
+            default:
+                return Collections.emptyList();
+        }
+    }
+
+    private List<QwSopLogsListCVO> handleQwSopLogs(QwSopLogsParam param) {
+        if (StringUtils.isNotEmpty(param.getPhone())) {
+            try {
+                CompanyUser companyUser = companyUserService.selectCompanyUserByPhone(param.getPhone());
+                if (companyUser == null) {
+                    return Collections.emptyList();
+                }
+                if (StringUtils.isEmpty(param.getQwUserid())) {
+                    param.setQwUserid(companyUser.getQwUserId());
+                }
+            } catch (Exception e) {
+                logger.error("根据手机号查询企业用户出现异常,手机号: {}, 异常信息: {}", param.getPhone(), e.getMessage(), e);
+                return Collections.emptyList();
+            }
         }
-       return null;
+        return qwSopLogsMapper.selectQwSopLogsListByQwSopId(param);
     }
 
 

+ 6 - 0
fs-service/src/main/resources/mapper/company/CompanyUserMapper.xml

@@ -277,6 +277,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
 
+
+    <select id="selectCompanyUserByPhone" resultType="com.fs.company.domain.CompanyUser">
+        select user_id, dept_id, user_name, nick_name, user_type, email, phonenumber, sex, avatar, password, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark, open_id, id_card, company_id, qr_code_weixin, qr_code_wecom, jpush_id, qw_user_id, qw_status, voice_print_url, address_id, `domain`, parent_id, bind_code from company_user where phonenumber=#{phone} and del_flag=0
+    </select>
+
+
     <sql id="selectUserVo">
         select u.user_id,u.qw_user_id,u.company_id,u.voice_print_url, u.dept_id, u.user_name, u.nick_name,
                u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip,