diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/BizUtils.java b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/BizUtils.java index 20a6a21..ac62f7f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/common/util/BizUtils.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/common/util/BizUtils.java @@ -101,7 +101,7 @@ public class BizUtils { }))); } - public static String inSqlJoin(List strings) { + public static String inSqlJoin(Collection strings) { return strings.stream().map(w -> "'" + w + "'").collect(Collectors.joining(StrPool.COMMA, StrPool.LEFT_BRACKET, StrPool.RIGHT_BRACKET)); } diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/ExpertRandomInviteAlgorithm.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/ExpertRandomInviteAlgorithm.java index 7854d85..d8956b8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/ExpertRandomInviteAlgorithm.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/ExpertRandomInviteAlgorithm.java @@ -157,9 +157,9 @@ public class ExpertRandomInviteAlgorithm { * @return 抽取到的专家信息 * @author WendyYang **/ - public static List inviteWithoutCompany(List userFullInfos, - List> expertsByRecentMeeting, - Integer count) { + public static List inviteRandom(List userFullInfos, + List> expertsByRecentMeeting, + Integer count) { List result; if (expertsByRecentMeeting.isEmpty()) { result = RandomUtil.randomEleList(userFullInfos, count); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertInviteManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertInviteManage.java index fbb87a8..2e2410b 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertInviteManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertInviteManage.java @@ -372,7 +372,7 @@ public class ExpertInviteManage { AvoidTypeEnum avoidType = avoidRule.getAvoidType() == null ? AvoidTypeEnum.CURR_UNIT : AvoidTypeEnum.getByCode(avoidRule.getAvoidType()); switch (avoidType) { case NONE: - result.setExperts(inviteWithoutCompany(userInfoList, expertsByRecentMeeting(), randomRule.getCount())); + result.setExperts(inviteRandom(userInfoList, expertsByRecentMeeting(), randomRule.getCount())); result.setTotal(userInfoList.size()); break; case CURR_UNIT: @@ -475,12 +475,12 @@ public class ExpertInviteManage { expertIdsNotIn.addAll(agreeOrNoticingExpertIds); if (AvoidTypeEnum.CURR_UNIT.equals(avoidType)) { List agreeOrNoticingUserInfos = expertUserFullInfoService.listByUserIds(agreeOrNoticingExpertIds); - List tmpUniqCompanyCodes = CollUtils.fieldList(agreeOrNoticingUserInfos, ExpertUserFullInfo::getCompanyUniqCode); + Set tmpUniqCompanyCodes = CollUtils.fieldSet(agreeOrNoticingUserInfos, ExpertUserFullInfo::getCompanyUniqCode); notInCompanyUniqCodeList.addAll(tmpUniqCompanyCodes); } else if (AvoidTypeEnum.CURR_STRIP.equals(avoidType)) { List expertStrips = expertGovBusinessStripService.listByUserIds(agreeOrNoticingExpertIds); if (CollUtil.isNotEmpty(expertStrips)) { - List businessStripCodes = CollUtils.fieldList(expertStrips, ExpertGovBusinessStrip::getBusinessStripCode); + Set businessStripCodes = CollUtils.fieldSet(expertStrips, ExpertGovBusinessStrip::getBusinessStripCode); query.notExists("select 1 from expert_gov_business_strip egbs " + "where egbs.expertUserId = nd_expert_user_full_info.user_id " + "and egbs.business_strip_code in " + BizUtils.inSqlJoin(businessStripCodes)); @@ -526,7 +526,7 @@ public class ExpertInviteManage { } switch (avoidType) { case NONE: - result.setExperts(inviteWithoutCompany(userFullInfos, expertsByRecentMeeting(), count)); + result.setExperts(inviteRandom(userFullInfos, expertsByRecentMeeting(), count)); result.setTotal(userFullInfos.size()); break; case CURR_UNIT: