Explorar el Código

Merge remote-tracking branch 'origin/master'

luolinsong hace 3 días
padre
commit
2a0357c8a4

+ 21 - 2
fs-service/src/main/java/com/fs/qw/service/impl/QwUserVoiceLogServiceImpl.java

@@ -6,6 +6,7 @@ import com.fs.company.domain.CompanyDept;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.mapper.CompanyDeptMapper;
 import com.fs.company.mapper.CompanyUserMapper;
+import com.fs.company.service.impl.CompanyDeptServiceImpl;
 import com.fs.qw.domain.*;
 import com.fs.qw.mapper.QwExternalContactMapper;
 import com.fs.qw.mapper.QwUserMapper;
@@ -55,6 +56,9 @@ public class QwUserVoiceLogServiceImpl extends ServiceImpl<QwUserVoiceLogMapper,
     @Autowired
     private CompanyDeptMapper companyDeptMapper;
 
+    @Autowired
+    private CompanyDeptServiceImpl companyDeptService;
+
     /**
      * 查询企微用户通话记录
      *
@@ -141,10 +145,25 @@ public class QwUserVoiceLogServiceImpl extends ServiceImpl<QwUserVoiceLogMapper,
 
             // 如果有部门过滤条件,则预先过滤用户列表
             if (qwUserVoiceLog.getDeptId() != null) {
-                Set<Long> deptIds = companyDeptMapper.selectChildrenDeptById(qwUserVoiceLog.getDeptId()).stream().map(CompanyDept::getDeptId).collect(Collectors.toSet());
+
+                Set<Long> combinedList= new HashSet<>();
+                 //查询的部门
+                Long deptId = qwUserVoiceLog.getDeptId();
+
+                if (deptId!=null){
+                    combinedList.add(deptId);
+                }
+
+                //本部门的全部下级部门
+                List<Long> deptList = companyDeptService.getCurrentDeptIdDownTreeIds(deptId);
+                if (!deptList.isEmpty()){
+                    combinedList.addAll(deptList);
+                }
+
+//                Set<Long> deptIds = companyDeptMapper.selectChildrenDeptById(qwUserVoiceLog.getDeptId()).stream().map(CompanyDept::getDeptId).collect(Collectors.toSet());
                 companyUserMap.entrySet().removeIf(entry ->
                         entry.getValue().getDeptId() == null ||
-                                !deptIds.contains(entry.getValue().getDeptId()));//需要deptId及其下级的部门
+                                !combinedList.contains(entry.getValue().getDeptId()));//需要deptId及其下级的部门
 //                                !entry.getValue().getDeptId().equals(qwUserVoiceLog.getDeptId()));
             }