1.技术监督调整

This commit is contained in:
cdf
2024-03-12 16:33:17 +08:00
parent 209393ad3c
commit bef44e6d96
3 changed files with 124 additions and 114 deletions

View File

@@ -54,7 +54,7 @@ public class ThsSuperviseController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON) /* @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("预警/告警事务生成手动") @ApiOperation("预警/告警事务生成手动")
@ApiImplicitParam(name = "superviseParam", value = "创建技术监督参数", required = true) @ApiImplicitParam(name = "superviseParam", value = "创建技术监督参数", required = true)
@PostMapping("/initSuperviseHand") @PostMapping("/initSuperviseHand")
@@ -63,7 +63,7 @@ public class ThsSuperviseController extends BaseController {
SuperviceRunLogVo result = thsSuperviseService.initSuperviseHand(superviseParam); SuperviceRunLogVo result = thsSuperviseService.initSuperviseHand(superviseParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
} }
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("预警/告警事务生成自动") @ApiOperation("预警/告警事务生成自动")

View File

@@ -116,7 +116,7 @@ public interface ThsSuperviseService extends IService<ThsSupervise> {
SuperviceRunLogVo initSupervise(@RequestBody @Validated SuperviseParam superviseParam); SuperviceRunLogVo initSupervise(@RequestBody @Validated SuperviseParam superviseParam);
SuperviceRunLogVo initSuperviseHand(@RequestBody @Validated SuperviseParam superviseParam); //SuperviceRunLogVo initSuperviseHand(@RequestBody @Validated SuperviseParam superviseParam);
Page<ThsSupervise> queryPage(ThsSuperviseParam thsSuperviseParam); Page<ThsSupervise> queryPage(ThsSuperviseParam thsSuperviseParam);

View File

@@ -26,6 +26,7 @@ import com.njcn.harmonic.pojo.vo.ThsStrategyVo;
import com.njcn.oss.constant.OssPath; import com.njcn.oss.constant.OssPath;
import com.njcn.oss.utils.FileStorageUtil; import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto; import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto;
import com.njcn.process.api.FlowableDefineFeignClient;
import com.njcn.process.pojo.param.SuperviseParam; import com.njcn.process.pojo.param.SuperviseParam;
import com.njcn.process.pojo.po.ThsOverRunLog; import com.njcn.process.pojo.po.ThsOverRunLog;
import com.njcn.process.pojo.po.ThsSupervise; import com.njcn.process.pojo.po.ThsSupervise;
@@ -95,9 +96,6 @@ import static com.njcn.process.enums.SteadyIndicatorEnum.Negative_Voltage;
public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, ThsSupervise> implements ThsSuperviseService { public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, ThsSupervise> implements ThsSuperviseService {
private final ThsWarnStrategyMapper thsWarnStrategyMapper; private final ThsWarnStrategyMapper thsWarnStrategyMapper;
private final ThsWarnStrategyAssMapper thsWarnStrategyAssMapper; private final ThsWarnStrategyAssMapper thsWarnStrategyAssMapper;
@@ -125,6 +123,8 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
private final FlowableAssMapper flowableAssMapper; private final FlowableAssMapper flowableAssMapper;
private final IFlowDefinitionService flowDefinitionService;
private final ThsDeptMonitorMapper thsDeptMonitorMapper; private final ThsDeptMonitorMapper thsDeptMonitorMapper;
private final CommTerminalGeneralClient commTerminalGeneralClient; private final CommTerminalGeneralClient commTerminalGeneralClient;
@@ -167,12 +167,12 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
//TODO 解决工作流写死问题 //TODO 解决工作流写死问题
Map<String, Object> mapParam = new HashMap<>(); Map<String, Object> mapParam = new HashMap<>();
String proInId = ""; String proInId = "";
if(thsSupervise.getType() == 0){ if (thsSupervise.getType() == 0) {
proInId = "flow_yzep99kb:1:a100b48b-da75-11ed-8335-b07b253cdad9"; proInId = "flow_yzep99kb:1:a100b48b-da75-11ed-8335-b07b253cdad9";
}else { } else {
proInId = "flow_yzep99kb:2:6358e099-dcba-11ed-8026-b07b253cdad9"; proInId = "flow_yzep99kb:2:6358e099-dcba-11ed-8026-b07b253cdad9";
} }
iFlowDefinitionService.startProcessInstanceById(proInId,thsSupervise.getSupIndex(),mapParam); iFlowDefinitionService.startProcessInstanceById(proInId, thsSupervise.getSupIndex(), mapParam);
for (ThsOverRunLog thsOverRunLog : superviceRunLogVo.getOverRunLog()) { for (ThsOverRunLog thsOverRunLog : superviceRunLogVo.getOverRunLog()) {
@@ -188,7 +188,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
Integer pageNum = PageFactory.getPageNum(superviseDto); Integer pageNum = PageFactory.getPageNum(superviseDto);
Integer pageSize = PageFactory.getPageSize(superviseDto); Integer pageSize = PageFactory.getPageSize(superviseDto);
Page<SuperviseVo> superviseVoPage = new Page<>(pageNum, pageSize); Page<SuperviseVo> superviseVoPage = new Page<>(pageNum, pageSize);
Page<SuperviseVo> page = thsSuperviseMapper.querySupervisePage(superviseVoPage,superviseDto); Page<SuperviseVo> page = thsSuperviseMapper.querySupervisePage(superviseVoPage, superviseDto);
List<SuperviseVo> pageRecords = page.getRecords(); List<SuperviseVo> pageRecords = page.getRecords();
if (CollectionUtil.isNotEmpty(pageRecords)) { if (CollectionUtil.isNotEmpty(pageRecords)) {
for (SuperviseVo superviseVo : pageRecords) { for (SuperviseVo superviseVo : pageRecords) {
@@ -232,7 +232,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
//删除同时删除工作流程 //删除同时删除工作流程
FlowableAss flowableAss = flowableAssMapper.selectById(id); FlowableAss flowableAss = flowableAssMapper.selectById(id);
if(Objects.nonNull(flowableAss)) { if (Objects.nonNull(flowableAss)) {
iFlowDefinitionService.deleteInstance(flowableAss.getExecIndex(), ""); iFlowDefinitionService.deleteInstance(flowableAss.getExecIndex(), "");
flowableAssMapper.deleteById(id); flowableAssMapper.deleteById(id);
} }
@@ -255,18 +255,18 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
thsOverRunLog.setId(id); thsOverRunLog.setId(id);
String path = fileStorageUtil.uploadMultipart(files[0], OssPath.ELECTRICITY_QUALITY); String path = fileStorageUtil.uploadMultipart(files[0], OssPath.ELECTRICITY_QUALITY);
this.updateSuperviesData(path, thsOverRunLog, ticketType, thsSupervise); this.updateSuperviesData(path, thsOverRunLog, ticketType, thsSupervise);
this.updateProcess(thsSupervise, ticketType,thsSuperObj.getType()); this.updateProcess(thsSupervise, ticketType, thsSuperObj.getType());
} }
if (files != null && files.length > 1) { if (files != null && files.length > 1) {
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogService.list(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex)); List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogService.list(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
this.batchUploadFile(thsSupervise, thsOverRunLogs, files, ticketType); this.batchUploadFile(thsSupervise, thsOverRunLogs, files, ticketType);
this.updateProcess(thsSupervise, ticketType,thsSuperObj.getType()); this.updateProcess(thsSupervise, ticketType, thsSuperObj.getType());
} }
//判断当监督单下面的监测点报告都被上传则认为流程完成 //判断当监督单下面的监测点报告都被上传则认为流程完成
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogService.list(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex)); List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogService.list(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
List<String> fileNames = thsOverRunLogs.stream().filter(item-> StrUtil.isNotBlank(item.getFeedback())).map(ThsOverRunLog::getFileName).distinct().collect(Collectors.toList()); List<String> fileNames = thsOverRunLogs.stream().filter(item -> StrUtil.isNotBlank(item.getFeedback())).map(ThsOverRunLog::getFileName).distinct().collect(Collectors.toList());
if(fileNames.size() == thsOverRunLogs.size()){ if (fileNames.size() == thsOverRunLogs.size()) {
FlowableAss flowableAss = flowableAssMapper.selectById(supIndex); FlowableAss flowableAss = flowableAssMapper.selectById(supIndex);
Task task = iFlowTaskService.getTask(flowableAss.getExecIndex()); Task task = iFlowTaskService.getTask(flowableAss.getExecIndex());
@@ -285,7 +285,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
* @param ticketType * @param ticketType
* @param type * @param type
*/ */
private void updateProcess(ThsSupervise thsSupervise, Integer ticketType,Integer type) { private void updateProcess(ThsSupervise thsSupervise, Integer ticketType, Integer type) {
TicketTypeEnum ticketTypeEnum = TicketTypeEnum.getTicketTypeEnumByCode(ticketType); TicketTypeEnum ticketTypeEnum = TicketTypeEnum.getTicketTypeEnumByCode(ticketType);
if (ticketTypeEnum == null) { if (ticketTypeEnum == null) {
throw new BusinessException("上传单据参数类型错误!"); throw new BusinessException("上传单据参数类型错误!");
@@ -295,9 +295,9 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
thsSupervise.setProgress(ProgressEnum.TEST_REPORT.getCode()); thsSupervise.setProgress(ProgressEnum.TEST_REPORT.getCode());
break; break;
case TEST_REPORT: case TEST_REPORT:
if(AlarmTypeEnum.EARLY_WARN.getCode().equals(type)){ if (AlarmTypeEnum.EARLY_WARN.getCode().equals(type)) {
thsSupervise.setProgress(ProgressEnum.END.getCode()); thsSupervise.setProgress(ProgressEnum.END.getCode());
}else { } else {
thsSupervise.setProgress(ProgressEnum.REVISE_NOTICE_ISSUE.getCode()); thsSupervise.setProgress(ProgressEnum.REVISE_NOTICE_ISSUE.getCode());
} }
break; break;
@@ -411,8 +411,6 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
thsAlarmFormworkMapper.insert(alarmFormwork); thsAlarmFormworkMapper.insert(alarmFormwork);
} }
@Override @Override
@@ -424,8 +422,11 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
throw new BusinessException("请先上传下发单模板单据!"); throw new BusinessException("请先上传下发单模板单据!");
} }
String fileUrl = fileStorageUtil.getFileUrl(thsAlarmFormwork.getPath()); String fileUrl = fileStorageUtil.getFileUrl(thsAlarmFormwork.getPath());
ThsSupervise thsSupervise = new ThsSupervise(); ThsSupervise thsSupervise = new ThsSupervise();
thsSupervise.setModifyTime(new Date()); thsSupervise.setModifyTime(new Date());
thsSupervise.setModifyUser(RequestUtil.getUserIndex());
ThsOverRunLog thsOverRunLog = new ThsOverRunLog(); ThsOverRunLog thsOverRunLog = new ThsOverRunLog();
thsOverRunLog.setSupIndex(supIndex); thsOverRunLog.setSupIndex(supIndex);
if (FormworkTypeEnum.ALARM_TICKET.getCode().equals(formworkType)) { if (FormworkTypeEnum.ALARM_TICKET.getCode().equals(formworkType)) {
@@ -439,6 +440,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
thsOverRunLogService.update(thsOverRunLog, new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex)); thsOverRunLogService.update(thsOverRunLog, new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
thsSuperviseMapper.update(thsSupervise, new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, supIndex)); thsSuperviseMapper.update(thsSupervise, new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, supIndex));
FlowableAss flowableAss = flowableAssMapper.selectById(supIndex); FlowableAss flowableAss = flowableAssMapper.selectById(supIndex);
Task task = iFlowTaskService.getTask(flowableAss.getExecIndex()); Task task = iFlowTaskService.getTask(flowableAss.getExecIndex());
@@ -565,9 +567,9 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
} }
/** /**
* 生成预警单告警单(自动) * 生成预警单告警单(自动)
*
* @author cdf * @author cdf
* @date 2024/1/29 * @date 2024/1/29
*/ */
@@ -613,44 +615,44 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
monitorGetParam.setDeptIds(deptAllIds); monitorGetParam.setDeptIds(deptAllIds);
//TODO 需要校验 //TODO 需要校验
List<CommMonitorInfoDTO> commMonitorInfoDTOList = commTerminalGeneralClient.tagOrIdGetMonitorList(monitorGetParam).getData(); List<CommMonitorInfoDTO> commMonitorInfoDTOList = commTerminalGeneralClient.tagOrIdGetMonitorList(monitorGetParam).getData();
Map<String,CommMonitorInfoDTO> monitorInfoDTOMap = commMonitorInfoDTOList.stream().collect(Collectors.toMap(CommMonitorInfoDTO::getId,Function.identity())); 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<String> temIds = commMonitorInfoDTOList.stream().map(CommMonitorInfoDTO::getId).distinct().collect(Collectors.toList());
List<RStatLimitRateDPO> rStatLimitRateDPOList = rStatLimitRateDClient.monitorIdsGetLimitInfo(RStatLimitQueryParam.builder().ids(temIds).date(yesterday).build()).getData(); List<RStatLimitRateDPO> rStatLimitRateDPOList = rStatLimitRateDClient.monitorIdsGetLimitInfo(RStatLimitQueryParam.builder().ids(temIds).date(yesterday).build()).getData();
//TODO 数据中心和pms这边稳态指标没用一个需要考虑兼容问题 //TODO 数据中心和pms这边稳态指标没用一个需要考虑兼容问题
dictTargetList = dictTargetList.stream().filter(item->targetIds.contains(item.getId())).collect(Collectors.toList()); dictTargetList = dictTargetList.stream().filter(item -> targetIds.contains(item.getId())).collect(Collectors.toList());
//判断指标是否在策略中 //判断指标是否在策略中
if(CollectionUtil.isNotEmpty(rStatLimitRateDPOList)){ if (CollectionUtil.isNotEmpty(rStatLimitRateDPOList)) {
for(RStatLimitRateDPO rStatLimitRateDPO :rStatLimitRateDPOList ){ for (RStatLimitRateDPO rStatLimitRateDPO : rStatLimitRateDPOList) {
List<String> descriptionList = new ArrayList<>(); List<String> descriptionList = new ArrayList<>();
Integer[] count = {0}; Integer[] count = {0};
Map<String,Boolean> limitBoolMap = verifyLimit(rStatLimitRateDPO,dictTargetList,descriptionList,count); Map<String, Boolean> limitBoolMap = verifyLimit(rStatLimitRateDPO, dictTargetList, descriptionList, count);
if(oneStrategyVo.getOperation().equals(OperationEnum.AND.getCode()) ){ if (oneStrategyVo.getOperation().equals(OperationEnum.AND.getCode())) {
//与 //与
boolean res = limitBoolMap.containsValue(false); boolean res = limitBoolMap.containsValue(false);
if(res){ if (res) {
continue; continue;
} }
}else { } else {
//或 //或
boolean res = limitBoolMap.containsValue(true); boolean res = limitBoolMap.containsValue(true);
if(!res){ if (!res) {
continue; continue;
} }
} }
//到这一步说明符合策略保留该条数据,开始组装实体 //到这一步说明符合策略保留该条数据,开始组装实体
if(Objects.isNull(thsSupervise)){ if (Objects.isNull(thsSupervise)) {
thsSupervise = new ThsSupervise(); thsSupervise = new ThsSupervise();
buildSuperviseData(yesterday,dept,superviseParam,oneStrategyVo,superviseParam.getInitType(),thsSupervise); buildSuperviseData(yesterday, dept, superviseParam, oneStrategyVo, superviseParam.getInitType(), thsSupervise);
thsSuperviseListPO.add(thsSupervise); thsSuperviseListPO.add(thsSupervise);
} }
buildOverRunLog(thsSupervise,monitorInfoDTOMap.get(rStatLimitRateDPO.getLineId()),descriptionList,thsOverRunLogList,count); buildOverRunLog(thsSupervise, monitorInfoDTOMap.get(rStatLimitRateDPO.getLineId()), descriptionList, thsOverRunLogList, count);
} }
allThsLogPO.addAll(thsOverRunLogList); allThsLogPO.addAll(thsOverRunLogList);
@@ -658,19 +660,30 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
} }
if(superviseParam.getInitType().equals(InitTypeEnum.AUTO.getCode())){ if (superviseParam.getInitType().equals(InitTypeEnum.AUTO.getCode())) {
if(CollectionUtil.isNotEmpty(thsSuperviseListPO)){ if (CollectionUtil.isNotEmpty(thsSuperviseListPO)) {
//处理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);
}
this.saveBatch(thsSuperviseListPO); this.saveBatch(thsSuperviseListPO);
thsOverRunLogService.saveBatch(allThsLogPO); thsOverRunLogService.saveBatch(allThsLogPO);
return null; return null;
} }
}else { } else {
superviceRunLogVo.setOverRunLog(allThsLogPO); superviceRunLogVo.setOverRunLog(allThsLogPO);
return superviceRunLogVo; return superviceRunLogVo;
} }
} }
@@ -680,7 +693,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
return superviceRunLogVo; return superviceRunLogVo;
} }
@Override /*@Override
public SuperviceRunLogVo initSuperviseHand(SuperviseParam superviseParam) { public SuperviceRunLogVo initSuperviseHand(SuperviseParam superviseParam) {
SuperviceRunLogVo superviceRunLogVo = new SuperviceRunLogVo(); SuperviceRunLogVo superviceRunLogVo = new SuperviceRunLogVo();
List<ThsOverRunLog> thsOverRunLogList = new ArrayList<>(); List<ThsOverRunLog> thsOverRunLogList = new ArrayList<>();
@@ -704,7 +717,6 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
Dept dept = deptFeignClient.getDeptById(oneStrategyVo.getDeptId()).getData(); Dept dept = deptFeignClient.getDeptById(oneStrategyVo.getDeptId()).getData();
List<ThsWarnStrategyAss> oneInterferenceSourceAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.SOURCE_TYPE);//干扰源列表 List<ThsWarnStrategyAss> oneInterferenceSourceAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.SOURCE_TYPE);//干扰源列表
List<ThsWarnStrategyAss> oneSteadyIndicatorAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.INTERFERENCE_TYPE);//指标类型列表 List<ThsWarnStrategyAss> oneSteadyIndicatorAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.INTERFERENCE_TYPE);//指标类型列表
List<ThsWarnStrategyAss> oneMonitorAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.MONITOR_TYPE);//监测点列表 List<ThsWarnStrategyAss> oneMonitorAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.MONITOR_TYPE);//监测点列表
@@ -721,43 +733,43 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
monitorGetParam.setDeptIds(deptAllIds); monitorGetParam.setDeptIds(deptAllIds);
//TODO 需要校验 //TODO 需要校验
List<CommMonitorInfoDTO> commMonitorInfoDTOList = commTerminalGeneralClient.tagOrIdGetMonitorList(monitorGetParam).getData(); List<CommMonitorInfoDTO> commMonitorInfoDTOList = commTerminalGeneralClient.tagOrIdGetMonitorList(monitorGetParam).getData();
Map<String,CommMonitorInfoDTO> monitorInfoDTOMap = commMonitorInfoDTOList.stream().collect(Collectors.toMap(CommMonitorInfoDTO::getId,Function.identity())); 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<String> temIds = commMonitorInfoDTOList.stream().map(CommMonitorInfoDTO::getId).distinct().collect(Collectors.toList());
List<RStatLimitRateDPO> rStatLimitRateDPOList = rStatLimitRateDClient.monitorIdsGetLimitInfo(RStatLimitQueryParam.builder().ids(temIds).date(yesterday).build()).getData(); List<RStatLimitRateDPO> rStatLimitRateDPOList = rStatLimitRateDClient.monitorIdsGetLimitInfo(RStatLimitQueryParam.builder().ids(temIds).date(yesterday).build()).getData();
//TODO 数据中心和pms这边稳态指标没用一个需要考虑兼容问题 //TODO 数据中心和pms这边稳态指标没用一个需要考虑兼容问题
dictTargetList = dictTargetList.stream().filter(item->targetIds.contains(item.getId())).collect(Collectors.toList()); dictTargetList = dictTargetList.stream().filter(item -> targetIds.contains(item.getId())).collect(Collectors.toList());
//判断指标是否在策略中 //判断指标是否在策略中
if(CollectionUtil.isNotEmpty(rStatLimitRateDPOList)){ if (CollectionUtil.isNotEmpty(rStatLimitRateDPOList)) {
for(RStatLimitRateDPO rStatLimitRateDPO :rStatLimitRateDPOList ){ for (RStatLimitRateDPO rStatLimitRateDPO : rStatLimitRateDPOList) {
List<String> descriptionList = new ArrayList<>(); List<String> descriptionList = new ArrayList<>();
Integer[] count = {0}; Integer[] count = {0};
Map<String,Boolean> limitBoolMap = verifyLimit(rStatLimitRateDPO,dictTargetList,descriptionList,count); Map<String, Boolean> limitBoolMap = verifyLimit(rStatLimitRateDPO, dictTargetList, descriptionList, count);
if(oneStrategyVo.getOperation().equals(OperationEnum.AND.getCode()) ){ if (oneStrategyVo.getOperation().equals(OperationEnum.AND.getCode())) {
//与 //与
boolean res = limitBoolMap.containsValue(false); boolean res = limitBoolMap.containsValue(false);
if(res){ if (res) {
continue; continue;
} }
}else { } else {
//或 //或
boolean res = limitBoolMap.containsValue(true); boolean res = limitBoolMap.containsValue(true);
if(!res){ if (!res) {
continue; continue;
} }
} }
//到这一步说明符合策略保留该条数据,开始组装实体 //到这一步说明符合策略保留该条数据,开始组装实体
if(Objects.isNull(thsSupervise)){ if (Objects.isNull(thsSupervise)) {
thsSupervise = new ThsSupervise(); thsSupervise = new ThsSupervise();
buildSuperviseData(yesterday,dept,superviseParam,oneStrategyVo,superviseParam.getInitType(),thsSupervise); buildSuperviseData(yesterday, dept, superviseParam, oneStrategyVo, superviseParam.getInitType(), thsSupervise);
} }
buildOverRunLog(thsSupervise,monitorInfoDTOMap.get(rStatLimitRateDPO.getLineId()),descriptionList,thsOverRunLogList,count); buildOverRunLog(thsSupervise, monitorInfoDTOMap.get(rStatLimitRateDPO.getLineId()), descriptionList, thsOverRunLogList, count);
} }
@@ -770,18 +782,18 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
} }
superviceRunLogVo.setOverRunLog(thsOverRunLogList); superviceRunLogVo.setOverRunLog(thsOverRunLogList);
return superviceRunLogVo; return superviceRunLogVo;
} }*/
@Override @Override
public Page<ThsSupervise> queryPage(ThsSuperviseParam thsSuperviseParam) { public Page<ThsSupervise> queryPage(ThsSuperviseParam thsSuperviseParam) {
return this.page(new Page<>(thsSuperviseParam.getPageNum(),thsSuperviseParam.getPageSize()),new LambdaQueryWrapper<ThsSupervise>() return this.page(new Page<>(thsSuperviseParam.getPageNum(), thsSuperviseParam.getPageSize()), new LambdaQueryWrapper<ThsSupervise>()
.between(ThsSupervise::getCreateTime,DateUtil.beginOfDay(DateUtil.parse(thsSuperviseParam.getStartTime())),DateUtil.endOfDay(DateUtil.parse(thsSuperviseParam.getEndTime()))) .between(ThsSupervise::getCreateTime, DateUtil.beginOfDay(DateUtil.parse(thsSuperviseParam.getStartTime())), DateUtil.endOfDay(DateUtil.parse(thsSuperviseParam.getEndTime())))
.eq(ThsSupervise::getDeptId,thsSuperviseParam.getDeptId())); .eq(ThsSupervise::getDeptId, thsSuperviseParam.getDeptId()));
} }
public void buildSuperviseData(String yesterday,Dept dept ,SuperviseParam superviseParam,ThsStrategyVo steady,Integer initType, ThsSupervise thsSupervise) { public void buildSuperviseData(String yesterday, Dept dept, SuperviseParam superviseParam, ThsStrategyVo steady, Integer initType, ThsSupervise thsSupervise) {
if (thsSupervise != null && StringUtils.isBlank(thsSupervise.getSupIndex())) { if (thsSupervise != null && StringUtils.isBlank(thsSupervise.getSupIndex())) {
thsSupervise.setName(yesterday+dept.getName()+AlarmTypeEnum.getAlarmTypeEnumByCode(superviseParam.getType()).getMessage()); thsSupervise.setName(yesterday + dept.getName() + AlarmTypeEnum.getAlarmTypeEnumByCode(superviseParam.getType()).getMessage());
thsSupervise.setSupIndex(IdUtil.simpleUUID()); thsSupervise.setSupIndex(IdUtil.simpleUUID());
thsSupervise.setDeptId(steady.getDeptId()); thsSupervise.setDeptId(steady.getDeptId());
thsSupervise.setCreateTime(new Date()); thsSupervise.setCreateTime(new Date());
@@ -792,7 +804,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
} }
} }
public void buildOverRunLog(ThsSupervise thsSupervise, CommMonitorInfoDTO monitor,List<String> descriptionList,List<ThsOverRunLog> thsOverRunLogs,Integer[] count) { public void buildOverRunLog(ThsSupervise thsSupervise, CommMonitorInfoDTO monitor, List<String> descriptionList, List<ThsOverRunLog> thsOverRunLogs, Integer[] count) {
ThsOverRunLog thsOverRunLog = new ThsOverRunLog(); ThsOverRunLog thsOverRunLog = new ThsOverRunLog();
thsOverRunLog.setId(IdUtil.simpleUUID()); thsOverRunLog.setId(IdUtil.simpleUUID());
thsOverRunLog.setSupIndex(thsSupervise.getSupIndex()); thsOverRunLog.setSupIndex(thsSupervise.getSupIndex());
@@ -815,8 +827,6 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
} }
/** /**
* 批量下载.zip文件 * 批量下载.zip文件
* *
@@ -889,18 +899,18 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
* @param rStatLimitRateDPO * @param rStatLimitRateDPO
* @param dictTargetList * @param dictTargetList
*/ */
private Map<String, Boolean> verifyLimit(RStatLimitRateDPO rStatLimitRateDPO,List<DictData> dictTargetList,List<String> descriptionList,Integer[] count) { private Map<String, Boolean> verifyLimit(RStatLimitRateDPO rStatLimitRateDPO, List<DictData> dictTargetList, List<String> descriptionList, Integer[] count) {
Map<String, Boolean> limitBoolMap = new HashMap<>(); Map<String, Boolean> limitBoolMap = new HashMap<>();
for(DictData dic : dictTargetList){ for (DictData dic : dictTargetList) {
SteadyIndicatorEnum steadyIndicatorEnum = SteadyIndicatorEnum.getSteadyIndicatorEnumByCode(dic.getCode()); SteadyIndicatorEnum steadyIndicatorEnum = SteadyIndicatorEnum.getSteadyIndicatorEnumByCode(dic.getCode());
switch (steadyIndicatorEnum) { switch (steadyIndicatorEnum) {
case Negative_Voltage://负序电压不平衡度 case Negative_Voltage://负序电压不平衡度
if (rStatLimitRateDPO.getUbalanceOvertime() > 0) { if (rStatLimitRateDPO.getUbalanceOvertime() > 0) {
limitBoolMap.put(Negative_Voltage.getCode(), true); limitBoolMap.put(Negative_Voltage.getCode(), true);
descriptionList.add(Negative_Voltage.getMessage().concat(rStatLimitRateDPO.getUbalanceOvertime() + "")); descriptionList.add(Negative_Voltage.getMessage().concat(rStatLimitRateDPO.getUbalanceOvertime() + ""));
count[0] = count[0]+rStatLimitRateDPO.getUbalanceOvertime(); count[0] = count[0] + rStatLimitRateDPO.getUbalanceOvertime();
} else { } else {
limitBoolMap.put(Negative_Voltage.getCode(), false); limitBoolMap.put(Negative_Voltage.getCode(), false);
} }
@@ -910,7 +920,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
if (interharVoltageOvertime > 0) { if (interharVoltageOvertime > 0) {
limitBoolMap.put(SteadyIndicatorEnum.Interhar_Voltage.getCode(), true); limitBoolMap.put(SteadyIndicatorEnum.Interhar_Voltage.getCode(), true);
descriptionList.add(SteadyIndicatorEnum.Interhar_Voltage.getMessage().concat(interharVoltageOvertime + "")); descriptionList.add(SteadyIndicatorEnum.Interhar_Voltage.getMessage().concat(interharVoltageOvertime + ""));
count[0] = count[0]+interharVoltageOvertime; count[0] = count[0] + interharVoltageOvertime;
} else { } else {
limitBoolMap.put(SteadyIndicatorEnum.Interhar_Voltage.getCode(), false); limitBoolMap.put(SteadyIndicatorEnum.Interhar_Voltage.getCode(), false);
} }
@@ -919,7 +929,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
if (rStatLimitRateDPO.getINegOvertime() > 0) { if (rStatLimitRateDPO.getINegOvertime() > 0) {
limitBoolMap.put(SteadyIndicatorEnum.Neg_Current.getCode(), true); limitBoolMap.put(SteadyIndicatorEnum.Neg_Current.getCode(), true);
descriptionList.add(SteadyIndicatorEnum.Neg_Current.getMessage().concat(rStatLimitRateDPO.getINegOvertime() + "")); descriptionList.add(SteadyIndicatorEnum.Neg_Current.getMessage().concat(rStatLimitRateDPO.getINegOvertime() + ""));
count[0] = count[0]+rStatLimitRateDPO.getINegOvertime(); count[0] = count[0] + rStatLimitRateDPO.getINegOvertime();
} else { } else {
limitBoolMap.put(SteadyIndicatorEnum.Neg_Current.getCode(), false); limitBoolMap.put(SteadyIndicatorEnum.Neg_Current.getCode(), false);
} }
@@ -928,7 +938,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
if (rStatLimitRateDPO.getFreqDevOvertime() > 0) { if (rStatLimitRateDPO.getFreqDevOvertime() > 0) {
limitBoolMap.put(SteadyIndicatorEnum.Fre_Deviation.getCode(), true); limitBoolMap.put(SteadyIndicatorEnum.Fre_Deviation.getCode(), true);
descriptionList.add(SteadyIndicatorEnum.Fre_Deviation.getMessage().concat(rStatLimitRateDPO.getFreqDevOvertime() + "")); descriptionList.add(SteadyIndicatorEnum.Fre_Deviation.getMessage().concat(rStatLimitRateDPO.getFreqDevOvertime() + ""));
count[0] = count[0]+rStatLimitRateDPO.getFreqDevOvertime(); count[0] = count[0] + rStatLimitRateDPO.getFreqDevOvertime();
} else { } else {
limitBoolMap.put(SteadyIndicatorEnum.Fre_Deviation.getCode(), false); limitBoolMap.put(SteadyIndicatorEnum.Fre_Deviation.getCode(), false);
} }
@@ -937,7 +947,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
if (rStatLimitRateDPO.getVoltageDevOvertime() > 0) { if (rStatLimitRateDPO.getVoltageDevOvertime() > 0) {
limitBoolMap.put(SteadyIndicatorEnum.Voltage_Dev.getCode(), true); limitBoolMap.put(SteadyIndicatorEnum.Voltage_Dev.getCode(), true);
descriptionList.add(SteadyIndicatorEnum.Voltage_Dev.getMessage().concat(rStatLimitRateDPO.getVoltageDevOvertime() + "")); descriptionList.add(SteadyIndicatorEnum.Voltage_Dev.getMessage().concat(rStatLimitRateDPO.getVoltageDevOvertime() + ""));
count[0] = count[0]+rStatLimitRateDPO.getVoltageDevOvertime(); count[0] = count[0] + rStatLimitRateDPO.getVoltageDevOvertime();
} else { } else {
limitBoolMap.put(SteadyIndicatorEnum.Voltage_Dev.getCode(), false); limitBoolMap.put(SteadyIndicatorEnum.Voltage_Dev.getCode(), false);
} }
@@ -947,7 +957,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
if (harCurrentOvertime > 0) { if (harCurrentOvertime > 0) {
limitBoolMap.put(SteadyIndicatorEnum.Har_Current.getCode(), true); limitBoolMap.put(SteadyIndicatorEnum.Har_Current.getCode(), true);
descriptionList.add(SteadyIndicatorEnum.Har_Current.getMessage().concat(harCurrentOvertime + "")); descriptionList.add(SteadyIndicatorEnum.Har_Current.getMessage().concat(harCurrentOvertime + ""));
count[0] = count[0]+harCurrentOvertime; count[0] = count[0] + harCurrentOvertime;
} else { } else {
@@ -958,7 +968,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
if (rStatLimitRateDPO.getFlickerOvertime() > 0) { if (rStatLimitRateDPO.getFlickerOvertime() > 0) {
limitBoolMap.put(SteadyIndicatorEnum.Voltage_Fluc.getCode(), true); limitBoolMap.put(SteadyIndicatorEnum.Voltage_Fluc.getCode(), true);
descriptionList.add(SteadyIndicatorEnum.Voltage_Fluc.getMessage().concat(rStatLimitRateDPO.getFlickerOvertime() + "")); descriptionList.add(SteadyIndicatorEnum.Voltage_Fluc.getMessage().concat(rStatLimitRateDPO.getFlickerOvertime() + ""));
count[0] = count[0]+rStatLimitRateDPO.getFlickerOvertime(); count[0] = count[0] + rStatLimitRateDPO.getFlickerOvertime();
} else { } else {
limitBoolMap.put(SteadyIndicatorEnum.Voltage_Fluc.getCode(), false); limitBoolMap.put(SteadyIndicatorEnum.Voltage_Fluc.getCode(), false);
} }
@@ -968,7 +978,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
if (harVoltageOvertime > 0) { if (harVoltageOvertime > 0) {
limitBoolMap.put(SteadyIndicatorEnum.Har_Voltage.getCode(), true); limitBoolMap.put(SteadyIndicatorEnum.Har_Voltage.getCode(), true);
descriptionList.add(SteadyIndicatorEnum.Har_Voltage.getMessage().concat(harVoltageOvertime + "")); descriptionList.add(SteadyIndicatorEnum.Har_Voltage.getMessage().concat(harVoltageOvertime + ""));
count[0] = count[0]+harVoltageOvertime; count[0] = count[0] + harVoltageOvertime;
} else { } else {
limitBoolMap.put(SteadyIndicatorEnum.Har_Voltage.getCode(), false); limitBoolMap.put(SteadyIndicatorEnum.Har_Voltage.getCode(), false);
} }
@@ -977,7 +987,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
if (rStatLimitRateDPO.getUaberranceOvertime() > 0) { if (rStatLimitRateDPO.getUaberranceOvertime() > 0) {
limitBoolMap.put(SteadyIndicatorEnum.Thd_V.getCode(), true); limitBoolMap.put(SteadyIndicatorEnum.Thd_V.getCode(), true);
descriptionList.add(SteadyIndicatorEnum.Thd_V.getMessage().concat(rStatLimitRateDPO.getUaberranceOvertime() + "")); descriptionList.add(SteadyIndicatorEnum.Thd_V.getMessage().concat(rStatLimitRateDPO.getUaberranceOvertime() + ""));
count[0] = count[0]+rStatLimitRateDPO.getUaberranceOvertime(); count[0] = count[0] + rStatLimitRateDPO.getUaberranceOvertime();
} else { } else {
limitBoolMap.put(SteadyIndicatorEnum.Thd_V.getCode(), false); limitBoolMap.put(SteadyIndicatorEnum.Thd_V.getCode(), false);
} }