PoffyZhang 10 months ago
parent
commit
acc06ff2d7
3 changed files with 40 additions and 16 deletions
  1. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java
  2. +6
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java
  3. +33
    -12
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningProjectTask.java

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectRenewalFundManage.java View File

@@ -381,7 +381,7 @@ public class ProjectRenewalFundManage {
}

//判断金额
// checkPaymentAmount(projectCode,projectYear,dto.getAnnualPaymentAmount());
checkPaymentAmount(projectCode,projectYear,dto.getAnnualPaymentAmount());

declaration.setApprovalStatus(ProjectRenewalApprovalStatusEnum.PENDING.name());
if(Objects.nonNull(project)){


+ 6
- 3
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningInstanceNotStartTask.java View File

@@ -231,7 +231,8 @@ public class EarlyWarningInstanceNotStartTask {
List<Integer> noticeTypes = noticeMap.get(needToWaringProject.getProjectCode());
for(Integer noticeType : noticeTypes) {
for (String employeeCode : batchEmployees) {
earlyWarningManage.doEarlyWarning(noticeMethod, Objects.nonNull(noticeType) && noticeType.equals(1) ? noticeContent : adventContent, time, biz,
earlyWarningManage.doEarlyWarning(noticeMethod, Objects.nonNull(noticeType) && noticeType.equals(1) ? noticeContent : adventContent,
Objects.nonNull(noticeType) && noticeType.equals(1) ? time : adventTime, biz,
needToWaringProject.getUpdateOn(),employeeCode, needToWaringProject,
WarningRuleTypeEnum.DECLARED_WARNING.getCode(), noticeType, path, batchEmployeesStr,null);
}
@@ -383,7 +384,8 @@ public class EarlyWarningInstanceNotStartTask {
if(noticeMap.containsKey(needToWaringProject.getProjectCode())){
List<Integer> noticeTypes = noticeMap.get(needToWaringProject.getProjectCode());
for(Integer noticeType : noticeTypes){
earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&&noticeType.equals(1) ? noticeContent : adventContent,time,biz,
earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&&noticeType.equals(1) ? noticeContent : adventContent,
Objects.nonNull(noticeType) && noticeType.equals(1) ? time : adventTime,biz,
needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject,
WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeType,path,employeeCode,null);
}
@@ -498,7 +500,8 @@ public class EarlyWarningInstanceNotStartTask {
if(noticeTypeMap.containsKey(needToWaringProject.getProjectCode())){
List<Integer> noticeTypes = noticeTypeMap.get(needToWaringProject.getProjectCode());
for(Integer noticeType : noticeTypes){
earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&&noticeType.equals(1) ? noticeContent : adventContent,time,null,
earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&&noticeType.equals(1) ? noticeContent : adventContent,
Objects.nonNull(noticeType) && noticeType.equals(1) ? time : adventTime,null,
needToWaringProject.getUpdateOn(),user.getEmployeeCode(),project,
WarningRuleTypeEnum.RENEWAL_FUND.getCode(),noticeType,path,employeesStr,needToWaringProject.getId().toString());
}


+ 33
- 12
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/EarlyWarningProjectTask.java View File

@@ -3,6 +3,7 @@ package com.ningdatech.pmapi.scheduler.task;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.StopWatch;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Sets;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectRenewalApprovalStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.WarningFlowTypeEnum;
@@ -29,7 +30,9 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;

/**
@@ -74,6 +77,10 @@ public class EarlyWarningProjectTask {
log.info("=========== 预警项目维度任务结束 耗时{}s", stopWatch.getTotalTimeSeconds());
return;
}

Set<String> projectSet = Sets.newHashSet();
Map<String, Project> projectMap = projects.stream().filter(p -> projectSet.add(p.getProjectCode()))
.collect(Collectors.toMap(Project::getProjectCode, p -> p));
List<ProjectEarlyWarning> warnings = projectEarlyWarningService.list();
List<String> warningProjectCodes = warnings.stream().map(ProjectEarlyWarning::getProjectCode)
.collect(Collectors.toList());
@@ -105,7 +112,17 @@ public class EarlyWarningProjectTask {
projectEarlyWarningService.saveBatch(toAdd);
}

//2.去查询 各个报警 是否已经正常
//2.删除 已经不存在的项目
List<ProjectEarlyWarning> toRemove = warnings.stream()
.filter(w -> !projectMap.containsKey(w.getProjectCode()))
.collect(Collectors.toList());
if(CollUtil.isNotEmpty(toRemove)){
List<Long> removeIds = toRemove.stream().map(ProjectEarlyWarning::getId)
.collect(Collectors.toList());
projectEarlyWarningService.removeBatchByIds(removeIds);
}

//3.去查询 各个报警 是否已经正常
List<ProjectEarlyWarning> trueWarnings = warnings.stream().filter(w -> Objects.nonNull(w.getNormal()) && !w.getNormal()).collect(Collectors.toList());
if(CollUtil.isEmpty(trueWarnings)){
log.info("没有异常的项目 要去查询");
@@ -113,36 +130,40 @@ public class EarlyWarningProjectTask {
log.info("=========== 预警项目维度任务结束 耗时{}s", stopWatch.getTotalTimeSeconds());
return;
}
//2.1 预警预警 如果正常了 要改会正常
checkNormal(trueWarnings);

stopWatch.stop();
log.info("=========== 预警项目维度任务结束 耗时{}s", stopWatch.getTotalTimeSeconds());
}

//3.去查询 各个报警 是否已经正常
private void checkNormal(List<ProjectEarlyWarning> trueWarnings) {
//3.1 预警预警 如果正常了 要改会正常
List<ProjectEarlyWarning> processWarning = trueWarnings.stream().filter(w -> Objects.nonNull(w.getProcessWarning())
&& w.getProcessWarning())
.collect(Collectors.toList());
checkProcessWarning(processWarning);

//2.2 填报预警 如果正常了 要改会正常
//3.2 填报预警 如果正常了 要改会正常
List<ProjectEarlyWarning> declaredWarning = trueWarnings.stream().filter(w ->
Objects.nonNull(w.getDeclaredWarning())
&& w.getDeclaredWarning())
&& w.getDeclaredWarning())
.collect(Collectors.toList());
checkDeclaredWarning(declaredWarning);

//2.3 实施预警 如果正常了 要改会正常
//3.3 实施预警 如果正常了 要改会正常
List<ProjectEarlyWarning> operationWarning = trueWarnings.stream().filter(w ->
Objects.nonNull(w.getOperationWarning())
&& w.getOperationWarning())
&& w.getOperationWarning())
.collect(Collectors.toList());
checkOperationWarning(operationWarning);

//2.4 续建资金预警 如果正常了 要改会正常
//3.4 续建资金预警 如果正常了 要改回正常
List<ProjectEarlyWarning> renewalFundWarning = trueWarnings.stream().filter(w ->
Objects.nonNull(w.getRenewalFundWarning())
&& w.getRenewalFundWarning())
&& w.getRenewalFundWarning())
.collect(Collectors.toList());
checkRenewalFundWarning(renewalFundWarning);


stopWatch.stop();
log.info("=========== 预警项目维度任务结束 耗时{}s", stopWatch.getTotalTimeSeconds());
}

private void checkRenewalFundWarning(List<ProjectEarlyWarning> renewalFundWarnings) {


Loading…
Cancel
Save