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
831b13fe
Commit
831b13fe
authored
Apr 30, 2021
by
季圣华
Browse files
给客户和仓库增加权限控制
parent
93a384df
Changes
3
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/controller/DepotController.java
View file @
831b13fe
...
@@ -10,6 +10,7 @@ import com.jsh.erp.exception.BusinessRunTimeException;
...
@@ -10,6 +10,7 @@ import com.jsh.erp.exception.BusinessRunTimeException;
import
com.jsh.erp.service.depot.DepotService
;
import
com.jsh.erp.service.depot.DepotService
;
import
com.jsh.erp.service.material.MaterialService
;
import
com.jsh.erp.service.material.MaterialService
;
import
com.jsh.erp.service.systemConfig.SystemConfigService
;
import
com.jsh.erp.service.systemConfig.SystemConfigService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.service.userBusiness.UserBusinessService
;
import
com.jsh.erp.service.userBusiness.UserBusinessService
;
import
com.jsh.erp.utils.*
;
import
com.jsh.erp.utils.*
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -36,6 +37,9 @@ public class DepotController {
...
@@ -36,6 +37,9 @@ public class DepotController {
@Resource
@Resource
private
DepotService
depotService
;
private
DepotService
depotService
;
@Resource
private
UserService
userService
;
@Resource
@Resource
private
UserBusinessService
userBusinessService
;
private
UserBusinessService
userBusinessService
;
...
@@ -113,18 +117,18 @@ public class DepotController {
...
@@ -113,18 +117,18 @@ public class DepotController {
}
}
/**
/**
* 获取用户拥有权限的仓库列表
* 获取当前用户拥有权限的仓库列表
* @param type
* @param keyId
* @param request
* @param request
* @return
* @return
* @throws Exception
* @throws Exception
*/
*/
@GetMapping
(
value
=
"/findDepotByUserId"
)
@GetMapping
(
value
=
"/findDepotByCurrentUser"
)
public
JSONArray
findDepotByUserId
(
@RequestParam
(
"UBType"
)
String
type
,
@RequestParam
(
"UBKeyId"
)
String
keyId
,
public
BaseResponseInfo
findDepotByCurrentUser
(
HttpServletRequest
request
)
throws
Exception
{
HttpServletRequest
request
)
throws
Exception
{
BaseResponseInfo
res
=
new
BaseResponseInfo
();
JSONArray
arr
=
new
JSONArray
();
try
{
try
{
JSONArray
arr
=
new
JSONArray
();
String
type
=
"UserDepot"
;
Long
userId
=
userService
.
getUserId
(
request
);
List
<
Depot
>
dataList
=
depotService
.
findUserDepot
();
List
<
Depot
>
dataList
=
depotService
.
findUserDepot
();
//开始拼接json数据
//开始拼接json数据
if
(
null
!=
dataList
)
{
if
(
null
!=
dataList
)
{
...
@@ -134,9 +138,9 @@ public class DepotController {
...
@@ -134,9 +138,9 @@ public class DepotController {
//勾选判断1
//勾选判断1
Boolean
flag
=
false
;
Boolean
flag
=
false
;
try
{
try
{
flag
=
userBusinessService
.
checkIsUserBusinessExist
(
type
,
keyId
,
"["
+
depot
.
getId
().
toString
()
+
"]"
);
flag
=
userBusinessService
.
checkIsUserBusinessExist
(
type
,
userId
.
toString
()
,
"["
+
depot
.
getId
().
toString
()
+
"]"
);
}
catch
(
DataAccessException
e
)
{
}
catch
(
DataAccessException
e
)
{
logger
.
error
(
">>>>>>>>>>>>>>>>>查询用户对应的仓库:类型"
+
type
+
" KeyId为: "
+
key
Id
+
" 存在异常!"
);
logger
.
error
(
">>>>>>>>>>>>>>>>>查询用户对应的仓库:类型"
+
type
+
" KeyId为: "
+
user
Id
+
" 存在异常!"
);
}
}
if
(!
depotFlag
||
flag
)
{
if
(!
depotFlag
||
flag
)
{
item
.
put
(
"id"
,
depot
.
getId
());
item
.
put
(
"id"
,
depot
.
getId
());
...
@@ -145,10 +149,14 @@ public class DepotController {
...
@@ -145,10 +149,14 @@ public class DepotController {
}
}
}
}
}
}
res
.
code
=
200
;
res
.
data
=
arr
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
res
.
code
=
500
;
res
.
data
=
"获取数据失败"
;
}
}
return
arr
;
return
res
;
}
}
@PostMapping
(
value
=
"/updateIsDefault"
)
@PostMapping
(
value
=
"/updateIsDefault"
)
...
...
jshERP-boot/src/main/java/com/jsh/erp/controller/SupplierController.java
View file @
831b13fe
...
@@ -78,11 +78,11 @@ public class SupplierController {
...
@@ -78,11 +78,11 @@ public class SupplierController {
* @return
* @return
*/
*/
@PostMapping
(
value
=
"/findBySelect_cus"
)
@PostMapping
(
value
=
"/findBySelect_cus"
)
public
JSONArray
findBySelectCus
(
@RequestParam
(
value
=
"UBType"
,
required
=
false
)
String
ubType
,
public
JSONArray
findBySelectCus
(
HttpServletRequest
request
)
{
@RequestParam
(
value
=
"UBKeyId"
,
required
=
false
)
String
ubKeyId
,
HttpServletRequest
request
)
{
JSONArray
arr
=
new
JSONArray
();
JSONArray
arr
=
new
JSONArray
();
try
{
try
{
String
type
=
"UserCustomer"
;
Long
userId
=
userService
.
getUserId
(
request
);
List
<
Supplier
>
supplierList
=
supplierService
.
findBySelectCus
();
List
<
Supplier
>
supplierList
=
supplierService
.
findBySelectCus
();
JSONArray
dataArray
=
new
JSONArray
();
JSONArray
dataArray
=
new
JSONArray
();
if
(
null
!=
supplierList
)
{
if
(
null
!=
supplierList
)
{
...
@@ -92,7 +92,7 @@ public class SupplierController {
...
@@ -92,7 +92,7 @@ public class SupplierController {
//勾选判断1
//勾选判断1
Boolean
flag
=
false
;
Boolean
flag
=
false
;
try
{
try
{
flag
=
userBusinessService
.
checkIsUserBusinessExist
(
ubT
ype
,
u
bKeyId
,
"["
+
supplier
.
getId
().
toString
()
+
"]"
);
flag
=
userBusinessService
.
checkIsUserBusinessExist
(
t
ype
,
u
serId
.
toString
()
,
"["
+
supplier
.
getId
().
toString
()
+
"]"
);
}
catch
(
DataAccessException
e
)
{
}
catch
(
DataAccessException
e
)
{
logger
.
error
(
">>>>>>>>>>>>>>>>>查询用户对应的客户:存在异常!"
);
logger
.
error
(
">>>>>>>>>>>>>>>>>查询用户对应的客户:存在异常!"
);
}
}
...
...
jshERP-boot/src/main/java/com/jsh/erp/controller/SystemConfigController.java
View file @
831b13fe
...
@@ -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.Depot
;
import
com.jsh.erp.datasource.entities.Depot
;
import
com.jsh.erp.datasource.entities.SystemConfig
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.service.depot.DepotService
;
import
com.jsh.erp.service.depot.DepotService
;
import
com.jsh.erp.service.systemConfig.SystemConfigService
;
import
com.jsh.erp.service.systemConfig.SystemConfigService
;
...
@@ -84,4 +85,26 @@ public class SystemConfigController {
...
@@ -84,4 +85,26 @@ public class SystemConfigController {
}
}
return
res
;
return
res
;
}
}
/**
* 获取当前租户的配置信息
* @param request
* @return
*/
@GetMapping
(
value
=
"/getCurrentInfo"
)
public
BaseResponseInfo
getCurrentInfo
(
HttpServletRequest
request
)
throws
Exception
{
BaseResponseInfo
res
=
new
BaseResponseInfo
();
try
{
List
<
SystemConfig
>
list
=
systemConfigService
.
getSystemConfig
();
if
(
list
.
size
()>
0
)
{
res
.
code
=
200
;
res
.
data
=
list
.
get
(
0
);
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
res
.
code
=
500
;
res
.
data
=
"获取数据失败"
;
}
return
res
;
}
}
}
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