Commit e65c55a0 authored by zhangsen's avatar zhangsen

风电-场站风速 、 光伏-辐照强度

parent 519c1bae
......@@ -42,6 +42,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.*;
import java.util.stream.Collectors;
......@@ -979,15 +980,31 @@ public class BigScreenAnalyseController extends BaseController {
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风电-场站风速")
@ApiOperation(value = "风电-场站风速 、 光伏-辐照强度 (WTX-801_25_WTX-801_总辐射)")
@GetMapping("/getFanWindSpeedInfo")
public ResponseModel<Map<String, String>> getFanWindSpeedInfo(@RequestParam("stationId") String stationId) throws Exception {
public ResponseModel<Map<String, Object>> getFanWindSpeedInfo(@RequestParam("stationId") String stationId,
@RequestParam("equipmentIndexName") String equipmentIndexName,
@RequestParam("limitNum") Integer limitNum,
@RequestParam(value = "stationType", required = false) String stationType) throws Exception {
if (StrUtil.isNotEmpty(stationId)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
stationId = stationBasic.getFanGatewayId();
stationId = StrUtil.isNotEmpty(stationType) ? stationBasic.getBoosterGatewayId() : stationBasic.getFanGatewayId();
}
return ResponseHelper.buildResponse(null);
String date = DateUtils.convertDateToString(DateUtils.dateAddHours(DateUtils.getCurrentDayStartTime(new Date()), -8), DateUtils.DATE_TIME_PATTERN);
List<IndicatorData> indicatorDataList = indicatorDataMapper.selectByIndexNameAndDate(equipmentIndexName, stationId, date, limitNum);
Map<String,Object> map = new HashMap<>();
List<Object> valueList = new ArrayList<>();
List<Object> time = new ArrayList<>();
Collections.reverse(indicatorDataList);
for (IndicatorData indicatorData : indicatorDataList) {
valueList.add(indicatorData.getValueF());
Timestamp createdTime = indicatorData.getCreatedTime();
String s = DateUtils.convertDateToString(createdTime, "HH:mm");
time.add(s);
}
map.put("seriesData", valueList);
map.put("axisData",time);
return ResponseHelper.buildResponse(map);
}
}
......@@ -30,4 +30,13 @@ public interface IndicatorDataMapper extends BaseMapper<IndicatorData> {
@Select("select `id`, `value` from iot_data.indicator_data where `address` in (${addresses}) and gateway_id = #{gatewayId}")
List<IndicatorData> selectByAddresses(@Param("addresses") String addresses, @Param("gatewayId") String gatewayId);
/**
* 根据测点名称查询测点值信息
* @param equipmentIndexName 测点名称
* @param gatewayId 网关Id
* @param date 时间
* @param limitNum 分页条数
*/
@Select("SELECT created_time as createdTime, avg( `value_f` ) as valueF FROM iot_data.indicator_data WHERE gateway_id = #{gatewayId} AND equipment_index_name = #{equipmentIndexName} AND ts > #{date} GROUP BY created_time order by created_time desc LIMIT #{limitNum}")
List<IndicatorData> selectByIndexNameAndDate(@Param("equipmentIndexName") String equipmentIndexName, @Param("gatewayId") String gatewayId, @Param("date") String date, @Param("limitNum") Integer limitNum);
}
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