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
41516a31
Commit
41516a31
authored
Jul 03, 2024
by
wujiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改大屏卡片问题
parent
36938861
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
74 deletions
+98
-74
StationCacheDataInit.java
.../boot/module/jxiop/biz/initdata/StationCacheDataInit.java
+13
-11
LargeScreenImpl.java
...s/boot/module/jxiop/biz/service/impl/LargeScreenImpl.java
+64
-56
MonitoringServiceImpl.java
.../module/jxiop/biz/service/impl/MonitoringServiceImpl.java
+18
-5
application-dev1.properties
...screen-biz/src/main/resources/application-dev1.properties
+3
-2
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/initdata/StationCacheDataInit.java
View file @
41516a31
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
initdata
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Component
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.MapRegion
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.Region
;
...
...
@@ -12,16 +24,6 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.QueryDto;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.mapper2.SjglZsjZsbtzMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Component
public
class
StationCacheDataInit
implements
CommandLineRunner
{
...
...
@@ -42,7 +44,7 @@ public class StationCacheDataInit implements CommandLineRunner {
public
void
run
(
String
...
args
)
throws
Exception
{
redisTemplate
.
delete
(
"station_info_cache_bigscreen"
);
List
<
StationCacheInfoDto
>
stationCacheInfoDtos
=
new
ArrayList
<>();
List
<
Region
>
regionList
=
regionMapper
.
selectList
(
new
QueryWrapper
<
Region
>().
eq
(
"\"LEVEL\""
,
1
));
List
<
Region
>
regionList
=
regionMapper
.
selectList
(
new
LambdaQueryWrapper
<
Region
>().
eq
(
Region:
:
getLevel_
,
1
));
List
<
MapRegion
>
mapRegionList
=
mapRegionMapper
.
selectList
(
new
QueryWrapper
<
MapRegion
>().
isNotNull
(
"name"
));
List
<
StationBasic
>
stationBasicList
=
stationBasicMapper
.
selectList
(
new
QueryWrapper
<
StationBasic
>().
isNotNull
(
"belong_area"
).
isNotNull
(
"fan_gateway_id"
));
stationBasicList
.
forEach
(
stationBasic
->
{
...
...
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 @
41516a31
...
...
@@ -131,29 +131,26 @@ public class LargeScreenImpl {
// }
// }
//改为部盾接口
//
改为部盾接口
String
requestUrl
=
Constants
.
BASE_URL
+
"?"
+
Constants
.
get_quota_info
;
LocalDate
currentDate
=
LocalDate
.
now
();
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
String
formattedDate
=
currentDate
.
format
(
formatter
);
JSONObject
data
=
httpRequestUtil
.
getResPonse
(
requestUrl
+
"&reporting_data="
+
formattedDate
,
Constants
.
REQUEST_GET
,
""
,
Constants
.
resovleRule_data
);
if
(
data
!=
null
)
{
//部盾每天十二点才填报,如果十二点前没有数据则获取前一天的数据
if
(
data
.
getDouble
(
"sum_irradiance"
)==
0
)
{
// 计算昨天日期
LocalDate
yesterday
=
currentDate
.
minusDays
(
1
);
formattedDate
=
yesterday
.
format
(
formatter
);
data
=
httpRequestUtil
.
getResPonse
(
requestUrl
+
"&reporting_data="
+
formattedDate
,
Constants
.
REQUEST_GET
,
""
,
Constants
.
resovleRule_data
);
}
mapdta
.
put
(
"SS"
,
data
.
getDouble
(
"average_wind_speed"
));
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
String
formattedDate
=
currentDate
.
format
(
formatter
);
JSONObject
data
=
httpRequestUtil
.
getResPonse
(
requestUrl
+
"&reporting_data="
+
formattedDate
,
Constants
.
REQUEST_GET
,
""
,
Constants
.
resovleRule_data
);
if
(
data
!=
null
)
{
// 部盾每天十二点才填报,如果十二点前没有数据则获取前一天的数据
if
(
data
.
getDouble
(
"sum_irradiance"
)
!=
null
&&
data
.
getDouble
(
"sum_irradiance"
)
==
0
)
{
// 计算昨天日期
LocalDate
yesterday
=
currentDate
.
minusDays
(
1
);
formattedDate
=
yesterday
.
format
(
formatter
);
data
=
httpRequestUtil
.
getResPonse
(
requestUrl
+
"&reporting_data="
+
formattedDate
,
Constants
.
REQUEST_GET
,
""
,
Constants
.
resovleRule_data
);
}
mapdta
.
put
(
"SS"
,
data
.
getDouble
(
"average_wind_speed"
));
mapdta
.
put
(
"ZFS"
,
data
.
getDouble
(
"avg_irradiance"
));
mapdta
.
put
(
"ZFSLJ"
,
data
.
getDouble
(
"sum_irradiance"
));
}
}
// //日发电量
// AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
...
...
@@ -246,7 +243,7 @@ public class LargeScreenImpl {
}
@Scheduled
(
cron
=
"0/10 * * * * ?"
)
@PostConstruct
//
@PostConstruct
private
void
sendQYYXZBMqtt
()
{
List
<
StationCacheInfoDto
>
listStationCacheInfoDto
=
commonServiceImpl
.
getListStationCacheInfoDto
();
Map
<
String
,
List
<
StationCacheInfoDto
>>
belongAreaList
=
listStationCacheInfoDto
.
stream
()
...
...
@@ -261,16 +258,16 @@ public class LargeScreenImpl {
/**
* 区域
**/
public
Map
<
String
,
Double
>
getqy
(
List
<
StationCacheInfoDto
>
gatewayId
,
String
s
)
{
Map
<
String
,
Double
>
mapdta
=
new
HashMap
<>();
mapdta
.
put
(
"SS"
,
0
d
);
mapdta
.
put
(
"ZFS"
,
0
d
);
mapdta
.
put
(
"ZFSLJ"
,
0
d
);
mapdta
.
put
(
"RSD"
,
0
d
);
mapdta
.
put
(
"YFD"
,
0
d
);
mapdta
.
put
(
"NFD"
,
0
d
);
mapdta
.
put
(
"YJHWC"
,
0
d
);
mapdta
.
put
(
"NJHWC"
,
0
d
);
public
Map
<
String
,
String
>
getqy
(
List
<
StationCacheInfoDto
>
gatewayId
,
String
s
)
{
Map
<
String
,
String
>
mapdta
=
new
HashMap
<>();
mapdta
.
put
(
"SS"
,
"0"
);
mapdta
.
put
(
"ZFS"
,
"0"
);
mapdta
.
put
(
"ZFSLJ"
,
"0"
);
mapdta
.
put
(
"RSD"
,
"0"
);
mapdta
.
put
(
"YFD"
,
"0"
);
mapdta
.
put
(
"NFD"
,
"0"
);
mapdta
.
put
(
"YJHWC"
,
"0"
);
mapdta
.
put
(
"NJHWC"
,
"0"
);
// // 平均数
// List<String> value = new ArrayList<>();
// List<String> ids = new ArrayList<>();
...
...
@@ -404,35 +401,46 @@ public class LargeScreenImpl {
// Double ybfbn = sumValuen > 0 ? mapdta.get("NFD") / sumValuen * 100 : 0;
// ybfbn = new BigDecimal(ybfbn).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
// mapdta.put("NJHWC", ybfbn);
//改为部盾接口
//
改为部盾接口
String
requestUrl
=
Constants
.
BASE_URL
+
"?"
+
Constants
.
get_quota_info
;
LocalDate
currentDate
=
LocalDate
.
now
();
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
String
formattedDate
=
currentDate
.
format
(
formatter
);
JSONObject
data
=
httpRequestUtil
.
getResPonse
(
requestUrl
+
"&reporting_data="
+
formattedDate
,
Constants
.
REQUEST_GET
,
""
,
Constants
.
resovleRule_data
);
mapdta
.
put
(
"Day"
,
data
.
getDouble
(
"day_generating_capacity"
));
mapdta
.
put
(
"Moon"
,
data
.
getDouble
(
"month_generating_capacity"
));
mapdta
.
put
(
"Year"
,
data
.
getDouble
(
"year_generating_capacity"
));
mapdta
.
put
(
"YJHWC"
,
Double
.
valueOf
(
data
.
getString
(
"month_quota_rate"
).
replace
(
"%"
,
""
)));
mapdta
.
put
(
"NJHWC"
,
Double
.
valueOf
(
data
.
getString
(
"year_quota_rate"
).
replace
(
"%"
,
""
)));
//部盾每天十二点才填报,如果十二点前没有数据则获取前一天的数据
if
(
data
.
getDouble
(
"sum_irradiance"
)==
0
)
{
// 计算昨天日期
LocalDate
yesterday
=
currentDate
.
minusDays
(
1
);
formattedDate
=
yesterday
.
format
(
formatter
);
data
=
httpRequestUtil
.
getResPonse
(
requestUrl
+
"&reporting_data="
+
formattedDate
,
Constants
.
REQUEST_GET
,
""
,
Constants
.
resovleRule_data
);
}
mapdta
.
put
(
"SS"
,
data
.
getDouble
(
"average_wind_speed"
));
mapdta
.
put
(
"ZFS"
,
data
.
getDouble
(
"avg_irradiance"
));
mapdta
.
put
(
"ZFSLJ"
,
data
.
getDouble
(
"sum_irradiance"
));
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
);
String
formattedDate
=
currentDate
.
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
(
"day_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
(
"day_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
)
{
// 计算昨天日期
LocalDate
yesterday
=
currentDate
.
minusDays
(
1
);
formattedDate
=
yesterday
.
format
(
formatter
);
data
=
httpRequestUtil
.
getResPonse
(
requestUrl
+
"&reporting_data="
+
formattedDate
,
Constants
.
REQUEST_GET
,
""
,
Constants
.
resovleRule_data
);
}
mapdta
.
put
(
"SS"
,
data
.
getString
(
"average_wind_speed"
));
mapdta
.
put
(
"ZFS"
,
data
.
getString
(
"avg_irradiance"
));
mapdta
.
put
(
"ZFSLJ"
,
data
.
getString
(
"sum_irradiance"
));
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/MonitoringServiceImpl.java
View file @
41516a31
...
...
@@ -28,6 +28,7 @@ import org.springframework.util.ObjectUtils;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
java.math.BigDecimal
;
import
java.text.DecimalFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
...
...
@@ -1112,11 +1113,23 @@ public class MonitoringServiceImpl {
String
formattedDate
=
currentDate
.
format
(
formatter
);
JSONObject
data
=
httpRequestUtil
.
getResPonse
(
requestUrl
+
"&reporting_data="
+
formattedDate
,
Constants
.
REQUEST_GET
,
""
,
Constants
.
resovleRule_data
);
resultMap
.
put
(
"Day"
,
data
.
getString
(
"day_generating_capacity"
));
resultMap
.
put
(
"Moon"
,
data
.
getString
(
"month_generating_capacity"
));
resultMap
.
put
(
"Year"
,
data
.
getString
(
"year_generating_capacity"
));
resultMap
.
put
(
"YJHWC"
,
data
.
getString
(
"month_quota_rate"
).
replace
(
"%"
,
""
));
resultMap
.
put
(
"NJHWC"
,
data
.
getString
(
"year_quota_rate"
).
replace
(
"%"
,
""
));
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
(
"%"
,
""
));
}
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 @
41516a31
...
...
@@ -148,4 +148,5 @@ pictureUrl=upload/jxiop/syz/
# Ԥ
idx.predict.serviceUrl
=
http://10.20.1.157:8095/jxdj/predict-data
forecast.url
=
\ No newline at end of file
forecast.url
=
logic
=
\ 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