hgw %!s(int64=3) %!d(string=hai) anos
pai
achega
cdc9e9b72e

+ 8 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TempLittleArtistTrainingCampServiceImpl.java

@@ -295,15 +295,14 @@ public class TempLittleArtistTrainingCampServiceImpl extends ServiceImpl<TempLit
         Map<String, Object> result = new HashMap<>();
         result.put("user", userRelation);
         if (CollectionUtils.isNotEmpty(campList)) {
-            campList.sort(Comparator.comparing(TempLittleArtistTrainingCamp::getApplyStartDate));
-        }
-        if (CollectionUtils.isNotEmpty(campList)) {
-            campList.forEach(a -> {
-                int count = tempLittleArtistTrainingCampUserRelationService.count(Wrappers.<TempLittleArtistTrainingCampUserRelation>lambdaQuery()
-                        .eq(TempLittleArtistTrainingCampUserRelation::getActivityId, a.getId())
-                );
-                a.setUserCount(count);
-            });
+            campList = campList.stream()
+                    .peek(a -> {
+                        int count = tempLittleArtistTrainingCampUserRelationService.count(Wrappers.<TempLittleArtistTrainingCampUserRelation>lambdaQuery()
+                                .eq(TempLittleArtistTrainingCampUserRelation::getActivityId, a.getId()));
+                        a.setUserCount(count);
+                    })
+                    .sorted(Comparator.comparing(TempLittleArtistTrainingCamp::getApplyStartDate))
+                    .collect(Collectors.toList());
         }
         result.put("campList", campList);
         return result;