@@ -64,6 +64,8 @@ public class ConstructionPlanManage { | |||
private final UserInfoHelper userInfoHelper; | |||
private final DefaultDeclaredProjectManage declaredProjectManage; | |||
/** | |||
* 建设方案 | |||
* | |||
@@ -72,6 +74,9 @@ public class ConstructionPlanManage { | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public String startTheProcess(DefaultDeclaredDTO dto) { | |||
Long userId = LoginUserUtil.getUserId(); | |||
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); | |||
ProjectDTO projectDto = dto.getProjectInfo(); | |||
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); | |||
Project projectInfo = projectService.getById(projectDto.getId()); | |||
@@ -96,7 +101,7 @@ public class ConstructionPlanManage { | |||
.throwMessage("提交失败 该项目不是 方案待申报状态或者未立项阶段"); | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(dto.getUser()); | |||
params.setUser(declaredProjectManage.buildUser(userId)); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
//放入条件判断的项目字段 | |||
ProjectConditionDTO conditionDto = new ProjectConditionDTO(); | |||
@@ -88,7 +88,6 @@ public class DeclaredProjectManage { | |||
public String startTheProcess(DefaultDeclaredDTO dto) { | |||
Long userId = LoginUserUtil.getUserId(); | |||
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); | |||
ProjectDTO projectInfo = dto.getProjectInfo(); | |||
@@ -115,7 +114,7 @@ public class DeclaredProjectManage { | |||
defaultDeclaredProjectManage.checkDuplication(projectInfo); | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(dto.getUser()); | |||
params.setUser(defaultDeclaredProjectManage.buildUser(userId)); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
//放入条件判断的项目字段 | |||
ProjectConditionDTO conditionDto = new ProjectConditionDTO(); | |||
@@ -144,6 +143,7 @@ public class DeclaredProjectManage { | |||
@Transactional(rollbackFor = Exception.class) | |||
public String reStartTheProcess(DefaultDeclaredDTO dto) { | |||
Long userId = LoginUserUtil.getUserId(); | |||
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); | |||
ProjectDTO projectDto = dto.getProjectInfo(); | |||
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); | |||
@@ -167,7 +167,7 @@ public class DeclaredProjectManage { | |||
.throwMessage("提交失败 该项目不是 单位内部拒绝审核状态或者未立项阶段"); | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(dto.getUser()); | |||
params.setUser(defaultDeclaredProjectManage.buildUser(userId)); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
//放入条件判断的项目字段 | |||
ProjectConditionDTO conditionDto = new ProjectConditionDTO(); | |||
@@ -2,9 +2,12 @@ package com.ningdatech.pmapi.projectdeclared.manage; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | |||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Component; | |||
@@ -24,6 +27,7 @@ public class DefaultDeclaredProjectManage { | |||
private final IProjectService projectService; | |||
private final UserInfoHelper userInfoHelper; | |||
//项目名称去重 | |||
public void checkDuplication(ProjectDTO project){ | |||
@@ -32,4 +36,18 @@ public class DefaultDeclaredProjectManage { | |||
.ne(Objects.nonNull(project.getId()),Project::getId,project.getId())) > 0) | |||
.throwMessage(String.format("修改失败 此项目名 【%s】 已存在!",project.getProjectName())); | |||
} | |||
public ProcessInstanceUserDto buildUser(Long userId){ | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); | |||
VUtils.isTrue(Objects.isNull(userFullInfo)) | |||
.throwMessage("当前登录用户 信息出错!"); | |||
return ProcessInstanceUserDto.builder() | |||
.userId(String.valueOf(userFullInfo.getUserId())) | |||
.userName(userFullInfo.getRealName()) | |||
.orgCode(userFullInfo.getOrganizationCode()) | |||
.orgName(userFullInfo.getOrganizationName()) | |||
.build(); | |||
} | |||
} |
@@ -67,6 +67,8 @@ public class PrequalificationDeclaredProjectManage { | |||
private final UserInfoHelper userInfoHelper; | |||
private final DefaultDeclaredProjectManage declaredProjectManage; | |||
/** | |||
* 提交预审 | |||
* | |||
@@ -75,6 +77,9 @@ public class PrequalificationDeclaredProjectManage { | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public String startTheProcess(DefaultDeclaredDTO dto) { | |||
Long userId = LoginUserUtil.getUserId(); | |||
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); | |||
ProjectDTO projectDto = dto.getProjectInfo(); | |||
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); | |||
Project projectInfo = projectService.getById(projectDto.getId()); | |||
@@ -121,7 +126,7 @@ public class PrequalificationDeclaredProjectManage { | |||
.getCode().equals(projectInfo.getStatus())){ | |||
//如果是非省级联审的项目 直接提交 预审 | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(dto.getUser()); | |||
params.setUser(declaredProjectManage.buildUser(userId)); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
//放入条件判断的项目字段 | |||
ProjectConditionDTO conditionDto = new ProjectConditionDTO(); | |||
@@ -14,6 +14,7 @@ import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import com.wflow.bean.entity.WflowModels; | |||
import com.wflow.exception.BusinessException; | |||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | |||
@@ -52,6 +53,8 @@ public class ReviewByDeptJointManage { | |||
private final UserInfoHelper userInfoHelper; | |||
private final DefaultDeclaredProjectManage declaredProjectManage; | |||
/** | |||
* 部门联审 | |||
* @param project | |||
@@ -59,6 +62,9 @@ public class ReviewByDeptJointManage { | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public Boolean startTheProcess(Project project) { | |||
Long userId = LoginUserUtil.getUserId(); | |||
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); | |||
VUtils.isTrue(Objects.isNull(project.getId())).throwMessage("提交失败 缺少项目ID!"); | |||
Project projectInfo = projectService.getById(project.getId()); | |||
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); | |||
@@ -81,12 +87,10 @@ public class ReviewByDeptJointManage { | |||
// 再判断 该项目是否 真实走完 预审审批 并且提取出 提交人 | |||
VUtils.isTrue(Objects.isNull(projectInfo.getSponsor())) | |||
.throwMessage("提交失败 项目信息 缺少项目发起人!"); | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(projectInfo.getSponsor()); | |||
VUtils.isTrue(Objects.isNull(userFullInfo)) | |||
.throwMessage("提交失败 项目发起人不存在!"); | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(buildUser(userFullInfo)); | |||
//发起人的信息 | |||
params.setUser(declaredProjectManage.buildUser(projectInfo.getSponsor())); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
Map<String, Object> formData = Maps.newHashMap(); | |||
@@ -109,15 +113,6 @@ public class ReviewByDeptJointManage { | |||
return Boolean.TRUE; | |||
} | |||
private ProcessInstanceUserDto buildUser(UserFullInfoDTO userFullInfo) { | |||
return ProcessInstanceUserDto.builder() | |||
.userId(String.valueOf(userFullInfo.getUserId())) | |||
.userName(userFullInfo.getRealName()) | |||
.orgCode(userFullInfo.getOrganizationCode()) | |||
.orgName(userFullInfo.getOrganizationName()) | |||
.build(); | |||
} | |||
private Boolean modifyProject(Project project, String instanceId) { | |||
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 | |||
try { | |||
@@ -31,9 +31,6 @@ public class DefaultDeclaredDTO implements Serializable { | |||
@ApiModelProperty("表单信息 保留") | |||
private Map<String,Object> formData; | |||
@ApiModelProperty("用户信息 暂时填一下") | |||
private ProcessInstanceUserDto user; | |||
public Map<String,Object> getFormData(){ | |||
if(CollUtil.isEmpty(this.formData)){ | |||
this.formData = Maps.newHashMap(); | |||
@@ -34,6 +34,7 @@ import com.ningdatech.pmapi.todocenter.model.dto.vo.ResToBeProcessedVO; | |||
import com.ningdatech.pmapi.user.entity.UserInfo; | |||
import com.ningdatech.pmapi.user.service.IUserInfoService; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import com.ningdatech.zwdd.client.ZwddClient; | |||
import com.wflow.bean.entity.WflowModels; | |||
import com.wflow.contants.HisProInsEndActId; | |||
@@ -114,11 +115,10 @@ public class TodoCenterManage { | |||
*/ | |||
public PageVo<ResToBeProcessedVO> todoProjectList(ToBeProcessedReq param) { | |||
// 获取登录用户ID | |||
// long userId = LoginUserUtil.getUserId(); | |||
String userId = param.getUserId(); | |||
Long userId = LoginUserUtil.getUserId(); | |||
//因为要解耦 不能把项目和工作流一起查 | |||
//1.先查出用户工作流 | |||
List<ProcessTaskVo> userTodoList = processTaskService.getUserTodoList(param.getProcessDefId(),userId); | |||
List<ProcessTaskVo> userTodoList = processTaskService.getUserTodoList(param.getProcessDefId(),String.valueOf(userId)); | |||
List<String> instCodes = userTodoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); | |||
//2.再分页查询项目信息 | |||
@@ -153,14 +153,13 @@ public class TodoCenterManage { | |||
*/ | |||
public void exportTodoList(HttpServletResponse response, ToBeProcessedExportReq param) { | |||
// 获取登录用户ID | |||
// long userId = LoginUserUtil.getUserId(); | |||
String userId = param.getUserId(); | |||
Long userId = LoginUserUtil.getUserId(); | |||
param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER); | |||
param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE); | |||
//因为要解耦 不能把项目和工作流一起查 | |||
//1.先查出用户工作流 | |||
List<ProcessTaskVo> userTodoList = processTaskService.getUserTodoList(param.getProcessDefId(),userId); | |||
List<ProcessTaskVo> userTodoList = processTaskService.getUserTodoList(param.getProcessDefId(),String.valueOf(userId)); | |||
List<String> instCodes = userTodoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); | |||
//2.再查询项目信息 | |||
@@ -506,9 +505,9 @@ public class TodoCenterManage { | |||
*/ | |||
private void updatePassProjectStatus(Long userId, Project declaredProject) { | |||
// 获取当前流程项目状态 | |||
Integer projectStatusSecond = declaredProject.getStatus(); | |||
Integer status = declaredProject.getStatus(); | |||
// 根据当前状态获取对应的通过事件 | |||
ProjectStatusChangeEvent event = stateMachineUtils.getProjectStatusPassEvent(projectStatusSecond); | |||
ProjectStatusChangeEvent event = stateMachineUtils.getProjectStatusPassEvent(status); | |||
try { | |||
stateMachineUtils.execute(declaredProject, event); | |||
declaredProject.setUpdateOn(LocalDateTime.now()); | |||
@@ -830,11 +829,10 @@ public class TodoCenterManage { | |||
*/ | |||
public PageVo<ResToBeProcessedVO> idoList(ToBeProcessedReq param) { | |||
// 获取登录用户ID | |||
// long userId = LoginUserUtil.getUserId(); | |||
long userId = LoginUserUtil.getUserId(); | |||
String userId = param.getUserId(); | |||
// 查出用户已处理工作流 | |||
List<ProcessTaskVo> userIdoList = processTaskService.getUserIdoList(param.getProcessDefId(), userId); | |||
List<ProcessTaskVo> userIdoList = processTaskService.getUserIdoList(param.getProcessDefId(),String.valueOf(userId)); | |||
List<String> instCodes = userIdoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); | |||
@@ -870,14 +868,14 @@ public class TodoCenterManage { | |||
*/ | |||
public void idoExport(HttpServletResponse response, ToBeProcessedExportReq param) { | |||
// 获取登录用户ID | |||
// long userId = LoginUserUtil.getUserId(); | |||
Long userId = LoginUserUtil.getUserId(); | |||
String userId = param.getUserId(); | |||
// String userId = param.getUserId(); | |||
param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER); | |||
param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE); | |||
// 查询用户已处理工作流 | |||
List<ProcessTaskVo> userIdoList = processTaskService.getUserIdoList(param.getProcessDefId(), userId); | |||
List<ProcessTaskVo> userIdoList = processTaskService.getUserIdoList(param.getProcessDefId(), String.valueOf(userId)); | |||
List<String> instCodes = userIdoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); | |||
// 查询项目信息 | |||
@@ -923,10 +921,9 @@ public class TodoCenterManage { | |||
public PageVo<ResToBeProcessedVO> mySubmittedList(ToBeProcessedReq param) { | |||
// 获取登录用户ID | |||
// Long startUserId = LoginUserUtil.getUserId(); | |||
String userId = param.getUserId(); | |||
Long startUserId = LoginUserUtil.getUserId(); | |||
// 查出登录用户已提交工作流 | |||
List<ProcessInstanceVo> userSubmittedList = processInstanceService.getUserSubmittedList(userId, param.getProcessDefId(), null); | |||
List<ProcessInstanceVo> userSubmittedList = processInstanceService.getUserSubmittedList(String.valueOf(startUserId), param.getProcessDefId(), null); | |||
List<String> instCodes = userSubmittedList.stream().map(ProcessInstanceVo::getInstanceId).collect(Collectors.toList()); | |||
// 分页查询项目信息 | |||
@@ -962,13 +959,12 @@ public class TodoCenterManage { | |||
public void exportMySubmittedList(HttpServletResponse response, ToBeProcessedExportReq param) { | |||
// 获取登录用户ID | |||
// long userId = LoginUserUtil.getUserId(); | |||
long userId = LoginUserUtil.getUserId(); | |||
String userId = param.getUserId(); | |||
param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER); | |||
param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE); | |||
// 查询用户已处理工作流 | |||
List<ProcessInstanceVo> userSubmittedList = processInstanceService.getUserSubmittedList(userId, param.getProcessDefId(), null); | |||
List<ProcessInstanceVo> userSubmittedList = processInstanceService.getUserSubmittedList(String.valueOf(userId), param.getProcessDefId(), null); | |||
List<String> instCodes = userSubmittedList.stream().map(ProcessInstanceVo::getInstanceId).collect(Collectors.toList()); | |||
// 查询项目信息 | |||
@@ -1013,11 +1009,10 @@ public class TodoCenterManage { | |||
*/ | |||
public PageVo<ResToBeProcessedVO> ccmeList(ToBeProcessedReq param) { | |||
// 获取当前登录用户ID | |||
// Long userId = LoginUserUtil.getUserId(); | |||
String userId = param.getUserId(); | |||
Long userId = LoginUserUtil.getUserId(); | |||
// 查询抄送登录用户的工作流 | |||
List<ProcessInstanceVo> ccMeList = processInstanceService.getCcMeList(param.getProcessDefId(), userId); | |||
List<ProcessInstanceVo> ccMeList = processInstanceService.getCcMeList(param.getProcessDefId(), String.valueOf(userId)); | |||
List<String> instCodes = ccMeList.stream().map(ProcessInstanceVo::getInstanceId).collect(Collectors.toList()); | |||
// 分页查询项目信息 | |||
@@ -1053,14 +1048,13 @@ public class TodoCenterManage { | |||
public void exportCcMeProjectList(HttpServletResponse response, ToBeProcessedExportReq param) { | |||
// 获取登录用户ID | |||
// long userId = LoginUserUtil.getUserId(); | |||
Long userId = LoginUserUtil.getUserId(); | |||
String userId = param.getUserId(); | |||
param.setPageNumber(CommonConstant.EXPORT_PAGE_NUMBER); | |||
param.setPageSize(CommonConstant.EXPORT_PAGE_SIZE); | |||
// 查询抄送登录用户的工作流 | |||
List<ProcessInstanceVo> ccMeList = processInstanceService.getCcMeList(param.getProcessDefId(), userId); | |||
List<ProcessInstanceVo> ccMeList = processInstanceService.getCcMeList(param.getProcessDefId(), String.valueOf(userId)); | |||
List<String> instCodes = ccMeList.stream().map(ProcessInstanceVo::getInstanceId).collect(Collectors.toList()); | |||
// 查询项目信息 | |||
@@ -45,9 +45,6 @@ public class ToBeProcessedReq extends PagePo implements Serializable { | |||
@ApiModelProperty(value = "是否增补项目",allowableValues = "非增补项目 0,增补项目 1") | |||
private Integer isTemporaryAugment; | |||
//因为测试 暂时传参 传下userId | |||
private String userId; | |||
@ApiModelProperty("流程配置ID") | |||
private String processDefId; | |||
} |