Browse Source

修复周参与次数赋值错误

master
WendyYang 11 months ago
parent
commit
9ff46fc295
2 changed files with 12 additions and 6 deletions
  1. +7
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/ExpertRandomInviteAlgorithm.java
  2. +5
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java

+ 7
- 3
pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/ExpertRandomInviteAlgorithm.java View File

@@ -21,6 +21,10 @@ import java.util.stream.Collectors;
**/
public class ExpertRandomInviteAlgorithm {

private ExpertRandomInviteAlgorithm() {

}

private static boolean expertMatchNone(List<MeetingExpert> experts, ExpertUserFullInfo userInfo) {
return experts.stream().noneMatch(w -> w.getExpertId().equals(userInfo.getUserId()));
}
@@ -34,9 +38,9 @@ public class ExpertRandomInviteAlgorithm {
* @return 抽取到的专家信息
* @author WendyYang
**/
public static List<ExpertUserFullInfo> inviteGroupByCompany(Map<String, List<ExpertUserFullInfo>> expertGroupByUnit,
List<List<MeetingExpert>> expertsByRecentMeeting,
Integer count) {
public static List<ExpertUserFullInfo> inviteGroupByUnit(Map<String, List<ExpertUserFullInfo>> expertGroupByUnit,
List<List<MeetingExpert>> expertsByRecentMeeting,
Integer count) {
if (MapUtils.isEmpty(expertGroupByUnit)) {
return Collections.emptyList();
}


+ 5
- 3
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java View File

@@ -21,8 +21,8 @@ import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import com.ningdatech.pmapi.meeting.entity.dto.*;
import com.ningdatech.pmapi.meeting.entity.enumeration.AvoidTypeEnum;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum;
import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusEnum;
import com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper;
import com.ningdatech.pmapi.meeting.helper.ExpertRandomInviteAlgorithm;
import com.ningdatech.pmapi.meeting.helper.MeetingCallOrMsgHelper;
import com.ningdatech.pmapi.meeting.service.IExpertInviteRuleService;
import com.ningdatech.pmapi.meeting.service.IMeetingExpertService;
@@ -377,7 +377,7 @@ public class ExpertInviteManage {
break;
case CURR_UNIT:
Map<String, List<ExpertUserFullInfo>> unitGroup = CollUtils.group(userInfoList, ExpertUserFullInfo::getCompanyUniqCode);
result.setExperts(inviteGroupByCompany(unitGroup, expertsByRecentMeeting(), randomRule.getCount()));
result.setExperts(inviteGroupByUnit(unitGroup, expertsByRecentMeeting(), randomRule.getCount()));
result.setTotal(unitGroup.size());
break;
case CURR_STRIP:
@@ -515,13 +515,15 @@ public class ExpertInviteManage {
}
Map<String, List<ExpertUserFullInfo>> userGroupByUnit = CollUtils.group(userFullInfos, ExpertUserFullInfo::getCompanyUniqCode);
result.setTotal(userGroupByUnit.size());
result.setExperts(inviteGroupByCompany(userGroupByUnit, expertsByRecentMeeting(), count));
result.setExperts(inviteGroupByUnit(userGroupByUnit, expertsByRecentMeeting(), count));
return result;
}

private List<List<MeetingExpert>> expertsByRecentMeeting() {
LambdaQueryWrapper<Meeting> query = Wrappers.lambdaQuery(Meeting.class)
.select(Meeting::getId)
.eq(Meeting::getInviteStatus, Boolean.TRUE)
.ne(Meeting::getStatus, MeetingStatusEnum.CANCELED.getCode())
.orderByDesc(Meeting::getCreateOn)
.last("limit " + recentMeetingCount);
List<Long> meetingIds = CollUtils.fieldList(meetingService.list(query), Meeting::getId);


Loading…
Cancel
Save