Browse Source

pms 设置任务设备 责任人 逻辑优化

zhangcl 2 tuần trước cách đây
mục cha
commit
10e5c8a882

+ 3 - 3
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/job/dailyreport/CreateFiveDailyReportOrderJob.java

@@ -104,7 +104,7 @@ public class CreateFiveDailyReportOrderJob implements JobHandler {
         if (CollUtil.isNotEmpty(qualifiedTasks)) {
             qualifiedTasks.forEach(task -> {
                 // 查询当前任务的 工单填报人
-                Set<Long> submitterIds = task.getSubmitter();
+                Set<Long> submitterIds = task.getResponsiblePerson();
                 Set<Long> teamDeptIds = task.getDeptIds();
                 if (CollUtil.isNotEmpty(submitterIds)) {
                     // 查询工单填报人所在部门
@@ -129,7 +129,7 @@ public class CreateFiveDailyReportOrderJob implements JobHandler {
             Map<Long, DeptDO> deptPair = deptService.getDeptMap(teamDepartmentIds);
             // 以任务为维度 生成 5#国 日报 部门为任务配置的工单填报人对应的部门
             qualifiedTasks.forEach(task -> {
-                if (!taskIds.contains(task.getId()) && CollUtil.isNotEmpty(task.getSubmitter())) {
+                if (!taskIds.contains(task.getId()) && CollUtil.isNotEmpty(task.getResponsiblePerson())) {
                     // 生成当天的日报
                     IotFiveDailyReportDO report = new IotFiveDailyReportDO();
                     if (taskSubmitterPair.containsKey(task.getId())) {
@@ -167,7 +167,7 @@ public class CreateFiveDailyReportOrderJob implements JobHandler {
                     report.setEndTime(LocalTime.of(8, 0, 0));
                     report.setConstructionStartDate(dailyReportStartTime);
                     report.setConstructionEndDate(dailyReportEndTime);
-                    Set<Long> submitters = task.getSubmitter();
+                    Set<Long> submitters = task.getResponsiblePerson();
                     report.setCreator(String.valueOf(new ArrayList<>(submitters).get(0)));
                     report.setCreateTime(LocalDateTime.now());
                     reports.add(report);

+ 7 - 3
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/IotDeviceServiceImpl.java

@@ -709,14 +709,18 @@ public class IotDeviceServiceImpl implements IotDeviceService {
         Long deptId = reqVO.getDeptId();
         List<IotDeviceDO> rdDevices = new ArrayList<>();
         if (CollUtil.isNotEmpty(reqVO.getDeptIds()) && ObjUtil.isNotEmpty(deptId)) {
-            // 查询选择的部门 选择的部门所属的公司 属于 瑞都 163l 则查询所有瑞都下的设备
+            // 查询选择的部门 选择的部门所属的公司 属于 瑞都 or 5#国 则查询所有 瑞都 or 5#国 下的设备
             // 但是 所选队伍 下的所有设备 需要显示在列表最上面
             List<Long> deptIds = reqVO.getDeptIds();
             Long randomDeptId = deptIds.get(0);
+            Set<Long> childDeptIds = new HashSet<>();
             // 查询 瑞都下的所有 部门
-            Set<Long> childDeptIds = deptService.getChildDeptIdListFromCache(deptId);
+            if (deptId == 163l || deptId == 388l) {
+                Set<Long> tempChildDeptIds = deptService.getChildDeptIdListFromCache(deptId);
+                childDeptIds.addAll(tempChildDeptIds);
+            }
             if (childDeptIds.contains(randomDeptId)) {
-                // 施工队伍 属于 瑞都 163l 则查询所有瑞都下的设备
+                // 施工队伍 属于 瑞都 or 5#国  则查询 瑞都 or 5#国 的设备
                 reqVO.setDeptIds(new ArrayList<>(childDeptIds));
                 // 查询所选施工队伍下所有设备
                 IotDevicePageReqVO rdReqVO = new IotDevicePageReqVO();

+ 11 - 5
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java

@@ -725,15 +725,21 @@ public class AdminUserServiceImpl implements AdminUserService {
         if (CollUtil.isEmpty(reqDeptIds)) {
             throw exception(DEPT_NOT_FOUND);
         }
+        // 需要查询的公司id 任务所属公司id
+        Long deptId = reqVO.getDeptId();
         Long randomDeptId = reqDeptIds.get(0);
         DeptListReqVO deptListReqVO = new DeptListReqVO();
         deptListReqVO.setDeptIds(reqVO.getDeptIds());
         List<Long> deptIds = new ArrayList<>();
         // 瑞都施工队伍
         List<Long> rdDeptIds = new ArrayList<>();
-        // 查询 瑞都下的所有 部门
-        Set<Long> childDeptIds = deptService.getChildDeptIdListFromCache(163l);
-        childDeptIds.add(163l);
+        // 查询 瑞都 or 5#公司 下的所有 部门
+        Set<Long> childDeptIds = new HashSet<>();
+        if (ObjUtil.isNotEmpty(deptId) && (deptId == 163l || deptId == 388l)) {
+            Set<Long> tempChildDeptIds = deptService.getChildDeptIdListFromCache(deptId);
+            childDeptIds.addAll(tempChildDeptIds);
+            childDeptIds.add(deptId);
+        }
         if (childDeptIds.contains(randomDeptId)) {
             // 瑞都下的部门 队伍 施工队伍包含的用户显示到设备列表前面
             deptIds = new ArrayList<>(childDeptIds);
@@ -751,10 +757,10 @@ public class AdminUserServiceImpl implements AdminUserService {
                     resultUsers.set(users);
                 }
                 if (childDeptIds.contains(randomDeptId)) {
-                    // 如果是瑞都任务 施工队伍包含的用户显示到设备列表前面
+                    // 如果是 瑞都 or 5#公司 任务 施工队伍包含的用户显示到设备列表前面
                     List<AdminUserDO> rdUsers = userMapper.selectSimpleList(finalRdDeptIds);
                     if (CollUtil.isNotEmpty(users) && CollUtil.isNotEmpty(rdUsers)) {
-                        // 提取rdUsers的id集合(快速判断)
+                        // 提取 rdUsers  id 集合(快速判断)
                         Set<Long> rdUserIds = rdUsers.stream()
                                 .map(AdminUserDO::getId)
                                 .collect(Collectors.toSet());