Commit 7d4260f9 by guojuxing

商品菜单从gic移动到应用

parent 3fc4e9b2
......@@ -500,6 +500,17 @@ public interface MenuApiService {
ServiceResponse<Void> syncProductMenu(String menuCode);
/**
* gic菜单转到某一个应用下面
* @Title: switchGicMenuToApp

* @Description:

* @author guojuxing
* @param gicMenuCode
* @param appMenuCode 

* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


*/
ServiceResponse<Void> switchGicMenuToApp(String gicMenuCode, String appMenuCode);
/**
* test
* @Title: test
* @Description:
......
......@@ -143,6 +143,26 @@ public interface TabSysMenuMapper {
List<TabSysMenu> listByParentMenuIdList(@Param("parentMenuIdList") List<Integer> parentMenuIdList);
/**
* gic菜单转应用菜单的时候,批量进行修改相关数据
* @Title: updateMenuTmp

* @Description:

* @author guojuxing
* @param menuIdList
* @param project
* @param parentId
* @param parentCode
* @param menuVersion
* @param menuVersionName

* @return void


*/
void updateMenuTmp(@Param("menuIdList") List<Integer> menuIdList,
@Param("project") String project,
@Param("parentId") Integer parentId,
@Param("parentCode") String parentCode,
@Param("menuVersion") String menuVersion,
@Param("menuVersionName") String menuVersionName);
/**
* selectByIdsAndOrderBy
* @Title: selectByIdsAndOrderBy
* @Description:
......
......@@ -260,6 +260,31 @@ public interface MenuService {

*/
void deleteNotInApp(List<String> projectList);
/**
* 查询所有的level >= 3的数据
* @Title: listMenuForGicContainChild

* @Description:

* @author guojuxing
* @param parentIdList
level = 2的menu_id集合
* @return java.util.List<com.gic.auth.entity.TabSysMenu>


*/
List<TabSysMenu> listMenuForGicContainChild(List<Integer> parentIdList);
/**
* gic菜单转应用菜单的时候,批量进行修改相关数据
* @Title: updateMenuTmp

* @Description:

* @author guojuxing
* @param menuIdList 需要修改的菜单ID集合
* @param project applicationId
* @param parentId 应用菜单的menuId
* @param parentCode 应用菜单的menuCode
* @param menuVersion 应用的版本code
* @param menuVersionName
 应用的版本名称
* @return void


*/
void updateMenuTmp(List<Integer> menuIdList, String project, Integer parentId, String parentCode, String menuVersion, String menuVersionName);
/***********同步测试环境数据到生产************/
......
......@@ -228,6 +228,31 @@ public class MenuServiceImpl implements MenuService {
}
@Override
public List<TabSysMenu> listMenuForGicContainChild(List<Integer> parentIdList) {
if (CollectionUtils.isEmpty(parentIdList)) {
return new ArrayList<>();
}
List<TabSysMenu> result = new ArrayList<>();
List<TabSysMenu> list = tabSysMenuMapper.listByParentMenuIdList(parentIdList);
while (CollectionUtils.isNotEmpty(list)) {
result.addAll(list);
List<Integer> menuIdList = list
.stream()
.filter(e -> e != null)
.map(e -> e.getMenuId())
.collect(Collectors.toList());
list.clear();
list = tabSysMenuMapper.listByParentMenuIdList(menuIdList);
}
return result;
}
@Override
public void updateMenuTmp(List<Integer> menuIdList, String project, Integer parentId, String parentCode, String menuVersion, String menuVersionName) {
tabSysMenuMapper.updateMenuTmp(menuIdList, project, parentId, parentCode, menuVersion, menuVersionName);
}
@Override
public List<TabSysMenu> listMenuTemp(String project) {
return tabSysMenuMapper.listMenuTemp(project);
}
......
......@@ -802,6 +802,49 @@ public class MenuApiServiceImpl implements MenuApiService {
}
@Override
public ServiceResponse<Void> switchGicMenuToApp(String gicMenuCode, String appMenuCode) {
TabSysMenu gicMenu = menuService.getMenuByMenuCode(gicMenuCode);
boolean isNotGicMenu = gicMenu == null || gicMenu.getLevel() != 1 || !gicMenu.getProject().equals(MenuProjectConstants.DEFAULT_PROJECT)
|| gicMenu.getPlatformType() != MenuPlatformTypeEnum.GIC.getCode();
if (isNotGicMenu) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "不存在或者不是GIC对应的code");
}
TabSysMenu appMenu = menuService.getMenuByMenuCode(appMenuCode);
boolean isNotAppMenu = appMenu == null || appMenu.getLevel() != 1 || appMenu.getProject().equals(MenuProjectConstants.DEFAULT_PROJECT)
|| gicMenu.getPlatformType() != MenuPlatformTypeEnum.GIC.getCode();
if (isNotAppMenu) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "不存在或者不是应用对应的code");
}
String applicationId = appMenu.getProject();
Integer parentId = appMenu.getMenuId();
String parentCode = appMenu.getMenuCode();
String menuVersion = appMenu.getMenuVersion();
String menuVersionName = appMenu.getMenuVersionName();
//第二层级需要修改的
//1:修改project
//2:修改parent_id,parent_code
//3:menu_version menu_version_name
List<TabSysMenu> list = menuService.listByParentMenuIdList(Arrays.asList(gicMenu.getMenuId()));
if (CollectionUtils.isNotEmpty(list)) {
List<Integer> menuIdList = list.stream().filter(e -> e != null).map(e -> e.getMenuId()).collect(Collectors.toList());
menuService.updateMenuTmp(menuIdList, applicationId, parentId, parentCode, menuVersion, menuVersionName);
//下面层级需要修改的
//1:修改project
//2:menu_version menu_version_name
List<TabSysMenu> childList = menuService.listMenuForGicContainChild(menuIdList);
if (CollectionUtils.isNotEmpty(childList)) {
List<Integer> childMenuIdList = childList.stream().filter(e -> e != null).map(e -> e.getMenuId()).collect(Collectors.toList());
menuService.updateMenuTmp(childMenuIdList, applicationId, null, null, menuVersion, menuVersionName);
}
}
return ServiceResponse.success();
}
@Override
public ServiceResponse<List<MenuDTO>> filterOperationUserDepartAuth(List<MenuDTO> resultList, UserDTO tabSysUser) {
List<TabSysMenu> list = filterOperationUserDepartAuth(EntityUtil.changeEntityListNew(TabSysMenu.class, resultList),
EntityUtil.changeEntityNew(TabSysUser.class, tabSysUser));
......
......@@ -490,6 +490,29 @@
</if>
</select>
<update id="updateMenuTmp">
update tab_sys_menu set
<if test="parentId != null">
parent_id = #{parentId},
</if>
<if test="parentCode != null and parentCode != ''">
parent_code = #{parentCode},
</if>
<if test="menuVersion != null and menuVersion != ''">
menu_version = #{menuVersion},
</if>
<if test="menuVersionName != null and menuVersionName != ''">
menu_version_name = #{menuVersionName},
</if>
project = #{project}
where menu_id in
<foreach close=")" collection="menuIdList" index="index" item="item" open="(" separator=",">
#{item}
</foreach>
and delete_flag=${@com.gic.auth.constant.DeleteFlagConstants@NORMAL_STATUS}
</update>
<select id="selectByIdsAndOrderBy" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
......
......@@ -113,12 +113,23 @@ public class MenuController {
return RestResponse.success(getAppId(null, menuCode));
}
/**
* gic菜单转到某一个应用下面
* @param menuCode
* @return
*/
@IgnoreLogin
@RequestMapping("sync-menu-to-pro")
public RestResponse syncMenuToPro(String menuCode) {
return RestResponse.success(menuApiService.syncProductMenu(menuCode));
}
@IgnoreLogin
@RequestMapping("switch-gic-menu-to-app")
public RestResponse switchGicMenuToApp(String gicMenuCode, String appMenuCode) {
return RestResponse.success(menuApiService.switchGicMenuToApp(gicMenuCode, appMenuCode));
}
@RequestMapping("login-collaborator-menu-of-app")
public RestResponse getCollaboratorMenu(String appId, String menuCode) {
LOGGER.info("查询登录用户的协作应用的菜单参数:{}-{}", appId, menuCode);
......
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