Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoban3.0
haoban-manage3.0
Commits
dcb9fa4a
Commit
dcb9fa4a
authored
May 19, 2022
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
管理员校验
parent
6984c948
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
200 additions
and
162 deletions
+200
-162
AdminController.java
...com/gic/haoban/manage/web/controller/AdminController.java
+8
-0
StaffController.java
...com/gic/haoban/manage/web/controller/StaffController.java
+34
-5
HaoBanErrCode.java
...java/com/gic/haoban/manage/web/errCode/HaoBanErrCode.java
+158
-157
No files found.
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/AdminController.java
View file @
dcb9fa4a
...
...
@@ -63,12 +63,17 @@ public class AdminController extends WebBaseController {
List
<
StaffDTO
>
list
=
new
ArrayList
<>();
List
<
AdminVO
>
resultList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
openUserIds
))
{
String
staffId
=
login
.
getStaffId
()
;
if
(
corpid
.
length
()
>
20
)
{
list
=
staffApiService
.
listByOpenUserIdsAndWxEnterpriseId
(
openUserIds
,
wxEnterpriseId
);
}
else
{
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
(
"管理员"
);
...
...
@@ -86,6 +91,9 @@ public class AdminController extends WebBaseController {
resultList
.
add
(
vo
);
}
}
if
(!
flag
)
{
return
this
.
resultResponse
(
HaoBanErrCode
.
ERR_10030
)
;
}
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
resultList
);
}
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/StaffController.java
View file @
dcb9fa4a
...
...
@@ -2,6 +2,7 @@ package com.gic.haoban.manage.web.controller;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.clerk.api.dto.ClerkDTO
;
...
...
@@ -10,7 +11,6 @@ import com.gic.clerk.api.service.ClerkService;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.util.ExcelUtils
;
import
com.gic.enterprise.api.dto.StoreDTO
;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.enterprise.api.service.StoreService
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
...
...
@@ -24,9 +24,12 @@ import com.gic.haoban.manage.api.enums.ChannelCodeEnum;
import
com.gic.haoban.manage.api.service.*
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.qo.StaffEditJsonQO
;
import
com.gic.haoban.manage.web.vo.AdminRoleVO
;
import
com.gic.haoban.manage.web.vo.AdminVO
;
import
com.gic.haoban.manage.web.vo.ClerkInfoVo
;
import
com.gic.haoban.manage.web.vo.StaffExportVO
;
import
com.gic.haoban.manage.web.vo.StaffVO
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
com.google.common.collect.Lists
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -62,20 +65,18 @@ public class StaffController extends WebBaseController {
private
WxApplicationApiService
wxApplicationApiService
;
@Autowired
private
ClerkService
clerkService
;
@Autowired
private
ClerkNewService
clerkNewService
;
@Autowired
private
StoreService
storeService
;
@Autowired
private
StaffClerkRelationApiService
staffClerkRelationApiService
;
@Autowired
private
WxEnterpriseRelatedApiService
wxEnterpriseRelatedApiService
;
@Autowired
private
ClerkMainStoreRelatedApiService
clerkMainStoreRelatedApiService
;
@Autowired
private
QywxSuiteApiService
qywxSuiteApiService
;
@RequestMapping
(
"set-default-gicenterprise"
)
...
...
@@ -138,6 +139,9 @@ public class StaffController extends WebBaseController {
Integer
relationFlag
,
String
keyWord
,
BasePageInfo
pageInfo
)
{
if
(!
isAdmin
())
{
return
this
.
resultResponse
(
HaoBanErrCode
.
ERR_10030
)
;
}
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
// 部门
List
<
DepartmentDTO
>
sonDepartmentList
=
departmentApiService
.
listSonByDepartmentIds
(
Lists
.
newArrayList
(
departmentId
),
login
.
getWxEnterpriseId
());
...
...
@@ -546,5 +550,30 @@ public class StaffController extends WebBaseController {
}
}
}
private
boolean
isAdmin
(){
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
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"
));
}
}
String
staffId
=
login
.
getStaffId
()
;
StaffDTO
staff
=
this
.
staffApiService
.
selectById
(
staffId
)
;
if
(
openUserIds
.
contains
(
staff
.
getWxUserId
())
||
openUserIds
.
contains
(
staff
.
getWxOpenUseId
()))
{
return
true
;
}
return
false
;
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/errCode/HaoBanErrCode.java
View file @
dcb9fa4a
package
com
.
gic
.
haoban
.
manage
.
web
.
errCode
;
/**
* Created by fudh on 2018/3/4.
*/
public
enum
HaoBanErrCode
{
//update by 牧峰 2018-7-25 19:58:06
/**
* 操作失败
*/
ERR_0
(
0
,
"操作失败"
),
/**
* 操作成功
*/
ERR_1
(
1
,
"操作成功"
),
/**
* 缺少参数
*/
ERR_2
(
2
,
"缺少参数"
),
/**
* 系统异常
*/
ERR_3
(
3
,
"系统异常"
),
/**
* 登录异常
*/
ERR_4
(
4
,
"登录异常"
),
/**
* 输入参数错误
*/
ERR_5
(
5
,
"输入参数错误"
),
/**
* 该企业登录用户不存在
*/
ERR_6
(
6
,
"该企业登录用户不存在"
),
/**
* 该用户缺少该权限
*/
ERR_7
(
7
,
"该用户缺少该权限"
),
/**
* 查无数据
*/
ERR_8
(
8
,
"查无数据"
),
/**
* 非法操作
*/
ERR_9
(
9
,
"非法操作"
),
/**
* 用户已经登录
*/
ERR_10
(
10
,
"用户已经登录"
),
/**
* 验证码发送失败
*/
ERR_11
(
11
,
"验证码发送失败"
),
/**
* 验证码发送失败
*/
ERR_13
(
13
,
"客官,当前访问人数较多,请稍后再试"
),
/**
* 验证码校验失败
*/
ERR_12
(
12
,
"验证码校验失败"
),
ERR_20
(
20
,
"区号或者手机号码不合法"
),
ERR_21
(
21
,
"验证码已过期或者错误"
),
ERR_22
(
22
,
"验证码一分钟只能请求一次"
),
ERR_10001
(
10001
,
"父部门不存在"
),
ERR_10002
(
10002
,
"门店类型部门不能新增子节点"
),
ERR_10003
(
10003
,
"部门不存在"
),
ERR_10004
(
10004
,
"成员名称不能为空"
),
ERR_10005
(
10005
,
"成员已存在"
),
ERR_10006
(
10006
,
"该企业已经绑定过了"
),
ERR_10007
(
10007
,
"成员不存在"
),
ERR_10008
(
10008
,
"请不要过于频繁点击"
),
ERR_10009
(
10009
,
"门店不存在"
),
ERR_10010
(
10010
,
"企业微信无关联的gic企业"
),
ERR_10011
(
10011
,
"正在同步中,请等待结束再操作"
),
ERR_10012
(
10012
,
"企业微信不存在"
),
ERR_10013
(
10013
,
"secret设置失败,请确认好办助手是否设置全部可见或登录账号是否被删除"
),
ERR_10014
(
10014
,
"暂存部门人员不能删除"
),
ERR_10015
(
10015
,
"分组已存在"
),
ERR_10016
(
10016
,
"分组不存在"
),
ERR_10017
(
10017
,
"存在素材不能删除"
),
ERR_10018
(
10018
,
"素材不存在"
),
ERR_10019
(
10019
,
"存在子分组不能删除"
),
ERR_10020
(
10020
,
"模板名称已存在"
),
ERR_10021
(
10021
,
"模板关联企业不能删除"
),
ERR_100015
(
100015
,
"暂存部门不能删除"
),
ERR_100016
(
100016
,
"审核失败"
),
ERR_100017
(
100017
,
"secret已经设置过"
),
ERR_100018
(
100018
,
"企业不存在"
),
ERR_100019
(
100019
,
"一天只能刷新1次"
),
ERR_100020
(
100020
,
"一个月只能刷新3次"
),
ERR_100021
(
100021
,
"创建任务失败"
),
ERR_100031
(
100031
,
"该小程序已经绑定过,不能重复绑定"
),
ERR_100032
(
100032
,
"代理不能设置导购编辑权限"
),
ERR_DEFINE
(-
888
,
"自定义错误"
),
ERR_OTHER
(-
999
,
"未知错误code"
);
private
int
code
;
private
String
msg
;
private
HaoBanErrCode
(
int
code
,
String
value
)
{
this
.
code
=
code
;
this
.
msg
=
value
;
}
public
static
HaoBanErrCode
getValue
(
int
code
)
{
for
(
HaoBanErrCode
sec
:
HaoBanErrCode
.
values
())
{
if
(
code
==
sec
.
getCode
())
{
return
sec
;
}
}
ERR_OTHER
.
setMsg
(
"未知错误code:"
+
code
);
return
ERR_OTHER
;
}
public
int
getCode
()
{
return
code
;
}
public
void
setCode
(
int
code
)
{
this
.
code
=
code
;
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
}
package
com
.
gic
.
haoban
.
manage
.
web
.
errCode
;
/**
* Created by fudh on 2018/3/4.
*/
public
enum
HaoBanErrCode
{
//update by 牧峰 2018-7-25 19:58:06
/**
* 操作失败
*/
ERR_0
(
0
,
"操作失败"
),
/**
* 操作成功
*/
ERR_1
(
1
,
"操作成功"
),
/**
* 缺少参数
*/
ERR_2
(
2
,
"缺少参数"
),
/**
* 系统异常
*/
ERR_3
(
3
,
"系统异常"
),
/**
* 登录异常
*/
ERR_4
(
4
,
"登录异常"
),
/**
* 输入参数错误
*/
ERR_5
(
5
,
"输入参数错误"
),
/**
* 该企业登录用户不存在
*/
ERR_6
(
6
,
"该企业登录用户不存在"
),
/**
* 该用户缺少该权限
*/
ERR_7
(
7
,
"该用户缺少该权限"
),
/**
* 查无数据
*/
ERR_8
(
8
,
"查无数据"
),
/**
* 非法操作
*/
ERR_9
(
9
,
"非法操作"
),
/**
* 用户已经登录
*/
ERR_10
(
10
,
"用户已经登录"
),
/**
* 验证码发送失败
*/
ERR_11
(
11
,
"验证码发送失败"
),
/**
* 验证码发送失败
*/
ERR_13
(
13
,
"客官,当前访问人数较多,请稍后再试"
),
/**
* 验证码校验失败
*/
ERR_12
(
12
,
"验证码校验失败"
),
ERR_20
(
20
,
"区号或者手机号码不合法"
),
ERR_21
(
21
,
"验证码已过期或者错误"
),
ERR_22
(
22
,
"验证码一分钟只能请求一次"
),
ERR_10001
(
10001
,
"父部门不存在"
),
ERR_10002
(
10002
,
"门店类型部门不能新增子节点"
),
ERR_10003
(
10003
,
"部门不存在"
),
ERR_10004
(
10004
,
"成员名称不能为空"
),
ERR_10005
(
10005
,
"成员已存在"
),
ERR_10006
(
10006
,
"该企业已经绑定过了"
),
ERR_10007
(
10007
,
"成员不存在"
),
ERR_10008
(
10008
,
"请不要过于频繁点击"
),
ERR_10009
(
10009
,
"门店不存在"
),
ERR_10010
(
10010
,
"企业微信无关联的gic企业"
),
ERR_10011
(
10011
,
"正在同步中,请等待结束再操作"
),
ERR_10012
(
10012
,
"企业微信不存在"
),
ERR_10013
(
10013
,
"secret设置失败,请确认好办助手是否设置全部可见或登录账号是否被删除"
),
ERR_10014
(
10014
,
"暂存部门人员不能删除"
),
ERR_10015
(
10015
,
"分组已存在"
),
ERR_10016
(
10016
,
"分组不存在"
),
ERR_10017
(
10017
,
"存在素材不能删除"
),
ERR_10018
(
10018
,
"素材不存在"
),
ERR_10019
(
10019
,
"存在子分组不能删除"
),
ERR_10020
(
10020
,
"模板名称已存在"
),
ERR_10030
(
10030
,
"您还不是企微的管理员,无法查看通讯录,若需查看,请联系超级管理员开通"
),
ERR_10021
(
10021
,
"模板关联企业不能删除"
),
ERR_100015
(
100015
,
"暂存部门不能删除"
),
ERR_100016
(
100016
,
"审核失败"
),
ERR_100017
(
100017
,
"secret已经设置过"
),
ERR_100018
(
100018
,
"企业不存在"
),
ERR_100019
(
100019
,
"一天只能刷新1次"
),
ERR_100020
(
100020
,
"一个月只能刷新3次"
),
ERR_100021
(
100021
,
"创建任务失败"
),
ERR_100031
(
100031
,
"该小程序已经绑定过,不能重复绑定"
),
ERR_100032
(
100032
,
"代理不能设置导购编辑权限"
),
ERR_DEFINE
(-
888
,
"自定义错误"
),
ERR_OTHER
(-
999
,
"未知错误code"
);
private
int
code
;
private
String
msg
;
private
HaoBanErrCode
(
int
code
,
String
value
)
{
this
.
code
=
code
;
this
.
msg
=
value
;
}
public
static
HaoBanErrCode
getValue
(
int
code
)
{
for
(
HaoBanErrCode
sec
:
HaoBanErrCode
.
values
())
{
if
(
code
==
sec
.
getCode
())
{
return
sec
;
}
}
ERR_OTHER
.
setMsg
(
"未知错误code:"
+
code
);
return
ERR_OTHER
;
}
public
int
getCode
()
{
return
code
;
}
public
void
setCode
(
int
code
)
{
this
.
code
=
code
;
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
}
Write
Preview
Markdown
is supported
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