|
@@ -1,18 +1,23 @@ |
|
|
package com.ningdatech.pmapi.workbench.manage; |
|
|
package com.ningdatech.pmapi.workbench.manage; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.google.common.collect.Lists; |
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
import com.ningdatech.pmapi.common.helper.UserInfoHelper; |
|
|
import com.ningdatech.pmapi.common.helper.UserInfoHelper; |
|
|
import com.ningdatech.pmapi.projectdeclared.manage.DefaultDeclaredProjectManage; |
|
|
import com.ningdatech.pmapi.projectdeclared.manage.DefaultDeclaredProjectManage; |
|
|
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; |
|
|
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; |
|
|
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; |
|
|
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; |
|
|
|
|
|
import com.ningdatech.pmapi.sys.enumeration.ProjectEarlyWarningStatusEnum; |
|
|
import com.ningdatech.pmapi.sys.manage.NoticeManage; |
|
|
import com.ningdatech.pmapi.sys.manage.NoticeManage; |
|
|
|
|
|
import com.ningdatech.pmapi.sys.model.entity.ProjectEarlyWarning; |
|
|
import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords; |
|
|
import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords; |
|
|
import com.ningdatech.pmapi.sys.model.req.NoticeListReq; |
|
|
import com.ningdatech.pmapi.sys.model.req.NoticeListReq; |
|
|
import com.ningdatech.pmapi.sys.model.req.WarningListReq; |
|
|
|
|
|
import com.ningdatech.pmapi.sys.model.vo.WflowEarlyWarningRecordsVO; |
|
|
|
|
|
|
|
|
import com.ningdatech.pmapi.sys.model.vo.ProjectEarlyWarningVO; |
|
|
import com.ningdatech.pmapi.sys.service.IEarlyWarningRecordsService; |
|
|
import com.ningdatech.pmapi.sys.service.IEarlyWarningRecordsService; |
|
|
|
|
|
import com.ningdatech.pmapi.sys.service.IProjectEarlyWarningService; |
|
|
import com.ningdatech.pmapi.todocenter.manage.TodoCenterManage; |
|
|
import com.ningdatech.pmapi.todocenter.manage.TodoCenterManage; |
|
|
import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedReq; |
|
|
import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedReq; |
|
|
import com.ningdatech.pmapi.todocenter.model.vo.TodoCenterStatisticsVO; |
|
|
import com.ningdatech.pmapi.todocenter.model.vo.TodoCenterStatisticsVO; |
|
@@ -21,11 +26,11 @@ import com.ningdatech.pmapi.user.util.LoginUserUtil; |
|
|
import com.ningdatech.pmapi.workbench.converter.WorkbenchConverter; |
|
|
import com.ningdatech.pmapi.workbench.converter.WorkbenchConverter; |
|
|
import com.ningdatech.pmapi.workbench.model.vo.WorkbenchVO; |
|
|
import com.ningdatech.pmapi.workbench.model.vo.WorkbenchVO; |
|
|
import com.wflow.enums.WarningNoticeTypeEnum; |
|
|
import com.wflow.enums.WarningNoticeTypeEnum; |
|
|
import com.wflow.enums.WarningRuleTypeEnum; |
|
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
import lombok.AllArgsConstructor; |
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.stereotype.Component; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
import java.util.concurrent.CompletableFuture; |
|
|
import java.util.concurrent.CompletableFuture; |
|
|
import java.util.concurrent.ForkJoinPool; |
|
|
import java.util.concurrent.ForkJoinPool; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
@@ -46,6 +51,8 @@ public class WorkbenchManage { |
|
|
|
|
|
|
|
|
private final IEarlyWarningRecordsService earlyWarningRecordsService; |
|
|
private final IEarlyWarningRecordsService earlyWarningRecordsService; |
|
|
|
|
|
|
|
|
|
|
|
private final IProjectEarlyWarningService projectEarlyWarningService; |
|
|
|
|
|
|
|
|
private final NoticeManage noticeManage; |
|
|
private final NoticeManage noticeManage; |
|
|
|
|
|
|
|
|
private final UserInfoHelper userInfoHelper; |
|
|
private final UserInfoHelper userInfoHelper; |
|
@@ -88,20 +95,7 @@ public class WorkbenchManage { |
|
|
}, ForkJoinPool.commonPool()), |
|
|
}, ForkJoinPool.commonPool()), |
|
|
CompletableFuture.runAsync(() -> { |
|
|
CompletableFuture.runAsync(() -> { |
|
|
//4.项目预警记录 |
|
|
//4.项目预警记录 |
|
|
WorkbenchVO.ProjectEarlyWarning projectEarlyWarning = new WorkbenchVO.ProjectEarlyWarning(); |
|
|
|
|
|
//4.1 |
|
|
|
|
|
//累积预警统计 |
|
|
|
|
|
WorkbenchVO.WarningStatistics accumulate = new WorkbenchVO.WarningStatistics(); |
|
|
|
|
|
Long overCount = earlyWarningRecordsService.count(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) |
|
|
|
|
|
.eq(WflowEarlyWarningRecords::getNoticeType, WarningNoticeTypeEnum.OVER.getCode()) |
|
|
|
|
|
.or(q2 -> q2.isNull(WflowEarlyWarningRecords::getNoticeType))); |
|
|
|
|
|
accumulate.setOver(overCount.intValue()); |
|
|
|
|
|
Long adventCount = earlyWarningRecordsService.count(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) |
|
|
|
|
|
.eq(WflowEarlyWarningRecords::getNoticeType, WarningNoticeTypeEnum.ADVENT.getCode())); |
|
|
|
|
|
accumulate.setAdvent(adventCount.intValue()); |
|
|
|
|
|
projectEarlyWarning.setAccumulate(accumulate); |
|
|
|
|
|
|
|
|
|
|
|
res.setProjectEarlyWarning(projectEarlyWarning); |
|
|
|
|
|
|
|
|
res.setProjectEarlyWarning(getProjectEarlyWarning()); |
|
|
}, ForkJoinPool.commonPool()) |
|
|
}, ForkJoinPool.commonPool()) |
|
|
).join(); |
|
|
).join(); |
|
|
|
|
|
|
|
@@ -114,4 +108,108 @@ public class WorkbenchManage { |
|
|
res.setProjects(new ArrayList<>(projectLibManage.projectLibListApprove(projectListReq, user).getRecords())); |
|
|
res.setProjects(new ArrayList<>(projectLibManage.projectLibListApprove(projectListReq, user).getRecords())); |
|
|
return res; |
|
|
return res; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private WorkbenchVO.ProjectEarlyWarning getProjectEarlyWarning() { |
|
|
|
|
|
WorkbenchVO.ProjectEarlyWarning projectEarlyWarning = new WorkbenchVO.ProjectEarlyWarning(); |
|
|
|
|
|
//4.1 |
|
|
|
|
|
//累积预警统计 |
|
|
|
|
|
WorkbenchVO.WarningStatistics accumulate = new WorkbenchVO.WarningStatistics(); |
|
|
|
|
|
Long overCount = earlyWarningRecordsService.count(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) |
|
|
|
|
|
.eq(WflowEarlyWarningRecords::getNoticeType, WarningNoticeTypeEnum.OVER.getCode()) |
|
|
|
|
|
.or(q2 -> q2.isNull(WflowEarlyWarningRecords::getNoticeType))); |
|
|
|
|
|
accumulate.setOver(overCount.intValue()); |
|
|
|
|
|
Long adventCount = earlyWarningRecordsService.count(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) |
|
|
|
|
|
.eq(WflowEarlyWarningRecords::getNoticeType, WarningNoticeTypeEnum.ADVENT.getCode())); |
|
|
|
|
|
accumulate.setAdvent(adventCount.intValue()); |
|
|
|
|
|
projectEarlyWarning.setAccumulate(accumulate); |
|
|
|
|
|
|
|
|
|
|
|
//4.2 |
|
|
|
|
|
//当前 |
|
|
|
|
|
//4.2.1 超期 |
|
|
|
|
|
Page<ProjectEarlyWarning> overPage = Page.of(1,1000); |
|
|
|
|
|
Page<ProjectEarlyWarning> adventPage = Page.of(1,1000); |
|
|
|
|
|
Page<ProjectEarlyWarning> normalPage = Page.of(1,1000); |
|
|
|
|
|
LambdaQueryWrapper<ProjectEarlyWarning> overWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) |
|
|
|
|
|
.eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.OVER_TIME.name()); |
|
|
|
|
|
projectEarlyWarningService.page(overPage,overWrapper); |
|
|
|
|
|
LambdaQueryWrapper<ProjectEarlyWarning> adventWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) |
|
|
|
|
|
.eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.ADVENT_TIME.name()); |
|
|
|
|
|
projectEarlyWarningService.page(adventPage,adventWrapper); |
|
|
|
|
|
LambdaQueryWrapper<ProjectEarlyWarning> normalWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) |
|
|
|
|
|
.eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.NORMAL.name()); |
|
|
|
|
|
projectEarlyWarningService.page(normalPage,normalWrapper); |
|
|
|
|
|
|
|
|
|
|
|
WorkbenchVO.WarningStatistics cuurent = new WorkbenchVO.WarningStatistics(); |
|
|
|
|
|
Long overTotal = overPage.getTotal(); |
|
|
|
|
|
Long adventTotal = adventPage.getTotal(); |
|
|
|
|
|
Long normalTotal = normalPage.getTotal(); |
|
|
|
|
|
cuurent.setAdvent(adventTotal.intValue()); |
|
|
|
|
|
cuurent.setOver(overTotal.intValue()); |
|
|
|
|
|
cuurent.setNormal(normalTotal.intValue()); |
|
|
|
|
|
projectEarlyWarning.setCurrent(cuurent); |
|
|
|
|
|
|
|
|
|
|
|
List<WflowEarlyWarningRecords> warningRecords = earlyWarningRecordsService.list(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) |
|
|
|
|
|
.groupBy(WflowEarlyWarningRecords::getProjectCode) |
|
|
|
|
|
.orderByDesc(WflowEarlyWarningRecords::getWarningTime)); |
|
|
|
|
|
Map<String, WflowEarlyWarningRecords> warningMap = warningRecords.stream() |
|
|
|
|
|
.collect(Collectors.toMap(WflowEarlyWarningRecords::getProjectCode, w -> w)); |
|
|
|
|
|
|
|
|
|
|
|
if(CollUtil.isNotEmpty(overPage.getRecords())){ |
|
|
|
|
|
List<ProjectEarlyWarningVO> overVos = overPage.getRecords().stream().map(o -> { |
|
|
|
|
|
ProjectEarlyWarningVO vo = BeanUtil.copyProperties(o,ProjectEarlyWarningVO.class); |
|
|
|
|
|
//取最新一条预警信息 |
|
|
|
|
|
if(warningMap.containsKey(vo.getProjectCode())){ |
|
|
|
|
|
WflowEarlyWarningRecords record = warningMap.get(vo.getProjectCode()); |
|
|
|
|
|
vo.setWarningTime(record.getWarningTime()); |
|
|
|
|
|
vo.setInstStart(record.getInstStart()); |
|
|
|
|
|
vo.setWarningEmployeecode(record.getWarningEmployeecode()); |
|
|
|
|
|
vo.setNoticeMethod(record.getNoticeMethod()); |
|
|
|
|
|
vo.setNoticeContent(record.getNoticeContent()); |
|
|
|
|
|
} |
|
|
|
|
|
return vo; |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
projectEarlyWarning.setOvers(PageVo.of(overVos,overPage.getTotal())); |
|
|
|
|
|
}else{ |
|
|
|
|
|
projectEarlyWarning.setOvers(PageVo.empty()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(CollUtil.isNotEmpty(adventPage.getRecords())){ |
|
|
|
|
|
List<ProjectEarlyWarningVO> adventVos = adventPage.getRecords().stream().map(o -> { |
|
|
|
|
|
ProjectEarlyWarningVO vo = BeanUtil.copyProperties(o,ProjectEarlyWarningVO.class); |
|
|
|
|
|
//取最新一条预警信息 |
|
|
|
|
|
if(warningMap.containsKey(vo.getProjectCode())){ |
|
|
|
|
|
WflowEarlyWarningRecords record = warningMap.get(vo.getProjectCode()); |
|
|
|
|
|
vo.setWarningTime(record.getWarningTime()); |
|
|
|
|
|
vo.setInstStart(record.getInstStart()); |
|
|
|
|
|
vo.setWarningEmployeecode(record.getWarningEmployeecode()); |
|
|
|
|
|
vo.setNoticeMethod(record.getNoticeMethod()); |
|
|
|
|
|
vo.setNoticeContent(record.getNoticeContent()); |
|
|
|
|
|
} |
|
|
|
|
|
return vo; |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
projectEarlyWarning.setAdvents(PageVo.of(adventVos,adventPage.getTotal())); |
|
|
|
|
|
}else{ |
|
|
|
|
|
projectEarlyWarning.setAdvents(PageVo.empty()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(CollUtil.isNotEmpty(normalPage.getRecords())){ |
|
|
|
|
|
List<ProjectEarlyWarningVO> normalVos = normalPage.getRecords().stream().map(o -> { |
|
|
|
|
|
ProjectEarlyWarningVO vo = BeanUtil.copyProperties(o,ProjectEarlyWarningVO.class); |
|
|
|
|
|
//取最新一条预警信息 |
|
|
|
|
|
if(warningMap.containsKey(vo.getProjectCode())){ |
|
|
|
|
|
WflowEarlyWarningRecords record = warningMap.get(vo.getProjectCode()); |
|
|
|
|
|
vo.setWarningTime(record.getWarningTime()); |
|
|
|
|
|
vo.setInstStart(record.getInstStart()); |
|
|
|
|
|
vo.setWarningEmployeecode(record.getWarningEmployeecode()); |
|
|
|
|
|
vo.setNoticeMethod(record.getNoticeMethod()); |
|
|
|
|
|
vo.setNoticeContent(record.getNoticeContent()); |
|
|
|
|
|
} |
|
|
|
|
|
return vo; |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
projectEarlyWarning.setNormals(PageVo.of(normalVos,normalPage.getTotal())); |
|
|
|
|
|
}else{ |
|
|
|
|
|
projectEarlyWarning.setNormals(PageVo.empty()); |
|
|
|
|
|
} |
|
|
|
|
|
return projectEarlyWarning; |
|
|
|
|
|
} |
|
|
} |
|
|
} |