Browse Source

修改专家抽取

tags/24080901
WendyYang 7 months ago
parent
commit
5f8f63ad7f
3 changed files with 8 additions and 8 deletions
  1. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/common/util/BizUtils.java
  2. +3
    -3
      hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/ExpertRandomInviteAlgorithm.java
  3. +4
    -4
      hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertInviteManage.java

+ 1
- 1
hz-pm-api/src/main/java/com/hz/pm/api/common/util/BizUtils.java View File

@@ -101,7 +101,7 @@ public class BizUtils {
}))); })));
} }


public static String inSqlJoin(List<String> strings) {
public static String inSqlJoin(Collection<String> strings) {
return strings.stream().map(w -> "'" + w + "'").collect(Collectors.joining(StrPool.COMMA, StrPool.LEFT_BRACKET, StrPool.RIGHT_BRACKET)); return strings.stream().map(w -> "'" + w + "'").collect(Collectors.joining(StrPool.COMMA, StrPool.LEFT_BRACKET, StrPool.RIGHT_BRACKET));
} }




+ 3
- 3
hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/ExpertRandomInviteAlgorithm.java View File

@@ -157,9 +157,9 @@ public class ExpertRandomInviteAlgorithm {
* @return 抽取到的专家信息 * @return 抽取到的专家信息
* @author WendyYang * @author WendyYang
**/ **/
public static List<ExpertUserFullInfo> inviteWithoutCompany(List<ExpertUserFullInfo> userFullInfos,
List<List<MeetingExpert>> expertsByRecentMeeting,
Integer count) {
public static List<ExpertUserFullInfo> inviteRandom(List<ExpertUserFullInfo> userFullInfos,
List<List<MeetingExpert>> expertsByRecentMeeting,
Integer count) {
List<ExpertUserFullInfo> result; List<ExpertUserFullInfo> result;
if (expertsByRecentMeeting.isEmpty()) { if (expertsByRecentMeeting.isEmpty()) {
result = RandomUtil.randomEleList(userFullInfos, count); result = RandomUtil.randomEleList(userFullInfos, count);


+ 4
- 4
hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/ExpertInviteManage.java View File

@@ -372,7 +372,7 @@ public class ExpertInviteManage {
AvoidTypeEnum avoidType = avoidRule.getAvoidType() == null ? AvoidTypeEnum.CURR_UNIT : AvoidTypeEnum.getByCode(avoidRule.getAvoidType()); AvoidTypeEnum avoidType = avoidRule.getAvoidType() == null ? AvoidTypeEnum.CURR_UNIT : AvoidTypeEnum.getByCode(avoidRule.getAvoidType());
switch (avoidType) { switch (avoidType) {
case NONE: case NONE:
result.setExperts(inviteWithoutCompany(userInfoList, expertsByRecentMeeting(), randomRule.getCount()));
result.setExperts(inviteRandom(userInfoList, expertsByRecentMeeting(), randomRule.getCount()));
result.setTotal(userInfoList.size()); result.setTotal(userInfoList.size());
break; break;
case CURR_UNIT: case CURR_UNIT:
@@ -475,12 +475,12 @@ public class ExpertInviteManage {
expertIdsNotIn.addAll(agreeOrNoticingExpertIds); expertIdsNotIn.addAll(agreeOrNoticingExpertIds);
if (AvoidTypeEnum.CURR_UNIT.equals(avoidType)) { if (AvoidTypeEnum.CURR_UNIT.equals(avoidType)) {
List<ExpertUserFullInfo> agreeOrNoticingUserInfos = expertUserFullInfoService.listByUserIds(agreeOrNoticingExpertIds); List<ExpertUserFullInfo> agreeOrNoticingUserInfos = expertUserFullInfoService.listByUserIds(agreeOrNoticingExpertIds);
List<String> tmpUniqCompanyCodes = CollUtils.fieldList(agreeOrNoticingUserInfos, ExpertUserFullInfo::getCompanyUniqCode);
Set<String> tmpUniqCompanyCodes = CollUtils.fieldSet(agreeOrNoticingUserInfos, ExpertUserFullInfo::getCompanyUniqCode);
notInCompanyUniqCodeList.addAll(tmpUniqCompanyCodes); notInCompanyUniqCodeList.addAll(tmpUniqCompanyCodes);
} else if (AvoidTypeEnum.CURR_STRIP.equals(avoidType)) { } else if (AvoidTypeEnum.CURR_STRIP.equals(avoidType)) {
List<ExpertGovBusinessStrip> expertStrips = expertGovBusinessStripService.listByUserIds(agreeOrNoticingExpertIds); List<ExpertGovBusinessStrip> expertStrips = expertGovBusinessStripService.listByUserIds(agreeOrNoticingExpertIds);
if (CollUtil.isNotEmpty(expertStrips)) { if (CollUtil.isNotEmpty(expertStrips)) {
List<String> businessStripCodes = CollUtils.fieldList(expertStrips, ExpertGovBusinessStrip::getBusinessStripCode);
Set<String> businessStripCodes = CollUtils.fieldSet(expertStrips, ExpertGovBusinessStrip::getBusinessStripCode);
query.notExists("select 1 from expert_gov_business_strip egbs " + query.notExists("select 1 from expert_gov_business_strip egbs " +
"where egbs.expertUserId = nd_expert_user_full_info.user_id " + "where egbs.expertUserId = nd_expert_user_full_info.user_id " +
"and egbs.business_strip_code in " + BizUtils.inSqlJoin(businessStripCodes)); "and egbs.business_strip_code in " + BizUtils.inSqlJoin(businessStripCodes));
@@ -526,7 +526,7 @@ public class ExpertInviteManage {
} }
switch (avoidType) { switch (avoidType) {
case NONE: case NONE:
result.setExperts(inviteWithoutCompany(userFullInfos, expertsByRecentMeeting(), count));
result.setExperts(inviteRandom(userFullInfos, expertsByRecentMeeting(), count));
result.setTotal(userFullInfos.size()); result.setTotal(userFullInfos.size());
break; break;
case CURR_UNIT: case CURR_UNIT:


Loading…
Cancel
Save