Browse Source

有效面谈逻辑修改

anderx 9 months ago
parent
commit
e5322e5c12

+ 8 - 1
src/main/java/com/goafanti/common/mapper/UserFirstInterviewMapper.xml

@@ -132,7 +132,14 @@
         select
         <include refid="UserFirstInterviewAllSql"/>
         from user_first_interview
-        where uid = #{uid} and aid = #{aid}
+        <where>
+            <if test="id != null">
+                and id = #{id}
+            </if>
+            <if test="uid != null and uid != ''">
+                and uid = #{uid}
+            </if>
+        </where>
     </select>
 
 </mapper>

+ 27 - 3
src/main/java/com/goafanti/customer/service/impl/UserArchivesServiceImpl.java

@@ -1,5 +1,6 @@
 package com.goafanti.customer.service.impl;
 
+import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.model.*;
 import com.goafanti.common.utils.excel.NewExcelUtil;
@@ -76,6 +77,11 @@ public class UserArchivesServiceImpl extends BaseMybatisDao< UserArchivesMapper>
 
     @Override
     public Object queryByUidAll(String id) {
+        //查询等级 0=自己 1=全部
+        int type=0;
+        if (TokenManager.hasRole(AFTConstants.SUPERADMIN)){
+            type=1;
+        }
         UserArchivesDetails user = customerService.selectUserByUid(id);
         User u = userMapper.queryById(id);
         OrganizationIdentity ori = organizationIdentityMapper.selectOrgIdentityByUserId(id);
@@ -99,15 +105,33 @@ public class UserArchivesServiceImpl extends BaseMybatisDao< UserArchivesMapper>
             user.setContactList(collect);
         }
         BeanUtils.copyProperties(userArchives, user);
-        List<UserArchivesInterview> userArchivesInterviews = userArchivesInterviewMapper.selectByUidAid(id, TokenManager.getAdminId());
+        List<UserArchivesInterview> userArchivesInterviews;
+        if (type==0){
+            userArchivesInterviews = userArchivesInterviewMapper.selectByUidAid(id, TokenManager.getAdminId());
+            user.setInterviewList(userArchivesInterviews);
+        }else {
+            userArchivesInterviews = userArchivesInterviewMapper.selectByUidAid(id, TokenManager.getAdminId());
+        }
         user.setInterviewList(userArchivesInterviews);
+
+
         //获取首次面谈时间
-        List<UserFirstInterview> firstList = userFirstInterviewMapper.selectByUidAid(id, TokenManager.getAdminId());
+        List<UserFirstInterview> firstList;
+        if (type == 0){
+            firstList = userFirstInterviewMapper.selectByUidAid(id, TokenManager.getAdminId());
+        }else {
+            firstList = userFirstInterviewMapper.selectByUidAid(id, null);
+        }
         if (!firstList.isEmpty()){
             UserFirstInterview userFirstInterview = firstList.get(0);
             user.setFirstInterviewDate(userFirstInterview.getFirstTime());
         }
-        List<UserInterviewProjectBo> userInterviewProjects = userInterviewProjectMapper.selectByAid(TokenManager.getAdminId(), id);
+        List<UserInterviewProjectBo> userInterviewProjects ;
+        if (type==0){
+            userInterviewProjects =userInterviewProjectMapper.selectByAid(TokenManager.getAdminId(), id);
+        } else {
+            userInterviewProjects =userInterviewProjectMapper.selectByAid(null, id);
+        }
         user.setProjectList(userInterviewProjects);
         return user;
     }