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 = "项目编码")
private String projectCode;

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

@ApiModelProperty(value = "区域")
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;
}

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()),
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()));


Loading…
Cancel
Save