@@ -0,0 +1,2 @@ | |||
ALTER TABLE PUBLIC."nd_project" ADD "org_credit_code" VARCHAR(60); | |||
comment ON COLUMN nd_project.org_credit_code IS '企业统一信息代码'; |
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.TypeReference; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.pmapi.common.constant.RegionConst; | |||
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; | |||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | |||
@@ -21,6 +22,7 @@ import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | |||
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.security.auth.model.UserInfoDetails; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import com.wflow.bean.entity.WflowModels; | |||
import com.wflow.exception.BusinessException; | |||
@@ -76,8 +78,10 @@ public class ConstructionPlanManage { | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public String startTheProcess(DefaultDeclaredDTO dto) { | |||
Long userId = LoginUserUtil.getUserId(); | |||
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); | |||
UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); | |||
Long userId = userInfoDetails.getUserId(); | |||
VUtils.isTrue(Objects.isNull(userInfoDetails) ||Objects.isNull(userInfoDetails.getUserId())) | |||
.throwMessage("获取登录用户失败!"); | |||
ProjectDTO projectDto = dto.getProjectInfo(); | |||
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); | |||
@@ -8,7 +8,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.pmapi.common.constant.RegionConst; | |||
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; | |||
import com.ningdatech.pmapi.common.helper.RegionCacheHelper; | |||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; | |||
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | |||
@@ -28,6 +30,7 @@ import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; | |||
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.security.auth.model.UserInfoDetails; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import com.wflow.bean.entity.WflowModels; | |||
import com.wflow.bean.entity.WflowOrgModels; | |||
@@ -79,6 +82,8 @@ public class DeclaredProjectManage { | |||
private final UserInfoHelper userInfoHelper; | |||
private final RegionCacheHelper regionCacheHelper; | |||
/** | |||
* 新项目 启动实例 | |||
* | |||
@@ -87,10 +92,16 @@ public class DeclaredProjectManage { | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public String startTheProcess(DefaultDeclaredDTO dto) { | |||
Long userId = LoginUserUtil.getUserId(); | |||
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); | |||
UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); | |||
Long userId = userInfoDetails.getUserId(); | |||
VUtils.isTrue(Objects.isNull(userInfoDetails) ||Objects.isNull(userInfoDetails.getUserId())) | |||
.throwMessage("获取登录用户失败!"); | |||
ProjectDTO projectInfo = dto.getProjectInfo(); | |||
projectInfo.setAreaCode(userInfoDetails.getRegionCode()); | |||
projectInfo.setArea(regionCacheHelper.getRegionName(userInfoDetails.getRegionCode(), RegionConst.RL_COUNTY)); | |||
projectInfo.setBuildOrgCode(userInfoDetails.getOrganizationCode()); | |||
projectInfo.setBuildOrgName(userInfoDetails.getOrganizationName()); | |||
//如果是重新提交的话 判断下 项目是否存在 | |||
if(Objects.nonNull(projectInfo.getId())){ | |||
@@ -105,7 +116,7 @@ public class DeclaredProjectManage { | |||
} | |||
String regionCode = projectInfo.getAreaCode(); | |||
String regionCode = userInfoDetails.getRegionCode(); | |||
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | |||
.eq(WflowModels::getRegionCode, regionCode) | |||
@@ -138,7 +149,10 @@ public class DeclaredProjectManage { | |||
log.info("申报项目成功 【{}】", instanceId); | |||
//如果是重新提交的话 判断下 项目是否存在 | |||
saveOrUpdateProject(dto.getProjectInfo(), instanceId, regionCode,userId); | |||
if(saveOrUpdateProject(projectInfo, instanceId,userId) && Objects.nonNull(projectInfo.getDraftId())){ | |||
//如果是草稿箱提交 删除对应的草稿箱 | |||
projectDraftService.removeById(projectInfo.getDraftId()); | |||
} | |||
return instanceId; | |||
} | |||
@@ -152,10 +166,16 @@ public class DeclaredProjectManage { | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public String reStartTheProcess(DefaultDeclaredDTO dto) { | |||
Long userId = LoginUserUtil.getUserId(); | |||
VUtils.isTrue(Objects.isNull(userId)).throwMessage("获取登录用户失败!"); | |||
UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); | |||
VUtils.isTrue(Objects.isNull(userInfoDetails) || Objects.isNull(userInfoDetails.getUserId())) | |||
.throwMessage("获取登录用户失败!"); | |||
Long userId = userInfoDetails.getUserId(); | |||
ProjectDTO projectDto = dto.getProjectInfo(); | |||
projectDto.setAreaCode(userInfoDetails.getRegionCode()); | |||
projectDto.setArea(regionCacheHelper.getRegionName(userInfoDetails.getRegionCode(), RegionConst.RL_COUNTY)); | |||
projectDto.setBuildOrgCode(userInfoDetails.getOrganizationCode()); | |||
projectDto.setBuildOrgName(userInfoDetails.getOrganizationName()); | |||
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); | |||
Project projectInfo = projectService.getById(projectDto.getId()); | |||
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); | |||
@@ -193,7 +213,7 @@ public class DeclaredProjectManage { | |||
log.info("重新申报项目成功 【{}】", instanceId); | |||
//保存项目 | |||
saveOrUpdateProject(projectDto,instanceId,regionCode,userId); | |||
saveOrUpdateProject(projectDto,instanceId,userId); | |||
return instanceId; | |||
} | |||
@@ -204,8 +224,8 @@ public class DeclaredProjectManage { | |||
* @param projectDto | |||
* @param instanceId | |||
*/ | |||
private void saveOrUpdateProject(ProjectDTO projectDto, String instanceId, | |||
String regionCode,Long userId) { | |||
private Boolean saveOrUpdateProject(ProjectDTO projectDto, String instanceId, | |||
Long userId) { | |||
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 | |||
try { | |||
//保存项目表信息 | |||
@@ -213,7 +233,6 @@ public class DeclaredProjectManage { | |||
BeanUtils.copyProperties(projectDto, project); | |||
project.setCreateOn(LocalDateTime.now()); | |||
project.setUpdateOn(LocalDateTime.now()); | |||
project.setAreaCode(regionCode); | |||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
project.setInstCode(instanceId); | |||
@@ -244,6 +263,7 @@ public class DeclaredProjectManage { | |||
log.error("项目信息入库错误 ", e); | |||
throw new BusinessException("项目信息入库错误 :" + e.getMessage()); | |||
} | |||
return Boolean.TRUE; | |||
} | |||
public PageVo<ProjectDraftVO> pageDraft(DeclaredProjectListParamDTO params) { | |||
@@ -292,10 +312,15 @@ public class DeclaredProjectManage { | |||
*/ | |||
public Long saveToDraft(ProjectDraftSaveDTO dto) { | |||
Long userId = LoginUserUtil.getUserId(); | |||
UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); | |||
ProjectDTO projectInfo = dto.getProjectInfo(); | |||
ProjectDraft draft = new ProjectDraft(); | |||
BeanUtils.copyProperties(projectInfo, draft); | |||
draft.setUserId(dto.getUser().getUserId()); | |||
draft.setBuildOrgCode(userInfoDetails.getOrganizationCode()); | |||
draft.setAreaCode(userInfoDetails.getRegionCode()); | |||
if(CollUtil.isNotEmpty(projectInfo.getDynamicForm())){ | |||
draft.setDynamicForm(JSON.toJSONString(projectInfo.getDynamicForm())); | |||
} | |||
@@ -70,6 +70,9 @@ public class ProjectDraft implements Serializable { | |||
private String buildOrgName; | |||
@ApiModelProperty("建设单位统一社会信用代码") | |||
private String orgCreditCode; | |||
@ApiModelProperty("公司编码code") | |||
private String buildOrgCode; | |||
@ApiModelProperty("建设单位浙政钉ID") | |||
@@ -58,7 +58,10 @@ public class ProjectDeclaredDetailVO { | |||
private String buildUnitName; | |||
@ApiModelProperty("建设单位统一社会信用代码") | |||
private String buildUnitCode; | |||
private String orgCreditCode; | |||
@ApiModelProperty("公司编码code") | |||
private String buildOrgCode; | |||
@ApiModelProperty("建设单位浙政钉ID") | |||
private String buildUnitZheJiangGovernmentDingId; | |||
@@ -71,6 +71,9 @@ public class ProjectDraftVO implements Serializable { | |||
private String buildOrgName; | |||
@ApiModelProperty("建设单位统一社会信用代码") | |||
private String orgCreditCode; | |||
@ApiModelProperty("公司编码code") | |||
private String buildOrgCode; | |||
@ApiModelProperty("建设单位浙政钉ID") | |||
@@ -3,9 +3,9 @@ package com.ningdatech.pmapi.projectlib.controller; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; | |||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.AllArgsConstructor; | |||
@@ -1,52 +0,0 @@ | |||
package com.ningdatech.pmapi.projectlib.enumeration; | |||
import com.google.common.collect.Lists; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Getter; | |||
import lombok.NoArgsConstructor; | |||
import org.apache.commons.lang3.StringUtils; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Objects; | |||
@Getter | |||
@AllArgsConstructor | |||
@NoArgsConstructor | |||
/** | |||
* 环节状态枚举 | |||
* @author CMM | |||
* @since 2023/02/24 11:51 | |||
*/ | |||
public enum StepStatusEnum { | |||
/** | |||
* 环节状态 | |||
*/ | |||
NOT_START(1, "未开始"), | |||
ON_GOING(2, "进行中"), | |||
REJECTED(3,"被驳回"), | |||
COMPLETED(4,"已完成"); | |||
private Integer code; | |||
private String desc; | |||
public static String getDescByCode(Integer code) { | |||
if (Objects.isNull(code)) { | |||
return StringUtils.EMPTY; | |||
} | |||
for (StepStatusEnum t : StepStatusEnum.values()) { | |||
if (code.equals(t.getCode())) { | |||
return t.desc; | |||
} | |||
} | |||
return StringUtils.EMPTY; | |||
} | |||
public boolean eq(String val) { | |||
return this.name().equals(val); | |||
} | |||
public static boolean contains (StepStatusEnum e, List<StepStatusEnum> enums){ | |||
return enums.contains(e); | |||
} | |||
} |
@@ -1,6 +1,6 @@ | |||
package com.ningdatech.pmapi.projectlib.handle; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import java.util.List; | |||
@@ -10,12 +10,12 @@ import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import com.wflow.workflow.enums.StepStatusEnum; | |||
import org.springframework.core.annotation.Order; | |||
import org.springframework.stereotype.Component; | |||
import com.ningdatech.pmapi.common.constant.CommonConst; | |||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||
import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; | |||
@@ -4,15 +4,15 @@ package com.ningdatech.pmapi.projectlib.handle; | |||
import java.util.List; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import com.wflow.workflow.enums.StepStatusEnum; | |||
import org.springframework.core.annotation.Order; | |||
import org.springframework.stereotype.Component; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.pmapi.common.constant.CommonConst; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | |||
/** | |||
@@ -6,16 +6,17 @@ import java.util.Objects; | |||
import com.google.common.collect.Lists; | |||
import com.ningdatech.basic.util.NdDateUtils; | |||
import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; | |||
import com.wflow.workflow.bean.process.ProgressNode; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import com.wflow.workflow.enums.StepStatusEnum; | |||
import org.springframework.core.annotation.Order; | |||
import org.springframework.stereotype.Component; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.pmapi.common.constant.CommonConst; | |||
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | |||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | |||
import com.wflow.workflow.bean.vo.ProcessProgressVo; | |||
import com.wflow.workflow.enums.ProcessStatusEnum; | |||
@@ -33,10 +34,12 @@ public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle | |||
private final IProjectInstService projectInstService; | |||
private final ProcessInstanceService processInstanceService; | |||
private final BuildUserUtils buildUserUtils; | |||
public ConstructionPlanReviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService){ | |||
public ConstructionPlanReviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils){ | |||
this.projectInstService = projectInstService; | |||
this.processInstanceService = processInstanceService; | |||
this.buildUserUtils = buildUserUtils; | |||
} | |||
@Override | |||
@@ -66,11 +69,15 @@ public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle | |||
} else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { | |||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | |||
} | |||
// 装配节点审核人员信息 | |||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||
buildUserUtils.buildUserByProcessInfo(progressInfo); | |||
// 根据流程处理详情获取流程完成时间 | |||
if(StepStatusEnum.contains(processDetailVO.getStepStatus(), | |||
Lists.newArrayList(StepStatusEnum.REJECTED, | |||
StepStatusEnum.COMPLETED))){ | |||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||
ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); | |||
LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | |||
processDetailVO.setFinishTime(finishTime); | |||
@@ -6,16 +6,17 @@ import java.util.Objects; | |||
import com.google.common.collect.Lists; | |||
import com.ningdatech.basic.util.NdDateUtils; | |||
import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; | |||
import com.wflow.workflow.bean.process.ProgressNode; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import com.wflow.workflow.enums.StepStatusEnum; | |||
import org.springframework.core.annotation.Order; | |||
import org.springframework.stereotype.Component; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.pmapi.common.constant.CommonConst; | |||
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | |||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | |||
import com.wflow.workflow.bean.vo.ProcessProgressVo; | |||
import com.wflow.workflow.enums.ProcessStatusEnum; | |||
@@ -33,10 +34,12 @@ public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandle { | |||
private final IProjectInstService projectInstService; | |||
private final ProcessInstanceService processInstanceService; | |||
private final BuildUserUtils buildUserUtils; | |||
public DeptUnitedReviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService){ | |||
public DeptUnitedReviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils){ | |||
this.projectInstService = projectInstService; | |||
this.processInstanceService = processInstanceService; | |||
this.buildUserUtils = buildUserUtils; | |||
} | |||
@Override | |||
@@ -64,11 +67,13 @@ public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandle { | |||
} else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { | |||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | |||
} | |||
// 装配节点审核人员信息 | |||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||
buildUserUtils.buildUserByProcessInfo(progressInfo); | |||
// 根据流程处理详情获取流程完成时间 | |||
if(StepStatusEnum.contains(processDetailVO.getStepStatus(), | |||
Lists.newArrayList(StepStatusEnum.REJECTED, | |||
StepStatusEnum.COMPLETED))){ | |||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||
ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); | |||
LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | |||
processDetailVO.setFinishTime(finishTime); | |||
@@ -5,13 +5,14 @@ import com.google.common.collect.Lists; | |||
import com.ningdatech.basic.util.NdDateUtils; | |||
import com.ningdatech.pmapi.common.constant.CommonConst; | |||
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | |||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | |||
import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; | |||
import com.wflow.workflow.bean.process.ProgressNode; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import com.wflow.workflow.bean.vo.ProcessProgressVo; | |||
import com.wflow.workflow.enums.ProcessStatusEnum; | |||
import com.wflow.workflow.enums.StepStatusEnum; | |||
import com.wflow.workflow.service.ProcessInstanceService; | |||
import org.springframework.core.annotation.Order; | |||
import org.springframework.stereotype.Component; | |||
@@ -32,10 +33,12 @@ public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle { | |||
private final IProjectInstService projectInstService; | |||
private final ProcessInstanceService processInstanceService; | |||
private final BuildUserUtils buildUserUtils; | |||
public PreliminaryPreviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService) { | |||
public PreliminaryPreviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils) { | |||
this.projectInstService = projectInstService; | |||
this.processInstanceService = processInstanceService; | |||
this.buildUserUtils = buildUserUtils; | |||
} | |||
@Override | |||
@@ -63,11 +66,15 @@ public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle { | |||
} else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { | |||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | |||
} | |||
// 装配节点审核人员信息 | |||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||
buildUserUtils.buildUserByProcessInfo(progressInfo); | |||
// 根据流程处理详情获取流程完成时间 | |||
if(StepStatusEnum.contains(processDetailVO.getStepStatus(), | |||
Lists.newArrayList(StepStatusEnum.REJECTED, | |||
StepStatusEnum.COMPLETED))){ | |||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||
ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); | |||
LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | |||
processDetailVO.setFinishTime(finishTime); | |||
@@ -1,6 +1,6 @@ | |||
package com.ningdatech.pmapi.projectlib.handle; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import org.springframework.stereotype.Component; | |||
import java.util.Collections; | |||
@@ -6,6 +6,8 @@ import java.util.*; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import com.wflow.workflow.enums.StepStatusEnum; | |||
import org.springframework.core.annotation.Order; | |||
import org.springframework.stereotype.Component; | |||
@@ -13,10 +15,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.pmapi.common.constant.CommonConst; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
@@ -1,10 +1,10 @@ | |||
package com.ningdatech.pmapi.projectlib.handle; | |||
import com.ningdatech.pmapi.common.constant.CommonConst; | |||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import com.wflow.workflow.enums.StepStatusEnum; | |||
import org.springframework.core.annotation.Order; | |||
import org.springframework.stereotype.Component; | |||
@@ -8,16 +8,17 @@ import com.ningdatech.basic.util.NdDateUtils; | |||
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | |||
import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; | |||
import com.wflow.workflow.bean.process.ProgressNode; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import com.wflow.workflow.bean.vo.ProcessProgressVo; | |||
import com.wflow.workflow.enums.ProcessStatusEnum; | |||
import com.wflow.workflow.enums.StepStatusEnum; | |||
import com.wflow.workflow.service.ProcessInstanceService; | |||
import org.springframework.core.annotation.Order; | |||
import org.springframework.stereotype.Component; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.pmapi.common.constant.CommonConst; | |||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||
/** | |||
@@ -31,10 +32,12 @@ import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||
public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle { | |||
private final IProjectInstService projectInstService; | |||
private final ProcessInstanceService processInstanceService; | |||
private final BuildUserUtils buildUserUtils; | |||
public ProjectFinalInspectionHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService){ | |||
public ProjectFinalInspectionHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils){ | |||
this.projectInstService = projectInstService; | |||
this.processInstanceService = processInstanceService; | |||
this.buildUserUtils = buildUserUtils; | |||
} | |||
@Override | |||
@@ -66,11 +69,15 @@ public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle | |||
} else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { | |||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | |||
} | |||
// 装配节点审核人员信息 | |||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||
buildUserUtils.buildUserByProcessInfo(progressInfo); | |||
// 根据流程处理详情获取流程完成时间 | |||
if(StepStatusEnum.contains(processDetailVO.getStepStatus(), | |||
Lists.newArrayList(StepStatusEnum.REJECTED, | |||
StepStatusEnum.COMPLETED))){ | |||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||
ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); | |||
LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | |||
processDetailVO.setFinishTime(finishTime); | |||
@@ -5,6 +5,8 @@ import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import com.wflow.workflow.enums.StepStatusEnum; | |||
import org.springframework.core.annotation.Order; | |||
import org.springframework.stereotype.Component; | |||
@@ -13,10 +15,8 @@ import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.pmapi.common.constant.CommonConst; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
@@ -4,6 +4,8 @@ import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; | |||
import java.util.*; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import com.wflow.workflow.enums.StepStatusEnum; | |||
import org.springframework.core.annotation.Order; | |||
import org.springframework.stereotype.Component; | |||
@@ -12,10 +14,8 @@ import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.pmapi.common.constant.CommonConst; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectStatusChange; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
@@ -2,7 +2,9 @@ package com.ningdatech.pmapi.projectlib.handle; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
import java.util.Map; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.google.common.collect.Lists; | |||
import com.ningdatech.basic.util.NdDateUtils; | |||
@@ -11,11 +13,13 @@ import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | |||
import com.ningdatech.pmapi.common.constant.CommonConst; | |||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||
import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; | |||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | |||
import com.wflow.workflow.bean.process.ProgressNode; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import com.wflow.workflow.bean.vo.ProcessProgressVo; | |||
import com.wflow.workflow.enums.ProcessStatusEnum; | |||
import com.wflow.workflow.enums.StepStatusEnum; | |||
import com.wflow.workflow.service.ProcessInstanceService; | |||
import org.springframework.core.annotation.Order; | |||
import org.springframework.stereotype.Component; | |||
@@ -33,10 +37,12 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { | |||
private final IProjectInstService projectInstService; | |||
private final ProcessInstanceService processInstanceService; | |||
private final BuildUserUtils buildUserUtils; | |||
public UnitInnerAuditHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService){ | |||
public UnitInnerAuditHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService, BuildUserUtils buildUserUtils){ | |||
this.projectInstService = projectInstService; | |||
this.processInstanceService = processInstanceService; | |||
this.buildUserUtils = buildUserUtils; | |||
} | |||
@Override | |||
@@ -59,11 +65,15 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { | |||
} else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { | |||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | |||
} | |||
// 装配节点审核人员信息 | |||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||
buildUserUtils.buildUserByProcessInfo(progressInfo); | |||
// 根据流程处理详情获取流程完成时间 | |||
if(StepStatusEnum.contains(processDetailVO.getStepStatus(), | |||
Lists.newArrayList(StepStatusEnum.REJECTED, | |||
StepStatusEnum.COMPLETED))){ | |||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||
ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); | |||
LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | |||
processDetailVO.setFinishTime(finishTime); | |||
@@ -72,4 +82,13 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { | |||
processDetailVO.setProcessName(CommonConst.UNIT_INNER_AUDIT); | |||
processSchedule.add(processDetailVO); | |||
} | |||
private void buildUser(List<ProgressNode> progressInfo, Map<String, ProcessInstanceUserDto> userMap) { | |||
for (ProgressNode progressNode : progressInfo) { | |||
progressNode.setUser(userMap.get(progressNode.getUserId())); | |||
if (CollUtil.isNotEmpty(progressNode.getChildren())) { | |||
buildUser(progressNode.getChildren(), userMap); | |||
} | |||
} | |||
} | |||
} |
@@ -17,12 +17,12 @@ import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; | |||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | |||
import com.ningdatech.pmapi.projectlib.model.vo.AnnualAmountVO; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.stereotype.Component; | |||
@@ -28,6 +28,9 @@ public class ProjectDTO implements Serializable { | |||
@ApiModelProperty("主键") | |||
private Long id; | |||
@ApiModelProperty("如果是通过草稿箱提交的 要传下草稿id") | |||
private Long draftId; | |||
@ApiModelProperty("所属地区编号") | |||
private String areaCode; | |||
@@ -56,6 +59,9 @@ public class ProjectDTO implements Serializable { | |||
private String buildOrgName; | |||
@ApiModelProperty("建设单位统一社会信用代码") | |||
private String orgCreditCode; | |||
@ApiModelProperty("公司编码code") | |||
private String buildOrgCode; | |||
@ApiModelProperty("建设单位浙政钉ID") | |||
@@ -63,6 +63,9 @@ public class Project implements Serializable { | |||
private String buildOrgName; | |||
@ApiModelProperty("建设单位统一社会信用代码") | |||
private String orgCreditCode; | |||
@ApiModelProperty("公司编码code") | |||
private String buildOrgCode; | |||
@ApiModelProperty("建设单位浙政钉ID") | |||
@@ -1,40 +0,0 @@ | |||
package com.ningdatech.pmapi.projectlib.model.vo; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | |||
import com.wflow.workflow.bean.vo.ProcessProgressVo; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
/** | |||
* 流程进度详情VO | |||
* | |||
* @author CMM | |||
* @since 2023/02/24 11:25 | |||
*/ | |||
@ApiModel(value = "ProcessDetailVO", description = "流程进度详情VO") | |||
@Data | |||
public class ProcessDetailVO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty("环节状态") | |||
private StepStatusEnum stepStatus; | |||
@ApiModelProperty("流程名称") | |||
private String processName; | |||
@ApiModelProperty("完成时间") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm") | |||
private LocalDateTime finishTime; | |||
@ApiModelProperty("流程处理进度详情") | |||
private ProcessProgressVo processProgressVo; | |||
} |
@@ -64,6 +64,9 @@ public class ProjectDetailVO { | |||
private String buildOrgName; | |||
@ApiModelProperty("建设单位统一社会信用代码") | |||
private String orgCreditCode; | |||
@ApiModelProperty("公司编码code") | |||
private String buildOrgCode; | |||
@ApiModelProperty("建设单位浙政钉ID") | |||
@@ -1,6 +1,5 @@ | |||
package com.ningdatech.pmapi.staging.enums; | |||
import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Getter; | |||
import lombok.NoArgsConstructor; | |||
@@ -9,6 +9,7 @@ import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.pmapi.common.constant.CommonConst; | |||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||
import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | |||
@@ -38,7 +39,9 @@ import com.ningdatech.pmapi.todocenter.model.req.ProcessDetailReq; | |||
import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedExportReq; | |||
import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedReq; | |||
import com.ningdatech.pmapi.todocenter.model.vo.ResToBeProcessedVO; | |||
import com.ningdatech.pmapi.todocenter.utils.BuildUserUtils; | |||
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.util.LoginUserUtil; | |||
import com.wflow.contants.HisProInsEndActId; | |||
@@ -97,6 +100,8 @@ public class TodoCenterManage { | |||
private final INdWorkNoticeStagingService workNoticeStagingService; | |||
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | |||
private final IProjectApplicationService projectApplicationService; | |||
private final UserInfoHelper userInfoHelper; | |||
private final BuildUserUtils buildUserUtils; | |||
/** | |||
@@ -363,14 +368,27 @@ public class TodoCenterManage { | |||
} else { | |||
// 当前登录用户不是流程发起人 | |||
List<ProgressNode> currentProgressInfo = currentInstanceDetail.getProgressInfo(); | |||
ProgressNode progressNode = currentProgressInfo.get(currentProgressInfo.size() - 1); | |||
ProgressNode beforeProgressNode; | |||
ProgressNode currentProgressNode; | |||
// 说明当前节点是子流程节点 | |||
if (progressNode.getNodeType().name().equals(NodeTypeEnum.SUB.name())) { | |||
List<ProgressNode> children = progressNode.getChildren(); | |||
beforeProgressNode = children.get(children.size() - 2); | |||
currentProgressNode = children.get(children.size() - 1); | |||
} else { | |||
beforeProgressNode = currentProgressInfo.get(currentProgressInfo.size() - 2); | |||
currentProgressNode = currentProgressInfo.get(currentProgressInfo.size() - 1); | |||
} | |||
// 获取当前工作流任务前一个审核人信息 | |||
ProgressNode beforeProgressNode = currentProgressInfo.get(currentProgressInfo.size() - 2); | |||
ProcessInstanceUserDto beforeUser = beforeProgressNode.getUser(); | |||
UserFullInfoDTO beforeUserInfo = userInfoHelper.getUserFullInfo(Long.valueOf(beforeUser.getUserId())); | |||
// 获取当前当前工作流任务当前审核人信息 | |||
ProgressNode currentProgressNode = currentProgressInfo.get(currentProgressInfo.size() - 1); | |||
ProcessInstanceUserDto currentUser = currentProgressNode.getUser(); | |||
UserFullInfoDTO currentUserInfo = userInfoHelper.getUserFullInfo(Long.valueOf(currentUser.getUserId())); | |||
// 判断当前工作流任务前一个审核人的部门和当前登录用户的部门是否是同一个,如果是同一个才可以撤回,否则抛出异常 | |||
boolean orgFlag = currentUser.getOrgCode().equals(beforeUser.getOrgCode()); | |||
boolean orgFlag = currentUserInfo.getOrganizationCode().equals(beforeUserInfo.getOrganizationCode()); | |||
boolean userFlag = beforeUser.getUserId().equals(String.valueOf(userId)); | |||
if (!orgFlag) { | |||
throw new BizException("下一个审核人和您不是同一个部门,无法撤回!"); | |||
@@ -573,21 +591,10 @@ public class TodoCenterManage { | |||
ProcessProgressVo progressInstanceDetail = processInstanceService.getProgressInstanceDetail(nodeId, instanceId); | |||
List<ProgressNode> progressInfo = progressInstanceDetail.getProgressInfo(); | |||
buildUserUtils.buildUserByProcessInfo(progressInfo); | |||
Set<String> userSet = Sets.newHashSet(); | |||
progressInfo.forEach(node -> { | |||
if (CollUtil.isNotEmpty(node.getChildren())) { | |||
for (ProgressNode innerNode : node.getChildren()) { | |||
userSet.add(innerNode.getUserId()); | |||
} | |||
} else { | |||
userSet.add(node.getUserId()); | |||
} | |||
}); | |||
Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(userSet); | |||
// 装配节点审核人员信息 | |||
buildUser(progressInfo, userMap); | |||
//// 装配节点审核人员信息 | |||
//buildUser(progressInfo, userMap); | |||
ProcessProgressDetailVo res = new ProcessProgressDetailVo(); | |||
res.setProcessProgressVo(progressInstanceDetail); | |||
@@ -596,14 +603,6 @@ public class TodoCenterManage { | |||
return res; | |||
} | |||
private void buildUser(List<ProgressNode> progressInfo, Map<String, ProcessInstanceUserDto> userMap) { | |||
for (ProgressNode progressNode : progressInfo) { | |||
progressNode.setUser(userMap.get(progressNode.getUserId())); | |||
if (CollUtil.isNotEmpty(progressNode.getChildren())) { | |||
buildUser(progressNode.getChildren(), userMap); | |||
} | |||
} | |||
} | |||
/** | |||
* 待办中心我已处理项目列表查询 | |||
@@ -39,13 +39,13 @@ public class ResToBeProcessedVO implements Serializable { | |||
private String projectName; | |||
@ApiModelProperty("建设单位名称") | |||
private String buildOrgName; | |||
private String buildOrg; | |||
@ApiModelProperty("建设单位统一社会信用代码") | |||
private String buildOrgCode; | |||
@ApiModelProperty("申报金额") | |||
private BigDecimal declareAmount; | |||
private BigDecimal declaredAmount; | |||
@ApiModelProperty("预算年度") | |||
private Integer projectYear; | |||
@@ -0,0 +1,53 @@ | |||
package com.ningdatech.pmapi.todocenter.utils; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.google.common.collect.Sets; | |||
import com.ningdatech.pmapi.user.service.IUserInfoService; | |||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | |||
import com.wflow.workflow.bean.process.ProgressNode; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Component; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Set; | |||
/** | |||
* 装配节点用户信息工具类 | |||
* | |||
* @author CMM | |||
* @since 2023/03/08 11:52 | |||
*/ | |||
@Slf4j | |||
@RequiredArgsConstructor | |||
@Component | |||
public class BuildUserUtils { | |||
private final IUserInfoService userInfoService; | |||
public void buildUserByProcessInfo(List<ProgressNode> progressInfo) { | |||
Set<String> userSet = Sets.newHashSet(); | |||
progressInfo.forEach(node -> { | |||
if (CollUtil.isNotEmpty(node.getChildren())) { | |||
for (ProgressNode innerNode : node.getChildren()) { | |||
userSet.add(innerNode.getUserId()); | |||
} | |||
} else { | |||
userSet.add(node.getUserId()); | |||
} | |||
}); | |||
Map<String, ProcessInstanceUserDto> userMap = userInfoService.getUserMapByIds(userSet); | |||
buildUser(progressInfo,userMap); | |||
} | |||
private void buildUser(List<ProgressNode> progressInfo, Map<String, ProcessInstanceUserDto> userMap) { | |||
for (ProgressNode progressNode : progressInfo) { | |||
progressNode.setUser(userMap.get(progressNode.getUserId())); | |||
if (CollUtil.isNotEmpty(progressNode.getChildren())) { | |||
buildUser(progressNode.getChildren(), userMap); | |||
} | |||
} | |||
} | |||
} |