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
5341dd21
Commit
5341dd21
authored
Apr 17, 2018
by
chenying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
4.17修改预警信息,给预警添加公司
parent
8082a828
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
166 additions
and
89 deletions
+166
-89
AddAlarmVo.java
src/main/java/com/example/tdl/domain/vo/AddAlarmVo.java
+10
-0
DelAlarmVo.java
src/main/java/com/example/tdl/domain/vo/DelAlarmVo.java
+10
-0
UpdateAlarmVo.java
src/main/java/com/example/tdl/domain/vo/UpdateAlarmVo.java
+10
-0
AlarmMapper.java
src/main/java/com/example/tdl/mapper/AlarmMapper.java
+5
-5
AlarmService.java
src/main/java/com/example/tdl/service/AlarmService.java
+10
-10
AlarmController.java
src/main/java/com/example/tdl/web/AlarmController.java
+45
-20
CircuitController.java
src/main/java/com/example/tdl/web/CircuitController.java
+44
-41
EquipmentBindingController.java
.../java/com/example/tdl/web/EquipmentBindingController.java
+10
-2
application.properties
src/main/resources/application.properties
+2
-2
AlarmMapper.xml
src/main/resources/mapper/AlarmMapper.xml
+20
-9
No files found.
src/main/java/com/example/tdl/domain/vo/AddAlarmVo.java
View file @
5341dd21
...
...
@@ -20,6 +20,8 @@ public class AddAlarmVo {
private
String
remark
;
private
String
companyName
;
public
String
getAlarmType
()
{
return
alarmType
;
}
...
...
@@ -91,4 +93,12 @@ public class AddAlarmVo {
public
void
setRemark
(
String
remark
)
{
this
.
remark
=
remark
;
}
public
String
getCompanyName
()
{
return
companyName
;
}
public
void
setCompanyName
(
String
companyName
)
{
this
.
companyName
=
companyName
;
}
}
src/main/java/com/example/tdl/domain/vo/DelAlarmVo.java
View file @
5341dd21
...
...
@@ -5,6 +5,16 @@ public class DelAlarmVo {
private
String
alarmScene
;
private
String
companyName
;
public
String
getCompanyName
()
{
return
companyName
;
}
public
void
setCompanyName
(
String
companyName
)
{
this
.
companyName
=
companyName
;
}
public
String
getAlarmType
()
{
return
alarmType
;
}
...
...
src/main/java/com/example/tdl/domain/vo/UpdateAlarmVo.java
View file @
5341dd21
...
...
@@ -24,6 +24,16 @@ public class UpdateAlarmVo {
private
String
oldAlarmScene
;
private
String
companyName
;
public
String
getCompanyName
()
{
return
companyName
;
}
public
void
setCompanyName
(
String
companyName
)
{
this
.
companyName
=
companyName
;
}
public
String
getAlarmType
()
{
return
alarmType
;
}
...
...
src/main/java/com/example/tdl/mapper/AlarmMapper.java
View file @
5341dd21
...
...
@@ -12,9 +12,9 @@ import java.util.List;
@Mapper
public
interface
AlarmMapper
{
List
<
ResultAlarmVo
>
getAll
();
List
<
ResultAlarmVo
>
getAll
(
String
companyName
);
List
<
ResultAlarmVo
>
getAllByAlarmType
(
String
alarmType
);
List
<
ResultAlarmVo
>
getAllByAlarmType
(
@Param
(
"companyName"
)
String
companyName
,
@Param
(
"alarmType"
)
String
alarmType
);
int
addAlarm
(
AddAlarmVo
addAlarmVo
);
...
...
@@ -22,9 +22,9 @@ public interface AlarmMapper {
int
delAlarm
(
DelAlarmVo
delAlarmVo
);
ResultAlarmVo
getByTypeAndScene
(
@Param
(
"alarmType"
)
String
alarmType
,
@Param
(
"alarmScene"
)
String
alarmScene
);
ResultAlarmVo
getByTypeAndScene
(
@Param
(
"alarmType"
)
String
alarmType
,
@Param
(
"alarmScene"
)
String
alarmScene
,
@Param
(
"companyName"
)
String
companyName
);
List
<
String
>
getForWarehouse
();
List
<
String
>
getForWarehouse
(
String
companyName
);
List
<
String
>
getForTransportation
();
List
<
String
>
getForTransportation
(
String
companyName
);
}
src/main/java/com/example/tdl/service/AlarmService.java
View file @
5341dd21
...
...
@@ -17,12 +17,12 @@ public class AlarmService {
@Autowired
private
AlarmMapper
alarmMapper
;
public
List
<
ResultAlarmVo
>
getAll
(){
return
alarmMapper
.
getAll
();
public
List
<
ResultAlarmVo
>
getAll
(
String
companyName
){
return
alarmMapper
.
getAll
(
companyName
);
}
public
List
<
ResultAlarmVo
>
getAllByAlarmType
(
String
alarmType
){
return
alarmMapper
.
getAllByAlarmType
(
alarmType
);
public
List
<
ResultAlarmVo
>
getAllByAlarmType
(
String
companyName
,
String
alarmType
){
return
alarmMapper
.
getAllByAlarmType
(
companyName
,
alarmType
);
}
public
int
addAlarm
(
AddAlarmVo
addAlarmVo
){
...
...
@@ -37,16 +37,16 @@ public class AlarmService {
return
alarmMapper
.
delAlarm
(
delAlarmVo
);
}
public
ResultAlarmVo
getByTypeAndScene
(
String
alarmType
,
String
alarmScene
){
return
alarmMapper
.
getByTypeAndScene
(
alarmType
,
alarmScene
);
public
ResultAlarmVo
getByTypeAndScene
(
String
alarmType
,
String
alarmScene
,
String
companyName
){
return
alarmMapper
.
getByTypeAndScene
(
alarmType
,
alarmScene
,
companyName
);
}
public
List
<
String
>
getForWarehouse
(){
return
alarmMapper
.
getForWarehouse
();
public
List
<
String
>
getForWarehouse
(
String
companyName
){
return
alarmMapper
.
getForWarehouse
(
companyName
);
}
public
List
<
String
>
getForTransportation
(){
return
alarmMapper
.
getForTransportation
();
public
List
<
String
>
getForTransportation
(
String
companyName
){
return
alarmMapper
.
getForTransportation
(
companyName
);
}
}
src/main/java/com/example/tdl/web/AlarmController.java
View file @
5341dd21
...
...
@@ -3,9 +3,7 @@ package com.example.tdl.web;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.example.tdl.domain.dto.CommFeedback
;
import
com.example.tdl.domain.vo.AddAlarmVo
;
import
com.example.tdl.domain.vo.DelAlarmVo
;
import
com.example.tdl.domain.vo.UpdateAlarmVo
;
import
com.example.tdl.domain.vo.*
;
import
com.example.tdl.service.AlarmService
;
import
com.example.tdl.service.WarehouseService
;
...
...
@@ -21,6 +19,9 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/alarm"
)
...
...
@@ -56,8 +57,11 @@ public class AlarmController {
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@RequestMapping
(
value
=
"/getAll"
,
method
=
RequestMethod
.
GET
)
public
Object
getAll
(){
return
alarmService
.
getAll
();
public
Object
getAll
(
HttpServletRequest
request
){
String
token
=
request
.
getHeader
(
"Account_token"
);
String
datum
=
tokenRedisService
.
get
(
"TOKEN_"
+
token
);
UserRedisVo
user
=
gson
.
fromJson
(
datum
,
UserRedisVo
.
class
);
return
alarmService
.
getAll
(
user
.
getCompanyName
());
}
//根据预警类型模糊查询
...
...
@@ -75,14 +79,17 @@ public class AlarmController {
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@RequestMapping
(
value
=
"/getAllByAlarmType"
,
method
=
RequestMethod
.
POST
)
public
Object
getAllByAlarmType
(
@RequestBody
String
alarmType
){
public
Object
getAllByAlarmType
(
@RequestBody
String
alarmType
,
HttpServletRequest
request
){
String
token
=
request
.
getHeader
(
"Account_token"
);
String
datum
=
tokenRedisService
.
get
(
"TOKEN_"
+
token
);
UserRedisVo
user
=
gson
.
fromJson
(
datum
,
UserRedisVo
.
class
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
alarmType
);
alarmType
=(
String
)
jsonObject
.
get
(
"alarmType"
);
return
alarmService
.
getAllByAlarmType
(
alarmType
);
return
alarmService
.
getAllByAlarmType
(
user
.
getCompanyName
(),
alarmType
);
}
//添加预警信息
@ApiOperation
(
value
=
"添加预警信息"
,
notes
=
"添加预警信息,传递参数:"
+
@ApiOperation
(
value
=
"添加预警信息"
,
notes
=
"添加预警信息,
companyName不用传,需要
传递参数:"
+
" alarmType:预警类型,"
+
" alarmScene:预警场景,"
+
" temMax:温度上限,"
+
...
...
@@ -96,7 +103,10 @@ public class AlarmController {
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@RequestMapping
(
value
=
"/addAlarm"
,
method
=
RequestMethod
.
POST
)
public
Object
addAlarm
(
@RequestBody
AddAlarmVo
addAlarmVo
){
public
Object
addAlarm
(
@RequestBody
AddAlarmVo
addAlarmVo
,
HttpServletRequest
request
){
String
token
=
request
.
getHeader
(
"Account_token"
);
String
datum
=
tokenRedisService
.
get
(
"TOKEN_"
+
token
);
UserRedisVo
user
=
gson
.
fromJson
(
datum
,
UserRedisVo
.
class
);
if
(
StringUtils
.
isEmpty
(
addAlarmVo
.
getAlarmType
())){
fb
.
setCode
(
0
);
fb
.
setMessage
(
"预警类型不能为空"
);
...
...
@@ -142,11 +152,12 @@ public class AlarmController {
fb
.
setMessage
(
"震度不能为空"
);
return
gson
.
toJson
(
fb
);
}
if
(
alarmService
.
getByTypeAndScene
(
addAlarmVo
.
getAlarmType
(),
addAlarmVo
.
getAlarmScene
())!=
null
){
if
(
alarmService
.
getByTypeAndScene
(
addAlarmVo
.
getAlarmType
(),
addAlarmVo
.
getAlarmScene
()
,
user
.
getCompanyName
()
)!=
null
){
fb
.
setCode
(
0
);
fb
.
setMessage
(
"添加的预警类型在该场景中已存在"
);
return
gson
.
toJson
(
fb
);
}
addAlarmVo
.
setCompanyName
(
user
.
getCompanyName
());
int
a
=
alarmService
.
addAlarm
(
addAlarmVo
);
if
(
a
>
0
){
fb
.
setCode
(
1
);
...
...
@@ -159,7 +170,7 @@ public class AlarmController {
}
//修改预警信息
@ApiOperation
(
value
=
"修改预警信息"
,
notes
=
"修改预警信息,传递参数:"
+
@ApiOperation
(
value
=
"修改预警信息"
,
notes
=
"修改预警信息,
companyName不用传,需要
传递参数:"
+
" oldAlarmType:需要修改的预警类型,"
+
" oldAlarmScene:需要修改的预警场景,"
+
" alarmType:预警类型,"
+
...
...
@@ -175,7 +186,10 @@ public class AlarmController {
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@RequestMapping
(
value
=
"/updateAlarm"
,
method
=
RequestMethod
.
POST
)
public
Object
updateAlarm
(
@RequestBody
UpdateAlarmVo
updateAlarmVo
){
public
Object
updateAlarm
(
@RequestBody
UpdateAlarmVo
updateAlarmVo
,
HttpServletRequest
request
){
String
token
=
request
.
getHeader
(
"Account_token"
);
String
datum
=
tokenRedisService
.
get
(
"TOKEN_"
+
token
);
UserRedisVo
user
=
gson
.
fromJson
(
datum
,
UserRedisVo
.
class
);
if
(
StringUtils
.
isEmpty
(
updateAlarmVo
.
getOldAlarmType
())){
fb
.
setCode
(
0
);
fb
.
setMessage
(
"需要修改的预警类型不能为空"
);
...
...
@@ -235,11 +249,12 @@ public class AlarmController {
fb
.
setMessage
(
"震度不能为空"
);
return
gson
.
toJson
(
fb
);
}
if
(
alarmService
.
getByTypeAndScene
(
updateAlarmVo
.
getAlarmType
(),
updateAlarmVo
.
getAlarmType
())!=
null
&&!
updateAlarmVo
.
getAlarmType
().
equals
(
updateAlarmVo
.
getAlarmType
())&&!
updateAlarmVo
.
getAlarmScene
().
equals
(
updateAlarmVo
.
getAlarmScene
())){
if
(
alarmService
.
getByTypeAndScene
(
updateAlarmVo
.
getAlarmType
(),
updateAlarmVo
.
getAlarmType
()
,
user
.
getCompanyName
()
)!=
null
&&!
updateAlarmVo
.
getAlarmType
().
equals
(
updateAlarmVo
.
getAlarmType
())&&!
updateAlarmVo
.
getAlarmScene
().
equals
(
updateAlarmVo
.
getAlarmScene
())){
fb
.
setCode
(
0
);
fb
.
setMessage
(
"修改的预警类型在该场景中已存在"
);
return
gson
.
toJson
(
fb
);
}
updateAlarmVo
.
setCompanyName
(
user
.
getCompanyName
());
int
a
=
alarmService
.
updateAlarm
(
updateAlarmVo
);
if
(
a
>
0
){
fb
.
setCode
(
1
);
...
...
@@ -253,14 +268,17 @@ public class AlarmController {
}
//删除预警信息
@ApiOperation
(
value
=
"删除预警信息"
,
notes
=
"删除预警信息,传值说明:"
+
@ApiOperation
(
value
=
"删除预警信息"
,
notes
=
"删除预警信息,
companyName不用传,
传值说明:"
+
" alarmType:需要删除的预警类型,"
+
" alarmScene:需要删除的预警场景"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@RequestMapping
(
value
=
"/delAlarm"
,
method
=
RequestMethod
.
POST
)
public
Object
delAlarm
(
@RequestBody
DelAlarmVo
delAlarmVo
){
public
Object
delAlarm
(
@RequestBody
DelAlarmVo
delAlarmVo
,
HttpServletRequest
request
){
String
token
=
request
.
getHeader
(
"Account_token"
);
String
datum
=
tokenRedisService
.
get
(
"TOKEN_"
+
token
);
UserRedisVo
user
=
gson
.
fromJson
(
datum
,
UserRedisVo
.
class
);
if
(
StringUtils
.
isEmpty
(
delAlarmVo
.
getAlarmScene
())){
fb
.
setCode
(
0
);
fb
.
setMessage
(
"需要删除的预警场景不能为空"
);
...
...
@@ -271,7 +289,8 @@ public class AlarmController {
fb
.
setMessage
(
"需要删除的预警类型不能为空"
);
return
gson
.
toJson
(
fb
);
}
if
(
warehouseService
.
getByAlarm
(
delAlarmVo
)!=
null
){
delAlarmVo
.
setCompanyName
(
user
.
getCompanyName
());
if
(
warehouseService
.
getByAlarm
(
delAlarmVo
).
size
()>
0
){
fb
.
setCode
(
0
);
fb
.
setMessage
(
"该预警正在被使用"
);
return
gson
.
toJson
(
fb
);
...
...
@@ -293,8 +312,11 @@ public class AlarmController {
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@RequestMapping
(
value
=
"/getForWarehouse"
,
method
=
RequestMethod
.
GET
)
public
Object
getForWarehouse
(){
return
alarmService
.
getForWarehouse
();
public
Object
getForWarehouse
(
HttpServletRequest
request
){
String
token
=
request
.
getHeader
(
"Account_token"
);
String
datum
=
tokenRedisService
.
get
(
"TOKEN_"
+
token
);
UserRedisVo
user
=
gson
.
fromJson
(
datum
,
UserRedisVo
.
class
);
return
alarmService
.
getForWarehouse
(
user
.
getCompanyName
());
}
...
...
@@ -304,8 +326,11 @@ public class AlarmController {
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@RequestMapping
(
value
=
"/getForTransportation"
,
method
=
RequestMethod
.
GET
)
public
Object
getForTransportation
(){
return
alarmService
.
getForTransportation
();
public
Object
getForTransportation
(
HttpServletRequest
request
){
String
token
=
request
.
getHeader
(
"Account_token"
);
String
datum
=
tokenRedisService
.
get
(
"TOKEN_"
+
token
);
UserRedisVo
user
=
gson
.
fromJson
(
datum
,
UserRedisVo
.
class
);
return
alarmService
.
getForTransportation
(
user
.
getCompanyName
());
}
}
src/main/java/com/example/tdl/web/CircuitController.java
View file @
5341dd21
...
...
@@ -82,7 +82,7 @@ public class CircuitController {
" alarm:报警详情(比如:温度,湿度,震动)"
+
" evaluate:运输评价"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@RequestMapping
(
value
=
"/getAll"
,
method
=
RequestMethod
.
GET
)
public
Object
getAll
(
HttpServletRequest
request
){
...
...
@@ -105,7 +105,7 @@ public class CircuitController {
" alarm:报警详情(比如:温度,湿度,震动)"
+
" evaluate:运输评价"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@RequestMapping
(
value
=
"/getByTransportationNo"
,
method
=
RequestMethod
.
POST
)
public
Object
getByTransportationNo
(
@RequestBody
String
transportationNo
,
HttpServletRequest
request
){
...
...
@@ -131,7 +131,7 @@ public class CircuitController {
" TDLSN:TDLSN序列号"
+
" remark:备注"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@RequestMapping
(
value
=
"/getByTransportationNoForApp"
,
method
=
RequestMethod
.
POST
)
public
Object
getByTransportationNoForApp
(
@RequestBody
String
transportationNo
,
HttpServletRequest
request
){
...
...
@@ -163,7 +163,7 @@ public class CircuitController {
" alarm:报警详情(比如:温度,湿度,震动),"
+
" evaluate:运输评价"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@RequestMapping
(
value
=
"/getByTerm"
,
method
=
RequestMethod
.
POST
)
public
Object
getByTerm
(
@RequestBody
CircuitTermVo
circuitTermVo
,
HttpServletRequest
request
){
...
...
@@ -231,7 +231,7 @@ public class CircuitController {
" cargoName:货物别名,"
+
" remark:备注"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@RequestMapping
(
value
=
"/addCircuit"
,
method
=
RequestMethod
.
POST
)
public
Object
addCircuit
(
@RequestBody
AddCircuitVo
addCircuitVo
,
HttpServletRequest
request
){
...
...
@@ -466,16 +466,16 @@ public class CircuitController {
}
//判断当前tdl是否存在
ResultTDLDeviceVo
tdlDeviceVo
=
tdlDeviceService
.
getByTDLSN
(
addCircuitVo
.
getTdlAlarmList
().
get
(
j
).
getTDLSN
());
if
(
tdlDeviceVo
==
null
){
fb
.
setCode
(
0
);
fb
.
setMessage
(
addCircuitVo
.
getTdlAlarmList
().
get
(
j
).
getTDLSN
()
+
"不存在"
);
return
gson
.
toJson
(
fb
);
}
if
(!
StringUtils
.
isEmpty
(
tdlDeviceVo
.
getGatewaySN
())){
fb
.
setCode
(
0
);
fb
.
setMessage
(
"序列号为"
+
addCircuitVo
.
getTdlAlarmList
().
get
(
j
).
getTDLSN
()
+
"的TDL已经被使用"
);
return
gson
.
toJson
(
fb
);
}
if
(
tdlDeviceVo
==
null
){
fb
.
setCode
(
0
);
fb
.
setMessage
(
addCircuitVo
.
getTdlAlarmList
().
get
(
j
).
getTDLSN
()
+
"不存在"
);
return
gson
.
toJson
(
fb
);
}
if
(!
StringUtils
.
isEmpty
(
tdlDeviceVo
.
getGatewaySN
())){
fb
.
setCode
(
0
);
fb
.
setMessage
(
"序列号为"
+
addCircuitVo
.
getTdlAlarmList
().
get
(
j
).
getTDLSN
()
+
"的TDL已经被使用"
);
return
gson
.
toJson
(
fb
);
}
if
(
StringUtils
.
isEmpty
(
addCircuitVo
.
getTdlAlarmList
().
get
(
j
).
getAlarmType
())){
fb
.
setCode
(
0
);
...
...
@@ -485,7 +485,7 @@ public class CircuitController {
alarmTypeVar
=
alarmTypeVar
+
addCircuitVo
.
getTdlAlarmList
().
get
(
j
).
getAlarmType
()
+
" "
;
TDLSNVar
=
TDLSNVar
+
addCircuitVo
.
getTdlAlarmList
().
get
(
j
).
getTDLSN
()
+
" "
;
devList
.
add
(
"TDL-"
+
addCircuitVo
.
getTdlAlarmList
().
get
(
j
).
getTDLSN
());
saveAlarmRule
(
"TDL/"
+
type
+
"/"
+
addCircuitVo
.
getSN
()+
"/Data"
,
addCircuitVo
.
getTdlAlarmList
().
get
(
j
).
getTDLSN
(),
addCircuitVo
.
getTdlAlarmList
().
get
(
j
).
getAlarmType
());
saveAlarmRule
(
"TDL/"
+
type
+
"/"
+
addCircuitVo
.
getSN
()+
"/Data"
,
addCircuitVo
.
getTdlAlarmList
().
get
(
j
).
getTDLSN
(),
addCircuitVo
.
getTdlAlarmList
().
get
(
j
).
getAlarmType
()
,
request
);
}
if
(
StringUtils
.
isEmpty
(
addCircuitVo
.
getCargoNo
())){
...
...
@@ -583,7 +583,7 @@ public class CircuitController {
" transportationType:运输类型,(本地运输,国际运输),"
+
" remark:备注,"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@RequestMapping
(
value
=
"/add"
,
method
=
RequestMethod
.
POST
)
public
Object
add
(
@RequestBody
AddCircuit
addCircuitVo
,
HttpServletRequest
request
){
...
...
@@ -764,7 +764,7 @@ public class CircuitController {
" transportationNo:运输编号,"
+
" endTime:目的时间 "
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@RequestMapping
(
value
=
"/updateEndTime"
,
method
=
RequestMethod
.
POST
)
public
Object
updateEndTime
(
@RequestBody
UpdateCircuitVo
updateCircuitVo
,
HttpServletRequest
request
){
...
...
@@ -845,16 +845,16 @@ public class CircuitController {
" alarm:报警详情(比如:温度,湿度,震动)"
+
" evaluate:运输评价"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@RequestMapping
(
value
=
"/getBy
Plate
No"
,
method
=
RequestMethod
.
POST
)
public
Object
getBy
PlateNo
(
@RequestBody
String
plate
No
,
HttpServletRequest
request
){
@RequestMapping
(
value
=
"/getBy
Container
No"
,
method
=
RequestMethod
.
POST
)
public
Object
getBy
ContainerNo
(
@RequestBody
String
cargo
No
,
HttpServletRequest
request
){
String
token
=
request
.
getHeader
(
"Account_token"
);
String
datum
=
tokenRedisService
.
get
(
"TOKEN_"
+
token
);
UserRedisVo
user
=
gson
.
fromJson
(
datum
,
UserRedisVo
.
class
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
plate
No
);
plateNo
=(
String
)
jsonObject
.
get
(
"plate
No"
);
return
circuitService
.
getByPlateNo
(
plate
No
,
user
.
getCompanyName
());
JSONObject
jsonObject
=
JSON
.
parseObject
(
cargo
No
);
cargoNo
=(
String
)
jsonObject
.
get
(
"cargo
No"
);
return
circuitService
.
getByPlateNo
(
cargo
No
,
user
.
getCompanyName
());
}
//评价
...
...
@@ -863,7 +863,7 @@ public class CircuitController {
" evaluate:评分,"
+
" evaluateRemark:评分备注"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@RequestMapping
(
value
=
"/updateEvaluate"
,
method
=
RequestMethod
.
POST
)
public
Object
updateEvaluate
(
@RequestBody
UpdateEvaluateVo
updateEvaluateVo
,
HttpServletRequest
request
){
...
...
@@ -915,7 +915,7 @@ public class CircuitController {
" evaluate:运输评价"
+
" transportation:运输方式"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@RequestMapping
(
value
=
"/getByCircuitState"
,
method
=
RequestMethod
.
POST
)
public
Object
getByCircuitState
(
@RequestBody
Map
map
,
HttpServletRequest
request
){
...
...
@@ -934,7 +934,7 @@ public class CircuitController {
@ApiOperation
(
value
=
"删除线路"
,
notes
=
"删除线路,传值说明:"
+
" transportationNo:运输编号"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@RequestMapping
(
value
=
"/delCircuit"
,
method
=
RequestMethod
.
POST
)
public
Object
delCircuit
(
@RequestBody
String
transportationNo
,
HttpServletRequest
request
){
...
...
@@ -1019,20 +1019,20 @@ public class CircuitController {
" SN:gateway序列号"
+
" TDLSN:TDLSN序列号"
+
" list:"
+
" {city:城市"
+
" time:到达时间/发车时间"
+
" last:运行时长"
+
" alarmCount:报警数"
+
" type:1--出发时间;2--目的时间}"
+
" {city:城市"
+
" time:到达时间/发车时间"
+
" last:运行时长"
+
" alarmCount:报警数"
+
" type:1--出发时间;2--目的时间}"
+
" alarmLogList:"
+
" transportationNo:运输编号"
+
" TDLSN:tag序列号"
+
" description:报警描述"
+
" data:数值"
+
" alarmTime:报警时间"
+
" classify:分类"
)
" transportationNo:运输编号"
+
" TDLSN:tag序列号"
+
" description:报警描述"
+
" data:数值"
+
" alarmTime:报警时间"
+
" classify:分类"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@PostMapping
(
"/getDetails"
)
public
Object
getDetails
(
@RequestBody
String
transportationNo
,
HttpServletRequest
request
)
{
...
...
@@ -1235,8 +1235,11 @@ public class CircuitController {
}
//将报警规则存到redis中
public
void
saveAlarmRule
(
String
topic
,
String
TDLSN
,
String
alarmType
){
ResultAlarmVo
alarmVo
=
alarmService
.
getByTypeAndScene
(
alarmType
,
"运输"
);
public
void
saveAlarmRule
(
String
topic
,
String
TDLSN
,
String
alarmType
,
HttpServletRequest
request
){
String
token
=
request
.
getHeader
(
"Account_token"
);
String
datum
=
tokenRedisService
.
get
(
"TOKEN_"
+
token
);
UserRedisVo
user
=
gson
.
fromJson
(
datum
,
UserRedisVo
.
class
);
ResultAlarmVo
alarmVo
=
alarmService
.
getByTypeAndScene
(
alarmType
,
"运输"
,
user
.
getCompanyName
());
for
(
String
alias
:
list
){
List
<
AlarmRuleVo
>
alarmRuleVos
=
new
ArrayList
<>();
AlarmRuleVo
alarmRuleVo
=
new
AlarmRuleVo
();
...
...
src/main/java/com/example/tdl/web/EquipmentBindingController.java
View file @
5341dd21
...
...
@@ -10,6 +10,7 @@ import com.example.tdl.service.ConfigService;
import
com.example.tdl.service.GatewayService
;
import
com.example.tdl.service.TDLDeviceService
;
import
com.example.tdl.service.redis.AlarmRedisService
;
import
com.example.tdl.service.redis.TokenRedisService
;
import
com.google.gson.Gson
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
...
...
@@ -23,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -52,6 +54,9 @@ public class EquipmentBindingController {
@Autowired
private
AlarmService
alarmService
;
@Autowired
private
TokenRedisService
tokenRedisService
;
List
<
String
>
list
=
new
ArrayList
<
String
>(){{
add
(
"T"
);
add
(
"h"
);
...
...
@@ -73,7 +78,10 @@ public class EquipmentBindingController {
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"Account_token"
,
value
=
"token"
,
required
=
true
,
dataType
=
"String"
),
})
@PostMapping
(
"/binding"
)
public
Object
binding
(
@RequestBody
BindingVo
bindingVo
){
public
Object
binding
(
@RequestBody
BindingVo
bindingVo
,
HttpServletRequest
request
){
String
token
=
request
.
getHeader
(
"Account_token"
);
String
datum
=
tokenRedisService
.
get
(
"TOKEN_"
+
token
);
UserRedisVo
user
=
gson
.
fromJson
(
datum
,
UserRedisVo
.
class
);
//获取gateWay的信息
ResultGatewayVo
resultGatewayVo
=
gatewayService
.
getBySNAndType
(
bindingVo
.
getSN
(),
bindingVo
.
getType
());
if
(
resultGatewayVo
.
getUseScene
()
!=
0
&&
resultGatewayVo
.
getUseScene
()
!=
bindingVo
.
getMode
()){
...
...
@@ -119,7 +127,7 @@ public class EquipmentBindingController {
fb
.
setCode
(
1
);
fb
.
setMessage
(
msg
.
get
(
"msg"
).
toString
());
//根据报警类型货报警信息
ResultAlarmVo
alarmVo
=
alarmService
.
getByTypeAndScene
(
bindingVo
.
getAlarmType
(),
"运输"
);
ResultAlarmVo
alarmVo
=
alarmService
.
getByTypeAndScene
(
bindingVo
.
getAlarmType
(),
"运输"
,
user
.
getCompanyName
()
);
for
(
String
alias
:
list
){
List
<
AlarmRuleVo
>
alarmRuleVos
=
new
ArrayList
<>();
AlarmRuleVo
alarmRuleVo
=
new
AlarmRuleVo
();
...
...
src/main/resources/application.properties
View file @
5341dd21
spring.datasource.url
=
jdbc:mysql://1
92.168.1.16
:3306/tdlCloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.url
=
jdbc:mysql://1
27.0.0.1
:3306/tdlCloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username
=
root
spring.datasource.password
=
37774020
spring.datasource.password
=
root
spring.datasource.driver-class-name
=
com.mysql.jdbc.Driver
threadpool.corepoolsize
=
30
...
...
src/main/resources/mapper/AlarmMapper.xml
View file @
5341dd21
...
...
@@ -2,14 +2,18 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.example.tdl.mapper.AlarmMapper"
>
<!--查询所有预警信息-->
<select
id=
"getAll"
resultType=
"com.example.tdl.domain.vo.ResultAlarmVo"
>
SELECT alarmType,alarmScene,temMax,temMin,humidityMax,humidityMin,tilt,shock,remark from alarm
<select
id=
"getAll"
resultType=
"com.example.tdl.domain.vo.ResultAlarmVo"
parameterType=
"String"
>
SELECT alarmType,alarmScene,temMax,temMin,humidityMax,humidityMin,tilt,shock,remark
from alarm a INNER JOIN company c ON a.company_id=c.id
WHERE c.companyName=#{companyName,jdbcType=VARCHAR}
</select>
<!--根据预警类型模糊查询-->
<select
id=
"getAllByAlarmType"
resultType=
"com.example.tdl.domain.vo.ResultAlarmVo"
parameterType=
"String"
>
SELECT alarmType,alarmScene,temMax,temMin,humidityMax,humidityMin,tilt,shock,remark from alarm
WHERE alarmType LIKE CONCAT(CONCAT('%',#{alarmType,jdbcType=VARCHAR}), '%')
SELECT alarmType,alarmScene,temMax,temMin,humidityMax,humidityMin,tilt,shock,remark
from alarm a INNER JOIN company c ON a.company_id=c.id
WHERE c.companyName=#{companyName,jdbcType=VARCHAR}
AND alarmType LIKE CONCAT(CONCAT('%',#{alarmType,jdbcType=VARCHAR}), '%')
</select>
<!--添加预警信息-->
...
...
@@ -24,6 +28,7 @@
#{humidityMin,jdbcType=FLOAT},
#{tilt,jdbcType=FLOAT},
#{shock,jdbcType=VARCHAR},
(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR}),
#{remark,jdbcType=VARCHAR}
)
</insert>
...
...
@@ -42,26 +47,32 @@
remark=#{remark,jdbcType=VARCHAR}
WHERE alarmType=#{oldAlarmType,jdbcType=VARCHAR}
AND alarmScene=#{oldAlarmScene,jdbcType=VARCHAR}
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
</update>
<!--删除预警信息-->
<delete
id=
"delAlarm"
parameterType=
"com.example.tdl.domain.vo.DelAlarmVo"
>
DELETE from alarm WHERE alarmType=#{alarmType,jdbcType=VARCHAR} AND alarmScene=#{alarmScene,jdbcType=VARCHAR}
DELETE from alarm WHERE alarmType=#{alarmType,jdbcType=VARCHAR}
AND alarmScene=#{alarmScene,jdbcType=VARCHAR}
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
</delete>
<!--根据预警类型和预警场景查询-->
<select
id=
"getByTypeAndScene"
parameterType=
"String"
resultType=
"com.example.tdl.domain.vo.ResultAlarmVo"
>
SELECT alarmType,alarmScene,temMax,temMin,humidityMax,humidityMin,tilt,shock,remark from alarm
WHERE alarmType=#{alarmType,jdbcType=VARCHAR} AND alarmScene=#{alarmScene,jdbcType=VARCHAR}
SELECT alarmType,alarmScene,temMax,temMin,humidityMax,humidityMin,tilt,shock,remark
from alarm a INNER JOIN company c ON a.company_id=c.id
WHERE c.companyName=#{companyName,jdbcType=VARCHAR}
AND alarmType=#{alarmType,jdbcType=VARCHAR}
AND alarmScene=#{alarmScene,jdbcType=VARCHAR}
</select>
<!--查询仓库的预警类型-->
<select
id=
"getForWarehouse"
resultType=
"String"
>
SELECT alarmType from alarm WHERE alarmScene="仓库"
SELECT alarmType from alarm WHERE alarmScene="仓库"
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
</select>
<!--查询仓库的预警类型-->
<select
id=
"getForTransportation"
resultType=
"String"
>
SELECT alarmType from alarm WHERE alarmScene="运输"
SELECT alarmType from alarm WHERE alarmScene="运输"
AND company_id=(SELECT id from company where companyName=#{companyName,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