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
93f564cd
Commit
93f564cd
authored
May 25, 2018
by
chenying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
5.25网关关联公司
parent
07e123ac
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
211 additions
and
79 deletions
+211
-79
ResultGatewayVo.java
src/main/java/com/example/tdl/domain/vo/ResultGatewayVo.java
+10
-0
UpdateGatewayCompanyVo.java
...ava/com/example/tdl/domain/vo/UpdateGatewayCompanyVo.java
+33
-0
GatewayMapper.java
src/main/java/com/example/tdl/mapper/GatewayMapper.java
+8
-9
GatewayService.java
src/main/java/com/example/tdl/service/GatewayService.java
+14
-10
CircuitController.java
src/main/java/com/example/tdl/web/CircuitController.java
+1
-1
EquipmentBindingController.java
.../java/com/example/tdl/web/EquipmentBindingController.java
+4
-1
GatewayController.java
src/main/java/com/example/tdl/web/GatewayController.java
+91
-44
WarehouseController.java
src/main/java/com/example/tdl/web/WarehouseController.java
+1
-1
messages_zh_CN.properties
src/main/resources/i18n/messages_zh_CN.properties
+18
-1
GatewayMapper.xml
src/main/resources/mapper/GatewayMapper.xml
+31
-12
No files found.
src/main/java/com/example/tdl/domain/vo/ResultGatewayVo.java
View file @
93f564cd
...
@@ -13,6 +13,16 @@ public class ResultGatewayVo {
...
@@ -13,6 +13,16 @@ public class ResultGatewayVo {
private
Integer
useScene
;
private
Integer
useScene
;
private
String
companyName
;
public
String
getCompanyName
()
{
return
companyName
;
}
public
void
setCompanyName
(
String
companyName
)
{
this
.
companyName
=
companyName
;
}
public
String
getSN
()
{
public
String
getSN
()
{
return
SN
;
return
SN
;
}
}
...
...
src/main/java/com/example/tdl/domain/vo/UpdateGatewayCompanyVo.java
0 → 100644
View file @
93f564cd
package
com
.
example
.
tdl
.
domain
.
vo
;
public
class
UpdateGatewayCompanyVo
{
private
String
SN
;
private
String
type
;
private
String
companyNo
;
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
String
getCompanyNo
()
{
return
companyNo
;
}
public
void
setCompanyNo
(
String
companyNo
)
{
this
.
companyNo
=
companyNo
;
}
}
src/main/java/com/example/tdl/mapper/GatewayMapper.java
View file @
93f564cd
package
com
.
example
.
tdl
.
mapper
;
package
com
.
example
.
tdl
.
mapper
;
import
com.example.tdl.domain.vo.GatewaySNVo
;
import
com.example.tdl.domain.vo.*
;
import
com.example.tdl.domain.vo.GatewayState
;
import
com.example.tdl.domain.vo.ResultGatewayVo
;
import
com.example.tdl.domain.vo.UpdateGatewayVo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -12,7 +9,9 @@ import java.util.Map;
...
@@ -12,7 +9,9 @@ import java.util.Map;
@Mapper
@Mapper
public
interface
GatewayMapper
{
public
interface
GatewayMapper
{
List
<
ResultGatewayVo
>
getAll
();
List
<
ResultGatewayVo
>
getAll
(
@Param
(
"companyNo"
)
String
companyNo
);
String
getBySN
(
@Param
(
"SN"
)
String
SN
,
@Param
(
"companyNo"
)
String
companyNo
);
int
addGateway
(
Map
<
Object
,
Object
>
map
);
int
addGateway
(
Map
<
Object
,
Object
>
map
);
...
@@ -22,15 +21,15 @@ public interface GatewayMapper {
...
@@ -22,15 +21,15 @@ public interface GatewayMapper {
ResultGatewayVo
getBySNAndType
(
@Param
(
"SN"
)
String
SN
,
@Param
(
"type"
)
String
type
);
ResultGatewayVo
getBySNAndType
(
@Param
(
"SN"
)
String
SN
,
@Param
(
"type"
)
String
type
);
int
getIdBySNAndType
(
@Param
(
"SN"
)
String
SN
,
@Param
(
"type"
)
String
type
);
int
getIdBySNAndType
(
@Param
(
"SN"
)
String
SN
,
@Param
(
"type"
)
String
type
,
@Param
(
"companyNo"
)
String
companyNo
);
int
deployGateway
(
Map
<
Object
,
Object
>
map
);
int
deployGateway
(
Map
<
Object
,
Object
>
map
);
String
getBySN
(
String
SN
);
Integer
updateState
(
GatewayState
gatewayState
);
Integer
updateState
(
GatewayState
gatewayState
);
String
getTransportationNo
(
@Param
(
"SN"
)
String
SN
,
@Param
(
"type"
)
String
type
);
String
getTransportationNo
(
@Param
(
"SN"
)
String
SN
,
@Param
(
"type"
)
String
type
);
List
<
GatewaySNVo
>
getUnusedGateway
(
String
SN
);
List
<
GatewaySNVo
>
getUnusedGateway
(
@Param
(
"SN"
)
String
SN
,
@Param
(
"companyNo"
)
String
companyNo
);
int
updateCompany
(
UpdateGatewayCompanyVo
updateGatewayCompanyVo
);
}
}
src/main/java/com/example/tdl/service/GatewayService.java
View file @
93f564cd
...
@@ -15,8 +15,12 @@ public class GatewayService {
...
@@ -15,8 +15,12 @@ public class GatewayService {
@Autowired
@Autowired
private
GatewayMapper
gatewayMapper
;
private
GatewayMapper
gatewayMapper
;
public
List
<
ResultGatewayVo
>
getAll
(){
public
List
<
ResultGatewayVo
>
getAll
(
String
companyNo
){
return
gatewayMapper
.
getAll
();
return
gatewayMapper
.
getAll
(
companyNo
);
}
public
String
getBySN
(
String
SN
,
String
companyNo
){
return
gatewayMapper
.
getBySN
(
SN
,
companyNo
);
}
}
public
int
addGateway
(
Map
<
Object
,
Object
>
map
){
public
int
addGateway
(
Map
<
Object
,
Object
>
map
){
...
@@ -35,18 +39,14 @@ public class GatewayService {
...
@@ -35,18 +39,14 @@ public class GatewayService {
return
gatewayMapper
.
getBySNAndType
(
SN
,
type
);
return
gatewayMapper
.
getBySNAndType
(
SN
,
type
);
}
}
public
int
getIdBySNAndType
(
String
SN
,
String
type
){
public
int
getIdBySNAndType
(
String
SN
,
String
type
,
String
companyNo
){
return
gatewayMapper
.
getIdBySNAndType
(
SN
,
type
);
return
gatewayMapper
.
getIdBySNAndType
(
SN
,
type
,
companyNo
);
}
}
public
int
deployGateway
(
Map
<
Object
,
Object
>
map
){
public
int
deployGateway
(
Map
<
Object
,
Object
>
map
){
return
gatewayMapper
.
deployGateway
(
map
);
return
gatewayMapper
.
deployGateway
(
map
);
}
}
public
String
getBySN
(
String
SN
){
return
gatewayMapper
.
getBySN
(
SN
);
}
public
Boolean
updateState
(
GatewayState
gatewayState
){
public
Boolean
updateState
(
GatewayState
gatewayState
){
return
gatewayMapper
.
updateState
(
gatewayState
)==
1
;
return
gatewayMapper
.
updateState
(
gatewayState
)==
1
;
}
}
...
@@ -55,7 +55,11 @@ public class GatewayService {
...
@@ -55,7 +55,11 @@ public class GatewayService {
return
gatewayMapper
.
getTransportationNo
(
SN
,
type
);
return
gatewayMapper
.
getTransportationNo
(
SN
,
type
);
}
}
public
List
<
GatewaySNVo
>
getUnusedGateway
(
String
SN
){
public
List
<
GatewaySNVo
>
getUnusedGateway
(
String
SN
,
String
companyNo
){
return
gatewayMapper
.
getUnusedGateway
(
SN
);
return
gatewayMapper
.
getUnusedGateway
(
SN
,
companyNo
);
}
public
int
updateCompany
(
UpdateGatewayCompanyVo
updateGatewayCompanyVo
){
return
gatewayMapper
.
updateCompany
(
updateGatewayCompanyVo
);
}
}
}
}
src/main/java/com/example/tdl/web/CircuitController.java
View file @
93f564cd
...
@@ -792,7 +792,7 @@ public class CircuitController {
...
@@ -792,7 +792,7 @@ public class CircuitController {
compTimeVar
=
compTimeVar
+
addCircuitVo
.
getEndAddressVo
().
getCompTime
()
+
"&"
;
compTimeVar
=
compTimeVar
+
addCircuitVo
.
getEndAddressVo
().
getCompTime
()
+
"&"
;
startTimeVar
=
startTimeVar
+
"0&"
;
startTimeVar
=
startTimeVar
+
"0&"
;
arrivalTimeVar
=
arrivalTimeVar
+
"0&"
;
arrivalTimeVar
=
arrivalTimeVar
+
"0&"
;
String
type
=
gatewayService
.
getBySN
(
addCircuitVo
.
getSN
());
String
type
=
gatewayService
.
getBySN
(
addCircuitVo
.
getSN
()
,
user
.
getCompanyNo
()
);
//判断当前gateWay是否存在
//判断当前gateWay是否存在
if
(
StringUtils
.
isEmpty
(
type
)){
if
(
StringUtils
.
isEmpty
(
type
)){
fb
.
setCode
(
0
);
fb
.
setCode
(
0
);
...
...
src/main/java/com/example/tdl/web/EquipmentBindingController.java
View file @
93f564cd
...
@@ -251,6 +251,9 @@ public class EquipmentBindingController {
...
@@ -251,6 +251,9 @@ public class EquipmentBindingController {
})
})
@PostMapping
(
"/untieGateway"
)
@PostMapping
(
"/untieGateway"
)
public
Object
untieGateway
(
@RequestBody
AddWarehouseGatewayVo
addWarehouseGatewayVo
,
HttpServletRequest
request
){
public
Object
untieGateway
(
@RequestBody
AddWarehouseGatewayVo
addWarehouseGatewayVo
,
HttpServletRequest
request
){
String
token
=
request
.
getHeader
(
"Account_token"
);
String
datum
=
tokenRedisService
.
get
(
"TOKEN_"
+
token
);
UserRedisVo
user
=
gson
.
fromJson
(
datum
,
UserRedisVo
.
class
);
if
(
StringUtils
.
isEmpty
(
addWarehouseGatewayVo
.
getWarehouseNo
())){
if
(
StringUtils
.
isEmpty
(
addWarehouseGatewayVo
.
getWarehouseNo
())){
fb
.
setCode
(
0
);
fb
.
setCode
(
0
);
fb
.
setMessage
(
"仓库编号不能为空"
);
fb
.
setMessage
(
"仓库编号不能为空"
);
...
@@ -266,7 +269,7 @@ public class EquipmentBindingController {
...
@@ -266,7 +269,7 @@ public class EquipmentBindingController {
fb
.
setMessage
(
"网关编号不能为空"
);
fb
.
setMessage
(
"网关编号不能为空"
);
return
gson
.
toJson
(
fb
);
return
gson
.
toJson
(
fb
);
}
}
if
(
gatewayService
.
getBySN
(
addWarehouseGatewayVo
.
getSN
())==
null
){
if
(
gatewayService
.
getBySN
(
addWarehouseGatewayVo
.
getSN
()
,
user
.
getCompanyNo
()
)==
null
){
fb
.
setCode
(
0
);
fb
.
setCode
(
0
);
fb
.
setMessage
(
"该网关不存在"
);
fb
.
setMessage
(
"该网关不存在"
);
return
gson
.
toJson
(
fb
);
return
gson
.
toJson
(
fb
);
...
...
src/main/java/com/example/tdl/web/GatewayController.java
View file @
93f564cd
This diff is collapsed.
Click to expand it.
src/main/java/com/example/tdl/web/WarehouseController.java
View file @
93f564cd
...
@@ -679,7 +679,7 @@ public class WarehouseController {
...
@@ -679,7 +679,7 @@ public class WarehouseController {
fb
.
setMessage
(
"网关编号不能为空"
);
fb
.
setMessage
(
"网关编号不能为空"
);
return
gson
.
toJson
(
fb
);
return
gson
.
toJson
(
fb
);
}
}
if
(
gatewayService
.
getBySN
(
addWarehouseGatewayVo
.
getSN
())==
null
){
if
(
gatewayService
.
getBySN
(
addWarehouseGatewayVo
.
getSN
()
,
user
.
getCompanyNo
()
)==
null
){
fb
.
setCode
(
0
);
fb
.
setCode
(
0
);
fb
.
setMessage
(
"该网关不存在"
);
fb
.
setMessage
(
"该网关不存在"
);
return
gson
.
toJson
(
fb
);
return
gson
.
toJson
(
fb
);
...
...
src/main/resources/i18n/messages_zh_CN.properties
View file @
93f564cd
...
@@ -190,4 +190,21 @@ addCarFailure=\u8F66\u8F86\u6DFB\u52A0\u5931\u8D25
...
@@ -190,4 +190,21 @@ addCarFailure=\u8F66\u8F86\u6DFB\u52A0\u5931\u8D25
updateCarSuccess
=
\u
8F66
\u
8F86
\u
4FEE
\u6539\u6210\u
529F
updateCarSuccess
=
\u
8F66
\u
8F86
\u
4FEE
\u6539\u6210\u
529F
updateCarFailure
=
\u
8F66
\u
8F86
\u
4FEE
\u6539\u5931\u
8D25
updateCarFailure
=
\u
8F66
\u
8F86
\u
4FEE
\u6539\u5931\u
8D25
deleteCarSuccess
=
\u
8F66
\u
8F86
\u5220\u9664\u6210\u
529F
deleteCarSuccess
=
\u
8F66
\u
8F86
\u5220\u9664\u6210\u
529F
deleteCarFailure
=
\u
8F66
\u
8F86
\u5220\u9664\u5931\u
8D25
deleteCarFailure
=
\u
8F66
\u
8F86
\u5220\u9664\u5931\u
8D25
\ No newline at end of file
#\u7F51\u5173
gatewaySN
=
\u
7F51
\u5173\u
5E8F
\u5217\u
53F7
\u
4E0D
\u
80FD
\u
4E3A
\u
7A7A
gatewaySNRule
=
gateway
\u
7F16
\u
53F7
\u
5FC5
\u
987B
\u
662F8
\u
4F4D
\u6570\u
5B57
gatewayName
=
\u
7F51
\u5173\u
540D
\u
4E0D
\u
80FD
\u
4E3A
\u
7A7A
gatewayType
=
\u
7F51
\u5173\u
7C7B
\u
578B
\u
4E0D
\u
80FD
\u
4E3A
\u
7A7A
gatewayModelName
=
\u
7F51
\u5173\u
6A21
\u
677F
\u
540D
\u
4E0D
\u
80FD
\u
4E3A
\u
7A7A
existModelName
=
\u
8BE5
\u
6A21
\u
677F
\u
4E0D
\u
5B58
\u5728
repeatedSN
=
\u
6DFB
\u
52A0
\u7684\u
7F51
\u5173\u
5DF2
\u
5B58
\u5728
existGateway
=
\u
8BE5
\u
7F51
\u5173\u
4E0D
\u
5B58
\u5728
addGatewaySuccess
=
\u
6DFB
\u
52A0
\u
7F51
\u5173\u6210\u
529F
updateGatewaySuccess
=
\u
4FEE
\u6539\u
7F51
\u5173\u6210\u
529F
updateGatewayFailure
=
\u
4FEE
\u6539\u
7F51
\u5173\u5931\u
8D25
updateGatewayByModelSuccess
=
\u
901A
\u
8FC7
\u
6A21
\u
677F
\u
4FEE
\u6539\u
8BBE
\u5907\u6210\u
529F
deleteGatewaySuccess
=
\u5220\u9664\u
7F51
\u5173\u6210\u
529F
isUseing
=
\u
8BBE
\u5907\u5728\u6302\u
8F7D
updateGatewayCompanySuccess
=
\u
7F51
\u5173\u5206\u
914D
\u
516C
\u
53F8
\u6210\u
529F
updateGatewayCompanyFailure
=
\u
7F51
\u5173\u5206\u
914D
\u
516C
\u
53F8
\u5931\u
8D25
src/main/resources/mapper/GatewayMapper.xml
View file @
93f564cd
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.example.tdl.mapper.GatewayMapper"
>
<mapper
namespace=
"com.example.tdl.mapper.GatewayMapper"
>
<select
id=
"getAll"
resultType=
"com.example.tdl.domain.vo.ResultGatewayVo"
>
<select
id=
"getAll"
parameterType=
"String"
resultType=
"com.example.tdl.domain.vo.ResultGatewayVo"
>
SELECT SN,name,type,state,bConfig,useScene
SELECT SN,name,type,g.state,bConfig,useScene,companyName
from gateway
from gateway g INNER JOIN company c on g.company_id=c.id
<if
test=
"companyNo!='TM201803298320'"
>
WHERE companyNo=#{companyNo,jdbcType=VARCHAR}
</if>
</select>
</select>
<select
id=
"getBySN"
resultType=
"String"
parameterType=
"String"
>
<select
id=
"getBySN"
resultType=
"String"
parameterType=
"String"
>
SELECT type from gateway where SN=#{SN,jdbcType=VARCHAR}
SELECT type from gateway g INNER JOIN company c on g.company_id=c.id
where SN=#{SN,jdbcType=VARCHAR}
<if
test=
"companyNo!='TM201803298320'"
>
WHERE companyNo=#{companyNo,jdbcType=VARCHAR}
</if>
</select>
</select>
<insert
id=
"addGateway"
parameterType=
"java.util.Map"
statementType=
"CALLABLE"
>
<insert
id=
"addGateway"
parameterType=
"java.util.Map"
statementType=
"CALLABLE"
>
...
@@ -19,6 +26,7 @@
...
@@ -19,6 +26,7 @@
#{type,mode=IN,jdbcType=VARCHAR},
#{type,mode=IN,jdbcType=VARCHAR},
#{createTime,mode=IN,jdbcType=BIGINT},
#{createTime,mode=IN,jdbcType=BIGINT},
#{updateTime,mode=IN,jdbcType=BIGINT},
#{updateTime,mode=IN,jdbcType=BIGINT},
#{companyNo,mode=IN,jdbcType=VARCHAR},
#{modelName,mode=IN,jdbcType=VARCHAR},
#{modelName,mode=IN,jdbcType=VARCHAR},
#{msg,mode=OUT,jdbcType=VARCHAR}
#{msg,mode=OUT,jdbcType=VARCHAR}
)
)
...
@@ -47,14 +55,18 @@
...
@@ -47,14 +55,18 @@
</delete>
</delete>
<select
id=
"getBySNAndType"
parameterType=
"String"
resultType=
"com.example.tdl.domain.vo.ResultGatewayVo"
>
<select
id=
"getBySNAndType"
parameterType=
"String"
resultType=
"com.example.tdl.domain.vo.ResultGatewayVo"
>
SELECT SN,name,type,state,bConfig,useScene
SELECT SN,name,type,g.state,bConfig,useScene,companyName
from gateway WHERE SN=#{SN,jdbcType=VARCHAR}
from gateway g INNER JOIN company c on g.company_id=c.id
WHERE SN=#{SN,jdbcType=VARCHAR}
AND type=#{type,jdbcType=VARCHAR}
AND type=#{type,jdbcType=VARCHAR}
</select>
</select>
<select
id=
"getIdBySNAndType"
parameterType=
"String"
resultType=
"java.lang.Integer"
>
<select
id=
"getIdBySNAndType"
parameterType=
"String"
resultType=
"java.lang.Integer"
>
SELECT id from gateway WHERE SN=#{SN,jdbcType=VARCHAR}
SELECT id from gateway WHERE SN=#{SN,jdbcType=VARCHAR}
AND type=#{type,jdbcType=VARCHAR}
AND type=#{type,jdbcType=VARCHAR}
<if
test=
"companyNo!='TM201803298320'"
>
AND companyNo=#{companyNo,jdbcType=VARCHAR}
</if>
</select>
</select>
<update
id=
"deployGateway"
parameterType=
"java.util.Map"
statementType=
"CALLABLE"
>
<update
id=
"deployGateway"
parameterType=
"java.util.Map"
statementType=
"CALLABLE"
>
...
@@ -77,18 +89,25 @@
...
@@ -77,18 +89,25 @@
</update>
</update>
<select
id=
"getTransportationNo"
parameterType=
"String"
resultType=
"String"
>
<select
id=
"getTransportationNo"
parameterType=
"String"
resultType=
"String"
>
select transportationNo from circuit where id = (select circuit_id from tdldevice
select transportationNo from circuit
where gateway_id =(SELECT id from gateway where SN=#{SN,jdbcType=VARCHAR}
where id = (select circuit_id from tdldevice
AND type=#{type,jdbcType=VARCHAR}))
where gateway_id =(SELECT id from gateway where SN=#{SN,jdbcType=VARCHAR}
AND type=#{type,jdbcType=VARCHAR}))
</select>
</select>
<select
id=
"getUnusedGateway"
parameterType=
"String"
resultType=
"com.example.tdl.domain.vo.GatewaySNVo"
>
<select
id=
"getUnusedGateway"
parameterType=
"String"
resultType=
"com.example.tdl.domain.vo.GatewaySNVo"
>
select
SN from gateway
select
SN from gateway g INNER JOIN company c ON g.company_id=c.id
where
SN
like CONCAT(CONCAT('%',#{SN,jdbcType=VARCHAR}), '%')
where
SN
like CONCAT(CONCAT('%',#{SN,jdbcType=VARCHAR}), '%')
and useScene = 0
and useScene = 0
and state = 1
and g.state = 1
AND companyNo=#{companyNo,jdbcType=VARCHAR}
</select>
</select>
<update
id=
"updateCompany"
parameterType=
"com.example.tdl.domain.vo.UpdateGatewayCompanyVo"
>
UPDATE gateway set company_id=(SELECT id from company where companyNo=#{companyNo,jdbcType=VARCHAR})
WHERE SN=#{SN,jdbcType=VARCHAR} AND type=#{type,jdbcType=VARCHAR}
</update>
<!-- <insert id="addGateway" parameterType="com.example.tdl.domain.vo.AddGatewayVo">
<!-- <insert id="addGateway" parameterType="com.example.tdl.domain.vo.AddGatewayVo">
INSERT into gateway VALUES (
INSERT into gateway VALUES (
...
...
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