Browse Source

新增待我处理数量统计

tags/24080901
CMM 1 year ago
parent
commit
8a5c8eda00
3 changed files with 105 additions and 1 deletions
  1. +7
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java
  2. +70
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  3. +28
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/TodoNumVO.java

+ 7
- 0
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java View File

@@ -4,6 +4,7 @@ package com.ningdatech.pmapi.todocenter.controller;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

import com.ningdatech.pmapi.todocenter.model.vo.TodoNumVO;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@@ -180,4 +181,10 @@ public class TodoCenterController {
public Long getSealedPdf(@Valid @RequestBody SealInfoDTO req){
return todoCenterManage.getSealedPdf(req);
}

@ApiOperation("待办中心待我处理数量统计")
@GetMapping("/getTodoNums")
public TodoNumVO getTodoNums(@Valid @ModelAttribute ToBeProcessedReq param){
return todoCenterManage.getTodoNums(param);
}
}

+ 70
- 1
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java View File

@@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletResponse;

import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage;
import com.ningdatech.pmapi.todocenter.handle.WithDrawHandle;
import com.ningdatech.pmapi.todocenter.model.vo.TodoNumVO;
import com.wflow.workflow.enums.ProcessHandlerEnum;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
@@ -218,7 +219,7 @@ public class TodoCenterManage {
res.setProcessDefName(d.getProcessDefName());
return res;
}).collect(Collectors.toList());
return PageVo.of(resVos, todoList.size());
return PageVo.of(resVos, list.size());
}

/**
@@ -1105,4 +1106,72 @@ public class TodoCenterManage {

return statisticsVO;
}

public TodoNumVO getTodoNums(ToBeProcessedReq param) {
// 获取登录用户ID
Long userId = LoginUserUtil.getUserId();
// 获取登录用户全量信息
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId);
// 获取员工浙政钉code
String employeeCode = userFullInfo.getEmployeeCode();
TodoNumVO todoNumVo = new TodoNumVO();
// 查出项目库项目
ProjectListReq projectListReq = new ProjectListReq();
BeanUtils.copyProperties(param, projectListReq);
List<Project> projects = projectLibManage.projectList(projectListReq);
if(CollUtil.isEmpty(projects)){
return todoNumVo;
}
// 再查出项目关联的流程实例ID
List<Long> projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList());

List<ProjectInst> projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, projectIdList)
.orderByDesc(ProjectInst::getProjectId));
List<String> instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList());
// 查出用户工作流
TodoCenterListReqDTO req = new TodoCenterListReqDTO();
req.setInstCodes(instCodes);
req.setProcessDefId(param.getProcessDefId());
req.setUserId(String.valueOf(userId));
req.setEmployeeCode(employeeCode);
//有待办节点的(不包含退回)
List<ProcessTaskVo> todoList = processTaskService.getUserTodoList(req);
//有退回待办的
List<ProcessTaskVo> backList = processTaskService.getBackTodoList(req);
//合并 并且排序
List<ProcessTaskVo> list = Stream.concat(todoList.stream(),backList.stream())
.filter(Objects::nonNull)
.sorted(Comparator.comparing(ProcessTaskVo::getTaskCreateTime)
.reversed())
.collect(Collectors.toList());
if (CollUtil.isEmpty(list)){
return todoNumVo;
}

Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v));
Map<String, Project> projectInfoMap = projectInstList.stream()
.collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId())));
// 关联项目信息
List<Project> projectList = list.stream()
.map(d -> projectInfoMap.get(d.getInstanceId()))
.collect(Collectors.toList());
if (CollUtil.isNotEmpty(projectList)) {
todoNumVo.setTotalNum(projectList.size());
}
// 筛选出增补项目和非增补项目
List<Project> appendProjects = projectList.stream()
.filter(p -> IsAppendProjectEnum.APPEND_PROJECT.getCode().equals(p.getIsTemporaryAugment()))
.collect(Collectors.toList());
if (CollUtil.isNotEmpty(appendProjects)){
todoNumVo.setAppendNum(appendProjects.size());
}
List<Project> notAppendProjects = projectList.stream()
.filter(p -> IsAppendProjectEnum.NOT_APPEND_PROJECT.getCode().equals(p.getIsTemporaryAugment()))
.collect(Collectors.toList());
if (CollUtil.isNotEmpty(notAppendProjects)){
todoNumVo.setNotAppendNum(notAppendProjects.size());
}
return todoNumVo;
}
}

+ 28
- 0
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/TodoNumVO.java View File

@@ -0,0 +1,28 @@
package com.ningdatech.pmapi.todocenter.model.vo;

import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
* 待办中心待我处理数量统计
*
* @author CMM
* @since 2023/04/12 16:51
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TodoNumVO {

@ApiModelProperty("待我处理总数量")
private Integer totalNum;

@ApiModelProperty("待我处理非增补项目总数量")
private Integer notAppendNum;

@ApiModelProperty("待我处理非增补项目总数量")
private Integer appendNum;
}

Loading…
Cancel
Save