Kaynağa Gözat

会议创建

tags/24080901
WendyYang 1 yıl önce
ebeveyn
işleme
ac12ff036c
20 değiştirilmiş dosya ile 257 ekleme ve 270 silme
  1. +4
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/builder/ExpertInviteBuilder.java
  2. +3
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java
  3. +7
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteAvoidRule.java
  4. +2
    -9
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/Meeting.java
  5. +10
    -32
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/AvoidInfoDTO.java
  6. +5
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingBasicDTO.java
  7. +7
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertInviteTypeEnum.java
  8. +7
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertInviteReq.java
  9. +31
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingCreateReq.java
  10. +4
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteRuleDetailVO.java
  11. +49
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/ExpertInviteHelper.java
  12. +7
    -12
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java
  13. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/DashboardManage.java
  14. +29
    -117
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java
  15. +75
    -61
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java
  16. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingExpertService.java
  17. +3
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/ExpertInviteAvoidRuleServiceImpl.java
  18. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/ExpertInviteRuleServiceImpl.java
  19. +4
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingExpertServiceImpl.java
  20. +4
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertInviteTask.java

+ 4
- 5
pmapi/src/main/java/com/ningdatech/pmapi/meeting/builder/ExpertInviteBuilder.java Dosyayı Görüntüle

@@ -2,8 +2,7 @@ package com.ningdatech.pmapi.meeting.builder;

import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteType;
import com.ningdatech.pmapi.user.entity.UserInfo;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum;

/**
* <p>
@@ -19,10 +18,10 @@ public class ExpertInviteBuilder {
}

public static MeetingExpert getExpertByRandom(Long meetingId, ExpertUserFullInfo user, Long ruleId) {
return getExpertBasic(meetingId, user, ruleId, ExpertInviteType.RANDOM);
return getExpertBasic(meetingId, user, ruleId, ExpertInviteTypeEnum.RANDOM);
}

private static MeetingExpert getExpertBasic(Long meetingId, ExpertUserFullInfo user, Long ruleId, ExpertInviteType type) {
private static MeetingExpert getExpertBasic(Long meetingId, ExpertUserFullInfo user, Long ruleId, ExpertInviteTypeEnum type) {
MeetingExpert expert = new MeetingExpert();
expert.setMeetingId(meetingId);
expert.setMobile(user.getPhoneNo());
@@ -34,7 +33,7 @@ public class ExpertInviteBuilder {
}

public static MeetingExpert getExpertByAppoint(Long meetingId, ExpertUserFullInfo user, Long ruleId) {
return getExpertBasic(meetingId, user, ruleId, ExpertInviteType.APPOINT);
return getExpertBasic(meetingId, user, ruleId, ExpertInviteTypeEnum.APPOINT);
}

}

+ 3
- 3
pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java Dosyayı Görüntüle

@@ -36,20 +36,20 @@ public class MeetingController {
@PostMapping("/save")
@ApiOperation("新建会议")
@WebLog(value = "新建会议")
public IdVo<Long> meetingCreate(@Valid @RequestBody MeetingBasicDTO req) {
public IdVo<Long> meetingCreate(@Valid @RequestBody MeetingCreateReq req) {
return meetingManage.save(req);
}

@PostMapping("/expertInviteByCreate")
@ApiOperation("新建会议-专家抽取")
@WebLog(value = "新建会议-专家抽取")
public void expertInviteByCreate(@Valid @RequestBody ExpertInviteCreateReq po) {
public void expertInviteByCreate(@Valid @RequestBody ExpertInviteReq po) {
meetingManage.expertInviteByCreate(po);
}

@ApiOperation("专家抽取数量校验")
@PostMapping("/expertCountOnChange")
public ExpertCountOnChangeVO expertCountOnChange(@RequestBody ExpertInviteCreateReq po) {
public ExpertCountOnChangeVO expertCountOnChange(@RequestBody ExpertInviteReq po) {
return meetingManage.expertCountOnChange(po);
}



+ 7
- 4
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/ExpertInviteAvoidRule.java Dosyayı Görüntüle

@@ -35,11 +35,14 @@ public class ExpertInviteAvoidRule implements Serializable {
@ApiModelProperty("回避专家ID")
private String expertIds;

@ApiModelProperty("回避单位名称")
private String companyIds;
@ApiModelProperty("回避单位ID")
private String avoidUnitIds;

@ApiModelProperty("回避本单位同事")
private Boolean avoidMates;
@ApiModelProperty("回避条线ID")
private String avoidOrgIds;

@ApiModelProperty("每周参与次数")
private Integer weekInviteCount;

@ApiModelProperty("创建人ID")
private Long createBy;


+ 2
- 9
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/Meeting.java Dosyayı Görüntüle

@@ -81,20 +81,13 @@ public class Meeting implements Serializable {
@ApiModelProperty("是否停止随机邀请")
private Boolean inviteStopped;

@ApiModelProperty("是否进行了专家抽取")
private Boolean invited;

@ApiModelProperty("取消说明")
private String cancelRemark;

@ApiModelProperty("举办单位")
private String holdOrg;

@ApiModelProperty("举办单位ID")
private String holdOrgCode;

public String getHoldCompanyBracket() {
return "(" + this.getHoldOrg() + ")";
}
@ApiModelProperty("是否为内部项目")
private Boolean isInnerProject;

}

+ 10
- 32
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/AvoidInfoDTO.java Dosyayı Görüntüle

@@ -6,12 +6,11 @@ import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Collections;
import java.util.List;

/**
* <p>
* AvoidInfoDto
* 专家邀请回避规则
* </p>
*
* @author WendyYang
@@ -23,38 +22,17 @@ public class AvoidInfoDTO {

@ApiModelProperty("回避单位")
@NotEmpty(message = "回避单位不能为空", groups = {AbstractInviteRule.RuleSave.class})
private List<String> companyIds;
private List<String> avoidUnitIdList;

@ApiModelProperty("是否回避同单位其他专家")
@NotNull(message = "是否回避同单位其他专家不能为空")
private Boolean avoidMates;
@ApiModelProperty("回避条线")
@NotEmpty(message = "回避条线不能为空", groups = {AbstractInviteRule.RuleSave.class})
private List<String> avoidOrgIdList;

@ApiModelProperty("回避专家ID")
private List<Long> expertIds;
@ApiModelProperty("每周邀请次数")
private Integer weekInviteCount;

/**
* 返回一个默认值,仅在前端未传值时使用
*
* @return /
*/
public static AvoidInfoDTO defVal() {
AvoidInfoDTO val = new AvoidInfoDTO();
val.setAvoidMates(false);
val.setCompanyIds(Collections.emptyList());
val.setExpertIds(Collections.emptyList());
return val;
}

public void initDefVal() {
if (this.avoidMates == null) {
this.setAvoidMates(false);
}
if (this.companyIds == null) {
this.setCompanyIds(Collections.emptyList());
}
if (this.expertIds == null) {
this.setExpertIds(Collections.emptyList());
}
}
@ApiModelProperty("回避专家")
@NotEmpty(message = "回避专家不能为空", groups = {AbstractInviteRule.RuleSave.class})
private List<Long> expertIds;

}

+ 5
- 2
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/dto/MeetingBasicDTO.java Dosyayı Görüntüle

@@ -1,6 +1,5 @@
package com.ningdatech.pmapi.meeting.entity.dto;

import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -22,6 +21,10 @@ import java.time.LocalDateTime;
@ApiModel("会议基本信息")
public class MeetingBasicDTO {

@NotNull(message = "是否是系统内部项目不能为空")
@ApiModelProperty("是否是系统内部项目")
private Boolean isInnerProject;

@NotEmpty(message = "事务名称不能为空")
@ApiModelProperty("事务名称")
private String name;
@@ -50,7 +53,7 @@ public class MeetingBasicDTO {

@NotEmpty(message = "联系人不能为空")
@ApiModelProperty("联系人")
private String contacter;
private String connecter;

@NotEmpty(message = "联系方式不能为空")
@ApiModelProperty("联系方式")


pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertInviteType.java → pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/enumeration/ExpertInviteTypeEnum.java Dosyayı Görüntüle

@@ -13,7 +13,7 @@ import java.util.Arrays;
* @since 10:11 2022/7/26
*/
@Getter
public enum ExpertInviteType {
public enum ExpertInviteTypeEnum {

/**
* 专家抽取类型
@@ -24,12 +24,16 @@ public enum ExpertInviteType {
private final Integer code;
private final String name;

ExpertInviteType(Integer code, String name) {
ExpertInviteTypeEnum(Integer code, String name) {
this.code = code;
this.name = name;
}

public static ExpertInviteType getByCode(Integer code) {
public boolean eq(Integer code) {
return this.getCode().equals(code);
}

public static ExpertInviteTypeEnum getByCode(Integer code) {
return Arrays.stream(values())
.filter(w -> w.getCode().equals(code))
.findFirst()

pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertInviteCreateReq.java → pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ExpertInviteReq.java Dosyayı Görüntüle

@@ -1,6 +1,5 @@
package com.ningdatech.pmapi.meeting.entity.req;

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.dto.RandomInviteRuleDTO;
@@ -22,15 +21,19 @@ import java.util.List;
*/
@Data
@ApiModel("专家抽取新家实体")
public class ExpertInviteCreateReq {
public class ExpertInviteReq {

@NotNull(message = "会议ID不能为空", groups = {AbstractInviteRule.RuleSave.class, AbstractInviteRule.CountCheck.class})
@ApiModelProperty("会议ID")
private Long meetingId;

@NotNull(message = "抽取类型不能为空")
@ApiModelProperty("抽取类型:1 随机抽取、2 指定抽取")
private Integer inviteType;

@Valid
@NotNull(message = "回避信息不能为空")
@ApiModelProperty("回避信息")
private AvoidInfoDTO avoidInfo;
private AvoidInfoDTO avoidRule;

@Valid
@ApiModelProperty("随机抽取规则")

+ 31
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/MeetingCreateReq.java Dosyayı Görüntüle

@@ -0,0 +1,31 @@
package com.ningdatech.pmapi.meeting.entity.req;

import com.ningdatech.pmapi.meeting.entity.dto.MeetingBasicDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

/**
* <p>
* MeetingCreateReq
* </p>
*
* @author WendyYang
* @since 14:33 2023/2/28
*/
@Data
public class MeetingCreateReq {

@Valid
@NotNull(message = "会议基本信息不能为空")
@ApiModelProperty("会议基本信息")
private MeetingBasicDTO meetingBasicInfo;

@Valid
@NotNull(message = "会议邀请规则不能为空")
@ApiModelProperty("会议邀请规则")
private ExpertInviteReq expertInviteRule;

}

+ 4
- 2
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteRuleDetailVO.java Dosyayı Görüntüle

@@ -37,9 +37,11 @@ public class InviteRuleDetailVO {
@Data
public static class AvoidInfoVo {

private List<String> companyIds;
private List<String> avoidUnitIds;

private Boolean avoidMates;
private List<String> avoidOrgIds;

private Integer weekInviteCount;

private List<ExpertBasicInfoVO> experts;



+ 49
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/ExpertInviteHelper.java Dosyayı Görüntüle

@@ -1,10 +1,17 @@
package com.ningdatech.pmapi.meeting.helper;

import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo;
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService;
import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteRule;
import com.ningdatech.pmapi.meeting.entity.domain.Meeting;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
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.ExpertAttendStatus;
import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatus;
@@ -12,7 +19,9 @@ import com.ningdatech.pmapi.meeting.service.IMeetingExpertService;
import com.ningdatech.pmapi.meeting.service.IMeetingService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

import java.time.LocalDateTime;
import java.util.*;
@@ -32,6 +41,7 @@ public class ExpertInviteHelper {

private final IMeetingService meetingService;
private final IMeetingExpertService meetingExpertService;
private final IExpertUserFullInfoService expertUserFullInfoService;

/**
* 获取时间段内被抽中的专家(通知中、确认参加)
@@ -77,4 +87,43 @@ public class ExpertInviteHelper {
return expertIds;
}

public Map<Long, ExpertUserFullInfo> checkAppointExpert(AppointInviteRuleDTO appointRule, AvoidInfoDTO avoidRule) {
if (appointRule == null) {
return Collections.emptyMap();
}
List<ExpertUserFullInfo> expertInfos = expertUserFullInfoService.listByUserId(appointRule.getExpertIds());
Map<Long, ExpertUserFullInfo> infoMap = CollUtils.listToMap(expertInfos, ExpertUserFullInfo::getUserId);
if (avoidRule == null) {
return infoMap;
}
infoMap.forEach((key, userFullInfo) -> {
if (CollectionUtils.isNotEmpty(avoidRule.getExpertIds())) {
boolean contains = avoidRule.getExpertIds().contains(key);
Assert.isTrue(!contains, "已回避的专家不可被指定邀请");
}
if (CollUtil.isNotEmpty(avoidRule.getAvoidUnitIdList())) {
boolean contains = avoidRule.getAvoidUnitIdList().contains(userFullInfo.getCompany());
Assert.isTrue(!contains, "回避单位的专家不可出现在指定邀请名单中");
}
});
return infoMap;
}

/**
* 构建邀请规则
*
* @param rule 邀请规则
* @param meetingId 会议ID
* @return {@link ExpertInviteRule}
* @author WendyYang
**/
public static ExpertInviteRule getExpertInviteRule(AbstractInviteRule rule, Long meetingId) {
ExpertInviteRule result = new ExpertInviteRule();
result.setInviteRule(JSONObject.toJSONString(rule));
result.setInviteCount(rule.getCount());
result.setInviteType(rule.getInviteType());
result.setMeetingId(meetingId);
return result;
}

}

+ 7
- 12
pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingManageHelper.java Dosyayı Görüntüle

@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.common.util.BizUtils;
import com.ningdatech.pmapi.common.util.StrUtils;
import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum;
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo;
import com.ningdatech.pmapi.expert.service.ExpertInfoService;
@@ -80,7 +79,6 @@ public class MeetingManageHelper {
.connecter(meeting.getConnecter())
.contact(meeting.getContact())
.status(meeting.getStatus())
.invited(meeting.getInvited())
.holdOrg(meeting.getHoldOrg())
.build();
}
@@ -134,11 +132,12 @@ public class MeetingManageHelper {

public AvoidInfoDTO getAvoidInfoDto(Long meetingId) {
ExpertInviteAvoidRule avoidRule = inviteAvoidRuleService.getByMeetingId(meetingId);
AvoidInfoDTO avoidInfoDto = new AvoidInfoDTO();
avoidInfoDto.setAvoidMates(avoidRule.getAvoidMates());
avoidInfoDto.setExpertIds(BizUtils.splitToLong(avoidRule.getExpertIds()));
avoidInfoDto.setCompanyIds(StrUtils.split(avoidRule.getCompanyIds()));
return avoidInfoDto;
AvoidInfoDTO result = new AvoidInfoDTO();
result.setAvoidOrgIdList(StrUtil.split(avoidRule.getAvoidOrgIds(), ","));
result.setExpertIds(BizUtils.splitToLong(avoidRule.getExpertIds()));
result.setAvoidUnitIdList(StrUtil.split(avoidRule.getAvoidUnitIds(), ","));
result.setWeekInviteCount(result.getWeekInviteCount());
return result;
}

public void saveAvoidInfo(Long meetingId, List<Long> expertIds) {
@@ -159,16 +158,12 @@ public class MeetingManageHelper {
AvoidInfoDTO avoidRule = getAvoidInfoDto(meetingId);
Map<String, Integer> countMap = new HashMap<>(16);
experts.forEach(expert -> {
if (avoidRule.getCompanyIds().contains(expert.getCompany())) {
if (avoidRule.getAvoidUnitIdList().contains(expert.getCompany())) {
throw BizException.wrap("回避单位的专家不可出现在指定邀请名单中");
}
if (CollectionUtils.isNotEmpty(avoidRule.getExpertIds()) && avoidRule.getExpertIds().contains(expert.getUserId())) {
throw BizException.wrap("已回避的专家不可被指定邀请");
}
if (avoidRule.getAvoidMates()) {
Integer oldValue = countMap.put(expert.getCompany(), 1);
Assert.isNull(oldValue, "不可选择同单位的多个专家");
}
// 校验专家状态
ExpertAccountStatusEnum accountStatus = ExpertAccountStatusEnum.of(expert.getExpertAccountStatus());
if (!accountStatus.equals(ExpertAccountStatusEnum.AVAILABLE)) {


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/DashboardManage.java Dosyayı Görüntüle

@@ -13,7 +13,7 @@ import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import com.ningdatech.pmapi.meeting.entity.dto.CountConfirmByMeetingIdDTO;
import com.ningdatech.pmapi.meeting.entity.dto.MeetingAndAttendStatusDTO;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatus;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteType;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum;
import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatus;
import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusByDashboard;
import com.ningdatech.pmapi.meeting.entity.req.MeetingCalenderReq;
@@ -202,7 +202,7 @@ public class DashboardManage {
item.setExpertMeetingId(w.getId());
Meeting meeting = meetingMap.get(w.getMeetingId());
item.setMeetingName(meeting.getName());
item.setInviteType(ExpertInviteType.getByCode(w.getInviteType()).getName());
item.setInviteType(ExpertInviteTypeEnum.getByCode(w.getInviteType()).getName());
item.setStatus(w.getStatus());
item.setStartTime(meeting.getStartTime());
item.setEndTime(meeting.getEndTime());


+ 29
- 117
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java Dosyayı Görüntüle

@@ -1,7 +1,6 @@
package com.ningdatech.pmapi.meeting.manage;

import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.util.CollUtils;
@@ -16,7 +15,10 @@ import com.ningdatech.pmapi.meeting.builder.ExpertInviteBuilder;
import com.ningdatech.pmapi.meeting.entity.domain.ExpertInviteRule;
import com.ningdatech.pmapi.meeting.entity.domain.Meeting;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import com.ningdatech.pmapi.meeting.entity.dto.*;
import com.ningdatech.pmapi.meeting.entity.dto.AvoidInfoDTO;
import com.ningdatech.pmapi.meeting.entity.dto.ExpertChooseDTO;
import com.ningdatech.pmapi.meeting.entity.dto.ExpertDictChooseDTO;
import com.ningdatech.pmapi.meeting.entity.dto.RandomInviteRuleDTO;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatus;
import com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper;
import com.ningdatech.pmapi.meeting.helper.YxtCallOrSmsHelper;
@@ -35,13 +37,14 @@ import org.apache.commons.collections4.Predicate;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.RandomUtils;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper.getExpertInviteRule;

/**
* <p>
* 专家邀请管理
@@ -149,7 +152,7 @@ public class ExpertInviteManage {
return null;
}
// 处理专家回避单位 与 抽取回避单位是否相同
List<Long> avoidCompanyExpertIds = avoidCompanyExpertIds(avoidInfo.getCompanyIds());
List<Long> avoidCompanyExpertIds = avoidCompanyExpertIds(avoidInfo.getAvoidUnitIdList());

// 聚合用户ID
List<Long> expertIdsIn = new ArrayList<>();
@@ -261,10 +264,10 @@ public class ExpertInviteManage {
}
boolean avoid = avoidInfo != null;
boolean avoidExpert = avoid && CollUtil.isNotEmpty(avoidInfo.getExpertIds());
boolean avoidCompany = avoid && CollUtil.isNotEmpty(avoidInfo.getCompanyIds());
boolean avoidCompany = avoid && CollUtil.isNotEmpty(avoidInfo.getAvoidUnitIdList());
Set<String> tmpAvoidCompany = new HashSet<>();
if (avoidCompany) {
List<String> companyIds = avoidInfo.getCompanyIds();
List<String> companyIds = avoidInfo.getAvoidUnitIdList();
for (String companyId : companyIds) {
if (companyId.contains(",")) {
String[] splitCompanyIds = companyId.split(",");
@@ -277,16 +280,11 @@ public class ExpertInviteManage {
}
}
// 回避信息
if (CollUtil.isNotEmpty(appointExpertIds) && avoid && avoidInfo.getAvoidMates()) {
// 如果设置了回避本单位同事且手动指定了专家,则对应的单位需要排除
List<ExpertUserFullInfo> appointUsers = expertUserFullInfoService.listByUserId(appointExpertIds);
tmpAvoidCompany.addAll(CollUtils.fieldList(appointUsers, ExpertUserFullInfo::getCompany));
}
LambdaQueryWrapper<ExpertUserFullInfo> query = buildBaseExpertQuery();
query.notIn(!tmpAvoidCompany.isEmpty(), ExpertUserFullInfo::getCompany, tmpAvoidCompany);
if (avoidCompany) {
query.notExists("select 1 from expert_avoid_company eac where eac.user_id = expert_user_full_info.user_id" +
" and company_name in ({0})", CollUtils.joinByComma(avoidInfo.getCompanyIds()));
" and company_name in ({0})", CollUtils.joinByComma(avoidInfo.getAvoidUnitIdList()));
}
// 处理专家层级
addRegionLimit(query, randomRule);
@@ -326,21 +324,11 @@ public class ExpertInviteManage {
if (userFullInfos.isEmpty()) {
return result;
}
if (avoid && avoidInfo.getAvoidMates()) {
// 回避同单位其他专家
Map<String, List<ExpertUserFullInfo>> userFullInfoMap = CollUtils.group(userFullInfos, ExpertUserFullInfo::getCompany);
result.setTotal(userFullInfoMap.size());
if (randomRule.getCount() == null || userFullInfoMap.size() >= randomRule.getCount()) {
List<ExpertUserFullInfo> userFullInfoList = inviteGroupByCompany(userFullInfoMap, randomRule.getCount());
result.setExperts(userFullInfoList);
}
} else {
result.setTotal(userFullInfos.size());
// count为空表示数量校验
if (randomRule.getCount() == null || result.getTotal() >= randomRule.getCount()) {
List<ExpertUserFullInfo> userFullInfoList = inviteWithoutCompany(userFullInfos, randomRule.getCount());
result.setExperts(userFullInfoList);
}
result.setTotal(userFullInfos.size());
// count为空表示数量校验
if (randomRule.getCount() == null || result.getTotal() >= randomRule.getCount()) {
List<ExpertUserFullInfo> userFullInfoList = inviteWithoutCompany(userFullInfos, randomRule.getCount());
result.setExperts(userFullInfoList);
}
return result;
}
@@ -369,9 +357,9 @@ public class ExpertInviteManage {
return result;
}
LambdaQueryWrapper<ExpertUserFullInfo> query = buildBaseExpertQuery();
query.notIn(ExpertUserFullInfo::getCompany, avoidInfo.getCompanyIds());
query.notIn(ExpertUserFullInfo::getCompany, avoidInfo.getAvoidUnitIdList());
query.notExists("select 1 from expert_avoid_company eac where eac.user_id = expert_user_full_info.user_id" +
" and company_name in ({0})", CollUtils.joinByComma(avoidInfo.getCompanyIds()));
" and company_name in ({0})", CollUtils.joinByComma(avoidInfo.getAvoidOrgIdList()));

// 处理专家层级
if (ObjectUtils.allNotNull(randomRule.getExpertRegionCode(), randomRule.getExpertRegionLevel())) {
@@ -440,23 +428,10 @@ public class ExpertInviteManage {
removeExpertIds.add(replacedExpertId);
}
List<Long> tempExpertIds = CollUtils.fieldList(removeExpertByCompany, MeetingExpert::getExpertId);
if (avoidInfo.getAvoidMates()) {
if (!tempExpertIds.isEmpty()) {
Set<String> confirmedCompany = userFullInfos.stream()
.filter(w -> tempExpertIds.contains(w.getUserId()))
.map(ExpertUserFullInfo::getCompany).collect(Collectors.toSet());
userFullInfos.removeIf(w -> confirmedCompany.contains(w.getCompany()));
}
userFullInfos.removeIf(w -> removeExpertIds.contains(w.getUserId()));
Map<String, List<ExpertUserFullInfo>> groupByCompany = CollUtils.group(userFullInfos, ExpertUserFullInfo::getCompany);
result.setTotal(groupByCompany.size());
result.setExperts(inviteGroupByCompany(groupByCompany, count));
} else {
// 移除确认参加、通知中的、拒绝参加、已取消
userFullInfos.removeIf(w -> tempExpertIds.contains(w.getUserId()) || removeExpertIds.contains(w.getUserId()));
result.setTotal(userFullInfos.size());
result.setExperts(inviteWithoutCompany(userFullInfos, count));
}
// 移除确认参加、通知中的、拒绝参加、已取消
userFullInfos.removeIf(w -> tempExpertIds.contains(w.getUserId()) || removeExpertIds.contains(w.getUserId()));
result.setTotal(userFullInfos.size());
result.setExperts(inviteWithoutCompany(userFullInfos, count));
return result;
}

@@ -569,78 +544,27 @@ public class ExpertInviteManage {
}

/**
* 构建邀请规则
*
* @param inviteRule 邀请规则
* @param meetingId 会议ID
* @return {@link ExpertInviteRule}
* @author WendyYang
**/
private static ExpertInviteRule getExpertInviteRule(AbstractInviteRule inviteRule, Long meetingId) {
ExpertInviteRule rule = new ExpertInviteRule();
rule.setInviteRule(JSONObject.toJSONString(inviteRule));
rule.setInviteCount(inviteRule.getCount());
rule.setInviteType(inviteRule.getInviteType());
rule.setMeetingId(meetingId);
return rule;
}

public Map<Long, ExpertUserFullInfo> checkAppointExpertConflictWithAvoidRule(AppointInviteRuleDTO appointRule, AvoidInfoDTO avoidRule) {
if (appointRule == null) {
return Collections.emptyMap();
}
List<ExpertUserFullInfo> expertInfos = expertUserFullInfoService.listByUserId(appointRule.getExpertIds());
Map<Long, ExpertUserFullInfo> infoMap = CollUtils.listToMap(expertInfos, ExpertUserFullInfo::getUserId);
if (avoidRule == null) {
return infoMap;
}
Map<String, Integer> countMap = new HashMap<>(16);
infoMap.forEach((key, userFullInfo) -> {
if (CollectionUtils.isNotEmpty(avoidRule.getExpertIds())) {
boolean contains = avoidRule.getExpertIds().contains(key);
Assert.isTrue(!contains, "已回避的专家不可被指定邀请");
}
if (CollectionUtils.isNotEmpty(avoidRule.getCompanyIds())) {
boolean contains = avoidRule.getCompanyIds().contains(userFullInfo.getCompany());
Assert.isTrue(!contains, "回避单位的专家不可出现在指定邀请名单中");
}
if (avoidRule.getAvoidMates()) {
Integer oldValue = countMap.put(userFullInfo.getCompany(), 1);
Assert.isNull(oldValue, "不可选择同单位的多个专家");
}
});
return infoMap;
}


/**
* 专家抽取(会议创建时抽取)
*
* @param randomRules 随机抽取规则
* @param appointRule 指定抽取规则
* @param avoid 回避信息
* @author WendyYang
**/
public void expertInviteByMeetingCreate(Meeting meeting,
List<RandomInviteRuleDTO> randomRules,
AppointInviteRuleDTO appointRule,
AvoidInfoDTO avoid) {
Map<Long, ExpertUserFullInfo> appointUser = checkAppointExpertConflictWithAvoidRule(appointRule, avoid);
public void expertRandomInviteByMeetingCreate(Meeting meeting,
List<RandomInviteRuleDTO> randomRules,
AvoidInfoDTO avoid) {
List<MeetingExpert> expertInserts = new ArrayList<>();
boolean appointed = appointRule != null;
// 处理随机抽取规则
if (CollectionUtils.isNotEmpty(randomRules)) {
List<ExpertInviteRule> randoms = new ArrayList<>();
List<ExpertChooseDTO> expertsByRandom = new ArrayList<>();
List<Long> tempExpertIdSelected = new ArrayList<>();
if (appointed) {
tempExpertIdSelected.addAll(appointRule.getExpertIds());
}
LocalDateTime startTime = meeting.getStartTime(), endTime = meeting.getEndTime();
List<Long> choosedExpertIds = new ArrayList<>();
LocalDateTime startTime = meeting.getStartTime();
LocalDateTime endTime = meeting.getEndTime();
randomRules.forEach(rule -> {
ExpertChooseDTO tempExperts = expertInviteByRandomRule(avoid, rule, tempExpertIdSelected, startTime, endTime);
ExpertChooseDTO tempExperts = expertInviteByRandomRule(avoid, rule, choosedExpertIds, startTime, endTime);
expertsByRandom.add(tempExperts);
tempExpertIdSelected.addAll(CollUtils.fieldList(tempExperts.getExperts(), ExpertUserFullInfo::getUserId));
choosedExpertIds.addAll(CollUtils.fieldList(tempExperts.getExperts(), ExpertUserFullInfo::getUserId));
randoms.add(getExpertInviteRule(rule, meeting.getId()));
});
inviteRuleService.saveBatch(randoms);
@@ -654,18 +578,6 @@ public class ExpertInviteManage {
}
yxtCallOrSmsHelper.callByMeetingExperts(meeting, expertInserts);
}
if (appointed) {
// 处理指定抽取规则
ExpertInviteRule appoint = getExpertInviteRule(appointRule, meeting.getId());
inviteRuleService.save(appoint);
Long ruleId = appoint.getId();
appointRule.getExpertIds().forEach(w -> {
ExpertUserFullInfo info = appointUser.get(w);
MeetingExpert expert = ExpertInviteBuilder.getExpertByAppoint(meeting.getId(), info, ruleId);
expert.setStatus(ExpertAttendStatus.NOTICING.getCode());
expertInserts.add(expert);
});
}
meetingExpertService.saveBatch(expertInserts);
}



+ 75
- 61
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java Dosyayı Görüntüle

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

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import com.alibaba.fastjson.JSON;
@@ -26,7 +27,7 @@ import com.ningdatech.pmapi.meeting.entity.domain.Meeting;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import com.ningdatech.pmapi.meeting.entity.dto.*;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatus;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteType;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum;
import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatus.Manager;
import com.ningdatech.pmapi.meeting.entity.req.*;
import com.ningdatech.pmapi.meeting.entity.vo.*;
@@ -46,7 +47,6 @@ import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.service.IUserInfoService;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
@@ -54,6 +54,9 @@ import org.springframework.util.Assert;
import java.time.LocalDateTime;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;

import static com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper.getExpertInviteRule;

/**
* <p>
@@ -93,23 +96,28 @@ public class MeetingManage {
*/
public static final int RETRY_TIMES = 3;

public IdVo<Long> save(MeetingBasicDTO po) {
String md5ByParam = SecureUtil.md5(po.toString());
@Transactional(rollbackFor = Exception.class)
public IdVo<Long> save(MeetingCreateReq req) {
MeetingBasicDTO meetingBasic = req.getMeetingBasicInfo();
String md5ByParam = SecureUtil.md5(meetingBasic.toString());
String key = MEETING_CREATE_KEY + md5ByParam;
if (!distributedLock.lock(key, RETRY_TIMES)) {
throw BizException.wrap("会议正在创建中");
}
try {
Meeting meeting = BeanUtil.copyProperties(po, Meeting.class);
// 保存会议基本信息
Meeting meeting = BeanUtil.copyProperties(meetingBasic, Meeting.class);
meeting.setStatus(Manager.UNCOMPLETED.getCode());
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail();
// TODO
meeting.setHoldOrg(userDetail.getOrganizationName());
meeting.setHoldOrgCode(userDetail.getOrganizationCode());
meeting.setRegionCode(userDetail.getRegionCode());
meeting.setCreator(userDetail.getUsername());
meeting.setInvited(Boolean.FALSE);
meeting.setInviteStopped(true);
meetingService.save(meeting);
// 抽取专家
req.getExpertInviteRule().setMeetingId(meeting.getId());
expertInviteByCreate(req.getExpertInviteRule());
return IdVo.of(meeting.getId());
} finally {
distributedLock.releaseLock(key);
@@ -117,44 +125,59 @@ public class MeetingManage {
}

@Transactional(rollbackFor = Exception.class)
public void expertInviteByCreate(ExpertInviteCreateReq req) {
// 未传递指定邀请专家直接忽略
if (req.getAppointRule() != null && CollectionUtils.isEmpty(req.getAppointRule().getExpertIds())) {
Assert.isTrue(CollectionUtils.isNotEmpty(req.getRandomRules()), "未指定抽取规则");
req.setAppointRule(null);
}
public void expertInviteByCreate(ExpertInviteReq req) {
String key = INVITED_RULE_CREATE + req.getMeetingId();
if (!distributedLock.lock(key, RETRY_TIMES)) {
throw BizException.wrap("不可重复进行专家抽取");
}
try {
AvoidInfoDTO avoidInfo = req.getAvoidRule();
Meeting meeting = meetingService.getById(req.getMeetingId());
Assert.isTrue(!meeting.getInvited(), "不可重复进行专家抽取");
ExpertCountOnChangeVO countOnChange = expertCountOnChange(req);
for (int i = 0; i < req.getRandomRules().size(); i++) {
Integer checkCount = countOnChange.getCountList().get(i);
Integer inviteCount = req.getRandomRules().get(i).getCount();
Assert.isTrue(checkCount >= inviteCount, "可供抽取的专家数量不足");
}
AvoidInfoDTO avoidInfo = req.getAvoidInfo();
expertInviteManage.expertInviteByMeetingCreate(meeting, req.getRandomRules(), req.getAppointRule(), avoidInfo);
LambdaUpdateWrapper<Meeting> updater = Wrappers.lambdaUpdate(Meeting.class)
.set(Meeting::getInvited, Boolean.TRUE)
.eq(Meeting::getId, req.getMeetingId());
if (CollectionUtils.isNotEmpty(req.getRandomRules())) {
if (ExpertInviteTypeEnum.RANDOM.eq(req.getInviteType())) {
List<RandomInviteRuleDTO> randomRules = req.getRandomRules();
Assert.notEmpty(randomRules, "随机抽取规则不能为空");
// 随机抽取的话则需进行抽取数量校验
ExpertCountOnChangeVO countOnChange = expertCountOnChange(req);
if (!countOnChange.getStatus()) {
throw BizException.wrap(countOnChange.getMessage());
}
for (int i = 0; i < randomRules.size(); i++) {
Integer checkCount = countOnChange.getCountList().get(i);
Integer inviteCount = randomRules.get(i).getCount();
Assert.isTrue(checkCount >= inviteCount, "可供抽取的专家数量不足");
}
expertInviteManage.expertRandomInviteByMeetingCreate(meeting, randomRules, avoidInfo);
expertInviteTask.addInviteExpertTaskByMeetingCreate(meeting.getId(), 5);
updater.set(Meeting::getInviteStopped, false);
LambdaUpdateWrapper<Meeting> update = Wrappers.lambdaUpdate(Meeting.class);
update.set(Meeting::getInviteStopped, false);
update.eq(Meeting::getId, meeting.getId());
meetingService.update(update);
} else {
// 指定邀请
AppointInviteRuleDTO appointRule = req.getAppointRule();
Assert.notNull(appointRule, "指定邀请规则不能为空");
Map<Long, ExpertUserFullInfo> usersMap = expertInviteHelper.checkAppointExpert(appointRule, avoidInfo);
// 处理指定抽取规则
ExpertInviteRule appoint = getExpertInviteRule(appointRule, meeting.getId());
inviteRuleService.save(appoint);
Long ruleId = appoint.getId();
List<MeetingExpert> experts = appointRule.getExpertIds().stream().map(w -> {
ExpertUserFullInfo info = usersMap.get(w);
MeetingExpert expert = ExpertInviteBuilder.getExpertByAppoint(meeting.getId(), info, ruleId);
expert.setStatus(ExpertAttendStatus.NOTICING.getCode());
return expert;
}).collect(Collectors.toList());
meetingExpertService.saveBatch(experts);
}
meetingService.update(updater);
// 回避规则
if (avoidInfo != null) {
ExpertInviteAvoidRule avoidRule = new ExpertInviteAvoidRule();
avoidRule.setMeetingId(meeting.getId());
avoidRule.setAvoidMates(avoidInfo.getAvoidMates());
avoidRule.setCompanyIds(CollUtils.joinByComma(avoidInfo.getCompanyIds()));
if (CollectionUtils.isNotEmpty(avoidInfo.getExpertIds())) {
avoidRule.setExpertIds(CollUtils.joinByComma(avoidInfo.getExpertIds()));
}
// 未传值时设置为0 表示不限制周参与次数
avoidRule.setWeekInviteCount(ObjectUtil.defaultIfNull(avoidRule.getWeekInviteCount(), 0));
avoidRule.setAvoidOrgIds(CollUtils.joinByComma(avoidInfo.getAvoidOrgIdList()));
avoidRule.setAvoidUnitIds(CollUtils.joinByComma(avoidInfo.getAvoidUnitIdList()));
avoidRule.setExpertIds(CollUtils.joinByComma(avoidInfo.getExpertIds()));
inviteAvoidRuleService.save(avoidRule);
}
} finally {
@@ -165,35 +188,27 @@ public class MeetingManage {
/**
* 抽取数量校验
*
* @param po 抽取参数
* @param req 抽取参数
* @return {@link ExpertCountOnChangeVO}
* @author WendyYang
**/
public ExpertCountOnChangeVO expertCountOnChange(ExpertInviteCreateReq po) {
public ExpertCountOnChangeVO expertCountOnChange(ExpertInviteReq req) {
// 未传递指定邀请专家直接忽略
if (po.getAppointRule() != null && CollUtil.isEmpty(po.getAppointRule().getExpertIds())) {
Assert.isTrue(CollUtil.isNotEmpty(po.getRandomRules()), "未指定抽取规则");
po.setAppointRule(null);
}
boolean appointed = po.getAppointRule() != null;
expertInviteManage.checkAppointExpertConflictWithAvoidRule(po.getAppointRule(), po.getAvoidInfo());
Meeting meeting = meetingService.getById(po.getMeetingId());
expertInviteHelper.checkAppointExpert(req.getAppointRule(), req.getAvoidRule());
Meeting meeting = meetingService.getById(req.getMeetingId());
ExpertCountOnChangeVO resultCount = new ExpertCountOnChangeVO();
resultCount.setStatus(true);
resultCount.setCountList(new ArrayList<>());
// 参数校验
String errMsg = ValidUtil.validFast(po, AbstractInviteRule.CountCheck.class);
String errMsg = ValidUtil.validFast(req, AbstractInviteRule.CountCheck.class);
if (errMsg != null) {
resultCount.setStatus(false);
resultCount.setMessage(errMsg);
return resultCount;
}
List<Long> expertIdsChoose = new ArrayList<>();
if (appointed) {
expertIdsChoose.addAll(po.getAppointRule().getExpertIds());
}
for (RandomInviteRuleDTO randomRule : po.getRandomRules()) {
ExpertChooseDTO chooseExpert = expertInviteManage.expertInviteByRandomRule(po.getAvoidInfo(),
for (RandomInviteRuleDTO randomRule : req.getRandomRules()) {
ExpertChooseDTO chooseExpert = expertInviteManage.expertInviteByRandomRule(req.getAvoidRule(),
randomRule, expertIdsChoose, meeting.getStartTime(), meeting.getEndTime());
resultCount.addCountList(chooseExpert.getTotal());
}
@@ -301,10 +316,8 @@ public class MeetingManage {
.connecter(meeting.getConnecter())
.status(meeting.getStatus())
.attendStatus(attendStatus)
.cancelRemark(meeting.getCancelRemark())
.createBy(meeting.getCreator())
.holdOrg(meeting.getHoldOrg())
.invited(meeting.getInvited())
.build();
}

@@ -340,7 +353,7 @@ public class MeetingManage {
List<MeetingExpert> attendList = new ArrayList<>();
List<Long> expertIds = new ArrayList<>();
experts.forEach(w -> {
boolean randomInvite = w.getInviteType().equals(ExpertInviteType.RANDOM.getCode());
boolean randomInvite = w.getInviteType().equals(ExpertInviteTypeEnum.RANDOM.getCode());
if (randomInvite) {
randomList.add(w);
} else {
@@ -382,7 +395,7 @@ public class MeetingManage {
attendList.forEach(w -> {
ExpertBasicInfoVO expertBasicInfoVo = expertBasicInfoVoMap.get(w.getExpertId());
ExpertAttendListItemVO item = BeanUtil.copyProperties(expertBasicInfoVo, ExpertAttendListItemVO.class);
item.setInviteType(ExpertInviteType.getByCode(w.getInviteType()).getName());
item.setInviteType(ExpertInviteTypeEnum.getByCode(w.getInviteType()).getName());
result.addAttendList(item);
});
return result;
@@ -434,9 +447,9 @@ public class MeetingManage {
return result;
}
result.setRandomRules(new ArrayList<>());
Map<ExpertInviteType, List<ExpertInviteRule>> groupByType = CollUtils.group(inviteRules, w -> ExpertInviteType.getByCode(w.getInviteType()));
List<ExpertInviteRule> randoms = groupByType.get(ExpertInviteType.RANDOM);
if (CollectionUtils.isNotEmpty(randoms)) {
Map<ExpertInviteTypeEnum, List<ExpertInviteRule>> groupByType = CollUtils.group(inviteRules, w -> ExpertInviteTypeEnum.getByCode(w.getInviteType()));
List<ExpertInviteRule> randoms = groupByType.get(ExpertInviteTypeEnum.RANDOM);
if (CollUtil.isNotEmpty(randoms)) {
randoms.forEach(random -> {
RandomInviteRuleVO randomRule = JSON.parseObject(random.getInviteRule(), RandomInviteRuleVO.class);
if (randomRule.getExpertTags() != null) {
@@ -452,17 +465,19 @@ public class MeetingManage {
});
}
if (StrUtil.isNotEmpty(randomRule.getIntentionRegionCode())) {
// TODO 履职意向地
/*List<RegionDTO> intentionRegions = regionCache.listParents(randomRule.getIntentionRegionCode(), randomRule.getIntentionRegionLevel());
randomRule.setIntentionRegions(intentionRegions);*/
}
if (StrUtil.isNotEmpty(randomRule.getExpertRegionCode())) {
// TODO 专家层级
/*List<RegionDTO> expertRegions = regionCache.listParents(randomRule.getExpertRegionCode(), randomRule.getExpertRegionLevel());
randomRule.setExpertRegions(expertRegions);*/
}
result.getRandomRules().add(randomRule);
});
}
List<ExpertInviteRule> appoints = groupByType.get(ExpertInviteType.APPOINT);
List<ExpertInviteRule> appoints = groupByType.get(ExpertInviteTypeEnum.APPOINT);
if (result.setAndGetHasAppointRule(CollUtil.isNotEmpty(appoints))) {
ExpertInviteRule appoint = appoints.get(0);
AppointInviteRuleDTO appointRule = JSON.parseObject(appoint.getInviteRule(), AppointInviteRuleDTO.class);
@@ -474,9 +489,9 @@ public class MeetingManage {
AvoidInfoDTO avoidInfo = inviteAvoidRuleService.getAvoidInfoDto(meetingId);
if (result.setAndGetHasAvoidInfo(avoidInfo != null)) {
InviteRuleDetailVO.AvoidInfoVo vo = new InviteRuleDetailVO.AvoidInfoVo();
vo.setAvoidMates(avoidInfo.getAvoidMates());
vo.setCompanyIds(avoidInfo.getCompanyIds());
if (CollectionUtils.isNotEmpty(avoidInfo.getExpertIds())) {
vo.setAvoidOrgIds(avoidInfo.getAvoidOrgIdList());
vo.setAvoidUnitIds(avoidInfo.getAvoidUnitIdList());
if (CollUtil.isNotEmpty(avoidInfo.getExpertIds())) {
vo.setExperts(new ArrayList<>(meetingManageHelper.getExpertBasicInfo(avoidInfo.getExpertIds()).values()));
}
result.setAvoidInfo(vo);
@@ -506,7 +521,7 @@ public class MeetingManage {
// 邀请规则
RandomInviteRuleDTO randomInviteRuleDto = null;
for (ExpertInviteRule rule : inviteRules) {
if (rule.getInviteType().equals(ExpertInviteType.RANDOM.getCode()) &&
if (rule.getInviteType().equals(ExpertInviteTypeEnum.RANDOM.getCode()) &&
rule.getId().equals(meetingExpert.getRuleId())) {
randomInviteRuleDto = JSON.parseObject(rule.getInviteRule(), RandomInviteRuleDTO.class);
ruleId = rule.getId();
@@ -607,7 +622,6 @@ public class MeetingManage {
LambdaUpdateWrapper<Meeting> update = Wrappers.lambdaUpdate(Meeting.class)
.set(Meeting::getStatus, Manager.CANCELED.getCode())
.set(Meeting::getUpdateBy, LoginUserUtil.getUserId())
.set(Meeting::getCancelRemark, po.getCancelRemark())
.set(Meeting::getUpdateOn, LocalDateTime.now())
.eq(Meeting::getId, po.getMeetingId());
meetingService.update(update);


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/IMeetingExpertService.java Dosyayı Görüntüle

@@ -6,7 +6,7 @@ import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import com.ningdatech.pmapi.meeting.entity.dto.CountConfirmByMeetingIdDTO;
import com.ningdatech.pmapi.meeting.entity.dto.MeetingAndAttendStatusDTO;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatus;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteType;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum;

import java.util.Collection;
import java.util.List;
@@ -100,7 +100,7 @@ public interface IMeetingExpertService extends IService<MeetingExpert> {
* @return int
* @author WendyYang
**/
int countExpertByStatusAndMeetingId(ExpertAttendStatus status, Long meetingId, ExpertInviteType inviteType);
int countExpertByStatusAndMeetingId(ExpertAttendStatus status, Long meetingId, ExpertInviteTypeEnum inviteType);

/**
* 查询所有同意参加的专家记录


+ 3
- 2
pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/ExpertInviteAvoidRuleServiceImpl.java Dosyayı Görüntüle

@@ -36,9 +36,10 @@ public class ExpertInviteAvoidRuleServiceImpl extends ServiceImpl<ExpertInviteAv
return null;
}
AvoidInfoDTO avoidInfo = new AvoidInfoDTO();
avoidInfo.setAvoidMates(avoidRule.getAvoidMates());
avoidInfo.setAvoidOrgIdList(StrUtils.split(avoidRule.getAvoidOrgIds()));
avoidInfo.setAvoidUnitIdList(StrUtils.split(avoidRule.getAvoidUnitIds()));
avoidInfo.setExpertIds(BizUtils.splitToLong(avoidRule.getExpertIds()));
avoidInfo.setCompanyIds(StrUtils.split(avoidRule.getCompanyIds()));
avoidInfo.setWeekInviteCount(avoidInfo.getWeekInviteCount());
return avoidInfo;
}



+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/ExpertInviteRuleServiceImpl.java Dosyayı Görüntüle

@@ -6,7 +6,7 @@ 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.RandomInviteRuleDTO;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteType;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum;
import com.ningdatech.pmapi.meeting.mapper.ExpertInviteRuleMapper;
import com.ningdatech.pmapi.meeting.service.IExpertInviteRuleService;
import org.springframework.stereotype.Service;
@@ -38,7 +38,7 @@ public class ExpertInviteRuleServiceImpl extends ServiceImpl<ExpertInviteRuleMap
@Override
public Map<Long, RandomInviteRuleDTO> randomRuleByMeetingId(Long meetingId) {
LambdaQueryWrapper<ExpertInviteRule> query = wrapperByMeetingId(meetingId)
.eq(ExpertInviteRule::getInviteType, ExpertInviteType.RANDOM.getCode());
.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)));


+ 4
- 4
pmapi/src/main/java/com/ningdatech/pmapi/meeting/service/impl/MeetingExpertServiceImpl.java Dosyayı Görüntüle

@@ -10,7 +10,7 @@ import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import com.ningdatech.pmapi.meeting.entity.dto.CountConfirmByMeetingIdDTO;
import com.ningdatech.pmapi.meeting.entity.dto.MeetingAndAttendStatusDTO;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatus;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteType;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum;
import com.ningdatech.pmapi.meeting.mapper.ExpertInviteRuleMapper;
import com.ningdatech.pmapi.meeting.mapper.MeetingExpertMapper;
import com.ningdatech.pmapi.meeting.service.IMeetingExpertService;
@@ -44,7 +44,7 @@ public class MeetingExpertServiceImpl extends ServiceImpl<MeetingExpertMapper, M
@Override
public Map<Long, CountConfirmByMeetingIdDTO> countConfirmedByMeetingIds(List<Long> meetingIds) {
List<ExpertInviteRule> inviteRules = inviteRuleMapper.selectList(Wrappers.lambdaQuery(ExpertInviteRule.class)
.eq(ExpertInviteRule::getInviteType, ExpertInviteType.RANDOM.getCode())
.eq(ExpertInviteRule::getInviteType, ExpertInviteTypeEnum.RANDOM.getCode())
.in(ExpertInviteRule::getMeetingId, meetingIds));
Map<Long, Integer> countByRandom = CollUtils.groupSumInt(inviteRules, ExpertInviteRule::getMeetingId, ExpertInviteRule::getInviteCount);
Page<MeetingExpert> page = pageExpertByStatusAndMeetingIds(new Page<>(0, 500), meetingIds, null);
@@ -59,7 +59,7 @@ public class MeetingExpertServiceImpl extends ServiceImpl<MeetingExpertMapper, M
.build();
w.forEach(item -> {
ExpertAttendStatus attendStatus = ExpertAttendStatus.getByCode(item.getStatus());
if (item.getInviteType().equals(ExpertInviteType.APPOINT.getCode())) {
if (item.getInviteType().equals(ExpertInviteTypeEnum.APPOINT.getCode())) {
// 被替换和已取消的不计数
if (attendStatus.equals(ExpertAttendStatus.CANCELED)
|| attendStatus.equals(ExpertAttendStatus.REPLACED)) {
@@ -113,7 +113,7 @@ public class MeetingExpertServiceImpl extends ServiceImpl<MeetingExpertMapper, M
}

@Override
public int countExpertByStatusAndMeetingId(ExpertAttendStatus status, Long meetingId, ExpertInviteType inviteType) {
public int countExpertByStatusAndMeetingId(ExpertAttendStatus status, Long meetingId, ExpertInviteTypeEnum inviteType) {
Integer tempStatus = status == null ? null : status.getCode();
Integer tempInviteType = inviteType == null ? null : inviteType.getCode();
return baseMapper.countExpertByStatusAndMeetingId(tempStatus, meetingId, tempInviteType);


+ 4
- 4
pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertInviteTask.java Dosyayı Görüntüle

@@ -17,7 +17,7 @@ import com.ningdatech.pmapi.meeting.entity.dto.AvoidInfoDTO;
import com.ningdatech.pmapi.meeting.entity.dto.ExpertChooseDTO;
import com.ningdatech.pmapi.meeting.entity.dto.RandomInviteRuleDTO;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatus;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteType;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum;
import com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper;
import com.ningdatech.pmapi.meeting.helper.YxtCallOrSmsHelper;
import com.ningdatech.pmapi.meeting.manage.ExpertInviteManage;
@@ -125,9 +125,9 @@ public class ExpertInviteTask {
**/
private boolean inviteCheck(Long meetingId) {
List<ExpertInviteRule> expertInviteRules = inviteRuleService.listByMeetingId(meetingId);
Function<ExpertInviteRule, ExpertInviteType> groupKey = w -> ExpertInviteType.getByCode(w.getInviteType());
Map<ExpertInviteType, List<ExpertInviteRule>> groupByType = CollUtils.group(expertInviteRules, groupKey);
List<ExpertInviteRule> randomRules = groupByType.get(ExpertInviteType.RANDOM);
Function<ExpertInviteRule, ExpertInviteTypeEnum> groupKey = w -> ExpertInviteTypeEnum.getByCode(w.getInviteType());
Map<ExpertInviteTypeEnum, List<ExpertInviteRule>> groupByType = CollUtils.group(expertInviteRules, groupKey);
List<ExpertInviteRule> randomRules = groupByType.get(ExpertInviteTypeEnum.RANDOM);
if (CollUtil.isEmpty(randomRules)) {
return false;
}


Yükleniyor…
İptal
Kaydet