|
@@ -7,7 +7,11 @@ import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.ningdatech.pmapi.common.enumeration.CommonEnum; |
|
|
import com.ningdatech.pmapi.common.enumeration.CommonEnum; |
|
|
import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; |
|
|
|
|
|
|
|
|
import com.ningdatech.pmapi.projectlib.enumeration.WarningFlowTypeEnum; |
|
|
|
|
|
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.wflow.bean.entity.WflowEarlyWarning; |
|
|
import com.wflow.bean.entity.WflowEarlyWarning; |
|
|
import com.wflow.enums.WarningRuleTypeEnum; |
|
|
import com.wflow.enums.WarningRuleTypeEnum; |
|
|
import com.wflow.service.IEarlyWarningService; |
|
|
import com.wflow.service.IEarlyWarningService; |
|
@@ -21,6 +25,7 @@ import java.net.InetAddress; |
|
|
import java.net.UnknownHostException; |
|
|
import java.net.UnknownHostException; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Objects; |
|
|
import java.util.Objects; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @author ZPF |
|
|
* @author ZPF |
|
@@ -37,6 +42,10 @@ public class EarlyWarningInstanceNotStartTask { |
|
|
|
|
|
|
|
|
private final IEarlyWarningService earlyWarningService; |
|
|
private final IEarlyWarningService earlyWarningService; |
|
|
|
|
|
|
|
|
|
|
|
private final IProjectService projectService; |
|
|
|
|
|
|
|
|
|
|
|
private final IProjectInstService projectInstService; |
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 2 * * * ?") |
|
|
@Scheduled(cron = "0 2 * * * ?") |
|
|
public void doTask() throws UnknownHostException { |
|
|
public void doTask() throws UnknownHostException { |
|
|
if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { |
|
|
if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { |
|
@@ -78,13 +87,26 @@ public class EarlyWarningInstanceNotStartTask { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
InstTypeEnum instTypeEnum = InstTypeEnum.getByCode(biz); |
|
|
|
|
|
if(Objects.isNull(instTypeEnum)){ |
|
|
|
|
|
|
|
|
WarningFlowTypeEnum flowTypeEnum = WarningFlowTypeEnum.getByCode(biz); |
|
|
|
|
|
if(Objects.isNull(flowTypeEnum)){ |
|
|
log.info("匹配不到 流程类型"); |
|
|
log.info("匹配不到 流程类型"); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//得出 对应待提交的项目状态 |
|
|
|
|
|
Integer projectStutas = flowTypeEnum.getProjectStutas(); |
|
|
|
|
|
String areaCode = warning.getAreaCode(); |
|
|
|
|
|
//测试先用分钟 |
|
|
|
|
|
//查询 所有这个区域的项目 未提交的项目 |
|
|
|
|
|
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class) |
|
|
|
|
|
.eq(Project::getAreaCode, areaCode) |
|
|
|
|
|
.eq(Project::getNewest, Boolean.TRUE) |
|
|
|
|
|
.eq(Project::getStatus,projectStutas)); |
|
|
|
|
|
List<Long> projectIds = projects.stream().map(Project::getId) |
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class) |
|
|
|
|
|
.in(ProjectInst::getProjectId,projectIds) |
|
|
|
|
|
.eq(ProjectInst::getInstType,biz)); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|