Browse Source

会议专家抽取列表增加邀请类型

master
WendyYang 1 year ago
parent
commit
eec1f79003
4 changed files with 15 additions and 15 deletions
  1. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteExpertListItemVO.java
  2. +2
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java
  3. +8
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java
  4. +2
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertInviteTask.java

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteExpertListItemVO.java View File

@@ -41,6 +41,9 @@ public class InviteExpertListItemVO extends ExpertBasicInfoVO {
@ApiModelProperty("邀请状态")
private Integer status;

@ApiModelProperty("抽取类型")
private Integer inviteType;

@ApiModelProperty("通知时间")
private LocalDateTime noticeTime;


+ 2
- 5
pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java View File

@@ -20,7 +20,6 @@ import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteAvoidRule;
import com.ningdatech.pmapi.meeting.entity.domain.Meeting;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import com.ningdatech.pmapi.meeting.entity.dto.AvoidRuleDTO;
import com.ningdatech.pmapi.meeting.entity.dto.MeetingAndAttendStatusDTO;
import com.ningdatech.pmapi.meeting.entity.dto.MeetingBasicDTO;
import com.ningdatech.pmapi.meeting.entity.dto.RandomInviteRuleDTO;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum;
@@ -236,12 +235,10 @@ public class MeetingManageHelper {
if (expertInfo != null) {
String expertName = expertInfo.getExpertName();
switch (ExpertAttendStatusEnum.getByCode(w.getStatus())) {
case REFUSED:
throw BizException.wrap("专家%s已拒绝参加", expertName);
case AGREED:
throw BizException.wrap("专家%s已同意参加", expertName);
throw BizException.wrap("专家 %s 已同意参加", expertName);
case NOTICING:
throw BizException.wrap("专家%s正在通知中", expertName);
throw BizException.wrap("专家 %s 正在通知中", expertName);
default:
break;
}


+ 8
- 6
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java View File

@@ -56,7 +56,7 @@ import org.springframework.util.Assert;

import java.time.LocalDateTime;
import java.util.*;
import java.util.function.Function;
import java.util.function.BiFunction;
import java.util.stream.Collectors;

import static com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum.*;
@@ -238,7 +238,7 @@ public class MeetingManage {
// 随机抽取的话则需进行抽取数量校验
LocalDateTime now = LocalDateTime.now();
expertInviteManage.expertInviteByMeetingCreate(meeting, randomRules, avoidInfo);
expertInviteTask.addInviteTaskByMeetingCreate(meeting.getId(), 5, now);
expertInviteTask.addInviteTaskByMeetingCreate(meeting.getId(), now);
LambdaUpdateWrapper<Meeting> mUpdate = Wrappers.lambdaUpdate(Meeting.class)
.set(Meeting::getInviteStatus, false)
.eq(Meeting::getId, meeting.getId());
@@ -470,7 +470,7 @@ public class MeetingManage {
}
List<Long> expertIds = CollUtils.fieldList(experts, MeetingExpert::getExpertId);
Map<Long, ExpertBasicInfoVO> expertMap = meetingManageHelper.getExpertBasicInfo(expertIds);
Function<MeetingExpert, InviteExpertListItemVO> mapping = me -> {
BiFunction<MeetingExpert, Map<Long, ExpertInviteRule>, InviteExpertListItemVO> mapping = (me, ruleMap) -> {
ExpertBasicInfoVO expert = expertMap.get(me.getExpertId());
InviteExpertListItemVO item = BeanUtil.copyProperties(expert, InviteExpertListItemVO.class);
item.setExpertMeetingId(me.getId());
@@ -480,6 +480,8 @@ public class MeetingManage {
item.setNoticeTime(me.getCreateOn());
item.setRuleId(me.getRuleId());
item.setIsHeadman(me.getIsHeadman());
ExpertInviteRule rule = ruleMap.get(me.getRuleId());
item.setInviteType(rule == null ? ExpertInviteTypeEnum.APPOINT.getCode() : rule.getInviteType());
if (NOTICING.eq(me.getStatus())) {
item.setNoticeStatus("通知中");
} else {
@@ -487,12 +489,12 @@ public class MeetingManage {
}
return item;
};
List<ExpertInviteRule> inviteRules = inviteRuleService.listByMeetingId(meetingId);
Map<Long, ExpertInviteRule> ruleMap = CollUtils.listToMap(inviteRules, ExpertInviteRule::getId);
boolean isRandom = ExpertInviteTypeEnum.RANDOM.eq(meeting.getInviteType());
if (isRandom) {
result.setInviteStatistics(new ArrayList<>());
Map<Long, List<MeetingExpert>> groupByRule = CollUtils.group(experts, MeetingExpert::getRuleId);
List<ExpertInviteRule> inviteRules = inviteRuleService.listByMeetingId(meetingId);
Map<Long, ExpertInviteRule> ruleMap = CollUtils.listToMap(inviteRules, ExpertInviteRule::getId);
ruleMap.forEach((k, v) -> {
InviteStatisticsByRuleVO statistics = InviteStatisticsByRuleVO.init(k);
statistics.setInviteCnt(v.getInviteCount());
@@ -508,7 +510,7 @@ public class MeetingManage {
result.getInviteStatistics().add(statistics);
});
}
List<InviteExpertListItemVO> converts = CollUtils.convert(experts, mapping);
List<InviteExpertListItemVO> converts = CollUtils.convert(experts, me -> mapping.apply(me, ruleMap));
result.setInviteExpertList(converts);
// 确定参加列表
return result;


+ 2
- 4
pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertInviteTask.java View File

@@ -27,7 +27,6 @@ import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springframework.aop.framework.AopContext;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@@ -205,13 +204,12 @@ public class ExpertInviteTask {
* 创建会议时添加抽取任务
*
* @param meetingId 会议ID
* @param delayTime 延迟时间
* @param tsTime 开始时间
* @author WendyYang
**/
public void addInviteTaskByMeetingCreate(Long meetingId, int delayTime, LocalDateTime tsTime) {
public void addInviteTaskByMeetingCreate(Long meetingId, LocalDateTime tsTime) {
Assert.isTrue(properties.getEnable(), "随机邀请已关闭");
addInviteTask(meetingId, false, delayTime, false, tsTime);
addInviteTask(meetingId, false, properties.getInviteDelay(), false, tsTime);
InviteCacheDTO cacheVal = InviteCacheDTO.of(meetingId, false, tsTime);
cachePlusOps.hSet(getCacheKey(meetingId), cacheVal);
}


Loading…
Cancel
Save