Commit e46dad67 by guojuxing

商品前置资源改成应用

parent c29e4f44
package com.gic.auth.constant;
/**
* 权限管理:应用code
* @ClassName: AppMenuCodeConstants

* @Description: 

* @author guojuxing

* @date 2020/10/19 3:31 PM

*/
public class AppMenuCodeConstants {
/**
* 商品应用菜单code
*/
public static final String GOODS = "goods_app";
/**
* gic权限页面code
*/
public static final String GOODS_GIC = "goods";
}
...@@ -1261,16 +1261,7 @@ public class MenuApiServiceImpl implements MenuApiService { ...@@ -1261,16 +1261,7 @@ public class MenuApiServiceImpl implements MenuApiService {
} }
} }
List<TabSysMenu> tempList = filterResource(resultList, params.getEnterpriseId());
Map<String, Object> resourcePage = getBusinessFrontRes(params.getEnterpriseId());
List<TabSysMenu> tempList = new ArrayList<>();
for (TabSysMenu menu : resultList) {
if (resourcePage.containsKey(menu.getMenuCode())) {
//如果包含了,则过滤掉
continue;
}
tempList.add(menu);
}
if (isNeedTree) { if (isNeedTree) {
return ServiceResponse.success(this.treeMenu(tempList, 1, 0)); return ServiceResponse.success(this.treeMenu(tempList, 1, 0));
...@@ -1370,16 +1361,7 @@ public class MenuApiServiceImpl implements MenuApiService { ...@@ -1370,16 +1361,7 @@ public class MenuApiServiceImpl implements MenuApiService {
private ServiceResponse<List<MenuDTO>> getAppMenuPage(Integer enterpriseId, List<Integer> menuIdList, String appId) { private ServiceResponse<List<MenuDTO>> getAppMenuPage(Integer enterpriseId, List<Integer> menuIdList, String appId) {
//返回结果集定义声明 //返回结果集定义声明
List<TabSysMenu> resultList = menuService.selectByIdsAndOrderBy(menuIdList, " order by sort"); List<TabSysMenu> resultList = menuService.selectByIdsAndOrderBy(menuIdList, " order by sort");
Map<String, Object> resourcePage = getBusinessFrontRes(enterpriseId); List<TabSysMenu> tempList = filterResource(resultList, enterpriseId);
List<TabSysMenu> tempList = new ArrayList<>();
for (TabSysMenu menu : resultList) {
if (resourcePage.containsKey(menu.getMenuCode())) {
//如果包含了,则过滤掉
continue;
}
tempList.add(menu);
}
return ServiceResponse.success(this.treeMenu(tempList, 1, 0)); return ServiceResponse.success(this.treeMenu(tempList, 1, 0));
} }
...@@ -1388,8 +1370,14 @@ public class MenuApiServiceImpl implements MenuApiService { ...@@ -1388,8 +1370,14 @@ public class MenuApiServiceImpl implements MenuApiService {
* @param enterpriseId * @param enterpriseId
* @return * @return
*/ */
private Map<String, Object> getBusinessFrontRes(Integer enterpriseId) { private Set<String> getBusinessFrontRes(Integer enterpriseId) {
Map<String, Object> resourcePage = new HashMap<>(16); Set<String> resourcePage = new HashSet<>(16);
//商品资源获取接口调整
ServiceResponse<MenuDTO> goods = getMenuByMenuCode(AppMenuCodeConstants.GOODS);
boolean hasGoodsAuth = goods.isSuccess();
if (!hasGoodsAuth) {
resourcePage.add(AppMenuCodeConstants.GOODS_GIC);
}
//过滤商品资源页面 //过滤商品资源页面
ServiceResponse<List<EnterpriseResourceRelDTO>> resourceResult = enterpriseApiService.getBusinessFrontRes(enterpriseId); ServiceResponse<List<EnterpriseResourceRelDTO>> resourceResult = enterpriseApiService.getBusinessFrontRes(enterpriseId);
if (resourceResult.isSuccess()) { if (resourceResult.isSuccess()) {
...@@ -1408,7 +1396,7 @@ public class MenuApiServiceImpl implements MenuApiService { ...@@ -1408,7 +1396,7 @@ public class MenuApiServiceImpl implements MenuApiService {
List<TabSysBusinessFrontRes> frontResourceList = businessFrontResService.listByCode(resourceCodeList, 1); List<TabSysBusinessFrontRes> frontResourceList = businessFrontResService.listByCode(resourceCodeList, 1);
if (CollectionUtils.isNotEmpty(frontResourceList)) { if (CollectionUtils.isNotEmpty(frontResourceList)) {
for (TabSysBusinessFrontRes resource : frontResourceList) { for (TabSysBusinessFrontRes resource : frontResourceList) {
resourcePage.put(resource.getPageName(), 1); resourcePage.add(resource.getPageName());
} }
} }
} }
...@@ -1418,6 +1406,26 @@ public class MenuApiServiceImpl implements MenuApiService { ...@@ -1418,6 +1406,26 @@ public class MenuApiServiceImpl implements MenuApiService {
} }
/** /**
* 获取前置资源
* @param resultList
* @param enterpriseId
* @return
*/
private List<TabSysMenu> filterResource(List<TabSysMenu> resultList, Integer enterpriseId) {
List<TabSysMenu> tempList = new ArrayList<>();
Set<String> resourcePage = getBusinessFrontRes(enterpriseId);
for (TabSysMenu menu : resultList) {
if (resourcePage.contains(menu.getMenuCode())) {
//如果包含了,则过滤掉
continue;
}
tempList.add(menu);
}
return tempList;
}
/**
* 获取用户没有权限的操作项 * 获取用户没有权限的操作项
* @Title: getNoAuthOperationItem
 * @Title: getNoAuthOperationItem

* @Description: * @Description:
......
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