public PageregRecord(RecordQueryParam recordQueryParam, PaobaPage paobaPage) { if(recordQueryParam.getCardId() == null && recordQueryParam.getOpenId() == null){ throw new PbServiceException("请登录小程序后查询个人报名记录!"); }else { Page map = playerRepository.regPage(recordQueryParam, paobaPage).map( tuple2 -> { tuple2._1(); ActivityVO activityVO = activityAssembler.E2V(tuple2._2()); UserActivityRegVO activityRegVO = new UserActivityRegVO(); BeanUtil.copyProperties(activityVO, activityRegVO); activityRegVO.setUserRegTime(tuple2._1().getCreateTime()); return activityRegVO; } ); List content = map.getContent(); List res = content.stream().collect(Collectors.collectingAndThen( Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(UserActivityRegVO::getActId))), ArrayList::new )); return new PageImpl<>(res,PageRequest.of(paobaPage.getPn(), paobaPage.getPs()),map.getTotalElements()); } }
使用流 *** 作去重:
content.stream().collect(Collectors.collectingAndThen( Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(UserActivityRegVO::getActId))), ArrayList::new ));
记录一下。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)