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
ee4e5dbe
Commit
ee4e5dbe
authored
Jun 13, 2018
by
chenying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
6.13修改添加公司接口,修改角色权限接口
parent
bf136da7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
144 additions
and
100 deletions
+144
-100
AddCompanyVo.java
src/main/java/com/example/tdl/domain/vo/AddCompanyVo.java
+10
-0
DataUtil.java
src/main/java/com/example/tdl/util/DataUtil.java
+96
-96
CompanyController.java
src/main/java/com/example/tdl/web/CompanyController.java
+8
-1
DataController.java
src/main/java/com/example/tdl/web/DataController.java
+2
-2
RoleController.java
src/main/java/com/example/tdl/web/RoleController.java
+26
-1
messages_zh_CN.properties
src/main/resources/i18n/messages_zh_CN.properties
+1
-0
CompanyMapper.xml
src/main/resources/mapper/CompanyMapper.xml
+1
-0
No files found.
src/main/java/com/example/tdl/domain/vo/AddCompanyVo.java
View file @
ee4e5dbe
...
@@ -19,6 +19,16 @@ public class AddCompanyVo {
...
@@ -19,6 +19,16 @@ public class AddCompanyVo {
private
String
img
;
private
String
img
;
private
String
roleName
;
public
String
getRoleName
()
{
return
roleName
;
}
public
void
setRoleName
(
String
roleName
)
{
this
.
roleName
=
roleName
;
}
public
String
getAlias
()
{
public
String
getAlias
()
{
return
alias
;
return
alias
;
}
}
...
...
src/main/java/com/example/tdl/util/DataUtil.java
View file @
ee4e5dbe
This diff is collapsed.
Click to expand it.
src/main/java/com/example/tdl/web/CompanyController.java
View file @
ee4e5dbe
...
@@ -82,7 +82,8 @@ public class CompanyController {
...
@@ -82,7 +82,8 @@ public class CompanyController {
" addressDetail:具体地址,"
+
" addressDetail:具体地址,"
+
" tel:电话号码,"
+
" tel:电话号码,"
+
" manager:负责人,"
+
" manager:负责人,"
+
" img:图片地址"
)
" img:图片地址,"
+
" roleName:辉度给该公司分配权限的角色名"
)
@ApiImplicitParams
({
@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"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"AccountLanguage"
,
value
=
"language"
,
required
=
false
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"header"
,
name
=
"AccountLanguage"
,
value
=
"language"
,
required
=
false
,
dataType
=
"String"
),
...
@@ -130,6 +131,11 @@ public class CompanyController {
...
@@ -130,6 +131,11 @@ public class CompanyController {
fb
.
setMessage
(
i18n
.
getMessage
(
request
,
"wrongTel"
));
fb
.
setMessage
(
i18n
.
getMessage
(
request
,
"wrongTel"
));
return
gson
.
toJson
(
fb
);
return
gson
.
toJson
(
fb
);
}
}
if
(
StringUtils
.
isEmpty
(
addCompanyVo
.
getRoleName
())){
fb
.
setCode
(
0
);
fb
.
setMessage
(
i18n
.
getMessage
(
request
,
"roleName"
));
return
gson
.
toJson
(
fb
);
}
if
(
companyService
.
getByCompanyName
(
addCompanyVo
.
getCompanyName
())!=
null
){
if
(
companyService
.
getByCompanyName
(
addCompanyVo
.
getCompanyName
())!=
null
){
fb
.
setCode
(
0
);
fb
.
setCode
(
0
);
fb
.
setMessage
(
i18n
.
getMessage
(
request
,
"repeateCompanyName"
));
fb
.
setMessage
(
i18n
.
getMessage
(
request
,
"repeateCompanyName"
));
...
@@ -159,6 +165,7 @@ public class CompanyController {
...
@@ -159,6 +165,7 @@ public class CompanyController {
map
.
put
(
"tel"
,
addCompanyVo
.
getTel
());
map
.
put
(
"tel"
,
addCompanyVo
.
getTel
());
map
.
put
(
"manager"
,
addCompanyVo
.
getManager
());
map
.
put
(
"manager"
,
addCompanyVo
.
getManager
());
map
.
put
(
"img"
,
addCompanyVo
.
getImg
());
map
.
put
(
"img"
,
addCompanyVo
.
getImg
());
map
.
put
(
"roleName"
,
addCompanyVo
.
getRoleName
());
map
.
put
(
"createTime"
,
System
.
currentTimeMillis
());
map
.
put
(
"createTime"
,
System
.
currentTimeMillis
());
companyService
.
addCompany
(
map
);
companyService
.
addCompany
(
map
);
Map
<
String
,
Object
>
msg
=
new
HashMap
<>();
Map
<
String
,
Object
>
msg
=
new
HashMap
<>();
...
...
src/main/java/com/example/tdl/web/DataController.java
View file @
ee4e5dbe
...
@@ -67,8 +67,8 @@ public class DataController {
...
@@ -67,8 +67,8 @@ public class DataController {
@Autowired
@Autowired
private
ProbesService
probesService
;
private
ProbesService
probesService
;
@Autowired
//
@Autowired
private
InfluxDBService
influxDBService
;
//
private InfluxDBService influxDBService;
@Autowired
@Autowired
private
I18nController
i18n
;
private
I18nController
i18n
;
...
...
src/main/java/com/example/tdl/web/RoleController.java
View file @
ee4e5dbe
...
@@ -153,6 +153,11 @@ public class RoleController {
...
@@ -153,6 +153,11 @@ public class RoleController {
fb
.
setMessage
(
i18n
.
getMessage
(
request
,
"roleName"
));
fb
.
setMessage
(
i18n
.
getMessage
(
request
,
"roleName"
));
return
gson
.
toJson
(
fb
);
return
gson
.
toJson
(
fb
);
}
}
if
(
addRoleForPermissionVo
.
getRoleName
().
equals
(
"管理员"
)){
fb
.
setCode
(
0
);
fb
.
setMessage
(
i18n
.
getMessage
(
request
,
"adminInoperable"
));
return
gson
.
toJson
(
fb
);
}
Integer
a
=
roleService
.
getByRoleName
(
addRoleForPermissionVo
.
getRoleName
(),
user
.
getCompanyName
());
Integer
a
=
roleService
.
getByRoleName
(
addRoleForPermissionVo
.
getRoleName
(),
user
.
getCompanyName
());
if
(
a
>
0
){
if
(
a
>
0
){
fb
.
setCode
(
0
);
fb
.
setCode
(
0
);
...
@@ -213,6 +218,11 @@ public class RoleController {
...
@@ -213,6 +218,11 @@ public class RoleController {
fb
.
setMessage
(
i18n
.
getMessage
(
request
,
"repeatedRole"
));
fb
.
setMessage
(
i18n
.
getMessage
(
request
,
"repeatedRole"
));
return
gson
.
toJson
(
fb
);
return
gson
.
toJson
(
fb
);
}
}
if
(
updateRoleVo
.
getRoleName
().
equals
(
"管理员"
)){
fb
.
setCode
(
0
);
fb
.
setMessage
(
i18n
.
getMessage
(
request
,
"adminInoperable"
));
return
gson
.
toJson
(
fb
);
}
try
{
try
{
updateRoleVo
.
setCompanyName
(
user
.
getCompanyName
());
updateRoleVo
.
setCompanyName
(
user
.
getCompanyName
());
int
c
=
roleService
.
updateRole
(
updateRoleVo
);
int
c
=
roleService
.
updateRole
(
updateRoleVo
);
...
@@ -248,6 +258,11 @@ public class RoleController {
...
@@ -248,6 +258,11 @@ public class RoleController {
fb
.
setMessage
(
i18n
.
getMessage
(
request
,
"roleName"
));
fb
.
setMessage
(
i18n
.
getMessage
(
request
,
"roleName"
));
return
gson
.
toJson
(
fb
);
return
gson
.
toJson
(
fb
);
}
}
if
(
roleName
.
equals
(
"管理员"
)){
fb
.
setCode
(
0
);
fb
.
setMessage
(
i18n
.
getMessage
(
request
,
"adminInoperable"
));
return
gson
.
toJson
(
fb
);
}
int
f
=
userService
.
getByRoleName
(
roleName
,
user
.
getCompanyName
());
int
f
=
userService
.
getByRoleName
(
roleName
,
user
.
getCompanyName
());
if
(
f
>
0
){
if
(
f
>
0
){
fb
.
setCode
(
0
);
fb
.
setCode
(
0
);
...
@@ -301,6 +316,11 @@ public class RoleController {
...
@@ -301,6 +316,11 @@ public class RoleController {
fb
.
setMessage
(
i18n
.
getMessage
(
request
,
"roleName"
));
fb
.
setMessage
(
i18n
.
getMessage
(
request
,
"roleName"
));
return
gson
.
toJson
(
fb
);
return
gson
.
toJson
(
fb
);
}
}
if
(!
user
.
getCompanyName
().
equals
(
"上海辉度"
)){
fb
.
setCode
(
0
);
fb
.
setMessage
(
"只有辉度能修改其他公司的权限"
);
return
gson
.
toJson
(
fb
);
}
String
companyNameVar
=
""
;
String
companyNameVar
=
""
;
for
(
int
i
=
0
;
i
<
updateRoleForWitiumVo
.
getCompanyNameVar
().
size
();
i
++){
for
(
int
i
=
0
;
i
<
updateRoleForWitiumVo
.
getCompanyNameVar
().
size
();
i
++){
companyNameVar
+=
updateRoleForWitiumVo
.
getCompanyNameVar
().
get
(
i
)+
"&"
;
companyNameVar
+=
updateRoleForWitiumVo
.
getCompanyNameVar
().
get
(
i
)+
"&"
;
...
@@ -329,7 +349,7 @@ public class RoleController {
...
@@ -329,7 +349,7 @@ public class RoleController {
return
gson
.
toJson
(
fb
);
return
gson
.
toJson
(
fb
);
}
}
//
添加
角色
//
辉度添加其他公司
角色
@ApiOperation
(
value
=
"辉度添加其他公司角色"
,
notes
=
"辉度添加其他公司角色,传递参数:"
+
@ApiOperation
(
value
=
"辉度添加其他公司角色"
,
notes
=
"辉度添加其他公司角色,传递参数:"
+
" roleName:角色名,"
+
" roleName:角色名,"
+
" companyName:需要添加的公司,"
+
" companyName:需要添加的公司,"
+
...
@@ -345,6 +365,11 @@ public class RoleController {
...
@@ -345,6 +365,11 @@ public class RoleController {
String
token
=
request
.
getHeader
(
"Account_token"
);
String
token
=
request
.
getHeader
(
"Account_token"
);
String
datum
=
tokenRedisService
.
get
(
"TOKEN_"
+
token
);
String
datum
=
tokenRedisService
.
get
(
"TOKEN_"
+
token
);
UserRedisVo
user
=
gson
.
fromJson
(
datum
,
UserRedisVo
.
class
);
UserRedisVo
user
=
gson
.
fromJson
(
datum
,
UserRedisVo
.
class
);
if
(!
user
.
getCompanyName
().
equals
(
"上海辉度"
)){
fb
.
setCode
(
0
);
fb
.
setMessage
(
"只有辉度能添加其他公司的角色"
);
return
gson
.
toJson
(
fb
);
}
if
(
StringUtils
.
isEmpty
(
addRoleForWitiumVo
.
getCompanyName
())){
if
(
StringUtils
.
isEmpty
(
addRoleForWitiumVo
.
getCompanyName
())){
fb
.
setCode
(
0
);
fb
.
setCode
(
0
);
fb
.
setMessage
(
i18n
.
getMessage
(
request
,
"companyName"
));
fb
.
setMessage
(
i18n
.
getMessage
(
request
,
"companyName"
));
...
...
src/main/resources/i18n/messages_zh_CN.properties
View file @
ee4e5dbe
...
@@ -252,6 +252,7 @@ updateSuccess=\u4FEE\u6539\u89D2\u8272\u6210\u529F
...
@@ -252,6 +252,7 @@ updateSuccess=\u4FEE\u6539\u89D2\u8272\u6210\u529F
updateFailure
=
\u
4FEE
\u6539\u
89D2
\u8272\u5931\u
8D25
updateFailure
=
\u
4FEE
\u6539\u
89D2
\u8272\u5931\u
8D25
deleteSuccess
=
\u5220\u9664\u
89D2
\u8272\u6210\u
529F
deleteSuccess
=
\u5220\u9664\u
89D2
\u8272\u6210\u
529F
deleteFailure
=
\u5220\u9664\u
89D2
\u8272\u5931\u
8D25
deleteFailure
=
\u5220\u9664\u
89D2
\u8272\u5931\u
8D25
adminInoperable
=
\u
7BA1
\u7406\u5458\u
89D2
\u8272\u
4E0D
\u
80FD
\u
64CD
\u
4F5C
#\u4ED3\u5E93\u6570\u636E\u4E0B\u8F7D
#\u4ED3\u5E93\u6570\u636E\u4E0B\u8F7D
downloadStartTime
=
\u
67E5
\u
8BE2
\u
5F00
\u
59CB
\u
65F6
\u
95F4
\u
4E0D
\u
80FD
\u
4E3A
\u
7A7A
downloadStartTime
=
\u
67E5
\u
8BE2
\u
5F00
\u
59CB
\u
65F6
\u
95F4
\u
4E0D
\u
80FD
\u
4E3A
\u
7A7A
downloadEndTime
=
\u
67E5
\u
8BE2
\u
7ED3
\u
675F
\u
65F6
\u
95F4
\u
4E0D
\u
80FD
\u
4E3A
\u
7A7A
downloadEndTime
=
\u
67E5
\u
8BE2
\u
7ED3
\u
675F
\u
65F6
\u
95F4
\u
4E0D
\u
80FD
\u
4E3A
\u
7A7A
...
...
src/main/resources/mapper/CompanyMapper.xml
View file @
ee4e5dbe
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#{tel,mode=IN,jdbcType=VARCHAR},
#{tel,mode=IN,jdbcType=VARCHAR},
#{manager,mode=IN,jdbcType=VARCHAR},
#{manager,mode=IN,jdbcType=VARCHAR},
#{img,mode=IN,jdbcType=VARCHAR},
#{img,mode=IN,jdbcType=VARCHAR},
#{roleName,mode=IN,jdbcType=VARCHAR},
#{createTime,mode=IN,jdbcType=VARCHAR},
#{createTime,mode=IN,jdbcType=VARCHAR},
#{msg,mode=OUT,jdbcType=VARCHAR}
#{msg,mode=OUT,jdbcType=VARCHAR}
)
)
...
...
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