查询用户授权app

develop
guyuliang 2024-08-26 19:25:16 +08:00
parent b6b758a770
commit bab20f84ad
3 changed files with 38 additions and 5 deletions

View File

@ -63,4 +63,15 @@ public class IndexDataController {
public GeneralResult userStatic(@Value(Common.REQ_CONTEXT) RequestContext requestContext) {
return indexService.userDataStatic(requestContext);
}
/**
*
* @param pager
* @param requestContext
* @return
*/
@GetMapping("/userAppList")
@Operation(summary = "当前用户首页数据展示模块的数据查询")
public GeneralResult userAppList(@Value(Common.REQ_CONTEXT) RequestContext requestContext) {
return indexService.userAppList(requestContext);
}
}

View File

@ -13,4 +13,6 @@ public interface IndexService {
GeneralResult workOrderStatic(RequestContext requestContext);
GeneralResult userDataStatic(RequestContext requestContext);
GeneralResult userAppList(RequestContext requestContext);
}

View File

@ -84,11 +84,10 @@ public class IndexServiceImpl implements IndexService {
@Override
public GeneralResult userDataStatic(RequestContext requestContext) {
try {
Map<String, Object> resultMap = new HashMap<>();
//查询当前用户授权应用
JSONObject param = new JSONObject();
param.put("userId", "1111");
param.put("type", "user");
String result = ykUtil.call(YkInfo.getUserAppList, param, JSONArray.class);
List<JSONObject> userAppList = getUserAppList(requestContext);
resultMap.put("userAppCount", userAppList.size());
//获取用户信息
JSONObject userParam = new JSONObject();
@ -96,10 +95,31 @@ public class IndexServiceImpl implements IndexService {
String userRolesStr = ykUtil.call(YkInfo.getUserRoles, userParam, JSONArray.class);
return new GeneralResult(true, "查询成功");
return new GeneralResult(true, resultMap, "查询成功");
} catch (Exception e) {
log.info("查询失败", e);
return new GeneralResult(false, "查询失败");
}
}
@Override
public GeneralResult userAppList(RequestContext requestContext) {
try {
List<JSONObject> userAppList = getUserAppList(requestContext);
return new GeneralResult(true, userAppList, "查询成功");
} catch (Exception e) {
log.info("查询失败", e);
return new GeneralResult(false, "查询失败");
}
}
private List<JSONObject> getUserAppList(RequestContext requestContext) throws Exception {
//查询当前用户授权应用
JSONObject param = new JSONObject();
param.put("userId", "1111");
param.put("type", "user");
String result = ykUtil.call(YkInfo.getUserAppList, param, JSONArray.class);
return JSONObject.parseObject(result, List.class);
}
}