diff --git a/bocloud.sms.booter/src/main/java/com/bocloud/sms/booter/controller/IndexDataController.java b/bocloud.sms.booter/src/main/java/com/bocloud/sms/booter/controller/IndexDataController.java index 6e5b1da..dfcb42a 100644 --- a/bocloud.sms.booter/src/main/java/com/bocloud/sms/booter/controller/IndexDataController.java +++ b/bocloud.sms.booter/src/main/java/com/bocloud/sms/booter/controller/IndexDataController.java @@ -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); + } } diff --git a/bocloud.sms.service/src/main/java/com/bocloud/sms/interfaces/IndexService.java b/bocloud.sms.service/src/main/java/com/bocloud/sms/interfaces/IndexService.java index 670afe4..5081def 100644 --- a/bocloud.sms.service/src/main/java/com/bocloud/sms/interfaces/IndexService.java +++ b/bocloud.sms.service/src/main/java/com/bocloud/sms/interfaces/IndexService.java @@ -13,4 +13,6 @@ public interface IndexService { GeneralResult workOrderStatic(RequestContext requestContext); GeneralResult userDataStatic(RequestContext requestContext); + + GeneralResult userAppList(RequestContext requestContext); } diff --git a/bocloud.sms.service/src/main/java/com/bocloud/sms/service/IndexServiceImpl.java b/bocloud.sms.service/src/main/java/com/bocloud/sms/service/IndexServiceImpl.java index db9d107..923d186 100644 --- a/bocloud.sms.service/src/main/java/com/bocloud/sms/service/IndexServiceImpl.java +++ b/bocloud.sms.service/src/main/java/com/bocloud/sms/service/IndexServiceImpl.java @@ -84,11 +84,10 @@ public class IndexServiceImpl implements IndexService { @Override public GeneralResult userDataStatic(RequestContext requestContext) { try { + Map 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 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 userAppList = getUserAppList(requestContext); + return new GeneralResult(true, userAppList, "查询成功"); + } catch (Exception e) { + log.info("查询失败", e); + return new GeneralResult(false, "查询失败"); + } + } + + private List 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); + } }