Browse Source

工作台 预警 催办 处理

tags/24080901
PoffyZhang 1 year ago
parent
commit
b1da9ae6e2
3 changed files with 42 additions and 7 deletions
  1. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/ProjectEarlyWarningVO.java
  2. +7
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java
  3. +32
    -7
      pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/ProjectEarlyWarningVO.java View File

@@ -34,6 +34,9 @@ public class ProjectEarlyWarningVO implements Serializable {
@ApiModelProperty(value = "项目编码") @ApiModelProperty(value = "项目编码")
private String projectCode; private String projectCode;


@ApiModelProperty(value = "项目名称")
private String projectName;

@ApiModelProperty(value = "区域") @ApiModelProperty(value = "区域")
private String areaCode; private String areaCode;




+ 7
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java View File

@@ -128,4 +128,11 @@ public class UserFullInfoDTO {
} }
return Boolean.FALSE; return Boolean.FALSE;
} }

public Boolean notAdmin() {
if(!getSuperAdmin() && !getRegionAdmin() && !getIsOrgAdmin()){
return Boolean.TRUE;
}
return Boolean.FALSE;
}
} }

+ 32
- 7
pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java View File

@@ -108,7 +108,7 @@ public class WorkbenchManage {
}, ForkJoinPool.commonPool()), }, ForkJoinPool.commonPool()),
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
//4.项目预警记录 //4.项目预警记录
res.setProjectEarlyWarning(getProjectEarlyWarning());
res.setProjectEarlyWarning(getProjectEarlyWarning(user));
}, ForkJoinPool.commonPool()) }, ForkJoinPool.commonPool())
).join(); ).join();


@@ -122,17 +122,31 @@ public class WorkbenchManage {
return res; return res;
} }


private WorkbenchVO.ProjectEarlyWarning getProjectEarlyWarning() {
private WorkbenchVO.ProjectEarlyWarning getProjectEarlyWarning(UserFullInfoDTO user) {
WorkbenchVO.ProjectEarlyWarning projectEarlyWarning = new WorkbenchVO.ProjectEarlyWarning(); 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 //4.1
//累积预警统计 //累积预警统计
WorkbenchVO.WarningStatistics accumulate = new WorkbenchVO.WarningStatistics(); WorkbenchVO.WarningStatistics accumulate = new WorkbenchVO.WarningStatistics();
Long overCount = earlyWarningRecordsService.count(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) Long overCount = earlyWarningRecordsService.count(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class)
.eq(WflowEarlyWarningRecords::getNoticeType, WarningNoticeTypeEnum.OVER.getCode()) .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()); accumulate.setOver(overCount.intValue());
Long adventCount = earlyWarningRecordsService.count(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) 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()); accumulate.setAdvent(adventCount.intValue());
projectEarlyWarning.setAccumulate(accumulate); projectEarlyWarning.setAccumulate(accumulate);


@@ -143,13 +157,19 @@ public class WorkbenchManage {
Page<ProjectEarlyWarning> adventPage = Page.of(1,1000); Page<ProjectEarlyWarning> adventPage = Page.of(1,1000);
Page<ProjectEarlyWarning> normalPage = Page.of(1,1000); Page<ProjectEarlyWarning> normalPage = Page.of(1,1000);
LambdaQueryWrapper<ProjectEarlyWarning> overWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) 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); projectEarlyWarningService.page(overPage,overWrapper);
LambdaQueryWrapper<ProjectEarlyWarning> adventWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) 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); projectEarlyWarningService.page(adventPage,adventWrapper);
LambdaQueryWrapper<ProjectEarlyWarning> normalWrapper = Wrappers.lambdaQuery(ProjectEarlyWarning.class) 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); projectEarlyWarningService.page(normalPage,normalWrapper);


WorkbenchVO.WarningStatistics cuurent = new WorkbenchVO.WarningStatistics(); WorkbenchVO.WarningStatistics cuurent = new WorkbenchVO.WarningStatistics();
@@ -162,6 +182,8 @@ public class WorkbenchManage {
projectEarlyWarning.setCurrent(cuurent); projectEarlyWarning.setCurrent(cuurent);


List<WflowEarlyWarningRecords> warningRecords = earlyWarningRecordsService.list(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) 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)); .orderByDesc(WflowEarlyWarningRecords::getWarningTime));
Set<String> projectCodeSet = Sets.newHashSet(); Set<String> projectCodeSet = Sets.newHashSet();
Map<String, WflowEarlyWarningRecords> warningMap = warningRecords.stream() Map<String, WflowEarlyWarningRecords> warningMap = warningRecords.stream()
@@ -183,6 +205,7 @@ public class WorkbenchManage {
vo.setBatchEmployees(record.getBatchEmployees()); vo.setBatchEmployees(record.getBatchEmployees());
vo.setRecordId(record.getId()); vo.setRecordId(record.getId());
} }
vo.setProjectName(projectNameMap.get(o.getProjectCode()));
return vo; return vo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
projectEarlyWarning.setOvers(PageVo.of(overVos,overPage.getTotal())); projectEarlyWarning.setOvers(PageVo.of(overVos,overPage.getTotal()));
@@ -205,6 +228,7 @@ public class WorkbenchManage {
vo.setBatchEmployees(record.getBatchEmployees()); vo.setBatchEmployees(record.getBatchEmployees());
vo.setRecordId(record.getId()); vo.setRecordId(record.getId());
} }
vo.setProjectName(projectNameMap.get(o.getProjectCode()));
return vo; return vo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
projectEarlyWarning.setAdvents(PageVo.of(adventVos,adventPage.getTotal())); projectEarlyWarning.setAdvents(PageVo.of(adventVos,adventPage.getTotal()));
@@ -227,6 +251,7 @@ public class WorkbenchManage {
vo.setBatchEmployees(record.getBatchEmployees()); vo.setBatchEmployees(record.getBatchEmployees());
vo.setRecordId(record.getId()); vo.setRecordId(record.getId());
} }
vo.setProjectName(projectNameMap.get(o.getProjectCode()));
return vo; return vo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
projectEarlyWarning.setNormals(PageVo.of(normalVos,normalPage.getTotal())); projectEarlyWarning.setNormals(PageVo.of(normalVos,normalPage.getTotal()));


Loading…
Cancel
Save