From a09c51ba0515580d3a0184947642597b017ed279 Mon Sep 17 00:00:00 2001 From: yuemian <--list> Date: Wed, 18 Sep 2024 09:55:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=BA=94=E7=94=A8=E6=9D=83?= =?UTF-8?q?=E9=99=90=E5=88=9D=E5=A7=8B=E5=8C=96=E4=B8=AD=E7=9A=84=E7=A9=BA?= =?UTF-8?q?=E9=9B=86=E5=90=88=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bocloud/sms/service/IndexServiceImpl.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) 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 8aa37cd..3d26213 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.HashMap; import java.util.List; @@ -140,15 +141,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));