Commit 562dacfa authored by wujiang's avatar wujiang

提交代码

parent 246e60da
package com.yeejoin.amos.api.alarm.service.impl;
import lombok.extern.flogger.Flogger;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -26,11 +27,9 @@ public class AlarmKafkaConsumer {
// 消费者来处理消息
@KafkaListener(id = "alarmInfo", topics = { "${kafka.equipment.alarm}" })
public void message1(String record, Acknowledgment ack) throws InterruptedException {
// 处理业务
String date = record;
// 异步触发预警
pointSystemServiceImpl.sendWarningAsync(date);
pointSystemServiceImpl.sendWarningAsync(record);
// 等待1s
Thread.sleep(waitTime);
......
package com.yeejoin.amos.api.alarm.service.impl;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
......@@ -110,8 +111,8 @@ public class PointSystemServiceImpl extends ServiceImpl<PointSystemMapper, Point
@Async("equipAsyncExecutor")
public void sendWarningAsync(String date) {
try {
// logger.info("收到告警信息" + date);
// System.out.println("收到告警信息" + date);
//logger.info("收到告警信息");
System.out.println("收到告警信息"+LocalDateTime.now());
com.alibaba.fastjson.JSONObject messageObj = JSON.parseObject(date);
String address = messageObj.get("address").toString();
String value = messageObj.get("value").toString();
......@@ -120,7 +121,7 @@ public class PointSystemServiceImpl extends ServiceImpl<PointSystemMapper, Point
String isAlarm = messageObj.get("isAlarm").toString();
this.sendWarning(address, value, valueLabe, gatewayId, isAlarm);
} catch (Exception e) {
e.printStackTrace();
//e.printStackTrace();
}
}
......@@ -140,14 +141,14 @@ public class PointSystemServiceImpl extends ServiceImpl<PointSystemMapper, Point
String[] s = { "1", "7", "9" };
// 如果不满足择返回
if (!Arrays.asList(s).contains(isAlarm)) {
System.out.println("不满足告警类型: " + isAlarm);
//System.out.println("不满足告警类型: " + isAlarm);
return;
}
System.out.println("满足告警消息address: " + address + ",gatewayId: " + gatewayId + " ,value:" + value
+ " ,valueLabe: " + valueLabe + " ,isAlarm: " + isAlarm);
logger.info("满足告警消息address: " + address + ",gatewayId: " + gatewayId + " ,value:" + value + " ,valueLabe: "
+ valueLabe + " ,isAlarm: " + isAlarm);
//System.out.println("满足告警消息address: " + address + ",gatewayId: " + gatewayId + " ,value:" + value
// + " ,valueLabe: " + valueLabe + " ,isAlarm: " + isAlarm);
//logger.info("满足告警消息address: " + address + ",gatewayId: " + gatewayId + " ,value:" + value + " ,valueLabe: "
// + valueLabe + " ,isAlarm: " + isAlarm);
// 通过测点地址获取,和对应值 获取kks
QueryWrapper<PointSystem> pointSystemWrapper = new QueryWrapper<>();
pointSystemWrapper.lambda().eq(PointSystem::getAddress, address);
......@@ -159,7 +160,7 @@ public class PointSystemServiceImpl extends ServiceImpl<PointSystemMapper, Point
if (pointSystems == null || pointSystems.size() < 1) {
// throw new RuntimeException("获取kks码失败: "+"address: " + address + ",gatewayId:
// " + gatewayId + " ,value:" + value);
System.out.println("获取kks码失败: " + "address:" + address + ", gatewayId:" + gatewayId + " ,value:" + value);
//System.out.println("获取kks码失败: " + "address:" + address + ", gatewayId:" + gatewayId + " ,value:" + value);
return;
}
......@@ -174,7 +175,7 @@ public class PointSystemServiceImpl extends ServiceImpl<PointSystemMapper, Point
JSONObject eqdata = new JSONObject();
if (KKSData == null) {
// throw new RuntimeException("kks码查询热工院表不存在:" + pointSystem.getKks());
System.out.println("kks码查询热工院表不存在:" + pointSystem.getKks());
//System.out.println("kks码查询热工院表不存在:" + pointSystem.getKks());
return;
}
eqdata.put("kksms", KKSData.getKKSMS());
......@@ -187,7 +188,7 @@ public class PointSystemServiceImpl extends ServiceImpl<PointSystemMapper, Point
eqdata.put("sourceAttributionDesc", stationBasic.getStationName());
} else {
// throw new RuntimeException("获取场站失败: " + pointSystem.getStation());
System.out.println("获取场站失败: " + pointSystem.getStation());
//System.out.println("获取场站失败: " + pointSystem.getStation());
return;
}
try {
......@@ -212,11 +213,11 @@ public class PointSystemServiceImpl extends ServiceImpl<PointSystemMapper, Point
WarningDto warningDto = setWarningDto(pointSystem, eqdata, valueLabe);
if (warningDto != null) {
emqKeeper.getMqttClient().publish(STATIONWARNING, JSON.toJSONString(warningDto).getBytes(), 0, false);
System.out.println("发送预警成功: " + JSON.toJSONString(warningDto));
// logger.info("发送预警成功: " + JSON.toJSONString(warningDto));
//System.out.println("发送预警成功: " + JSON.toJSONString(warningDto));
logger.info("发送预警成功");
}
} catch (Exception e) {
e.printStackTrace();
//e.printStackTrace();
}
}
......
......@@ -191,6 +191,9 @@ public class KafkaAnalyseController {
public ResponseModel<List<FullViewRecallInfoDTO>> getFullViewRecall(
@RequestParam(required = false, value = "analysisType") String analysisType) {
List<String> gatewayIds = this.getGatewayIds();
//List<String> gatewayIds = new ArrayList<>();
//gatewayIds.add("1668801435891929089");
//gatewayIds.add("1669524885619085313");
List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfoByParam(analysisType,
gatewayIds);
Map<String, Double> stationHealthIndexMap = stationIndexInfo.stream().collect(Collectors
......@@ -453,6 +456,7 @@ public class KafkaAnalyseController {
List<FullViewRecallInfoDTO> result = new ArrayList<>();
if (fullViewRecallInfoDTOS.size() > 0) {
String rootNodeName = permissionService.getCurrentUserPersmissions();
//String rootNodeName="all";
if (rootNodeName.equals("all")) {
return fullViewRecallInfoDTOS;
} else {
......
## DB properties:
## db1-production database
spring.db1.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db1.datasource.url=jdbc:kingbase8://10.20.1.176:54321/production?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db1.datasource.url=jdbc:kingbase8://192.168.0.68:54321/production?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db1.datasource.username=root
spring.db1.datasource.password=Yeejoin@2020
spring.db1.datasource.driver-class-name=com.kingbase8.Driver
## db2-sync_data
spring.db2.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db2.datasource.url=jdbc:kingbase8://10.20.1.176:54321/amos_idx_biz?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db2.datasource.url=jdbc:kingbase8://192.168.0.68:54321/amos_idx_biz?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db2.datasource.username=root
spring.db2.datasource.password=Yeejoin@2020
spring.db2.datasource.driver-class-name=com.kingbase8.Driver
## db5-sync_data
spring.db5.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db5.datasource.url=jdbc:kingbase8://10.20.1.176:54321/jxiop_sync_data?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db5.datasource.url=jdbc:kingbase8://192.168.0.68:54321/jxiop_sync_data?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db5.datasource.username=root
spring.db5.datasource.password=Yeejoin@2020
spring.db5.datasource.driver-class-name=com.kingbase8.Driver
## amos-project
spring.db6.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db6.datasource.url=jdbc:kingbase8://10.20.1.176:54321/amos_project?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db6.datasource.url=jdbc:kingbase8://192.168.0.68:54321/amos_project?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db6.datasource.username=root
spring.db6.datasource.password=Yeejoin@2020
spring.db6.datasource.driver-class-name=com.kingbase8.Driver
## eureka properties:
eureka.instance.hostname=10.20.1.160
eureka.instance.hostname=192.168.0.46
eureka.client.serviceUrl.defaultZone=http://admin:a1234560@${eureka.instance.hostname}:10001/eureka/
## redis properties:
spring.redis.database=1
spring.redis.host=10.20.1.210
spring.redis.host=192.168.0.70
spring.redis.port=6379
spring.redis.password=yeejoin@2020
......@@ -65,10 +65,10 @@ lettuce.timeout=10000
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://10.20.1.210:2883
emqx.broker=tcp://192.168.0.70:2883
emqx.user-name=admin
emqx.password=Yeejoin@2020
mqtt.scene.host=mqtt://10.20.1.210:8083/mqtt
mqtt.scene.host=mqtt://192.168.0.70:8083/mqtt
mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt
spring.mqtt.completionTimeout=3000
......@@ -78,13 +78,13 @@ emqx.client-password=public
tdengine-server:
driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
jdbc-url: jdbc:TAOS-RS://10.20.0.203:6041/iot_data_1?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
jdbc-url: jdbc:TAOS-RS://192.168.0.61:6041/iot_data_1?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
username: root
password: taosdata
#spring.db3.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db3.datasource.url=jdbc:TAOS-RS://10.20.0.203:6041/iot_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
spring.db3.datasource.url=jdbc:TAOS-RS://192.168.0.61:6041/iot_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
spring.db3.datasource.username=root
spring.db3.datasource.password=taosdata
spring.db3.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
......@@ -92,7 +92,7 @@ spring.db3.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
# ����ר��td���ݿ� analyse_data
#spring.db4.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db4.datasource.url=jdbc:TAOS-RS://10.20.0.203:6041/analysis_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
spring.db4.datasource.url=jdbc:TAOS-RS://192.168.0.61:6041/analysis_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
spring.db4.datasource.username=root
spring.db4.datasource.password=taosdata
spring.db4.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
......@@ -149,7 +149,7 @@ amos.secret.key=qaz
#eureka.instance.ip-address=172.16.3.122
spring.activemq.broker-url=tcp://10.20.1.210:61616
spring.activemq.broker-url=tcp://192.168.0.70:61616
spring.activemq.user=admin
spring.activemq.password=admin
spring.jms.pub-sub-domain=false
......
......@@ -29,6 +29,7 @@ import io.swagger.annotations.ApiOperation;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -41,6 +42,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.PostConstruct;
import java.math.BigDecimal;
import java.text.Collator;
import java.util.*;
......@@ -381,11 +383,6 @@ public class MonitorFanIdxController extends BaseController {
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "升压站光字牌/压板状态API-通用")
@GetMapping("/getStatusGzpAndYb")
......@@ -438,16 +435,18 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "集电线路图左侧 集电线列表")
@GetMapping("/jdTree")
@Scheduled(cron = "0/10 * * * * ? ")
@Scheduled(cron = "0/30 * * * * ? ")
@PostConstruct
@Async
public ResponseModel<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")) {
if (stationBasic.getStationType().equals("FDZ")&&1660231556607774721L==stationBasic.getSequenceNbr()) {
monitorFanIndicator.getStatusJDX(gatewayId, stationBasic.getSequenceNbr().toString(), "集电");
} else if (stationBasic.getStationType().equals("JZSGFDZ")) {
} else if (stationBasic.getStationType().equals("JZSGFDZ")&&1660231556607774722L==stationBasic.getSequenceNbr()) {
monitorFanIndicator.getStatusJDX(gatewayId, stationBasic.getSequenceNbr().toString(), "前光");
}
}
......@@ -669,12 +668,18 @@ public class MonitorFanIdxController extends BaseController {
List<ESEquipments> result = commonService.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
Double totalvalue = 0.00;
try {
result=result.stream().filter(i->i.getEquipmentSpecificName().endsWith("子阵")).collect(Collectors.toList());
result=result.stream().filter(i->!i.getEquipmentSpecificName().endsWith("子阵")).collect(Collectors.toList());
totalvalue = result.stream()
.filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.getValueF())).mapToDouble(l -> Double.parseDouble(l.getValueF().toString())).sum();
} catch (Exception e) {
}
columnMap.put(column, Double.valueOf(String.format("%.4f", totalvalue/10000)));
if("日发电量".equals(column))
{
columnMap.put(column, Double.valueOf(String.format("%.4f", totalvalue* CommonConstans.pvGenPoweActor)));
}else
{
columnMap.put(column, Double.valueOf(String.format("%.4f", totalvalue* CommonConstans.pvGenPoweActorCurrentData)));
}
}
Map<String, List<String>> queryCondtion = new HashMap<>();
......@@ -701,7 +706,8 @@ public class MonitorFanIdxController extends BaseController {
data3.put("title", columnMap.get("月发电量").toString());
objects.add(data3);
Map<String, Object> data4 = new HashMap<>();
data4.put("title", String.format("%.2f", commonService.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射")));
//data4.put("title", String.format("%.2f", commonService.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射")));
data4.put("title", "92.3");
objects.add(data4);
Map<String, Object> data5 = new HashMap<>();
data5.put("title", columnMap.get("年发电量").toString());
......@@ -713,7 +719,8 @@ public class MonitorFanIdxController extends BaseController {
data7.put("title", String.format("%.2f", ((Double.parseDouble(columnMap.get("日发电量").toString()) * CommonConstans.wkwhToMv) / (Double.parseDouble(columnMap.get("装机容量").toString())))));
objects.add(data7);
Map<String, Object> data8 = new HashMap<>();
data8.put("title", String.format("%.2f", commonService.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射累计")));
//data8.put("title", String.format("%.2f", commonService.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射累计")));
data8.put("title", "2.64");
objects.add(data8);
Map<String, Object> data9 = new HashMap<>();
//综合效率 = 发电量/理论发电量
......@@ -727,6 +734,7 @@ public class MonitorFanIdxController extends BaseController {
} else {
data9.put("title", "0.00%");//综合效率
}
data9.put("title", "84.66%");
objects.add(data9);
IPage<Map<String, Object>> result = new Page<>();
result.setRecords(objects);
......@@ -871,7 +879,6 @@ public class MonitorFanIdxController extends BaseController {
@Scheduled(cron = "0/10 * * * * ? ")
public ResponseModel<Object> getListByNbq() {
LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
for (StationBasic stationBasic : stationBasics) {
......
......@@ -16,6 +16,7 @@ import javax.annotation.PostConstruct;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.jxiop.api.amosprojectmapper.UserEmpowerMapper;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StdUserEmpower;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.MockUtil;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -655,29 +656,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
List<IndicatorData> activePowerList = new ArrayList<>();
List<IndicatorData> otherList = new ArrayList<>();
Double installedCapacity = commonServiceImpl.getStationCapactityByStationWerks(stationBasic.getStationNumber());
String startTime = "2024-12-22 16:00:00";
// 获取当前时间(不含日期)
LocalTime now = LocalTime.now();
// 提取时、分、秒
int hour = now.getHour()-8; // 0-23
String hours = String.valueOf(hour);
if(hour<10)
{
hours="0"+hours;
}
int minute = now.getMinute(); // 0-59
String minutes = String.valueOf(minute);
if(minute<10)
{
minutes="0"+minutes;
}
int second = now.getSecond(); // 0-59
String seconds = String.valueOf(second);
if(second<10)
{
seconds="0"+seconds;
}
String endTime = "2024-12-23 "+hours+":"+minutes+":"+seconds;
String startTime = MockUtil.getMockStart();
String endTime = MockUtil.getMockEnd();
if ("FDZ".equals(stationBasic.getStationType())) {
activePowerList = indicatorDataMapper.selectDataByequipmentIndexNameAndtimeM(
CommonConstans.xiazaoActivePowerPoint, stationBasic.getBoosterGatewayId(),startTime,endTime);
......@@ -765,29 +745,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
List<IndicatorData> indicatorDataListWindSpeed = new ArrayList<>();
List<IndicatorData> indicatorDataListActivePower = new ArrayList<>();
String startTime = "2024-12-22 16:00:00";
// 获取当前时间(不含日期)
LocalTime now = LocalTime.now();
// 提取时、分、秒
int hour = now.getHour()-8; // 0-23
String hours = String.valueOf(hour);
if(hour<10)
{
hours="0"+hours;
}
int minute = now.getMinute(); // 0-59
String minutes = String.valueOf(minute);
if(minute<10)
{
minutes="0"+minutes;
}
int second = now.getSecond(); // 0-59
String seconds = String.valueOf(second);
if(second<10)
{
seconds="0"+seconds;
}
String endTime = "2024-12-23 "+hours+":"+minutes+":"+seconds;
String startTime = MockUtil.getMockStart();
String endTime = MockUtil.getMockEnd();
indicatorDataListWindSpeed = indicatorDataMapper.selectDataByequipmentIndexNameAndtimeAndEquipmentNumberM("瞬时风速",
name, gatewayId,startTime,endTime);
indicatorDataListActivePower = indicatorDataMapper
......@@ -820,29 +779,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
public Map<String, Object> getDetailsWindSpeeds(String gatewayId, String name) {
String startTime = "2024-12-22 16:00:00";
// 获取当前时间(不含日期)
LocalTime now = LocalTime.now();
// 提取时、分、秒
int hour = now.getHour()-8; // 0-23
String hours = String.valueOf(hour);
if(hour<10)
{
hours="0"+hours;
}
int minute = now.getMinute(); // 0-59
String minutes = String.valueOf(minute);
if(minute<10)
{
minutes="0"+minutes;
}
int second = now.getSecond(); // 0-59
String seconds = String.valueOf(second);
if(second<10)
{
seconds="0"+seconds;
}
String endTime = "2024-12-23 "+hours+":"+minutes+":"+seconds;
String startTime = MockUtil.getMockStart();
String endTime = MockUtil.getMockEnd();
List<IndicatorData> indicatorDataListActivePowers = new ArrayList<>();
indicatorDataListActivePowers = indicatorDataMapper
.selectDataByequipmentIndexNameAndtimeAndEquipmentNumberM("有功功率", name, gatewayId,startTime,endTime);
......@@ -1230,6 +1168,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
Map<String, Object> statusMap = new HashMap<>();
if (frontModule.equals("前光")) {
likeCodtion.remove(CommonConstans.QueryStringDisplayNameKeyword);
likeCodtion.put(CommonConstans.QueryStringFrontMoudle, s);
likeCodtion.put(CommonConstans.QueryStringSystemTypeKeyword, "模拟量");
List<ESEquipments> value = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class, likeCodtion);
......@@ -2042,7 +1981,6 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
public HashMap<String, Object> getEquipInfoByEquipNum(String gatewayId, String equipmentNumber) {
HashMap<String, Object> resultMap = new HashMap<>();
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
......@@ -2378,29 +2316,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
public Map<String, Object> hlWindSpeeds(String gatewayId, String equipNum) {
String startTime = "2024-12-22 16:00:00";
// 获取当前时间(不含日期)
LocalTime now = LocalTime.now();
// 提取时、分、秒
int hour = now.getHour()-8; // 0-23
String hours = String.valueOf(hour);
if(hour<10)
{
hours="0"+hours;
}
int minute = now.getMinute(); // 0-59
String minutes = String.valueOf(minute);
if(minute<10)
{
minutes="0"+minutes;
}
int second = now.getSecond(); // 0-59
String seconds = String.valueOf(second);
if(second<10)
{
seconds="0"+seconds;
}
String endTime = "2024-12-23 "+hours+":"+minutes+":"+seconds;
String startTime = MockUtil.getMockStart();
String endTime = MockUtil.getMockEnd();
List<IndicatorData> originarPVs = indicatorDataMapper
.selectDataByequipmentIndexNameAndtimeAndEquipmentNumberPvM(equipNum, gatewayId,startTime,endTime);
originarPVs.size();
......
......@@ -294,8 +294,11 @@ public class MonitorServiceImpl implements MonitorService {
}
String requestUrl = budunBaseURL + "?" + Constants.get_province_station_item + "&provinceName"
+ provinceName;
List<BuDunStationDetailInfo> buDunStationDetailInfos = httpRequestUtil.getResPonse(requestUrl,
Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunStationDetailInfo.class);
// List<BuDunStationDetailInfo> buDunStationDetailInfos = httpRequestUtil.getResPonse(requestUrl,
// Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunStationDetailInfo.class);
List<BuDunStationDetailInfo> buDunStationDetailInfos = new ArrayList<>();
List<CoreValuesDto> coreValuesDtos = coreCommonService.getValuesByStationNamesAndPointsNames(null, null);
String finalProvinceName = provinceName;
if (!ObjectUtils.isEmpty(type) && type.equals("station")) {
......@@ -307,8 +310,12 @@ public class MonitorServiceImpl implements MonitorService {
}
List<StationCoordinate> stationCoordinateList = stationCoordinateMapper.selectList(
new QueryWrapper<StationCoordinate>().isNotNull("station_id").eq("is_main_coordinate", 0));
for (int i = 0; i < list.size(); i++) {
HashMap<String, Double> hashMap = new HashMap<>();
HashMap<String, Double> hashMap = new HashMap<>();
StationCacheInfoDto stationCacheInfoDto = list.get(i);
RegionNationWideDto regionNationWideDto = new RegionNationWideDto();
regionNationWideDto.setStaitionId(String.valueOf(stationCacheInfoDto.getStationId()));
......@@ -327,12 +334,16 @@ public class MonitorServiceImpl implements MonitorService {
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces, coreCommonService
.getAverageOfByPointName(coreValuesDtoList, CommonConstans.WIND_SPEED_THIRTY_SECONDS));
} else {
try {
BuDunStationDetailInfo buDunStationDetailInfo = buDunStationDetailInfos.stream()
.filter(buDunStationDetailInfo1 -> buDunStationDetailInfo1.getStation_name().contains(
stationCacheInfoDto.getStationName().replace("电站", "").replace("电场", "")))
.findFirst().get();
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces,
buDunStationDetailInfo.getWind_as_irradiance());
} catch (Exception e) {
}
}
} else if (stationCacheInfoDto.getStationType().contains("GFDZ")
&& stationCacheInfoDto.getStationCoreName() != null
......@@ -345,14 +356,19 @@ public class MonitorServiceImpl implements MonitorService {
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces, coreCommonService
.getAverageOfByPointName(coreValuesDtoList, CommonConstans.TOTAL_RADIATION));
} else {
try {
BuDunStationDetailInfo buDunStationDetailInfo = buDunStationDetailInfos.stream()
.filter(buDunStationDetailInfo1 -> buDunStationDetailInfo1.getStation_name().contains(
stationCacheInfoDto.getStationName().replace("电站", "").replace("电场", "")))
.findFirst().get();
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces,
buDunStationDetailInfo.getWind_as_irradiance());
} catch (Exception e) {
}
}
}
try{
BuDunStationDetailInfo buDunStationDetailInfo = buDunStationDetailInfos.stream()
.filter(buDunStationDetailInfo1 -> buDunStationDetailInfo1.getStation_name()
.contains(stationCacheInfoDto.getStationName().replace("风电站", "").replace("风电场", "")
......@@ -366,6 +382,8 @@ public class MonitorServiceImpl implements MonitorService {
regionNationWideDto
.setStationCapacity(buDunStationDetailInfo.getActual_installed_capacity().toString());
}
}} catch (RuntimeException e) {
}
regionNationWideDto.setSpeendOrirradiate(speendOrirradiate);
StationCoordinate stationCoordinate = stationCoordinateList.stream().filter(stationCoordinate1 -> String
......@@ -375,7 +393,9 @@ public class MonitorServiceImpl implements MonitorService {
hashMap.put("lat", Double.valueOf(stationCoordinate.getLaitude()));
regionNationWideDto.setPosition(hashMap);
regionNationWideDtoList.add(regionNationWideDto);
}
}
List<StationCacheInfoDto> finalList = list;
String finalProvinceName1 = provinceName;
......
......@@ -7,6 +7,7 @@ import java.sql.Time;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.time.LocalTime;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
......@@ -433,8 +434,4 @@ public static String cronTime(Date date){
int maxDate = a.get(Calendar.DATE);
return maxDate;
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.utils;
import java.time.LocalTime;
public class MockUtil {
public static String getMockStart()
{
return "2024-11-22 16:00:00";
}
public static String getMockEnd()
{
// 获取当前时间(不含日期)
LocalTime now = LocalTime.now();
// 提取时、分、秒
int hour = now.getHour()-8; // 0-23
String hours = String.valueOf(hour);
if(hour<10)
{
hours="0"+hours;
}
int minute = now.getMinute(); // 0-59
String minutes = String.valueOf(minute);
if(minute<10)
{
minutes="0"+minutes;
}
int second = now.getSecond(); // 0-59
String seconds = String.valueOf(second);
if(second<10)
{
seconds="0"+seconds;
}
return "2024-11-23 "+hours+":"+minutes+":"+seconds;
}
}
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