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
0ab2365a
Commit
0ab2365a
authored
Jun 29, 2023
by
jinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
好办自建应用菜单过滤
parent
08634b42
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
14 deletions
+33
-14
RightController.java
...com/gic/haoban/manage/web/controller/RightController.java
+33
-14
No files found.
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/RightController.java
View file @
0ab2365a
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
com.google.common.collect.Lists
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
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.gic.api.base.commons.ServiceResponse
;
import
com.gic.clerk.api.dto.right.RightMenuDTO
;
...
...
@@ -21,7 +7,18 @@ import com.gic.clerk.api.service.RightService;
import
com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO
;
import
com.gic.haoban.common.utils.AuthWebRequestUtil
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.service.WxEnterpriseApiService
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.*
;
/**
*
...
...
@@ -35,9 +32,15 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
public
class
RightController
extends
WebBaseController
{
private
static
final
Logger
log
=
LogManager
.
getLogger
(
RightController
.
class
);
/**
* 好办付费应用菜单code
*/
private
static
final
Set
<
String
>
menuCodeSet
=
new
HashSet
<>(
Arrays
.
asList
(
"hb_m040902"
,
"purchaseAppOrder"
,
"appOrderPay"
,
"appCancelOrder"
));
@Autowired
private
RightService
rightService
;
@Autowired
private
WxEnterpriseApiService
wxEnterpriseApiService
;
@RequestMapping
(
"get-haoban-menu"
)
public
HaobanResponse
getHaobanMenu
(
HttpServletRequest
request
)
{
...
...
@@ -45,6 +48,7 @@ public class RightController extends WebBaseController {
log
.
info
(
JSON
.
toJSONString
(
login
));
String
enterpriseId
=
login
.
getEnterpriseId
()
;
String
clerkId
=
login
.
getClerkId
()
;
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
if
(
StringUtils
.
isBlank
(
enterpriseId
)){
return
resultResponse
(
HaoBanErrCode
.
ERR_OTHER
,
"gic商户为空"
);
}
...
...
@@ -52,8 +56,23 @@ public class RightController extends WebBaseController {
if
(
StringUtils
.
isEmpty
(
clerkId
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_OTHER
,
"clerkId为空"
);
}
if
(
StringUtils
.
isEmpty
(
wxEnterpriseId
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_OTHER
,
"wxEnterpriseId为空"
);
}
ServiceResponse
<
List
<
RightMenuDTO
>>
resp
=
this
.
rightService
.
getHaobanMenu
(
enterpriseId
,
clerkId
);
if
(
resp
.
isSuccess
())
{
//如果是好办自建应用,应用购买的菜单需要过滤
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
if
(
null
!=
wxEnterpriseDTO
&&
wxEnterpriseDTO
.
getWxSecurityType
()
==
5
){
List
<
RightMenuDTO
>
list
=
resp
.
getResult
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++){
RightMenuDTO
dto
=
list
.
get
(
i
);
if
(
menuCodeSet
.
contains
(
dto
.
getMenuCode
())){
list
.
remove
(
dto
);
}
}
resp
.
setResult
(
list
);
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
resp
.
getResult
());
}
return
resultResponse
(
HaoBanErrCode
.
ERR_OTHER
,
resp
.
getMessage
());
...
...
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