首页搜索、图书语言设置、观看记录、文字转语音
This commit is contained in:
6
pom.xml
6
pom.xml
@@ -63,6 +63,12 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<!--文字转语音离线工具,windows平台-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.hynnet</groupId>
|
||||||
|
<artifactId>jacob</artifactId>
|
||||||
|
<version>1.18</version>
|
||||||
|
</dependency>
|
||||||
<!--谷歌支付-->
|
<!--谷歌支付-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.apis</groupId>
|
<groupId>com.google.apis</groupId>
|
||||||
|
|||||||
@@ -3,19 +3,20 @@ package com.peanut.modules.bookAbroad.controller;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.peanut.common.utils.DateUtil;
|
|
||||||
import com.peanut.common.utils.R;
|
import com.peanut.common.utils.R;
|
||||||
import com.peanut.common.utils.ShiroUtils;
|
import com.peanut.common.utils.ShiroUtils;
|
||||||
import com.peanut.modules.book.service.*;
|
import com.peanut.modules.book.service.*;
|
||||||
|
import com.peanut.modules.common.dao.ShopProductCourseDao;
|
||||||
import com.peanut.modules.common.entity.*;
|
import com.peanut.modules.common.entity.*;
|
||||||
import com.peanut.modules.common.service.UserEbookVipService;
|
import com.peanut.modules.common.service.UserEbookVipService;
|
||||||
import com.peanut.modules.master.service.BookAbroadToLableService;
|
import com.peanut.modules.master.service.BookAbroadToLableService;
|
||||||
import com.peanut.modules.bookAbroad.service.BookAbroadLableService;
|
import com.peanut.modules.bookAbroad.service.BookAbroadLableService;
|
||||||
|
import com.peanut.modules.master.service.CourseCatalogueService;
|
||||||
|
import com.peanut.modules.medical.service.CourseService;
|
||||||
import com.peanut.modules.sys.entity.SysDictDataEntity;
|
import com.peanut.modules.sys.entity.SysDictDataEntity;
|
||||||
import com.peanut.modules.sys.service.SysDictDataService;
|
import com.peanut.modules.sys.service.SysDictDataService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.http.client.utils.DateUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -53,6 +54,82 @@ public class HomeController {
|
|||||||
private UserEbookVipService userEbookVipService;
|
private UserEbookVipService userEbookVipService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysDictDataService sysDictDataService;
|
private SysDictDataService sysDictDataService;
|
||||||
|
@Autowired
|
||||||
|
private CourseService courseService;
|
||||||
|
@Autowired
|
||||||
|
private CourseCatalogueService courseCatalogueService;
|
||||||
|
@Autowired
|
||||||
|
private ShopProductCourseDao shopProductCourseDao;
|
||||||
|
|
||||||
|
//图书搜索
|
||||||
|
@RequestMapping("/searchBook")
|
||||||
|
public R searchBook(@RequestBody Map<String,Object> params){
|
||||||
|
if ("".equals(params.get("title"))) {
|
||||||
|
return R.error("搜索内容不能为空");
|
||||||
|
}
|
||||||
|
MPJLambdaWrapper<BookAbroadToLable> wrapper = new MPJLambdaWrapper();
|
||||||
|
wrapper.leftJoin(BookEntity.class,BookEntity::getId,BookAbroadToLable::getBookId);
|
||||||
|
wrapper.selectAs(BookEntity::getId,"bookId");
|
||||||
|
wrapper.selectAs(BookEntity::getAbroadPriceId,"abroadPriceId");
|
||||||
|
wrapper.select(BookEntity::getImages);
|
||||||
|
wrapper.select(BookEntity::getName);
|
||||||
|
wrapper.select(BookEntity::getIsVip);
|
||||||
|
wrapper.like(BookEntity::getName,params.get("title"));
|
||||||
|
wrapper.orderByAsc(BookAbroadToLable::getSort);
|
||||||
|
List<Map<String,Object>> list = toLableService.listMaps(wrapper);
|
||||||
|
// for (Map<String, Object> map : list) {
|
||||||
|
// long readCount = bookReadRateService.count(new LambdaQueryWrapper<BookReadRateEntity>()
|
||||||
|
// .eq(BookReadRateEntity::getBookId,map.get("bookId")));
|
||||||
|
// long buyCount = userEbookBuyService.count(new LambdaQueryWrapper<UserEbookBuyEntity>()
|
||||||
|
// .eq(UserEbookBuyEntity::getBookId,map.get("bookId")));
|
||||||
|
// long listenCount = bookListeningService.count(new LambdaQueryWrapper<BookListeningEntity>()
|
||||||
|
// .eq(BookListeningEntity::getBookId,map.get("bookId")));
|
||||||
|
// map.put("readCount",readCount);
|
||||||
|
// map.put("buyCount",buyCount);
|
||||||
|
// map.put("listenCount",listenCount);
|
||||||
|
// map.put("isBuy",false);
|
||||||
|
// long count = userEbookBuyService.count(new LambdaQueryWrapper<UserEbookBuyEntity>()
|
||||||
|
// .eq(UserEbookBuyEntity::getUserId,ShiroUtils.getUId())
|
||||||
|
// .eq(UserEbookBuyEntity::getBookId,map.get("bookId")));
|
||||||
|
// if (count > 0) {
|
||||||
|
// map.put("isBuy",true);
|
||||||
|
// }
|
||||||
|
// SysDictDataEntity sysDictData = sysDictDataService.getById(map.get("abroadPriceId").toString());
|
||||||
|
// map.put("sysDictData",sysDictData);
|
||||||
|
// }
|
||||||
|
return R.ok().put("bookList",list);
|
||||||
|
}
|
||||||
|
|
||||||
|
//课程搜索
|
||||||
|
@RequestMapping("/searchCourse")
|
||||||
|
public R searchCourse(@RequestBody Map<String, Object> params) {
|
||||||
|
if ("".equals(params.get("title"))) {
|
||||||
|
return R.error("搜索内容不能为空");
|
||||||
|
}
|
||||||
|
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
|
||||||
|
wrapper.leftJoin(CourseCatalogueEntity.class,CourseCatalogueEntity::getCourseId,CourseEntity::getId);
|
||||||
|
wrapper.disableSubLogicDel().leftJoin(CourseToMedicine.class,CourseToMedicine::getCourseId,CourseEntity::getId);
|
||||||
|
wrapper.disableSubLogicDel().leftJoin(CourseToSociologyEntity.class,CourseToSociologyEntity::getCourseId,CourseEntity::getId);
|
||||||
|
wrapper.disableSubLogicDel().leftJoin(CourseToPsyche.class,CourseToPsyche::getCourseId,CourseEntity::getId);
|
||||||
|
wrapper.select("DISTINCT t.id,t.title,t.image,t.square_image squareImage,t.content");
|
||||||
|
wrapper.like(CourseEntity::getTitle,params.get("title").toString());
|
||||||
|
List<Map<String,Object>> courseEntities = courseService.listMaps(wrapper);
|
||||||
|
// for (Map<String,Object> map : courseEntities) {
|
||||||
|
// List<CourseCatalogueEntity> courseCatalogueEntities = courseCatalogueService.list(new LambdaQueryWrapper<CourseCatalogueEntity>()
|
||||||
|
// .eq(CourseCatalogueEntity::getCourseId, map.get("id"))
|
||||||
|
// .orderByAsc(CourseCatalogueEntity::getSort));
|
||||||
|
// for (CourseCatalogueEntity co : courseCatalogueEntities){
|
||||||
|
// MPJLambdaWrapper<ShopProductCourseEntity> shopProductCourseEntityMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
||||||
|
// shopProductCourseEntityMPJLambdaWrapper.selectAll(ShopProduct.class);
|
||||||
|
// shopProductCourseEntityMPJLambdaWrapper.leftJoin(ShopProduct.class,ShopProduct::getProductId,ShopProductCourseEntity::getProductId);
|
||||||
|
// shopProductCourseEntityMPJLambdaWrapper.eq(ShopProductCourseEntity::getCatalogueId,co.getId());
|
||||||
|
// List<ShopProduct> shopProducts = shopProductCourseDao.selectJoinList(ShopProduct.class, shopProductCourseEntityMPJLambdaWrapper);
|
||||||
|
// co.setProductList(shopProducts);
|
||||||
|
// }
|
||||||
|
// map.put("courseCatalogueEntityList",courseCatalogueEntities);
|
||||||
|
// }
|
||||||
|
return R.ok().put("courseEntities", courseEntities);
|
||||||
|
}
|
||||||
|
|
||||||
//我的图书
|
//我的图书
|
||||||
@RequestMapping("/getMyBooks")
|
@RequestMapping("/getMyBooks")
|
||||||
@@ -211,12 +288,23 @@ public class HomeController {
|
|||||||
return R.ok().put("bookInfo",bookEntity);
|
return R.ok().put("bookInfo",bookEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取图书有哪些语言
|
||||||
|
@RequestMapping("/getBookLanguage")
|
||||||
|
public R getBookLanguage(@RequestBody Map<String,Object> params) {
|
||||||
|
List<BookChapterEntity> languageList = bookChapterService.list(new LambdaQueryWrapper<BookChapterEntity>()
|
||||||
|
.select(BookChapterEntity::getLanguage)
|
||||||
|
.eq(BookChapterEntity::getBookId,params.get("bookId"))
|
||||||
|
.groupBy(BookChapterEntity::getLanguage));
|
||||||
|
return R.ok().put("languageList",languageList);
|
||||||
|
}
|
||||||
|
|
||||||
//图书章节
|
//图书章节
|
||||||
@RequestMapping("/getBookChapter")
|
@RequestMapping("/getBookChapter")
|
||||||
public R getBookChapter(@RequestBody Map<String,Object> params) {
|
public R getBookChapter(@RequestBody Map<String,Object> params) {
|
||||||
|
String language = params.containsKey("language")?params.get("language").toString():"中文";
|
||||||
List<BookChapterEntity> chapterList = bookChapterService.list(new LambdaQueryWrapper<BookChapterEntity>()
|
List<BookChapterEntity> chapterList = bookChapterService.list(new LambdaQueryWrapper<BookChapterEntity>()
|
||||||
.eq(BookChapterEntity::getBookId,params.get("bookId"))
|
.eq(BookChapterEntity::getBookId,params.get("bookId"))
|
||||||
.eq(params.containsKey("language"),BookChapterEntity::getLanguage,params.get("language"))
|
.eq(BookChapterEntity::getLanguage,language)
|
||||||
.orderByAsc(BookChapterEntity::getId));
|
.orderByAsc(BookChapterEntity::getId));
|
||||||
return R.ok().put("chapterList",chapterList);
|
return R.ok().put("chapterList",chapterList);
|
||||||
}
|
}
|
||||||
@@ -333,7 +421,7 @@ public class HomeController {
|
|||||||
Page<BuyOrder> orders = buyOrderService.page(new Page<>(
|
Page<BuyOrder> orders = buyOrderService.page(new Page<>(
|
||||||
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),new LambdaQueryWrapper<BuyOrder>()
|
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),new LambdaQueryWrapper<BuyOrder>()
|
||||||
.eq(BuyOrder::getUserId,ShiroUtils.getUId())
|
.eq(BuyOrder::getUserId,ShiroUtils.getUId())
|
||||||
.eq(BuyOrder::getCome,3)
|
.eq(BuyOrder::getCome,10)
|
||||||
.eq(BuyOrder::getOrderType,"abroadBook")
|
.eq(BuyOrder::getOrderType,"abroadBook")
|
||||||
.eq(BuyOrder::getOrderStatus,"3")
|
.eq(BuyOrder::getOrderStatus,"3")
|
||||||
.orderByDesc(BuyOrder::getOrderId));
|
.orderByDesc(BuyOrder::getOrderId));
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
|||||||
public List<CourseEntity> getUserLateCourseList(ParamTo param) {
|
public List<CourseEntity> getUserLateCourseList(ParamTo param) {
|
||||||
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
|
MPJLambdaWrapper<CourseEntity> wrapper = new MPJLambdaWrapper<>();
|
||||||
wrapper.selectAll(CourseEntity.class);
|
wrapper.selectAll(CourseEntity.class);
|
||||||
|
wrapper.selectAs(UserToCourseEntity::getUpdateTime,"endTime");
|
||||||
wrapper.distinct();
|
wrapper.distinct();
|
||||||
wrapper.leftJoin(CourseToMedicine.class, CourseToMedicine::getCourseId,CourseEntity::getId);
|
|
||||||
wrapper.leftJoin(UserToCourseEntity.class,UserToCourseEntity::getCourseId,CourseEntity::getId);
|
wrapper.leftJoin(UserToCourseEntity.class,UserToCourseEntity::getCourseId,CourseEntity::getId);
|
||||||
wrapper.eq(UserToCourseEntity::getUserId,param.getId());
|
wrapper.eq(UserToCourseEntity::getUserId,param.getId());
|
||||||
wrapper.orderByDesc(UserToCourseEntity::getUpdateTime);
|
wrapper.orderByDesc(UserToCourseEntity::getUpdateTime);
|
||||||
|
|||||||
Reference in New Issue
Block a user