增加根据当前用户获取操作员数组-接口
This commit is contained in:
@@ -440,4 +440,30 @@ public class DepotHeadController {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前用户获取操作员数组,用于控制当前用户的数据权限,限制可以看到的单据范围
|
||||
* 注意:该接口提供给部分插件使用,勿删
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getCreatorByCurrentUser")
|
||||
public BaseResponseInfo getCreatorByRoleType(HttpServletRequest request) {
|
||||
BaseResponseInfo res = new BaseResponseInfo();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
try {
|
||||
String creator = "";
|
||||
Object roleType = request.getSession().getAttribute("roleType");
|
||||
if(roleType!=null) {
|
||||
creator = depotHeadService.getCreatorByRoleType(roleType.toString());
|
||||
}
|
||||
res.code = 200;
|
||||
res.data = creator;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
res.code = 500;
|
||||
res.data = "获取数据失败";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,22 @@ public class DepotHeadService {
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private String[] getCreatorArray(String roleType) throws Exception {
|
||||
public String[] getCreatorArray(String roleType) throws Exception {
|
||||
String creator = getCreatorByRoleType(roleType);
|
||||
String [] creatorArray=null;
|
||||
if(StringUtil.isNotEmpty(creator)){
|
||||
creatorArray = creator.split(",");
|
||||
}
|
||||
return creatorArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色类型获取操作员
|
||||
* @param roleType
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String getCreatorByRoleType(String roleType) throws Exception {
|
||||
String creator = "";
|
||||
User user = userService.getCurrentUser();
|
||||
if(BusinessConstants.ROLE_TYPE_PRIVATE.equals(roleType)) {
|
||||
@@ -148,11 +163,7 @@ public class DepotHeadService {
|
||||
} else if(BusinessConstants.ROLE_TYPE_THIS_ORG.equals(roleType)) {
|
||||
creator = orgaUserRelService.getUserIdListByUserId(user.getId());
|
||||
}
|
||||
String [] creatorArray=null;
|
||||
if(StringUtil.isNotEmpty(creator)){
|
||||
creatorArray = creator.split(",");
|
||||
}
|
||||
return creatorArray;
|
||||
return creator;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
|
||||
Reference in New Issue
Block a user