Browse Source

增加专家移除接口

master
WendyYang 1 year ago
parent
commit
ca00c2329b
2 changed files with 39 additions and 5 deletions
  1. +7
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java
  2. +32
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java

+ 7
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java View File

@@ -153,6 +153,13 @@ public class MeetingController {
meetingManage.confirmAttendByManager(req);
}

@ApiOperation("专家移除")
@PostMapping("/expertRemove")
@WebLog(value = "专家移除")
public void expertRemove(@Valid @RequestBody ExpertRemoveReq req) {
meetingManage.expertRemove(req);
}

@ApiOperation("释放专家")
@PostMapping("/expert/release")
@WebLog(value = "释放专家")


+ 32
- 5
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java View File

@@ -60,6 +60,7 @@ import java.util.function.BiFunction;
import java.util.stream.Collectors;

import static com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum.*;
import static com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum.APPOINT;
import static com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper.getExpertInviteRule;

/**
@@ -199,7 +200,7 @@ public class MeetingManage {
}
expertInviteTask.cancelByMeetingId(meetingId);
LambdaUpdateWrapper<Meeting> meetingUpdate = Wrappers.lambdaUpdate(Meeting.class)
.set(Meeting::getInviteType, ExpertInviteTypeEnum.APPOINT.getCode())
.set(Meeting::getInviteType, APPOINT.getCode())
.eq(Meeting::getId, meetingId);
meetingService.update(meetingUpdate);
saveAppointRuleByConvertFromRandomRule(meetingId);
@@ -212,7 +213,7 @@ public class MeetingManage {
AppointInviteRuleDTO rule = new AppointInviteRuleDTO();
rule.setInviteDesc("转为指定抽取");
rule.setExpertIdList(Collections.emptyList());
rule.setInviteType(ExpertInviteTypeEnum.APPOINT.getCode());
rule.setInviteType(APPOINT.getCode());
rule.setCount(0);
ExpertInviteRule inviteRule = new ExpertInviteRule();
inviteRule.setMeetingId(meetingId);
@@ -482,7 +483,7 @@ public class MeetingManage {
item.setRuleId(me.getRuleId());
item.setIsHeadman(me.getIsHeadman());
ExpertInviteRule rule = ruleMap.get(me.getRuleId());
item.setInviteType(rule == null ? ExpertInviteTypeEnum.APPOINT.getCode() : rule.getInviteType());
item.setInviteType(rule == null ? APPOINT.getCode() : rule.getInviteType());
if (NOTICING.eq(me.getStatus())) {
item.setNoticeStatus("通知中");
} else {
@@ -592,7 +593,7 @@ public class MeetingManage {
}
result.setAvoidInfo(vo);
} else {
List<ExpertInviteRule> appoints = groupByType.get(ExpertInviteTypeEnum.APPOINT);
List<ExpertInviteRule> appoints = groupByType.get(APPOINT);
ExpertInviteRule appoint = appoints.get(0);
AppointInviteRuleDTO appointRule = JSON.parseObject(appoint.getInviteRule(), AppointInviteRuleDTO.class);
appointRule.setId(appoint.getId());
@@ -612,7 +613,7 @@ public class MeetingManage {
}
try {
Meeting meeting = meetingService.getById(meetingId);
if (!ExpertInviteTypeEnum.APPOINT.eq(meeting.getInviteType())) {
if (!APPOINT.eq(meeting.getInviteType())) {
throw BizException.wrap("该会议不能指定邀请专家");
}
if (meeting.getConfirmedRoster()) {
@@ -715,6 +716,32 @@ public class MeetingManage {
}
}

public void expertRemove(ExpertRemoveReq req) {
String key = "EXPERT_REMOVE:" + req.getExpertMeetingId();
if (!distributedLock.lock(key, RETRY_TIMES)) {
throw BizException.wrap("删除专家失败,请重试!");
}
try {
Meeting meeting = meetingService.getById(req.getMeetingId());
if (MeetingStatusEnum.CANCELED.eq(meeting.getStatus())) {
throw BizException.wrap("会议已取消!");
}
if (LocalDateTime.now().isAfter(meeting.getStartTime())) {
throw BizException.wrap("会议已开始,不允许移除专家!");
}
MeetingExpert expert = meetingExpertService.getById(req.getExpertMeetingId());
if (!APPOINT.eq(expert.getInviteType())) {
throw BizException.wrap("随机抽取的专家不允许移除!");
}
if (!NOTICING.eq(expert.getStatus())) {
throw BizException.wrap("已确认过的专家不允许移除!");
}
meetingExpertService.removeById(req.getExpertMeetingId());
} finally {
distributedLock.releaseLock(key);
}
}

public void releaseExperts(MeetingCancelReq req) {
String key = "EXPERT_RELEASE:" + req.getMeetingId();
if (!distributedLock.lock(key, RETRY_TIMES)) {


Loading…
Cancel
Save