Browse Source

Merge remote-tracking branch 'origin/master'

tags/24080901
CMM 1 year ago
parent
commit
1dcdbc3b71
9 changed files with 41 additions and 76 deletions
  1. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ReviewTemplateSettingsController.java
  2. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java
  3. +5
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml
  4. +17
    -11
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertInviteTask.java
  5. +2
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java
  6. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java
  7. +0
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/NdWorkNoticeStagingServiceImpl.java
  8. +0
    -44
      pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/WorkNoticeFlowMapUtil.java
  9. +13
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java

+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ReviewTemplateSettingsController.java View File

@@ -45,14 +45,14 @@ public class ReviewTemplateSettingsController {
} }


@GetMapping("/template") @GetMapping("/template")
@ApiModelProperty("根据模版ID获取评审模版")
@ApiOperation("根据模版ID获取评审模版")
@ApiImplicitParam(name = "templateId", defaultValue = "模版ID") @ApiImplicitParam(name = "templateId", defaultValue = "模版ID")
public ReviewTemplateVO getTemplateById(@RequestParam Long templateId) { public ReviewTemplateVO getTemplateById(@RequestParam Long templateId) {
return reviewTemplateSettingsManage.getReviewTemplateSettings(templateId); return reviewTemplateSettingsManage.getReviewTemplateSettings(templateId);
} }


@GetMapping("/templates") @GetMapping("/templates")
@ApiModelProperty("(批量)根据模版ID获取评审模版")
@ApiOperation("(批量)根据模版ID获取评审模版")
@ApiImplicitParam(name = "templateIds", defaultValue = "模版ID集合") @ApiImplicitParam(name = "templateIds", defaultValue = "模版ID集合")
public List<ReviewTemplateVO> getTemplateById(@RequestParam List<Long> templateIds) { public List<ReviewTemplateVO> getTemplateById(@RequestParam List<Long> templateIds) {
return reviewTemplateSettingsManage.listReviewTemplateSettings(templateIds); return reviewTemplateSettingsManage.listReviewTemplateSettings(templateIds);


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

@@ -209,7 +209,7 @@ public class MeetingManage {
Assert.isTrue(checkCount >= inviteCount, "可供抽取的专家数量不足"); Assert.isTrue(checkCount >= inviteCount, "可供抽取的专家数量不足");
} }
expertInviteManage.expertInviteByMeetingCreate(meeting, randomRules, avoidInfo); expertInviteManage.expertInviteByMeetingCreate(meeting, randomRules, avoidInfo);
expertInviteTask.addInviteExpertTaskByMeetingCreate(meeting.getId(), 5);
expertInviteTask.addInviteTaskByMeetingCreate(meeting.getId(), 5);
LambdaUpdateWrapper<Meeting> update = Wrappers.lambdaUpdate(Meeting.class); LambdaUpdateWrapper<Meeting> update = Wrappers.lambdaUpdate(Meeting.class);
update.set(Meeting::getInviteStatus, false); update.set(Meeting::getInviteStatus, false);
update.eq(Meeting::getId, meeting.getId()); update.eq(Meeting::getId, meeting.getId());


+ 5
- 5
pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml View File

@@ -74,22 +74,22 @@


<sql id="reviewedByHeadman"> <sql id="reviewedByHeadman">
<if test="p.reviewed"> <if test="p.reviewed">
and exists(select 1 from nd_expert_review ner where ner.project_id = np.id and ner.create_by =
exists(select 1 from nd_expert_review ner where ner.project_id = np.id and ner.create_by =
me.expert_id and is_final = true) me.expert_id and is_final = true)
</if> </if>
<if test="!p.reviewed"> <if test="!p.reviewed">
and not exists(select 1 from nd_expert_review ner where ner.project_id = np.id and ner.create_by =
not exists(select 1 from nd_expert_review ner where ner.project_id = np.id and ner.create_by =
me.expert_id and is_final = true) me.expert_id and is_final = true)
</if> </if>
</sql> </sql>


<sql id="reviewedByNotHeadman"> <sql id="reviewedByNotHeadman">
<if test="p.reviewed"> <if test="p.reviewed">
and exists(select 1 from nd_expert_review ner where ner.project_id = np.id and ner.create_by =
exists(select 1 from nd_expert_review ner where ner.project_id = np.id and ner.create_by =
me.expert_id) me.expert_id)
</if> </if>
<if test="!p.reviewed"> <if test="!p.reviewed">
and not exists(select 1 from nd_expert_review ner where ner.project_id = np.id and ner.create_by =
not exists(select 1 from nd_expert_review ner where ner.project_id = np.id and ner.create_by =
me.expert_id) me.expert_id)
</if> </if>
</sql> </sql>
@@ -104,7 +104,7 @@
inner join meeting_expert me on m.id = me.meeting_id inner join meeting_expert me on m.id = me.meeting_id
where m.is_inner_project = true where m.is_inner_project = true
<if test="p.reviewed != null"> <if test="p.reviewed != null">
if(me.is_headman,<include refid="reviewedByHeadman"/>,<include refid="reviewedByNotHeadman"/>)
and if(me.is_headman,<include refid="reviewedByHeadman"/>,<include refid="reviewedByNotHeadman"/>)
</if> </if>
and me.expert_id = #{p.userId} and me.expert_id = #{p.userId}
<if test="p.projectName != null and p.projectName.length > 0"> <if test="p.projectName != null and p.projectName.length > 0">


+ 17
- 11
pmapi/src/main/java/com/ningdatech/pmapi/meeting/task/ExpertInviteTask.java View File

@@ -78,9 +78,9 @@ public class ExpertInviteTask {
private final YxtCallOrSmsHelper yxtCallOrSmsHelper; private final YxtCallOrSmsHelper yxtCallOrSmsHelper;


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


public ExpertInviteTask currProxy() { public ExpertInviteTask currProxy() {
return (ExpertInviteTask) AopContext.currentProxy(); return (ExpertInviteTask) AopContext.currentProxy();
@@ -109,7 +109,7 @@ public class ExpertInviteTask {
return; return;
} }
for (InviteCacheDTO cache : caches.values()) { for (InviteCacheDTO cache : caches.values()) {
addInviteExpertTask(cache.getMeetingId(), true, properties.getInviteDelay(), cache.getInvitedRefused());
addInviteTask(cache.getMeetingId(), true, properties.getInviteDelay(), cache.getInvitedRefused());
} }
} }


@@ -155,8 +155,8 @@ public class ExpertInviteTask {
if (ArrayUtil.isNotEmpty(invitedRefused)) { if (ArrayUtil.isNotEmpty(invitedRefused)) {
tmpInvitedRefused = invitedRefused[0]; tmpInvitedRefused = invitedRefused[0];
} }
if (!INVITE_MAP.containsKey(meetingId)) {
addInviteExpertTask(meetingId, false, properties.getInviteDelay(), tmpInvitedRefused);
if (!INVITE_TASK_MAP.containsKey(meetingId)) {
addInviteTask(meetingId, false, properties.getInviteDelay(), tmpInvitedRefused);
log.info("重置会议的随机抽取状态:{}", meetingId); log.info("重置会议的随机抽取状态:{}", meetingId);
LambdaUpdateWrapper<Meeting> update = Wrappers.lambdaUpdate(Meeting.class); LambdaUpdateWrapper<Meeting> update = Wrappers.lambdaUpdate(Meeting.class);
update.set(Meeting::getInviteStatus, false); update.set(Meeting::getInviteStatus, false);
@@ -176,7 +176,7 @@ public class ExpertInviteTask {
* @param invitedRefused 是否可以邀请被拒绝的专家 * @param invitedRefused 是否可以邀请被拒绝的专家
* @author WendyYang * @author WendyYang
**/ **/
public void addInviteExpertTask(Long meetingId, boolean checked, int delayedMinutes, boolean invitedRefused) {
public void addInviteTask(Long meetingId, boolean checked, int delayedMinutes, boolean invitedRefused) {
if (checked && !inviteCountCheck(meetingId)) { if (checked && !inviteCountCheck(meetingId)) {
// 如果抽取数量满足直接返回 // 如果抽取数量满足直接返回
return; return;
@@ -190,7 +190,7 @@ public class ExpertInviteTask {
log.error("执行专家邀请任务异常:{}", meetingId, e); log.error("执行专家邀请任务异常:{}", meetingId, e);
} }
}, startTime, Duration.ofMinutes(properties.getInviteFixedRate())); }, startTime, Duration.ofMinutes(properties.getInviteFixedRate()));
INVITE_MAP.putIfAbsent(meetingId, future);
INVITE_TASK_MAP.putIfAbsent(meetingId, future);
log.info("添加专家抽取后台任务:{}", meetingId); log.info("添加专家抽取后台任务:{}", meetingId);
} }


@@ -201,13 +201,19 @@ public class ExpertInviteTask {
* @param delayedMinutes 延迟时间 * @param delayedMinutes 延迟时间
* @author WendyYang * @author WendyYang
**/ **/
public void addInviteExpertTaskByMeetingCreate(Long meetingId, int delayedMinutes) {
public void addInviteTaskByMeetingCreate(Long meetingId, int delayedMinutes) {
Assert.isTrue(properties.getEnable(), "随机邀请已关闭"); Assert.isTrue(properties.getEnable(), "随机邀请已关闭");
addInviteExpertTask(meetingId, false, delayedMinutes, false);
addInviteTask(meetingId, false, delayedMinutes, false);
InviteCacheDTO cacheVal = InviteCacheDTO.of(meetingId, false); InviteCacheDTO cacheVal = InviteCacheDTO.of(meetingId, false);
cachePlusOps.hSet(getCacheKey(meetingId), cacheVal); cachePlusOps.hSet(getCacheKey(meetingId), cacheVal);
} }


/**
* 抽取过程
*
* @param meetingId 会议ID
* @param invitedRefused 是否可以邀请已拒绝的专家
*/
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void invite(Long meetingId, Boolean invitedRefused) { public void invite(Long meetingId, Boolean invitedRefused) {
log.info("开始进行专家后台抽取:{}", meetingId); log.info("开始进行专家后台抽取:{}", meetingId);
@@ -269,9 +275,9 @@ public class ExpertInviteTask {
log.info("终止专家抽取:{}", meetingId); log.info("终止专家抽取:{}", meetingId);
meetingService.stopRandomInvite(meetingId); meetingService.stopRandomInvite(meetingId);
cachePlusOps.hDel(getCacheKey(meetingId)); cachePlusOps.hDel(getCacheKey(meetingId));
ScheduledFuture<?> future = INVITE_MAP.get(meetingId);
ScheduledFuture<?> future = INVITE_TASK_MAP.get(meetingId);
if (future != null) { if (future != null) {
INVITE_MAP.remove(meetingId);
INVITE_TASK_MAP.remove(meetingId);
if (!future.isCancelled()) { if (!future.isCancelled()) {
future.cancel(true); future.cancel(true);
} }


+ 2
- 6
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ReviewByDeptJointManage.java View File

@@ -51,8 +51,6 @@ public class ReviewByDeptJointManage {
private final ProcessInstanceService processService; private final ProcessInstanceService processService;


private final IProjectInstService projectInstService; private final IProjectInstService projectInstService;

private final UserInfoHelper userInfoHelper;
private final DefaultDeclaredProjectManage declaredProjectManage; private final DefaultDeclaredProjectManage declaredProjectManage;
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; private final DefaultDeclaredProjectManage defaultDeclaredProjectManage;


@@ -63,8 +61,8 @@ public class ReviewByDeptJointManage {
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean startTheProcess(Project project) { public Boolean startTheProcess(Project project) {
Long userId = LoginUserUtil.getUserId();
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!");
//这里是任务发起的 所以用项目发起人
Long userId = project.getSponsor();


VUtils.isTrue(Objects.isNull(project.getId())).throwMessage("提交失败 缺少项目ID!"); VUtils.isTrue(Objects.isNull(project.getId())).throwMessage("提交失败 缺少项目ID!");
Project projectInfo = projectService.getById(project.getId()); Project projectInfo = projectService.getById(project.getId());
@@ -122,8 +120,6 @@ public class ReviewByDeptJointManage {
try { try {
project.setUpdateOn(LocalDateTime.now()); project.setUpdateOn(LocalDateTime.now());
project.setInstCode(instanceId); project.setInstCode(instanceId);
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode());
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode());
projectService.updateById(project); projectService.updateById(project);
//保存项目和实例的关系 //保存项目和实例的关系
ProjectInst projectInst = new ProjectInst(); ProjectInst projectInst = new ProjectInst();


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/ProjectStatusFlowTask.java View File

@@ -82,7 +82,7 @@ public class ProjectStatusFlowTask {
projectStagingService.removeById(projectStaging); projectStagingService.removeById(projectStaging);
} }
}catch (Exception e){ }catch (Exception e){
log.error("项目流转 异常 projectId:【" + projectStaging.getProjectId() + "】 异常内容:" + e);
log.error("项目流转 异常 projectId:【" + projectStaging.getProjectId() + "】 异常内容:" + e.getMessage());
}finally { }finally {
//增加重试的次数 和下次扫描时间 //增加重试的次数 和下次扫描时间
projectStagingService.addRetryTimes(projectStaging); projectStagingService.addRetryTimes(projectStaging);


+ 0
- 1
pmapi/src/main/java/com/ningdatech/pmapi/staging/service/impl/NdWorkNoticeStagingServiceImpl.java View File

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


import com.ningdatech.pmapi.staging.contants.StagingContant; import com.ningdatech.pmapi.staging.contants.StagingContant;
import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; import com.ningdatech.pmapi.staging.enums.MsgTypeEnum;
import com.ningdatech.pmapi.staging.model.entity.ProjectStaging;
import com.ningdatech.pmapi.staging.model.entity.WorkNoticeStaging; import com.ningdatech.pmapi.staging.model.entity.WorkNoticeStaging;
import com.ningdatech.pmapi.staging.mapper.NdWorkNoticeStagingMapper; import com.ningdatech.pmapi.staging.mapper.NdWorkNoticeStagingMapper;
import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService; import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService;


+ 0
- 44
pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/WorkNoticeFlowMapUtil.java View File

@@ -1,23 +1,9 @@
package com.ningdatech.pmapi.staging.utils; package com.ningdatech.pmapi.staging.utils;


import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function;

import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;

import com.ningdatech.pmapi.common.util.SendWorkNoticeUtil;
import com.ningdatech.pmapi.staging.enums.MsgTypeEnum;
import com.ningdatech.pmapi.staging.model.entity.WorkNoticeStaging;
import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;

import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.ningdatech.pmapi.projectdeclared.manage.ReviewByDeptJointManage;
import com.ningdatech.pmapi.projectdeclared.manage.ReviewByProvincialDeptManage;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project;

import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;


/** /**
@@ -29,41 +15,11 @@ import lombok.RequiredArgsConstructor;
@Component @Component
@RequiredArgsConstructor @RequiredArgsConstructor
public class WorkNoticeFlowMapUtil { public class WorkNoticeFlowMapUtil {
//public Map<Integer, Function<WorkNoticeInfo,Boolean>> workNoticeFlowFunctionMap = Maps.newHashMap();
/** /**
* key 重试的次数 , value 是增加是描述 * key 重试的次数 , value 是增加是描述
*/ */
public Map<Integer, Integer> intervalTimeMap = Maps.newHashMap(); public Map<Integer, Integer> intervalTimeMap = Maps.newHashMap();


///**
// * 初始化工作通知分派逻辑,代替了if-else部分
// * key: 枚举 消息类型
// * value: lambda表达式,最终会获取发送工作通知的函数
// */
//@PostConstruct
//public void workNoticeFlowFunctionInit(){
// // 待审核
// workNoticeFlowFunctionMap.put(MsgTypeEnum.AUDIT.getCode(),
// workNoticeInfos-> SendWorkNoticeUtil.sendWorkNotice(workNoticeInfos));
//
// // 审核通过
// workNoticeFlowFunctionMap.put(MsgTypeEnum.PASS.getCode(),
// workNoticeInfos-> SendWorkNoticeUtil.sendWorkNotice(workNoticeInfos));
//
// // 被驳回
// workNoticeFlowFunctionMap.put(MsgTypeEnum.REJECTED.getCode(),
// workNoticeInfos-> SendWorkNoticeUtil.sendWorkNotice(workNoticeInfos));
//
// // 被退回
// workNoticeFlowFunctionMap.put(MsgTypeEnum.BACKED.getCode(),
// workNoticeInfos-> SendWorkNoticeUtil.sendWorkNotice(workNoticeInfos));
//
// // 被驳回
// workNoticeFlowFunctionMap.put(MsgTypeEnum.REJECTED.getCode(),
// workNoticeInfos-> SendWorkNoticeUtil.sendWorkNotice(workNoticeInfos));
//
//}

/** /**
* 扫描的间隔越来越长 秒数 * 扫描的间隔越来越长 秒数
*/ */


+ 13
- 5
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java View File

@@ -32,6 +32,7 @@ import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService;
import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.projectlib.service.IProjectService;
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.staging.service.IProjectStagingService;
import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo;
import com.ningdatech.pmapi.todocenter.model.dto.AdjustHandleDTO; import com.ningdatech.pmapi.todocenter.model.dto.AdjustHandleDTO;
import com.ningdatech.pmapi.todocenter.model.vo.ProcessProgressDetailVo; import com.ningdatech.pmapi.todocenter.model.vo.ProcessProgressDetailVo;
@@ -105,6 +106,8 @@ public class TodoCenterManage {
private final UserInfoHelper userInfoHelper; private final UserInfoHelper userInfoHelper;
private final BuildUserUtils buildUserUtils; private final BuildUserUtils buildUserUtils;


private final IProjectStagingService projectStagingService;



/** /**
* 待办中心待我处理项目列表查询 * 待办中心待我处理项目列表查询
@@ -270,15 +273,20 @@ public class TodoCenterManage {
// 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 // 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。
if (HisProInsEndActId.END.equals(newInstance.getEndActivityId())) { if (HisProInsEndActId.END.equals(newInstance.getEndActivityId())) {
switch (Objects.requireNonNull(ProjectStatusEnum.getValue(projectStatus))) { switch (Objects.requireNonNull(ProjectStatusEnum.getValue(projectStatus))) {
// 当前项目状态是预审中
case PRE_APPLYING:
//先修改项目状态
updatePassProjectStatus(userId, declaredProject);
//然后入库暂存库
projectStagingService.addByProject(declaredProject,"暂存入库 待提交部门联审");
break;
// 当前项目状态是单位内部审核中 // 当前项目状态是单位内部审核中
case UNDER_INTERNAL_AUDIT: case UNDER_INTERNAL_AUDIT:
// 当前项目状态是预审中
case PRE_APPLYING:
// 当前项目状态是部门联审中
// 当前项目状态是部门联审中
case DEPARTMENT_JOINT_REVIEW: case DEPARTMENT_JOINT_REVIEW:
// 当前项目状态是方案评审中
// 当前项目状态是方案评审中
case SCHEME_UNDER_REVIEW: case SCHEME_UNDER_REVIEW:
// 当前项目状态是终验审核中
// 当前项目状态是终验审核中
case FINAL_ACCEPTANCE_IS_UNDER_REVIEW: case FINAL_ACCEPTANCE_IS_UNDER_REVIEW:
updatePassProjectStatus(userId, declaredProject); updatePassProjectStatus(userId, declaredProject);
break; break;


Loading…
Cancel
Save