|
|
@@ -35,8 +35,10 @@ import com.platform.dao.mapper.sb.SbInfoMapper;
|
|
|
import com.platform.dao.mapper.sb.SbPositionMapper;
|
|
|
import com.platform.dao.mapper.upms.SysFileMapper;
|
|
|
import com.platform.dao.util.CustomExcelImportUtil;
|
|
|
+import com.platform.dao.vo.SysUserDeptVO;
|
|
|
import com.platform.dao.vo.SysUserVO;
|
|
|
import com.platform.dao.vo.query.check.*;
|
|
|
+import com.platform.dao.vo.query.upms.SysDeptVO;
|
|
|
import com.platform.dao.vo.report.CheckItemVO;
|
|
|
import com.platform.dao.vo.report.CheckJobReportVO;
|
|
|
import com.platform.dao.vo.report.CheckJobReportWeekHoursVO;
|
|
|
@@ -490,6 +492,8 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
// checkJobDTO.setSearchEndTime(LocalDateTime.parse(lastDay, df));
|
|
|
}
|
|
|
checkJobDTO.setCheckUserId(userInfo.getUserId());
|
|
|
+ // 班组任务可见性:包含用户所属部门及所有上级部门ID
|
|
|
+ fillCheckDeptIds(checkJobDTO, userInfo);
|
|
|
checkJobDTO.setType(2);
|
|
|
List<Integer> statusList = new ArrayList<>();
|
|
|
statusList.add(CheckJobStatusEnum.NOT_EXECUTE.getValue());
|
|
|
@@ -579,6 +583,9 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
String superUser = ConfigCache.getLabelByValue(SysConfigEnum.CHECK_JOB_SUPER_USER.name());
|
|
|
if (superUser != null && Arrays.asList(superUser.split(",")).contains(userInfo.getUsername())) {
|
|
|
model.setCheckUserId(null);
|
|
|
+ } else {
|
|
|
+ // 班组任务可见性:获取用户所属部门及所有上级部门ID,用于匹配班组任务的checkDeptId
|
|
|
+ fillCheckDeptIds(model, userInfo);
|
|
|
}
|
|
|
|
|
|
// 修复分页重复:先分页获取任务ID,再根据ID查询完整数据
|
|
|
@@ -635,6 +642,42 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 填充班组任务可见性所需的部门链:用户所属部门 + 所有上级部门ID。
|
|
|
+ * 查询任务时,任务的 check_dept_id 命中该链中任意部门,用户即可看到该班组任务,
|
|
|
+ * 因此选择上级部门时,其所有下级部门的人员也能看到并执行任务。
|
|
|
+ *
|
|
|
+ * @param model 查询条件
|
|
|
+ * @param userInfo 当前用户
|
|
|
+ */
|
|
|
+ private void fillCheckDeptIds(CheckJobDTO model, UserInfo userInfo) {
|
|
|
+ try {
|
|
|
+ SysUserDeptVO userDept = com.platform.dao.util.UserUtil.getUserDeptAllowNull(userInfo);
|
|
|
+ if (userDept == null) {
|
|
|
+ log.warn("fillCheckDeptIds: 用户 {} 未关联部门,班组任务将不可见", userInfo.getUserId());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<String> deptIds = new ArrayList<>();
|
|
|
+ deptIds.add(userDept.getDeptId());
|
|
|
+ log.info("fillCheckDeptIds: 用户 {} 所属部门 {}", userInfo.getUserId(), userDept.getDeptId());
|
|
|
+ // 获取所有上级部门(班组→项目部→分公司→集团)
|
|
|
+ com.platform.dao.dto.upms.SysDeptDTO deptQuery = new com.platform.dao.dto.upms.SysDeptDTO();
|
|
|
+ deptQuery.setDescendant(userDept.getDeptId());
|
|
|
+ com.platform.dao.mapper.upms.SysDeptRelationMapper deptRelationMapper =
|
|
|
+ com.platform.common.util.SpringContextHolder.getBean(com.platform.dao.mapper.upms.SysDeptRelationMapper.class);
|
|
|
+ List<SysDeptVO> parentDepts = deptRelationMapper.allParentList(deptQuery);
|
|
|
+ if (!CollectionUtils.isEmpty(parentDepts)) {
|
|
|
+ for (SysDeptVO dept : parentDepts) {
|
|
|
+ deptIds.add(dept.getDeptId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ log.info("fillCheckDeptIds: 用户 {} 部门链 {}", userInfo.getUserId(), deptIds);
|
|
|
+ model.setCheckDeptIds(deptIds);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("获取用户部门层级失败,班组任务可能不可见: {}", e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 获取当日移动端现场任务:当日的任务:主要是现场人员的任务
|
|
|
* <p>
|
|
|
* 如果有sbId,则说明是查询某一台设备的任务,需要查询设备的显示使用人员账号
|
|
|
@@ -690,7 +733,10 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
model.setSearchEndTime(DateUtils.getLastDayOfThisMonth());
|
|
|
if (model.getStandardLevel() == null) {
|
|
|
if (!SecurityUtils.isRole(SysRoleCodeEnum.MM.name())) {
|
|
|
- model.setCheckUserId(SecurityUtils.getUserInfo().getUserId());
|
|
|
+ UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
+ model.setCheckUserId(userInfo.getUserId());
|
|
|
+ // 班组任务可见性:包含用户所属部门及所有上级部门ID
|
|
|
+ fillCheckDeptIds(model, userInfo);
|
|
|
}
|
|
|
}
|
|
|
List<Integer> statusList = new ArrayList<Integer>();
|
|
|
@@ -712,6 +758,8 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
if (model.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == model.getFilter().intValue()) {
|
|
|
UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
model.setCheckUserId(userInfo.getUserId());
|
|
|
+ // 班组任务可见性:包含用户所属部门及所有上级部门ID
|
|
|
+ fillCheckDeptIds(model, userInfo);
|
|
|
}
|
|
|
if (model.getSearchMonth() != null) {
|
|
|
LocalDate firstDay = model.getSearchMonth().with(TemporalAdjusters.firstDayOfMonth());
|
|
|
@@ -795,6 +843,8 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
if (model.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == model.getFilter().intValue()) {
|
|
|
UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
model.setCheckUserId(userInfo.getUserId());
|
|
|
+ // 班组任务可见性:包含用户所属部门及所有上级部门ID
|
|
|
+ fillCheckDeptIds(model, userInfo);
|
|
|
}
|
|
|
if (model.getSearchMonth() != null) {
|
|
|
LocalDate firstDay = model.getSearchMonth().with(TemporalAdjusters.firstDayOfMonth());
|
|
|
@@ -823,6 +873,8 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
if (model.getFilter() != null && DataFilterTypeEnum.SELF.getValue() == model.getFilter().intValue()) {
|
|
|
UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
model.setCheckUserId(userInfo.getUserId());
|
|
|
+ // 班组任务可见性:包含用户所属部门及所有上级部门ID
|
|
|
+ fillCheckDeptIds(model, userInfo);
|
|
|
}
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
AbstractPageResultBean<CheckJob> pageInfo = new MyPage(mapper.selectList(model));
|
|
|
@@ -1570,6 +1622,8 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
UserInfo userInfo = SecurityUtils.getUser().getUserInfo();
|
|
|
checkJob.setUpdateUserId(userInfo.getUserId());
|
|
|
checkJob.setUpdateUserName(userInfo.getUsername());
|
|
|
+ // 记录实际执行人:接收任务时确定由谁执行该任务(班组模式下尤其重要)
|
|
|
+ checkJob.setActualUser(userInfo.getRealName());
|
|
|
}
|
|
|
mapper.updateByPrimaryKeySelective(checkJob);
|
|
|
}
|
|
|
@@ -1679,6 +1733,7 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
nextCheckJob.setSbId(checkStandard.getSbId());
|
|
|
nextCheckJob.setReceiveOvertime(false);
|
|
|
nextCheckJob.setCheckUserId(checkJob.getCheckUserId());
|
|
|
+ nextCheckJob.setCheckDeptId(checkJob.getCheckDeptId());
|
|
|
nextCheckJob.setPartId(checkStandard.getPart());
|
|
|
nextCheckJob.setStandardId(checkStandard.getId());
|
|
|
nextCheckJob.setType(checkStandard.getType());
|
|
|
@@ -1708,8 +1763,11 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
String savePeriod = "一年";
|
|
|
// 维保工时
|
|
|
String wbHours = detail.getRealHours();
|
|
|
- // 维保人员
|
|
|
+ // 维保人员:班组任务无指定点检人,回退使用实际执行人
|
|
|
String wbUser = detail.getCheckUserName();
|
|
|
+ if (StringUtils.isBlank(wbUser)) {
|
|
|
+ wbUser = checkJob.getActualUser();
|
|
|
+ }
|
|
|
|
|
|
// 根据标准 id 查询保养项集合
|
|
|
List<CheckRequirement> dbRequirementList = requirementMapper.selectByStandardId(checkJob.getStandardId());
|
|
|
@@ -2068,6 +2126,7 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
nextCheckJob.setCreatedTime(LocalDateTime.now());
|
|
|
nextCheckJob.setSbId(checkStandard.getSbId());
|
|
|
nextCheckJob.setCheckUserId(checkJob.getCheckUserId());
|
|
|
+ nextCheckJob.setCheckDeptId(checkJob.getCheckDeptId());
|
|
|
nextCheckJob.setPartId(checkStandard.getPart());
|
|
|
nextCheckJob.setStandardId(checkStandard.getId());
|
|
|
nextCheckJob.setType(checkStandard.getType());
|