Browse Source

Merge remote-tracking branch 'origin/master'

tags/24080901
PoffyZhang 1 year ago
parent
commit
7e2af1b056
8 changed files with 89 additions and 79 deletions
  1. +2
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/leave/manage/LeaveManage.java
  2. +26
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingCallOrMsgHelper.java
  3. +2
    -16
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/YxtCallOrSmsHelper.java
  4. +3
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java
  5. +11
    -11
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java
  6. +9
    -11
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertRandomInviteTask.java
  7. +11
    -16
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/utils/ProjectVersionUtil.java
  8. +25
    -13
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java

+ 2
- 6
pmapi/src/main/java/com/ningdatech/pmapi/leave/manage/LeaveManage.java View File

@@ -41,12 +41,10 @@ import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum; import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum;
import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusEnum; import com.ningdatech.pmapi.meeting.entity.enumeration.MeetingStatusEnum;
import com.ningdatech.pmapi.meeting.helper.YxtCallOrSmsHelper;
import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; import com.ningdatech.pmapi.meeting.service.IMeetingExpertService;
import com.ningdatech.pmapi.meeting.service.IMeetingService; import com.ningdatech.pmapi.meeting.service.IMeetingService;
import com.ningdatech.pmapi.meeting.task.ExpertInviteTask;
import com.ningdatech.pmapi.meeting.task.ExpertRandomInviteTask;
import com.ningdatech.pmapi.sms.utils.DateUtil; import com.ningdatech.pmapi.sms.utils.DateUtil;
import com.ningdatech.pmapi.user.service.IUserInfoService;
import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.aop.framework.AopContext; import org.springframework.aop.framework.AopContext;
@@ -71,7 +69,7 @@ import java.util.stream.Collectors;
@AllArgsConstructor @AllArgsConstructor
public class LeaveManage { public class LeaveManage {


private final ExpertInviteTask inviteTask;
private final ExpertRandomInviteTask inviteTask;
private final IMeetingService meetingService; private final IMeetingService meetingService;
private final IMeetingExpertService meetingExpertService; private final IMeetingExpertService meetingExpertService;
private final IExpertLeaveService leaveService; private final IExpertLeaveService leaveService;
@@ -79,8 +77,6 @@ public class LeaveManage {
private final IExpertMetaApplyService metaApplyService; private final IExpertMetaApplyService metaApplyService;
private final FileService fileService; private final FileService fileService;
private final IExpertUserFullInfoService userFullInfoService; private final IExpertUserFullInfoService userFullInfoService;
private final YxtCallOrSmsHelper yxtCallOrSmsHelper;
private final IUserInfoService userInfoService;


private static final int HOURS_BEFORE_MEETING = 2; private static final int HOURS_BEFORE_MEETING = 2;




pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingMsgHelper.java → pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/MeetingCallOrMsgHelper.java View File

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


import cn.hutool.core.date.DatePattern;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -13,6 +12,8 @@ import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo;
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; import com.ningdatech.pmapi.organization.model.entity.DingOrganization;
import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService;
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
import com.ningdatech.pmapi.sms.constant.VoiceSmsTemplateConst;
import com.ningdatech.pmapi.sms.utils.DateUtil;
import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; import com.ningdatech.pmapi.staging.enums.MsgTypeEnum;
import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService; import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService;
import com.ningdatech.pmapi.sys.model.entity.Notify; import com.ningdatech.pmapi.sys.model.entity.Notify;
@@ -21,6 +22,7 @@ import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo;
import com.ningdatech.pmapi.user.entity.UserInfo; import com.ningdatech.pmapi.user.entity.UserInfo;
import com.ningdatech.pmapi.user.service.IUserInfoService; import com.ningdatech.pmapi.user.service.IUserInfoService;
import com.ningdatech.yxt.model.cmd.SendSmsCmd.SendSmsContext; import com.ningdatech.yxt.model.cmd.SendSmsCmd.SendSmsContext;
import com.ningdatech.yxt.model.cmd.SubmitTaskCallCmd.SubmitTaskCallContext;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -42,7 +44,7 @@ import java.util.stream.Collectors;
**/ **/
@Component @Component
@AllArgsConstructor @AllArgsConstructor
public class MeetingMsgHelper {
public class MeetingCallOrMsgHelper {


private final IUserInfoService userInfoService; private final IUserInfoService userInfoService;
private final YxtCallOrSmsHelper yxtCallOrSmsHelper; private final YxtCallOrSmsHelper yxtCallOrSmsHelper;
@@ -52,7 +54,7 @@ public class MeetingMsgHelper {
private final INotifyService notifyService; private final INotifyService notifyService;


private static String officialTime(LocalDateTime time) { private static String officialTime(LocalDateTime time) {
return time.format(DatePattern.NORM_DATETIME_MINUTE_FORMATTER);
return time.format(DateUtil.DTF_YMD_HM);
} }


private Notify getNotify(Long userId, String msg, MsgTypeEnum type, Map<String, Object> extraPara) { private Notify getNotify(Long userId, String msg, MsgTypeEnum type, Map<String, Object> extraPara) {
@@ -164,4 +166,25 @@ public class MeetingMsgHelper {
yxtCallOrSmsHelper.sendSms(contexts); yxtCallOrSmsHelper.sendSms(contexts);
} }


/**
* 提交专家通知音信通任务
*
* @param meeting 会议信息
* @param experts 待通知专家
* @author WendyYang
**/
public void callExpertByMeeting(Meeting meeting, List<MeetingExpert> experts) {
String voiceContent = String.format(VoiceSmsTemplateConst.OFFLINE_TEMPLATE,
meeting.getHoldOrg(), meeting.getName(), officialTime(meeting.getStartTime()),
meeting.getMeetingAddress());
List<SubmitTaskCallContext> callContexts = CollUtils.convert(experts, w -> {
SubmitTaskCallContext context = new SubmitTaskCallContext();
context.setContent(voiceContent);
context.setReceiveNumber(w.getMobile());
return context;
});
String submitKey = yxtCallOrSmsHelper.submitCallTask(callContexts);
experts.forEach(w -> w.setSubmitKey(submitKey));
}

} }

+ 2
- 16
pmapi/src/main/java/com/ningdatech/pmapi/meeting/helper/YxtCallOrSmsHelper.java View File

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


import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.meeting.entity.domain.Meeting;
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert;
import com.ningdatech.pmapi.sms.constant.VoiceSmsTemplateConst;
import com.ningdatech.pmapi.sms.utils.DateUtil;
import com.ningdatech.yxt.client.YxtClient; import com.ningdatech.yxt.client.YxtClient;
import com.ningdatech.yxt.constants.YxtSmsSignEnum; import com.ningdatech.yxt.constants.YxtSmsSignEnum;
import com.ningdatech.yxt.model.cmd.SendSmsCmd; import com.ningdatech.yxt.model.cmd.SendSmsCmd;
@@ -33,18 +28,9 @@ public class YxtCallOrSmsHelper {


private final YxtClient yxtClient; private final YxtClient yxtClient;


public void callByMeetingExperts(Meeting meeting, List<MeetingExpert> experts) {
String callContent = String.format(VoiceSmsTemplateConst.OFFLINE_TEMPLATE,
meeting.getHoldOrg(), meeting.getName(),
meeting.getStartTime().format(DateUtil.DTF_YMD_HM), meeting.getMeetingAddress());
List<SubmitTaskCallContext> callContexts = CollUtils.convert(experts, w -> {
SubmitTaskCallContext context = new SubmitTaskCallContext();
context.setContent(callContent);
context.setReceiveNumber(w.getMobile());
return context;
});
public String submitCallTask(List<SubmitTaskCallContext> callContexts) {
SubmitTaskCallResponse callResponse = yxtClient.submitTaskCall(of(callContexts)); SubmitTaskCallResponse callResponse = yxtClient.submitTaskCall(of(callContexts));
experts.forEach(w -> w.setSubmitKey(callResponse.getSubmitKey()));
return callResponse.getSubmitKey();
} }


public void sendSms(List<SendSmsContext> smsList) { public void sendSms(List<SendSmsContext> smsList) {


+ 3
- 3
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java View File

@@ -19,7 +19,7 @@ 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.ExpertAttendStatusEnum; import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum;
import com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper; import com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper;
import com.ningdatech.pmapi.meeting.helper.YxtCallOrSmsHelper;
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;
import com.ningdatech.pmapi.meeting.service.IMeetingService; import com.ningdatech.pmapi.meeting.service.IMeetingService;
@@ -65,7 +65,7 @@ public class ExpertInviteManage {
private final IExpertUserFullInfoService expertUserFullInfoService; private final IExpertUserFullInfoService expertUserFullInfoService;
private final IMeetingService meetingService; private final IMeetingService meetingService;
private final IExpertAvoidCompanyService expertAvoidCompanyService; private final IExpertAvoidCompanyService expertAvoidCompanyService;
private final YxtCallOrSmsHelper yxtCallOrSmsHelper;
private final MeetingCallOrMsgHelper meetingCallOrMsgHelper;


@Value("#{randomInviteProperties.recentMeetingCount}") @Value("#{randomInviteProperties.recentMeetingCount}")
private Integer recentMeetingCount; private Integer recentMeetingCount;
@@ -547,7 +547,7 @@ public class ExpertInviteManage {
expertInserts.add(expert); expertInserts.add(expert);
}); });
} }
yxtCallOrSmsHelper.callByMeetingExperts(meeting, expertInserts);
meetingCallOrMsgHelper.callExpertByMeeting(meeting, expertInserts);
} }
meetingExpertService.saveBatch(expertInserts); meetingExpertService.saveBatch(expertInserts);
} }


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

@@ -36,10 +36,10 @@ import com.ningdatech.pmapi.meeting.entity.req.*;
import com.ningdatech.pmapi.meeting.entity.vo.*; import com.ningdatech.pmapi.meeting.entity.vo.*;
import com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper; import com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper;
import com.ningdatech.pmapi.meeting.helper.MeetingManageHelper; import com.ningdatech.pmapi.meeting.helper.MeetingManageHelper;
import com.ningdatech.pmapi.meeting.helper.MeetingMsgHelper;
import com.ningdatech.pmapi.meeting.helper.MeetingCallOrMsgHelper;
import com.ningdatech.pmapi.meeting.helper.YxtCallOrSmsHelper; import com.ningdatech.pmapi.meeting.helper.YxtCallOrSmsHelper;
import com.ningdatech.pmapi.meeting.service.*; import com.ningdatech.pmapi.meeting.service.*;
import com.ningdatech.pmapi.meeting.task.ExpertInviteTask;
import com.ningdatech.pmapi.meeting.task.ExpertRandomInviteTask;
import com.ningdatech.pmapi.meta.helper.DictionaryCache; import com.ningdatech.pmapi.meta.helper.DictionaryCache;
import com.ningdatech.pmapi.meta.helper.TagCache; import com.ningdatech.pmapi.meta.helper.TagCache;
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
@@ -85,7 +85,7 @@ public class MeetingManage {
private final DictionaryCache dictionaryCache; private final DictionaryCache dictionaryCache;
private final IMeetingExpertService meetingExpertService; private final IMeetingExpertService meetingExpertService;
private final ExpertInviteManage expertInviteManage; private final ExpertInviteManage expertInviteManage;
private final ExpertInviteTask expertInviteTask;
private final ExpertRandomInviteTask expertRandomInviteTask;
private final MeetingManageHelper meetingManageHelper; private final MeetingManageHelper meetingManageHelper;
private final YxtCallOrSmsHelper yxtCallOrSmsHelper; private final YxtCallOrSmsHelper yxtCallOrSmsHelper;
private final DistributedLock distributedLock; private final DistributedLock distributedLock;
@@ -97,7 +97,7 @@ public class MeetingManage {
private final IDingOrganizationService dingOrganizationService; private final IDingOrganizationService dingOrganizationService;
private final IExpertReviewService expertReviewService; private final IExpertReviewService expertReviewService;
private final ExpertInviteHelper expertInviteHelper; private final ExpertInviteHelper expertInviteHelper;
private final MeetingMsgHelper meetingMsgHelper;
private final MeetingCallOrMsgHelper meetingCallOrMsgHelper;
private static final String INVITED_RULE_CREATE = "INVITED_RULE_CREATE:"; private static final String INVITED_RULE_CREATE = "INVITED_RULE_CREATE:";


private static final String MEETING_CREATE_KEY = "MEETING_CREATE:"; private static final String MEETING_CREATE_KEY = "MEETING_CREATE:";
@@ -183,7 +183,7 @@ public class MeetingManage {
if (!invitedContinue) { if (!invitedContinue) {
throw BizException.wrap("抽取人员数量已满足抽取规则"); throw BizException.wrap("抽取人员数量已满足抽取规则");
} }
expertInviteTask.notifyInviteTask(meetingId);
expertRandomInviteTask.notifyInviteTask(meetingId);
} finally { } finally {
distributedLock.releaseLock(key); distributedLock.releaseLock(key);
} }
@@ -200,7 +200,7 @@ public class MeetingManage {
if (!MeetingStatusEnum.NORMAL.eq(meeting.getStatus())) { if (!MeetingStatusEnum.NORMAL.eq(meeting.getStatus())) {
throw BizException.wrap("转换失败,请刷新后重试"); throw BizException.wrap("转换失败,请刷新后重试");
} }
expertInviteTask.cancelByMeetingId(meetingId);
expertRandomInviteTask.cancelByMeetingId(meetingId);
LambdaUpdateWrapper<Meeting> meetingUpdate = Wrappers.lambdaUpdate(Meeting.class) LambdaUpdateWrapper<Meeting> meetingUpdate = Wrappers.lambdaUpdate(Meeting.class)
.set(Meeting::getInviteType, APPOINT.getCode()) .set(Meeting::getInviteType, APPOINT.getCode())
.eq(Meeting::getId, meetingId); .eq(Meeting::getId, meetingId);
@@ -241,7 +241,7 @@ public class MeetingManage {
// 随机抽取的话则需进行抽取数量校验 // 随机抽取的话则需进行抽取数量校验
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
expertInviteManage.expertInviteByMeetingCreate(meeting, randomRules, avoidInfo); expertInviteManage.expertInviteByMeetingCreate(meeting, randomRules, avoidInfo);
expertInviteTask.addInviteTaskByMeetingCreate(meeting.getId(), now);
expertRandomInviteTask.addInviteTaskByMeetingCreate(meeting.getId(), now);
LambdaUpdateWrapper<Meeting> mUpdate = Wrappers.lambdaUpdate(Meeting.class) LambdaUpdateWrapper<Meeting> mUpdate = Wrappers.lambdaUpdate(Meeting.class)
.set(Meeting::getInviteStatus, false) .set(Meeting::getInviteStatus, false)
.eq(Meeting::getId, meeting.getId()); .eq(Meeting::getId, meeting.getId());
@@ -638,7 +638,7 @@ public class MeetingManage {
} }


public void stopRandomInvite(Long meetingId) { public void stopRandomInvite(Long meetingId) {
expertInviteTask.cancelByMeetingId(meetingId);
expertRandomInviteTask.cancelByMeetingId(meetingId);
} }


@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@@ -660,11 +660,11 @@ public class MeetingManage {
.set(Meeting::getStatus, MeetingStatusEnum.CANCELED.getCode()) .set(Meeting::getStatus, MeetingStatusEnum.CANCELED.getCode())
.eq(Meeting::getId, meetingId); .eq(Meeting::getId, meetingId);
meetingService.update(meetingUpdate); meetingService.update(meetingUpdate);
expertInviteTask.cancelByMeetingId(meetingId);
expertRandomInviteTask.cancelByMeetingId(meetingId);
// 发送通知给专家 // 发送通知给专家
List<MeetingExpert> experts = meetingExpertService.listAgreedExperts(meetingId); List<MeetingExpert> experts = meetingExpertService.listAgreedExperts(meetingId);
if (!experts.isEmpty()) { if (!experts.isEmpty()) {
meetingMsgHelper.sendCancelMeetingMsg(experts, meeting);
meetingCallOrMsgHelper.sendCancelMeetingMsg(experts, meeting);
} }
} finally { } finally {
distributedLock.releaseLock(key); distributedLock.releaseLock(key);
@@ -824,7 +824,7 @@ public class MeetingManage {
.in(MeetingExpert::getId, currConfirmedMeIds) .in(MeetingExpert::getId, currConfirmedMeIds)
.set(MeetingExpert::getConfirmedRoster, Boolean.TRUE); .set(MeetingExpert::getConfirmedRoster, Boolean.TRUE);
meetingExpertService.update(meUpdate); meetingExpertService.update(meUpdate);
meetingMsgHelper.sendConfirmedRosterMsg(expertNoticing, meeting);
meetingCallOrMsgHelper.sendConfirmedRosterMsg(expertNoticing, meeting);
} finally { } finally {
distributedLock.releaseLock(key); distributedLock.releaseLock(key);
} }


pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertInviteTask.java → pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertRandomInviteTask.java View File

@@ -16,8 +16,7 @@ import com.ningdatech.pmapi.meeting.entity.dto.ExpertChooseDTO;
import com.ningdatech.pmapi.meeting.entity.dto.InviteCacheDTO; import com.ningdatech.pmapi.meeting.entity.dto.InviteCacheDTO;
import com.ningdatech.pmapi.meeting.entity.dto.RandomInviteRuleDTO; import com.ningdatech.pmapi.meeting.entity.dto.RandomInviteRuleDTO;
import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum; import com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum;
import com.ningdatech.pmapi.meeting.helper.MeetingMsgHelper;
import com.ningdatech.pmapi.meeting.helper.YxtCallOrSmsHelper;
import com.ningdatech.pmapi.meeting.helper.MeetingCallOrMsgHelper;
import com.ningdatech.pmapi.meeting.manage.ExpertInviteManage; import com.ningdatech.pmapi.meeting.manage.ExpertInviteManage;
import com.ningdatech.pmapi.meeting.service.IExpertInviteAvoidRuleService; import com.ningdatech.pmapi.meeting.service.IExpertInviteAvoidRuleService;
import com.ningdatech.pmapi.meeting.service.IExpertInviteRuleService; import com.ningdatech.pmapi.meeting.service.IExpertInviteRuleService;
@@ -50,7 +49,7 @@ import java.util.concurrent.atomic.AtomicInteger;


/** /**
* <p> * <p>
* ExpertInviteTask
* 专家随机邀请任务
* </p> * </p>
* *
* @author WendyYang * @author WendyYang
@@ -59,7 +58,7 @@ import java.util.concurrent.atomic.AtomicInteger;
@Slf4j @Slf4j
@Component @Component
@AllArgsConstructor @AllArgsConstructor
public class ExpertInviteTask {
public class ExpertRandomInviteTask {


private final RandomInviteProperties properties; private final RandomInviteProperties properties;
private static final String MEETING_ID_INVITE_RANDOM = "MEETING_ID_INVITE_RANDOM"; private static final String MEETING_ID_INVITE_RANDOM = "MEETING_ID_INVITE_RANDOM";
@@ -74,16 +73,15 @@ public class ExpertInviteTask {
private final IMeetingService meetingService; private final IMeetingService meetingService;
private final ExpertInviteManage expertInviteManage; private final ExpertInviteManage expertInviteManage;
private final IExpertInviteAvoidRuleService inviteAvoidRuleService; private final IExpertInviteAvoidRuleService inviteAvoidRuleService;
private final YxtCallOrSmsHelper yxtCallOrSmsHelper;
private final MeetingMsgHelper meetingMsgHelper;
private final MeetingCallOrMsgHelper meetingCallOrMsgHelper;


/** /**
* 用来存入线程执行句柄, 停止定时任务时使用 * 用来存入线程执行句柄, 停止定时任务时使用
*/ */
private static final ConcurrentMap<Long, ScheduledFuture<?>> INVITE_TASK_MAP = new ConcurrentHashMap<>(); private static final ConcurrentMap<Long, ScheduledFuture<?>> INVITE_TASK_MAP = new ConcurrentHashMap<>();


private ExpertInviteTask currProxy() {
return (ExpertInviteTask) AopContext.currentProxy();
private ExpertRandomInviteTask currProxy() {
return (ExpertRandomInviteTask) AopContext.currentProxy();
} }


private CacheHashKey getCacheKey(Long meetingId) { private CacheHashKey getCacheKey(Long meetingId) {
@@ -190,7 +188,7 @@ public class ExpertInviteTask {
} }
Instant startTime = LocalDateTime.now().plusMinutes(delayTime).atZone(ZoneId.systemDefault()).toInstant(); Instant startTime = LocalDateTime.now().plusMinutes(delayTime).atZone(ZoneId.systemDefault()).toInstant();
ScheduledFuture<?> future = scheduler.scheduleAtFixedRate(() -> { ScheduledFuture<?> future = scheduler.scheduleAtFixedRate(() -> {
ExpertInviteTask bean = SpringContextHolder.getBean(ExpertInviteTask.class);
ExpertRandomInviteTask bean = SpringContextHolder.getBean(ExpertRandomInviteTask.class);
try { try {
bean.invite(meetingId, reInvite, tsTime); bean.invite(meetingId, reInvite, tsTime);
} catch (Exception e) { } catch (Exception e) {
@@ -264,7 +262,7 @@ public class ExpertInviteTask {
expert.setStatus(ExpertAttendStatusEnum.NOTICING.getCode()); expert.setStatus(ExpertAttendStatusEnum.NOTICING.getCode());
return expert; return expert;
}); });
yxtCallOrSmsHelper.callByMeetingExperts(meeting, expertMeetings);
meetingCallOrMsgHelper.callExpertByMeeting(meeting, expertMeetings);
log.info("会议:{} 后台抽取专家:{}名", meetingId, expertMeetings.size()); log.info("会议:{} 后台抽取专家:{}名", meetingId, expertMeetings.size());
meetingExpertService.saveBatch(expertMeetings); meetingExpertService.saveBatch(expertMeetings);
} else { } else {
@@ -275,7 +273,7 @@ public class ExpertInviteTask {
if (notIgnoreCnt.get() == 0 || notIgnoreCnt.get() == notSupportCnt.get()) { if (notIgnoreCnt.get() == 0 || notIgnoreCnt.get() == notSupportCnt.get()) {
log.info("停止会议随机邀请:{} 未完成抽取规则数量 {} 无可抽取专家规则数量 {}", meetingId, notIgnoreCnt, notSupportCnt); log.info("停止会议随机邀请:{} 未完成抽取规则数量 {} 无可抽取专家规则数量 {}", meetingId, notIgnoreCnt, notSupportCnt);
currProxy().cancelByMeetingId(meetingId); currProxy().cancelByMeetingId(meetingId);
meetingMsgHelper.sendInviteStopMsg(meeting.getCreateBy(), meetingId, meeting.getName());
meetingCallOrMsgHelper.sendInviteStopMsg(meeting.getCreateBy(), meetingId, meeting.getName());
} }
} }



+ 11
- 16
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/utils/ProjectVersionUtil.java View File

@@ -63,28 +63,23 @@ public class ProjectVersionUtil {
} }


// 获取之前版本的项目 // 获取之前版本的项目
int index = projectList.size() - 1;
ProcessProgressVo instanceDetail = null;
while (index > 0){
index = index - 1;
Project preProject = projectList.get(index);
for (Project preProject : projectList) {
// 从项目流程实例关联表中查出实例详情 // 从项目流程实例关联表中查出实例详情
List<ProjectInst> projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class)
.eq(ProjectInst::getProjectId, preProject.getId())
.eq(ProjectInst::getInstType,instTypeEnum.getCode()));
List<ProjectInst> projectInstList = projectInstService
.list(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getProjectId, preProject.getId())
.eq(ProjectInst::getInstType, instTypeEnum.getCode()));
if (CollUtil.isNotEmpty(projectInstList)) { if (CollUtil.isNotEmpty(projectInstList)) {
List<ProcessProgressVo> processProgressVoList = projectInstList.stream() List<ProcessProgressVo> processProgressVoList = projectInstList.stream()
.map(p -> processInstanceService.getProgressInstanceDetail(null, p.getInstCode()))
.collect(Collectors.toList());
.map(p -> processInstanceService.getProgressInstanceDetail(null, p.getInstCode()))
.collect(Collectors.toList());
// 筛选出上个版本该类型审核流程通过的流程详情 // 筛选出上个版本该类型审核流程通过的流程详情
List<ProcessProgressVo> instanceDetailList = processProgressVoList.stream() List<ProcessProgressVo> instanceDetailList = processProgressVoList.stream()
.filter(p -> ProcessStatusEnum.APPROVED.getDesc().equals(p.getStatus()))
.collect(Collectors.toList());
if (CollUtil.isEmpty(instanceDetailList)){
continue;
.filter(p -> ProcessStatusEnum.APPROVED.getDesc().equals(p.getStatus()))
.collect(Collectors.toList());
if (CollUtil.isNotEmpty(instanceDetailList)) {
// 获取最后一个流程详情
return instanceDetailList.get(instanceDetailList.size() - 1);
} }
// 获取最后一个流程详情
return instanceDetailList.get(instanceDetailList.size() - 1);
} }
} }
return null; return null;


+ 25
- 13
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/HandlerManage.java View File

@@ -3,13 +3,12 @@ package com.ningdatech.pmapi.todocenter.manage;
import static com.ningdatech.pmapi.todocenter.constant.WorkNoticeContant.*; import static com.ningdatech.pmapi.todocenter.constant.WorkNoticeContant.*;


import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;


import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.flowable.engine.HistoryService; import org.flowable.engine.HistoryService;
import org.flowable.engine.RuntimeService; import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService; import org.flowable.engine.TaskService;
@@ -89,17 +88,28 @@ public class HandlerManage {
// 获取流程通过后当前流程详情 // 获取流程通过后当前流程详情
ProcessProgressVo newInstanceDetail = processInstanceService.getProgressInstanceDetail(null, instance.getId()); ProcessProgressVo newInstanceDetail = processInstanceService.getProgressInstanceDetail(null, instance.getId());
// 获取流程通过后当前审核人信息,向其发送工作通知 // 获取流程通过后当前审核人信息,向其发送工作通知
// 会签/或签会有多个审核人
List<String> currentEmployeeCodeList = Lists.newArrayList();
List<ProgressNode> newProgressInfo = newInstanceDetail.getProgressInfo(); List<ProgressNode> newProgressInfo = newInstanceDetail.getProgressInfo();
ProgressNode currentNode = newProgressInfo.get(newProgressInfo.size() - 1); ProgressNode currentNode = newProgressInfo.get(newProgressInfo.size() - 1);
String currentEmployeeCode;
// 说明当前节点是子流程节点 // 说明当前节点是子流程节点
if (currentNode.getNodeType().name().equals(NodeTypeEnum.SUB.name())) { if (currentNode.getNodeType().name().equals(NodeTypeEnum.SUB.name())) {
List<ProgressNode> children = currentNode.getChildren(); List<ProgressNode> children = currentNode.getChildren();
// 获取子流程当前审核人节点 // 获取子流程当前审核人节点
ProgressNode subCurrentNode = children.get(children.size() - 1); ProgressNode subCurrentNode = children.get(children.size() - 1);
currentEmployeeCode = subCurrentNode.getUserId();
// 获取节点ID相同地审核节点
List<ProgressNode> nodeList = children.stream()
.filter(c -> subCurrentNode.getNodeId().equals(c.getNodeId()))
.collect(Collectors.toList());
List<String> userIdList = nodeList.stream().map(ProgressNode::getUserId).collect(Collectors.toList());
currentEmployeeCodeList.addAll(userIdList);
} else { } else {
currentEmployeeCode = currentNode.getUserId();
List<ProgressNode> nodeList = newProgressInfo.stream()
.filter(c -> currentNode.getNodeId().equals(c.getNodeId()))
.collect(Collectors.toList());
List<String> userIdList = nodeList.stream().map(ProgressNode::getUserId).collect(Collectors.toList());
currentEmployeeCodeList.addAll(userIdList);
} }


// 流程通过后,判断当前登录用户是不是最后一个审核人 // 流程通过后,判断当前登录用户是不是最后一个审核人
@@ -131,15 +141,17 @@ public class HandlerManage {
noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(),
PASS_MSG_TEMPLATE2,MsgTypeEnum.PROJECT_REVIEW_PASS); PASS_MSG_TEMPLATE2,MsgTypeEnum.PROJECT_REVIEW_PASS);
} else { } else {
// 若有下一个审核人(当前节点的用户),
// 若有下一个审核人(当前节点的用户),会签/或签会有多个
// 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 // 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。
// 获取发送浙政钉工作通知必要信息 // 获取发送浙政钉工作通知必要信息
if (Objects.isNull(currentEmployeeCode)) {
throw new BizException("审核人信息不存在!");
for (String currentEmployeeCode : currentEmployeeCodeList) {
if (Objects.isNull(currentEmployeeCode)) {
throw new BizException("审核人信息不存在!");
}
//发送消息
noticeManage.sendNotice(currentEmployeeCode,userId,declaredProject,instance.getProcessDefinitionName(),
PASS_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW);
} }
//发送消息
noticeManage.sendNotice(currentEmployeeCode,userId,declaredProject,instance.getProcessDefinitionName(),
PASS_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW);
} }
} }




Loading…
Cancel
Save