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
661e74c0
Commit
661e74c0
authored
Aug 07, 2023
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加大屏接口
parent
d8e391d1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
247 additions
and
16 deletions
+247
-16
GeneratingCapacity.java
...n/amos/boot/module/jxiop/api/Enum/GeneratingCapacity.java
+30
-0
MonitorFanIdxController.java
.../module/jxiop/biz/controller/MonitorFanIdxController.java
+59
-7
MonitorFanIndicatorImpl.java
...odule/jxiop/biz/service/impl/MonitorFanIndicatorImpl.java
+36
-0
MonitorFanIdxController.java
.../module/jxiop/biz/controller/MonitorFanIdxController.java
+62
-0
CommonServiceImpl.java
...boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
+12
-0
MonitorFanIndicatorImpl.java
...odule/jxiop/biz/service/impl/MonitorFanIndicatorImpl.java
+48
-9
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/Enum/GeneratingCapacity.java
0 → 100644
View file @
661e74c0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
Enum
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
@Getter
@AllArgsConstructor
public
enum
GeneratingCapacity
{
DAY
(
"日发电量"
,
"0"
),
MONTH
(
"月发电量"
,
"1"
),
YEAR
(
"年发电量"
,
"2"
);
private
String
name
;
private
String
code
;
public
static
String
getCode
(
String
name
)
{
for
(
KGName
electricQuantity
:
KGName
.
values
())
{
if
(
electricQuantity
.
getName
().
equals
(
name
))
{
return
electricQuantity
.
getCode
();
}
}
return
null
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/MonitorFanIdxController.java
View file @
661e74c0
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil
;
import
com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil
;
import
com.yeejoin.amos.boot.module.jxiop.api.Enum.GeneratingCapacity
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.TreeDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.TreeDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic
;
...
@@ -50,13 +51,7 @@ public class MonitorFanIdxController extends BaseController {
...
@@ -50,13 +51,7 @@ public class MonitorFanIdxController extends BaseController {
@Autowired
@Autowired
CommonServiceImpl
commonService
;
CommonServiceImpl
commonService
;
@Value
(
"${gl.sum.column}"
)
String
sumColumn
;
@Value
(
"${gl.avg.column}"
)
String
avgColumn
;
@Value
(
"${fan.statuts.stattuspath}"
)
@Value
(
"${fan.statuts.stattuspath}"
)
private
String
fanStatusImagePathPrefix
;
private
String
fanStatusImagePathPrefix
;
...
@@ -791,4 +786,61 @@ public class MonitorFanIdxController extends BaseController {
...
@@ -791,4 +786,61 @@ public class MonitorFanIdxController extends BaseController {
Map
<
String
,
Object
>
result
=
monitorFanIndicator
.
partofWaring3D
(
stationId
,
equipNum
);
Map
<
String
,
Object
>
result
=
monitorFanIndicator
.
partofWaring3D
(
stationId
,
equipNum
);
return
ResponseHelper
.
buildResponse
(
result
);
return
ResponseHelper
.
buildResponse
(
result
);
}
}
@ApiOperation
(
value
=
"电站排名"
)
@GetMapping
(
"/stationRanking"
)
public
ResponseModel
stationRanking
(
@RequestParam
(
value
=
"stationId"
)
String
stationId
,
@RequestParam
(
value
=
"equipNum"
)
String
equipNum
)
{
LambdaQueryWrapper
<
StationBasic
>
wrapper
=
new
LambdaQueryWrapper
<>();
List
<
StationBasic
>
stationBasics
=
stationBasicMapper
.
selectList
(
wrapper
);
List
<
Map
<
String
,
Object
>>
datDataFJ
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
monthDataFJ
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
yearDataFJ
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
datDataGF
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
monthDataGF
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
yearDataGF
=
new
ArrayList
<>();
for
(
StationBasic
stationBasic
:
stationBasics
)
{
String
gatewayId
=
stationBasic
.
getFanGatewayId
();
String
querySql
=
null
;
String
name
=
stationBasic
.
getStationName
();
if
(
stationBasic
.
getStationType
().
equals
(
"FDZ"
)){
Map
<
String
,
Object
>
map
=
monitorFanIndicator
.
generatingCapacity
(
gatewayId
,
querySql
);
Map
<
String
,
Object
>
dayMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
monthMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
yearMap
=
new
HashMap
<>();
dayMap
.
put
(
"title"
,
name
);
dayMap
.
put
(
"data"
,
map
.
get
(
"日发电量"
));
monthMap
.
put
(
"title"
,
name
);
monthMap
.
put
(
"data"
,
map
.
get
(
"月发电量"
));
yearMap
.
put
(
"title"
,
name
);
yearMap
.
put
(
"data"
,
map
.
get
(
"年发电量"
));
datDataFJ
.
add
(
dayMap
);
monthDataFJ
.
add
(
monthMap
);
yearDataFJ
.
add
(
yearMap
);
}
else
{
querySql
=
" and frontModule = '逆变器'"
;
Map
<
String
,
Object
>
map
=
monitorFanIndicator
.
generatingCapacity
(
gatewayId
,
querySql
);
Map
<
String
,
Object
>
dayMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
monthMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
yearMap
=
new
HashMap
<>();
dayMap
.
put
(
"title"
,
name
);
dayMap
.
put
(
"data"
,
map
.
get
(
"日发电量"
));
monthMap
.
put
(
"title"
,
name
);
monthMap
.
put
(
"data"
,
map
.
get
(
"月发电量"
));
yearMap
.
put
(
"title"
,
name
);
yearMap
.
put
(
"data"
,
map
.
get
(
"年发电量"
));
datDataGF
.
add
(
dayMap
);
monthDataGF
.
add
(
monthMap
);
yearDataGF
.
add
(
yearMap
);
}
}
monitorFanIndicator
.
sendMqttByRanking
(
datDataFJ
,
GeneratingCapacity
.
DAY
.
getCode
(),
"fjpm"
);
monitorFanIndicator
.
sendMqttByRanking
(
monthDataFJ
,
GeneratingCapacity
.
MONTH
.
getCode
(),
"fjpm"
);
monitorFanIndicator
.
sendMqttByRanking
(
yearDataFJ
,
GeneratingCapacity
.
YEAR
.
getCode
(),
"fjpm"
);
monitorFanIndicator
.
sendMqttByRanking
(
datDataGF
,
GeneratingCapacity
.
YEAR
.
getCode
(),
"gfpm"
);
monitorFanIndicator
.
sendMqttByRanking
(
monthDataGF
,
GeneratingCapacity
.
YEAR
.
getCode
(),
"gfpm"
);
monitorFanIndicator
.
sendMqttByRanking
(
yearDataGF
,
GeneratingCapacity
.
YEAR
.
getCode
(),
"gfpm"
);
return
CommonResponseUtil
.
success
();
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/MonitorFanIndicatorImpl.java
View file @
661e74c0
...
@@ -1744,5 +1744,41 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
...
@@ -1744,5 +1744,41 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return
resultMap
;
return
resultMap
;
}
}
public
void
sendMqttByRanking
(
List
<
Map
<
String
,
Object
>>
list
,
String
code
,
String
topic
){
list
.
stream
().
sorted
((
o1
,
o2
)->{
double
o1Num
=
Double
.
parseDouble
(
o1
.
get
(
"data"
).
toString
());
double
o2Num
=
Double
.
parseDouble
(
o2
.
get
(
"data"
).
toString
());
if
((
o1Num
-
o2Num
)<
0
){
return
-
1
;
}
else
if
((
o1Num
-
o2Num
)>
0
){
return
1
;
}
else
{
return
0
;
}
});
try
{
emqKeeper
.
getMqttClient
().
publish
(
topic
+
"/"
+
code
,
JSON
.
toJSONString
(
list
).
getBytes
(),
0
,
false
);
}
catch
(
MqttException
e
)
{
e
.
printStackTrace
();
}
}
public
Map
<
String
,
Object
>
generatingCapacity
(
String
gatewayId
,
String
query
){
String
querySql
=
" SELECT * FROM indicators_"
+
gatewayId
+
" WHERE equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量'"
;
if
(
null
!=
query
){
querySql
=
querySql
+
" "
+
querySql
;
}
List
<
IndicatorsDto
>
queryList
=
influxDButils
.
getListData
(
querySql
,
IndicatorsDto
.
class
);
Map
<
String
,
List
<
IndicatorsDto
>>
maps
=
queryList
.
stream
().
collect
(
Collectors
.
groupingBy
(
IndicatorsDto:
:
getEquipmentIndexName
));
Map
<
String
,
Object
>
hashMap
=
new
HashMap
<>();
for
(
String
s
:
maps
.
keySet
())
{
List
<
IndicatorsDto
>
indicatorsDtos
=
maps
.
get
(
s
);
Double
totalvalue
=
indicatorsDtos
.
stream
().
filter
(
obj
->
!
ObjectUtils
.
isEmpty
(
obj
.
getValue
())).
mapToDouble
(
l
->
Double
.
parseDouble
(
l
.
getValue
())).
sum
();
hashMap
.
put
(
s
,
totalvalue
);
}
return
hashMap
;
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/MonitorFanIdxController.java
View file @
661e74c0
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil
;
import
com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil
;
import
com.yeejoin.amos.boot.module.jxiop.api.Enum.GeneratingCapacity
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.TreeDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.TreeDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic
;
...
@@ -791,4 +792,65 @@ public class MonitorFanIdxController extends BaseController {
...
@@ -791,4 +792,65 @@ public class MonitorFanIdxController extends BaseController {
Map
<
String
,
Object
>
result
=
monitorFanIndicator
.
partofWaring3D
(
stationId
,
equipNum
);
Map
<
String
,
Object
>
result
=
monitorFanIndicator
.
partofWaring3D
(
stationId
,
equipNum
);
return
ResponseHelper
.
buildResponse
(
result
);
return
ResponseHelper
.
buildResponse
(
result
);
}
}
@ApiOperation
(
value
=
"电站排名"
)
@GetMapping
(
"/stationRanking"
)
public
ResponseModel
stationRanking
(
@RequestParam
(
value
=
"stationId"
)
String
stationId
,
@RequestParam
(
value
=
"equipNum"
)
String
equipNum
)
{
LambdaQueryWrapper
<
StationBasic
>
wrapper
=
new
LambdaQueryWrapper
<>();
List
<
StationBasic
>
stationBasics
=
stationBasicMapper
.
selectList
(
wrapper
);
List
<
Map
<
String
,
Object
>>
datDataFJ
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
monthDataFJ
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
yearDataFJ
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
datDataGF
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
monthDataGF
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
yearDataGF
=
new
ArrayList
<>();
for
(
StationBasic
stationBasic
:
stationBasics
)
{
String
gatewayId
=
stationBasic
.
getFanGatewayId
();
String
querySql
=
null
;
String
name
=
stationBasic
.
getStationName
();
if
(
stationBasic
.
getStationType
().
equals
(
"FDZ"
)){
Map
<
String
,
Object
>
map
=
monitorFanIndicator
.
generatingCapacity
(
gatewayId
,
querySql
);
Map
<
String
,
Object
>
dayMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
monthMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
yearMap
=
new
HashMap
<>();
dayMap
.
put
(
"title"
,
name
);
dayMap
.
put
(
"data"
,
map
.
get
(
"日发电量"
));
monthMap
.
put
(
"title"
,
name
);
monthMap
.
put
(
"data"
,
map
.
get
(
"月发电量"
));
yearMap
.
put
(
"title"
,
name
);
yearMap
.
put
(
"data"
,
map
.
get
(
"年发电量"
));
datDataFJ
.
add
(
dayMap
);
monthDataFJ
.
add
(
monthMap
);
yearDataFJ
.
add
(
yearMap
);
}
else
{
querySql
=
" and frontModule = '逆变器'"
;
Map
<
String
,
Object
>
map
=
monitorFanIndicator
.
generatingCapacity
(
gatewayId
,
querySql
);
Map
<
String
,
Object
>
dayMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
monthMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
yearMap
=
new
HashMap
<>();
dayMap
.
put
(
"title"
,
name
);
dayMap
.
put
(
"data"
,
map
.
get
(
"日发电量"
));
monthMap
.
put
(
"title"
,
name
);
monthMap
.
put
(
"data"
,
map
.
get
(
"月发电量"
));
yearMap
.
put
(
"title"
,
name
);
yearMap
.
put
(
"data"
,
map
.
get
(
"年发电量"
));
datDataGF
.
add
(
dayMap
);
monthDataGF
.
add
(
monthMap
);
yearDataGF
.
add
(
yearMap
);
}
}
monitorFanIndicator
.
sendMqttByRanking
(
datDataFJ
,
GeneratingCapacity
.
DAY
.
getCode
(),
"fjpm"
);
monitorFanIndicator
.
sendMqttByRanking
(
monthDataFJ
,
GeneratingCapacity
.
MONTH
.
getCode
(),
"fjpm"
);
monitorFanIndicator
.
sendMqttByRanking
(
yearDataFJ
,
GeneratingCapacity
.
YEAR
.
getCode
(),
"fjpm"
);
monitorFanIndicator
.
sendMqttByRanking
(
datDataGF
,
GeneratingCapacity
.
YEAR
.
getCode
(),
"gfpm"
);
monitorFanIndicator
.
sendMqttByRanking
(
monthDataGF
,
GeneratingCapacity
.
YEAR
.
getCode
(),
"gfpm"
);
monitorFanIndicator
.
sendMqttByRanking
(
yearDataGF
,
GeneratingCapacity
.
YEAR
.
getCode
(),
"gfpm"
);
return
CommonResponseUtil
.
success
();
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
View file @
661e74c0
...
@@ -42,6 +42,18 @@ public class CommonServiceImpl {
...
@@ -42,6 +42,18 @@ public class CommonServiceImpl {
return
Double
.
valueOf
(
String
.
format
(
"%.2f"
,
totalvalue
));
return
Double
.
valueOf
(
String
.
format
(
"%.2f"
,
totalvalue
));
}
}
public
Double
getTotalByIndicatiorAndParams
(
String
gatewayId
,
String
indicator
,
String
querySql
){
String
sql
=
"SELECT * FROM indicators_"
+
gatewayId
+
" where equipmentIndexName='"
+
indicator
+
"'"
;
Double
totalvalue
=
0.0
;
if
(
null
!=
querySql
){
sql
=
sql
+
" "
+
querySql
;
}
List
<
Map
<
String
,
Object
>>
mapList
=
influxdbUtil
.
query
(
sql
);
totalvalue
=
mapList
.
stream
().
filter
(
stringObjectMap
->
!
ObjectUtils
.
isEmpty
(
stringObjectMap
.
get
(
"value"
))).
mapToDouble
(
l
->
Double
.
parseDouble
((
String
)
l
.
get
(
"value"
))).
sum
();
return
Double
.
valueOf
(
String
.
format
(
"%.2f"
,
totalvalue
));
}
public
Double
getNumByIndicatior
(
String
gatewayId
,
String
indicator
){
public
Double
getNumByIndicatior
(
String
gatewayId
,
String
indicator
){
String
sql
=
"SELECT * FROM indicators_"
+
gatewayId
+
" where equipmentIndexName=~/"
+
indicator
+
"$/"
;
String
sql
=
"SELECT * FROM indicators_"
+
gatewayId
+
" where equipmentIndexName=~/"
+
indicator
+
"$/"
;
Double
totalvalue
=
0.0
;
Double
totalvalue
=
0.0
;
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/MonitorFanIndicatorImpl.java
View file @
661e74c0
...
@@ -1794,17 +1794,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
...
@@ -1794,17 +1794,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
List
<
IndicatorsDto
>
queryList
=
influxDButils
.
getListData
(
querySql
,
IndicatorsDto
.
class
);
List
<
IndicatorsDto
>
queryList
=
influxDButils
.
getListData
(
querySql
,
IndicatorsDto
.
class
);
if
(!
ValidationUtil
.
isEmpty
(
queryList
))
{
if
(!
ValidationUtil
.
isEmpty
(
queryList
))
{
List
<
String
>
collect
=
queryList
.
stream
().
map
(
IndicatorsDto:
:
getEquipmentNumber
).
collect
(
Collectors
.
toList
());
List
<
String
>
collect
=
queryList
.
stream
().
map
(
IndicatorsDto:
:
getEquipmentNumber
).
collect
(
Collectors
.
toList
());
Set
<
String
>
strings
=
new
HashSet
<>(
collect
);
Set
<
String
>
strings
=
new
HashSet
<>(
collect
);
zcNum
=
collect
.
size
()
-
strings
.
size
();
zcNum
=
collect
.
size
()
-
strings
.
size
();
}
}
String
querySql1
=
" SELECT * FROM indicators_"
+
gatewayId
+
" equipmentIndexName ='通讯异常' and value = 'true'"
;
String
querySql1
=
" SELECT * FROM indicators_"
+
gatewayId
+
" equipmentIndexName ='通讯异常' and value = 'true'"
;
List
<
IndicatorsDto
>
queryList1
=
influxDButils
.
getListData
(
querySql1
,
IndicatorsDto
.
class
);
List
<
IndicatorsDto
>
queryList1
=
influxDButils
.
getListData
(
querySql1
,
IndicatorsDto
.
class
);
if
(!
ValidationUtil
.
isEmpty
(
queryList1
)){
if
(!
ValidationUtil
.
isEmpty
(
queryList1
)){
List
<
String
>
collect1
=
queryList
.
stream
().
map
(
IndicatorsDto:
:
getEquipmentNumber
).
collect
(
Collectors
.
toList
());
List
<
String
>
collect1
=
queryList
.
stream
().
map
(
IndicatorsDto:
:
getEquipmentNumber
).
collect
(
Collectors
.
toList
());
Set
<
String
>
strings1
=
new
HashSet
<>(
collect1
);
Set
<
String
>
strings1
=
new
HashSet
<>(
collect1
);
txNum
=
collect1
.
size
()-
strings1
.
size
();
txNum
=
collect1
.
size
()-
strings1
.
size
();
}
}
...
@@ -1820,5 +1820,44 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
...
@@ -1820,5 +1820,44 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return
numMap
;
return
numMap
;
}
}
public
void
sendMqttByRanking
(
List
<
Map
<
String
,
Object
>>
list
,
String
code
,
String
topic
){
list
.
stream
().
sorted
((
o1
,
o2
)->{
double
o1Num
=
Double
.
parseDouble
(
o1
.
get
(
"data"
).
toString
());
double
o2Num
=
Double
.
parseDouble
(
o2
.
get
(
"data"
).
toString
());
if
((
o1Num
-
o2Num
)<
0
){
return
-
1
;
}
else
if
((
o1Num
-
o2Num
)>
0
){
return
1
;
}
else
{
return
0
;
}
});
try
{
emqKeeper
.
getMqttClient
().
publish
(
topic
+
"/"
+
code
,
JSON
.
toJSONString
(
list
).
getBytes
(),
0
,
false
);
}
catch
(
MqttException
e
)
{
e
.
printStackTrace
();
}
}
public
Map
<
String
,
Object
>
generatingCapacity
(
String
gatewayId
,
String
query
){
String
querySql
=
" SELECT * FROM indicators_"
+
gatewayId
+
" WHERE equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量'"
;
if
(
null
!=
query
){
querySql
=
querySql
+
" "
+
querySql
;
}
List
<
IndicatorsDto
>
queryList
=
influxDButils
.
getListData
(
querySql
,
IndicatorsDto
.
class
);
Map
<
String
,
List
<
IndicatorsDto
>>
maps
=
queryList
.
stream
().
collect
(
Collectors
.
groupingBy
(
IndicatorsDto:
:
getEquipmentIndexName
));
Map
<
String
,
Object
>
hashMap
=
new
HashMap
<>();
for
(
String
s
:
maps
.
keySet
())
{
List
<
IndicatorsDto
>
indicatorsDtos
=
maps
.
get
(
s
);
Double
totalvalue
=
indicatorsDtos
.
stream
().
filter
(
obj
->
!
ObjectUtils
.
isEmpty
(
obj
.
getValue
())).
mapToDouble
(
l
->
Double
.
parseDouble
(
l
.
getValue
())).
sum
();
hashMap
.
put
(
s
,
totalvalue
);
}
return
hashMap
;
}
}
}
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