Commit 6eea7db5 authored by zhangsen's avatar zhangsen

API提交

parent 9f86bc5a
...@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.dto.TreeDto; ...@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.dto.TreeDto;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator; import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator;
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.StationBasicMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
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;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -285,4 +286,27 @@ public class MonitorFanIdxController extends BaseController { ...@@ -285,4 +286,27 @@ public class MonitorFanIdxController extends BaseController {
return ResponseHelper.buildResponse(monitorFanIndicator.getBoosterStationInfo(stationId)); return ResponseHelper.buildResponse(monitorFanIndicator.getBoosterStationInfo(stationId));
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据id获取场站信息")
@GetMapping("/getByStationId")
public ResponseModel<IPage<StationBasic>> getByStationId(@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic oneByStationNumber = monitorFanIndicator.getOneByStationNumber(stationId);
List<StationBasic> stationBasics = Collections.singletonList(oneByStationNumber);
IPage<StationBasic> result = new Page<>();
result.setRecords(stationBasics);
result.setCurrent(1);
result.setTotal(stationBasics.size());
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "夏造运行列表API")
@GetMapping("/runningPageByStationId")
public ResponseModel<ResultsData> runningPageByStationId(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "stationId") String stationId) {
ResultsData resultsData = monitorFanIndicatorImpl.runningPageByStationId(current, size, stationId);
return ResponseHelper.buildResponse(resultsData);
}
} }
...@@ -237,7 +237,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -237,7 +237,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
} }
private StationBasic getOneByStationNumber(String stationId) { public StationBasic getOneByStationNumber(String stationId) {
return stationBasicMapper.selectById(stationId); return stationBasicMapper.selectById(stationId);
} }
...@@ -564,4 +564,41 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -564,4 +564,41 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
List<Map<String, String>> boosterStationInfo = monitorFanIndicatorregionMapper.getBoosterStationInfo(stationBasic.getFanGatewayId()); List<Map<String, String>> boosterStationInfo = monitorFanIndicatorregionMapper.getBoosterStationInfo(stationBasic.getFanGatewayId());
return boosterStationInfo; return boosterStationInfo;
} }
public ResultsData runningPageByStationId(int current, int size, String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String baseSql = "SELECT equipmentNumber, value FROM \"indicators_%s\" where equipmentIndexName = '%s'";
String windSql = String.format(baseSql, stationBasic.getFanGatewayId(), "风向角");
List<IndicatorsDto> windSqlList = influxDButils.getListDataAll(windSql,IndicatorsDto.class);
String powerSql = String.format(baseSql, stationBasic.getFanGatewayId(), "有功功率");
List<IndicatorsDto> powerSqlList = influxDButils.getListDataAll(powerSql,IndicatorsDto.class);
Map<String, String> powerSqlMap = powerSqlList.stream().collect(Collectors.toMap(IndicatorsDto::getEquipmentNumber, IndicatorsDto::getValue));
String windSpeedSql = String.format(baseSql, stationBasic.getFanGatewayId(), "瞬时风速");
List<IndicatorsDto> windSpeedSqlList = influxDButils.getListDataAll(windSpeedSql,IndicatorsDto.class);
Map<String, String> windSpeedSqlMap = windSpeedSqlList.stream().collect(Collectors.toMap(IndicatorsDto::getEquipmentNumber, IndicatorsDto::getValue));
String electricitySql = String.format(baseSql, stationBasic.getFanGatewayId(), "日发电量");
List<IndicatorsDto> electricitySqlList = influxDButils.getListDataAll(electricitySql,IndicatorsDto.class);
Map<String, String> electricitySqlMap = electricitySqlList.stream().collect(Collectors.toMap(IndicatorsDto::getEquipmentNumber, IndicatorsDto::getValue));
ArrayList<Map<String, String>> resultList = new ArrayList<>();
windSqlList.forEach(item -> {
HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("equipmentNumber", item.getEquipmentNumber());
stringStringHashMap.put("wind", item.getValue());
stringStringHashMap.put("power", powerSqlMap.get(item.getEquipmentNumber()));
stringStringHashMap.put("windSpeed", windSpeedSqlMap.get(item.getEquipmentNumber()));
stringStringHashMap.put("electricity", electricitySqlMap.get(item.getEquipmentNumber()));
resultList.add(stringStringHashMap);
});
//构建平台数据
DataGridMock DataGridMock = new DataGridMock(current, resultList.size(), false, current, resultList);
ColModel colModelEquipmentNumber = new ColModel("equipmentNumber", "equipmentNumber", "风机编码", "风机编码", "dataGrid", "equipmentNumber");
ColModel colModelPower = new ColModel("power", "power", "有功功率", "有功功率", "dataGrid", "power");
ColModel colModelWindSpeed = new ColModel("windSpeed", "windSpeed", "风速", "风速", "dataGrid", "windSpeed");
ColModel colModelWind = new ColModel("wind", "wind", "风向", "风向", "dataGrid", "wind");
ColModel colModelElectricity = new ColModel("electricity", "electricity", "日发电量", "日发电量", "dataGrid", "electricity");
List<ColModel> listColModel = Arrays.asList(colModelEquipmentNumber, colModelPower, colModelWindSpeed, colModelWind, colModelElectricity);
ResultsData resultsData = new ResultsData(DataGridMock, listColModel);
return resultsData;
}
} }
\ No newline at end of file
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