diff --git a/pom.xml b/pom.xml index bcb9810..bba6a0b 100644 --- a/pom.xml +++ b/pom.xml @@ -63,6 +63,12 @@ + + + com.hynnet + jacob + 1.18 + com.google.apis diff --git a/src/main/java/com/peanut/modules/bookAbroad/controller/HomeController.java b/src/main/java/com/peanut/modules/bookAbroad/controller/HomeController.java index dcfc6d3..820c654 100644 --- a/src/main/java/com/peanut/modules/bookAbroad/controller/HomeController.java +++ b/src/main/java/com/peanut/modules/bookAbroad/controller/HomeController.java @@ -3,19 +3,20 @@ package com.peanut.modules.bookAbroad.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.yulichang.wrapper.MPJLambdaWrapper; -import com.peanut.common.utils.DateUtil; import com.peanut.common.utils.R; import com.peanut.common.utils.ShiroUtils; import com.peanut.modules.book.service.*; +import com.peanut.modules.common.dao.ShopProductCourseDao; import com.peanut.modules.common.entity.*; import com.peanut.modules.common.service.UserEbookVipService; import com.peanut.modules.master.service.BookAbroadToLableService; 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.service.SysDictDataService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; -import org.apache.http.client.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -53,6 +54,82 @@ public class HomeController { private UserEbookVipService userEbookVipService; @Autowired private SysDictDataService sysDictDataService; + @Autowired + private CourseService courseService; + @Autowired + private CourseCatalogueService courseCatalogueService; + @Autowired + private ShopProductCourseDao shopProductCourseDao; + + //图书搜索 + @RequestMapping("/searchBook") + public R searchBook(@RequestBody Map params){ + if ("".equals(params.get("title"))) { + return R.error("搜索内容不能为空"); + } + MPJLambdaWrapper 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> list = toLableService.listMaps(wrapper); +// for (Map map : list) { +// long readCount = bookReadRateService.count(new LambdaQueryWrapper() +// .eq(BookReadRateEntity::getBookId,map.get("bookId"))); +// long buyCount = userEbookBuyService.count(new LambdaQueryWrapper() +// .eq(UserEbookBuyEntity::getBookId,map.get("bookId"))); +// long listenCount = bookListeningService.count(new LambdaQueryWrapper() +// .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() +// .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 params) { + if ("".equals(params.get("title"))) { + return R.error("搜索内容不能为空"); + } + MPJLambdaWrapper 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> courseEntities = courseService.listMaps(wrapper); +// for (Map map : courseEntities) { +// List courseCatalogueEntities = courseCatalogueService.list(new LambdaQueryWrapper() +// .eq(CourseCatalogueEntity::getCourseId, map.get("id")) +// .orderByAsc(CourseCatalogueEntity::getSort)); +// for (CourseCatalogueEntity co : courseCatalogueEntities){ +// MPJLambdaWrapper shopProductCourseEntityMPJLambdaWrapper = new MPJLambdaWrapper<>(); +// shopProductCourseEntityMPJLambdaWrapper.selectAll(ShopProduct.class); +// shopProductCourseEntityMPJLambdaWrapper.leftJoin(ShopProduct.class,ShopProduct::getProductId,ShopProductCourseEntity::getProductId); +// shopProductCourseEntityMPJLambdaWrapper.eq(ShopProductCourseEntity::getCatalogueId,co.getId()); +// List shopProducts = shopProductCourseDao.selectJoinList(ShopProduct.class, shopProductCourseEntityMPJLambdaWrapper); +// co.setProductList(shopProducts); +// } +// map.put("courseCatalogueEntityList",courseCatalogueEntities); +// } + return R.ok().put("courseEntities", courseEntities); + } //我的图书 @RequestMapping("/getMyBooks") @@ -211,12 +288,23 @@ public class HomeController { return R.ok().put("bookInfo",bookEntity); } + //获取图书有哪些语言 + @RequestMapping("/getBookLanguage") + public R getBookLanguage(@RequestBody Map params) { + List languageList = bookChapterService.list(new LambdaQueryWrapper() + .select(BookChapterEntity::getLanguage) + .eq(BookChapterEntity::getBookId,params.get("bookId")) + .groupBy(BookChapterEntity::getLanguage)); + return R.ok().put("languageList",languageList); + } + //图书章节 @RequestMapping("/getBookChapter") public R getBookChapter(@RequestBody Map params) { + String language = params.containsKey("language")?params.get("language").toString():"中文"; List chapterList = bookChapterService.list(new LambdaQueryWrapper() .eq(BookChapterEntity::getBookId,params.get("bookId")) - .eq(params.containsKey("language"),BookChapterEntity::getLanguage,params.get("language")) + .eq(BookChapterEntity::getLanguage,language) .orderByAsc(BookChapterEntity::getId)); return R.ok().put("chapterList",chapterList); } @@ -333,7 +421,7 @@ public class HomeController { Page orders = buyOrderService.page(new Page<>( Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),new LambdaQueryWrapper() .eq(BuyOrder::getUserId,ShiroUtils.getUId()) - .eq(BuyOrder::getCome,3) + .eq(BuyOrder::getCome,10) .eq(BuyOrder::getOrderType,"abroadBook") .eq(BuyOrder::getOrderStatus,"3") .orderByDesc(BuyOrder::getOrderId)); diff --git a/src/main/java/com/peanut/modules/medical/service/impl/CourseServiceImpl.java b/src/main/java/com/peanut/modules/medical/service/impl/CourseServiceImpl.java index df9708c..7733338 100644 --- a/src/main/java/com/peanut/modules/medical/service/impl/CourseServiceImpl.java +++ b/src/main/java/com/peanut/modules/medical/service/impl/CourseServiceImpl.java @@ -80,8 +80,8 @@ public class CourseServiceImpl extends ServiceImpl impl public List getUserLateCourseList(ParamTo param) { MPJLambdaWrapper wrapper = new MPJLambdaWrapper<>(); wrapper.selectAll(CourseEntity.class); + wrapper.selectAs(UserToCourseEntity::getUpdateTime,"endTime"); wrapper.distinct(); - wrapper.leftJoin(CourseToMedicine.class, CourseToMedicine::getCourseId,CourseEntity::getId); wrapper.leftJoin(UserToCourseEntity.class,UserToCourseEntity::getCourseId,CourseEntity::getId); wrapper.eq(UserToCourseEntity::getUserId,param.getId()); wrapper.orderByDesc(UserToCourseEntity::getUpdateTime);