|
|
@@ -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
|
|