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
b520ef6e
Commit
b520ef6e
authored
Aug 05, 2024
by
朱晨阳
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
2644dea7
3490be9b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
KafkaConsumerService.java
...mos/boot/module/jxiop/biz/kafka/KafkaConsumerService.java
+21
-2
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/kafka/KafkaConsumerService.java
View file @
b520ef6e
...
@@ -16,11 +16,13 @@ import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.*;
...
@@ -16,11 +16,13 @@ import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.*;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.kafka.clients.consumer.ConsumerRecord
;
import
org.apache.kafka.clients.consumer.ConsumerRecord
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.kafka.annotation.KafkaListener
;
import
org.springframework.kafka.annotation.KafkaListener
;
import
org.springframework.kafka.support.Acknowledgment
;
import
org.springframework.kafka.support.Acknowledgment
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
tech.tablesaw.api.ColumnType
;
import
tech.tablesaw.api.ColumnType
;
import
tech.tablesaw.api.DoubleColumn
;
import
tech.tablesaw.api.DoubleColumn
;
import
tech.tablesaw.api.Table
;
import
tech.tablesaw.api.Table
;
...
@@ -90,6 +92,9 @@ public class KafkaConsumerService {
...
@@ -90,6 +92,9 @@ public class KafkaConsumerService {
@Value
(
"${last.month.num:12}"
)
@Value
(
"${last.month.num:12}"
)
private
Integer
lastMonthNum
;
private
Integer
lastMonthNum
;
@Autowired
EmqKeeper
emqKeeper
;
ExecutorService
service
=
Executors
.
newFixedThreadPool
(
threadNum
);
ExecutorService
service
=
Executors
.
newFixedThreadPool
(
threadNum
);
BlockingQueue
<
PointData
>
queue
=
new
LinkedBlockingQueue
<>();
BlockingQueue
<
PointData
>
queue
=
new
LinkedBlockingQueue
<>();
...
@@ -567,6 +572,13 @@ public class KafkaConsumerService {
...
@@ -567,6 +572,13 @@ public class KafkaConsumerService {
resultMap
.
put
(
"processVariable"
,
data1
);
resultMap
.
put
(
"processVariable"
,
data1
);
resultMap
.
put
(
"processVariableId"
,
fanPointVarCorrelation
.
getSequenceNbr
());
resultMap
.
put
(
"processVariableId"
,
fanPointVarCorrelation
.
getSequenceNbr
());
if
(
fanPointVarCorrelation
.
getEquipmentName
().
equals
(
"升压站"
)){
try
{
emqKeeper
.
getMqttClient
().
publish
(
"gkblfx"
,
JSON
.
toJSONString
(
resultMap
).
getBytes
(),
2
,
false
);
}
catch
(
MqttException
e
)
{
e
.
printStackTrace
();
}
}
String
response
=
HttpUtil
.
createPost
(
baseUrlGKHF
).
body
(
JSON
.
toJSONString
(
resultMap
)).
execute
()
String
response
=
HttpUtil
.
createPost
(
baseUrlGKHF
).
body
(
JSON
.
toJSONString
(
resultMap
)).
execute
()
.
body
();
.
body
();
...
@@ -606,7 +618,7 @@ public class KafkaConsumerService {
...
@@ -606,7 +618,7 @@ public class KafkaConsumerService {
* @param consumerRecords messages
* @param consumerRecords messages
* @param ack ack
* @param ack ack
*/
*/
@KafkaListener
(
id
=
"GKHFPvConsumer"
,
groupId
=
"consumerGroup"
,
topics
=
kafkaTopicConsumerGKHFPv
)
@KafkaListener
(
id
=
"GKHFPvConsume
12
r"
,
groupId
=
"consumerGroup"
,
topics
=
kafkaTopicConsumerGKHFPv
)
public
void
listenGKHFPv
(
List
<
ConsumerRecord
<
String
,
String
>>
consumerRecords
,
Acknowledgment
ack
)
{
public
void
listenGKHFPv
(
List
<
ConsumerRecord
<
String
,
String
>>
consumerRecords
,
Acknowledgment
ack
)
{
try
{
try
{
...
@@ -653,7 +665,14 @@ public class KafkaConsumerService {
...
@@ -653,7 +665,14 @@ public class KafkaConsumerService {
double
[]
data1
=
table
.
where
(
selection
).
doubleColumn
(
"value"
).
asDoubleArray
();
double
[]
data1
=
table
.
where
(
selection
).
doubleColumn
(
"value"
).
asDoubleArray
();
resultMap
.
put
(
"processVariable"
,
data1
);
resultMap
.
put
(
"processVariable"
,
data1
);
resultMap
.
put
(
"processVariableId"
,
pvPointVarCorrelation
.
getSequenceNbr
());
resultMap
.
put
(
"processVariableId"
,
pvPointVarCorrelation
.
getSequenceNbr
());
if
(
pvPointVarCorrelation
.
getEquipmentName
().
equals
(
"升压站"
)){
System
.
out
.
println
(
"升压站数据进来了"
);
try
{
emqKeeper
.
getMqttClient
().
publish
(
"gkblfx"
,
JSON
.
toJSONString
(
resultMap
).
getBytes
(),
2
,
false
);
}
catch
(
MqttException
e
)
{
e
.
printStackTrace
();
}
}
String
response
=
HttpUtil
.
createPost
(
baseUrlGKHF
).
body
(
JSON
.
toJSONString
(
resultMap
)).
execute
()
String
response
=
HttpUtil
.
createPost
(
baseUrlGKHF
).
body
(
JSON
.
toJSONString
(
resultMap
)).
execute
()
.
body
();
.
body
();
...
...
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