Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
4a6657ae
Commit
4a6657ae
authored
Aug 29, 2023
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改代码
parent
c158ee73
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
12 deletions
+38
-12
LargeScreenImpl.java
...s/boot/module/jxiop/biz/service/impl/LargeScreenImpl.java
+38
-12
No files found.
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 @
4a6657ae
...
@@ -2,10 +2,13 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
...
@@ -2,10 +2,13 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
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.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationPlan
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationPlan
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationPlanMapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationPlanMapper
;
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.SeriesData
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.SeriesData
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.utils.DateUtil
;
import
com.yeejoin.amos.boot.module.jxiop.biz.utils.DateUtil
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.elasticsearch.search.aggregations.Aggregation
;
import
org.elasticsearch.search.aggregations.Aggregation
;
...
@@ -23,6 +26,7 @@ import java.text.DecimalFormat;
...
@@ -23,6 +26,7 @@ import java.text.DecimalFormat;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
/**
* @description:
* @description:
...
@@ -49,6 +53,7 @@ public class LargeScreenImpl {
...
@@ -49,6 +53,7 @@ public class LargeScreenImpl {
/**
/**
* 全国
* 全国
*/
*/
@Scheduled
(
cron
=
"0/10 * * * * ?"
)
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"
,
0
d
);
mapdta
.
put
(
"SS"
,
0
d
);
...
@@ -149,11 +154,23 @@ public class LargeScreenImpl {
...
@@ -149,11 +154,23 @@ public class LargeScreenImpl {
}
}
@Scheduled
(
cron
=
"0/10 * * * * ?"
)
private
void
sendQYYXZBMqtt
(){
List
<
StationCacheInfoDto
>
listStationCacheInfoDto
=
commonServiceImpl
.
getListStationCacheInfoDto
();
Map
<
String
,
List
<
StationCacheInfoDto
>>
belongAreaList
=
listStationCacheInfoDto
.
stream
().
collect
(
Collectors
.
groupingBy
(
StationCacheInfoDto:
:
getAreaCode
));
for
(
String
s
:
belongAreaList
.
keySet
())
{
List
<
String
>
ids
=
belongAreaList
.
get
(
s
).
stream
().
map
(
StationCacheInfoDto:
:
getFanGatewayId
).
collect
(
Collectors
.
toList
());
getqy
(
ids
,
s
);
}
}
/**
/**
* 区域
* 区域
**/
**/
public
Map
<
String
,
Double
>
getqy
(
List
<
String
>
gatewayId
)
{
public
Map
<
String
,
Double
>
getqy
(
List
<
String
>
gatewayId
,
String
s
)
{
Map
<
String
,
Double
>
mapdta
=
new
HashMap
<>();
Map
<
String
,
Double
>
mapdta
=
new
HashMap
<>();
mapdta
.
put
(
"SS"
,
0
d
);
mapdta
.
put
(
"SS"
,
0
d
);
mapdta
.
put
(
"ZFS"
,
0
d
);
mapdta
.
put
(
"ZFS"
,
0
d
);
...
@@ -246,7 +263,7 @@ public class LargeScreenImpl {
...
@@ -246,7 +263,7 @@ public class LargeScreenImpl {
ybfbn
=
new
BigDecimal
(
ybfbn
).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
();
ybfbn
=
new
BigDecimal
(
ybfbn
).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
();
mapdta
.
put
(
"NJHWC"
,
ybfbn
);
mapdta
.
put
(
"NJHWC"
,
ybfbn
);
try
{
try
{
emqKeeper
.
getMqttClient
().
publish
(
"
topic"
,
JSON
.
toJSONString
(
mapdta
).
getBytes
(),
0
,
false
);
emqKeeper
.
getMqttClient
().
publish
(
"
qyyxzb/"
+
s
,
JSON
.
toJSONString
(
mapdta
).
getBytes
(),
0
,
false
);
}
catch
(
MqttException
e
)
{
}
catch
(
MqttException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -257,7 +274,7 @@ public class LargeScreenImpl {
...
@@ -257,7 +274,7 @@ public class LargeScreenImpl {
//全国发电趋势
//全国发电趋势
// @Scheduled(cron = "0/10 * * * * *
")
@Scheduled
(
cron
=
"0/10 * * * * ?
"
)
public
SeriesData
getSeriesDataqg
(){
public
SeriesData
getSeriesDataqg
(){
//获取今年当月 日发电趋势
//获取今年当月 日发电趋势
...
@@ -292,9 +309,23 @@ public class LargeScreenImpl {
...
@@ -292,9 +309,23 @@ public class LargeScreenImpl {
return
seriesData
;
return
seriesData
;
}
}
//区域发电趋势
public
SeriesData
getSeriesDataqy
(
Date
date
,
List
<
String
>
gatewayId
){
//获取区域月日发电量
@Scheduled
(
cron
=
"0/10 * * * * ?"
)
private
void
sendQYFDLMqtt
(){
List
<
StationCacheInfoDto
>
listStationCacheInfoDto
=
commonServiceImpl
.
getListStationCacheInfoDto
();
Map
<
String
,
List
<
StationCacheInfoDto
>>
belongAreaList
=
listStationCacheInfoDto
.
stream
().
collect
(
Collectors
.
groupingBy
(
StationCacheInfoDto:
:
getAreaCode
));
for
(
String
s
:
belongAreaList
.
keySet
())
{
List
<
String
>
ids
=
belongAreaList
.
get
(
s
).
stream
().
map
(
StationCacheInfoDto:
:
getFanGatewayId
).
collect
(
Collectors
.
toList
());
getSeriesDataqy
(
new
Date
(),
ids
,
s
);
}
}
//区域发电趋势
public
SeriesData
getSeriesDataqy
(
Date
date
,
List
<
String
>
gatewayId
,
String
areaCode
){
//获取今年当月 日发电趋势
//获取今年当月 日发电趋势
List
<
Double
>
listjn
=
gettimedateqy
(
new
Date
(),
gatewayId
);
List
<
Double
>
listjn
=
gettimedateqy
(
new
Date
(),
gatewayId
);
...
@@ -320,7 +351,7 @@ public class LargeScreenImpl {
...
@@ -320,7 +351,7 @@ public class LargeScreenImpl {
List
<
String
>
listdate
=
dayReportnq
(
new
Date
());
List
<
String
>
listdate
=
dayReportnq
(
new
Date
());
seriesData
.
setAxisData
(
listdate
);
seriesData
.
setAxisData
(
listdate
);
try
{
try
{
emqKeeper
.
getMqttClient
().
publish
(
"qy/
yxzb"
,
JSON
.
toJSONString
(
seriesData
).
getBytes
(),
0
,
false
);
emqKeeper
.
getMqttClient
().
publish
(
"qy/
fdqs/"
+
areaCode
,
JSON
.
toJSONString
(
seriesData
).
getBytes
(),
0
,
false
);
}
catch
(
MqttException
e
)
{
}
catch
(
MqttException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -380,7 +411,6 @@ public class LargeScreenImpl {
...
@@ -380,7 +411,6 @@ public class LargeScreenImpl {
}
}
//获取区域月日发电量
public
List
<
Double
>
gettimedateqy
(
Date
date
,
List
<
String
>
gatewayId
){
public
List
<
Double
>
gettimedateqy
(
Date
date
,
List
<
String
>
gatewayId
){
...
@@ -419,11 +449,7 @@ public class LargeScreenImpl {
...
@@ -419,11 +449,7 @@ public class LargeScreenImpl {
}
}
}
}
try
{
emqKeeper
.
getMqttClient
().
publish
(
"topic"
,
JSON
.
toJSONString
(
listdate
).
getBytes
(),
0
,
false
);
}
catch
(
MqttException
e
)
{
e
.
printStackTrace
();
}
return
listdate
;
return
listdate
;
...
...
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