Commit b07390e9 authored by tangwei's avatar tangwei

去除influx

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