@@ -56,7 +56,7 @@ public class GeneratorCodeKingbaseConfig { | |||||
} | } | ||||
public static void main(String[] args) { | public static void main(String[] args) { | ||||
generate("Liuxinxin", "expert", PATH_LXX, "expert_avoid_company"); | |||||
generate("Liuxinxin", "expert", PATH_LXX, "expert_avoid_company"); | |||||
} | } | ||||
} | } |
@@ -6,7 +6,7 @@ import com.ningdatech.pmapi.common.constant.StateMachineConstants; | |||||
import com.ningdatech.pmapi.common.statemachine.builder.ProjectDeclareStateMachineBuilder; | import com.ningdatech.pmapi.common.statemachine.builder.ProjectDeclareStateMachineBuilder; | ||||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
@@ -44,7 +44,7 @@ public class StateMachineUtils { | |||||
public void execute(Project project, ProjectStatusChangeEvent event) throws Exception { | public void execute(Project project, ProjectStatusChangeEvent event) throws Exception { | ||||
log.info("调用状态机前的项目状态为>>>>>>>>>>{}" + project.getStatus()); | log.info("调用状态机前的项目状态为>>>>>>>>>>{}" + project.getStatus()); | ||||
// 将状态变更记录保存到项目状态变更表中 | // 将状态变更记录保存到项目状态变更表中 | ||||
NdProjectStatusChange projectStatusChange = new NdProjectStatusChange(); | |||||
ProjectStatusChange projectStatusChange = new ProjectStatusChange(); | |||||
projectStatusChange.setBeforeStatus(project.getStatus()); | projectStatusChange.setBeforeStatus(project.getStatus()); | ||||
//获取TO状态机 | //获取TO状态机 | ||||
StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = projectDeclareStateMachineBuilder.build(); | StateMachine<ProjectStatusEnum, ProjectStatusChangeEvent> stateMachine = projectDeclareStateMachineBuilder.build(); | ||||
@@ -4,8 +4,11 @@ import com.ningdatech.basic.exception.BizException; | |||||
import com.ningdatech.basic.model.GenericResult; | import com.ningdatech.basic.model.GenericResult; | ||||
import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; | import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; | ||||
import com.ningdatech.zwdd.client.ZwddClient; | import com.ningdatech.zwdd.client.ZwddClient; | ||||
import lombok.RequiredArgsConstructor; | |||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.stereotype.Component; | |||||
import java.util.List; | |||||
import java.util.concurrent.*; | import java.util.concurrent.*; | ||||
/** | /** | ||||
@@ -15,18 +18,22 @@ import java.util.concurrent.*; | |||||
* @since 2023/02/23 13:50 | * @since 2023/02/23 13:50 | ||||
*/ | */ | ||||
@Slf4j | @Slf4j | ||||
@RequiredArgsConstructor | |||||
@Component | |||||
public class SendWorkNoticeUtil { | public class SendWorkNoticeUtil { | ||||
private SendWorkNoticeUtil(){ | |||||
private final ZwddClient zwddClient; | |||||
} | |||||
/** | |||||
* 初始化线程池 | |||||
*/ | |||||
public static ThreadPoolExecutor threadPool = new ThreadPoolExecutor(2, 10, | |||||
60, TimeUnit.SECONDS, new ArrayBlockingQueue(10), new ThreadPoolExecutor.AbortPolicy()); | |||||
public static void sendWorkNotice(ZwddClient zwddClient, WorkNoticeInfo workNoticeInfo, String msg){ | |||||
// 初始化线程池 | |||||
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(10, 20, | |||||
60, TimeUnit.SECONDS, new ArrayBlockingQueue(20), new ThreadPoolExecutor.AbortPolicy()); | |||||
public Boolean sendWorkNotice(WorkNoticeInfo workNoticeInfo){ | |||||
// 将发送工作通知交给异步任务Future | // 将发送工作通知交给异步任务Future | ||||
String msg = workNoticeInfo.getMsg(); | |||||
CompletableFuture<String> future = CompletableFuture.supplyAsync(() -> { | CompletableFuture<String> future = CompletableFuture.supplyAsync(() -> { | ||||
// 调用浙政钉的接口发送工作通知 | // 调用浙政钉的接口发送工作通知 | ||||
long startTime = System.currentTimeMillis(); | long startTime = System.currentTimeMillis(); | ||||
@@ -41,17 +48,19 @@ public class SendWorkNoticeUtil { | |||||
return "发送工作通知失败!"; | return "发送工作通知失败!"; | ||||
} | } | ||||
return "发送工作通知成功!"; | return "发送工作通知成功!"; | ||||
}, threadPool); | |||||
String s; | |||||
try { | |||||
s = future.get(); | |||||
} catch (Exception e) { | |||||
throw new BizException("获取异步线程处理结果失败!"); | |||||
} | |||||
threadPool.shutdown(); | |||||
while (threadPool.isTerminated()) { | |||||
}, threadPool); | |||||
String s; | |||||
try { | |||||
s = future.get(); | |||||
} catch (Exception e) { | |||||
throw new BizException("获取异步线程处理结果失败!"); | |||||
} | |||||
threadPool.shutdown(); | |||||
while (!threadPool.isTerminated()) { | |||||
log.info(s); | |||||
return Boolean.FALSE; | |||||
} | |||||
log.info(s); | log.info(s); | ||||
break; | |||||
} | |||||
return Boolean.TRUE; | |||||
} | } | ||||
} | } |
@@ -8,7 +8,6 @@ import com.ningdatech.basic.model.PageVo; | |||||
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; | import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; | ||||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | import com.ningdatech.pmapi.common.helper.UserInfoHelper; | ||||
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | ||||
import com.ningdatech.pmapi.projectdeclared.contants.DeclaredProjectContant; | |||||
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; | import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; | ||||
import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO; | import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO; | ||||
import com.ningdatech.pmapi.projectdeclared.model.req.PrequalificationDeclaredListReq; | import com.ningdatech.pmapi.projectdeclared.model.req.PrequalificationDeclaredListReq; | ||||
@@ -21,7 +20,7 @@ import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | |||||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | ||||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | ||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | import com.ningdatech.pmapi.projectlib.service.IProjectService; | ||||
import com.ningdatech.pmapi.staging.serivice.IProjectStagingService; | |||||
import com.ningdatech.pmapi.staging.service.IProjectStagingService; | |||||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | ||||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | import com.ningdatech.pmapi.user.util.LoginUserUtil; | ||||
import com.wflow.bean.entity.WflowModels; | import com.wflow.bean.entity.WflowModels; | ||||
@@ -6,8 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | ||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | import com.ningdatech.pmapi.projectlib.service.IProjectService; | ||||
@@ -71,26 +70,26 @@ public class AnnualPlanHandle extends AbstractProcessBusinessHandle { | |||||
// 项目状态为年度计划中 | // 项目状态为年度计划中 | ||||
if (ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode().equals(status)){ | if (ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode().equals(status)){ | ||||
// 根据部门联审通过的时间获取 | // 根据部门联审通过的时间获取 | ||||
NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) | |||||
.eq(NdProjectStatusChange::getProjectId, projectId) | |||||
.eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS.name()) | |||||
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | |||||
.eq(ProjectStatusChange::getProjectId, projectId) | |||||
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.DEPARTMENT_UNITED_REVIEW_PASS.name()) | |||||
.last("limit 1")); | .last("limit 1")); | ||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | ||||
processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); | processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); | ||||
} else if (ProjectStatusEnum.BE_SUSPENDED.getCode().equals(status)) { | } else if (ProjectStatusEnum.BE_SUSPENDED.getCode().equals(status)) { | ||||
// 根据年度计划暂缓的时间获取 | // 根据年度计划暂缓的时间获取 | ||||
NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) | |||||
.eq(NdProjectStatusChange::getProjectId, projectId) | |||||
.eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND.name()) | |||||
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | |||||
.eq(ProjectStatusChange::getProjectId, projectId) | |||||
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND.name()) | |||||
.last("limit 1")); | .last("limit 1")); | ||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | ||||
processDetailVO.setStepStatus(StepStatusEnum.REJECTED); | processDetailVO.setStepStatus(StepStatusEnum.REJECTED); | ||||
} else { | } else { | ||||
// 根据开启方案申报的时间获取 | // 根据开启方案申报的时间获取 | ||||
NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) | |||||
.eq(NdProjectStatusChange::getProjectId, projectId) | |||||
.eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE.name()) | |||||
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | |||||
.eq(ProjectStatusChange::getProjectId, projectId) | |||||
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.ANNUAL_PLAN_PROJECT_OPEN_PLAN_DECLARE.name()) | |||||
.last("limit 1")); | .last("limit 1")); | ||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | ||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | ||||
@@ -11,7 +11,7 @@ import com.ningdatech.pmapi.common.constant.CommonConstant; | |||||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | ||||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | ||||
@@ -48,9 +48,9 @@ public class ArchivedHandle extends AbstractProcessBusinessHandle { | |||||
// 项目阶段为已归档 | // 项目阶段为已归档 | ||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | ||||
// 根据项目终验获取归档时间 | // 根据项目终验获取归档时间 | ||||
NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) | |||||
.eq(NdProjectStatusChange::getProjectId, projectId) | |||||
.eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS.name()) | |||||
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | |||||
.eq(ProjectStatusChange::getProjectId, projectId) | |||||
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.FINAL_ACCEPTANCE_PASS.name()) | |||||
.last("limit 1")); | .last("limit 1")); | ||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | ||||
processDetailVO.setProcessName(CommonConstant.ARCHIVED); | processDetailVO.setProcessName(CommonConstant.ARCHIVED); | ||||
@@ -3,24 +3,19 @@ package com.ningdatech.pmapi.projectlib.handle; | |||||
import java.time.LocalDate; | import java.time.LocalDate; | ||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
import java.util.*; | import java.util.*; | ||||
import java.util.stream.Collectors; | |||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
import com.ningdatech.basic.util.NdDateUtils; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import org.springframework.core.annotation.Order; | import org.springframework.core.annotation.Order; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.ningdatech.basic.model.PageVo; | |||||
import com.ningdatech.pmapi.common.constant.CommonConstant; | import com.ningdatech.pmapi.common.constant.CommonConstant; | ||||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; | import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | |||||
import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | ||||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | ||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | import com.ningdatech.pmapi.projectlib.service.IProjectService; | ||||
@@ -86,9 +81,9 @@ public class ProjectApprovalHandle extends AbstractProcessBusinessHandle { | |||||
// 当前项目状态为待立项批复 | // 当前项目状态为待立项批复 | ||||
if (ProjectStatusEnum.TO_BE_APPROVED.getCode().equals(status)){ | if (ProjectStatusEnum.TO_BE_APPROVED.getCode().equals(status)){ | ||||
// 根据建设方案评审通过的时间获取 | // 根据建设方案评审通过的时间获取 | ||||
NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) | |||||
.eq(NdProjectStatusChange::getProjectId, projectId) | |||||
.eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.PLAN_REVIEW_PASS.name()) | |||||
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | |||||
.eq(ProjectStatusChange::getProjectId, projectId) | |||||
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PLAN_REVIEW_PASS.name()) | |||||
.last("limit 1")); | .last("limit 1")); | ||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | ||||
processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); | processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); | ||||
@@ -4,7 +4,6 @@ import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; | |||||
import java.util.Arrays; | import java.util.Arrays; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Objects; | |||||
import org.springframework.core.annotation.Order; | import org.springframework.core.annotation.Order; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
@@ -15,8 +14,7 @@ import com.ningdatech.pmapi.common.constant.CommonConstant; | |||||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | ||||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | ||||
@@ -70,9 +68,9 @@ public class ProjectPreliminaryInspectionHandle extends AbstractProcessBusinessH | |||||
}else { | }else { | ||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | ||||
// 根据初验备案的时间获取 | // 根据初验备案的时间获取 | ||||
NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) | |||||
.eq(NdProjectStatusChange::getProjectId, projectId) | |||||
.eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD.name()) | |||||
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | |||||
.eq(ProjectStatusChange::getProjectId, projectId) | |||||
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD.name()) | |||||
.last("limit 1")); | .last("limit 1")); | ||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | ||||
} | } | ||||
@@ -2,26 +2,19 @@ package com.ningdatech.pmapi.projectlib.handle; | |||||
import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; | import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; | ||||
import java.time.LocalDate; | |||||
import java.time.LocalDateTime; | |||||
import java.util.*; | import java.util.*; | ||||
import java.util.stream.Collectors; | |||||
import org.springframework.core.annotation.Order; | import org.springframework.core.annotation.Order; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.ningdatech.basic.model.PageVo; | |||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
import com.ningdatech.pmapi.common.constant.CommonConstant; | import com.ningdatech.pmapi.common.constant.CommonConstant; | ||||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | |||||
import com.ningdatech.pmapi.projectlib.model.vo.AnnualPlanListItemVO; | |||||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | ||||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | ||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | import com.ningdatech.pmapi.projectlib.service.IProjectService; | ||||
@@ -74,9 +67,9 @@ public class TenderPurchaseHandle extends AbstractProcessBusinessHandle { | |||||
}else if (fieldList.contains(status)){ | }else if (fieldList.contains(status)){ | ||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | ||||
// 根据采购备案的时间获取 | // 根据采购备案的时间获取 | ||||
NdProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(NdProjectStatusChange.class) | |||||
.eq(NdProjectStatusChange::getProjectId, projectId) | |||||
.eq(NdProjectStatusChange::getEvent, ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD.name()) | |||||
ProjectStatusChange projectStatusChange = projectStatusChangeService.getOne(Wrappers.lambdaQuery(ProjectStatusChange.class) | |||||
.eq(ProjectStatusChange::getProjectId, projectId) | |||||
.eq(ProjectStatusChange::getEvent, ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD.name()) | |||||
.last("limit 1")); | .last("limit 1")); | ||||
processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | processDetailVO.setFinishTime(projectStatusChange.getCreateOn()); | ||||
} | } | ||||
@@ -1,6 +1,6 @@ | |||||
package com.ningdatech.pmapi.projectlib.mapper; | package com.ningdatech.pmapi.projectlib.mapper; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||||
/** | /** | ||||
@@ -11,6 +11,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
* @author CMM | * @author CMM | ||||
* @since 2023-02-27 | * @since 2023-02-27 | ||||
*/ | */ | ||||
public interface NdProjectStatusChangeMapper extends BaseMapper<NdProjectStatusChange> { | |||||
public interface NdProjectStatusChangeMapper extends BaseMapper<ProjectStatusChange> { | |||||
} | } |
@@ -1,95 +0,0 @@ | |||||
package com.ningdatech.pmapi.projectlib.model.entity; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
/** | |||||
* <p> | |||||
* | |||||
* </p> | |||||
* | |||||
* @author CMM | |||||
* @since 2023-02-27 | |||||
*/ | |||||
@TableName("nd_project_status_change") | |||||
@ApiModel(value = "NdProjectStatusChange对象", description = "") | |||||
public class NdProjectStatusChange implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty("主键") | |||||
private Long id; | |||||
@ApiModelProperty("项目ID") | |||||
private Long projectId; | |||||
@ApiModelProperty("状态机执行前的项目状态") | |||||
private Integer beforeStatus; | |||||
@ApiModelProperty("状态机执行后的项目状态") | |||||
private Integer afterStatus; | |||||
@ApiModelProperty("状态变更对应的事件") | |||||
private String event; | |||||
@ApiModelProperty("状态变更发生的时间") | |||||
private LocalDateTime createOn; | |||||
public Long getId() { | |||||
return id; | |||||
} | |||||
public void setId(Long id) { | |||||
this.id = id; | |||||
} | |||||
public Long getProjectId() { | |||||
return projectId; | |||||
} | |||||
public void setProjectId(Long projectId) { | |||||
this.projectId = projectId; | |||||
} | |||||
public Integer getBeforeStatus() { | |||||
return beforeStatus; | |||||
} | |||||
public void setBeforeStatus(Integer beforeStatus) { | |||||
this.beforeStatus = beforeStatus; | |||||
} | |||||
public Integer getAfterStatus() { | |||||
return afterStatus; | |||||
} | |||||
public void setAfterStatus(Integer afterStatus) { | |||||
this.afterStatus = afterStatus; | |||||
} | |||||
public String getEvent() { | |||||
return event; | |||||
} | |||||
public void setEvent(String event) { | |||||
this.event = event; | |||||
} | |||||
public LocalDateTime getCreateOn() { | |||||
return createOn; | |||||
} | |||||
public void setCreateOn(LocalDateTime createOn) { | |||||
this.createOn = createOn; | |||||
} | |||||
@Override | |||||
public String toString() { | |||||
return "NdProjectStatusChange{" + | |||||
"id=" + id + | |||||
", projectId=" + projectId + | |||||
", beforeStatus=" + beforeStatus + | |||||
", afterStatus=" + afterStatus + | |||||
", event=" + event + | |||||
", createOn=" + createOn + | |||||
"}"; | |||||
} | |||||
} |
@@ -0,0 +1,48 @@ | |||||
package com.ningdatech.pmapi.projectlib.model.entity; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.AllArgsConstructor; | |||||
import lombok.Builder; | |||||
import lombok.Data; | |||||
import lombok.NoArgsConstructor; | |||||
/** | |||||
* <p> | |||||
* | |||||
* </p> | |||||
* | |||||
* @author CMM | |||||
* @since 2023-02-27 | |||||
*/ | |||||
@Data | |||||
@Builder | |||||
@AllArgsConstructor | |||||
@NoArgsConstructor | |||||
@TableName("nd_project_status_change") | |||||
@ApiModel(value = "NdProjectStatusChange对象", description = "") | |||||
public class ProjectStatusChange implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty("主键") | |||||
private Long id; | |||||
@ApiModelProperty("项目ID") | |||||
private Long projectId; | |||||
@ApiModelProperty("状态机执行前的项目状态") | |||||
private Integer beforeStatus; | |||||
@ApiModelProperty("状态机执行后的项目状态") | |||||
private Integer afterStatus; | |||||
@ApiModelProperty("状态变更对应的事件") | |||||
private String event; | |||||
@ApiModelProperty("状态变更发生的时间") | |||||
private LocalDateTime createOn; | |||||
} |
@@ -1,6 +1,6 @@ | |||||
package com.ningdatech.pmapi.projectlib.service; | package com.ningdatech.pmapi.projectlib.service; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | import com.baomidou.mybatisplus.extension.service.IService; | ||||
/** | /** | ||||
@@ -11,6 +11,6 @@ import com.baomidou.mybatisplus.extension.service.IService; | |||||
* @author CMM | * @author CMM | ||||
* @since 2023-02-27 | * @since 2023-02-27 | ||||
*/ | */ | ||||
public interface INdProjectStatusChangeService extends IService<NdProjectStatusChange> { | |||||
public interface INdProjectStatusChangeService extends IService<ProjectStatusChange> { | |||||
} | } |
@@ -1,6 +1,6 @@ | |||||
package com.ningdatech.pmapi.projectlib.service.impl; | package com.ningdatech.pmapi.projectlib.service.impl; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.NdProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; | |||||
import com.ningdatech.pmapi.projectlib.mapper.NdProjectStatusChangeMapper; | import com.ningdatech.pmapi.projectlib.mapper.NdProjectStatusChangeMapper; | ||||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | ||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||
@@ -15,6 +15,6 @@ import org.springframework.stereotype.Service; | |||||
* @since 2023-02-27 | * @since 2023-02-27 | ||||
*/ | */ | ||||
@Service | @Service | ||||
public class NdProjectStatusChangeServiceImpl extends ServiceImpl<NdProjectStatusChangeMapper, NdProjectStatusChange> implements INdProjectStatusChangeService { | |||||
public class NdProjectStatusChangeServiceImpl extends ServiceImpl<NdProjectStatusChangeMapper, ProjectStatusChange> implements INdProjectStatusChangeService { | |||||
} | } |
@@ -8,7 +8,7 @@ import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||||
import com.ningdatech.pmapi.scheduler.contants.TaskContant; | import com.ningdatech.pmapi.scheduler.contants.TaskContant; | ||||
import com.ningdatech.pmapi.staging.contants.StagingContant; | import com.ningdatech.pmapi.staging.contants.StagingContant; | ||||
import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; | import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; | ||||
import com.ningdatech.pmapi.staging.serivice.IProjectStagingService; | |||||
import com.ningdatech.pmapi.staging.service.IProjectStagingService; | |||||
import com.ningdatech.pmapi.staging.utils.ProjectStatusFlowMapUtil; | import com.ningdatech.pmapi.staging.utils.ProjectStatusFlowMapUtil; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
@@ -0,0 +1,87 @@ | |||||
package com.ningdatech.pmapi.scheduler.task; | |||||
import java.net.InetAddress; | |||||
import java.net.UnknownHostException; | |||||
import java.time.LocalDateTime; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
import java.util.Objects; | |||||
import java.util.function.Function; | |||||
import com.ningdatech.basic.model.GenericResult; | |||||
import com.ningdatech.pmapi.staging.model.entity.WorkNoticeStaging; | |||||
import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService; | |||||
import com.ningdatech.pmapi.staging.utils.WorkNoticeFlowMapUtil; | |||||
import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; | |||||
import com.ningdatech.zwdd.client.ZwddClient; | |||||
import org.springframework.beans.BeanUtils; | |||||
import org.springframework.scheduling.annotation.Scheduled; | |||||
import org.springframework.stereotype.Component; | |||||
import com.alibaba.fastjson.JSON; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||||
import com.ningdatech.pmapi.scheduler.contants.TaskContant; | |||||
import com.ningdatech.pmapi.staging.contants.StagingContant; | |||||
import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; | |||||
import com.ningdatech.pmapi.staging.service.IProjectStagingService; | |||||
import com.ningdatech.pmapi.staging.utils.ProjectStatusFlowMapUtil; | |||||
import cn.hutool.core.collection.CollUtil; | |||||
import lombok.RequiredArgsConstructor; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
/** | |||||
* 发送工作通知定时任务 | |||||
* @return | |||||
* @author CMM | |||||
* @since 2023/02/28 21:23 | |||||
*/ | |||||
@Slf4j | |||||
@Component | |||||
@RequiredArgsConstructor | |||||
public class WorkNoticeFlowTask { | |||||
private final INdWorkNoticeStagingService workNoticeStagingService; | |||||
private final ZwddClient zwddClient; | |||||
@Scheduled(cron = "0 */1 * * * ?") | |||||
public void statusFlow() throws UnknownHostException { | |||||
//测试暂时用自己电脑HOST | |||||
if (TaskContant.Host.HOST_CMM.equals(InetAddress.getLocalHost().getHostName())) { | |||||
//1. 定时取 工作通知暂存表的数据进行发送 | |||||
List<WorkNoticeStaging> stagingList = workNoticeStagingService.list(Wrappers.lambdaQuery(WorkNoticeStaging.class) | |||||
.eq(WorkNoticeStaging::getDead, Boolean.FALSE) | |||||
.ge(WorkNoticeStaging::getNextTime, LocalDateTime.now()) | |||||
.le(WorkNoticeStaging::getRetryTimes, StagingContant.Retry.MAX_RETRY_TIMES) | |||||
.orderByAsc(WorkNoticeStaging::getId)); | |||||
log.info("需要发送的工作通知 size:{} :{}",stagingList.size(), JSON.toJSONString(stagingList)); | |||||
if(CollUtil.isEmpty(stagingList)){ | |||||
log.info("没有需要发送的工作通知!"); | |||||
return; | |||||
} | |||||
//遍历 | |||||
for(WorkNoticeStaging workNoticeStaging : stagingList){ | |||||
try{ | |||||
WorkNoticeInfo workNoticeInfo = new WorkNoticeInfo(); | |||||
BeanUtils.copyProperties(workNoticeStaging,workNoticeInfo); | |||||
String receiverUserId = workNoticeInfo.getReceiverUserId(); | |||||
String bizMsgId = workNoticeInfo.getBizMsgId(); | |||||
String msg = workNoticeInfo.getMsg(); | |||||
GenericResult<Void> result = zwddClient.sendWorkNotice(receiverUserId, bizMsgId, msg); | |||||
if (result.isSuccess()){ | |||||
//执行成功了 删除暂存的数据 | |||||
workNoticeStagingService.removeById(workNoticeStaging); | |||||
} | |||||
}catch (Exception e){ | |||||
log.error("发送工作通知 异常 bizMsgId:【" + workNoticeStaging.getBizMsgId() + "】 异常内容:" + e); | |||||
}finally { | |||||
//增加重试的次数 和下次扫描时间 | |||||
workNoticeStagingService.addRetryTimes(workNoticeStaging); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,51 @@ | |||||
package com.ningdatech.pmapi.staging.enums; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | |||||
import lombok.AllArgsConstructor; | |||||
import lombok.Getter; | |||||
import lombok.NoArgsConstructor; | |||||
import org.apache.commons.lang3.StringUtils; | |||||
import java.util.Objects; | |||||
/** | |||||
* 消息类型枚举 | |||||
* @author CMM | |||||
* @since 2023/02/28 17:34 | |||||
*/ | |||||
@Getter | |||||
@AllArgsConstructor | |||||
@NoArgsConstructor | |||||
public enum MsgTypeEnum { | |||||
/** | |||||
* 消息类型 | |||||
*/ | |||||
AUDIT(1, "项目审核(待审核)"), | |||||
PASS(2, "项目审核(通过)"), | |||||
REJECTED(3,"项目审核(被驳回)"), | |||||
BACKED(4,"项目审核(被退回)"), | |||||
WARING(5,"预警提醒"), | |||||
EXPORT_REVIEW(6,"专家评审"), | |||||
REVIEW_MEETING(7,"评审会议"); | |||||
private Integer code; | |||||
private String desc; | |||||
public static String getDescByCode(Integer code) { | |||||
if (Objects.isNull(code)) { | |||||
return StringUtils.EMPTY; | |||||
} | |||||
for (MsgTypeEnum t : MsgTypeEnum.values()) { | |||||
if (code.equals(t.getCode())) { | |||||
return t.desc; | |||||
} | |||||
} | |||||
return StringUtils.EMPTY; | |||||
} | |||||
public boolean eq(String val) { | |||||
return this.name().equals(val); | |||||
} | |||||
} |
@@ -0,0 +1,21 @@ | |||||
package com.ningdatech.pmapi.staging.mapper; | |||||
import com.ningdatech.pmapi.staging.model.entity.WorkNoticeStaging; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
import org.apache.ibatis.annotations.Param; | |||||
import java.time.LocalDateTime; | |||||
/** | |||||
* <p> | |||||
* Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author CMM | |||||
* @since 2023-02-28 | |||||
*/ | |||||
public interface NdWorkNoticeStagingMapper extends BaseMapper<WorkNoticeStaging> { | |||||
Boolean addRetryTimes(@Param("id") Long id, @Param("retryTimes") Integer retryTimes, | |||||
@Param("nextRetryTime") LocalDateTime nextRetryTime, @Param("dead") Boolean dead); | |||||
} |
@@ -0,0 +1,12 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
<mapper namespace="com.ningdatech.pmapi.staging.mapper.NdWorkNoticeStagingMapper"> | |||||
<update id="addRetryTimes"> | |||||
update nd_work_notice_staging | |||||
set retry_times = #{retryTimes}, | |||||
next_time = #{nextRetryTime}, | |||||
dead = #{dead} | |||||
where id = #{id} and retry_times = #{retryTimes - 1} | |||||
</update> | |||||
</mapper> |
@@ -0,0 +1,71 @@ | |||||
package com.ningdatech.pmapi.staging.model.entity; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.AllArgsConstructor; | |||||
import lombok.Builder; | |||||
import lombok.Data; | |||||
import lombok.NoArgsConstructor; | |||||
/** | |||||
* <p> | |||||
* | |||||
* </p> | |||||
* | |||||
* @author CMM | |||||
* @since 2023-02-28 | |||||
*/ | |||||
@Data | |||||
@Builder | |||||
@AllArgsConstructor | |||||
@NoArgsConstructor | |||||
@TableName("nd_work_notice_staging") | |||||
@ApiModel(value = "NdWorkNoticeStaging对象", description = "") | |||||
public class WorkNoticeStaging implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
@ApiModelProperty("主键") | |||||
private Long id; | |||||
@ApiModelProperty("浙政钉用户ID") | |||||
private Long accountId; | |||||
@ApiModelProperty("部门编号") | |||||
private String organizationCode; | |||||
@ApiModelProperty("部门名称") | |||||
private String organizationName; | |||||
@ApiModelProperty("工作通知唯一标识") | |||||
private String bizMsgId; | |||||
@ApiModelProperty("接收人浙政钉ID") | |||||
private String receiverUserId; | |||||
@ApiModelProperty("工作通知内容") | |||||
private String msg; | |||||
@ApiModelProperty("重试次数 最大10次") | |||||
private Integer retryTimes; | |||||
@ApiModelProperty("false 可继续扫描 true 死信") | |||||
private Boolean dead; | |||||
@ApiModelProperty("下次扫描时间") | |||||
private LocalDateTime nextTime; | |||||
@ApiModelProperty("消息类型") | |||||
private MsgTypeEnum msgType; | |||||
@ApiModelProperty("创建时间") | |||||
private LocalDateTime createOn; | |||||
@ApiModelProperty("更新时间") | |||||
private LocalDateTime updateOn; | |||||
} |
@@ -0,0 +1,23 @@ | |||||
package com.ningdatech.pmapi.staging.service; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||||
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.baomidou.mybatisplus.extension.service.IService; | |||||
import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; | |||||
/** | |||||
* <p> | |||||
* 服务类 | |||||
* </p> | |||||
* | |||||
* @author CMM | |||||
* @since 2023-02-28 | |||||
*/ | |||||
public interface INdWorkNoticeStagingService extends IService<WorkNoticeStaging> { | |||||
Boolean addRetryTimes(WorkNoticeStaging workNoticeStaging); | |||||
public Boolean addByWorkNotice(WorkNoticeInfo workNoticeInfo, MsgTypeEnum msgType) ; | |||||
} |
@@ -1,4 +1,4 @@ | |||||
package com.ningdatech.pmapi.staging.serivice; | |||||
package com.ningdatech.pmapi.staging.service; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | import com.baomidou.mybatisplus.extension.service.IService; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; |
@@ -0,0 +1,84 @@ | |||||
package com.ningdatech.pmapi.staging.service.impl; | |||||
import com.ningdatech.pmapi.staging.contants.StagingContant; | |||||
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.mapper.NdWorkNoticeStagingMapper; | |||||
import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import com.ningdatech.pmapi.staging.utils.WorkNoticeFlowMapUtil; | |||||
import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; | |||||
import lombok.RequiredArgsConstructor; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.springframework.stereotype.Service; | |||||
import java.time.LocalDateTime; | |||||
/** | |||||
* <p> | |||||
* 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author CMM | |||||
* @since 2023-02-28 | |||||
*/ | |||||
@Service | |||||
@Slf4j | |||||
@RequiredArgsConstructor | |||||
public class NdWorkNoticeStagingServiceImpl extends ServiceImpl<NdWorkNoticeStagingMapper, WorkNoticeStaging> implements INdWorkNoticeStagingService { | |||||
private final NdWorkNoticeStagingMapper mapper; | |||||
private final WorkNoticeFlowMapUtil workNoticeFlowMapUtil; | |||||
/** | |||||
* 增加 重试次数 和下次扫描时间 | |||||
* @param workNoticeStaging | |||||
* @return java.lang.Boolean | |||||
* @author CMM | |||||
* @since 2023/02/28 18:02 | |||||
*/ | |||||
@Override | |||||
public Boolean addRetryTimes(WorkNoticeStaging workNoticeStaging) { | |||||
Integer retryTimes = workNoticeStaging.getRetryTimes() + 1; | |||||
if(!workNoticeFlowMapUtil.intervalTimeMap.containsKey(retryTimes)){ | |||||
log.info("没有对应重试间隔时间 添加重试信息失败"); | |||||
return Boolean.FALSE; | |||||
} | |||||
Integer addSeconds = workNoticeFlowMapUtil.intervalTimeMap.get(retryTimes); | |||||
Boolean dead = Boolean.FALSE; | |||||
//超过重试最大次数 dead置为 true | |||||
if(retryTimes.compareTo(StagingContant.Retry.MAX_RETRY_TIMES) > 0){ | |||||
dead = Boolean.TRUE; | |||||
} | |||||
LocalDateTime nextRetryTime = LocalDateTime.now().plusSeconds(addSeconds); | |||||
return mapper.addRetryTimes(workNoticeStaging.getId(),retryTimes,nextRetryTime,dead); | |||||
} | |||||
/** | |||||
* 在对应的流程处理后,增加一个工作通知到暂存表中 | |||||
* @param workNoticeInfo | |||||
* @param msgType | |||||
* @return java.lang.Boolean | |||||
* @author CMM | |||||
* @since 2023/02/28 20:02 | |||||
*/ | |||||
@Override | |||||
public Boolean addByWorkNotice(WorkNoticeInfo workNoticeInfo, MsgTypeEnum msgType) { | |||||
WorkNoticeStaging workNoticeStaging = WorkNoticeStaging.builder() | |||||
.accountId(workNoticeInfo.getAccountId()) | |||||
.msg(workNoticeInfo.getMsg()) | |||||
.bizMsgId(workNoticeInfo.getBizMsgId()) | |||||
.organizationCode(workNoticeInfo.getOrganizationCode()) | |||||
.organizationName(workNoticeInfo.getOrganizationName()) | |||||
.receiverUserId(workNoticeInfo.getReceiverUserId()) | |||||
.msgType(msgType) | |||||
.createOn(LocalDateTime.now()) | |||||
.updateOn(LocalDateTime.now()) | |||||
.nextTime(LocalDateTime.now()) | |||||
.retryTimes(0) | |||||
.build(); | |||||
return this.save(workNoticeStaging); | |||||
} | |||||
} |
@@ -1,11 +1,11 @@ | |||||
package com.ningdatech.pmapi.staging.serivice.impl; | |||||
package com.ningdatech.pmapi.staging.service.impl; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.staging.contants.StagingContant; | import com.ningdatech.pmapi.staging.contants.StagingContant; | ||||
import com.ningdatech.pmapi.staging.mapper.ProjectStagingMapper; | import com.ningdatech.pmapi.staging.mapper.ProjectStagingMapper; | ||||
import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; | import com.ningdatech.pmapi.staging.model.entity.ProjectStaging; | ||||
import com.ningdatech.pmapi.staging.serivice.IProjectStagingService; | |||||
import com.ningdatech.pmapi.staging.service.IProjectStagingService; | |||||
import com.ningdatech.pmapi.staging.utils.ProjectStatusFlowMapUtil; | import com.ningdatech.pmapi.staging.utils.ProjectStatusFlowMapUtil; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; |
@@ -0,0 +1,83 @@ | |||||
package com.ningdatech.pmapi.staging.utils; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
import java.util.function.Function; | |||||
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 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; | |||||
/** | |||||
* 工作通知流转 事件函数MAP | |||||
* @return | |||||
* @author CMM | |||||
* @since 2023/02/28 17:03 | |||||
*/ | |||||
@Component | |||||
@RequiredArgsConstructor | |||||
public class WorkNoticeFlowMapUtil { | |||||
//public Map<Integer, Function<WorkNoticeInfo,Boolean>> workNoticeFlowFunctionMap = Maps.newHashMap(); | |||||
/** | |||||
* key 重试的次数 , value 是增加是描述 | |||||
*/ | |||||
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)); | |||||
// | |||||
//} | |||||
/** | |||||
* 扫描的间隔越来越长 秒数 | |||||
*/ | |||||
@PostConstruct | |||||
public void intervalTimeMapInit(){ | |||||
intervalTimeMap.put(1,60 * 2); | |||||
intervalTimeMap.put(2,60 * 6); | |||||
intervalTimeMap.put(3,60 * 15); | |||||
intervalTimeMap.put(4,60 * 30); | |||||
intervalTimeMap.put(5,60 * 60); | |||||
intervalTimeMap.put(6,60 * 60 * 2); | |||||
intervalTimeMap.put(7,60 * 60 * 5); | |||||
intervalTimeMap.put(8,60 * 60 * 12); | |||||
intervalTimeMap.put(9,60 * 60 * 24); | |||||
intervalTimeMap.put(10,60 * 60 * 72); | |||||
} | |||||
} |
@@ -14,6 +14,7 @@ import lombok.NoArgsConstructor; | |||||
@AllArgsConstructor | @AllArgsConstructor | ||||
@NoArgsConstructor | @NoArgsConstructor | ||||
public class WorkNoticeInfo { | public class WorkNoticeInfo { | ||||
private String msg; | |||||
private Long accountId; | private Long accountId; | ||||
private String organizationCode; | private String organizationCode; | ||||
private String organizationName; | private String organizationName; | ||||
@@ -10,10 +10,12 @@ import com.ningdatech.basic.exception.BizException; | |||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
import com.ningdatech.pmapi.common.constant.CommonConstant; | import com.ningdatech.pmapi.common.constant.CommonConstant; | ||||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||||
import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; | import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; | ||||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | ||||
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | ||||
import com.ningdatech.pmapi.common.util.ExcelDownUtil; | import com.ningdatech.pmapi.common.util.ExcelDownUtil; | ||||
import com.ningdatech.pmapi.common.util.SendWorkNoticeUtil; | |||||
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; | 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; | ||||
@@ -24,6 +26,8 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | ||||
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.service.INdWorkNoticeStagingService; | |||||
import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; | import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; | ||||
import com.ningdatech.pmapi.todocenter.bean.vo.ProcessProgressDetailVo; | import com.ningdatech.pmapi.todocenter.bean.vo.ProcessProgressDetailVo; | ||||
import com.ningdatech.pmapi.todocenter.enumeration.IsAppendProjectEnum; | import com.ningdatech.pmapi.todocenter.enumeration.IsAppendProjectEnum; | ||||
@@ -33,6 +37,7 @@ import com.ningdatech.pmapi.todocenter.model.dto.req.ToBeProcessedExportReq; | |||||
import com.ningdatech.pmapi.todocenter.model.dto.vo.ResToBeProcessedVO; | import com.ningdatech.pmapi.todocenter.model.dto.vo.ResToBeProcessedVO; | ||||
import com.ningdatech.pmapi.user.entity.UserInfo; | import com.ningdatech.pmapi.user.entity.UserInfo; | ||||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | |||||
import com.ningdatech.pmapi.user.service.IUserInfoService; | import com.ningdatech.pmapi.user.service.IUserInfoService; | ||||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | import com.ningdatech.pmapi.user.util.LoginUserUtil; | ||||
import com.ningdatech.zwdd.client.ZwddClient; | import com.ningdatech.zwdd.client.ZwddClient; | ||||
@@ -87,6 +92,8 @@ public class TodoCenterManage { | |||||
private final IDingEmployeeInfoService dingEmployeeInfoService; | private final IDingEmployeeInfoService dingEmployeeInfoService; | ||||
private final IDingOrganizationService dingOrganizationService; | private final IDingOrganizationService dingOrganizationService; | ||||
private final ProcessInstanceService processInstanceService; | private final ProcessInstanceService processInstanceService; | ||||
private final ZwddClient zwddClient; | |||||
private final INdWorkNoticeStagingService workNoticeStagingService; | |||||
/** | /** | ||||
@@ -261,46 +268,46 @@ public class TodoCenterManage { | |||||
// 获取发送浙政钉工作通知必要信息 | // 获取发送浙政钉工作通知必要信息 | ||||
WorkNoticeInfo passWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); | WorkNoticeInfo passWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); | ||||
String passMsg = String.format(PASS_MSG_TEMPLATE, passWorkNoticeInfo.getOrganizationName(), projectName); | String passMsg = String.format(PASS_MSG_TEMPLATE, passWorkNoticeInfo.getOrganizationName(), projectName); | ||||
// 异步发送工作通知 | |||||
// SendWorkNoticeUtil.sendWorkNotice(zwddClient,passWorkNoticeInfo,passMsg); | |||||
passWorkNoticeInfo.setMsg(passMsg); | |||||
// 放入工作通知暂存表中,通过扫表异步发送 | |||||
workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, MsgTypeEnum.AUDIT); | |||||
return; | return; | ||||
} | } | ||||
// 若不是被退回状态,流程通过后,判断当前登录用户是不是最后一个审核人 | // 若不是被退回状态,流程通过后,判断当前登录用户是不是最后一个审核人 | ||||
// TODO 若当前流程是预审流程,需要在提交预审申报的时候,调用状态机判断申报后的项目状态, | |||||
// 若是省级部门联审中,要对接外部接口,获取省级部门联审的结果,更新项目状态(预审申报提交的时候处理) | |||||
// 若当前登录用户是最后一个审批人,需更新流程状态为审核完成,项目状态到下个状态 | // 若当前登录用户是最后一个审批人,需更新流程状态为审核完成,项目状态到下个状态 | ||||
// 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 | // 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 | ||||
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 UNDER_INTERNAL_AUDIT: | case UNDER_INTERNAL_AUDIT: | ||||
// 当前项目状态是预审中 | |||||
// 当前项目状态是预审中 | |||||
case PRE_APPLYING: | 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; | ||||
default: | default: | ||||
throw new IllegalStateException("Unexpected value: " + projectStatus); | throw new IllegalStateException("Unexpected value: " + projectStatus); | ||||
} | } | ||||
// WorkNoticeInfo passWorkNoticeInfo2 = getSendWorkNoticeInfo(startUserInfo); | |||||
// String passMsg2 = String.format(PASS_MSG_TEMPLATE2, projectName, processDefinitionName); | |||||
// 异步发送工作通知 | |||||
// SendWorkNoticeUtil.sendWorkNotice(zwddClient,passWorkNoticeInfo2,passMsg2); | |||||
// 获取发送浙政钉工作通知必要信息 | |||||
WorkNoticeInfo passWorkNoticeInfo2 = getSendWorkNoticeInfo(startUserInfo); | |||||
String passMsg2 = String.format(PASS_MSG_TEMPLATE2, projectName, processDefinitionName); | |||||
passWorkNoticeInfo2.setMsg(passMsg2); | |||||
// 放入工作通知暂存表中,通过扫表异步发送 | |||||
workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo2, MsgTypeEnum.PASS); | |||||
}else { | }else { | ||||
// 若有下一个审核人(当前节点的用户), | // 若有下一个审核人(当前节点的用户), | ||||
// 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 | // 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 | ||||
// 获取发送浙政钉工作通知必要信息 | // 获取发送浙政钉工作通知必要信息 | ||||
// WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); | |||||
// String msg = String.format(PASS_MSG_TEMPLATE, null, projectName); | |||||
// 异步发送工作通知 | |||||
// SendWorkNoticeUtil.sendWorkNotice(zwddClient,sendWorkNoticeInfo,msg); | |||||
WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo); | |||||
String msg = String.format(PASS_MSG_TEMPLATE, sendWorkNoticeInfo.getOrganizationName(), projectName); | |||||
sendWorkNoticeInfo.setMsg(msg); | |||||
// 放入工作通知暂存表中,通过扫表异步发送 | |||||
workNoticeStagingService.addByWorkNotice(sendWorkNoticeInfo, MsgTypeEnum.AUDIT); | |||||
} | } | ||||
break; | break; | ||||
// 盖章并通过 | // 盖章并通过 | ||||
@@ -314,12 +321,14 @@ public class TodoCenterManage { | |||||
// 驳回该任务,中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知: | // 驳回该任务,中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知: | ||||
// 【项目名称】的【流程名称】被驳回,请及时处理。 | // 【项目名称】的【流程名称】被驳回,请及时处理。 | ||||
processTaskService.handleTask(param, userId); | processTaskService.handleTask(param, userId); | ||||
WorkNoticeInfo rejectWorkNoticeInfo = getSendWorkNoticeInfo(startUserInfo); | |||||
String rejectMsg = String.format(REJECT_MSG_TEMPLATE, projectName, processDefinitionName); | |||||
// 异步发送工作通知 | |||||
// SendWorkNoticeUtil.sendWorkNotice(zwddClient,rejectWorkNoticeInfo,rejectMsg); | |||||
// 更新项目状态和流程状态 | // 更新项目状态和流程状态 | ||||
updateRejectProjectStatus(userId, declaredProject); | updateRejectProjectStatus(userId, declaredProject); | ||||
// 获取发送浙政钉工作通知必要信息 | |||||
WorkNoticeInfo rejectWorkNoticeInfo = getSendWorkNoticeInfo(startUserInfo); | |||||
String rejectMsg = String.format(REJECT_MSG_TEMPLATE, projectName, processDefinitionName); | |||||
rejectWorkNoticeInfo.setMsg(rejectMsg); | |||||
// 放入工作通知暂存表中,通过扫表异步发送 | |||||
workNoticeStagingService.addByWorkNotice(rejectWorkNoticeInfo, MsgTypeEnum.REJECTED); | |||||
break; | break; | ||||
// 退回 | // 退回 | ||||
case BACK: | case BACK: | ||||
@@ -331,10 +340,12 @@ public class TodoCenterManage { | |||||
declaredProject.setUpdateBy(userId); | declaredProject.setUpdateBy(userId); | ||||
projectService.updateById(declaredProject); | projectService.updateById(declaredProject); | ||||
// 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 | // 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 | ||||
// 获取发送浙政钉工作通知必要信息 | |||||
WorkNoticeInfo backWorkNoticeInfo = getSendWorkNoticeInfo(startUserInfo); | WorkNoticeInfo backWorkNoticeInfo = getSendWorkNoticeInfo(startUserInfo); | ||||
String backMsg = String.format(BACK_MSG_TEMPLATE, projectName, processDefinitionName); | String backMsg = String.format(BACK_MSG_TEMPLATE, projectName, processDefinitionName); | ||||
// 异步发送工作通知 | |||||
// SendWorkNoticeUtil.sendWorkNotice(zwddClient,backWorkNoticeInfo,backMsg); | |||||
backWorkNoticeInfo.setMsg(backMsg); | |||||
// 放入工作通知暂存表中,通过扫表异步发送 | |||||
workNoticeStagingService.addByWorkNotice(backWorkNoticeInfo, MsgTypeEnum.BACKED); | |||||
break; | break; | ||||
// 撤回(流程发起人和当前流程审核人的前一个审核人操作) | // 撤回(流程发起人和当前流程审核人的前一个审核人操作) | ||||
case WITHDRAW: | case WITHDRAW: | ||||
@@ -369,9 +380,12 @@ public class TodoCenterManage { | |||||
ProcessInstanceUserDto currentUser = currentProgressNode.getUser(); | ProcessInstanceUserDto currentUser = currentProgressNode.getUser(); | ||||
// 判断当前工作流任务前一个审核人的部门和当前登录用户的部门是否是同一个,如果是同一个才可以撤回,否则抛出异常 | // 判断当前工作流任务前一个审核人的部门和当前登录用户的部门是否是同一个,如果是同一个才可以撤回,否则抛出异常 | ||||
boolean orgFlag = currentUser.getOrgCode().equals(beforeUser.getOrgCode()); | boolean orgFlag = currentUser.getOrgCode().equals(beforeUser.getOrgCode()); | ||||
boolean userFlag = beforeUser.getUserId().equals(String.valueOf( userId)); | |||||
if (!orgFlag) { | if (!orgFlag) { | ||||
throw new BizException("下一个审核人和您不是同一个部门,无法撤回!"); | throw new BizException("下一个审核人和您不是同一个部门,无法撤回!"); | ||||
} else { | |||||
} else if (!userFlag){ | |||||
throw new BizException("当前登录用户无法进行撤回操作!"); | |||||
} else{ | |||||
processTaskService.handleTask(param, userId); | processTaskService.handleTask(param, userId); | ||||
} | } | ||||
} | } | ||||
@@ -4,6 +4,8 @@ import com.ningdatech.basic.exception.BizException; | |||||
import com.ningdatech.basic.model.GenericResult; | import com.ningdatech.basic.model.GenericResult; | ||||
import com.ningdatech.pmapi.AppTests; | import com.ningdatech.pmapi.AppTests; | ||||
import com.ningdatech.pmapi.beanconfig.BeanConfig; | import com.ningdatech.pmapi.beanconfig.BeanConfig; | ||||
import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; | |||||
import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService; | |||||
import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; | import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; | ||||
import com.ningdatech.pmapi.todocenter.manage.TodoCenterManage; | import com.ningdatech.pmapi.todocenter.manage.TodoCenterManage; | ||||
import com.ningdatech.pmapi.user.entity.UserInfo; | import com.ningdatech.pmapi.user.entity.UserInfo; | ||||
@@ -37,12 +39,12 @@ public class TodoCenterTest extends AppTests { | |||||
@Autowired | @Autowired | ||||
private TodoCenterManage todoCenterManage; | private TodoCenterManage todoCenterManage; | ||||
@Autowired | @Autowired | ||||
private IUserInfoService userInfoService; | private IUserInfoService userInfoService; | ||||
@Autowired | @Autowired | ||||
private ZwddClient zwddClient; | private ZwddClient zwddClient; | ||||
@Autowired | |||||
private INdWorkNoticeStagingService workNoticeStagingService; | |||||
@Test | @Test | ||||
public void sendWorkNoticeTest() throws ExecutionException, InterruptedException { | public void sendWorkNoticeTest() throws ExecutionException, InterruptedException { | ||||
//String msg = String.format(PASS_MSG_TEMPLATE, "发改委", "0223-00-测试项目"); | //String msg = String.format(PASS_MSG_TEMPLATE, "发改委", "0223-00-测试项目"); | ||||
@@ -93,4 +95,15 @@ public class TodoCenterTest extends AppTests { | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
@Test | |||||
public void sendWorkNoticeTest2(){ | |||||
UserInfo userInfo = userInfoService.getById(4L); | |||||
// 获取发送浙政钉工作通知必要信息 | |||||
WorkNoticeInfo passWorkNoticeInfo = todoCenterManage.getSendWorkNoticeInfo(userInfo); | |||||
String passMsg = String.format(PASS_MSG_TEMPLATE, passWorkNoticeInfo.getOrganizationName(), "测试项目0301-1"); | |||||
passWorkNoticeInfo.setMsg(passMsg); | |||||
// 放入工作通知暂存表中,通过扫表异步发送 | |||||
workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, MsgTypeEnum.AUDIT); | |||||
} | |||||
} | } |