优化异常数据和稳态告警接口信息

This commit is contained in:
wr
2025-12-25 15:32:21 +08:00
parent 917e3fb2d5
commit 778f689b3e
8 changed files with 120 additions and 154 deletions

View File

@@ -17,7 +17,7 @@ public class DetailAbnormalVO {
private String date; private String date;
private List<String> dateList; private List<TimeAndTargetKey> dateTargetList;
private String monitorName; private String monitorName;
@@ -29,7 +29,13 @@ public class DetailAbnormalVO {
private String targetKey; private String targetKey;
@Data
public static class TimeAndTargetKey {
private String date;
private List<VerifyTargetVO> targetKeys;
}
/** /**
* 异常实体 * 异常实体
*/ */
@@ -68,6 +74,14 @@ public class DetailAbnormalVO {
private List<DetailAbnormalInnerVO> time; private List<DetailAbnormalInnerVO> time;
} }
@Data
public static class DetailLimitCountVO {
private Integer timeSum;
private Integer errCount;
private List<DetailLimitInnerVO> time;
}
@Data @Data
public static class DetailLimitInnerVO{ public static class DetailLimitInnerVO{

View File

@@ -134,9 +134,9 @@ public class DataVerifyController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/monitorLimitTableDetail") @PostMapping("/monitorLimitTableDetail")
@ApiOperation("弹框-获取稳态告警监测点列表详情") @ApiOperation("弹框-获取稳态告警监测点列表详情")
public HttpResult<List<DetailAbnormalVO.DetailLimitInnerVO>> monitorLimitTableDetail(@RequestBody MonitorBaseParam monitorBaseParam){ public HttpResult<DetailAbnormalVO.DetailLimitCountVO> monitorLimitTableDetail(@RequestBody MonitorBaseParam monitorBaseParam){
String methodDescribe = getMethodDescribe("monitorLimitTableDetail"); String methodDescribe = getMethodDescribe("monitorLimitTableDetail");
List<DetailAbnormalVO.DetailLimitInnerVO> list = iDataVerifyService.monitorLimitTableDetail(monitorBaseParam); DetailAbnormalVO.DetailLimitCountVO list = iDataVerifyService.monitorLimitTableDetail(monitorBaseParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
} }

View File

@@ -41,7 +41,7 @@ public interface IDataVerifyService extends IService<DataVerify> {
List<DetailAbnormalVO> monitorLimitTable(MonitorBaseParam monitorBaseParam); List<DetailAbnormalVO> monitorLimitTable(MonitorBaseParam monitorBaseParam);
List<DetailAbnormalVO.DetailLimitInnerVO> monitorLimitTableDetail(MonitorBaseParam monitorBaseParam); DetailAbnormalVO.DetailLimitCountVO monitorLimitTableDetail(MonitorBaseParam monitorBaseParam);
DetailAbnormalVO.Assess limitTableDetail(MonitorBaseParam monitorBaseParam); DetailAbnormalVO.Assess limitTableDetail(MonitorBaseParam monitorBaseParam);

View File

@@ -18,6 +18,7 @@ import com.njcn.dataProcess.enums.DataCleanEnum;
import com.njcn.dataProcess.param.DataCleanParam; import com.njcn.dataProcess.param.DataCleanParam;
import com.njcn.dataProcess.param.LineCountEvaluateParam; import com.njcn.dataProcess.param.LineCountEvaluateParam;
import com.njcn.dataProcess.pojo.dto.DataLimitRateDetailDto; import com.njcn.dataProcess.pojo.dto.DataLimitRateDetailDto;
import com.njcn.dataProcess.pojo.dto.DataLimitRateDto;
import com.njcn.dataProcess.pojo.dto.DataLimitTargetDto; import com.njcn.dataProcess.pojo.dto.DataLimitTargetDto;
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto; import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
import com.njcn.device.biz.enums.DeviceResponseEnum; import com.njcn.device.biz.enums.DeviceResponseEnum;
@@ -30,6 +31,7 @@ import com.njcn.device.pq.mapper.DataVerifyMapper;
import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam; import com.njcn.device.pq.pojo.param.dataClean.MonitorBaseParam;
import com.njcn.device.pq.pojo.po.DataVerify; import com.njcn.device.pq.pojo.po.DataVerify;
import com.njcn.device.pq.pojo.po.DeptLine; import com.njcn.device.pq.pojo.po.DeptLine;
import com.njcn.device.pq.pojo.po.PqDataVerifyBak;
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO; import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
import com.njcn.device.pq.pojo.vo.LineDetailDataVO; import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
import com.njcn.device.pq.pojo.vo.dataClean.*; import com.njcn.device.pq.pojo.vo.dataClean.*;
@@ -84,7 +86,6 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
private final DeptLineService deptLineService; private final DeptLineService deptLineService;
@Override @Override
public VerifyMonitorVO getMonitorVerifyData(MonitorBaseParam monitorBaseParam) { public VerifyMonitorVO getMonitorVerifyData(MonitorBaseParam monitorBaseParam) {
List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam); List<String> monitorIds = commTerminalService.getRunMonitorByDept(monitorBaseParam);
@@ -238,137 +239,50 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
List<DetailAbnormalVO> result = new ArrayList<>(); List<DetailAbnormalVO> result = new ArrayList<>();
List<LineDetailDataVO> lineDetailList = lineMapper.getLineDetailDataVO(monitorBaseParam.getMonitorIds()); List<LineDetailDataVO> lineDetailList = lineMapper.getLineDetailDataVO(monitorBaseParam.getMonitorIds());
Map<String, LineDetailDataVO> lineDetailMap = lineDetailList.stream().collect(Collectors.toMap(LineDetailDataVO::getLineId, Function.identity())); Map<String, LineDetailDataVO> lineDetailMap = lineDetailList.stream().collect(Collectors.toMap(LineDetailDataVO::getLineId, Function.identity()));
LineCountEvaluateParam lineCountEvaluateParam = new LineCountEvaluateParam(); LineCountEvaluateParam lineCountEvaluateParam = new LineCountEvaluateParam();
lineCountEvaluateParam.setLineId(monitorBaseParam.getMonitorIds()); lineCountEvaluateParam.setLineId(monitorBaseParam.getMonitorIds());
lineCountEvaluateParam.setStartTime(monitorBaseParam.getSearchBeginTime()); lineCountEvaluateParam.setStartTime(monitorBaseParam.getSearchBeginTime());
lineCountEvaluateParam.setEndTime(monitorBaseParam.getSearchEndTime()); lineCountEvaluateParam.setEndTime(monitorBaseParam.getSearchEndTime());
List<DataLimitRateDetailDto> dataLimitRateDetailDtoList = dataLimitRateDetailFeignClient.getRawData(lineCountEvaluateParam).getData(); List<DataLimitTargetDto> dataLimitTargetDtoList = dataLimitTargetFeignClient.getRawData(lineCountEvaluateParam).getData();
Map<LocalDate, List<DataLimitRateDetailDto>> limitMap = dataLimitRateDetailDtoList.stream().collect(Collectors.groupingBy(DataLimitRateDetailDto::getTime)); Map<String, List<DataLimitTargetDto>> limitMap = dataLimitTargetDtoList.stream().filter(it -> (it.getAllTime() > 0 || it.getFlickerAllTime() > 0)).collect(Collectors.groupingBy(DataLimitTargetDto::getLineId));
limitMap.forEach((lineId, value) -> {
limitMap.forEach((date, list) -> { LineDetailDataVO lineInfoVO = lineDetailMap.get(lineId);
Map<String, DataLimitRateDetailDto> map = list.stream().collect(Collectors.toMap(DataLimitRateDetailDto::getLineId, Function.identity())); DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO();
map.forEach((lineId, line) -> { detailAbnormalVO.setMonitorId(lineId);
LineDetailDataVO lineInfoVO = lineDetailMap.get(lineId); List<DetailAbnormalVO.TimeAndTargetKey> targetKeyList = new ArrayList<>();
Integer timeInterval = lineInfoVO.getTimeInterval(); DetailAbnormalVO.TimeAndTargetKey targetKey;
Set<String> timeSet = new HashSet<>(); for (DataLimitTargetDto dto : value) {
List<String> specialTargetList = new ArrayList<>(); List<VerifyTargetVO> verifyS = assLimitTarget(Arrays.asList(dto)).stream().filter(x -> x.getIds().size() > 0).collect(Collectors.toList());
String jonsStr = ""; if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
if (monitorBaseParam.getTargetKey().equals(DicDataEnum.VOLTAGE_DEV.getCode())) { List<VerifyTargetVO> verify = verifyS.stream().filter(x -> x.getKey().equals(monitorBaseParam.getTargetKey())).collect(Collectors.toList());
//电压偏差 if (CollUtil.isNotEmpty(verify)) {
jonsStr = line.getVoltageDevOvertime(); targetKey = new DetailAbnormalVO.TimeAndTargetKey();
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.FLICKER.getCode())) { targetKey.setDate(dto.getTime().format(DatePattern.NORM_DATE_FORMATTER));
jonsStr = line.getFlickerOvertime(); targetKey.setTargetKeys(verify);
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.phase_Voltage.getCode())) { targetKeyList.add(targetKey);
jonsStr = line.getUbalanceOvertime();
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.FREQUENCY_DEV.getCode())) {
jonsStr = line.getFreqDevOvertime();
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.NEG_CURRENT.getCode())) {
jonsStr = line.getINegOvertime();
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.THD_V.getCode())) {
jonsStr = line.getUaberranceOvertime();
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.HARMONIC_VOLTAGE.getCode())) {
for (int i = 2; i <= 25; i++) {
String uHarmKey = "uharm" + i + "Overtime";
String json = getFieldValueForDetail(line, uHarmKey);
if (StrUtil.isNotBlank(json)) {
specialTargetList.add(json);
}
}
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.HARMONIC_CURRENT.getCode())) {
for (int i = 2; i <= 25; i++) {
String uHarmKey = "iharm" + i + "Overtime";
String json = getFieldValueForDetail(line, uHarmKey);
if (StrUtil.isNotBlank(json)) {
specialTargetList.add(json);
}
}
} else if (monitorBaseParam.getTargetKey().equals(DicDataEnum.INTERHARMONIC_VOLTAGE.getCode())) {
for (int i = 1; i <= 16; i++) {
String uHarmKey = "inuharm" + i + "Overtime";
String json = getFieldValueForDetail(line, uHarmKey);
if (StrUtil.isNotBlank(json)) {
specialTargetList.add(json);
}
} }
} else { } else {
if (StrUtil.isNotBlank(line.getVoltageDevOvertime())) { targetKey = new DetailAbnormalVO.TimeAndTargetKey();
specialTargetList.add(line.getVoltageDevOvertime()); targetKey.setDate(dto.getTime().format(DatePattern.NORM_DATE_FORMATTER));
} targetKey.setTargetKeys(verifyS);
if (StrUtil.isNotBlank(line.getFlickerOvertime())) { targetKeyList.add(targetKey);
specialTargetList.add(line.getFlickerOvertime());
}
if (StrUtil.isNotBlank(line.getUbalanceOvertime())) {
specialTargetList.add(line.getUbalanceOvertime());
}
if (StrUtil.isNotBlank(line.getFreqDevOvertime())) {
specialTargetList.add(line.getFreqDevOvertime());
}
if (StrUtil.isNotBlank(line.getINegOvertime())) {
specialTargetList.add(line.getINegOvertime());
}
if (StrUtil.isNotBlank(line.getUaberranceOvertime())) {
specialTargetList.add(line.getUaberranceOvertime());
}
for (int i = 2; i <= 25; i++) {
String uHarmKey = "uharm" + i + "Overtime";
String json = getFieldValueForDetail(line, uHarmKey);
if (StrUtil.isNotBlank(json)) {
specialTargetList.add(json);
}
}
for (int i = 2; i <= 25; i++) {
String uHarmKey = "iharm" + i + "Overtime";
String json = getFieldValueForDetail(line, uHarmKey);
if (StrUtil.isNotBlank(json)) {
specialTargetList.add(json);
}
}
for (int i = 1; i <= 16; i++) {
String uHarmKey = "inuharm" + i + "Overtime";
String json = getFieldValueForDetail(line, uHarmKey);
if (StrUtil.isNotBlank(json)) {
specialTargetList.add(json);
}
}
} }
}
if (CollUtil.isNotEmpty(specialTargetList)) { detailAbnormalVO.setDateTargetList(targetKeyList);
for (String str : specialTargetList) { detailAbnormalVO.setMonitorName(lineInfoVO.getLineName());
JSONArray jsonArray = new JSONArray(str); detailAbnormalVO.setBdName(lineInfoVO.getBdName());
List<JsonBaseVO> jsonBaseVOList = jsonArray.toList(JsonBaseVO.class); detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey());
jsonBaseVOList.forEach(it -> { result.add(detailAbnormalVO);
timeSet.addAll(Arrays.asList(it.getTime().split(StrUtil.COMMA)));
});
}
} else {
if (StrUtil.isNotBlank(jonsStr)) {
JSONArray jsonArray = new JSONArray(jonsStr);
List<JsonBaseVO> jsonBaseVOList = jsonArray.toList(JsonBaseVO.class);
jsonBaseVOList.forEach(it -> {
timeSet.addAll(Arrays.asList(it.getTime().split(StrUtil.COMMA)));
});
}
}
if (timeSet.size() > 0) {
DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO();
detailAbnormalVO.setMonitorId(lineId);
detailAbnormalVO.setDate(date.format(DATE_FORMAT));
detailAbnormalVO.setMonitorName(lineInfoVO.getLineName());
detailAbnormalVO.setBdName(lineInfoVO.getBdName());
detailAbnormalVO.setTimeSum(String.valueOf(timeInterval * timeSet.size()));
detailAbnormalVO.setTargetKey(monitorBaseParam.getTargetKey());
result.add(detailAbnormalVO);
}
});
}); });
return result; return result;
} }
@Override @Override
public List<DetailAbnormalVO.DetailLimitInnerVO> monitorLimitTableDetail(MonitorBaseParam monitorBaseParam) { public DetailAbnormalVO.DetailLimitCountVO monitorLimitTableDetail(MonitorBaseParam monitorBaseParam) {
List<LineDetailDataVO> lineDetailList = lineMapper.getLineDetailDataVO(monitorBaseParam.getMonitorIds());
Map<String, LineDetailDataVO> lineDetailMap = lineDetailList.stream().collect(Collectors.toMap(LineDetailDataVO::getLineId, Function.identity()));
DetailAbnormalVO.DetailLimitCountVO v = new DetailAbnormalVO.DetailLimitCountVO();
List<DetailAbnormalVO.DetailLimitInnerVO> result = new ArrayList<>(); List<DetailAbnormalVO.DetailLimitInnerVO> result = new ArrayList<>();
LineCountEvaluateParam lineCountEvaluateParam = new LineCountEvaluateParam(); LineCountEvaluateParam lineCountEvaluateParam = new LineCountEvaluateParam();
lineCountEvaluateParam.setLineId(Collections.singletonList(monitorBaseParam.getMonitorIds().get(0))); lineCountEvaluateParam.setLineId(Collections.singletonList(monitorBaseParam.getMonitorIds().get(0)));
@@ -376,7 +290,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
lineCountEvaluateParam.setEndTime(monitorBaseParam.getSearchBeginTime()); lineCountEvaluateParam.setEndTime(monitorBaseParam.getSearchBeginTime());
List<DataLimitRateDetailDto> dtoList = dataLimitRateDetailFeignClient.getRawData(lineCountEvaluateParam).getData(); List<DataLimitRateDetailDto> dtoList = dataLimitRateDetailFeignClient.getRawData(lineCountEvaluateParam).getData();
if (CollUtil.isEmpty(dtoList)) { if (CollUtil.isEmpty(dtoList)) {
return result; return v;
} }
DataLimitRateDetailDto dto = dtoList.get(0); DataLimitRateDetailDto dto = dtoList.get(0);
@@ -386,7 +300,10 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
} else { } else {
processAllTargets(dto, targetMap, result); processAllTargets(dto, targetMap, result);
} }
return result; int size = result.stream().map(DetailAbnormalVO.DetailLimitInnerVO::getTime).collect(Collectors.toSet()).size();
v.setTimeSum(lineDetailMap.get(monitorBaseParam.getMonitorIds().get(0)).getTimeInterval() * size);
v.setTime(result);
return v;
} }
@Override @Override
@@ -534,10 +451,12 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}else{ } else {
PqReasonableRangeDto dto = dataVCode.get(DataCleanEnum.VThd.getCode()); if(CollUtil.isNotEmpty(uaberrance)){
DetailAbnormalVO.DetailLimitInnerVO val = reasonAble(uaberrance, dto); PqReasonableRangeDto dto = dataVCode.get(DataCleanEnum.VThd.getCode());
assess.setUharmData(NumberUtil.round(val.getVal(), 2).doubleValue()); DetailAbnormalVO.DetailLimitInnerVO val = reasonAble(uaberrance, dto);
assess.setUharmData(NumberUtil.round(val.getVal(), 2).doubleValue());
}
} }
//谐波电流 //谐波电流
if (CollUtil.isNotEmpty(iharm)) { if (CollUtil.isNotEmpty(iharm)) {
@@ -568,7 +487,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
String[] split = val.getTargetName().split(""); String[] split = val.getTargetName().split("");
try { try {
Class<?> clazz = overLimitDataById.getClass(); Class<?> clazz = overLimitDataById.getClass();
String methodName = "getInuharm" + split[0]; String methodName = "getInuharm" + (int)(Double.valueOf(split[0])+0.5);
Method method = clazz.getMethod(methodName); Method method = clazz.getMethod(methodName);
Float value = (Float) method.invoke(overLimitDataById); Float value = (Float) method.invoke(overLimitDataById);
assess.setInuharmLimit(value); assess.setInuharmLimit(value);
@@ -810,7 +729,12 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
String fieldName = prefix + i + "Overtime"; String fieldName = prefix + i + "Overtime";
String json = getFieldValueForDetail(dto, fieldName); String json = getFieldValueForDetail(dto, fieldName);
if (StrUtil.isNotBlank(json)) { if (StrUtil.isNotBlank(json)) {
result.add(json + SEPARATOR + i); if (end == 16) {
result.add(json + SEPARATOR + (i - 0.5));
} else {
result.add(json + SEPARATOR + i);
}
} }
} }
} }
@@ -1026,7 +950,7 @@ public class DataVerifyServiceImpl extends ServiceImpl<DataVerifyMapper, DataVer
PowerQualityIndicatorsVO it = areaMap.get(lineDetail.getLineId()); PowerQualityIndicatorsVO it = areaMap.get(lineDetail.getLineId());
it.setMonitorName(lineDetail.getLineName()); it.setMonitorName(lineDetail.getLineName());
it.setStationName(lineDetail.getSubName()); it.setStationName(lineDetail.getSubName());
if(deptName.containsKey(lineDetail.getLineId())){ if (deptName.containsKey(lineDetail.getLineId())) {
it.setCity(deptName.get(lineDetail.getLineId())); it.setCity(deptName.get(lineDetail.getLineId()));
} }
it.setDevName(lineDetail.getDeviceName()); it.setDevName(lineDetail.getDeviceName());

View File

@@ -438,12 +438,17 @@ public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
//异常率 //异常率
List<PqDataVerifyCount> verifyList = sumVerify.stream().filter(x->x.getTotal()>0).filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList()); List<PqDataVerifyCount> verifyList = sumVerify.stream().filter(x->x.getTotal()>0).filter(x -> lineIds.contains(x.getLineId())).collect(Collectors.toList());
List<String> verifyLine = verifyList.stream().map(PqDataVerifyCount::getLineId).distinct().collect(Collectors.toList()); List<String> verifyLine = verifyList.stream().map(PqDataVerifyCount::getLineId).distinct().collect(Collectors.toList());
List<String> devIdsLine = lineMapper.getDevIdsLine(verifyLine); if (CollUtil.isNotEmpty(verifyLine)) {
if (CollUtil.isNotEmpty(devIdsLine)) { List<String> devIdsLine = lineMapper.getDevIdsLine(verifyLine);
return NumberUtil.round(Math.min(devIdsLine.size() * 100.0 / devIds.size(), 100), 2); if (CollUtil.isNotEmpty(devIdsLine)) {
return NumberUtil.round(Math.min(devIdsLine.size() * 100.0 / devIds.size(), 100), 2);
} else {
return new BigDecimal(0);
}
} else { } else {
return new BigDecimal(0); return new BigDecimal(0);
} }
} }
private BigDecimal verify(List<PqDataVerifyCount> sumVerify, List<String> lineIds) { private BigDecimal verify(List<PqDataVerifyCount> sumVerify, List<String> lineIds) {

View File

@@ -278,8 +278,16 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
} else if (lineDevGetDTO.getPowerFlag().equals(LineBaseEnum.POWER_FLAG_NOT.getCode())) { } else if (lineDevGetDTO.getPowerFlag().equals(LineBaseEnum.POWER_FLAG_NOT.getCode())) {
temBgName = lineDevGetDTO.getObjName(); temBgName = lineDevGetDTO.getObjName();
} }
List<DetailAbnormalVO.TimeAndTargetKey> targetKeyList = new ArrayList<>();
DetailAbnormalVO.TimeAndTargetKey targetKey;
DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO(); DetailAbnormalVO detailAbnormalVO = new DetailAbnormalVO();
detailAbnormalVO.setDateList(value.stream().map(x -> x.getTimeId().format(DatePattern.NORM_DATE_FORMATTER)).collect(Collectors.toList())); for (PqDataVerifyBak pqDataVerifyBak : value) {
targetKey = new DetailAbnormalVO.TimeAndTargetKey();
targetKey.setDate(pqDataVerifyBak.getTimeId().format(DatePattern.NORM_DATE_FORMATTER));
targetKey.setTargetKeys(getAbnormalTarget(Arrays.asList(pqDataVerifyBak)).stream().filter(x->x.getIds().size()>0).collect(Collectors.toList()));
targetKeyList.add(targetKey);
}
detailAbnormalVO.setDateTargetList(targetKeyList);
detailAbnormalVO.setMonitorName(lineDevGetDTO.getLineName()); detailAbnormalVO.setMonitorName(lineDevGetDTO.getLineName());
detailAbnormalVO.setBdName(temBgName); detailAbnormalVO.setBdName(temBgName);
detailAbnormalVO.setMonitorId(lineDevGetDTO.getLineId()); detailAbnormalVO.setMonitorId(lineDevGetDTO.getLineId());
@@ -304,7 +312,8 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
.in(PqDataVerifyBak::getLineId, monitorBaseParam.getMonitorIds()); .in(PqDataVerifyBak::getLineId, monitorBaseParam.getMonitorIds());
List<PqDataVerifyBak> pqDataVerifyBak = this.list(lambdaQueryWrapper); List<PqDataVerifyBak> pqDataVerifyBak = this.list(lambdaQueryWrapper);
Integer[] errorTimeCount = {0}; //index[0] 总异常时间 index[1]指标异常时间
Integer[] errorTimeCount = {0, 0};
Integer[] errAllCount = {0}; Integer[] errAllCount = {0};
for (PqDataVerifyBak dataVerifyBak : pqDataVerifyBak) { for (PqDataVerifyBak dataVerifyBak : pqDataVerifyBak) {
try (InputStream fileStream = fileStorageUtil.getFileStream(dataVerifyBak.getPath())) { try (InputStream fileStream = fileStorageUtil.getFileStream(dataVerifyBak.getPath())) {
@@ -316,17 +325,16 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
}else{ }else{
if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) { if (StrUtil.isNotBlank(monitorBaseParam.getTargetKey())) {
if (targetJson.containsKey(monitorBaseParam.getTargetKey())) { if (targetJson.containsKey(monitorBaseParam.getTargetKey())) {
resultDeal(dtoMap, monitorBaseParam.getTargetKey(), targetJson, result, dataVerifyBak.getTimeId().toString(), errAllCount); resultDeal(dtoMap, monitorBaseParam.getTargetKey(), targetJson, result, dataVerifyBak.getTimeId().toString(), errorTimeCount, errAllCount);
} }
} else { } else {
String tarKey = "";
for (Map.Entry<String, PqReasonableRangeDto> entry : dtoMap.entrySet()) { for (Map.Entry<String, PqReasonableRangeDto> entry : dtoMap.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
if (targetJson.containsKey(key)) { if (targetJson.containsKey(key)) {
tarKey = key; resultDeal(dtoMap, key, targetJson, result, dataVerifyBak.getTimeId().toString(), errorTimeCount, errAllCount);
} }
} }
resultDeal(dtoMap, tarKey, targetJson, result, dataVerifyBak.getTimeId().toString(), errAllCount);
} }
} }
}); });
@@ -336,7 +344,7 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
} }
// 排序实现 // 排序实现
DetailAbnormalVO.DetailAbnormalCountVO info = new DetailAbnormalVO.DetailAbnormalCountVO(); DetailAbnormalVO.DetailAbnormalCountVO info = new DetailAbnormalVO.DetailAbnormalCountVO();
info.setTimeSum(errorTimeCount[0]); info.setTimeSum(StrUtil.isBlank(monitorBaseParam.getTargetKey()) ? errorTimeCount[0] : errorTimeCount[1]);
info.setErrCount(errAllCount[0]); info.setErrCount(errAllCount[0]);
info.setTime(result.stream() info.setTime(result.stream()
.sorted(Comparator.comparing(DetailAbnormalVO.DetailAbnormalInnerVO::getTargetName) .sorted(Comparator.comparing(DetailAbnormalVO.DetailAbnormalInnerVO::getTargetName)
@@ -371,13 +379,14 @@ public class PqDataVerifyBakServiceImpl extends ServiceImpl<PqDataVerifyBakMappe
* 处理json对象中list数组 * 处理json对象中list数组
*/ */
private void resultDeal(Map<String, PqReasonableRangeDto> dtoMap, String targetKey, JSONObject targetJson, List<DetailAbnormalVO.DetailAbnormalInnerVO> result, String date, Integer[] errorCounts) { private void resultDeal(Map<String, PqReasonableRangeDto> dtoMap, String targetKey, JSONObject targetJson, List<DetailAbnormalVO.DetailAbnormalInnerVO> result, String date, Integer[] errorTimeCount, Integer[] errorCounts) {
PqReasonableRangeDto pqReasonableRangeDto = dtoMap.get(targetKey); PqReasonableRangeDto pqReasonableRangeDto = dtoMap.get(targetKey);
JSONArray innerJson = targetJson.getJSONArray(targetKey); JSONArray innerJson = targetJson.getJSONArray(targetKey);
innerJson.forEach(oo -> { innerJson.forEach(oo -> {
JSONObject jsonObjectTem = (JSONObject) oo; JSONObject jsonObjectTem = (JSONObject) oo;
String targetName = jsonObjectTem.get("targetName").toString(); String targetName = jsonObjectTem.get("targetName").toString();
errorCounts[0] += Integer.valueOf(jsonObjectTem.get("errorCounts").toString()); errorCounts[0] += Integer.valueOf(jsonObjectTem.get("errorCounts").toString());
errorTimeCount[1] += Integer.valueOf(jsonObjectTem.get("errorTimes").toString());
JSONArray list = jsonObjectTem.getJSONArray("list"); JSONArray list = jsonObjectTem.getJSONArray("list");
List<DetailAbnormalVO.DetailLimitInnerVO> temList = new ArrayList<>(); List<DetailAbnormalVO.DetailLimitInnerVO> temList = new ArrayList<>();
list.forEach(listItem -> { list.forEach(listItem -> {

View File

@@ -224,7 +224,7 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
queryWrapper.in("supervision_temp_line_report.org_id", data); queryWrapper.in("supervision_temp_line_report.org_id", data);
} }
queryWrapper queryWrapper
.and(CollUtil.isNotEmpty(InstanceUtil.filterTaskStatus()), w -> w.in("supervision_temp_line_debug.status", InstanceUtil.filterTaskStatus()) .and(CollUtil.isNotEmpty(InstanceUtil.filterTempLineTaskStatus()), w -> w.in("supervision_temp_line_debug.status", InstanceUtil.filterTempLineTaskStatus())
.or() .or()
.eq("supervision_temp_line_debug.create_by", RequestUtil.getUserIndex()) .eq("supervision_temp_line_debug.create_by", RequestUtil.getUserIndex())
); );
@@ -265,7 +265,7 @@ public class SupervisionTempLineDebugPOServiceImpl extends ServiceImpl<Supervisi
queryWrapper.in("supervision_temp_line_report.org_id", data); queryWrapper.in("supervision_temp_line_report.org_id", data);
} }
queryWrapper queryWrapper
.and(CollUtil.isNotEmpty(InstanceUtil.filterTaskStatus()), w -> w.in("supervision_temp_line_debug.status", InstanceUtil.filterTaskStatus()) .and(CollUtil.isNotEmpty(InstanceUtil.filterTempLineTaskStatus()), w -> w.in("supervision_temp_line_debug.status", InstanceUtil.filterTempLineTaskStatus())
.or() .or()
.eq("supervision_temp_line_debug.create_by", RequestUtil.getUserIndex()) .eq("supervision_temp_line_debug.create_by", RequestUtil.getUserIndex())
); );

View File

@@ -69,10 +69,7 @@ public class InstanceUtil {
throw new BusinessException(SupervisionResponseEnum.EXISTENCE_OR_NOT); throw new BusinessException(SupervisionResponseEnum.EXISTENCE_OR_NOT);
} }
//先判断是否是删除管理员,如果是就有全部删除权限,否则就只能删除带提交审批的 //先判断是否是删除管理员,如果是就有全部删除权限,否则就只能删除带提交审批的
String userRole = RequestUtil.getUserRole(); List<String> delete = deleteUser();
String trimmedString = userRole.substring(1, userRole.length() - 1).replace("\"", "");
List<String> list = Arrays.asList(trimmedString.split(","));
List<String> delete = list.stream().filter(x -> "delete_info".equals(x)).collect(Collectors.toList());
//如果为空则需要判断信息,先判断全部数据是否都是自己创建的,然后判断是否是都是带提交数据 //如果为空则需要判断信息,先判断全部数据是否都是自己创建的,然后判断是否是都是带提交数据
if (CollUtil.isEmpty(delete)) { if (CollUtil.isEmpty(delete)) {
long count = createBy.stream().filter(x -> !userId.equals(x)).count(); long count = createBy.stream().filter(x -> !userId.equals(x)).count();
@@ -91,10 +88,7 @@ public class InstanceUtil {
List<Integer> info =new ArrayList<>(); List<Integer> info =new ArrayList<>();
info.add(BpmTaskStatusEnum.RUNNING.getStatus()); info.add(BpmTaskStatusEnum.RUNNING.getStatus());
info.add(BpmTaskStatusEnum.APPROVE.getStatus()); info.add(BpmTaskStatusEnum.APPROVE.getStatus());
String userRole = RequestUtil.getUserRole(); List<String> delete = deleteUser();
String trimmedString = userRole.substring(1, userRole.length() - 1).replace("\"", "");
List<String> list = Arrays.asList(trimmedString.split(","));
List<String> delete = list.stream().filter(x -> "delete_info".equals(x)).collect(Collectors.toList());
//删除管理员默认能删除全部数据 //删除管理员默认能删除全部数据
if (CollUtil.isNotEmpty(delete)) { if (CollUtil.isNotEmpty(delete)) {
info.clear(); info.clear();
@@ -102,4 +96,24 @@ public class InstanceUtil {
return info; return info;
} }
public static List<Integer> filterTempLineTaskStatus() {
List<Integer> info =new ArrayList<>();
info.add(BpmTaskStatusEnum.RUNNING.getStatus());
info.add(BpmTaskStatusEnum.APPROVE.getStatus());
info.add(BpmTaskStatusEnum.RETURN.getStatus());
List<String> delete = deleteUser();
//删除管理员默认能删除全部数据
if (CollUtil.isNotEmpty(delete)) {
info.clear();
}
return info;
}
private static List<String> deleteUser() {
String userRole = RequestUtil.getUserRole();
String trimmedString = userRole.substring(1, userRole.length() - 1).replace("\"", "");
List<String> list = Arrays.asList(trimmedString.split(","));
return list.stream().filter(x -> "delete_info".equals(x)).collect(Collectors.toList());
}
} }