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
a5dd5e0a
Commit
a5dd5e0a
authored
May 25, 2022
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
企微管理员校验
parent
0d0ffd15
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
18 deletions
+67
-18
AdminController.java
...com/gic/haoban/manage/web/controller/AdminController.java
+4
-4
DepartmentContoller.java
...gic/haoban/manage/web/controller/DepartmentContoller.java
+59
-10
StaffController.java
...com/gic/haoban/manage/web/controller/StaffController.java
+4
-4
No files found.
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/AdminController.java
View file @
a5dd5e0a
...
@@ -45,6 +45,10 @@ public class AdminController extends WebBaseController {
...
@@ -45,6 +45,10 @@ public class AdminController extends WebBaseController {
@RequestMapping
(
"admin-list"
)
@RequestMapping
(
"admin-list"
)
public
HaobanResponse
adminList
()
{
public
HaobanResponse
adminList
()
{
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
String
staffId
=
login
.
getStaffId
()
;
if
(
StringUtils
.
isBlank
(
staffId
))
{
return
this
.
resultResponse
(
HaoBanErrCode
.
ERR_10030
)
;
}
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
WxApplicationDTO
application
=
wxApplicationApiService
.
selectByWxEnterpriseIdAndApplicationType
(
wxEnterpriseId
,
2
);
WxApplicationDTO
application
=
wxApplicationApiService
.
selectByWxEnterpriseIdAndApplicationType
(
wxEnterpriseId
,
2
);
WxEnterpriseDTO
enterprise
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
WxEnterpriseDTO
enterprise
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
...
@@ -63,10 +67,6 @@ public class AdminController extends WebBaseController {
...
@@ -63,10 +67,6 @@ public class AdminController extends WebBaseController {
List
<
StaffDTO
>
list
=
new
ArrayList
<>();
List
<
StaffDTO
>
list
=
new
ArrayList
<>();
List
<
AdminVO
>
resultList
=
new
ArrayList
<>();
List
<
AdminVO
>
resultList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
openUserIds
))
{
if
(
CollectionUtils
.
isNotEmpty
(
openUserIds
))
{
String
staffId
=
login
.
getStaffId
()
;
if
(
StringUtils
.
isBlank
(
staffId
))
{
return
this
.
resultResponse
(
HaoBanErrCode
.
ERR_10030
)
;
}
if
(
corpid
.
length
()
>
20
)
{
if
(
corpid
.
length
()
>
20
)
{
logger
.
info
(
"OpenUserIds"
);
logger
.
info
(
"OpenUserIds"
);
list
=
staffApiService
.
listByOpenUserIdsAndWxEnterpriseId
(
openUserIds
,
wxEnterpriseId
);
list
=
staffApiService
.
listByOpenUserIdsAndWxEnterpriseId
(
openUserIds
,
wxEnterpriseId
);
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/DepartmentContoller.java
View file @
a5dd5e0a
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
import
cn.hutool.core.collection.CollectionUtil
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.alibaba.fastjson.JSON
;
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.api.base.commons.Page
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.dto.ClerkListDTO
;
import
com.gic.clerk.api.dto.ClerkListDTO
;
...
@@ -24,21 +39,20 @@ import com.gic.haoban.manage.api.dto.DepartmentDTO;
...
@@ -24,21 +39,20 @@ import com.gic.haoban.manage.api.dto.DepartmentDTO;
import
com.gic.haoban.manage.api.dto.DepartmentShortDTO
;
import
com.gic.haoban.manage.api.dto.DepartmentShortDTO
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO
;
import
com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO
;
import
com.gic.haoban.manage.api.dto.WxApplicationDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.service.DepartmentApiService
;
import
com.gic.haoban.manage.api.service.DepartmentApiService
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService
;
import
com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService
;
import
com.gic.haoban.manage.api.service.WxApplicationApiService
;
import
com.gic.haoban.manage.api.service.WxEnterpriseApiService
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.vo.DepartmentChainVO
;
import
com.gic.haoban.manage.web.vo.DepartmentChainVO
;
import
com.gic.haoban.manage.web.vo.DepartmentVO
;
import
com.gic.haoban.manage.web.vo.DepartmentVO
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.redis.data.util.RedisUtil
;
import
org.apache.commons.lang.StringUtils
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.*
;
import
cn.hutool.core.collection.CollectionUtil
;
@RestController
@RestController
public
class
DepartmentContoller
extends
WebBaseController
{
public
class
DepartmentContoller
extends
WebBaseController
{
...
@@ -46,20 +60,24 @@ public class DepartmentContoller extends WebBaseController {
...
@@ -46,20 +60,24 @@ public class DepartmentContoller extends WebBaseController {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
DepartmentContoller
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
DepartmentContoller
.
class
);
@Autowired
@Autowired
private
DepartmentApiService
departmentApiService
;
private
DepartmentApiService
departmentApiService
;
@Autowired
@Autowired
private
StoreGroupService
storeGroupService
;
private
StoreGroupService
storeGroupService
;
@Autowired
@Autowired
private
StoreService
storeService
;
private
StoreService
storeService
;
@Autowired
@Autowired
private
StaffApiService
staffApiService
;
private
StaffApiService
staffApiService
;
@Autowired
@Autowired
private
EnterpriseService
enterpriseService
;
private
EnterpriseService
enterpriseService
;
@Autowired
@Autowired
private
ClerkService
clerkService
;
private
ClerkService
clerkService
;
@Autowired
@Autowired
private
StaffDepartmentRelatedApiService
staffDepartmentRelatedApiService
;
private
StaffDepartmentRelatedApiService
staffDepartmentRelatedApiService
;
@Autowired
private
WxApplicationApiService
wxApplicationApiService
;
@Autowired
private
WxEnterpriseApiService
wxEnterpriseApiService
;
@Autowired
private
QywxSuiteApiService
qywxSuiteApiService
;
@RequestMapping
(
"department-list"
)
@RequestMapping
(
"department-list"
)
...
@@ -420,6 +438,9 @@ public class DepartmentContoller extends WebBaseController {
...
@@ -420,6 +438,9 @@ public class DepartmentContoller extends WebBaseController {
*/
*/
@RequestMapping
(
"department-list-cache"
)
@RequestMapping
(
"department-list-cache"
)
public
HaobanResponse
departmentCachelist
()
{
public
HaobanResponse
departmentCachelist
()
{
if
(!
isAdmin
())
{
return
this
.
resultResponse
(
HaoBanErrCode
.
ERR_10030
)
;
}
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
if
(
StringUtils
.
isBlank
(
wxEnterpriseId
))
{
if
(
StringUtils
.
isBlank
(
wxEnterpriseId
))
{
...
@@ -434,5 +455,33 @@ public class DepartmentContoller extends WebBaseController {
...
@@ -434,5 +455,33 @@ public class DepartmentContoller extends WebBaseController {
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
cache
);
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
;
}
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/StaffController.java
View file @
a5dd5e0a
...
@@ -562,6 +562,10 @@ public class StaffController extends WebBaseController {
...
@@ -562,6 +562,10 @@ public class StaffController extends WebBaseController {
private
boolean
isAdmin
(){
private
boolean
isAdmin
(){
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
String
staffId
=
login
.
getStaffId
()
;
if
(
StringUtils
.
isBlank
(
staffId
))
{
return
false
;
}
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
WxApplicationDTO
application
=
wxApplicationApiService
.
selectByWxEnterpriseIdAndApplicationType
(
wxEnterpriseId
,
2
);
WxApplicationDTO
application
=
wxApplicationApiService
.
selectByWxEnterpriseIdAndApplicationType
(
wxEnterpriseId
,
2
);
WxEnterpriseDTO
enterprise
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
WxEnterpriseDTO
enterprise
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
...
@@ -577,10 +581,6 @@ public class StaffController extends WebBaseController {
...
@@ -577,10 +581,6 @@ public class StaffController extends WebBaseController {
openUserIds
.
add
(
json
.
getString
(
"userid"
));
openUserIds
.
add
(
json
.
getString
(
"userid"
));
}
}
}
}
String
staffId
=
login
.
getStaffId
()
;
if
(
StringUtils
.
isBlank
(
staffId
))
{
return
false
;
}
StaffDTO
staff
=
this
.
staffApiService
.
selectById
(
staffId
)
;
StaffDTO
staff
=
this
.
staffApiService
.
selectById
(
staffId
)
;
if
(
openUserIds
.
contains
(
staff
.
getWxUserId
())
||
openUserIds
.
contains
(
staff
.
getWxOpenUseId
()))
{
if
(
openUserIds
.
contains
(
staff
.
getWxUserId
())
||
openUserIds
.
contains
(
staff
.
getWxOpenUseId
()))
{
return
true
;
return
true
;
...
...
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