diff --git a/src/main/java/com/peanut/modules/book/controller/BookChapterContentController.java b/src/main/java/com/peanut/modules/book/controller/BookChapterContentController.java index 55931e66..cd23619e 100644 --- a/src/main/java/com/peanut/modules/book/controller/BookChapterContentController.java +++ b/src/main/java/com/peanut/modules/book/controller/BookChapterContentController.java @@ -2,7 +2,6 @@ package com.peanut.modules.book.controller; import java.io.File; import java.io.FileInputStream; -import java.io.InputStream; import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -16,7 +15,6 @@ import com.peanut.modules.book.service.*; import com.peanut.modules.oss.service.OssService; import lombok.SneakyThrows; import org.apache.commons.io.IOUtils; -import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mock.web.MockMultipartFile; import org.springframework.web.bind.annotation.PathVariable; @@ -31,8 +29,6 @@ import org.springframework.web.multipart.MultipartFile; /** - * - * * @author yl * @email yl328572838@163.com * @date 2022-08-16 14:32:06 @@ -53,27 +49,24 @@ public class BookChapterContentController { @Autowired private UserEbookBuyService userEbookBuyService; @Autowired - private ShopProudictBookService shopProudictBookService; + private ShopProductBookService shopProductBookService; /** * 列表 */ @RequestMapping("/list") -// @RequiresPermissions("book:bookchaptercontent:list") - public R list(@RequestParam Map params){ + public R list(@RequestParam Map params) { PageUtils page = bookChapterContentService.queryPage(params); return R.ok().put("page", page); } - /** * 信息 */ @RequestMapping("/info/{id}") -// @RequiresPermissions("book:bookchaptercontent:info") - public R info(@PathVariable("id") Integer id){ - BookChapterContentEntity bookChapterContent = bookChapterContentService.getById(id); + public R info(@PathVariable("id") Integer id) { + BookChapterContentEntity bookChapterContent = bookChapterContentService.getById(id); return R.ok().put("bookChapterContent", bookChapterContent); } @@ -82,9 +75,8 @@ public class BookChapterContentController { * 保存 */ @RequestMapping("/save") -// @RequiresPermissions("book:bookchaptercontent:save") - public R save(@RequestBody BookChapterContentEntity bookChapterContent){ - bookChapterContentService.save(bookChapterContent); + public R save(@RequestBody BookChapterContentEntity bookChapterContent) { + bookChapterContentService.save(bookChapterContent); return R.ok(); } @@ -93,9 +85,8 @@ public class BookChapterContentController { * 修改 */ @RequestMapping("/update") -// @RequiresPermissions("book:bookchaptercontent:update") - public R update(@RequestBody BookChapterContentEntity bookChapterContent){ - bookChapterContentService.updateById(bookChapterContent); + public R update(@RequestBody BookChapterContentEntity bookChapterContent) { + bookChapterContentService.updateById(bookChapterContent); return R.ok(); } @@ -104,9 +95,8 @@ public class BookChapterContentController { * 删除 */ @RequestMapping("/delete") -// @RequiresPermissions("book:bookchaptercontent:delete") - public R delete(@RequestBody Integer[] ids){ - bookChapterContentService.removeByIds(Arrays.asList(ids)); + public R delete(@RequestBody Integer[] ids) { + bookChapterContentService.removeByIds(Arrays.asList(ids)); return R.ok(); } @@ -116,17 +106,10 @@ public class BookChapterContentController { * 章节拆分转换单句 */ @RequestMapping("/getBookVoices") -// @RequiresPermissions("book:bookchaptercontent:delete") - public R getBookVoices(@RequestParam("id") Integer id){ + public R getBookVoices(@RequestParam("id") Integer id) { ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor(); - singleThreadExecutor.execute(new Runnable() { - @Override - public void run() { - bookChapterContentService.getWordChapterParagraph(id); - - } - }); + singleThreadExecutor.execute(() -> bookChapterContentService.getWordChapterParagraph(id)); BookEntity bookEntity = bookService.getBaseMapper().selectById(id); bookEntity.setContentStatus("2"); @@ -134,6 +117,7 @@ public class BookChapterContentController { return R.ok(); } + /** * 章节单句 转成音频 */ @@ -146,21 +130,16 @@ public class BookChapterContentController { return R.error("语音文件未生成"); } FileInputStream fileInputStream = new FileInputStream(file); - - - MultipartFile multipartFile =new MockMultipartFile("file", file.getName(), "text/plain", IOUtils.toByteArray(fileInputStream)); - + MultipartFile multipartFile = new MockMultipartFile("file", file.getName(), "text/plain", IOUtils.toByteArray(fileInputStream)); String path = ossService.uploadFileAvatar(multipartFile); - fileInputStream.close(); - file.delete(); - if (StringUtils.isEmpty(path)){ + if (StringUtils.isEmpty(path)) { return R.error("语音上传失败"); } - return R.ok().put("voices",path); + return R.ok().put("voices", path); } /** @@ -180,7 +159,7 @@ public class BookChapterContentController { List book_id = bookChapterContentService.getBaseMapper().selectList(new QueryWrapper() .eq("book_id", id)); - for (BookChapterContentEntity bookContent:book_id) { + for (BookChapterContentEntity bookContent : book_id) { String content = bookContent.getContent(); //生成相应的语音文件 String voices = BaiduVoicesUtils.run(content); @@ -193,9 +172,9 @@ public class BookChapterContentController { //把 voices 音频文件读入到内存中并将其转换成MultipartFile格式文件 multipartFile 用于OSS上传 // application/x-www-form-urlencoded form表单数据被编码为key/value格式发送到服务器 - // text/plain 纯文本格式 + // text/plain 纯文本格式 // MultipartFile multipartFile =new MockMultipartFile("file", file.getName(), "text/plain", IOUtils.toByteArray(fileInputStream)); - MultipartFile multipartFile =new MockMultipartFile("file", file.getName(), "text/plain", IOUtils.toByteArray(fileInputStream)); + MultipartFile multipartFile = new MockMultipartFile("file", file.getName(), "text/plain", IOUtils.toByteArray(fileInputStream)); //上传 multipartFile 文件到阿里云OSS上 String path = ossService.uploadFileAvatar(multipartFile); @@ -206,7 +185,7 @@ public class BookChapterContentController { file.delete(); bookChapterContentService.updateById(bookContent); - if (StringUtils.isEmpty(path)){ + if (StringUtils.isEmpty(path)) { bookEntity.setVoicesStatus("3"); } } @@ -235,7 +214,7 @@ public class BookChapterContentController { List book_id = bookChapterService.getBaseMapper().selectList(new QueryWrapper().eq("book_id", id)); - for (BookChapterEntity bookChapter:book_id) { + for (BookChapterEntity bookChapter : book_id) { String content = bookChapter.getContent(); //生成相应的语音文件 String voices = BaiduVoicesUtils.run(content); @@ -245,7 +224,7 @@ public class BookChapterContentController { bookEntity.setVoicesStatus("3"); } FileInputStream fileInputStream = new FileInputStream(file); - MultipartFile multipartFile =new MockMultipartFile("file", file.getName(), "text/plain", IOUtils.toByteArray(fileInputStream)); + MultipartFile multipartFile = new MockMultipartFile("file", file.getName(), "text/plain", IOUtils.toByteArray(fileInputStream)); //上传 multipartFile 文件到阿里云OSS上 String path = ossService.uploadFileAvatar(multipartFile); @@ -256,7 +235,7 @@ public class BookChapterContentController { file.delete(); bookChapterService.updateById(bookChapter); - if (StringUtils.isEmpty(path)){ + if (StringUtils.isEmpty(path)) { bookEntity.setVoicesStatus("3"); } } @@ -271,14 +250,15 @@ public class BookChapterContentController { /** * 鉴权获取章节 + * * @param bookid * @param userId * @return */ @RequestMapping("/getBooksCatal") public R getBooksCatal(@RequestParam("id") Integer id, - @RequestParam("bookid") Integer bookid, - @RequestParam("userId") Integer userId) { + @RequestParam("bookid") Integer bookid, + @RequestParam("userId") Integer userId) { // TODO 验证 当前请求的书 是否存在免费章节数 BookEntity bookEntity = bookService.getBaseMapper().selectById(bookid); Integer freeChapterCount = bookEntity.getFreeChapterCount(); @@ -294,7 +274,7 @@ public class BookChapterContentController { String vip = user.getVip(); if (!"1".equals(vip)) { - return R.error("当前为VIP"); + return R.error("当前为VIP"); } } @@ -308,14 +288,14 @@ public class BookChapterContentController { return R.error(500, "请购买书籍!"); } } - if(isVip == 3){ - boolean b = myUserService.bookAuthenticate(bookid,userId); - if (!b){ + if (isVip == 3) { + boolean b = myUserService.bookAuthenticate(bookid, userId); + if (!b) { List book = bookChapterService.getBaseMapper().selectList(new QueryWrapper() .eq("book_id", bookid)); ArrayList chapterList = new ArrayList<>(); - int chapterIndex=0; + int chapterIndex = 0; for (BookChapterEntity chapter : book) { if (chapterIndex >= freeChapterCount) { break; // 取出前freeChapterCount条记录后,退出循环 @@ -330,19 +310,18 @@ public class BookChapterContentController { chapterIndex++; } - return R.ok("当前为试听章节:"+chapterList).put("bookCatalogue", chapterList).put("image", bookEntity.getImages()).put("chapterIndex",chapterIndex); + return R.ok("当前为试听章节:" + chapterList).put("bookCatalogue", chapterList).put("image", bookEntity.getImages()).put("chapterIndex", chapterIndex); } } - List book = bookChapterService.getBaseMapper().selectList(new QueryWrapper() .eq("book_id", bookid)); ArrayList chapterList = new ArrayList<>(); for (BookChapterEntity chapter : book) { Map map = new HashMap<>(); - map.put("name",chapter.getChapter()); - map.put("url",chapter.getVoices()); + map.put("name", chapter.getChapter()); + map.put("url", chapter.getVoices()); chapterList.add(map); } return R.ok().put("bookCatalogue", chapterList).put("image", bookEntity.getImages()); @@ -351,128 +330,114 @@ public class BookChapterContentController { /** * 获取章节音频地址 + * * @return */ @RequestMapping("/getBooksCatalogue") public R getBooksCatalogue(@RequestParam Integer chapterId, @RequestParam Integer bookId, - @RequestParam Integer userId){ + @RequestParam Integer userId) { //鉴权阶段 BookEntity book_info = bookService.getById(bookId); BookChapterEntity chapter_info = bookChapterService.getById(chapterId); UserEbookBuyEntity userEbookBuyEntity = userEbookBuyService.getBaseMapper().selectOne(new LambdaQueryWrapper(). - eq(UserEbookBuyEntity::getUserId,userId).eq(UserEbookBuyEntity::getBookId,bookId)); - if(chapter_info.getNumber()>book_info.getFreeChapterCount()&&userEbookBuyEntity==null){ - Integer productByBookId = shopProudictBookService.getProductByBookId(bookId); - return R.ok().put("jq",false).put("product",productByBookId); + eq(UserEbookBuyEntity::getUserId, userId).eq(UserEbookBuyEntity::getBookId, bookId)); + if (chapter_info.getNumber() > book_info.getFreeChapterCount() && userEbookBuyEntity == null) { + Integer productByBookId = shopProductBookService.getProductByBookId(bookId); + return R.ok().put("jq", false).put("product", productByBookId); } - - return R.ok().put("chapter",chapter_info); + return R.ok().put("chapter", chapter_info); } -/** - * app 获取电子书章节内容 2.0 (在用鉴权) - */ -@RequestMapping("/appBooksChapterContent1") -public R getBooksCatalogue1(@RequestParam("chapterid") Integer id, - @RequestParam("bookid") Integer bookid, - @RequestParam("userId") Integer userId) { - // TODO 验证 当前请求的书 是否存在免费章节数 - BookEntity bookEntity = bookService.getBaseMapper().selectById(bookid); - Integer freeChapterCount = bookEntity.getFreeChapterCount(); + /** + * app 获取电子书章节内容 2.0 (在用鉴权) + */ + @RequestMapping("/appBooksChapterContent1") + public R getBooksCatalogue1(@RequestParam("chapterid") Integer id, + @RequestParam("bookid") Integer bookid, + @RequestParam("userId") Integer userId) { + // TODO 验证 当前请求的书 是否存在免费章节数 + BookEntity bookEntity = bookService.getBaseMapper().selectById(bookid); + Integer freeChapterCount = bookEntity.getFreeChapterCount(); - BookChapterEntity bookChapterEntity = bookChapterService.getBaseMapper().selectById(id); + BookChapterEntity bookChapterEntity = bookChapterService.getBaseMapper().selectById(id); - Integer number = bookChapterEntity.getNumber(); + Integer number = bookChapterEntity.getNumber(); - //TODO 0-免费 1-会免(改为电子书听书) 2-付费 // 阅读章节数 大于 免费章节数 - Integer isVip = bookEntity.getIsVip(); - Boolean canListen = bookEntity.getCanListen(); + //TODO 0-免费 1-会免(改为电子书听书) 2-付费 // 阅读章节数 大于 免费章节数 + Integer isVip = bookEntity.getIsVip(); + Boolean canListen = bookEntity.getCanListen(); - //todo 暂未开通听书功能 + //todo 暂未开通听书功能 // if (canListen==false) { // return R.error1("暂未开通听书功能"); // } - if ((number > freeChapterCount) || freeChapterCount == 0) { - // 书籍为 会免 + if ((number > freeChapterCount) || freeChapterCount == 0) { + // 书籍为 会免 - if (isVip == 1) { - //查询用户身份 - MyUserEntity user = myUserService.getById(userId); - String vip = user.getVip(); - if (!"1".equals(vip)) { + if (isVip == 1) { + //查询用户身份 + MyUserEntity user = myUserService.getById(userId); + String vip = user.getVip(); + if (!"1".equals(vip)) { - return R.error("当前为VIP"); + return R.error("当前为VIP"); } } - if(canListen == true){ - boolean b = myUserService.bookAuthenticate(bookid,userId); - if (!b) { + if (canListen == true) { + boolean b = myUserService.bookAuthenticate(bookid, userId); + if (!b) { - return R.error("未购买书籍!"); + return R.error("未购买书籍!"); + } } - } - - - } - - if (isVip == 2) { + if (isVip == 2) { // 鉴权 查询权限表中 用户是否开通 boolean b = myUserService.bookAuthenticate(bookid, userId); if (!b) { - return R.error(500, "请购买书籍!").put("code",500); + return R.error(500, "请购买书籍!").put("code", 500); } } - - ArrayList chapterList = new ArrayList<>(); - + ArrayList chapterList = new ArrayList<>(); Map map = new HashMap<>(); - map.put("name",bookChapterEntity.getChapter()); - map.put("url",bookChapterEntity.getVoices()); - map.put("bookid",bookChapterEntity.getBookId()); - map.put("chapterid",bookChapterEntity.getId()); + map.put("name", bookChapterEntity.getChapter()); + map.put("url", bookChapterEntity.getVoices()); + map.put("bookid", bookChapterEntity.getBookId()); + map.put("chapterid", bookChapterEntity.getId()); //todo sort先注释调 // map.put("sort",bookChapterEntity.getSort()); chapterList.add(map); - return R.ok().put("bookCatalogue", chapterList).put("image", bookEntity.getImages()); + return R.ok().put("bookCatalogue", chapterList).put("image", bookEntity.getImages()); } - - - - - - - - /** * app 获取电子书章节内容 */ @RequestMapping("/appGetBookChapterContent") public R getBookCatalogue(@RequestParam("chapterid") Integer chapterid, @RequestParam("bookid") Integer bookid, - @RequestParam("userId") Integer userId){ + @RequestParam("userId") Integer userId) { // TODO 验证 当前请求的书 是否存在免费章节数 BookEntity bookEntity = bookService.getBaseMapper().selectById(bookid); @@ -481,57 +446,56 @@ public R getBooksCatalogue1(@RequestParam("chapterid") Integer id, BookChapterEntity bookChapterEntity = bookChapterService.getBaseMapper().selectById(chapterid); Integer number = bookChapterEntity.getNumber(); // 阅读章节数 大于 免费章节数 - if ((number > freeChapterCount) || freeChapterCount ==0){ + if ((number > freeChapterCount) || freeChapterCount == 0) { if (isVip == 1) { MyUserEntity user = myUserService.getById(userId); String vip = user.getVip(); if (!"1".equals(vip)) { - return R.error(500,"当前书籍为会员书籍,请开通会员或购买!"); + return R.error(500, "当前书籍为会员书籍,请开通会员或购买!"); } } if (isVip == 2) { boolean b = myUserService.bookAuthenticate(bookid, userId); if (!b) { - return R.error(500,"请购买此书籍!"); + return R.error(500, "请购买此书籍!"); } } } - ArrayList list = new ArrayList<>(); List bookChapterContentEntities = bookChapterContentService.getBaseMapper().selectList(new QueryWrapper() - .eq("book_id",bookid) - .eq("book_chatper_id",chapterid)); + .eq("book_id", bookid) + .eq("book_chatper_id", chapterid)); for (BookChapterContentEntity bookChapterContentEntity : bookChapterContentEntities) { String content = bookChapterContentEntity.getContent(); String substring = ""; - if (bookChapterContentEntity.getOtherContent() != null){ - substring = bookChapterContentEntity.getOtherContent().replace("

","").replace("

",""); + if (bookChapterContentEntity.getOtherContent() != null) { + substring = bookChapterContentEntity.getOtherContent().replace("

", "").replace("

", ""); } StringBuffer stringBuffer = new StringBuffer(substring); - if(stringBuffer.indexOf("title") != -1){ - stringBuffer.insert(stringBuffer.indexOf("title"),"width=\"100%\""); + if (stringBuffer.indexOf("title") != -1) { + stringBuffer.insert(stringBuffer.indexOf("title"), "width=\"100%\""); } - if (bookChapterContentEntity.getNumber() == 1){ + if (bookChapterContentEntity.getNumber() == 1) { Integer bookChatperId = bookChapterContentEntity.getBookChatperId(); BookChapterEntity chapterEntity = bookChapterService.getById(bookChatperId); String chapter = chapterEntity.getChapter(); content = bookChapterContentEntity.getContent().replace(chapter, ""); } - bookChapterContentEntity.setPicAndWord(content.replaceAll(" ","") + stringBuffer); + bookChapterContentEntity.setPicAndWord(content.replaceAll(" ", "") + stringBuffer); list.add(bookChapterContentEntity); } - return R.ok().put("bookCatalogue",list); + return R.ok().put("bookCatalogue", list); } //生成电子书 目录 @RequestMapping("/getWordChapterParagraph") - public R getWordChapterParagraph(@RequestParam Map params){ + public R getWordChapterParagraph(@RequestParam Map params) { bookChapterContentService.getWordChapterParagraph(14); return R.ok(); } diff --git a/src/main/java/com/peanut/modules/book/controller/BookController.java b/src/main/java/com/peanut/modules/book/controller/BookController.java index a708c582..7a57a9ed 100644 --- a/src/main/java/com/peanut/modules/book/controller/BookController.java +++ b/src/main/java/com/peanut/modules/book/controller/BookController.java @@ -7,13 +7,11 @@ import java.util.stream.Collectors; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.peanut.common.utils.ReadProvinceUtil; import com.peanut.modules.book.dao.BookDao; import com.peanut.modules.book.entity.*; import com.peanut.modules.book.service.*; import com.peanut.modules.book.vo.BookIndexVo; -import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.web.bind.annotation.*; @@ -58,7 +56,7 @@ public class BookController { @Autowired private ShopProductService shopProductService; @Autowired - private ShopProudictBookService shopProudictBookService; + private ShopProductBookService shopProductBookService; @Autowired private ShopProductToLabelService shopProductToLabelService; final ExecutorService fixedThreadPool = Executors.newFixedThreadPool(10); @@ -123,7 +121,7 @@ public class BookController { BookEntity book_info = bookService.getById(bookId); book_info.setAuthor(authorService.getById(book_info.getAuthorId())); book_info.setPublisher(publisherService.getById(book_info.getPublisherId())); - book_info.setProductId(shopProudictBookService.getProductByBookId(bookId)); + book_info.setProductId(shopProductBookService.getProductByBookId(bookId)); LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(UserEbookBuyEntity::getUserId,userId); @@ -715,7 +713,7 @@ public class BookController { } Page bookEntityPage = bookService.getBaseMapper().selectPage(new Page<>(page, limit), wrapper1); for (BookEntity b : bookEntityPage.getRecords()){ - b.setProductId(shopProudictBookService.getProductByBookId(b.getId())); + b.setProductId(shopProductBookService.getProductByBookId(b.getId())); } return R.ok().put("page",bookEntityPage); diff --git a/src/main/java/com/peanut/modules/book/controller/BookTeachController.java b/src/main/java/com/peanut/modules/book/controller/BookTeachController.java index a2fbf3a8..65ed664a 100644 --- a/src/main/java/com/peanut/modules/book/controller/BookTeachController.java +++ b/src/main/java/com/peanut/modules/book/controller/BookTeachController.java @@ -7,16 +7,13 @@ import com.peanut.modules.book.entity.BookEntity; import com.peanut.modules.book.entity.BookTeachEntity; import com.peanut.modules.book.service.BookService; import com.peanut.modules.book.service.BookTeachService; -import com.peanut.modules.book.service.ShopProudictBookService; +import com.peanut.modules.book.service.ShopProductBookService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import java.util.ArrayList; -import java.util.List; - @RestController @RequestMapping("book/teach") public class BookTeachController { @@ -25,123 +22,82 @@ public class BookTeachController { @Autowired private BookService bookService; @Autowired - private ShopProudictBookService shopProudictBookService; + private ShopProductBookService shopProductBookService; /** * 获取讲书列表 + * * @return */ @RequestMapping("/getTeachBooks") - public R getTeachBooks(@RequestParam Integer limit,@RequestParam Integer page){ + public R getTeachBooks(@RequestParam Integer limit, @RequestParam Integer page) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(BookEntity::getDelFlag,0); - wrapper.eq(BookEntity::getTeachIn,1); + wrapper.eq(BookEntity::getDelFlag, 0); + wrapper.eq(BookEntity::getTeachIn, 1); Page bookEntityPage = bookService.getBaseMapper().selectPage(new Page(page, limit), wrapper); - return R.ok().put("page",bookEntityPage); + return R.ok().put("page", bookEntityPage); } /** * 获取讲书目录 + * * @return */ @RequestMapping("/getBookTeachItems") - public R getBookTeachItems(@RequestParam Integer bookId,@RequestParam Integer limit,@RequestParam Integer page){ + public R getBookTeachItems(@RequestParam Integer bookId, @RequestParam Integer limit, @RequestParam Integer page) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(BookTeachEntity::getBookId,bookId); - wrapper.eq(BookTeachEntity::getDelFlag,0); + wrapper.eq(BookTeachEntity::getBookId, bookId); + wrapper.eq(BookTeachEntity::getDelFlag, 0); wrapper.orderByAsc(BookTeachEntity::getChapter); Page bookTeachEntityPage = bookTeachService.getBaseMapper().selectPage(new Page(page, limit), wrapper); - return R.ok().put("page",bookTeachEntityPage); + return R.ok().put("page", bookTeachEntityPage); } /** * 获取讲书的详情 + * * @param teachId * @return */ @RequestMapping("/getTeachDetail") - public R getTeachDetail(@RequestParam Integer teachId){ + public R getTeachDetail(@RequestParam Integer teachId) { BookTeachEntity teach_info = bookTeachService.getById(teachId); - Integer productByBookId = shopProudictBookService.getProductByBookId(teach_info.getBookId()); - return R.ok().put("bookTeach",teach_info).put("product",productByBookId); + Integer productByBookId = shopProductBookService.getProductByBookId(teach_info.getBookId()); + return R.ok().put("bookTeach", teach_info).put("product", productByBookId); } - - - /** - * 添加讲书 - * @return - */ -// @RequestMapping("/addTeach") -// public R addTeach(@RequestParam Integer bookId, -// @RequestParam Integer chapter, -// @RequestParam String title, -// @RequestParam String voices, -// @RequestParam String content){ -// BookTeachEntity bookTeachEntity = new BookTeachEntity(); -// bookTeachEntity.setBookId(bookId); -// bookTeachEntity.setChapter(chapter); -// bookTeachEntity.setTitle(title); -// bookTeachEntity.setVoices(voices); -// bookTeachEntity.setContent(content); -// bookTeachService.save(bookTeachEntity); -// -// return R.ok(); -// } - /** * 添加讲书的章节 + * * @param bookTeach * @return */ @RequestMapping("/addTeach1") - public R addTeach1(@RequestBody BookTeachEntity bookTeach){ + public R addTeach1(@RequestBody BookTeachEntity bookTeach) { bookTeachService.save(bookTeach); return R.ok(); } /** * 删除讲书章节 + * * @return */ @RequestMapping("/delTeach") - public R delTeach(@RequestBody BookTeachEntity bookTeach){ + public R delTeach(@RequestBody BookTeachEntity bookTeach) { bookTeachService.removeById(bookTeach.getTeachId()); return R.ok(); } /** * 编辑讲书的章节 - * @return - */ -// @RequestMapping("/updateTeach") -// public R updateTeach(@RequestParam Integer teachId, -// @RequestParam Integer chapter, -// @RequestParam String title, -// @RequestParam String voices, -// @RequestParam String content){ -// -// BookTeachEntity bookTeachEntity = new BookTeachEntity(); -// bookTeachEntity.setTeachId(teachId); -// bookTeachEntity.setTitle(title); -// bookTeachEntity.setVoices(voices); -// bookTeachEntity.setContent(content); -// bookTeachService.updateById(bookTeachEntity); -// return R.ok(); -// -// } - - /** - * 编辑讲书的章节 + * * @return */ @RequestMapping("/updateTeach") - public R updateTeach(@RequestBody BookTeachEntity bookTeach){ + public R updateTeach(@RequestBody BookTeachEntity bookTeach) { bookTeachService.updateById(bookTeach); return R.ok(); } - - - } diff --git a/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java b/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java index f0141438..12fe0620 100644 --- a/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java +++ b/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java @@ -63,7 +63,7 @@ public class BuyOrderController { private RabbitTemplate rabbitTemplate; @Autowired - private ShopProudictBookService shopProudictBookService; + private ShopProductBookService shopProductBookService; /** * 列表 @@ -523,9 +523,9 @@ public class BuyOrderController { private void addEbookToUser(List products, BuyOrderEntity buyOrder) { List productIds = products.stream().map(BuyOrderDetailEntity::getProductId).collect(Collectors.toList()); for (Integer productId : productIds) { - List collect = shopProudictBookService.getBaseMapper().selectList(new LambdaQueryWrapper() - .eq(ShopProudictBookEntity::getProudictId, productId) - .eq(ShopProudictBookEntity::getDelFlag, 0)).stream().map(ShopProudictBookEntity::getBookId).collect(Collectors.toList()); + List collect = shopProductBookService.getBaseMapper().selectList(new LambdaQueryWrapper() + .eq(ShopProductBookEntity::getProductId, productId) + .eq(ShopProductBookEntity::getDelFlag, 0)).stream().map(ShopProductBookEntity::getBookId).collect(Collectors.toList()); userEbookBuyService.addBookForUser(buyOrder.getUserId(), collect); } } diff --git a/src/main/java/com/peanut/modules/book/controller/ShopProductBookController.java b/src/main/java/com/peanut/modules/book/controller/ShopProductBookController.java new file mode 100644 index 00000000..0c4e1699 --- /dev/null +++ b/src/main/java/com/peanut/modules/book/controller/ShopProductBookController.java @@ -0,0 +1,75 @@ +package com.peanut.modules.book.controller; + +import com.peanut.common.utils.PageUtils; +import com.peanut.common.utils.R; +import com.peanut.modules.book.entity.ShopProductBookEntity; +import com.peanut.modules.book.service.ShopProductBookService; +import com.peanut.modules.book.vo.ProductBookQueryVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("book/shopProudictBook") +public class ShopProductBookController { + @Autowired + private ShopProductBookService shopProductBookService; + + /** + * 列表 + */ + @RequestMapping("/list") + public R list(@RequestParam Map params) { + PageUtils page = shopProductBookService.queryPage(params); + return R.ok().put("page", page); + + } + + /** + * 图书与商品信息 + */ + // 根据商品id查询图书信息,查询到图书信息,反向查找包含该图书id的所有商品返回 + @RequestMapping("/proudictBooklist") + public R productBookList(@RequestParam Integer productId) { + List cartList = shopProductBookService.getCartList(productId); + return R.ok().put("cartList", cartList); + + } + + /** + * 保存 + */ + @RequestMapping("/save") + public R save(@RequestBody ShopProductBookEntity shopProductBookEntity) { + for (Integer s : shopProductBookEntity.getBookIdList()) { + if (s != null) { + Integer productId = shopProductBookEntity.getProductId(); + shopProductBookEntity.setProductId(productId); + shopProductBookEntity.setBookId(s); + shopProductBookService.save(shopProductBookEntity); + } + } + return R.ok(); + } + + /** + * 修改 + */ + @RequestMapping("/update") + public R update(@RequestBody ShopProductBookEntity shopProductBookEntity) { + + shopProductBookService.updateById(shopProductBookEntity); + return R.ok(); + } + + /** + * 删除 + */ + @RequestMapping("/delete") + public R delete(@RequestParam Integer id) { + shopProductBookService.removeById(id); + return R.ok(); + } +} diff --git a/src/main/java/com/peanut/modules/book/controller/ShopProductController.java b/src/main/java/com/peanut/modules/book/controller/ShopProductController.java index 128c8317..ff7a3691 100644 --- a/src/main/java/com/peanut/modules/book/controller/ShopProductController.java +++ b/src/main/java/com/peanut/modules/book/controller/ShopProductController.java @@ -1,6 +1,8 @@ package com.peanut.modules.book.controller; + import java.util.*; import java.util.stream.Collectors; + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.peanut.modules.book.entity.*; import com.peanut.modules.book.service.*; @@ -15,7 +17,6 @@ import com.peanut.common.utils.PageUtils; import com.peanut.common.utils.R; - /** * 商品表 * @@ -35,27 +36,25 @@ public class ShopProductController { @Autowired private BookService bookService; @Autowired - private ShopProudictBookService shopProudictBookService; + private ShopProductBookService shopProductBookService; @Autowired private ShopProductToLabelService shopProductToLabelService; - @Autowired - private ShopProductLabelService shopProductLabelService; /** - * 精选商品 列表 + * 精选商品 列表 */ @RequestMapping("/listproductSales") -// @RequiresPermissions("book:shopproduct:list") - public R listproductSales(@RequestParam Map params){ + public R listProductSales(@RequestParam Map params) { PageUtils page = shopProductService.queryPageproductSales(params); return R.ok().put("page", page); } + /** * 折扣商品 */ @RequestMapping("/listactivityprice") - public R listactivityprice(@RequestParam Map params){ + public R listActivityPrice(@RequestParam Map params) { PageUtils page = shopProductService.queryPageactivityprice(params); return R.ok().put("page", page); @@ -65,18 +64,17 @@ public class ShopProductController { * 列表 */ @RequestMapping("/list") -// @RequiresPermissions("book:shopproduct:list") - public R list(@RequestParam Map params){ + public R list(@RequestParam Map params) { PageUtils page = shopProductService.appQueryPage(params); return R.ok().put("page", page); -} + } /** * 查询列表 */ @RequestMapping("/selectList") - public R selectList(@RequestParam Map params){ + public R selectList(@RequestParam Map params) { PageUtils page = shopProductService.selectListqueryPage(params); return R.ok().put("page", page); @@ -90,19 +88,15 @@ public class ShopProductController { } - - - - - /** - * 未购买书列表 - * @param userId 用户id + * 未购买书列表 + * + * @param userId 用户id * @return */ @RequestMapping("/booklist") - public R booklistss(@RequestParam("userId") Integer userId - ) { + public R bookList(@RequestParam("userId") Integer userId + ) { //查询已购买的书籍 List buyOrderDetailEntities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper() .eq("user_id", userId)); @@ -118,17 +112,17 @@ public class ShopProductController { } //查询商品表并过滤已购买商品id,根据时间倒叙展示 List allProductEntities = shopProductService.getBaseMapper().selectList(new QueryWrapper() - .notIn("product_id", purchasedProductIds) - .orderByDesc("create_time") + .notIn("product_id", purchasedProductIds) + .orderByDesc("create_time") // .notLike("book_ids",",") - .isNotNull("book_ids") + .isNotNull("book_ids") ); List lists = new ArrayList<>(); for (ShopProductEntity product : allProductEntities) { Map productMap = new HashMap<>(); - productMap.put("product",product); + productMap.put("product", product); lists.add(productMap); } @@ -137,20 +131,17 @@ public class ShopProductController { } - - - @RequestMapping("/bookinfo/{productId}") - public R bookinfo(@PathVariable("productId") Integer productId){ - ArrayList> imagesUrl = new ArrayList>(); - List bookEntityList = shopProudictBookService.getBaseMapper().selectList(new QueryWrapper().eq("book_id", productId)); + public R bookInfo(@PathVariable("productId") Integer productId) { + ArrayList> imagesUrl = new ArrayList>(); + List bookEntityList = shopProductBookService.getBaseMapper().selectList(new QueryWrapper().eq("book_id", productId)); List list = new ArrayList<>(); ArrayList booklist = new ArrayList<>(); - ShopProductEntity shopProductEntity=null; - for (ShopProudictBookEntity shopProudictBookEntity : bookEntityList) { - Integer proudictId = shopProudictBookEntity.getProudictId(); + ShopProductEntity shopProductEntity = null; + for (ShopProductBookEntity shopProductBookEntity : bookEntityList) { + Integer proudictId = shopProductBookEntity.getProductId(); shopProductEntity = shopProductService.getBaseMapper().selectOne(new QueryWrapper().eq("product_id", proudictId)); - Integer bookId = shopProudictBookEntity.getBookId(); + Integer bookId = shopProductBookEntity.getBookId(); BookEntity byId = bookService.getById(bookId); booklist.add(String.valueOf(bookId)); list.add(byId); @@ -163,8 +154,6 @@ public class ShopProductController { } - - @RequestMapping("/bookinfolists/{productId}") public R bookinfolists(@PathVariable("productId") Integer productId) { //查询商品 @@ -176,31 +165,31 @@ public class ShopProductController { Integer productId1 = shopProductEntity.getProductId(); //分类信息 List poids = shopCategoryService.findPoid(poid); - List proudict = shopProudictBookService.getBaseMapper().selectList(new QueryWrapper() - .eq("proudict_id", productId1)); + List product = shopProductBookService.getBaseMapper().selectList(new QueryWrapper() + .eq("product_id", productId1)); List result = new ArrayList<>(); //获取商品id Set productIds = new HashSet<>(); productIds.add(productId); - for (ShopProudictBookEntity shopProudictBookEntity : proudict) { - Integer bookId = shopProudictBookEntity.getBookId(); + for (ShopProductBookEntity shopProductBookEntity : product) { + Integer bookId = shopProductBookEntity.getBookId(); BookEntity byId = bookService.getById(bookId); - List entityByBookId = shopProudictBookService.getBaseMapper().selectList(new QueryWrapper() + List entityByBookId = shopProductBookService.getBaseMapper().selectList(new QueryWrapper() .eq("book_id", bookId)); - for(ShopProudictBookEntity entity : entityByBookId){ - productIds.add(entity.getProudictId()); + for (ShopProductBookEntity entity : entityByBookId) { + productIds.add(entity.getProductId()); } } - for(Integer pId : productIds){ - ShopProductEntity proEntity =null; + for (Integer pId : productIds) { + ShopProductEntity proEntity = null; proEntity = shopProductService.getById(pId); - List pbookEntitys = shopProudictBookService.getBaseMapper().selectList(new QueryWrapper() - .eq("proudict_id", pId)); + List pbookEntitys = shopProductBookService.getBaseMapper().selectList(new QueryWrapper() + .eq("product_id", pId)); ArrayList booklist = new ArrayList<>(); List list = new ArrayList<>(); - for (ShopProudictBookEntity shopProudictBookEntity : pbookEntitys) { - booklist.add(String.valueOf(shopProudictBookEntity.getBookId())); - BookEntity byId = bookService.getById(shopProudictBookEntity.getBookId()); + for (ShopProductBookEntity shopProductBookEntity : pbookEntitys) { + booklist.add(String.valueOf(shopProductBookEntity.getBookId())); + BookEntity byId = bookService.getById(shopProductBookEntity.getBookId()); list.add(byId); } proEntity.setPoids(poids); @@ -214,6 +203,7 @@ public class ShopProductController { /** * 获取关联订单列表 + * * @param productId * @return */ @@ -221,45 +211,46 @@ public class ShopProductController { public R getGlProductList(@RequestParam int productId) { //获取此商品下的books - List ids = shopProudictBookService.getBookidsByProductId(productId); + List ids = shopProductBookService.getBookIdsByProductId(productId); - if(ids.size()==0){ + if (ids.size() == 0) { return R.ok(); } - List ss = shopProudictBookService.getBaseMapper().selectList(new QueryWrapper() - .eq("del_flag",0) - .in("book_id",ids) - .groupBy("proudict_id") - .having("count(proudict_id) >="+ids.size()) + List ss = shopProductBookService.getBaseMapper().selectList(new QueryWrapper() + .eq("del_flag", 0) + .in("book_id", ids) + .groupBy("product_id") + .having("count(product_id) >=" + ids.size()) ); List frag = new ArrayList<>(); //如果绑定的书为空,直接返回空值 - if(ids.size()==0){ + if (ids.size() == 0) { return R.ok(); } - for (ShopProudictBookEntity spbe : ss){ - ShopProductEntity ca_sp = shopProductService.getById(spbe.getProudictId()); + for (ShopProductBookEntity spbe : ss) { + ShopProductEntity ca_sp = shopProductService.getById(spbe.getProductId()); frag.add(ca_sp); } - return R.ok().put("result",frag); + return R.ok().put("result", frag); } /** * 信息 + * * @param productId * @return */ @RequestMapping("/info/{productId}") - public R info(@PathVariable("productId") Integer productId){ - ShopProductEntity shopProductEntity = shopProductService.getBaseMapper().selectOne(new QueryWrapper().eq("product_id", productId).eq("del_flag",0)); - if (shopProductEntity == null) { - return R.error("该商品已下架,看看其他商品吧"); - } - ArrayList> imagesUrl = new ArrayList>(); + public R info(@PathVariable("productId") Integer productId) { + ShopProductEntity shopProductEntity = shopProductService.getBaseMapper().selectOne(new QueryWrapper().eq("product_id", productId).eq("del_flag", 0)); + if (shopProductEntity == null) { + return R.error("该商品已下架,看看其他商品吧"); + } + ArrayList> imagesUrl = new ArrayList>(); Integer poid = shopProductEntity.getProductPid(); Integer productId1 = shopProductEntity.getProductId(); @@ -268,11 +259,11 @@ public class ShopProductController { List list = new ArrayList<>(); List bookIdlist = new ArrayList<>(); ArrayList booklist = new ArrayList<>(); - List proudict = shopProudictBookService.getBaseMapper().selectList(new QueryWrapper() - .eq("proudict_id", productId1)); - for (ShopProudictBookEntity shopProudictBookEntity : proudict) { - Integer id = shopProudictBookEntity.getId(); - Integer bookId = shopProudictBookEntity.getBookId(); + List product = shopProductBookService.getBaseMapper().selectList(new QueryWrapper() + .eq("product_id", productId1)); + for (ShopProductBookEntity shopProductBookEntity : product) { + Integer id = shopProductBookEntity.getId(); + Integer bookId = shopProductBookEntity.getBookId(); BookEntity byId = bookService.getById(bookId); bookIdlist.add(id); @@ -282,9 +273,9 @@ public class ShopProductController { //添加获取标签逻辑 List shopProductToLabelEntities = shopProductToLabelService.getBaseMapper().selectList(new QueryWrapper() - .eq("product_id",productId).eq("del_flag",0)); + .eq("product_id", productId).eq("del_flag", 0)); List labelList = new ArrayList(); - for (ShopProductToLabelEntity sp : shopProductToLabelEntities){ + for (ShopProductToLabelEntity sp : shopProductToLabelEntities) { labelList.add(sp.getSplId()); } @@ -292,32 +283,31 @@ public class ShopProductController { shopProductEntity.setBookidsimages(list); shopProductEntity.setBookids(booklist); shopProductEntity.setShoproudIds(bookIdlist); - return R.ok().put("shopProduct", shopProductEntity).put("labels",labelList); + return R.ok().put("shopProduct", shopProductEntity).put("labels", labelList); } - - /** - * 根据传入商品id反向查询图书id,然后查询图书id下包含的商品 + * 根据传入商品id反向查询图书id,然后查询图书id下包含的商品 + * * @param productId * @return */ @RequestMapping("/infobook/{productId}") public R infobook(@PathVariable("productId") Integer productId) { - List proudict = shopProudictBookService.getBaseMapper().selectList(new QueryWrapper() - .eq("proudict_id", productId)); + List proudict = shopProductBookService.getBaseMapper().selectList(new QueryWrapper() + .eq("product_id", productId)); List list = new ArrayList<>(); - for (ShopProudictBookEntity shopProudictBookEntity : proudict) { - Integer bookId = shopProudictBookEntity.getBookId(); + for (ShopProductBookEntity shopProductBookEntity : proudict) { + Integer bookId = shopProductBookEntity.getBookId(); - List bookIds = shopProudictBookService.getBaseMapper().selectList(new QueryWrapper() + List bookIds = shopProductBookService.getBaseMapper().selectList(new QueryWrapper() .eq("book_id", bookId)); - for (ShopProudictBookEntity shopProudict : bookIds) { - Integer proudictId = shopProudict.getProudictId(); + for (ShopProductBookEntity shopProduct : bookIds) { + Integer shopProductId = shopProduct.getProductId(); List shopProductEntities = shopProductService.getBaseMapper().selectList(new QueryWrapper() - .eq("proudict_id",proudictId)); + .eq("product_id", shopProductId)); list.add(shopProductEntities); } } @@ -334,147 +324,138 @@ public class ShopProductController { shopProduct.setCreateTime(new Date()); String bkids = ""; - for(String s : shopProduct.getBookids()){ - bkids += s+","; + for (String s : shopProduct.getBookids()) { + bkids += s + ","; + } + if (bkids != null && !bkids.isEmpty()) { + String substring = bkids.substring(0, bkids.length() - 1); + shopProduct.setBookId(substring); + } else { + shopProduct.setBookId(""); } - if (bkids!=null &&!bkids.isEmpty()){ - String substring = bkids.substring(0, bkids.length() - 1); - shopProduct.setBookId(substring); - }else { - shopProduct.setBookId(""); - } shopProductService.save(shopProduct); - ShopProudictBookEntity shopProudictBookEntity = new ShopProudictBookEntity(); + ShopProductBookEntity shopProductBookEntity = new ShopProductBookEntity(); for (String s : shopProduct.getBookids()) { String bookidlist = s; if (bookidlist != null) { Integer proudict = shopProduct.getProductId(); - shopProudictBookEntity.setProudictId(proudict); - shopProudictBookEntity.setBookId(Integer.valueOf(bookidlist)); - shopProudictBookService.save(shopProudictBookEntity); + shopProductBookEntity.setProductId(proudict); + shopProductBookEntity.setBookId(Integer.valueOf(bookidlist)); + shopProductBookService.save(shopProductBookEntity); } } return R.ok(); } + /** * 修改 */ - @RequestMapping("/update") + @RequestMapping("/update") public R update(@RequestBody ShopProductEntity shopProduct) { - //商品id - Integer productId = shopProduct.getProductId(); - shopProduct.setCreateTime(new Date()); - //用list集合接收数组,转String类型字符串 - String bkids = ""; - for (String s : shopProduct.getBookids()) { - bkids += s + ","; - } - if (bkids != null && !bkids.isEmpty()) { - String substring = bkids.substring(0, bkids.length() - 1); - shopProduct.setBookId(substring); - } else { - shopProduct.setBookId(""); - } - //传过来的proudictid只有一个,但是bookid可能有多个,对应的一个proudictid一个bookid为一条数据,一对多存储 - List bookyList = shopProudictBookService.getBaseMapper().selectList(new QueryWrapper() - .eq("proudict_id", productId)); - Integer shop_book_ids [] = new Integer[bookyList.size()]; - for(int i=0; i 0){ - shopProudictBookService.getBaseMapper().deleteBatchIds(Arrays.asList(shop_book_ids)); - } - - ShopProudictBookEntity shopProudictBookEntity = new ShopProudictBookEntity(); - for (String s : shopProduct.getBookids()) { - String bookidlist = s; - if (bookidlist != null) { - Integer proudict = shopProduct.getProductId(); - shopProudictBookEntity.setProudictId(proudict); - shopProudictBookEntity.setBookId(Integer.valueOf(bookidlist)); - shopProudictBookService.save(shopProudictBookEntity); - } - } - - - //对于标签的增和删 - List shopProductToLabelEntities_now = shopProductToLabelService.getBaseMapper().selectList(new QueryWrapper() - .eq("product_id", productId)); - List m_spl_ids = shopProduct.getShoproudLabels(); - //删除 - for (ShopProductToLabelEntity sn:shopProductToLabelEntities_now){ - if(!m_spl_ids.contains(sn.getSplId())){ - shopProductToLabelService.removeById(sn.getPtlId()); - } - } - //添加 - for (String m:m_spl_ids){ - Integer spl_id = Integer.valueOf(m); - ShopProductToLabelEntity byId = shopProductToLabelService.getBaseMapper().selectOne(new QueryWrapper() - .eq("spl_id",spl_id).eq("product_id",productId)); - if(byId==null){ - ShopProductToLabelEntity shopProductToLabelEntity = new ShopProductToLabelEntity(); - shopProductToLabelEntity.setProductId(productId); - shopProductToLabelEntity.setSplId(spl_id); - shopProductToLabelService.save(shopProductToLabelEntity); - } - } - - shopProductService.updateById(shopProduct); - return R.ok(); + //商品id + Integer productId = shopProduct.getProductId(); + shopProduct.setCreateTime(new Date()); + //用list集合接收数组,转String类型字符串 + String bkids = ""; + for (String s : shopProduct.getBookids()) { + bkids += s + ","; } + if (bkids != null && !bkids.isEmpty()) { + String substring = bkids.substring(0, bkids.length() - 1); + shopProduct.setBookId(substring); + } else { + shopProduct.setBookId(""); + } + //传过来的proudictid只有一个,但是bookid可能有多个,对应的一个proudictid一个bookid为一条数据,一对多存储 + List bookyList = shopProductBookService.getBaseMapper().selectList(new QueryWrapper() + .eq("product_id", productId)); + Integer shop_book_ids[] = new Integer[bookyList.size()]; + for (int i = 0; i < bookyList.size(); i++) { + shop_book_ids[i] = bookyList.get(i).getId(); + } + if (null != shop_book_ids && shop_book_ids.length > 0) { + shopProductBookService.getBaseMapper().deleteBatchIds(Arrays.asList(shop_book_ids)); + } + + ShopProductBookEntity shopProductBookEntity = new ShopProductBookEntity(); + for (String s : shopProduct.getBookids()) { + String bookidlist = s; + if (bookidlist != null) { + Integer proudict = shopProduct.getProductId(); + shopProductBookEntity.setProductId(proudict); + shopProductBookEntity.setBookId(Integer.valueOf(bookidlist)); + shopProductBookService.save(shopProductBookEntity); + } + } + + + //对于标签的增和删 + List shopProductToLabelEntities_now = shopProductToLabelService.getBaseMapper().selectList(new QueryWrapper() + .eq("product_id", productId)); + List m_spl_ids = shopProduct.getShoproudLabels(); + //删除 + for (ShopProductToLabelEntity sn : shopProductToLabelEntities_now) { + if (!m_spl_ids.contains(sn.getSplId())) { + shopProductToLabelService.removeById(sn.getPtlId()); + } + } + //添加 + for (String m : m_spl_ids) { + Integer spl_id = Integer.valueOf(m); + ShopProductToLabelEntity byId = shopProductToLabelService.getBaseMapper().selectOne(new QueryWrapper() + .eq("spl_id", spl_id).eq("product_id", productId)); + if (byId == null) { + ShopProductToLabelEntity shopProductToLabelEntity = new ShopProductToLabelEntity(); + shopProductToLabelEntity.setProductId(productId); + shopProductToLabelEntity.setSplId(spl_id); + shopProductToLabelService.save(shopProductToLabelEntity); + } + } + + shopProductService.updateById(shopProduct); + return R.ok(); + } /** * 删除 */ @RequestMapping("/delete") - public R delete(@RequestBody Integer[] productIds){ + public R delete(@RequestBody Integer[] productIds) { - List bookEntityList = shopProudictBookService.getBaseMapper().selectList(new QueryWrapper() - .in("proudict_id", productIds) + List bookEntityList = shopProductBookService.getBaseMapper().selectList(new QueryWrapper() + .in("product_id", productIds) ); - for (ShopProudictBookEntity shopProudictBookEntity : bookEntityList) { - Integer id = shopProudictBookEntity.getId(); - shopProudictBookService.removeById(id); + for (ShopProductBookEntity shopProductBookEntity : bookEntityList) { + Integer id = shopProductBookEntity.getId(); + shopProductBookService.removeById(id); } - shopProductService.removeByIds(Arrays.asList(productIds)); + shopProductService.removeByIds(Arrays.asList(productIds)); return R.ok(); } - - - - - /** * 列表 */ @RequestMapping("/appGetList") - public R appGetList(@RequestParam Map params){ + public R appGetList(@RequestParam Map params) { PageUtils page = shopProductService.queryPage(params); return R.ok().put("page", page); } - - - - - /** * 获取分类下商品列表 */ @RequestMapping("/appGetCategoryList") - public R appGetCategoryList(@RequestParam("catId") Integer catId){ + public R appGetCategoryList(@RequestParam("catId") Integer catId) { List list1 = shopCategoryService.getBaseMapper().selectList(new QueryWrapper() - .eq("cat_id",catId)); + .eq("cat_id", catId)); if (catId == null) { } - if(catId == 0){ + if (catId == 0) { catId = null; } List list = shopProductService.appGetCategoryList(catId); @@ -485,7 +466,7 @@ public class ShopProductController { * 远程搜索 */ @RequestMapping("/prodSearch") - public R prodSearch(){ + public R prodSearch() { List list = shopProductService.list(new QueryWrapper().select("product_id,product_name")); List collect = list.stream().map(shopProductEntity -> { ShopProductVo shopProductVo = new ShopProductVo(); @@ -500,11 +481,10 @@ public class ShopProductController { * 优惠券获取商品信息 */ @RequestMapping("/backProdSearch") - public R backProdSearch(@RequestParam Map params){ + public R backProdSearch(@RequestParam Map params) { String productName = (String) params.get("productName"); List list = shopProductService.list(new QueryWrapper() - .like("product_name",productName)); + .like("product_name", productName)); return R.ok().put("list", list); } - } diff --git a/src/main/java/com/peanut/modules/book/controller/ShopProudictBookController.java b/src/main/java/com/peanut/modules/book/controller/ShopProudictBookController.java deleted file mode 100644 index 964d0c3d..00000000 --- a/src/main/java/com/peanut/modules/book/controller/ShopProudictBookController.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.peanut.modules.book.controller; -import com.peanut.common.utils.PageUtils; -import com.peanut.common.utils.R; -import com.peanut.modules.book.entity.ShopProudictBookEntity; -import com.peanut.modules.book.service.ShopProudictBookService; -import com.peanut.modules.book.vo.ProudictBookqueryVO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import java.util.List; -import java.util.Map; - -@RestController -@RequestMapping("book/shopProudictBook") -public class ShopProudictBookController { - @Autowired - private ShopProudictBookService shopProudictBookService; - /** - * 列表 - */ - @RequestMapping("/list") - public R list(@RequestParam Map params ){ - PageUtils page = shopProudictBookService.queryPage(params); - return R.ok().put("page", page); - - } - /** - * 图书与商品信息 - */ - // 根据商品id查询图书信息,查询到图书信息,反向查找包含该图书id的所有商品返回 - @RequestMapping("/proudictBooklist") - public R proudictBooklist(@RequestParam Integer proudictId){ - List cartList = shopProudictBookService.getCartList(proudictId); - return R.ok().put("cartList", cartList); - - } - /** - * 保存 - */ - @RequestMapping("/save") - public R save(@RequestBody ShopProudictBookEntity shopProudictBookEntity){ - - for(Integer s : shopProudictBookEntity.getBookidlist()){ - Integer bookidlist = s; - if (bookidlist!=null){ - Integer proudict = shopProudictBookEntity.getProudictId(); - shopProudictBookEntity.setProudictId(proudict); - shopProudictBookEntity.setBookId(bookidlist); - shopProudictBookService.save(shopProudictBookEntity); - - } - } - return R.ok(); - } - - /** - * 修改 - */ - @RequestMapping("/update") - public R update(@RequestBody ShopProudictBookEntity shopProudictBookEntity){ - - shopProudictBookService.updateById(shopProudictBookEntity); - return R.ok(); - } - /** - * 删除 - */ - @RequestMapping("/delete") - public R delete(@RequestParam Integer id){ - shopProudictBookService.removeById(id); - return R.ok(); - } - - - - - - - - - - - - - - - - - - - - - - - -} diff --git a/src/main/java/com/peanut/modules/book/dao/ShopProudictBookDao.java b/src/main/java/com/peanut/modules/book/dao/ShopProductBookDao.java similarity index 60% rename from src/main/java/com/peanut/modules/book/dao/ShopProudictBookDao.java rename to src/main/java/com/peanut/modules/book/dao/ShopProductBookDao.java index 298bf77f..90f7942a 100644 --- a/src/main/java/com/peanut/modules/book/dao/ShopProudictBookDao.java +++ b/src/main/java/com/peanut/modules/book/dao/ShopProductBookDao.java @@ -1,13 +1,13 @@ package com.peanut.modules.book.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.peanut.modules.book.entity.ShopProudictBookEntity; +import com.peanut.modules.book.entity.ShopProductBookEntity; import org.apache.ibatis.annotations.Mapper; import java.util.List; @Mapper -public interface ShopProudictBookDao extends BaseMapper { +public interface ShopProductBookDao extends BaseMapper { List getOrderBookId(String orderSn); } diff --git a/src/main/java/com/peanut/modules/book/entity/ShopProudictBookEntity.java b/src/main/java/com/peanut/modules/book/entity/ShopProductBookEntity.java similarity index 53% rename from src/main/java/com/peanut/modules/book/entity/ShopProudictBookEntity.java rename to src/main/java/com/peanut/modules/book/entity/ShopProductBookEntity.java index 46e8e99a..b0f30516 100644 --- a/src/main/java/com/peanut/modules/book/entity/ShopProudictBookEntity.java +++ b/src/main/java/com/peanut/modules/book/entity/ShopProductBookEntity.java @@ -1,21 +1,27 @@ package com.peanut.modules.book.entity; + import com.baomidou.mybatisplus.annotation.*; import lombok.Data; + import java.util.ArrayList; import java.util.Date; -@Data -@TableName("shop_proudict_book") -public class ShopProudictBookEntity { - @TableId - private Integer id; +@Data +@TableName("shop_product_book") +public class ShopProductBookEntity { + /** - * 商品id + * 主键 id */ - @TableField("proudict_id") - private Integer proudictId; + @TableId + private Integer id; /** - *图书id + * 商品id + */ + @TableField("product_id") + private Integer productId; + /** + * 图书id */ @TableField("book_id") private Integer bookId; @@ -23,18 +29,21 @@ public class ShopProudictBookEntity { * 多个图书id (备用) */ @TableField("book_ids") - private Integer bookdIds; - - + private Integer bookIds; + /** + * 删除标记 + */ @TableField("del_flag") @TableLogic - private Integer delFlag; + private Integer delFlag; /** * 创建日期 */ @TableField(fill = FieldFill.INSERT) private Date createTime; - // - @TableField(exist = false) - private ArrayList bookidlist; + /** + * 书籍列表 + */ + @TableField(exist = false) + private ArrayList bookIdList; } diff --git a/src/main/java/com/peanut/modules/book/service/ShopProductBookService.java b/src/main/java/com/peanut/modules/book/service/ShopProductBookService.java new file mode 100644 index 00000000..917fc925 --- /dev/null +++ b/src/main/java/com/peanut/modules/book/service/ShopProductBookService.java @@ -0,0 +1,24 @@ +package com.peanut.modules.book.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.peanut.common.utils.PageUtils; +import com.peanut.modules.book.entity.ShopProductBookEntity; +import com.peanut.modules.book.vo.ProductBookQueryVO; + +import java.util.List; +import java.util.Map; + +public interface ShopProductBookService extends IService { + PageUtils queryPage(Map params); + + PageUtils productBookQueryPage(Map params); + + List getCartList(Integer productId); + + List getBookIdsByProductId(Integer productId); + + Integer getProductByBookId(Integer bookId); + + List getOrderBookId(String orderSn); + +} diff --git a/src/main/java/com/peanut/modules/book/service/ShopProudictBookService.java b/src/main/java/com/peanut/modules/book/service/ShopProudictBookService.java deleted file mode 100644 index fde137a2..00000000 --- a/src/main/java/com/peanut/modules/book/service/ShopProudictBookService.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.peanut.modules.book.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.peanut.common.utils.PageUtils; -import com.peanut.modules.book.entity.ShopProudictBookEntity; -import com.peanut.modules.book.vo.ProudictBookqueryVO; - -import java.util.List; -import java.util.Map; - -public interface ShopProudictBookService extends IService { - PageUtils queryPage(Map params); - - PageUtils proudictBookqueryPage(Map params); - - List getCartList(Integer proudictId); - - List getBookidsByProductId(Integer productId); - - Integer getProductByBookId(Integer bookId); - - List getOrderBookId(String orderSn); - -} diff --git a/src/main/java/com/peanut/modules/book/service/impl/ShopProudictBookServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/ShopProductBookServiceImpl.java similarity index 53% rename from src/main/java/com/peanut/modules/book/service/impl/ShopProudictBookServiceImpl.java rename to src/main/java/com/peanut/modules/book/service/impl/ShopProductBookServiceImpl.java index 4e887746..68a75c2c 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/ShopProudictBookServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/ShopProductBookServiceImpl.java @@ -6,14 +6,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.peanut.common.utils.PageUtils; import com.peanut.common.utils.Query; -import com.peanut.modules.book.dao.ShopProudictBookDao; +import com.peanut.modules.book.dao.ShopProductBookDao; import com.peanut.modules.book.entity.BookEntity; import com.peanut.modules.book.entity.ShopProductEntity; -import com.peanut.modules.book.entity.ShopProudictBookEntity; +import com.peanut.modules.book.entity.ShopProductBookEntity; import com.peanut.modules.book.service.BookService; import com.peanut.modules.book.service.ShopProductService; -import com.peanut.modules.book.service.ShopProudictBookService; -import com.peanut.modules.book.vo.ProudictBookqueryVO; +import com.peanut.modules.book.service.ShopProductBookService; +import com.peanut.modules.book.vo.ProductBookQueryVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -22,50 +22,50 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -@Service("shopProudictBookService") -public class ShopProudictBookServiceImpl extends ServiceImpl implements ShopProudictBookService { +@Service("shopProductBookService") +public class ShopProductBookServiceImpl extends ServiceImpl implements ShopProductBookService { @Autowired private ShopProductService shopProductService; @Autowired private BookService bookService; @Autowired - private ShopProudictBookDao shopProudictBookDao; + private ShopProductBookDao shopProductBookDao; @Override public PageUtils queryPage(Map params) { - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper() + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper<>() ); return new PageUtils(page); } @Override - public PageUtils proudictBookqueryPage(Map params) { + public PageUtils productBookQueryPage(Map params) { Object proudictId = params.get("proudictId"); - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper().eq("proudict_id", proudictId) + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper().eq("product_id", proudictId) ); - List records = page.getRecords(); + List records = page.getRecords(); return new PageUtils(page); } @Override - public List getCartList(Integer proudictId) { + public List getCartList(Integer productId) { - ShopProductEntity shopProductEntity = shopProductService.getBaseMapper().selectOne(new QueryWrapper().eq("proudict_id", proudictId)); - List proudictBooklist = this.list(new QueryWrapper().eq("proudict_id", proudictId)); + ShopProductEntity shopProductEntity = shopProductService.getBaseMapper().selectOne(new QueryWrapper().eq("product_id", productId)); + List proudictBooklist = this.list(new QueryWrapper().eq("product_id", productId)); List prList = new ArrayList<>(); List prLists = new ArrayList<>(); Map map = new HashMap<>(); - for (ShopProudictBookEntity shopProudictBookEntity : proudictBooklist) { - Integer bookId = shopProudictBookEntity.getBookId(); - List booklist = this.list(new QueryWrapper().eq("book_id", bookId)); - for (ShopProudictBookEntity shopProudictBook : booklist) { - Integer proudictId1 = shopProudictBook.getProudictId(); + for (ShopProductBookEntity shopProductBookEntity : proudictBooklist) { + Integer bookId = shopProductBookEntity.getBookId(); + List booklist = this.list(new QueryWrapper().eq("book_id", bookId)); + for (ShopProductBookEntity shopProudictBook : booklist) { + Integer proudictId1 = shopProudictBook.getProductId(); Integer bookId1 = shopProudictBook.getBookId(); BookEntity bookbyId = bookService.getById(bookId1); prList.add(bookbyId); @@ -78,10 +78,10 @@ public class ShopProudictBookServiceImpl extends ServiceImpl getBookidsByProductId(Integer productId) { - List spbs = this.list(new QueryWrapper().eq("del_flag", 0).eq("proudict_id", productId)); + public List getBookIdsByProductId(Integer productId) { + List spbs = this.list(new QueryWrapper().eq("del_flag", 0).eq("proudict_id", productId)); List ids = new ArrayList(); - for (ShopProudictBookEntity s : spbs) { + for (ShopProductBookEntity s : spbs) { ids.add(s.getBookId()); } return ids; @@ -89,14 +89,14 @@ public class ShopProudictBookServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(ShopProudictBookEntity::getBookId, bookId); - wrapper.eq(ShopProudictBookEntity::getDelFlag, 0); - wrapper.groupBy(ShopProudictBookEntity::getProudictId); - List shopProudictBookEntities = this.getBaseMapper().selectList(wrapper); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ShopProductBookEntity::getBookId, bookId); + wrapper.eq(ShopProductBookEntity::getDelFlag, 0); + wrapper.groupBy(ShopProductBookEntity::getProductId); + List shopProudictBookEntities = this.getBaseMapper().selectList(wrapper); List ids = new ArrayList(); - for (ShopProudictBookEntity s : shopProudictBookEntities) { - ids.add(s.getProudictId()); + for (ShopProductBookEntity s : shopProudictBookEntities) { + ids.add(s.getProductId()); } if (ids.size() == 0) { return null; @@ -114,7 +114,7 @@ public class ShopProudictBookServiceImpl extends ServiceImpl getOrderBookId(String orderSn) { - return shopProudictBookDao.getOrderBookId(orderSn); + return shopProductBookDao.getOrderBookId(orderSn); } diff --git a/src/main/java/com/peanut/modules/book/service/impl/ShopProductServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/ShopProductServiceImpl.java index eb3307e5..e80804ef 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/ShopProductServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/ShopProductServiceImpl.java @@ -1,14 +1,7 @@ package com.peanut.modules.book.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.peanut.common.utils.ExcludeEmptyQueryWrapper; -import com.peanut.modules.book.entity.ShopCategoryEntity; -import com.peanut.modules.book.entity.ShopProudictBookEntity; -import com.peanut.modules.book.service.ShopProudictBookService; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Map; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; diff --git a/src/main/java/com/peanut/modules/book/vo/ProductBookQueryVO.java b/src/main/java/com/peanut/modules/book/vo/ProductBookQueryVO.java new file mode 100644 index 00000000..2de1d5bc --- /dev/null +++ b/src/main/java/com/peanut/modules/book/vo/ProductBookQueryVO.java @@ -0,0 +1,29 @@ +package com.peanut.modules.book.vo; + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + + +/** + * 返回图书与商品基本信息vo, + */ +@Data +public class ProductBookQueryVO { + + private Integer bookId; + private String bookName; + private Boolean canListen; + private Integer clockIn; + private String images; + private List products; + + private Integer productId; + private String productName; + private BigDecimal price; + private BigDecimal activityPrice; + private Integer sumSales; + private String productImages; + +} diff --git a/src/main/java/com/peanut/modules/book/vo/ProudictBookqueryVO.java b/src/main/java/com/peanut/modules/book/vo/ProudictBookqueryVO.java deleted file mode 100644 index f85c5762..00000000 --- a/src/main/java/com/peanut/modules/book/vo/ProudictBookqueryVO.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.peanut.modules.book.vo; - -import com.baomidou.mybatisplus.annotation.TableField; -import lombok.Data; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - - -/** - * 返回图书与商品基本信息vo, - - */ -@Data -public class ProudictBookqueryVO { - - - - /** - *图书基本信息 - */ - private Integer bookId; - private String bookname; - private Boolean canListen; - private Integer clockIn; - private String images; - private List proudicts; - - /** - * 商品基本信息 - */ - private Integer proudictId; - private String productName; - private BigDecimal price; - private BigDecimal activityPrice; - private Integer sumSales; - private String proudictimages; - -} diff --git a/src/main/java/com/peanut/modules/pay/weChatPay/controller/WeChatPayController.java b/src/main/java/com/peanut/modules/pay/weChatPay/controller/WeChatPayController.java index 87b719a8..4daf6d9d 100644 --- a/src/main/java/com/peanut/modules/pay/weChatPay/controller/WeChatPayController.java +++ b/src/main/java/com/peanut/modules/pay/weChatPay/controller/WeChatPayController.java @@ -53,7 +53,7 @@ public class WeChatPayController { private TransactionDetailsService transactionDetailsService; @Autowired - private ShopProudictBookService shopProudictBookService; + private ShopProductBookService shopProudictBookService; @Autowired private UserEbookBuyService userEbookBuyService; diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 9853eb73..601b66fe 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -1,60 +1,73 @@ spring: - datasource: - type: com.alibaba.druid.pool.DruidDataSource - druid: - driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://59.110.212.44:3306/e_book_test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true - username: root - password: HSXY1234hsxy - initial-size: 10 - max-active: 100 - min-idle: 10 - max-wait: 60000 - pool-prepared-statements: true - max-pool-prepared-statement-per-connection-size: 20 - time-between-eviction-runs-millis: 60000 - min-evictable-idle-time-millis: 300000 - #Oracle需要打开注释 - #validation-query: SELECT 1 FROM DUAL - test-while-idle: true - test-on-borrow: false - test-on-return: false - stat-view-servlet: - enabled: true - url-pattern: /druid/* - #login-username: admin - #login-password: admin - filter: - stat: - log-slow-sql: true - slow-sql-millis: 1000 - merge-sql: false - wall: - config: - multi-statement-allow: true - tomcat: - initSQL: SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci + redis: + open: false # 是否开启redis缓存 true开启 false关闭 + database: 0 + host: 39.106.36.183 + port: 6379 + password: Jgll2015 # 密码(默认为空) + timeout: 6000000ms # 连接超时时长(毫秒) + jedis: + pool: + max-active: 1000 # 连接池最大连接数(使用负值表示没有限制) + max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制) + max-idle: 10 # 连接池中的最大空闲连接 + min-idle: 5 # 连接池中的最小空闲连接 + datasource: + type: com.alibaba.druid.pool.DruidDataSource + druid: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://59.110.212.44:3306/e_book_test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true + username: root + password: HSXY1234hsxy + initial-size: 10 + max-active: 100 + min-idle: 10 + max-wait: 60000 + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + time-between-eviction-runs-millis: 60000 + min-evictable-idle-time-millis: 300000 + #Oracle需要打开注释 + #validation-query: SELECT 1 FROM DUAL + test-while-idle: true + test-on-borrow: false + test-on-return: false + stat-view-servlet: + enabled: true + url-pattern: /druid/* + #login-username: admin + #login-password: admin + filter: + stat: + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: false + wall: + config: + multi-statement-allow: true + tomcat: + initSQL: SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci - rabbitmq: - host: 59.110.212.44 - port: 5672 - username: admin - password: 751019 - virtualHost: / + rabbitmq: + host: 39.106.36.183 + port: 5672 + username: admin + password: 751019 + virtualHost: / aliyun: - oss: - file: - endpoint: oss-cn-beijing.aliyuncs.com - keyid: LTAIiSMeo8ztauV5 - keysecret: pVIYAOIFSUGg61lYfE8cjg2ZNpnLJA - bucketname: ehh-private-01 - sms: - accessKeyId: LTAI5tJbbw5fY97pnw635yq3 - accessKeySecret: LTXQ9v3OYVwNVbDWWfVpbbcVDKErKi - singName: 疯子读书 + oss: + file: + endpoint: oss-cn-beijing.aliyuncs.com + keyid: LTAIiSMeo8ztauV5 + keysecret: pVIYAOIFSUGg61lYfE8cjg2ZNpnLJA + bucketname: ehh-private-01 + sms: + accessKeyId: LTAI5tJbbw5fY97pnw635yq3 + accessKeySecret: LTXQ9v3OYVwNVbDWWfVpbbcVDKErKi + singName: 疯子读书 - templateCode: SMS_248840040 + templateCode: SMS_248840040 server: - port: 9200 \ No newline at end of file + port: 9200 \ No newline at end of file diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 2ceaca9a..28030565 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -1,5 +1,18 @@ spring: + redis: + open: false # 是否开启redis缓存 true开启 false关闭 + database: 0 + host: 59.110.212.44 + port: 6379 + password: Jgll2015 # 密码(默认为空) + timeout: 6000000ms # 连接超时时长(毫秒) + jedis: + pool: + max-active: 1000 # 连接池最大连接数(使用负值表示没有限制) + max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制) + max-idle: 10 # 连接池中的最大空闲连接 + min-idle: 5 # 连接池中的最小空闲连接 datasource: type: com.alibaba.druid.pool.DruidDataSource druid: diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index e7477840..e167c270 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -11,7 +11,7 @@ connection-timeout: 6000000ms spring: # 环境 dev|test|prod profiles: - active: prod + active: dev # jackson时间格式化 jackson: time-zone: GMT+8 @@ -21,19 +21,6 @@ spring: max-file-size: 100MB max-request-size: 100MB enabled: true - redis: - open: false # 是否开启redis缓存 true开启 false关闭 - database: 0 - host: 59.110.212.44 - port: 6379 - password: Jgll2015 # 密码(默认为空) - timeout: 6000000ms # 连接超时时长(毫秒) - jedis: - pool: - max-active: 1000 # 连接池最大连接数(使用负值表示没有限制) - max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制) - max-idle: 10 # 连接池中的最大空闲连接 - min-idle: 5 # 连接池中的最小空闲连接 mvc: throw-exception-if-no-handler-found: true pathmatch: diff --git a/src/main/resources/mapper/book/ShopProudictBookDao.xml b/src/main/resources/mapper/book/ShopProductBookDao.xml similarity index 56% rename from src/main/resources/mapper/book/ShopProudictBookDao.xml rename to src/main/resources/mapper/book/ShopProductBookDao.xml index 63237def..b3ff6d29 100644 --- a/src/main/resources/mapper/book/ShopProudictBookDao.xml +++ b/src/main/resources/mapper/book/ShopProductBookDao.xml @@ -1,24 +1,25 @@ - + - + - + - +