From 70e1982e8a75a0b1b34a8f7a8f2ca5d7072ade63 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 8 Mar 2023 09:12:48 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E6=8A=BD=E5=8F=96?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/meeting/entity/domain/MeetingExpert.java | 13 +++++---- .../pmapi/meeting/entity/dto/InviteCacheDTO.java | 27 ++++++++++++++++++ .../meeting/entity/dto/MeetingInviteCacheDTO.java | 27 ------------------ .../entity/enumeration/ExpertAttendStatusEnum.java | 3 -- .../pmapi/meeting/helper/MeetingManageHelper.java | 3 +- .../pmapi/meeting/manage/DashboardManage.java | 10 ++----- .../pmapi/meeting/manage/ExpertInviteManage.java | 11 ++------ .../pmapi/meeting/manage/MeetingManage.java | 3 +- .../pmapi/meeting/mapper/MeetingExpertMapper.xml | 9 +----- .../service/impl/MeetingExpertServiceImpl.java | 7 +---- .../pmapi/meeting/task/ExpertInviteTask.java | 33 +++++++++++----------- 11 files changed, 61 insertions(+), 85 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/InviteCacheDTO.java delete mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingInviteCacheDTO.java 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/InviteCacheDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/InviteCacheDTO.java new file mode 100644 index 0000000..b7ed771 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/InviteCacheDTO.java @@ -0,0 +1,27 @@ +package com.ningdatech.pmapi.meeting.entity.dto; + +import lombok.Data; + +/** + *

+ * MeetingInviteDTO + *

+ * + * @author WendyYang + * @since 19:21 2023/3/7 + */ +@Data +public final class InviteCacheDTO { + + private Long meetingId; + + private Boolean invitedRefused; + + public static InviteCacheDTO of(Long meetingId, Boolean invitedRefused) { + InviteCacheDTO bo = new InviteCacheDTO(); + bo.setMeetingId(meetingId); + bo.setInvitedRefused(invitedRefused); + return bo; + } + +} \ No newline at end of file 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/MeetingInviteCacheDTO.java deleted file mode 100644 index 9c3fea6..0000000 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingInviteCacheDTO.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.ningdatech.pmapi.meeting.entity.dto; - -import lombok.Data; - -/** - *

- * MeetingInviteDTO - *

- * - * @author WendyYang - * @since 19:21 2023/3/7 - */ -@Data -public final class MeetingInviteCacheDTO { - - private Long meetingId; - - private Boolean invitedRefused; - - public static MeetingInviteCacheDTO of(Long meetingId, Boolean invitedRefused) { - MeetingInviteCacheDTO bo = new MeetingInviteCacheDTO(); - bo.setMeetingId(meetingId); - bo.setInvitedRefused(invitedRefused); - return bo; - } - -} \ No newline at end of file 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..fd51e2b 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,7 @@ public class MeetingManage { if (!invitedContinue) { throw BizException.wrap("抽取人员数量已满足抽取规则"); } - + expertInviteTask.notifyInviteTask(meetingId); } 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 @@