Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
5a1974a5
Commit
5a1974a5
authored
Apr 01, 2019
by
季圣华
Browse files
解决权限配置过滤的bug
parent
7e799c55
Changes
2
Show whitespace changes
Inline
Side-by-side
src/main/java/com/jsh/erp/controller/AppController.java
View file @
5a1974a5
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.App
;
import
com.jsh.erp.datasource.entities.App
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.datasource.entities.UserBusiness
;
import
com.jsh.erp.datasource.entities.UserBusiness
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.service.app.AppService
;
import
com.jsh.erp.service.app.AppService
;
...
@@ -12,12 +13,14 @@ import com.jsh.erp.utils.BaseResponseInfo;
...
@@ -12,12 +13,14 @@ import com.jsh.erp.utils.BaseResponseInfo;
import
com.jsh.erp.utils.FileUtils
;
import
com.jsh.erp.utils.FileUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.*
;
import
java.io.*
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Properties
;
import
java.util.Properties
;
...
@@ -29,6 +32,9 @@ import java.util.Properties;
...
@@ -29,6 +32,9 @@ import java.util.Properties;
public
class
AppController
{
public
class
AppController
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
AppController
.
class
);
private
Logger
logger
=
LoggerFactory
.
getLogger
(
AppController
.
class
);
@Value
(
"${mybatis-plus.status}"
)
private
String
mybatisPlusStatus
;
@Resource
@Resource
private
AppService
appService
;
private
AppService
appService
;
...
@@ -157,7 +163,7 @@ public class AppController {
...
@@ -157,7 +163,7 @@ public class AppController {
HttpServletRequest
request
)
{
HttpServletRequest
request
)
{
JSONArray
arr
=
new
JSONArray
();
JSONArray
arr
=
new
JSONArray
();
try
{
try
{
List
<
App
>
dataList
=
appService
.
findRoleAPP
();
List
<
App
>
dataList
App
=
appService
.
findRoleAPP
();
//开始拼接json数据
//开始拼接json数据
JSONObject
outer
=
new
JSONObject
();
JSONObject
outer
=
new
JSONObject
();
outer
.
put
(
"id"
,
1
);
outer
.
put
(
"id"
,
1
);
...
@@ -165,9 +171,32 @@ public class AppController {
...
@@ -165,9 +171,32 @@ public class AppController {
outer
.
put
(
"state"
,
"open"
);
outer
.
put
(
"state"
,
"open"
);
//存放数据json数组
//存放数据json数组
JSONArray
dataArray
=
new
JSONArray
();
JSONArray
dataArray
=
new
JSONArray
();
if
(
null
!=
dataList
)
{
if
(
null
!=
dataListApp
)
{
//根据条件从列表里面移除"系统管理"
List
<
App
>
dataList
=
new
ArrayList
<
App
>();
for
(
App
appOne
:
dataListApp
)
{
if
((
"open"
).
equals
(
mybatisPlusStatus
)){
//从session中获取租户id
String
loginName
=
null
;
Object
userInfo
=
request
.
getSession
().
getAttribute
(
"user"
);
if
(
userInfo
!=
null
)
{
User
user
=
(
User
)
userInfo
;
loginName
=
user
.
getLoginame
();
}
if
((
"admin"
).
equals
(
loginName
))
{
dataList
.
add
(
appOne
);
}
else
{
if
(!(
"系统管理"
).
equals
(
appOne
.
getName
()))
{
dataList
.
add
(
appOne
);
}
}
}
else
{
dataList
.
add
(
appOne
);
}
}
//筛选应用列表
for
(
App
app
:
dataList
)
{
for
(
App
app
:
dataList
)
{
if
(!(
"系统管理"
).
equals
(
app
.
getName
()))
{
JSONObject
item
=
new
JSONObject
();
JSONObject
item
=
new
JSONObject
();
item
.
put
(
"id"
,
app
.
getId
());
item
.
put
(
"id"
,
app
.
getId
());
item
.
put
(
"text"
,
app
.
getName
());
item
.
put
(
"text"
,
app
.
getName
());
...
@@ -185,7 +214,6 @@ public class AppController {
...
@@ -185,7 +214,6 @@ public class AppController {
dataArray
.
add
(
item
);
dataArray
.
add
(
item
);
}
}
}
}
}
outer
.
put
(
"children"
,
dataArray
);
outer
.
put
(
"children"
,
dataArray
);
arr
.
add
(
outer
);
arr
.
add
(
outer
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
src/main/java/com/jsh/erp/controller/FunctionsController.java
View file @
5a1974a5
...
@@ -4,18 +4,21 @@ import com.alibaba.fastjson.JSONArray;
...
@@ -4,18 +4,21 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.Functions
;
import
com.jsh.erp.datasource.entities.Functions
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.service.functions.FunctionsService
;
import
com.jsh.erp.service.functions.FunctionsService
;
import
com.jsh.erp.service.userBusiness.UserBusinessService
;
import
com.jsh.erp.service.userBusiness.UserBusinessService
;
import
com.jsh.erp.utils.BaseResponseInfo
;
import
com.jsh.erp.utils.BaseResponseInfo
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.dao.DataAccessException
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -26,6 +29,9 @@ import java.util.List;
...
@@ -26,6 +29,9 @@ import java.util.List;
public
class
FunctionsController
{
public
class
FunctionsController
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
FunctionsController
.
class
);
private
Logger
logger
=
LoggerFactory
.
getLogger
(
FunctionsController
.
class
);
@Value
(
"${mybatis-plus.status}"
)
private
String
mybatisPlusStatus
;
@Resource
@Resource
private
FunctionsService
functionsService
;
private
FunctionsService
functionsService
;
...
@@ -121,7 +127,7 @@ public class FunctionsController {
...
@@ -121,7 +127,7 @@ public class FunctionsController {
HttpServletRequest
request
)
{
HttpServletRequest
request
)
{
JSONArray
arr
=
new
JSONArray
();
JSONArray
arr
=
new
JSONArray
();
try
{
try
{
List
<
Functions
>
dataList
=
functionsService
.
findRoleFunctions
(
"0"
);
List
<
Functions
>
dataList
Fun
=
functionsService
.
findRoleFunctions
(
"0"
);
//开始拼接json数据
//开始拼接json数据
JSONObject
outer
=
new
JSONObject
();
JSONObject
outer
=
new
JSONObject
();
outer
.
put
(
"id"
,
1
);
outer
.
put
(
"id"
,
1
);
...
@@ -129,9 +135,32 @@ public class FunctionsController {
...
@@ -129,9 +135,32 @@ public class FunctionsController {
outer
.
put
(
"state"
,
"open"
);
outer
.
put
(
"state"
,
"open"
);
//存放数据json数组
//存放数据json数组
JSONArray
dataArray
=
new
JSONArray
();
JSONArray
dataArray
=
new
JSONArray
();
if
(
null
!=
dataList
)
{
if
(
null
!=
dataListFun
)
{
//根据条件从列表里面移除"系统管理"
List
<
Functions
>
dataList
=
new
ArrayList
<
Functions
>();
for
(
Functions
fun
:
dataListFun
)
{
if
((
"open"
).
equals
(
mybatisPlusStatus
)){
//从session中获取租户id
String
loginName
=
null
;
Object
userInfo
=
request
.
getSession
().
getAttribute
(
"user"
);
if
(
userInfo
!=
null
)
{
User
user
=
(
User
)
userInfo
;
loginName
=
user
.
getLoginame
();
}
if
((
"admin"
).
equals
(
loginName
))
{
dataList
.
add
(
fun
);
}
else
{
if
(!(
"系统管理"
).
equals
(
fun
.
getName
()))
{
dataList
.
add
(
fun
);
}
}
}
else
{
dataList
.
add
(
fun
);
}
}
//筛选功能列表
for
(
Functions
functions
:
dataList
)
{
for
(
Functions
functions
:
dataList
)
{
if
(!(
"系统管理"
).
equals
(
functions
.
getName
()))
{
JSONObject
item
=
new
JSONObject
();
JSONObject
item
=
new
JSONObject
();
item
.
put
(
"id"
,
functions
.
getId
());
item
.
put
(
"id"
,
functions
.
getId
());
item
.
put
(
"text"
,
functions
.
getName
());
item
.
put
(
"text"
,
functions
.
getName
());
...
@@ -231,7 +260,6 @@ public class FunctionsController {
...
@@ -231,7 +260,6 @@ public class FunctionsController {
}
}
dataArray
.
add
(
item
);
dataArray
.
add
(
item
);
}
}
}
outer
.
put
(
"children"
,
dataArray
);
outer
.
put
(
"children"
,
dataArray
);
arr
.
add
(
outer
);
arr
.
add
(
outer
);
}
}
...
...
Write
Preview
Supports
Markdown
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