@@ -6,6 +6,7 @@ import java.util.Objects; | |||||
import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
import com.ningdatech.basic.util.NdDateUtils; | 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.process.ProgressNode; | ||||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | import com.wflow.workflow.bean.vo.ProcessDetailVO; | ||||
import com.wflow.workflow.enums.StepStatusEnum; | import com.wflow.workflow.enums.StepStatusEnum; | ||||
@@ -33,10 +34,12 @@ public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle | |||||
private final IProjectInstService projectInstService; | private final IProjectInstService projectInstService; | ||||
private final ProcessInstanceService processInstanceService; | 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.projectInstService = projectInstService; | ||||
this.processInstanceService = processInstanceService; | this.processInstanceService = processInstanceService; | ||||
this.buildUserUtils = buildUserUtils; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -66,11 +69,15 @@ public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle | |||||
} else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { | } else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { | ||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | ||||
} | } | ||||
// 装配节点审核人员信息 | |||||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||||
buildUserUtils.buildUserByProcessInfo(progressInfo); | |||||
// 根据流程处理详情获取流程完成时间 | // 根据流程处理详情获取流程完成时间 | ||||
if(StepStatusEnum.contains(processDetailVO.getStepStatus(), | if(StepStatusEnum.contains(processDetailVO.getStepStatus(), | ||||
Lists.newArrayList(StepStatusEnum.REJECTED, | Lists.newArrayList(StepStatusEnum.REJECTED, | ||||
StepStatusEnum.COMPLETED))){ | StepStatusEnum.COMPLETED))){ | ||||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||||
ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); | ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); | ||||
LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | ||||
processDetailVO.setFinishTime(finishTime); | processDetailVO.setFinishTime(finishTime); | ||||
@@ -6,6 +6,7 @@ import java.util.Objects; | |||||
import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
import com.ningdatech.basic.util.NdDateUtils; | 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.process.ProgressNode; | ||||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | import com.wflow.workflow.bean.vo.ProcessDetailVO; | ||||
import com.wflow.workflow.enums.StepStatusEnum; | import com.wflow.workflow.enums.StepStatusEnum; | ||||
@@ -33,10 +34,12 @@ public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandle { | |||||
private final IProjectInstService projectInstService; | private final IProjectInstService projectInstService; | ||||
private final ProcessInstanceService processInstanceService; | 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.projectInstService = projectInstService; | ||||
this.processInstanceService = processInstanceService; | this.processInstanceService = processInstanceService; | ||||
this.buildUserUtils = buildUserUtils; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -64,11 +67,13 @@ public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandle { | |||||
} else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { | } else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { | ||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | ||||
} | } | ||||
// 装配节点审核人员信息 | |||||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||||
buildUserUtils.buildUserByProcessInfo(progressInfo); | |||||
// 根据流程处理详情获取流程完成时间 | // 根据流程处理详情获取流程完成时间 | ||||
if(StepStatusEnum.contains(processDetailVO.getStepStatus(), | if(StepStatusEnum.contains(processDetailVO.getStepStatus(), | ||||
Lists.newArrayList(StepStatusEnum.REJECTED, | Lists.newArrayList(StepStatusEnum.REJECTED, | ||||
StepStatusEnum.COMPLETED))){ | StepStatusEnum.COMPLETED))){ | ||||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||||
ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); | ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); | ||||
LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | ||||
processDetailVO.setFinishTime(finishTime); | processDetailVO.setFinishTime(finishTime); | ||||
@@ -7,6 +7,7 @@ import com.ningdatech.pmapi.common.constant.CommonConst; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | ||||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | 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.process.ProgressNode; | ||||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | import com.wflow.workflow.bean.vo.ProcessDetailVO; | ||||
import com.wflow.workflow.bean.vo.ProcessProgressVo; | import com.wflow.workflow.bean.vo.ProcessProgressVo; | ||||
@@ -32,10 +33,12 @@ public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle { | |||||
private final IProjectInstService projectInstService; | private final IProjectInstService projectInstService; | ||||
private final ProcessInstanceService processInstanceService; | 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.projectInstService = projectInstService; | ||||
this.processInstanceService = processInstanceService; | this.processInstanceService = processInstanceService; | ||||
this.buildUserUtils = buildUserUtils; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -63,11 +66,15 @@ public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle { | |||||
} else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { | } else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { | ||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | ||||
} | } | ||||
// 装配节点审核人员信息 | |||||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||||
buildUserUtils.buildUserByProcessInfo(progressInfo); | |||||
// 根据流程处理详情获取流程完成时间 | // 根据流程处理详情获取流程完成时间 | ||||
if(StepStatusEnum.contains(processDetailVO.getStepStatus(), | if(StepStatusEnum.contains(processDetailVO.getStepStatus(), | ||||
Lists.newArrayList(StepStatusEnum.REJECTED, | Lists.newArrayList(StepStatusEnum.REJECTED, | ||||
StepStatusEnum.COMPLETED))){ | StepStatusEnum.COMPLETED))){ | ||||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||||
ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); | ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); | ||||
LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | ||||
processDetailVO.setFinishTime(finishTime); | processDetailVO.setFinishTime(finishTime); | ||||
@@ -8,6 +8,7 @@ import com.ningdatech.basic.util.NdDateUtils; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | ||||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | 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.process.ProgressNode; | ||||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | import com.wflow.workflow.bean.vo.ProcessDetailVO; | ||||
import com.wflow.workflow.bean.vo.ProcessProgressVo; | import com.wflow.workflow.bean.vo.ProcessProgressVo; | ||||
@@ -31,10 +32,12 @@ import com.ningdatech.pmapi.common.constant.CommonConst; | |||||
public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle { | public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle { | ||||
private final IProjectInstService projectInstService; | private final IProjectInstService projectInstService; | ||||
private final ProcessInstanceService processInstanceService; | 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.projectInstService = projectInstService; | ||||
this.processInstanceService = processInstanceService; | this.processInstanceService = processInstanceService; | ||||
this.buildUserUtils = buildUserUtils; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -66,11 +69,15 @@ public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle | |||||
} else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { | } else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { | ||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | ||||
} | } | ||||
// 装配节点审核人员信息 | |||||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||||
buildUserUtils.buildUserByProcessInfo(progressInfo); | |||||
// 根据流程处理详情获取流程完成时间 | // 根据流程处理详情获取流程完成时间 | ||||
if(StepStatusEnum.contains(processDetailVO.getStepStatus(), | if(StepStatusEnum.contains(processDetailVO.getStepStatus(), | ||||
Lists.newArrayList(StepStatusEnum.REJECTED, | Lists.newArrayList(StepStatusEnum.REJECTED, | ||||
StepStatusEnum.COMPLETED))){ | StepStatusEnum.COMPLETED))){ | ||||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||||
ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); | ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); | ||||
LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | ||||
processDetailVO.setFinishTime(finishTime); | processDetailVO.setFinishTime(finishTime); | ||||
@@ -2,7 +2,9 @@ package com.ningdatech.pmapi.projectlib.handle; | |||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | |||||
import cn.hutool.core.collection.CollUtil; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
import com.ningdatech.basic.util.NdDateUtils; | import com.ningdatech.basic.util.NdDateUtils; | ||||
@@ -11,6 +13,8 @@ import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | ||||
import com.ningdatech.pmapi.common.constant.CommonConst; | import com.ningdatech.pmapi.common.constant.CommonConst; | ||||
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.process.ProgressNode; | ||||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | import com.wflow.workflow.bean.vo.ProcessDetailVO; | ||||
import com.wflow.workflow.bean.vo.ProcessProgressVo; | import com.wflow.workflow.bean.vo.ProcessProgressVo; | ||||
@@ -33,10 +37,12 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { | |||||
private final IProjectInstService projectInstService; | private final IProjectInstService projectInstService; | ||||
private final ProcessInstanceService processInstanceService; | 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.projectInstService = projectInstService; | ||||
this.processInstanceService = processInstanceService; | this.processInstanceService = processInstanceService; | ||||
this.buildUserUtils = buildUserUtils; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -59,11 +65,15 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { | |||||
} else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { | } else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { | ||||
processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); | ||||
} | } | ||||
// 装配节点审核人员信息 | |||||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||||
buildUserUtils.buildUserByProcessInfo(progressInfo); | |||||
// 根据流程处理详情获取流程完成时间 | // 根据流程处理详情获取流程完成时间 | ||||
if(StepStatusEnum.contains(processDetailVO.getStepStatus(), | if(StepStatusEnum.contains(processDetailVO.getStepStatus(), | ||||
Lists.newArrayList(StepStatusEnum.REJECTED, | Lists.newArrayList(StepStatusEnum.REJECTED, | ||||
StepStatusEnum.COMPLETED))){ | StepStatusEnum.COMPLETED))){ | ||||
List<ProgressNode> progressInfo = instanceDetail.getProgressInfo(); | |||||
ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); | ProgressNode progressNode = progressInfo.get(progressInfo.size() - 1); | ||||
LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | LocalDateTime finishTime = NdDateUtils.date2LocalDateTime(progressNode.getFinishTime()); | ||||
processDetailVO.setFinishTime(finishTime); | processDetailVO.setFinishTime(finishTime); | ||||
@@ -72,4 +82,13 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { | |||||
processDetailVO.setProcessName(CommonConst.UNIT_INNER_AUDIT); | processDetailVO.setProcessName(CommonConst.UNIT_INNER_AUDIT); | ||||
processSchedule.add(processDetailVO); | 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); | |||||
} | |||||
} | |||||
} | |||||
} | } |
@@ -39,6 +39,7 @@ import com.ningdatech.pmapi.todocenter.model.req.ProcessDetailReq; | |||||
import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedExportReq; | import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedExportReq; | ||||
import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedReq; | import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedReq; | ||||
import com.ningdatech.pmapi.todocenter.model.vo.ResToBeProcessedVO; | 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.entity.UserInfo; | ||||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | ||||
import com.ningdatech.pmapi.user.service.IUserInfoService; | import com.ningdatech.pmapi.user.service.IUserInfoService; | ||||
@@ -100,6 +101,7 @@ public class TodoCenterManage { | |||||
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | ||||
private final IProjectApplicationService projectApplicationService; | private final IProjectApplicationService projectApplicationService; | ||||
private final UserInfoHelper userInfoHelper; | private final UserInfoHelper userInfoHelper; | ||||
private final BuildUserUtils buildUserUtils; | |||||
/** | /** | ||||
@@ -589,21 +591,10 @@ public class TodoCenterManage { | |||||
ProcessProgressVo progressInstanceDetail = processInstanceService.getProgressInstanceDetail(nodeId, instanceId); | ProcessProgressVo progressInstanceDetail = processInstanceService.getProgressInstanceDetail(nodeId, instanceId); | ||||
List<ProgressNode> progressInfo = progressInstanceDetail.getProgressInfo(); | 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(); | ProcessProgressDetailVo res = new ProcessProgressDetailVo(); | ||||
res.setProcessProgressVo(progressInstanceDetail); | res.setProcessProgressVo(progressInstanceDetail); | ||||
@@ -612,14 +603,6 @@ public class TodoCenterManage { | |||||
return res; | 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; | private String projectName; | ||||
@ApiModelProperty("建设单位名称") | @ApiModelProperty("建设单位名称") | ||||
private String buildOrgName; | |||||
private String buildOrg; | |||||
@ApiModelProperty("建设单位统一社会信用代码") | @ApiModelProperty("建设单位统一社会信用代码") | ||||
private String buildOrgCode; | private String buildOrgCode; | ||||
@ApiModelProperty("申报金额") | @ApiModelProperty("申报金额") | ||||
private BigDecimal declareAmount; | |||||
private BigDecimal declaredAmount; | |||||
@ApiModelProperty("预算年度") | @ApiModelProperty("预算年度") | ||||
private Integer projectYear; | 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); | |||||
} | |||||
} | |||||
} | |||||
} |