diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java index dee41ff..91f7e1e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java @@ -72,14 +72,21 @@ public class MeetingController { @GetMapping("/manager/meetingList") @WebLog(value = "管理员会议列表") public PageVo meetingListByManager(MeetingListReq req) { - return meetingManage.meetingListByManager(req); + return meetingManage.meetingListForManager(req); } @ApiOperation("专家会议列表") @GetMapping("/expert/meetingList") @WebLog(value = "专家会议列表") public PageVo meetingListByExpert(MeetingListReq po) { - return meetingManage.meetingListByExpert(po); + return meetingManage.meetingListForExpert(po); + } + + @ApiOperation("专家请假会议列表") + @GetMapping("/expert/meetingListForLeave") + @WebLog(value = "专家请假会议列表") + public PageVo meetingListForLeave(MeetingLeaveListReq req) { + return meetingManage.meetingListForLeave(req); } @ApiOperation("会议详情-基本信息") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingLeaveListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingLeaveListReq.java new file mode 100644 index 0000000..379b79b --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingLeaveListReq.java @@ -0,0 +1,21 @@ +package com.ningdatech.pmapi.meeting.entity.req; + +import com.ningdatech.basic.model.PagePo; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * MeetingListForLeaveReq + *

+ * + * @author WendyYang + * @since 17:03 2023/4/3 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class MeetingLeaveListReq extends PagePo { + + private Long expertId; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingListReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingListReq.java index 4ef7111..11a7043 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingListReq.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingListReq.java @@ -51,4 +51,7 @@ public class MeetingListReq extends PagePo { @ApiModelProperty("区域层级") private Integer regionLevel; + @ApiModelProperty("参会名单是否确认") + private Boolean confirmedRoster; + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java index a612e1d..9e296b1 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java @@ -145,6 +145,9 @@ public class MeetingManageHelper { if (req.getEndTime() != null) { query.le(Meeting::getEndTime, req.getEndTime()); } + if (req.getConfirmedRoster() != null) { + query.eq(Meeting::getConfirmedRoster, req.getConfirmedRoster()); + } if (StrUtils.isNotBlank(req.getProjectName())) { String projectName = "%" + req.getProjectName() + "%"; query.and(q1 -> q1.exists("select 1 from nd_project np inner join meeting_inner_project mip on mip.project_id = np.id" + diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/DashboardManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/DashboardManage.java index 4928322..b7c94b3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/DashboardManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/DashboardManage.java @@ -63,7 +63,7 @@ public class DashboardManage { meetingListPo.setPageSize(500); meetingListPo.setStartTime(po.getStartDate().atStartOfDay()); meetingListPo.setEndTime(po.getEndDate().atTime(LocalTime.MAX)); - PageVo meetingPage = meetingManage.meetingListByExpert(meetingListPo); + PageVo meetingPage = meetingManage.meetingListForExpert(meetingListPo); Map> meetingByDate = meetingPage.getRecords().stream().map(w -> { List> pairs = new ArrayList<>(); LocalDateTime tempTime = w.getStartTime(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java index 75c08d2..8440879 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java @@ -58,6 +58,7 @@ import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; +import static com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum.*; import static com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper.getExpertInviteRule; /** @@ -252,7 +253,7 @@ public class MeetingManage { List experts = appointRule.getExpertIdList().stream().map(w -> { ExpertUserFullInfo info = usersMap.get(w); MeetingExpert expert = ExpertInviteBuilder.getExpertByAppoint(meeting.getId(), info, ruleId); - expert.setStatus(ExpertAttendStatusEnum.NOTICING.getCode()); + expert.setStatus(NOTICING.getCode()); return expert; }).collect(Collectors.toList()); meetingExpertService.saveBatch(experts); @@ -299,7 +300,7 @@ public class MeetingManage { * @return 会议列表 * @author WendyYang **/ - public PageVo meetingListByExpert(MeetingListReq req) { + public PageVo meetingListForExpert(MeetingListReq req) { Long expertId = req.getExpertId() != null ? req.getExpertId() : LoginUserUtil.getUserId(); List meetings = meetingExpertService.listByExpertIdAndStatus(expertId, null, null); if (meetings.isEmpty()) { @@ -329,6 +330,37 @@ public class MeetingManage { return result; } + public PageVo meetingListForLeave(MeetingLeaveListReq req) { + Long expertId = ObjectUtil.defaultIfNull(req.getExpertId(), LoginUserUtil.getUserId()); + LambdaQueryWrapper meQuery = Wrappers.lambdaQuery(MeetingExpert.class) + .eq(MeetingExpert::getExpertId, expertId) + .in(MeetingExpert::getStatus, AGREED.getCode(), ON_LEAVE.getCode()); + List meetings = meetingExpertService.list(meQuery); + if (meetings.isEmpty()) { + return PageVo.empty(); + } + Map meetingMap = new HashMap<>(16); + meetings.forEach(w -> meetingMap.put(w.getMeetingId(), w)); + LambdaQueryWrapper query = new LambdaQueryWrapper() + .orderByAsc(Meeting::getStartTime) + .in(Meeting::getId, meetingMap.keySet()) + .eq(Meeting::getConfirmedRoster, Boolean.TRUE) + .ne(Meeting::getStatus, MeetingStatusEnum.CANCELED.getCode()); + Page page = meetingService.page(req.page(), query); + if (page.getTotal() == 0) { + return PageVo.empty(); + } + PageVo result = new PageVo<>(new ArrayList<>(), page.getTotal()); + page.getRecords().forEach(meeting -> { + MeetingByManagerVO item = meetingManageHelper.buildByMeeting(meeting); + MeetingExpert info = meetingMap.get(meeting.getId()); + item.setExpertStatus(info.getStatus()); + result.getRecords().add(item); + }); + return result; + } + + /** * 管理员会议列表 * @@ -336,7 +368,7 @@ public class MeetingManage { * @return 会议列表 * @author WendyYang */ - public PageVo meetingListByManager(MeetingListReq req) { + public PageVo meetingListForManager(MeetingListReq req) { LambdaQueryWrapper query = new LambdaQueryWrapper() .orderByDesc(Meeting::getCreateOn); // 补充逻辑 如果拥有超级管理员权限可以看到所有事务 @@ -424,7 +456,7 @@ public class MeetingManage { item.setMobile(me.getMobile()); item.setNoticeTime(me.getCreateOn()); item.setRuleId(me.getRuleId()); - if (ExpertAttendStatusEnum.NOTICING.eq(me.getStatus())) { + if (NOTICING.eq(me.getStatus())) { item.setNoticeStatus("通知中"); } else { item.setNoticeStatus("已通知"); @@ -441,7 +473,7 @@ public class MeetingManage { InviteStatisticsByRuleVO statistics = InviteStatisticsByRuleVO.init(ruleId); expertList.forEach((expert) -> { Integer status = expert.getStatus(); - if (ExpertAttendStatusEnum.AGREED.eq(status)) { + if (AGREED.eq(status)) { statistics.incrAgreeCnt(); } statistics.setInviteCnt(ruleMap.get(ruleId).getInviteCount()); @@ -563,7 +595,7 @@ public class MeetingManage { List userInfos = meetingManageHelper.appointExpertCheck(meetingId, meeting.getInviteType(), req.getExpertIdList()); List expertList = CollUtils.convert(userInfos, w -> { MeetingExpert me = ExpertInviteBuilder.getExpertByAppoint(meetingId, w, rule.getId()); - me.setStatus(ExpertAttendStatusEnum.NOTICING.getCode()); + me.setStatus(NOTICING.getCode()); return me; }); meetingExpertService.saveBatch(expertList); @@ -616,7 +648,7 @@ public class MeetingManage { if (me == null) { throw BizException.wrap("未被邀请参加此会议"); } - if (ExpertAttendStatusEnum.AGREED.eq(me.getStatus())) { + if (AGREED.eq(me.getStatus())) { throw BizException.wrap("未确认参加此会议"); } ExpertUserFullInfo userInfo = expertUserFullInfoService.getByUserId(userId); @@ -641,11 +673,11 @@ public class MeetingManage { } try { MeetingExpert me = meetingExpertService.getById(req.getExpertMeetingId()); - if (!ExpertAttendStatusEnum.NOTICING.eq(me.getStatus())) { + if (!NOTICING.eq(me.getStatus())) { throw BizException.wrap("%s失败,请重试!", msgPrefix); } LambdaUpdateWrapper update = Wrappers.lambdaUpdate(MeetingExpert.class) - .set(MeetingExpert::getStatus, (req.getAgreed() ? ExpertAttendStatusEnum.AGREED : ExpertAttendStatusEnum.REFUSED).getCode()) + .set(MeetingExpert::getStatus, (req.getAgreed() ? AGREED : REFUSED).getCode()) .eq(MeetingExpert::getId, req.getExpertMeetingId()); meetingExpertService.update(update); } finally { @@ -664,7 +696,7 @@ public class MeetingManage { throw BizException.wrap("会议已取消"); } LambdaUpdateWrapper update = Wrappers.lambdaUpdate(MeetingExpert.class) - .set(MeetingExpert::getStatus, ExpertAttendStatusEnum.RELEASED.getCode()) + .set(MeetingExpert::getStatus, RELEASED.getCode()) .eq(MeetingExpert::getMeetingId, req.getMeetingId()); meetingExpertService.update(update); } finally { @@ -689,8 +721,8 @@ public class MeetingManage { .eq(MeetingExpert::getMeetingId, req.getMeetingId()); meetingExpertService.update(cancel); MeetingExpert headman = meetingExpertService.getById(req.getExpertMeetingId()); - if (!ExpertAttendStatusEnum.AGREED.eq(headman.getStatus())) { - ExpertAttendStatusEnum status = ExpertAttendStatusEnum.getByCode(headman.getStatus()); + if (!AGREED.eq(headman.getStatus())) { + ExpertAttendStatusEnum status = getByCode(headman.getStatus()); throw BizException.wrap("该专家处于:%s状态,不能被设置为专家组长!", status.getValue()); } LambdaUpdateWrapper setup = Wrappers.lambdaUpdate(MeetingExpert.class)