Browse Source

[fix]
1.去掉头像处理时可能会出现null数据的情况

limeng 1 tháng trước cách đây
mục cha
commit
eb571933cf

+ 4 - 1
application-webadmin/src/main/java/com/tourism/webadmin/back/service/impl/TourProjectGroupPurchaseServiceImpl.java

@@ -215,6 +215,8 @@ public class TourProjectGroupPurchaseServiceImpl extends BaseService<TourProject
         // usersAvatars用,分割成List
         if(StringUtils.isNotBlank(usersAvatars)) {
             List<String> headImageUrlList = Arrays.asList(usersAvatars.split(","));
+            // 去掉list里的null元素
+            headImageUrlList = headImageUrlList.stream().filter(Objects::nonNull).collect(Collectors.toList());
             groupPurchase.setSplicingAvatars(this.splicingAvatars(headImageUrlList));
         }
 
@@ -294,7 +296,8 @@ public class TourProjectGroupPurchaseServiceImpl extends BaseService<TourProject
         List<TourUser> tourUserList = tourOrderService.getTourUserListByProjectId(dto);
         // tourUserList里的头像url提取成List<String>
         List<String> headImageUrlList = tourUserList.stream().map(TourUser::getHeadImageUrl).collect(Collectors.toList());
-
+        // 去掉list里的空元素
+        headImageUrlList = headImageUrlList.stream().filter(Objects::nonNull).collect(Collectors.toList());
         // headImageUrlList使用,分割,转为字符串
         if(headImageUrlList != null && headImageUrlList.size() > 0) {
             // 如果是参与拼团,那么加上当前用户头像,如果是取消,就不用处理