From a6c30e4c5ed3979f2d725e84d9e2d838c7948d8c Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Wed, 10 Jul 2024 14:41:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=A1=E5=88=9B=E5=AE=A1=E6=A0=B8=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20debug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TodoCenterController.java | 5 ++ .../pm/api/todocenter/manage/TodoCenterManage.java | 97 ++++++++++++++++++---- 2 files changed, 86 insertions(+), 16 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/controller/TodoCenterController.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/controller/TodoCenterController.java index d571890..0eddf16 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/controller/TodoCenterController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/controller/TodoCenterController.java @@ -189,6 +189,11 @@ public class TodoCenterController { return todoCenterManage.ccmeList(param); } + @GetMapping("/ccme-list-xinchuang") + public PageVo ccmeListXinchuang(@Valid @ModelAttribute ToBeProcessedReq param) { + return todoCenterManage.ccmeListXinchuang(param); + } + /** * 待办中心-抄送我的项目列表导出 * diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java index deda1ae..c200a19 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/todocenter/manage/TodoCenterManage.java @@ -244,23 +244,24 @@ public class TodoCenterManage { public PageVo todoXinchuangList(ToBeProcessedReq param) { Long userId = Optional.ofNullable(param.getUserId()).orElseGet(LoginUserUtil::getUserId); String userIdStr = String.valueOf(userId); - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - // 查出信创信息 + // 查出信创 List xinchuangs = xinchuangService.list(Wrappers.lambdaQuery(Xinchuang.class) .isNotNull(Xinchuang::getInstCode)); + if (CollUtil.isEmpty(xinchuangs)) { return PageVo.empty(); } - + Map xinchuangMap = CollUtils.listToMap(xinchuangs, Xinchuang::getId); List xinchuangIds = CollUtils.fieldList(xinchuangs, Xinchuang::getId); List xinchuangInsts = xinchuangInstService.listByXinchuangIds(xinchuangIds); - Map xinchuangMap = CollUtils.listToMap(xinchuangs, Xinchuang::getInstCode); + Map xinchuangInstMap = CollUtils.listToMap(xinchuangInsts, XinchuangInst::getInstCode); List instCodes = CollUtils.fieldList(xinchuangInsts, XinchuangInst::getInstCode); if (CollUtil.isEmpty(instCodes)) { return PageVo.empty(); } + // 查出用户工作流 TodoCenterListReqDTO req = new TodoCenterListReqDTO(); req.setInstCodes(instCodes); @@ -296,9 +297,10 @@ public class TodoCenterManage { List instanceIds = CollUtils.fieldList(userTodoList, ProcessTaskVo::getInstanceId); List resVos = userTodoList.stream().map(d -> { - Xinchuang xinchuang = xinchuangMap.get(d.getInstanceId()); + XinchuangInst xinchuangInst = xinchuangInstMap.get(d.getInstanceId()); ResToBeProcessedVO res = new ResToBeProcessedVO(); - if(Objects.nonNull(xinchuang)){ + if(Objects.nonNull(xinchuangInst) && xinchuangMap.containsKey(xinchuangInst.getXinchuangId())){ + Xinchuang xinchuang = xinchuangMap.get(xinchuangInst.getXinchuangId()); res.setXinchuangId(xinchuang.getId()); res.setProjectName(xinchuang.getProjectName()); res.setBuildOrg(xinchuang.getBuildOrgName()); @@ -931,19 +933,19 @@ public class TodoCenterManage { Long userId = LoginUserUtil.getUserId(); // 获取登录用户浙政钉code String userIdStr = String.valueOf(userId); - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - // 查出信创信息 + // 查出信创 List xinchuangs = xinchuangService.list(Wrappers.lambdaQuery(Xinchuang.class) .isNotNull(Xinchuang::getInstCode)); - if (xinchuangs.isEmpty()) { + if (CollUtil.isEmpty(xinchuangs)) { return PageVo.empty(); } + Map xinchuangMap = CollUtils.listToMap(xinchuangs, Xinchuang::getId); List xinchuangIds = CollUtils.fieldList(xinchuangs, Xinchuang::getId); List xinchuangInsts = xinchuangInstService.listByXinchuangIds(xinchuangIds); - Map xinchuangMap = CollUtils.listToMap(xinchuangs, Xinchuang::getInstCode); + Map xinchuangInstMap = CollUtils.listToMap(xinchuangInsts, XinchuangInst::getInstCode); List instCodes = CollUtils.fieldList(xinchuangInsts, XinchuangInst::getInstCode); if (CollUtil.isEmpty(instCodes)) { return PageVo.empty(); @@ -967,8 +969,9 @@ public class TodoCenterManage { .collect(Collectors.toList()); List resVos = userIdoList.stream().map(d -> { ResToBeProcessedVO res = new ResToBeProcessedVO(); - Xinchuang xinchuang = xinchuangMap.get(d.getInstanceId()); - if(Objects.nonNull(xinchuang)){ + XinchuangInst xinchuangInst = xinchuangInstMap.get(d.getInstanceId()); + if(Objects.nonNull(xinchuangInst) && xinchuangMap.containsKey(xinchuangInst.getXinchuangId())){ + Xinchuang xinchuang = xinchuangMap.get(xinchuangInst.getXinchuangId()); res.setXinchuangId(xinchuang.getId()); res.setProjectName(xinchuang.getProjectName()); res.setBuildOrg(xinchuang.getBuildOrgName()); @@ -1132,7 +1135,6 @@ public class TodoCenterManage { Long userId = LoginUserUtil.getUserId(); // 获取登录用户浙政钉code String userIdStr = String.valueOf(userId); - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); // 查出信创 List xinchuangs = xinchuangService.list(Wrappers.lambdaQuery(Xinchuang.class) @@ -1141,10 +1143,11 @@ public class TodoCenterManage { if (CollUtil.isEmpty(xinchuangs)) { return PageVo.empty(); } + Map xinchuangMap = CollUtils.listToMap(xinchuangs, Xinchuang::getId); List xinchuangIds = CollUtils.fieldList(xinchuangs, Xinchuang::getId); List xinchuangInsts = xinchuangInstService.listByXinchuangIds(xinchuangIds); - Map xinchuangMap = CollUtils.listToMap(xinchuangs, Xinchuang::getInstCode); + Map xinchuangInstMap = CollUtils.listToMap(xinchuangInsts, XinchuangInst::getInstCode); List instCodes = CollUtils.fieldList(xinchuangInsts, XinchuangInst::getInstCode); if (CollUtil.isEmpty(instCodes)) { return PageVo.empty(); @@ -1171,8 +1174,9 @@ public class TodoCenterManage { List resVos = userSubmittedList.stream().map(d -> { ResToBeProcessedVO res = new ResToBeProcessedVO(); - Xinchuang xinchuang = xinchuangMap.get(d.getInstanceId()); - if(Objects.nonNull(xinchuang)){ + XinchuangInst xinchuangInst = xinchuangInstMap.get(d.getInstanceId()); + if(Objects.nonNull(xinchuangInst) && xinchuangMap.containsKey(xinchuangInst.getXinchuangId())){ + Xinchuang xinchuang = xinchuangMap.get(xinchuangInst.getXinchuangId()); res.setXinchuangId(xinchuang.getId()); res.setProjectName(xinchuang.getProjectName()); res.setBuildOrg(xinchuang.getBuildOrgName()); @@ -1327,6 +1331,67 @@ public class TodoCenterManage { return PageVo.of(resVos, ccMeList.size()); } + public PageVo ccmeListXinchuang(ToBeProcessedReq param) { + + // 获取登录用户ID + Long userId = LoginUserUtil.getUserId(); + // 获取登录用户全量信息 + String userIdStr = String.valueOf(userId); + // 查出信创 + List xinchuangs = xinchuangService.list(Wrappers.lambdaQuery(Xinchuang.class) + .isNotNull(Xinchuang::getInstCode)); + + if (CollUtil.isEmpty(xinchuangs)) { + return PageVo.empty(); + } + Map xinchuangMap = CollUtils.listToMap(xinchuangs, Xinchuang::getId); + List xinchuangIds = CollUtils.fieldList(xinchuangs, Xinchuang::getId); + List xinchuangInsts = xinchuangInstService.listByXinchuangIds(xinchuangIds); + + Map xinchuangInstMap = CollUtils.listToMap(xinchuangInsts, XinchuangInst::getInstCode); + List instCodes = CollUtils.fieldList(xinchuangInsts, XinchuangInst::getInstCode); + if (CollUtil.isEmpty(instCodes)) { + return PageVo.empty(); + } + // 查出用户工作流 + TodoCenterListReqDTO req = new TodoCenterListReqDTO(); + Integer pageNumber = param.getPageNumber(); + Integer pageSize = param.getPageSize(); + req.setProcessDefId(param.getProcessDefId()); + req.setUserId(userIdStr); + req.setEmployeeCode(userIdStr); + req.setInstCodes(instCodes); + List ccMeList = processInstanceService.getCcMeList(req); + + if (CollUtil.isEmpty(ccMeList)) { + return PageVo.empty(); + } + + List ccMeInstList = ccMeList.stream() + .skip((long) (pageNumber - 1) * pageSize) + .limit(pageSize) + .collect(Collectors.toList()); + + List resVos = ccMeInstList.stream().map(d -> { + ResToBeProcessedVO res = new ResToBeProcessedVO(); + XinchuangInst xinchuangInst = xinchuangInstMap.get(d.getInstanceId()); + if(Objects.nonNull(xinchuangInst) && xinchuangMap.containsKey(xinchuangInst.getXinchuangId())){ + Xinchuang xinchuang = xinchuangMap.get(xinchuangInst.getXinchuangId()); + BeanUtils.copyProperties(xinchuang, res); + res.setXinchuangId(xinchuang.getId()); + res.setBuildOrg(xinchuang.getBuildOrgName()); + res.setBuildOrgCode(xinchuang.getBuildOrgCode()); + } + res.setInstCode(d.getInstanceId()); + res.setNodeId(d.getNodeId()); + + res.setProcessStatusName(d.getStatus()); + res.setProcessLaunchTime(d.getStartTime()); + return res; + }).collect(Collectors.toList()); + return PageVo.of(resVos, ccMeList.size()); + } + /** * 待办中心-抄送我的项目列表导出 *