Bladeren bron

待办中心待我处理/我已处理/我发起的

tags/24080901
CMM 1 jaar geleden
bovenliggende
commit
754f533a1c
12 gewijzigde bestanden met toevoegingen van 387 en 145 verwijderingen
  1. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java
  2. +12
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/vo/ProcessProgressDetailVo.java
  3. +26
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java
  4. +5
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enums/ProcessStatusEnum.java
  5. +247
    -126
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  6. +6
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqToBeProcessedDTO.java
  7. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/res/ResHandledExportDTO.java
  8. +6
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/res/ResMySubmittedExportDTO.java
  9. +42
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/res/ResToBeExportDTO.java
  10. +19
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/res/ResToBeProcessedDTO.java
  11. +4
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java
  12. +16
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java Bestand weergeven

@@ -292,6 +292,9 @@ public class Project implements Serializable {
@ApiModelProperty("单位code")
private String orgCode;

@ApiModelProperty("流程状态")
private Integer processStatus;

private Long createBy;
private Long updateBy;



+ 12
- 2
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/bean/vo/ProcessProgressDetailVo.java Bestand weergeven

@@ -1,7 +1,9 @@
package com.ningdatech.pmapi.todocenter.bean.vo;

import com.ningdatech.pmapi.common.model.FileBasicInfo;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.todocenter.bean.entity.ProgressNode;
import com.ningdatech.pmapi.user.entity.UserInfo;
import com.wflow.workflow.bean.process.OrgUser;
import com.wflow.workflow.bean.process.form.Form;
import lombok.AllArgsConstructor;
@@ -60,13 +62,21 @@ public class ProcessProgressDetailVo {
/**
* 发起人
*/
private OrgUser staterUser;
private OrgUser startTempUser;
/**
* 发起人
*/
private UserInfo startUser;
/**
* 发起人部门
*/
private String starterDept;
private String startDept;
/**
* 发起时间
*/
private Date startTime;
/**
* 项目申报信息
*/
private Project declaredProjectInfo;
}

+ 26
- 1
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java Bestand weergeven

@@ -65,7 +65,7 @@ public class TodoCenterController {
* @param nodeId 当前获取流程人员关联的流程节点ID
* @return 流程进度及表单详情
*/
@GetMapping("progress/{instanceId}/{nodeId}")
@GetMapping("/progress/{instanceId}/{nodeId}")
public ApiResponse<ProcessProgressDetailVo> getProcessDetail(@PathVariable String instanceId,
@PathVariable(required = false) String nodeId) {
return ApiResponse.ofSuccess(todoCenterManage.getProcessDetail(nodeId, instanceId));
@@ -103,4 +103,29 @@ public class TodoCenterController {
public void exportHandledProjectList(ReqToBeProcessedDTO param, HttpServletResponse response){
ExcelDownUtil.downXlsx(response,param,todoCenterManage::exportHandledProjectList);
}

/**
* 待办中心-我发起的项目列表查询
* @param param
* @return
*/
@GetMapping("/query-mySubmitted-list")
public ApiResponse<PageVo<ResToBeProcessedDTO>> queryMySubmittedProjectList(@Valid @ModelAttribute ReqToBeProcessedDTO param){
PageVo<ResToBeProcessedDTO> result = todoCenterManage.queryMySubmittedProjectList(param);
return ApiResponse.ofSuccess(result);
}

/**
* 待办中心-我发起的项目列表导出
*
* @param param
* @param response
* @return void
*/
@GetMapping("/exportMySubmitted")
public void exportMySubmittedProjectList(ReqToBeProcessedDTO param, HttpServletResponse response){
ExcelDownUtil.downXlsx(response,param,todoCenterManage::exportMySubmittedProjectList);
}


}

+ 5
- 1
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/enums/ProcessStatusEnum.java Bestand weergeven

@@ -37,7 +37,11 @@ public enum ProcessStatusEnum {
/**
* 审核通过
*/
APPROVED(4,"审核通过");
APPROVED(4,"审核通过"),
/**
* 被撤回
*/
WITHDRAW(5,"被撤回");


private Integer code;


+ 247
- 126
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java Bestand weergeven

@@ -22,34 +22,35 @@ import com.ningdatech.pmapi.common.constant.DingConstant;
import com.ningdatech.pmapi.common.constant.ProjectDeclareConstants;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.common.util.ExcelExportStyle;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.todocenter.bean.entity.ProcessComment;
import com.ningdatech.pmapi.todocenter.bean.entity.ProgressNode;
import com.ningdatech.pmapi.todocenter.bean.vo.ProcessProgressDetailVo;
import com.ningdatech.pmapi.todocenter.constant.HisProInsEndActId;
import com.ningdatech.pmapi.todocenter.enums.IsAppendProjectEnum;
import com.ningdatech.pmapi.todocenter.enums.ProcessHandlerEnum;
import com.ningdatech.pmapi.todocenter.enums.ProcessStatusEnum;
import com.ningdatech.pmapi.todocenter.extension.cmd.BackToHisApprovalNodeCmd;
import com.ningdatech.pmapi.todocenter.model.dto.req.ReqProcessHandlerDTO;
import com.ningdatech.pmapi.todocenter.model.dto.req.ReqToBeProcessedDTO;
import com.ningdatech.pmapi.todocenter.model.dto.res.ResHandledProjectListExportDTO;
import com.ningdatech.pmapi.todocenter.model.dto.res.ResHandledExportDTO;
import com.ningdatech.pmapi.todocenter.model.dto.res.ResMySubmittedExportDTO;
import com.ningdatech.pmapi.todocenter.model.dto.res.ResToBeProcessedDTO;
import com.ningdatech.pmapi.todocenter.model.dto.res.ResToBeProjectListExportDTO;
import com.ningdatech.pmapi.todocenter.model.dto.res.ResToBeExportDTO;
import com.ningdatech.pmapi.todocenter.zwdd.model.MessageContent;
import com.ningdatech.pmapi.todocenter.zwdd.model.MessageText;
import com.ningdatech.pmapi.user.entity.UserInfo;
import com.ningdatech.pmapi.user.service.IUserInfoService;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import com.wflow.bean.do_.UserDo;
import com.wflow.bean.entity.NdDeclaredProject;
import com.wflow.bean.entity.WflowCcTasks;
import com.wflow.bean.entity.WflowModelHistorys;
import com.wflow.bean.entity.WflowModels;
import com.wflow.exception.BusinessException;
import com.wflow.mapper.WflowCcTasksMapper;
import com.wflow.mapper.WflowModelHistorysMapper;
import com.wflow.service.NdDeclaredProjectService;
import com.wflow.service.OrgRepositoryService;
import com.wflow.utils.UserUtil;
import com.wflow.workflow.bean.dto.ProcessInstanceOwnerDto;
import com.wflow.workflow.bean.process.OrgUser;
import com.wflow.workflow.bean.process.ProcessNode;
@@ -58,25 +59,26 @@ import com.wflow.workflow.bean.process.enums.NodeTypeEnum;
import com.wflow.workflow.bean.process.form.Form;
import com.wflow.workflow.bean.process.props.ApprovalProps;
import com.wflow.workflow.bean.vo.ProcessHandlerParamsVo;
import com.wflow.workflow.bean.vo.ProcessInstanceVo;
import com.wflow.workflow.bean.vo.ProcessProgressVo;
import com.wflow.workflow.bean.vo.ProcessTaskVo;
import com.wflow.workflow.config.WflowGlobalVarDef;
import com.wflow.workflow.service.FormService;
import com.wflow.workflow.service.*;
import com.wflow.workflow.utils.Executor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.assertj.core.util.Maps;
import org.flowable.bpmn.model.*;
import org.flowable.bpmn.model.Process;
import org.flowable.engine.*;
import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.history.HistoricProcessInstanceQuery;
import org.flowable.engine.impl.util.ProcessDefinitionUtil;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.engine.runtime.Execution;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.api.Task;
import org.flowable.task.api.TaskInfo;
import org.flowable.task.api.TaskQuery;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.flowable.task.service.history.NativeHistoricTaskInstanceQuery;
@@ -87,6 +89,8 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;

@@ -117,7 +121,7 @@ public class TodoCenterManage {
private final ProcessModelService processModelService;
private final IUserInfoService userInfoService;

private final NdDeclaredProjectService declaredProjectService;
private final IProjectService projectService;
@Resource(name = "executableClient")
private ExecutableClient client;
/**
@@ -130,17 +134,15 @@ public class TodoCenterManage {
public PageVo<ResToBeProcessedDTO> queryPendingProjectList(ReqToBeProcessedDTO param) {
// 获取登录用户ID
// long userId = LoginUserUtil.getUserId();
int userId = 381496;
// 获取入参分页信息
Integer pageSize = param.getPageSize();
Integer pageNumber = param.getPageNumber();

Long userId = 381496L;

TaskQuery taskQuery = taskService.createTaskQuery();
taskQuery.active().taskCandidateOrAssigned(String.valueOf(userId)).orderByTaskCreateTime().desc();

List<Task> taskList = taskQuery.list();
Set<String> staterUsers = new HashSet<>();
Page<NdDeclaredProject> page = param.page();
Page<Project> page = param.page();

// 将待办任务流程实例一次性取出来,减少查询次数
Map<String, HistoricProcessInstance> instanceMap = CollectionUtil.isNotEmpty(taskList) ?
@@ -149,27 +151,29 @@ public class TodoCenterManage {
.list().stream().collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) : new HashMap<>();
List<String> processInsIds = taskList.stream().map(Task::getProcessInstanceId).collect(Collectors.toList());

LambdaQueryWrapper<NdDeclaredProject> wrapper = Wrappers.lambdaQuery(NdDeclaredProject.class);
wrapper.like(StrUtil.isNotBlank(param.getProjectName()),NdDeclaredProject::getProjectName,param.getProjectName())
.like(StrUtil.isNotBlank(param.getOrgName()),NdDeclaredProject::getOrgName,param.getOrgName())
.eq(Objects.nonNull(param.getProjectYear()),NdDeclaredProject::getProjectYear,param.getProjectYear())
.ge(Objects.nonNull(param.getProcessLaunchStartTime()),NdDeclaredProject::getCreateOn,param.getProcessLaunchStartTime())
.le(Objects.nonNull(param.getProcessLaunchEndTime()),NdDeclaredProject::getCreateOn,param.getProcessLaunchEndTime());
declaredProjectService.page(page,wrapper);
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class);
wrapper.like(StrUtil.isNotBlank(param.getProjectName()),Project::getProjectName,param.getProjectName())
.like(StrUtil.isNotBlank(param.getBuildUnitName()),Project::getBuildUnitName,param.getBuildUnitName())
.eq(Objects.nonNull(param.getProjectYear()),Project::getProjectYear,param.getProjectYear())
.eq(Objects.nonNull(param.getIsSupplement()),Project::getIsTemporaryAugment,param.getIsSupplement())
.ge(Objects.nonNull(param.getProcessLaunchStartTime()),Project::getBeginTime,param.getProcessLaunchStartTime())
.le(Objects.nonNull(param.getProcessLaunchEndTime()),Project::getEndTime,param.getProcessLaunchEndTime());
projectService.page(page,wrapper);

List<ResToBeProcessedDTO> resVos = page.getRecords().stream().filter(d -> processInsIds.contains(d.getProcInsId())).map(d -> {
List<ResToBeProcessedDTO> resVos = page.getRecords().stream().filter(d -> processInsIds.contains(d.getInstCode())).map(d -> {

ResToBeProcessedDTO res = new ResToBeProcessedDTO();
BeanUtils.copyProperties(d, res);
res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus()));
res.setProcessLaunchTime(d.getCreateOn());
LocalDateTime processLaunchTime = d.getCreateOn();
String format = NdDateUtils.format(processLaunchTime, "yyyy-MM-dd HH:mm");
LocalDateTime launchTime = LocalDateTime.parse(format, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
res.setProcessLaunchTime(launchTime);

HistoricTaskInstance task = historyService.createHistoricTaskInstanceQuery().processInstanceId(d.getProcInsId()).singleResult();
HistoricTaskInstance task = historyService.createHistoricTaskInstanceQuery().processInstanceId(d.getInstCode()).singleResult();
HistoricProcessInstance instance = instanceMap.get(task.getProcessInstanceId());
HistoricVariableInstance variableInstance = historyService.createHistoricVariableInstanceQuery()
.processInstanceId(instance.getId()).variableName("approve_" + task.getId()).singleResult();
//从缓存取
staterUsers.add(instance.getStartUserId());
staterUsers.add(String.valueOf(userId));
ProcessTaskVo processTaskVo = ProcessTaskVo.builder()
.taskId(task.getId())
.taskName(task.getName())
@@ -184,9 +188,6 @@ public class TodoCenterManage {
.ownerId(instance.getStartUserId())
.createTime(instance.getStartTime())
.taskCreateTime(task.getCreateTime())
.taskEndTime(task.getEndTime())
.taskResult(String.valueOf(Objects.nonNull(variableInstance) ?
variableInstance.getValue() : ProcessHandlerParamsVo.Action.recall))
.build();
res.setProcessTaskInfo(processTaskVo);
return res;
@@ -195,70 +196,13 @@ public class TodoCenterManage {
List<ResToBeProcessedDTO> result = null;
if (CollectionUtil.isNotEmpty(staterUsers)) {
Map<String, OrgUser> userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers);
result = resVos.stream().peek(v -> v.getProcessTaskInfo()
.setOwner(userMap.get(v.getProcessTaskInfo().getOwnerId())))
.collect(Collectors.toList());
result = resVos.stream().peek(v -> v.getProcessTaskInfo().setOwner(userMap.get(v.getProcessTaskInfo().getOwnerId())))
.collect(Collectors.toList());
// Map<Long,UserInfo> userMap = userInfoService.getUserMapByIds(staterUsers);
// result = resVos.stream().peek(v -> v.setOwner(userMap.get(userId)))
// .collect(Collectors.toList());
}
return PageVo.of(result,page.getTotal());

//List<ResToBeProcessedDTO> resVos = taskList.stream().map(task -> {
// String nodeId = task.getTaskDefinitionKey();
// String instanceId = task.getProcessInstanceId();
//
// ProcessProgressVo instanceProgress = processService.getInstanceProgress(nodeId, instanceId);
// Map<String, Object> formData = instanceProgress.getFormData();
// String status = instanceProgress.getStatus();
// Boolean temporarySupplement = (Boolean) formData.get(ProjectDeclareConstants.BasicInformation.TEMPORARY_SUPPLEMENT);
// ResToBeProcessedDTO res = new ResToBeProcessedDTO();
// temporarySupplement = true;
// if (temporarySupplement.equals(param.getIsSupplement())) {
// ProcessDefinition processDef = repositoryService.createProcessDefinitionQuery()
// .processDefinitionId(task.getProcessDefinitionId())
// .singleResult();
// //从缓存取
// ProcessInstanceOwnerDto owner = runtimeService.getVariable(task.getExecutionId(), "owner", ProcessInstanceOwnerDto.class);
// ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult();
// staterUsers.add(owner.getOwner());
// ProcessTaskVo processTaskVo = ProcessTaskVo.builder()
// .taskId(task.getId())
// .taskName(task.getName())
// .taskDefKey(task.getTaskDefinitionKey())
// .processDefId(task.getProcessDefinitionId())
// .executionId(task.getExecutionId())
// .nodeId(nodeId)
// .deployId(processDef.getDeploymentId())
// .processDefName(processDef.getName())
// .version(processDef.getVersion())
// .instanceId(instanceId)
// .ownerId(processInstance.getStartUserId())
// .ownerDeptId(owner.getOwnerDeptId())
// .ownerDeptName(owner.getOwnerDeptName())
// .createTime(processInstance.getStartTime())
// .taskCreateTime(task.getCreateTime())
// .build();
// res.setProcessTaskInfo(processTaskVo);
// String projectName = (String) formData.get(ProjectDeclareConstants.BasicInformation.PROJECT_NAME);
// res.setProjectName(projectName);
// res.setReportUnitId(owner.getOwnerDeptId());
// res.setReportUnitName(owner.getOwnerDeptName());
// res.setReportAmount((Integer) formData.get(ProjectDeclareConstants.FundDeclareInfo.DECLARE_AMOUNT));
// res.setBudgetYear((Integer) formData.get(ProjectDeclareConstants.BasicInformation.BUDGET_YEAR));
// res.setProcessStatus(ProcessStatusEnum.getCodeByDesc(status));
// res.setProcessStatusName(status);
// res.setProcessLaunchTime(NdDateUtils.date2LocalDateTime(processInstance.getStartTime()));
// }
// return res;
//}).filter(v -> StringUtils.isBlank(param.getProjectName()) || v.getProjectName().contains(param.getProjectName()))
// .filter(v -> StringUtils.isBlank(param.getReportUnitName()) || v.getReportUnitName().contains(param.getReportUnitName()))
// .filter(v -> Objects.isNull(param.getBudgetYear()) || v.getBudgetYear().equals(param.getBudgetYear()))
// .filter(v -> Objects.isNull(param.getProcessLaunchStartTime()) || v.getProcessLaunchTime().isBefore(param.getProcessLaunchStartTime()))
// .filter(v -> Objects.isNull(param.getProcessLaunchEndTime()) || v.getProcessLaunchTime().isAfter(param.getProcessLaunchEndTime()))
// .collect(Collectors.toList());
//if (CollectionUtil.isNotEmpty(staterUsers)) {
// Map<String, OrgUser> userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers);
// page.setRecords(resVos.stream().peek(v -> v.getProcessTaskInfo().setOwner(userMap.get(v.getProcessTaskInfo().getOwnerId()))).collect(Collectors.toList()));
//}
//return PageVo.of(resVos,resVos.size());
}
/**
* 待办中心列表导出
@@ -272,15 +216,15 @@ public class TodoCenterManage {
PageVo<ResToBeProcessedDTO> page = queryPendingProjectList(param);
List<ResToBeProcessedDTO> collect = (List<ResToBeProcessedDTO>) page.getRecords();
String fileName = null;
if (param.getIsSupplement()){
if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsSupplement())){
fileName = "待办中心_待我处理_增补项目列表";
}else {
}else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsSupplement())){
fileName = "待办中心_待我处理_非增补项目列表";
}
ExcelDownUtil.setFileName(fileName,response);
//数据导出处理函数
try {
EasyExcel.write(response.getOutputStream(), ResToBeProjectListExportDTO.class)
EasyExcel.write(response.getOutputStream(), ResToBeExportDTO.class)
.autoCloseStream(false)
.registerWriteHandler(ExcelExportStyle.formalStyle())
.sheet(fileName)
@@ -560,16 +504,19 @@ public class TodoCenterManage {
FlowNode rootNode = (FlowNode) process.getFlowElement("root", true);
// 获取当前节点
FlowNode currentNode = (FlowNode) process.getFlowElement(task.getTaskDefinitionKey(), true);
UserTask userTask = (UserTask) process.getFlowElement(task.getTaskDefinitionKey());
String currentUserId = userTask.getAssignee();
String rootUserId = getRootUserId(rootNode);
// 判断当前登录用户是否是流程发起人
Long userId = LoginUserUtil.getUserId();
List<Execution> executions = runtimeService.createExecutionQuery()
.processInstanceId(task.getProcessInstanceId())
.onlyChildExecutions().list();
if (rootUserId.equals(String.valueOf(userId))){
// TODO 若是流程发起人点击撤回,项目回到上一个状态,并删除当前审核人对应的待办记录
// 获取当前流程项目状态
Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class)
.eq(Project::getInstCode, task.getProcessInstanceId()));
Integer projectStatusSecond = declaredProject.getProjectStatusSecond();

List<Execution> executions = runtimeService.createExecutionQuery()
.processInstanceId(task.getProcessInstanceId())
.onlyChildExecutions().list();
// 强制流程指向撤回
runtimeService.createChangeActivityStateBuilder()
.processInstanceId(task.getProcessInstanceId())
@@ -580,12 +527,16 @@ public class TodoCenterManage {
}else {
FlowElementsContainer parentContainer = currentNode.getParentContainer();
for (FlowElement flowElement : parentContainer.getFlowElements()) {
UserTask BeforeUserTask = (UserTask) flowElement;
if (BeforeUserTask.getAssignee().equals(String.valueOf(userId))){
UserTask beforeUserTask = (UserTask) flowElement;
if (beforeUserTask.getAssignee().equals(String.valueOf(userId))){
// TODO 若是前一个审核人点击撤回,在审核记录中移除自己提交过的审核意见、
// 待我处理中移除当前审核人的待办记录、
// 待我处理中增加自己的待办记录、
// 我已处理中去掉自己之前处理的记录
HistoricTaskInstance beforeTaskInstance = historyService.createHistoricTaskInstanceQuery().taskId(beforeUserTask.getId()).singleResult();
List<Execution> executions = runtimeService.createExecutionQuery()
.processInstanceId(beforeTaskInstance.getProcessInstanceId())
.onlyChildExecutions().list();
// 强制流程指向撤回
runtimeService.createChangeActivityStateBuilder()
.processInstanceId(task.getProcessInstanceId())
@@ -648,6 +599,7 @@ public class TodoCenterManage {
}
UserDo users = orgRepositoryService.getUserById(instance.getStartUserId());
OrgUser startUser = OrgUser.builder().id(users.getUserId()).name(users.getUserName()).avatar(users.getAvatar()).build();

List<ProgressNode> taskRecords = getHisTaskRecords(instanceId, nodePropsValue);
// 获取添加抄送任务
taskRecords.addAll(getCcTaskRecords(instanceId));
@@ -679,12 +631,14 @@ public class TodoCenterManage {
.formItems(formService.filterFormAndDataByPermConfig((List<Form>) forms.getValue(), formData, currentNode))
.formData(formData)
.processDefName(instance.getProcessDefinitionName())
.staterUser(startUser)
.starterDept(null == owner ? null : owner.getOwnerDeptName())
.startTempUser(startUser)
.startDept(null == owner ? null : owner.getOwnerDeptName())
.result(instance.getEndActivityId())
.startTime(instance.getStartTime())
.progress(taskRecords)
.build();
// UserInfo userInfo = userInfoService.getById(Long.valueOf(instance.getStartUserId()));
// res.setStartUser(userInfo);
if (Objects.isNull(instance.getEndActivityId())){
res.setStatus(ProcessStatusEnum.UNDER_REVIEW.name());
} else if (HisProInsEndActId.BACK.equals(instance.getEndActivityId())) {
@@ -695,6 +649,10 @@ public class TodoCenterManage {
} else if (HisProInsEndActId.END.equals(instance.getEndActivityId())) {
res.setStatus(ProcessStatusEnum.APPROVED.name());
}
// 查询项目申报信息
Project projectInfo = projectService.getOne(Wrappers.lambdaQuery(Project.class)
.eq(Project::getInstCode, instanceId));
res.setDeclaredProjectInfo(projectInfo);
return res;
}

@@ -780,15 +738,15 @@ public class TodoCenterManage {
public PageVo<ResToBeProcessedDTO> queryHandledProjectList(ReqToBeProcessedDTO param) {
// 获取登录用户ID
// long userId = LoginUserUtil.getUserId();
int userId = 381496;
Long userId = 381496L;
// 获取入参分页信息
Integer pageSize = param.getPageSize();
Integer pageNumber = param.getPageNumber();
Page<NdDeclaredProject> page = param.page();
Page<Project> page = param.page();

//自定义sql查询所有已办的任务
String nativeSql = "SELECT aht.* FROM `ACT_HI_TASKINST` AS aht LEFT JOIN `ACT_HI_VARINST` AS ahv ON SUBSTRING(ahv.NAME_, 9) = aht.ID_ \n" +
"AND ahv.NAME_ LIKE 'approve_%' WHERE aht.ASSIGNEE_ = '" + userId + "' AND ahv.NAME_ IS NOT NULL ORDER BY aht.END_TIME_ DESC";
String nativeSql = "SELECT aht.* FROM ACT_HI_TASKINST AS aht \n" +
"LEFT JOIN ACT_HI_VARINST AS ahv ON SUBSTRING(ahv.NAME_, 9) = aht.ID_ AND ahv.NAME_ LIKE 'approve_%'\n" +
"WHERE aht.ASSIGNEE_ = " + userId + " AND ahv.NAME_ IS NOT NULL \n" +
"ORDER BY aht.END_TIME_ DESC";

NativeHistoricTaskInstanceQuery taskInstanceQuery = historyService.createNativeHistoricTaskInstanceQuery().sql(nativeSql);
List<HistoricTaskInstance> taskInstances = taskInstanceQuery.list();
@@ -800,23 +758,30 @@ public class TodoCenterManage {
.list().stream().collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) : new HashMap<>();

List<String> processInsIds = taskInstances.stream().map(HistoricTaskInstance::getProcessInstanceId).collect(Collectors.toList());
LambdaQueryWrapper<NdDeclaredProject> wrapper = Wrappers.lambdaQuery(NdDeclaredProject.class);
wrapper.like(StrUtil.isNotBlank(param.getProjectName()),NdDeclaredProject::getProjectName,param.getProjectName())
.like(StrUtil.isNotBlank(param.getOrgName()),NdDeclaredProject::getOrgName,param.getOrgName())
.eq(Objects.nonNull(param.getProjectYear()),NdDeclaredProject::getProjectYear,param.getProjectYear())
.ge(Objects.nonNull(param.getProcessLaunchStartTime()),NdDeclaredProject::getCreateOn,param.getProcessLaunchStartTime())
.le(Objects.nonNull(param.getProcessLaunchEndTime()),NdDeclaredProject::getCreateOn,param.getProcessLaunchEndTime());
declaredProjectService.page(page,wrapper);
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class);
wrapper.like(StrUtil.isNotBlank(param.getProjectName()),Project::getProjectName,param.getProjectName())
.like(StrUtil.isNotBlank(param.getBuildUnitName()),Project::getBuildUnitName,param.getBuildUnitName())
.eq(Objects.nonNull(param.getProjectYear()),Project::getProjectYear,param.getProjectYear())
.eq(Objects.nonNull(param.getIsSupplement()),Project::getIsTemporaryAugment,param.getIsSupplement())
.ge(Objects.nonNull(param.getProcessLaunchStartTime()),Project::getBeginTime,param.getProcessLaunchStartTime())
.le(Objects.nonNull(param.getProcessLaunchEndTime()),Project::getEndTime,param.getProcessLaunchEndTime());
projectService.page(page,wrapper);
Set<String> staterUsers = new HashSet<>();
List<ResToBeProcessedDTO> resVos = page.getRecords().stream().filter(d -> processInsIds.contains(d.getProcInsId())).map(d -> {
List<ResToBeProcessedDTO> resVos = page.getRecords().stream().filter(d -> processInsIds.contains(d.getInstCode())).map(d -> {

ResToBeProcessedDTO res = new ResToBeProcessedDTO();
BeanUtils.copyProperties(d, res);
res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus()));
res.setProcessLaunchTime(d.getCreateOn());
res.setProcessHandleTime(d.getUpdateOn());

HistoricTaskInstance task = historyService.createHistoricTaskInstanceQuery().processInstanceId(d.getProcInsId()).singleResult();
LocalDateTime processLaunchTime = d.getCreateOn();
String launchTimeFormat = NdDateUtils.format(processLaunchTime, "yyyy-MM-dd HH:mm");
LocalDateTime launchTime = LocalDateTime.parse(launchTimeFormat, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
res.setProcessLaunchTime(launchTime);
LocalDateTime processHandleTime = d.getUpdateOn();
String handleTimeFormat = NdDateUtils.format(processHandleTime, "yyyy-MM-dd HH:mm");
LocalDateTime handleTime = LocalDateTime.parse(handleTimeFormat, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
res.setProcessHandleTime(handleTime);

HistoricTaskInstance task = historyService.createHistoricTaskInstanceQuery().processInstanceId(d.getInstCode()).singleResult();
HistoricProcessInstance instance = instanceMap.get(task.getProcessInstanceId());
HistoricVariableInstance variableInstance = historyService.createHistoricVariableInstanceQuery()
.processInstanceId(instance.getId()).variableName("approve_" + task.getId()).singleResult();
@@ -850,23 +815,35 @@ public class TodoCenterManage {
result = resVos.stream().peek(v -> v.getProcessTaskInfo()
.setOwner(userMap.get(v.getProcessTaskInfo().getOwnerId())))
.collect(Collectors.toList());
// Map<Long,UserInfo> userMap = userInfoService.getUserMapByIds(staterUsers);
// result = resVos.stream().peek(v -> v.setOwner(userMap.get(userId)))
// .collect(Collectors.toList());
}
return PageVo.of(result,page.getTotal());
return PageVo.of(result,resVos.size());
}

/**
* 导出我已处理项目列表
* @param response 返回数据流
* @param param 请求参数
* @return void
* @author CMM
* @since 2023/02/06 16:25
*/
public void exportHandledProjectList(HttpServletResponse response, ReqToBeProcessedDTO param) {
PageVo<ResToBeProcessedDTO> page = queryHandledProjectList(param);
List<ResToBeProcessedDTO> collect = (List<ResToBeProcessedDTO>) page.getRecords();
String fileName = null;
if (param.getIsSupplement()){
if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsSupplement())){
fileName = "待办中心_我已处理_增补项目列表";
}else {
}else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsSupplement())){
fileName = "待办中心_我已处理_非增补项目列表";
}
ExcelDownUtil.setFileName(fileName,response);
//数据导出处理函数
try {
EasyExcel.write(response.getOutputStream(), ResHandledProjectListExportDTO.class)
EasyExcel.write(response.getOutputStream(), ResHandledExportDTO.class)
.autoCloseStream(false)
.registerWriteHandler(ExcelExportStyle.formalStyle())
.sheet(fileName)
@@ -875,4 +852,148 @@ public class TodoCenterManage {
throw new RuntimeException(e);
}
}

/**
* 查询我提交的项目列表
* @param param
* @return com.ningdatech.basic.model.PageVo<com.ningdatech.pmapi.todocenter.model.dto.res.ResToBeProcessedDTO>
* @author CMM
* @since 2023/02/06 16:18
*/
public PageVo<ResToBeProcessedDTO> queryMySubmittedProjectList(ReqToBeProcessedDTO param) {
HistoricProcessInstanceQuery instanceQuery = historyService.createHistoricProcessInstanceQuery();
// Long startUserId = LoginUserUtil.getUserId();
Long startUserId = 381496L;
Page<Project> page = param.page();
Executor.builder().ifNotBlankNext(String.valueOf(startUserId), instanceQuery::startedBy);
List<HistoricProcessInstance> historicProcessInstances = instanceQuery
.orderByProcessInstanceStartTime().desc()
.orderByProcessInstanceEndTime().desc()
.list();
//把已办任务流程实例一次性取出来,减少查询次数
Map<String, HistoricProcessInstance> instanceMap = CollectionUtil.isNotEmpty(historicProcessInstances) ?
historyService.createHistoricProcessInstanceQuery().processInstanceIds(historicProcessInstances.stream()
.map(h -> h.getId()).collect(Collectors.toSet())).list().stream()
.collect(Collectors.toMap(HistoricProcessInstance::getId, v -> v)) : new HashMap<>();
Set<String> historicProcessInstanceIds = historicProcessInstances.stream().map(h -> h.getId()).collect(Collectors.toSet());
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class);
wrapper.like(StrUtil.isNotBlank(param.getProjectName()),Project::getProjectName,param.getProjectName())
.like(StrUtil.isNotBlank(param.getBuildUnitName()),Project::getBuildUnitName,param.getBuildUnitName())
.eq(Objects.nonNull(param.getProjectYear()),Project::getProjectYear,param.getProjectYear())
.eq(Objects.nonNull(param.getIsSupplement()),Project::getIsTemporaryAugment,param.getIsSupplement())
.ge(Objects.nonNull(param.getProcessLaunchStartTime()),Project::getBeginTime,param.getProcessLaunchStartTime())
.le(Objects.nonNull(param.getProcessLaunchEndTime()),Project::getEndTime,param.getProcessLaunchEndTime());
projectService.page(page,wrapper);
Set<String> staterUsers = new HashSet<>();
List<ResToBeProcessedDTO> resVos = page.getRecords().stream().filter(d -> historicProcessInstanceIds.contains(d.getInstCode())).map(d -> {
ResToBeProcessedDTO res = new ResToBeProcessedDTO();
BeanUtils.copyProperties(d, res);
res.setProcessStatusName(ProcessStatusEnum.getDescByCode(d.getProcessStatus()));
LocalDateTime processLaunchTime = d.getCreateOn();
String launchTimeFormat = NdDateUtils.format(processLaunchTime, "yyyy-MM-dd HH:mm");
LocalDateTime launchTime = LocalDateTime.parse(launchTimeFormat, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
res.setProcessLaunchTime(launchTime);
HistoricProcessInstance ist = instanceMap.get(d.getInstCode());
staterUsers.add(ist.getStartUserId());
ProcessInstanceVo processInstanceVo = getProcessInstanceVos(ist);
res.setProcessInstanceInfo(processInstanceVo);
return res;
}).collect(Collectors.toList());

if (CollectionUtil.isNotEmpty(staterUsers)) {
Map<String, OrgUser> userMap = userDeptOrLeaderService.getUserMapByIds(staterUsers);
resVos.stream().map(v -> {
v.getProcessInstanceInfo().setStaterUser(userMap.get(v.getProcessInstanceInfo().getStaterUserId()));
return v;
}).collect(Collectors.toList());
}

//if (CollectionUtil.isNotEmpty(staterUsers)) {
// Map<Long, UserInfo> userMap = userInfoService.getUserMapByIds(staterUsers);
// resVos.stream().peek(v -> v.setOwner(userMap.get(startUserId)))
// .collect(Collectors.toList());
//}
return PageVo.of(resVos,resVos.size());
}

/**
* 获取流程实例信息
*
* @param ist 流程实例
* @return java.util.List<com.wflow.workflow.bean.vo.ProcessInstanceVo>
* @author CMM
* @since 2023/02/06 17:34
*/
private ProcessInstanceVo getProcessInstanceVos( HistoricProcessInstance ist) {
Map<String, String> instanceNodeMap = new HashMap<>();
ProcessInstanceVo instanceVo = ProcessInstanceVo.builder()
.processDefId(ist.getProcessDefinitionId())
.instanceId(ist.getId())
.nodeId(instanceNodeMap.get(ist.getId()))
.formId(ist.getProcessDefinitionKey())
.staterUserId(ist.getStartUserId())
.startTime(ist.getStartTime())
.finishTime(ist.getEndTime())
.processDefName(ist.getProcessDefinitionName())
.result(ist.getEndActivityId())
.version(ist.getProcessDefinitionVersion())
.build();

if (Objects.isNull(ist.getEndActivityId())) {
instanceVo.setStatus(ProcessStatusEnum.UNDER_REVIEW.name());
} else if (HisProInsEndActId.BACK.equals(ist.getEndActivityId())) {
// TODO 被退回的审核节点状态这里只是暂时这么判断,具体怎么保存这个退回状态,后面讨论
instanceVo.setStatus(ProcessStatusEnum.BE_BACKED.name());
} else if (HisProInsEndActId.REJECT.equals(ist.getEndActivityId())) {
instanceVo.setStatus(ProcessStatusEnum.BE_REJECTED.name());
} else if (HisProInsEndActId.END.equals(ist.getEndActivityId())) {
instanceVo.setStatus(ProcessStatusEnum.APPROVED.name());
}

if (ObjectUtil.isNull(ist.getEndActivityId())) {
// 没有结束,还在走流程,获取任务
List<Task> list =
taskService.createTaskQuery().processInstanceId(ist.getId()).includeIdentityLinks().active().list();
instanceVo.setNodeId(Optional.ofNullable(instanceVo.getNodeId()).orElseGet(() -> {
if (CollectionUtil.isNotEmpty(list)) {
return list.get(0).getTaskDefinitionKey();
}
return null;
}));
instanceVo.setTaskName(StrUtil.join("、", list.stream().map(TaskInfo::getName).collect(Collectors.toSet())));
} else {
if (HisProInsEndActId.WITHDRAW.equals(ist.getEndActivityId())) {
instanceVo.setTaskName(ProcessStatusEnum.WITHDRAW.getDesc());
} else if (HisProInsEndActId.REJECT.equals(ist.getEndActivityId())) {
instanceVo.setTaskName(ProcessStatusEnum.BE_REJECTED.getDesc());
} else {
instanceVo.setTaskName(ProcessStatusEnum.APPROVED.getDesc());
}
}

return instanceVo;
}

public void exportMySubmittedProjectList(HttpServletResponse response, ReqToBeProcessedDTO param) {
PageVo<ResToBeProcessedDTO> page = queryMySubmittedProjectList(param);
List<ResToBeProcessedDTO> collect = (List<ResToBeProcessedDTO>) page.getRecords();
String fileName = null;
if (IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(param.getIsSupplement())){
fileName = "待办中心_我发起的_增补项目列表";
}else if (IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(param.getIsSupplement())){
fileName = "待办中心_我发起的_非增补项目列表";
}
ExcelDownUtil.setFileName(fileName,response);
//数据导出处理函数
try {
EasyExcel.write(response.getOutputStream(), ResMySubmittedExportDTO.class)
.autoCloseStream(false)
.registerWriteHandler(ExcelExportStyle.formalStyle())
.sheet(fileName)
.doWrite(collect);
} catch (IOException e) {
throw new RuntimeException(e);
}

}
}

+ 6
- 3
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/req/ReqToBeProcessedDTO.java Bestand weergeven

@@ -10,6 +10,8 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;

/**
* 待办中心-待我处理查询实体信息
*
@@ -26,7 +28,7 @@ public class ReqToBeProcessedDTO extends PagePo implements Serializable {
private String projectName;

@ApiModelProperty("申报单位名称")
private String orgName;
private String buildUnitName;

@ApiModelProperty("预算年度")
private Integer projectYear;
@@ -37,6 +39,7 @@ public class ReqToBeProcessedDTO extends PagePo implements Serializable {
@ApiModelProperty("流程发起结束时间")
private LocalDateTime processLaunchEndTime;

@ApiModelProperty(value = "是否增补项目",allowableValues = "非增补项目 false,增补项目 true")
private Boolean isSupplement;
@ApiModelProperty(value = "是否增补项目",allowableValues = "非增补项目 0,增补项目 1")
@NotNull(message = "是否增补字段不能为空!")
private Integer isSupplement;
}

pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/res/ResHandledProjectListExportDTO.java → pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/res/ResHandledExportDTO.java Bestand weergeven

@@ -18,7 +18,7 @@ import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResHandledProjectListExportDTO implements Serializable {
public class ResHandledExportDTO implements Serializable {
private static final long serialVersionUID = 1L;

@ExcelProperty("项目名称")

pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/res/ResToBeProjectListExportDTO.java → pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/res/ResMySubmittedExportDTO.java Bestand weergeven

@@ -1,15 +1,16 @@
package com.ningdatech.pmapi.todocenter.model.dto.res;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.alibaba.excel.annotation.ExcelProperty;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* 待办中心待我处理项目列表导出实体
* 待办中心我发起的项目列表导出实体
*
* @author CMM
* @since 2023/01/19 16:42
@@ -17,7 +18,7 @@ import java.time.LocalDateTime;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResToBeProjectListExportDTO implements Serializable {
public class ResMySubmittedExportDTO implements Serializable {
private static final long serialVersionUID = 1L;

@ExcelProperty("项目名称")

+ 42
- 0
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/res/ResToBeExportDTO.java Bestand weergeven

@@ -0,0 +1,42 @@
package com.ningdatech.pmapi.todocenter.model.dto.res;

import com.alibaba.excel.annotation.ExcelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
* 待办中心待我处理项目列表导出实体
*
* @author CMM
* @since 2023/01/19 16:42
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResToBeExportDTO implements Serializable {
private static final long serialVersionUID = 1L;

@ExcelProperty("项目名称")
private String projectName;

@ExcelProperty("申报单位")
private String buildUnitName;

@ExcelProperty("申报金额")
private Integer declareAmount;

@ExcelProperty("预算年度")
private Integer projectYear;

@ExcelProperty("流程状态")
private String processStatusName;

@ExcelProperty("发起时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime processLaunchTime;
}

+ 19
- 5
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/dto/res/ResToBeProcessedDTO.java Bestand weergeven

@@ -5,11 +5,16 @@ import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ningdatech.pmapi.user.entity.UserInfo;
import com.wflow.workflow.bean.vo.ProcessInstanceVo;
import com.wflow.workflow.bean.vo.ProcessTaskVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

/**
* 待办中心-待我处理返回实体信息
@@ -20,23 +25,24 @@ import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
@ExcelIgnoreUnannotated
public class ResToBeProcessedDTO implements Serializable {
private static final long serialVersionUID = 1L;

@ApiModelProperty("项目ID")
private String procInsId;
@ApiModelProperty("流程实例编号")
private String instanceCode;

@ApiModelProperty("项目名称")
private String projectName;

@ApiModelProperty("申报单位ID")
private String orgCode;
private String buildUnitId;

@ApiModelProperty("申报单位名称")
private String orgName;
private String buildUnitName;

@ApiModelProperty("申报金额")
private BigDecimal approvedAmount;
private BigDecimal declareAmount;

@ApiModelProperty("预算年度")
private Integer projectYear;
@@ -48,11 +54,19 @@ public class ResToBeProcessedDTO implements Serializable {
private String processStatusName;

@ApiModelProperty("流程发起时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime processLaunchTime;

@ApiModelProperty("流程处理时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime processHandleTime;

@ApiModelProperty("流程任务信息")
private ProcessTaskVo processTaskInfo;

@ApiModelProperty("流程实例信息")
private ProcessInstanceVo processInstanceInfo;

@ApiModelProperty("流程发起人信息")
private UserInfo owner;
}

+ 4
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java Bestand weergeven

@@ -3,6 +3,9 @@ package com.ningdatech.pmapi.user.service;
import com.ningdatech.pmapi.user.entity.UserInfo;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.Map;
import java.util.Set;

/**
* <p>
* 用户信息表 服务类
@@ -13,4 +16,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IUserInfoService extends IService<UserInfo> {

Map<Long, UserInfo> getUserMapByIds(Set<String> staterUsers);
}

+ 16
- 1
pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java Bestand weergeven

@@ -4,8 +4,17 @@ import com.ningdatech.pmapi.user.entity.UserInfo;
import com.ningdatech.pmapi.user.mapper.UserInfoMapper;
import com.ningdatech.pmapi.user.service.IUserInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

/**
* <p>
* 用户信息表 服务实现类
@@ -15,6 +24,12 @@ import org.springframework.stereotype.Service;
* @since 2023-01-04
*/
@Service
@RequiredArgsConstructor
public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> implements IUserInfoService {

private final UserInfoMapper userInfoMapper;
@Override
public Map<Long, UserInfo> getUserMapByIds(Set<String> staterUsers) {
List<UserInfo> userInfos = userInfoMapper.selectBatchIds(staterUsers);
return userInfos.stream().collect(Collectors.toMap(UserInfo::getId,u -> u ));
}
}

Laden…
Annuleren
Opslaan