|
|
@@ -108,7 +108,7 @@ public class WorkbenchManage { |
|
|
|
}, ForkJoinPool.commonPool()), |
|
|
|
CompletableFuture.runAsync(() -> { |
|
|
|
//4.项目预警记录 |
|
|
|
res.setProjectEarlyWarning(getProjectEarlyWarning()); |
|
|
|
res.setProjectEarlyWarning(getProjectEarlyWarning(user)); |
|
|
|
}, ForkJoinPool.commonPool()) |
|
|
|
).join(); |
|
|
|
|
|
|
@@ -122,17 +122,31 @@ public class WorkbenchManage { |
|
|
|
return res; |
|
|
|
} |
|
|
|
|
|
|
|
private WorkbenchVO.ProjectEarlyWarning getProjectEarlyWarning() { |
|
|
|
private WorkbenchVO.ProjectEarlyWarning getProjectEarlyWarning(UserFullInfoDTO user) { |
|
|
|
WorkbenchVO.ProjectEarlyWarning projectEarlyWarning = new WorkbenchVO.ProjectEarlyWarning(); |
|
|
|
|
|
|
|
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class) |
|
|
|
.eq(Project::getNewest, Boolean.TRUE) |
|
|
|
.eq(user.getRegionAdmin(),Project::getAreaCode,user.getRegionCode()) |
|
|
|
.eq(user.getIsOrgAdmin() || user.notAdmin(),Project::getBuildOrgCode,user.getEmpPosUnitCode())); |
|
|
|
Set<String> projectCodeS = Sets.newHashSet(); |
|
|
|
Map<String,String> projectNameMap = projects.stream() |
|
|
|
.filter(p -> projectCodeS.add(p.getProjectCode())) |
|
|
|
.collect(Collectors.toMap(Project::getProjectCode,Project::getProjectName)); |
|
|
|
|
|
|
|
//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))); |
|
|
|
.or(q2 -> q2.isNull(WflowEarlyWarningRecords::getNoticeType)) |
|
|
|
.eq(user.getRegionAdmin(),WflowEarlyWarningRecords::getAreaCode,user.getRegionCode()) |
|
|
|
.eq(user.getIsOrgAdmin() || user.notAdmin(),WflowEarlyWarningRecords::getBuildOrgCode,user.getEmpPosUnitCode())); |
|
|
|
accumulate.setOver(overCount.intValue()); |
|
|
|
Long adventCount = earlyWarningRecordsService.count(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) |
|
|
|
.eq(WflowEarlyWarningRecords::getNoticeType, WarningNoticeTypeEnum.ADVENT.getCode())); |
|
|
|
.eq(WflowEarlyWarningRecords::getNoticeType, WarningNoticeTypeEnum.ADVENT.getCode()) |
|
|
|
.eq(user.getRegionAdmin(),WflowEarlyWarningRecords::getAreaCode,user.getRegionCode()) |
|
|
|
.eq(user.getIsOrgAdmin() || user.notAdmin(),WflowEarlyWarningRecords::getBuildOrgCode,user.getEmpPosUnitCode())); |
|
|
|
accumulate.setAdvent(adventCount.intValue()); |
|
|
|
projectEarlyWarning.setAccumulate(accumulate); |
|
|
|
|
|
|
@@ -143,13 +157,19 @@ public class WorkbenchManage { |
|
|
|
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()); |
|
|
|
.eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.OVER_TIME.name()) |
|
|
|
.eq(user.getRegionAdmin(),ProjectEarlyWarning::getAreaCode,user.getRegionCode()) |
|
|
|
.eq(user.getIsOrgAdmin() || user.notAdmin(),ProjectEarlyWarning::getBuildOrgCode,user.getEmpPosUnitCode()); |
|
|
|
projectEarlyWarningService.page(overPage,overWrapper); |
|
|
|
LambdaQueryWrapper<ProjectEarlyWarning> adventWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) |
|
|
|
.eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.ADVENT_TIME.name()); |
|
|
|
.eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.ADVENT_TIME.name()) |
|
|
|
.eq(user.getRegionAdmin(),ProjectEarlyWarning::getAreaCode,user.getRegionCode()) |
|
|
|
.eq(user.getIsOrgAdmin() || user.notAdmin(),ProjectEarlyWarning::getBuildOrgCode,user.getEmpPosUnitCode()); |
|
|
|
projectEarlyWarningService.page(adventPage,adventWrapper); |
|
|
|
LambdaQueryWrapper<ProjectEarlyWarning> normalWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) |
|
|
|
.eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.NORMAL.name()); |
|
|
|
.eq(ProjectEarlyWarning::getStatus, ProjectEarlyWarningStatusEnum.NORMAL.name()) |
|
|
|
.eq(user.getRegionAdmin(),ProjectEarlyWarning::getAreaCode,user.getRegionCode()) |
|
|
|
.eq(user.getIsOrgAdmin() || user.notAdmin(),ProjectEarlyWarning::getBuildOrgCode,user.getEmpPosUnitCode()); |
|
|
|
projectEarlyWarningService.page(normalPage,normalWrapper); |
|
|
|
|
|
|
|
WorkbenchVO.WarningStatistics cuurent = new WorkbenchVO.WarningStatistics(); |
|
|
@@ -162,6 +182,8 @@ public class WorkbenchManage { |
|
|
|
projectEarlyWarning.setCurrent(cuurent); |
|
|
|
|
|
|
|
List<WflowEarlyWarningRecords> warningRecords = earlyWarningRecordsService.list(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) |
|
|
|
.eq(user.getRegionAdmin(),WflowEarlyWarningRecords::getAreaCode,user.getRegionCode()) |
|
|
|
.eq(user.getIsOrgAdmin() || user.notAdmin(),WflowEarlyWarningRecords::getBuildOrgCode,user.getEmpPosUnitCode()) |
|
|
|
.orderByDesc(WflowEarlyWarningRecords::getWarningTime)); |
|
|
|
Set<String> projectCodeSet = Sets.newHashSet(); |
|
|
|
Map<String, WflowEarlyWarningRecords> warningMap = warningRecords.stream() |
|
|
@@ -183,6 +205,7 @@ public class WorkbenchManage { |
|
|
|
vo.setBatchEmployees(record.getBatchEmployees()); |
|
|
|
vo.setRecordId(record.getId()); |
|
|
|
} |
|
|
|
vo.setProjectName(projectNameMap.get(o.getProjectCode())); |
|
|
|
return vo; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
projectEarlyWarning.setOvers(PageVo.of(overVos,overPage.getTotal())); |
|
|
@@ -205,6 +228,7 @@ public class WorkbenchManage { |
|
|
|
vo.setBatchEmployees(record.getBatchEmployees()); |
|
|
|
vo.setRecordId(record.getId()); |
|
|
|
} |
|
|
|
vo.setProjectName(projectNameMap.get(o.getProjectCode())); |
|
|
|
return vo; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
projectEarlyWarning.setAdvents(PageVo.of(adventVos,adventPage.getTotal())); |
|
|
@@ -227,6 +251,7 @@ public class WorkbenchManage { |
|
|
|
vo.setBatchEmployees(record.getBatchEmployees()); |
|
|
|
vo.setRecordId(record.getId()); |
|
|
|
} |
|
|
|
vo.setProjectName(projectNameMap.get(o.getProjectCode())); |
|
|
|
return vo; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
projectEarlyWarning.setNormals(PageVo.of(normalVos,normalPage.getTotal())); |
|
|
|