|
|
@@ -312,16 +312,15 @@ public class IotOperationMeetingServiceImpl implements IotOperationMeetingServic
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, List<IotOperationMeetingDetailDO>> summarizedProjectDetails(IotOperationMeetingPageReqVO pageReqVO) {
|
|
|
- Map<String, List<IotOperationMeetingDetailDO>> resultMeetingDetails = new HashMap<>();
|
|
|
+ public List<IotOperationMeetingRespVO> summarizedProjectDetails(IotOperationMeetingPageReqVO pageReqVO) {
|
|
|
+ List<IotOperationMeetingRespVO> resultMeetings = new ArrayList<>();
|
|
|
// 石油技术 查询 下属各专业公司 指定期次的 项目明细
|
|
|
String meetingSeries = pageReqVO.getMeetingSeries(); // 期次
|
|
|
Integer year = pageReqVO.getYear(); // 会议日期
|
|
|
if (StrUtil.isBlank(meetingSeries) || ObjUtil.isEmpty(year)) {
|
|
|
- return resultMeetingDetails;
|
|
|
+ return resultMeetings;
|
|
|
}
|
|
|
// 根据 期次 日期yyyy 查询石油技术下所有专业公司的项目明细
|
|
|
-
|
|
|
IotOperationMeetingDetailPageReqVO reqVO = new IotOperationMeetingDetailPageReqVO();
|
|
|
reqVO.setYear(year);
|
|
|
// 提取 meetingSeries 中的数字
|
|
|
@@ -332,11 +331,12 @@ public class IotOperationMeetingServiceImpl implements IotOperationMeetingServic
|
|
|
.ifPresent(reqVO::setSort);
|
|
|
List<IotOperationMeetingDetailDO> summarizedDetails = iotOperationMeetingDetailMapper.summarizedProjectDetails(reqVO);
|
|
|
if (CollUtil.isEmpty(summarizedDetails)) {
|
|
|
- return resultMeetingDetails;
|
|
|
+ return resultMeetings;
|
|
|
}
|
|
|
Set<Long> companyIds = new HashSet<>();
|
|
|
- // 需要把 明细按照公司分组
|
|
|
- Map<String, List<IotOperationMeetingDetailDO>> companyMeetingDetailPair = new HashMap<>();
|
|
|
+ // key会议id value当前会议/公司下的项目明细
|
|
|
+ Map<Long, List<IotOperationMeetingDetailDO>> companyMeetingIdDetailPair = new HashMap<>();
|
|
|
+ Set<Long> meetingIds = new HashSet<>();
|
|
|
summarizedDetails.forEach(detail -> {
|
|
|
companyIds.add(detail.getDeptId());
|
|
|
});
|
|
|
@@ -344,38 +344,81 @@ public class IotOperationMeetingServiceImpl implements IotOperationMeetingServic
|
|
|
List<DeptDO> companyNames = deptservice.getDeptList(companyIds);
|
|
|
Map<Long, String> companyPair = new HashMap<>();
|
|
|
if (CollUtil.isEmpty(companyNames)) {
|
|
|
- return resultMeetingDetails;
|
|
|
+ return resultMeetings;
|
|
|
}
|
|
|
companyNames.forEach(name -> {
|
|
|
companyPair.put(name.getId(), name.getName());
|
|
|
});
|
|
|
summarizedDetails.forEach(detail -> {
|
|
|
- if (companyPair.containsKey(detail.getDeptId())) {
|
|
|
- String companyName = companyPair.get(detail.getDeptId());
|
|
|
- if (companyMeetingDetailPair.containsKey(companyName)) {
|
|
|
- List<IotOperationMeetingDetailDO> tempDetails = companyMeetingDetailPair.get(companyName);
|
|
|
- tempDetails.add(detail);
|
|
|
- companyMeetingDetailPair.put(companyName, tempDetails);
|
|
|
- } else {
|
|
|
- List<IotOperationMeetingDetailDO> tempDetails = new ArrayList<>();
|
|
|
- tempDetails.add(detail);
|
|
|
- companyMeetingDetailPair.put(companyName, tempDetails);
|
|
|
- }
|
|
|
+ meetingIds.add(detail.getMeetingId());
|
|
|
+ if (companyMeetingIdDetailPair.containsKey(detail.getMeetingId())) {
|
|
|
+ List<IotOperationMeetingDetailDO> tempDetails = companyMeetingIdDetailPair.get(detail.getMeetingId());
|
|
|
+ tempDetails.add(detail);
|
|
|
+ companyMeetingIdDetailPair.put(detail.getMeetingId(), tempDetails);
|
|
|
+ } else {
|
|
|
+ List<IotOperationMeetingDetailDO> tempDetails = new ArrayList<>();
|
|
|
+ tempDetails.add(detail);
|
|
|
+ companyMeetingIdDetailPair.put(detail.getMeetingId(), tempDetails);
|
|
|
}
|
|
|
});
|
|
|
+ // 根据 meetingIds 集合查询各会议的汇总信息(需要集团支持事项)
|
|
|
+ IotOperationMeetingPageReqVO meetingReqVO = new IotOperationMeetingPageReqVO();
|
|
|
+ meetingReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ meetingReqVO.setMeetingIds(meetingIds);
|
|
|
+ PageResult<IotOperationMeetingDO> pageMeetings = iotOperationMeetingMapper.selectPage(meetingReqVO);
|
|
|
+ if (ObjUtil.isEmpty(pageMeetings)) {
|
|
|
+ return resultMeetings;
|
|
|
+ }
|
|
|
+ List<IotOperationMeetingDO> meetings = pageMeetings.getList();
|
|
|
+ if (CollUtil.isEmpty(meetings)) {
|
|
|
+ return resultMeetings;
|
|
|
+ }
|
|
|
+ // 组装每个会议的需要集团支持的事项
|
|
|
+ Map<Long, IotOperationMeetingDO> supportPair = new HashMap<>();
|
|
|
+ meetings.forEach(meeting -> {
|
|
|
+ supportPair.put(meeting.getId(), meeting);
|
|
|
+ });
|
|
|
// 排序 按照 部门 sort 值正序排列
|
|
|
- // 构建 公司名称 -> sort 的映射(DeptDO 中有 sort 字段)
|
|
|
- Map<String, Integer> nameSortMap = companyNames.stream()
|
|
|
- .collect(Collectors.toMap(DeptDO::getName, DeptDO::getSort));
|
|
|
+ // 1. 构建部门ID -> sort 的映射(类似你已有的 nameSortMap 思路)
|
|
|
+ Map<Long, Integer> deptSortMap = companyNames.stream()
|
|
|
+ .collect(Collectors.toMap(DeptDO::getId, DeptDO::getSort));
|
|
|
|
|
|
- // 按公司 sort 升序排列,返回有序 Map
|
|
|
- return companyMeetingDetailPair.entrySet().stream()
|
|
|
- .sorted(Comparator.comparingInt(e -> nameSortMap.getOrDefault(e.getKey(), Integer.MAX_VALUE)))
|
|
|
+ // 2. 对 companyMeetingIdDetailPair 中每个明细列表按部门 sort 升序排列
|
|
|
+ companyMeetingIdDetailPair.values().forEach(list ->
|
|
|
+ list.sort(Comparator.comparingInt(detail ->
|
|
|
+ deptSortMap.getOrDefault(detail.getDeptId(), Integer.MAX_VALUE))));
|
|
|
+ // 排序后的会议项目明细列表
|
|
|
+ LinkedHashMap<Long, List<IotOperationMeetingDetailDO>> sortedMeetingDetails = companyMeetingIdDetailPair.entrySet().stream()
|
|
|
+ .sorted(Comparator.comparingInt(e -> deptSortMap.getOrDefault(e.getKey(), Integer.MAX_VALUE)))
|
|
|
.collect(Collectors.toMap(
|
|
|
Map.Entry::getKey,
|
|
|
Map.Entry::getValue,
|
|
|
(v1, v2) -> v1,
|
|
|
LinkedHashMap::new));
|
|
|
+ companyMeetingIdDetailPair.forEach((meetingId, details) -> {
|
|
|
+ // meetingId会议id details各专业公司的会议明细
|
|
|
+ IotOperationMeetingRespVO tempMeeting = new IotOperationMeetingRespVO();
|
|
|
+ if (supportPair.containsKey(meetingId)) {
|
|
|
+ IotOperationMeetingDO existMeeting = supportPair.get(meetingId);
|
|
|
+ tempMeeting.setDeptId(existMeeting.getDeptId());
|
|
|
+ tempMeeting.setSupport(existMeeting.getSupport());
|
|
|
+ tempMeeting.setMeetingSeries(existMeeting.getMeetingSeries());
|
|
|
+ tempMeeting.setMeetingDate(existMeeting.getMeetingDate());
|
|
|
+ if (companyPair.containsKey(existMeeting.getDeptId())) {
|
|
|
+ tempMeeting.setCompanyName(companyPair.get(existMeeting.getDeptId()));
|
|
|
+ }
|
|
|
+ List<IotOperationMeetingDetailRespVO> meetingDetails = BeanUtils.toBean(details, IotOperationMeetingDetailRespVO.class);
|
|
|
+ tempMeeting.setDetails(meetingDetails);
|
|
|
+ resultMeetings.add(tempMeeting);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 按照会议所属部门的 sort 升序排列
|
|
|
+ resultMeetings.sort(Comparator.comparingInt(vo ->
|
|
|
+ Optional.ofNullable(vo.getDeptId())
|
|
|
+ .map(deptSortMap::get)
|
|
|
+ .orElse(Integer.MAX_VALUE)
|
|
|
+ ));
|
|
|
+ return resultMeetings;
|
|
|
}
|
|
|
|
|
|
}
|