Kaynağa Gözat

指示牌列表,如果是空,返回空数组

dsx 2 yıl önce
ebeveyn
işleme
c09fd85d55

+ 25 - 26
src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoExtServiceImpl.java

@@ -200,43 +200,42 @@ public class SceneEditInfoExtServiceImpl extends ServiceImpl<ISceneEditInfoExtMa
         List<JSONObject> styles = new ArrayList<>();
         ScenePlus scenePlus = scenePlusService.getScenePlusByNum(param.getNum());
         SceneEditInfoExt sceneEditInfoExt = this.getByScenePlusId(scenePlus.getId());
-        if(sceneEditInfoExt.getBillboards() == CommonStatus.NO.code().intValue()){
-            result.put("tags", tags);
-            result.put("styles", styles);
-            return result;
-        }
 
         this.syncBillboardsFromFileToRedis(param.getNum());
 
         //获取指示牌数据
         String key = String.format(RedisKey.SCENE_BILLBOARDS, param.getNum());
         List<String> list = redisUtil.hgetValues(key);
-        List<TagBean> sortList = list.stream().map(str -> {
-            JSONObject jsonObject = JSON.parseObject(str);
-            TagBean tagBean = new TagBean();
-            tagBean.setCreateTime(jsonObject.getLong("createTime"));
-            jsonObject.remove("createTime");
-            tagBean.setTag(jsonObject);
-            return tagBean;
-        }).collect(Collectors.toList());
-        sortList.sort(Comparator.comparingLong(TagBean::getCreateTime).reversed());
-        tags = sortList.stream().map(item -> item.getTag()).collect(Collectors.toList());
+        if(CollUtil.isNotEmpty(list)){
+            List<TagBean> sortList = list.stream().map(str -> {
+                JSONObject jsonObject = JSON.parseObject(str);
+                TagBean tagBean = new TagBean();
+                tagBean.setCreateTime(jsonObject.getLong("createTime"));
+                jsonObject.remove("createTime");
+                tagBean.setTag(jsonObject);
+                return tagBean;
+            }).collect(Collectors.toList());
+            sortList.sort(Comparator.comparingLong(TagBean::getCreateTime).reversed());
+            tags = sortList.stream().map(item -> item.getTag()).collect(Collectors.toList());
+        }
         result.put("tags", tags);
 
         //获取图标数据
         this.syncBillboardsStylesFromFileToRedis(param.getNum());
         key = String.format(RedisKey.SCENE_BILLBOARDS_STYLES, param.getNum());
-        list = redisUtil.hgetValues(key);
-        sortList = list.stream().map(str -> {
-            JSONObject jsonObject = JSON.parseObject(str);
-            TagBean tagBean = new TagBean();
-            tagBean.setCreateTime(jsonObject.getLong("createTime"));
-            jsonObject.remove("createTime");
-            tagBean.setTag(jsonObject);
-            return tagBean;
-        }).collect(Collectors.toList());
-        sortList.sort(Comparator.comparingLong(TagBean::getCreateTime).reversed());
-        styles = sortList.stream().map(item -> item.getTag()).collect(Collectors.toList());
+        List<String> sytlelist = redisUtil.hgetValues(key);
+        if(CollUtil.isNotEmpty(sytlelist)){
+            List<TagBean> stileSortList = sytlelist.stream().map(str -> {
+                JSONObject jsonObject = JSON.parseObject(str);
+                TagBean tagBean = new TagBean();
+                tagBean.setCreateTime(jsonObject.getLong("createTime"));
+                jsonObject.remove("createTime");
+                tagBean.setTag(jsonObject);
+                return tagBean;
+            }).collect(Collectors.toList());
+            stileSortList.sort(Comparator.comparingLong(TagBean::getCreateTime).reversed());
+            styles = stileSortList.stream().map(item -> item.getTag()).collect(Collectors.toList());
+        }
         result.put("styles", styles);
 
         return result;