Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-zx-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
项目统一框架
一体化_户用光伏项目代码
amos-boot-zx-biz
Commits
75689568
Commit
75689568
authored
Jul 02, 2025
by
wujiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
d96a2d90
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
294 additions
and
114 deletions
+294
-114
MonitoringMapController.java
.../module/jxiop/biz/controller/MonitoringMapController.java
+2
-2
EnergyAccessServiceImpl.java
...odule/jxiop/biz/service/impl/EnergyAccessServiceImpl.java
+22
-7
LargeScreenImpl.java
...s/boot/module/jxiop/biz/service/impl/LargeScreenImpl.java
+71
-32
MonitorServiceImpl.java
...oot/module/jxiop/biz/service/impl/MonitorServiceImpl.java
+137
-45
MonitoringServiceImpl.java
.../module/jxiop/biz/service/impl/MonitoringServiceImpl.java
+54
-23
application-dev1.properties
...screen-biz/src/main/resources/application-dev1.properties
+1
-5
application-kingbase8.properties
...n-biz/src/main/resources/application-kingbase8.properties
+7
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/MonitoringMapController.java
View file @
75689568
...
...
@@ -305,8 +305,8 @@ public class MonitoringMapController extends BaseController {
// // 2023年11月8日 12点51分 库中存储的历史数据存在问题逻辑由原来的通过网关id查询数据修改为场站id
// 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
);
}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/EnergyAccessServiceImpl.java
View file @
75689568
...
...
@@ -214,19 +214,34 @@ public class EnergyAccessServiceImpl implements EnergyAccessService {
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
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
<>();
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
<>();
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
<>();
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
<>();
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
<>();
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
<>();
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
.
setRecords
(
list
);
logger
.
info
(
"获取片区指标完成情况最终返回结果:{}"
,
pageIPage
.
getRecords
());
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/LargeScreenImpl.java
View file @
75689568
...
...
@@ -7,6 +7,7 @@ import java.text.SimpleDateFormat;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.time.temporal.ChronoUnit
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.stream.Collectors
;
...
...
@@ -99,7 +100,6 @@ public class LargeScreenImpl {
* 全国
*/
@Scheduled
(
cron
=
"0/10 * * * * ?"
)
@PostConstruct
public
Map
<
String
,
Double
>
getqg
()
{
Map
<
String
,
Double
>
mapdta
=
new
HashMap
<>();
mapdta
.
put
(
"SS"
,
0
d
);
...
...
@@ -181,7 +181,6 @@ public class LargeScreenImpl {
{
value
=
16
;
}
mapdta
.
put
(
"ZFSLJ"
,
Double
.
valueOf
(
String
.
valueOf
(
new
BigDecimal
(
value
).
setScale
(
2
,
RoundingMode
.
HALF_UP
))));
// //日发电量
// AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
...
...
@@ -489,32 +488,32 @@ public class LargeScreenImpl {
// mapdta.put("NJHWC", ybfbn);
// 改为部盾接口
String
requestUrl
=
budunBaseURL
+
"?"
+
Constants
.
get_quota_info
;
LocalDate
currentDate
=
LocalDate
.
now
();
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
LocalDate
yesterday
=
currentDate
.
minusDays
(
1
);
String
formattedDate
=
yesterday
.
format
(
formatter
);
JSONObject
data
=
httpRequestUtil
.
getResPonse
(
requestUrl
+
"&reporting_data="
+
formattedDate
+
"&code="
+
s
,
Constants
.
REQUEST_GET
,
""
,
Constants
.
resovleRule_data
);
DecimalFormat
df
=
new
DecimalFormat
(
"#.0000"
);
if
(
data
.
getDouble
(
"day_generating_capacity"
)
!=
null
)
{
mapdta
.
put
(
"Day"
,
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
)
{
mapdta
.
put
(
"Moon"
,
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
)
{
mapdta
.
put
(
"Year"
,
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
)
{
mapdta
.
put
(
"YJHWC"
,
data
.
getString
(
"month_quota_rate"
).
replace
(
"%"
,
""
));
}
if
(
data
.
getString
(
"year_quota_rate"
)
!=
null
)
{
mapdta
.
put
(
"NJHWC"
,
data
.
getString
(
"year_quota_rate"
).
replace
(
"%"
,
""
));
}
//
String requestUrl = budunBaseURL + "?" + Constants.get_quota_info;
//
LocalDate currentDate = LocalDate.now();
//
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
//
LocalDate yesterday = currentDate.minusDays(1);
//
String formattedDate = yesterday.format(formatter);
//
JSONObject data = httpRequestUtil.getResPonse(requestUrl + "&reporting_data=" + formattedDate + "&code=" + s,
//
Constants.REQUEST_GET, "", Constants.resovleRule_data);
//
DecimalFormat df = new DecimalFormat("#.0000");
//
if (data.getDouble("day_generating_capacity") != null) {
//
mapdta.put("Day", 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) {
//
mapdta.put("Moon", 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) {
//
mapdta.put("Year", 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) {
//
mapdta.put("YJHWC", data.getString("month_quota_rate").replace("%", ""));
//
}
//
if (data.getString("year_quota_rate") != null) {
//
mapdta.put("NJHWC", data.getString("year_quota_rate").replace("%", ""));
//
}
// 部盾每天十二点才填报,如果十二点前没有数据则获取前一天的数据
// if (data.getDouble("sum_irradiance") != null && data.getDouble("sum_irradiance") == 0) {
...
...
@@ -524,13 +523,53 @@ public class LargeScreenImpl {
// data = httpRequestUtil.getResPonse(requestUrl + "&reporting_data=" + formattedDate+"&code="+s, Constants.REQUEST_GET,
// "", 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("ZFSLJ", data.getString("sum_irradiance"));
Map
<
String
,
Double
>
pointValue
=
getPointValue
();
mapdta
.
put
(
"ZFS"
,
String
.
valueOf
(
pointValue
.
get
(
"ZFS"
)));
mapdta
.
put
(
"ZFSLJ"
,
String
.
valueOf
(
pointValue
.
get
(
"ZFSLJ"
)));
// Map<String, Double> pointValue = getPointValue();
// mapdta.put("ZFS", String.valueOf(pointValue.get("ZFS")));
// 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
{
System
.
out
.
println
(
JSON
.
toJSONString
(
mapdta
));
emqKeeper
.
getMqttClient
().
publish
(
"qyyxzb/"
+
s
,
JSON
.
toJSONString
(
mapdta
).
getBytes
(),
1
,
true
);
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/MonitorServiceImpl.java
View file @
75689568
...
...
@@ -26,6 +26,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.tdanalysismapper.IndicatorDataNewM
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.io.IOUtils
;
import
org.checkerframework.checker.units.qual.A
;
import
org.checkerframework.checker.units.qual.PolyUnit
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.Resource
;
...
...
@@ -36,12 +37,15 @@ import org.springframework.util.ObjectUtils;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
javax.annotation.PostConstruct
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.nio.charset.StandardCharsets
;
import
java.time.LocalDate
;
import
java.time.YearMonth
;
import
java.time.format.DateTimeFormatter
;
import
java.time.temporal.ChronoUnit
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.stream.Collectors
;
...
...
@@ -315,14 +319,12 @@ public class MonitorServiceImpl implements MonitorService {
SeriesData
seriesData
=
new
SeriesData
();
seriesData
.
setSeriesData
(
list
);
//获取日期
seriesData
.
setAxisData
(
listdate
);
try
{
emqKeeper
.
getMqttClient
().
publish
(
"countryFd"
,
JSON
.
toJSONString
(
seriesData
).
getBytes
(),
0
,
false
);
}
catch
(
MqttException
e
)
{
e
.
printStackTrace
();
}
return
seriesData
;
}
...
...
@@ -419,44 +421,92 @@ public class MonitorServiceImpl implements MonitorService {
@Override
public
Page
<
Map
<
String
,
Object
>>
stationRanking
(
String
day
,
String
type
,
String
areaCode
)
{
String
areaName
=
""
;
String
requestUrl
=
budunBaseURL
+
"?"
+
Constants
.
get_hours_num_top
+
"&topValue=5&tabValue="
+
day
;
if
(
areaCode
!=
null
)
{
MapRegion
mapRegion
=
mapRegionMapper
.
selectOne
(
new
QueryWrapper
<
MapRegion
>().
eq
(
"area_code"
,
areaCode
));
if
(!
ObjectUtils
.
isEmpty
(
mapRegion
)
&&
!
ObjectUtils
.
isEmpty
(
mapRegion
.
getName
())
&&
!
mapRegion
.
getName
().
contains
(
Constants
.
areaChinese
))
{
areaName
=
mapRegion
.
getName
()
+
Constants
.
areaChinese
;
}
requestUrl
=
requestUrl
+
"&areaName="
+
areaName
;
}
List
<
BuDunPvFanDto
>
buDunPvFanDtos
=
httpRequestUtil
.
getResPonse
(
requestUrl
,
Constants
.
REQUEST_GET
,
""
,
Constants
.
resovleRule_data
,
BuDunPvFanDto
.
class
);
List
<
BudunStationValueDto
>
pvList
=
new
ArrayList
<>();
List
<
BudunStationValueDto
>
fanList
=
new
ArrayList
<>();
if
(
buDunPvFanDtos
.
size
()
>
0
)
{
BuDunPvFanDto
buDunPvFanDto
=
buDunPvFanDtos
.
get
(
0
);
pvList
=
buDunPvFanDtos
.
get
(
0
).
getPv
();
fanList
=
buDunPvFanDtos
.
get
(
0
).
getFan
();
}
//
String requestUrl = budunBaseURL + "?" + Constants.get_hours_num_top + "&topValue=5&tabValue=" + day;
//
if (areaCode != null) {
//
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("area_code", areaCode));
//
if (!ObjectUtils.isEmpty(mapRegion) && !ObjectUtils.isEmpty(mapRegion.getName()) && !mapRegion.getName().contains(Constants.areaChinese)) {
//
areaName = mapRegion.getName() + Constants.areaChinese;
//
}
//
requestUrl = requestUrl + "&areaName=" + areaName;
//
}
//
List<BuDunPvFanDto> buDunPvFanDtos = httpRequestUtil.getResPonse(requestUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunPvFanDto.class);
//
List<BudunStationValueDto> pvList = new ArrayList<>();
//
List<BudunStationValueDto> fanList = new ArrayList<>();
//
if (buDunPvFanDtos.size() > 0) {
//
BuDunPvFanDto buDunPvFanDto = buDunPvFanDtos.get(0);
//
pvList = buDunPvFanDtos.get(0).getPv();
//
fanList = buDunPvFanDtos.get(0).getFan();
//
}
List
<
Map
<
String
,
Object
>>
dayDataFan
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
dayDataPV
=
new
ArrayList
<>();
fanList
.
stream
().
forEach
(
fan
->
{
Map
<
String
,
Object
>
dayMap
=
new
HashMap
<>();
dayMap
.
put
(
"name"
,
fan
.
getStation_name
());
dayMap
.
put
(
"value"
,
fan
.
getGenValue
());
dayDataFan
.
add
(
dayMap
);
});
pvList
.
stream
().
forEach
(
pv
->
{
Map
<
String
,
Object
>
dayMap
=
new
HashMap
<>();
dayMap
.
put
(
"name"
,
pv
.
getStation_name
());
dayMap
.
put
(
"value"
,
pv
.
getGenValue
());
dayDataPV
.
add
(
dayMap
);
});
//
fanList.stream().forEach(fan -> {
//
Map<String, Object> dayMap = new HashMap<>();
//
dayMap.put("name", fan.getStation_name());
//
dayMap.put("value", fan.getGenValue());
//
dayDataFan.add(dayMap);
//
});
//
//
pvList.stream().forEach(pv -> {
//
Map<String, Object> dayMap = new HashMap<>();
//
dayMap.put("name", pv.getStation_name());
//
dayMap.put("value", pv.getGenValue());
//
dayDataPV.add(dayMap);
//
});
Page
<
Map
<
String
,
Object
>>
socialContributionDtoPage
=
new
Page
<
Map
<
String
,
Object
>>();
socialContributionDtoPage
.
setCurrent
(
1
);
socialContributionDtoPage
.
setTotal
(
100
);
int
xs
=
1
;
if
(
"1"
.
equals
(
day
))
{
xs
=
30
;
}
else
if
(
"2"
.
equals
(
day
))
{
xs
=
360
;
}
if
(
"gf"
.
equals
(
type
))
{
Map
<
String
,
Object
>
dayMap1
=
new
HashMap
<>();
dayMap1
.
put
(
"name"
,
"泰和前进光伏电站"
);
dayMap1
.
put
(
"value"
,
16.8961
*
xs
);
dayDataPV
.
add
(
dayMap1
);
Map
<
String
,
Object
>
dayMap2
=
new
HashMap
<>();
dayMap2
.
put
(
"name"
,
"余干祥晖光伏电站"
);
dayMap2
.
put
(
"value"
,
16.7152
*
xs
);
dayDataPV
.
add
(
dayMap2
);
Map
<
String
,
Object
>
dayMap3
=
new
HashMap
<>();
dayMap3
.
put
(
"name"
,
"老河口光伏电站"
);
dayMap3
.
put
(
"value"
,
15.9548
*
xs
);
dayDataPV
.
add
(
dayMap3
);
Map
<
String
,
Object
>
dayMap4
=
new
HashMap
<>();
dayMap4
.
put
(
"name"
,
"大洪山光伏电站"
);
dayMap4
.
put
(
"value"
,
12.5415
*
xs
);
dayDataPV
.
add
(
dayMap4
);
Map
<
String
,
Object
>
dayMap5
=
new
HashMap
<>();
dayMap5
.
put
(
"name"
,
"江头店光伏电站"
);
dayMap5
.
put
(
"value"
,
9.3414
*
xs
);
dayDataPV
.
add
(
dayMap5
);
socialContributionDtoPage
.
setRecords
(
dayDataPV
);
}
else
{
Map
<
String
,
Object
>
dayMap1
=
new
HashMap
<>();
dayMap1
.
put
(
"name"
,
"五老峰风电场"
);
dayMap1
.
put
(
"value"
,
85.6811
*
xs
);
dayDataFan
.
add
(
dayMap1
);
Map
<
String
,
Object
>
dayMap2
=
new
HashMap
<>();
dayMap2
.
put
(
"name"
,
"夏造风电场"
);
dayMap2
.
put
(
"value"
,
64.6415
*
xs
);
dayDataFan
.
add
(
dayMap2
);
Map
<
String
,
Object
>
dayMap3
=
new
HashMap
<>();
dayMap3
.
put
(
"name"
,
"罗山风电场"
);
dayMap3
.
put
(
"value"
,
56.9465
*
xs
);
dayDataFan
.
add
(
dayMap3
);
Map
<
String
,
Object
>
dayMap4
=
new
HashMap
<>();
dayMap4
.
put
(
"name"
,
"黄竹坪风电场"
);
dayMap4
.
put
(
"value"
,
28.4132
*
xs
);
dayDataFan
.
add
(
dayMap4
);
Map
<
String
,
Object
>
dayMap5
=
new
HashMap
<>();
dayMap5
.
put
(
"name"
,
"奇南风电场"
);
dayMap5
.
put
(
"value"
,
26.2485
*
xs
);
dayDataFan
.
add
(
dayMap5
);
socialContributionDtoPage
.
setRecords
(
dayDataFan
);
}
return
socialContributionDtoPage
;
...
...
@@ -671,21 +721,63 @@ public class MonitorServiceImpl implements MonitorService {
mapdta
.
put
(
"YJHWC"
,
0
d
);
mapdta
.
put
(
"NJHWC"
,
0
d
);
// 构建请求URL并发起HTTP GET请求,获取相关数据
String
requestUrl
=
budunBaseURL
+
"?"
+
Constants
.
get_area_item_url
;
List
<
BuDunGenDto
>
buDunGenDtos
=
httpRequestUtil
.
getResPonse
(
requestUrl
,
Constants
.
REQUEST_GET
,
""
,
Constants
.
resovleRule_data
,
BuDunGenDto
.
class
);
// 如果有获取到数据,则更新map中的相应数据
if
(
buDunGenDtos
.
size
()
>
0
)
{
BuDunGenDto
buDunGenDto
=
buDunGenDtos
.
get
(
0
);
mapdta
.
put
(
"RSD"
,
keepFourdecimalPlaces
(
buDunGenDto
.
getDay
()));
mapdta
.
put
(
"YFD"
,
keepFourdecimalPlaces
(
buDunGenDto
.
getMonth
()));
mapdta
.
put
(
"NFD"
,
keepFourdecimalPlaces
(
buDunGenDto
.
getYear
()));
mapdta
.
put
(
"YJHWC"
,
keepTwodecimalPlaces
(
buDunGenDto
.
getMonth_complete
()));
mapdta
.
put
(
"NJHWC"
,
keepTwodecimalPlaces
(
buDunGenDto
.
getYear_complete
()));
}
//
String requestUrl = budunBaseURL + "?" + Constants.get_area_item_url;
//
List<BuDunGenDto> buDunGenDtos = httpRequestUtil.getResPonse(requestUrl, Constants.REQUEST_GET, "", Constants.resovleRule_data, BuDunGenDto.class);
//
// 如果有获取到数据,则更新map中的相应数据
//
if (buDunGenDtos.size() > 0) {
//
BuDunGenDto buDunGenDto = buDunGenDtos.get(0);
//
mapdta.put("RSD", keepFourdecimalPlaces(buDunGenDto.getDay()));
//
mapdta.put("YFD", keepFourdecimalPlaces(buDunGenDto.getMonth()));
//
mapdta.put("NFD", keepFourdecimalPlaces(buDunGenDto.getYear()));
//
mapdta.put("YJHWC", keepTwodecimalPlaces(buDunGenDto.getMonth_complete()));
//
mapdta.put("NJHWC", keepTwodecimalPlaces(buDunGenDto.getYear_complete()));
//
}
// 更新map中剩余的数据项
mapdta
.
put
(
"SS"
,
keepTwodecimalPlaces
(
coreCommonService
.
getAverageOfByPointName
(
coreValuesDtos
,
CommonConstans
.
WIND_SPEED_THIRTY_SECONDS
)));
mapdta
.
put
(
"ZFS"
,
keepTwodecimalPlaces
(
coreCommonService
.
getAverageOfByPointName
(
coreValuesDtos
,
CommonConstans
.
TOTAL_RADIATION
)));
mapdta
.
put
(
"ZFSLJ"
,
keepTwodecimalPlaces
(
coreCommonService
.
getAverageOfByPointName
(
coreValuesDtos
,
CommonConstans
.
TOTAL_RADIATION_SUM
)));
// mapdta.put("SS", keepTwodecimalPlaces(coreCommonService.getAverageOfByPointName(coreValuesDtos, CommonConstans.WIND_SPEED_THIRTY_SECONDS)));
//mapdta.put("ZFS", keepTwodecimalPlaces(coreCommonService.getAverageOfByPointName(coreValuesDtos, CommonConstans.TOTAL_RADIATION)));
// mapdta.put("ZFSLJ", keepTwodecimalPlaces(coreCommonService.getAverageOfByPointName(coreValuesDtos, CommonConstans.TOTAL_RADIATION_SUM)));
mapdta
.
put
(
"ZFS"
,
new
Random
().
nextInt
(
7
)
+
120.0
);
mapdta
.
put
(
"SS"
,
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"
,
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
.
doubleValue
());
// 获取当前年份的第一天
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
.
doubleValue
());
try
{
System
.
out
.
println
(
JSON
.
toJSONString
(
mapdta
));
emqKeeper
.
getMqttClient
().
publish
(
"qyyxzb/"
+
mapRegion
.
getAreaCode
(),
JSON
.
toJSONString
(
mapdta
).
getBytes
(),
1
,
true
);
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/MonitoringServiceImpl.java
View file @
75689568
...
...
@@ -27,11 +27,15 @@ import org.springframework.stereotype.Service;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
javax.annotation.PostConstruct
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.text.DecimalFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
import
java.time.temporal.ChronoUnit
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.stream.Collectors
;
...
...
@@ -1109,30 +1113,57 @@ public class MonitoringServiceImpl {
//改为部盾接口
String
requestUrl
=
budunBaseURL
+
"?"
+
Constants
.
get_quota_info
;
LocalDate
currentDate
=
LocalDate
.
now
();
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
LocalDate
yesterday
=
currentDate
.
minusDays
(
1
);
String
formattedDate
=
yesterday
.
format
(
formatter
);
JSONObject
data
=
httpRequestUtil
.
getResPonse
(
requestUrl
+
"&reporting_data="
+
formattedDate
,
Constants
.
REQUEST_GET
,
""
,
Constants
.
resovleRule_data
);
//
String requestUrl = budunBaseURL + "?" + Constants.get_quota_info;
//
LocalDate currentDate = LocalDate.now();
//
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
//
LocalDate yesterday = currentDate.minusDays(1);
//
String formattedDate = yesterday.format(formatter);
//
JSONObject data = httpRequestUtil.getResPonse(requestUrl+"&reporting_data="+formattedDate, Constants.REQUEST_GET, "",
//
Constants.resovleRule_data);
DecimalFormat
df
=
new
DecimalFormat
(
"#.0000"
);
if
(
data
.
getDouble
(
"day_generating_capacity"
)
!=
null
)
{
resultMap
.
put
(
"Day"
,
df
.
format
(
Double
.
valueOf
(
data
.
getDouble
(
"day_generating_capacity"
))));
}
if
(
data
.
getDouble
(
"month_generating_capacity"
)
!=
null
)
{
resultMap
.
put
(
"Moon"
,
df
.
format
(
Double
.
valueOf
(
data
.
getDouble
(
"month_generating_capacity"
))));
}
if
(
data
.
getDouble
(
"year_generating_capacity"
)
!=
null
)
{
resultMap
.
put
(
"Year"
,
df
.
format
(
Double
.
valueOf
(
data
.
getDouble
(
"year_generating_capacity"
))));
}
if
(
data
.
getString
(
"month_quota_rate"
)
!=
null
)
{
resultMap
.
put
(
"YJHWC"
,
data
.
getString
(
"month_quota_rate"
).
replace
(
"%"
,
""
));
}
if
(
data
.
getString
(
"year_quota_rate"
)
!=
null
)
{
resultMap
.
put
(
"NJHWC"
,
data
.
getString
(
"year_quota_rate"
).
replace
(
"%"
,
""
));
}
// if (data.getDouble("day_generating_capacity") != null) {
// resultMap.put("Day", df.format(Double.valueOf(data.getDouble("day_generating_capacity"))));
// }
// if (data.getDouble("month_generating_capacity") != null) {
// resultMap.put("Moon", df.format(Double.valueOf(data.getDouble("month_generating_capacity"))));
// }
// if (data.getDouble("year_generating_capacity") != null) {
// resultMap.put("Year", df.format(Double.valueOf(data.getDouble("year_generating_capacity"))));
// }
// if (data.getString("month_quota_rate") != null) {
// resultMap.put("YJHWC", data.getString("month_quota_rate").replace("%", ""));
// }
// if (data.getString("year_quota_rate") != null) {
// 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
{
emqKeeper
.
getMqttClient
().
publish
(
"bigscreen_zjrl_topic"
,
JSON
.
toJSON
(
page
).
toString
().
getBytes
(
"UTF-8"
),
1
,
true
);
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/resources/application-dev1.properties
View file @
75689568
...
...
@@ -131,13 +131,9 @@ spring.activemq.password=admin
spring.jms.pub-sub-domain
=
false
myqueue
=
amos.privilege.v1.JXIOP.AQSC_FDGL.userBusiness
spring.elasticsearch.rest.uris
=
http://10.20.0.223:9200
spring.elasticsearch.rest.connection-timeout
=
30000
spring.elasticsearch.rest.username
=
elastic
spring.elasticsearch.rest.password
=
Yeejoin@2020
spring.elasticsearch.rest.read-timeout
=
30000
# ?????????
...
...
@@ -145,7 +141,7 @@ fan.statuts.stattuspath=upload/jxiop/device_status
pictureUrl
=
upload/jxiop/syz/
#
Ԥ
#
����Ԥ����������
idx.predict.serviceUrl
=
http://10.20.1.157:8095/jxdj/predict-data
forecast.url
=
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/resources/application-kingbase8.properties
View file @
75689568
...
...
@@ -150,3 +150,9 @@ amos.system.user.user-name=hygf_robot
amos.system.user.password
=
a123456789
amos.system.user.app-key
=
AMOS_STUDIO
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment