From 3b9eaa7b10341e956b092b8ee8ff670c02aca484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?niohe=C2=B7erbao?= Date: Thu, 30 Mar 2023 09:27:19 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E5=AE=9A=E5=88=B6?= =?UTF-8?q?=E5=8C=96=E9=80=BB=E8=BE=91=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ningdatech/pmapi/organization/manage/OrganizationManage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java index 27842f6..ad22694 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java @@ -166,7 +166,7 @@ public class OrganizationManage { return keyTreeVO; }).collect(Collectors.toList()); - if (StringUtils.isNotBlank(parentCode) && !needMember){ + if (StringUtils.isNotBlank(parentCode) && needMember){ List dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) .eq(DingEmployeeInfo::getMainJob, "true") .eq(DingEmployeeInfo::getOrganizationCode, parentCode)); From fff8527a938142786f88a98cbf56a61f406d5a19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?niohe=C2=B7erbao?= Date: Thu, 30 Mar 2023 10:09:56 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E5=AE=9A=E5=88=B6?= =?UTF-8?q?=E5=8C=96=E9=80=BB=E8=BE=91=E6=8E=A5=E5=8F=A3=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DingOrganizationController.java | 11 +- .../organization/manage/OrganizationManage.java | 134 +++++++-------------- .../organization/model/po/ReqSynthesizePO.java | 4 +- 3 files changed, 48 insertions(+), 101 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java index 33135b7..a7b8d73 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java @@ -6,7 +6,6 @@ import com.ningdatech.pmapi.organization.manage.OrganizationManage; import com.ningdatech.pmapi.organization.model.po.ReqOrganizationListPO; import com.ningdatech.pmapi.organization.model.po.ReqSynthesizePO; import com.ningdatech.pmapi.organization.model.vo.KeyTreeVO; -import com.ningdatech.pmapi.organization.model.vo.OrganizationSynthesizeTreeVO; import com.ningdatech.pmapi.organization.model.vo.OrganizationTreeVO; import com.ningdatech.pmapi.organization.model.vo.ResOrganizationListVO; import io.swagger.annotations.Api; @@ -50,15 +49,9 @@ public class DingOrganizationController { return organizationManage.getChildOrganizationList(parentCode); } - @ApiOperation("综合列表筛选") - @PostMapping("/synthesize-list") - public List organizationSynthesizeList(@Valid @RequestBody ReqSynthesizePO request) { - return organizationManage.organizationSynthesizeList(request); - } - - @ApiOperation("组织树状列表筛选") + @ApiOperation("组织树状列表筛选(前端定制化接口不可复用)") @PostMapping("/tree-list") public List treeVOList(@Valid @RequestBody ReqSynthesizePO request) { - return organizationManage.treeVOList(request); + return organizationManage.treeRubbishVOList(request); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java index ad22694..2041adb 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java @@ -13,8 +13,6 @@ import com.ningdatech.pmapi.organization.model.entity.DingOrganization; import com.ningdatech.pmapi.organization.model.po.ReqOrganizationListPO; import com.ningdatech.pmapi.organization.model.po.ReqSynthesizePO; import com.ningdatech.pmapi.organization.model.vo.KeyTreeVO; -import com.ningdatech.pmapi.organization.model.vo.OrganizationSynthesizeTreeVO; -import com.ningdatech.pmapi.organization.model.vo.OrganizationSynthesizeTreeVO.OrganizationMemberInfo; import com.ningdatech.pmapi.organization.model.vo.OrganizationTreeVO; import com.ningdatech.pmapi.organization.model.vo.ResOrganizationListVO; import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; @@ -26,7 +24,6 @@ import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.Comparator; import java.util.List; -import java.util.Map; import java.util.stream.Collectors; /** @@ -110,106 +107,63 @@ public class OrganizationManage { }).collect(Collectors.toList()); } - public List organizationSynthesizeList(ReqSynthesizePO request) { - String parentCode = request.getParentCode(); - Boolean needMember = request.getNeedMember(); + public List treeRubbishVOList(ReqSynthesizePO request) { + String organizationCode = request.getOrganizationCode(); - List childOrganizationList = getChildOrganizationList(parentCode); - - List organizationSynthesizeTreeVOList = childOrganizationList.stream().map(r -> { - OrganizationSynthesizeTreeVO organizationSynthesizeTreeVO = new OrganizationSynthesizeTreeVO(); - organizationSynthesizeTreeVO.setName(r.getName()); - organizationSynthesizeTreeVO.setOrganizationCode(r.getOrganizationCode()); - organizationSynthesizeTreeVO.setParentCode(r.getParentCode()); - return organizationSynthesizeTreeVO; - }).collect(Collectors.toList()); - - if (needMember && organizationSynthesizeTreeVOList.size() > 0) { - List organizationCodeList = organizationSynthesizeTreeVOList.stream() - .map(OrganizationSynthesizeTreeVO::getOrganizationCode).collect(Collectors.toList()); - List dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .eq(DingEmployeeInfo::getMainJob, "true") - .in(DingEmployeeInfo::getOrganizationCode, organizationCodeList)); - - Map> organizationCodeGroupMap = dingEmployeeInfoList.stream() - .collect(Collectors.groupingBy(DingEmployeeInfo::getOrganizationCode)); - - for (OrganizationSynthesizeTreeVO organizationSynthesizeTreeVO : organizationSynthesizeTreeVOList) { - String organizationCode = organizationSynthesizeTreeVO.getOrganizationCode(); - List dingEmployeeInfoGroupList = organizationCodeGroupMap.get(organizationCode); - if (CollUtil.isNotEmpty(dingEmployeeInfoGroupList)) { - List organizationMemberInfoList = dingEmployeeInfoGroupList.stream().map(r -> { - OrganizationMemberInfo organizationMemberInfo = new OrganizationMemberInfo(); - organizationMemberInfo.setEmployeeCode(r.getEmployeeCode()); - organizationMemberInfo.setName(r.getEmployeeName()); - return organizationMemberInfo; - }).collect(Collectors.toList()); - organizationSynthesizeTreeVO.setMemberList(organizationMemberInfoList); - } - } + List dingOrganizationList = new ArrayList<>(); + List organizationCodeList = new ArrayList<>(); + if (StrUtils.isBlank(organizationCode)) { + organizationCodeList = dingOrganizationProperties.getDeptVisibleScopes(); + } else { + organizationCodeList = CollectionUtil.toList(organizationCode); } + dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .in(DingOrganization::getOrganizationCode, organizationCodeList)); - return organizationSynthesizeTreeVOList; - } - - public List treeVOList(ReqSynthesizePO request) { - String parentCode = request.getParentCode(); - Boolean needMember = request.getNeedMember(); - - List childOrganizationList = getChildOrganizationList(parentCode); - - List orgKeyTreeVOList = childOrganizationList.stream().map(r -> { + List orgKeyTreeVOList = dingOrganizationList.stream().map(r -> { KeyTreeVO keyTreeVO = new KeyTreeVO(); - keyTreeVO.setTitle(r.getName()); + keyTreeVO.setTitle(r.getOrganizationName()); keyTreeVO.setKey(r.getOrganizationCode()); keyTreeVO.setType("ORGANIZATION"); return keyTreeVO; }).collect(Collectors.toList()); + treeVOList(request.getNeedMember(), orgKeyTreeVOList); + return orgKeyTreeVOList; + } - if (StringUtils.isNotBlank(parentCode) && needMember){ - List dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .eq(DingEmployeeInfo::getMainJob, "true") - .eq(DingEmployeeInfo::getOrganizationCode, parentCode)); - - List memberChildren = dingEmployeeInfoList.stream().map(r -> { - KeyTreeVO child = new KeyTreeVO(); - child.setKey(r.getEmployeeCode()); - child.setTitle(r.getEmployeeName()); - child.setType("MEMBER"); - return child; + public void treeVOList(Boolean needMember, List basicOrgKeyTreeVOList) { + for (KeyTreeVO basicOrgKeyTreeVO : basicOrgKeyTreeVOList) { + String parentCode = basicOrgKeyTreeVO.getKey(); + List childOrganizationList = getChildOrganizationList(parentCode); + + List orgKeyTreeVOList = childOrganizationList.stream().map(r -> { + KeyTreeVO keyTreeVO = new KeyTreeVO(); + keyTreeVO.setTitle(r.getName()); + keyTreeVO.setKey(r.getOrganizationCode()); + keyTreeVO.setType("ORGANIZATION"); + return keyTreeVO; }).collect(Collectors.toList()); - if (CollUtil.isNotEmpty(memberChildren)) { - orgKeyTreeVOList.addAll(memberChildren); + if (StringUtils.isNotBlank(parentCode) && needMember) { + List dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .eq(DingEmployeeInfo::getMainJob, "true") + .eq(DingEmployeeInfo::getOrganizationCode, parentCode)); + + List memberChildren = dingEmployeeInfoList.stream().map(r -> { + KeyTreeVO child = new KeyTreeVO(); + child.setKey(r.getEmployeeCode()); + child.setTitle(r.getEmployeeName()); + child.setType("MEMBER"); + return child; + }).collect(Collectors.toList()); + + if (CollUtil.isNotEmpty(memberChildren)) { + orgKeyTreeVOList.addAll(memberChildren); + } } + basicOrgKeyTreeVO.setChildren(orgKeyTreeVOList); } + } -// if (needMember && orgKeyTreeVOList.size() > 0) { -// List organizationCodeList = orgKeyTreeVOList.stream() -// .map(KeyTreeVO::getKey).collect(Collectors.toList()); -// List dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) -// .eq(DingEmployeeInfo::getMainJob, "true") -// .in(DingEmployeeInfo::getOrganizationCode, organizationCodeList)); -// -// Map> organizationCodeGroupMap = dingEmployeeInfoList.stream() -// .collect(Collectors.groupingBy(DingEmployeeInfo::getOrganizationCode)); -// -// for (KeyTreeVO keyTreeVO : orgKeyTreeVOList) { -// String organizationCode = keyTreeVO.getKey(); -// List dingEmployeeInfoGroupList = organizationCodeGroupMap.get(organizationCode); -// if (CollUtil.isNotEmpty(dingEmployeeInfoGroupList)) { -// List memberChildren = dingEmployeeInfoGroupList.stream().map(r -> { -// KeyTreeVO child = new KeyTreeVO(); -// child.setKey(r.getEmployeeCode()); -// child.setTitle(r.getEmployeeName()); -// child.setType("MEMBER"); -// return child; -// }).collect(Collectors.toList()); -// keyTreeVO.setChildren(memberChildren); -// } -// } -// } - return orgKeyTreeVOList; - } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java index d5b4fb6..0e02e27 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java @@ -15,8 +15,8 @@ import javax.validation.constraints.NotBlank; @ApiModel("单位列表综合筛选请求") public class ReqSynthesizePO { - @ApiModelProperty("父组织code") - private String parentCode; + @ApiModelProperty("组织code") + private String organizationCode; @ApiModelProperty("是否需要组织成员列表") private Boolean needMember = false; From ff320f255279445194d39819f802122f22c46618 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Thu, 30 Mar 2023 11:02:40 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E7=94=A8=E6=88=B7ID=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E6=B5=99=E6=94=BF=E9=92=89code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/todocenter/manage/TodoCenterManage.java | 70 ++++++++++++++++++---- .../pmapi/todocenter/mapper/StatisticsMapper.java | 8 +-- .../pmapi/todocenter/mapper/StatisticsMapper.xml | 16 ++--- .../todocenter/service/StatisticsService.java | 2 +- .../service/impl/StatisticsServiceImpl.java | 8 +-- 5 files changed, 74 insertions(+), 30 deletions(-) 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 a953e83..944d776 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 @@ -160,6 +160,10 @@ public class TodoCenterManage { public PageVo todoProjectList(ToBeProcessedReq param) { // 获取登录用户ID Long userId = LoginUserUtil.getUserId(); + // 获取登录用户全量信息 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取员工浙政钉code + String employeeCode = userFullInfo.getEmployeeCode(); // 查出项目库项目 ProjectListReq projectListReq = new ProjectListReq(); @@ -186,6 +190,7 @@ public class TodoCenterManage { Integer pageSize = param.getPageSize(); req.setProcessDefId(param.getProcessDefId()); req.setUserId(String.valueOf(userId)); + req.setEmployeeCode(employeeCode); List todoList = processTaskService.getUserTodoList(req); if (CollUtil.isEmpty(todoList)) { @@ -232,6 +237,10 @@ public class TodoCenterManage { public void exportTodoList(HttpServletResponse response, ToBeProcessedExportReq param) { // 获取登录用户ID Long userId = LoginUserUtil.getUserId(); + // 获取用户全量用户信息 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取登录用户浙政钉code + String employeeCode = userFullInfo.getEmployeeCode(); // 查出项目库项目 ProjectListReq projectListReq = new ProjectListReq(); @@ -253,6 +262,7 @@ public class TodoCenterManage { req.setInstCodes(instCodes); req.setProcessDefId(param.getProcessDefId()); req.setUserId(String.valueOf(userId)); + req.setEmployeeCode(employeeCode); BeanUtils.copyProperties(param,req); userTodoList = processTaskService.getUserTodoList(req); } @@ -289,7 +299,10 @@ public class TodoCenterManage { public void handler(ReqProcessHandlerDTO param) { // 获取登录用户ID Long userId = LoginUserUtil.getUserId(); - + // 获取登录用户全量信息 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取登录用户浙政钉code + String employeeCode = userFullInfo.getEmployeeCode(); // 获取入参 String processInstanceId = param.getInstanceId(); Long projectId = param.getProjectId(); @@ -313,7 +326,8 @@ public class TodoCenterManage { .singleResult(); // 获取流程发起人信息 String startUserId = instance.getStartUserId(); - UserInfo startUserInfo = userInfoService.getById(Long.valueOf(startUserId)); + UserInfo startUserInfo = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getEmployeeCode, startUserId)); // 获取流程定义名称 String processDefinitionName = instance.getProcessDefinitionName(); @@ -323,7 +337,7 @@ public class TodoCenterManage { // 盖章并通过 case SEAL_PASS: // 通过该任务,流程到下一审核人处 - processTaskService.handleTask(param, userId); + processTaskService.handleTask(param, employeeCode); // 获取流程通过后的流程实例 HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() .processInstanceId(processInstanceId) @@ -397,7 +411,7 @@ public class TodoCenterManage { case REJECT: // 驳回该任务,中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知: // 【项目名称】的【流程名称】被驳回,请及时处理。 - processTaskService.handleTask(param, userId); + processTaskService.handleTask(param, employeeCode); // 更新项目状态和流程状态 updateRejectProjectStatus(userId, declaredProject); // 获取发送浙政钉工作通知必要信息 @@ -412,7 +426,7 @@ public class TodoCenterManage { // 退回 case BACK: // 退回该任务 - processTaskService.handleTask(param, userId); + processTaskService.handleTask(param, employeeCode); // 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。 // 获取发送浙政钉工作通知必要信息 WorkNoticeInfo backWorkNoticeInfo = getSendWorkNoticeInfo(startUserInfo); @@ -426,9 +440,9 @@ public class TodoCenterManage { // 撤回(流程发起人和当前流程审核人的前一个审核人操作) case WITHDRAW: // 登录用户是流程发起人,且是流程发起人撤回 - if (userId.equals(Long.valueOf(startUserId)) + if (employeeCode.equals(startUserId) && ProcessConstant.Field.ROOT.equals(param.getTaskId())) { - processTaskService.handleTask(param, userId); + processTaskService.handleTask(param, employeeCode); // 若是流程发起人点击撤回,项目回到上一个状态,需调用状态机更新项目状态,流程状态更新为审核通过 switch (Objects.requireNonNull(ProjectStatusEnum.getValue(projectStatus))) { // 当前项目状态是单位内部审核中 @@ -475,7 +489,7 @@ public class TodoCenterManage { } else if (!userFlag) { throw new BizException("当前登录用户无法进行撤回操作!"); } else { - processTaskService.handleTask(param, userId); + processTaskService.handleTask(param, employeeCode); } } break; @@ -752,6 +766,10 @@ public class TodoCenterManage { // 获取登录用户ID Long userId = LoginUserUtil.getUserId(); + // 获取登录用户全量信息 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取登录用户浙政钉code + String employeeCode = userFullInfo.getEmployeeCode(); // 查出项目库项目 ProjectListReq projectListReq = new ProjectListReq(); @@ -775,6 +793,7 @@ public class TodoCenterManage { Integer pageSize = param.getPageSize(); req.setProcessDefId(param.getProcessDefId()); req.setUserId(String.valueOf(userId)); + req.setEmployeeCode(employeeCode); req.setInstCodes(instCodes); List iDoList = processTaskService.getUserIdoList(req); if (CollUtil.isEmpty(iDoList)) { @@ -813,6 +832,10 @@ public class TodoCenterManage { public void idoExport(HttpServletResponse response, ToBeProcessedExportReq param) { // 获取登录用户ID Long userId = LoginUserUtil.getUserId(); + // 获取登录用户全量信息 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取登录用户浙政钉code + String employeeCode = userFullInfo.getEmployeeCode(); //因为要解耦 不能把项目和工作流一起查 // 查出项目库项目 @@ -836,6 +859,7 @@ public class TodoCenterManage { TodoCenterListReqDTO req = new TodoCenterListReqDTO(); req.setProcessDefId(param.getProcessDefId()); req.setUserId(String.valueOf(userId)); + req.setEmployeeCode(employeeCode); req.setInstCodes(instCodes); userIdoList = processTaskService.getUserIdoList(req); } @@ -875,9 +899,12 @@ public class TodoCenterManage { * @since 2023/02/06 */ public PageVo mySubmittedList(ToBeProcessedReq param) { - // 获取登录用户ID Long userId = LoginUserUtil.getUserId(); + // 获取登录用户全量信息 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取登录用户浙政钉code + String employeeCode = userFullInfo.getEmployeeCode(); // 查出项目库项目 ProjectListReq projectListReq = new ProjectListReq(); @@ -903,6 +930,7 @@ public class TodoCenterManage { Integer pageSize = param.getPageSize(); req.setProcessDefId(param.getProcessDefId()); req.setUserId(String.valueOf(userId)); + req.setEmployeeCode(employeeCode); req.setInstCodes(instCodes); List submittedList = processInstanceService.getUserSubmittedList(req); @@ -915,7 +943,6 @@ public class TodoCenterManage { .limit(pageSize) .collect(Collectors.toList()); - List resVos = userSubmittedList.stream().map(d -> { ResToBeProcessedVO res = new ResToBeProcessedVO(); Project project = projectInfoMap.get(d.getInstanceId()); @@ -943,6 +970,10 @@ public class TodoCenterManage { // 获取登录用户ID long userId = LoginUserUtil.getUserId(); + // 获取登录用户全量信息 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取登录用户浙政钉code + String employeeCode = userFullInfo.getEmployeeCode(); // 查出项目库项目 ProjectListReq projectListReq = new ProjectListReq(); @@ -965,6 +996,7 @@ public class TodoCenterManage { TodoCenterListReqDTO req = new TodoCenterListReqDTO(); req.setProcessDefId(param.getProcessDefId()); req.setUserId(String.valueOf(userId)); + req.setEmployeeCode(employeeCode); req.setInstCodes(instCodes); userSubmittedList = processInstanceService.getUserSubmittedList(req); } @@ -1007,6 +1039,10 @@ public class TodoCenterManage { // 获取登录用户ID Long userId = LoginUserUtil.getUserId(); + // 获取登录用户全量信息 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取登录用户浙政钉code + String employeeCode = userFullInfo.getEmployeeCode(); // 查出项目库项目 ProjectListReq projectListReq = new ProjectListReq(); @@ -1032,6 +1068,7 @@ public class TodoCenterManage { Integer pageSize = param.getPageSize(); req.setProcessDefId(param.getProcessDefId()); req.setUserId(String.valueOf(userId)); + req.setEmployeeCode(employeeCode); req.setInstCodes(instCodes); BeanUtils.copyProperties(param,req); List ccMeList = processInstanceService.getCcMeList(req); @@ -1073,6 +1110,10 @@ public class TodoCenterManage { // 获取登录用户ID Long userId = LoginUserUtil.getUserId(); + // 获取登录用户全量信息 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取登录用户浙政钉code + String employeeCode = userFullInfo.getEmployeeCode(); // 查出项目库项目 ProjectListReq projectListReq = new ProjectListReq(); @@ -1095,13 +1136,12 @@ public class TodoCenterManage { TodoCenterListReqDTO req = new TodoCenterListReqDTO(); req.setProcessDefId(param.getProcessDefId()); req.setUserId(String.valueOf(userId)); + req.setEmployeeCode(employeeCode); req.setInstCodes(instCodes); BeanUtils.copyProperties(param,req); ccMeList = processInstanceService.getCcMeList(req); } - - ExcelExportWriter excelExportWriter = new ExcelExportWriter(); String fileName = null; @@ -1345,9 +1385,13 @@ public class TodoCenterManage { //获取当前登录人的 待办中心统计数据 public TodoCenterStatisticsVO todoCenterStatistics(){ Long userId = LoginUserUtil.getUserId(); + // 获取登录用户全量信息 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取登录用户浙政钉code + String employeeCode = userFullInfo.getEmployeeCode(); //为了查询效率 还是自己去写统计接口 - TodoCenterStatisticsPO statistics = statisticsService.getStatistics(userId); + TodoCenterStatisticsPO statistics = statisticsService.getStatistics(employeeCode); TodoCenterStatisticsVO statisticsVO = BeanUtil.copyProperties(statistics,TodoCenterStatisticsVO.class); return statisticsVO; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/mapper/StatisticsMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/mapper/StatisticsMapper.java index fe78d59..73343f2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/mapper/StatisticsMapper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/mapper/StatisticsMapper.java @@ -7,11 +7,11 @@ import org.apache.ibatis.annotations.Param; public interface StatisticsMapper extends BaseMapper { - TodoCenterStatisticsPO getStatistics(@Param("userId") Long userId); + TodoCenterStatisticsPO getStatistics(@Param("employeeCode") String employeeCode); - TodoCenterStatisticsPO getTodoOrIdo(@Param("userId") Long userId); + TodoCenterStatisticsPO getTodoOrIdo(@Param("employeeCode") String employeeCode); - TodoCenterStatisticsPO mysubmitNum(@Param("userId") Long userId); + TodoCenterStatisticsPO mysubmitNum(@Param("employeeCode") String employeeCode); - TodoCenterStatisticsPO ccNums(@Param("userId") Long userId); + TodoCenterStatisticsPO ccNums(@Param("employeeCode") String employeeCode); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/mapper/StatisticsMapper.xml b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/mapper/StatisticsMapper.xml index f8033c3..3fc11c2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/mapper/StatisticsMapper.xml +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/mapper/StatisticsMapper.xml @@ -10,10 +10,10 @@ sum(CASE WHEN tol.ccmeNum IS NOT NULL AND tol.ccmeNum > 0 THEN 1 ELSE 0 end) ccmeNum FROM ( SELECT - sum(CASE WHEN ht.assignee_ = #{userId} AND ht.end_time_ is NULL THEN 1 end) todoNum, - sum(CASE WHEN ht.assignee_ = #{userId} AND ht.end_time_ IS not NULL THEN 1 end) idoNum, - sum(CASE WHEN hp.start_user_id_ = #{userId} THEN 1 end) mysubmitNum, - sum(CASE WHEN cc.user_id = #{userId} THEN 1 end) ccmeNum + sum(CASE WHEN ht.assignee_ = #{employeeCode} AND ht.end_time_ is NULL THEN 1 end) todoNum, + sum(CASE WHEN ht.assignee_ = #{employeeCode} AND ht.end_time_ IS not NULL THEN 1 end) idoNum, + sum(CASE WHEN hp.start_user_id_ = #{employeeCode} THEN 1 end) mysubmitNum, + sum(CASE WHEN cc.user_id = #{employeeCode} THEN 1 end) ccmeNum FROM act_hi_procinst hp LEFT JOIN @@ -27,8 +27,8 @@ @@ -44,7 +44,7 @@ act_hi_procinst hp LEFT JOIN act_hi_taskinst ht ON hp.proc_inst_id_ = ht.proc_inst_id_ - where start_user_id_ = #{userId} + where start_user_id_ = #{employeeCode} GROUP BY hp.id_) tol @@ -55,6 +55,6 @@ count(0) ccmeNum FROM wflow_cc_tasks cc - where cc.user_id = #{userId} + where cc.employee_code = #{employeeCode} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/StatisticsService.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/StatisticsService.java index 2b1bd7e..40401e1 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/StatisticsService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/StatisticsService.java @@ -11,5 +11,5 @@ import com.ningdatech.pmapi.todocenter.model.po.TodoCenterStatisticsPO; public interface StatisticsService { //根据用户id 去查询 一些统计数据 - TodoCenterStatisticsPO getStatistics(Long userId); + TodoCenterStatisticsPO getStatistics(String employeeCode); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/StatisticsServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/StatisticsServiceImpl.java index 0cc04fc..ffdbc7a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/StatisticsServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/StatisticsServiceImpl.java @@ -21,21 +21,21 @@ public class StatisticsServiceImpl implements StatisticsService { private final StatisticsMapper mapper; @Override - public TodoCenterStatisticsPO getStatistics(Long userId) { + public TodoCenterStatisticsPO getStatistics(String employeeCode) { TodoCenterStatisticsPO res = new TodoCenterStatisticsPO(); - TodoCenterStatisticsPO todoOrIdo = mapper.getTodoOrIdo(userId); + TodoCenterStatisticsPO todoOrIdo = mapper.getTodoOrIdo(employeeCode); if(Objects.nonNull(todoOrIdo)){ res.setTodoNum(todoOrIdo.getTodoNum()); res.setIdoNum(todoOrIdo.getIdoNum()); } - TodoCenterStatisticsPO submit = mapper.mysubmitNum(userId); + TodoCenterStatisticsPO submit = mapper.mysubmitNum(employeeCode); if(Objects.nonNull(submit)){ res.setMysubmitNum(submit.getMysubmitNum()); } - TodoCenterStatisticsPO ccMe = mapper.ccNums(userId); + TodoCenterStatisticsPO ccMe = mapper.ccNums(employeeCode); if(Objects.nonNull(ccMe)){ res.setCcmeNum(ccMe.getCcmeNum()); } From 5c96cb04627115b73e7bbbb21282a75318b335c1 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Thu, 30 Mar 2023 11:11:15 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E7=94=A8=E6=88=B7ID=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E6=B5=99=E6=94=BF=E9=92=89code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java | 1 - 1 file changed, 1 deletion(-) 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 0ed62a5..678b380 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 @@ -1068,7 +1068,6 @@ public class TodoCenterManage { req.setUserId(String.valueOf(userId)); req.setEmployeeCode(employeeCode); req.setInstCodes(instCodes); -// req.setInstCodes(instCodes); BeanUtils.copyProperties(param,req); List ccMeList = processInstanceService.getCcMeList(req);