This commit is contained in:
yc13649764453
2023-09-19 15:00:15 +08:00
parent 9ada233eb7
commit 5a43a5020b
21 changed files with 745 additions and 582 deletions

View File

@@ -31,7 +31,7 @@ public class BookChapterServiceImpl extends ServiceImpl<BookChapterDao, BookChap
IPage<BookChapterEntity> page = this.page(
new Query<BookChapterEntity>().getPage(params),
//8.24修改根据number升序 排序
new QueryWrapper<BookChapterEntity>().eq("book_id",bookid).orderByDesc("number")
new QueryWrapper<BookChapterEntity>().eq("book_id",bookid).orderByAsc("number")
);
return new PageUtils(page);

View File

@@ -561,16 +561,13 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
Map<String,List<String[]>> paraMap = new HashMap<>();
Map<String,String> headMap = new HashMap<>();
List<String> title_list = new ArrayList<>();
for (int i = 0; i < doc.getSections().getCount(); i++) {
String currentTitle = "";
Section section = doc.getSections().get(i);
for (int j = 0; j < section.getParagraphs().getCount() - 1; j++) {
Paragraph paragraph = section.getParagraphs().get(j);
if (paragraph.getStyleName().equals("Heading1") ) {
//
String textq = paragraph.getText();
currentTitle = textq;
title_list.add(currentTitle);
List<String[]> secondTitleList = new ArrayList<>();
@@ -578,7 +575,6 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
if(!section.getParagraphs().get(j+1).getStyleName().matches("Heading2")){
int head_index = j ;
StringBuilder builder = new StringBuilder();
do {
builder.append(section.getParagraphs().get(head_index).getText());
head_index++;
@@ -660,6 +656,55 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
return false;
}
@Override
public PageUtils queryPagebooks(Map<String, Object> params) {
IPage<BookEntity> page = this.page(
new Query<BookEntity>().getPage(params),
new QueryWrapper<BookEntity>()
.eq("state", "1")
.orderByDesc("create_time")
);
for (BookEntity book : page.getRecords()) {
String authorName = "";
String publisherName = "";
ArrayList<Object> list = new ArrayList<>();
String authorId = book.getAuthorId();
String publisherId = book.getPublisherId();
String[] authorIds = authorId.split(",");
String[] publisherIds = publisherId.split(",");
List<String> authorList = Arrays.asList(authorIds);
List<String> publisherList = Arrays.asList(publisherIds);
List<PublisherEntity> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<PublisherEntity>().in("id", publisherList));
List<AuthorEntity> authorEntities = authorService.getBaseMapper().selectList(new QueryWrapper<AuthorEntity>().in("id", authorList));
for (AuthorEntity authorEntity : authorEntities) {
authorName += "," + authorEntity.getAuthorName();
}
for (PublisherEntity publisherEntity : publisherEntities) {
publisherName += "," + publisherEntity.getPublisherName();
}
authorName = authorName.startsWith(",") ? authorName.substring(1) : authorName;
publisherName = publisherName.startsWith(",") ? publisherName.substring(1) : publisherName;
if (!CollectionUtils.isEmpty(list)) {
book.setType(Joiner.on(",").join(list));
}
if (!StringUtils.isEmpty(authorName)) {
book.setAuthorName(authorName);
}
if (!StringUtils.isEmpty(publisherName)) {
book.setPublisherName(publisherName);
}
}
return new PageUtils(page);
}
}

View File

@@ -21,7 +21,7 @@ public class BookTaskServiceImpl extends ServiceImpl<BookTaskDao, BookTaskEntity
Object bookid = params.get("bookid");
IPage<BookTaskEntity> page = this.page(
new Query<BookTaskEntity>().getPage(params),
new QueryWrapper<BookTaskEntity>().eq("book_id",bookid).orderByDesc("days")
new QueryWrapper<BookTaskEntity>().eq("book_id",bookid).orderByAsc("days")
);

View File

@@ -51,6 +51,7 @@ public class OrderCartServiceImpl extends ServiceImpl<OrderCartDao, OrderCartEnt
Integer productId = orderCartEntity.getProductId();
ShopProductEntity productEntity = shopProductService.getById(productId);
// shopProductService.getBaseMapper().selectList()
ShopCartVo shopCartVo = new ShopCartVo();
BeanUtils.copyProperties(orderCartEntity, shopCartVo);
@@ -62,7 +63,7 @@ public class OrderCartServiceImpl extends ServiceImpl<OrderCartDao, OrderCartEnt
shopCartVo.setWeight(productEntity.getWeight().doubleValue());
shopCartVo.setProductStock(productEntity.getProductStock());
shopCartVo.setProudictBook(Integer.valueOf(productEntity.getBookId()));
// shopCartVo.setProudictBook(Integer.valueOf(productEntity.getBookId()));
BigDecimal activityPrice = productEntity.getActivityPrice();
BigDecimal big = new BigDecimal(0);

View File

@@ -76,4 +76,13 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
return new PageUtils(page);
}
@Override
public PageUtils queryPageactivityprice(Map<String, Object> params) {
IPage<ShopProductEntity> page = this.page(
new Query<ShopProductEntity>().getPage(params),
new QueryWrapper<ShopProductEntity>().ne("activity_price", "").ne("activity_price", 0)
);
return new PageUtils(page);
}
}

View File

@@ -1,6 +1,4 @@
package com.peanut.modules.book.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -8,7 +6,6 @@ import com.peanut.common.utils.PageUtils;
import com.peanut.common.utils.Query;
import com.peanut.modules.book.dao.ShopProudictBookDao;
import com.peanut.modules.book.entity.BookEntity;
import com.peanut.modules.book.entity.ShopCategoryEntity;
import com.peanut.modules.book.entity.ShopProductEntity;
import com.peanut.modules.book.entity.ShopProudictBookEntity;
import com.peanut.modules.book.service.BookService;
@@ -17,8 +14,8 @@ import com.peanut.modules.book.service.ShopProudictBookService;
import com.peanut.modules.book.vo.ProudictBookqueryVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -53,33 +50,25 @@ public class ShopProudictBookServiceImpl extends ServiceImpl<ShopProudictBookDa
@Override
public List<ProudictBookqueryVO> getCartList(Integer proudictId) {
ShopProductEntity shopProductEntity = shopProductService.getBaseMapper().selectOne(new QueryWrapper<ShopProductEntity>().eq("proudict_id", proudictId));
List<ShopProudictBookEntity> proudictBooklist = this.list(new QueryWrapper<ShopProudictBookEntity>().eq("proudict_id", proudictId));
List prList = new ArrayList<>();
List prLists = new ArrayList<>();
Map<String, Object> map = new HashMap<>();
for (ShopProudictBookEntity shopProudictBookEntity : proudictBooklist) {
Integer proudictId1 = shopProudictBookEntity.getProudictId();
Integer bookId = shopProudictBookEntity.getBookId();
System.out.println("proudictId1======="+proudictId1);
System.out.println("bookId======="+bookId);
BookEntity bookbyId = bookService.getById(bookId);
ShopProductEntity shopProductbyId = shopProductService.getById(proudictId1);
ProudictBookqueryVO queryVO = new ProudictBookqueryVO();
queryVO.setBookId(bookbyId.getId());
queryVO.setName(bookbyId.getName());
queryVO.setCanListen(bookbyId.getCanListen());
queryVO.setImages(bookbyId.getImages());
queryVO.setClockIn(bookbyId.getClockIn());
queryVO.setProudictId(shopProductbyId.getProductId());
queryVO.setProductName(shopProductbyId.getProductName());
queryVO.setPrice(shopProductbyId.getPrice());
queryVO.setActivityPrice(shopProductbyId.getActivityPrice());
queryVO.setSumSales(shopProductbyId.getSumSales());
prList.add(queryVO);
System.out.println("queryVO======="+queryVO);
List<ShopProudictBookEntity> booklist = this.list(new QueryWrapper<ShopProudictBookEntity>().eq("book_id", bookId));
for (ShopProudictBookEntity shopProudictBook : booklist) {
Integer proudictId1 = shopProudictBook.getProudictId();
Integer bookId1 = shopProudictBook.getBookId();
BookEntity bookbyId = bookService.getById(bookId1);
prList.add(bookbyId);
ShopProductEntity shopProductbyId = shopProductService.getById(proudictId1);
shopProductbyId.setBookidsimages(prList);
}
}
return prList;
shopProductEntity.setBookidsimages(prList);
return prLists;
}
}