From 0a23c31baef81d149563da16486f3f7d8d9f33e8 Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期二, 16 四月 2024 17:30:25 +0800
Subject: [PATCH] 4.16

---
 common-buiness/src/main/java/cn/stylefeng/guns/modular/business/service/impl/CourseOrderServiceImpl.java |   18 +++
 rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CounsellingInfoController.java              |  196 +++++++++++++++++++-------------------
 guns/src/main/java/cn/stylefeng/guns/modular/business/controller/SysUserBusinessController.java          |    2 
 rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CourseController.java                       |   45 ++++++++
 4 files changed, 160 insertions(+), 101 deletions(-)

diff --git a/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/service/impl/CourseOrderServiceImpl.java b/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/service/impl/CourseOrderServiceImpl.java
index edf48e3..d0c5ec9 100644
--- a/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/service/impl/CourseOrderServiceImpl.java
+++ b/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/service/impl/CourseOrderServiceImpl.java
@@ -73,7 +73,8 @@
 
     @Override
     public CourseOrderResponseDTO getCourseChapterInfoByOrderId(Long orderId) {
-        CourseOrderResponseDTO courseOrderResponseDTO = BeanUtil.copyProperties(this.getById(orderId),CourseOrderResponseDTO.class);
+        CourseOrder byId = this.getById(orderId);
+        CourseOrderResponseDTO courseOrderResponseDTO = BeanUtil.copyProperties(byId,CourseOrderResponseDTO.class);
         //查询章节信息
         List<CourseChapter> courseChapterList = this.courseChapterService.getAllByCourseId(courseOrderResponseDTO.getCourseId());
         //查询章节学习进度
@@ -92,6 +93,21 @@
         List<CourseResponseDTO.CourseChapterResponseDTO> courseChapterResponseDTOList = new ArrayList<>();
         courseChapterResponseDTOList = turnChapterResponseDTO(courseChapterResponseDTOList,courseChapterList,learnMap);
         courseOrderResponseDTO.setCourseChapterResponseDTOList(courseChapterResponseDTOList);
+
+        if (byId.getUserId()!=null) {
+            Customer byId1 = customerService.getById(byId.getUserId());
+            courseOrderResponseDTO.setUserName(byId1.getNickName());
+        }
+        if (byId.getCourseUserId()!=null) {
+            Customer byId1 = customerService.getById(byId.getCourseUserId());
+            courseOrderResponseDTO.setCourseName(byId1.getNickName());
+        }
+        if (byId.getTutoringUserId()!=null) {
+            Customer byId1 = customerService.getById(byId.getTutoringUserId());
+            courseOrderResponseDTO.setTutoringUserName(byId1.getNickName());
+        }
+
+
         return courseOrderResponseDTO;
     }
 
diff --git a/guns/src/main/java/cn/stylefeng/guns/modular/business/controller/SysUserBusinessController.java b/guns/src/main/java/cn/stylefeng/guns/modular/business/controller/SysUserBusinessController.java
index d5a4158..3e9f59f 100644
--- a/guns/src/main/java/cn/stylefeng/guns/modular/business/controller/SysUserBusinessController.java
+++ b/guns/src/main/java/cn/stylefeng/guns/modular/business/controller/SysUserBusinessController.java
@@ -206,7 +206,7 @@
 
         List<CounsellingInfo> list = counsellingInfoService.list(Wrappers.lambdaQuery(CounsellingInfo.class).eq(CounsellingInfo::getListingStatus, 1).eq(CounsellingInfo::getIsDelete, 0));
         if (!list.isEmpty()){
-            throw new SystemModularException(SysUserExceptionEnum.USER_CAN_NOT_DELETE_ADMIN);
+            throw new SystemModularException(SysUserExceptionEnum.USER_CAN_NOT_DELETE_INFO);
 
         }
 
diff --git a/rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CounsellingInfoController.java b/rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CounsellingInfoController.java
index 63d206d..36f16bf 100644
--- a/rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CounsellingInfoController.java
+++ b/rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CounsellingInfoController.java
@@ -180,97 +180,14 @@
             @ApiImplicitParam(name = "pageSize", value = "分页:每页大小(默认10)", dataTypeClass = Integer.class, paramType = "query"),
             @ApiImplicitParam(name = "searchType", value = "查询类型 1-严选,2-普通查询,默认2", dataTypeClass = Integer.class, paramType = "query")
     })
-    public ResponseData<List<CounsellinginfoResponseDTO>> page(Integer pageNo, Integer pageSize,Integer searchType) {
-        if (roleInfoCacheApi.get("customer")!=null){
-            List<CounsellinginfoResponseDTO> customer = roleInfoCacheApi.get("customer");
-            return  new SuccessResponseData<>(customer);
-        }
-
-        LambdaQueryWrapper<CounsellingInfo> lambdaQueryWrapper = new LambdaQueryWrapper<CounsellingInfo>().eq(CounsellingInfo::getIsDelete,false)
-                .orderByDesc(CounsellingInfo::getSort,CounsellingInfo::getCreateTime).eq(CounsellingInfo::getListingStatus,1);
-        //默认普通查询
-        if (searchType != null  && searchType.intValue() == 1){
-            List<Customer> customerList = customerService.getWorkerListByLineStatusAndPost(null, null, PostIdEnum.PO_22.getCode(), CustomerWorkStatusEnum.ON_WORK.getCode());
-            if (CollectionUtil.isNotEmpty(customerList)){
-                List<Long> customerIds = customerList.stream().map(Customer::getCustomerId).collect(Collectors.toList());
-                lambdaQueryWrapper.in(CounsellingInfo::getUserId,customerIds);
-            }
-        }
-        List<CounsellingInfo> page = this.counsellingInfoService.list(lambdaQueryWrapper);
-        if (CollectionUtil.isNotEmpty(page)){
-            List<Long> counseIds = page.stream().map(CounsellingInfo::getId).collect(Collectors.toList());
-            QueryWrapper<CounsellingOrder> orderQueryWrapper = new QueryWrapper<CounsellingOrder>().select("counselling_info_id counsellingInfoId,count(1) num ");
-            //查询是否首次咨询
-            orderQueryWrapper.lambda().eq(CounsellingOrder::getUserId,LoginContext.me().getLoginUser().getUserId()).in(CounsellingOrder::getStatusFlag,1,2).in(CounsellingOrder::getCounsellingInfoId,counseIds)
-                    .eq(CounsellingOrder::getOrderType,1).groupBy(CounsellingOrder::getCounsellingInfoId).having(" num > 0 ");
-            List<Map<String,Object>> mapList = this.counsellingOrderService.listMaps(orderQueryWrapper);
-            Map<Long,Object> fristMap = new HashMap<>();
-            if (CollectionUtil.isNotEmpty(mapList)){
-
-                mapList.stream().forEach(stringObjectMap -> {
-                    fristMap.put(Long.parseLong(stringObjectMap.get("counsellingInfoId").toString()),stringObjectMap.get("num"));
-                });
-            }
-            //查询标签总条数
-            List<CounsellingTag> counsellingTags = this.counsellingTagService.list(new LambdaQueryWrapper<CounsellingTag>()
-                    .select(CounsellingTag::getId,CounsellingTag::getTagName));
-            List<Long> custommerIds = page.stream().map(CounsellingInfo::getUserId).collect(Collectors.toList());
-            //查询客户ids
-            List<Customer> customerList = this.customerService.list(new LambdaQueryWrapper<Customer>().select(Customer::getCustomerId,Customer::getNickName).in(Customer::getCustomerId,custommerIds));
-            //查询套餐最低价
-            List<Map<String,Object>> lowMapList = this.counsellingSetMealService.listMaps(new QueryWrapper<CounsellingSetMeal>().select(" counselling_info_id counsellingInfoId,IFNULL(min(price),0) price ").lambda().in(CounsellingSetMeal::getCounsellingInfoId,counseIds)
-                    .eq(CounsellingSetMeal::getSetMealType,1).eq(CounsellingSetMeal::getIsDelete,0));
-
-            List<CounsellinginfoResponseDTO> counsellinginfoResponseDTOS = BeanUtil.copyToList(page,CounsellinginfoResponseDTO.class, CopyOptions.create());
-            counsellinginfoResponseDTOS.stream().forEach(counsellinginfoResponseDTO -> {
-                if (fristMap.get(counsellinginfoResponseDTO.getId()) != null){
-                    counsellinginfoResponseDTO.setIsFirstBuy(true);
-                }
-                if (StrUtil.isNotBlank(counsellinginfoResponseDTO.getCounsellingTagIds())){
-                    List<String> counsellingTagList = Arrays.asList(counsellinginfoResponseDTO.getCounsellingTagIds().split(","));
-                    String tagNames = counsellingTags.stream().filter(cou -> counsellingTagList.contains(cou.getId().toString())).map(CounsellingTag::getTagName).collect(Collectors.joining(","));
-                    //获取课程标签名称
-//                    LambdaQueryWrapper<CounsellingTag> counsellingTagLambdaQueryWrapper = new QueryWrapper<CounsellingTag>().select(" GROUP_CONCAT(tag_name)  tagName ").lambda();
-//                    Map<String,Object> map = counsellingTagService.getMap(counsellingTagLambdaQueryWrapper.in(CounsellingTag::getId,counsellinginfoResponseDTO.getCounsellingTagIds().split(",")));
-//                    if (ObjectUtil.isNotEmpty(map)){
-                    counsellinginfoResponseDTO.setCounsellingTagNames(tagNames);
-//                    }
-                }
-                counsellinginfoResponseDTO.setPersonalProfile(null);
-
-                counsellinginfoResponseDTO.setNikeName(customerList.stream().filter(cus -> counsellinginfoResponseDTO.getUserId().longValue() == cus.getCustomerId().longValue()).findFirst().get().getNickName());
-
-//                BigDecimal lowPrice = this.counsellingSetMealService.getObj(new QueryWrapper<CounsellingSetMeal>().select(" counselling_info_id counsellingInfoId,IFNULL(min(price),0) price ").lambda().eq(CounsellingSetMeal::getCounsellingInfoId,counsellinginfoResponseDTO.getId())
-//                        .eq(CounsellingSetMeal::getSetMealType,1).eq(CounsellingSetMeal::getIsDelete,0),Convert::toBigDecimal);
-
-
-                if (CollectionUtil.isNotEmpty(lowMapList)){
-                    lowMapList.stream().forEach(stringObjectMap -> {
-                        if (stringObjectMap.get("counsellingInfoId") != null){
-                            counsellinginfoResponseDTO.setLowPrice(new BigDecimal(stringObjectMap.get("price").toString()));
-                        }
-                    });
-                    if (counsellinginfoResponseDTO.getLowPrice() == null){
-                        counsellinginfoResponseDTO.setLowPrice(new BigDecimal(0));
-                    }
-                }
-
-
-            });
-            roleInfoCacheApi.put("customer",counsellinginfoResponseDTOS,600L);
-
-            return  new SuccessResponseData<>(counsellinginfoResponseDTOS);
-        }
-
-        return  new SuccessResponseData<>();
-
-
-
-
-
-
+    public ResponseData<PageResult<CounsellinginfoResponseDTO>> page(Integer pageNo, Integer pageSize,Integer searchType) {
+//        if (roleInfoCacheApi.get("customer:"+LoginContext.me().getLoginUser().getUserId())!=null){
+//            List<CounsellinginfoResponseDTO> customer = roleInfoCacheApi.get("customer:"+LoginContext.me().getLoginUser().getUserId());
+//            return  new SuccessResponseData<>(customer);
+//        }
+//
 //        LambdaQueryWrapper<CounsellingInfo> lambdaQueryWrapper = new LambdaQueryWrapper<CounsellingInfo>().eq(CounsellingInfo::getIsDelete,false)
-//                    .orderByDesc(CounsellingInfo::getSort,CounsellingInfo::getCreateTime).eq(CounsellingInfo::getListingStatus,1);
+//                .orderByDesc(CounsellingInfo::getSort,CounsellingInfo::getCreateTime).eq(CounsellingInfo::getListingStatus,1);
 //        //默认普通查询
 //        if (searchType != null  && searchType.intValue() == 1){
 //            List<Customer> customerList = customerService.getWorkerListByLineStatusAndPost(null, null, PostIdEnum.PO_22.getCode(), CustomerWorkStatusEnum.ON_WORK.getCode());
@@ -279,9 +196,9 @@
 //                lambdaQueryWrapper.in(CounsellingInfo::getUserId,customerIds);
 //            }
 //        }
-//        Page<CounsellingInfo> page = this.counsellingInfoService.page(PageFactory.defaultPage(), lambdaQueryWrapper);
-//        if (CollectionUtil.isNotEmpty(page.getRecords())){
-//            List<Long> counseIds = page.getRecords().stream().map(CounsellingInfo::getId).collect(Collectors.toList());
+//        List<CounsellingInfo> page = this.counsellingInfoService.list(lambdaQueryWrapper);
+//        if (CollectionUtil.isNotEmpty(page)){
+//            List<Long> counseIds = page.stream().map(CounsellingInfo::getId).collect(Collectors.toList());
 //            QueryWrapper<CounsellingOrder> orderQueryWrapper = new QueryWrapper<CounsellingOrder>().select("counselling_info_id counsellingInfoId,count(1) num ");
 //            //查询是否首次咨询
 //            orderQueryWrapper.lambda().eq(CounsellingOrder::getUserId,LoginContext.me().getLoginUser().getUserId()).in(CounsellingOrder::getStatusFlag,1,2).in(CounsellingOrder::getCounsellingInfoId,counseIds)
@@ -297,14 +214,14 @@
 //            //查询标签总条数
 //            List<CounsellingTag> counsellingTags = this.counsellingTagService.list(new LambdaQueryWrapper<CounsellingTag>()
 //                    .select(CounsellingTag::getId,CounsellingTag::getTagName));
-//            List<Long> custommerIds = page.getRecords().stream().map(CounsellingInfo::getUserId).collect(Collectors.toList());
+//            List<Long> custommerIds = page.stream().map(CounsellingInfo::getUserId).collect(Collectors.toList());
 //            //查询客户ids
 //            List<Customer> customerList = this.customerService.list(new LambdaQueryWrapper<Customer>().select(Customer::getCustomerId,Customer::getNickName).in(Customer::getCustomerId,custommerIds));
 //            //查询套餐最低价
 //            List<Map<String,Object>> lowMapList = this.counsellingSetMealService.listMaps(new QueryWrapper<CounsellingSetMeal>().select(" counselling_info_id counsellingInfoId,IFNULL(min(price),0) price ").lambda().in(CounsellingSetMeal::getCounsellingInfoId,counseIds)
 //                    .eq(CounsellingSetMeal::getSetMealType,1).eq(CounsellingSetMeal::getIsDelete,0));
 //
-//            List<CounsellinginfoResponseDTO> counsellinginfoResponseDTOS = BeanUtil.copyToList(page.getRecords(),CounsellinginfoResponseDTO.class, CopyOptions.create());
+//            List<CounsellinginfoResponseDTO> counsellinginfoResponseDTOS = BeanUtil.copyToList(page,CounsellinginfoResponseDTO.class, CopyOptions.create());
 //            counsellinginfoResponseDTOS.stream().forEach(counsellinginfoResponseDTO -> {
 //                if (fristMap.get(counsellinginfoResponseDTO.getId()) != null){
 //                    counsellinginfoResponseDTO.setIsFirstBuy(true);
@@ -316,7 +233,7 @@
 ////                    LambdaQueryWrapper<CounsellingTag> counsellingTagLambdaQueryWrapper = new QueryWrapper<CounsellingTag>().select(" GROUP_CONCAT(tag_name)  tagName ").lambda();
 ////                    Map<String,Object> map = counsellingTagService.getMap(counsellingTagLambdaQueryWrapper.in(CounsellingTag::getId,counsellinginfoResponseDTO.getCounsellingTagIds().split(",")));
 ////                    if (ObjectUtil.isNotEmpty(map)){
-//                        counsellinginfoResponseDTO.setCounsellingTagNames(tagNames);
+//                    counsellinginfoResponseDTO.setCounsellingTagNames(tagNames);
 ////                    }
 //                }
 //                counsellinginfoResponseDTO.setPersonalProfile(null);
@@ -340,11 +257,94 @@
 //
 //
 //            });
+//            roleInfoCacheApi.put("customer:"+LoginContext.me().getLoginUser().getUserId(),counsellinginfoResponseDTOS,600L);
 //
-//            return  new SuccessResponseData<>(PageResultFactory.createPageResult(counsellinginfoResponseDTOS,page.getTotal(), Convert.toInt(page.getSize()),Convert.toInt(page.getCurrent())));
+//            return  new SuccessResponseData<>(counsellinginfoResponseDTOS);
 //        }
 //
-//        return  new SuccessResponseData<>(PageResultFactory.createPageResult(new ArrayList<CounsellinginfoResponseDTO>(),page.getTotal(), Convert.toInt(page.getSize()),Convert.toInt(page.getCurrent())));
+//        return  new SuccessResponseData<>();
+
+
+
+
+
+
+        LambdaQueryWrapper<CounsellingInfo> lambdaQueryWrapper = new LambdaQueryWrapper<CounsellingInfo>().eq(CounsellingInfo::getIsDelete,false)
+                    .orderByDesc(CounsellingInfo::getSort,CounsellingInfo::getCreateTime).eq(CounsellingInfo::getListingStatus,1);
+        //默认普通查询
+        if (searchType != null  && searchType.intValue() == 1){
+            List<Customer> customerList = customerService.getWorkerListByLineStatusAndPost(null, null, PostIdEnum.PO_22.getCode(), CustomerWorkStatusEnum.ON_WORK.getCode());
+            if (CollectionUtil.isNotEmpty(customerList)){
+                List<Long> customerIds = customerList.stream().map(Customer::getCustomerId).collect(Collectors.toList());
+                lambdaQueryWrapper.in(CounsellingInfo::getUserId,customerIds);
+            }
+        }
+        Page<CounsellingInfo> page = this.counsellingInfoService.page(PageFactory.defaultPage(), lambdaQueryWrapper);
+        if (CollectionUtil.isNotEmpty(page.getRecords())){
+            List<Long> counseIds = page.getRecords().stream().map(CounsellingInfo::getId).collect(Collectors.toList());
+            QueryWrapper<CounsellingOrder> orderQueryWrapper = new QueryWrapper<CounsellingOrder>().select("counselling_info_id counsellingInfoId,count(1) num ");
+            //查询是否首次咨询
+            orderQueryWrapper.lambda().eq(CounsellingOrder::getUserId,LoginContext.me().getLoginUser().getUserId()).in(CounsellingOrder::getStatusFlag,1,2).in(CounsellingOrder::getCounsellingInfoId,counseIds)
+                    .eq(CounsellingOrder::getOrderType,1).groupBy(CounsellingOrder::getCounsellingInfoId).having(" num > 0 ");
+            List<Map<String,Object>> mapList = this.counsellingOrderService.listMaps(orderQueryWrapper);
+            Map<Long,Object> fristMap = new HashMap<>();
+            if (CollectionUtil.isNotEmpty(mapList)){
+
+                mapList.stream().forEach(stringObjectMap -> {
+                    fristMap.put(Long.parseLong(stringObjectMap.get("counsellingInfoId").toString()),stringObjectMap.get("num"));
+                });
+            }
+            //查询标签总条数
+            List<CounsellingTag> counsellingTags = this.counsellingTagService.list(new LambdaQueryWrapper<CounsellingTag>()
+                    .select(CounsellingTag::getId,CounsellingTag::getTagName));
+            List<Long> custommerIds = page.getRecords().stream().map(CounsellingInfo::getUserId).collect(Collectors.toList());
+            //查询客户ids
+            List<Customer> customerList = this.customerService.list(new LambdaQueryWrapper<Customer>().select(Customer::getCustomerId,Customer::getNickName).in(Customer::getCustomerId,custommerIds));
+            //查询套餐最低价
+            List<Map<String,Object>> lowMapList = this.counsellingSetMealService.listMaps(new QueryWrapper<CounsellingSetMeal>().select(" counselling_info_id counsellingInfoId,IFNULL(min(price),0) price ").lambda().in(CounsellingSetMeal::getCounsellingInfoId,counseIds)
+                    .eq(CounsellingSetMeal::getSetMealType,1).eq(CounsellingSetMeal::getIsDelete,0));
+
+            List<CounsellinginfoResponseDTO> counsellinginfoResponseDTOS = BeanUtil.copyToList(page.getRecords(),CounsellinginfoResponseDTO.class, CopyOptions.create());
+            counsellinginfoResponseDTOS.stream().forEach(counsellinginfoResponseDTO -> {
+                if (fristMap.get(counsellinginfoResponseDTO.getId()) != null){
+                    counsellinginfoResponseDTO.setIsFirstBuy(true);
+                }
+                if (StrUtil.isNotBlank(counsellinginfoResponseDTO.getCounsellingTagIds())){
+                    List<String> counsellingTagList = Arrays.asList(counsellinginfoResponseDTO.getCounsellingTagIds().split(","));
+                    String tagNames = counsellingTags.stream().filter(cou -> counsellingTagList.contains(cou.getId().toString())).map(CounsellingTag::getTagName).collect(Collectors.joining(","));
+                    //获取课程标签名称
+//                    LambdaQueryWrapper<CounsellingTag> counsellingTagLambdaQueryWrapper = new QueryWrapper<CounsellingTag>().select(" GROUP_CONCAT(tag_name)  tagName ").lambda();
+//                    Map<String,Object> map = counsellingTagService.getMap(counsellingTagLambdaQueryWrapper.in(CounsellingTag::getId,counsellinginfoResponseDTO.getCounsellingTagIds().split(",")));
+//                    if (ObjectUtil.isNotEmpty(map)){
+                        counsellinginfoResponseDTO.setCounsellingTagNames(tagNames);
+//                    }
+                }
+                counsellinginfoResponseDTO.setPersonalProfile(null);
+
+                counsellinginfoResponseDTO.setNikeName(customerList.stream().filter(cus -> counsellinginfoResponseDTO.getUserId().longValue() == cus.getCustomerId().longValue()).findFirst().get().getNickName());
+
+//                BigDecimal lowPrice = this.counsellingSetMealService.getObj(new QueryWrapper<CounsellingSetMeal>().select(" counselling_info_id counsellingInfoId,IFNULL(min(price),0) price ").lambda().eq(CounsellingSetMeal::getCounsellingInfoId,counsellinginfoResponseDTO.getId())
+//                        .eq(CounsellingSetMeal::getSetMealType,1).eq(CounsellingSetMeal::getIsDelete,0),Convert::toBigDecimal);
+
+
+                if (CollectionUtil.isNotEmpty(lowMapList)){
+                    lowMapList.stream().forEach(stringObjectMap -> {
+                        if (stringObjectMap.get("counsellingInfoId") != null){
+                            counsellinginfoResponseDTO.setLowPrice(new BigDecimal(stringObjectMap.get("price").toString()));
+                        }
+                    });
+                    if (counsellinginfoResponseDTO.getLowPrice() == null){
+                        counsellinginfoResponseDTO.setLowPrice(new BigDecimal(0));
+                    }
+                }
+
+
+            });
+
+            return  new SuccessResponseData<>(PageResultFactory.createPageResult(counsellinginfoResponseDTOS,page.getTotal(), Convert.toInt(page.getSize()),Convert.toInt(page.getCurrent())));
+        }
+
+        return  new SuccessResponseData<>(PageResultFactory.createPageResult(new ArrayList<CounsellinginfoResponseDTO>(),page.getTotal(), Convert.toInt(page.getSize()),Convert.toInt(page.getCurrent())));
     }
 
 
diff --git a/rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CourseController.java b/rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CourseController.java
index 828b101..66c4d42 100644
--- a/rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CourseController.java
+++ b/rest/src/main/java/cn/stylefeng/rest/modular/user/controller/CourseController.java
@@ -120,13 +120,56 @@
         return new SuccessResponseData<>(course);
     }
     @Resource
-    private CacheOperatorApi<List<Object>> roleInfoCacheApi;
+    private CacheOperatorApi<List<CourseResponseDTO>> roleInfoCacheApi;
     /**
      * 获取课程管理列表(分页)
      */
     @ApiOperation("获取课程管理列表(分页)")
     @GetResource(name = "获取课程管理列表(分页)", path = "/page", requiredPermission = false)
     public ResponseData<PageResult<CourseResponseDTO>> page(CourseRequest courseRequest) {
+
+//        if (roleInfoCacheApi.get("course:"+LoginContext.me().getLoginUser().getUserId())!=null){
+//                return  new SuccessResponseData<>(roleInfoCacheApi.get("course:"+LoginContext.me().getLoginUser().getUserId()));
+//        }else {
+//            LambdaQueryWrapper<Course> lambdaQueryWrapper = new LambdaQueryWrapper<Course>().eq(Course::getIsDelete, false)
+//                    .orderByDesc(Course::getSort, Course::getCreateTime);
+//            if (courseRequest.getListingStatus() != null) {
+//                lambdaQueryWrapper.eq(Course::getListingStatus, courseRequest.getListingStatus());
+//            } else {
+//                lambdaQueryWrapper.eq(Course::getListingStatus, 1);
+//            }
+//            lambdaQueryWrapper.like(StrUtil.isNotBlank(courseRequest.getCourseName()), Course::getCourseName, courseRequest.getCourseName());
+//            List<Course> page = this.courseService.list( lambdaQueryWrapper);
+//
+//            if (CollectionUtil.isNotEmpty(page)) {
+//                List<CourseResponseDTO> courseResponseDTOList = BeanUtil.copyToList(page, CourseResponseDTO.class, CopyOptions.create());
+//                //查询当前人是否购买过课程
+//                List<CourseOrder> courseOrderList = this.courseOrderService.list(new LambdaQueryWrapper<CourseOrder>().select(CourseOrder::getCourseId).eq(CourseOrder::getUserId, LoginContext.me().getLoginUser().getUserId()).eq(CourseOrder::getStatusFlag, 1));
+//                if (CollectionUtil.isNotEmpty(courseOrderList)) {
+//                    List<Long> courseIds = courseOrderList.stream().map(CourseOrder::getCourseId).collect(Collectors.toList());
+//                    courseResponseDTOList.forEach(course1 -> {
+//                        if (courseIds.contains(course1.getId())) {
+//                            course1.setIsBuy(true);
+//                            CourseOrder courseOrder = this.courseOrderService.getOne(new LambdaQueryWrapper<CourseOrder>().select(CourseOrder::getId).eq(CourseOrder::getUserId, LoginContext.me().getLoginUser().getUserId()).eq(CourseOrder::getStatusFlag, 1)
+//                                    .eq(CourseOrder::getCourseId, course1.getId()).orderByAsc(CourseOrder::getPayTime)
+//                                    .last(" limit 1 "));
+//                            if (courseOrder != null) {
+//                                course1.setCourseOrderId(courseOrder.getId());
+//                            }
+//                        } else {
+//                            course1.setIsBuy(false);
+//                        }
+//                    });
+//                }
+//                roleInfoCacheApi.put("course:"+LoginContext.me().getLoginUser().getUserId(),courseResponseDTOList,600L);
+//                return new SuccessResponseData<>(courseResponseDTOList);
+//            }
+//
+//        }
+//        return new SuccessResponseData<>();
+
+        //缓存
+//
 //        List<Object> course = roleInfoCacheApi.get("course");
 //        return new SuccessResponseData<>(course);
 

--
Gitblit v1.7.1