|
|
@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.workbench.manage; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.date.StopWatch; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
@@ -34,6 +35,7 @@ import com.ningdatech.pmapi.workbench.model.vo.WorkbenchVO; |
|
|
|
import com.wflow.enums.WarningNoticeTypeEnum; |
|
|
|
import com.wflow.enums.WarningRuleTypeEnum; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
@@ -52,6 +54,7 @@ import java.util.stream.Collectors; |
|
|
|
*/ |
|
|
|
@Component |
|
|
|
@AllArgsConstructor |
|
|
|
@Slf4j |
|
|
|
public class WorkbenchManage { |
|
|
|
|
|
|
|
private final TodoCenterManage todoCenterManage; |
|
|
@@ -79,6 +82,8 @@ public class WorkbenchManage { |
|
|
|
|
|
|
|
CompletableFuture.allOf( |
|
|
|
CompletableFuture.runAsync(() -> { |
|
|
|
StopWatch stopWatch = new StopWatch(); |
|
|
|
stopWatch.start(); |
|
|
|
//1.待办中心数据 |
|
|
|
TodoCenterStatisticsVO statisticsVO = todoCenterManage.todoCenterStatistics(user.getEmployeeCode()); |
|
|
|
ToBeProcessedReq toBeProcessedReq = new ToBeProcessedReq(); |
|
|
@@ -89,8 +94,13 @@ public class WorkbenchManage { |
|
|
|
statisticsVO.setTodoList(todoCenterManage.todoProjectList(toBeProcessedReq).getRecords() |
|
|
|
.stream().map(WorkbenchConverter::convert).collect(Collectors.toList())); |
|
|
|
res.setTodoCerter(statisticsVO); |
|
|
|
stopWatch.stop(); |
|
|
|
log.info("待办中心数据 耗时,{} s",stopWatch.getTotalTimeSeconds()); |
|
|
|
}, ForkJoinPool.commonPool()), |
|
|
|
CompletableFuture.runAsync(() -> { |
|
|
|
StopWatch stopWatch = new StopWatch(); |
|
|
|
stopWatch.start(); |
|
|
|
|
|
|
|
//2.项目统计数据 |
|
|
|
res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage |
|
|
|
.declaredProjectOrgStatistics(year, user),defaultDeclaredProjectManage.declaredProjectOrgStatistics(year - 1, user))); |
|
|
@@ -98,26 +108,43 @@ public class WorkbenchManage { |
|
|
|
res.setRegionDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage |
|
|
|
.declaredProjectRegionStatistics(year, user),defaultDeclaredProjectManage.declaredProjectRegionStatistics(year - 1, user))); |
|
|
|
} |
|
|
|
stopWatch.stop(); |
|
|
|
log.info("项目统计数据 耗时,{} s",stopWatch.getTotalTimeSeconds()); |
|
|
|
}, ForkJoinPool.commonPool()), |
|
|
|
CompletableFuture.runAsync(() -> { |
|
|
|
StopWatch stopWatch = new StopWatch(); |
|
|
|
stopWatch.start(); |
|
|
|
|
|
|
|
//3.所有公告按类型分 |
|
|
|
NoticeListReq noticeListReq = new NoticeListReq(); |
|
|
|
noticeListReq.setPageNumber(1); |
|
|
|
noticeListReq.setPageSize(1000); |
|
|
|
res.setNoticeList(noticeManage.listToMapByManager(noticeListReq,user)); |
|
|
|
stopWatch.stop(); |
|
|
|
log.info("公告 耗时,{} s",stopWatch.getTotalTimeSeconds()); |
|
|
|
}, ForkJoinPool.commonPool()), |
|
|
|
CompletableFuture.runAsync(() -> { |
|
|
|
StopWatch stopWatch = new StopWatch(); |
|
|
|
stopWatch.start(); |
|
|
|
|
|
|
|
//4.项目预警记录 |
|
|
|
res.setProjectEarlyWarning(getProjectEarlyWarning(user)); |
|
|
|
log.info("项目预警记录 耗时,{} s",stopWatch.getTotalTimeSeconds()); |
|
|
|
}, ForkJoinPool.commonPool()), |
|
|
|
CompletableFuture.runAsync(() -> { |
|
|
|
StopWatch stopWatch = new StopWatch(); |
|
|
|
stopWatch.start(); |
|
|
|
|
|
|
|
// 项目列表 |
|
|
|
ProjectListReq projectListReq = new ProjectListReq(); |
|
|
|
projectListReq.setPageNumber(1); |
|
|
|
projectListReq.setPageSize(2000); |
|
|
|
projectListReq.setProjectYear(year); |
|
|
|
res.setProjects(new ArrayList<>(projectLibManage.listWithPermissionWorkbentch(projectListReq,user).getRecords())); |
|
|
|
log.info("工作台 项目列表 耗时,{} s",stopWatch.getTotalTimeSeconds()); |
|
|
|
}, ForkJoinPool.commonPool()) |
|
|
|
).join(); |
|
|
|
|
|
|
|
//这个不能放入子线程 |
|
|
|
ProjectListReq projectListReq = new ProjectListReq(); |
|
|
|
projectListReq.setPageNumber(1); |
|
|
|
projectListReq.setPageSize(2000); |
|
|
|
projectListReq.setProjectYear(year); |
|
|
|
res.setProjects(new ArrayList<>(projectLibManage.listWithPermissionWorkbentch(projectListReq,user).getRecords())); |
|
|
|
return res; |
|
|
|
} |
|
|
|
|
|
|
|