Browse Source

修复周参与次数赋值错误

master
WendyYang 9 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 { public class ExpertRandomInviteAlgorithm {


private ExpertRandomInviteAlgorithm() {

}

private static boolean expertMatchNone(List<MeetingExpert> experts, ExpertUserFullInfo userInfo) { private static boolean expertMatchNone(List<MeetingExpert> experts, ExpertUserFullInfo userInfo) {
return experts.stream().noneMatch(w -> w.getExpertId().equals(userInfo.getUserId())); return experts.stream().noneMatch(w -> w.getExpertId().equals(userInfo.getUserId()));
} }
@@ -34,9 +38,9 @@ public class ExpertRandomInviteAlgorithm {
* @return 抽取到的专家信息 * @return 抽取到的专家信息
* @author WendyYang * @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)) { if (MapUtils.isEmpty(expertGroupByUnit)) {
return Collections.emptyList(); 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.dto.*;
import com.ningdatech.pmapi.meeting.entity.enumeration.AvoidTypeEnum; import com.ningdatech.pmapi.meeting.entity.enumeration.AvoidTypeEnum;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; 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.ExpertInviteHelper;
import com.ningdatech.pmapi.meeting.helper.ExpertRandomInviteAlgorithm;
import com.ningdatech.pmapi.meeting.helper.MeetingCallOrMsgHelper; import com.ningdatech.pmapi.meeting.helper.MeetingCallOrMsgHelper;
import com.ningdatech.pmapi.meeting.service.IExpertInviteRuleService; import com.ningdatech.pmapi.meeting.service.IExpertInviteRuleService;
import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; import com.ningdatech.pmapi.meeting.service.IMeetingExpertService;
@@ -377,7 +377,7 @@ public class ExpertInviteManage {
break; break;
case CURR_UNIT: case CURR_UNIT:
Map<String, List<ExpertUserFullInfo>> unitGroup = CollUtils.group(userInfoList, ExpertUserFullInfo::getCompanyUniqCode); 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()); result.setTotal(unitGroup.size());
break; break;
case CURR_STRIP: case CURR_STRIP:
@@ -515,13 +515,15 @@ public class ExpertInviteManage {
} }
Map<String, List<ExpertUserFullInfo>> userGroupByUnit = CollUtils.group(userFullInfos, ExpertUserFullInfo::getCompanyUniqCode); Map<String, List<ExpertUserFullInfo>> userGroupByUnit = CollUtils.group(userFullInfos, ExpertUserFullInfo::getCompanyUniqCode);
result.setTotal(userGroupByUnit.size()); result.setTotal(userGroupByUnit.size());
result.setExperts(inviteGroupByCompany(userGroupByUnit, expertsByRecentMeeting(), count));
result.setExperts(inviteGroupByUnit(userGroupByUnit, expertsByRecentMeeting(), count));
return result; return result;
} }


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


Loading…
Cancel
Save