瀏覽代碼

修改确认参加接口

master
WendyYang 1 年之前
父節點
當前提交
7a2fa84220
共有 10 個文件被更改,包括 94 次插入30 次删除
  1. +2
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java
  2. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/AppointInviteRuleDTO.java
  3. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/BatchAppointExpertsReq.java
  4. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertConfirmReq.java
  5. +1
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/ExpertInviteHelper.java
  6. +6
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java
  7. +37
    -14
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java
  8. +24
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IExpertInviteRuleService.java
  9. +13
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/ExpertInviteRuleServiceImpl.java
  10. +6
    -4
      pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IMenuServiceTest.java

+ 2
- 3
pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java 查看文件

@@ -123,8 +123,8 @@ public class MeetingController {
return meetingManage.expertInvitationDetail(meetingId, expertId);
}

@ApiOperation("批量补充专家")
@PostMapping("batchAppointExperts")
@ApiOperation("补充专家(指定抽取)")
@PostMapping("/expert/batchAppoint")
@WebLog(value = "批量补充专家")
public void batchAppointExperts(@Valid @RequestBody BatchAppointExpertsReq po) {
meetingManage.batchAppointExperts(po);
@@ -158,5 +158,4 @@ public class MeetingController {
meetingManage.confirmedRoster(req.getMeetingId());
}


}

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/AppointInviteRuleDTO.java 查看文件

@@ -29,6 +29,6 @@ public class AppointInviteRuleDTO extends AbstractInviteRule {

@NotEmpty(message = "专家ID不能为空", groups = {RuleSave.class, CountCheck.class})
@ApiModelProperty("专家ID")
private List<Long> expertIds;
private List<Long> expertIdList;

}

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/BatchAppointExpertsReq.java 查看文件

@@ -22,7 +22,7 @@ public class BatchAppointExpertsReq {

@NotEmpty(message = "专家ID不能为空")
@ApiModelProperty("专家ID")
private List<Long> expertIds;
private List<Long> expertIdList;

@NotNull(message = "会议ID不能为空")
@ApiModelProperty("会议ID")


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertConfirmReq.java 查看文件

@@ -26,4 +26,7 @@ public class ExpertConfirmReq {
@ApiModelProperty("专家会议ID")
private Long expertMeetingId;

@ApiModelProperty("是否确认参加会议")
private Boolean agreed;

}

+ 1
- 2
pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/ExpertInviteHelper.java 查看文件

@@ -13,7 +13,6 @@ import com.ningdatech.pmapi.meeting.entity.dto.AbstractInviteRule;
import com.ningdatech.pmapi.meeting.entity.dto.AppointInviteRuleDTO;
import com.ningdatech.pmapi.meeting.entity.dto.AvoidInfoDTO;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum;
import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusEnum;
import com.ningdatech.pmapi.meeting.service.IMeetingExpertService;
import com.ningdatech.pmapi.meeting.service.IMeetingService;
import lombok.AllArgsConstructor;
@@ -85,7 +84,7 @@ public class ExpertInviteHelper {
if (appointRule == null) {
return Collections.emptyMap();
}
List<ExpertUserFullInfo> expertInfos = expertUserFullInfoService.listByUserId(appointRule.getExpertIds());
List<ExpertUserFullInfo> expertInfos = expertUserFullInfoService.listByUserId(appointRule.getExpertIdList());
return CollUtils.listToMap(expertInfos, ExpertUserFullInfo::getUserId);
}



+ 6
- 4
pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java 查看文件

@@ -28,7 +28,10 @@ import lombok.AllArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;

import java.util.*;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.Map;

/**
* <p>
@@ -157,13 +160,12 @@ public class MeetingManageHelper {
public List<ExpertUserFullInfo> appointExpertCheck(Long meetingId, List<Long> expertIds) {
List<ExpertUserFullInfo> experts = expertUserFullInfoService.listByUserId(expertIds);
AvoidInfoDTO avoidRule = getAvoidInfoDto(meetingId);
Map<String, Integer> countMap = new HashMap<>(16);
experts.forEach(expert -> {
if (avoidRule.getAvoidUnitIdList().contains(expert.getCompany())) {
throw BizException.wrap("回避单位的专家不可出现在指定邀请名单中");
throw BizException.wrap("请移除已回避单位的专家");
}
if (CollectionUtils.isNotEmpty(avoidRule.getExpertIds()) && avoidRule.getExpertIds().contains(expert.getUserId())) {
throw BizException.wrap("已回避的专家不可被指定邀请");
throw BizException.wrap("请移除已回避的专家");
}
// 校验专家状态
ExpertAccountStatusEnum accountStatus = ExpertAccountStatusEnum.of(expert.getExpertAccountStatus());


+ 37
- 14
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java 查看文件

@@ -102,6 +102,7 @@ public class MeetingManage {
throw BizException.wrap("会议正在创建中");
}
try {
ExpertInviteReq inviteRule = req.getExpertInviteRule();
// 保存会议基本信息
Meeting meeting = BeanUtil.copyProperties(meetingBasic, Meeting.class);
meeting.setStatus(MeetingStatusEnum.NORMAL.getCode());
@@ -112,6 +113,7 @@ public class MeetingManage {
meeting.setCreator(userDetail.getUsername());
meeting.setInviteStopped(Boolean.FALSE);
meeting.setConfirmedRoster(Boolean.FALSE);
meeting.setInviteType(inviteRule.getInviteType());
meetingService.save(meeting);
if (meetingBasic.getIsInnerProject()) {
List<MeetingInnerProject> projects = meetingBasic.getProjectIdList().stream().map(w -> {
@@ -131,7 +133,7 @@ public class MeetingManage {
}
// 抽取专家
req.getExpertInviteRule().setMeetingId(meeting.getId());
expertInviteByCreate(req.getExpertInviteRule());
expertInviteByCreate(inviteRule);
return IdVo.of(meeting.getId());
} finally {
distributedLock.releaseLock(key);
@@ -187,7 +189,7 @@ public class MeetingManage {
ExpertInviteRule appoint = getExpertInviteRule(appointRule, meeting.getId());
inviteRuleService.save(appoint);
Long ruleId = appoint.getId();
List<MeetingExpert> experts = appointRule.getExpertIds().stream().map(w -> {
List<MeetingExpert> experts = appointRule.getExpertIdList().stream().map(w -> {
ExpertUserFullInfo info = usersMap.get(w);
MeetingExpert expert = ExpertInviteBuilder.getExpertByAppoint(meeting.getId(), info, ruleId);
expert.setStatus(ExpertAttendStatusEnum.NOTICING.getCode());
@@ -472,7 +474,7 @@ public class MeetingManage {
AppointInviteRuleDTO appointRule = JSON.parseObject(appoint.getInviteRule(), AppointInviteRuleDTO.class);
AppointRuleVO vo = new AppointRuleVO();
vo.setInviteDesc(appointRule.getInviteDesc());
vo.setExperts(new ArrayList<>(meetingManageHelper.getExpertBasicInfo(appointRule.getExpertIds()).values()));
vo.setExperts(new ArrayList<>(meetingManageHelper.getExpertBasicInfo(appointRule.getExpertIdList()).values()));
result.setAppointRule(vo);
}
return result;
@@ -547,14 +549,34 @@ public class MeetingManage {
// yxtCallOrSmsHelper.sendSms(context);
}

public void batchAppointExperts(BatchAppointExpertsReq po) {
List<ExpertUserFullInfo> userInfos = meetingManageHelper.appointExpertCheck(po.getMeetingId(), po.getExpertIds());
List<MeetingExpert> expertList = CollUtils.convert(userInfos, w -> {
MeetingExpert me = ExpertInviteBuilder.getExpertByAppoint(po.getMeetingId(), w, 0L);
me.setStatus(ExpertAttendStatusEnum.NOTICING.getCode());
return me;
});
meetingExpertService.saveBatch(expertList);
public void batchAppointExperts(BatchAppointExpertsReq req) {
Long meetingId = req.getMeetingId();
String key = "BATCH_APPOINT_EXPERT:" + meetingId;
if (!distributedLock.lock(key, RETRY_TIMES)) {
throw BizException.wrap("补充专家中,请勿重复点击");
}
try {
Meeting meeting = meetingService.getById(meetingId);
if (!ExpertInviteTypeEnum.APPOINT.eq(meeting.getInviteType())) {
throw BizException.wrap("该会议不能指定邀请专家");
}
if (meeting.getConfirmedRoster()) {
throw BizException.wrap("补充专家失败,已确认过专家名单");
}
if (!MeetingStatusEnum.NORMAL.eq(meeting.getStatus())) {
throw BizException.wrap("补充专家失败");
}
AppointInviteRuleDTO rule = inviteRuleService.appointRuleByMeetingId(meetingId);
List<ExpertUserFullInfo> userInfos = meetingManageHelper.appointExpertCheck(meetingId, req.getExpertIdList());
List<MeetingExpert> expertList = CollUtils.convert(userInfos, w -> {
MeetingExpert me = ExpertInviteBuilder.getExpertByAppoint(meetingId, w, rule.getId());
me.setStatus(ExpertAttendStatusEnum.NOTICING.getCode());
return me;
});
meetingExpertService.saveBatch(expertList);
} finally {
distributedLock.releaseLock(key);
}
}

public void stopRandomInvite(Long meetingId) {
@@ -620,16 +642,17 @@ public class MeetingManage {

public void confirmAttendByManager(ExpertConfirmReq req) {
String key = "CONFIRM_ATTEND:" + req.getExpertMeetingId();
String msgPrefix = req.getAgreed() ? "确认参加" : "拒绝参加";
if (!distributedLock.lock(key, RETRY_TIMES)) {
throw BizException.wrap("确认参加失败,请重试!");
throw BizException.wrap("%s失败,请重试!", msgPrefix);
}
try {
MeetingExpert me = meetingExpertService.getById(req.getExpertMeetingId());
if (!ExpertAttendStatusEnum.NOTICING.eq(me.getStatus())) {
throw BizException.wrap("确认参加失败,请重试!");
throw BizException.wrap("%s失败,请重试!", msgPrefix);
}
LambdaUpdateWrapper<MeetingExpert> update = Wrappers.lambdaUpdate(MeetingExpert.class)
.set(MeetingExpert::getStatus, ExpertAttendStatusEnum.AGREED.getCode())
.set(MeetingExpert::getStatus, (req.getAgreed() ? ExpertAttendStatusEnum.AGREED : ExpertAttendStatusEnum.REFUSED).getCode())
.eq(MeetingExpert::getId, req.getExpertMeetingId());
meetingExpertService.update(update);
} finally {


+ 24
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IExpertInviteRuleService.java 查看文件

@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.meeting.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteRule;
import com.ningdatech.pmapi.meeting.entity.dto.AppointInviteRuleDTO;
import com.ningdatech.pmapi.meeting.entity.dto.RandomInviteRuleDTO;

import java.util.List;
@@ -17,8 +18,31 @@ import java.util.Map;
*/
public interface IExpertInviteRuleService extends IService<ExpertInviteRule> {

/**
* 查询会议所有的邀请规则
*
* @param meetingId 会议ID
* @return 抽取规则集合
* @author WendyYang
**/
List<ExpertInviteRule> listByMeetingId(Long meetingId);

/**
* 查询会议所有的随机邀请规则
*
* @param meetingId 会议ID
* @return 随机邀请规则
* @author WendyYang
**/
Map<Long, RandomInviteRuleDTO> randomRuleByMeetingId(Long meetingId);

/**
* 查询会议的指定邀请规则
*
* @param meetingId 会议ID
* @return 指定邀请规则
* @author WendyYang
**/
AppointInviteRuleDTO appointRuleByMeetingId(Long meetingId);

}

+ 13
- 1
pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/ExpertInviteRuleServiceImpl.java 查看文件

@@ -1,10 +1,12 @@
package com.ningdatech.pmapi.meeting.service.impl;

import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteRule;
import com.ningdatech.pmapi.meeting.entity.dto.AppointInviteRuleDTO;
import com.ningdatech.pmapi.meeting.entity.dto.RandomInviteRuleDTO;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum;
import com.ningdatech.pmapi.meeting.mapper.ExpertInviteRuleMapper;
@@ -41,7 +43,17 @@ public class ExpertInviteRuleServiceImpl extends ServiceImpl<ExpertInviteRuleMap
.eq(ExpertInviteRule::getInviteType, ExpertInviteTypeEnum.RANDOM.getCode());
List<ExpertInviteRule> inviteRules = baseMapper.selectList(query);
return inviteRules.stream().collect(Collectors.toMap(ExpertInviteRule::getId,
w -> JSONObject.parseObject(w.getInviteRule(), RandomInviteRuleDTO.class)));
w -> JSONUtil.toBean(w.getInviteRule(), RandomInviteRuleDTO.class)));
}

@Override
public AppointInviteRuleDTO appointRuleByMeetingId(Long meetingId) {
LambdaQueryWrapper<ExpertInviteRule> query = wrapperByMeetingId(meetingId)
.eq(ExpertInviteRule::getInviteType, ExpertInviteTypeEnum.APPOINT.getCode());
ExpertInviteRule inviteRule = baseMapper.selectOne(query);
AppointInviteRuleDTO rule = JSONUtil.toBean(inviteRule.getInviteRule(), AppointInviteRuleDTO.class);
rule.setId(inviteRule.getId());
return rule;
}

}

+ 6
- 4
pmapi/src/test/java/com/ningdatech/pmapi/sys/service/IMenuServiceTest.java 查看文件

@@ -1,9 +1,11 @@
package com.ningdatech.pmapi.sys.service;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.db.Db;
import cn.hutool.db.Entity;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.pmapi.AppTests;
import com.ningdatech.pmapi.sys.model.entity.Menu;
@@ -70,12 +72,12 @@ class IMenuServiceTest extends AppTests {

@Test
public void initMenu() {
// menuService.remove(null);
menuService.remove(null);
roleMenuService.remove(Wrappers.lambdaQuery(RoleMenu.class)
.eq(RoleMenu::getRoleId, 1));
// String str = FileUtil.readString("/Users/wendy/Desktop/long_text_2023-02-13-15-28-42.txt", "UTF-8");
// List<JSONObject> obj = JSONUtil.toList(str, JSONObject.class);
// save(obj, 0);
String str = FileUtil.readString("/Users/wendy/Desktop/long_text_2023-02-13-15-28-42.txt", "UTF-8");
List<JSONObject> obj = JSONUtil.toList(str, JSONObject.class);
save(obj, 0);
menuService.list().forEach(w -> {
roleMenuService.save(new RoleMenu() {{
setRoleId(1L);


Loading…
取消
儲存