记得上下班打卡 | git大法好,push需谨慎

Commit ee1181e7 authored by jiangxiulong's avatar jiangxiulong

本地演出双循环判断导致演出重复

parent 8d9bf58a
...@@ -65,6 +65,7 @@ public class KylinPerformancesServiceImpl extends ServiceImpl<KylinPerformancesM ...@@ -65,6 +65,7 @@ public class KylinPerformancesServiceImpl extends ServiceImpl<KylinPerformancesM
// 判断搜索 处理新数据 // 判断搜索 处理新数据
List<KylinPerformanceVo> performancesListNew = new ArrayList<>(); List<KylinPerformanceVo> performancesListNew = new ArrayList<>();
List<String> performancesIds = new ArrayList<>();
for (KylinPerformanceVo info : performancesList) { for (KylinPerformanceVo info : performancesList) {
boolean isShow = true; boolean isShow = true;
if (type > 0) { if (type > 0) {
...@@ -78,35 +79,32 @@ public class KylinPerformancesServiceImpl extends ServiceImpl<KylinPerformancesM ...@@ -78,35 +79,32 @@ public class KylinPerformancesServiceImpl extends ServiceImpl<KylinPerformancesM
} }
} }
if (isShow) { if (isShow) {
performancesIds.add(info.getPerformancesId());
performancesListNew.add(info); performancesListNew.add(info);
} }
} }
// List<String> ids = Arrays.asList("");
// 推荐 // 推荐
int is_native = 1; int is_native = 1;
int recommend = performancesListNew.size(); int recommend = performancesListNew.size();
List<KylinPerformanceVo> performancesListNewUnqui = new ArrayList<>();
performancesListNewUnqui.addAll(performancesListNew);
if (recommend <= 2) { if (recommend <= 2) {
List<KylinPerformanceVo> performancesListRecommend = dataUtils.getPerformancesListIsSystemRecommend(); List<KylinPerformanceVo> performancesListRecommend = dataUtils.getPerformancesListIsSystemRecommend();
/*List<KylinPerformanceVo> collect = performancesListRecommend.stream().filter(r -> !ids.contains(r.getPerformancesId())).collect(Collectors.toList());
performancesListNew.addAll(collect);*/
if (!CollectionUtils.isEmpty(performancesListRecommend)) { if (!CollectionUtils.isEmpty(performancesListRecommend)) {
is_native = 0; is_native = 0;
if(recommend > 0) {// 去重 if(recommend > 0) {// 去重
for(KylinPerformanceVo recommendInfo : performancesListRecommend) { List<KylinPerformanceVo> collect = performancesListRecommend.stream().filter(r -> !performancesIds.contains(r.getPerformancesId())).collect(Collectors.toList());
performancesListNew.addAll(collect);
/*for(KylinPerformanceVo recommendInfo : performancesListRecommend) {
for(KylinPerformanceVo info : performancesListNew) { for(KylinPerformanceVo info : performancesListNew) {
if (!recommendInfo.getPerformancesId().equals(info.getPerformancesId())) { if (!recommendInfo.getPerformancesId().equals(info.getPerformancesId())) {
performancesListNewUnqui.add(recommendInfo); performancesListNewUnqui.add(recommendInfo);
} }
} }
} }*/
} else { } else {
performancesListNewUnqui.addAll(performancesListRecommend); performancesListNew.addAll(performancesListRecommend);
} }
} }
} }
...@@ -116,7 +114,7 @@ public class KylinPerformancesServiceImpl extends ServiceImpl<KylinPerformancesM ...@@ -116,7 +114,7 @@ public class KylinPerformancesServiceImpl extends ServiceImpl<KylinPerformancesM
info.put("is_native", is_native); // 本地演出少是否推荐了其他演出 0有推荐 1没有 info.put("is_native", is_native); // 本地演出少是否推荐了其他演出 0有推荐 1没有
info.put("recommend", recommend); // 从第几个开始是其他推荐演出 后台设置的那个推荐 info.put("recommend", recommend); // 从第几个开始是其他推荐演出 后台设置的那个推荐
info.put("total", 0); info.put("total", 0);
info.put("list", performancesListNewUnqui); info.put("list", performancesListNew);
return info; return info;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment