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
f4a76c00
Commit
f4a76c00
authored
Mar 19, 2018
by
zhuangzhuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
3.19--tdl与gateway的绑定、解绑接口;获取历史数据以及实时数据的接口,修改角色的返回值
parent
5a4afdd8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
52 changed files
with
1594 additions
and
436 deletions
+1594
-436
InfluxDBConfiguration.java
...in/java/com/example/tdl/config/InfluxDBConfiguration.java
+45
-0
Influxdbconfig.java
src/main/java/com/example/tdl/config/Influxdbconfig.java
+0
-55
RedisConfig.java
src/main/java/com/example/tdl/config/RedisConfig.java
+12
-5
AddAlarmLogVo.java
src/main/java/com/example/tdl/domain/vo/AddAlarmLogVo.java
+7
-7
BindingVo.java
src/main/java/com/example/tdl/domain/vo/BindingVo.java
+64
-0
ConfigCMDVo.java
src/main/java/com/example/tdl/domain/vo/ConfigCMDVo.java
+20
-0
DeviceDataVo.java
src/main/java/com/example/tdl/domain/vo/DeviceDataVo.java
+64
-0
Humidity.java
src/main/java/com/example/tdl/domain/vo/Humidity.java
+26
-0
HumidityDataVo.java
src/main/java/com/example/tdl/domain/vo/HumidityDataVo.java
+24
-0
LiveDataVo.java
src/main/java/com/example/tdl/domain/vo/LiveDataVo.java
+26
-0
LocationDataVo.java
src/main/java/com/example/tdl/domain/vo/LocationDataVo.java
+44
-0
LocationMessageVo.java
...ain/java/com/example/tdl/domain/vo/LocationMessageVo.java
+126
-0
LocationVo.java
src/main/java/com/example/tdl/domain/vo/LocationVo.java
+45
-0
NumberVo.java
src/main/java/com/example/tdl/domain/vo/NumberVo.java
+24
-0
ProbesVo.java
src/main/java/com/example/tdl/domain/vo/ProbesVo.java
+84
-0
RoleNameVo.java
src/main/java/com/example/tdl/domain/vo/RoleNameVo.java
+14
-0
ShockEnergy.java
src/main/java/com/example/tdl/domain/vo/ShockEnergy.java
+26
-0
ShockEnergyVo.java
src/main/java/com/example/tdl/domain/vo/ShockEnergyVo.java
+24
-0
Temperature.java
src/main/java/com/example/tdl/domain/vo/Temperature.java
+26
-0
TemperatureDataVo.java
...ain/java/com/example/tdl/domain/vo/TemperatureDataVo.java
+24
-0
TiltAngle.java
src/main/java/com/example/tdl/domain/vo/TiltAngle.java
+26
-0
TiltAngleVo.java
src/main/java/com/example/tdl/domain/vo/TiltAngleVo.java
+23
-0
AlarmLog.java
src/main/java/com/example/tdl/entity/AlarmLog.java
+5
-5
PermissionInterceptor.java
...va/com/example/tdl/interceptor/PermissionInterceptor.java
+0
-2
AlarmLogMapper.java
src/main/java/com/example/tdl/mapper/AlarmLogMapper.java
+1
-0
CircuitMapper.java
src/main/java/com/example/tdl/mapper/CircuitMapper.java
+3
-4
ConfigMapper.java
src/main/java/com/example/tdl/mapper/ConfigMapper.java
+7
-2
ProbesMapper.java
src/main/java/com/example/tdl/mapper/ProbesMapper.java
+3
-0
RoleMapper.java
src/main/java/com/example/tdl/mapper/RoleMapper.java
+2
-1
TDLDeviceMapper.java
src/main/java/com/example/tdl/mapper/TDLDeviceMapper.java
+3
-0
AlarmLogService.java
src/main/java/com/example/tdl/service/AlarmLogService.java
+5
-1
CircuitService.java
src/main/java/com/example/tdl/service/CircuitService.java
+5
-4
ConfigService.java
src/main/java/com/example/tdl/service/ConfigService.java
+13
-3
InfluxDBService.java
src/main/java/com/example/tdl/service/InfluxDBService.java
+0
-244
ProbesService.java
src/main/java/com/example/tdl/service/ProbesService.java
+5
-0
RoleService.java
src/main/java/com/example/tdl/service/RoleService.java
+2
-1
TDLDeviceService.java
src/main/java/com/example/tdl/service/TDLDeviceService.java
+4
-0
RealRedisService.java
.../java/com/example/tdl/service/redis/RealRedisService.java
+16
-0
RedisService.java
...main/java/com/example/tdl/service/redis/RedisService.java
+3
-55
AlarmLogController.java
src/main/java/com/example/tdl/web/AlarmLogController.java
+4
-4
DataController.java
src/main/java/com/example/tdl/web/DataController.java
+489
-6
EquipmentBindingController.java
.../java/com/example/tdl/web/EquipmentBindingController.java
+152
-0
GatewayController.java
src/main/java/com/example/tdl/web/GatewayController.java
+3
-0
HomePageController.java
src/main/java/com/example/tdl/web/HomePageController.java
+5
-5
TDLDeviceController.java
src/main/java/com/example/tdl/web/TDLDeviceController.java
+0
-7
application.properties
src/main/resources/application.properties
+10
-5
AlarmLogMapper.xml
src/main/resources/mapper/AlarmLogMapper.xml
+1
-1
CircuitMapper.xml
src/main/resources/mapper/CircuitMapper.xml
+7
-0
ConfigMapper.xml
src/main/resources/mapper/ConfigMapper.xml
+54
-18
ProbesMapper.xml
src/main/resources/mapper/ProbesMapper.xml
+13
-0
RoleMapper.xml
src/main/resources/mapper/RoleMapper.xml
+1
-1
TDLDeviceMapper.xml
src/main/resources/mapper/TDLDeviceMapper.xml
+4
-0
No files found.
src/main/java/com/example/tdl/config/InfluxDBConfiguration.java
0 → 100644
View file @
f4a76c00
package
com
.
example
.
tdl
.
config
;
import
org.influxdb.dto.Point
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.influxdb.DefaultInfluxDBTemplate
;
import
org.springframework.data.influxdb.InfluxDBConnectionFactory
;
import
org.springframework.data.influxdb.InfluxDBProperties
;
import
org.springframework.data.influxdb.InfluxDBTemplate
;
import
org.springframework.data.influxdb.converter.PointConverter
;
@Configuration
@EnableConfigurationProperties
(
value
=
InfluxDBProperties
.
class
)
public
class
InfluxDBConfiguration
{
@Bean
public
InfluxDBConnectionFactory
connectionFactory
(
final
InfluxDBProperties
properties
)
{
return
new
InfluxDBConnectionFactory
(
properties
);
}
@Bean
public
InfluxDBTemplate
<
Point
>
influxDBTemplate
(
final
InfluxDBConnectionFactory
connectionFactory
)
{
/*
* You can use your own 'PointCollectionConverter' implementation, e.g. in case
* you want to use your own custom measurement object.
*/
return
new
InfluxDBTemplate
<>(
connectionFactory
,
new
PointConverter
());
}
@Bean
public
DefaultInfluxDBTemplate
defaultTemplate
(
final
InfluxDBConnectionFactory
connectionFactory
)
{
/* * If you are just dealing with Point objects from 'influxdb-java' you could
* also use an instance of class DefaultInfluxDBTemplate.*/
return
new
DefaultInfluxDBTemplate
(
connectionFactory
);
}
}
src/main/java/com/example/tdl/config/Influxdbconfig.java
deleted
100644 → 0
View file @
5a4afdd8
package
com
.
example
.
tdl
.
config
;
import
org.influxdb.InfluxDB
;
import
org.influxdb.InfluxDBFactory
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
@Configuration
@ConfigurationProperties
(
prefix
=
"tdl.influxdb"
)
public
class
Influxdbconfig
{
private
String
user
;
private
String
password
;
private
String
host
;
private
String
database
;
public
String
getUser
()
{
return
user
;
}
public
void
setUser
(
String
user
)
{
this
.
user
=
user
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
String
getHost
()
{
return
host
;
}
public
void
setHost
(
String
host
)
{
this
.
host
=
host
;
}
public
String
getDatabase
()
{
return
database
;
}
public
void
setDatabase
(
String
database
)
{
this
.
database
=
database
;
}
@Bean
public
InfluxDB
influxDB
()
{
return
InfluxDBFactory
.
connect
(
host
,
user
,
password
);
}
}
src/main/java/com/example/tdl/config/RedisConfig.java
View file @
f4a76c00
...
...
@@ -202,19 +202,26 @@ public class RedisConfig extends CachingConfigurerSupport{
* @param
* @return
*/
//@SuppressWarnings({"rawtypes", "unchecked"})
@Bean
public
RedisTemplate
<
String
,
String
>
tokenR
edisTemplate
()
{
StringRedisTemplate
template
=
new
StringRedisTemplate
(
redisConnectionFactory
(
15
));
JsonRedisSerializer
(
template
,
fals
e
);
public
RedisTemplate
<
String
,
String
>
r
edisTemplate
()
{
StringRedisTemplate
template
=
new
StringRedisTemplate
(
redisConnectionFactory
(
0
));
JsonRedisSerializer
(
template
,
tru
e
);
return
template
;
}
@Bean
public
RedisTemplate
<
String
,
String
>
redisTemplate
()
{
public
RedisTemplate
<
String
,
String
>
re
alRe
disTemplate
()
{
StringRedisTemplate
template
=
new
StringRedisTemplate
(
redisConnectionFactory
(
1
));
JsonRedisSerializer
(
template
,
true
);
return
template
;
}
@Bean
public
RedisTemplate
<
String
,
String
>
tokenRedisTemplate
()
{
StringRedisTemplate
template
=
new
StringRedisTemplate
(
redisConnectionFactory
(
15
));
JsonRedisSerializer
(
template
,
false
);
return
template
;
}
}
src/main/java/com/example/tdl/domain/vo/AddAlarmLogVo.java
View file @
f4a76c00
...
...
@@ -2,7 +2,7 @@ package com.example.tdl.domain.vo;
public
class
AddAlarmLogVo
{
private
String
routeNumber
;
private
String
transportationNo
;
private
String
routeName
;
...
...
@@ -15,20 +15,20 @@ public class AddAlarmLogVo {
public
AddAlarmLogVo
()
{
}
public
AddAlarmLogVo
(
String
routeNumber
,
String
routeName
,
String
description
,
Float
data
,
Long
alarmTime
)
{
this
.
routeNumber
=
routeNumber
;
public
AddAlarmLogVo
(
String
transportationNo
,
String
routeName
,
String
description
,
Float
data
,
Long
alarmTime
)
{
this
.
transportationNo
=
transportationNo
;
this
.
routeName
=
routeName
;
this
.
description
=
description
;
this
.
data
=
data
;
this
.
alarmTime
=
alarmTime
;
}
public
String
get
RouteNumber
()
{
return
routeNumber
;
public
String
get
TransportationNo
()
{
return
transportationNo
;
}
public
void
set
RouteNumber
(
String
routeNumber
)
{
this
.
routeNumber
=
routeNumber
;
public
void
set
TransportationNo
(
String
transportationNo
)
{
this
.
transportationNo
=
transportationNo
;
}
public
String
getRouteName
()
{
...
...
src/main/java/com/example/tdl/domain/vo/BindingVo.java
0 → 100644
View file @
f4a76c00
package
com
.
example
.
tdl
.
domain
.
vo
;
public
class
BindingVo
{
private
String
SN
;
private
String
type
;
private
Integer
mode
;
private
String
TDLSN
;
private
String
transportationNo
;
private
String
warehouseNo
;
public
String
getSN
()
{
return
SN
;
}
public
void
setSN
(
String
SN
)
{
this
.
SN
=
SN
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
Integer
getMode
()
{
return
mode
;
}
public
void
setMode
(
Integer
mode
)
{
this
.
mode
=
mode
;
}
public
String
getTDLSN
()
{
return
TDLSN
;
}
public
void
setTDLSN
(
String
TDLSN
)
{
this
.
TDLSN
=
TDLSN
;
}
public
String
getTransportationNo
()
{
return
transportationNo
;
}
public
void
setTransportationNo
(
String
transportationNo
)
{
this
.
transportationNo
=
transportationNo
;
}
public
String
getWarehouseNo
()
{
return
warehouseNo
;
}
public
void
setWarehouseNo
(
String
warehouseNo
)
{
this
.
warehouseNo
=
warehouseNo
;
}
}
src/main/java/com/example/tdl/domain/vo/ConfigCMDVo.java
View file @
f4a76c00
...
...
@@ -16,6 +16,26 @@ public class ConfigCMDVo {
private
Long
t
;
//配置时的时间戳
public
ConfigCMDVo
()
{
}
public
ConfigCMDVo
(
String
action
,
Integer
gpsPeriod
,
Integer
gprsPeriod
,
List
<
String
>
devList
,
Integer
mode
)
{
this
.
action
=
action
;
this
.
gpsPeriod
=
gpsPeriod
;
this
.
gprsPeriod
=
gprsPeriod
;
this
.
devList
=
devList
;
this
.
mode
=
mode
;
}
public
ConfigCMDVo
(
String
action
,
Integer
gpsPeriod
,
Integer
gprsPeriod
,
List
<
String
>
devList
,
Integer
mode
,
Long
t
)
{
this
.
action
=
action
;
this
.
gpsPeriod
=
gpsPeriod
;
this
.
gprsPeriod
=
gprsPeriod
;
this
.
devList
=
devList
;
this
.
mode
=
mode
;
this
.
t
=
t
;
}
public
String
getAction
()
{
return
action
;
}
...
...
src/main/java/com/example/tdl/domain/vo/DeviceDataVo.java
0 → 100644
View file @
f4a76c00
package
com
.
example
.
tdl
.
domain
.
vo
;
public
class
DeviceDataVo
{
private
String
time
;
private
String
temperature
;
private
String
humidity
;
private
String
pressure
;
private
String
shockEnergy
;
private
String
tiltAngle
;
public
String
getTime
()
{
return
time
;
}
public
void
setTime
(
String
time
)
{
this
.
time
=
time
;
}
public
String
getTemperature
()
{
return
temperature
;
}
public
void
setTemperature
(
String
temperature
)
{
this
.
temperature
=
temperature
;
}
public
String
getHumidity
()
{
return
humidity
;
}
public
void
setHumidity
(
String
humidity
)
{
this
.
humidity
=
humidity
;
}
public
String
getPressure
()
{
return
pressure
;
}
public
void
setPressure
(
String
pressure
)
{
this
.
pressure
=
pressure
;
}
public
String
getShockEnergy
()
{
return
shockEnergy
;
}
public
void
setShockEnergy
(
String
shockEnergy
)
{
this
.
shockEnergy
=
shockEnergy
;
}
public
String
getTiltAngle
()
{
return
tiltAngle
;
}
public
void
setTiltAngle
(
String
tiltAngle
)
{
this
.
tiltAngle
=
tiltAngle
;
}
}
src/main/java/com/example/tdl/domain/vo/Humidity.java
0 → 100644
View file @
f4a76c00
package
com
.
example
.
tdl
.
domain
.
vo
;
import
java.util.List
;
public
class
Humidity
{
private
String
TDLSN
;
private
List
<
HumidityDataVo
>
humidityDataVoList
;
public
String
getTDLSN
()
{
return
TDLSN
;
}
public
void
setTDLSN
(
String
TDLSN
)
{
this
.
TDLSN
=
TDLSN
;
}
public
List
<
HumidityDataVo
>
getHumidityDataVoList
()
{
return
humidityDataVoList
;
}
public
void
setHumidityDataVoList
(
List
<
HumidityDataVo
>
humidityDataVoList
)
{
this
.
humidityDataVoList
=
humidityDataVoList
;
}
}
src/main/java/com/example/tdl/domain/vo/HumidityDataVo.java
0 → 100644
View file @
f4a76c00
package
com
.
example
.
tdl
.
domain
.
vo
;
public
class
HumidityDataVo
{
private
String
time
;
private
String
value
;
public
String
getTime
()
{
return
time
;
}
public
void
setTime
(
String
time
)
{
this
.
time
=
time
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
}
src/main/java/com/example/tdl/domain/vo/LiveDataVo.java
0 → 100644
View file @
f4a76c00
package
com
.
example
.
tdl
.
domain
.
vo
;
import
java.util.List
;
public
class
LiveDataVo
{
private
String
key
;
private
List
<
ProbesVo
>
probesVoList
;
public
String
getKey
()
{
return
key
;
}
public
void
setKey
(
String
key
)
{
this
.
key
=
key
;
}
public
List
<
ProbesVo
>
getProbesVoList
()
{
return
probesVoList
;
}
public
void
setProbesVoList
(
List
<
ProbesVo
>
probesVoList
)
{
this
.
probesVoList
=
probesVoList
;
}
}
src/main/java/com/example/tdl/domain/vo/LocationDataVo.java
0 → 100644
View file @
f4a76c00
package
com
.
example
.
tdl
.
domain
.
vo
;
public
class
LocationDataVo
{
private
String
time
;
private
Double
lng
;
private
Double
lat
;
private
Integer
error
;
//0 没有预警//1 发生预警
public
String
getTime
()
{
return
time
;
}
public
void
setTime
(
String
time
)
{
this
.
time
=
time
;
}
public
Double
getLng
()
{
return
lng
;
}
public
void
setLng
(
Double
lng
)
{
this
.
lng
=
lng
;
}
public
Double
getLat
()
{
return
lat
;
}
public
void
setLat
(
Double
lat
)
{
this
.
lat
=
lat
;
}
public
Integer
getError
()
{
return
error
;
}
public
void
setError
(
Integer
error
)
{
this
.
error
=
error
;
}
}
src/main/java/com/example/tdl/domain/vo/LocationMessageVo.java
0 → 100644
View file @
f4a76c00
package
com
.
example
.
tdl
.
domain
.
vo
;
import
java.util.List
;
public
class
LocationMessageVo
{
private
String
transportationNo
;
//运输编号
private
List
<
String
>
TDLSN
;
private
String
gatewaySN
;
private
String
startCity
;
private
String
endCity
;
private
String
startTime
;
private
String
endTime
;
private
Long
alarmTime
;
private
String
alarmType
;
private
String
alarmValue
;
private
String
lng
;
private
String
lat
;
public
String
getTransportationNo
()
{
return
transportationNo
;
}
public
void
setTransportationNo
(
String
transportationNo
)
{
this
.
transportationNo
=
transportationNo
;
}
public
List
<
String
>
getTDLSN
()
{
return
TDLSN
;
}
public
void
setTDLSN
(
List
<
String
>
TDLSN
)
{
this
.
TDLSN
=
TDLSN
;
}
public
String
getGatewaySN
()
{
return
gatewaySN
;
}
public
void
setGatewaySN
(
String
gatewaySN
)
{
this
.
gatewaySN
=
gatewaySN
;
}
public
String
getStartCity
()
{
return
startCity
;
}
public
void
setStartCity
(
String
startCity
)
{
this
.
startCity
=
startCity
;
}
public
String
getEndCity
()
{
return
endCity
;
}
public
void
setEndCity
(
String
endCity
)
{
this
.
endCity
=
endCity
;
}
public
String
getStartTime
()
{
return
startTime
;
}
public
void
setStartTime
(
String
startTime
)
{
this
.
startTime
=
startTime
;
}
public
String
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
String
endTime
)
{
this
.
endTime
=
endTime
;
}
public
Long
getAlarmTime
()
{
return
alarmTime
;
}
public
void
setAlarmTime
(
Long
alarmTime
)
{
this
.
alarmTime
=
alarmTime
;
}
public
String
getAlarmType
()
{
return
alarmType
;
}
public
void
setAlarmType
(
String
alarmType
)
{
this
.
alarmType
=
alarmType
;
}
public
String
getAlarmValue
()
{
return
alarmValue
;
}
public
void
setAlarmValue
(
String
alarmValue
)
{
this
.
alarmValue
=
alarmValue
;
}
public
String
getLng
()
{
return
lng
;
}
public
void
setLng
(
String
lng
)
{
this
.
lng
=
lng
;
}
public
String
getLat
()
{
return
lat
;
}
public
void
setLat
(
String
lat
)
{
this
.
lat
=
lat
;
}
}
src/main/java/com/example/tdl/domain/vo/LocationVo.java
0 → 100644
View file @
f4a76c00
package
com
.
example
.
tdl
.
domain
.
vo
;
public
class
LocationVo
{
private
Long
time
;
private
String
transportationNo
;
private
String
alarmType
;
private
String
vlaue
;
public
Long
getTime
()
{
return
time
;
}
public
void
setTime
(
Long
time
)
{
this
.
time
=
time
;
}
public
String
getTransportationNo
()
{
return
transportationNo
;
}
public
void
setTransportationNo
(
String
transportationNo
)
{
this
.
transportationNo
=
transportationNo
;
}
public
String
getAlarmType
()
{
return
alarmType
;
}
public
void
setAlarmType
(
String
alarmType
)
{
this
.
alarmType
=
alarmType
;
}
public
String
getVlaue
()
{
return
vlaue
;
}
public
void
setVlaue
(
String
vlaue
)
{
this
.
vlaue
=
vlaue
;
}
}
src/main/java/com/example/tdl/domain/vo/NumberVo.java
0 → 100644
View file @
f4a76c00
package
com
.
example
.
tdl
.
domain
.
vo
;
public
class
NumberVo
{
private
String
transportationNo
;
private
String
warehouseNo
;
public
String
getTransportationNo
()
{
return
transportationNo
;
}
public
void
setTransportationNo
(
String
transportationNo
)
{
this
.
transportationNo
=
transportationNo
;
}
public
String
getWarehouseNo
()
{
return
warehouseNo
;
}
public
void
setWarehouseNo
(
String
warehouseNo
)
{
this
.
warehouseNo
=
warehouseNo
;
}
}
src/main/java/com/example/tdl/domain/vo/ProbesVo.java
0 → 100644
View file @
f4a76c00
package
com
.
example
.
tdl
.
domain
.
vo
;
public
class
ProbesVo
{
private
Integer
port
;
private
String
unit
;
private
String
description
;
private
String
alias
;
private
String
type
;
private
Integer
alarmUp
;
private
Integer
alarmDown
;
private
String
value
;
public
Integer
getPort
()
{
return
port
;
}
public
void
setPort
(
Integer
port
)
{
this
.
port
=
port
;
}
public
String
getUnit
()
{
return
unit
;
}
public
void
setUnit
(
String
unit
)
{
this
.
unit
=
unit
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
String
getAlias
()
{
return
alias
;
}
public
void
setAlias
(
String
alias
)
{
this
.
alias
=
alias
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
Integer
getAlarmUp
()
{
return
alarmUp
;
}
public
void
setAlarmUp
(
Integer
alarmUp
)
{
this
.
alarmUp
=
alarmUp
;
}
public
Integer
getAlarmDown
()
{
return
alarmDown
;
}
public
void
setAlarmDown
(
Integer
alarmDown
)
{
this
.
alarmDown
=
alarmDown
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
}
src/main/java/com/example/tdl/domain/vo/RoleNameVo.java
0 → 100644
View file @
f4a76c00
package
com
.
example
.
tdl
.
domain
.
vo
;
public
class
RoleNameVo
{
private
String
roleName
;
public
String
getRoleName
()
{
return
roleName
;
}
public
void
setRoleName
(
String
roleName
)
{
this
.
roleName
=
roleName
;
}
}
src/main/java/com/example/tdl/domain/vo/ShockEnergy.java
0 → 100644
View file @
f4a76c00
package
com
.
example
.
tdl
.
domain
.
vo
;
import
java.util.List
;
public
class
ShockEnergy
{
private
String
TDLSN
;
private
List
<
ShockEnergyVo
>
shockEnergyVoList
;
public
String
getTDLSN
()
{
return
TDLSN
;
}
public
void
setTDLSN
(
String
TDLSN
)
{
this
.
TDLSN
=
TDLSN
;
}
public
List
<
ShockEnergyVo
>
getShockEnergyVoList
()
{
return
shockEnergyVoList
;
}
public
void
setShockEnergyVoList
(
List
<
ShockEnergyVo
>
shockEnergyVoList
)
{
this
.
shockEnergyVoList
=
shockEnergyVoList
;
}
}
src/main/java/com/example/tdl/domain/vo/ShockEnergyVo.java
0 → 100644
View file @
f4a76c00
package
com
.
example
.
tdl
.
domain
.
vo
;
public
class
ShockEnergyVo
{
private
String
time
;
private
String
value
;
public
String
getTime
()
{
return
time
;
}
public
void
setTime
(
String
time
)
{
this
.
time
=
time
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
}
src/main/java/com/example/tdl/domain/vo/Temperature.java
0 → 100644
View file @
f4a76c00
package
com
.
example
.
tdl
.
domain
.
vo
;
import
java.util.List
;
public
class
Temperature
{
private
String
TDLSN
;
private
List
<
TemperatureDataVo
>
temperatureDataVos
;
public
String
getTDLSN
()
{
return
TDLSN
;
}
public
void
setTDLSN
(
String
TDLSN
)
{
this
.
TDLSN
=
TDLSN
;
}
public
List
<
TemperatureDataVo
>
getTemperatureDataVos
()
{
return
temperatureDataVos
;
}
public
void
setTemperatureDataVos
(
List
<
TemperatureDataVo
>
temperatureDataVos
)
{
this
.
temperatureDataVos
=
temperatureDataVos
;
}
}
src/main/java/com/example/tdl/domain/vo/TemperatureDataVo.java
0 → 100644
View file @
f4a76c00
package
com
.
example
.
tdl
.
domain
.
vo
;
public
class
TemperatureDataVo
{
private
String
time
;
private
String
value
;
public
String
getTime
()
{
return
time
;
}
public
void
setTime
(
String
time
)
{
this
.
time
=
time
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
}
src/main/java/com/example/tdl/domain/vo/TiltAngle.java
0 → 100644
View file @
f4a76c00
package
com
.
example
.
tdl
.
domain
.
vo
;
import
java.util.List
;
public
class
TiltAngle
{
private
String
TDLSN
;
private
List
<
TiltAngleVo
>
shockEnergyVoList
;
public
String
getTDLSN
()
{
return
TDLSN
;
}
public
void
setTDLSN
(
String
TDLSN
)
{
this
.
TDLSN
=
TDLSN
;
}
public
List
<
TiltAngleVo
>
getShockEnergyVoList
()
{
return
shockEnergyVoList
;
}
public
void
setShockEnergyVoList
(
List
<
TiltAngleVo
>
shockEnergyVoList
)
{
this
.
shockEnergyVoList
=
shockEnergyVoList
;
}
}
src/main/java/com/example/tdl/domain/vo/TiltAngleVo.java
0 → 100644
View file @
f4a76c00
package
com
.
example
.
tdl
.
domain
.
vo
;
public
class
TiltAngleVo
{
private
String
time
;
private
String
value
;
public
String
getTime
()
{
return
time
;
}
public
void
setTime
(
String
time
)
{
this
.
time
=
time
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
}
src/main/java/com/example/tdl/entity/AlarmLog.java
View file @
f4a76c00
...
...
@@ -4,7 +4,7 @@ public class AlarmLog {
private
Integer
id
;
private
String
routeNumber
;
private
String
transportationNo
;
private
String
routeName
;
...
...
@@ -23,12 +23,12 @@ public class AlarmLog {
this
.
id
=
id
;
}
public
String
get
RouteNumber
()
{
return
routeNumber
;
public
String
get
TransportationNo
()
{
return
transportationNo
;
}
public
void
set
RouteNumber
(
String
routeNumber
)
{
this
.
routeNumber
=
routeNumber
;
public
void
set
TransportationNo
(
String
transportationNo
)
{
this
.
transportationNo
=
transportationNo
;
}
public
String
getRouteName
()
{
...
...
src/main/java/com/example/tdl/interceptor/PermissionInterceptor.java
View file @
f4a76c00
...
...
@@ -32,8 +32,6 @@ public class PermissionInterceptor implements HandlerInterceptor {
String
contextPath
=
request
.
getContextPath
();
String
url
=
requestUri
.
substring
(
contextPath
.
length
());
logger
.
info
(
"requestUri:"
+
requestUri
);
logger
.
info
(
"contextPath:"
+
contextPath
);
logger
.
info
(
"url:"
+
url
);
//获取用户信息以及对应的权限信息
UserVo
user
=
gson
.
fromJson
(
redisService
.
get
(
"TOKEN_"
+
request
.
getHeader
(
"Account_token"
)),
UserVo
.
class
);
...
...
src/main/java/com/example/tdl/mapper/AlarmLogMapper.java
View file @
f4a76c00
...
...
@@ -17,4 +17,5 @@ public interface AlarmLogMapper {
//新增报警数据
int
addAlarmLog
(
AddAlarmLogVo
addAlarmLogVo
);
List
<
AlarmLogVo
>
getByTransportationNo
(
String
transportationNo
);
}
src/main/java/com/example/tdl/mapper/CircuitMapper.java
View file @
f4a76c00
package
com
.
example
.
tdl
.
mapper
;
import
com.example.tdl.domain.vo.CircuitTermVo
;
import
com.example.tdl.domain.vo.ResultCircuitVo
;
import
com.example.tdl.domain.vo.ResultRouteVo
;
import
com.example.tdl.domain.vo.UpdateCircuitVo
;
import
com.example.tdl.domain.vo.*
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
...
...
@@ -24,4 +21,6 @@ public interface CircuitMapper {
int
delCircuit
(
String
transportationNo
);
ResultCircuitVo
getByTransportationNo
(
String
transportation
);
ResultGatewayVo
getByNo
(
String
transportationNo
);
}
src/main/java/com/example/tdl/mapper/ConfigMapper.java
View file @
f4a76c00
...
...
@@ -4,10 +4,14 @@ import com.example.tdl.domain.vo.ConfigVo;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Map
;
@Mapper
public
interface
ConfigMapper
{
int
addConfig
(
ConfigVo
configVo
);
// int addConfig(ConfigVo configVo);
int
addConfig
(
Map
<
Object
,
Object
>
map
);
ConfigVo
getConfig
(
@Param
(
"gSN"
)
String
gSN
,
@Param
(
"gType"
)
String
gType
);
...
...
@@ -15,5 +19,6 @@ public interface ConfigMapper {
int
bindiSuccess
(
@Param
(
"gSN"
)
String
gSN
,
@Param
(
"gType"
)
String
gType
,
@Param
(
"resp"
)
Integer
resp
);
int
updateConfig
(
@Param
(
"gSN"
)
String
gSN
,
@Param
(
"gType"
)
String
gType
,
@Param
(
"untie"
)
Boolean
untie
);
//int updateConfig(@Param("gSN") String gSN,@Param("gType") String gType,@Param("untie") Boolean untie);
int
updateConfig
(
Map
<
Object
,
Object
>
map
);
}
src/main/java/com/example/tdl/mapper/ProbesMapper.java
View file @
f4a76c00
package
com
.
example
.
tdl
.
mapper
;
import
com.example.tdl.domain.vo.ProbesVo
;
import
com.example.tdl.domain.vo.ResultProbesVo
;
import
com.example.tdl.domain.vo.UpdateProbesVo
;
import
org.apache.ibatis.annotations.Mapper
;
...
...
@@ -26,6 +27,8 @@ public interface ProbesMapper {
List
<
String
>
getNameByAliasList
(
@Param
(
"SN"
)
String
SN
,
@Param
(
"type"
)
String
type
,
@Param
(
"aliasList"
)
List
<
String
>
aliasList
);
List
<
ProbesVo
>
getByAliasList
(
@Param
(
"SN"
)
String
SN
,
@Param
(
"type"
)
String
type
,
@Param
(
"aliasList"
)
List
<
String
>
aliasList
);
Integer
getCountByGateway
(
@Param
(
"SN"
)
String
SN
,
@Param
(
"type"
)
String
type
);
int
addProbes
(
Map
<
String
,
Object
>
map
);
...
...
src/main/java/com/example/tdl/mapper/RoleMapper.java
View file @
f4a76c00
package
com
.
example
.
tdl
.
mapper
;
import
com.example.tdl.domain.vo.RoleNameVo
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
@Mapper
public
interface
RoleMapper
{
List
<
String
>
getAllRoleName
();
List
<
RoleNameVo
>
getAllRoleName
();
Integer
getByRoleName
(
String
roleName
);
}
src/main/java/com/example/tdl/mapper/TDLDeviceMapper.java
View file @
f4a76c00
...
...
@@ -6,6 +6,7 @@ import com.example.tdl.domain.vo.ResultTDLDeviceVo;
import
com.example.tdl.domain.vo.TDLDeviceTermVo
;
import
com.example.tdl.domain.vo.UpdateTDLDeviceVo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
...
...
@@ -22,4 +23,6 @@ public interface TDLDeviceMapper {
int
delTDLDevice
(
String
TDLSN
);
ResultTDLDeviceVo
getByTDLSN
(
String
TDLSN
);
List
<
String
>
getByGatewaySN
(
@Param
(
"SN"
)
String
SN
,
@Param
(
"type"
)
String
type
);
}
src/main/java/com/example/tdl/service/AlarmLogServ
ci
e.java
→
src/main/java/com/example/tdl/service/AlarmLogServ
ic
e.java
View file @
f4a76c00
...
...
@@ -9,7 +9,7 @@ import org.springframework.stereotype.Service;
import
java.util.List
;
@Service
public
class
AlarmLogServ
ci
e
{
public
class
AlarmLogServ
ic
e
{
@Autowired
private
AlarmLogMapper
alarmLogMapper
;
...
...
@@ -26,5 +26,9 @@ public class AlarmLogServcie {
return
alarmLogMapper
.
addAlarmLog
(
addAlarmLogVo
);
}
public
List
<
AlarmLogVo
>
getByTransportationNo
(
String
transportationNo
){
return
alarmLogMapper
.
getByTransportationNo
(
transportationNo
);
}
}
src/main/java/com/example/tdl/service/CircuitService.java
View file @
f4a76c00
package
com
.
example
.
tdl
.
service
;
import
com.example.tdl.domain.vo.AddCircuitVo
;
import
com.example.tdl.domain.vo.CircuitTermVo
;
import
com.example.tdl.domain.vo.ResultCircuitVo
;
import
com.example.tdl.domain.vo.UpdateCircuitVo
;
import
com.example.tdl.domain.vo.*
;
import
com.example.tdl.mapper.CircuitMapper
;
import
com.example.tdl.mapper.RoleMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -46,4 +43,8 @@ public class CircuitService {
return
circuitMapper
.
getByTransportationNo
(
transportationNo
);
}
public
ResultGatewayVo
getByNo
(
String
transportationNo
){
return
circuitMapper
.
getByNo
(
transportationNo
);
}
}
src/main/java/com/example/tdl/service/ConfigService.java
View file @
f4a76c00
...
...
@@ -5,6 +5,8 @@ import com.example.tdl.mapper.ConfigMapper;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Map
;
@Service
public
class
ConfigService
{
...
...
@@ -12,8 +14,12 @@ public class ConfigService {
private
ConfigMapper
configMapper
;
//绑定getway和tdl
public
int
addConfig
(
ConfigVo
configVo
){
/*
public int addConfig(ConfigVo configVo){
return configMapper.addConfig(configVo);
}*/
public
int
addConfig
(
Map
<
Object
,
Object
>
map
){
return
configMapper
.
addConfig
(
map
);
}
...
...
@@ -28,8 +34,12 @@ public class ConfigService {
}
//解绑getWay和tdl
public
int
updateConfig
(
String
gSN
,
String
gType
,
Boolean
untie
){
return
configMapper
.
updateConfig
(
gSN
,
gType
,
untie
);
// public int updateConfig(String gSN,String gType,Boolean untie ){
// return configMapper.updateConfig(gSN,gType,untie);
// }
public
int
updateConfig
(
Map
<
Object
,
Object
>
map
){
return
configMapper
.
updateConfig
(
map
);
}
//解绑成功
...
...
src/main/java/com/example/tdl/service/InfluxDBService.java
deleted
100644 → 0
View file @
5a4afdd8
package
com
.
example
.
tdl
.
service
;
import
com.example.tdl.config.Influxdbconfig
;
import
org.influxdb.InfluxDB
;
import
org.influxdb.dto.BatchPoints
;
import
org.influxdb.dto.Point
;
import
org.influxdb.dto.Query
;
import
org.influxdb.dto.QueryResult
;
import
org.influxdb.dto.QueryResult.Result
;
import
org.influxdb.dto.QueryResult.Series
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
@Service
(
"influxdbService"
)
public
class
InfluxDBService
{
@Autowired
Influxdbconfig
influxdbconfig
;
@Autowired
private
InfluxDB
influxDB
;
public
final
static
String
DEFAULT_DATABASE
=
"original"
;
public
final
static
String
DEFAULT_POLICY
=
"witium_policy"
;
private
final
static
String
DEFAULT_DURATION
=
"0d"
;
private
final
static
String
DEFAULT_SHARD_DURATION
=
"90d"
;
private
String
mPolicyName
=
DEFAULT_POLICY
;
private
String
mDBName
=
DEFAULT_DATABASE
;
public
void
connectDatabase
(
String
dbname
)
{
if
(!
dbname
.
isEmpty
()
&&
dbname
!=
null
)
{
useDatabase
(
dbname
);
useRetentionPolicy
(
mPolicyName
);
}
}
/* Create the database if it is not exist. */
private
void
createDatabase
(
String
database
)
{
if
(
database
!=
null
&&
!
database
.
isEmpty
())
{
if
(!
influxDB
.
databaseExists
(
database
))
{
influxDB
.
createDatabase
(
database
);
}
}
}
public
void
useDatabase
(
String
database
)
{
if
(!
influxDB
.
databaseExists
(
database
))
{
createDatabase
(
database
);
}
influxdbconfig
.
setDatabase
(
database
);
mDBName
=
database
;
}
public
List
<
String
>
showRetentionPolicys
()
{
String
command
=
String
.
format
(
"SHOW RETENTION POLICIES ON \"%s\""
,
mDBName
);
QueryResult
results
=
this
.
query
(
command
);
List
<
String
>
policys
=
new
ArrayList
<
String
>();
for
(
Result
result
:
results
.
getResults
())
{
List
<
Series
>
series
=
result
.
getSeries
();
for
(
Series
serie
:
series
)
{
List
<
List
<
Object
>>
values
=
serie
.
getValues
();
for
(
List
<
Object
>
value
:
values
)
{
policys
.
add
(
0
,
(
String
)
value
.
get
(
0
));
}
}
}
return
policys
;
}
/* Judge whether policy is exist. */
public
boolean
isRetentionPolicyExist
(
String
policyname
)
{
boolean
isExist
=
false
;
List
<
String
>
policys
;
policys
=
showRetentionPolicys
();
for
(
String
policy
:
policys
)
{
if
(
policy
.
equals
(
policyname
))
{
isExist
=
true
;
break
;
}
}
return
isExist
;
}
public
void
useRetentionPolicy
(
String
policy
)
{
mPolicyName
=
policy
;
if
(!
isRetentionPolicyExist
(
policy
))
{
createRetentionPolicy
(
DEFAULT_DURATION
,
DEFAULT_SHARD_DURATION
,
1
,
true
);
}
}
/**
* 创建保存策略 <br/>
* CREATE RETENTION POLICY "default" ON "database" DURATION 30d REPLICATION 1 DEFAULT
*
* @param duration 存放时间
* @param replicationNum 备份数量
*/
public
void
createRetentionPolicy
(
String
duration
,
Integer
replicationNum
,
Boolean
isDefault
)
{
if
(
mPolicyName
!=
null
&&
!
mPolicyName
.
isEmpty
()
&&
mDBName
!=
null
&&
!
mDBName
.
isEmpty
())
{
String
command
=
String
.
format
(
"CREATE RETENTION POLICY \"%s\" ON \"%s\" DURATION %s REPLICATION %s %s"
,
mPolicyName
,
mDBName
,
duration
,
replicationNum
,
isDefault
?
"DEFAULT"
:
""
);
this
.
query
(
command
);
}
}
/**
* 创建保存策略 <br/>
* CREATE RETENTION POLICY "default" ON "database" DURATION 30d SHARD DURATION %s REPLICATION 1 DEFAULT
*
* @param duration 存放时间
* @param shardGroupDuration 存放快速读取组时间
* @param replicationNum 备份数量
*/
public
void
createRetentionPolicy
(
String
duration
,
String
shardGroupDuration
,
Integer
replicationNum
,
Boolean
isDefault
)
{
if
(
mPolicyName
!=
null
&&
!
mPolicyName
.
isEmpty
()
&&
mDBName
!=
null
&&
!
mDBName
.
isEmpty
())
{
String
command
=
String
.
format
(
"CREATE RETENTION POLICY \"%s\" ON \"%s\" DURATION %s SHARD DURATION %s REPLICATION %s %s"
,
mPolicyName
,
mDBName
,
duration
,
shardGroupDuration
,
replicationNum
,
isDefault
?
"DEFAULT"
:
""
);
this
.
query
(
command
);
}
}
/**
* 插入数据
*
* @param measurement a Point in a fluent manner
* @param tagsToAdd the Map of tags to add
* @param fields the fields to add
*/
public
void
insert
(
String
measurement
,
Long
timestamp
,
Map
<
String
,
String
>
tagsToAdd
,
Map
<
String
,
Object
>
fields
)
{
if
(
measurement
!=
null
&&
!
measurement
.
isEmpty
()
&&
tagsToAdd
!=
null
&&
!
tagsToAdd
.
isEmpty
()
&&
fields
!=
null
&&
!
fields
.
isEmpty
())
{
Point
.
Builder
builder
=
Point
.
measurement
(
measurement
)
.
time
(
timestamp
,
TimeUnit
.
MILLISECONDS
)
.
tag
(
tagsToAdd
)
.
fields
(
fields
);
try
{
influxDB
.
write
(
mDBName
,
mPolicyName
,
builder
.
build
());
}
catch
(
RuntimeException
e
)
{
// TODO: handle exception
e
.
printStackTrace
();
}
catch
(
Exception
e
)
{
// TODO: handle exception
e
.
printStackTrace
();
}
}
}
public
void
insertBatchWithMultiTags
(
String
dbname
,
String
measurement
,
Long
[]
timestamp
,
List
<
Map
<
String
,
String
>>
tagsToAdd
,
List
<
Map
<
String
,
Object
>>
fields
)
{
if
(
measurement
!=
null
&&
!
measurement
.
isEmpty
()
&&
tagsToAdd
!=
null
&&
!
tagsToAdd
.
isEmpty
()
&&
fields
!=
null
&&
!
fields
.
isEmpty
())
{
BatchPoints
batchPoints
=
BatchPoints
.
database
(
dbname
)
.
retentionPolicy
(
mPolicyName
)
.
consistency
(
InfluxDB
.
ConsistencyLevel
.
ALL
)
.
build
();
for
(
int
i
=
0
;
i
<
tagsToAdd
.
size
();
i
++)
{
Point
pointdata
=
Point
.
measurement
(
measurement
)
.
time
(
timestamp
[
i
],
TimeUnit
.
MILLISECONDS
)
.
tag
(
tagsToAdd
.
get
(
i
))
.
fields
(
fields
.
get
(
i
))
.
build
();
batchPoints
.
point
(
pointdata
);
}
try
{
influxDB
.
write
(
batchPoints
);
}
catch
(
RuntimeException
e
)
{
// TODO: handle exception
e
.
printStackTrace
();
}
catch
(
Exception
e
)
{
// TODO: handle exception
e
.
printStackTrace
();
}
}
}
public
void
insertBatchWithSameTags
(
String
dbname
,
String
measurement
,
Long
[]
timestamp
,
Map
<
String
,
String
>
tagsToAdd
,
List
<
Map
<
String
,
Object
>>
fields
)
{
if
(
measurement
!=
null
&&
!
measurement
.
isEmpty
()
&&
tagsToAdd
!=
null
&&
!
tagsToAdd
.
isEmpty
()
&&
fields
!=
null
&&
!
fields
.
isEmpty
())
{
BatchPoints
batchPoints
=
BatchPoints
.
database
(
dbname
)
.
retentionPolicy
(
mPolicyName
)
.
consistency
(
InfluxDB
.
ConsistencyLevel
.
ALL
)
.
build
();
for
(
int
i
=
0
;
i
<
fields
.
size
();
i
++)
{
Point
pointdata
=
Point
.
measurement
(
measurement
)
.
time
(
timestamp
[
i
],
TimeUnit
.
MILLISECONDS
)
.
tag
(
tagsToAdd
)
.
fields
(
fields
.
get
(
i
))
.
build
();
if
(
pointdata
!=
null
)
{
batchPoints
.
point
(
pointdata
);
}
}
try
{
influxDB
.
write
(
batchPoints
);
}
catch
(
RuntimeException
e
)
{
// TODO: handle exception
e
.
printStackTrace
();
}
catch
(
Exception
e
)
{
// TODO: handle exception
e
.
printStackTrace
();
}
}
}
/**
* 查询数据
*
* @param command
* @return QueryResult
*/
public
QueryResult
query
(
String
command
)
{
return
influxDB
.
query
(
new
Query
(
command
,
mDBName
));
}
}
src/main/java/com/example/tdl/service/ProbesService.java
View file @
f4a76c00
package
com
.
example
.
tdl
.
service
;
import
com.example.tdl.domain.vo.ProbesVo
;
import
com.example.tdl.domain.vo.ResultProbesVo
;
import
com.example.tdl.domain.vo.UpdateProbesVo
;
import
com.example.tdl.mapper.ProbesMapper
;
...
...
@@ -47,6 +48,10 @@ public class ProbesService {
return
probesMapper
.
getNameByAliasList
(
SN
,
type
,
aliasList
);
}
public
List
<
ProbesVo
>
getByAliasList
(
String
SN
,
String
type
,
List
<
String
>
aliasList
){
return
probesMapper
.
getByAliasList
(
SN
,
type
,
aliasList
);
}
public
Integer
getCountByGateway
(
String
SN
,
String
type
){
return
probesMapper
.
getCountByGateway
(
SN
,
type
);
}
...
...
src/main/java/com/example/tdl/service/RoleService.java
View file @
f4a76c00
package
com
.
example
.
tdl
.
service
;
import
com.example.tdl.domain.vo.RoleNameVo
;
import
com.example.tdl.mapper.RoleMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -12,7 +13,7 @@ public class RoleService {
@Autowired
private
RoleMapper
roleMapper
;
public
List
<
String
>
getAllRoleName
(){
public
List
<
RoleNameVo
>
getAllRoleName
(){
return
roleMapper
.
getAllRoleName
();
}
...
...
src/main/java/com/example/tdl/service/TDLDeviceService.java
View file @
f4a76c00
...
...
@@ -38,4 +38,8 @@ public class TDLDeviceService {
public
ResultTDLDeviceVo
getByTDLSN
(
String
TDLSN
){
return
tdlDeviceMapper
.
getByTDLSN
(
TDLSN
);
}
public
List
<
String
>
getByGatewaySN
(
String
SN
,
String
type
){
return
tdlDeviceMapper
.
getByGatewaySN
(
SN
,
type
);
}
}
src/main/java/com/example/tdl/service/redis/RealRedisService.java
0 → 100644
View file @
f4a76c00
package
com
.
example
.
tdl
.
service
.
redis
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
@Service
public
class
RealRedisService
extends
RedisService
{
@SuppressWarnings
({
"unchecked"
,
"rawtypes"
})
@Autowired
public
RealRedisService
(
RedisTemplate
realRedisTemplate
)
{
super
(
realRedisTemplate
);
}
}
src/main/java/com/example/tdl/service/redis/RedisService.java
View file @
f4a76c00
...
...
@@ -122,11 +122,7 @@ public class RedisService {
}
return
result
;
}
/**
* 获取此数据库所有的Keys表
* @return
*/
public
Object
getAllKeys
()
{
Object
ret
=
null
;
try
{
...
...
@@ -136,56 +132,29 @@ public class RedisService {
}
return
ret
;
}
/**
* 批量删除对应的value
*
* @param keys
*/
public
void
remove
(
final
String
...
keys
)
{
for
(
String
key
:
keys
)
{
remove
(
key
);
}
}
/**
* 批量删除key
*
* @param pattern
*/
public
void
removePattern
(
final
String
pattern
)
{
Set
<
Serializable
>
keys
=
redisTemplate
.
keys
(
pattern
);
if
(
keys
.
size
()
>
0
)
redisTemplate
.
delete
(
keys
);
}
/**
* 删除对应的value
*
* @param key
*/
public
void
remove
(
final
String
key
)
{
if
(
exists
(
key
))
{
redisTemplate
.
delete
(
key
);
}
}
/**
* 判断缓存中是否有对应的value
*
* @param key
* @return
*/
public
boolean
exists
(
final
String
key
)
{
return
redisTemplate
.
hasKey
(
key
);
}
/**
* 读取缓存
*
* @param key
* @return
*/
public
String
get
(
final
String
key
)
{
String
result
=
null
;
try
{
...
...
@@ -198,13 +167,6 @@ public class RedisService {
return
result
;
}
/**
* 写入缓存
*
* @param key
* @param value
* @return
*/
public
boolean
set
(
final
String
key
,
Object
value
)
{
boolean
result
=
false
;
try
{
...
...
@@ -218,19 +180,11 @@ public class RedisService {
return
result
;
}
/**
* 写入缓存
*
* @param key
* @param value
* @return
*/
public
boolean
set
(
final
String
key
,
Object
value
,
long
expireTime
)
{
boolean
result
=
false
;
try
{
ValueOperations
<
Serializable
,
Object
>
operations
=
redisTemplate
.
opsForValue
();
operations
.
set
(
key
,
value
);
//logger.info("[key:" + key + "],[value:" + value + "]");
redisTemplate
.
expire
(
key
,
expireTime
,
TimeUnit
.
SECONDS
);
result
=
true
;
}
catch
(
Exception
e
)
{
...
...
@@ -240,12 +194,6 @@ public class RedisService {
return
result
;
}
/**
* 更新过期时间
*
* @param key
* @return
*/
public
boolean
refeshTimeOut
(
String
key
,
long
expireTime
)
{
boolean
f
=
false
;
try
{
...
...
@@ -258,7 +206,6 @@ public class RedisService {
return
f
;
}
//删除key
public
void
delKey
(
final
String
...
key
){
if
(
key
!=
null
&&
key
.
length
>
0
){
if
(
key
.
length
==
1
){
...
...
@@ -268,4 +215,5 @@ public class RedisService {
}
}
}
}
src/main/java/com/example/tdl/web/AlarmLogController.java
View file @
f4a76c00
...
...
@@ -2,7 +2,7 @@ package com.example.tdl.web;
import
com.example.tdl.domain.dto.CommFeedback
;
import
com.example.tdl.domain.vo.AddAlarmLogVo
;
import
com.example.tdl.service.AlarmLogServ
ci
e
;
import
com.example.tdl.service.AlarmLogServ
ic
e
;
import
com.google.gson.Gson
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
...
...
@@ -23,7 +23,7 @@ public class AlarmLogController {
CommFeedback
fb
=
new
CommFeedback
();
@Autowired
private
AlarmLogServ
ci
e
alarmLogServcie
;
private
AlarmLogServ
ic
e
alarmLogServcie
;
//获取所有的报警数据
@GetMapping
(
"/getAll"
)
...
...
@@ -40,9 +40,9 @@ public class AlarmLogController {
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
public
Object
addAlarmLog
(
@RequestBody
AddAlarmLogVo
addAlarmLogVo
){
if
(
StringUtils
.
isEmpty
(
addAlarmLogVo
.
get
RouteNumber
())){
if
(
StringUtils
.
isEmpty
(
addAlarmLogVo
.
get
TransportationNo
())){
fb
.
setCode
(
0
);
fb
.
setMessage
(
"
路由
编号不能为空"
);
fb
.
setMessage
(
"
运输
编号不能为空"
);
return
gson
.
toJson
(
fb
);
}
if
(
StringUtils
.
isEmpty
(
addAlarmLogVo
.
getRouteName
())){
...
...
src/main/java/com/example/tdl/web/DataController.java
View file @
f4a76c00
This diff is collapsed.
Click to expand it.
src/main/java/com/example/tdl/web/EquipmentBindingController.java
0 → 100644
View file @
f4a76c00
package
com
.
example
.
tdl
.
web
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.serializer.FloatArraySerializer
;
import
com.example.tdl.domain.dto.CommFeedback
;
import
com.example.tdl.domain.vo.*
;
import
com.example.tdl.service.ConfigService
;
import
com.example.tdl.service.GatewayService
;
import
com.example.tdl.service.TDLDeviceService
;
import
com.google.gson.Gson
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@RestController
@RequestMapping
(
"/equipmentBinding"
)
public
class
EquipmentBindingController
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
CommFeedback
fb
=
new
CommFeedback
();
Gson
gson
=
new
Gson
();
@Autowired
private
ConfigService
configService
;
@Autowired
private
GatewayService
gatewayService
;
@Autowired
private
TDLDeviceService
tdlDeviceService
;
@ApiOperation
(
value
=
"绑定gateWay和tdl"
,
notes
=
"绑定gateWay和tdl"
+
" SN:gateWay编号,"
+
" type:gateWay类型,"
+
" mode:1--运输/2--仓库,"
+
" TDLSN:tdl编号,"
+
" transportationNo:运输编号,"
+
" warehouseNo:仓库编号"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@PostMapping
(
"/binding"
)
public
Object
binding
(
@RequestBody
BindingVo
bindingVo
){
//获取gateWay的信息
ResultGatewayVo
resultGatewayVo
=
gatewayService
.
getBySNAndType
(
bindingVo
.
getSN
(),
bindingVo
.
getType
());
if
(
resultGatewayVo
.
getUseScene
()
!=
0
&&
resultGatewayVo
.
getUseScene
()
!=
bindingVo
.
getMode
()){
fb
.
setCode
(
0
);
fb
.
setMessage
(
"该网关所属环境与当前不符"
);
return
gson
.
toJson
(
fb
);
}
//判断当前tdl是否有网关在使用
ResultTDLDeviceVo
resultTDLDeviceVo
=
tdlDeviceService
.
getByTDLSN
(
bindingVo
.
getTDLSN
());
if
(!
StringUtils
.
isEmpty
(
resultTDLDeviceVo
.
getGatewaySN
())){
fb
.
setCode
(
0
);
fb
.
setMessage
(
"该TDL已经被使用"
);
return
gson
.
toJson
(
fb
);
}
if
(
StringUtils
.
isEmpty
(
bindingVo
.
getTransportationNo
())
&&
!
StringUtils
.
isEmpty
(
bindingVo
.
getWarehouseNo
())){
bindingVo
.
setTransportationNo
(
""
);
}
else
if
(
StringUtils
.
isEmpty
(
bindingVo
.
getWarehouseNo
())
&&
!
StringUtils
.
isEmpty
(
bindingVo
.
getTransportationNo
())){
bindingVo
.
setWarehouseNo
(
""
);
}
//开始绑定
//获取gateway下的所有tdl的编号
List
<
String
>
devList
=
tdlDeviceService
.
getByGatewaySN
(
bindingVo
.
getSN
(),
bindingVo
.
getType
());
devList
.
add
(
bindingVo
.
getTDLSN
());
ConfigCMDVo
configCMDVo
=
new
ConfigCMDVo
(
"config"
,
5
,
15
,
devList
,
bindingVo
.
getMode
(),
System
.
currentTimeMillis
()/
1000
l
);
Map
<
Object
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"transportationNo"
,
bindingVo
.
getTransportationNo
());
map
.
put
(
"warehouseNo"
,
bindingVo
.
getWarehouseNo
());
map
.
put
(
"useScene"
,
bindingVo
.
getMode
());
map
.
put
(
"gSN"
,
bindingVo
.
getSN
());
map
.
put
(
"gType"
,
bindingVo
.
getType
());
map
.
put
(
"message"
,
gson
.
toJson
(
configCMDVo
));
map
.
put
(
"flag"
,
false
);
map
.
put
(
"resp"
,
null
);
map
.
put
(
"state"
,
1
);
map
.
put
(
"untie"
,
false
);
map
.
put
(
"TDLSN"
,
bindingVo
.
getTDLSN
());
map
.
put
(
"createTime"
,
System
.
currentTimeMillis
());
configService
.
addConfig
(
map
);
Map
<
Object
,
Object
>
msg
=
new
HashMap
<>();
msg
.
put
(
"msg"
,
map
.
get
(
"msg"
));
if
(
msg
.
get
(
"msg"
).
equals
(
"配置网关成功"
)){
fb
.
setCode
(
1
);
fb
.
setMessage
(
msg
.
get
(
"msg"
).
toString
());
}
else
{
fb
.
setCode
(
0
);
fb
.
setMessage
(
msg
.
get
(
"msg"
).
toString
());
}
return
gson
.
toJson
(
fb
);
}
@ApiOperation
(
value
=
"重置tdl"
,
notes
=
"重置tdl"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@PostMapping
(
"/untie"
)
public
Object
untie
(
@RequestBody
String
TDLSN
){
JSONObject
jsonObject
=
JSON
.
parseObject
(
TDLSN
);
TDLSN
=(
String
)
jsonObject
.
get
(
"TDLSN"
);
//判断当前tdl是否有网关在使用
ResultTDLDeviceVo
resultTDLDeviceVo
=
tdlDeviceService
.
getByTDLSN
(
TDLSN
);
List
<
String
>
devList
=
tdlDeviceService
.
getByGatewaySN
(
resultTDLDeviceVo
.
getGatewaySN
(),
resultTDLDeviceVo
.
getGatewayType
());
ConfigVo
configVo
=
configService
.
getConfig
(
resultTDLDeviceVo
.
getGatewaySN
(),
resultTDLDeviceVo
.
getGatewayType
());
ConfigCMDVo
config
=
gson
.
fromJson
(
configVo
.
getMessage
(),
ConfigCMDVo
.
class
);
ConfigCMDVo
configCMDVo
;
Boolean
untie
=
false
;
if
(
devList
.
size
()>
1
){
devList
.
remove
(
TDLSN
);
configCMDVo
=
new
ConfigCMDVo
(
"config"
,
config
.
getGpsPeriod
(),
config
.
getGprsPeriod
(),
devList
,
config
.
getMode
(),
System
.
currentTimeMillis
()/
1000
l
);
}
else
{
configCMDVo
=
config
;
untie
=
true
;
}
Map
<
Object
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"gSN"
,
resultTDLDeviceVo
.
getGatewaySN
());
map
.
put
(
"gType"
,
resultTDLDeviceVo
.
getGatewayType
());
map
.
put
(
"message"
,
gson
.
toJson
(
configCMDVo
));
map
.
put
(
"untie"
,
untie
);
map
.
put
(
"TDLSN"
,
TDLSN
);
configService
.
updateConfig
(
map
);
Map
<
Object
,
Object
>
msg
=
new
HashMap
<>();
msg
.
put
(
"msg"
,
map
.
get
(
"msg"
));
if
(
msg
.
get
(
"msg"
).
equals
(
"解除网关成功"
)){
fb
.
setCode
(
1
);
fb
.
setMessage
(
msg
.
get
(
"msg"
).
toString
());
}
else
{
fb
.
setCode
(
0
);
fb
.
setMessage
(
msg
.
get
(
"msg"
).
toString
());
}
return
gson
.
toJson
(
fb
);
}
}
src/main/java/com/example/tdl/web/GatewayController.java
View file @
f4a76c00
...
...
@@ -18,7 +18,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@RestController
...
...
src/main/java/com/example/tdl/web/HomePageController.java
View file @
f4a76c00
...
...
@@ -5,7 +5,7 @@ import com.example.tdl.domain.vo.AlarmLogVo;
import
com.example.tdl.domain.vo.HomePageDataVo
;
import
com.example.tdl.domain.vo.ResultRouteVo
;
import
com.example.tdl.domain.vo.TermVo
;
import
com.example.tdl.service.AlarmLogServ
ci
e
;
import
com.example.tdl.service.AlarmLogServ
ic
e
;
import
com.example.tdl.service.RouteService
;
import
com.google.gson.Gson
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -31,7 +31,7 @@ public class HomePageController {
private
RouteService
routeService
;
@Autowired
private
AlarmLogServ
ci
e
alarmLogServcie
;
private
AlarmLogServ
ic
e
alarmLogServcie
;
//获取当天所有的设备数据
@ApiOperation
(
value
=
"获取所有的运输数据"
,
notes
=
"获取运输设备数据:"
+
...
...
@@ -70,14 +70,14 @@ public class HomePageController {
public
Object
getAll
(){
HomePageDataVo
dataVo
=
new
HomePageDataVo
();
//获取所有的路线
List
<
ResultRouteVo
>
routeVos
=
routeService
.
getAll
();
//所有的路线
//
List<ResultRouteVo> routeVos = routeService.getAll();//所有的路线
//List<ResultRouteVo> routeVoList = routeService.getAllRoute();//当天的数量
//获取所有的报警
List
<
AlarmLogVo
>
alarmLogVos
=
alarmLogServcie
.
getAll
();
// 获取所有的路线数量
dataVo
.
setRouteVoList
(
routeVos
);
//路线列表
//
dataVo.setRouteVoList(routeVos);//路线列表
dataVo
.
setAlarmLogVoList
(
alarmLogVos
);
//报警列表
dataVo
.
setSum
(
routeVos
.
size
());
//总数量
//
dataVo.setSum(routeVos.size());//总数量
dataVo
.
setOnRoute
(
0
);
//在途数量
dataVo
.
setComplted
(
0
);
//已完成数量
dataVo
.
setAlarmed
(
0
);
//报警数量
...
...
src/main/java/com/example/tdl/web/TDLDeviceController.java
View file @
f4a76c00
...
...
@@ -5,8 +5,6 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONObject
;
import
com.example.tdl.domain.dto.CommFeedback
;
import
com.example.tdl.domain.vo.*
;
import
com.example.tdl.entity.Route
;
import
com.example.tdl.service.RouteService
;
import
com.example.tdl.service.TDLDeviceService
;
import
com.example.tdl.service.redis.TokenRedisService
;
import
com.google.gson.Gson
;
...
...
@@ -14,7 +12,6 @@ import io.swagger.annotations.ApiImplicitParam;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.shiro.SecurityUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -23,9 +20,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
@RestController
@RequestMapping
(
"/tdlDevice"
)
...
...
@@ -43,7 +37,6 @@ public class TDLDeviceController {
@Autowired
private
TokenRedisService
tokenRedisService
;
//查询TDL信息
@ApiOperation
(
value
=
"查询TDL信息"
,
notes
=
"查询TDL信息,返回值说明:"
+
" TDLName:TDL名字,"
+
...
...
src/main/resources/application.properties
View file @
f4a76c00
...
...
@@ -15,7 +15,7 @@ mybatis.config-location=classpath:mybatis-config.xml
# Redis服务器地址
tdl.redis.host
=
1
27.0.0.1
tdl.redis.host
=
1
92.168.1.16
# Redis数据库索引(默认为0)
tdl.redis.index
=
0
# Redis服务器连接端口
...
...
@@ -51,9 +51,14 @@ tdl.mqtt.clientcrt = witcd.crt
# InfluxDB
tdl.influxdb.user
=
admin
tdl.influxdb.password
=
Witium37774020
tdl.influxdb.host
=
http://192.168.1.11:8086
tdl.influxdb.database
=
original
spring.influxdb.username
=
admin
spring.influxdb.password
=
37774020
spring.influxdb.url
=
http://192.168.1.16:8086
spring.influxdb.database
=
original
spring.influxdb.retentionPolicy
=
tdl_policy
spring.influxdb.connent-timeout
=
10
spring.influxdb.read-timeout
=
30
spring.influxdb.write-timeout
=
10
spring.influxdb.gzip
=
true
src/main/resources/mapper/AlarmLogMapper.xml
View file @
f4a76c00
...
...
@@ -18,7 +18,7 @@
insert into alarm_log
values(
null,
#{
routeNumber
,jdbcType=VARCHAR},
#{
transportationNo
,jdbcType=VARCHAR},
#{routeName,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR},
#{data,jdbcType=FLOAT},
...
...
src/main/resources/mapper/CircuitMapper.xml
View file @
f4a76c00
...
...
@@ -133,4 +133,11 @@
boxNo,containerNo,deliveryAddress,transportationType,circuitState,c.remark
from circuit c,route r WHERE c.route_id=r.id AND r.state=1 AND c.state=1 AND transportationNo=#{transportationNo,jdbcType=VARCHAR}
</select>
<select
id=
"getByNo"
parameterType=
"String"
resultType=
"com.example.tdl.domain.vo.ResultGatewayVo"
>
SELECT SN,`name`,type,state,bConfig,useScene,from_unixtime((createTime/1000),'%Y-%m-%d %T') createTime,from_unixtime((updateTime/1000),'%Y-%m-%d %T') updateTime
from gateway
WHERE id=(SELECT gateway_id from tdldevice where circuit_id =(SELECT id from circuit WHERE transportationNo=#{transportationNo,jdbcType=VARCHAR}))
</select>
</mapper>
\ No newline at end of file
src/main/resources/mapper/ConfigMapper.xml
View file @
f4a76c00
...
...
@@ -2,18 +2,26 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.example.tdl.mapper.ConfigMapper"
>
<!--绑定getway和tdl-->
<insert
id=
"addConfig"
parameterType=
"com.example.tdl.domain.vo.ConfigVo"
>
insert into config
values(
null,
#{gSN,jdbcType=VARCHAR},
#{gType,jdbcType=VARCHAR},
#{message,jdbcType=VARCHAR},
#{flag,jdbcType=INTEGER},
#{resp,jdbcType=INTEGER},
#{state,jdbcType=INTEGER},
#{untie,jdbcType=INTEGER}
)
<insert
id=
"addConfig"
parameterType=
"java.util.Map"
statementType=
"CALLABLE"
>
<![CDATA[
{
call pro_addTDLGatewayLog(
#{transportationNo,mode=IN,jdbcType=VARCHAR},
#{warehouseNo,mode=IN,jdbcType=VARCHAR},
#{useScene,mode=IN,jdbcType=INTEGER},
#{gSN,mode=IN,jdbcType=VARCHAR},
#{gType,mode=IN,jdbcType=VARCHAR},
#{message,mode=IN,jdbcType=VARCHAR},
#{flag,mode=IN,jdbcType=INTEGER},
#{resp,mode=IN,jdbcType=INTEGER},
#{state,mode=IN,jdbcType=INTEGER},
#{untie,mode=IN,jdbcType=INTEGER},
#{TDLSN,mode=IN,jdbcType=VARCHAR},
#{createTime,mode=IN,jdbcType=BIGINT},
#{msg,mode=OUT,jdbcType=VARCHAR}
)
}
]]>
</insert>
<!--获取绑定消息-->
...
...
@@ -29,16 +37,44 @@
and state = 1;
</update>
<update
id=
"updateConfig"
>
update config set untie=#{untie,jdbcType=INTEGER}
where gSN= #{gSN,jdbcType=VARCHAR}
and gType=#{gType,jdbcType=VARCHAR}
and state = 1;
<!--重置tdl-->
<update
id=
"updateConfig"
parameterType=
"java.util.Map"
statementType=
"CALLABLE"
>
<![CDATA[
{
call pro_updateTDLGatewayLog(
#{gSN,mode=IN,jdbcType=VARCHAR},
#{gType,mode=IN,jdbcType=VARCHAR},
#{message,mode=IN,jdbcType=VARCHAR},
#{untie,mode=IN,jdbcType=INTEGER},
#{TDLSN,mode=IN,jdbcType=VARCHAR},
#{msg,mode=OUT,jdbcType=VARCHAR}
)
}
]]>
</update>
<!--解绑成功-->
<update
id=
"delConfig"
parameterType=
"String"
>
update config set state = 0 where gSN= #{gSN,jdbcType=VARCHAR} and gType=#{gType,jdbcType=VARCHAR} and state = 1;
</update>
<!-- <insert id="addConfig" parameterType="com.example.tdl.domain.vo.ConfigVo">
insert into config
values(
null,
#{gSN,jdbcType=VARCHAR},
#{gType,jdbcType=VARCHAR},
#{message,jdbcType=VARCHAR},
#{flag,jdbcType=INTEGER},
#{resp,jdbcType=INTEGER},
#{state,jdbcType=INTEGER},
#{untie,jdbcType=INTEGER}
)
</insert>-->
<!--<update id="updateConfig">
update config set untie=#{untie,jdbcType=INTEGER}
where gSN= #{gSN,jdbcType=VARCHAR}
and gType=#{gType,jdbcType=VARCHAR}
and state = 1;
</update>-->
</mapper>
\ No newline at end of file
src/main/resources/mapper/ProbesMapper.xml
View file @
f4a76c00
...
...
@@ -61,6 +61,19 @@
</foreach>
)
</select>
<select
id=
"getByAliasList"
resultType=
"com.example.tdl.domain.vo.ProbesVo"
parameterType=
"String"
>
select port,unit,description,alias,type alarmUp alarmDown from probes where gateway_id =(
select id from gateway where SN=#{SN,jdbcType=VARCHAR} and type= #{type,jdbcType=VARCHAR})
and alias in
<foreach
collection=
"aliasList"
item=
"alias"
open=
"("
close=
")"
separator=
","
>
#{alias,jdbcType=VARCHAR}
</foreach>
ORDER BY FIELD(alias,
<foreach
collection=
"aliasList"
item=
"alias"
separator=
","
>
#{alias,jdbcType=VARCHAR}
</foreach>
)
</select>
<select
id=
"getCountByGateway"
parameterType=
"String"
resultType=
"java.lang.Integer"
>
select COUNT(*) from probes where gateway_id =(
SELECT id FROM gateway WHERE SN = #{SN,jdbcType=VARCHAR} AND type = #{type,jdbcType=VARCHAR})
...
...
src/main/resources/mapper/RoleMapper.xml
View file @
f4a76c00
...
...
@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.example.tdl.mapper.RoleMapper"
>
<!--查询所有角色名-->
<select
id=
"getAllRoleName"
resultType=
"
String
"
>
<select
id=
"getAllRoleName"
resultType=
"
com.example.tdl.domain.vo.RoleNameVo
"
>
SELECT roleName from role;
</select>
...
...
src/main/resources/mapper/TDLDeviceMapper.xml
View file @
f4a76c00
...
...
@@ -55,4 +55,8 @@
from tdldevice t
WHERE TDLSN=#{TDLSN,jdbcType=VARCHAR}
</select>
<select
id=
"getByGatewaySN"
parameterType=
"String"
resultType=
"String"
>
select TDLSN from tdldevice t,gateway g where t.gateway_id = g.id and g.SN =#{SN,jdbcType=VARCHAR} and g.type=#{type,jdbcType=VARCHAR}
</select>
</mapper>
\ No newline at end of file
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