chenshudong 4 miesięcy temu
rodzic
commit
f06bffb9be

+ 24 - 24
airport-check/src/main/java/com/sundot/airport/check/service/impl/CheckRecordServiceImpl.java

@@ -7,9 +7,7 @@ import java.util.Objects;
7 7
 import java.util.stream.Collectors;
8 8
 
9 9
 import cn.hutool.core.collection.CollUtil;
10
-import cn.hutool.core.collection.CollectionUtil;
11 10
 import cn.hutool.core.util.ObjUtil;
12
-import cn.hutool.core.util.StrUtil;
13 11
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
14 12
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
15 13
 import com.sundot.airport.check.domain.CheckCorrection;
@@ -19,17 +17,16 @@ import com.sundot.airport.check.service.ICheckCorrectionService;
19 17
 import com.sundot.airport.check.service.ICheckProjectItemService;
20 18
 import com.sundot.airport.check.service.ICheckUserService;
21 19
 import com.sundot.airport.common.constant.Constants;
22
-import com.sundot.airport.common.core.domain.entity.SysDept;
23 20
 import com.sundot.airport.common.core.domain.entity.SysUser;
24 21
 import com.sundot.airport.common.core.redis.RedisSerialGenerator;
25 22
 import com.sundot.airport.common.domain.BaseAttachment;
23
+import com.sundot.airport.common.dto.DeptInfo;
26 24
 import com.sundot.airport.common.enums.BaseAttachmentSourceTypeEnum;
27 25
 import com.sundot.airport.common.enums.CheckLevelEnum;
28 26
 import com.sundot.airport.common.enums.CheckProjectItemTypeEnum;
29 27
 import com.sundot.airport.common.enums.CheckRecordStatusEnum;
30 28
 import com.sundot.airport.common.enums.CheckScoreLevelEnum;
31 29
 import com.sundot.airport.common.enums.CheckUserTypeEnum;
32
-import com.sundot.airport.common.enums.DeptType;
33 30
 import com.sundot.airport.common.exception.ServiceException;
34 31
 import com.sundot.airport.common.service.IBaseAttachmentService;
35 32
 import com.sundot.airport.common.utils.DateUtils;
@@ -400,34 +397,37 @@ public class CheckRecordServiceImpl extends ServiceImpl<CheckRecordMapper, Check
400 397
             if (Objects.isNull(sysUser.getDeptId())) {
401 398
                 throw new ServiceException("被检查人员[" + userId + "]所属部门为空");
402 399
             }
403
-            List<SysDept> deptList = deptService.selectAllDept(sysUser.getDeptId());
404
-            if (CollectionUtil.isEmpty(deptList)) {
405
-                throw new ServiceException("被检查人员[" + userId + "]所属部门上下级为空");
406
-            }
407
-            SysDept teams = deptList.stream().filter(x -> StrUtil.equals(DeptType.TEAMS.getCode(), x.getDeptType())).findFirst().orElse(null);
408
-            SysDept department = deptList.stream().filter(x -> StrUtil.equals(DeptType.MANAGER.getCode(), x.getDeptType())).findFirst().orElse(null);
409
-            SysDept brigade = deptList.stream().filter(x -> StrUtil.equals(DeptType.BRIGADE.getCode(), x.getDeptType())).findFirst().orElse(null);
410
-            SysDept station = deptList.stream().filter(x -> StrUtil.equals(DeptType.STATION.getCode(), x.getDeptType())).findFirst().orElse(null);
411
-
412
-            if (Objects.isNull(teams)) {
400
+            DeptInfo deptInfo = deptService.getDeptInfoByDeptId(sysUser.getDeptId());
401
+            if (Objects.isNull(deptInfo.getTeamId())) {
413 402
                 throw new ServiceException("被检查人员[" + userId + "]所属班组信息为空");
414 403
             }
415
-            if (Objects.isNull(department)) {
404
+            if (Objects.isNull(deptInfo.getDepartmentId())) {
416 405
                 throw new ServiceException("被检查人员[" + userId + "]所属主管信息为空");
417 406
             }
418
-            if (Objects.isNull(brigade)) {
407
+            if (Objects.isNull(deptInfo.getBrigadeId())) {
419 408
                 throw new ServiceException("被检查人员[" + userId + "]所属大队信息为空");
420 409
             }
421
-            if (Objects.isNull(station)) {
410
+            if (Objects.isNull(deptInfo.getStationId())) {
422 411
                 throw new ServiceException("被检查人员[" + userId + "]所属机构站信息为空");
423 412
             }
424
-
425
-            checkRecord.setCheckedBrigadeId(brigade.getDeptId());
426
-            checkRecord.setCheckedBrigadeName(brigade.getDeptName());
427
-            checkRecord.setCheckedDepartmentId(department.getDeptId());
428
-            checkRecord.setCheckedDepartmentName(department.getDeptName());
429
-            checkRecord.setCheckedTeamId(teams.getDeptId());
430
-            checkRecord.setCheckedTeamName(teams.getDeptName());
413
+            checkRecord.setCheckedBrigadeId(deptInfo.getBrigadeId());
414
+            checkRecord.setCheckedBrigadeName(deptInfo.getBrigadeName());
415
+            checkRecord.setCheckedDepartmentId(deptInfo.getDepartmentId());
416
+            checkRecord.setCheckedDepartmentName(deptInfo.getDepartmentName());
417
+            checkRecord.setCheckedTeamId(deptInfo.getTeamId());
418
+            checkRecord.setCheckedTeamName(deptInfo.getTeamName());
419
+        } else {
420
+            Long deptId = checkRecord.getCheckedDeptId();
421
+            if (Objects.isNull(deptId)) {
422
+                throw new ServiceException("请选择被检查部门");
423
+            }
424
+            DeptInfo deptInfo = deptService.getDeptInfoByDeptId(deptId);
425
+            checkRecord.setCheckedBrigadeId(deptInfo.getBrigadeId());
426
+            checkRecord.setCheckedBrigadeName(deptInfo.getBrigadeName());
427
+            checkRecord.setCheckedDepartmentId(deptInfo.getDepartmentId());
428
+            checkRecord.setCheckedDepartmentName(deptInfo.getDepartmentName());
429
+            checkRecord.setCheckedTeamId(deptInfo.getTeamId());
430
+            checkRecord.setCheckedTeamName(deptInfo.getTeamName());
431 431
         }
432 432
     }
433 433
 

+ 58 - 0
airport-common/src/main/java/com/sundot/airport/common/dto/DeptInfo.java

@@ -0,0 +1,58 @@
1
+package com.sundot.airport.common.dto;
2
+
3
+import lombok.Data;
4
+
5
+import java.io.Serializable;
6
+
7
+/**
8
+ * 部门信息
9
+ *
10
+ * @Author: wangchong
11
+ * @Date: 2025/7/11 14:19
12
+ **/
13
+@Data
14
+public class DeptInfo implements Serializable {
15
+
16
+    private static final long serialVersionUID = 1L;
17
+
18
+    /**
19
+     * 班组 id
20
+     */
21
+    private Long teamId;
22
+
23
+    /**
24
+     * 班组名称
25
+     */
26
+    private String teamName;
27
+
28
+    /**
29
+     * 部门 id
30
+     */
31
+    private Long departmentId;
32
+
33
+    /**
34
+     * 部门名称
35
+     */
36
+    private String departmentName;
37
+
38
+    /**
39
+     * 大队 id
40
+     */
41
+    private Long brigadeId;
42
+
43
+    /**
44
+     * 大队名称
45
+     */
46
+    private String brigadeName;
47
+
48
+    /**
49
+     * 机构站 id
50
+     */
51
+    private Long stationId;
52
+
53
+    /**
54
+     * 机构站名称
55
+     */
56
+    private String stationName;
57
+
58
+}