Commit 858eff67 by 徐高华

删除管理员判断

parent d3e7c8be
......@@ -45,10 +45,6 @@ public class AdminController extends WebBaseController {
@RequestMapping("admin-list")
public HaobanResponse adminList() {
WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
String staffId = login.getStaffId() ;
if(StringUtils.isBlank(staffId)) {
return this.resultResponse(HaoBanErrCode.ERR_10030) ;
}
String wxEnterpriseId = login.getWxEnterpriseId();
WxApplicationDTO application = wxApplicationApiService.selectByWxEnterpriseIdAndApplicationType(wxEnterpriseId, 2);
WxEnterpriseDTO enterprise = wxEnterpriseApiService.getOne(wxEnterpriseId);
......@@ -74,11 +70,7 @@ public class AdminController extends WebBaseController {
logger.info("UserIds");
list = staffApiService.listByUserIdsAndWxEnterpriseId(openUserIds, wxEnterpriseId);
}
boolean flag = false ;
for (StaffDTO staffDTO : list) {
if(staffDTO.getStaffId().equals(staffId)) {
flag = true ;
}
AdminVO vo = new AdminVO();
vo.setRoleId(staffDTO.getStaffId());
vo.setRoleName("管理员");
......@@ -96,9 +88,6 @@ public class AdminController extends WebBaseController {
resultList.add(vo);
}
}
if(!flag) {
return this.resultResponse(HaoBanErrCode.ERR_10030) ;
}
}
return resultResponse(HaoBanErrCode.ERR_1, resultList);
}
......
......@@ -438,9 +438,6 @@ public class DepartmentContoller extends WebBaseController {
*/
@RequestMapping("department-list-cache")
public HaobanResponse departmentCachelist() {
if(!isAdmin()) {
return this.resultResponse(HaoBanErrCode.ERR_10030) ;
}
WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId();
if (StringUtils.isBlank(wxEnterpriseId)) {
......@@ -455,33 +452,4 @@ public class DepartmentContoller extends WebBaseController {
return resultResponse(HaoBanErrCode.ERR_1, cache);
}
}
private boolean isAdmin(){
WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
String staffId = login.getStaffId() ;
if(StringUtils.isBlank(staffId)) {
return false ;
}
String wxEnterpriseId = login.getWxEnterpriseId();
WxApplicationDTO application = wxApplicationApiService.selectByWxEnterpriseIdAndApplicationType(wxEnterpriseId, 2);
WxEnterpriseDTO enterprise = wxEnterpriseApiService.getOne(wxEnterpriseId);
String corpid = enterprise.getCorpid();
logger.info("【管理员查询】corpid={},siteId={},agentId={}", corpid, application.getSiteId(), application.getAgentId());
String adminList = qywxSuiteApiService.getAdminList(corpid, application.getSiteId(), Integer.parseInt(application.getAgentId()));
logger.info("【管理员查询】userIds={}", JSON.toJSONString(adminList));
List<String> openUserIds = new ArrayList<>();
if (StringUtils.isNotBlank(adminList)) {
JSONArray jsonArr = JSON.parseArray(adminList);
for (Object object : jsonArr) {
JSONObject json = JSON.parseObject(JSON.toJSONString(object));
openUserIds.add(json.getString("userid"));
}
}
StaffDTO staff = this.staffApiService.selectById(staffId) ;
if(openUserIds.contains(staff.getWxUserId()) || openUserIds.contains(staff.getWxOpenUseId())) {
return true ;
}
return false ;
}
}
......@@ -141,9 +141,6 @@ public class StaffController extends WebBaseController {
Integer relationFlag,
String keyWord,
BasePageInfo pageInfo) {
if(!isAdmin()) {
return this.resultResponse(HaoBanErrCode.ERR_10030) ;
}
WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId();
List<String> departmentIds = new ArrayList<>();
......@@ -462,9 +459,6 @@ public class StaffController extends WebBaseController {
*/
@RequestMapping("staff-export")
public HaobanResponse staffExport(HttpServletRequest request, HttpServletResponse response, String departmentId, Integer activeFlag, Integer relationFlag, String keyWord, BasePageInfo pageInfo) {
if(!isAdmin()) {
return this.resultResponse(HaoBanErrCode.ERR_10030) ;
}
List<String> departmentIdSet = new ArrayList<>();
departmentIdSet.add(departmentId);
WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
......@@ -568,9 +562,6 @@ public class StaffController extends WebBaseController {
*/
@RequestMapping("sync-qywx")
public Object syncQywx() {
if(!isAdmin()) {
return this.resultResponse(HaoBanErrCode.ERR_10030) ;
}
WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId();
WxEnterpriseDTO enterpriseDTO = this.wxEnterpriseApiService.getOne(wxEnterpriseId);
......@@ -586,33 +577,4 @@ public class StaffController extends WebBaseController {
}
return resultResponse(HaoBanErrCode.ERR_1);
}
private boolean isAdmin(){
WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
String staffId = login.getStaffId() ;
if(StringUtils.isBlank(staffId)) {
return false ;
}
String wxEnterpriseId = login.getWxEnterpriseId();
WxApplicationDTO application = wxApplicationApiService.selectByWxEnterpriseIdAndApplicationType(wxEnterpriseId, 2);
WxEnterpriseDTO enterprise = wxEnterpriseApiService.getOne(wxEnterpriseId);
String corpid = enterprise.getCorpid();
logger.info("【管理员查询】corpid={},siteId={},agentId={}", corpid, application.getSiteId(), application.getAgentId());
String adminList = qywxSuiteApiService.getAdminList(corpid, application.getSiteId(), Integer.parseInt(application.getAgentId()));
logger.info("【管理员查询】userIds={}", JSON.toJSONString(adminList));
List<String> openUserIds = new ArrayList<>();
if (StringUtils.isNotBlank(adminList)) {
JSONArray jsonArr = JSON.parseArray(adminList);
for (Object object : jsonArr) {
JSONObject json = JSON.parseObject(JSON.toJSONString(object));
openUserIds.add(json.getString("userid"));
}
}
StaffDTO staff = this.staffApiService.selectById(staffId) ;
if(openUserIds.contains(staff.getWxUserId()) || openUserIds.contains(staff.getWxOpenUseId())) {
return true ;
}
return false ;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment