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 8f30234..1126fc5 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 @@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; /** @@ -72,8 +73,9 @@ public class IndexDataController { */ @GetMapping("/userAppList") @Operation(summary = "当前用户首页数据展示模块的数据查询") - public GeneralResult userAppList(@Value(Common.REQ_CONTEXT) RequestContext requestContext) { - return indexService.userAppList(requestContext); + public GeneralResult userAppList(@Value(Common.REQ_CONTEXT) RequestContext requestContext, + @RequestParam(value = "trxToken", required = false) String trxToken) { + return indexService.userAppList(requestContext, trxToken); } /** 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 fbb8879..a1a32c5 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 @@ -14,7 +14,7 @@ public interface IndexService { GeneralResult userDataStatic(RequestContext requestContext); - GeneralResult userAppList(RequestContext requestContext); + GeneralResult userAppList(RequestContext requestContext, String trxToken); GeneralResult sevenDayWarnTrend(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 e397aff..8aa37cd 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 @@ -7,7 +7,9 @@ import com.bocloud.sms.entity.User; import com.bocloud.sms.enums.WarnInfo; import com.bocloud.sms.enums.YkInfo; import com.bocloud.sms.interfaces.IndexService; +import com.bocloud.sms.model.AppPerm; import com.bocloud.sms.repository.UserRepository; +import com.bocloud.sms.service.utils.QxUtils; import com.bocloud.sms.utils.WarnUtil; import com.bocloud.sms.utils.YkUtil; import com.megatron.common.model.GeneralResult; @@ -32,6 +34,8 @@ public class IndexServiceImpl implements IndexService { private UserRepository userRepository; @Autowired private WarnUtil warnUtil; + @Autowired + private QxUtils qxUtils; @Override public GeneralResult doneWorkOrder(Pager pager, RequestContext requestContext) { @@ -114,7 +118,7 @@ public class IndexServiceImpl implements IndexService { } @Override - public GeneralResult userAppList(RequestContext requestContext) { + public GeneralResult userAppList(RequestContext requestContext, String trxToken) { try { //获取所有的appList @@ -127,9 +131,18 @@ public class IndexServiceImpl implements IndexService { JSONObject allAppJson = JSONObject.parseObject(result, JSONObject.class); List allAppList = JSONObject.parseObject(allAppJson.getString("list"), List.class); log.info("allAppList:{}", JSON.toJSONString(allAppList)); - List userAppList = getUserAppList(requestContext); - log.info("userAppList:{}", JSON.toJSONString(userAppList)); - List appIdList = userAppList.stream().map(jsonObject -> jsonObject.getString("appId")).collect(Collectors.toList()); + +// List userAppList = getUserAppList(requestContext); +// log.info("userAppList:{}", JSON.toJSONString(userAppList)); +// List appIdList = userAppList.stream().map(jsonObject -> jsonObject.getString("appId")).collect(Collectors.toList()); + + // 调用权限系统接口 + User user = userRepository.query(requestContext.getTarget()); + log.info("user:{}", JSON.toJSONString(user)); + List permList = JSONArray.parseArray(qxUtils.queryApp(trxToken, user.getUserId()), AppPerm.class); + List appIdList = permList.stream() + .map(AppPerm::getId) + .collect(Collectors.toList()); log.info("appIdList:{}", JSON.toJSONString(appIdList)); for (JSONObject data : allAppList) { if (appIdList.contains(data.getString("appId"))) {