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 f554dc3..14c20cd 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 @@ -46,6 +46,13 @@ public class MeetingController { meetingManage.continueInvite(req.getMeetingId()); } + @PostMapping("/convertToAppoint") + @ApiOperation(value = "转为指定抽取") + @WebLog(value = "转为指定抽取") + public void convertToAppoint(@Valid @RequestBody MeetingIdReq req) { + meetingManage.convertToAppoint(req.getMeetingId()); + } + @PostMapping("/expertInviteByCreate") @ApiOperation(value = "新建会议-专家抽取", hidden = true) @WebLog(value = "新建会议-专家抽取") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpert.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpert.java index be63408..73533f4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpert.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpert.java @@ -1,8 +1,6 @@ package com.ningdatech.pmapi.meeting.entity.domain; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.*; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Builder; @@ -58,15 +56,18 @@ public class MeetingExpert implements Serializable { @ApiModelProperty("邀请类型") private Integer inviteType; + private String submitKey; + + @TableField(fill = FieldFill.INSERT) private Long createBy; + @TableField(fill = FieldFill.INSERT) private LocalDateTime createOn; + @TableField(fill = FieldFill.INSERT_UPDATE) private Long updateBy; + @TableField(fill = FieldFill.INSERT_UPDATE) private LocalDateTime updateOn; - private String submitKey; - - } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingInviteCacheDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/InviteCacheDTO.java similarity index 64% rename from pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingInviteCacheDTO.java rename to pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/InviteCacheDTO.java index 9c3fea6..b7ed771 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingInviteCacheDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/InviteCacheDTO.java @@ -11,14 +11,14 @@ import lombok.Data; * @since 19:21 2023/3/7 */ @Data -public final class MeetingInviteCacheDTO { +public final class InviteCacheDTO { private Long meetingId; private Boolean invitedRefused; - public static MeetingInviteCacheDTO of(Long meetingId, Boolean invitedRefused) { - MeetingInviteCacheDTO bo = new MeetingInviteCacheDTO(); + public static InviteCacheDTO of(Long meetingId, Boolean invitedRefused) { + InviteCacheDTO bo = new InviteCacheDTO(); bo.setMeetingId(meetingId); bo.setInvitedRefused(invitedRefused); return bo; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertAttendStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertAttendStatusEnum.java index f53606f..7f34237 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertAttendStatusEnum.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertAttendStatusEnum.java @@ -19,11 +19,8 @@ public enum ExpertAttendStatusEnum { NOTICING("通知中", 0), UNANSWERED("未应答", 1), - REPLACED("已替换", 2), AGREED("同意参加", 3), REFUSED("拒绝参加", 4), - REMOVED("已移除", 5), - ON_LEAVE("已请假", 6), RELEASED("已释放", 7); private final String value; 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 a699740..741a114 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 @@ -196,6 +196,7 @@ public class MeetingManageHelper { * * @param meetingId 会议ID * @param expertIds 专家ID + * @return 符合邀请规则的专家 * @author WendyYang **/ public List appointExpertCheck(Long meetingId, List expertIds) { @@ -226,8 +227,6 @@ public class MeetingManageHelper { switch (ExpertAttendStatusEnum.getByCode(w.getStatus())) { case REFUSED: throw BizException.wrap("专家%s已拒绝参加", expertName); - case REMOVED: - throw BizException.wrap("专家%s已被移除", expertName); case AGREED: throw BizException.wrap("专家%s已同意参加", expertName); case NOTICING: 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 0c5b608..4928322 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 @@ -12,10 +12,9 @@ import com.ningdatech.pmapi.meeting.entity.domain.Meeting; import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; import com.ningdatech.pmapi.meeting.entity.dto.CountConfirmByMeetingIdDTO; import com.ningdatech.pmapi.meeting.entity.dto.MeetingAndAttendStatusDTO; -import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum; -import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusEnum; import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusByDashboard; +import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusEnum; import com.ningdatech.pmapi.meeting.entity.req.MeetingCalenderReq; import com.ningdatech.pmapi.meeting.entity.req.MeetingListReq; import com.ningdatech.pmapi.meeting.entity.vo.*; @@ -186,8 +185,7 @@ public class DashboardManage { return PageVo.empty(); } List meetingIds = CollUtils.fieldList(meetings, Meeting::getId); - Page page = meetingExpertService.pageExpertByStatusAndMeetingIds(new Page<>(po.getPageNumber(), po.getPageSize()), - meetingIds, ExpertAttendStatusEnum.ON_LEAVE); + Page page = meetingExpertService.pageExpertByStatusAndMeetingIds(po.page(), meetingIds, null); if (page.getTotal() == 0) { return PageVo.empty(); } @@ -224,9 +222,7 @@ public class DashboardManage { List attendStatusList = meetingExpertService.listByExpertIdAndStatus(LoginUserUtil.getUserId(), null, null); MeetingCountByExpertVO result = MeetingCountByExpertVO.init(); attendStatusList.forEach(w -> { - if (w.getStatus().equals(ExpertAttendStatusEnum.ON_LEAVE.getCode())) { - result.incrLeaved(); - } else if (w.getAttended() != null && w.getAttended()) { + if (w.getAttended() != null && w.getAttended()) { result.incrAttended(); } else { result.incrToBeAttended(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java index ce351ca..df85d9b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java @@ -407,11 +407,6 @@ public class ExpertInviteManage { removeExpertIds.addAll(tempRefused); }); } - // 被取消的也不可以被再次抽中 - BizUtils.notEmpty(expertGroupByStatus.get(ExpertAttendStatusEnum.REMOVED), w -> { - List tempCanceled = CollUtils.fieldList(w, MeetingExpert::getExpertId); - removeExpertIds.addAll(tempCanceled); - }); List tempExpertIds = CollUtils.fieldList(removeExpertByCompany, MeetingExpert::getExpertId); // 移除确认参加、通知中的、拒绝参加、已取消 userFullInfos.removeIf(w -> tempExpertIds.contains(w.getUserId()) || removeExpertIds.contains(w.getUserId())); @@ -545,13 +540,13 @@ public class ExpertInviteManage { if (CollectionUtils.isNotEmpty(randomRules)) { List randoms = new ArrayList<>(); List expertsByRandom = new ArrayList<>(); - List choosedExpertIds = new ArrayList<>(); + List chooseExpertIds = new ArrayList<>(); LocalDateTime startTime = meeting.getStartTime(); LocalDateTime endTime = meeting.getEndTime(); randomRules.forEach(rule -> { - ExpertChooseDTO tempExperts = expertInviteByRandomRule(avoidRuled, rule, choosedExpertIds, startTime, endTime); + ExpertChooseDTO tempExperts = expertInviteByRandomRule(avoidRuled, rule, chooseExpertIds, startTime, endTime); expertsByRandom.add(tempExperts); - choosedExpertIds.addAll(CollUtils.fieldList(tempExperts.getExperts(), ExpertUserFullInfo::getUserId)); + chooseExpertIds.addAll(CollUtils.fieldList(tempExperts.getExperts(), ExpertUserFullInfo::getUserId)); randoms.add(getExpertInviteRule(rule, meeting.getId())); }); inviteRuleService.saveBatch(randoms); 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 f3f2e67..ff2f50e 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 @@ -140,6 +140,7 @@ public class MeetingManage { } } + @Transactional(rollbackFor = Exception.class) public void continueInvite(Long meetingId) { String key = "CONTINUE_INVITE:" + meetingId; if (!distributedLock.lock(key, RETRY_TIMES)) { @@ -157,7 +158,28 @@ public class MeetingManage { if (!invitedContinue) { throw BizException.wrap("抽取人员数量已满足抽取规则"); } + expertInviteTask.notifyInviteTask(meetingId); + } finally { + distributedLock.releaseLock(key); + } + } + @Transactional(rollbackFor = Exception.class) + public void convertToAppoint(Long meetingId) { + String key = "CONVERT_TO_APPOINT:" + meetingId; + if (!distributedLock.lock(key, RETRY_TIMES)) { + throw BizException.wrap("已进行转换,请勿重复点击"); + } + try { + Meeting meeting = meetingService.getById(meetingId); + if (!MeetingStatusEnum.NORMAL.eq(meeting.getStatus())) { + throw BizException.wrap("转换失败,请刷新后重试"); + } + expertInviteTask.cancelByMeetingId(meetingId); + LambdaUpdateWrapper meetingUpdate = Wrappers.lambdaUpdate(Meeting.class) + .set(Meeting::getInviteType, ExpertInviteTypeEnum.APPOINT.getCode()) + .eq(Meeting::getId, meetingId); + meetingService.update(meetingUpdate); } finally { distributedLock.releaseLock(key); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml index fedb7ff..0752ff4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml @@ -4,7 +4,7 @@