|
@@ -36,6 +36,7 @@ import javax.annotation.Resource;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
|
@@ -199,6 +200,42 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
|
|
|
// key任务id value任务工艺名称
|
|
// key任务id value任务工艺名称
|
|
|
Map<Long, String> taskTechniquePair = new HashMap<>();
|
|
Map<Long, String> taskTechniquePair = new HashMap<>();
|
|
|
if (CollUtil.isNotEmpty(dailyReports)) {
|
|
if (CollUtil.isNotEmpty(dailyReports)) {
|
|
|
|
|
+ // 遍历日报 找到每个日报关联的任务的 施工队伍
|
|
|
|
|
+ List<Long> taskIds = convertList(dailyReports, IotRdDailyReportDO::getTaskId);
|
|
|
|
|
+ Set<Long> uniqueTaskIds = new HashSet<>(taskIds);
|
|
|
|
|
+ // 查询所有任务关联的队伍信息 如果任务选择了多个队伍 队伍名称逗号分隔
|
|
|
|
|
+ // key任务id value任务选择的施工队伍名称集合
|
|
|
|
|
+ Map<Long, String> taskDeptNamePair = new HashMap<>();
|
|
|
|
|
+ // key任务id value任务选择的施工队伍对应的项目部名称集合
|
|
|
|
|
+ Map<Long, String> taskProjectDeptPair = new HashMap<>();
|
|
|
|
|
+ IotProjectTaskPageReqVO relatedTaskReqVO = new IotProjectTaskPageReqVO();
|
|
|
|
|
+ relatedTaskReqVO.setTaskIds(new ArrayList<>(uniqueTaskIds));
|
|
|
|
|
+ List<IotProjectTaskDO> relatedTasks = iotProjectTaskMapper.selectList(relatedTaskReqVO);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(relatedTasks)) {
|
|
|
|
|
+ relatedTasks.forEach(task -> {
|
|
|
|
|
+ Set<Long> teamIds = task.getDeptIds();
|
|
|
|
|
+ // 非空判断,避免空指针
|
|
|
|
|
+ if (CollUtil.isNotEmpty(teamIds)) {
|
|
|
|
|
+ // 映射队伍ID为名称,过滤空值,用逗号拼接
|
|
|
|
|
+ String teamNames = teamIds.stream()
|
|
|
|
|
+ .map(teamDeptPair::get) // 从已有映射中获取队伍名称
|
|
|
|
|
+ .filter(Objects::nonNull) // 过滤未匹配到名称的情况
|
|
|
|
|
+ .collect(Collectors.joining(",")); // 多队伍用逗号分隔
|
|
|
|
|
+ // 存入任务-队伍名称映射
|
|
|
|
|
+ taskDeptNamePair.put(task.getId(), teamNames);
|
|
|
|
|
+ // 处理项目部名称集合
|
|
|
|
|
+ String projectNames = teamIds.stream()
|
|
|
|
|
+ .map(teamId -> teamProjectPair.get(teamId)) // 队伍ID→项目部ID
|
|
|
|
|
+ .filter(Objects::nonNull) // 过滤无效的项目部ID
|
|
|
|
|
+ .map(projectId -> projectDeptPair.get(projectId)) // 项目部ID→项目部名称
|
|
|
|
|
+ .filter(Objects::nonNull) // 过滤无效的项目部名称
|
|
|
|
|
+ .distinct() // 去重(避免同一项目部重复出现)
|
|
|
|
|
+ .collect(Collectors.joining(",")); // 逗号分隔多项目部
|
|
|
|
|
+ taskProjectDeptPair.put(task.getId(), projectNames);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 查询施工工艺字典数据
|
|
// 查询施工工艺字典数据
|
|
|
List<DictDataDO> rdTechniques = dictDataService.getDictDataListByDictType("rq_iot_project_technology_rd");
|
|
List<DictDataDO> rdTechniques = dictDataService.getDictDataListByDictType("rq_iot_project_technology_rd");
|
|
|
if (CollUtil.isNotEmpty(rdTechniques)) {
|
|
if (CollUtil.isNotEmpty(rdTechniques)) {
|
|
@@ -374,14 +411,20 @@ public class IotRdDailyReportServiceImpl implements IotRdDailyReportService {
|
|
|
Long taskId = Long.valueOf(deptIdTaskIdArray[2]);
|
|
Long taskId = Long.valueOf(deptIdTaskIdArray[2]);
|
|
|
IotRdDailyReportStatisticsRespVO uniqueReport = new IotRdDailyReportStatisticsRespVO();
|
|
IotRdDailyReportStatisticsRespVO uniqueReport = new IotRdDailyReportStatisticsRespVO();
|
|
|
List<IotRdDailyReportStatisticsItemVO> items = new ArrayList<>();
|
|
List<IotRdDailyReportStatisticsItemVO> items = new ArrayList<>();
|
|
|
- if (teamDeptPair.containsKey(deptId)) {
|
|
|
|
|
|
|
+ /* if (teamDeptPair.containsKey(deptId)) {
|
|
|
uniqueReport.setDeptName(teamDeptPair.get(deptId));
|
|
uniqueReport.setDeptName(teamDeptPair.get(deptId));
|
|
|
|
|
+ } */
|
|
|
|
|
+ if (taskDeptNamePair.containsKey(taskId)) {
|
|
|
|
|
+ uniqueReport.setDeptName(taskDeptNamePair.get(taskId));
|
|
|
}
|
|
}
|
|
|
- if (teamProjectPair.containsKey(deptId)) {
|
|
|
|
|
|
|
+ /* if (teamProjectPair.containsKey(deptId)) {
|
|
|
Long parentId = teamProjectPair.get(deptId);
|
|
Long parentId = teamProjectPair.get(deptId);
|
|
|
if (projectDeptPair.containsKey(parentId)) {
|
|
if (projectDeptPair.containsKey(parentId)) {
|
|
|
uniqueReport.setProjectDeptName(projectDeptPair.get(parentId));
|
|
uniqueReport.setProjectDeptName(projectDeptPair.get(parentId));
|
|
|
}
|
|
}
|
|
|
|
|
+ } */
|
|
|
|
|
+ if (taskProjectDeptPair.containsKey(taskId)) {
|
|
|
|
|
+ uniqueReport.setProjectDeptName(taskProjectDeptPair.get(taskId));
|
|
|
}
|
|
}
|
|
|
if (projectPair.containsKey(projectId)) {
|
|
if (projectPair.containsKey(projectId)) {
|
|
|
uniqueReport.setManufactureName(projectPair.get(projectId));
|
|
uniqueReport.setManufactureName(projectPair.get(projectId));
|