| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | //参会人员id(人员台账和用户表通过人员编号和用户名称(登录账号)做匹配) |
| | | if (Integer.valueOf(1).equals(meetApplication.getPublishStatus())) { |
| | | MeetApplication application = meetApplicationMapper.selectById(meetApplication.getId()); |
| | | |
| | | String cleanStr = application.getParticipants() |
| | | .replaceAll("^\\[|\\]$", "") |
| | | .trim(); |
| | | |
| | | List<Long> userIds = Arrays.stream(cleanStr.split(",")) |
| | | .map(String::trim) |
| | | .filter(s -> !s.isEmpty()) |
| | | .map(Long::valueOf) |
| | | .map(staffId -> { |
| | | StaffOnJob record = staffOnJobMapper.selectById(staffId); |
| | | if (record == null) { |
| | | return null; |
| | | } |
| | | return userMapper.selectOne( |
| | | Wrappers.<SysUser>lambdaQuery() |
| | | .eq(SysUser::getUserName, record.getStaffNo()) |
| | | ); |
| | | }) |
| | | .filter(Objects::nonNull) |
| | | .map(SysUser::getUserId) |
| | | .collect(Collectors.toList()); |
| | | List<Long> userIds = resolveParticipantUserIds(application.getParticipants()); |
| | | |
| | | if (!userIds.isEmpty()) { |
| | | sysNoticeService.simpleNoticeByUser( |
| | |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | // 参会人员台账id -> 登录用户id;同一登录账号在 sys_user 存在多条历史记录时,按未删除优先取一条,避免 selectOne 抛 TooManyResultsException |
| | | private List<Long> resolveParticipantUserIds(String participants) { |
| | | if (StrUtil.isBlank(participants)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | String cleanStr = participants.replaceAll("^\\[|\\]$", "").trim(); |
| | | if (cleanStr.isEmpty()) { |
| | | return Collections.emptyList(); |
| | | } |
| | | List<Long> staffIds = Arrays.stream(cleanStr.split(",")) |
| | | .map(String::trim) |
| | | .filter(s -> !s.isEmpty()) |
| | | .map(Long::valueOf) |
| | | .collect(Collectors.toList()); |
| | | if (staffIds.isEmpty()) { |
| | | return Collections.emptyList(); |
| | | } |
| | | List<String> loginNames = staffOnJobMapper.selectBatchIds(staffIds).stream() |
| | | .map(StaffOnJob::getStaffNo) |
| | | .filter(StrUtil::isNotBlank) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | if (loginNames.isEmpty()) { |
| | | return Collections.emptyList(); |
| | | } |
| | | return userMapper.selectList(Wrappers.<SysUser>lambdaQuery() |
| | | .in(SysUser::getUserName, loginNames) |
| | | .orderByAsc(SysUser::getDelFlag) |
| | | .orderByAsc(SysUser::getUserId)) |
| | | .stream() |
| | | .collect(Collectors.toMap(SysUser::getUserName, SysUser::getUserId, |
| | | (first, ignored) -> first, LinkedHashMap::new)) |
| | | .values() |
| | | .stream() |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | .or() |
| | | .eq(MeetApplication::getApplicationType, "notification"); |
| | | }); |
| | | if (Objects.nonNull(vo.getMeetingDate())) { |
| | | if (Objects.nonNull(vo.getDate())) { |
| | | alWrapper.and(wrapper -> { |
| | | wrapper.eq(MeetApplication::getMeetingDate, vo.getMeetingDate()); |
| | | wrapper.eq(MeetApplication::getMeetingDate, vo.getDate()); |
| | | }); |
| | | } |
| | | alWrapper.orderByAsc(MeetApplication::getStartTime); |