Commit 1649efad authored by chenzhao's avatar chenzhao

修改代码

parent c7a6f40d
...@@ -11,7 +11,11 @@ public enum ElectricQuantity { ...@@ -11,7 +11,11 @@ public enum ElectricQuantity {
ZXYGZ("正向总有功","zxzyg"), ZXYGZ("正向总有功","zxzyg"),
FXYGZ("反向总有功","fxzyg"), FXYGZ("反向总有功","fxzyg"),
ZXWGZ("正向总无功","zxzwg"), ZXWGZ("正向总无功","zxzwg"),
FXWGZ("反向总无功","fxzwg"); FXWGZ("反向总无功","fxzwg"),
ZGXWG("总感性无功","zgxwg"),
ZZXYG("总正向有功","zzxwg"),
ZRXWG("总容性无功","zrxwg"),
ZFXYG("总反向有功","zfxyg");
......
...@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.dto.TreeDto; ...@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.dto.TreeDto;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic; import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IndicatorsDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ResultsData; import com.yeejoin.amos.boot.module.jxiop.biz.dto.ResultsData;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.MonitorFanIndicatorImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.MonitorFanIndicatorImpl;
...@@ -566,7 +567,7 @@ public class MonitorFanIdxController extends BaseController { ...@@ -566,7 +567,7 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "光伏-总概览") @ApiOperation(value = "光伏-总概览")
@GetMapping("/solarPowerOverview") @GetMapping("/solarPowerOverview")
public ResponseModel<Map<String, Object>> solarPowerData(@RequestParam(value = "stationId")String stationId) { public ResponseModel<IPage<Map<String, Object>>> solarPowerData(@RequestParam(value = "stationId")String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
...@@ -574,17 +575,20 @@ public class MonitorFanIdxController extends BaseController { ...@@ -574,17 +575,20 @@ public class MonitorFanIdxController extends BaseController {
String boosterGatewayId = stationBasic.getBoosterGatewayId(); String boosterGatewayId = stationBasic.getBoosterGatewayId();
String [] columnList = new String[]{"日发电量","月发电量","年发电量"}; String [] columnList = new String[]{"日发电量","月发电量","年发电量"};
String [] columnLists = new String[]{"有功功率"}; String [] columnLists = new String[]{"有功功率"};
String [] syLists = new String[]{"总辐射累计"}; String [] syLists = new String[]{"总辐射累计","总辐射"};
Map<String, Object> columnMap = new HashMap<>(); Map<String, Object> columnMap = new HashMap<>();
for (String column : columnList) { for (String column : columnList) {
Double result = commonService.getTotalByIndicatior(gatewayId, column); Double result = commonService.getTotalByIndicatior(gatewayId, column);
columnMap.put(column, String.format("%.2f",result)); columnMap.put(column, String.format("%.2f",result));
} }
for (String column : syLists) { for (String column : syLists) {
Double result = commonService.getTotalByIndicatior(boosterGatewayId, column); Double result = commonService.getNumByIndicatior(boosterGatewayId, column);
columnMap.put(column, String.format("%.2f",result)); columnMap.put(column, String.format("%.2f",result));
} }
for (String column : columnLists) { for (String column : columnLists) {
Double result = commonService.getAvgvalueByIndicatior(gatewayId, column); Double result = commonService.getAvgvalueByIndicatior(gatewayId, column);
columnMap.put(column, String.format("%.2f",result)); columnMap.put(column, String.format("%.2f",result));
...@@ -597,19 +601,47 @@ public class MonitorFanIdxController extends BaseController { ...@@ -597,19 +601,47 @@ public class MonitorFanIdxController extends BaseController {
columnMap.put("装机容量",capacityl); columnMap.put("装机容量",capacityl);
List<Map<String,Object>> objects = new ArrayList<>();
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
data.put("total1",columnMap.get("装机容量").toString()); data.put("title",columnMap.get("装机容量").toString());
data.put("total2",columnMap.get("日发电量").toString()); objects.add(data);
data.put("total3",columnMap.get("风机台数").toString().replace(".0","")); Map<String, Object> data1 = new HashMap<>();
data.put("total4",columnMap.get("月发电量").toString()); data1.put("title",columnMap.get("日发电量").toString());
data.put("total5",7.47);//辐照强度 objects.add(data1);
data.put("total6",columnMap.get("年发电量").toString()); Map<String, Object> data2 = new HashMap<>();
data.put("total7", String.format("%.2f",Double.parseDouble(columnMap.get("有功功率").toString())/1000)); data2.put("title",columnMap.get("风机台数").toString().replace(".0",""));
objects.add(data2);
data.put("total8",String.format("%.2f",Double.parseDouble(columnMap.get("日发电量").toString())/ (Double.parseDouble(columnMap.get("装机容量").toString())*1000))); Map<String, Object> data3 = new HashMap<>();
data.put("total9",columnMap.get("总辐射累计").toString());//总辐射日累计 data3.put("title",columnMap.get("月发电量").toString());
data.put("total0",7.47);//综合效率 objects.add(data3);
return ResponseHelper.buildResponse(data); Map<String, Object> data4 = new HashMap<>();
data4.put("title",columnMap.get("总辐射").toString());
objects.add(data4);
Map<String, Object> data5 = new HashMap<>();
data5.put("title",columnMap.get("年发电量").toString());
objects.add(data5);
Map<String, Object> data6 = new HashMap<>();
data6.put("title", String.format("%.2f",Double.parseDouble(columnMap.get("有功功率").toString())/1000)) ;
objects.add(data6);
Map<String, Object> data7 = new HashMap<>();
data7.put("title",String.format("%.2f",Double.parseDouble(columnMap.get("日发电量").toString())/ (Double.parseDouble(columnMap.get("装机容量").toString())*1000)));
objects.add(data7);
Map<String, Object> data8 = new HashMap<>();
data8.put("title",String.format("%.2f",Double.parseDouble(columnMap.get("总辐射累计").toString())));
objects.add(data8);
Map<String, Object> data9 = new HashMap<>();
data9.put("title","84.00%");//综合效率
objects.add(data9);
IPage<Map<String,Object>> result = new Page<>();
result.setRecords(objects);
result.setCurrent(1);
result.setTotal(objects.size());
return ResponseHelper.buildResponse(result);
} }
......
...@@ -41,6 +41,15 @@ public class CommonServiceImpl { ...@@ -41,6 +41,15 @@ public class CommonServiceImpl {
totalvalue =mapList.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l->Double.parseDouble((String) l.get("value"))).sum(); totalvalue =mapList.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l->Double.parseDouble((String) l.get("value"))).sum();
return Double.valueOf(String.format("%.2f",totalvalue)); return Double.valueOf(String.format("%.2f",totalvalue));
} }
public Double getNumByIndicatior(String gatewayId,String indicator){
String sql = "SELECT * FROM indicators_"+gatewayId+" where equipmentIndexName=~/"+indicator+"$/";
Double totalvalue = 0.0;
List<Map<String,Object>> mapList = influxdbUtil.query(sql);
totalvalue =mapList.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l->Double.parseDouble((String) l.get("value"))).sum();
return Double.valueOf(String.format("%.2f",totalvalue));
}
/** /**
* @deprecated 获取指标值平均值 * @deprecated 获取指标值平均值
* @param gatewayId 网关id 用于拼接sql语句 * @param gatewayId 网关id 用于拼接sql语句
......
...@@ -651,7 +651,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -651,7 +651,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public void schedAddAlarmEventData(String gatewayId,String stationId,String stationName,long currentsort){ public void schedAddAlarmEventData(String gatewayId,String stationId,String stationName,long currentsort){
String sql = "SELECT * FROM indicators_"+gatewayId+" WHERE systemType = '光字牌' and value = 'true'"; String sql = "SELECT * FROM indicators_"+gatewayId+" WHERE systemType = '光字牌' and value = 'false'";
List<IndicatorsDto> indicatorsDtoList = influxDButils.getListDataAll(sql,IndicatorsDto.class); List<IndicatorsDto> indicatorsDtoList = influxDButils.getListDataAll(sql,IndicatorsDto.class);
List<AlarmEvent> newAlarmEvents = new ArrayList<>(); List<AlarmEvent> newAlarmEvents = new ArrayList<>();
List<String> alarmsNames = new ArrayList<>(); List<String> alarmsNames = new ArrayList<>();
...@@ -1043,24 +1043,32 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1043,24 +1043,32 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
List<IndicatorsDto> windSqlList = influxDButils.getListDataAll(sql, IndicatorsDto.class); List<IndicatorsDto> windSqlList = influxDButils.getListDataAll(sql, IndicatorsDto.class);
Map<String, List<IndicatorsDto>> maps = windSqlList.stream().collect(Collectors.groupingBy(IndicatorsDto::getSystemType)); Map<String, List<IndicatorsDto>> maps = windSqlList.stream().collect(Collectors.groupingBy(IndicatorsDto::getSystemType));
ArrayList<Map<String, String>> resultList = new ArrayList<>(); ArrayList<Map<String, String>> resultList = new ArrayList<>();
Set<ColModel> listColModel = new LinkedHashSet<>();
List<ColModel> listColModels = new ArrayList<>();
ColModel name = new ColModel("name", "name", "测量点", "测量点", "dataGrid", "name");
listColModel.add(name);
for (Map.Entry<String, List<IndicatorsDto>> stringListEntry : maps.entrySet()) { for (Map.Entry<String, List<IndicatorsDto>> stringListEntry : maps.entrySet()) {
HashMap<String, String> stringStringHashMap = new HashMap<>(); HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("name", stringListEntry.getKey()); stringStringHashMap.put("name", stringListEntry.getKey());
for (IndicatorsDto indicatorsDto : stringListEntry.getValue()) { for (IndicatorsDto indicatorsDto : stringListEntry.getValue()) {
stringStringHashMap.put(ElectricQuantity.getCode(indicatorsDto.getDisplayName()), String.format("%.3f",ObjectUtils.isEmpty(indicatorsDto.getValue())?0.0:Double.parseDouble(indicatorsDto.getValue()))); stringStringHashMap.put(ElectricQuantity.getCode(indicatorsDto.getDisplayName()), String.format("%.2f",ObjectUtils.isEmpty(indicatorsDto.getValue())?0.0:Double.parseDouble(indicatorsDto.getValue())));
String key = ElectricQuantity.getCode(indicatorsDto.getDisplayName());
ColModel keyName = new ColModel(key, key, indicatorsDto.getDisplayName(),indicatorsDto.getDisplayName(), "dataGrid", key);
listColModel.add(keyName);
} }
resultList.add(stringStringHashMap); resultList.add(stringStringHashMap);
} }
listColModels.addAll(listColModel);
//构建平台数据 //构建平台数据
DataGridMock DataGridMock = new DataGridMock(current, resultList.size(), false, current, resultList); DataGridMock DataGridMock = new DataGridMock(current, resultList.size(), false, current, resultList);
ColModel colModelEventMovement = new ColModel("name", "name", "测量点", "测量点", "dataGrid", "name"); // ColModel colModelStationName = new ColModel("zxzyg", "zxzyg", "正向总有功", "正向总有功", "dataGrid", "zxzyg");
ColModel colModelStationName = new ColModel("zxzyg", "zxzyg", "正向总有功", "正向总有功", "dataGrid", "zxzyg"); // ColModel colModelEventDesc = new ColModel("fxzyg", "fxzyg", "反向总有功", "反向总有功", "dataGrid", "fxzyg");
ColModel colModelEventDesc = new ColModel("fxzyg", "fxzyg", "反向总有功", "反向总有功", "dataGrid", "fxzyg"); // ColModel colModelAlarmGroupName = new ColModel("zxzwg", "zxzwg", "正向总无功", "正向总无功", "dataGrid", "zxzwg");
ColModel colModelAlarmGroupName = new ColModel("zxzwg", "zxzwg", "正向总无功", "正向总无功", "zxzwg", "alarmGroupName"); // ColModel colModelEventTime = new ColModel("fxzwg", "fxzwg", "反向总无功", "反向总无功", "dataGrid", "fxzwg");
ColModel colModelEventTime = new ColModel("fxzwg", "fxzwg", "反向总无功", "反向总无功", "dataGrid", "fxzwg");
List<ColModel> listColModel = Arrays.asList(colModelEventMovement, colModelStationName, colModelEventDesc, colModelAlarmGroupName, colModelEventTime);
ResultsData resultsData = new ResultsData(DataGridMock, listColModel); //List<ColModel> listColModel = Arrays.asList(colModelEventMovement, colModelStationName, colModelEventDesc, colModelAlarmGroupName, colModelEventTime);
ResultsData resultsData = new ResultsData(DataGridMock, listColModels);
return resultsData; 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