Commit ea23097a authored by tangwei's avatar tangwei

风机功率曲线

parent b05d0084
......@@ -232,7 +232,16 @@ public class MonitoringMapController extends BaseController {
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风机详情-风速功率曲线")
@GetMapping("/detailsWindSpeed")
public ResponseModel<Map<String, Object>> getDetailsWindSpeed(@RequestParam(value = "stationId") String stationId, String equipmentNumber) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
Map<String, Object> detailsWindSpeed = largeScreenImpl.getDetailsWindSpeed(gatewayId, equipmentNumber);
return ResponseHelper.buildResponse(detailsWindSpeed);
}
......
......@@ -1042,6 +1042,40 @@ public Map<String,Object> gettimedateyfd( ){
public Map<String, Object> getDetailsWindSpeed(String gatewayId, String equipmentNumber) {
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
String startTime = sdf.format(currentDayStartTime);
String endTime= sdf.format(currentDayEndTime);
List<IndicatorData> indicatorDataListWindSpeed = new ArrayList<>();
List<IndicatorData> indicatorDataListActivePower = new ArrayList<>();
indicatorDataListWindSpeed = indicatorDataMapper.selectDataByequipmentIndexNameAndtimeAndEquipmentNumber("瞬时风速", equipmentNumber, startTime, endTime, gatewayId);
indicatorDataListActivePower = indicatorDataMapper.selectDataByequipmentIndexNameAndtimeAndEquipmentNumber("有功功率", equipmentNumber, startTime, endTime, gatewayId);
List<String> windSpeeds = new ArrayList<>();
List<String> activePowers = new ArrayList<>();
List<String> axisData = new ArrayList<>();
for (int i = 0; i < indicatorDataListWindSpeed.size(); i++) {
windSpeeds.add(indicatorDataListWindSpeed.get(i).getValue());
activePowers.add(indicatorDataListActivePower.get(i).getValue());
axisData.add(cn.hutool.core.date.DateUtil.format(indicatorDataListWindSpeed.get(i).getCreatedTime(), "HH:mm"));
}
List<Map<String, Object>> seriesData = new ArrayList<>();
Map<String, Object> map = new HashMap<>();
Map<String, Object> map1 = new HashMap<>();
Map<String, Object> map2 = new HashMap<>();
map1.put("data", windSpeeds);
map2.put("data", activePowers);
seriesData.add(map1);
seriesData.add(map2);
map.put("seriesData", seriesData);
map.put("axisData", axisData);
return map;
}
......
......@@ -25,4 +25,12 @@ public interface IndicatorDataMapper extends BaseMapper<IndicatorData> {
@Select("select sum(valueFs) valueF,xtime from (select SUBSTR(`created_time`, 11,6) xtime, `value_f` as valueFs from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and ts >= #{startTime} and ts <= #{endTime} and gateway_id in (#{gatewayId})) group by xtime order by xtime ")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeqg(@Param("equipmentIndexName") String equipmentIndexName, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("gatewayId") String gatewayId);
@Select("select `value`, created_time, `value_f` as valueF from iot_data.indicator_data where equipment_index_name =#{equipmentIndexName} and equipment_number = #{equipmentNumber} and ts >= #{startTime} and ts <= #{endTime} and gateway_id =#{gatewayId}")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeAndEquipmentNumber(@Param("equipmentIndexName") String equipmentIndexName, @Param("equipmentNumber") String equipmentNumber, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("gatewayId") String gatewayId);
@Select("select `value`, created_time, `value_f` as valueF, equipment_index_name from iot_data.indicator_data where equipment_index_name like '%路电流%' and equipment_number = #{equipmentNumber} and ts >= #{startTime} and ts <= #{endTime} and gateway_id =#{gatewayId}")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeAndEquipmentNumberPv(@Param("equipmentNumber") String equipmentNumber, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("gatewayId") String gatewayId);
}
......@@ -1318,22 +1318,27 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
ArrayList<Map<String, String>> resultList = new ArrayList<>();
List<String> boosterDisplayNameList = Arrays.asList("Ia", "P", "Q");
for (Map<String, String> map : boosterStationInfo) {
List<ESEquipments> listData = esEquipmentsList.stream().filter(esEquipments -> esEquipments.getFrontModule().contains(map.get("boosterName")) && boosterDisplayNameList.contains(esEquipments.getDisplayName())).collect(Collectors.toList());
HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("value1", "0.0");
stringStringHashMap.put("value2", "0.0");
stringStringHashMap.put("value3", "0.0");
listData.forEach(item -> {
if (item.getDisplayName().equals("Ia")) {
stringStringHashMap.put("value1", item.getValueF() == null ? "0" : keepTwoDecimalPlaces(item.getValueF().toString()));
}
if (item.getDisplayName().equals("P")) {
stringStringHashMap.put("value2", item.getValueF() == null ? "0" : keepTwoDecimalPlaces(item.getValueF().toString()));
}
if (item.getDisplayName().equals("Q")) {
stringStringHashMap.put("value3", item.getValueF() == null ? "0" : keepTwoDecimalPlaces(item.getValueF().toString()));
}
});
if(!map.get("boosterName").toString().equals("35kVⅠ母PT")){
listData.forEach(item -> {
if (item.getDisplayName().equals("Ia")) {
stringStringHashMap.put("value1", item.getValueF() == null ? "0" : keepTwoDecimalPlaces(item.getValueF().toString()));
}
if (item.getDisplayName().equals("P")) {
stringStringHashMap.put("value2", item.getValueF() == null ? "0" : keepTwoDecimalPlaces(item.getValueF().toString()));
}
if (item.getDisplayName().equals("Q")) {
stringStringHashMap.put("value3", item.getValueF() == null ? "0" : keepTwoDecimalPlaces(item.getValueF().toString()));
}
});
}
resultList.add(stringStringHashMap);
}
resultMap.put("records", resultList);
......
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