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
4efbd22b
Commit
4efbd22b
authored
Jul 06, 2023
by
caotao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
监盘接口demo提交
parent
2cb99a81
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
94 additions
and
10 deletions
+94
-10
DemoController.java
...amos/boot/module/jxiop/biz/controller/DemoController.java
+22
-3
TestDto.java
...a/com/yeejoin/amos/boot/module/jxiop/biz/dto/TestDto.java
+20
-0
MonitorFanIndicatorImpl.java
...odule/jxiop/biz/service/impl/MonitorFanIndicatorImpl.java
+2
-4
InfluxDButils.java
...ejoin/amos/boot/module/jxiop/biz/utils/InfluxDButils.java
+43
-0
application-dev.properties
...monitor-biz/src/main/resources/application-dev.properties
+7
-3
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/DemoController.java
View file @
4efbd22b
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
controller
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.Test
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.MonitorFanIndicatorImpl
;
...
...
@@ -21,14 +18,18 @@ import io.swagger.annotations.ApiOperation;
import
io.swagger.models.auth.In
;
import
net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils
;
import
org.influxdb.dto.QueryResult
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanWrapperImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.*
;
@RestController
@Api
(
tags
=
"Demo-test"
)
...
...
@@ -55,6 +56,9 @@ public class DemoController extends BaseController {
@Autowired
InfluxDButils
influxDButils
;
@Autowired
EmqKeeper
emqKeeper
;
@Autowired
private
MonitorFanIndicatorMapper
monitorFanIndicatorregionMapper
;
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
...
...
@@ -117,6 +121,21 @@ public class DemoController extends BaseController {
}
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"测试消息发送"
)
@GetMapping
(
"/test5"
)
public
void
demoTest4
()
{
HashMap
<
String
,
String
>
hashMap
=
new
HashMap
<>();
hashMap
.
put
(
"test"
,
String
.
valueOf
(
Math
.
random
()
*
1000
));
hashMap
.
put
(
"test1"
,
String
.
valueOf
(
Math
.
random
()
*
100
));
try
{
emqKeeper
.
getMqttClient
().
publish
(
"test_topic"
,
JSON
.
toJSON
(
hashMap
).
toString
().
getBytes
(
"UTF-8"
),
1
,
true
);
emqKeeper
.
getMqttClient
().
publish
(
"test_topic1"
,
JSON
.
toJSON
(
hashMap
).
toString
().
getBytes
(
"UTF-8"
),
1
,
true
);
logger
.
info
(
"++++++++++++++++++++++++++++++++++发送消息成功++++++++++++++++++++++++++++++++++++++"
);
}
catch
(
Exception
exception
)
{
logger
.
error
(
"============================================================发送消息报错"
);
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/dto/TestDto.java
0 → 100644
View file @
4efbd22b
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
dto
;
import
lombok.Data
;
@Data
public
class
TestDto
{
// "date": "2020-12-12 12:12:12",
// "address": "陕西省西安市雁塔区太白南路A座C区",
// "level": "紧急",
// "name": "咸阳机场项目",
// "id": "1",
// "status": "研发中"
private
String
createdTime
;
private
String
equipmentIndex
;
private
String
equipmentIndexName
;
private
String
traceId
;
private
String
value
;
private
String
valueLabel
;
private
String
unit
;
}
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 @
4efbd22b
...
...
@@ -133,7 +133,4 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public
Object
getIndicatoralueTotal
(
String
gateway
,
String
indicator
){
return
monitorFanIndicatorregionMapper
.
getIndicatoralueTotal
(
gateway
,
indicator
);
}
}
}
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/utils/InfluxDButils.java
View file @
4efbd22b
...
...
@@ -5,6 +5,7 @@ import org.influxdb.dto.QueryResult;
import
org.springframework.beans.BeanWrapperImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.ObjectUtils
;
import
java.util.ArrayList
;
import
java.util.Date
;
...
...
@@ -48,4 +49,46 @@ public class InfluxDButils {
}
return
list
;
}
public
<
T
>
List
<
T
>
getListData1
(
String
sql
,
Class
<
T
>
clazz
)
{
List
<
T
>
list
=
new
ArrayList
<>();
try
{
QueryResult
query
=
influxDbConnection
.
query
(
sql
);
List
<
QueryResult
.
Result
>
queryResults
=
query
.
getResults
();
for
(
QueryResult
.
Result
result
:
queryResults
)
{
List
<
QueryResult
.
Series
>
series
=
result
.
getSeries
();
if
(
series
==
null
)
{
continue
;
}
for
(
QueryResult
.
Series
serie
:
series
)
{
List
<
List
<
Object
>>
values
=
serie
.
getValues
();
List
<
String
>
columns
=
serie
.
getColumns
();
for
(
int
i
=
0
;
i
<
values
.
size
();
++
i
)
{
T
object
=
clazz
.
newInstance
();
BeanWrapperImpl
bean
=
new
BeanWrapperImpl
(
object
);
for
(
int
j
=
0
;
j
<
columns
.
size
();
++
j
)
{
String
k
=
columns
.
get
(
j
).
replace
(
"last_"
,
""
);
Object
v
=
values
.
get
(
i
).
get
(
j
);
System
.
out
.
println
(
k
);
System
.
out
.
println
(
v
);
if
(
"time"
.
equals
(
k
))
{
continue
;
}
else
{
// if(ObjectUtils.isEmpty(v)){
// bean.setPropertyValue(k, "");
// }else{
bean
.
setPropertyValue
(
k
,
v
);
// }
}
}
list
.
add
(
object
);
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
list
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/resources/application-dev.properties
View file @
4efbd22b
...
...
@@ -53,9 +53,13 @@ lettuce.timeout=10000
emqx.clean-session
=
true
emqx.client-id
=
${spring.application.name}-${random.int[1024,65536]}
emqx.broker
=
tcp://172.16.3.18:2883
emqx.user-name
=
super
emqx.password
=
a123456
emqx.broker
=
tcp://172.16.10.220:1883
emqx.user-name
=
admin
emqx.password
=
public
mqtt.scene.host
=
mqtt://172.16.10.220:8083/mqtt
mqtt.client.product.id
=
mqtt
mqtt.topic
=
topic_mqtt
spring.mqtt.completionTimeout
=
3000
emqx.max-inflight
=
1000
...
...
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