查询用户授权app

develop
guyuliang 2024-08-26 20:14:42 +08:00
parent ddd530f969
commit 57ec1cc335
2 changed files with 26 additions and 10 deletions

View File

@ -49,13 +49,7 @@ public class IndexServiceImpl implements IndexService {
public GeneralResult workOrderStatic(RequestContext requestContext) {
try {
JSONObject param = new JSONObject();
User user = userRepository.query(requestContext.getTarget());
param.put("userId", "1111");
param.put("page", 1);
param.put("limit", Integer.MAX_VALUE);
String result = ykUtil.call(YkInfo.getTaskList, param, JSONArray.class);
JSONObject jsonObject = JSONArray.parseObject(result, JSONObject.class);
JSONObject jsonObject = getTaskList(requestContext);
Integer total = jsonObject.getInteger("total");
Map<String, Object> resultMap = new HashMap<>();
@ -82,6 +76,17 @@ public class IndexServiceImpl implements IndexService {
}
}
private JSONObject getTaskList(RequestContext requestContext) throws Exception {
JSONObject param = new JSONObject();
User user = userRepository.query(requestContext.getTarget());
param.put("userId", "1111");
param.put("page", 1);
param.put("limit", Integer.MAX_VALUE);
String result = ykUtil.call(YkInfo.getTaskList, param, JSONArray.class);
JSONObject jsonObject = JSONArray.parseObject(result, JSONObject.class);
return jsonObject;
}
@Override
public GeneralResult userDataStatic(RequestContext requestContext) {
try {
@ -90,10 +95,17 @@ public class IndexServiceImpl implements IndexService {
List<JSONObject> userAppList = getUserAppList(requestContext);
resultMap.put("userAppCount", userAppList.size());
//获取用户信息
//获取运维任务申请表
JSONObject taskJson = getTaskList(requestContext);
Integer total = taskJson.getInteger("total");
resultMap.put("taskCount", total);
//获取用户数据权限申请数量
JSONObject userParam = new JSONObject();
userParam.put("userId", "1111");
String userRolesStr = ykUtil.call(YkInfo.getUserRoles, userParam, JSONArray.class);
String userRolesStr = ykUtil.call(YkInfo.getUserDataJurisdiction, userParam, JSONArray.class);
return new GeneralResult(true, resultMap, "查询成功");
@ -117,12 +129,14 @@ public class IndexServiceImpl implements IndexService {
JSONObject allAppJson = JSONObject.parseObject(result, JSONObject.class);
List<JSONObject> allAppList = JSONObject.parseObject(allAppJson.getString("list"), List.class);
List<JSONObject> userAppList = getUserAppList(requestContext);
List<String> appIdList = userAppList.stream().map(jsonObject -> jsonObject.getString("appId")).collect(Collectors.toList());
for (JSONObject data : allAppList) {
if(appIdList.contains(data.getString("appId"))){
data.put("enable", "1");
}else{
data.put("enable", "0");
}
}
return new GeneralResult(true, allAppList, "查询成功");

View File

@ -13,6 +13,8 @@ public enum YkInfo {
getAllAppList("/system/sysapp/getAppList"),
//获取用户角色信息
getUserRoles("/system/user/queryUserRoles"),
//用户数据权限信息查询接口
getUserDataJurisdiction("/system/user/queryUserAuthres"),
getTaskByUser("/system/task/countTaskByUser");