| | |
| | | import com.xinquan.order.api.feign.RemoteOrderService; |
| | | import com.xinquan.system.api.domain.AppUser; |
| | | import com.xinquan.meditation.api.domain.MeditationQuestion; |
| | | import com.xinquan.system.api.domain.AppUserViewingHistory; |
| | | import com.xinquan.system.api.domain.vo.AppUserVO; |
| | | import com.xinquan.system.api.model.LoginUser; |
| | | import com.xinquan.user.api.domain.dto.AppUserDTO; |
| | |
| | | private final MeditationQuestionLikeService meditationQuestionLikeService; |
| | | private final MeditationUserFavoriteService meditationUserFavoriteService; |
| | | private final RemoteOrderService remoteOrderService; |
| | | private final MeditationMapper meditationMapper; |
| | | /** |
| | | * 获取私人订制 |
| | | * |
| | |
| | | if (loginUser==null){ |
| | | return new ArrayList<>(); |
| | | } |
| | | Long userId = loginUser.getUserid(); |
| | | List<Order> orderList = remoteOrderService.getOrderListByType(userId, |
| | | OrderFromEnum.MEDITATION.getCode(), |
| | | SecurityConstants.INNER).getData(); |
| | | List<Long> meditationIdList = orderList.stream().map(Order::getBusinessId) |
| | | .collect(Collectors.toList()); |
| | | Long userId = loginUser.getUserid(); |
| | | List<Order> data1 = remoteOrderService.getMeditationIsBuyAll(userId).getData(); |
| | | List<Long> meditationIdList = data1.stream().map(Order::getBusinessId).collect(Collectors.toList()); |
| | | if (CollUtils.isNotEmpty(meditationIdList)) { |
| | | Set<Long> meditationIdSet = new HashSet<>(meditationIdList); |
| | | voList = voList.stream() |
| | | .filter(meditationVO -> meditationIdList.contains(meditationVO.getId())) |
| | | .filter(meditationVO -> meditationIdSet.contains(meditationVO.getId())) |
| | | .peek(meditationVO -> meditationVO.setIsBuy(1)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | |
| | | meditationLambdaQueryWrapper.orderByDesc(Meditation::getSortNum).last("limit 8"); |
| | | } |
| | | List<Meditation> list =this.list(meditationLambdaQueryWrapper); |
| | | List<Meditation> meditations = new ArrayList<>(); |
| | | for (Meditation meditation : list) { |
| | | if (meditation.getListingStatus()==1){ |
| | | meditations.add(meditation); |
| | | } |
| | | } |
| | | if (CollUtils.isNotEmpty(meditations)) { |
| | | |
| | | if (CollUtils.isNotEmpty(list)) { |
| | | // 对象拷贝 |
| | | voList = BeanUtils.copyList(meditations, ClientMeditationVO.class); |
| | | voList = BeanUtils.copyList(list, ClientMeditationVO.class); |
| | | } |
| | | handlePaidMeditation(voList); |
| | | return voList; |
| | |
| | | if (tokenService.getLoginUser()!=null){ |
| | | data1 = remoteOrderService.getMeditationIsBuyAll(tokenService.getLoginUser().getUserid()).getData(); |
| | | } |
| | | List<AppUserViewingHistory> data2 = remoteAppUserService.getMeditationHistoryCountAll().getData(); |
| | | boolean temp = tokenService.getLoginUser()!=null; |
| | | for (Meditation record : page.getRecords()) { |
| | | Long data = remoteAppUserService.getMeditationHistoryCount(record.getId()).getData(); |
| | | record.setRealLearnedNum(Integer.valueOf(data+"")); |
| | | List<AppUserViewingHistory> collect = data2.stream().filter(e -> e.getBizId().equals(record.getId())).collect(Collectors.toList()); |
| | | record.setRealLearnedNum(collect.size()); |
| | | record.setRealLearnedNum(record.getVirtualLearnedNum()+record.getRealLearnedNum()); |
| | | if (tokenService.getLoginUser()!=null){ |
| | | if (temp){ |
| | | Order order = data1.stream().filter(e -> e.getBusinessId().equals(record.getId())).findFirst().orElse(null); |
| | | if (order==null){ |
| | | record.setIsBuy(2); |
| | |
| | | }else{ |
| | | record.setIsBuy(2); |
| | | } |
| | | this.updateById(record); |
| | | } |
| | | this.updateBatchById(page.getRecords()); |
| | | // 将实体类转换为VO |
| | | pageDTO = PageDTO.of(page, ClientMeditationVO.class); |
| | | return pageDTO; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | this.updateById(meditation); |
| | | return R.ok(vo); |
| | | } |
| | | @Override |