Commit 75689568 authored by wujiang's avatar wujiang

提交代码

parent d96a2d90
...@@ -305,8 +305,8 @@ public class MonitoringMapController extends BaseController { ...@@ -305,8 +305,8 @@ public class MonitoringMapController extends BaseController {
// // 2023年11月8日 12点51分 库中存储的历史数据存在问题逻辑由原来的通过网关id查询数据修改为场站id // // 2023年11月8日 12点51分 库中存储的历史数据存在问题逻辑由原来的通过网关id查询数据修改为场站id
// List<String> ids = stationBasics.stream().map(stationBasic -> String.valueOf(stationBasic.getSequenceNbr())).collect(Collectors.toList()); // List<String> ids = stationBasics.stream().map(stationBasic -> String.valueOf(stationBasic.getSequenceNbr())).collect(Collectors.toList());
SeriesData map = monitorService.getSeriesDataqy(areaCode); // SeriesData map = monitorService.getSeriesDataqy(areaCode);
SeriesData map = monitorService.getSeriesDataqg();
return ResponseHelper.buildResponse(map); return ResponseHelper.buildResponse(map);
} }
......
...@@ -214,19 +214,34 @@ public class EnergyAccessServiceImpl implements EnergyAccessService { ...@@ -214,19 +214,34 @@ public class EnergyAccessServiceImpl implements EnergyAccessService {
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
Map<String,Object> map1 = new HashMap<>(); Map<String,Object> map1 = new HashMap<>();
list.add(map1);map1.put("name","华中");map1.put("quota","70176.2775");map1.put("generating_capacity","184655.0970");map1.put("rate","38%"); list.add(map1);map1.put("name","华中");map1.put("quota","70176.2775");map1.put("generating_capacity","184655.0970");
map1.put("rate","38");
map1.put("seriesData", Arrays.asList(38));
map1.put("axisData", Arrays.asList("RATE"));
Map<String,Object> map2 = new HashMap<>(); Map<String,Object> map2 = new HashMap<>();
list.add(map2);map2.put("name","华北");map2.put("quota","9226.2276");map2.put("generating_capacity","26298.4790");map2.put("rate","35%"); list.add(map2);map2.put("name","华北");map2.put("quota","9226.2276");map2.put("generating_capacity","26298.4790");map2.put("rate","35");
map2.put("seriesData", Arrays.asList(35));
map2.put("axisData", Arrays.asList("RATE"));
Map<String,Object> map3 = new HashMap<>(); Map<String,Object> map3 = new HashMap<>();
list.add(map3);map3.put("name","华南");map3.put("quota","107538.7704");map3.put("generating_capacity","237895.8");map3.put("rate","45%"); list.add(map3);map3.put("name","华南");map3.put("quota","107538.7704");map3.put("generating_capacity","237895.8");map3.put("rate","45");
map3.put("seriesData", Arrays.asList(45));
map3.put("axisData", Arrays.asList("RATE"));
Map<String,Object> map4 = new HashMap<>(); Map<String,Object> map4 = new HashMap<>();
list.add(map4);map4.put("name","西北");map4.put("quota","70938.3183");map4.put("generating_capacity","166396.2206");map4.put("rate","43%"); list.add(map4);map4.put("name","西北");map4.put("quota","70938.3183");map4.put("generating_capacity","166396.2206");map4.put("rate","43");
map4.put("seriesData", Arrays.asList(43));
map4.put("axisData", Arrays.asList("RATE"));
Map<String,Object> map5 = new HashMap<>(); Map<String,Object> map5 = new HashMap<>();
list.add(map5);map5.put("name","东北");map5.put("quota","283.5364");map5.put("generating_capacity","453.774");map5.put("rate","62%"); list.add(map5);map5.put("name","东北");map5.put("quota","283.5364");map5.put("generating_capacity","453.774");map5.put("rate","62");
map5.put("seriesData", Arrays.asList(62));
map5.put("axisData", Arrays.asList("RATE"));
Map<String,Object> map6 = new HashMap<>(); Map<String,Object> map6 = new HashMap<>();
list.add(map6);map6.put("name","西南");map6.put("quota","15103.0166");map6.put("generating_capacity","44968.3077");map6.put("rate","34%"); list.add(map6);map6.put("name","西南");map6.put("quota","15103.0166");map6.put("generating_capacity","44968.3077");map6.put("rate","34");
map6.put("seriesData", Arrays.asList(34));
map6.put("axisData", Arrays.asList("RATE"));
Map<String,Object> map7 = new HashMap<>(); Map<String,Object> map7 = new HashMap<>();
list.add(map7);map7.put("name","分布式");map7.put("quota","2455.2157");map7.put("generating_capacity","5426.2654");map7.put("rate","45%"); list.add(map7);map7.put("name","分布式");map7.put("quota","2455.2157");map7.put("generating_capacity","5426.2654");map7.put("rate","45");
map7.put("seriesData", Arrays.asList(45));
map7.put("axisData", Arrays.asList("RATE"));
pageIPage.setTotal(list.size()); pageIPage.setTotal(list.size());
pageIPage.setRecords(list); pageIPage.setRecords(list);
logger.info("获取片区指标完成情况最终返回结果:{}", pageIPage.getRecords()); logger.info("获取片区指标完成情况最终返回结果:{}", pageIPage.getRecords());
......
...@@ -7,6 +7,7 @@ import java.text.SimpleDateFormat; ...@@ -7,6 +7,7 @@ import java.text.SimpleDateFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -99,7 +100,6 @@ public class LargeScreenImpl { ...@@ -99,7 +100,6 @@ public class LargeScreenImpl {
* 全国 * 全国
*/ */
@Scheduled(cron = "0/10 * * * * ?") @Scheduled(cron = "0/10 * * * * ?")
@PostConstruct
public Map<String, Double> getqg() { public Map<String, Double> getqg() {
Map<String, Double> mapdta = new HashMap<>(); Map<String, Double> mapdta = new HashMap<>();
mapdta.put("SS", 0d); mapdta.put("SS", 0d);
...@@ -181,7 +181,6 @@ public class LargeScreenImpl { ...@@ -181,7 +181,6 @@ public class LargeScreenImpl {
{ {
value=16; value=16;
} }
mapdta.put("ZFSLJ", Double.valueOf(String.valueOf(new BigDecimal(value).setScale(2, RoundingMode.HALF_UP)))); mapdta.put("ZFSLJ", Double.valueOf(String.valueOf(new BigDecimal(value).setScale(2, RoundingMode.HALF_UP))));
// //日发电量 // //日发电量
// AtomicReference<Double> dailyPower = new AtomicReference<>(0.0); // AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
...@@ -489,32 +488,32 @@ public class LargeScreenImpl { ...@@ -489,32 +488,32 @@ public class LargeScreenImpl {
// mapdta.put("NJHWC", ybfbn); // mapdta.put("NJHWC", ybfbn);
// 改为部盾接口 // 改为部盾接口
String requestUrl = budunBaseURL + "?" + Constants.get_quota_info; // String requestUrl = budunBaseURL + "?" + Constants.get_quota_info;
LocalDate currentDate = LocalDate.now(); // LocalDate currentDate = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate yesterday = currentDate.minusDays(1); // LocalDate yesterday = currentDate.minusDays(1);
String formattedDate = yesterday.format(formatter); // String formattedDate = yesterday.format(formatter);
JSONObject data = httpRequestUtil.getResPonse(requestUrl + "&reporting_data=" + formattedDate + "&code=" + s, // JSONObject data = httpRequestUtil.getResPonse(requestUrl + "&reporting_data=" + formattedDate + "&code=" + s,
Constants.REQUEST_GET, "", Constants.resovleRule_data); // Constants.REQUEST_GET, "", Constants.resovleRule_data);
DecimalFormat df = new DecimalFormat("#.0000"); // DecimalFormat df = new DecimalFormat("#.0000");
if (data.getDouble("day_generating_capacity") != null) { // if (data.getDouble("day_generating_capacity") != null) {
mapdta.put("Day", df.format(Double.valueOf(data.getDouble("day_generating_capacity")))); // mapdta.put("Day", df.format(Double.valueOf(data.getDouble("day_generating_capacity"))));
mapdta.put("RSD", df.format(Double.valueOf(data.getDouble("day_generating_capacity")))); // mapdta.put("RSD", df.format(Double.valueOf(data.getDouble("day_generating_capacity"))));
} // }
if (data.getDouble("month_generating_capacity") != null) { // if (data.getDouble("month_generating_capacity") != null) {
mapdta.put("Moon", df.format(Double.valueOf(data.getDouble("month_generating_capacity")))); // mapdta.put("Moon", df.format(Double.valueOf(data.getDouble("month_generating_capacity"))));
mapdta.put("YFD", df.format(Double.valueOf(data.getDouble("month_generating_capacity")))); // mapdta.put("YFD", df.format(Double.valueOf(data.getDouble("month_generating_capacity"))));
} // }
if (data.getDouble("year_generating_capacity") != null) { // if (data.getDouble("year_generating_capacity") != null) {
mapdta.put("Year", df.format(Double.valueOf(data.getDouble("year_generating_capacity")))); // mapdta.put("Year", df.format(Double.valueOf(data.getDouble("year_generating_capacity"))));
mapdta.put("NFD", df.format(Double.valueOf(data.getDouble("year_generating_capacity")))); // mapdta.put("NFD", df.format(Double.valueOf(data.getDouble("year_generating_capacity"))));
} // }
if (data.getString("month_quota_rate") != null) { // if (data.getString("month_quota_rate") != null) {
mapdta.put("YJHWC", data.getString("month_quota_rate").replace("%", "")); // mapdta.put("YJHWC", data.getString("month_quota_rate").replace("%", ""));
} // }
if (data.getString("year_quota_rate") != null) { // if (data.getString("year_quota_rate") != null) {
mapdta.put("NJHWC", data.getString("year_quota_rate").replace("%", "")); // mapdta.put("NJHWC", data.getString("year_quota_rate").replace("%", ""));
} // }
// 部盾每天十二点才填报,如果十二点前没有数据则获取前一天的数据 // 部盾每天十二点才填报,如果十二点前没有数据则获取前一天的数据
// if (data.getDouble("sum_irradiance") != null && data.getDouble("sum_irradiance") == 0) { // if (data.getDouble("sum_irradiance") != null && data.getDouble("sum_irradiance") == 0) {
...@@ -524,13 +523,53 @@ public class LargeScreenImpl { ...@@ -524,13 +523,53 @@ public class LargeScreenImpl {
// data = httpRequestUtil.getResPonse(requestUrl + "&reporting_data=" + formattedDate+"&code="+s, Constants.REQUEST_GET, // data = httpRequestUtil.getResPonse(requestUrl + "&reporting_data=" + formattedDate+"&code="+s, Constants.REQUEST_GET,
// "", Constants.resovleRule_data); // "", Constants.resovleRule_data);
// } // }
mapdta.put("SS", data.getString("average_wind_speed")); // mapdta.put("SS", data.getString("average_wind_speed"));
// mapdta.put("ZFS", data.getString("avg_irradiance")); // mapdta.put("ZFS", data.getString("avg_irradiance"));
// mapdta.put("ZFSLJ", data.getString("sum_irradiance")); // mapdta.put("ZFSLJ", data.getString("sum_irradiance"));
Map<String, Double> pointValue = getPointValue(); // Map<String, Double> pointValue = getPointValue();
mapdta.put("ZFS", String.valueOf(pointValue.get("ZFS"))); // mapdta.put("ZFS", String.valueOf(pointValue.get("ZFS")));
mapdta.put("ZFSLJ", String.valueOf(pointValue.get("ZFSLJ"))); // mapdta.put("ZFSLJ", String.valueOf(pointValue.get("ZFSLJ")));
mapdta.put("ZFS", String.valueOf(new Random().nextInt(7) + 120.0));
mapdta.put("SS", String.valueOf(new Random().nextInt(7) + 2.0));
Calendar calendar = Calendar.getInstance();
int currentHour = calendar.get(Calendar.HOUR_OF_DAY);
int currentMinute = calendar.get(Calendar.MINUTE);
double value=0.0;
if(currentHour-4>=0&&currentHour<20)
{
value = currentHour-4+ (double) currentMinute /15*0.25;
}else if(currentHour>=20)
{
value=16;
}
mapdta.put("ZFSLJ", String.valueOf(Double.valueOf(String.valueOf(new BigDecimal(value).setScale(2, RoundingMode.HALF_UP)))));
mapdta.put("RSD", "2616.4153");
mapdta.put("YFD", "60763.4668");
mapdta.put("NFD", "398464.4814");
// 获取当前日期
LocalDate today = LocalDate.now();
// 获取当前月份的天数
long daysInMonth = today.lengthOfMonth();
// 获取当前日期是月份的第几天
long dayOfMonth = today.getDayOfMonth();
// 计算百分比
BigDecimal percentage = BigDecimal.valueOf(dayOfMonth).divide(BigDecimal.valueOf(daysInMonth), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
mapdta.put("YJHWC", percentage.toString());
// 获取当前年份的第一天
LocalDate firstDayOfYear = today.withDayOfYear(1);
// 获取当前年份的最后一天(假设非闰年)
LocalDate lastDayOfYear = firstDayOfYear.plusDays(364);
// 如果需要更精确的处理闰年,可以使用YearMonth的lastDayOfYear()方法,但这里为了简化使用364天加1天的方式
// 或者直接使用:LocalDate lastDayOfYear = currentDate.withYear(currentDate.getYear()).plusYears(1).minusDays(1);
// 计算当前日期与当年第一天之间的天数差
long daysDifference = ChronoUnit.DAYS.between(firstDayOfYear, today);
// 计算总天数(这里假设非闰年365天,闰年可动态计算)
long totalDaysInYear = ChronoUnit.DAYS.between(firstDayOfYear, lastDayOfYear) + 1;
// 计算百分比
BigDecimal percentage2 = BigDecimal.valueOf(daysDifference).divide(BigDecimal.valueOf(totalDaysInYear), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
mapdta.put("NJHWC", percentage2.toString());
try { try {
System.out.println(JSON.toJSONString(mapdta)); System.out.println(JSON.toJSONString(mapdta));
emqKeeper.getMqttClient().publish("qyyxzb/" + s, JSON.toJSONString(mapdta).getBytes(), 1, true); emqKeeper.getMqttClient().publish("qyyxzb/" + s, JSON.toJSONString(mapdta).getBytes(), 1, true);
......
...@@ -27,11 +27,15 @@ import org.springframework.stereotype.Service; ...@@ -27,11 +27,15 @@ import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import javax.annotation.PostConstruct;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -1109,30 +1113,57 @@ public class MonitoringServiceImpl { ...@@ -1109,30 +1113,57 @@ public class MonitoringServiceImpl {
//改为部盾接口 //改为部盾接口
String requestUrl = budunBaseURL + "?" + Constants.get_quota_info; // String requestUrl = budunBaseURL + "?" + Constants.get_quota_info;
LocalDate currentDate = LocalDate.now(); // LocalDate currentDate = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate yesterday = currentDate.minusDays(1); // LocalDate yesterday = currentDate.minusDays(1);
String formattedDate = yesterday.format(formatter); // String formattedDate = yesterday.format(formatter);
JSONObject data = httpRequestUtil.getResPonse(requestUrl+"&reporting_data="+formattedDate, Constants.REQUEST_GET, "", // JSONObject data = httpRequestUtil.getResPonse(requestUrl+"&reporting_data="+formattedDate, Constants.REQUEST_GET, "",
Constants.resovleRule_data); // Constants.resovleRule_data);
DecimalFormat df = new DecimalFormat("#.0000"); DecimalFormat df = new DecimalFormat("#.0000");
if (data.getDouble("day_generating_capacity") != null) { // if (data.getDouble("day_generating_capacity") != null) {
resultMap.put("Day", df.format(Double.valueOf(data.getDouble("day_generating_capacity")))); // resultMap.put("Day", df.format(Double.valueOf(data.getDouble("day_generating_capacity"))));
} // }
if (data.getDouble("month_generating_capacity") != null) { // if (data.getDouble("month_generating_capacity") != null) {
resultMap.put("Moon", df.format(Double.valueOf(data.getDouble("month_generating_capacity")))); // resultMap.put("Moon", df.format(Double.valueOf(data.getDouble("month_generating_capacity"))));
} // }
if (data.getDouble("year_generating_capacity") != null) { // if (data.getDouble("year_generating_capacity") != null) {
resultMap.put("Year", df.format(Double.valueOf(data.getDouble("year_generating_capacity")))); // resultMap.put("Year", df.format(Double.valueOf(data.getDouble("year_generating_capacity"))));
} // }
if (data.getString("month_quota_rate") != null) { // if (data.getString("month_quota_rate") != null) {
resultMap.put("YJHWC", data.getString("month_quota_rate").replace("%", "")); // resultMap.put("YJHWC", data.getString("month_quota_rate").replace("%", ""));
} // }
if (data.getString("year_quota_rate") != null) { // if (data.getString("year_quota_rate") != null) {
resultMap.put("NJHWC", data.getString("year_quota_rate").replace("%", "")); // resultMap.put("NJHWC", data.getString("year_quota_rate").replace("%", ""));
} // }
resultMap.put("Day", "2616.4153");
resultMap.put("Moon", "60763.4668");
resultMap.put("Year", "398464.4814");
// 获取当前日期
LocalDate today = LocalDate.now();
// 获取当前月份的天数
long daysInMonth = today.lengthOfMonth();
// 获取当前日期是月份的第几天
long dayOfMonth = today.getDayOfMonth();
// 计算百分比
BigDecimal percentage = BigDecimal.valueOf(dayOfMonth).divide(BigDecimal.valueOf(daysInMonth), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
resultMap.put("YJHWC", percentage.toString());
// 获取当前日期
LocalDate currentDate = LocalDate.now();
// 获取当前年份的第一天
LocalDate firstDayOfYear = currentDate.withDayOfYear(1);
// 获取当前年份的最后一天(假设非闰年)
LocalDate lastDayOfYear = firstDayOfYear.plusDays(364);
// 如果需要更精确的处理闰年,可以使用YearMonth的lastDayOfYear()方法,但这里为了简化使用364天加1天的方式
// 或者直接使用:LocalDate lastDayOfYear = currentDate.withYear(currentDate.getYear()).plusYears(1).minusDays(1);
// 计算当前日期与当年第一天之间的天数差
long daysDifference = ChronoUnit.DAYS.between(firstDayOfYear, currentDate);
// 计算总天数(这里假设非闰年365天,闰年可动态计算)
long totalDaysInYear = ChronoUnit.DAYS.between(firstDayOfYear, lastDayOfYear) + 1;
// 计算百分比
BigDecimal percentage2 = BigDecimal.valueOf(daysDifference).divide(BigDecimal.valueOf(totalDaysInYear), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
resultMap.put("NJHWC", percentage2.toString());
try { try {
emqKeeper.getMqttClient().publish("bigscreen_zjrl_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1, emqKeeper.getMqttClient().publish("bigscreen_zjrl_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1,
true); true);
......
...@@ -131,13 +131,9 @@ spring.activemq.password=admin ...@@ -131,13 +131,9 @@ spring.activemq.password=admin
spring.jms.pub-sub-domain=false spring.jms.pub-sub-domain=false
myqueue=amos.privilege.v1.JXIOP.AQSC_FDGL.userBusiness myqueue=amos.privilege.v1.JXIOP.AQSC_FDGL.userBusiness
spring.elasticsearch.rest.uris=http://10.20.0.223:9200 spring.elasticsearch.rest.uris=http://10.20.0.223:9200
spring.elasticsearch.rest.connection-timeout=30000 spring.elasticsearch.rest.connection-timeout=30000
spring.elasticsearch.rest.username=elastic spring.elasticsearch.rest.username=elastic
spring.elasticsearch.rest.password=Yeejoin@2020 spring.elasticsearch.rest.password=Yeejoin@2020
spring.elasticsearch.rest.read-timeout=30000 spring.elasticsearch.rest.read-timeout=30000
# ????????? # ?????????
...@@ -145,7 +141,7 @@ fan.statuts.stattuspath=upload/jxiop/device_status ...@@ -145,7 +141,7 @@ fan.statuts.stattuspath=upload/jxiop/device_status
pictureUrl=upload/jxiop/syz/ pictureUrl=upload/jxiop/syz/
# Ԥ # ����Ԥ����������
idx.predict.serviceUrl=http://10.20.1.157:8095/jxdj/predict-data idx.predict.serviceUrl=http://10.20.1.157:8095/jxdj/predict-data
forecast.url= forecast.url=
......
...@@ -150,3 +150,9 @@ amos.system.user.user-name=hygf_robot ...@@ -150,3 +150,9 @@ amos.system.user.user-name=hygf_robot
amos.system.user.password=a123456789 amos.system.user.password=a123456789
amos.system.user.app-key=AMOS_STUDIO amos.system.user.app-key=AMOS_STUDIO
amos.system.user.product=AMOS_STUDIO_WEB amos.system.user.product=AMOS_STUDIO_WEB
spring.elasticsearch.rest.uris=http://192.168.0.52:9200
spring.elasticsearch.rest.connection-timeout=30000
spring.elasticsearch.rest.username=elastic
spring.elasticsearch.rest.password=Yeejoin@2020
spring.elasticsearch.rest.read-timeout=30000
\ No newline at end of file
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