@@ -19,6 +19,43 @@ import java.math.BigDecimal; | |||
@NoArgsConstructor | |||
public class DataDTO { | |||
public static DataDTO of(String name,Integer num){ | |||
DataDTO dataDTO = new DataDTO(); | |||
dataDTO.setName(name); | |||
dataDTO.setNum(num); | |||
return dataDTO; | |||
} | |||
public static DataDTO of(String name,String code,Integer num){ | |||
DataDTO dataDTO = new DataDTO(); | |||
dataDTO.setName(name); | |||
dataDTO.setCode(code); | |||
dataDTO.setNum(num); | |||
return dataDTO; | |||
} | |||
public static DataDTO of(String name,BigDecimal amount){ | |||
DataDTO dataDTO = new DataDTO(); | |||
dataDTO.setName(name); | |||
dataDTO.setAmount(amount); | |||
return dataDTO; | |||
} | |||
public static DataDTO of(String name,String code,BigDecimal amount){ | |||
DataDTO dataDTO = new DataDTO(); | |||
dataDTO.setName(name); | |||
dataDTO.setCode(code); | |||
dataDTO.setAmount(amount); | |||
return dataDTO; | |||
} | |||
public static DataDTO ofRate(String name,BigDecimal rate){ | |||
DataDTO dataDTO = new DataDTO(); | |||
dataDTO.setName(name); | |||
dataDTO.setRate(rate); | |||
return dataDTO; | |||
} | |||
@ApiModelProperty("编号") | |||
private String code; | |||
@@ -7,14 +7,19 @@ import com.google.common.collect.Lists; | |||
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; | |||
import com.ningdatech.pmapi.common.model.entity.DataDTO; | |||
import com.ningdatech.pmapi.dashboard.model.vo.EarlyWarningStatisticsVO; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.enumeration.WarningFlowTypeEnum; | |||
import com.ningdatech.pmapi.projectlib.enumeration.WarningOperationTypeEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords; | |||
import com.ningdatech.pmapi.sys.service.IEarlyWarningRecordsService; | |||
import com.ningdatech.pmapi.sys.utils.EarlyWarningUtil; | |||
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import com.wflow.enums.WarningNoticeTypeEnum; | |||
import com.wflow.enums.WarningRuleTypeEnum; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
@@ -48,6 +53,8 @@ public class EarlyWarningStatisticsManage { | |||
private final IProjectInstService projectInstService; | |||
private final IProjectService projectService; | |||
private final TaskService taskService; | |||
private static final List<Integer> threeYears = Lists.newArrayList(LocalDateTime.now().getYear() - 2, | |||
@@ -95,32 +102,104 @@ public class EarlyWarningStatisticsManage { | |||
//当前各流程报警数 | |||
List<DataDTO> alarmsFlowsNow = Lists.newArrayList(); | |||
for(ProjectProcessStageEnum stageEnum : ProjectProcessStageEnum.values()){ | |||
DataDTO flowData = new DataDTO(); | |||
String processName = stageEnum.getDesc(); | |||
Integer processType = stageEnum.getCode(); | |||
flowData.setName(processName); | |||
flowData.setCode(processType.toString()); | |||
flowData.setNum(computeFlowWarningNow(processType,records)); | |||
alarmsFlowsNow.add(flowData); | |||
alarmsFlowsNow.add(DataDTO.of(processName,computeFlowWarningNow(processType,records))); | |||
} | |||
res.setAlarmsFlowsNow(alarmsFlowsNow); | |||
//当前各填报报警数 | |||
List<DataDTO> alarmsFillingNow = Lists.newArrayList(); | |||
for(WarningFlowTypeEnum fillingEnum : WarningFlowTypeEnum.values()){ | |||
DataDTO fillingData = new DataDTO(); | |||
String processName = fillingEnum.getDesc(); | |||
Integer processType = fillingEnum.getCode(); | |||
fillingData.setName(processName); | |||
fillingData.setCode(processType.toString()); | |||
fillingData.setNum(computeFlowWarningNow(processType,records)); | |||
alarmsFillingNow.add(fillingData); | |||
Integer projectStutas = fillingEnum.getProjectStutas(); | |||
alarmsFillingNow.add(DataDTO.of(processName,computeFillingNow(projectStutas,records))); | |||
} | |||
res.setAlarmsFillingNow(alarmsFillingNow); | |||
//实施预警 | |||
List<DataDTO> alarmsConstruction = Lists.newArrayList(); | |||
for(WarningNoticeTypeEnum noticeTypeEnum : WarningNoticeTypeEnum.values()){ | |||
String name = noticeTypeEnum.getDesc(); | |||
Integer noticeType = noticeTypeEnum.getCode(); | |||
alarmsConstruction.add(DataDTO.of(name,computeConstruction(noticeType,records))); | |||
} | |||
res.setConstructionAlarms(alarmsConstruction); | |||
//安全监测 | |||
List<DataDTO> safetyMonitoring = Lists.newArrayList(); | |||
//--1 安全设计 | |||
safetyMonitoring.add(DataDTO.of("安全设计",0)); | |||
//--2 安全投入低于5% | |||
safetyMonitoring.add(DataDTO.of("安全投入低于5%",0)); | |||
//--3 非信创 | |||
safetyMonitoring.add(DataDTO.of("非信创",0)); | |||
//--4 等保未做 | |||
safetyMonitoring.add(DataDTO.of("等保未做",0)); | |||
//--5 密评未做 | |||
safetyMonitoring.add(DataDTO.of("密评未做",0)); | |||
res.setSafetyMonitoring(safetyMonitoring); | |||
return res; | |||
} | |||
private Integer computeConstruction(Integer noticeType, List<WflowEarlyWarningRecords> records) { | |||
//终验告警 | |||
List<WflowEarlyWarningRecords> constructionRecords = records.stream().filter(r -> { | |||
if (Objects.nonNull(r.getRuleType()) && | |||
WarningRuleTypeEnum.OPERATION_WARNING.getCode().equals(r.getRuleType())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).filter(r -> Objects.nonNull(r.getNoticeType()) && r.getNoticeType().equals(noticeType) && | |||
WarningOperationTypeEnum.ZHONGYAN.getCode().equals(r.getBiz())) | |||
.collect(Collectors.toList()); | |||
if(CollUtil.isEmpty(constructionRecords)){ | |||
return 0; | |||
} | |||
Map<String, List<WflowEarlyWarningRecords>> recordsMap = constructionRecords.stream().collect(Collectors.groupingBy( | |||
WflowEarlyWarningRecords::getProjectCode)); | |||
//待终验的项目 | |||
List<Project> tobeFinalProjects = projectService.list(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.eq(Project::getStatus, ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode())); | |||
return tobeFinalProjects.stream().filter(p -> { | |||
if(recordsMap.containsKey(p.getProjectCode())){ | |||
//这个状态有告警 并且 这个项目也是这个类型 | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size(); | |||
} | |||
private Integer computeFillingNow(Integer projectStutas, List<WflowEarlyWarningRecords> records) { | |||
List<WflowEarlyWarningRecords> fillingRecords = records.stream().filter(r -> { | |||
if (Objects.nonNull(r.getRuleType()) && | |||
WarningRuleTypeEnum.DECLARED_WARNING.getCode().equals(r.getRuleType())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).filter(r -> Objects.nonNull(r.getNodeId())).collect(Collectors.toList()); | |||
if(CollUtil.isEmpty(fillingRecords)){ | |||
return 0; | |||
} | |||
Map<String, List<WflowEarlyWarningRecords>> warningMap = fillingRecords.stream() | |||
.collect(Collectors.groupingBy(WflowEarlyWarningRecords::getProjectCode)); | |||
List<Project> thisStatusProjects = projectService.list(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.eq(Project::getStatus, projectStutas)); | |||
return thisStatusProjects.stream().filter(p -> { | |||
if(warningMap.containsKey(p.getProjectCode())){ | |||
//这个状态有告警 并且 这个项目也是这个类型 | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size(); | |||
} | |||
//计算某个流程当前正在告警的数量 | |||
private Integer computeFlowWarningNow(Integer processType,List<WflowEarlyWarningRecords> records) { | |||
List<WflowEarlyWarningRecords> processRecords = records.stream().filter(r -> { | |||
@@ -145,16 +145,13 @@ public class ExpertStatisticsManage { | |||
private void threeYearsCompleteExpert(ExpertStatisticsVO res,List<ExpertUserFullInfo> experts) { | |||
List<DataDTO> threeYearsAdds = Lists.newArrayList(); | |||
for (Integer year : threeYears){ | |||
DataDTO expert = new DataDTO(); | |||
expert.setName(year.toString()); | |||
expert.setCode(year.toString()); | |||
expert.setNum(experts.stream().filter(e -> { | |||
if (Objects.nonNull(e.getCreateOn()) && year.equals(e.getCreateOn().getYear())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size()); | |||
threeYearsAdds.add(expert); | |||
threeYearsAdds.add(DataDTO.of(year.toString(),year.toString(), | |||
experts.stream().filter(e -> { | |||
if (Objects.nonNull(e.getCreateOn()) && year.equals(e.getCreateOn().getYear())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size())); | |||
} | |||
res.setThreeYearsAdded(threeYearsAdds); | |||
} | |||
@@ -217,19 +214,17 @@ public class ExpertStatisticsManage { | |||
Map<String, List<ExpertDictionary>> dictionaryMap = expertDictionaries.stream() | |||
.collect(Collectors.groupingBy(ExpertDictionary::getDictionaryCode)); | |||
for(String levelCode : LEVELS){ | |||
DataDTO expertData = new DataDTO(); | |||
int num = 0; | |||
if(dictionaryMap.containsKey(levelCode)){ | |||
List<ExpertDictionary> dictionaries = dictionaryMap.get(levelCode); | |||
expertData.setNum(dictionaries.stream().filter(d -> { | |||
if(expertUserFullInfoMap.containsKey(d.getUserId())){ | |||
num = dictionaries.stream().filter(d -> { | |||
if (expertUserFullInfoMap.containsKey(d.getUserId())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size()); | |||
}).collect(Collectors.toList()).size(); | |||
} | |||
expertData.setName(dictionMap.get(levelCode)); | |||
expertData.setCode(levelCode); | |||
levels.add(expertData); | |||
levels.add(DataDTO.of(dictionMap.get(levelCode),levelCode,num)); | |||
} | |||
res.setLevels(levels); | |||
@@ -252,19 +247,17 @@ public class ExpertStatisticsManage { | |||
Map<String, List<ExpertDictionary>> dictionaryMap = expertDictionaries.stream() | |||
.collect(Collectors.groupingBy(ExpertDictionary::getDictionaryCode)); | |||
for(String typeCode : TYPES){ | |||
DataDTO expertData = new DataDTO(); | |||
int num = 0; | |||
if(dictionaryMap.containsKey(typeCode)){ | |||
List<ExpertDictionary> dictionaries = dictionaryMap.get(typeCode); | |||
expertData.setNum(dictionaries.stream().filter(d -> { | |||
num = dictionaries.stream().filter(d -> { | |||
if(expertUserFullInfoMap.containsKey(d.getUserId())){ | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size()); | |||
}).collect(Collectors.toList()).size(); | |||
} | |||
expertData.setName(dictionMap.get(typeCode)); | |||
expertData.setCode(typeCode); | |||
types.add(expertData); | |||
types.add(DataDTO.of(dictionMap.get(typeCode),typeCode,num)); | |||
} | |||
res.setTypes(types); | |||
@@ -316,37 +309,32 @@ public class ExpertStatisticsManage { | |||
* @return | |||
*/ | |||
private static DataDTO getExpertData(Map<Long, ExpertUserFullInfo> expertUserFullInfoMap, Map<String, List<ExpertTag>> tagsMap, Map<String, String> tagNameMap, String code) { | |||
DataDTO data = new DataDTO(); | |||
data.setCode(code); | |||
data.setName(tagNameMap.get(code)); | |||
int num = 0; | |||
if(tagsMap.containsKey(code)){ | |||
List<ExpertTag> ets = tagsMap.get(code); | |||
data.setNum(ets.stream().filter(e -> { | |||
num = ets.stream().filter(e -> { | |||
if(expertUserFullInfoMap.containsKey(e.getUserId())){ | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size()); | |||
}).collect(Collectors.toList()).size(); | |||
} | |||
return data; | |||
return DataDTO.of(tagNameMap.get(code),code,num); | |||
} | |||
//计算区域专家 | |||
private static void computeRegionExperts(ExpertStatisticsVO res, List<ExpertIntentionWorkRegion> intentionWorkRegions, Map<Long, ExpertUserFullInfo> expertMap, List<RegionDTO> regions) { | |||
List<DataDTO> regionExpert = Lists.newArrayList(); | |||
for(RegionDTO region : regions){ | |||
DataDTO expertData = new DataDTO(); | |||
expertData.setName(region.getRegionName()); | |||
expertData.setCode(region.getRegionCode()); | |||
expertData.setNum(intentionWorkRegions.stream().filter(w -> { | |||
if(Objects.nonNull(w) && Objects.nonNull(w.getRegionCode()) && | |||
w.getRegionCode().equals(region.getRegionCode()) && | |||
expertMap.containsKey(w.getUserId())){ | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size()); | |||
regionExpert.add(expertData); | |||
regionExpert.add(DataDTO.of(region.getRegionName(),region.getRegionCode(), | |||
intentionWorkRegions.stream().filter(w -> { | |||
if(Objects.nonNull(w) && Objects.nonNull(w.getRegionCode()) && | |||
w.getRegionCode().equals(region.getRegionCode()) && | |||
expertMap.containsKey(w.getUserId())){ | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size())); | |||
} | |||
res.setRegionExpert(regionExpert); | |||
} | |||
@@ -98,37 +98,27 @@ public class MeetingStatisticsManage { | |||
.sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); | |||
List<DataDTO> regionMeetngs = Lists.newArrayList(); | |||
for(RegionDTO region : regions){ | |||
DataDTO data = new DataDTO(); | |||
data.setCode(region.getRegionCode()); | |||
data.setName(region.getRegionName()); | |||
data.setNum(meetings.stream().filter(m -> { | |||
regionMeetngs.add(DataDTO.of(region.getRegionName(),region.getRegionCode(),meetings.stream().filter(m -> { | |||
if(StringUtils.isNotBlank(m.getRegionCode()) && | |||
m.getRegionCode().equals(region.getRegionCode())){ | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size()); | |||
regionMeetngs.add(data); | |||
}).collect(Collectors.toList()).size())); | |||
} | |||
res.setRegionMeetings(regionMeetngs); | |||
//预审 验收 会议 | |||
List<DataDTO> meetingTypes = Lists.newArrayList(); | |||
DataDTO yushen = new DataDTO(); | |||
yushen.setCode(ReviewTemplateTypeEnum.PRELIMINARY_SCHEME_REVIEW.getCode().toString()); | |||
yushen.setName("预审会议"); | |||
yushen.setNum(meetings.stream().filter(m -> { | |||
if(StringUtils.isNotBlank(m.getType()) && | |||
m.getType().equals(ReviewTemplateTypeEnum.PRELIMINARY_SCHEME_REVIEW.getCode() | |||
.toString())){ | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size()); | |||
meetingTypes.add(yushen); | |||
DataDTO yanshou = new DataDTO(); | |||
yanshou.setCode(ReviewTemplateTypeEnum.ACCEPTANCE_SCHEME_REVIEW.getCode().toString()); | |||
yanshou.setName("验收会议"); | |||
meetingTypes.add(DataDTO.of("预审会议",ReviewTemplateTypeEnum.PRELIMINARY_SCHEME_REVIEW.getCode().toString(), | |||
meetings.stream().filter(m -> { | |||
if(StringUtils.isNotBlank(m.getType()) && | |||
m.getType().equals(ReviewTemplateTypeEnum.PRELIMINARY_SCHEME_REVIEW.getCode() | |||
.toString())){ | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size())); | |||
Long yanshouCount = meetings.stream().filter(m -> { | |||
if (StringUtils.isNotBlank(m.getType()) && | |||
m.getType().equals(ReviewTemplateTypeEnum.ACCEPTANCE_SCHEME_REVIEW.getCode() | |||
@@ -137,8 +127,8 @@ public class MeetingStatisticsManage { | |||
} | |||
return Boolean.FALSE; | |||
}).count(); | |||
yanshou.setNum(yanshouCount.intValue()); | |||
meetingTypes.add(yanshou); | |||
meetingTypes.add(DataDTO.of("验收会议",ReviewTemplateTypeEnum.ACCEPTANCE_SCHEME_REVIEW.getCode().toString(), | |||
yanshouCount.intValue())); | |||
res.setMeetingTypes(meetingTypes); | |||
//各区县评审 不通过率 | |||
@@ -6,7 +6,6 @@ import com.google.common.collect.Lists; | |||
import com.ningdatech.pmapi.common.model.entity.DataDTO; | |||
import com.ningdatech.pmapi.dashboard.constant.DashboardConstant; | |||
import com.ningdatech.pmapi.dashboard.model.vo.CostStatisticsVO; | |||
import com.ningdatech.pmapi.expert.service.IExpertReviewService; | |||
import com.ningdatech.pmapi.meeting.entity.domain.Meeting; | |||
import com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert; | |||
import com.ningdatech.pmapi.meeting.service.IMeetingExpertService; | |||
@@ -33,8 +32,6 @@ import java.util.stream.Collectors; | |||
@Slf4j | |||
public class ProjectCostStatisticsManage { | |||
private final IExpertReviewService expertReviewService; | |||
private final IMeetingExpertService meetingExpertService; | |||
private final IMeetingService meetingService; | |||
@@ -69,8 +66,6 @@ public class ProjectCostStatisticsManage { | |||
BigDecimal reviewTwoYearTotal = BigDecimal.ZERO; | |||
BigDecimal pricingTwoYearTotal = BigDecimal.ZERO; | |||
for(Integer thisYear : thisTwoYears){ | |||
DataDTO reviewData = new DataDTO(); | |||
DataDTO pricingData = new DataDTO(); | |||
//查出 年份的 会议数据 | |||
List<Meeting> yearMeetings = meetings.stream().filter(m -> { | |||
if(Objects.nonNull(m.getStartTime()) && | |||
@@ -86,13 +81,9 @@ public class ProjectCostStatisticsManage { | |||
if(CollUtil.isNotEmpty(yearMeetingIds)){ | |||
yearMeetingExperts = meetingExpertService.listAgreedExperts(yearMeetingIds); | |||
} | |||
reviewData.setName(thisYear.toString()); | |||
reviewData.setAmount(reviewAoumtExpert.multiply(BigDecimal | |||
.valueOf(yearMeetingExperts.size()))); | |||
pricingData.setName(thisYear.toString()); | |||
twoYearsReviews.add(reviewData); | |||
twoYearsPricing.add(pricingData); | |||
twoYearsReviews.add(DataDTO.of(thisYear.toString(),reviewAoumtExpert.multiply(BigDecimal | |||
.valueOf(yearMeetingExperts.size())))); | |||
twoYearsPricing.add(DataDTO.of(thisYear.toString(),BigDecimal.ZERO)); | |||
reviewTwoYearTotal = reviewTwoYearTotal.add(reviewAoumtExpert.multiply(BigDecimal | |||
.valueOf(yearMeetingExperts.size()))); | |||
@@ -396,7 +396,7 @@ public class ProjectRenewalFundManage { | |||
} | |||
//判断金额 | |||
// checkPaymentAmount(projectCode,projectYear,dto.getAnnualPaymentAmount()); | |||
checkPaymentAmount(projectCode,projectYear,dto.getAnnualPaymentAmount()); | |||
declaration.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PENDING.name()); | |||
if(Objects.nonNull(project)){ | |||