Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
api
Overview
Overview
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
首航-临时账号
api
Commits
78ddee6c
Commit
78ddee6c
authored
Dec 21, 2020
by
java-李谡
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
油量分析权限验证
parent
61f6e755
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
26 deletions
+63
-26
UserRolesDao.xml
resources/mapper/modules/role/UserRolesDao.xml
+12
-0
UserRolesDao.java
src/com/ejweb/modules/role/dao/UserRolesDao.java
+4
-3
UserRolesService.java
src/com/ejweb/modules/role/service/UserRolesService.java
+31
-23
UserController.java
src/com/ejweb/modules/user/api/UserController.java
+5
-0
LoginUserEntity.java
src/com/ejweb/modules/user/entity/LoginUserEntity.java
+11
-0
No files found.
resources/mapper/modules/role/UserRolesDao.xml
View file @
78ddee6c
...
...
@@ -52,6 +52,18 @@
</select>
<select
id=
"getOilRole"
resultType=
"java.lang.Integer"
>
SELECT
count( * )
FROM
sys_user2role ur
LEFT JOIN sys_role r ON r.id = ur.role_id
WHERE
r.enname = 'oil-analysis'
AND r.del_flag = 0
AND ur.user_id = #{userCode}
</select>
<select
id=
"getParentRoles"
resultType=
"com.ejweb.modules.role.entity.UserRolesEntity"
>
SELECT DISTINCT(p.id), p.permission,p.name AS menuName
FROM sys_user2role a
...
...
src/com/ejweb/modules/role/dao/UserRolesDao.java
View file @
78ddee6c
...
...
@@ -23,12 +23,13 @@ public interface UserRolesDao extends BaseDao {
List
<
UserRolesEntity
>
getRootRoles
(
UserRolesBean
bean
);
List
<
InformationEntity
>
getInformation
(
UserRolesBean
bean
);
Integer
getOilRole
(
UserRolesBean
bean
);
/**
*
* @author zhanglg
* @time 2016年10月3日
* @param bean
* @return
* @author zhanglg
* @time 2016年10月3日
*/
List
<
UserRolesEntity
>
getParentRoles
(
UserRolesBean
bean
);
...
...
src/com/ejweb/modules/role/service/UserRolesService.java
View file @
78ddee6c
...
...
@@ -6,12 +6,12 @@ import com.ejweb.modules.role.bean.UserRolesBean;
import
com.ejweb.modules.role.dao.UserRolesDao
;
import
com.ejweb.modules.role.entity.InformationEntity
;
import
com.ejweb.modules.role.entity.UserRolesEntity
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
/**
* @author yuxg
...
...
@@ -28,45 +28,54 @@ public class UserRolesService extends BaseService<UserRolesDao> {
public
List
<
UserRolesEntity
>
getRootRoles
(
UserRolesBean
bean
)
{
return
dao
.
getRootRoles
(
bean
);
return
dao
.
getRootRoles
(
bean
);
}
public
List
<
UserRolesEntity
>
getUserPermissionList
(
String
userCode
)
{
UserRolesBean
bean
=
new
UserRolesBean
();
bean
.
setUserCode
(
userCode
);
return
dao
.
getUserPermissionList
(
bean
);
return
dao
.
getUserPermissionList
(
bean
);
}
public
List
<
InformationEntity
>
getInformation
(
UserRolesBean
bean
)
{
return
dao
.
getInformation
(
bean
);
}
public
List
<
InformationEntity
>
getInformation
(
UserRolesBean
bean
){
return
dao
.
getInformation
(
bean
);
public
boolean
getOilRole
(
UserRolesBean
bean
)
{
Integer
roleCount
=
dao
.
getOilRole
(
bean
);
return
Objects
.
nonNull
(
roleCount
);
}
public
List
<
JSONObject
>
getList
(
String
userCode
,
String
p
){
UserRolesBean
bean
=
new
UserRolesBean
();
List
<
JSONObject
>
jsonlist
=
new
ArrayList
<
JSONObject
>();
public
List
<
JSONObject
>
getList
(
String
userCode
,
String
p
)
{
UserRolesBean
bean
=
new
UserRolesBean
();
List
<
JSONObject
>
jsonlist
=
new
ArrayList
<
JSONObject
>();
bean
.
setUserCode
(
userCode
);
if
(
StringUtils
.
isNoneBlank
(
p
))
{
if
(
StringUtils
.
isNoneBlank
(
p
))
{
bean
.
setPermission
(
p
);
}
List
<
UserRolesEntity
>
list1
=
getParentRoles
(
bean
);
for
(
UserRolesEntity
entity1
:
list1
)
{
JSONObject
json
=
new
JSONObject
();
List
<
UserRolesEntity
>
list1
=
getParentRoles
(
bean
);
for
(
UserRolesEntity
entity1
:
list1
)
{
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"name"
,
entity1
.
getMenuName
());
json
.
put
(
"permission"
,
entity1
.
getPermission
());
getChildList
(
bean
,
json
,
entity1
.
getId
());
getChildList
(
bean
,
json
,
entity1
.
getId
());
jsonlist
.
add
(
json
);
}
return
jsonlist
;
}
private
JSONObject
getChildList
(
UserRolesBean
bean
,
JSONObject
data
,
String
id
){
private
JSONObject
getChildList
(
UserRolesBean
bean
,
JSONObject
data
,
String
id
)
{
bean
.
setId
(
id
);
List
<
UserRolesEntity
>
list1
=
getUserRoles
(
bean
);
if
(
list1
.
size
()!=
0
)
{
List
<
JSONObject
>
jsonlist1
=
new
ArrayList
<
JSONObject
>();
for
(
UserRolesEntity
entity1
:
list1
)
{
JSONObject
json
=
new
JSONObject
();
List
<
UserRolesEntity
>
list1
=
getUserRoles
(
bean
);
if
(
list1
.
size
()
!=
0
)
{
List
<
JSONObject
>
jsonlist1
=
new
ArrayList
<
JSONObject
>();
for
(
UserRolesEntity
entity1
:
list1
)
{
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"name"
,
entity1
.
getMenuName
());
json
.
put
(
"permission"
,
entity1
.
getPermission
());
getChildList
(
bean
,
json
,
entity1
.
getId
());
getChildList
(
bean
,
json
,
entity1
.
getId
());
jsonlist1
.
add
(
json
);
}
data
.
put
(
"children"
,
jsonlist1
);
...
...
@@ -75,11 +84,10 @@ public class UserRolesService extends BaseService<UserRolesDao> {
}
/**
*
* @author zhanglg
* @time 2016年10月3日
* @param bean
* @return
* @author zhanglg
* @time 2016年10月3日
*/
public
List
<
UserRolesEntity
>
getParentRoles
(
UserRolesBean
bean
)
{
...
...
src/com/ejweb/modules/user/api/UserController.java
View file @
78ddee6c
...
...
@@ -350,12 +350,17 @@ public class UserController {
bean
.
setUserCode
(
userEntity
.
getId
());
// 默认有航线论证权限(0表示有航线论证权限,1是没有)
userEntity
.
setVerify
(
"0"
);
// 默认没有油量分析权限(0表示有油量分析权限,1是没有)
userEntity
.
setOil
(
"1"
);
List
<
InformationEntity
>
informationEntity
=
userRolesService
.
getInformation
(
bean
);
// 获取航线论证的部门信息
if
(
informationEntity
==
null
||
informationEntity
.
size
()
==
0
)
{
// 无航向论证权限
userEntity
.
setVerify
(
"1"
);
}
if
(
userRolesService
.
getOilRole
(
bean
))
{
userEntity
.
setOil
(
"0"
);
}
userEntity
.
setShowPhone
(
userEntity
.
getPhone
());
userEntity
.
setPhone
(
Util
.
formatedWorkPhone
(
userEntity
.
getPhone
()));
responseBean
.
setData
(
userEntity
);
...
...
src/com/ejweb/modules/user/entity/LoginUserEntity.java
View file @
78ddee6c
...
...
@@ -14,6 +14,7 @@ public class LoginUserEntity extends BaseEntity {
@JSONField
(
serialize
=
false
)
private
String
officeId
;
// 归属ID
private
String
verify
;
private
String
oil
=
"1"
;
private
String
officeName
;
// 归属部门
private
String
officeFullName
;
// 归属部门
@JSONField
(
serialize
=
false
)
...
...
@@ -281,14 +282,24 @@ public class LoginUserEntity extends BaseEntity {
public
String
getPlatform
()
{
return
platform
;
}
public
void
setPlatform
(
String
platform
)
{
this
.
platform
=
platform
;
}
public
String
getDeviceToken
()
{
return
deviceToken
;
}
public
void
setDeviceToken
(
String
deviceToken
)
{
this
.
deviceToken
=
deviceToken
;
}
public
String
getOil
()
{
return
oil
;
}
public
void
setOil
(
String
oil
)
{
this
.
oil
=
oil
;
}
}
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