1.技术监督调整
This commit is contained in:
@@ -54,7 +54,7 @@ public class ThsSuperviseController extends BaseController {
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
/* @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("预警/告警事务生成手动")
|
||||
@ApiImplicitParam(name = "superviseParam", value = "创建技术监督参数", required = true)
|
||||
@PostMapping("/initSuperviseHand")
|
||||
@@ -63,7 +63,7 @@ public class ThsSuperviseController extends BaseController {
|
||||
SuperviceRunLogVo result = thsSuperviseService.initSuperviseHand(superviseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("预警/告警事务生成自动")
|
||||
|
||||
@@ -116,7 +116,7 @@ public interface ThsSuperviseService extends IService<ThsSupervise> {
|
||||
SuperviceRunLogVo initSupervise(@RequestBody @Validated SuperviseParam superviseParam);
|
||||
|
||||
|
||||
SuperviceRunLogVo initSuperviseHand(@RequestBody @Validated SuperviseParam superviseParam);
|
||||
//SuperviceRunLogVo initSuperviseHand(@RequestBody @Validated SuperviseParam superviseParam);
|
||||
|
||||
|
||||
Page<ThsSupervise> queryPage(ThsSuperviseParam thsSuperviseParam);
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.njcn.harmonic.pojo.vo.ThsStrategyVo;
|
||||
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.param.SuperviseParam;
|
||||
import com.njcn.process.pojo.po.ThsOverRunLog;
|
||||
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 {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private final ThsWarnStrategyMapper thsWarnStrategyMapper;
|
||||
|
||||
private final ThsWarnStrategyAssMapper thsWarnStrategyAssMapper;
|
||||
@@ -125,6 +123,8 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
|
||||
private final FlowableAssMapper flowableAssMapper;
|
||||
|
||||
private final IFlowDefinitionService flowDefinitionService;
|
||||
|
||||
private final ThsDeptMonitorMapper thsDeptMonitorMapper;
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
@@ -167,12 +167,12 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
//TODO 解决工作流写死问题
|
||||
Map<String, Object> mapParam = new HashMap<>();
|
||||
String proInId = "";
|
||||
if(thsSupervise.getType() == 0){
|
||||
if (thsSupervise.getType() == 0) {
|
||||
proInId = "flow_yzep99kb:1:a100b48b-da75-11ed-8335-b07b253cdad9";
|
||||
}else {
|
||||
} else {
|
||||
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()) {
|
||||
@@ -188,7 +188,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
Integer pageNum = PageFactory.getPageNum(superviseDto);
|
||||
Integer pageSize = PageFactory.getPageSize(superviseDto);
|
||||
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();
|
||||
if (CollectionUtil.isNotEmpty(pageRecords)) {
|
||||
for (SuperviseVo superviseVo : pageRecords) {
|
||||
@@ -231,11 +231,11 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
thsSuperviseMapper.delete(new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, id));
|
||||
|
||||
//删除同时删除工作流程
|
||||
FlowableAss flowableAss = flowableAssMapper.selectById(id);
|
||||
if(Objects.nonNull(flowableAss)) {
|
||||
iFlowDefinitionService.deleteInstance(flowableAss.getExecIndex(), "");
|
||||
flowableAssMapper.deleteById(id);
|
||||
}
|
||||
FlowableAss flowableAss = flowableAssMapper.selectById(id);
|
||||
if (Objects.nonNull(flowableAss)) {
|
||||
iFlowDefinitionService.deleteInstance(flowableAss.getExecIndex(), "");
|
||||
flowableAssMapper.deleteById(id);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
@@ -248,25 +248,25 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
public void uploadSuperviseTicket(String id, String supIndex, Integer ticketType, MultipartFile[] files, HttpServletResponse response) {
|
||||
ThsSupervise thsSupervise = new ThsSupervise();
|
||||
thsSupervise.setSupIndex(supIndex);
|
||||
ThsSupervise thsSuperObj = thsSuperviseMapper.selectById(supIndex);
|
||||
ThsSupervise thsSuperObj = thsSuperviseMapper.selectById(supIndex);
|
||||
|
||||
if (files != null && files.length == 1) {
|
||||
ThsOverRunLog thsOverRunLog = thsOverRunLogService.getById(id);
|
||||
thsOverRunLog.setId(id);
|
||||
String path = fileStorageUtil.uploadMultipart(files[0], OssPath.ELECTRICITY_QUALITY);
|
||||
this.updateSuperviesData(path, thsOverRunLog, ticketType, thsSupervise);
|
||||
this.updateProcess(thsSupervise, ticketType,thsSuperObj.getType());
|
||||
this.updateProcess(thsSupervise, ticketType, thsSuperObj.getType());
|
||||
}
|
||||
if (files != null && files.length > 1) {
|
||||
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogService.list(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
|
||||
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<String> fileNames = thsOverRunLogs.stream().filter(item-> StrUtil.isNotBlank(item.getFeedback())).map(ThsOverRunLog::getFileName).distinct().collect(Collectors.toList());
|
||||
if(fileNames.size() == thsOverRunLogs.size()){
|
||||
List<String> fileNames = thsOverRunLogs.stream().filter(item -> StrUtil.isNotBlank(item.getFeedback())).map(ThsOverRunLog::getFileName).distinct().collect(Collectors.toList());
|
||||
if (fileNames.size() == thsOverRunLogs.size()) {
|
||||
FlowableAss flowableAss = flowableAssMapper.selectById(supIndex);
|
||||
Task task = iFlowTaskService.getTask(flowableAss.getExecIndex());
|
||||
|
||||
@@ -285,7 +285,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
* @param ticketType
|
||||
* @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);
|
||||
if (ticketTypeEnum == null) {
|
||||
throw new BusinessException("上传单据参数类型错误!");
|
||||
@@ -295,9 +295,9 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
thsSupervise.setProgress(ProgressEnum.TEST_REPORT.getCode());
|
||||
break;
|
||||
case TEST_REPORT:
|
||||
if(AlarmTypeEnum.EARLY_WARN.getCode().equals(type)){
|
||||
if (AlarmTypeEnum.EARLY_WARN.getCode().equals(type)) {
|
||||
thsSupervise.setProgress(ProgressEnum.END.getCode());
|
||||
}else {
|
||||
} else {
|
||||
thsSupervise.setProgress(ProgressEnum.REVISE_NOTICE_ISSUE.getCode());
|
||||
}
|
||||
break;
|
||||
@@ -411,8 +411,6 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
thsAlarmFormworkMapper.insert(alarmFormwork);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -424,8 +422,11 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
throw new BusinessException("请先上传下发单模板单据!");
|
||||
}
|
||||
String fileUrl = fileStorageUtil.getFileUrl(thsAlarmFormwork.getPath());
|
||||
|
||||
|
||||
ThsSupervise thsSupervise = new ThsSupervise();
|
||||
thsSupervise.setModifyTime(new Date());
|
||||
thsSupervise.setModifyUser(RequestUtil.getUserIndex());
|
||||
ThsOverRunLog thsOverRunLog = new ThsOverRunLog();
|
||||
thsOverRunLog.setSupIndex(supIndex);
|
||||
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));
|
||||
thsSuperviseMapper.update(thsSupervise, new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, supIndex));
|
||||
|
||||
|
||||
FlowableAss flowableAss = flowableAssMapper.selectById(supIndex);
|
||||
Task task = iFlowTaskService.getTask(flowableAss.getExecIndex());
|
||||
|
||||
@@ -565,9 +567,9 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 生成预警单告警单(自动)
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2024/1/29
|
||||
*/
|
||||
@@ -613,44 +615,44 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
monitorGetParam.setDeptIds(deptAllIds);
|
||||
//TODO 需要校验
|
||||
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();
|
||||
|
||||
//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)){
|
||||
for(RStatLimitRateDPO rStatLimitRateDPO :rStatLimitRateDPOList ){
|
||||
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);
|
||||
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);
|
||||
if(res){
|
||||
if (res) {
|
||||
continue;
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
//或
|
||||
boolean res = limitBoolMap.containsValue(true);
|
||||
if(!res){
|
||||
if (!res) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//到这一步说明符合策略保留该条数据,开始组装实体
|
||||
if(Objects.isNull(thsSupervise)){
|
||||
if (Objects.isNull(thsSupervise)) {
|
||||
thsSupervise = new ThsSupervise();
|
||||
buildSuperviseData(yesterday,dept,superviseParam,oneStrategyVo,superviseParam.getInitType(),thsSupervise);
|
||||
buildSuperviseData(yesterday, dept, superviseParam, oneStrategyVo, superviseParam.getInitType(), 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);
|
||||
@@ -658,19 +660,30 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
}
|
||||
|
||||
|
||||
if(superviseParam.getInitType().equals(InitTypeEnum.AUTO.getCode())){
|
||||
if(CollectionUtil.isNotEmpty(thsSuperviseListPO)){
|
||||
if (superviseParam.getInitType().equals(InitTypeEnum.AUTO.getCode())) {
|
||||
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);
|
||||
thsOverRunLogService.saveBatch(allThsLogPO);
|
||||
return null;
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
superviceRunLogVo.setOverRunLog(allThsLogPO);
|
||||
return superviceRunLogVo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -680,7 +693,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
return superviceRunLogVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public SuperviceRunLogVo initSuperviseHand(SuperviseParam superviseParam) {
|
||||
SuperviceRunLogVo superviceRunLogVo = new SuperviceRunLogVo();
|
||||
List<ThsOverRunLog> thsOverRunLogList = new ArrayList<>();
|
||||
@@ -695,93 +708,92 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
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) {
|
||||
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();
|
||||
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<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());
|
||||
|
||||
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);
|
||||
|
||||
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> 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<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这边稳态指标没用一个需要考虑兼容问题
|
||||
dictTargetList = dictTargetList.stream().filter(item -> targetIds.contains(item.getId())).collect(Collectors.toList());
|
||||
|
||||
//TODO 数据中心和pms这边稳态指标没用一个需要考虑兼容问题
|
||||
dictTargetList = dictTargetList.stream().filter(item->targetIds.contains(item.getId())).collect(Collectors.toList());
|
||||
//判断指标是否在策略中
|
||||
if (CollectionUtil.isNotEmpty(rStatLimitRateDPOList)) {
|
||||
for (RStatLimitRateDPO rStatLimitRateDPO : rStatLimitRateDPOList) {
|
||||
|
||||
//判断指标是否在策略中
|
||||
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<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 (oneStrategyVo.getOperation().equals(OperationEnum.AND.getCode())) {
|
||||
//与
|
||||
boolean res = limitBoolMap.containsValue(false);
|
||||
if (res) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//到这一步说明符合策略保留该条数据,开始组装实体
|
||||
if(Objects.isNull(thsSupervise)){
|
||||
thsSupervise = new ThsSupervise();
|
||||
buildSuperviseData(yesterday,dept,superviseParam,oneStrategyVo,superviseParam.getInitType(),thsSupervise);
|
||||
} else {
|
||||
//或
|
||||
boolean res = limitBoolMap.containsValue(true);
|
||||
if (!res) {
|
||||
continue;
|
||||
}
|
||||
buildOverRunLog(thsSupervise,monitorInfoDTOMap.get(rStatLimitRateDPO.getLineId()),descriptionList,thsOverRunLogList,count);
|
||||
|
||||
}
|
||||
|
||||
//到这一步说明符合策略保留该条数据,开始组装实体
|
||||
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) {
|
||||
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())))
|
||||
.eq(ThsSupervise::getDeptId,thsSuperviseParam.getDeptId()));
|
||||
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())))
|
||||
.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())) {
|
||||
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.setDeptId(steady.getDeptId());
|
||||
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.setId(IdUtil.simpleUUID());
|
||||
thsOverRunLog.setSupIndex(thsSupervise.getSupIndex());
|
||||
@@ -815,8 +827,6 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 批量下载.zip文件
|
||||
*
|
||||
@@ -889,18 +899,18 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
* @param rStatLimitRateDPO
|
||||
* @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<>();
|
||||
for(DictData dic : dictTargetList){
|
||||
for (DictData dic : dictTargetList) {
|
||||
SteadyIndicatorEnum steadyIndicatorEnum = SteadyIndicatorEnum.getSteadyIndicatorEnumByCode(dic.getCode());
|
||||
switch (steadyIndicatorEnum) {
|
||||
case Negative_Voltage://负序电压不平衡度
|
||||
if (rStatLimitRateDPO.getUbalanceOvertime() > 0) {
|
||||
limitBoolMap.put(Negative_Voltage.getCode(), true);
|
||||
descriptionList.add(Negative_Voltage.getMessage().concat(rStatLimitRateDPO.getUbalanceOvertime() + "次"));
|
||||
count[0] = count[0]+rStatLimitRateDPO.getUbalanceOvertime();
|
||||
count[0] = count[0] + rStatLimitRateDPO.getUbalanceOvertime();
|
||||
} else {
|
||||
limitBoolMap.put(Negative_Voltage.getCode(), false);
|
||||
}
|
||||
@@ -910,7 +920,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
if (interharVoltageOvertime > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Interhar_Voltage.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Interhar_Voltage.getMessage().concat(interharVoltageOvertime + "次"));
|
||||
count[0] = count[0]+interharVoltageOvertime;
|
||||
count[0] = count[0] + interharVoltageOvertime;
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Interhar_Voltage.getCode(), false);
|
||||
}
|
||||
@@ -919,7 +929,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
if (rStatLimitRateDPO.getINegOvertime() > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Neg_Current.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Neg_Current.getMessage().concat(rStatLimitRateDPO.getINegOvertime() + "次"));
|
||||
count[0] = count[0]+rStatLimitRateDPO.getINegOvertime();
|
||||
count[0] = count[0] + rStatLimitRateDPO.getINegOvertime();
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Neg_Current.getCode(), false);
|
||||
}
|
||||
@@ -928,7 +938,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
if (rStatLimitRateDPO.getFreqDevOvertime() > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Fre_Deviation.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Fre_Deviation.getMessage().concat(rStatLimitRateDPO.getFreqDevOvertime() + "次"));
|
||||
count[0] = count[0]+rStatLimitRateDPO.getFreqDevOvertime();
|
||||
count[0] = count[0] + rStatLimitRateDPO.getFreqDevOvertime();
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Fre_Deviation.getCode(), false);
|
||||
}
|
||||
@@ -937,7 +947,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
if (rStatLimitRateDPO.getVoltageDevOvertime() > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Voltage_Dev.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Voltage_Dev.getMessage().concat(rStatLimitRateDPO.getVoltageDevOvertime() + "次"));
|
||||
count[0] = count[0]+rStatLimitRateDPO.getVoltageDevOvertime();
|
||||
count[0] = count[0] + rStatLimitRateDPO.getVoltageDevOvertime();
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Voltage_Dev.getCode(), false);
|
||||
}
|
||||
@@ -947,7 +957,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
if (harCurrentOvertime > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Har_Current.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Har_Current.getMessage().concat(harCurrentOvertime + "次"));
|
||||
count[0] = count[0]+harCurrentOvertime;
|
||||
count[0] = count[0] + harCurrentOvertime;
|
||||
|
||||
|
||||
} else {
|
||||
@@ -958,7 +968,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
if (rStatLimitRateDPO.getFlickerOvertime() > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Voltage_Fluc.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Voltage_Fluc.getMessage().concat(rStatLimitRateDPO.getFlickerOvertime() + "次"));
|
||||
count[0] = count[0]+rStatLimitRateDPO.getFlickerOvertime();
|
||||
count[0] = count[0] + rStatLimitRateDPO.getFlickerOvertime();
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Voltage_Fluc.getCode(), false);
|
||||
}
|
||||
@@ -968,7 +978,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
if (harVoltageOvertime > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Har_Voltage.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Har_Voltage.getMessage().concat(harVoltageOvertime + "次"));
|
||||
count[0] = count[0]+harVoltageOvertime;
|
||||
count[0] = count[0] + harVoltageOvertime;
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Har_Voltage.getCode(), false);
|
||||
}
|
||||
@@ -977,7 +987,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
if (rStatLimitRateDPO.getUaberranceOvertime() > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Thd_V.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Thd_V.getMessage().concat(rStatLimitRateDPO.getUaberranceOvertime() + "次"));
|
||||
count[0] = count[0]+rStatLimitRateDPO.getUaberranceOvertime();
|
||||
count[0] = count[0] + rStatLimitRateDPO.getUaberranceOvertime();
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Thd_V.getCode(), false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user