无关风月
2024-11-15 353cf91d3679e68d9b8c07652e4f7791d606dbd4
xinquan-modules/xinquan-user/src/main/java/com/xinquan/user/controller/client/ClientAppUserViewingHistoryController.java
@@ -69,6 +69,26 @@
    private final RemoteAppUserService remoteAppUserService;
    /**
     * 远程调用 根据章节id和用户id查询是否观看完毕
     * @param id
     * @return
     */
    @PostMapping("/getCourseChapterHistoryState/{id}/{chapterId}")
    public R<Integer> getCourseChapterHistoryState(@PathVariable("id") Long id,@PathVariable("chapterId") Long chapterId) {
        List<AppUserViewingHistory> list = appUserViewingHistoryService.lambdaQuery()
                .eq(AppUserViewingHistory::getChapterId, chapterId)
                .eq(AppUserViewingHistory::getAppUserId, id)
                .eq(AppUserViewingHistory::getViewingType, 2)
                .list();
        for (AppUserViewingHistory appUserViewingHistory : list) {
            if (appUserViewingHistory.getIsOver()!=null && appUserViewingHistory.getIsOver()==1){
                return R.ok(1);
            }
        }
        return R.ok(2);
    }
    /**
     * 远程调用查询用户观看了哪些课程
     * @return
     */
@@ -86,6 +106,7 @@
        List<AppUserViewingHistory> list = appUserViewingHistoryService.lambdaQuery()
                .eq(AppUserViewingHistory::getBizId, id)
                .eq(AppUserViewingHistory::getViewingType, 1)
                .groupBy(AppUserViewingHistory::getAppUserId)
                .list();
        return R.ok(Long.valueOf(list.size()));
    }
@@ -102,6 +123,7 @@
        List<AppUserViewingHistory> list = appUserViewingHistoryService.lambdaQuery()
                .eq(AppUserViewingHistory::getChapterId, id)
                .eq(AppUserViewingHistory::getViewingType, 2)
                .groupBy(AppUserViewingHistory::getAppUserId)
                .list();
        return R.ok(Long.valueOf(list.size()));
    }
@@ -148,6 +170,7 @@
                    orderCourseVO.setIosPrice(meditation.getIosPrice());
                    orderCourseVO.setCoverUrl(meditation.getCoverUrl());
                    orderCourseVO.setCount(meditation.getRealLearnedNum()+meditation.getVirtualLearnedNum());
                    orderCourseVO.setCoverDescription(meditation.getCoverDescription());
                    orderCourseVOS.add(orderCourseVO);
                }
                break;