@@ -17,6 +17,7 @@ import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import com.wflow.bean.entity.WflowModels; | |||
import com.wflow.bean.entity.WflowOrgModels; | |||
@@ -216,15 +217,13 @@ public class DefaultDeclaredProjectManage { | |||
} | |||
//根据提交者的单位 | |||
public DeclaredProjectStatisticsPO declaredProjectOrgStatistics(Integer year){ | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
public DeclaredProjectStatisticsPO declaredProjectOrgStatistics(Integer year, UserFullInfoDTO user){ | |||
//查此人建设单位的项目 | |||
return statisticsService.getOrgStatistics(user.getEmpPosUnitCode(),year); | |||
} | |||
//根据提交者的区域 他是区管或者超管 | |||
public DeclaredProjectStatisticsPO declaredProjectRegionStatistics(Integer year){ | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
public DeclaredProjectStatisticsPO declaredProjectRegionStatistics(Integer year, UserFullInfoDTO user){ | |||
//查此人建设单位的项目 | |||
return statisticsService.getRegionStatistics(user.getRegionCode(),year); | |||
} | |||
@@ -1,10 +1,13 @@ | |||
package com.ningdatech.pmapi.projectlib.controller; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; | |||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; | |||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
@@ -31,10 +34,13 @@ public class ProjectLibController { | |||
private final ProjectLibManage projectLibManage; | |||
private final UserInfoHelper userInfoHelper; | |||
@GetMapping("/list") | |||
@ApiOperation("项目库列表") | |||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | |||
return projectLibManage.projectLibListWithPermission(req); | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
return projectLibManage.projectLibListWithPermission(req,user); | |||
} | |||
@GetMapping("/{id}") | |||
@@ -108,9 +108,9 @@ public class ProjectLibManage { | |||
return PageVo.of(records, total); | |||
} | |||
public PageVo<ProjectLibListItemVO> projectLibListWithPermission(ProjectListReq req) { | |||
public PageVo<ProjectLibListItemVO> projectLibListWithPermission(ProjectListReq req,UserFullInfoDTO user) { | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
UserFullInfoDTO user = buildProjectLibPermission(query); | |||
user = buildProjectLibPermission(query,user); | |||
//项目查最新 | |||
query.eq(Project::getNewest,Boolean.TRUE); | |||
Page<Project> page = projectService.page(req.page(), query); | |||
@@ -118,6 +118,7 @@ public class ProjectLibManage { | |||
if ((total = page.getTotal()) == 0) { | |||
return PageVo.empty(); | |||
} | |||
UserFullInfoDTO finalUser = user; | |||
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> { | |||
ProjectLibListItemVO item = new ProjectLibListItemVO(); | |||
item.setId(w.getId()); | |||
@@ -133,10 +134,10 @@ public class ProjectLibManage { | |||
item.setProcessStatus(w.getProcessStatus()); | |||
item.setInstCode(w.getInstCode()); | |||
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); | |||
if (user.getIsOrgAdmin() && | |||
if (finalUser.getIsOrgAdmin() && | |||
ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) | |||
&& StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(user.getEmpPosUnitCode()) | |||
&& w.getSuperOrgCode().equals(user.getEmpPosUnitCode())) { | |||
&& StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) | |||
&& w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { | |||
item.setCanPreDeclared(Boolean.TRUE); | |||
} | |||
return item; | |||
@@ -522,8 +523,7 @@ public class ProjectLibManage { | |||
* | |||
* @param query | |||
*/ | |||
public UserFullInfoDTO buildProjectLibPermission(LambdaQueryWrapper<Project> query) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
public UserFullInfoDTO buildProjectLibPermission(LambdaQueryWrapper<Project> query,UserFullInfoDTO user) { | |||
Optional<DataScopeDTO> currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user); | |||
if (!currentUserDataScope.isPresent()) { | |||
log.warn("没有取到权限信息 当前查询 没有权限条件"); | |||
@@ -122,11 +122,7 @@ public class TodoCenterManage { | |||
private final RuntimeService runtimeService; | |||
private final IProjectService projectService; | |||
private final ProjectLibManage projectLibManage; | |||
private final StateMachineUtils stateMachineUtils; | |||
private final IDingEmployeeInfoService dingEmployeeInfoService; | |||
private final IDingOrganizationService dingOrganizationService; | |||
private final ProcessInstanceService processInstanceService; | |||
private final INdWorkNoticeStagingService workNoticeStagingService; | |||
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | |||
private final IProjectApplicationService projectApplicationService; | |||
private final UserInfoHelper userInfoHelper; | |||
@@ -152,12 +148,15 @@ public class TodoCenterManage { | |||
* @since 2023/02/18 | |||
*/ | |||
public PageVo<ResToBeProcessedVO> todoProjectList(ToBeProcessedReq param) { | |||
// 获取登录用户ID | |||
Long userId = LoginUserUtil.getUserId(); | |||
// 获取登录用户全量信息 | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); | |||
// 获取员工浙政钉code | |||
String employeeCode = userFullInfo.getEmployeeCode(); | |||
String employeeCode = param.getEmployeeCode(); | |||
if(StringUtils.isBlank(employeeCode)){ | |||
// 获取登录用户ID | |||
Long userId = LoginUserUtil.getUserId(); | |||
// 获取登录用户全量信息 | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); | |||
// 获取员工浙政钉code | |||
employeeCode = userFullInfo.getEmployeeCode(); | |||
} | |||
// 查出项目库项目 | |||
ProjectListReq projectListReq = new ProjectListReq(); | |||
@@ -184,7 +183,6 @@ public class TodoCenterManage { | |||
Integer pageNumber = param.getPageNumber(); | |||
Integer pageSize = param.getPageSize(); | |||
req.setProcessDefId(param.getProcessDefId()); | |||
req.setUserId(String.valueOf(userId)); | |||
req.setEmployeeCode(employeeCode); | |||
//有待办节点的(不包含退回) | |||
List<ProcessTaskVo> todoList = processTaskService.getUserTodoList(req); | |||
@@ -1136,13 +1134,7 @@ public class TodoCenterManage { | |||
} | |||
//获取当前登录人的 待办中心统计数据 | |||
public TodoCenterStatisticsVO todoCenterStatistics(){ | |||
Long userId = LoginUserUtil.getUserId(); | |||
// 获取登录用户全量信息 | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); | |||
// 获取登录用户浙政钉code | |||
String employeeCode = userFullInfo.getEmployeeCode(); | |||
public TodoCenterStatisticsVO todoCenterStatistics(String employeeCode){ | |||
//为了查询效率 还是自己去写统计接口 | |||
TodoCenterStatisticsPO statistics = statisticsService.getStatistics(employeeCode); | |||
TodoCenterStatisticsVO statisticsVO = BeanUtil.copyProperties(statistics,TodoCenterStatisticsVO.class); | |||
@@ -45,4 +45,7 @@ public class ToBeProcessedReq extends PagePo implements Serializable { | |||
@ApiModelProperty("流程配置ID") | |||
private String processDefId; | |||
@ApiModelProperty("登录人员工号") | |||
private String employeeCode; | |||
} |
@@ -3,7 +3,10 @@ package com.ningdatech.pmapi.todocenter.service.impl; | |||
import com.ningdatech.pmapi.todocenter.mapper.StatisticsMapper; | |||
import com.ningdatech.pmapi.todocenter.model.po.TodoCenterStatisticsPO; | |||
import com.ningdatech.pmapi.todocenter.service.StatisticsService; | |||
import com.wflow.workflow.bean.dto.TodoCenterListReqDTO; | |||
import com.wflow.workflow.service.ProcessTaskService; | |||
import lombok.AllArgsConstructor; | |||
import org.flowable.engine.TaskService; | |||
import org.springframework.stereotype.Service; | |||
import java.util.Objects; | |||
@@ -20,18 +23,22 @@ public class StatisticsServiceImpl implements StatisticsService { | |||
private final StatisticsMapper mapper; | |||
private final ProcessTaskService processTaskService; | |||
private final TaskService taskService; | |||
@Override | |||
public TodoCenterStatisticsPO getStatistics(String employeeCode) { | |||
TodoCenterStatisticsPO res = new TodoCenterStatisticsPO(); | |||
TodoCenterStatisticsPO todo = mapper.getTodoOrIdo(employeeCode); | |||
if(Objects.nonNull(todo)){ | |||
res.setTodoNum(todo.getTodoNum()); | |||
} | |||
TodoCenterStatisticsPO ido = mapper.getIdo(employeeCode); | |||
if(Objects.nonNull(ido)){ | |||
res.setIdoNum(ido.getIdoNum()); | |||
} | |||
TodoCenterListReqDTO req = new TodoCenterListReqDTO(); | |||
req.setEmployeeCode(employeeCode); | |||
Integer todoCount = processTaskService.getTodoCount(req); | |||
res.setTodoNum(todoCount); | |||
Integer idoCount = processTaskService.getUserIdoCount(req); | |||
res.setIdoNum(idoCount); | |||
TodoCenterStatisticsPO submit = mapper.mysubmitNum(employeeCode); | |||
if(Objects.nonNull(submit)){ | |||
res.setMysubmitNum(submit.getMysubmitNum()); | |||
@@ -1,22 +1,15 @@ | |||
package com.ningdatech.pmapi.workbench.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||
import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage; | |||
import com.ningdatech.pmapi.projectdeclared.manage.DefaultDeclaredProjectManage; | |||
import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO; | |||
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; | |||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | |||
import com.ningdatech.pmapi.sys.enumeration.NoticeTypeEnum; | |||
import com.ningdatech.pmapi.sys.manage.NoticeManage; | |||
import com.ningdatech.pmapi.sys.model.req.NoticeListReq; | |||
import com.ningdatech.pmapi.sys.model.vo.NoticeListItemVO; | |||
import com.ningdatech.pmapi.todocenter.manage.TodoCenterManage; | |||
import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedReq; | |||
import com.ningdatech.pmapi.todocenter.model.vo.ResToBeProcessedVO; | |||
import com.ningdatech.pmapi.todocenter.model.vo.TodoCenterStatisticsVO; | |||
import com.ningdatech.pmapi.todocenter.model.vo.TodoVO; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
@@ -24,7 +17,8 @@ import com.ningdatech.pmapi.workbench.converter.WorkbenchConverter; | |||
import com.ningdatech.pmapi.workbench.model.vo.WorkbenchVO; | |||
import lombok.AllArgsConstructor; | |||
import org.springframework.stereotype.Component; | |||
import java.util.concurrent.CompletableFuture; | |||
import java.util.concurrent.ForkJoinPool; | |||
import java.util.stream.Collectors; | |||
/** | |||
@@ -51,34 +45,43 @@ public class WorkbenchManage { | |||
public WorkbenchVO getWorkbenchData(Integer year){ | |||
WorkbenchVO res = new WorkbenchVO(); | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
//1.待办中心数据 | |||
TodoCenterStatisticsVO statisticsVO = todoCenterManage.todoCenterStatistics(); | |||
ToBeProcessedReq toBeProcessedReq = new ToBeProcessedReq(); | |||
toBeProcessedReq.setPageNumber(1); | |||
toBeProcessedReq.setPageSize(5); | |||
statisticsVO.setTodoList(todoCenterManage.todoProjectList(toBeProcessedReq).getRecords() | |||
.stream().map(v -> WorkbenchConverter.convert(v)).collect(Collectors.toList())); | |||
res.setTodoCerter(statisticsVO); | |||
CompletableFuture.allOf( | |||
CompletableFuture.runAsync(()-> { | |||
//1.待办中心数据 | |||
TodoCenterStatisticsVO statisticsVO = todoCenterManage.todoCenterStatistics(user.getEmployeeCode()); | |||
ToBeProcessedReq toBeProcessedReq = new ToBeProcessedReq(); | |||
toBeProcessedReq.setPageNumber(1); | |||
toBeProcessedReq.setPageSize(5); | |||
toBeProcessedReq.setEmployeeCode(user.getEmployeeCode()); | |||
statisticsVO.setTodoList(todoCenterManage.todoProjectList(toBeProcessedReq).getRecords() | |||
.stream().map(v -> WorkbenchConverter.convert(v)).collect(Collectors.toList())); | |||
res.setTodoCerter(statisticsVO); | |||
}, ForkJoinPool.commonPool()), | |||
CompletableFuture.runAsync(()-> { | |||
//2.项目统计数据 | |||
res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectOrgStatistics(year,user))); | |||
if(userInfoHelper.isSuperOrRegionAdmin(user.getUserId())){ | |||
res.setRegionDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectRegionStatistics(year,user))); | |||
} | |||
}, ForkJoinPool.commonPool()), | |||
CompletableFuture.runAsync(()-> { | |||
//3.所有公告按类型分 | |||
NoticeListReq noticeListReq = new NoticeListReq(); | |||
noticeListReq.setPageNumber(1); | |||
noticeListReq.setPageSize(1000); | |||
res.setNoticeList(noticeManage.listToMapByManager(noticeListReq)); | |||
}, ForkJoinPool.commonPool()) | |||
).join(); | |||
//2.项目统计数据 | |||
res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectOrgStatistics(year))); | |||
if(userInfoHelper.isSuperOrRegionAdmin(LoginUserUtil.getUserId())){ | |||
res.setRegionDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectRegionStatistics(year))); | |||
} | |||
//这个不能放入子线程 | |||
ProjectListReq projectListReq = new ProjectListReq(); | |||
projectListReq.setPageNumber(1); | |||
projectListReq.setPageSize(5); | |||
projectListReq.setProjectYear(year); | |||
projectListReq.setBuildOrgCode(user.getEmpPosUnitCode()); | |||
res.setProjects(projectLibManage.projectLibListWithPermission(projectListReq).getRecords().stream().collect(Collectors.toList())); | |||
//3.所有公告按类型分 | |||
NoticeListReq noticeListReq = new NoticeListReq(); | |||
noticeListReq.setPageNumber(1); | |||
noticeListReq.setPageSize(1000); | |||
res.setNoticeList(noticeManage.listToMapByManager(noticeListReq)); | |||
res.setProjects(projectLibManage.projectLibListWithPermission(projectListReq,user).getRecords().stream().collect(Collectors.toList())); | |||
return res; | |||
} | |||