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
e8f662cb
Commit
e8f662cb
authored
Jul 13, 2023
by
caotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
风机状态图改用消息广播
parent
b043aff3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
1 deletion
+31
-1
MonitoringServiceIMQTTmpl.java
...ule/jxiop/biz/service/impl/MonitoringServiceIMQTTmpl.java
+31
-1
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/MonitoringServiceIMQTTmpl.java
View file @
e8f662cb
...
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
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.netflix.loadbalancer.RetryRule
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.Region
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic
;
...
...
@@ -13,11 +14,13 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.SocialContributionDto;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
java.io.File
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.stream.Collectors
;
...
...
@@ -40,7 +43,8 @@ public class MonitoringServiceIMQTTmpl {
private
final
String
fanStatusListCron
=
"0/30 * * * * *"
;
//风机实时数据Cron表达式
private
final
String
fanCurrentDataCron
=
"0 0/1 * * * *"
;
@Value
(
"${fan.statuts.stattuspath}"
)
private
String
fanStatusImagePathPrefix
;
/**
* 场站mapper
*/
...
...
@@ -287,8 +291,10 @@ public class MonitoringServiceIMQTTmpl {
.
collect
(
Collectors
.
toList
());
page
.
setTotal
(
fanStatusList
.
size
());
page
.
setRecords
(
collect
);
IPage
<
HashMap
<
String
,
String
>>
fanStatusListImages
=
getFanStatusListImages
(
collect
);
try
{
emqKeeper
.
getMqttClient
().
publish
(
stationBasic
.
getSequenceNbr
()
+
"_fanStationFanStatusList_topic"
,
JSON
.
toJSON
(
page
).
toString
().
getBytes
(
"UTF-8"
),
1
,
true
);
emqKeeper
.
getMqttClient
().
publish
(
stationBasic
.
getSequenceNbr
()
+
"_fanStationFanStatusListImages_topic"
,
JSON
.
toJSON
(
fanStatusListImages
).
toString
().
getBytes
(
"UTF-8"
),
1
,
true
);
logger
.
info
(
"-----------------发送风电站风机列表数据消息=================== 成功!"
+
JSON
.
toJSONString
(
page
));
}
catch
(
Exception
exception
)
{
logger
.
error
(
"-----------------发送风电站风机列表数据消息=================== 失败!"
);
...
...
@@ -377,4 +383,28 @@ public class MonitoringServiceIMQTTmpl {
});
});
}
/**
* @deprecated 根据查询出来的风机状态返回风机的状态图片
* @param collect 根据网关id查询出来的数据
* @return 加工后风机实时运行状态图列表数据
*/
public
IPage
<
HashMap
<
String
,
String
>>
getFanStatusListImages
(
List
<
IndexDto
>
collect
)
{
IPage
<
HashMap
<
String
,
String
>>
page
=
new
Page
<>();
HashMap
<
String
,
String
>
hashMap
=
new
HashMap
<>();
//对于查出来的风机进行排序,便于数据处理
List
<
IndexDto
>
indexDtoList
=
collect
.
stream
().
sorted
(
Comparator
.
comparing
(
IndexDto:
:
getEquipmentNumber
)).
collect
(
Collectors
.
toList
());
for
(
int
i
=
1
;
i
<=
indexDtoList
.
size
();
i
++)
{
IndexDto
indexDto
=
indexDtoList
.
get
(
i
-
1
);
hashMap
.
put
(
"url"
+
i
,
fanStatusImagePathPrefix
+
File
.
separator
+
"风机-"
+
indexDto
.
getState
()
+
".gif"
);
hashMap
.
put
(
"name"
+
i
,
indexDto
.
getEquipmentNumber
());
}
page
.
setTotal
(
10
);
page
.
setSize
(
100
);
page
.
setCurrent
(
1
);
List
<
HashMap
<
String
,
String
>>
hashMapList
=
new
ArrayList
<>();
hashMapList
.
add
(
hashMap
);
page
.
setRecords
(
hashMapList
);
return
page
;
}
}
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