From 5bc2552c03542adff61320c48b10e86f4290af76 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 24 Feb 2023 14:37:49 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8D=89=E7=A8=BF=E7=AE=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projectdeclared/manage/DeclaredProjectManage.java | 2 ++ .../pmapi/todocenter/manage/TodoCenterManage.java | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java index 02d8802..22cde80 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java @@ -279,6 +279,7 @@ public class DeclaredProjectManage { * @return */ public Long saveToDraft(ProjectDraftSaveDTO dto) { + Long userId = LoginUserUtil.getUserId(); ProjectDTO projectInfo = dto.getProjectInfo(); ProjectDraft draft = new ProjectDraft(); BeanUtils.copyProperties(projectInfo, draft); @@ -293,6 +294,7 @@ public class DeclaredProjectManage { draft.setCreateOn(LocalDateTime.now()); } draft.setUpdateOn(LocalDateTime.now()); + draft.setUserId(String.valueOf(userId)); projectDraftService.saveOrUpdate(draft); return draft.getId(); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index 1b8a934..3d580d0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -1,6 +1,7 @@ package com.ningdatech.pmapi.todocenter.manage; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.StopWatch; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Sets; @@ -95,22 +96,34 @@ public class TodoCenterManage { Long userId = LoginUserUtil.getUserId(); //因为要解耦 不能把项目和工作流一起查 //1.先查出用户工作流 + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); List userTodoList = processTaskService.getUserTodoList(param.getProcessDefId(),String.valueOf(userId)); if(CollUtil.isEmpty(userTodoList)){ return PageVo.empty(); } List instCodes = userTodoList.stream().map(ProcessTaskVo::getInstanceId).collect(Collectors.toList()); + + stopWatch.stop(); + log.info("查询 工作流个人列表 所消耗时间 :{}s" + stopWatch.getTotalTimeSeconds()); + + StopWatch stopWatch2 = new StopWatch(); + stopWatch2.start(); Map taskVoMap = userTodoList.stream().collect(Collectors.toMap(ProcessTaskVo::getInstanceId, v -> v)); //2.再分页查询项目信息 ProjectListReq projectListReq = new ProjectListReq(); projectListReq.setInstCodes(instCodes); BeanUtils.copyProperties(param,projectListReq); PageVo projectPage = projectLibManage.projectLibList(projectListReq); + stopWatch2.stop(); + log.info("查询 项目库列表 所消耗时间 :{}s" + stopWatch2.getTotalTimeSeconds()); if(0L == projectPage.getTotal()){ return PageVo.empty(); } + StopWatch stopWatch3 = new StopWatch(); + stopWatch3.start(); List resVos = projectPage.getRecords().stream().map(d -> { ResToBeProcessedVO res = new ResToBeProcessedVO(); BeanUtils.copyProperties(d, res); @@ -121,6 +134,8 @@ public class TodoCenterManage { res.setProcessLaunchTime(d.getCreateOn()); return res; }).collect(Collectors.toList()); + stopWatch3.stop(); + log.info("查询 转换实体 所消耗时间 :{}s" + stopWatch3.getTotalTimeSeconds()); return PageVo.of(resVos, projectPage.getTotal()); }