From bef6666139fc53570f6eb0265934624c4c748eba Mon Sep 17 00:00:00 2001 From: WendyYang Date: Mon, 17 Apr 2023 10:56:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E9=87=8D=E5=A4=8D=E6=8A=BD?= =?UTF-8?q?=E5=8F=96bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/meeting/manage/ExpertInviteManage.java | 23 +++++++++++++--------- .../pmapi/meeting/task/ExpertInviteTask.java | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) 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 02d99b4..1cc38c1 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 @@ -337,6 +337,7 @@ public class ExpertInviteManage { * @param count 抽取数量 * @param msTime 会议开始时间 * @param meTime 会议结束时间 + * @param reInvite 邀请已拒绝 * @return {@link ExpertChooseDTO} * @author WendyYang **/ @@ -347,7 +348,7 @@ public class ExpertInviteManage { LocalDateTime msTime, LocalDateTime meTime, LocalDateTime tsTime, - boolean invitedRefused) { + boolean reInvite) { ExpertChooseDTO result = new ExpertChooseDTO(new ArrayList<>(), 0); // 合并标签、字典 MergeExpertIdDTO merge = mergeExpertIdsByCondition(randomRule, avoidRule); @@ -402,17 +403,21 @@ public class ExpertInviteManage { List tmpUniqCompanyCodes = CollUtils.fieldList(agreeOrNoticingUserInfos, ExpertUserFullInfo::getCompanyUniqCode); notInCompanyUniqCodeList.addAll(tmpUniqCompanyCodes); } - if (!invitedRefused) { - // 拒绝参加的不可以被再次抽中 - List refusedExperts = expertGroupByStatus.get(REFUSED); - if (refusedExperts.size() > 0) { - List refusedExpertIds = refusedExperts.stream() - .filter(w -> w.getCreateOn().isBefore(tsTime)) + + // 处理已拒绝专家与重复抽取 + BizUtils.notEmpty(expertGroupByStatus.get(REFUSED), refuseExperts -> { + List tmpExpertIdsNotIn; + if (reInvite) { + tmpExpertIdsNotIn = refuseExperts.stream() + .filter(w -> w.getCreateOn().isAfter(tsTime)) .map(MeetingExpert::getExpertId) .collect(Collectors.toList()); - expertIdsNotIn.addAll(refusedExpertIds); + } else { + tmpExpertIdsNotIn = CollUtils.fieldList(refuseExperts, MeetingExpert::getExpertId); } - } + expertIdsNotIn.addAll(tmpExpertIdsNotIn); + }); + boolean hasExpertIdIn = !expertIdsIn.isEmpty(); boolean hasExpertIdNotIn = !expertIdsNotIn.isEmpty(); if (hasExpertIdIn && hasExpertIdNotIn) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertInviteTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertInviteTask.java index 813ff09..0e3d878 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertInviteTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertInviteTask.java @@ -157,7 +157,7 @@ public class ExpertInviteTask { * @author WendyYang **/ public void notifyInviteTask(Long meetingId, boolean... reInvite) { - boolean tmpReInvite = !ArrayUtil.isNotEmpty(reInvite) || reInvite[0]; + boolean tmpReInvite = ArrayUtil.isEmpty(reInvite) || reInvite[0]; if (!INVITE_TASK_MAP.containsKey(meetingId)) { if (addInviteTask(meetingId, false, properties.getInviteDelay(), tmpReInvite, LocalDateTime.now())) { log.info("重置会议的随机抽取状态:{}", meetingId);