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
dce1a9b1
Commit
dce1a9b1
authored
Sep 07, 2020
by
季圣华
Browse files
增加本机构数据权限的逻辑
parent
3b4afd98
Changes
9
Hide whitespace changes
Inline
Side-by-side
erp_web/pages/manage/user.html
View file @
dce1a9b1
...
@@ -104,7 +104,7 @@
...
@@ -104,7 +104,7 @@
</tr>
</tr>
<tr>
<tr>
<td>
<td>
用户
排序
排序
</td>
</td>
<td
style=
"padding:5px"
>
<td
style=
"padding:5px"
>
<input
name=
"userBlngOrgaDsplSeq"
id=
"userBlngOrgaDsplSeq"
class=
"easyui-textbox"
style=
"width: 230px;"
/>
<input
name=
"userBlngOrgaDsplSeq"
id=
"userBlngOrgaDsplSeq"
class=
"easyui-textbox"
style=
"width: 230px;"
/>
...
@@ -175,7 +175,7 @@
...
@@ -175,7 +175,7 @@
title
:
'
操作
'
,
field
:
'
isystem
'
,
align
:
"
center
"
,
width
:
80
,
title
:
'
操作
'
,
field
:
'
isystem
'
,
align
:
"
center
"
,
width
:
80
,
formatter
:
function
(
value
,
rec
,
index
)
{
formatter
:
function
(
value
,
rec
,
index
)
{
var
str
=
''
;
var
str
=
''
;
if
(
rec
.
loginNam
e
!=
"
jsh
"
)
{
if
(
rec
.
userTyp
e
!=
"
演示用户
"
)
{
str
+=
'
<img src="/js/easyui/themes/icons/pencil.png" style="cursor: pointer;" onclick="editUser(
\'
'
+
index
+
'
\'
);"/>
'
;
str
+=
'
<img src="/js/easyui/themes/icons/pencil.png" style="cursor: pointer;" onclick="editUser(
\'
'
+
index
+
'
\'
);"/>
'
;
}
}
if
(
isShowOpFun
())
{
if
(
isShowOpFun
())
{
...
@@ -188,19 +188,7 @@
...
@@ -188,19 +188,7 @@
return
str
;
return
str
;
}
}
},
},
{
{
title
:
'
用户类型
'
,
field
:
'
userType
'
,
width
:
80
},
title
:
'
用户类型
'
,
field
:
'
userType
'
,
width
:
80
,
formatter
:
function
(
value
,
rec
,
index
)
{
var
str
=
''
;
if
(
rec
.
id
==
rec
.
tenantId
)
{
str
=
"
租户
"
;
}
else
if
(
rec
.
tenantId
==
null
){
str
=
"
超管
"
;
}
else
{
str
=
"
普通
"
;
}
return
str
;
}
},
{
title
:
'
登录名称
'
,
field
:
'
loginName
'
,
width
:
80
,
align
:
"
center
"
},
{
title
:
'
登录名称
'
,
field
:
'
loginName
'
,
width
:
80
,
align
:
"
center
"
},
{
title
:
'
用户姓名
'
,
field
:
'
username
'
,
width
:
80
,
align
:
"
center
"
},
{
title
:
'
用户姓名
'
,
field
:
'
username
'
,
width
:
80
,
align
:
"
center
"
},
{
title
:
'
角色
'
,
field
:
'
roleName
'
,
width
:
80
,
align
:
"
center
"
},
{
title
:
'
角色
'
,
field
:
'
roleName
'
,
width
:
80
,
align
:
"
center
"
},
...
@@ -208,7 +196,7 @@
...
@@ -208,7 +196,7 @@
{
title
:
'
机构
'
,
field
:
'
orgAbr
'
,
width
:
115
,
align
:
"
center
"
},
{
title
:
'
机构
'
,
field
:
'
orgAbr
'
,
width
:
115
,
align
:
"
center
"
},
{
title
:
'
电子邮箱
'
,
field
:
'
email
'
,
width
:
150
,
align
:
"
center
"
},
{
title
:
'
电子邮箱
'
,
field
:
'
email
'
,
width
:
150
,
align
:
"
center
"
},
{
title
:
'
电话号码
'
,
field
:
'
phonenum
'
,
width
:
150
,
align
:
"
center
"
},
{
title
:
'
电话号码
'
,
field
:
'
phonenum
'
,
width
:
150
,
align
:
"
center
"
},
{
title
:
'
用户
排序
'
,
field
:
'
userBlngOrgaDsplSeq
'
,
width
:
80
,
align
:
"
center
"
},
{
title
:
'
排序
'
,
field
:
'
userBlngOrgaDsplSeq
'
,
width
:
80
,
align
:
"
center
"
},
{
title
:
'
描述
'
,
field
:
'
description
'
,
width
:
130
},
{
title
:
'
描述
'
,
field
:
'
description
'
,
width
:
130
},
{
field
:
'
orgaId
'
,
hidden
:
true
,
width
:
10
}
{
field
:
'
orgaId
'
,
hidden
:
true
,
width
:
10
}
]],
]],
...
...
src/main/java/com/jsh/erp/datasource/entities/UserEx.java
View file @
dce1a9b1
...
@@ -18,6 +18,8 @@ public class UserEx extends User{
...
@@ -18,6 +18,8 @@ public class UserEx extends User{
private
String
roleName
;
private
String
roleName
;
private
String
userType
;
public
String
getOrgAbr
()
{
public
String
getOrgAbr
()
{
return
orgAbr
;
return
orgAbr
;
}
}
...
@@ -57,4 +59,12 @@ public class UserEx extends User{
...
@@ -57,4 +59,12 @@ public class UserEx extends User{
public
void
setRoleName
(
String
roleName
)
{
public
void
setRoleName
(
String
roleName
)
{
this
.
roleName
=
roleName
;
this
.
roleName
=
roleName
;
}
}
public
String
getUserType
()
{
return
userType
;
}
public
void
setUserType
(
String
userType
)
{
this
.
userType
=
userType
;
}
}
}
src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapperEx.java
View file @
dce1a9b1
...
@@ -21,7 +21,7 @@ public interface DepotHeadMapperEx {
...
@@ -21,7 +21,7 @@ public interface DepotHeadMapperEx {
List
<
DepotHeadVo4List
>
selectByConditionDepotHead
(
List
<
DepotHeadVo4List
>
selectByConditionDepotHead
(
@Param
(
"type"
)
String
type
,
@Param
(
"type"
)
String
type
,
@Param
(
"subType"
)
String
subType
,
@Param
(
"subType"
)
String
subType
,
@Param
(
"handsPersonId"
)
Long
handsPersonId
,
@Param
(
"handsPersonId
s
"
)
String
[]
handsPersonId
s
,
@Param
(
"number"
)
String
number
,
@Param
(
"number"
)
String
number
,
@Param
(
"beginTime"
)
String
beginTime
,
@Param
(
"beginTime"
)
String
beginTime
,
@Param
(
"endTime"
)
String
endTime
,
@Param
(
"endTime"
)
String
endTime
,
...
@@ -33,7 +33,7 @@ public interface DepotHeadMapperEx {
...
@@ -33,7 +33,7 @@ public interface DepotHeadMapperEx {
Long
countsByDepotHead
(
Long
countsByDepotHead
(
@Param
(
"type"
)
String
type
,
@Param
(
"type"
)
String
type
,
@Param
(
"subType"
)
String
subType
,
@Param
(
"subType"
)
String
subType
,
@Param
(
"handsPersonId"
)
Long
handsPersonId
,
@Param
(
"handsPersonId
s
"
)
String
[]
handsPersonId
s
,
@Param
(
"number"
)
String
number
,
@Param
(
"number"
)
String
number
,
@Param
(
"beginTime"
)
String
beginTime
,
@Param
(
"beginTime"
)
String
beginTime
,
@Param
(
"endTime"
)
String
endTime
,
@Param
(
"endTime"
)
String
endTime
,
...
...
src/main/java/com/jsh/erp/service/depotHead/DepotHeadService.java
View file @
dce1a9b1
...
@@ -15,6 +15,7 @@ import com.jsh.erp.exception.BusinessRunTimeException;
...
@@ -15,6 +15,7 @@ import com.jsh.erp.exception.BusinessRunTimeException;
import
com.jsh.erp.exception.JshException
;
import
com.jsh.erp.exception.JshException
;
import
com.jsh.erp.service.depotItem.DepotItemService
;
import
com.jsh.erp.service.depotItem.DepotItemService
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.orgaUserRel.OrgaUserRelService
;
import
com.jsh.erp.service.serialNumber.SerialNumberService
;
import
com.jsh.erp.service.serialNumber.SerialNumberService
;
import
com.jsh.erp.service.supplier.SupplierService
;
import
com.jsh.erp.service.supplier.SupplierService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.service.user.UserService
;
...
@@ -53,6 +54,8 @@ public class DepotHeadService {
...
@@ -53,6 +54,8 @@ public class DepotHeadService {
@Resource
@Resource
private
SerialNumberService
serialNumberService
;
private
SerialNumberService
serialNumberService
;
@Resource
@Resource
private
OrgaUserRelService
orgaUserRelService
;
@Resource
DepotItemMapperEx
depotItemMapperEx
;
DepotItemMapperEx
depotItemMapperEx
;
@Resource
@Resource
private
LogService
logService
;
private
LogService
logService
;
...
@@ -81,15 +84,21 @@ public class DepotHeadService {
...
@@ -81,15 +84,21 @@ public class DepotHeadService {
public
List
<
DepotHeadVo4List
>
select
(
String
type
,
String
subType
,
String
roleType
,
String
number
,
String
beginTime
,
String
endTime
,
public
List
<
DepotHeadVo4List
>
select
(
String
type
,
String
subType
,
String
roleType
,
String
number
,
String
beginTime
,
String
endTime
,
String
materialParam
,
String
depotIds
,
int
offset
,
int
rows
)
throws
Exception
{
String
materialParam
,
String
depotIds
,
int
offset
,
int
rows
)
throws
Exception
{
Lo
ng
handsPersonId
=
null
;
Stri
ng
handsPersonId
s
=
""
;
User
user
=
userService
.
getCurrentUser
();
User
user
=
userService
.
getCurrentUser
();
if
(
"个人数据"
.
equals
(
roleType
))
{
if
(
"个人数据"
.
equals
(
roleType
))
{
handsPersonId
=
user
.
getId
();
handsPersonIds
=
user
.
getId
().
toString
();
}
else
if
(
"本机构数据"
.
equals
(
roleType
))
{
handsPersonIds
=
orgaUserRelService
.
getUserIdListByUserId
(
user
.
getId
());
}
String
[]
handsPersonIdArray
=
null
;
if
(
StringUtil
.
isNotEmpty
(
handsPersonIds
)){
handsPersonIdArray
=
handsPersonIds
.
split
(
","
);
}
}
List
<
DepotHeadVo4List
>
resList
=
new
ArrayList
<
DepotHeadVo4List
>();
List
<
DepotHeadVo4List
>
resList
=
new
ArrayList
<
DepotHeadVo4List
>();
List
<
DepotHeadVo4List
>
list
=
null
;
List
<
DepotHeadVo4List
>
list
=
null
;
try
{
try
{
list
=
depotHeadMapperEx
.
selectByConditionDepotHead
(
type
,
subType
,
handsPersonId
,
number
,
beginTime
,
endTime
,
materialParam
,
depotIds
,
offset
,
rows
);
list
=
depotHeadMapperEx
.
selectByConditionDepotHead
(
type
,
subType
,
handsPersonId
Array
,
number
,
beginTime
,
endTime
,
materialParam
,
depotIds
,
offset
,
rows
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
JshException
.
readFail
(
logger
,
e
);
JshException
.
readFail
(
logger
,
e
);
}
}
...
@@ -125,14 +134,20 @@ public class DepotHeadService {
...
@@ -125,14 +134,20 @@ public class DepotHeadService {
public
Long
countDepotHead
(
String
type
,
String
subType
,
String
roleType
,
String
number
,
String
beginTime
,
String
endTime
,
public
Long
countDepotHead
(
String
type
,
String
subType
,
String
roleType
,
String
number
,
String
beginTime
,
String
endTime
,
String
materialParam
,
String
depotIds
)
throws
Exception
{
String
materialParam
,
String
depotIds
)
throws
Exception
{
Lo
ng
handsPersonId
=
null
;
Stri
ng
handsPersonId
s
=
""
;
User
user
=
userService
.
getCurrentUser
();
User
user
=
userService
.
getCurrentUser
();
if
(
"个人数据"
.
equals
(
roleType
))
{
if
(
"个人数据"
.
equals
(
roleType
))
{
handsPersonId
=
user
.
getId
();
handsPersonIds
=
user
.
getId
().
toString
();
}
else
if
(
"本机构数据"
.
equals
(
roleType
))
{
handsPersonIds
=
orgaUserRelService
.
getUserIdListByUserId
(
user
.
getId
());
}
String
[]
handsPersonIdArray
=
null
;
if
(
StringUtil
.
isNotEmpty
(
handsPersonIds
)){
handsPersonIdArray
=
handsPersonIds
.
split
(
","
);
}
}
Long
result
=
null
;
Long
result
=
null
;
try
{
try
{
result
=
depotHeadMapperEx
.
countsByDepotHead
(
type
,
subType
,
handsPersonId
,
number
,
beginTime
,
endTime
,
materialParam
,
depotIds
);
result
=
depotHeadMapperEx
.
countsByDepotHead
(
type
,
subType
,
handsPersonId
Array
,
number
,
beginTime
,
endTime
,
materialParam
,
depotIds
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
JshException
.
readFail
(
logger
,
e
);
JshException
.
readFail
(
logger
,
e
);
}
}
...
...
src/main/java/com/jsh/erp/service/orgaUserRel/OrgaUserRelService.java
View file @
dce1a9b1
...
@@ -21,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -21,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -41,6 +42,8 @@ public class OrgaUserRelService {
...
@@ -41,6 +42,8 @@ public class OrgaUserRelService {
@Resource
@Resource
private
UserService
userService
;
private
UserService
userService
;
@Resource
@Resource
private
OrganizationService
organizationService
;
@Resource
private
LogService
logService
;
private
LogService
logService
;
public
OrgaUserRel
getOrgaUserRel
(
long
id
)
throws
Exception
{
public
OrgaUserRel
getOrgaUserRel
(
long
id
)
throws
Exception
{
...
@@ -169,4 +172,48 @@ public class OrgaUserRelService {
...
@@ -169,4 +172,48 @@ public class OrgaUserRelService {
}
}
return
null
;
return
null
;
}
}
/**
* 根据用户id获取用户id列表
* @param userId
* @return
* @throws Exception
*/
public
String
getUserIdListByUserId
(
Long
userId
)
throws
Exception
{
OrgaUserRel
our
=
new
OrgaUserRel
();
OrgaUserRelExample
example
=
new
OrgaUserRelExample
();
example
.
createCriteria
().
andUserIdEqualTo
(
userId
);
List
<
OrgaUserRel
>
list
=
orgaUserRelMapper
.
selectByExample
(
example
);
if
(
list
!=
null
&&
list
.
size
()>
0
)
{
our
=
list
.
get
(
0
);
}
List
<
Long
>
userIdList
=
getUserIdListByOrgId
(
our
.
getOrgaId
());
String
users
=
""
;
for
(
Long
u:
userIdList
){
users
=
users
+
u
+
","
;
}
if
(
users
.
length
()>
0
){
users
=
users
.
substring
(
0
,
users
.
length
()-
1
);
}
return
users
;
}
/**
* 根据组织id获取所属的用户id列表(包含组织的递归)
* @param orgId
* @return
*/
public
List
<
Long
>
getUserIdListByOrgId
(
Long
orgId
)
{
List
<
Long
>
orgIdList
=
organizationService
.
getOrgIdByParentId
(
orgId
);
List
<
Long
>
userIdList
=
new
ArrayList
<
Long
>();
OrgaUserRelExample
example
=
new
OrgaUserRelExample
();
example
.
createCriteria
().
andOrgaIdIn
(
orgIdList
).
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
List
<
OrgaUserRel
>
list
=
orgaUserRelMapper
.
selectByExample
(
example
);
if
(
list
!=
null
&&
list
.
size
()>
0
)
{
for
(
OrgaUserRel
our:
list
)
{
userIdList
.
add
(
our
.
getUserId
());
}
}
return
userIdList
;
}
}
}
src/main/java/com/jsh/erp/service/organization/OrganizationService.java
View file @
dce1a9b1
...
@@ -273,4 +273,38 @@ public class OrganizationService {
...
@@ -273,4 +273,38 @@ public class OrganizationService {
}
}
return
result
;
return
result
;
}
}
/**
* 根据父级id递归获取子集组织id
* @return
*/
public
List
<
Long
>
getOrgIdByParentId
(
Long
orgId
)
{
List
<
Long
>
idList
=
new
ArrayList
<
Long
>();
OrganizationExample
example
=
new
OrganizationExample
();
example
.
createCriteria
().
andIdEqualTo
(
orgId
).
andOrgStcdNotEqualTo
(
BusinessConstants
.
ORGANIZATION_STCD_REMOVED
);
List
<
Organization
>
orgList
=
organizationMapper
.
selectByExample
(
example
);
if
(
orgList
!=
null
&&
orgList
.
size
()>
0
)
{
idList
.
add
(
orgId
);
getOrgIdByParentNo
(
idList
,
orgList
.
get
(
0
).
getOrgNo
());
}
return
idList
;
}
/**
* 根据组织编号递归获取下级编号
* @param orgNo
* @return
*/
public
void
getOrgIdByParentNo
(
List
<
Long
>
idList
,
String
orgNo
)
{
List
<
Long
>
list
=
new
ArrayList
<
Long
>();
OrganizationExample
example
=
new
OrganizationExample
();
example
.
createCriteria
().
andOrgParentNoEqualTo
(
orgNo
).
andOrgStcdNotEqualTo
(
BusinessConstants
.
ORGANIZATION_STCD_REMOVED
);
List
<
Organization
>
orgList
=
organizationMapper
.
selectByExample
(
example
);
if
(
orgList
!=
null
&&
orgList
.
size
()>
0
)
{
for
(
Organization
o:
orgList
)
{
idList
.
add
(
o
.
getId
());
getOrgIdByParentNo
(
idList
,
o
.
getOrgNo
());
}
}
}
}
}
src/main/java/com/jsh/erp/service/user/UserService.java
View file @
dce1a9b1
...
@@ -101,6 +101,21 @@ public class UserService {
...
@@ -101,6 +101,21 @@ public class UserService {
List
<
UserEx
>
list
=
null
;
List
<
UserEx
>
list
=
null
;
try
{
try
{
list
=
userMapperEx
.
selectByConditionUser
(
userName
,
loginName
,
offset
,
rows
);
list
=
userMapperEx
.
selectByConditionUser
(
userName
,
loginName
,
offset
,
rows
);
for
(
UserEx
ue:
list
){
String
userType
=
""
;
if
(
demonstrateOpen
&&
TEST_USER
.
equals
(
ue
.
getLoginName
())){
userType
=
"演示用户"
;
}
else
{
if
(
ue
.
getId
().
equals
(
ue
.
getTenantId
()))
{
userType
=
"租户"
;
}
else
if
(
ue
.
getTenantId
()
==
null
){
userType
=
"超管"
;
}
else
{
userType
=
"普通"
;
}
}
ue
.
setUserType
(
userType
);
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
JshException
.
readFail
(
logger
,
e
);
JshException
.
readFail
(
logger
,
e
);
}
}
...
...
src/main/resources/mapper_xml/DepotHeadMapperEx.xml
View file @
dce1a9b1
...
@@ -55,9 +55,6 @@
...
@@ -55,9 +55,6 @@
<if
test=
"subType != null"
>
<if
test=
"subType != null"
>
and dh.sub_type='${subType}'
and dh.sub_type='${subType}'
</if>
</if>
<if
test=
"handsPersonId != null"
>
and dh.hands_person_id='${handsPersonId}'
</if>
<if
test=
"number != null"
>
<if
test=
"number != null"
>
and dh.number like '%${number}%'
and dh.number like '%${number}%'
</if>
</if>
...
@@ -73,6 +70,13 @@
...
@@ -73,6 +70,13 @@
<if
test=
"depotIds != null"
>
<if
test=
"depotIds != null"
>
and di.depot_id in (${depotIds})
and di.depot_id in (${depotIds})
</if>
</if>
<if
test=
"handsPersonIds != null"
>
and dh.hands_person_id in (
<foreach
collection=
"handsPersonIds"
item=
"handsPersonId"
separator=
","
>
#{handsPersonId}
</foreach>
)
</if>
and ifnull(dh.delete_flag,'0') !='1'
and ifnull(dh.delete_flag,'0') !='1'
order by dh.id desc
order by dh.id desc
<if
test=
"offset != null and rows != null"
>
<if
test=
"offset != null and rows != null"
>
...
@@ -92,9 +96,6 @@
...
@@ -92,9 +96,6 @@
<if
test=
"subType != null"
>
<if
test=
"subType != null"
>
and sub_type='${subType}'
and sub_type='${subType}'
</if>
</if>
<if
test=
"handsPersonId != null"
>
and hands_person_id='${handsPersonId}'
</if>
<if
test=
"number != null"
>
<if
test=
"number != null"
>
and number like '%${number}%'
and number like '%${number}%'
</if>
</if>
...
@@ -110,6 +111,13 @@
...
@@ -110,6 +111,13 @@
<if
test=
"depotIds != null"
>
<if
test=
"depotIds != null"
>
and di.depot_id in (${depotIds})
and di.depot_id in (${depotIds})
</if>
</if>
<if
test=
"handsPersonIds != null"
>
and hands_person_id in (
<foreach
collection=
"handsPersonIds"
item=
"handsPersonId"
separator=
","
>
#{handsPersonId}
</foreach>
)
</if>
and ifnull(jsh_depot_head.delete_Flag,'0') !='1') tb
and ifnull(jsh_depot_head.delete_Flag,'0') !='1') tb
</select>
</select>
...
...
src/main/resources/mapper_xml/UserMapperEx.xml
View file @
dce1a9b1
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
<if
test=
"loginName != null"
>
<if
test=
"loginName != null"
>
and user.login_name like '%${loginName}%'
and user.login_name like '%${loginName}%'
</if>
</if>
order by user.id desc
order by
rel.user_blng_orga_dspl_seq,
user.id desc
<if
test=
"offset != null and rows != null"
>
<if
test=
"offset != null and rows != null"
>
limit #{offset},#{rows}
limit #{offset},#{rows}
</if>
</if>
...
...
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