1.bug调整
This commit is contained in:
@@ -129,10 +129,10 @@ public class EventRelevantAnalysisController extends BaseController {
|
||||
@PostMapping("/updateEventToAss")
|
||||
@ApiOperation("把暂降事件添加到指定事件中去")
|
||||
public HttpResult<Page<AdvanceEventDetailVO>> updateEventToAss(@RequestBody Map<String,Object> map){
|
||||
if(!map.containsKey("eventId") || !map.containsKey("assId")){
|
||||
throw new BusinessException("参数异常");
|
||||
}
|
||||
String methodDescribe = getMethodDescribe("updateEventToAss");
|
||||
if(!map.containsKey("eventId") || !map.containsKey("assId")){
|
||||
throw new BusinessException("参数异常");
|
||||
}
|
||||
List<String> eventIds = (List<String>) map.get("eventId");
|
||||
if(CollectionUtil.isEmpty(eventIds)){
|
||||
throw new BusinessException("暂降事件不可为空");
|
||||
|
||||
@@ -168,7 +168,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
EntityGroupEvtData[] arrayObj = Arrays.copyOfRange(entityGroupEvtData,
|
||||
i * FinalData.MAX_EVT_NUM, to);
|
||||
EntityMtrans entityMtrans = mEntry.getValue();
|
||||
EntityGroupData entityGroupData = handleEvent.translate(arrayObj,entityMtrans);
|
||||
EntityGroupData entityGroupData = handleEvent.translate(arrayObj, entityMtrans);
|
||||
// 处理分析结果
|
||||
handleEvent.show_group_info(entityGroupData, listSagEvent, listEventAssObj, date);
|
||||
}
|
||||
@@ -177,51 +177,44 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
}
|
||||
|
||||
|
||||
disposeNonStandardData(handleEvent, baseList, listEventAssObj, listSagEvent, date);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
disposeNonStandardData(handleEvent, baseList, listEventAssObj, listSagEvent, date);
|
||||
|
||||
|
||||
int listSize = listEventAssObj.size();
|
||||
int toIndex = 1000;
|
||||
for (int i = 0; i < listSize; i += 1000) {
|
||||
//作用为toIndex最后没有toIndex条数据则剩余几条newList中就装几条
|
||||
if (i + 1000 > listSize) {
|
||||
toIndex = listSize - i;
|
||||
}
|
||||
//分割lst
|
||||
List<EventAssObj> newList = listEventAssObj.subList(i, i + toIndex);
|
||||
//写入添加方法,需要写你的新增方法,把newList分切后的数据新增进入数据库。
|
||||
rmpEventDetailAssMapper.insertEventAssData(newList);
|
||||
int listSize = listEventAssObj.size();
|
||||
int toIndex = 1000;
|
||||
for (int i = 0; i < listSize; i += 1000) {
|
||||
//作用为toIndex最后没有toIndex条数据则剩余几条newList中就装几条
|
||||
if (i + 1000 > listSize) {
|
||||
toIndex = listSize - i;
|
||||
}
|
||||
//分割lst
|
||||
List<EventAssObj> newList = listEventAssObj.subList(i, i + toIndex);
|
||||
//写入添加方法,需要写你的新增方法,把newList分切后的数据新增进入数据库。
|
||||
rmpEventDetailAssMapper.insertEventAssData(newList);
|
||||
}
|
||||
|
||||
List<RmpEventDetailPO> eventUpdateList = new ArrayList<>();
|
||||
for (int i = 0; i < listSagEvent.size(); i++) {
|
||||
RmpEventDetailPO rmp = new RmpEventDetailPO();
|
||||
rmp.setEventId(listSagEvent.get(i).getIndexEventDetail());
|
||||
rmp.setEventassIndex(listSagEvent.get(i).getIndexEventAss());
|
||||
rmp.setDealTime(listSagEvent.get(i).getDealTime());
|
||||
eventUpdateList.add(rmp);
|
||||
if ((i + 1) % 1000 == 0) {
|
||||
this.updateBatchById(eventUpdateList);
|
||||
eventUpdateList.clear();
|
||||
} else if (i == listSagEvent.size() - 1) {
|
||||
this.updateBatchById(eventUpdateList);
|
||||
}
|
||||
List<RmpEventDetailPO> eventUpdateList = new ArrayList<>();
|
||||
for (int i = 0; i < listSagEvent.size(); i++) {
|
||||
RmpEventDetailPO rmp = new RmpEventDetailPO();
|
||||
rmp.setEventId(listSagEvent.get(i).getIndexEventDetail());
|
||||
rmp.setEventassIndex(listSagEvent.get(i).getIndexEventAss());
|
||||
rmp.setDealTime(listSagEvent.get(i).getDealTime());
|
||||
eventUpdateList.add(rmp);
|
||||
if ((i + 1) % 1000 == 0) {
|
||||
this.updateBatchById(eventUpdateList);
|
||||
eventUpdateList.clear();
|
||||
} else if (i == listSagEvent.size() - 1) {
|
||||
this.updateBatchById(eventUpdateList);
|
||||
}
|
||||
}
|
||||
|
||||
// 增加策略记录
|
||||
String describe = "用户" + RequestUtil.getUserNickname() + "进行了关联分析";
|
||||
PqsRelevanceLog entityPqsRelevance = new PqsRelevanceLog();
|
||||
entityPqsRelevance.setContentDes(describe);
|
||||
entityPqsRelevance.setState(DataStateEnum.ENABLE.getCode());
|
||||
entityPqsRelevance.setTimeId(date);
|
||||
relevantLogMapper.insert(entityPqsRelevance);
|
||||
|
||||
// 增加策略记录
|
||||
String describe = "用户" + RequestUtil.getUserNickname() + "进行了关联分析";
|
||||
PqsRelevanceLog entityPqsRelevance = new PqsRelevanceLog();
|
||||
entityPqsRelevance.setContentDes(describe);
|
||||
entityPqsRelevance.setState(DataStateEnum.ENABLE.getCode());
|
||||
entityPqsRelevance.setTimeId(date);
|
||||
relevantLogMapper.insert(entityPqsRelevance);
|
||||
|
||||
|
||||
log.info("事件关联分析用时:" + timeInterval.interval() / 1000 + "秒");
|
||||
@@ -230,224 +223,6 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// @Override
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
// public void processEvents(LocalDateTime startTime, LocalDateTime endTime) {
|
||||
//
|
||||
// TimeInterval timeInterval = new TimeInterval();
|
||||
//
|
||||
//
|
||||
// Map<String, Map<String, Integer>> nodeSort = new HashMap<>();
|
||||
// Map<String, EntityMtrans> entityMtransMap = getNodeInfo();
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// for (Map.Entry<String, Map<String, Integer>> m : nodeSort) {
|
||||
// List<EntityGroupEvtData> list = new ArrayList<EntityGroupEvtData>();
|
||||
// Set<Map.Entry<String, Integer>> mapValue = m.getValue().entrySet();
|
||||
// FinalData.NODE_NUM = m.getValue().size();
|
||||
//
|
||||
// for (Map.Entry<String, Integer> mm : mapValue) {
|
||||
// for (int i = 0; i < entityGroupEvtDatas.length; i++) {
|
||||
// if (entityGroupEvtDatas[i].getNodePhysics() == mm.getKey().intValue() && "短路故障".equals(entityGroupEvtDatas[i].getSagReason())) {
|
||||
// entityGroupEvtDatas[i].setNode(mm.getValue());
|
||||
// list.add(entityGroupEvtDatas[i]);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 筛选不在矩阵中的事件id
|
||||
// Iterator<EntityGroupEvtData> iterator = list3.iterator();
|
||||
// while (iterator.hasNext()) {
|
||||
// EntityGroupEvtData entityGroupEvtData = iterator.next();
|
||||
//
|
||||
// if (entityGroupEvtData.getNodePhysics() == mm.getKey().intValue() && "短路故障".equals(entityGroupEvtData.getSagReason())) {
|
||||
// iterator.remove();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// EntityGroupEvtData[] entityGroupEvtData = new EntityGroupEvtData[list.size()];
|
||||
// Collections.sort(list);
|
||||
// list.toArray(entityGroupEvtData);
|
||||
//
|
||||
// for (Map.Entry<String, JSONObject> mEntry : setMtrans) {
|
||||
// if (mEntry.getKey().equals(m.getKey())) {
|
||||
// *//**//********************************************************************
|
||||
// * 算法最多处理1000条数据,超过限制需分批处理 先将数据根据某种方式进行升序/降序排序,然后分段处理 加入循环处理
|
||||
// *********************************************************************//**//*
|
||||
// int circulation = entityGroupEvtData.length % FinalData.MAX_EVT_NUM == 0
|
||||
// ? entityGroupEvtData.length / FinalData.MAX_EVT_NUM
|
||||
// : entityGroupEvtData.length / FinalData.MAX_EVT_NUM + 1;
|
||||
//
|
||||
// for (int i = 0; i < circulation; i++) {
|
||||
// int to = 0;
|
||||
//
|
||||
// if (i == circulation - 1) {
|
||||
// to = entityGroupEvtData.length % FinalData.MAX_EVT_NUM > 0
|
||||
// ? entityGroupEvtData.length
|
||||
// : (i + 1) * FinalData.MAX_EVT_NUM - 1;
|
||||
// } else {
|
||||
// to = (i + 1) * FinalData.MAX_EVT_NUM - 1;
|
||||
// }
|
||||
//
|
||||
// EntityGroupEvtData[] arrayObj = Arrays.copyOfRange(entityGroupEvtData,
|
||||
// i * FinalData.MAX_EVT_NUM, to);
|
||||
// JSONObject entityMtrans = mEntry.getValue();
|
||||
// EntityGroupData entityGroupData = handleEvent.translate(arrayObj, (EntityMtrans) JSONObject.toBean(entityMtrans, EntityMtrans.class));
|
||||
// // 处理分析结果
|
||||
// handleEvent.show_group_info(entityGroupData, listSagEvent, listEventAssObj, date);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// DictData dictData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.EVENT_REASON.getName(), DicDataEnum.SHORT_TROUBLE.getName()).getData();
|
||||
// if (Objects.isNull(dictData)) {
|
||||
// throw new BusinessException(SystemResponseEnum.ADVANCE_REASON);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// LocalDateTime date = LocalDateTime.now();
|
||||
// HandleEvent handleEvent = new HandleEvent();
|
||||
// // 分析的事件进行处理
|
||||
// List<EntityGroupEvtData> baseList = handleEvent.getData(startTime, endTime);
|
||||
// if (CollectionUtil.isEmpty(baseList)) {
|
||||
// throw new BusinessException("当前时间段暂无可分析事件");
|
||||
// }
|
||||
//
|
||||
// // 传入的处理事件根据物理隔绝进行分组
|
||||
//
|
||||
// List<EntityLogic> strategyList = relevantLogMapper.getLogic();
|
||||
//
|
||||
// if (CollectionUtil.isNotEmpty(strategyList)) {
|
||||
// List<SagEvent> listSagEvent = new ArrayList<>();
|
||||
// List<EventAssObj> listEventAssObj = new ArrayList<>();
|
||||
//
|
||||
// Map<String, List<String>> strategyToBusBarMap = new HashMap<>(32);
|
||||
//
|
||||
// Map<String, EntityMtrans> mapRedis = new HashMap<>(32);
|
||||
//
|
||||
// Map<String, List<EntityLogic>> strategyMap = strategyList.stream().collect(Collectors.groupingBy(EntityLogic::getTPIndex));
|
||||
// strategyMap.forEach((key, list) -> {
|
||||
// List<String> before = list.stream().map(EntityLogic::getNodeBefore).distinct().collect(Collectors.toList());
|
||||
// List<String> after = list.stream().map(EntityLogic::getNodeNext).distinct().collect(Collectors.toList());
|
||||
// before.addAll(after);
|
||||
// before = before.stream().distinct().collect(Collectors.toList());
|
||||
// strategyToBusBarMap.put(key, before);
|
||||
//
|
||||
// FinalData.NODE_NUM = before.size();
|
||||
// EntityMtrans entityMtrans = new EntityMtrans();
|
||||
// handleEvent.create_matrixcata(list, entityMtrans);
|
||||
//
|
||||
// mapRedis.put(key, entityMtrans);
|
||||
// });
|
||||
//
|
||||
// strategyToBusBarMap.forEach((lastKey, lastVal) -> {
|
||||
// int index = 1;
|
||||
// List<EntityGroupEvtData> list = new ArrayList<>();
|
||||
// for (EntityGroupEvtData entityGroupEvtData : baseList) {
|
||||
// if (lastVal.contains(entityGroupEvtData.getNodePhysics()) && dictData.getId().equals(entityGroupEvtData.getSagReason())) {
|
||||
// entityGroupEvtData.setNode(index++);
|
||||
// list.add(entityGroupEvtData);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// baseList.removeIf(entityGroupEvtData -> lastVal.contains(entityGroupEvtData.getNodePhysics()) && dictData.getId().equals(entityGroupEvtData.getSagReason()));
|
||||
//
|
||||
//
|
||||
// EntityGroupEvtData[] entityGroupEvtData = new EntityGroupEvtData[list.size()];
|
||||
// Collections.sort(list);
|
||||
// list.toArray(entityGroupEvtData);
|
||||
//
|
||||
// mapRedis.forEach((mKey, mVal) -> {
|
||||
// if (mKey.equals(lastKey)) {
|
||||
// //算法最多处理1000条数据,超过限制需分批处理 先将数据根据某种方式进行升序/降序排序,然后分段处理 加入循环处理
|
||||
// int circulation = entityGroupEvtData.length % FinalData.MAX_EVT_NUM == 0
|
||||
// ? entityGroupEvtData.length / FinalData.MAX_EVT_NUM
|
||||
// : entityGroupEvtData.length / FinalData.MAX_EVT_NUM + 1;
|
||||
//
|
||||
// for (int i = 0; i < circulation; i++) {
|
||||
// int to;
|
||||
// if (i == circulation - 1) {
|
||||
// to = entityGroupEvtData.length % FinalData.MAX_EVT_NUM > 0
|
||||
// ? entityGroupEvtData.length
|
||||
// : (i + 1) * FinalData.MAX_EVT_NUM - 1;
|
||||
// } else {
|
||||
// to = (i + 1) * FinalData.MAX_EVT_NUM - 1;
|
||||
// }
|
||||
//
|
||||
// EntityGroupEvtData[] arrayObj = Arrays.copyOfRange(entityGroupEvtData,
|
||||
// i * FinalData.MAX_EVT_NUM, to);
|
||||
// EntityGroupData entityGroupData = handleEvent.translate(arrayObj, mVal);
|
||||
// // 处理分析结果
|
||||
// handleEvent.show_group_info(entityGroupData, listSagEvent, listEventAssObj, date);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// });
|
||||
//
|
||||
//
|
||||
//
|
||||
// //事件ID不在矩阵中,结果集为基础以时标为标准进行归集处理 注意:三相与(单相/两相)互斥
|
||||
//
|
||||
// disposeNonStandardData(handleEvent, baseList, listEventAssObj, listSagEvent, date);
|
||||
//
|
||||
//
|
||||
// int listSize = listEventAssObj.size();
|
||||
// int toIndex = 1000;
|
||||
// for (int i = 0; i < listSize; i += 1000) {
|
||||
// //作用为toIndex最后没有toIndex条数据则剩余几条newList中就装几条
|
||||
// if (i + 1000 > listSize) {
|
||||
// toIndex = listSize - i;
|
||||
// }
|
||||
// //分割lst
|
||||
// List<EventAssObj> newList = listEventAssObj.subList(i, i + toIndex);
|
||||
// //写入添加方法,需要写你的新增方法,把newList分切后的数据新增进入数据库。
|
||||
// rmpEventDetailAssMapper.insertEventAssData(newList);
|
||||
// }
|
||||
//
|
||||
// List<RmpEventDetailPO> eventUpdateList = new ArrayList<>();
|
||||
// for (int i = 0; i < listSagEvent.size(); i++) {
|
||||
// RmpEventDetailPO rmp = new RmpEventDetailPO();
|
||||
// rmp.setEventId(listSagEvent.get(i).getIndexEventDetail());
|
||||
// rmp.setEventassIndex(listSagEvent.get(i).getIndexEventAss());
|
||||
// rmp.setDealTime(listSagEvent.get(i).getDealTime());
|
||||
// eventUpdateList.add(rmp);
|
||||
// if ((i + 1) % 1000 == 0) {
|
||||
// this.updateBatchById(eventUpdateList);
|
||||
// eventUpdateList.clear();
|
||||
// } else if (i == listSagEvent.size() - 1) {
|
||||
// this.updateBatchById(eventUpdateList);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 增加策略记录
|
||||
// String describe = "用户" + RequestUtil.getUserNickname() + "进行了关联分析";
|
||||
// PqsRelevanceLog entityPqsRelevance = new PqsRelevanceLog();
|
||||
// entityPqsRelevance.setContentDes(describe);
|
||||
// entityPqsRelevance.setState(DataStateEnum.ENABLE.getCode());
|
||||
// entityPqsRelevance.setTimeId(date);
|
||||
// relevantLogMapper.insert(entityPqsRelevance);
|
||||
//
|
||||
// } else {
|
||||
// throw new BusinessException("当前无变压器策略,请先配置策略");
|
||||
// }
|
||||
//
|
||||
// log.info("事件关联分析用时:" + timeInterval.interval() / 1000 + "秒");
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Page<AdvanceEventDetailVO> querySagEventsPage(BaseParam baseParam) {
|
||||
List<String> lineIds = generalDeviceInfoClient.deptGetRunLineEvent(RequestUtil.getDeptIndex()).getData();
|
||||
@@ -473,7 +248,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
|
||||
List<AdvanceEventDetailVO> advanceEventDetailVOList = BeanUtil.copyToList(rmpEventDetailPOList, AdvanceEventDetailVO.class);
|
||||
advanceEventDetailVOList = advanceEventDetailVOList.stream().peek(item -> {
|
||||
item.setFeatureAmplitude(roundHalfUp(item.getFeatureAmplitude()*100));
|
||||
item.setFeatureAmplitude(roundHalfUp(item.getFeatureAmplitude() * 100));
|
||||
|
||||
if (map.containsKey(item.getLineId())) {
|
||||
AreaLineInfoVO areaLineInfoVO = map.get(item.getLineId());
|
||||
@@ -493,6 +268,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 四舍五入保留两位小数
|
||||
*/
|
||||
@@ -504,6 +280,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
//保留2位小数
|
||||
return com.njcn.harmonic.utils.PubUtils.dataLimits(b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<RmpEventDetailAssPO> queryEventsAssPage(BaseParam baseParam) {
|
||||
List<LocalDateTime> timeV = PubUtils.checkLocalDate(baseParam.getSearchBeginTime(), baseParam.getSearchEndTime());
|
||||
@@ -620,6 +397,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
.in(RmpEventDetailPO::getEventId, eventId);
|
||||
RmpEventDetailPO rmpEventDetailPO = new RmpEventDetailPO();
|
||||
rmpEventDetailPO.setEventassIndex(assId);
|
||||
rmpEventDetailPO.setDealTime(LocalDateTime.now());
|
||||
eventAdvanceMapper.update(rmpEventDetailPO, lambdaUpdateWrapper);
|
||||
return true;
|
||||
}
|
||||
@@ -734,7 +512,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
|
||||
List<AdvanceEventDetailVO> advanceEventDetailVOLsit = querySagEventsAll(startTime, endTime);
|
||||
|
||||
advanceEventDetailVOLsit = advanceEventDetailVOLsit.stream().filter(temp-> StringUtils.isNotEmpty(temp.getAdvanceType())).collect(Collectors.toList());
|
||||
advanceEventDetailVOLsit = advanceEventDetailVOLsit.stream().filter(temp -> StringUtils.isNotEmpty(temp.getAdvanceType())).collect(Collectors.toList());
|
||||
for (AdvanceEventDetailVO advanceEventDetailVO : advanceEventDetailVOLsit) { // 获取监测点线路序号
|
||||
//母线id
|
||||
String nodePhysics = advanceEventDetailVO.getVoltageId();
|
||||
@@ -868,7 +646,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
/*************************************************************************************
|
||||
* 获取变压器信息并生成矩阵
|
||||
*************************************************************************************/
|
||||
public Map<String, Map<String, Integer>> getNodeBefore(){
|
||||
public Map<String, Map<String, Integer>> getNodeBefore() {
|
||||
Map<String, EntityMtrans> entityMtranMap = new HashMap<>(32);
|
||||
|
||||
HandleEvent handleEvent = new HandleEvent();
|
||||
@@ -883,7 +661,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
}
|
||||
|
||||
|
||||
public Map<String, EntityMtrans> getNodeInfo( ) {
|
||||
public Map<String, EntityMtrans> getNodeInfo() {
|
||||
Map<String, EntityMtrans> entityMtranMap = new HashMap<>(32);
|
||||
|
||||
HandleEvent handleEvent = new HandleEvent();
|
||||
@@ -893,7 +671,7 @@ public class EventRelevantAnalysisServiceImpl extends ServiceImpl<RmpEventAdvanc
|
||||
|
||||
Map<String, List<String>> map = getLogicInfo(list);
|
||||
Map<String, Map<String, Integer>> setNodeSort = nodeSort(map);
|
||||
redisUtil.saveByKeyWithExpire(redisSortKey,setNodeSort,-1L);
|
||||
redisUtil.saveByKeyWithExpire(redisSortKey, setNodeSort, -1L);
|
||||
|
||||
setNodeSort.forEach((key, val) -> {
|
||||
FinalData.NODE_NUM = val.size();
|
||||
|
||||
@@ -71,6 +71,6 @@ cas:
|
||||
#白名单设置
|
||||
# /oauth/lnLogin$|/pqs-auth/oauth/lnLogin|/oauth/lnRefreshToken$|/pqs-auth/oauth/lnRefreshToken
|
||||
sso:
|
||||
whiteList:
|
||||
whiteList: .*/oauth/lnLogin.*|.*/pqs-auth/oauth/lnLogin.*|.*/oauth/lnRefreshToken.*|.*/pqs-auth/oauth/lnRefreshToken.*
|
||||
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ public class LineIntegrityDataController extends BaseController {
|
||||
String methodDescribe = getMethodDescribe("getIntegrityByLineIds");
|
||||
if(CollUtil.isNotEmpty(lineIds)){
|
||||
QueryWrapper<RStatIntegrityD> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("sum(real_time) as realTime,sum(due_time) as dueTime,sum(real_time)/sum(due_time) as integrityData","line_index").in("line_index",lineIds).between("time_id",startTime,endTime).groupBy("line_index");
|
||||
queryWrapper.select("sum(real_time) as realTime,sum(due_time) as dueTime,avg(real_time/due_time) as integrityData","line_index").in("line_index",lineIds).between("time_id",startTime,endTime).groupBy("line_index");
|
||||
List<RStatIntegrityD> rStatIntegrityDList = irStatIntegrityDService.list(queryWrapper);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatIntegrityDList, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -1505,8 +1505,8 @@
|
||||
<select id="getCustomDetailByLineId" resultType="map">
|
||||
SELECT line.id AS lineId,
|
||||
CONCAT(CONCAT(CONCAT(sub.NAME, '_'), vo.NAME), CONCAT('_', line.NAME)) AS lineName,
|
||||
CONCAT(CONCAT(COALESCE(detail.pt1, 'N/A'), ':'), COALESCE(detail.pt2, 'N/A')) AS pt,
|
||||
CONCAT(CONCAT(COALESCE(detail.ct1, 'N/A'), ':'), COALESCE(detail.ct2, 'N/A')) AS ct,
|
||||
CONCAT(detail.pt1, ':', detail.pt2) AS pt,
|
||||
CONCAT(detail.ct1, ':', detail.ct2) AS ct,
|
||||
detail.Dev_Capacity AS Dev_Capacity,
|
||||
detail.Short_Capacity AS Short_Capacity,
|
||||
detail.Standard_Capacity AS Standard_Capacity,
|
||||
|
||||
@@ -64,7 +64,7 @@ public class PowerStatisticsController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getTargetByTime")
|
||||
@ApiOperation("点击越限列表时间查询指标的详细数据")
|
||||
public HttpResult<List<ThdDataVO>> getTargetByTime(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam) {
|
||||
public HttpResult<List<ThdDataVO>> getTargetByTime(@RequestBody PowerStatisticsParam powerStatisticsParam) {
|
||||
String methodDescribe = getMethodDescribe("getTargetByTime");
|
||||
List<ThdDataVO> targetByTime = powerStatisticsService.getTargetByTimeDetail(powerStatisticsParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, targetByTime, methodDescribe);
|
||||
@@ -73,14 +73,14 @@ public class PowerStatisticsController extends BaseController {
|
||||
@ResponseBody
|
||||
@ApiOperation("导出区间数据")
|
||||
@PostMapping(value = "exportExcelRangTemplate")
|
||||
public void exportExcelRangTemplate(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam,HttpServletResponse response) {
|
||||
public void exportExcelRangTemplate(@RequestBody PowerStatisticsParam powerStatisticsParam,HttpServletResponse response) {
|
||||
powerStatisticsService.exportExcelRangTemplate(powerStatisticsParam,response);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@ApiOperation("导出指标越限列表数据")
|
||||
@PostMapping(value = "exportExcelListTemplate")
|
||||
public void exportExcelListTemplate(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam,HttpServletResponse response) {
|
||||
public void exportExcelListTemplate(@RequestBody PowerStatisticsParam powerStatisticsParam,HttpServletResponse response) {
|
||||
powerStatisticsService.exportExcelListTemplate(powerStatisticsParam,response);
|
||||
}
|
||||
|
||||
|
||||
@@ -167,12 +167,16 @@ public class RMpTargetWarnDServiceImpl extends ServiceImpl<RMpTargetWarnDMapper,
|
||||
List<GridDiagramVO.StatisticsData> statisticsData = new ArrayList<>();
|
||||
List<GridDiagramVO.StatisticsData> gwStatisticsData = new ArrayList<>();
|
||||
|
||||
List<String> idsList = new ArrayList<>();
|
||||
int allNum = 0;
|
||||
for(String voltage:voltageIds){
|
||||
GridDiagramVO.StatisticsData voltageItem = new GridDiagramVO.StatisticsData();
|
||||
voltageItem.setColumnName(voltage);
|
||||
if(voltageMonitorMap.containsKey(voltage)){
|
||||
List<String> ids = voltageMonitorMap.get(voltage).stream().map(LineDevGetDTO::getObjId).distinct().collect(Collectors.toList());
|
||||
voltageItem.setNumOne((long)ids.size());
|
||||
allNum+=ids.size();
|
||||
idsList.addAll(ids);
|
||||
voltageItem.setNumOneList(ids);
|
||||
}else {
|
||||
voltageItem.setNumOne(0L);
|
||||
@@ -180,6 +184,10 @@ public class RMpTargetWarnDServiceImpl extends ServiceImpl<RMpTargetWarnDMapper,
|
||||
}
|
||||
statisticsData.add(voltageItem);
|
||||
}
|
||||
GridDiagramVO.StatisticsData dataSum = new GridDiagramVO.StatisticsData();
|
||||
dataSum.setNumOneList(idsList);
|
||||
dataSum.setNumOne((long)allNum);
|
||||
statisticsData.add(dataSum);
|
||||
lineStatistics.setData(statisticsData);
|
||||
gwLineStatistics.setData(gwStatisticsData);
|
||||
|
||||
|
||||
@@ -115,6 +115,9 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
private final String STR_FOUR = "%";
|
||||
private final String UVOLTAGE_DEV = "UVOLTAGE_DEV";
|
||||
private final String VOLTAGE_DEV = "VOLTAGE_DEV";
|
||||
private final String PT = "PT";
|
||||
private final String CT = "CT";
|
||||
|
||||
|
||||
@Override
|
||||
public void getCustomReport(ReportSearchParam reportSearchParam, HttpServletResponse response) {
|
||||
@@ -126,6 +129,8 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
DeviceUnitCommDTO deviceUnitCommDTO = BeanUtil.copyProperties(deviceUnit, DeviceUnitCommDTO.class);
|
||||
|
||||
Map<String,String> finalTerminalMap = convertKeysToUpperCase(commTerminalGeneralClient.getCustomDetailByLineId(reportSearchParam.getLineId()).getData());
|
||||
finalTerminalMap.put(PT,formatSciNumber(finalTerminalMap.getOrDefault(PT,"N/A")));
|
||||
finalTerminalMap.put(CT,formatSciNumber(finalTerminalMap.getOrDefault(CT,"N/A")));
|
||||
customReportTableService.getCustomReport(reportSearchParam,finalTerminalMap,deviceUnitCommDTO, response);
|
||||
} else {
|
||||
//浙江无线报表
|
||||
@@ -1462,6 +1467,28 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 解析科学计数字符串,转为完整数字文本,原有小数原样保留
|
||||
* @param numStr 数据库返回字符串:123.00 / 1.234E+08 / N/A
|
||||
* @return 标准数字字符串
|
||||
*/
|
||||
public String formatSciNumber(String numStr) {
|
||||
// 空值或占位符直接返回
|
||||
if (numStr == null || "N/A".equals(numStr.trim())) {
|
||||
return numStr;
|
||||
}
|
||||
// 判断是否为科学计数格式
|
||||
if (numStr.toLowerCase().contains("e")) {
|
||||
// BigDecimal 可完美解析科学计数,输出完整数字,保留全部小数位
|
||||
String [] split =numStr.split(":");
|
||||
BigDecimal one = new BigDecimal(split[0]);
|
||||
BigDecimal two = new BigDecimal(split[1]);
|
||||
return (one.toPlainString().concat(":").concat(two.toPlainString()));
|
||||
}
|
||||
return numStr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
}};
|
||||
|
||||
@Override
|
||||
public void getCustomReport(ReportSearchParam reportSearchParam, Map<String, String> newMap, DeviceUnitCommDTO deviceUnitCommDTO, HttpServletResponse response) {
|
||||
public void getCustomReport(ReportSearchParam reportSearchParam, Map<String, String> ledgerMap, DeviceUnitCommDTO deviceUnitCommDTO, HttpServletResponse response) {
|
||||
TimeInterval timeInterval = new TimeInterval();
|
||||
ExcelRptTemp excelRptTemp = excelRptTempMapper.selectById(reportSearchParam.getTempId());
|
||||
if (Objects.isNull(excelRptTemp)) {
|
||||
@@ -100,7 +100,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
}
|
||||
if (Objects.isNull(reportSearchParam.getCustomType())) {
|
||||
//通用报表
|
||||
analyzeReport(reportSearchParam, excelRptTemp, newMap, deviceUnitCommDTO, response);
|
||||
analyzeReport(reportSearchParam, excelRptTemp, ledgerMap, deviceUnitCommDTO, response);
|
||||
|
||||
log.info("报表执行时间{}秒", timeInterval.intervalSecond());
|
||||
}
|
||||
@@ -565,7 +565,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
* @date 2023/10/8
|
||||
*/
|
||||
|
||||
private void analyzeReport(ReportSearchParam reportSearchParam, ExcelRptTemp excelRptTemp, Map<String, String> newMap, DeviceUnitCommDTO deviceUnitCommDTO, HttpServletResponse response) {
|
||||
private void analyzeReport(ReportSearchParam reportSearchParam, ExcelRptTemp excelRptTemp, Map<String, String> ledgerMap, DeviceUnitCommDTO deviceUnitCommDTO, HttpServletResponse response) {
|
||||
//定义一个线程集合
|
||||
List<Future<?>> futures = new ArrayList<>();
|
||||
//指标
|
||||
@@ -651,13 +651,13 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
phaseMap.forEach((phaseKey, phaseVal) -> {
|
||||
StringBuilder sql = new StringBuilder(InfluxDbSqlConstant.SELECT);
|
||||
if (InfluxDbSqlConstant.MAX.equalsIgnoreCase(valueTypeKey)) {
|
||||
assembleSqlAndQuery(tMap, newMap.get("LEVEL"), newMap.get("PT"), newMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.MAX, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList, tableMap);
|
||||
assembleSqlAndQuery(tMap, ledgerMap.get("LEVEL"), ledgerMap.get("PT"), ledgerMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.MAX, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList, tableMap);
|
||||
} else if (InfluxDbSqlConstant.MIN.equalsIgnoreCase(valueTypeKey)) {
|
||||
assembleSqlAndQuery(tMap, newMap.get("LEVEL"), newMap.get("PT"), newMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.MIN, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList, tableMap);
|
||||
assembleSqlAndQuery(tMap, ledgerMap.get("LEVEL"), ledgerMap.get("PT"), ledgerMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.MIN, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList, tableMap);
|
||||
} else if (InfluxDbSqlConstant.AVG_WEB.equalsIgnoreCase(valueTypeKey)) {
|
||||
assembleSqlAndQuery(tMap, newMap.get("LEVEL"), newMap.get("PT"), newMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.AVG_WEB, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList,tableMap);
|
||||
assembleSqlAndQuery(tMap, ledgerMap.get("LEVEL"), ledgerMap.get("PT"), ledgerMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.AVG_WEB, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList,tableMap);
|
||||
} else if (InfluxDbSqlConstant.CP95.equalsIgnoreCase(valueTypeKey)) {
|
||||
assembleSqlAndQuery(tMap, newMap.get("LEVEL"), newMap.get("PT"), newMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.CP95, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList,tableMap);
|
||||
assembleSqlAndQuery(tMap, ledgerMap.get("LEVEL"), ledgerMap.get("PT"), ledgerMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.CP95, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList,tableMap);
|
||||
}
|
||||
|
||||
});
|
||||
@@ -681,7 +681,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
//处理指标最终判定合格还是不合格
|
||||
dealTargetResult(assNoPassMap, limitTargetMapX, endList);
|
||||
}
|
||||
resultAssemble(endList, reportSearchParam, newMap, deviceUnitCommDTO, jsonArray);
|
||||
resultAssemble(endList, reportSearchParam, ledgerMap, deviceUnitCommDTO, jsonArray);
|
||||
//导出自定义报表
|
||||
downReport(jsonArray, response);
|
||||
}
|
||||
@@ -1305,68 +1305,70 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
data = data.stream().peek(item -> item.setValue("/")).collect(Collectors.toList());
|
||||
} else {
|
||||
// 兼容达梦数据库方法
|
||||
Map<String, Object> map = convertKeysToUpperCase(mapList.get(0));
|
||||
for (ReportTemplateDTO item : data) {
|
||||
if (map.containsKey(item.getItemName())) {
|
||||
double v = Double.parseDouble(map.get(item.getItemName()).toString());
|
||||
item.setValue(String.format("%.3f", v));
|
||||
if(Objects.nonNull(mapList.get(0))) {
|
||||
Map<String, Object> map = convertKeysToUpperCase(mapList.get(0));
|
||||
for (ReportTemplateDTO item : data) {
|
||||
if (map.containsKey(item.getItemName())) {
|
||||
double v = Double.parseDouble(map.get(item.getItemName()).toString());
|
||||
item.setValue(String.format("%.3f", v));
|
||||
|
||||
// 处理overLimitMap越限判断
|
||||
if (overLimitMap != null && overLimitMap.containsKey(item.getLimitName())) {
|
||||
Float tagVal = overLimitMap.get(item.getLimitName());
|
||||
// 处理overLimitMap越限判断
|
||||
if (overLimitMap != null && overLimitMap.containsKey(item.getLimitName())) {
|
||||
Float tagVal = overLimitMap.get(item.getLimitName());
|
||||
|
||||
if (item.getLimitName() != null && item.getLimitName().equalsIgnoreCase(UVOLTAGE_DEV)) {
|
||||
// 对电压偏差特殊处理
|
||||
Float tagVal_U = overLimitMap.get(UVOLTAGE_DEV);
|
||||
if (v > tagVal || v < tagVal_U) {
|
||||
item.setOverLimitFlag(1);
|
||||
} else {
|
||||
item.setOverLimitFlag(0);
|
||||
}
|
||||
} else {
|
||||
if (v > tagVal) {
|
||||
item.setOverLimitFlag(1);
|
||||
} else {
|
||||
item.setOverLimitFlag(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 判断是否越限(limitMap处理)
|
||||
if (limitMap != null && !limitMap.isEmpty()) {
|
||||
String key = item.getLimitName() + STR_ONE + item.getStatMethod() + "#PQ_OVERLIMIT";
|
||||
if (limitMap.containsKey(key)) {
|
||||
ReportTemplateDTO tem = limitMap.get(key);
|
||||
double limitVal = Double.parseDouble(tem.getValue());
|
||||
|
||||
if (VOLTAGE_DEV.equalsIgnoreCase(tem.getLimitName())) {
|
||||
// 针对电压偏差特殊处理
|
||||
double limitLowVal = Double.parseDouble(tem.getLowValue());
|
||||
if (v > limitVal || v < limitLowVal) {
|
||||
tem.setOverLimitFlag(1);
|
||||
if (assNoPassMap != null) {
|
||||
assNoPassMap.put(key, tem);
|
||||
}
|
||||
} else if (assNoPassMap != null && !assNoPassMap.containsKey(key)) {
|
||||
tem.setOverLimitFlag(0);
|
||||
assNoPassMap.put(key, tem);
|
||||
if (item.getLimitName() != null && item.getLimitName().equalsIgnoreCase(UVOLTAGE_DEV)) {
|
||||
// 对电压偏差特殊处理
|
||||
Float tagVal_U = overLimitMap.get(UVOLTAGE_DEV);
|
||||
if (v > tagVal || v < tagVal_U) {
|
||||
item.setOverLimitFlag(1);
|
||||
} else {
|
||||
item.setOverLimitFlag(0);
|
||||
}
|
||||
} else {
|
||||
// 其他指标
|
||||
if (v > limitVal) {
|
||||
tem.setOverLimitFlag(1);
|
||||
if (assNoPassMap != null) {
|
||||
assNoPassMap.put(key, tem);
|
||||
}
|
||||
} else if (assNoPassMap != null && !assNoPassMap.containsKey(key)) {
|
||||
tem.setOverLimitFlag(0);
|
||||
assNoPassMap.put(key, tem);
|
||||
if (v > tagVal) {
|
||||
item.setOverLimitFlag(1);
|
||||
} else {
|
||||
item.setOverLimitFlag(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 判断是否越限(limitMap处理)
|
||||
if (limitMap != null && !limitMap.isEmpty()) {
|
||||
String key = item.getLimitName() + STR_ONE + item.getStatMethod() + "#PQ_OVERLIMIT";
|
||||
if (limitMap.containsKey(key)) {
|
||||
ReportTemplateDTO tem = limitMap.get(key);
|
||||
double limitVal = Double.parseDouble(tem.getValue());
|
||||
|
||||
if (VOLTAGE_DEV.equalsIgnoreCase(tem.getLimitName())) {
|
||||
// 针对电压偏差特殊处理
|
||||
double limitLowVal = Double.parseDouble(tem.getLowValue());
|
||||
if (v > limitVal || v < limitLowVal) {
|
||||
tem.setOverLimitFlag(1);
|
||||
if (assNoPassMap != null) {
|
||||
assNoPassMap.put(key, tem);
|
||||
}
|
||||
} else if (assNoPassMap != null && !assNoPassMap.containsKey(key)) {
|
||||
tem.setOverLimitFlag(0);
|
||||
assNoPassMap.put(key, tem);
|
||||
}
|
||||
} else {
|
||||
// 其他指标
|
||||
if (v > limitVal) {
|
||||
tem.setOverLimitFlag(1);
|
||||
if (assNoPassMap != null) {
|
||||
assNoPassMap.put(key, tem);
|
||||
}
|
||||
} else if (assNoPassMap != null && !assNoPassMap.containsKey(key)) {
|
||||
tem.setOverLimitFlag(0);
|
||||
assNoPassMap.put(key, tem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
item.setValue("/");
|
||||
}
|
||||
} else {
|
||||
item.setValue("/");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1486,7 +1488,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
} else if (v.charAt(0) == '&') {
|
||||
//结论
|
||||
String tem = v.replace(STR_THREE, "").toUpperCase();
|
||||
if (finalTerminalMap.size() > 0) {
|
||||
if (!finalTerminalMap.isEmpty()) {
|
||||
if ("STATIS_TIME".equals(tem)) {
|
||||
//如何时间是大于当前时间则用当前时间
|
||||
String localTime = InfluxDbSqlConstant.END_TIME;
|
||||
|
||||
Reference in New Issue
Block a user