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 72ed210..e1718c8 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 @@ -18,6 +18,7 @@ import com.megatron.common.model.RequestContext; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.HashMap; @@ -141,15 +142,17 @@ public class IndexServiceImpl implements IndexService { 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"))) { - data.put("enable", "1"); - } else { - data.put("enable", "0"); + if (!CollectionUtils.isEmpty(permList)) { + 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"))) { + data.put("enable", "1"); + } else { + data.put("enable", "0"); + } } } log.info("allAppList:{}", JSON.toJSONString(allAppList));