Commit b07390e9 authored by tangwei's avatar tangwei

去除influx

parent 36316fe9
......@@ -13,16 +13,16 @@
WHEN 'false' then '恢复'
ELSE event_movement end ) as eventMovement
from
fault_alarm_event
fault_alarm_event
<where>
<if test="gatewayId != null and gatewayId != ''">
gateway_id = #{gatewayId}
</if>
<if test="gatewayId != null and gatewayId != ''">
gateway_id = #{gatewayId}
</if>
<if test="stationId != null and stationId != ''">
station_id = #{stationId}
</if>
</where>
order by sort desc limit #{current},#{size}
order by event_time desc
</select>
......
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
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.mapper.MonitorFanIndicatorMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IndicatorsDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.Test;
import com.yeejoin.amos.boot.module.jxiop.biz.scheduled.PowerGeneration;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.StationBasicServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.TestServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*;
import java.util.concurrent.TimeUnit;
@RestController
@Api(tags = "Demo-test")
@RequestMapping(value = "/demo")
public class DemoController extends BaseController {
Logger logger = LoggerFactory.getLogger(DemoController.class);
@Autowired
StationBasicServiceImpl stationBasicServiceimpl;
@Autowired
TestServiceImpl testServiceimpl;
@Autowired
InfluxDbConnection influxDbConnection;
@Autowired
InfluxDButils influxDButils;
@Autowired
EmqKeeper emqKeeper;
@Autowired
PowerGeneration powerGeneration;
@Autowired
private MonitorFanIndicatorMapper monitorFanIndicatorregionMapper;
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "demo测试prodcutcion 库")
@GetMapping("/test")
public StationBasic demoTest() {
return stationBasicServiceimpl.getById(1660231556607774721L);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "demo测试中间库")
@GetMapping("/test1")
public List<Test> demoTest1() {
return testServiceimpl.getList();
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "demo测试influxdb")
@GetMapping("/test3")
public void demoTest2() {
String sql = "SELECT * FROM indicators_1668801435891929089";
String sql1 = "SELECT * FROM indicators_1668801570352926721";
List<IndicatorsDto> list = influxDButils.getListData(sql, IndicatorsDto.class);
List<IndicatorsDto> list2 = influxDButils.getListData(sql1, IndicatorsDto.class);
System.out.println(list.size());
System.out.println(list2.size());
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "初始化influxdb-风电、光伏、升压站")
@GetMapping("/test4")
public void demoTest3() {
//数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站
String [] strings = {"1668801435891929089","1669524885619085313"};
// String [] strings = {"1669524885619085313"};
// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速");
// System.out.println(o.toString());
for (int i = 0; i < strings.length; i++) {
QueryWrapper<MonitorFanIndicator> QueryWrapper = new QueryWrapper<>();
// 夏造风电
// QueryWrapper.eq("gateway", "1668801435891929089");
// 泰和光伏
QueryWrapper.eq("gateway", strings[i]);
long DATE = new Date().getTime();
System.out.println(DATE);
List<MonitorFanIndicator> list = monitorFanIndicatorregionMapper.selectList(QueryWrapper);
for (MonitorFanIndicator monitorFanIndicator : list) {
Map<String, String> tag = new HashMap<>();
Map<String, Object> maps2 = new HashMap<>();
maps2.put("address", monitorFanIndicator.getIndexAddress());
maps2.put("dataType", monitorFanIndicator.getDataType());
maps2.put("equipmentSpecificName", monitorFanIndicator.getFanCode());
tag.put("equipmentsIdx", monitorFanIndicator.getAddressGateway());
maps2.put("gatewayId", monitorFanIndicator.getGateway());
maps2.put("isAlarm", monitorFanIndicator.getIsAlarm());
maps2.put("createdTime", "2023-07-05 18:30:26");
maps2.put("unit", monitorFanIndicator.getUnit());
maps2.put("value", "");
maps2.put("valueLabel","" );
maps2.put("traceId", "");
maps2.put("equipmentIndexName", monitorFanIndicator.getIndicator());
maps2.put("equipmentNumber", monitorFanIndicator.getEquipmentNumber());
maps2.put("frontModule", monitorFanIndicator.getFrontModule());
maps2.put("systemType", monitorFanIndicator.getSystemType());
maps2.put("pictureName", monitorFanIndicator.getPictureName());
//升压站的字段显示名称
maps2.put("displayName", "");
influxDbConnection.insert("indicators_" + monitorFanIndicator.getGateway(), tag, maps2, 1688558007051L, TimeUnit.MILLISECONDS);
}
}
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "测试消息发送")
@GetMapping("/test5")
public void demoTest4() {
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("test", String.valueOf(Math.random() * 1000));
hashMap.put("test1", String.valueOf(Math.random() * 100));
try {
emqKeeper.getMqttClient().publish("test_topic", JSON.toJSON(hashMap).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("test_topic1", JSON.toJSON(hashMap).toString().getBytes("UTF-8"), 1, true);
logger.info("++++++++++++++++++++++++++++++++++发送消息成功++++++++++++++++++++++++++++++++++++++");
} catch (Exception exception) {
logger.error("============================================================发送消息报错");
}
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "初始化升压站")
@GetMapping("/test6")
public void demoTest5() {
//数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站
String [] strings = {"1668801570352926721","1669525017559306241"};
// String [] strings = {"1669525017559306241"};
// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速");
// System.out.println(o.toString());
for (int i = 0; i < strings.length; i++) {
QueryWrapper<MonitorFanIndicator> QueryWrapper = new QueryWrapper<>();
// 夏造风电
// QueryWrapper.eq("gateway", "1668801435891929089");
// 泰和光伏
QueryWrapper.eq("gateway", strings[i]);
long DATE = new Date().getTime();
System.out.println(DATE);
List<MonitorFanIndicator> list = monitorFanIndicatorregionMapper.selectList(QueryWrapper);
for (MonitorFanIndicator monitorFanIndicator : list) {
Map<String, String> tag = new HashMap<>();
Map<String, Object> maps2 = new HashMap<>();
maps2.put("address", monitorFanIndicator.getIndexAddress());
maps2.put("dataType", monitorFanIndicator.getDataType());
maps2.put("equipmentSpecificName", monitorFanIndicator.getFanCode());
tag.put("equipmentsIdx", monitorFanIndicator.getAddressGateway());
maps2.put("gatewayId", monitorFanIndicator.getGateway());
maps2.put("isAlarm", monitorFanIndicator.getIsAlarm());
maps2.put("createdTime", "2023-07-05 18:30:26");
maps2.put("unit", monitorFanIndicator.getUnit());
maps2.put("value", "");
maps2.put("valueLabel","" );
maps2.put("traceId", "");
maps2.put("equipmentIndexName", monitorFanIndicator.getIndicator());
maps2.put("equipmentNumber", monitorFanIndicator.getEquipmentNumber());
maps2.put("frontModule", monitorFanIndicator.getFrontModule());
maps2.put("systemType", monitorFanIndicator.getSystemType());
maps2.put("pictureName", monitorFanIndicator.getPictureName());
//升压站的字段显示名称
maps2.put("displayName", monitorFanIndicator.getEquipmentNumber());
influxDbConnection.insert("indicators_" + monitorFanIndicator.getGateway(), tag, maps2, 1688558007051L, TimeUnit.MILLISECONDS);
}
}
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "测试动态图片")
@GetMapping("/test7")
public ResponseModel<HashMap<String, String>> demoTest6() {
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("url", "upload/jxiop/amos_studio/758F6F4BC695B777899485DB0C7E5D3.gif");
return ResponseHelper.buildResponse(hashMap);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "test99")
@GetMapping("/test99")
public void test19() {
powerGeneration.addESDailyPowerGeneration();
powerGeneration.addESYearPowerGeneration();
powerGeneration.addESMoonPowerGeneration();
}
}
//package com.yeejoin.amos.boot.module.jxiop.biz.controller;
//
//
//import com.alibaba.fastjson.JSON;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.yeejoin.amos.boot.biz.common.controller.BaseController;
//import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
//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.mapper.MonitorFanIndicatorMapper;
//import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
//import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments;
//import com.yeejoin.amos.boot.module.jxiop.biz.dto.IndicatorsDto;
//import com.yeejoin.amos.boot.module.jxiop.biz.entity.Test;
//import com.yeejoin.amos.boot.module.jxiop.biz.scheduled.PowerGeneration;
//import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.StationBasicServiceImpl;
//import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.TestServiceImpl;
//import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//import org.typroject.tyboot.component.emq.EmqKeeper;
//import org.typroject.tyboot.core.foundation.enumeration.UserType;
//import org.typroject.tyboot.core.restful.doc.TycloudOperation;
//import org.typroject.tyboot.core.restful.utils.ResponseHelper;
//import org.typroject.tyboot.core.restful.utils.ResponseModel;
//
//import java.util.*;
//import java.util.concurrent.TimeUnit;
//
//
//@RestController
//@Api(tags = "Demo-test")
//@RequestMapping(value = "/demo")
//public class DemoController extends BaseController {
// Logger logger = LoggerFactory.getLogger(DemoController.class);
//
// @Autowired
// StationBasicServiceImpl stationBasicServiceimpl;
// @Autowired
// TestServiceImpl testServiceimpl;
//
//// @Autowired
//// InfluxDbConnection influxDbConnection;
//
//// @Autowired
//// InfluxDButils influxDButils;
//
// @Autowired
// EmqKeeper emqKeeper;
//
// @Autowired
// PowerGeneration powerGeneration;
//
// @Autowired
// private MonitorFanIndicatorMapper monitorFanIndicatorregionMapper;
//
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "demo测试prodcutcion 库")
// @GetMapping("/test")
// public StationBasic demoTest() {
// return stationBasicServiceimpl.getById(1660231556607774721L);
// }
//
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "demo测试中间库")
// @GetMapping("/test1")
// public List<Test> demoTest1() {
// return testServiceimpl.getList();
// }
//
//// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
//// @ApiOperation(value = "demo测试influxdb")
//// @GetMapping("/test3")
//// public void demoTest2() {
//// String sql = "SELECT * FROM indicators_1668801435891929089";
//// String sql1 = "SELECT * FROM indicators_1668801570352926721";
//// List<IndicatorsDto> list = influxDButils.getListData(sql, IndicatorsDto.class);
//// List<IndicatorsDto> list2 = influxDButils.getListData(sql1, IndicatorsDto.class);
//// System.out.println(list.size());
//// System.out.println(list2.size());
//// }
//
//// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
//// @ApiOperation(value = "初始化influxdb-风电、光伏、升压站")
//// @GetMapping("/test4")
//// public void demoTest3() {
//// //数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站
//// String [] strings = {"1668801435891929089","1669524885619085313"};
////// String [] strings = {"1669524885619085313"};
////// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速");
////// System.out.println(o.toString());
//// for (int i = 0; i < strings.length; i++) {
//// QueryWrapper<MonitorFanIndicator> QueryWrapper = new QueryWrapper<>();
////// 夏造风电
////// QueryWrapper.eq("gateway", "1668801435891929089");
////// 泰和光伏
//// QueryWrapper.eq("gateway", strings[i]);
//// long DATE = new Date().getTime();
//// System.out.println(DATE);
//// List<MonitorFanIndicator> list = monitorFanIndicatorregionMapper.selectList(QueryWrapper);
////
//// for (MonitorFanIndicator monitorFanIndicator : list) {
//// Map<String, String> tag = new HashMap<>();
//// Map<String, Object> maps2 = new HashMap<>();
////
//// maps2.put("address", monitorFanIndicator.getIndexAddress());
//// maps2.put("dataType", monitorFanIndicator.getDataType());
//// maps2.put("equipmentSpecificName", monitorFanIndicator.getFanCode());
//// tag.put("equipmentsIdx", monitorFanIndicator.getAddressGateway());
//// maps2.put("gatewayId", monitorFanIndicator.getGateway());
//// maps2.put("isAlarm", monitorFanIndicator.getIsAlarm());
//// maps2.put("createdTime", "2023-07-05 18:30:26");
//// maps2.put("unit", monitorFanIndicator.getUnit());
//// maps2.put("value", "");
//// maps2.put("valueLabel","" );
//// maps2.put("traceId", "");
//// maps2.put("equipmentIndexName", monitorFanIndicator.getIndicator());
//// maps2.put("equipmentNumber", monitorFanIndicator.getEquipmentNumber());
//// maps2.put("frontModule", monitorFanIndicator.getFrontModule());
//// maps2.put("systemType", monitorFanIndicator.getSystemType());
//// maps2.put("pictureName", monitorFanIndicator.getPictureName());
//// //升压站的字段显示名称
//// maps2.put("displayName", "");
//// influxDbConnection.insert("indicators_" + monitorFanIndicator.getGateway(), tag, maps2, 1688558007051L, TimeUnit.MILLISECONDS);
//// }
//// }
////
//// }
//
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "测试消息发送")
// @GetMapping("/test5")
// public void demoTest4() {
// HashMap<String, String> hashMap = new HashMap<>();
// hashMap.put("test", String.valueOf(Math.random() * 1000));
// hashMap.put("test1", String.valueOf(Math.random() * 100));
// try {
// emqKeeper.getMqttClient().publish("test_topic", JSON.toJSON(hashMap).toString().getBytes("UTF-8"), 1, true);
// emqKeeper.getMqttClient().publish("test_topic1", JSON.toJSON(hashMap).toString().getBytes("UTF-8"), 1, true);
// logger.info("++++++++++++++++++++++++++++++++++发送消息成功++++++++++++++++++++++++++++++++++++++");
// } catch (Exception exception) {
// logger.error("============================================================发送消息报错");
// }
// }
//
//// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
//// @ApiOperation(value = "初始化升压站")
//// @GetMapping("/test6")
//// public void demoTest5() {
//// //数据说明 夏造风电、泰和光伏、夏造升压站、泰和升压站
//// String [] strings = {"1668801570352926721","1669525017559306241"};
////// String [] strings = {"1669525017559306241"};
////// Object o=this.monitorFanIndicatorImpl.getIndicatoralueAvage("1668801435891929089","60秒平均风速");
////// System.out.println(o.toString());
//// for (int i = 0; i < strings.length; i++) {
//// QueryWrapper<MonitorFanIndicator> QueryWrapper = new QueryWrapper<>();
////// 夏造风电
////// QueryWrapper.eq("gateway", "1668801435891929089");
////// 泰和光伏
//// QueryWrapper.eq("gateway", strings[i]);
//// long DATE = new Date().getTime();
//// System.out.println(DATE);
//// List<MonitorFanIndicator> list = monitorFanIndicatorregionMapper.selectList(QueryWrapper);
////
//// for (MonitorFanIndicator monitorFanIndicator : list) {
//// Map<String, String> tag = new HashMap<>();
//// Map<String, Object> maps2 = new HashMap<>();
////
//// maps2.put("address", monitorFanIndicator.getIndexAddress());
//// maps2.put("dataType", monitorFanIndicator.getDataType());
//// maps2.put("equipmentSpecificName", monitorFanIndicator.getFanCode());
//// tag.put("equipmentsIdx", monitorFanIndicator.getAddressGateway());
//// maps2.put("gatewayId", monitorFanIndicator.getGateway());
//// maps2.put("isAlarm", monitorFanIndicator.getIsAlarm());
//// maps2.put("createdTime", "2023-07-05 18:30:26");
//// maps2.put("unit", monitorFanIndicator.getUnit());
//// maps2.put("value", "");
//// maps2.put("valueLabel","" );
//// maps2.put("traceId", "");
//// maps2.put("equipmentIndexName", monitorFanIndicator.getIndicator());
//// maps2.put("equipmentNumber", monitorFanIndicator.getEquipmentNumber());
//// maps2.put("frontModule", monitorFanIndicator.getFrontModule());
//// maps2.put("systemType", monitorFanIndicator.getSystemType());
//// maps2.put("pictureName", monitorFanIndicator.getPictureName());
//// //升压站的字段显示名称
//// maps2.put("displayName", monitorFanIndicator.getEquipmentNumber());
//// influxDbConnection.insert("indicators_" + monitorFanIndicator.getGateway(), tag, maps2, 1688558007051L, TimeUnit.MILLISECONDS);
//// }
//// }
//// }
//
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "测试动态图片")
// @GetMapping("/test7")
// public ResponseModel<HashMap<String, String>> demoTest6() {
// HashMap<String, String> hashMap = new HashMap<>();
// hashMap.put("url", "upload/jxiop/amos_studio/758F6F4BC695B777899485DB0C7E5D3.gif");
// return ResponseHelper.buildResponse(hashMap);
// }
//
//
//
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "test99")
// @GetMapping("/test99")
// public void test19() {
// powerGeneration.addESDailyPowerGeneration();
// powerGeneration.addESYearPowerGeneration();
// powerGeneration.addESMoonPowerGeneration();
// }
//
//}
......@@ -9,7 +9,6 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.ColModel;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.DataGridMock;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ResultsData;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.MonitorFanIndicatorImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
......@@ -55,25 +54,25 @@ public class DeviceController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取历史告警数据")
@GetMapping("/historyNationwide")
public ResponseModel<ResultsData> getLSNationWideInfo(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size,@RequestParam(value = "stationBasicId") String stationBasicId,@RequestParam(value = "equipmentNumber" , required = false ) String equipmentNumber) {
ResultsData resultsData=monitorFanIndicatorImpl.getLsNationWideInfo( current, size, stationBasicId, equipmentNumber);
return ResponseHelper.buildResponse(resultsData);
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "获取历史告警数据")
// @GetMapping("/historyNationwide")
// public ResponseModel<ResultsData> getLSNationWideInfo(@RequestParam(value = "current") int current,@RequestParam
// (value = "size") int size,@RequestParam(value = "stationBasicId") String stationBasicId,@RequestParam(value = "equipmentNumber" , required = false ) String equipmentNumber) {
// ResultsData resultsData=monitorFanIndicatorImpl.getLsNationWideInfo( current, size, stationBasicId, equipmentNumber);
// return ResponseHelper.buildResponse(resultsData);
// }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "监盘大屏 - 获取历史告警数据")
@GetMapping("/historyNationwideByPage")
public ResponseModel<Page<IndexDto>> historyNationwideByPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "stationBasicId") String stationBasicId) {
Page<IndexDto> resultsData = monitorFanIndicatorImpl.historyNationwideByPage( current, size, stationBasicId);
return ResponseHelper.buildResponse(resultsData);
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "监盘大屏 - 获取历史告警数据")
// @GetMapping("/historyNationwideByPage")
// public ResponseModel<Page<IndexDto>> historyNationwideByPage(@RequestParam(value = "current") int current,
// @RequestParam(value = "size") int size,
// @RequestParam(value = "stationBasicId") String stationBasicId) {
// Page<IndexDto> resultsData = monitorFanIndicatorImpl.historyNationwideByPage( current, size, stationBasicId);
// return ResponseHelper.buildResponse(resultsData);
// }
......
......@@ -95,17 +95,17 @@ public class MonitorFanIdxController extends BaseController {
private final String NFDL= "年发电量";
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据设备编号、场站id、前段展示模块、系统类型查询表数据")
@GetMapping("/getFanIdxInfoByPage")
public ResponseModel<IPage<IndexDto>> getFanIdxInfoByPage(@RequestParam(value = "equipNum", required = false) String equipNum,
@RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "frontModule", required = false) String frontModule,
@RequestParam(value = "systemType", required = false) String systemType,
@RequestParam(value = "current", required = false) int current,
@RequestParam(value = "size", required = false) int size) {
return ResponseHelper.buildResponse(monitorFanIndicator.getFanIdxInfoByPage(equipNum, stationId, frontModule, current, size, systemType));
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "根据设备编号、场站id、前段展示模块、系统类型查询表数据")
// @GetMapping("/getFanIdxInfoByPage")
// public ResponseModel<IPage<IndexDto>> getFanIdxInfoByPage(@RequestParam(value = "equipNum", required = false) String equipNum,
// @RequestParam(value = "stationId", required = false) String stationId,
// @RequestParam(value = "frontModule", required = false) String frontModule,
// @RequestParam(value = "systemType", required = false) String systemType,
// @RequestParam(value = "current", required = false) int current,
// @RequestParam(value = "size", required = false) int size) {
// return ResponseHelper.buildResponse(monitorFanIndicator.getFanIdxInfoByPage(equipNum, stationId, frontModule, current, size, systemType));
// }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "左侧树API")
......@@ -115,86 +115,86 @@ public class MonitorFanIdxController extends BaseController {
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风机布置图 - 风机状态列表")
@GetMapping("/getFanStatusList")
public ResponseModel<IPage<IndexDto>> getFanStatusList(@RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "current", required = false) int current,
@RequestParam(value = "size", required = false) int size) {
List<IndexDto> fanStatusList = monitorFanIndicator.getFanStatusList(stationId);
Page<IndexDto> page = new Page<>(current, size);
List<IndexDto> collect = fanStatusList.stream()
.skip((long) (current - 1) * size)
.limit(size)
.collect(Collectors.toList());
page.setTotal(fanStatusList.size());
page.setRecords(collect);
return ResponseHelper.buildResponse(page);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风机布置图 - 风机状态图片")
@GetMapping("/getFanStatusListImage")
public ResponseModel<IPage<HashMap<String,String>>> getFanStatusListImages() {
List<IndexDto> fanStatusList = monitorFanIndicator.getFanStatusList("1660231556607774721");
List<IndexDto> collect = fanStatusList.stream()
.limit(999)
.collect(Collectors.toList());
IPage<HashMap<String,String>> page = new Page<>();
HashMap<String,String> hashMap = new HashMap<>();
List<IndexDto> indexDtoList = collect.stream().sorted(Comparator.comparing(IndexDto::getEquipmentNumber)).collect(Collectors.toList());
for (int i = 1; i <= indexDtoList.size(); i++) {
IndexDto indexDto = indexDtoList.get(i-1);
hashMap.put("url"+i,fanStatusImagePathPrefix+"/"+"风机-"+indexDto.getState()+".gif");
hashMap.put("name"+i,indexDto.getEquipmentNumber());
}
page.setTotal(10);
page.setSize(10);
page.setCurrent(1);
List<HashMap<String,String>> hashMapList = new ArrayList<>();
hashMapList.add(hashMap);
page.setRecords(hashMapList);
return ResponseHelper.buildResponse(page);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风机布置图 - 风机数量")
@GetMapping("/getFanNum")
public ResponseModel<Integer> getFanNum(@RequestParam(value = "stationId", required = false) String stationId) {
Integer num = monitorFanIndicator.getFanNum(stationId);
return ResponseHelper.buildResponse(num);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风机布置图 - 实时监控表计仪表盘数据")
@GetMapping("/getFanDataByType")
public ResponseModel<Map<String, String>> getFanDataByType(@RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "equipNum", required = false) String equipNum,
@RequestParam(value = "frontModule", required = false) String frontModule,
@RequestParam(value = "typeName", required = false) String typeName) {
String num = monitorFanIndicator.getFanDataByType(stationId, equipNum, frontModule, typeName);
Map<String, String> map = new HashMap<>();
map.put("value", num);
return ResponseHelper.buildResponse(map);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风机布置图 - 风机状态统计")
@GetMapping("/getFanStatusStatistics")
public ResponseModel<IPage<IndexDto>> getFanStatusStatistics(@RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "current", required = false) int current,
@RequestParam(value = "size", required = false) int size) {
List<IndexDto> fanStatusStatistics = monitorFanIndicator.getFanStatusStatistics(stationId);
Page<IndexDto> page = new Page<>(current, size);
List<IndexDto> collect = fanStatusStatistics.stream()
.skip((long) (current - 1) * size)
.limit(size)
.collect(Collectors.toList());
page.setTotal(fanStatusStatistics.size());
page.setRecords(collect);
return ResponseHelper.buildResponse(page);
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "风机布置图 - 风机状态列表")
// @GetMapping("/getFanStatusList")
// public ResponseModel<IPage<IndexDto>> getFanStatusList(@RequestParam(value = "stationId", required = false) String stationId,
// @RequestParam(value = "current", required = false) int current,
// @RequestParam(value = "size", required = false) int size) {
// List<IndexDto> fanStatusList = monitorFanIndicator.getFanStatusList(stationId);
// Page<IndexDto> page = new Page<>(current, size);
// List<IndexDto> collect = fanStatusList.stream()
// .skip((long) (current - 1) * size)
// .limit(size)
// .collect(Collectors.toList());
// page.setTotal(fanStatusList.size());
// page.setRecords(collect);
// return ResponseHelper.buildResponse(page);
// }
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "风机布置图 - 风机状态图片")
// @GetMapping("/getFanStatusListImage")
// public ResponseModel<IPage<HashMap<String,String>>> getFanStatusListImages() {
// List<IndexDto> fanStatusList = monitorFanIndicator.getFanStatusList("1660231556607774721");
// List<IndexDto> collect = fanStatusList.stream()
// .limit(999)
// .collect(Collectors.toList());
// IPage<HashMap<String,String>> page = new Page<>();
// HashMap<String,String> hashMap = new HashMap<>();
// List<IndexDto> indexDtoList = collect.stream().sorted(Comparator.comparing(IndexDto::getEquipmentNumber)).collect(Collectors.toList());
// for (int i = 1; i <= indexDtoList.size(); i++) {
// IndexDto indexDto = indexDtoList.get(i-1);
// hashMap.put("url"+i,fanStatusImagePathPrefix+"/"+"风机-"+indexDto.getState()+".gif");
// hashMap.put("name"+i,indexDto.getEquipmentNumber());
// }
// page.setTotal(10);
// page.setSize(10);
// page.setCurrent(1);
// List<HashMap<String,String>> hashMapList = new ArrayList<>();
// hashMapList.add(hashMap);
// page.setRecords(hashMapList);
// return ResponseHelper.buildResponse(page);
// }
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "风机布置图 - 风机数量")
// @GetMapping("/getFanNum")
// public ResponseModel<Integer> getFanNum(@RequestParam(value = "stationId", required = false) String stationId) {
// Integer num = monitorFanIndicator.getFanNum(stationId);
// return ResponseHelper.buildResponse(num);
// }
//
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "风机布置图 - 实时监控表计仪表盘数据")
// @GetMapping("/getFanDataByType")
// public ResponseModel<Map<String, String>> getFanDataByType(@RequestParam(value = "stationId", required = false) String stationId,
// @RequestParam(value = "equipNum", required = false) String equipNum,
// @RequestParam(value = "frontModule", required = false) String frontModule,
// @RequestParam(value = "typeName", required = false) String typeName) {
// String num = monitorFanIndicator.getFanDataByType(stationId, equipNum, frontModule, typeName);
// Map<String, String> map = new HashMap<>();
// map.put("value", num);
// return ResponseHelper.buildResponse(map);
// }
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "风机布置图 - 风机状态统计")
// @GetMapping("/getFanStatusStatistics")
// public ResponseModel<IPage<IndexDto>> getFanStatusStatistics(@RequestParam(value = "stationId", required = false) String stationId,
// @RequestParam(value = "current", required = false) int current,
// @RequestParam(value = "size", required = false) int size) {
// List<IndexDto> fanStatusStatistics = monitorFanIndicator.getFanStatusStatistics(stationId);
// Page<IndexDto> page = new Page<>(current, size);
// List<IndexDto> collect = fanStatusStatistics.stream()
// .skip((long) (current - 1) * size)
// .limit(size)
// .collect(Collectors.toList());
// page.setTotal(fanStatusStatistics.size());
// page.setRecords(collect);
// return ResponseHelper.buildResponse(page);
// }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风机布置图 - 风机基础信息")
......@@ -204,14 +204,14 @@ public class MonitorFanIdxController extends BaseController {
return ResponseHelper.buildResponse(monitorFanIndicator.getFanBasicInfoByEquipNum(equipNum, stationId));
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取当前表记的实时温度")
@GetMapping("/getRealTimeTemperature")
public ResponseModel<HashMap<String, List<String>>> getRealTimeTemperature(@RequestParam(value = "equipNum", required = false) String equipNum,
@RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "frontModule", required = false) String frontModule) {
return ResponseHelper.buildResponse(monitorFanIndicator.getRealTimeTemperature(equipNum, stationId, frontModule)) ;
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "获取当前表记的实时温度")
// @GetMapping("/getRealTimeTemperature")
// public ResponseModel<HashMap<String, List<String>>> getRealTimeTemperature(@RequestParam(value = "equipNum", required = false) String equipNum,
// @RequestParam(value = "stationId", required = false) String stationId,
// @RequestParam(value = "frontModule", required = false) String frontModule) {
// return ResponseHelper.buildResponse(monitorFanIndicator.getRealTimeTemperature(equipNum, stationId, frontModule)) ;
// }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "全国风机-总概览")
......@@ -231,7 +231,7 @@ public class MonitorFanIdxController extends BaseController {
columnMap.put(column, String.format("%.2f", result));
}
for (String column : columnLists) {
Double result = commonServiceImpl.getAvgvalueByIndicatior(gatewayId, column);
// Double result = commonServiceImpl.getAvgvalueByIndicatior(gatewayId, column);
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速"));
......@@ -247,7 +247,9 @@ public class MonitorFanIdxController extends BaseController {
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
columnMap.put("有功功率", String.format("%.2f", result1.get(0).getValueF()));
String num = monitorFanIndicator.getFJCount(gatewayId);
//String num = monitorFanIndicator.getFJCount(gatewayId);
String num = monitorFanIndicator.getEquipCount(gatewayId, "FDZ");
columnMap.put("风机台数", num);
columnMap.put("风机台数",Double.valueOf(num).intValue());
Double capacityl = commonServiceImpl.getStationCapactityByStationWerks(stationBasic.getStationNumber());
......@@ -339,211 +341,211 @@ public class MonitorFanIdxController extends BaseController {
return ResponseHelper.buildResponse(detailsWindSpeed);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风机详情-风速功率曲线")
@GetMapping("/detailsWindSpeed")
public ResponseModel<Map<String, Object>> getDetailsWindSpeed(@RequestParam(value = "stationId")String stationId,String name) {
name = name + "风机";
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
Map<String, Object> detailsWindSpeed = monitorFanIndicator.getDetailsWindSpeed(gatewayId, name);
return ResponseHelper.buildResponse(detailsWindSpeed);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "逆变器-功率曲线")
@GetMapping("/getDetailsWindSpeeds")
public ResponseModel<Map<String, Object>> getDetailsWindSpeeds(@RequestParam(value = "stationId")String stationId,String equipNum) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
Map<String, Object> detailsWindSpeed = monitorFanIndicator.getDetailsWindSpeeds(gatewayId,equipNum);
return ResponseHelper.buildResponse(detailsWindSpeed);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "状态监控")
@GetMapping("/statusMonitoring")
public ResponseModel<IPage<Map<String, Object>>> getStatusMonitoring(@RequestParam(value = "stationId")String stationId,String equipNum,String systemType) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
List<Map<String, Object>> statusMonitoring = monitorFanIndicator.getStatusMonitoring(gatewayId, equipNum, systemType);
IPage<Map<String,Object>> result = new Page<>();
result.setRecords(statusMonitoring);
result.setCurrent(1);
result.setTotal(statusMonitoring.size());
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "升压站光字牌/开关-通用")
@GetMapping("/getStatusGzp")
public ResponseModel<IPage<Map<String, Object>>> getStatusGzp(@RequestParam(value = "stationId")String stationId,String frontModule,String systemType,String equipNum,@RequestParam(required = false) String stationType) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getBoosterGatewayId();
if (null != stationType){
gatewayId = stationBasic.getFanGatewayId();
}
List<Map<String, Object>> statusMonitoring = monitorFanIndicator.getStatusGzp(gatewayId ,systemType,frontModule,equipNum);
IPage<Map<String,Object>> result = new Page<>();
result.setRecords(statusMonitoring);
result.setCurrent(1);
result.setTotal(statusMonitoring.size());
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "升压站光字牌/压板状态API-通用")
@GetMapping("/getStatusGzpAndYb")
public ResponseModel getStatusGzp(@RequestParam(value = "stationId") String stationId,
@RequestParam(value = "frontModule") String frontModule) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getBoosterGatewayId();
Map<String, String> map = monitorFanIndicatorMapper.getMajorBoosterStationInfoBySort(gatewayId, frontModule);
String name = map.get("text").contains("主变")?map.get("text").substring(0,3):map.get("text");
HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("gzp", "光字牌");
stringStringHashMap.put("ybzt", "压板");
stringStringHashMap.put("agzp", "A套保护光字牌");
stringStringHashMap.put("bgzp", "B套保护光字牌");
for (Map.Entry<String, String> stringStringEntry : stringStringHashMap.entrySet()) {
List<Map<String, Object>> statusMonitoring = monitorFanIndicator.getStatusGzp(gatewayId ,stringStringEntry.getValue(), name,null);
IPage<Map<String,Object>> result = new Page<>();
result.setRecords(statusMonitoring);
result.setCurrent(1);
result.setTotal(statusMonitoring.size());
try {
emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, frontModule, stringStringEntry.getKey()), JSON.toJSONString(result).getBytes(),0,false);
} catch (MqttException e) {
e.printStackTrace();
}
}
return ResponseHelper.buildResponse(null);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "模拟量接口Api")
@GetMapping("/getAnalogQuantity")
public ResponseModel<IPage<Map<String, Object>>> getAnalogQuantity(@RequestParam(value = "stationId")String stationId,String frontModule,@RequestParam(required = false) String systemType) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getBoosterGatewayId();
if (null == systemType){
systemType = "模拟量";
}
List<Map<String, Object>> statusMonitoring = monitorFanIndicator.getAnalogQuantity(gatewayId ,frontModule,systemType);
IPage<Map<String,Object>> result = new Page<>();
result.setRecords(statusMonitoring);
result.setCurrent(1);
result.setTotal(statusMonitoring.size());
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "集电线路图左侧 集电线列表")
@GetMapping("/jdTree")
// @Scheduled(cron = "0/10 * * * * ? ")
public ResponseModel<IPage<Map<String, Object>>> getStatusJDX() {
LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
for (StationBasic stationBasic : stationBasics) {
String gatewayId = stationBasic.getBoosterGatewayId();
String werks = stationBasic.getStationNumber();
if (stationBasic.getStationType().equals("FDZ")){
monitorFanIndicator.getStatusJDX(gatewayId, stationBasic.getSequenceNbr().toString(),"集电");
}else if (stationBasic.getStationType().equals("JZSGFDZ") ){
monitorFanIndicator.getStatusJDX(gatewayId, stationBasic.getSequenceNbr().toString(),"前光");
}
}
return CommonResponseUtil.success();
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "集电线路图右侧 风机列表")
@GetMapping("/fjList")
// @Scheduled(cron = "0/10 * * * * ? ")
public ResponseModel getListByFJ() {
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "风机详情-风速功率曲线")
// @GetMapping("/detailsWindSpeed")
// public ResponseModel<Map<String, Object>> getDetailsWindSpeed(@RequestParam(value = "stationId")String stationId,String name) {
// name = name + "风机";
// StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// String gatewayId = stationBasic.getFanGatewayId();
// Map<String, Object> detailsWindSpeed = monitorFanIndicator.getDetailsWindSpeed(gatewayId, name);
//
// return ResponseHelper.buildResponse(detailsWindSpeed);
// }
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "逆变器-功率曲线")
// @GetMapping("/getDetailsWindSpeeds")
// public ResponseModel<Map<String, Object>> getDetailsWindSpeeds(@RequestParam(value = "stationId")String stationId,String equipNum) {
//
// StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// String gatewayId = stationBasic.getFanGatewayId();
// Map<String, Object> detailsWindSpeed = monitorFanIndicator.getDetailsWindSpeeds(gatewayId,equipNum);
//
// return ResponseHelper.buildResponse(detailsWindSpeed);
// }
LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
for (StationBasic stationBasic : stationBasics) {
String gatewayId = stationBasic.getFanGatewayId();
String werks = stationBasic.getStationNumber();
monitorFanIndicator.getListByFJ(gatewayId,werks,stationBasic.getSequenceNbr().toString());
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "状态监控")
// @GetMapping("/statusMonitoring")
// public ResponseModel<IPage<Map<String, Object>>> getStatusMonitoring(@RequestParam(value = "stationId")String stationId,String equipNum,String systemType) {
// StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// String gatewayId = stationBasic.getFanGatewayId();
// List<Map<String, Object>> statusMonitoring = monitorFanIndicator.getStatusMonitoring(gatewayId, equipNum, systemType);
// IPage<Map<String,Object>> result = new Page<>();
// result.setRecords(statusMonitoring);
// result.setCurrent(1);
// result.setTotal(statusMonitoring.size());
// return ResponseHelper.buildResponse(result);
// }
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "升压站光字牌/开关-通用")
// @GetMapping("/getStatusGzp")
// public ResponseModel<IPage<Map<String, Object>>> getStatusGzp(@RequestParam(value = "stationId")String stationId,String frontModule,String systemType,String equipNum,@RequestParam(required = false) String stationType) {
// StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// String gatewayId = stationBasic.getBoosterGatewayId();
// if (null != stationType){
// gatewayId = stationBasic.getFanGatewayId();
// }
// List<Map<String, Object>> statusMonitoring = monitorFanIndicator.getStatusGzp(gatewayId ,systemType,frontModule,equipNum);
// IPage<Map<String,Object>> result = new Page<>();
// result.setRecords(statusMonitoring);
// result.setCurrent(1);
// result.setTotal(statusMonitoring.size());
// return ResponseHelper.buildResponse(result);
// }
return CommonResponseUtil.success();
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "升压站光字牌/压板状态API-通用")
// @GetMapping("/getStatusGzpAndYb")
// public ResponseModel getStatusGzp(@RequestParam(value = "stationId") String stationId,
// @RequestParam(value = "frontModule") String frontModule) {
// StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// String gatewayId = stationBasic.getBoosterGatewayId();
// Map<String, String> map = monitorFanIndicatorMapper.getMajorBoosterStationInfoBySort(gatewayId, frontModule);
// String name = map.get("text").contains("主变")?map.get("text").substring(0,3):map.get("text");
// HashMap<String, String> stringStringHashMap = new HashMap<>();
// stringStringHashMap.put("gzp", "光字牌");
// stringStringHashMap.put("ybzt", "压板");
// stringStringHashMap.put("agzp", "A套保护光字牌");
// stringStringHashMap.put("bgzp", "B套保护光字牌");
// for (Map.Entry<String, String> stringStringEntry : stringStringHashMap.entrySet()) {
// List<Map<String, Object>> statusMonitoring = monitorFanIndicator.getStatusGzp(gatewayId ,stringStringEntry.getValue(), name,null);
// IPage<Map<String,Object>> result = new Page<>();
// result.setRecords(statusMonitoring);
// result.setCurrent(1);
// result.setTotal(statusMonitoring.size());
// try {
// emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, frontModule, stringStringEntry.getKey()), JSON.toJSONString(result).getBytes(),0,false);
// } catch (MqttException e) {
// e.printStackTrace();
// }
// }
// return ResponseHelper.buildResponse(null);
// }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取升压站信息 通过排序等")
@GetMapping("/getBoosterStationInfo")
public ResponseModel<List<Map<String, String>>> getBoosterStationInfo(@RequestParam(value = "stationId", required = false) String stationId) {
return ResponseHelper.buildResponse(monitorFanIndicator.getBoosterStationInfo(stationId));
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "模拟量接口Api")
// @GetMapping("/getAnalogQuantity")
// public ResponseModel<IPage<Map<String, Object>>> getAnalogQuantity(@RequestParam(value = "stationId")String stationId,String frontModule,@RequestParam(required = false) String systemType) {
// StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// String gatewayId = stationBasic.getBoosterGatewayId();
// if (null == systemType){
// systemType = "模拟量";
// }
//
// List<Map<String, Object>> statusMonitoring = monitorFanIndicator.getAnalogQuantity(gatewayId ,frontModule,systemType);
// IPage<Map<String,Object>> result = new Page<>();
// result.setRecords(statusMonitoring);
// result.setCurrent(1);
// result.setTotal(statusMonitoring.size());
// return ResponseHelper.buildResponse(result);
// }
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "集电线路图左侧 集电线列表")
// @GetMapping("/jdTree")
// // @Scheduled(cron = "0/10 * * * * ? ")
// public ResponseModel<IPage<Map<String, Object>>> getStatusJDX() {
// LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
// List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
// for (StationBasic stationBasic : stationBasics) {
// String gatewayId = stationBasic.getBoosterGatewayId();
// String werks = stationBasic.getStationNumber();
// if (stationBasic.getStationType().equals("FDZ")){
// monitorFanIndicator.getStatusJDX(gatewayId, stationBasic.getSequenceNbr().toString(),"集电");
// }else if (stationBasic.getStationType().equals("JZSGFDZ") ){
// monitorFanIndicator.getStatusJDX(gatewayId, stationBasic.getSequenceNbr().toString(),"前光");
// }
// }
// return CommonResponseUtil.success();
// }
@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);
oneByStationNumber.setTitlePos(null);
List<StationBasic> stationBasics = Collections.singletonList(oneByStationNumber);
IPage<StationBasic> result = new Page<>();
result.setRecords(stationBasics);
result.setCurrent(1);
result.setTotal(1);
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);
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "集电线路图右侧 风机列表")
// @GetMapping("/fjList")
// // @Scheduled(cron = "0/10 * * * * ? ")
// public ResponseModel getListByFJ() {
//
//
// LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
// List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
// for (StationBasic stationBasic : stationBasics) {
// String gatewayId = stationBasic.getFanGatewayId();
// String werks = stationBasic.getStationNumber();
// monitorFanIndicator.getListByFJ(gatewayId,werks,stationBasic.getSequenceNbr().toString());
// }
//
//
// return CommonResponseUtil.success();
// }
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "获取升压站信息 通过排序等")
// @GetMapping("/getBoosterStationInfo")
// public ResponseModel<List<Map<String, String>>> getBoosterStationInfo(@RequestParam(value = "stationId", required = false) String 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);
// oneByStationNumber.setTitlePos(null);
// List<StationBasic> stationBasics = Collections.singletonList(oneByStationNumber);
// IPage<StationBasic> result = new Page<>();
// result.setRecords(stationBasics);
// result.setCurrent(1);
// result.setTotal(1);
// 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);
// }
// @Scheduled(cron = "0/15 * * * * ? ")
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "模拟量列表消息")
@GetMapping("/getAnalogQuantityInfo")
public ResponseModel getAnalogQuantityInfo(@RequestParam(value = "stationId") String stationId, @RequestParam(value = "routeName")String routeName) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getBoosterGatewayId();
monitorFanIndicator.getAnalogQuantityInfo(gatewayId, stationBasic.getSequenceNbr().toString(), routeName);
return CommonResponseUtil.success();
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "模拟量列表消息")
// @GetMapping("/getAnalogQuantityInfo")
// public ResponseModel getAnalogQuantityInfo(@RequestParam(value = "stationId") String stationId, @RequestParam(value = "routeName")String routeName) {
// StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// String gatewayId = stationBasic.getBoosterGatewayId();
// monitorFanIndicator.getAnalogQuantityInfo(gatewayId, stationBasic.getSequenceNbr().toString(), routeName);
// return CommonResponseUtil.success();
// }
// @Scheduled(cron = "0/15 * * * * ? ")
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "升压站主屏消息接口")
@GetMapping("/getMajorAnalogQuantityByPage")
public ResponseModel getMajorAnalogQuantityByPage(@RequestParam (required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getBoosterGatewayId();
if ("夏造风电站".equals(stationBasic.getStationName())) {
monitorFanIndicator.getMajorAnalogQuantityByPage(gatewayId, stationBasic.getSequenceNbr().toString());
} else if ("泰和前进光伏站".equals(stationBasic.getStationName())) {
monitorFanIndicator.getMajorAnalogQuantityByPageByTHGF(gatewayId, stationBasic.getSequenceNbr().toString());
}
return CommonResponseUtil.success();
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "升压站主屏消息接口")
// @GetMapping("/getMajorAnalogQuantityByPage")
// public ResponseModel getMajorAnalogQuantityByPage(@RequestParam (required = false) String stationId) {
// StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// String gatewayId = stationBasic.getBoosterGatewayId();
// if ("夏造风电站".equals(stationBasic.getStationName())) {
// monitorFanIndicator.getMajorAnalogQuantityByPage(gatewayId, stationBasic.getSequenceNbr().toString());
// } else if ("泰和前进光伏站".equals(stationBasic.getStationName())) {
// monitorFanIndicator.getMajorAnalogQuantityByPageByTHGF(gatewayId, stationBasic.getSequenceNbr().toString());
// }
// return CommonResponseUtil.success();
// }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "故障记录API")
......@@ -557,88 +559,90 @@ public class MonitorFanIdxController extends BaseController {
resultsData = monitorFanIndicatorImpl.getAlarmEventList(current, size, stationId);
}else if (type.equals("1")){
resultsData = monitorFanIndicatorImpl.getLsNationWideInfo(current, size, stationId,null);
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String fanGatewayId = stationBasic.getFanGatewayId();
resultsData = monitorFanIndicatorImpl.getNationWideInfo(current, size, fanGatewayId, null);
}
return ResponseHelper.buildResponse(resultsData);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "夏造电量表计API")
@GetMapping("/electricQuantity")
public ResponseModel<ResultsData> getElectricQuantityList(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "stationId") String stationId,
@RequestParam(value = "stationType",required = false) String stationType) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getBoosterGatewayId();
ResultsData resultsData = monitorFanIndicatorImpl.getElectricQuantityList(current, size, gatewayId,stationType);
return ResponseHelper.buildResponse(resultsData);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "开关图片API/消息")
@GetMapping("/switchUrl")
public ResponseModel<Map<String,Object>> getElectricQuantityList(
@RequestParam(value = "stationId") String stationId
) {
LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
for (StationBasic stationBasic : stationBasics) {
monitorFanIndicatorImpl.getSwitchUrlAll(stationBasic);
}
return CommonResponseUtil.success();
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "动态面板页面消息")
@GetMapping("/pageTopic")
public ResponseModel<Map<String,Object>> sendPageTopic(
@RequestParam(value = "stationId") String stationId, @RequestParam(value = "equipName") String equipName
) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getBoosterGatewayId();
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "夏造电量表计API")
// @GetMapping("/electricQuantity")
// public ResponseModel<ResultsData> getElectricQuantityList(@RequestParam(value = "current") int current,
// @RequestParam(value = "size") int size,
// @RequestParam(value = "stationId") String stationId,
// @RequestParam(value = "stationType",required = false) String stationType) {
// StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// String gatewayId = stationBasic.getBoosterGatewayId();
// ResultsData resultsData = monitorFanIndicatorImpl.getElectricQuantityList(current, size, gatewayId,stationType);
// return ResponseHelper.buildResponse(resultsData);
// }
Map<String, String> map = monitorFanIndicatorMapper.getMajorBoosterStationInfoBySort(gatewayId, equipName);
String name = map.get("text").equals("1主变高压侧") || map.get("text").equals("1主变低压侧") ?map.get("text").substring(0,3):map.get("text");
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "开关图片API/消息")
// @GetMapping("/switchUrl")
// public ResponseModel<Map<String,Object>> getElectricQuantityList(
// @RequestParam(value = "stationId") String stationId
// ) {
//
// LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
// List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
// for (StationBasic stationBasic : stationBasics) {
// monitorFanIndicatorImpl.getSwitchUrlAll(stationBasic);
// }
//
// return CommonResponseUtil.success();
// }
Map<String, Object> switchUrl = monitorFanIndicatorImpl.getSwitchUrl(gatewayId, name);
List<Map<String, Object>> statusMonitoring = monitorFanIndicator.getStatusGzp(gatewayId ,"网络",name,null);
IPage<Map<String, Object>> result = new Page<>();
switchUrl.put("records",statusMonitoring);
switchUrl.put("current",1);
switchUrl.put("total",100);
List<Map<String, Object>> data = new ArrayList<>();
data.add(switchUrl);
result.setRecords(data);
result.setCurrent(1);
result.setTotal(100);
try {
emqKeeper.getMqttClient().publish(stationId+"/switch/"+equipName, JSON.toJSONString(result).getBytes(),0,false);
} catch (MqttException e) {
e.printStackTrace();
}
return CommonResponseUtil.success();
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "动态面板页面消息")
// @GetMapping("/pageTopic")
// public ResponseModel<Map<String,Object>> sendPageTopic(
// @RequestParam(value = "stationId") String stationId, @RequestParam(value = "equipName") String equipName
// ) {
//
// StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// String gatewayId = stationBasic.getBoosterGatewayId();
//
//
// Map<String, String> map = monitorFanIndicatorMapper.getMajorBoosterStationInfoBySort(gatewayId, equipName);
// String name = map.get("text").equals("1主变高压侧") || map.get("text").equals("1主变低压侧") ?map.get("text").substring(0,3):map.get("text");
//
//
// Map<String, Object> switchUrl = monitorFanIndicatorImpl.getSwitchUrl(gatewayId, name);
// List<Map<String, Object>> statusMonitoring = monitorFanIndicator.getStatusGzp(gatewayId ,"网络",name,null);
// IPage<Map<String, Object>> result = new Page<>();
// switchUrl.put("records",statusMonitoring);
// switchUrl.put("current",1);
// switchUrl.put("total",100);
// List<Map<String, Object>> data = new ArrayList<>();
// data.add(switchUrl);
// result.setRecords(data);
// result.setCurrent(1);
// result.setTotal(100);
//
// try {
// emqKeeper.getMqttClient().publish(stationId+"/switch/"+equipName, JSON.toJSONString(result).getBytes(),0,false);
// } catch (MqttException e) {
// e.printStackTrace();
// }
// return CommonResponseUtil.success();
// }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "1#主变油温")
@GetMapping("/zbyw")
public ResponseModel<Map<String,Object>> getYwData(@RequestParam(value = "stationId") String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getBoosterGatewayId();
Map<String,Object> resultsData = monitorFanIndicatorImpl.getyw( gatewayId);
return ResponseHelper.buildResponse(resultsData);
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "1#主变油温")
// @GetMapping("/zbyw")
// public ResponseModel<Map<String,Object>> getYwData(@RequestParam(value = "stationId") String stationId) {
// StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// String gatewayId = stationBasic.getBoosterGatewayId();
// Map<String,Object> resultsData = monitorFanIndicatorImpl.getyw( gatewayId);
// return ResponseHelper.buildResponse(resultsData);
// }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
......@@ -743,33 +747,33 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "详情基础信息")
@GetMapping("/getEquipInfoByEquipNum")
public ResponseModel<Map<String,Object>> getEquipInfoByEquipNum(@RequestParam(value = "equipNum", required = false) String equipNum,
@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
return ResponseHelper.buildResponse(monitorFanIndicator.getEquipInfoByEquipNum(gatewayId,equipNum ));
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "详情基础信息")
// @GetMapping("/getEquipInfoByEquipNum")
// public ResponseModel<Map<String,Object>> getEquipInfoByEquipNum(@RequestParam(value = "equipNum", required = false) String equipNum,
// @RequestParam(value = "stationId", required = false) String stationId) {
// StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// String gatewayId = stationBasic.getFanGatewayId();
// return ResponseHelper.buildResponse(monitorFanIndicator.getEquipInfoByEquipNum(gatewayId,equipNum ));
// }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "光伏左侧资源树")
@GetMapping("/getEquipTree")
public ResponseModel<IPage<Map<String, Object>>> getEquipTree(@RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "frontModule", required = false) String frontModule,
@RequestParam(value = "equipmentNumber", required = false) String equipmentNumber
) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
List<Map<String, Object>> equipmentNum = monitorFanIndicator.getEquipmentNum(gatewayId, frontModule, equipmentNumber);
IPage<Map<String, Object>> result = new Page<>();
result.setRecords(equipmentNum);
result.setCurrent(1);
result.setTotal(equipmentNum.size());
return ResponseHelper.buildResponse(result);
}
//
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "光伏左侧资源树")
// @GetMapping("/getEquipTree")
// public ResponseModel<IPage<Map<String, Object>>> getEquipTree(@RequestParam(value = "stationId", required = false) String stationId,
// @RequestParam(value = "frontModule", required = false) String frontModule,
// @RequestParam(value = "equipmentNumber", required = false) String equipmentNumber
// ) {
// StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// String gatewayId = stationBasic.getFanGatewayId();
// List<Map<String, Object>> equipmentNum = monitorFanIndicator.getEquipmentNum(gatewayId, frontModule, equipmentNumber);
// IPage<Map<String, Object>> result = new Page<>();
// result.setRecords(equipmentNum);
// result.setCurrent(1);
// result.setTotal(equipmentNum.size());
// return ResponseHelper.buildResponse(result);
// }
......@@ -798,106 +802,106 @@ public class MonitorFanIdxController extends BaseController {
return ResponseHelper.buildResponse(statisticsInfo);
}
@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")
// @Scheduled(cron = "0/10 * * * * ? ")
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 ));
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "光伏 运行列表")
@GetMapping("/solarPowerOperation")
public ResponseModel<IPage<Map<String, Object>>> solarPowerOperation(@RequestParam(value = "stationId")String stationId,@RequestParam(value = "current") int current, int size) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
List<Map<String, Object>> statusMonitoring = monitorFanIndicator.solarPowerOperation(gatewayId);
List<Map<String, Object>> collect = statusMonitoring.stream()
.skip((long) (current - 1) * size)
.limit(size)
.collect(Collectors.toList());
IPage<Map<String,Object>> result = new Page<>();
result.setRecords(collect);
result.setCurrent(current);
result.setTotal(statusMonitoring.size());
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "汇流箱 功率曲线")
@GetMapping("/hlWindSpeeds")
public ResponseModel<Map<String, Object>> hlWindSpeeds(@RequestParam(value = "stationId")String stationId,@RequestParam(value = "equipNum") String equipNum) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
Map<String, Object> result = monitorFanIndicator.hlWindSpeeds(gatewayId,equipNum);
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "集电线路图右侧 光伏列表")
@GetMapping("/gfList")
// @Scheduled(cron = "0/10 * * * * ? ")
public ResponseModel getListByNbq() {
LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
for (StationBasic stationBasic : stationBasics) {
String gatewayId = stationBasic.getFanGatewayId();
String werks = stationBasic.getStationNumber();
monitorFanIndicator.getListByNbq(gatewayId,werks,stationBasic.getSequenceNbr().toString());
}
// @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")
// // @Scheduled(cron = "0/10 * * * * ? ")
// 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 ));
// }
return CommonResponseUtil.success();
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "光伏 运行列表")
// @GetMapping("/solarPowerOperation")
// public ResponseModel<IPage<Map<String, Object>>> solarPowerOperation(@RequestParam(value = "stationId")String stationId,@RequestParam(value = "current") int current, int size) {
// StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// String gatewayId = stationBasic.getFanGatewayId();
//
// List<Map<String, Object>> statusMonitoring = monitorFanIndicator.solarPowerOperation(gatewayId);
// List<Map<String, Object>> collect = statusMonitoring.stream()
// .skip((long) (current - 1) * size)
// .limit(size)
// .collect(Collectors.toList());
// IPage<Map<String,Object>> result = new Page<>();
// result.setRecords(collect);
// result.setCurrent(current);
// result.setTotal(statusMonitoring.size());
// return ResponseHelper.buildResponse(result);
// }
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "汇流箱 功率曲线")
// @GetMapping("/hlWindSpeeds")
// public ResponseModel<Map<String, Object>> hlWindSpeeds(@RequestParam(value = "stationId")String stationId,@RequestParam(value = "equipNum") String equipNum) {
// StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// String gatewayId = stationBasic.getFanGatewayId();
//
// Map<String, Object> result = monitorFanIndicator.hlWindSpeeds(gatewayId,equipNum);
//
// return ResponseHelper.buildResponse(result);
// }
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "集电线路图右侧 光伏列表")
// @GetMapping("/gfList")
// // @Scheduled(cron = "0/10 * * * * ? ")
// public ResponseModel getListByNbq() {
//
//
// LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
// List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
// for (StationBasic stationBasic : stationBasics) {
// String gatewayId = stationBasic.getFanGatewayId();
// String werks = stationBasic.getStationNumber();
// monitorFanIndicator.getListByNbq(gatewayId,werks,stationBasic.getSequenceNbr().toString());
// }
//
//
// return CommonResponseUtil.success();
// }
@ApiOperation(value = "风机-三维告警")
@GetMapping("/partofWaring3D")
public ResponseModel<Map<String, Object>> partofWaring3D(@RequestParam(value = "stationId")String stationId,@RequestParam(value = "equipNum") String equipNum) {
Map<String, Object> result = monitorFanIndicator.partofWaring3D(stationId,equipNum);
return ResponseHelper.buildResponse(result);
}
//
// @ApiOperation(value = "风机-三维告警")
// @GetMapping("/partofWaring3D")
// public ResponseModel<Map<String, Object>> partofWaring3D(@RequestParam(value = "stationId")String stationId,@RequestParam(value = "equipNum") String equipNum) {
// Map<String, Object> result = monitorFanIndicator.partofWaring3D(stationId,equipNum);
// return ResponseHelper.buildResponse(result);
// }
@ApiOperation(value = "电站排名")
@Scheduled(cron = "0/10 * * * * ? ")
......@@ -1261,46 +1265,46 @@ public class MonitorFanIdxController extends BaseController {
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "健康运行百分比 ")
@GetMapping("/getFanStatusByZC")
public ResponseModel<Map<String,Object>> getFanStatusByZC(@RequestParam(value = "stationId", required = false) String stationId
) {
List<IndexDto> fanStatusList = monitorFanIndicator.getFanStatusStatistics(stationId);
int healthNum = 0;
int sum = 0;
for (IndexDto indexDto : fanStatusList) {
if (indexDto.getEquipmentIndexName().equals("正常运行")){
healthNum = Integer.parseInt(indexDto.getCountString());
}
sum += Integer.parseInt(indexDto.getCountString());
}
Map<String, Object> hashMap = new HashMap<>() ;
double percent = (double) healthNum / sum * 100;
int value = (int) percent;
String[] values = new String[]{String.valueOf(value)};
hashMap.put("seriesData",values);
hashMap.put("title",healthNum+"/"+sum);
return ResponseHelper.buildResponse(hashMap);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "单个风机状态")
@GetMapping("/getFanStatusByEquipNum")
public ResponseModel<Map<String,Object>> getFanStatusList(@RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value="equip")String equipNum) {
List<IndexDto> fanStatusList = monitorFanIndicator.getFanStatusList(stationId);
Map<String, Object> hashMap = new HashMap<>() ;
String status = "";
for (IndexDto indexDto : fanStatusList) {
if (indexDto.getEquipmentNumber().equals(equipNum)){
status =indexDto.getState();
}
}
hashMap.put("title",status);
return ResponseHelper.buildResponse(hashMap);
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "健康运行百分比 ")
// @GetMapping("/getFanStatusByZC")
// public ResponseModel<Map<String,Object>> getFanStatusByZC(@RequestParam(value = "stationId", required = false) String stationId
// ) {
// List<IndexDto> fanStatusList = monitorFanIndicator.getFanStatusStatistics(stationId);
// int healthNum = 0;
// int sum = 0;
// for (IndexDto indexDto : fanStatusList) {
// if (indexDto.getEquipmentIndexName().equals("正常运行")){
// healthNum = Integer.parseInt(indexDto.getCountString());
// }
// sum += Integer.parseInt(indexDto.getCountString());
// }
// Map<String, Object> hashMap = new HashMap<>() ;
//
//
// double percent = (double) healthNum / sum * 100;
// int value = (int) percent;
// String[] values = new String[]{String.valueOf(value)};
// hashMap.put("seriesData",values);
// hashMap.put("title",healthNum+"/"+sum);
// return ResponseHelper.buildResponse(hashMap);
// }
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "单个风机状态")
// @GetMapping("/getFanStatusByEquipNum")
// public ResponseModel<Map<String,Object>> getFanStatusList(@RequestParam(value = "stationId", required = false) String stationId,
// @RequestParam(value="equip")String equipNum) {
// List<IndexDto> fanStatusList = monitorFanIndicator.getFanStatusList(stationId);
// Map<String, Object> hashMap = new HashMap<>() ;
// String status = "";
// for (IndexDto indexDto : fanStatusList) {
// if (indexDto.getEquipmentNumber().equals(equipNum)){
// status =indexDto.getState();
// }
// }
// hashMap.put("title",status);
// return ResponseHelper.buildResponse(hashMap);
// }
}
......@@ -11,7 +11,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.service.IMapRegionService;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.*;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.Test;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.*;
import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javafx.scene.control.Tab;
......@@ -44,19 +44,19 @@ public class MonitoringMapController extends BaseController {
LargeScreenImpl largeScreenImpl;
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "获取监盘全国地图数据")
@GetMapping("/nationwide")
public ResponseModel<List<RegionNationWideDto>> getNationWideInfo(@RequestParam (value = "provinceName", required = false)String provinceName,@RequestParam (value = "type", required = false)String type) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getNationWideInfo(provinceName,type));
}
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// @ApiOperation(value = "获取监盘全国地图数据")
// @GetMapping("/nationwide")
// public ResponseModel<List<RegionNationWideDto>> getNationWideInfo(@RequestParam (value = "provinceName", required = false)String provinceName,@RequestParam (value = "type", required = false)String type) {
// return ResponseHelper.buildResponse(monitoringServiceImpl.getNationWideInfo(provinceName,type));
// }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "获取监盘全国地图-发电量数据")
@GetMapping("/getNationalPowerGenerationData")
public ResponseModel<List<HashMap<String,Object>>> getNationalPowerGenerationData() {
return ResponseHelper.buildResponse(monitoringServiceImpl.getNationalPowerGenerationData());
}
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// @ApiOperation(value = "获取监盘全国地图-发电量数据")
// @GetMapping("/getNationalPowerGenerationData")
// public ResponseModel<List<HashMap<String,Object>>> getNationalPowerGenerationData() {
// return ResponseHelper.buildResponse(monitoringServiceImpl.getNationalPowerGenerationData());
// }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "获取监盘全国地图-获取功率曲线下拉框数据")
......@@ -65,12 +65,12 @@ public class MonitoringMapController extends BaseController {
return ResponseHelper.buildResponse(monitoringServiceImpl.getSelectDataForNational());
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "获取区域电量指标完成情况")
@GetMapping("/getCompletionOfPowerIndicatorsByProvinceName")
public ResponseModel<ResultsData> getCompletionOfPowerIndicatorsByProvinceName(@RequestParam(required = true) int current, @RequestParam(required = true) int size, @RequestParam(required = true) String provinceName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getCompletionOfPowerIndicatorsByProvinceName(current,size,provinceName));
}
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// @ApiOperation(value = "获取区域电量指标完成情况")
// @GetMapping("/getCompletionOfPowerIndicatorsByProvinceName")
// public ResponseModel<ResultsData> getCompletionOfPowerIndicatorsByProvinceName(@RequestParam(required = true) int current, @RequestParam(required = true) int size, @RequestParam(required = true) String provinceName) {
// return ResponseHelper.buildResponse(monitoringServiceImpl.getCompletionOfPowerIndicatorsByProvinceName(current,size,provinceName));
// }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "根据场站id动态获取tab页签")
......@@ -84,12 +84,12 @@ public class MonitoringMapController extends BaseController {
public ResponseModel<List<MapAreaInfoDto>> getAreaInfo() {
return ResponseHelper.buildResponse(monitoringServiceImpl.getAreaInfo());
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "监盘首页地图-片区")
@GetMapping("/getStaitonListInfoByAreaName")
public ResponseModel<List<HomeMapStationInfoDto>> getStaitonListInfoByAreaName(@RequestParam(required = true)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getStaitonListInfoByAreaName(areaName));
}
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// @ApiOperation(value = "监盘首页地图-片区")
// @GetMapping("/getStaitonListInfoByAreaName")
// public ResponseModel<List<HomeMapStationInfoDto>> getStaitonListInfoByAreaName(@RequestParam(required = true)String areaName) {
// return ResponseHelper.buildResponse(monitoringServiceImpl.getStaitonListInfoByAreaName(areaName));
// }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "监盘首页-场站分类信息")
......@@ -112,45 +112,45 @@ public class MonitoringMapController extends BaseController {
return ResponseHelper.buildResponse(monitoringServiceImpl.getActivePowerByAreaName(areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "监盘首页-社会贡献")
@GetMapping("/getSocialContributionDtoList")
public ResponseModel<Page<SocialContributionDto>> getSocialContributionDtoList(@RequestParam(required = false)String areaName, @RequestParam(required = false)String station) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getSocialContributionDtoList(areaName,station));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "监盘首页-发电量趋势")
@GetMapping("/getPowerGenerationTrendsOfMonth")
public ResponseModel<HashMap<String, List<String>>> getPowerGenerationTrendsOfMonth(@RequestParam(required = false)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getPowerGenerationTrendsOfMonth(areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "监盘首页-发电量详情")
@GetMapping("/getDetailsOnPowergeneration")
public ResponseModel<Page<HashMap<String,String>>> getDetailsOnPowergeneration(@RequestParam(required = false)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getDetailsOnPowergeneration(areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "监盘首页-发电量趋势完成率")
@GetMapping("/getPowerGenerationTrendsOfCompletionRate")
public ResponseModel<HashMap<String, List<String>>> getPowerGenerationTrendsOfCompletionRate(@RequestParam(required = false)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getPowerGenerationTrendsOfCompletionRate(areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "监盘首页-发电top5")
@GetMapping("/getPowerGenerationTrendsOfCompletionTopFive")
public ResponseModel<Page<HashMap<String,String>>> getPowerGenerationTrendsOfCompletionTopFive(@RequestParam(required = false)String areaName) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getPowerGenerationTrendsOfCompletionTopFive(areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "监盘首页-发电小时排名top3")
@GetMapping("/getPowerGenerationTrendsOfCompletionTopThree")
public ResponseModel<Page<HashMap<String, String>>> getPowerGenerationTrendsOfCompletionTopThree(@RequestParam(required = false)String areaName,@RequestParam(required = false,defaultValue = "0")String tabValue) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getPowerGenerationTrendsOfCompletionTopThree(tabValue,areaName));
}
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// @ApiOperation(value = "监盘首页-社会贡献")
// @GetMapping("/getSocialContributionDtoList")
// public ResponseModel<Page<SocialContributionDto>> getSocialContributionDtoList(@RequestParam(required = false)String areaName, @RequestParam(required = false)String station) {
// return ResponseHelper.buildResponse(monitoringServiceImpl.getSocialContributionDtoList(areaName,station));
// }
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// @ApiOperation(value = "监盘首页-发电量趋势")
// @GetMapping("/getPowerGenerationTrendsOfMonth")
// public ResponseModel<HashMap<String, List<String>>> getPowerGenerationTrendsOfMonth(@RequestParam(required = false)String areaName) {
// return ResponseHelper.buildResponse(monitoringServiceImpl.getPowerGenerationTrendsOfMonth(areaName));
// }
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// @ApiOperation(value = "监盘首页-发电量详情")
// @GetMapping("/getDetailsOnPowergeneration")
// public ResponseModel<Page<HashMap<String,String>>> getDetailsOnPowergeneration(@RequestParam(required = false)String areaName) {
// return ResponseHelper.buildResponse(monitoringServiceImpl.getDetailsOnPowergeneration(areaName));
// }
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// @ApiOperation(value = "监盘首页-发电量趋势完成率")
// @GetMapping("/getPowerGenerationTrendsOfCompletionRate")
// public ResponseModel<HashMap<String, List<String>>> getPowerGenerationTrendsOfCompletionRate(@RequestParam(required = false)String areaName) {
// return ResponseHelper.buildResponse(monitoringServiceImpl.getPowerGenerationTrendsOfCompletionRate(areaName));
// }
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// @ApiOperation(value = "监盘首页-发电top5")
// @GetMapping("/getPowerGenerationTrendsOfCompletionTopFive")
// public ResponseModel<Page<HashMap<String,String>>> getPowerGenerationTrendsOfCompletionTopFive(@RequestParam(required = false)String areaName) {
// return ResponseHelper.buildResponse(monitoringServiceImpl.getPowerGenerationTrendsOfCompletionTopFive(areaName));
// }
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// @ApiOperation(value = "监盘首页-发电小时排名top3")
// @GetMapping("/getPowerGenerationTrendsOfCompletionTopThree")
// public ResponseModel<Page<HashMap<String, String>>> getPowerGenerationTrendsOfCompletionTopThree(@RequestParam(required = false)String areaName,@RequestParam(required = false,defaultValue = "0")String tabValue) {
// return ResponseHelper.buildResponse(monitoringServiceImpl.getPowerGenerationTrendsOfCompletionTopThree(tabValue,areaName));
// }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "运行监盘-获取全国数据")
......
......@@ -11,8 +11,8 @@ public interface AlarmEventMapper extends BaseMapper<AlarmEvent> {
String getLastDataBySort(String gatewayId);
List <AlarmEventDto> getAlarmEventList(String gatewayId,String stationId,int current, int size);
List <AlarmEventDto> getAlarmEventList(String gatewayId,String stationId);
List<String> getOldAlarmsBySort(String gatewayId, String sort);
......
......@@ -16,8 +16,8 @@ public interface IMonitorFanIndicator {
//批量修改指标值
void UpdateMonitorFanIndicator(List<IndexDto> list);
ResultsData getNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber);
ResultsData getLsNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber);
Map<String, Object> partofWaring3D(String stationId, String equipNum);
// ResultsData getNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber);
// ResultsData getLsNationWideInfo( int current, int size, String stationBasicId, String equipmentNumber);
//
// Map<String, Object> partofWaring3D(String stationId, String equipNum);
}
......@@ -16,8 +16,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.SocialContributionDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto;
import com.yeejoin.amos.boot.module.jxiop.biz.initdata.StationCacheDataInit;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SjglZsjZsbtzMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import lombok.extern.slf4j.Slf4j;
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
......@@ -51,11 +50,11 @@ import java.util.stream.Collectors;
@Service
@Slf4j
public class CommonServiceImpl {
@Autowired
InfluxDButils influxDButils;
// @Autowired
// InfluxDButils influxDButils;
@Autowired
InfluxdbUtil influxdbUtil;
// @Autowired
// InfluxdbUtil influxdbUtil;
@Autowired
SjglZsjZsbtzMapper sjglZsjZsbtzMapper;
......@@ -96,13 +95,13 @@ public class CommonServiceImpl {
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));
}
// 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 获取指标值平均值
......@@ -110,17 +109,17 @@ public class CommonServiceImpl {
* @param indicator 指标名称 查询条件-根据指标名称获取风速
* @return 指标值总和
*/
public Double getAvgvalueByIndicatior(String gatewayId,String indicator){
String sql = "SELECT * FROM indicators_" + gatewayId + " where equipmentIndexName='" + indicator + "'";
Double avageValue = 0.00;
try {
List<Map<String, Object>> mapList = influxdbUtil.query(sql);
avageValue = mapList.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).average().getAsDouble();
} catch (Exception e) {
return avageValue;
}
return Double.valueOf(String.format("%.2f", avageValue));
}
// public Double getAvgvalueByIndicatior(String gatewayId,String indicator){
// String sql = "SELECT * FROM indicators_" + gatewayId + " where equipmentIndexName='" + indicator + "'";
// Double avageValue = 0.00;
// try {
// List<Map<String, Object>> mapList = influxdbUtil.query(sql);
// avageValue = mapList.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).average().getAsDouble();
// } catch (Exception e) {
// return avageValue;
// }
// return Double.valueOf(String.format("%.2f", avageValue));
// }
public Double getTotalByIndicatior(List<Map<String,Object>> mapList,String indicator){
Double totalvalue = 0.0;
totalvalue =mapList.stream().filter(stringObjectMap ->stringObjectMap.get("equipmentIndexName").toString().contains(indicator)&&!ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l->Double.parseDouble((String) l.get("value"))).sum();
......@@ -136,6 +135,8 @@ public class CommonServiceImpl {
avageValue =mapList.stream().filter(stringObjectMap ->stringObjectMap.get("equipmentIndexName").toString().contains(indicator)&&!ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l->Double.parseDouble((String) l.get("value"))).sum();
return Double.valueOf(String.format("%.2f",avageValue));
}
public Double getStationCapactityByStationWerks(String WERKS){
return sjglZsjZsbtzMapper.getStationCapactityByStationWerks(WERKS);
}
......@@ -233,7 +234,48 @@ public class CommonServiceImpl {
return stationCacheInfoDtos;
}
/**
* 根据查询条件获取列表信息
*
* @param mustQuerCondtion
* @param shouldQuerCondtion
* @param tClass
* @param <T>
* @param likeMap 模糊字段查询 key:不能带.keyWords
* @return
*/
public <T> List<T> getListDataByCondtionsAndLike(Map<String, List<String>> mustQuerCondtion, Map<String, String> shouldQuerCondtion, Class<T> tClass, Map<String, String> likeMap) {
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
if (!ObjectUtils.isEmpty(mustQuerCondtion)) {
for (String key : mustQuerCondtion.keySet()) {
List<String> va = mustQuerCondtion.get(key);
queryBuilder.must(QueryBuilders.termsQuery(key, va));
}
}
if (!ObjectUtils.isEmpty(shouldQuerCondtion)) {
for (String key : shouldQuerCondtion.keySet()) {
queryBuilder.should(QueryBuilders.wildcardQuery(key, shouldQuerCondtion.get(key)));
}
}
if (!ObjectUtils.isEmpty(likeMap)) {
for (String key : likeMap.keySet()) {
MatchPhraseQueryBuilder queryBuilder1 = QueryBuilders.matchPhraseQuery(key, "*" + likeMap.get(key) + "*");
queryBuilder.must(queryBuilder1);
}
}
Query query = new NativeSearchQueryBuilder()
.withQuery(queryBuilder)
.build();
query.setTrackTotalHits(true);
SearchHits search = elasticsearchTemplate.search(query, tClass);
if (search.hasSearchHits()) {
List<SearchHit<T>> searchHitList = search.getSearchHits();
List<T> list = searchHitList.stream().map(hit -> hit.getContent()).collect(Collectors.toList());
return list;
}
return new ArrayList<>();
}
/*
*分组求和
......
......@@ -9,7 +9,6 @@ import com.yeejoin.amos.boot.module.jxiop.api.mapper.*;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments;
import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.*;
import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -66,8 +65,8 @@ public class MonitoringServiceImpl {
@Autowired
EmqKeeper emqKeeper;
@Autowired
InfluxdbUtil influxdbUtil;
// @Autowired
// InfluxdbUtil influxdbUtil;
/**
......@@ -88,236 +87,236 @@ public class MonitoringServiceImpl {
* @param provinceName
* @return
*/
public List<RegionNationWideDto> getNationWideInfo(String provinceName, String type) {
List<RegionNationWideDto> regionNationWideDtoList = new ArrayList<>();
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
List<Region> regionList = this.regionMapper.selectList(new QueryWrapper<Region>().eq("level", 1));
List<StationBasic> list = new ArrayList<>();
//如果 provinceName 为空则表示当前为全国地图 否则则为省份地图
// if (ObjectUtils.isEmpty(provinceName) || provinceName.equals("")) {
if ((!ObjectUtils.isEmpty(type) && type.equals("gis")) && (ObjectUtils.isEmpty(provinceName) || provinceName.equals(""))) {
for (int i = 0; i < regionList.size(); i++) {
RegionNationWideDto regionNationWideDto = new RegionNationWideDto();
AtomicReference<Double> guangfuMW = new AtomicReference<>(0.0);
AtomicReference<Double> fengdianMW = new AtomicReference<>(0.0);
AtomicReference<Integer> guangfu = new AtomicReference<>(0);
AtomicReference<Integer> fengdian = new AtomicReference<>(0);
Region region = regionList.get(i);
list = stationBasicList.stream().filter(stationBasic -> stationBasic.getBelongArea().contains(String.valueOf(region.getRegionCode()))).collect(Collectors.toList());
list.forEach(stationBasic -> {
if (!ObjectUtils.isEmpty(stationBasic.getFanGatewayId()) && !ObjectUtils.isEmpty(stationBasic.getStationNumber())) {
regionNationWideDto.setJsJoin(true);
}
if (stationBasic.getStationType().equals("FDZ")) {
fengdianMW.set(getStationCaPACITYL(stationBasic.getStationNumber()));
fengdian.getAndSet(fengdian.get() + 1);
} else {
guangfuMW.set(getStationCaPACITYL(stationBasic.getStationNumber()));
guangfu.getAndSet(guangfu.get() + 1);
}
});
regionNationWideDto.setFengdian(fengdian.toString());
regionNationWideDto.setGuangfu(guangfu.toString());
regionNationWideDto.setGuangfuMW("0");
regionNationWideDto.setFengdianMV("0");
if (!ObjectUtils.isEmpty(guangfuMW.get())) {
regionNationWideDto.setGuangfuMW(String.format("%.2f", guangfuMW.get()));
}
if (!ObjectUtils.isEmpty(fengdianMW.get())) {
regionNationWideDto.setFengdianMV(String.format("%.2f", fengdianMW.get()));
}
regionNationWideDto.setName(region.getRegionName());
regionNationWideDtoList.add(regionNationWideDto);
}
} else {
if (!ObjectUtils.isEmpty(provinceName) && provinceName.contains("%")) {
try {
provinceName = URLDecoder.decode(provinceName, "UTF-8");
} catch (Exception e) {
}
}
String finalProvinceName = provinceName;
if (!ObjectUtils.isEmpty(type) && type.equals("station")) {
list = stationBasicList;
} else {
Region region = regionList.stream().filter(region1 -> region1.getRegionName().equals(finalProvinceName)).collect(Collectors.toList()).get(0);
list = stationBasicList.stream().filter(stationBasic -> stationBasic.getBelongArea().contains(String.valueOf(region.getRegionCode())) && stationBasic.getFanGatewayId() != null).collect(Collectors.toList());
}
List<StationCoordinate> stationCoordinateList = stationCoordinateMapper.selectList(new QueryWrapper<StationCoordinate>().isNotNull("station_id").eq("is_main_coordinate", 0));
for (int i = 0; i < list.size(); i++) {
HashMap<String, Double> hashMap = new HashMap<>();
StationBasic stationBasic = list.get(i);
RegionNationWideDto regionNationWideDto = new RegionNationWideDto();
regionNationWideDto.setStaitionId(String.valueOf(stationBasic.getSequenceNbr()));
regionNationWideDto.setStaitionName(stationBasic.getStationName());
regionNationWideDto.setStaitionType(stationBasic.getStationType());
String speendOrirradiate = "";
regionNationWideDto.setStationCapacity(String.valueOf(getStationCaPACITYL(stationBasic.getStationNumber())));
if (stationBasic.getStationType().equals("FDZ")) {
speendOrirradiate = String.valueOf(commonServiceImpl.getAvgvalueByIndicatior(stationBasic.getFanGatewayId(), "30秒平均风速"));
} else {
speendOrirradiate = String.valueOf(commonServiceImpl.getTotalByIndicatior(stationBasic.getBoosterGatewayId(), "WTX-801_25_WTX-801_总辐射"));
}
regionNationWideDto.setSpeendOrirradiate(speendOrirradiate);
StationCoordinate stationCoordinate = stationCoordinateList.stream().filter(stationCoordinate1 -> stationCoordinate1.getStationId().equals(stationBasic.getSequenceNbr())).collect(Collectors.toList()).get(0);
hashMap.put("lng", Double.valueOf(stationCoordinate.getLongitude()));
hashMap.put("lat", Double.valueOf(stationCoordinate.getLaitude()));
regionNationWideDto.setPosition(hashMap);
regionNationWideDtoList.add(regionNationWideDto);
}
}
List<StationBasic> finalList = list;
String finalProvinceName1 = provinceName;
Thread thread = new Thread(() -> {
getCompletionOfPowerIndicatorsByCurrentData(finalList, finalProvinceName1);
});
thread.start();
return regionNationWideDtoList;
}
public ResultsData getCompletionOfPowerIndicatorsByProvinceName(int current, int size, String provinceName) {
List<ColModel> colModels = new ArrayList<>();
List<CompletionOfPowerIndicatorsDto> completionOfPowerIndicatorsDtoList = new ArrayList<>();
ColModel colModelStatitonName = new ColModel("stationName", "stationName", "场站", "场站", "dataGrid", "stationName");
ColModel colModelInstallCapactity = new ColModel("installCapactity", "installCapactity", "装机容量", "装机容量", "dataGrid", "installCapactity");
ColModel colModelWindSpeedOrIrradiance = new ColModel("windSpeedOrIrradiance", "windSpeedOrIrradiance", "风速/辐照度", "风速/辐照度", "dataGrid", "windSpeedOrIrradiance");
ColModel colModelActivePower = new ColModel("activePower", "activePower", "有功", "有功", "dataGrid", "activePower");
ColModel colModelDailyPower = new ColModel("dailyPower", "dailyPower", "日发电量", "日发电量", "dataGrid", "dailyPower");
ColModel colModelMonthlyPower = new ColModel("monthlyPower", "monthlyPower", "月发电量", "月发电量", "dataGrid", "monthlyPower");
ColModel colModelAnnualPower = new ColModel("annualPower", "annualPower", "年发电量", "年发电量", "dataGrid", "annualPower");
colModels.add(colModelStatitonName);
colModels.add(colModelInstallCapactity);
colModels.add(colModelWindSpeedOrIrradiance);
colModels.add(colModelActivePower);
colModels.add(colModelDailyPower);
colModels.add(colModelMonthlyPower);
colModels.add(colModelAnnualPower);
Region region = this.regionMapper.selectOne(new QueryWrapper<Region>().eq("level", 1).eq("region_name", provinceName));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
//遍历列表
stationBasicList.forEach(stationBasic -> {
CompletionOfPowerIndicatorsDto completionOfPowerIndicatorsDto = new CompletionOfPowerIndicatorsDto();
completionOfPowerIndicatorsDto.setStationName(stationBasic.getStationName());
completionOfPowerIndicatorsDto.setInstallCapactity("0");
if (getStationCaPACITYL(stationBasic.getStationNumber()) != null) {
completionOfPowerIndicatorsDto.setInstallCapactity(String.format("%.2f", getStationCaPACITYL(stationBasic.getStationNumber())));
}
try {
List<Map<String, Object>> mapList;
List<Map<String, Object>> mapList1;
if (stationBasic.getStationType().equals("FDZ")) {
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' or equipmentIndexName='有功功率' or equipmentIndexName='30秒平均风速' )");
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.valueOf(commonServiceImpl.getAvgvalueByIndicatior(mapList, "30秒平均风速")));
completionOfPowerIndicatorsDto.setActivePower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "有功功率")));
completionOfPowerIndicatorsDto.setDailyPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "日发电量")));
completionOfPowerIndicatorsDto.setMonthlyPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "月发电量")));
completionOfPowerIndicatorsDto.setAnnualPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "年发电量")));
} else {
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and(equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' or equipmentIndexName='有功功率')");
mapList1 = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getBoosterGatewayId() + " where equipmentIndexName='WTX-801_25_WTX-801_总辐射'");
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList1, "WTX-801_25_WTX-801_总辐射")));
completionOfPowerIndicatorsDto.setActivePower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "有功功率")));
completionOfPowerIndicatorsDto.setDailyPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "日发电量")));
completionOfPowerIndicatorsDto.setMonthlyPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "月发电量")));
completionOfPowerIndicatorsDto.setAnnualPower(String.format("%.2f", new BigDecimal(commonServiceImpl.getTotalByIndicatior(mapList, "年发电量"))));
}
// public List<RegionNationWideDto> getNationWideInfo(String provinceName, String type) {
// List<RegionNationWideDto> regionNationWideDtoList = new ArrayList<>();
// List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
// List<Region> regionList = this.regionMapper.selectList(new QueryWrapper<Region>().eq("level", 1));
// List<StationBasic> list = new ArrayList<>();
// //如果 provinceName 为空则表示当前为全国地图 否则则为省份地图
//// if (ObjectUtils.isEmpty(provinceName) || provinceName.equals("")) {
// if ((!ObjectUtils.isEmpty(type) && type.equals("gis")) && (ObjectUtils.isEmpty(provinceName) || provinceName.equals(""))) {
// for (int i = 0; i < regionList.size(); i++) {
// RegionNationWideDto regionNationWideDto = new RegionNationWideDto();
// AtomicReference<Double> guangfuMW = new AtomicReference<>(0.0);
// AtomicReference<Double> fengdianMW = new AtomicReference<>(0.0);
// AtomicReference<Integer> guangfu = new AtomicReference<>(0);
// AtomicReference<Integer> fengdian = new AtomicReference<>(0);
// Region region = regionList.get(i);
// list = stationBasicList.stream().filter(stationBasic -> stationBasic.getBelongArea().contains(String.valueOf(region.getRegionCode()))).collect(Collectors.toList());
// list.forEach(stationBasic -> {
// if (!ObjectUtils.isEmpty(stationBasic.getFanGatewayId()) && !ObjectUtils.isEmpty(stationBasic.getStationNumber())) {
// regionNationWideDto.setJsJoin(true);
// }
// if (stationBasic.getStationType().equals("FDZ")) {
// fengdianMW.set(getStationCaPACITYL(stationBasic.getStationNumber()));
// fengdian.getAndSet(fengdian.get() + 1);
// } else {
// guangfuMW.set(getStationCaPACITYL(stationBasic.getStationNumber()));
// guangfu.getAndSet(guangfu.get() + 1);
// }
// });
// regionNationWideDto.setFengdian(fengdian.toString());
// regionNationWideDto.setGuangfu(guangfu.toString());
// regionNationWideDto.setGuangfuMW("0");
// regionNationWideDto.setFengdianMV("0");
// if (!ObjectUtils.isEmpty(guangfuMW.get())) {
// regionNationWideDto.setGuangfuMW(String.format("%.2f", guangfuMW.get()));
// }
// if (!ObjectUtils.isEmpty(fengdianMW.get())) {
// regionNationWideDto.setFengdianMV(String.format("%.2f", fengdianMW.get()));
// }
// regionNationWideDto.setName(region.getRegionName());
// regionNationWideDtoList.add(regionNationWideDto);
// }
// } else {
// if (!ObjectUtils.isEmpty(provinceName) && provinceName.contains("%")) {
// try {
// provinceName = URLDecoder.decode(provinceName, "UTF-8");
// } catch (Exception e) {
//
// }
// }
// String finalProvinceName = provinceName;
// if (!ObjectUtils.isEmpty(type) && type.equals("station")) {
// list = stationBasicList;
// } else {
// Region region = regionList.stream().filter(region1 -> region1.getRegionName().equals(finalProvinceName)).collect(Collectors.toList()).get(0);
// list = stationBasicList.stream().filter(stationBasic -> stationBasic.getBelongArea().contains(String.valueOf(region.getRegionCode())) && stationBasic.getFanGatewayId() != null).collect(Collectors.toList());
// }
// List<StationCoordinate> stationCoordinateList = stationCoordinateMapper.selectList(new QueryWrapper<StationCoordinate>().isNotNull("station_id").eq("is_main_coordinate", 0));
// for (int i = 0; i < list.size(); i++) {
// HashMap<String, Double> hashMap = new HashMap<>();
// StationBasic stationBasic = list.get(i);
// RegionNationWideDto regionNationWideDto = new RegionNationWideDto();
// regionNationWideDto.setStaitionId(String.valueOf(stationBasic.getSequenceNbr()));
// regionNationWideDto.setStaitionName(stationBasic.getStationName());
// regionNationWideDto.setStaitionType(stationBasic.getStationType());
// String speendOrirradiate = "";
// regionNationWideDto.setStationCapacity(String.valueOf(getStationCaPACITYL(stationBasic.getStationNumber())));
// if (stationBasic.getStationType().equals("FDZ")) {
// speendOrirradiate = String.valueOf(commonServiceImpl.getAvgvalueByIndicatior(stationBasic.getFanGatewayId(), "30秒平均风速"));
// } else {
// speendOrirradiate = String.valueOf(commonServiceImpl.getTotalByIndicatior(stationBasic.getBoosterGatewayId(), "WTX-801_25_WTX-801_总辐射"));
// }
// regionNationWideDto.setSpeendOrirradiate(speendOrirradiate);
// StationCoordinate stationCoordinate = stationCoordinateList.stream().filter(stationCoordinate1 -> stationCoordinate1.getStationId().equals(stationBasic.getSequenceNbr())).collect(Collectors.toList()).get(0);
// hashMap.put("lng", Double.valueOf(stationCoordinate.getLongitude()));
// hashMap.put("lat", Double.valueOf(stationCoordinate.getLaitude()));
// regionNationWideDto.setPosition(hashMap);
// regionNationWideDtoList.add(regionNationWideDto);
// }
// }
// List<StationBasic> finalList = list;
// String finalProvinceName1 = provinceName;
// Thread thread = new Thread(() -> {
// getCompletionOfPowerIndicatorsByCurrentData(finalList, finalProvinceName1);
// });
// thread.start();
// return regionNationWideDtoList;
// }
} catch (Exception exception) {
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance("0");
completionOfPowerIndicatorsDto.setActivePower("0");
completionOfPowerIndicatorsDto.setDailyPower("0");
completionOfPowerIndicatorsDto.setMonthlyPower("0");
completionOfPowerIndicatorsDto.setAnnualPower("0");
}
completionOfPowerIndicatorsDtoList.add(completionOfPowerIndicatorsDto);
});
Integer allsize = completionOfPowerIndicatorsDtoList.size();
DataGridMock dataGridMock = new DataGridMock(current, allsize, false, allsize / size + 1, completionOfPowerIndicatorsDtoList);
ResultsData resultsData = new ResultsData(dataGridMock, colModels);
return resultsData;
}
// public ResultsData getCompletionOfPowerIndicatorsByProvinceName(int current, int size, String provinceName) {
//
// List<ColModel> colModels = new ArrayList<>();
// List<CompletionOfPowerIndicatorsDto> completionOfPowerIndicatorsDtoList = new ArrayList<>();
// ColModel colModelStatitonName = new ColModel("stationName", "stationName", "场站", "场站", "dataGrid", "stationName");
// ColModel colModelInstallCapactity = new ColModel("installCapactity", "installCapactity", "装机容量", "装机容量", "dataGrid", "installCapactity");
// ColModel colModelWindSpeedOrIrradiance = new ColModel("windSpeedOrIrradiance", "windSpeedOrIrradiance", "风速/辐照度", "风速/辐照度", "dataGrid", "windSpeedOrIrradiance");
// ColModel colModelActivePower = new ColModel("activePower", "activePower", "有功", "有功", "dataGrid", "activePower");
// ColModel colModelDailyPower = new ColModel("dailyPower", "dailyPower", "日发电量", "日发电量", "dataGrid", "dailyPower");
// ColModel colModelMonthlyPower = new ColModel("monthlyPower", "monthlyPower", "月发电量", "月发电量", "dataGrid", "monthlyPower");
// ColModel colModelAnnualPower = new ColModel("annualPower", "annualPower", "年发电量", "年发电量", "dataGrid", "annualPower");
// colModels.add(colModelStatitonName);
// colModels.add(colModelInstallCapactity);
// colModels.add(colModelWindSpeedOrIrradiance);
// colModels.add(colModelActivePower);
// colModels.add(colModelDailyPower);
// colModels.add(colModelMonthlyPower);
// colModels.add(colModelAnnualPower);
// Region region = this.regionMapper.selectOne(new QueryWrapper<Region>().eq("level", 1).eq("region_name", provinceName));
// List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
// //遍历列表
// stationBasicList.forEach(stationBasic -> {
// CompletionOfPowerIndicatorsDto completionOfPowerIndicatorsDto = new CompletionOfPowerIndicatorsDto();
// completionOfPowerIndicatorsDto.setStationName(stationBasic.getStationName());
// completionOfPowerIndicatorsDto.setInstallCapactity("0");
// if (getStationCaPACITYL(stationBasic.getStationNumber()) != null) {
// completionOfPowerIndicatorsDto.setInstallCapactity(String.format("%.2f", getStationCaPACITYL(stationBasic.getStationNumber())));
// }
//
// try {
// List<Map<String, Object>> mapList;
// List<Map<String, Object>> mapList1;
// if (stationBasic.getStationType().equals("FDZ")) {
// mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' or equipmentIndexName='有功功率' or equipmentIndexName='30秒平均风速' )");
// completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.valueOf(commonServiceImpl.getAvgvalueByIndicatior(mapList, "30秒平均风速")));
// completionOfPowerIndicatorsDto.setActivePower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "有功功率")));
// completionOfPowerIndicatorsDto.setDailyPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "日发电量")));
// completionOfPowerIndicatorsDto.setMonthlyPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "月发电量")));
// completionOfPowerIndicatorsDto.setAnnualPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "年发电量")));
// } else {
// mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and(equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' or equipmentIndexName='有功功率')");
// mapList1 = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getBoosterGatewayId() + " where equipmentIndexName='WTX-801_25_WTX-801_总辐射'");
// completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList1, "WTX-801_25_WTX-801_总辐射")));
// completionOfPowerIndicatorsDto.setActivePower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "有功功率")));
// completionOfPowerIndicatorsDto.setDailyPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "日发电量")));
// completionOfPowerIndicatorsDto.setMonthlyPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "月发电量")));
// completionOfPowerIndicatorsDto.setAnnualPower(String.format("%.2f", new BigDecimal(commonServiceImpl.getTotalByIndicatior(mapList, "年发电量"))));
// }
//
//
// } catch (Exception exception) {
// completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance("0");
// completionOfPowerIndicatorsDto.setActivePower("0");
// completionOfPowerIndicatorsDto.setDailyPower("0");
// completionOfPowerIndicatorsDto.setMonthlyPower("0");
// completionOfPowerIndicatorsDto.setAnnualPower("0");
// }
// completionOfPowerIndicatorsDtoList.add(completionOfPowerIndicatorsDto);
// });
// Integer allsize = completionOfPowerIndicatorsDtoList.size();
// DataGridMock dataGridMock = new DataGridMock(current, allsize, false, allsize / size + 1, completionOfPowerIndicatorsDtoList);
// ResultsData resultsData = new ResultsData(dataGridMock, colModels);
// return resultsData;
// }
public void getCompletionOfPowerIndicatorsByCurrentData(List<StationBasic> stationBasicList, String provinceName) {
String provinceNameTopic = "";
if (provinceName.contains("黑龙江") || provinceName.contains("内蒙古")) {
provinceNameTopic = provinceName.substring(0, 3);
} else {
provinceNameTopic = provinceName.substring(0, 2);
}
HashMap<String, String> stringHashMap = new HashMap<>();
stringHashMap.put("title", provinceNameTopic + "区域");
try {
emqKeeper.getMqttClient().publish("proviceName_topic", JSON.toJSON(stringHashMap).toString().getBytes("UTF-8"), 1, true);
logger.info("----------------------------------推送省份名称消息成功败--------------------------------");
} catch (Exception e) {
logger.info("----------------------------------推送省份名称消息失败--------------------------------");
}
Page<SocialContributionDto> socialContributionDtoPage = new Page<SocialContributionDto>();
logger.error("--------------------------区域实时数据消息开始发送----------------------------------------------");
List<SocialContributionDto> socialContributionDtoList = new ArrayList<>();
//日发电量
AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
//月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
//年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
//年发电量完成比例
String completionRatio = "0.00";
//年利用小时数
AtomicReference<Double> useHours = new AtomicReference<>(0.0);
AtomicReference<Double> installCapacity = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> {
List<Map<String, Object>> mapList = new ArrayList<>();
if (stationBasic.getStationType().equals("FDZ")) {
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
} else {
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
}
List<Map<String, Object>> finalMapList = mapList;
dailyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "日发电量"));
monthlyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "月发电量"));
annualPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "年发电量"));
installCapacity.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber()));
});
SocialContributionDto dailyPowerdto = new SocialContributionDto();
dailyPowerdto.setTitle(String.format("%.2f", dailyPower.get()));
dailyPowerdto.setUnit("万kWh");
SocialContributionDto monthlyPowerdto = new SocialContributionDto();
monthlyPowerdto.setTitle(String.format("%.2f", monthlyPower.get()));
monthlyPowerdto.setUnit("万kWh");
SocialContributionDto annualPowerdto = new SocialContributionDto();
annualPowerdto.setTitle(String.format("%.2f", annualPower.get()));
annualPowerdto.setUnit("万kWh");
SocialContributionDto completionRatioDto = new SocialContributionDto();
if (stationBasicList.size() > 0) {
completionRatioDto.setTitle(String.format("%.2f", 23.21 + Math.random() * 10));
} else {
completionRatioDto.setTitle(completionRatio);
}
completionRatioDto.setUnit("%");
SocialContributionDto useHoursDto = new SocialContributionDto();
useHoursDto.setTitle(String.format("%.2f", annualPower.get() / installCapacity.get()));
useHoursDto.setUnit("h");
socialContributionDtoList.add(dailyPowerdto);
socialContributionDtoList.add(monthlyPowerdto);
socialContributionDtoList.add(annualPowerdto);
socialContributionDtoList.add(completionRatioDto);
socialContributionDtoList.add(useHoursDto);
socialContributionDtoPage.setRecords(socialContributionDtoList);
socialContributionDtoPage.setTotal(100);
socialContributionDtoPage.setCurrent(1);
try {
// emqKeeper.getMqttClient().publish("completionofpowerindicator_topic", JSON.toJSON(socialContributionDtoPage).toString().getBytes("UTF-8"), 1, true);
logger.info("-----------------发送区域实时生产数据消息=================== 成功!" + JSON.toJSONString(socialContributionDtoPage));
} catch (Exception exception) {
logger.error("-----------------发送区域实时生产数据消息=================== 失败!");
}
}
// public void getCompletionOfPowerIndicatorsByCurrentData(List<StationBasic> stationBasicList, String provinceName) {
// String provinceNameTopic = "";
// if (provinceName.contains("黑龙江") || provinceName.contains("内蒙古")) {
// provinceNameTopic = provinceName.substring(0, 3);
// } else {
// provinceNameTopic = provinceName.substring(0, 2);
// }
// HashMap<String, String> stringHashMap = new HashMap<>();
// stringHashMap.put("title", provinceNameTopic + "区域");
// try {
// emqKeeper.getMqttClient().publish("proviceName_topic", JSON.toJSON(stringHashMap).toString().getBytes("UTF-8"), 1, true);
// logger.info("----------------------------------推送省份名称消息成功败--------------------------------");
// } catch (Exception e) {
// logger.info("----------------------------------推送省份名称消息失败--------------------------------");
// }
// Page<SocialContributionDto> socialContributionDtoPage = new Page<SocialContributionDto>();
// logger.error("--------------------------区域实时数据消息开始发送----------------------------------------------");
// List<SocialContributionDto> socialContributionDtoList = new ArrayList<>();
// //日发电量
// AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
// //月发电量
// AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
// //年发电量
// AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
// //年发电量完成比例
// String completionRatio = "0.00";
// //年利用小时数
// AtomicReference<Double> useHours = new AtomicReference<>(0.0);
// AtomicReference<Double> installCapacity = new AtomicReference<>(0.0);
// stationBasicList.forEach(stationBasic -> {
// List<Map<String, Object>> mapList = new ArrayList<>();
// if (stationBasic.getStationType().equals("FDZ")) {
// mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
// } else {
// mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
// }
// List<Map<String, Object>> finalMapList = mapList;
// dailyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "日发电量"));
// monthlyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "月发电量"));
// annualPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "年发电量"));
// installCapacity.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber()));
// });
// SocialContributionDto dailyPowerdto = new SocialContributionDto();
// dailyPowerdto.setTitle(String.format("%.2f", dailyPower.get()));
// dailyPowerdto.setUnit("万kWh");
// SocialContributionDto monthlyPowerdto = new SocialContributionDto();
// monthlyPowerdto.setTitle(String.format("%.2f", monthlyPower.get()));
// monthlyPowerdto.setUnit("万kWh");
// SocialContributionDto annualPowerdto = new SocialContributionDto();
// annualPowerdto.setTitle(String.format("%.2f", annualPower.get()));
// annualPowerdto.setUnit("万kWh");
// SocialContributionDto completionRatioDto = new SocialContributionDto();
// if (stationBasicList.size() > 0) {
// completionRatioDto.setTitle(String.format("%.2f", 23.21 + Math.random() * 10));
// } else {
// completionRatioDto.setTitle(completionRatio);
// }
// completionRatioDto.setUnit("%");
// SocialContributionDto useHoursDto = new SocialContributionDto();
// useHoursDto.setTitle(String.format("%.2f", annualPower.get() / installCapacity.get()));
// useHoursDto.setUnit("h");
// socialContributionDtoList.add(dailyPowerdto);
// socialContributionDtoList.add(monthlyPowerdto);
// socialContributionDtoList.add(annualPowerdto);
// socialContributionDtoList.add(completionRatioDto);
// socialContributionDtoList.add(useHoursDto);
// socialContributionDtoPage.setRecords(socialContributionDtoList);
// socialContributionDtoPage.setTotal(100);
// socialContributionDtoPage.setCurrent(1);
// try {
//// emqKeeper.getMqttClient().publish("completionofpowerindicator_topic", JSON.toJSON(socialContributionDtoPage).toString().getBytes("UTF-8"), 1, true);
// logger.info("-----------------发送区域实时生产数据消息=================== 成功!" + JSON.toJSONString(socialContributionDtoPage));
// } catch (Exception exception) {
// logger.error("-----------------发送区域实时生产数据消息=================== 失败!");
// }
// }
public List<TabDto> getTabsByStationBasicId(String stationBasicId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationBasicId);
......@@ -396,48 +395,48 @@ public class MonitoringServiceImpl {
return mapAreaInfoDtoList;
}
public List<HomeMapStationInfoDto> getStaitonListInfoByAreaName(String areaName) {
List<HomeMapStationInfoDto> homeMapStationInfoDtoList = new ArrayList<>();
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1));
//根据areaName获取area信息
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("name", areaName));
//获取片区下的省份名称
ArrayList<String> stringArrayList = mapRegion.getProvince();
List<Region> regions = regionList.stream().filter(region -> stringArrayList.contains(region.getRegionName().substring(0, 2)) || stringArrayList.contains(region.getRegionName().substring(0, 3))).collect(Collectors.toList());
List<String> regionCodes = regions.stream().map(region -> String.valueOf(region.getRegionCode())).collect(Collectors.toList());
List<StationBasic> stationBasicListAll = stationBasicList.stream().filter(stationBasic -> regionCodes.contains(stationBasic.getBelongArea().replace("[", "").replace("]", "").split(",")[0])).collect(Collectors.toList());
List<StationCoordinate> stationCoordinateList = stationCoordinateMapper.selectList(new QueryWrapper<StationCoordinate>().eq("is_main_coordinate", 0));
if (!stationBasicListAll.isEmpty()) {
stationBasicListAll.forEach(stationBasic -> {
HomeMapStationInfoDto homeMapStationInfoDto = new HomeMapStationInfoDto();
//设置场站id
homeMapStationInfoDto.setStationId(String.valueOf(stationBasic.getSequenceNbr()));
//设置场站类型
homeMapStationInfoDto.setStationType(stationBasic.getStationType());
//设置装机容量
homeMapStationInfoDto.setStationInstalledCapacity(String.format("%.2f", getStationCaPACITYL(stationBasic.getStationNumber())));
//设置风速辐照度
String speendOrirradiate = "";
if (stationBasic.getStationType().equals("FDZ")) {
speendOrirradiate = String.valueOf(commonServiceImpl.getAvgvalueByIndicatior(stationBasic.getFanGatewayId(), "30秒平均风速"));
homeMapStationInfoDto.setSpeendOrirradiate(speendOrirradiate);
} else {
homeMapStationInfoDto.setSpeendOrirradiate(String.valueOf(Math.random() * 100));
}
StationCoordinate stationCoordinate = stationCoordinateList.stream().filter(stationCoordinate1 -> stationCoordinate1.getStationId().equals(stationBasic.getSequenceNbr())).collect(Collectors.toList()).get(0);
//获取场站经纬度
List<String> list = new ArrayList<>();
list.add(stationCoordinate.getLongitude());
list.add(stationCoordinate.getLaitude());
homeMapStationInfoDto.setStationPosition(list);
//设置当前功率
homeMapStationInfoDto.setCurrentPower("0");
homeMapStationInfoDtoList.add(homeMapStationInfoDto);
});
}
return homeMapStationInfoDtoList;
}
// public List<HomeMapStationInfoDto> getStaitonListInfoByAreaName(String areaName) {
// List<HomeMapStationInfoDto> homeMapStationInfoDtoList = new ArrayList<>();
// List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
// List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1));
// //根据areaName获取area信息
// MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("name", areaName));
// //获取片区下的省份名称
// ArrayList<String> stringArrayList = mapRegion.getProvince();
// List<Region> regions = regionList.stream().filter(region -> stringArrayList.contains(region.getRegionName().substring(0, 2)) || stringArrayList.contains(region.getRegionName().substring(0, 3))).collect(Collectors.toList());
// List<String> regionCodes = regions.stream().map(region -> String.valueOf(region.getRegionCode())).collect(Collectors.toList());
// List<StationBasic> stationBasicListAll = stationBasicList.stream().filter(stationBasic -> regionCodes.contains(stationBasic.getBelongArea().replace("[", "").replace("]", "").split(",")[0])).collect(Collectors.toList());
// List<StationCoordinate> stationCoordinateList = stationCoordinateMapper.selectList(new QueryWrapper<StationCoordinate>().eq("is_main_coordinate", 0));
// if (!stationBasicListAll.isEmpty()) {
// stationBasicListAll.forEach(stationBasic -> {
// HomeMapStationInfoDto homeMapStationInfoDto = new HomeMapStationInfoDto();
// //设置场站id
// homeMapStationInfoDto.setStationId(String.valueOf(stationBasic.getSequenceNbr()));
// //设置场站类型
// homeMapStationInfoDto.setStationType(stationBasic.getStationType());
// //设置装机容量
// homeMapStationInfoDto.setStationInstalledCapacity(String.format("%.2f", getStationCaPACITYL(stationBasic.getStationNumber())));
// //设置风速辐照度
// String speendOrirradiate = "";
// if (stationBasic.getStationType().equals("FDZ")) {
// speendOrirradiate = String.valueOf(commonServiceImpl.getAvgvalueByIndicatior(stationBasic.getFanGatewayId(), "30秒平均风速"));
// homeMapStationInfoDto.setSpeendOrirradiate(speendOrirradiate);
// } else {
// homeMapStationInfoDto.setSpeendOrirradiate(String.valueOf(Math.random() * 100));
// }
// StationCoordinate stationCoordinate = stationCoordinateList.stream().filter(stationCoordinate1 -> stationCoordinate1.getStationId().equals(stationBasic.getSequenceNbr())).collect(Collectors.toList()).get(0);
// //获取场站经纬度
// List<String> list = new ArrayList<>();
// list.add(stationCoordinate.getLongitude());
// list.add(stationCoordinate.getLaitude());
// homeMapStationInfoDto.setStationPosition(list);
// //设置当前功率
// homeMapStationInfoDto.setCurrentPower("0");
// homeMapStationInfoDtoList.add(homeMapStationInfoDto);
// });
// }
// return homeMapStationInfoDtoList;
// }
public String getInstallCapity(List<StationBasic> stationBasicList) {
AtomicReference<Double> total = new AtomicReference<>(0.0);
......@@ -530,95 +529,95 @@ public class MonitoringServiceImpl {
* @return 社会贡献列表
* @deprecated 如果areaName 与 stationID 都不传 则查全国、如果areaName传了 staionID没有传则查片区 如果 areaName 与stationId都传 则取场站id
*/
public Page<SocialContributionDto> getSocialContributionDtoList(String areaName, String stationId) {
AtomicReference<Double> total = new AtomicReference<>(0.0);
List<StationBasic> stationBasicListAll = new ArrayList<>();
if (!ObjectUtils.isEmpty(stationId)) {
stationBasicListAll.add(stationBasicMapper.selectById(stationId));
} else if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
stationBasicListAll.forEach(stationBasic -> {
List<Map<String, Object>> mapListData = new ArrayList<>();
String finalIndicator = "年发电量";
if (stationBasic.getStationType().equals("FDZ")) {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='" + finalIndicator + "' )");
} else {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='" + finalIndicator + "' )");
}
Double total1 = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
total.updateAndGet(v -> v + total1);
});
return commonServiceImpl.getSocialContributionDtoList(total.get());
}
// public Page<SocialContributionDto> getSocialContributionDtoList(String areaName, String stationId) {
// AtomicReference<Double> total = new AtomicReference<>(0.0);
// List<StationBasic> stationBasicListAll = new ArrayList<>();
// if (!ObjectUtils.isEmpty(stationId)) {
// stationBasicListAll.add(stationBasicMapper.selectById(stationId));
// } else if (!ObjectUtils.isEmpty(areaName)) {
// stationBasicListAll = getListOfStationBasicByAreaName(areaName);
// } else {
// stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
// }
// stationBasicListAll.forEach(stationBasic -> {
// List<Map<String, Object>> mapListData = new ArrayList<>();
// String finalIndicator = "年发电量";
// if (stationBasic.getStationType().equals("FDZ")) {
// mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='" + finalIndicator + "' )");
// } else {
// mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='" + finalIndicator + "' )");
// }
// Double total1 = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
// total.updateAndGet(v -> v + total1);
// });
// return commonServiceImpl.getSocialContributionDtoList(total.get());
// }
public HashMap<String, List<String>> getPowerGenerationTrendsOfMonth(String areaName) {
List<StationBasic> stationBasicListAll = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
//月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
stationBasicListAll.forEach(stationBasic -> {
List<Map<String, Object>> mapListData = new ArrayList<>();
String finalIndicator = "月发电量";
if (stationBasic.getStationType().equals("FDZ")) {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='" + finalIndicator + "' )");
} else {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='" + finalIndicator + "' )");
}
Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
monthlyPower.updateAndGet(v -> v + total);
});
HashMap<String, List<String>> hashMap = new HashMap<>();
List<String> xList = getXListofRecentOneYear();
List<String> yList = Arrays.asList("0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "12000", String.format("%.2f", monthlyPower.get() / 1000));
hashMap.put("axisData", xList);
hashMap.put("seriesData", yList);
return hashMap;
}
// public HashMap<String, List<String>> getPowerGenerationTrendsOfMonth(String areaName) {
// List<StationBasic> stationBasicListAll = new ArrayList<>();
// if (!ObjectUtils.isEmpty(areaName)) {
// stationBasicListAll = getListOfStationBasicByAreaName(areaName);
// } else {
// stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
// }
// //月发电量
// AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
// stationBasicListAll.forEach(stationBasic -> {
// List<Map<String, Object>> mapListData = new ArrayList<>();
// String finalIndicator = "月发电量";
// if (stationBasic.getStationType().equals("FDZ")) {
// mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='" + finalIndicator + "' )");
// } else {
// mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='" + finalIndicator + "' )");
// }
// Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
// monthlyPower.updateAndGet(v -> v + total);
// });
// HashMap<String, List<String>> hashMap = new HashMap<>();
// List<String> xList = getXListofRecentOneYear();
// List<String> yList = Arrays.asList("0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "12000", String.format("%.2f", monthlyPower.get() / 1000));
// hashMap.put("axisData", xList);
// hashMap.put("seriesData", yList);
// return hashMap;
// }
public Page<HashMap<String, String>> getDetailsOnPowergeneration(String areaName) {
Page<HashMap<String, String>> hashMapPage = new Page<>(1, 99);
List<HashMap<String, String>> hashMapList = new ArrayList<>();
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().eq("station_type", "FDZ").isNotNull("fan_gateway_id"));
//日发电量
AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
//月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
//年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> {
List<Map<String, Object>> mapList = new ArrayList<>();
if (stationBasic.getStationType().equals("FDZ")) {
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
} else {
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
}
List<Map<String, Object>> finalMapList = mapList;
dailyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "日发电量"));
monthlyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "月发电量"));
annualPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "年发电量"));
});
HashMap<String, String> dayHashMap = new HashMap<>();
dayHashMap.put("title", String.format("%.2f", dailyPower.get()) + "KWh");
HashMap<String, String> monthHashMap = new HashMap<>();
monthHashMap.put("title", String.format("%.2f", monthlyPower.get()) + "KWh");
HashMap<String, String> annualHashMap = new HashMap<>();
annualHashMap.put("title", String.format("%.2f", annualPower.get()) + "KWh");
HashMap<String, String> totalHashMap = new HashMap<>();
totalHashMap.put("title", String.format("%.2f", annualPower.get()) + "KWh");
hashMapList.add(dayHashMap);
hashMapList.add(monthHashMap);
hashMapList.add(annualHashMap);
hashMapList.add(totalHashMap);
hashMapPage.setRecords(hashMapList);
return hashMapPage;
}
// public Page<HashMap<String, String>> getDetailsOnPowergeneration(String areaName) {
// Page<HashMap<String, String>> hashMapPage = new Page<>(1, 99);
// List<HashMap<String, String>> hashMapList = new ArrayList<>();
// List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().eq("station_type", "FDZ").isNotNull("fan_gateway_id"));
// //日发电量
// AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
// //月发电量
// AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
// //年发电量
// AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
// stationBasicList.forEach(stationBasic -> {
// List<Map<String, Object>> mapList = new ArrayList<>();
// if (stationBasic.getStationType().equals("FDZ")) {
// mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
// } else {
// mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
// }
// List<Map<String, Object>> finalMapList = mapList;
// dailyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "日发电量"));
// monthlyPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "月发电量"));
// annualPower.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(finalMapList, "年发电量"));
// });
// HashMap<String, String> dayHashMap = new HashMap<>();
// dayHashMap.put("title", String.format("%.2f", dailyPower.get()) + "KWh");
// HashMap<String, String> monthHashMap = new HashMap<>();
// monthHashMap.put("title", String.format("%.2f", monthlyPower.get()) + "KWh");
// HashMap<String, String> annualHashMap = new HashMap<>();
// annualHashMap.put("title", String.format("%.2f", annualPower.get()) + "KWh");
// HashMap<String, String> totalHashMap = new HashMap<>();
// totalHashMap.put("title", String.format("%.2f", annualPower.get()) + "KWh");
// hashMapList.add(dayHashMap);
// hashMapList.add(monthHashMap);
// hashMapList.add(annualHashMap);
// hashMapList.add(totalHashMap);
// hashMapPage.setRecords(hashMapList);
// return hashMapPage;
// }
public List<StationBasic> getListOfStationBasicByAreaName(String areaName) {
List<StationBasic> stationBasicListAll = new ArrayList<>();
......@@ -635,70 +634,70 @@ public class MonitoringServiceImpl {
}
public HashMap<String, List<String>> getPowerGenerationTrendsOfCompletionRate(String areaName) {
List<StationBasic> stationBasicListAll = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
//月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
stationBasicListAll.forEach(stationBasic -> {
List<Map<String, Object>> mapListData = new ArrayList<>();
String finalIndicator = "月发电量";
if (!stationBasic.getStationType().equals("FDZ")) {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='" + finalIndicator + "' )");
} else {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='" + finalIndicator + "' )");
}
Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
monthlyPower.updateAndGet(v -> v + total);
});
HashMap<String, List<String>> hashMap = new HashMap<>();
List<String> xList = getXListofRecentOneYear();
List<String> yList = Arrays.asList("0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "120", String.format("%.2f", monthlyPower.get() % 200));
hashMap.put("axisData", xList);
hashMap.put("seriesData", yList);
return hashMap;
}
// public HashMap<String, List<String>> getPowerGenerationTrendsOfCompletionRate(String areaName) {
// List<StationBasic> stationBasicListAll = new ArrayList<>();
// if (!ObjectUtils.isEmpty(areaName)) {
// stationBasicListAll = getListOfStationBasicByAreaName(areaName);
// } else {
// stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
// }
// //月发电量
// AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
// stationBasicListAll.forEach(stationBasic -> {
// List<Map<String, Object>> mapListData = new ArrayList<>();
// String finalIndicator = "月发电量";
// if (!stationBasic.getStationType().equals("FDZ")) {
// mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='" + finalIndicator + "' )");
// } else {
// mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='" + finalIndicator + "' )");
// }
// Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
// monthlyPower.updateAndGet(v -> v + total);
// });
// HashMap<String, List<String>> hashMap = new HashMap<>();
// List<String> xList = getXListofRecentOneYear();
// List<String> yList = Arrays.asList("0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "120", String.format("%.2f", monthlyPower.get() % 200));
// hashMap.put("axisData", xList);
// hashMap.put("seriesData", yList);
// return hashMap;
// }
public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopFive(String areaName) {
Page<HashMap<String, String>> hashMapPage = new Page<>(1, 5);
List<HashMap<String, String>> mapList = new ArrayList<>();
List<StationBasic> stationBasicListAll = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
HashMap<String, List<String>> hashMap = new HashMap<>();
List<String> xList = new ArrayList<>();
List<String> yList = new ArrayList<>();
//月发电量
String finalIndicator = "月发电量";
stationBasicListAll.forEach(stationBasic -> {
List<Map<String, Object>> mapListData = new ArrayList<>();
if (!stationBasic.getStationType().equals("FDZ")) {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='" + finalIndicator + "' )");
} else {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='" + finalIndicator + "' )");
}
Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
stationBasic.setAddress(String.format("%.2f", total % 100));
});
List<StationBasic> sorted = stationBasicListAll.stream().sorted(Comparator.comparing(StationBasic::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
sorted.forEach(stationBasic -> {
HashMap<String, String> hashMap1 = new HashMap<>();
hashMap1.put("stationName", stationBasic.getStationName());
hashMap1.put("value", stationBasic.getAddress());
hashMap1.put("value1", stationBasic.getAddress());
mapList.add(hashMap1);
});
hashMapPage.setRecords(mapList);
return hashMapPage;
}
// public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopFive(String areaName) {
// Page<HashMap<String, String>> hashMapPage = new Page<>(1, 5);
// List<HashMap<String, String>> mapList = new ArrayList<>();
// List<StationBasic> stationBasicListAll = new ArrayList<>();
// if (!ObjectUtils.isEmpty(areaName)) {
// stationBasicListAll = getListOfStationBasicByAreaName(areaName);
// } else {
// stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
// }
// HashMap<String, List<String>> hashMap = new HashMap<>();
// List<String> xList = new ArrayList<>();
// List<String> yList = new ArrayList<>();
// //月发电量
// String finalIndicator = "月发电量";
// stationBasicListAll.forEach(stationBasic -> {
// List<Map<String, Object>> mapListData = new ArrayList<>();
// if (!stationBasic.getStationType().equals("FDZ")) {
// mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='" + finalIndicator + "' )");
// } else {
// mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='" + finalIndicator + "' )");
// }
// Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
// stationBasic.setAddress(String.format("%.2f", total % 100));
// });
// List<StationBasic> sorted = stationBasicListAll.stream().sorted(Comparator.comparing(StationBasic::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
// sorted.forEach(stationBasic -> {
// HashMap<String, String> hashMap1 = new HashMap<>();
// hashMap1.put("stationName", stationBasic.getStationName());
// hashMap1.put("value", stationBasic.getAddress());
// hashMap1.put("value1", stationBasic.getAddress());
// mapList.add(hashMap1);
// });
// hashMapPage.setRecords(mapList);
// return hashMapPage;
// }
public List<String> getXListofRecentOneYear() {
......@@ -713,74 +712,74 @@ public class MonitoringServiceImpl {
return xList;
}
public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopThree(String tabValue, String areaName) {
Page<HashMap<String, String>> page = new Page<>(1, 3);
List<HashMap<String, String>> mapList = new ArrayList<>();
List<StationBasic> stationBasicListAll = new ArrayList<>();
List<StationBasic> fdzList = new ArrayList<>();
List<StationBasic> gfdzlist = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
String indicator = "日发电量";
if (tabValue.equals("1")) {
indicator = "月发电量";
} else if (tabValue.equals("2")) {
indicator = "年发电量";
}
//填写发电小时数
String finalIndicator = indicator;
stationBasicListAll.forEach(stationBasic -> {
Double install = getStationCaPACITYL(stationBasic.getStationNumber());
List<Map<String, Object>> mapListData = new ArrayList<>();
if (!stationBasic.getStationType().equals("FDZ")) {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='" + finalIndicator + "' )");
} else {
mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='" + finalIndicator + "' )");
}
Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
stationBasic.setAddress(String.format("%.2f", total));
if (stationBasic.getStationType().equals("FDZ")) {
stationBasic.setAddress(String.format("%.2f", (total * 10) / install));
} else {
stationBasic.setAddress(String.format("%.2f", total / 10000 / install));
}
if (stationBasic.getAddress().equals("NaN")) {
stationBasic.setAddress("0.00");
}
});
//分组并排序
fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList()).stream().sorted(Comparator.comparing(StationBasic::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
gfdzlist = stationBasicListAll.stream().filter(stationBasic -> !stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList()).stream().sorted(Comparator.comparing(StationBasic::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
for (int i = 0; i < 3; i++) {
HashMap<String, String> stringHashMap = new HashMap<>();
stringHashMap.put("sortNumber", String.valueOf(i + 1));
StationBasic stationBasic = new StationBasic();
if (i < (fdzList.size())) {
stationBasic = fdzList.get(i);
stringHashMap.put("stationName1", stationBasic.getStationName());
stringHashMap.put("hours1", stationBasic.getAddress() + "h");
} else {
stringHashMap.put("stationName1", "");
stringHashMap.put("hours1", "");
}
if (i < (gfdzlist.size())) {
stationBasic = gfdzlist.get(i);
stringHashMap.put("stationName2", stationBasic.getStationName());
stringHashMap.put("hours2", stationBasic.getAddress() + "h");
} else {
stringHashMap.put("stationName2", "");
stringHashMap.put("hours2", "");
}
mapList.add(stringHashMap);
}
page.setRecords(mapList);
//组装数据
return page;
}
//
// public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopThree(String tabValue, String areaName) {
// Page<HashMap<String, String>> page = new Page<>(1, 3);
// List<HashMap<String, String>> mapList = new ArrayList<>();
// List<StationBasic> stationBasicListAll = new ArrayList<>();
// List<StationBasic> fdzList = new ArrayList<>();
// List<StationBasic> gfdzlist = new ArrayList<>();
// if (!ObjectUtils.isEmpty(areaName)) {
// stationBasicListAll = getListOfStationBasicByAreaName(areaName);
// } else {
// stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
// }
// String indicator = "日发电量";
// if (tabValue.equals("1")) {
// indicator = "月发电量";
// } else if (tabValue.equals("2")) {
// indicator = "年发电量";
// }
// //填写发电小时数
// String finalIndicator = indicator;
// stationBasicListAll.forEach(stationBasic -> {
// Double install = getStationCaPACITYL(stationBasic.getStationNumber());
// List<Map<String, Object>> mapListData = new ArrayList<>();
// if (!stationBasic.getStationType().equals("FDZ")) {
// mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='" + finalIndicator + "' )");
// } else {
// mapListData = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='" + finalIndicator + "' )");
// }
// Double total = commonServiceImpl.getTotalByIndicatior(mapListData, finalIndicator);
// stationBasic.setAddress(String.format("%.2f", total));
// if (stationBasic.getStationType().equals("FDZ")) {
// stationBasic.setAddress(String.format("%.2f", (total * 10) / install));
// } else {
// stationBasic.setAddress(String.format("%.2f", total / 10000 / install));
// }
// if (stationBasic.getAddress().equals("NaN")) {
// stationBasic.setAddress("0.00");
// }
// });
// //分组并排序
// fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList()).stream().sorted(Comparator.comparing(StationBasic::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
// gfdzlist = stationBasicListAll.stream().filter(stationBasic -> !stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList()).stream().sorted(Comparator.comparing(StationBasic::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
// for (int i = 0; i < 3; i++) {
// HashMap<String, String> stringHashMap = new HashMap<>();
// stringHashMap.put("sortNumber", String.valueOf(i + 1));
// StationBasic stationBasic = new StationBasic();
// if (i < (fdzList.size())) {
// stationBasic = fdzList.get(i);
// stringHashMap.put("stationName1", stationBasic.getStationName());
// stringHashMap.put("hours1", stationBasic.getAddress() + "h");
// } else {
// stringHashMap.put("stationName1", "");
// stringHashMap.put("hours1", "");
// }
// if (i < (gfdzlist.size())) {
// stationBasic = gfdzlist.get(i);
// stringHashMap.put("stationName2", stationBasic.getStationName());
// stringHashMap.put("hours2", stationBasic.getAddress() + "h");
// } else {
// stringHashMap.put("stationName2", "");
// stringHashMap.put("hours2", "");
// }
// mapList.add(stringHashMap);
// }
// page.setRecords(mapList);
// //组装数据
// return page;
// }
@Scheduled(cron = "0/5 * * * * *")
public void getTotalData() {
......@@ -945,27 +944,27 @@ public class MonitoringServiceImpl {
}
}
public List<HashMap<String, Object>> getNationalPowerGenerationData() {
List<HashMap<String, Object>> resultHashMap = new ArrayList<>();
List<StationBasic> stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
stationBasicListAll.forEach(stationBasic -> {
List<Map<String, Object>> mapList;
if (stationBasic.getStationType().equals("FDZ")) {
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
stationBasic.setAddress(String.format("%.2f", commonServiceImpl.getTotalByIndicatior(mapList, "年发电量")));
} else {
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
stationBasic.setAddress(String.format("%.2f", commonServiceImpl.getTotalByIndicatior(mapList, "年发电量") / 10000));
}
});
List<StationBasic> fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationBasic> jzsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).collect(Collectors.toList());
List<StationBasic> fbsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).collect(Collectors.toList());
resultHashMap.add(getTableByStationListAndTitle("风电年发电量 (万kWh)", fdzList, "#0060ff"));
resultHashMap.add(getTableByStationListAndTitle("分布式光伏年发电量 (万kWh)", fbsgfdzList, "#fdaa04"));
resultHashMap.add(getTableByStationListAndTitle("集中式光伏年发电量 (万kWh)", jzsgfdzList, "#ec18f7"));
return resultHashMap;
}
// public List<HashMap<String, Object>> getNationalPowerGenerationData() {
// List<HashMap<String, Object>> resultHashMap = new ArrayList<>();
// List<StationBasic> stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
// stationBasicListAll.forEach(stationBasic -> {
// List<Map<String, Object>> mapList;
// if (stationBasic.getStationType().equals("FDZ")) {
// mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
// stationBasic.setAddress(String.format("%.2f", commonServiceImpl.getTotalByIndicatior(mapList, "年发电量")));
// } else {
// mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
// stationBasic.setAddress(String.format("%.2f", commonServiceImpl.getTotalByIndicatior(mapList, "年发电量") / 10000));
// }
// });
// List<StationBasic> fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
// List<StationBasic> jzsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).collect(Collectors.toList());
// List<StationBasic> fbsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).collect(Collectors.toList());
// resultHashMap.add(getTableByStationListAndTitle("风电年发电量 (万kWh)", fdzList, "#0060ff"));
// resultHashMap.add(getTableByStationListAndTitle("分布式光伏年发电量 (万kWh)", fbsgfdzList, "#fdaa04"));
// resultHashMap.add(getTableByStationListAndTitle("集中式光伏年发电量 (万kWh)", jzsgfdzList, "#ec18f7"));
// return resultHashMap;
// }
public HashMap<String, Object> getTableByStationListAndTitle(String title, List<StationBasic> stationBasicList, String color) {
HashMap<String, Object> hashMap = new HashMap<>();
......
......@@ -12,7 +12,6 @@ import com.yeejoin.amos.boot.module.jxiop.biz.repository.ESDailyPowerGenerationR
import com.yeejoin.amos.boot.module.jxiop.biz.repository.ESMoonPowerGenerationRepository;
import com.yeejoin.amos.boot.module.jxiop.biz.repository.ESYearPowerGenerationRepository;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
......@@ -32,8 +31,8 @@ import java.util.List;
@Service
public class PowerGenerationImpl {
@Autowired
InfluxDButils influxDButils;
// @Autowired
// InfluxDButils influxDButils;
@Autowired
private ElasticsearchRestTemplate elasticsearchTemplate;
@Autowired
......@@ -45,28 +44,28 @@ public class PowerGenerationImpl {
@Autowired(required=true)
IndicatorDataMapper indicatorDataMapper;
//获取指定指标,当天最后一条数据
public List<IndexDto> getlast(String gatewayId, String value,String daty){
IndexDto indexDto=null;
String querySql = " SELECT * FROM iot_data_%s WHERE equipmentIndexName='%s' and time >='%sT00:55:00Z' AND time < '%sT23:59:59Z' group by equipmentsIdx order by time desc LIMIT 1";
querySql = String.format(querySql, gatewayId, value,daty,daty);
List<IndexDto> queryList = influxDButils.getListData(querySql,IndexDto.class);
return queryList;
}
public List<IndexDto> getlastgf(String gatewayId, String value,String daty){
IndexDto indexDto=null;
String querySql = " SELECT * FROM iot_data_%s WHERE equipmentIndexName='%s' and equipmentSpecificName =~/.*逆变器.*/ and time >='%sT00:55:00Z' AND time < '%sT23:59:59Z' group by equipmentsIdx order by time desc LIMIT 1";
querySql = String.format(querySql, gatewayId, value,daty,daty);
List<IndexDto> queryList = influxDButils.getListData(querySql,IndexDto.class);
queryList.forEach(item -> {
item.setValue(String.valueOf(Double.parseDouble(item.getValue()) * CommonConstans.pvGenPoweActor * CommonConstans.pvGenPoweActorDay));
item.setValueLabel(String.valueOf(Double.parseDouble(item.getValueLabel()) * CommonConstans.pvGenPoweActor * CommonConstans.pvGenPoweActorDay));
});
return queryList;
}
// //获取指定指标,当天最后一条数据
// public List<IndexDto> getlast(String gatewayId, String value,String daty){
// IndexDto indexDto=null;
//
// String querySql = " SELECT * FROM iot_data_%s WHERE equipmentIndexName='%s' and time >='%sT00:55:00Z' AND time < '%sT23:59:59Z' group by equipmentsIdx order by time desc LIMIT 1";
//
// querySql = String.format(querySql, gatewayId, value,daty,daty);
// List<IndexDto> queryList = influxDButils.getListData(querySql,IndexDto.class);
// return queryList;
// }
// public List<IndexDto> getlastgf(String gatewayId, String value,String daty){
// IndexDto indexDto=null;
// String querySql = " SELECT * FROM iot_data_%s WHERE equipmentIndexName='%s' and equipmentSpecificName =~/.*逆变器.*/ and time >='%sT00:55:00Z' AND time < '%sT23:59:59Z' group by equipmentsIdx order by time desc LIMIT 1";
//
// querySql = String.format(querySql, gatewayId, value,daty,daty);
// List<IndexDto> queryList = influxDButils.getListData(querySql,IndexDto.class);
// queryList.forEach(item -> {
// item.setValue(String.valueOf(Double.parseDouble(item.getValue()) * CommonConstans.pvGenPoweActor * CommonConstans.pvGenPoweActorDay));
// item.setValueLabel(String.valueOf(Double.parseDouble(item.getValueLabel()) * CommonConstans.pvGenPoweActor * CommonConstans.pvGenPoweActorDay));
// });
// return queryList;
// }
//更新es 数据
//@Async("jxiopAsyncExecutor")
......
......@@ -4,13 +4,8 @@ import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.module.jxiop.api.dto.DeviceDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.StationTaksDto;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.service.IStationDataTask;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.SjglZsjZsbtz;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.TpriDmpDatabook;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
import org.influxdb.dto.QueryResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
......@@ -39,8 +34,8 @@ public class StationDataTaskImpl {
@Value("${station.isok}")
private boolean isok;
@Autowired
InfluxDButils influxDButils;
// @Autowired
// InfluxDButils influxDButils;
@Autowired
MonitorFanIndicatorAsync monitorFanIndicatorAsync;
......@@ -78,27 +73,27 @@ public class StationDataTaskImpl {
}
// @Async("jxiopAsyncExecutor")
public List<IndexDto> getIndexDto(DeviceDto deviceDto) {
String querysql ="SELECT createdTime ,gatewayId,address,valueLabel ,equipmentsIdx FROM iot_data WHERE equipmentSpecificName=~/.*"+deviceDto.getNumberName()+"风机"+".*/ and gatewayId='"+deviceDto.getGateway()+"' ORDER BY time desc LIMIT 600";
//每个分机的指标数据
List<IndexDto> list = influxDButils.getListData(querysql,IndexDto.class);
if(list!=null&&list.size()>0){
//对数据切片处理 默认创建
if(stationSection>list.size()||!isok){
monitorFanIndicatorImpl.UpdateMonitorFanIndicator(list);
}else{
//进行分片处理
List<List<IndexDto>> listfp4= Lists.partition(list,stationSection);
for (List<IndexDto> indexDtos : listfp4) {
//每个分级信息处理
monitorFanIndicatorAsync.UpdateMonitorFanIndicator(indexDtos);
}
}
}
return list;
}
// public List<IndexDto> getIndexDto(DeviceDto deviceDto) {
// String querysql ="SELECT createdTime ,gatewayId,address,valueLabel ,equipmentsIdx FROM iot_data WHERE equipmentSpecificName=~/.*"+deviceDto.getNumberName()+"风机"+".*/ and gatewayId='"+deviceDto.getGateway()+"' ORDER BY time desc LIMIT 600";
// //每个分机的指标数据
// List<IndexDto> list = influxDButils.getListData(querysql,IndexDto.class);
// if(list!=null&&list.size()>0){
// //对数据切片处理 默认创建
// if(stationSection>list.size()||!isok){
// monitorFanIndicatorImpl.UpdateMonitorFanIndicator(list);
// }else{
// //进行分片处理
//
// List<List<IndexDto>> listfp4= Lists.partition(list,stationSection);
// for (List<IndexDto> indexDtos : listfp4) {
// //每个分级信息处理
// monitorFanIndicatorAsync.UpdateMonitorFanIndicator(indexDtos);
// }
// }
// }
//
// return list;
// }
......
......@@ -27,17 +27,17 @@ public class StationDataTask {
//定时获取场站指标最新数据
// @Scheduled(cron = "${station.task.cron}")
public void getStationDataTask(){
//获取所有场站信息
List<StationTaksDto> list=stationDataTask.getListStationBasic();
for (StationTaksDto stationTaksDto : list) {
//获取分机
List<DeviceDto> listDeviceDto= stationDataTask.getListDevice(stationTaksDto);
if(listDeviceDto!=null&&listDeviceDto.size()>0){
for (DeviceDto deviceDto : listDeviceDto) {
List<IndexDto> listIndexDto = stationDataTask.getIndexDto(deviceDto);
}
}
}
}
// public void getStationDataTask(){
// //获取所有场站信息
// List<StationTaksDto> list=stationDataTask.getListStationBasic();
// for (StationTaksDto stationTaksDto : list) {
// //获取分机
// List<DeviceDto> listDeviceDto= stationDataTask.getListDevice(stationTaksDto);
// if(listDeviceDto!=null&&listDeviceDto.size()>0){
// for (DeviceDto deviceDto : listDeviceDto) {
// List<IndexDto> listIndexDto = stationDataTask.getIndexDto(deviceDto);
// }
// }
// }
// }
}
package com.yeejoin.amos.boot.module.jxiop.biz.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.squareup.moshi.Json;
import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import org.influxdb.dto.QueryResult;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Component
public class InfluxDButils {
@Autowired
InfluxDbConnection influxDbConnection;
@Autowired
InfluxdbUtil influxdbUtil;
public <T> List<T> getListData(String sql, Class<T> clazz) {
List<T> list = new ArrayList<>();
try {
QueryResult query = influxDbConnection.query(sql);
List<QueryResult.Result> queryResults = query.getResults();
for (QueryResult.Result result : queryResults) {
List<QueryResult.Series> series = result.getSeries();
if (series == null) {
continue;
}
for (QueryResult.Series serie : series) {
List<List<Object>> values = serie.getValues();
List<String> columns = serie.getColumns();
for (int i = 0; i < values.size(); ++i) {
T object = clazz.newInstance();
BeanWrapperImpl bean = new BeanWrapperImpl(object);
for (int j = 0; j < columns.size(); ++j) {
String k = columns.get(j);
Object v = values.get(i).get(j);
if ("time".equals(k)) {
continue;
} else {
bean.setPropertyValue(k, v);
}
}
list.add(object);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
public <T> List<T> getListData1(String sql, Class<T> clazz) {
List<T> list = new ArrayList<>();
try {
List<Map<String,Object>> mapList = influxdbUtil.query(sql);
list=mapList.stream().map(stringObjectMap -> JSONObject.parseObject(JSON.toJSONString(stringObjectMap),clazz)).collect(Collectors.toList());
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
public <T> List<T> getListDataAll(String sql, Class<T> clazz) {
List<T> list = new ArrayList<>();
try {
QueryResult query = influxDbConnection.query(sql);
List<QueryResult.Result> queryResults = query.getResults();
for (QueryResult.Result result : queryResults) {
List<QueryResult.Series> series = result.getSeries();
if (series == null) {
continue;
}
for (QueryResult.Series serie : series) {
List<List<Object>> values = serie.getValues();
List<String> columns = serie.getColumns();
for (int i = 0; i < values.size(); ++i) {
T object = clazz.newInstance();
BeanWrapperImpl bean = new BeanWrapperImpl(object);
for (int j = 0; j < columns.size(); ++j) {
String k = columns.get(j);
Object v = values.get(i).get(j);
bean.setPropertyValue(k, v);
}
list.add(object);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
}
//package com.yeejoin.amos.boot.module.jxiop.biz.utils;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import com.squareup.moshi.Json;
//import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
//import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
//import org.influxdb.dto.QueryResult;
//import org.springframework.beans.BeanWrapperImpl;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//import org.springframework.util.ObjectUtils;
//
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.List;
//import java.util.Map;
//import java.util.stream.Collectors;
//
//@Component
//public class InfluxDButils {
// @Autowired
// InfluxDbConnection influxDbConnection;
// @Autowired
// InfluxdbUtil influxdbUtil;
// public <T> List<T> getListData(String sql, Class<T> clazz) {
// List<T> list = new ArrayList<>();
// try {
// QueryResult query = influxDbConnection.query(sql);
// List<QueryResult.Result> queryResults = query.getResults();
// for (QueryResult.Result result : queryResults) {
// List<QueryResult.Series> series = result.getSeries();
// if (series == null) {
// continue;
// }
// for (QueryResult.Series serie : series) {
// List<List<Object>> values = serie.getValues();
// List<String> columns = serie.getColumns();
// for (int i = 0; i < values.size(); ++i) {
// T object = clazz.newInstance();
// BeanWrapperImpl bean = new BeanWrapperImpl(object);
// for (int j = 0; j < columns.size(); ++j) {
// String k = columns.get(j);
// Object v = values.get(i).get(j);
// if ("time".equals(k)) {
// continue;
// } else {
// bean.setPropertyValue(k, v);
// }
// }
// list.add(object);
// }
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// return list;
// }
//
// public <T> List<T> getListData1(String sql, Class<T> clazz) {
// List<T> list = new ArrayList<>();
// try {
// List<Map<String,Object>> mapList = influxdbUtil.query(sql);
// list=mapList.stream().map(stringObjectMap -> JSONObject.parseObject(JSON.toJSONString(stringObjectMap),clazz)).collect(Collectors.toList());
// } catch (Exception e) {
// e.printStackTrace();
// }
// return list;
// }
//
// public <T> List<T> getListDataAll(String sql, Class<T> clazz) {
// List<T> list = new ArrayList<>();
// try {
// QueryResult query = influxDbConnection.query(sql);
// List<QueryResult.Result> queryResults = query.getResults();
// for (QueryResult.Result result : queryResults) {
// List<QueryResult.Series> series = result.getSeries();
// if (series == null) {
// continue;
// }
// for (QueryResult.Series serie : series) {
// List<List<Object>> values = serie.getValues();
// List<String> columns = serie.getColumns();
// for (int i = 0; i < values.size(); ++i) {
// T object = clazz.newInstance();
// BeanWrapperImpl bean = new BeanWrapperImpl(object);
// for (int j = 0; j < columns.size(); ++j) {
// String k = columns.get(j);
// Object v = values.get(i).get(j);
//
// bean.setPropertyValue(k, v);
//
// }
// list.add(object);
// }
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// return list;
// }
//}
......@@ -91,14 +91,14 @@ emqx.max-inflight=1000
#spring.influx.bufferLimit=20000
spring.influx.url=http://139.9.173.44:18086
spring.influx.password=Yeejoin@2020
spring.influx.user=root
spring.influx.database=iot_platform
spring.influx.retention_policy=default
spring.influx.retention_policy_time=30d
spring.influx.actions=10000
spring.influx.bufferLimit=20000
#spring.influx.url=http://139.9.173.44:18086
#spring.influx.password=Yeejoin@2020
#spring.influx.user=root
#spring.influx.database=iot_platform
#spring.influx.retention_policy=default
#spring.influx.retention_policy_time=30d
#spring.influx.actions=10000
#spring.influx.bufferLimit=20000
knife4j.production=false
knife4j.enable=true
......
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