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
b861dac4
Commit
b861dac4
authored
Aug 06, 2024
by
wujiang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' of
http://36.40.66.175:5000/moa/jxdj_zx/amos-boot-zx-biz
into developer
parents
caad4362
b520ef6e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
2 deletions
+79
-2
TdInfoQueryController.java
...ot/module/jxiop/biz/controller/TdInfoQueryController.java
+58
-0
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/controller/TdInfoQueryController.java
View file @
b861dac4
...
...
@@ -41,6 +41,9 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import
java.text.DecimalFormat
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -75,12 +78,19 @@ public class TdInfoQueryController extends BaseController {
@Autowired
UserEmpowerMapper
userEmpowerMapper
;
private
SimpleDateFormat
hhmmss
=
new
SimpleDateFormat
(
"HH:mm:ss"
);
private
SimpleDateFormat
mmss
=
new
SimpleDateFormat
(
"mm:ss"
);
private
SimpleDateFormat
ss
=
new
SimpleDateFormat
(
"ss"
);
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@PostMapping
(
value
=
"/getFanHealthIndexInfo"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"分页查询健康指数信息 - 风电"
,
notes
=
"分页查询健康指数信息 - 风电"
)
@GatewayIdAutowired
public
ResponseModel
<
Page
<
FanHealthIndex
>>
getFanHealthIndexInfo
(
@RequestBody
FanHealthIndexDto
dto
)
throws
ParseException
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
userId
=
reginParams
.
getUserModel
().
getUserId
();
StdUserEmpower
stdUserEmpower
=
userEmpowerMapper
.
selectOne
(
new
QueryWrapper
<
StdUserEmpower
>().
eq
(
"amos_user_id"
,
userId
).
eq
(
"permission_type"
,
"YTH"
));
...
...
@@ -89,14 +99,37 @@ public class TdInfoQueryController extends BaseController {
orgCode
=
stdUserEmpower
.
getAmosOrgCode
().
get
(
0
)+
"%"
;
}
dto
.
setOrgCode
(
orgCode
);
Date
currentDate
=
new
Date
();
if
(
CharSequenceUtil
.
isNotEmpty
(
dto
.
getStartDate
()))
{
String
startDate
=
dto
.
getStartDate
();
if
(
dto
.
getAnalysisType
()
!=
null
&&
dto
.
getAnalysisType
().
equals
(
"按天"
)
&&
startDate
.
length
()
==
10
)
{
startDate
=
startDate
+
" "
+
hhmmss
.
format
(
currentDate
);
}
if
(
dto
.
getAnalysisType
()
!=
null
&&
dto
.
getAnalysisType
().
equals
(
"按小时"
)
&&
startDate
.
length
()
==
13
)
{
startDate
=
startDate
+
":"
+
mmss
.
format
(
currentDate
);
}
if
(
dto
.
getAnalysisType
()
!=
null
&&
dto
.
getAnalysisType
().
equals
(
"按10分钟"
)
&&
startDate
.
length
()
==
16
)
{
startDate
=
startDate
+
":"
+
ss
.
format
(
currentDate
);
}
Date
date
=
DateUtils
.
dateParse
(
startDate
,
DATE_TIME_PATTERN
);
String
startDateString
=
DateUtils
.
dateFormat
(
DateUtils
.
dateAddHours
(
date
,
-
8
),
DATE_TIME_PATTERN
);
dto
.
setStartDate
(
startDateString
);
}
if
(
CharSequenceUtil
.
isNotEmpty
(
dto
.
getEndDate
()))
{
String
endDate
=
dto
.
getEndDate
();
if
(
dto
.
getAnalysisType
()
!=
null
&&
dto
.
getAnalysisType
().
equals
(
"按天"
)
&&
endDate
.
length
()
==
10
)
{
endDate
=
endDate
+
" "
+
hhmmss
.
format
(
currentDate
);
}
if
(
dto
.
getAnalysisType
()
!=
null
&&
dto
.
getAnalysisType
().
equals
(
"按小时"
)
&&
endDate
.
length
()
==
13
)
{
endDate
=
endDate
+
":"
+
mmss
.
format
(
currentDate
);
}
if
(
dto
.
getAnalysisType
()
!=
null
&&
dto
.
getAnalysisType
().
equals
(
"按10分钟"
)
&&
endDate
.
length
()
==
16
)
{
endDate
=
endDate
+
":"
+
ss
.
format
(
currentDate
);
}
Date
endDateDate
=
DateUtils
.
dateParse
(
endDate
,
DATE_TIME_PATTERN
);
String
endDateString
=
DateUtils
.
dateFormat
(
DateUtils
.
dateAddHours
(
endDateDate
,
-
8
),
DATE_TIME_PATTERN
);
dto
.
setEndDate
(
endDateString
);
...
...
@@ -165,14 +198,39 @@ public class TdInfoQueryController extends BaseController {
orgCode
=
stdUserEmpower
.
getAmosOrgCode
().
get
(
0
)+
"%"
;
}
dto
.
setOrgCode
(
orgCode
);
Date
currentDate
=
new
Date
();
if
(
CharSequenceUtil
.
isNotEmpty
(
dto
.
getStartDate
()))
{
String
startDate
=
dto
.
getStartDate
();
if
(
dto
.
getAnalysisType
()
!=
null
&&
dto
.
getAnalysisType
().
equals
(
"按天"
)
&&
startDate
.
length
()
==
10
)
{
startDate
=
startDate
+
" "
+
hhmmss
.
format
(
currentDate
);
}
if
(
dto
.
getAnalysisType
()
!=
null
&&
dto
.
getAnalysisType
().
equals
(
"按小时"
)
&&
startDate
.
length
()
==
13
)
{
startDate
=
startDate
+
":"
+
mmss
.
format
(
currentDate
);
}
if
(
dto
.
getAnalysisType
()
!=
null
&&
dto
.
getAnalysisType
().
equals
(
"按10分钟"
)
&&
startDate
.
length
()
==
16
)
{
startDate
=
startDate
+
":"
+
ss
.
format
(
currentDate
);
}
Date
date
=
DateUtils
.
dateParse
(
startDate
,
DATE_TIME_PATTERN
);
String
startDateString
=
DateUtils
.
dateFormat
(
DateUtils
.
dateAddHours
(
date
,
-
8
),
DATE_TIME_PATTERN
);
dto
.
setStartDate
(
startDateString
);
}
if
(
CharSequenceUtil
.
isNotEmpty
(
dto
.
getEndDate
()))
{
String
endDate
=
dto
.
getEndDate
();
if
(
dto
.
getAnalysisType
()
!=
null
&&
dto
.
getAnalysisType
().
equals
(
"按天"
)
&&
endDate
.
length
()
==
10
)
{
endDate
=
endDate
+
" "
+
hhmmss
.
format
(
currentDate
);
}
if
(
dto
.
getAnalysisType
()
!=
null
&&
dto
.
getAnalysisType
().
equals
(
"按小时"
)
&&
endDate
.
length
()
==
13
)
{
endDate
=
endDate
+
":"
+
mmss
.
format
(
currentDate
);
}
if
(
dto
.
getAnalysisType
()
!=
null
&&
dto
.
getAnalysisType
().
equals
(
"按10分钟"
)
&&
endDate
.
length
()
==
16
)
{
endDate
=
endDate
+
":"
+
ss
.
format
(
currentDate
);
}
Date
endDateDate
=
DateUtils
.
dateParse
(
endDate
,
DATE_TIME_PATTERN
);
String
endDateString
=
DateUtils
.
dateFormat
(
DateUtils
.
dateAddHours
(
endDateDate
,
-
8
),
DATE_TIME_PATTERN
);
dto
.
setEndDate
(
endDateString
);
...
...
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 @
b861dac4
...
...
@@ -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
lombok.extern.slf4j.Slf4j
;
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.Value
;
import
org.springframework.kafka.annotation.KafkaListener
;
import
org.springframework.kafka.support.Acknowledgment
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
tech.tablesaw.api.ColumnType
;
import
tech.tablesaw.api.DoubleColumn
;
import
tech.tablesaw.api.Table
;
...
...
@@ -90,6 +92,9 @@ public class KafkaConsumerService {
@Value
(
"${last.month.num:12}"
)
private
Integer
lastMonthNum
;
@Autowired
EmqKeeper
emqKeeper
;
ExecutorService
service
=
Executors
.
newFixedThreadPool
(
threadNum
);
BlockingQueue
<
PointData
>
queue
=
new
LinkedBlockingQueue
<>();
...
...
@@ -567,6 +572,13 @@ public class KafkaConsumerService {
resultMap
.
put
(
"processVariable"
,
data1
);
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
()
.
body
();
...
...
@@ -606,7 +618,7 @@ public class KafkaConsumerService {
* @param consumerRecords messages
* @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
)
{
try
{
...
...
@@ -653,7 +665,14 @@ public class KafkaConsumerService {
double
[]
data1
=
table
.
where
(
selection
).
doubleColumn
(
"value"
).
asDoubleArray
();
resultMap
.
put
(
"processVariable"
,
data1
);
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
()
.
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