Bladeren bron

更新菜单返回区分

tags/v2.4.1
xiaoying 1 jaar geleden
bovenliggende
commit
497894769f
4 gewijzigde bestanden met toevoegingen van 48 en 13 verwijderingen
  1. +18
    -11
      tuoheng_oidc_admin/src/main/java/com/tuoheng/third/service/impl/ThirdServiceImpl.java
  2. +4
    -1
      tuoheng_oidc_admin/src/main/java/com/tuoheng/third/vo/MenuVo.java
  3. +25
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/third/vo/RoleMenuListVo.java
  4. +1
    -1
      tuoheng_oidc_admin/target/classes/application-test.yml

+ 18
- 11
tuoheng_oidc_admin/src/main/java/com/tuoheng/third/service/impl/ThirdServiceImpl.java Bestand weergeven

@@ -13,9 +13,7 @@ import com.tuoheng.model.dto.Platform;
import com.tuoheng.model.dto.RoleDto;
import com.tuoheng.third.request.ThirdRequest;
import com.tuoheng.third.service.ThirdService;
import com.tuoheng.third.vo.IndustryVo;
import com.tuoheng.third.vo.RoleMenuVo;
import com.tuoheng.third.vo.ServiceExampleVo;
import com.tuoheng.third.vo.*;
import com.tuoheng.until.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -25,10 +23,8 @@ import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.web.client.RestTemplate;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.*;
import java.util.stream.Collectors;

/**
* @Author xiaoying
@@ -121,7 +117,7 @@ public class ThirdServiceImpl implements ThirdService {
return JsonResult.error("请求参数有误!");

}
RoleMenuVo vo = getRoleMenuVoByThirdRequest(request, loginUser);
RoleMenuListVo vo = getRoleMenuVoByThirdRequest(request, loginUser);

return JsonResult.success(vo);
}
@@ -133,7 +129,7 @@ public class ThirdServiceImpl implements ThirdService {
* @param loginUser
* @return
*/
private RoleMenuVo getRoleMenuVoByThirdRequest(ThirdRequest request, LoginUser loginUser) {
private RoleMenuListVo getRoleMenuVoByThirdRequest(ThirdRequest request, LoginUser loginUser) {

Platform platform = platformMapper.selectOne(Wrappers.<Platform>lambdaQuery()
.eq(Platform::getPlatformCode, request.getClientId())
@@ -142,6 +138,7 @@ public class ThirdServiceImpl implements ThirdService {
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "该业务平台不存在");
}
RoleMenuVo vo = new RoleMenuVo();
RoleMenuListVo roleMenuListVo = new RoleMenuListVo();
vo.setRoleId(request.getRoleId());

String url = "";
@@ -183,8 +180,18 @@ public class ThirdServiceImpl implements ThirdService {
if (response == null || !response.hasBody() || response.getBody().getCode() != JsonResult.SUCCESS) {
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "获取菜单表响应失败!");
}

return response.getBody().getData();
RoleMenuVo menuVo = response.getBody().getData();
Map<String, List<MenuVo>> collect = menuVo.getOpMenusList().parallelStream().collect(Collectors.groupingBy(MenuVo::getClientId));
Set<Map.Entry<String, List<MenuVo>>> entries = collect.entrySet();
//区分小程序菜单及pc菜单
for (Map.Entry<String, List<MenuVo>> entry : entries) {
if (entry.getKey().contains("mp")) {
roleMenuListVo.setMpMenusList(entry.getValue());
} else if (entry.getKey().contains("admin")) {
roleMenuListVo.setAdminMenusList(entry.getValue());
}
}
return roleMenuListVo;
}

/**

+ 4
- 1
tuoheng_oidc_admin/src/main/java/com/tuoheng/third/vo/MenuVo.java Bestand weergeven

@@ -21,6 +21,9 @@ public class MenuVo {
* 父级ID
*/
private Integer parentId;

/**
* 菜单标识
*/
private String clientId;

}

+ 25
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/third/vo/RoleMenuListVo.java Bestand weergeven

@@ -0,0 +1,25 @@
package com.tuoheng.third.vo;

import lombok.Data;

import java.util.List;

/**
* @Author xiaoying
* @Date 2023/3/22 10:24
*/
@Data
public class RoleMenuListVo {

/**
*pc菜单
*/
private List<MenuVo> adminMenusList;

/**
*小程序菜单
*/
private List<MenuVo> mpMenusList;


}

+ 1
- 1
tuoheng_oidc_admin/target/classes/application-test.yml Bestand weergeven

@@ -70,6 +70,6 @@ tuoheng:
#airport配置地址
airport-url: https://airport-test.t-aaron.com
#dsp配置地址
dsp-url: https://dsp-portal.t-aaron.com/api/web/dsp
dsp-url: http://106.15.64.139:7011/api/web/dsp
# 高德Key
gaodeKey: 5a1f63e7563cba471a9d0773e218144a

Laden…
Annuleren
Opslaan