|
|
@@ -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; |
|
|
|
} |
|
|
|
|
|
|
|
/** |