Commit 59e10062 authored by wujiang's avatar wujiang

修改偏差率

parent 966888c5
...@@ -94,6 +94,8 @@ public class CommonConstans { ...@@ -94,6 +94,8 @@ public class CommonConstans {
public static final String QueryStringEquipmentIndexName = "equipmentIndexName.keyword"; public static final String QueryStringEquipmentIndexName = "equipmentIndexName.keyword";
//es EquipIndexName 查绚关键字 //es EquipIndexName 查绚关键字
public static final String QueryStringEquipmentIndexNameNotKeyword = "equipmentIndexName"; public static final String QueryStringEquipmentIndexNameNotKeyword = "equipmentIndexName";
public static final String QueryStringEquipmentSpecificNameNotKeyword = "equipmentSpecificName.keyword";
//es gatewayId 查绚关键字 //es gatewayId 查绚关键字
public static final String QueryStringGateWayId = "gatewayId.keyword"; public static final String QueryStringGateWayId = "gatewayId.keyword";
public static final String QueryStringFrontMoudle = "frontModule.keyword"; public static final String QueryStringFrontMoudle = "frontModule.keyword";
......
...@@ -764,12 +764,16 @@ public class MonitorFanIdxController extends BaseController { ...@@ -764,12 +764,16 @@ public class MonitorFanIdxController extends BaseController {
return ResponseHelper.buildResponse(monitorFanIndicatorImpl.collectingBox(gatewayId, current, size)); return ResponseHelper.buildResponse(monitorFanIndicatorImpl.collectingBox(gatewayId, current, size));
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "汇流箱支路电流偏差率") @ApiOperation(value = "汇流箱支路电流偏差率")
@GetMapping("/getDeaviAtionRate") @GetMapping("/getDeaviAtionRate")
public ResponseModel<Page<DeaviationRateDto>> getDeaviAtionRate(@RequestParam(value = "stationId") String stationId, String equipNumber) { public ResponseModel<ResultsData> getDeaviAtionRate(@RequestParam(value = "stationId") String stationId,
return ResponseHelper.buildResponse(monitorFanIndicatorImpl.getDeaviAtionRate(stationId, equipNumber)); @RequestParam(value = "zz") String zz, @RequestParam(value = "nbq") String nbq,
} @RequestParam(value = "hlx") String hlx) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
return ResponseHelper.buildResponse(monitorFanIndicatorImpl.getDeaviAtionRate(gatewayId, zz, nbq, hlx));
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
......
...@@ -2157,28 +2157,59 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -2157,28 +2157,59 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
} }
public Page<DeaviationRateDto> getDeaviAtionRate(String stationId, String equipNumber) { public ResultsData getDeaviAtionRate(String gatewayId, String zz, String nbq, String hlx) {
StationCacheInfoDto stationCacheInfoDto = commonServiceImpl.getStationCacheInfoDtoByStationId(stationId); ArrayList<Map<String, Object>> resultList = new ArrayList<>();
Page<DeaviationRateDto> deaviationRateDtoPage = new Page<>(1, 100); Map<String, List<String>> queryConditon = new HashMap<>();
List<DeaviationRateDto> deaviationRateDtoList = new ArrayList<>(); queryConditon.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
Map<String, List<String>> queryCondition = new HashMap<>(); Map<String, String> likeMap = new HashMap<>();
queryCondition.put(CommonConstans.QueryStringEquipmentNumber, Arrays.asList(equipNumber)); likeMap.put(CommonConstans.QueryStringEquipmentIndexNameNotKeyword, "路电流");
queryCondition.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId())); //hlx=hlx.replace("#0", "#");
Map<String, String> shouldCodtion = new HashMap<>(); //likeMap.put(CommonConstans.QueryStringEquipmentSpecificNameNotKeyword, hlx);
shouldCodtion.put(CommonConstans.QueryStringEquipmentIndexName, "路电流"); String nhlx =zz+"/"+nbq+"/"+ hlx.replace("#0", "#");
List<ESEquipments> indicatorsDtoList = commonServiceImpl.getListDataByCondtions(queryCondition, shouldCodtion, ESEquipments.class); List<ESEquipments> list = commonServiceImpl.getListDataByCondtionsAndLike(queryConditon, null,
Random random = new Random(); ESEquipments.class, likeMap);
indicatorsDtoList.forEach(esEquipments -> {
DeaviationRateDto deaviationRateDto = new DeaviationRateDto(); // Map<String, List<String>> queryConditon1 = new HashMap<>();
deaviationRateDto.setName(esEquipments.getEquipmentIndexName()); // queryConditon1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
deaviationRateDto.setCurrentValue(esEquipments.getValue()); // Map<String, String> likeMap1 = new HashMap<>();
deaviationRateDto.setOffset(String.valueOf(random.nextDouble())); // likeMap1.put(CommonConstans.QueryStringEquipmentIndexNameNotKeyword, "平均电流");
deaviationRateDto.setAttValue(String.valueOf(random.nextDouble())); // List<ESEquipments> list1 = commonServiceImpl.getListDataByCondtionsAndLike(queryConditon, null,
deaviationRateDtoList.add(deaviationRateDto); // ESEquipments.class, likeMap1);
});
deaviationRateDtoPage.setRecords(deaviationRateDtoList); if (!ValidationUtil.isEmpty(list)) {
return deaviationRateDtoPage; list=list.stream().filter(i->i.getEquipmentSpecificName().contains(nhlx)).collect(Collectors.toList());
}
Double avageValue = 0.0;
avageValue = list.stream().filter(e -> !ObjectUtils.isEmpty(e.getValueF()))
.mapToDouble(l -> Double.parseDouble(l.getValueF().toString())).average().getAsDouble();
avageValue = Double.valueOf(String.format(CommonConstans.Twodecimalplaces, avageValue));
for (ESEquipments s : list) {
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("hlx", s.getEquipmentIndexName());
double now = Double.valueOf(String.format(CommonConstans.Twodecimalplaces, s.getValueF()));
resultMap.put("now", now);
resultMap.put("avg", avageValue);
double c = now - avageValue;
if (c < 0) {
c = -c;
}
double lsv = c / avageValue;
lsv = Double.valueOf(String.format(CommonConstans.Twodecimalplaces, lsv));
resultMap.put("lsv", lsv);
resultList.add(resultMap);
}
}
// 构建平台数据
DataGridMock DataGridMock = new DataGridMock(0, resultList.size(), false, 0, resultList);
ColModel colModelEventMovement = new ColModel("hlx", "hlx", "汇流箱", "汇流箱", "dataGrid", "hlx");
ColModel colModelStationName = new ColModel("now", "now", "当前值", "当前值", "dataGrid", "now");
ColModel colModelEventDesc = new ColModel("avg", "avg", "平均值", "平均值", "dataGrid", "avg");
ColModel colModelAlarmGroupName = new ColModel("pcv", "pcv", "偏差率", "偏差率", "dataGrid", "pcv");
List<ColModel> listColModel = Arrays.asList(colModelEventMovement, colModelStationName, colModelEventDesc,
colModelAlarmGroupName);
ResultsData resultsData = new ResultsData(DataGridMock, listColModel);
return resultsData;
}
// @Scheduled(cron = "0 */10 * * * ?") // @Scheduled(cron = "0 */10 * * * ?")
// //@Scheduled(cron = "0/1 * * * * ?") // //@Scheduled(cron = "0/1 * * * * ?")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment