Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
TDLCloud
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
WitCloud
TDLCloud
Commits
021a0a47
Commit
021a0a47
authored
Oct 25, 2019
by
zhuangzhuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改influxdb的配置
parent
db872313
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
26 deletions
+35
-26
WarehouseController.java
src/main/java/com/example/tdl/web/WarehouseController.java
+21
-17
application-docker.properties
src/main/resources/application-docker.properties
+9
-9
application.properties
src/main/resources/application.properties
+5
-0
No files found.
src/main/java/com/example/tdl/web/WarehouseController.java
View file @
021a0a47
...
@@ -37,6 +37,7 @@ import javax.xml.crypto.Data;
...
@@ -37,6 +37,7 @@ import javax.xml.crypto.Data;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.math.BigDecimal
;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormat
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
...
@@ -85,6 +86,9 @@ public class WarehouseController {
...
@@ -85,6 +86,9 @@ public class WarehouseController {
@Value
(
"${spring.influxdb.database}"
)
@Value
(
"${spring.influxdb.database}"
)
private
String
database
;
private
String
database
;
DecimalFormat
df
=
new
DecimalFormat
(
"0.0"
);
//查询所有仓库信息
//查询所有仓库信息
@ApiOperation
(
value
=
"查询所有仓库信息"
,
notes
=
"查询所有仓库信息,返回值说明:"
+
@ApiOperation
(
value
=
"查询所有仓库信息"
,
notes
=
"查询所有仓库信息,返回值说明:"
+
" warehouseName:仓库名,"
+
" warehouseName:仓库名,"
+
...
@@ -342,7 +346,7 @@ public class WarehouseController {
...
@@ -342,7 +346,7 @@ public class WarehouseController {
}
}
//根据网关线路编号获取时间
//根据网关线路编号获取时间
Long
startTime
=
tdlLogService
.
getTimeByWarehouseNo
(
warehouseNo
,
list
.
get
(
a
).
getSN
());
Long
startTime
=
tdlLogService
.
getTimeByWarehouseNo
(
warehouseNo
,
list
.
get
(
a
).
getSN
());
String
sql
=
"SELECT \"battery\" FROM \"tdl_policy\".\""
+
list
.
get
(
a
).
getDevice
()
+
"\"
where time >=
"
+
startTime
*
1000000
l
+
" ORDER BY time DESC LIMIT 1"
;
String
sql
=
"SELECT \"battery\" FROM \"tdl_policy\".\""
+
list
.
get
(
a
).
getDevice
()
+
"\"
where time >
"
+
startTime
*
1000000
l
+
" ORDER BY time DESC LIMIT 1"
;
QueryResult
queryResult
=
influxDBTemplate
.
query
(
new
Query
(
sql
,
database
));
QueryResult
queryResult
=
influxDBTemplate
.
query
(
new
Query
(
sql
,
database
));
if
(
queryResult
.
getResults
().
get
(
0
).
getSeries
()
!=
null
)
{
if
(
queryResult
.
getResults
().
get
(
0
).
getSeries
()
!=
null
)
{
if
(
Double
.
valueOf
(
queryResult
.
getResults
().
get
(
0
).
getSeries
().
get
(
0
).
getValues
().
get
(
0
).
get
(
1
).
toString
())>
0
){
if
(
Double
.
valueOf
(
queryResult
.
getResults
().
get
(
0
).
getSeries
().
get
(
0
).
getValues
().
get
(
0
).
get
(
1
).
toString
())>
0
){
...
@@ -362,9 +366,9 @@ public class WarehouseController {
...
@@ -362,9 +366,9 @@ public class WarehouseController {
QueryResult
queryResults
=
influxDBTemplate
.
query
(
new
Query
(
sqls
,
database
));
QueryResult
queryResults
=
influxDBTemplate
.
query
(
new
Query
(
sqls
,
database
));
if
(
queryResults
.
getResults
().
get
(
0
).
getSeries
()
!=
null
)
{
if
(
queryResults
.
getResults
().
get
(
0
).
getSeries
()
!=
null
)
{
tdlDeviceDetailVo
.
setTime
(
parseTime
(
queryResults
.
getResults
().
get
(
0
).
getSeries
().
get
(
0
).
getValues
().
get
(
0
).
get
(
0
).
toString
()));
tdlDeviceDetailVo
.
setTime
(
parseTime
(
queryResults
.
getResults
().
get
(
0
).
getSeries
().
get
(
0
).
getValues
().
get
(
0
).
get
(
0
).
toString
()));
tdlDeviceDetailVo
.
setPressure
(
queryResults
.
getResults
().
get
(
0
).
getSeries
().
get
(
0
).
getValues
().
get
(
0
).
get
(
1
).
toString
(
));
tdlDeviceDetailVo
.
setPressure
(
df
.
format
(
new
BigDecimal
(
queryResults
.
getResults
().
get
(
0
).
getSeries
().
get
(
0
).
getValues
().
get
(
0
).
get
(
1
).
toString
())
));
tdlDeviceDetailVo
.
setTemperature
(
queryResults
.
getResults
().
get
(
0
).
getSeries
().
get
(
0
).
getValues
().
get
(
0
).
get
(
2
).
toString
(
));
tdlDeviceDetailVo
.
setTemperature
(
df
.
format
(
new
BigDecimal
(
queryResults
.
getResults
().
get
(
0
).
getSeries
().
get
(
0
).
getValues
().
get
(
0
).
get
(
2
).
toString
())
));
tdlDeviceDetailVo
.
setHumidity
(
queryResults
.
getResults
().
get
(
0
).
getSeries
().
get
(
0
).
getValues
().
get
(
0
).
get
(
3
).
toString
(
));
tdlDeviceDetailVo
.
setHumidity
(
df
.
format
(
new
BigDecimal
(
queryResults
.
getResults
().
get
(
0
).
getSeries
().
get
(
0
).
getValues
().
get
(
0
).
get
(
3
).
toString
())
));
}
else
{
}
else
{
tdlDeviceDetailVo
.
setTime
(
"NA"
);
tdlDeviceDetailVo
.
setTime
(
"NA"
);
tdlDeviceDetailVo
.
setPressure
(
"NA"
);
tdlDeviceDetailVo
.
setPressure
(
"NA"
);
...
@@ -1047,9 +1051,9 @@ public class WarehouseController {
...
@@ -1047,9 +1051,9 @@ public class WarehouseController {
ResultAlarmVo
resultAlarmVo
=
alarmService
.
getAlarmByWarehouseNo
(
warehouseVo
.
getWarehouseNo
(),
gatewayOnLineVos
.
get
(
a
).
getgSN
(),
tdls
.
get
(
b
).
replace
(
"TDL-"
,
""
).
trim
());
ResultAlarmVo
resultAlarmVo
=
alarmService
.
getAlarmByWarehouseNo
(
warehouseVo
.
getWarehouseNo
(),
gatewayOnLineVos
.
get
(
a
).
getgSN
(),
tdls
.
get
(
b
).
replace
(
"TDL-"
,
""
).
trim
());
if
(
queryResults
.
getResults
().
get
(
0
).
getSeries
()
!=
null
)
{
if
(
queryResults
.
getResults
().
get
(
0
).
getSeries
()
!=
null
)
{
warehouseDataVo
.
setTime
(
UTCToCST
(
queryResults
.
getResults
().
get
(
0
).
getSeries
().
get
(
0
).
getValues
().
get
(
0
).
get
(
0
).
toString
(),
warehouseVo
.
getOffset
()==
null
?
"+8"
:
warehouseVo
.
getOffset
()));
warehouseDataVo
.
setTime
(
UTCToCST
(
queryResults
.
getResults
().
get
(
0
).
getSeries
().
get
(
0
).
getValues
().
get
(
0
).
get
(
0
).
toString
(),
warehouseVo
.
getOffset
()==
null
?
"+8"
:
warehouseVo
.
getOffset
()));
warehouseDataVo
.
setBatteryVoltage
(
queryResults
.
getResults
().
get
(
0
).
getSeries
().
get
(
0
).
getValues
().
get
(
0
).
get
(
2
).
toString
(
));
warehouseDataVo
.
setBatteryVoltage
(
df
.
format
(
new
BigDecimal
(
queryResults
.
getResults
().
get
(
0
).
getSeries
().
get
(
0
).
getValues
().
get
(
0
).
get
(
2
).
toString
())
));
warehouseDataVo
.
setTemperature
(
queryResults
.
getResults
().
get
(
0
).
getSeries
().
get
(
0
).
getValues
().
get
(
0
).
get
(
3
).
toString
(
));
warehouseDataVo
.
setTemperature
(
df
.
format
(
new
BigDecimal
(
queryResults
.
getResults
().
get
(
0
).
getSeries
().
get
(
0
).
getValues
().
get
(
0
).
get
(
3
).
toString
())
));
warehouseDataVo
.
setHumidity
(
queryResults
.
getResults
().
get
(
0
).
getSeries
().
get
(
0
).
getValues
().
get
(
0
).
get
(
4
).
toString
(
));
warehouseDataVo
.
setHumidity
(
df
.
format
(
new
BigDecimal
(
queryResults
.
getResults
().
get
(
0
).
getSeries
().
get
(
0
).
getValues
().
get
(
0
).
get
(
4
).
toString
())
));
}
else
{
}
else
{
warehouseDataVo
.
setTime
(
"NA"
);
warehouseDataVo
.
setTime
(
"NA"
);
warehouseDataVo
.
setBatteryVoltage
(
"NA"
);
warehouseDataVo
.
setBatteryVoltage
(
"NA"
);
...
@@ -1306,12 +1310,12 @@ public class WarehouseController {
...
@@ -1306,12 +1310,12 @@ public class WarehouseController {
String
time
=
UTCToCST
(
value
.
get
(
0
).
toString
(),
offset
);
String
time
=
UTCToCST
(
value
.
get
(
0
).
toString
(),
offset
);
WarehouseTimeAndDataVo
warehouseTimeAndDataVo
=
new
WarehouseTimeAndDataVo
();
WarehouseTimeAndDataVo
warehouseTimeAndDataVo
=
new
WarehouseTimeAndDataVo
();
warehouseTimeAndDataVo
.
setTime
(
time
);
warehouseTimeAndDataVo
.
setTime
(
time
);
warehouseTimeAndDataVo
.
setValue
(
value
.
get
(
3
)==
null
?
""
:
value
.
get
(
3
).
toString
(
));
warehouseTimeAndDataVo
.
setValue
(
value
.
get
(
3
)==
null
?
""
:
df
.
format
(
new
BigDecimal
(
value
.
get
(
3
).
toString
())
));
historyDataList
.
add
(
warehouseTimeAndDataVo
);
historyDataList
.
add
(
warehouseTimeAndDataVo
);
WarehouseTimeAndDataVo
warehouseTimeAndDataVos
=
new
WarehouseTimeAndDataVo
();
WarehouseTimeAndDataVo
warehouseTimeAndDataVos
=
new
WarehouseTimeAndDataVo
();
warehouseTimeAndDataVos
.
setTime
(
time
);
warehouseTimeAndDataVos
.
setTime
(
time
);
warehouseTimeAndDataVos
.
setValue
(
value
.
get
(
2
)==
null
?
""
:
value
.
get
(
2
).
toString
(
));
warehouseTimeAndDataVos
.
setValue
(
value
.
get
(
2
)==
null
?
""
:
df
.
format
(
new
BigDecimal
(
value
.
get
(
2
).
toString
())
));
historyDataLists
.
add
(
warehouseTimeAndDataVos
);
historyDataLists
.
add
(
warehouseTimeAndDataVos
);
}
}
WarehouseTDLDetailVo
warehouseTDLDetailVo
=
new
WarehouseTDLDetailVo
();
WarehouseTDLDetailVo
warehouseTDLDetailVo
=
new
WarehouseTDLDetailVo
();
...
@@ -1337,7 +1341,7 @@ public class WarehouseController {
...
@@ -1337,7 +1341,7 @@ public class WarehouseController {
for
(
List
<
Object
>
value:
values
){
for
(
List
<
Object
>
value:
values
){
WarehouseTimeAndDataVo
warehouseTimeAndDataVo
=
new
WarehouseTimeAndDataVo
();
WarehouseTimeAndDataVo
warehouseTimeAndDataVo
=
new
WarehouseTimeAndDataVo
();
warehouseTimeAndDataVo
.
setTime
(
UTCToCST
(
value
.
get
(
0
).
toString
(),
offset
));
warehouseTimeAndDataVo
.
setTime
(
UTCToCST
(
value
.
get
(
0
).
toString
(),
offset
));
warehouseTimeAndDataVo
.
setValue
(
value
.
get
(
3
)==
null
?
""
:
value
.
get
(
3
).
toString
(
));
warehouseTimeAndDataVo
.
setValue
(
value
.
get
(
3
)==
null
?
""
:
df
.
format
(
new
BigDecimal
(
value
.
get
(
3
).
toString
())
));
historyDataList
.
add
(
warehouseTimeAndDataVo
);
historyDataList
.
add
(
warehouseTimeAndDataVo
);
}
}
return
historyDataList
;
return
historyDataList
;
...
@@ -1351,7 +1355,7 @@ public class WarehouseController {
...
@@ -1351,7 +1355,7 @@ public class WarehouseController {
for
(
List
<
Object
>
value:
values
){
for
(
List
<
Object
>
value:
values
){
WarehouseTimeAndDataVo
warehouseTimeAndDataVo
=
new
WarehouseTimeAndDataVo
();
WarehouseTimeAndDataVo
warehouseTimeAndDataVo
=
new
WarehouseTimeAndDataVo
();
warehouseTimeAndDataVo
.
setTime
(
UTCToCST
(
value
.
get
(
0
).
toString
(),
offset
));
warehouseTimeAndDataVo
.
setTime
(
UTCToCST
(
value
.
get
(
0
).
toString
(),
offset
));
warehouseTimeAndDataVo
.
setValue
(
value
.
get
(
4
)==
null
?
""
:
value
.
get
(
4
).
toString
(
));
warehouseTimeAndDataVo
.
setValue
(
value
.
get
(
4
)==
null
?
""
:
df
.
format
(
new
BigDecimal
(
value
.
get
(
4
).
toString
())
));
historyDataList
.
add
(
warehouseTimeAndDataVo
);
historyDataList
.
add
(
warehouseTimeAndDataVo
);
}
}
return
historyDataList
;
return
historyDataList
;
...
@@ -1453,22 +1457,22 @@ public class WarehouseController {
...
@@ -1453,22 +1457,22 @@ public class WarehouseController {
List
<
TdlDataVo
.
HistoryDataVo
>
historyDataList
=
new
ArrayList
<>();
List
<
TdlDataVo
.
HistoryDataVo
>
historyDataList
=
new
ArrayList
<>();
for
(
int
i
=
0
,
length
=
values
.
size
();
i
<
length
;
i
++){
for
(
int
i
=
0
,
length
=
values
.
size
();
i
<
length
;
i
++){
TdlDataVo
.
HistoryDataVo
historyDataVo
=
new
TdlDataVo
.
HistoryDataVo
();
TdlDataVo
.
HistoryDataVo
historyDataVo
=
new
TdlDataVo
.
HistoryDataVo
();
historyDataVo
.
setHumidity
(
values
.
get
(
i
).
get
(
2
)==
null
?
""
:
values
.
get
(
i
).
get
(
2
).
toString
(
)
);
historyDataVo
.
setHumidity
(
values
.
get
(
i
).
get
(
2
)==
null
?
""
:
df
.
format
(
new
BigDecimal
(
values
.
get
(
i
).
get
(
2
).
toString
())
)
);
historyDataVo
.
setTemp
(
values
.
get
(
i
).
get
(
1
)==
null
?
""
:
values
.
get
(
i
).
get
(
1
).
toString
(
)
);
historyDataVo
.
setTemp
(
values
.
get
(
i
).
get
(
1
)==
null
?
""
:
df
.
format
(
new
BigDecimal
(
values
.
get
(
i
).
get
(
1
).
toString
())
)
);
String
time
=
UTCToCST
(
values
.
get
(
i
).
get
(
0
).
toString
());
String
time
=
UTCToCST
(
values
.
get
(
i
).
get
(
0
).
toString
());
historyDataVo
.
setTime
(
Long
.
valueOf
(
time
));
historyDataVo
.
setTime
(
Long
.
valueOf
(
time
));
historyDataList
.
add
(
historyDataVo
);
historyDataList
.
add
(
historyDataVo
);
HistoryData
tem
=
new
HistoryData
();
HistoryData
tem
=
new
HistoryData
();
tem
.
setTime
(
time
);
tem
.
setTime
(
time
);
tem
.
setValue
(
values
.
get
(
i
).
get
(
1
)==
null
?
""
:
values
.
get
(
i
).
get
(
1
).
toString
(
));
tem
.
setValue
(
values
.
get
(
i
).
get
(
1
)==
null
?
""
:
df
.
format
(
new
BigDecimal
(
values
.
get
(
i
).
get
(
1
).
toString
())
));
tempData
.
add
(
tem
);
tempData
.
add
(
tem
);
HistoryData
hump
=
new
HistoryData
();
HistoryData
hump
=
new
HistoryData
();
hump
.
setTime
(
time
);
hump
.
setTime
(
time
);
hump
.
setValue
(
values
.
get
(
i
).
get
(
2
)==
null
?
""
:
values
.
get
(
i
).
get
(
2
).
toString
(
));
hump
.
setValue
(
values
.
get
(
i
).
get
(
2
)==
null
?
""
:
df
.
format
(
new
BigDecimal
(
values
.
get
(
i
).
get
(
2
).
toString
())
));
humpData
.
add
(
hump
);
humpData
.
add
(
hump
);
if
(
i
==
length
-
1
){
if
(
i
==
length
-
1
){
tdlDataVo
.
setHumidity
(
values
.
get
(
i
).
get
(
2
)==
null
?
""
:
values
.
get
(
i
).
get
(
2
).
toString
(
));
tdlDataVo
.
setHumidity
(
values
.
get
(
i
).
get
(
2
)==
null
?
""
:
df
.
format
(
new
BigDecimal
(
values
.
get
(
i
).
get
(
2
).
toString
())
));
tdlDataVo
.
setTemp
(
values
.
get
(
i
).
get
(
1
)==
null
?
""
:
values
.
get
(
i
).
get
(
1
).
toString
(
));
tdlDataVo
.
setTemp
(
values
.
get
(
i
).
get
(
1
)==
null
?
""
:
df
.
format
(
new
BigDecimal
(
values
.
get
(
i
).
get
(
1
).
toString
())
));
}
}
}
}
temp
.
setHistoryDataList
(
tempData
);
temp
.
setHistoryDataList
(
tempData
);
...
...
src/main/resources/application-docker.properties
View file @
021a0a47
...
@@ -15,15 +15,15 @@ tdl.redis.password=Witium37774020
...
@@ -15,15 +15,15 @@ tdl.redis.password=Witium37774020
server.port
=
8092
server.port
=
8092
# InfluxDB
# InfluxDB
#
spring.influxdb.url=https://ts-bp1q738i505oj79t7.influxdata.tsdb.aliyuncs.com:8086
spring.influxdb.url
=
https://ts-bp1q738i505oj79t7.influxdata.tsdb.aliyuncs.com:8086
#
spring.influxdb.username=witcloud
spring.influxdb.username
=
witcloud
#
spring.influxdb.password=Witcloud37774020
spring.influxdb.password
=
Witcloud37774020
#spring.influxdb.database=logistics
spring.influxdb.database
=
warehouse-bosch
spring.influxdb.url
=
http://witcloud-influxdb:8086
#
spring.influxdb.url=http://witcloud-influxdb:8086
spring.influxdb.username
=
admin
#
spring.influxdb.username=admin
spring.influxdb.password
=
37774020
#
spring.influxdb.password=37774020
spring.influxdb.database
=
original
#
spring.influxdb.database=original
tdl.mqtt.url
=
ssl://47.96.128.181
tdl.mqtt.url
=
ssl://47.96.128.181
...
...
src/main/resources/application.properties
View file @
021a0a47
...
@@ -55,6 +55,11 @@ spring.influxdb.username=witcloud
...
@@ -55,6 +55,11 @@ spring.influxdb.username=witcloud
spring.influxdb.password
=
Witcloud37774020
spring.influxdb.password
=
Witcloud37774020
spring.influxdb.url
=
https://ts-bp1q738i505oj79t7.influxdata.rds.aliyuncs.com:3242
spring.influxdb.url
=
https://ts-bp1q738i505oj79t7.influxdata.rds.aliyuncs.com:3242
spring.influxdb.database
=
logistics
spring.influxdb.database
=
logistics
#spring.influxdb.url=http://47.97.184.225:8086
#spring.influxdb.username=admin
#spring.influxdb.password=37774020
#spring.influxdb.database=original
spring.influxdb.retentionPolicy
=
tdl_policy
spring.influxdb.retentionPolicy
=
tdl_policy
spring.influxdb.connent-timeout
=
10
spring.influxdb.connent-timeout
=
10
spring.influxdb.read-timeout
=
30
spring.influxdb.read-timeout
=
30
...
...
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