|
@@ -28,6 +28,7 @@ import org.springframework.validation.annotation.Validated;
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
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.module.pms.enums.ErrorCodeConstant.IOT_OPERATION_MEETING_EXISTS;
|
|
import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_OPERATION_MEETING_EXISTS;
|
|
@@ -271,4 +272,110 @@ public class IotOperationMeetingServiceImpl implements IotOperationMeetingServic
|
|
|
return resp;
|
|
return resp;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Map<String, List<IotOperationMeetingDO>> integratedMeeting(IotOperationMeetingPageReqVO pageReqVO) {
|
|
|
|
|
+ // 石油技术查询整合后 各公司的 项目明细
|
|
|
|
|
+ if (StrUtil.isNotBlank(pageReqVO.getMeetingSeries())) {
|
|
|
|
|
+
|
|
|
|
|
+ // 提取 meetingSeries 中的数字
|
|
|
|
|
+ Optional.ofNullable(pageReqVO.getMeetingSeries())
|
|
|
|
|
+ .map(s -> s.replaceAll("\\D", "")) // 提取所有数字
|
|
|
|
|
+ .filter(StrUtil::isNumeric) // 确保是数字
|
|
|
|
|
+ .map(Integer::valueOf)
|
|
|
|
|
+ .ifPresent(pageReqVO::setSort);
|
|
|
|
|
+ }
|
|
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
|
+ PageResult<IotOperationMeetingDO> pageMeetings = iotOperationMeetingMapper.selectPage(pageReqVO);
|
|
|
|
|
+ // key格式2026-第8期 value当期公司会议集合
|
|
|
|
|
+ Map<String, List<IotOperationMeetingDO>> companyMeetingPair = new HashMap<>();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(pageMeetings)) {
|
|
|
|
|
+ List<IotOperationMeetingDO> meetings = pageMeetings.getList();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(meetings)) {
|
|
|
|
|
+ meetings.forEach(meeting -> {
|
|
|
|
|
+ LocalDateTime meetingDate = meeting.getMeetingDate();
|
|
|
|
|
+ // 获取日期中的年 yyyy
|
|
|
|
|
+ Integer year = meetingDate.getYear();
|
|
|
|
|
+ String uniqueKey = StrUtil.join("-", year, meeting.getMeetingSeries());
|
|
|
|
|
+ if (companyMeetingPair.containsKey(uniqueKey)) {
|
|
|
|
|
+ List<IotOperationMeetingDO> tempMeetings = companyMeetingPair.get(uniqueKey);
|
|
|
|
|
+ tempMeetings.add(meeting);
|
|
|
|
|
+ companyMeetingPair.put(uniqueKey, tempMeetings);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ List<IotOperationMeetingDO> tempMeetings = new ArrayList<>();
|
|
|
|
|
+ tempMeetings.add(meeting);
|
|
|
|
|
+ companyMeetingPair.put(uniqueKey, tempMeetings);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return companyMeetingPair;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Map<String, List<IotOperationMeetingDetailDO>> summarizedProjectDetails(IotOperationMeetingPageReqVO pageReqVO) {
|
|
|
|
|
+ Map<String, List<IotOperationMeetingDetailDO>> resultMeetingDetails = new HashMap<>();
|
|
|
|
|
+ // 石油技术 查询 下属各专业公司 指定期次的 项目明细
|
|
|
|
|
+ String meetingSeries = pageReqVO.getMeetingSeries(); // 期次
|
|
|
|
|
+ Integer year = pageReqVO.getYear(); // 会议日期
|
|
|
|
|
+ if (StrUtil.isBlank(meetingSeries) || ObjUtil.isEmpty(year)) {
|
|
|
|
|
+ return resultMeetingDetails;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 根据 期次 日期yyyy 查询石油技术下所有专业公司的项目明细
|
|
|
|
|
+
|
|
|
|
|
+ IotOperationMeetingDetailPageReqVO reqVO = new IotOperationMeetingDetailPageReqVO();
|
|
|
|
|
+ reqVO.setYear(year);
|
|
|
|
|
+ // 提取 meetingSeries 中的数字
|
|
|
|
|
+ Optional.ofNullable(meetingSeries)
|
|
|
|
|
+ .map(s -> s.replaceAll("\\D", "")) // 提取所有数字
|
|
|
|
|
+ .filter(StrUtil::isNumeric) // 确保是数字
|
|
|
|
|
+ .map(Integer::valueOf)
|
|
|
|
|
+ .ifPresent(reqVO::setSort);
|
|
|
|
|
+ List<IotOperationMeetingDetailDO> summarizedDetails = iotOperationMeetingDetailMapper.summarizedProjectDetails(reqVO);
|
|
|
|
|
+ if (CollUtil.isEmpty(summarizedDetails)) {
|
|
|
|
|
+ return resultMeetingDetails;
|
|
|
|
|
+ }
|
|
|
|
|
+ Set<Long> companyIds = new HashSet<>();
|
|
|
|
|
+ // 需要把 明细按照公司分组
|
|
|
|
|
+ Map<String, List<IotOperationMeetingDetailDO>> companyMeetingDetailPair = new HashMap<>();
|
|
|
|
|
+ summarizedDetails.forEach(detail -> {
|
|
|
|
|
+ companyIds.add(detail.getDeptId());
|
|
|
|
|
+ });
|
|
|
|
|
+ // 查询 companyIds 各公司id对应的公司名称
|
|
|
|
|
+ List<DeptDO> companyNames = deptservice.getDeptList(companyIds);
|
|
|
|
|
+ Map<Long, String> companyPair = new HashMap<>();
|
|
|
|
|
+ if (CollUtil.isEmpty(companyNames)) {
|
|
|
|
|
+ return resultMeetingDetails;
|
|
|
|
|
+ }
|
|
|
|
|
+ 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);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ // 排序 按照 部门 sort 值正序排列
|
|
|
|
|
+ // 构建 公司名称 -> sort 的映射(DeptDO 中有 sort 字段)
|
|
|
|
|
+ Map<String, Integer> nameSortMap = companyNames.stream()
|
|
|
|
|
+ .collect(Collectors.toMap(DeptDO::getName, DeptDO::getSort));
|
|
|
|
|
+
|
|
|
|
|
+ // 按公司 sort 升序排列,返回有序 Map
|
|
|
|
|
+ return companyMeetingDetailPair.entrySet().stream()
|
|
|
|
|
+ .sorted(Comparator.comparingInt(e -> nameSortMap.getOrDefault(e.getKey(), Integer.MAX_VALUE)))
|
|
|
|
|
+ .collect(Collectors.toMap(
|
|
|
|
|
+ Map.Entry::getKey,
|
|
|
|
|
+ Map.Entry::getValue,
|
|
|
|
|
+ (v1, v2) -> v1,
|
|
|
|
|
+ LinkedHashMap::new));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|