Commit 5b3e6f4d authored by chenzhao's avatar chenzhao

修改代码

parent 0ea8867e
......@@ -234,7 +234,7 @@ public class MonitorFanIdxController extends BaseController {
data6.put("title",columnMap.get("有功功率").toString());
objects.add(data6);
Map<String, Object> data7 = new HashMap<>();
data7.put("title",(double)columnMap.get("日发电量")/(double)columnMap.get("装机容量")*1000);
data7.put("title",Double.parseDouble(columnMap.get("日发电量").toString())/ Double.parseDouble(columnMap.get("装机容量").toString())*1000);
objects.add(data7);
IPage<Map<String,Object>> result = new Page<>();
......@@ -607,7 +607,8 @@ public class MonitorFanIdxController extends BaseController {
data.put("title5",7.47);//辐照强度
data.put("title6",columnMap.get("年发电量").toString());
data.put("title7",columnMap.get("有功功率").toString());
data.put("title8",(double)columnMap.get("日发电量")/(double)columnMap.get("装机容量")*1000);//日利用小时
data.put("title8", Double.parseDouble(columnMap.get("日发电量").toString())/ Double.parseDouble(columnMap.get("装机容量").toString())*1000);//日利用小时
data.put("title9",columnMap.get("总辐射累计").toString());//总辐射日累计
data.put("title0",7.47);//综合效率
return ResponseHelper.buildResponse(data);
......@@ -658,4 +659,44 @@ public class MonitorFanIdxController extends BaseController {
}
return ResponseHelper.buildResponse(monitorFanIndicator.getStatisticsInfo(gatewayId,equipmentIndexName ));
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "码速表")
@GetMapping("/SpeedIndicator")
public ResponseModel<Map<String,Object>> SpeedIndicator(@RequestParam(value = "equipNum", required = false) String equipNum,
@RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "equipmentIndexName", required = false) String equipmentIndexName
) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
return ResponseHelper.buildResponse(monitorFanIndicator.SpeedIndicator(gatewayId,equipNum,equipmentIndexName ));
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "箱变实时开关状态")
@GetMapping("/equipSwitchStatus")
public ResponseModel<Map<String,Object>> getEquipSwitchStatus() {
LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
for (StationBasic stationBasic : stationBasics) {
String fanGatewayId = stationBasic.getFanGatewayId();
monitorFanIndicatorImpl.getEquipSwitchStatus(stationBasic);
}
return CommonResponseUtil.success();
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "汇流箱支路电流离散率")
@GetMapping("/collectingBox")
public ResponseModel<ResultsData> collectingBox(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "stationId") String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
return ResponseHelper.buildResponse(monitorFanIndicatorImpl.collectingBox(gatewayId,current, size ));
}
}
......@@ -1479,5 +1479,94 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return s;
}
public HashMap<String, Object> SpeedIndicator(String gatewayId ,String equipmentNumber,String equipmentIndexName){
HashMap<String, Object> resultMap = new HashMap<>();
String sql = "SELECT * FROM indicators_"+gatewayId+" WHERE equipmentNumber ='"+equipmentNumber +"' and equipmentIndexName = '"+equipmentIndexName+"'";
List<IndicatorsDto> list = influxDButils.getListData(sql, IndicatorsDto.class);
if (!ValidationUtil.isEmpty(list)){
resultMap.put("value",list.get(0).getValue());
}
return resultMap;
}
public void getEquipSwitchStatus(StationBasic stationBasic ){
String gatewayId = stationBasic.getFanGatewayId();
Long stationId = stationBasic.getSequenceNbr();
String sql = "SELECT * FROM indicators_"+gatewayId+" WHERE equipmentIndexName =~/合闸/";
List<IndicatorsDto> list = influxDButils.getListData(sql, IndicatorsDto.class);
if (!ValidationUtil.isEmpty(list)){
Map<String, List<IndicatorsDto>> collect = list.stream().collect(Collectors.groupingBy(IndicatorsDto::getEquipmentNumber));
for (String s : collect.keySet()) {
HashMap<String, Object> resultMap = new HashMap<>();
collect.get(s).stream().forEach(e->{
String picturl = "";
if (e.getValue().equals("true")){
picturl = pictureUrl+"dlg-h-red.png";
}else {
picturl = pictureUrl+"dlg-h-green.png";
}
if(e.getEquipmentIndexName().contains("合闸")){
resultMap.put(e.getEquipmentIndexName().substring(0,3),picturl);
}else {
resultMap.put("gy",picturl);
}
});
IPage<Map<String, Object>> result = new Page<>();
List<Map<String, Object>> data = new ArrayList<>();
data.add(resultMap);
result.setRecords(data);
result.setCurrent(1);
result.setTotal(100);
try {
emqKeeper.getMqttClient().publish(stationId+"/xbjg/"+s,JSON.toJSONString(result).getBytes(),0,false);
} catch (MqttException e) {
e.printStackTrace();
}
}
}
}
public ResultsData collectingBox(String gatewayId ,int current,int size){
HashMap<String, Object> resultMap = new HashMap<>();
ArrayList<Map<String, Object>> resultList = new ArrayList<>();
String sql = "SELECT * FROM indicators_"+gatewayId+" WHERE equipmentIndexName =~/路电流/ ";
List<IndicatorsDto> list = influxDButils.getListData(sql, IndicatorsDto.class);
if (!ValidationUtil.isEmpty(list)){
Map<String, List<IndicatorsDto>> collect = list.stream().collect(Collectors.groupingBy(IndicatorsDto::getEquipmentNumber));
for (String s : collect.keySet()) {
List<IndicatorsDto> indicatorsDtos = collect.get(s);
Double avageValue = 0.0;
avageValue =indicatorsDtos.stream().filter(e -> !ObjectUtils.isEmpty(e.getValue())).mapToDouble(l->Double.parseDouble((String) l.getValue())).average().getAsDouble();
avageValue = Double.valueOf(String.format("%.2f", avageValue));
resultMap.put("avg",avageValue);
String[] name = s.split("-");
resultMap.put("zz","#"+name[0]+"子阵");
resultMap.put("nbq","逆变器"+name[1]);
resultMap.put("hlx","#"+name[2]+"汇流箱");
resultMap.put("lsv","1.7840");
resultList.add(resultMap);
}
}
//构建平台数据
DataGridMock DataGridMock = new DataGridMock(current, resultList.size(), false, current, resultList);
ColModel colModelEventMovement = new ColModel("zz", "zz", "子阵", "子阵", "dataGrid", "zz");
ColModel colModelStationName = new ColModel("nbq", "nbq", "逆变器", "逆变器", "dataGrid", "nvq");
ColModel colModelEventDesc = new ColModel("hlx", "hlx", "汇流箱", "汇流箱", "dataGrid", "hlx");
ColModel colModelAlarmGroupName = new ColModel("avg", "avg", "支路电流平均值", "支路电流平均值", "dataGrid", "avg");
ColModel colModelEventTime = new ColModel("lsl", "lsv", "支路电流离散率", "支路电流离散率", "dataGrid", "lsv");
List<ColModel> listColModel = Arrays.asList(colModelEventMovement, colModelStationName, colModelEventDesc, colModelAlarmGroupName, colModelEventTime);
ResultsData resultsData = new ResultsData(DataGridMock, listColModel);
return resultsData;
}
}
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