|
|
|
|
@@ -27,6 +27,7 @@ import com.njcn.oss.constant.OssPath;
|
|
|
|
|
import com.njcn.oss.utils.FileStorageUtil;
|
|
|
|
|
import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto;
|
|
|
|
|
import com.njcn.process.api.FlowableDefineFeignClient;
|
|
|
|
|
import com.njcn.process.pojo.dto.ThsStrategyBindDTO;
|
|
|
|
|
import com.njcn.process.pojo.param.SuperviseParam;
|
|
|
|
|
import com.njcn.process.pojo.po.ThsOverRunLog;
|
|
|
|
|
import com.njcn.process.pojo.po.ThsSupervise;
|
|
|
|
|
@@ -58,6 +59,7 @@ import com.njcn.user.pojo.po.Dept;
|
|
|
|
|
import com.njcn.user.pojo.po.User;
|
|
|
|
|
import com.njcn.web.factory.PageFactory;
|
|
|
|
|
import com.njcn.web.utils.RequestUtil;
|
|
|
|
|
import liquibase.pro.packaged.S;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
|
|
@@ -77,6 +79,7 @@ import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
import java.util.zip.Adler32;
|
|
|
|
|
import java.util.zip.CheckedOutputStream;
|
|
|
|
|
import java.util.zip.ZipEntry;
|
|
|
|
|
@@ -167,15 +170,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
|
|
|
|
this.buildSuperviseName(thsSupervise, superviceRunLogVo.getOverRunLog(), dept);
|
|
|
|
|
this.save(thsSupervise);
|
|
|
|
|
//TODO 解决工作流写死问题
|
|
|
|
|
Map<String, Object> mapParam = new HashMap<>();
|
|
|
|
|
String proInId = "";
|
|
|
|
|
if (thsSupervise.getType() == 0) {
|
|
|
|
|
proInId = "flow_yzep99kb:1:a100b48b-da75-11ed-8335-b07b253cdad9";
|
|
|
|
|
} else {
|
|
|
|
|
proInId = "flow_yzep99kb:2:6358e099-dcba-11ed-8026-b07b253cdad9";
|
|
|
|
|
}
|
|
|
|
|
iFlowDefinitionService.startProcessInstanceById(proInId, thsSupervise.getSupIndex(), mapParam);
|
|
|
|
|
|
|
|
|
|
flowableRun(thsSupervise);
|
|
|
|
|
|
|
|
|
|
for (ThsOverRunLog thsOverRunLog : superviceRunLogVo.getOverRunLog()) {
|
|
|
|
|
thsOverRunLog.setCreateTime(date);
|
|
|
|
|
@@ -186,8 +181,6 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public HttpResult deleteSupervise(SuperviseDto superviseDto) {
|
|
|
|
|
@@ -256,7 +249,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
|
|
|
|
thsSupervise.setSupIndex(supIndex);
|
|
|
|
|
ThsSupervise thsSuperObj = thsSuperviseMapper.selectById(supIndex);
|
|
|
|
|
|
|
|
|
|
List<ThsOverRunLog> thsOverRunLogList = thsOverRunLogService.list(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex,supIndex));
|
|
|
|
|
List<ThsOverRunLog> thsOverRunLogList = thsOverRunLogService.list(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
|
|
|
|
|
|
|
|
|
|
if (files != null && files.length == 1) {
|
|
|
|
|
ThsOverRunLog thsOverRunLog = thsOverRunLogService.getById(id);
|
|
|
|
|
@@ -265,16 +258,31 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
|
|
|
|
this.updateSuperviesData(path, thsOverRunLog, ticketType, thsSupervise);
|
|
|
|
|
}
|
|
|
|
|
if (files != null && files.length > 1) {
|
|
|
|
|
if(files.length!=thsOverRunLogList.size()){
|
|
|
|
|
if (files.length != thsOverRunLogList.size()) {
|
|
|
|
|
throw new BusinessException("批量上传需保证报告数量与测点数量一致");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.batchUploadFile(thsSupervise, thsOverRunLogList, files, ticketType);
|
|
|
|
|
}
|
|
|
|
|
this.updateProcess(thsSupervise, ticketType, thsSuperObj.getType(),thsOverRunLogList,files.length);
|
|
|
|
|
this.updateProcess(thsSupervise, ticketType, thsSuperObj.getType(), thsOverRunLogList, files.length);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 执行流程
|
|
|
|
|
* @author cdf
|
|
|
|
|
* @date 2024/3/19
|
|
|
|
|
*/
|
|
|
|
|
private void flowableRun(ThsSupervise thsSupervise){
|
|
|
|
|
Map<String, Object> mapParam = new HashMap<>();
|
|
|
|
|
String proInId = "";
|
|
|
|
|
if (thsSupervise.getType() == 0) {
|
|
|
|
|
proInId = "flow_yzep99kb:1:a100b48b-da75-11ed-8335-b07b253cdad9";
|
|
|
|
|
} else {
|
|
|
|
|
proInId = "flow_yzep99kb:2:6358e099-dcba-11ed-8026-b07b253cdad9";
|
|
|
|
|
}
|
|
|
|
|
iFlowDefinitionService.startProcessInstanceById(proInId, thsSupervise.getSupIndex(), mapParam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -284,7 +292,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
|
|
|
|
* @param ticketType
|
|
|
|
|
* @param type
|
|
|
|
|
*/
|
|
|
|
|
private void updateProcess(ThsSupervise thsSupervise, Integer ticketType, Integer type,List<ThsOverRunLog> thsOverRunLogList,Integer uploadCount) {
|
|
|
|
|
private void updateProcess(ThsSupervise thsSupervise, Integer ticketType, Integer type, List<ThsOverRunLog> thsOverRunLogList, Integer uploadCount) {
|
|
|
|
|
TicketTypeEnum ticketTypeEnum = TicketTypeEnum.getTicketTypeEnumByCode(ticketType);
|
|
|
|
|
if (ticketTypeEnum == null) {
|
|
|
|
|
throw new BusinessException("上传单据参数类型错误!");
|
|
|
|
|
@@ -294,8 +302,8 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
|
|
|
|
switch (ticketTypeEnum) {
|
|
|
|
|
|
|
|
|
|
case FEEDBACK:
|
|
|
|
|
count = thsOverRunLogList.stream().filter(item->Objects.isNull(item.getFeedback())).count();
|
|
|
|
|
if(uploadCount == count){
|
|
|
|
|
count = thsOverRunLogList.stream().filter(item -> Objects.isNull(item.getFeedback())).count();
|
|
|
|
|
if (uploadCount == count) {
|
|
|
|
|
thsSupervise.setProgress(ProgressEnum.TEST_REPORT.getCode());
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
@@ -311,7 +319,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(uploadCount == count){
|
|
|
|
|
if (uploadCount == count) {
|
|
|
|
|
//默认上传报告后当前流程结束
|
|
|
|
|
FlowableAss flowableAss = flowableAssMapper.selectById(thsSupervise.getSupIndex());
|
|
|
|
|
Task task = iFlowTaskService.getTask(flowableAss.getExecIndex());
|
|
|
|
|
@@ -480,21 +488,25 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
|
|
|
|
ThsSuperviseVo thsSuperviseVo = new ThsSuperviseVo();
|
|
|
|
|
if (CollectionUtil.isNotEmpty(querySuperviseList)) {
|
|
|
|
|
|
|
|
|
|
List<String> userIds = querySuperviseList.stream().filter(item->Objects.nonNull(item.getModifyUser())).map(SuperviseVo::getModifyUser).distinct().collect(Collectors.toList());
|
|
|
|
|
List<String> userIds = querySuperviseList.stream().map(SuperviseVo::getModifyUser).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
List<User> userList = userFeignClient.getUserByIdList(userIds).getData();
|
|
|
|
|
Map<String,User> userMap = userList.stream().collect(Collectors.toMap(User::getId,Function.identity()));
|
|
|
|
|
Map<String, User> userMap = userList.stream().collect(Collectors.toMap(User::getId, Function.identity()));
|
|
|
|
|
|
|
|
|
|
List<String> deptIds = querySuperviseList.stream().map(SuperviseVo::getDeptId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
List<Dept> deptList = deptFeignClient.getDeptInfoListByIds(deptIds).getData();
|
|
|
|
|
Map<String,Dept> deptMap = deptList.stream().collect(Collectors.toMap(Dept::getId,Function.identity()));
|
|
|
|
|
Map<String, Dept> deptMap = deptList.stream().collect(Collectors.toMap(Dept::getId, Function.identity()));
|
|
|
|
|
|
|
|
|
|
for (SuperviseVo superviseVo : querySuperviseList) {
|
|
|
|
|
|
|
|
|
|
superviseVo.setModifyUser(userMap.get(superviseVo.getModifyUser()).getName());
|
|
|
|
|
if(StrUtil.isNotBlank(superviseVo.getModifyUser())) {
|
|
|
|
|
superviseVo.setModifyUser(userMap.get(superviseVo.getModifyUser()).getName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
superviseVo.setCompanyName(deptMap.get(superviseVo.getDeptId()).getName());
|
|
|
|
|
if(StrUtil.isNotBlank(superviseVo.getDeptId())) {
|
|
|
|
|
superviseVo.setCompanyName(deptMap.get(superviseVo.getDeptId()).getName());
|
|
|
|
|
}
|
|
|
|
|
//处理预警类型
|
|
|
|
|
|
|
|
|
|
Date modifyTime = superviseVo.getModifyTime();
|
|
|
|
|
@@ -619,13 +631,21 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
|
|
|
|
|
|
|
|
|
List<ThsStrategyVo> thsStrategyList = this.thsWarnStrategyMapper.selectStrategyList(superviseParam);
|
|
|
|
|
//按部门进行分组
|
|
|
|
|
|
|
|
|
|
List<ThsStrategyBindDTO> thsStrategyBindDTOList = new ArrayList<>();
|
|
|
|
|
if (CollectionUtil.isNotEmpty(thsStrategyList)) {
|
|
|
|
|
|
|
|
|
|
List<ThsStrategyVo> threeLevel = thsStrategyList.stream().filter(r -> GradeEnum.THREE_LEVEL.getCode().equals(r.getGrade())).collect(Collectors.toList());//三级策略集合
|
|
|
|
|
//获取排他策略集合
|
|
|
|
|
assBindList(threeLevel, thsStrategyBindDTOList);
|
|
|
|
|
Map<String, ThsStrategyBindDTO> deleteMap = thsStrategyBindDTOList.stream().collect(Collectors.toMap(ThsStrategyBindDTO::getKeyId, Function.identity()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ThsStrategyVo> oneLevel = thsStrategyList.stream().filter(r -> !GradeEnum.THREE_LEVEL.getCode().equals(r.getGrade())).collect(Collectors.toList());//一级或二级策略集合
|
|
|
|
|
|
|
|
|
|
Map<String, List<ThsStrategyVo>> deptMap = oneLevel.stream().collect(Collectors.groupingBy(ThsStrategyVo::getDeptId));
|
|
|
|
|
for (Map.Entry<String, List<ThsStrategyVo>> entry : deptMap.entrySet()) {
|
|
|
|
|
String depId = entry.getKey();
|
|
|
|
|
List<String> deptAllIds = deptFeignClient.getDepSonIdtByDeptId(depId).getData();
|
|
|
|
|
Dept dept = deptFeignClient.getDeptById(depId).getData();
|
|
|
|
|
|
|
|
|
|
List<ThsOverRunLog> thsOverRunLogList = new ArrayList<>();
|
|
|
|
|
@@ -633,8 +653,11 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
|
|
|
|
ThsSupervise thsSupervise = null;
|
|
|
|
|
List<ThsStrategyVo> deptStrategyList = entry.getValue();
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deptStrategyList)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//遍历当前部门下面的所有策略
|
|
|
|
|
for (ThsStrategyVo oneStrategyVo : deptStrategyList) {
|
|
|
|
|
List<ThsStrategyBindDTO> useBindDTOList = new ArrayList<>();
|
|
|
|
|
List<ThsWarnStrategyAss> oneInterferenceSourceAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.SOURCE_TYPE);//干扰源列表
|
|
|
|
|
List<ThsWarnStrategyAss> oneSteadyIndicatorAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.INTERFERENCE_TYPE);//指标类型列表
|
|
|
|
|
List<ThsWarnStrategyAss> oneMonitorAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.MONITOR_TYPE);//监测点列表
|
|
|
|
|
@@ -642,11 +665,40 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
|
|
|
|
List<String> tagIds = oneInterferenceSourceAsses.stream().map(ThsWarnStrategyAss::getAssId).distinct().collect(Collectors.toList());
|
|
|
|
|
List<String> targetIds = oneSteadyIndicatorAsses.stream().map(ThsWarnStrategyAss::getAssId).distinct().collect(Collectors.toList());
|
|
|
|
|
List<String> monitorIds = oneMonitorAsses.stream().map(ThsWarnStrategyAss::getAssId).collect(Collectors.toList());
|
|
|
|
|
for (String tagId : tagIds) {
|
|
|
|
|
ThsStrategyBindDTO strategyBindDTO = ThsStrategyBindDTO.builder().keyId(tagId).targetIds(targetIds).operation(oneStrategyVo.getOperation()).type(0).build();
|
|
|
|
|
useBindDTOList.add(strategyBindDTO);
|
|
|
|
|
}
|
|
|
|
|
for (String monitorId : monitorIds) {
|
|
|
|
|
ThsStrategyBindDTO strategyBindDTO = ThsStrategyBindDTO.builder().keyId(monitorId).targetIds(targetIds).operation(oneStrategyVo.getOperation()).type(1).build();
|
|
|
|
|
useBindDTOList.add(strategyBindDTO);
|
|
|
|
|
}
|
|
|
|
|
//根据排他策略过滤12级策略
|
|
|
|
|
Iterator<ThsStrategyBindDTO> iterator = useBindDTOList.iterator();
|
|
|
|
|
while (iterator.hasNext()) {
|
|
|
|
|
ThsStrategyBindDTO item = iterator.next();
|
|
|
|
|
if (deleteMap.containsKey(item.getKeyId())) {
|
|
|
|
|
item.getTargetIds().removeAll(deleteMap.get(item.getKeyId()).getTargetIds());
|
|
|
|
|
if (CollectionUtil.isEmpty(item.getTargetIds())) {
|
|
|
|
|
iterator.remove();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//过滤排他策略后开始组装信息
|
|
|
|
|
List<ThsStrategyBindDTO> tagObj = useBindDTOList.stream().filter(item -> item.getType() == 0).collect(Collectors.toList());
|
|
|
|
|
List<String> useTagIds = tagObj.stream().map(ThsStrategyBindDTO::getKeyId).collect(Collectors.toList());
|
|
|
|
|
Map<String, ThsStrategyBindDTO> tagMap = tagObj.stream().collect(Collectors.toMap(ThsStrategyBindDTO::getKeyId, Function.identity()));
|
|
|
|
|
|
|
|
|
|
List<ThsStrategyBindDTO> monitorObj = useBindDTOList.stream().filter(item -> item.getType() == 1).collect(Collectors.toList());
|
|
|
|
|
List<String> useMonitorIds = monitorObj.stream().map(ThsStrategyBindDTO::getKeyId).collect(Collectors.toList());
|
|
|
|
|
Map<String, ThsStrategyBindDTO> monitorMap = monitorObj.stream().collect(Collectors.toMap(ThsStrategyBindDTO::getKeyId, Function.identity()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MonitorGetParam monitorGetParam = new MonitorGetParam();
|
|
|
|
|
monitorGetParam.setTagList(tagIds);
|
|
|
|
|
monitorGetParam.setMonitorIds(monitorIds);
|
|
|
|
|
monitorGetParam.setDeptIds(deptAllIds);
|
|
|
|
|
monitorGetParam.setTagList(useTagIds);
|
|
|
|
|
monitorGetParam.setMonitorIds(useMonitorIds);
|
|
|
|
|
monitorGetParam.setDeptIds(Stream.of(dept.getId()).collect(Collectors.toList()));
|
|
|
|
|
//TODO 需要校验
|
|
|
|
|
List<CommMonitorInfoDTO> commMonitorInfoDTOList = commTerminalGeneralClient.tagOrIdGetMonitorList(monitorGetParam).getData();
|
|
|
|
|
Map<String, CommMonitorInfoDTO> monitorInfoDTOMap = commMonitorInfoDTOList.stream().collect(Collectors.toMap(CommMonitorInfoDTO::getId, Function.identity()));
|
|
|
|
|
@@ -656,27 +708,37 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
|
|
|
|
List<RStatLimitRateDPO> rStatLimitRateDPOList = rStatLimitRateDClient.monitorIdsGetLimitInfo(RStatLimitQueryParam.builder().ids(temIds).date(yesterday).build()).getData();
|
|
|
|
|
|
|
|
|
|
//TODO 数据中心和pms这边稳态指标没用一个需要考虑兼容问题
|
|
|
|
|
dictTargetList = dictTargetList.stream().filter(item -> targetIds.contains(item.getId())).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
//判断指标是否在策略中
|
|
|
|
|
if (CollectionUtil.isNotEmpty(rStatLimitRateDPOList)) {
|
|
|
|
|
for (RStatLimitRateDPO rStatLimitRateDPO : rStatLimitRateDPOList) {
|
|
|
|
|
List<String> descriptionList = new ArrayList<>();
|
|
|
|
|
Integer[] count = {0};
|
|
|
|
|
Map<String, Boolean> limitBoolMap = verifyLimit(rStatLimitRateDPO, dictTargetList, descriptionList, count);
|
|
|
|
|
|
|
|
|
|
//先判断当前测点是否监测点策略
|
|
|
|
|
List<DictData> dictDataList;
|
|
|
|
|
if (monitorMap.containsKey(rStatLimitRateDPO.getLineId())) {
|
|
|
|
|
List<String> lineTargetIds = monitorMap.get(rStatLimitRateDPO.getLineId()).getTargetIds();
|
|
|
|
|
dictDataList = dictTargetList.stream().filter(item -> lineTargetIds.contains(item.getId())).collect(Collectors.toList());
|
|
|
|
|
} else {
|
|
|
|
|
//不是监测点策略则去匹配对象标签策略
|
|
|
|
|
String tagId = monitorInfoDTOMap.get(rStatLimitRateDPO.getLineId()).getObjTagId();
|
|
|
|
|
List<String> tagTargetIds = tagMap.get(tagId).getTargetIds();
|
|
|
|
|
dictDataList = dictTargetList.stream().filter(item -> tagTargetIds.contains(item.getId())).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, Boolean> limitBoolMap = verifyLimit(rStatLimitRateDPO, dictDataList, descriptionList, count);
|
|
|
|
|
|
|
|
|
|
boolean shouldContinue;
|
|
|
|
|
if (oneStrategyVo.getOperation().equals(OperationEnum.AND.getCode())) {
|
|
|
|
|
//与
|
|
|
|
|
boolean res = limitBoolMap.containsValue(false);
|
|
|
|
|
if (res) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
shouldContinue = limitBoolMap.containsValue(false);
|
|
|
|
|
} else {
|
|
|
|
|
//或
|
|
|
|
|
boolean res = limitBoolMap.containsValue(true);
|
|
|
|
|
if (!res) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
shouldContinue = !limitBoolMap.containsValue(true);
|
|
|
|
|
}
|
|
|
|
|
if (shouldContinue) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//到这一步说明符合策略保留该条数据,开始组装实体
|
|
|
|
|
@@ -693,29 +755,21 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (superviseParam.getInitType().equals(InitTypeEnum.AUTO.getCode())) {
|
|
|
|
|
if (CollectionUtil.isNotEmpty(thsSuperviseListPO)) {
|
|
|
|
|
|
|
|
|
|
//返回体处理
|
|
|
|
|
if (CollectionUtil.isNotEmpty(thsSuperviseListPO)) {
|
|
|
|
|
if (superviseParam.getInitType().equals(InitTypeEnum.AUTO.getCode())) {
|
|
|
|
|
//处理flowable
|
|
|
|
|
for(ThsSupervise ths:thsSuperviseListPO){
|
|
|
|
|
Map<String, Object> mapParam = new HashMap<>();
|
|
|
|
|
String proInId = "";
|
|
|
|
|
if (ths.getType() == 0) {
|
|
|
|
|
proInId = "flow_yzep99kb:1:a100b48b-da75-11ed-8335-b07b253cdad9";
|
|
|
|
|
} else {
|
|
|
|
|
proInId = "flow_yzep99kb:2:6358e099-dcba-11ed-8026-b07b253cdad9";
|
|
|
|
|
}
|
|
|
|
|
flowDefinitionService.startProcessInstanceById(proInId, thsSupervise.getSupIndex(), mapParam);
|
|
|
|
|
for (ThsSupervise ths : thsSuperviseListPO) {
|
|
|
|
|
flowableRun(ths);
|
|
|
|
|
}
|
|
|
|
|
this.saveBatch(thsSuperviseListPO);
|
|
|
|
|
thsOverRunLogService.saveBatch(allThsLogPO);
|
|
|
|
|
return null;
|
|
|
|
|
} else {
|
|
|
|
|
superviceRunLogVo.setOverRunLog(allThsLogPO);
|
|
|
|
|
superviceRunLogVo.setThsSupervise(thsSuperviseListPO.get(0));
|
|
|
|
|
return superviceRunLogVo;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
superviceRunLogVo.setOverRunLog(allThsLogPO);
|
|
|
|
|
superviceRunLogVo.setThsSupervise(thsSuperviseListPO.get(0));
|
|
|
|
|
return superviceRunLogVo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -728,96 +782,6 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
|
|
|
|
return superviceRunLogVo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*@Override
|
|
|
|
|
public SuperviceRunLogVo initSuperviseHand(SuperviseParam superviseParam) {
|
|
|
|
|
SuperviceRunLogVo superviceRunLogVo = new SuperviceRunLogVo();
|
|
|
|
|
List<ThsOverRunLog> thsOverRunLogList = new ArrayList<>();
|
|
|
|
|
String yesterday = LocalDate.now().minusDays(1).format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
|
|
|
|
|
|
|
|
|
|
List<DictData> dictTargetList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (InitTypeEnum.MANUAL.getCode().equals(superviseParam.getInitType()) && StringUtils.isBlank(superviseParam.getDeptId())) {
|
|
|
|
|
throw new BusinessException(CommonResponseEnum.INVALID_PARAMETER.getMessage());
|
|
|
|
|
}
|
|
|
|
|
List<ThsStrategyVo> thsStrategyList = this.thsWarnStrategyMapper.selectStrategyList(superviseParam);
|
|
|
|
|
//按部门进行分组
|
|
|
|
|
if (CollectionUtil.isNotEmpty(thsStrategyList)) {
|
|
|
|
|
ThsSupervise thsSupervise = null;
|
|
|
|
|
List<ThsStrategyVo> oneLevel = thsStrategyList.stream().filter(r -> !GradeEnum.THREE_LEVEL.getCode().equals(r.getGrade())).collect(Collectors.toList());//一级或二级策略集合
|
|
|
|
|
if (CollectionUtil.isNotEmpty(oneLevel)) {
|
|
|
|
|
//遍历当前部门下面的所有策略
|
|
|
|
|
for (ThsStrategyVo oneStrategyVo : oneLevel) {
|
|
|
|
|
|
|
|
|
|
Dept dept = deptFeignClient.getDeptById(oneStrategyVo.getDeptId()).getData();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ThsWarnStrategyAss> oneInterferenceSourceAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.SOURCE_TYPE);//干扰源列表
|
|
|
|
|
List<ThsWarnStrategyAss> oneSteadyIndicatorAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.INTERFERENCE_TYPE);//指标类型列表
|
|
|
|
|
List<ThsWarnStrategyAss> oneMonitorAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.MONITOR_TYPE);//监测点列表
|
|
|
|
|
|
|
|
|
|
List<String> tagIds = oneInterferenceSourceAsses.stream().map(ThsWarnStrategyAss::getAssId).distinct().collect(Collectors.toList());
|
|
|
|
|
List<String> targetIds = oneSteadyIndicatorAsses.stream().map(ThsWarnStrategyAss::getAssId).distinct().collect(Collectors.toList());
|
|
|
|
|
List<String> monitorIds = oneMonitorAsses.stream().map(ThsWarnStrategyAss::getAssId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
MonitorGetParam monitorGetParam = new MonitorGetParam();
|
|
|
|
|
monitorGetParam.setTagList(tagIds);
|
|
|
|
|
monitorGetParam.setMonitorIds(monitorIds);
|
|
|
|
|
|
|
|
|
|
List<String> deptAllIds = deptFeignClient.getDepSonIdtByDeptId(oneStrategyVo.getDeptId()).getData();
|
|
|
|
|
monitorGetParam.setDeptIds(deptAllIds);
|
|
|
|
|
//TODO 需要校验
|
|
|
|
|
List<CommMonitorInfoDTO> commMonitorInfoDTOList = commTerminalGeneralClient.tagOrIdGetMonitorList(monitorGetParam).getData();
|
|
|
|
|
Map<String, CommMonitorInfoDTO> monitorInfoDTOMap = commMonitorInfoDTOList.stream().collect(Collectors.toMap(CommMonitorInfoDTO::getId, Function.identity()));
|
|
|
|
|
|
|
|
|
|
List<String> temIds = commMonitorInfoDTOList.stream().map(CommMonitorInfoDTO::getId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
List<RStatLimitRateDPO> rStatLimitRateDPOList = rStatLimitRateDClient.monitorIdsGetLimitInfo(RStatLimitQueryParam.builder().ids(temIds).date(yesterday).build()).getData();
|
|
|
|
|
|
|
|
|
|
//TODO 数据中心和pms这边稳态指标没用一个需要考虑兼容问题
|
|
|
|
|
dictTargetList = dictTargetList.stream().filter(item -> targetIds.contains(item.getId())).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
//判断指标是否在策略中
|
|
|
|
|
if (CollectionUtil.isNotEmpty(rStatLimitRateDPOList)) {
|
|
|
|
|
for (RStatLimitRateDPO rStatLimitRateDPO : rStatLimitRateDPOList) {
|
|
|
|
|
|
|
|
|
|
List<String> descriptionList = new ArrayList<>();
|
|
|
|
|
Integer[] count = {0};
|
|
|
|
|
Map<String, Boolean> limitBoolMap = verifyLimit(rStatLimitRateDPO, dictTargetList, descriptionList, count);
|
|
|
|
|
|
|
|
|
|
if (oneStrategyVo.getOperation().equals(OperationEnum.AND.getCode())) {
|
|
|
|
|
//与
|
|
|
|
|
boolean res = limitBoolMap.containsValue(false);
|
|
|
|
|
if (res) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
//或
|
|
|
|
|
boolean res = limitBoolMap.containsValue(true);
|
|
|
|
|
if (!res) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//到这一步说明符合策略保留该条数据,开始组装实体
|
|
|
|
|
if (Objects.isNull(thsSupervise)) {
|
|
|
|
|
thsSupervise = new ThsSupervise();
|
|
|
|
|
buildSuperviseData(yesterday, dept, superviseParam, oneStrategyVo, superviseParam.getInitType(), thsSupervise);
|
|
|
|
|
}
|
|
|
|
|
buildOverRunLog(thsSupervise, monitorInfoDTOMap.get(rStatLimitRateDPO.getLineId()), descriptionList, thsOverRunLogList, count);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
superviceRunLogVo.setOverRunLog(thsOverRunLogList);
|
|
|
|
|
return superviceRunLogVo;
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Page<ThsSupervise> queryPage(ThsSuperviseParam thsSuperviseParam) {
|
|
|
|
|
@@ -862,6 +826,37 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据策略组装对象
|
|
|
|
|
*
|
|
|
|
|
* @author cdf
|
|
|
|
|
* @date 2024/3/19
|
|
|
|
|
*/
|
|
|
|
|
private void assBindList(List<ThsStrategyVo> levelList, List<ThsStrategyBindDTO> thsStrategyBindDTOList) {
|
|
|
|
|
if (CollectionUtil.isNotEmpty(levelList)) {
|
|
|
|
|
for (ThsStrategyVo thsStrategyVo : levelList) {
|
|
|
|
|
List<ThsWarnStrategyAss> tagIdsAss = this.queryWarnStrategyAss(thsStrategyVo.getId(), TypeEnum.SOURCE_TYPE);//干扰源列表
|
|
|
|
|
List<ThsWarnStrategyAss> targetIdsAss = this.queryWarnStrategyAss(thsStrategyVo.getId(), TypeEnum.INTERFERENCE_TYPE);//指标类型列表
|
|
|
|
|
List<ThsWarnStrategyAss> monitorIdsAss = this.queryWarnStrategyAss(thsStrategyVo.getId(), TypeEnum.MONITOR_TYPE);//监测点列表
|
|
|
|
|
|
|
|
|
|
List<String> tagIds = tagIdsAss.stream().map(ThsWarnStrategyAss::getAssId).distinct().collect(Collectors.toList());
|
|
|
|
|
List<String> targetIds = targetIdsAss.stream().map(ThsWarnStrategyAss::getAssId).distinct().collect(Collectors.toList());
|
|
|
|
|
List<String> monitorIds = monitorIdsAss.stream().map(ThsWarnStrategyAss::getAssId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
for (String tagId : tagIds) {
|
|
|
|
|
ThsStrategyBindDTO strategyBindDTO = ThsStrategyBindDTO.builder().keyId(tagId).targetIds(targetIds).operation(thsStrategyVo.getOperation()).build();
|
|
|
|
|
thsStrategyBindDTOList.add(strategyBindDTO);
|
|
|
|
|
}
|
|
|
|
|
for (String monitorId : monitorIds) {
|
|
|
|
|
ThsStrategyBindDTO strategyBindDTO = ThsStrategyBindDTO.builder().keyId(monitorId).targetIds(targetIds).operation(thsStrategyVo.getOperation()).build();
|
|
|
|
|
thsStrategyBindDTOList.add(strategyBindDTO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 批量下载.zip文件
|
|
|
|
|
*
|
|
|
|
|
|