|
|
@@ -144,15 +144,23 @@ public class CreateRdDailyReportOrderJob implements JobHandler {
|
|
|
Set<Long> userIds = new HashSet<>();
|
|
|
List<IotRdDailyReportDO> reports = new ArrayList<>();
|
|
|
Map<Long, Long> taskSubmitterPair = new HashMap<>();
|
|
|
+ // key任务id value施工队伍id
|
|
|
+ Map<Long, Long> taskTeamIdPair = new HashMap<>();
|
|
|
+ Set<Long> teamDepartmentIds = new HashSet<>();
|
|
|
if (CollUtil.isNotEmpty(qualifiedTasks)) {
|
|
|
qualifiedTasks.forEach(task -> {
|
|
|
// 查询当前任务的 工单填报人
|
|
|
Set<Long> submitterIds = task.getSubmitter();
|
|
|
+ Set<Long> teamDeptIds = task.getDeptIds();
|
|
|
if (CollUtil.isNotEmpty(submitterIds)) {
|
|
|
// 查询工单填报人所在部门
|
|
|
userIds.addAll(submitterIds);
|
|
|
taskSubmitterPair.put(task.getId(), new ArrayList<>(submitterIds).get(0));
|
|
|
}
|
|
|
+ if (CollUtil.isNotEmpty(teamDeptIds)) {
|
|
|
+ taskTeamIdPair.put(task.getId(), new ArrayList<>(teamDeptIds).get(0));
|
|
|
+ teamDepartmentIds.addAll(teamDeptIds);
|
|
|
+ }
|
|
|
});
|
|
|
// 查询所有任务配置的工单填报人的信息
|
|
|
Map<Long, AdminUserRespDTO> users = adminUserApi.getUserMap(userIds);
|
|
|
@@ -163,7 +171,8 @@ public class CreateRdDailyReportOrderJob implements JobHandler {
|
|
|
deptIds.add(user.getDeptId());
|
|
|
});
|
|
|
}
|
|
|
- Map<Long, DeptDO> deptPair = deptService.getDeptMap(deptIds);
|
|
|
+ // 查询所有任务施工队伍的 deptId
|
|
|
+ Map<Long, DeptDO> deptPair = deptService.getDeptMap(teamDepartmentIds);
|
|
|
// 以任务为维度 生成瑞都日报 部门为任务配置的工单填报人对应的部门
|
|
|
// todo 任务填报人列表中 如果有人属于队伍上 则 设置日报deptId=队伍id 这样项目部填报人也能看到日报
|
|
|
qualifiedTasks.forEach(task -> {
|
|
|
@@ -174,10 +183,15 @@ public class CreateRdDailyReportOrderJob implements JobHandler {
|
|
|
Long userId = taskSubmitterPair.get(task.getId());
|
|
|
if (users.containsKey(userId)) {
|
|
|
AdminUserRespDTO user = users.get(userId);
|
|
|
- report.setDeptId(user.getDeptId());
|
|
|
+ // 取任务施工队伍的 deptId
|
|
|
+ if (taskTeamIdPair.containsKey(task.getId())) {
|
|
|
+ report.setDeptId(taskTeamIdPair.get(task.getId()));
|
|
|
+ } else {
|
|
|
+ report.setDeptId(user.getDeptId());
|
|
|
+ }
|
|
|
// 根据用户部门名称 生成日报标题
|
|
|
- if (deptPair.containsKey(user.getDeptId())) {
|
|
|
- DeptDO dept = deptPair.get(user.getDeptId());
|
|
|
+ if (deptPair.containsKey(report.getDeptId())) {
|
|
|
+ DeptDO dept = deptPair.get(report.getDeptId());
|
|
|
String deptName = dept.getName();
|
|
|
String[] multiLangDeptNames = deptName.split("~~");
|
|
|
report.setReportName(multiLangDeptNames[0] + "/" + currentFormatDateStr + "日报填报" );
|