Commit 1d0570e5 by guojuxing

已购买的应用添加逻辑:拓展包查询

parent 7fedb354
......@@ -79,6 +79,7 @@ public interface TabSysMenuMapper {
* @return int


 */
int getMaxSortByParentId(@Param("parentId") Integer parentId, @Param("project") String project);
/**
* 查询页面下的操作项列表数据
* @Title: listMenuItemByParentId

......@@ -98,6 +99,7 @@ public interface TabSysMenuMapper {
* @return java.util.List<com.gic.auth.entity.TabSysMenu>


 */
List<TabSysMenu> listMenuByParentId(@Param("parentId") Integer parentId, @Param("project") String project);
/**
* 分页查询操作项
* @Title: pageMenuOperationItem

......@@ -127,6 +129,7 @@ public interface TabSysMenuMapper {
* @return java.util.List<com.gic.auth.dto.AuthItemListDTO>


 */
List<AuthItemListDTO> listAuthItemByMenuId(@Param("menuId") Integer menuId);
/**
* 统计页面下的子项目
* @Title: countChildByParentId

......@@ -136,6 +139,7 @@ public interface TabSysMenuMapper {
* @return int


 */
int countChildByParentId(@Param("menuId") Integer menuId);
/**
* 查询菜单树(页面&权限项)
* @Title: listMenuTree

......@@ -147,7 +151,19 @@ public interface TabSysMenuMapper {

 */
List<TabSysMenu> listMenuTree(@Param("project") String project, @Param("versionCode") String versionCode);
List<TabSysMenu> selectByProjectList(@Param("projectList")List<String> projectList);
List<TabSysMenu> selectByProjectList(@Param("projectList") List<String> projectList);
/**
* 查询应用权限
* @Title: selectAppMenuByParam

* @Description:

 * @author guojuxing
* @param projectList appID List
* @param versionList
 版本/拓展包 list
* @return java.util.List<com.gic.auth.entity.TabSysMenu>


 */
List<TabSysMenu> selectAppMenuByParam(@Param("projectList") List<String> projectList,
@Param("versionList") List<String> versionList);
/**
* 相同code个数
......@@ -157,7 +173,7 @@ public interface TabSysMenuMapper {
* @param menuCode

* @return int


 */
int countByMenuCode(@Param("menuCode") String menuCode,@Param("menuId") Integer menuId);
int countByMenuCode(@Param("menuCode") String menuCode, @Param("menuId") Integer menuId);
/**
* 批量更新子集的父级code数据,根据父级ID
......@@ -167,7 +183,7 @@ public interface TabSysMenuMapper {
* @param parentId

* @return void


 */
void updateParentCodeByParentId(@Param("parentId")Integer parentId, @Param("parentCode") String parentCode);
void updateParentCodeByParentId(@Param("parentId") Integer parentId, @Param("parentCode") String parentCode);
/**
* 仅超管可用的操作项
......
......@@ -128,6 +128,17 @@ public interface MenuService {
List<TabSysMenu> selectByProjectList(List<String> projectList);
/**
* 查询应用权限
* @Title: selectAppMenuByParam

* @Description:

 * @author guojuxing
* @param projectList appID List
* @param versionList
 版本/拓展包 list
* @return java.util.List<com.gic.auth.entity.TabSysMenu>


 */
List<TabSysMenu> selectAppMenuByParam(List<String> projectList, List<String> versionList);
/**
* 是否重复页面code
* @Title: isRepeatMenuCode

* @Description:
......
......@@ -135,6 +135,11 @@ public class MenuServiceImpl implements MenuService {
}
@Override
public List<TabSysMenu> selectAppMenuByParam(List<String> projectList, List<String> versionList) {
return tabSysMenuMapper.selectAppMenuByParam(projectList, versionList);
}
@Override
public boolean isRepeatMenuCode(String code, Integer menuId) {
int count = tabSysMenuMapper.countByMenuCode(code, menuId);
if (count > 0) {
......
......@@ -3,7 +3,7 @@ package com.gic.auth.service.outer.impl;
import java.util.*;
import com.gic.enterprise.service.EnterpriseApiService;
import com.gic.open.api.dto.ServeExpanDTO;
import com.gic.open.api.dto.*;
import com.gic.open.api.service.ServeApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
......@@ -31,8 +31,6 @@ import com.gic.commons.util.PageHelperUtils;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.enterprise.utils.valid.ValidParamsUtils;
import com.gic.open.api.dto.ApplicationDTO;
import com.gic.open.api.dto.ServePropDTO;
import com.gic.open.api.service.AppTokenApiService;
import com.gic.open.api.service.ApplicationApiService;
......@@ -175,18 +173,27 @@ public class MenuApiServiceImpl implements MenuApiService {
@Override
public ServiceResponse<List<MenuDTO>> listAppPageOfHasBuy(Integer enterpriseId) {
ServiceResponse<List<ApplicationDTO>> appResult = appTokenApiService
.listApplicationByEnterpriseId(Long.valueOf(enterpriseId), null);
ServiceResponse<List<ApplicationTokenDTO>> appResult = appTokenApiService
.listApplicationByeId(Long.valueOf(enterpriseId));
if (appResult.isSuccess()) {
List<ApplicationDTO> appList = appResult.getResult();
List<ApplicationTokenDTO> appList = appResult.getResult();
if (CollectionUtils.isNotEmpty(appList)) {
saveHasBuyAppMenu(appList);
//调用所有的应用列表保存接口,保证,已购买的应用已经在菜单
saveAppMenu();
//查询已购买的有权限的app应用菜单
List<String> projectList = new ArrayList<>(appList.size());
for (ApplicationDTO app : appList) {
List<String> versionList = new ArrayList<>();
for (ApplicationTokenDTO app : appList) {
projectList.add(app.getApplicationId().toString());
versionList.add(app.getVersionCode());
if (CollectionUtils.isNotEmpty(app.getExpanList())) {
for (ApplicationExpanDTO expanDTO : app.getExpanList()) {
versionList.add(expanDTO.getAppExpanId().toString());
}
}
}
List<MenuDTO> menuList = EntityUtil.changeEntityListNew(MenuDTO.class,
menuService.selectByProjectList(projectList));
menuService.selectAppMenuByParam(projectList, versionList));
return ServiceResponse.success(menuList);
} else {
return ServiceResponse.success(new ArrayList<>());
......@@ -616,34 +623,6 @@ public class MenuApiServiceImpl implements MenuApiService {
}
/**
* 商户已购买的应用,变成一级菜单
* @Title: saveHasBuyAppMenu

* @Description:

 * @author guojuxing
* @param hasBuyAppList

* @return void


 */
private void saveHasBuyAppMenu(List<ApplicationDTO> hasBuyAppList) {
Map<String, TabSysMenu> appMenu = getFirstLevelAppMenu();
for (ApplicationDTO app : hasBuyAppList) {
if (appMenu.containsKey(app.getApplicationId().toString())) {
//如果已存在,则更新版本信息
MenuDTO menuDTO = new MenuDTO();
menuDTO.setMenuName(app.getName());
menuDTO.setProject(app.getApplicationId().toString());
menuDTO.setMenuId(appMenu.get(app.getApplicationId().toString()).getMenuId());
menuService.updatePage(menuDTO);
} else {
MenuDTO menuDTO = new MenuDTO();
menuDTO.setMenuName(app.getName());
menuDTO.setProject(app.getApplicationId().toString());
setNormalFieldValue(menuDTO);
menuService.savePage(menuDTO);
}
}
}
/**
* 第一级页面通用字段值设置
* @param menuDTO
*/
......
......@@ -428,6 +428,28 @@
</if>
</select>
<select id="selectAppMenuByParam" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_sys_menu
where status=1
and project != 'gic'
<include refid="tree_filter" />
<if test="null != projectList and projectList.size() &gt; 0">
and project in
<foreach close=")" collection="projectList" index="index" item="item" open="(" separator=",">
#{item}
</foreach>
</if>
<if test="versionList != null and versionList.size() > 0">
and (
<foreach collection="versionList" index="index" item="item" separator="or">
menu_version like concat('%_', #{item}, '_%' )
</foreach>
)
</if>
</select>
<select id="countByMenuCode" resultType="int">
SELECT count(1) from tab_sys_menu
where status = 1
......
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