-- 新版提交

This commit is contained in:
yc13649764453
2023-09-09 13:51:35 +08:00
parent 763e24b4e0
commit 0b193caa03
92 changed files with 3451 additions and 1120 deletions

View File

@@ -6,6 +6,7 @@ import com.peanut.modules.book.entity.BookChapterEntity;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
@@ -19,5 +20,9 @@ public interface BookChapterService extends IService<BookChapterEntity> {
PageUtils queryPage(Map<String, Object> params);
PageUtils queryPage1(Map<String, Object> params);
// List<BookChapterEntity> getUse(Integer userId);
List<BookChapterEntity> getUserBookChapter(Integer userId);
}

View File

@@ -21,12 +21,21 @@ public interface BookService extends IService<BookEntity> {
PageUtils getBestBook(Map<String, Object> params);
PageUtils getbooklist(Map<String, Object> params);
PageUtils getNewBook(Map<String, Object> params);
PageUtils getSaleBook(Map<String, Object> params);
//获取Word电子书章节
boolean getWordChapter(Integer bookId);
//获取Word电子书章节并按照章节保存内容
boolean getWord(Integer bookId);
//获取Word电子书章按照章节中小节拆分
boolean getWordSection (Integer bookId);
}

View File

@@ -20,5 +20,7 @@ public interface BookShelfService extends IService<BookShelfEntity> {
PageUtils queryPage(Map<String, Object> params);
List<BookShelfVo> getUserBookshelf(Integer userId);
List<BookShelfVo> getUserBookChapterRead(Integer userId);
}

View File

@@ -19,6 +19,9 @@ public interface BuyOrderDetailService extends IService<BuyOrderDetailEntity> {
PageUtils querySheet(Map<String, Object> params);
PageUtils querybuy(Map<String,Object>params);
PageUtils querybuyss(Map<String,Object>params);
public void batchUpdateByShippingSns(String[] shippingSnList);
}

View File

@@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.common.utils.PageUtils;
import com.peanut.common.utils.R;
import com.peanut.modules.book.entity.BuyOrderEntity;
import javax.xml.soap.Text;
import java.util.List;
import java.util.Map;
@@ -18,7 +20,7 @@ import java.util.Map;
*/
public interface BuyOrderService extends IService<BuyOrderEntity> {
PageUtils queryPage(Map<String, Object> params);
PageUtils queryPage(Map<String, Object> params) throws Exception;
PageUtils queryPage1(Map<String, Object> params);
//更新订单状态
@@ -40,10 +42,19 @@ public interface BuyOrderService extends IService<BuyOrderEntity> {
public Page checkOrder(Map<String, Object> params);
// 批量发货功能
public void blendSendFMS(Integer[] orderDetailIds,String shipperCode,String shipperName);
public void blendSendFMS(Integer[] orderDetailIds, String shipperCode, String shipperName);
public int getProductGoodsType (Map<String, Object> param,Map<String, Object> productMap);
public R randomOrderCode( BuyOrderEntity buyOrder);
PageUtils querySheet(Map<String, Object> params);
PageUtils queryPages(Map<String, Object> params);
}

View File

@@ -2,9 +2,12 @@ package com.peanut.modules.book.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.common.utils.PageUtils;
import com.peanut.common.utils.R;
import com.peanut.modules.book.entity.MyUserEntity;
import com.peanut.modules.book.entity.UserAppAuthorEntity;
import org.springframework.context.annotation.Lazy;
import javax.persistence.Entity;
import java.util.Map;
/**
@@ -14,6 +17,7 @@ import java.util.Map;
* @email yl328572838@163.com
* @date 2022-08-10 14:20:12
*/
public interface MyUserService extends IService<MyUserEntity> {
PageUtils queryPage(Map<String, Object> params);
@@ -21,11 +25,20 @@ public interface MyUserService extends IService<MyUserEntity> {
void sendCodeForRegister(String phone, String code) throws Exception;
boolean bookAuthenticate(Integer bookId,Integer userId);
//电子书鉴权
boolean bookAuthenti(Integer bookId,Integer userId);
//会员开通 电话 开通 期限
boolean openMember(Integer customerId,Integer openMonth);
//充值花生币
boolean rechargeHSPoint(Integer customerId,Integer HSPoint);
//电子书购买
String buyEbook(String userId, String bookId,String couponId);
void update (MyUserEntity user);
//第三方微信登录
R getUserInfoByApp(UserAppAuthorEntity userAppAuthorEntity);
boolean bookEbookBuy(Integer bookid,Integer userId);
}

View File

@@ -27,5 +27,7 @@ public interface ShopCategoryService extends IService<ShopCategoryEntity> {
List<ShopCategoryEntity> getOneLevel();
List<ShopCategoryEntity> getTwoLevel(Integer catId);
List<String> findBookId(String bookId);
}

View File

@@ -18,9 +18,14 @@ public interface ShopProductService extends IService<ShopProductEntity> {
PageUtils queryPage(Map<String, Object> params);
PageUtils appQueryPage(Map<String, Object> params);
List<ShopProductEntity> appGetCategoryList(Integer catId);
PageUtils getNewBook(Map<String, Object> params);
PageUtils selectListqueryPage(Map<String, Object> params);
}

View File

@@ -16,5 +16,16 @@ import java.util.Map;
public interface UserEbookBuyService extends IService<UserEbookBuyEntity> {
PageUtils queryPage(Map<String, Object> params);
PageUtils queryPages(Map<String, Object> params);
}

View File

@@ -1,11 +1,13 @@
package com.peanut.modules.book.service.impl;
import com.peanut.modules.book.vo.BookShelfVo;
import org.springframework.stereotype.Service;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -24,13 +26,44 @@ public class BookChapterServiceImpl extends ServiceImpl<BookChapterDao, BookChap
@Override
public PageUtils queryPage(Map<String, Object> params) {
Object bookid = params.get("bookid");
IPage<BookChapterEntity> page = this.page(
new Query<BookChapterEntity>().getPage(params),
new QueryWrapper<BookChapterEntity>().eq("book_id",params.get("bookid"))
//8.24修改根据number升序 排序
new QueryWrapper<BookChapterEntity>().eq("book_id",bookid).orderByAsc("number")
);
return new PageUtils(page);
}
@Override
public PageUtils queryPage1(Map<String, Object> params) {
Object chapterid = params.get("chapterid");
System.out.println(chapterid);
IPage<BookChapterEntity> page = this.page(
new Query<BookChapterEntity>().getPage(params),
new QueryWrapper<BookChapterEntity>().eq("book_id",params.get("bookid"))
.eq("number",params.get("number"))
);
return new PageUtils(page);
}
@Override
public List<BookChapterEntity> getUserBookChapter(Integer userId) {
return null;
}
}

View File

@@ -5,8 +5,7 @@ import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.OSSException;
import com.aliyun.oss.model.OSSObject;
import com.google.common.base.Joiner;
import com.peanut.common.utils.ConstantPropertiesUtils;
import com.peanut.common.utils.FileDownloadUtil;
import com.peanut.common.utils.*;
import com.peanut.modules.book.entity.*;
import com.peanut.modules.book.entity.SysDictDataEntity;
import com.peanut.modules.book.service.BookChapterContentService;
@@ -18,10 +17,12 @@ import com.spire.doc.Document;
import com.spire.doc.Section;
import com.spire.doc.documents.Paragraph;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URLDecoder;
@@ -32,8 +33,6 @@ import java.util.regex.Pattern;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.BookDao;
import com.peanut.modules.book.service.BookService;
@@ -55,10 +54,6 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
ConstantPropertiesUtils constantPropertiesUtils;
// String endpoint = ConstantPropertiesUtils.END_POIND;
// String accessKeyId = ConstantPropertiesUtils.ACCESS_KEY_ID;
// String accessKeySecret = ConstantPropertiesUtils.ACCESS_KEY_SECRET;
// String bucketName = ConstantPropertiesUtils.BUCKET_NAME;
@Override
@@ -80,10 +75,11 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
new Query<BookEntity>().getPage(params),
new QueryWrapper<BookEntity>()
.like(StringUtils.isNotBlank(bookName), "name", bookName)
.eq(StringUtils.isNotBlank(state),"state",state)
.apply(StringUtils.isNotBlank(typeC),"FIND_IN_SET ("+ typeC +",type)")
.apply(StringUtils.isNotBlank(publisherName1) , "FIND_IN_SET((SELECT id FROM publisher WHERE publisher_name LIKE concat( '%','" + publisherName1 + "','%')),publisher_id)")
.apply(StringUtils.isNotBlank(authorName1),"FIND_IN_SET((SELECT id FROM author WHERE author_name LIKE concat( '%','" + authorName1 + "','%')),author_id)")
.eq(StringUtils.isNotBlank(state), "state", state)
.orderByDesc("create_time")
.apply(StringUtils.isNotBlank(typeC), "FIND_IN_SET (" + typeC + ",type)")
.apply(StringUtils.isNotBlank(publisherName1), "FIND_IN_SET((SELECT id FROM publisher WHERE publisher_name LIKE concat( '%','" + publisherName1 + "','%')),publisher_id)")
.apply(StringUtils.isNotBlank(authorName1), "FIND_IN_SET((SELECT id FROM author WHERE author_name LIKE concat( '%','" + authorName1 + "','%')),author_id)")
);
for (BookEntity book : page.getRecords()) {
String authorName = "";
@@ -115,7 +111,7 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
for (String tp : split) {
SysDictDataEntity dict = sysDictDataService.getBaseMapper().selectOne(new QueryWrapper<SysDictDataEntity>()
.eq("dict_type", tp).eq("dict_label", "book_type"));
if(dict != null){
if (dict != null) {
list.add(dict.getDictValue());
}
}
@@ -236,7 +232,6 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
indexOf = newStr.indexOf(newChapterName);
// System.out.println(newChapterName + ":" + "第" + count + "行"); // 得到返回的章
if (bflag) {
bflag = false;
@@ -259,9 +254,9 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
content.setContent(substring.trim());
content.setBookId(bookEntityId);
content.setNumber(++linecount);
// System.out.println(substring);
System.out.println(substring);
// contentList.add(substring);
// System.out.println(content.toString());
System.out.println(content.toString());
bookChapterService.save(content);
}
@@ -275,12 +270,11 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
// 致请求无连接可用,程序无法正常工作。
ossObject.close();
bookEntity.setChapterStatus("2");
//
// System.out.println(chapterList);
// System.out.println(contentList);
} catch (OSSException oe) {
bookEntity.setChapterStatus("3");
System.out.println("Caught an OSSException, which means your request made it to OSS, "
@@ -309,7 +303,7 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
IPage<BookEntity> page = this.page(
new Query<BookEntity>().getPage(params),
new QueryWrapper<BookEntity>().eq("state",1).eq("istop", 1).orderByDesc("sort")
new QueryWrapper<BookEntity>().eq("state", 1).eq("istop", 1).orderByDesc("sort")
);
List<BookEntity> newBookList = page.getRecords();
@@ -348,11 +342,20 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
}
@Override
public PageUtils getNewBook(Map<String, Object> params) {
public PageUtils getbooklist(Map<String, Object> params) {
Object id = params.get("id");
IPage<BookEntity> page = this.page(
new Query<BookEntity>().getPage(params),
new QueryWrapper<BookEntity>().eq("id",id)
);
return new PageUtils(page);
}
@Override
public PageUtils getNewBook(Map<String, Object> params) {
IPage<BookEntity> page = this.page(
new Query<BookEntity>().getPage(params),
new QueryWrapper<BookEntity>().eq("state",1).orderByDesc("create_time")
new QueryWrapper<BookEntity>().eq("state", 1).orderByDesc("create_time")
);
List<BookEntity> newBookList = page.getRecords();
@@ -394,7 +397,7 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
public PageUtils getSaleBook(Map<String, Object> params) {
IPage<BookEntity> page = this.page(
new Query<BookEntity>().getPage(params),
new QueryWrapper<BookEntity>().eq("is_sale", 1).eq("state",1).orderByDesc("sort")
new QueryWrapper<BookEntity>().eq("is_sale", 1).eq("state", 1).orderByDesc("sort")
);
List<BookEntity> newBookList = page.getRecords();
@@ -443,11 +446,15 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
//遍历Paragraph每个小节下有若干段落
for (int j = 0; j < section.getParagraphs().getCount() - 1; j++) {
Paragraph paragraph = section.getParagraphs().get(j);
System.out.println(paragraph.getStyleName() + "-----");
System.out.println(paragraph.getText().trim());
System.out.println(StringUtils.isNotBlank(paragraph.getText().trim()));
//获取标题
if (paragraph.getStyleName().equals("Heading1") && StringUtils.isNotBlank(paragraph.getText().trim()))//段落样式为“标题1”的内容
// if (paragraph.getStyleName().equals("Normal") && StringUtils.isNotBlank(paragraph.getText().trim()))//段落样式为“标题1”的内容
{
num++;
//如果 是标题 1 为一级 目录
String level1 = paragraph.getText();
BookChapterEntity bookChapterEntity = new BookChapterEntity();
bookChapterEntity.setBookId(bookId);
@@ -462,5 +469,197 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
return false;
}
//todo 章节拆分 按照章节保存
@Override
public boolean getWord(Integer bookId) {
BookEntity bookEntity = this.getBaseMapper().selectById(bookId);
String novel = bookEntity.getNovel();
InputStream inputStream = FileDownloadUtil.getInputStream(novel);
Document doc = new Document(inputStream);
int num = 0;
for (int i = 0; i < doc.getSections().getCount(); i++) {
Section section = doc.getSections().get(i);
//遍历Paragraph每个小节下有若干段落
for (int j = 0; j < section.getParagraphs().getCount() - 1; j++) {
//插入分页符到小节下若干段落
Paragraph paragraph = section.getParagraphs().get(j);
//插入分页符到第五个段落
// Paragraph paragraph = section.getParagraphs().get(4);
//获取标题
// int cj = 0;
// if (section.getParagraphs().get(j).getStyleName().equals("Heading2")) {
// cj = 2;
// }
// if (section.getParagraphs().get(j).getStyleName().equals("Heading3")) {
// cj = 3;
// }
// if (section.getParagraphs().get(j).getStyleName().equals("Heading4")) {
// cj = 4;
// }
// int cj= 0;
// if (section.getParagraphs().get(j).getStyleName().equals("Heading2")) {
//// cj = 2;
// }
// if(section.getParagraphs().get(j).getStyleName().equals(""))
if (paragraph.getStyleName().equals("Heading1") && StringUtils.isNotBlank(paragraph.getText().trim())) {
StringBuilder builder = new StringBuilder();
do {
builder.append(section.getParagraphs().get(j).getText());
j++;
//防止index超出异常发生
if (j >= section.getParagraphs().getCount()) {
break;
}
} while (!section.getParagraphs().get(j).getStyleName().equals("Heading1"));
//获取段落标题内容
String text = builder.toString();
num++;
//如果 是标题 1 为一级 目录
String level1 = paragraph.getText();
BookChapterEntity bookChapterEntity = new BookChapterEntity();
bookChapterEntity.setBookId(bookId);
bookChapterEntity.setNumber(num);
bookChapterEntity.setChapter(level1);
bookChapterEntity.setContent(text);
bookChapterService.save(bookChapterEntity);
}
}
}
doc.close();
return false;
}
/**
* number章节号变小节号
* 如果上传文档为只有heading1标题则按照标题1进行拆分
* 如果上传文档的heading1标题下有heading2标题则按照标题2进行拆分
* @param bookId 图书ID
*
* @return0
*/
@Override
public boolean getWordSection(Integer bookId) {
BookEntity bookEntity = this.getBaseMapper().selectById(bookId);
String novel = bookEntity.getNovel();
InputStream inputStream = FileDownloadUtil.getInputStream(novel);
Document doc = new Document(inputStream);
int nums = 0;
String title2Text = "";
int num1=0;
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<>();
paraMap.put(currentTitle,secondTitleList);
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++;
//防止index超出异常发生
if (head_index >= section.getParagraphs().getCount()) {
break;
}
} while (!section.getParagraphs().get(head_index).getStyleName().equals("Heading2"));
String head_text = builder.toString();
headMap.put(currentTitle,head_text);
}
} else if (paragraph.getStyleName().equals("Heading2") && StringUtils.isNotBlank(paragraph.getText().trim())) {
StringBuilder builder = new StringBuilder();
boolean isRun = false;
do {
if(isRun){
builder.append(section.getParagraphs().get(j).getText());
}
isRun = true;
j++;
//防止index超出异常发生
if (j >= section.getParagraphs().getCount()) {
break;
}
} while (!section.getParagraphs().get(j).getStyleName().equals("Heading2")&&!section.getParagraphs().get(j).getStyleName().equals("Heading1"));
j --;
String text = builder.toString();
nums++;
title2Text = paragraph.getText(); // 获取标题二的文本内容
if(null != title2Text && !"".equals(title2Text)){
String [] s = new String[]{title2Text,text};
paraMap.get(currentTitle).add(s);
}
}
}
}
int index = 0;
for(String title: title_list){
if(null == paraMap.get(title) || paraMap.get(title).size() == 0){
index ++ ;
BookChapterEntity bookChapterEntity = new BookChapterEntity();
bookChapterEntity.setBookId(bookId);
bookChapterEntity.setNumber(index);
bookChapterEntity.setChapter(title);
bookChapterEntity.setSort(1);
if(null != headMap.get(title)){
bookChapterEntity.setContent(headMap.get(title));
}else {
bookChapterEntity.setContent("");
}
bookChapterService.save(bookChapterEntity);
}else {
for(String[] t : paraMap.get(title)){
index ++;
BookChapterEntity bookChapterEntity = new BookChapterEntity();
bookChapterEntity.setBookId(bookId);
bookChapterEntity.setSort(2);
bookChapterEntity.setNumber(index);
bookChapterEntity.setChapter(title+","+t[0]);
bookChapterEntity.setContent(t[1]);
bookChapterService.save(bookChapterEntity);
}
}
}
return false;
}
}
}

View File

@@ -1,23 +1,19 @@
package com.peanut.modules.book.service.impl;
import com.peanut.modules.book.entity.*;
import com.peanut.modules.book.service.*;
import com.peanut.modules.book.vo.BookShelfVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.BookShelfDao;
@@ -32,12 +28,14 @@ public class BookShelfServiceImpl extends ServiceImpl<BookShelfDao, BookShelfEnt
private BookReadRateService bookReadRateService;
@Autowired
private BookChapterService bookChapterService;
@Autowired
private BookListeningService bookListeningService;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<BookShelfEntity> page = this.page(
new Query<BookShelfEntity>().getPage(params),
new QueryWrapper<BookShelfEntity>()
new QueryWrapper<BookShelfEntity>().orderByDesc("update_time")
);
return new PageUtils(page);
@@ -78,6 +76,9 @@ public class BookShelfServiceImpl extends ServiceImpl<BookShelfDao, BookShelfEnt
BookReadRateEntity bookReadRateEntity = bookReadRateService.getBaseMapper().selectOne(new QueryWrapper<BookReadRateEntity>()
.eq("user_id", userId)
.eq("book_id", bookid));
// BookReadRateEntity bookReadRateEntity = bookReadRateService.getOne(new QueryWrapper<BookReadRateEntity>()
// .eq("user_id", userId)
// .eq("book_id", bookid));
String percent = "";
if (bookReadRateEntity == null) {
@@ -87,7 +88,7 @@ public class BookShelfServiceImpl extends ServiceImpl<BookShelfDao, BookShelfEnt
String chapterName = bookReadRateEntity.getChapterName();
//4. 根据 章节id 去书籍表查询
BookChapterEntity bookChapterEntity = bookChapterService.getBaseMapper().selectById(chapterId);
BookChapterEntity bookChapterEntity = bookChapterService.getBaseMapper().selectById(bookReadRateEntity.getContentId());
if (bookChapterEntity == null) {
percent = "0%";
}else {
@@ -100,6 +101,8 @@ public class BookShelfServiceImpl extends ServiceImpl<BookShelfDao, BookShelfEnt
if (idNumber == 0){
percent = "0%";
}else {
//todo 章节号等于3 idnumber章节数13 3除以13等于阅读进度
float xx = (float)number / idNumber;
DecimalFormat df = new DecimalFormat("##.00%");
@@ -131,4 +134,100 @@ public class BookShelfServiceImpl extends ServiceImpl<BookShelfDao, BookShelfEnt
return list;
}
@Override
public List<BookShelfVo> getUserBookChapterRead(Integer userId) {
List list = new ArrayList();
//1.获取 用户的 书架列表
List<BookShelfEntity> bookShelf = this.baseMapper.selectList(new QueryWrapper<BookShelfEntity>().eq("user_id", userId).orderByDesc("update_time"));
//2. 遍历 获取书 的 详情
for (BookShelfEntity bookShelfEntity : bookShelf) {
String authorName = "";
Integer bookid = bookShelfEntity.getBookId();
BookShelfVo bookShelfVo = new BookShelfVo();
BookEntity bookEntity = bookService.getBaseMapper().selectById(bookid);
String name = bookEntity.getName();
String images = bookEntity.getImages();
String authorId = bookEntity.getAuthorId();
String[] authorIds = authorId.split(",");
List<String> authorList = Arrays.asList(authorIds);
List<AuthorEntity> authorEntities = authorService.getBaseMapper().selectList(new QueryWrapper<AuthorEntity>().in("id", authorList));
for (AuthorEntity authorEntity : authorEntities) {
authorName += "," + authorEntity.getAuthorName();
}
authorName = authorName.startsWith(",") ? authorName.substring(1) : authorName;
//3. 根据 userid bookid 查询书籍 阅读进度
// BookReadRateEntity bookReadRateEntity = bookReadRateService.getBaseMapper().selectOne(new QueryWrapper<BookReadRateEntity>()
// .eq("user_id", userId)
// .eq("book_id", bookid));
BookListeningEntity bookListeningEntity = bookListeningService.getBaseMapper().selectOne(new QueryWrapper<BookListeningEntity>()
.eq("user_id", userId)
.eq("book_id", bookid));
String percent = "";
if (bookListeningEntity == null) {
percent = "0%";
} else {
Integer chapterId = bookListeningEntity.getChapterId();
String chapterName = bookListeningEntity.getChapterName();
//4. 根据 章节id 去书籍表查询
BookChapterEntity bookChapterEntity = bookChapterService.getBaseMapper().selectById(bookListeningEntity.getContentId());
if (bookChapterEntity == null) {
percent = "0%";
}else {
Integer number = bookChapterEntity.getNumber();
BookChapterEntity book_id = bookChapterService.getBaseMapper().selectOne(new QueryWrapper<BookChapterEntity>()
.select("max(number) as number")
.eq("book_id", bookid));
Integer idNumber = book_id.getNumber();
if (idNumber == 0){
percent = "0%";
}else {
//todo 章节号等于3 idnumber章节数13 3除以13等于阅读进度
float xx = (float)number / idNumber;
DecimalFormat df = new DecimalFormat("##.00%");
// float xx = (float) number / idNumber;
// int df = (int) (xx * 3600); // 将百分比转换为秒数
if (Math.abs(xx) < 0.000000000001) {
percent = "0.00%";
} else {
percent = df.format(xx);
}
bookShelfVo.setChapterNum(number);
}
}
bookShelfVo.setChapterId(chapterId);
bookShelfVo.setChapterName(chapterName);
}
bookShelfVo.setBookShelfId(bookShelfEntity.getId());
bookShelfVo.setBookid(bookid);
bookShelfVo.setBookName(name);
bookShelfVo.setAuthorName(authorName);
bookShelfVo.setImage(images);
bookShelfVo.setPrecent(percent);
list.add(bookShelfVo);
}
return list;
}
}

View File

@@ -1,8 +1,15 @@
package com.peanut.modules.book.service.impl;
import com.peanut.modules.book.entity.BookEntity;
import com.peanut.modules.book.entity.ShopProductEntity;
import com.peanut.modules.book.service.BookService;
import com.peanut.modules.book.service.ShopProductService;
import jodd.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.awt.print.Book;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -32,6 +39,13 @@ public class BuyOrderDetailServiceImpl extends ServiceImpl<BuyOrderDetailDao, Bu
}
/**
* 去重查询未打印的面单信息
* @param params
@@ -47,6 +61,26 @@ public class BuyOrderDetailServiceImpl extends ServiceImpl<BuyOrderDetailDao, Bu
return new PageUtils(page);
}
@Override
public PageUtils querybuy(Map<String, Object> params) {
Integer userid = Integer.valueOf((String) params.get("id"));
IPage<BuyOrderDetailEntity> page = this.page(
new Query<BuyOrderDetailEntity>().getPage(params),
new QueryWrapper<BuyOrderDetailEntity>()
.eq("user_id",userid)
);
System.out.println("=====querybuy=====userid================"+userid);
return new PageUtils(page);
}
@Override
public PageUtils querybuyss(Map<String, Object> params) {
return null;
}
@Override
public void batchUpdateByShippingSns(String[] shippingSnList) {

View File

@@ -1,5 +1,6 @@
package com.peanut.modules.book.service.impl;
import cn.com.marsoft.tool.ToolObject;
import com.alibaba.druid.mock.MockConnection;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -28,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.xml.soap.Text;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -45,13 +47,16 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
private ShopProductService shopProductService;
@Autowired
private MyUserService myUserService;
@Autowired
//todo 6.2 buyOrderDao buyOrderDetailDao因为报红把 @Autowired 换成JDK注解 @Resource它不检查所以也就不会报红。
@Resource
private BuyOrderDao buyOrderDao;
@Autowired
@Resource
private BuyOrderDetailDao buyOrderDetailDao;
@Autowired
private FMSOrderDetailService fmsOrderDetailService;
protected Logger logger = LoggerFactory.getLogger(BuyOrderServiceImpl.class);
private MockConnection connection;
@@ -148,6 +153,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
// 交易失败 9
BuyOrderEntity orderEntity = this.getOne(new QueryWrapper<BuyOrderEntity>().eq("user_id", userId)
.eq("order_sn", orderSn));
if (type.equals("0")) {
orderEntity.setOrderStatus("1");
} else if (type.equals("9")) {
@@ -294,6 +300,8 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
Map<String, Object> param = new HashMap<>();
param.put("ShipperCode", shipperCode);
param.put("LogisticCode", expNo);
//todo 如果使用顺丰需要加上CustomerName手机号后四位才可以
// param.put("CustomerName",phone)
try {
//todo expNo不等于1则执行第一个代码块否则执行第二个代码块。 5.5
// if (!expNo.equals(1)) {
@@ -309,7 +317,11 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
return jsonObject;
}
}else {
return null;
String rntStr = KdApiEOrder.queryOrderOnlineByJson(param);
JSONObject jsonObject = JSONObject.parseObject(rntStr);
if ("true".equals(jsonObject.getString("Success"))) {
return jsonObject;
}
}
String rntStr = KdApiEOrder.queryOrderOnlineByJson(param);
@@ -520,7 +532,13 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
BuyOrderEntity o = this.getById(fms.getOrderId());
BuyOrderDetailEntity detail = this.buyOrderDetailService.getById(fms.getDetailId());
detail.setOrderStatus("1");
detail.setFmsHtml(PrintTemplate);
if (PrintTemplate.equals(buyOrderDetailService.getById(detail))){
return;
}else {
detail.setFmsHtml(PrintTemplate);
}
// detail.setFmsHtml(PrintTemplate);
detail.setCreatTime(new Date());
detail.setShippingSn(SortingCode);
detail.setShipperCode(ShipperCode);
@@ -539,6 +557,14 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
}
this.updateById(o);
buyOrderDao.updateById(o);
//todo 混合发货原本属于订单A的的信息无缘无故跑到订单B。或者订单C里面去
// todo 打印面单快递单号重复 主要问题在html表格里面有 可能是数据太多导致混乱把数据清除再做一次混合发货 查看错误
Map<String, Object> map = new HashMap<>();
buyOrderDetailService.querySheet(map);
}
}
@@ -656,6 +682,52 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
}
return R.ok(Xsode) ;
}
/*
打印时查重
*/
@Override
public PageUtils querySheet(Map<String, Object> params) {
IPage<BuyOrderEntity> page = this.page(
new Query<BuyOrderEntity>().getPage(params),
new QueryWrapper<BuyOrderEntity>().eq("is_print","0")
.groupBy("shipping_sn")
);
return new PageUtils(page);
}
@Override
public PageUtils queryPages(Map<String, Object> params) {
String orderStatus = (String) params.get("orderStatus");
if (orderStatus.equals("9")) {
orderStatus = null;
}
String userId = (String) params.get("userId");
IPage<BuyOrderEntity> page = this.page(
new Query<BuyOrderEntity>().getPage(params),
new QueryWrapper<BuyOrderEntity>()
.eq("user_id", userId)
.eq(StringUtils.isNotBlank(orderStatus), "order_status", orderStatus)
.orderByDesc("create_time")
);
List<BuyOrderEntity> records = page.getRecords();
for (BuyOrderEntity buyOrderEntity : records) {
Integer orderId = buyOrderEntity.getOrderId();
List<BuyOrderDetailEntity> entities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper<BuyOrderDetailEntity>()
.eq("order_id", orderId));
for (BuyOrderDetailEntity entity : entities) {
Integer productId = entity.getProductId();
ShopProductEntity shopPro = shopProductService.getById(productId);
entity.setImage(shopPro.getProductImages());
}
buyOrderEntity.setProducts(entities);
}
return new PageUtils(page);
}
/**
@@ -774,4 +846,4 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrderEntity
return 0;
}
}
}

View File

@@ -82,6 +82,8 @@ public class CouponHistoryServiceImpl extends ServiceImpl<CouponHistoryDao, Coup
if (!isEffective) {
couponsUser.setUseStatus(2);
needCouponsUserList.add(couponsUser); //需要更新状态的券
couponEntity.setCurrentState("2");
this.couponService.updateById(couponEntity);
}
}

View File

@@ -1,5 +1,6 @@
package com.peanut.modules.book.service.impl;
import com.peanut.common.utils.ExcludeEmptyQueryWrapper;
import com.peanut.modules.book.service.CouponHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -27,12 +28,12 @@ public class CouponServiceImpl extends ServiceImpl<CouponDao, CouponEntity> impl
if("0".equals(cu)){
page = this.page(
new Query<CouponEntity>().getPage(params),
new QueryWrapper<CouponEntity>()
new ExcludeEmptyQueryWrapper<CouponEntity>().like("coupon_name",params.get("key"))
);
}else{
page = this.page(
new Query<CouponEntity>().getPage(params),
new QueryWrapper<CouponEntity>().eq("current_state",cu)
new ExcludeEmptyQueryWrapper<CouponEntity>().eq("current_state",cu).like("coupon_name",params.get("key"))
);
}

View File

@@ -1,6 +1,7 @@
package com.peanut.modules.book.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alipay.api.domain.Member;
import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
import com.aliyun.dysmsapi20170525.models.SendSmsResponseBody;
@@ -9,7 +10,7 @@ import com.aliyun.teautil.Common;
import com.aliyun.teautil.models.RuntimeOptions;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.google.common.collect.Maps;
import com.peanut.common.utils.R;
import com.peanut.common.utils.*;
import com.peanut.config.DelayQueueConfig;
import com.peanut.modules.app.config.SMSConfig;
import com.peanut.modules.app.config.Sample;
@@ -17,19 +18,17 @@ import com.peanut.modules.book.entity.*;
import com.peanut.modules.book.service.*;
import com.peanut.modules.mq.service.RabbitMqService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.MyUserDao;
@@ -54,12 +53,14 @@ public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> impl
private CouponService couponService;
@Autowired
private CouponHistoryService couponHistoryService;
@Autowired
private MyUserDao myUserDao;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<MyUserEntity> page = this.page(
new Query<MyUserEntity>().getPage(params),
new QueryWrapper<MyUserEntity>()
new ExcludeEmptyQueryWrapper<MyUserEntity>().like("name",params.get("key")).or().eq("tel",params.get("key"))
);
return new PageUtils(page);
@@ -77,6 +78,7 @@ public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> impl
//查询书籍 类型
BookEntity book = bookService.getById(bookId);
Integer isVip = book.getIsVip(); // 0 - 免费 1- 会免 2 - 付费
Boolean canListen = book.getCanListen();
if (isVip == 1) {
// 查询 用户是否为 vip 0 - 普通 1- 会员
MyUserEntity myUserEntity = this.getBaseMapper().selectById(userId);
@@ -95,6 +97,7 @@ public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> impl
}
if (isVip == 2) {
// TODO 查询 购买表中是否有用户购买记录
TransactionDetailsEntity transactionDetailsEntity = transactionDetailsService.getBaseMapper().selectOne(new QueryWrapper<TransactionDetailsEntity>().eq("user_id", userId)
.eq("relation_id", bookId));
@@ -104,11 +107,53 @@ public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> impl
}
}
//vip等于3为听书付费
if (isVip == 3){
UserEbookBuyEntity userid = userEbookBuyService.getBaseMapper().selectOne(new QueryWrapper<UserEbookBuyEntity>()
.eq("user_id", userId)
.eq("book_id",bookId));
if (userid == null) {
return false;
}
}
if (canListen == true){
UserEbookBuyEntity userid = userEbookBuyService.getBaseMapper().selectOne(new QueryWrapper<UserEbookBuyEntity>()
.eq("user_id", userId)
.eq("book_id",bookId));
if (userid == null) {
return false;
}
}
return true;
}
@Override
public boolean bookAuthenti(Integer bookId, Integer userId) {
//查询书籍 类型
BookEntity book = bookService.getById(bookId);
Integer isVip = book.getIsVip(); // 0 - 免费 1- 会免 2 - 付费
UserEbookBuyEntity userid = userEbookBuyService.getBaseMapper().selectOne(new QueryWrapper<UserEbookBuyEntity>()
.eq("user_id", userId)
.eq("book_id",bookId));
System.out.println("userid==========="+userid);
if (userid == null) {
return false;
}
return true;
}
@Override
public boolean openMember(Integer customerId,Integer openMonth) {
@@ -195,8 +240,9 @@ public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> impl
if (user == null) {
return false;
}
Integer peanutCoin = user.getPeanutCoin();
user.setPeanutCoin(peanutCoin + HSPoint);
BigDecimal hs = new BigDecimal(HSPoint);
BigDecimal peanutCoin = user.getPeanutCoin();
user.setPeanutCoin(peanutCoin.add(hs));
this.updateById(user);
return true;
}
@@ -217,6 +263,7 @@ public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> impl
BigDecimal salePrice = new BigDecimal(0);
// 查询书籍 价格
BookEntity book = bookService.getById(Integer.valueOf(bookId));
@@ -240,21 +287,23 @@ public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> impl
//查询用户
MyUserEntity user = this.getById(Integer.valueOf(userId));
Double peanutCoin = user.getPeanutCoin() - salePrice.doubleValue();
Double peanutCoin = user.getPeanutCoin().doubleValue() - salePrice.doubleValue();
if (peanutCoin < 0) {
return "当前书籍以购买,请勿重复购买!";
}
user.setPeanutCoin(peanutCoin.intValue());
user.setPeanutCoin(new BigDecimal(peanutCoin));
this.updateById(user);
TransactionDetailsEntity detailsEntity = new TransactionDetailsEntity();
detailsEntity.setUserId(Integer.valueOf(userId));
detailsEntity.setChangeAmount(salePrice.negate());
detailsEntity.setUserBalance(new BigDecimal(user.getPeanutCoin()));
detailsEntity.setUserBalance(user.getPeanutCoin());
detailsEntity.setRemark("购买:"+book.getName());
detailsEntity.setOrderType("购买电子书");
detailsEntity.setRelationId(Integer.valueOf(bookId));
detailsEntity.setUserName(user.getNickname());
detailsEntity.setTel(user.getTel());
transactionDetailsService.save(detailsEntity);
// 插入购买记录
@@ -291,6 +340,60 @@ public class MyUserServiceImpl extends ServiceImpl<MyUserDao, MyUserEntity> impl
return "购买成功!";
}
/**
* 更新
*
* @param user
*/
@Override
public void update(MyUserEntity user) {
myUserDao.update(user);
}
/**
* 微信授权登录
*
* @param userAppAuthorEntity
*/
@Override
public R getUserInfoByApp(UserAppAuthorEntity userAppAuthorEntity) {
// todo CommConfig WeiXinParam 表未建
try {
Member member = new Member();
BeanUtils.copyProperties(userAppAuthorEntity, member);
CommConfig commConfig = new CommConfig();
//调用微信授权
// WeixinLoginUtils appWeiXinUserInfo1 = weixinLoginUtils1.getAppWeiXinUserInfo(commConfig.);
WeixinLoginUtils weixinLoginUtils = new WeixinLoginUtils();
StringBuilder stringBuilder = weixinLoginUtils.getAccessTokenBycode(commConfig.getUserAppID(), commConfig.getUserAppSecret(), userAppAuthorEntity.getCode());
if (stringBuilder != null) {
if (stringBuilder.toString().trim().contains("errcode")) {
return R.error();
}
JSONObject object = JSONObject.parseObject(stringBuilder.toString().trim());
String accessToken = object.getString("access_token"); //接口调用凭证
String openID = object.getString("openid"); //授权用户唯一标识
//获取微信用户基本信息
WeiXinParam appWeiXinUserInfo = weixinLoginUtils.getAppWeiXinUserInfo(accessToken, openID, WeiXinParam.class);
// TODO 业务逻辑
return R.ok().put("member",member);
}
} catch (Exception e) {
e.printStackTrace();
}
return R.ok("sec");
}
@Override
public boolean bookEbookBuy(Integer bookid, Integer userId) {
return false;
}
private void sendCode(String phone,String code) throws Exception {
com.aliyun.dysmsapi20170525.Client client = Sample.createClient(smsConfig.getAccessKeyId(),smsConfig.getAccessKeySecret());

View File

@@ -1,5 +1,7 @@
package com.peanut.modules.book.service.impl;
import com.peanut.common.utils.ExcludeEmptyQueryWrapper;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -20,7 +22,10 @@ public class PayPaymentOrderServiceImpl extends ServiceImpl<PayPaymentOrderDao,
public PageUtils queryPage(Map<String, Object> params) {
IPage<PayPaymentOrderEntity> page = this.page(
new Query<PayPaymentOrderEntity>().getPage(params),
new QueryWrapper<PayPaymentOrderEntity>()
new ExcludeEmptyQueryWrapper<PayPaymentOrderEntity>()
.eq("tel",params.get("key"))
.or().like("user_name",params.get("key")).orderByDesc("create_time")
);
return new PageUtils(page);

View File

@@ -20,7 +20,7 @@ public class PublisherServiceImpl extends ServiceImpl<PublisherDao, PublisherEnt
public PageUtils queryPage(Map<String, Object> params) {
IPage<PublisherEntity> page = this.page(
new Query<PublisherEntity>().getPage(params),
new QueryWrapper<PublisherEntity>()
new QueryWrapper<PublisherEntity>().orderByDesc("create_time")
);
return new PageUtils(page);

View File

@@ -32,12 +32,14 @@ public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryDao, ShopCa
return new PageUtils(page);
}
@Override
public List<ShopCategoryEntity> listTree() {
List<ShopCategoryEntity> entities = baseMapper.selectList(null);
//一级菜单
List<ShopCategoryEntity> level1 = entities.stream().filter((catalogueEntity) ->
catalogueEntity.getParentCid() == 0
).map((menu)->{
menu.setChildren(getChildrens(menu,entities));
return menu;
@@ -56,7 +58,8 @@ public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryDao, ShopCa
@Override
public List<ShopCategoryEntity> getOneLevel() {
List<ShopCategoryEntity> list = this.list(new QueryWrapper<ShopCategoryEntity>().eq("parent_cid", 1).eq("show_status", 1));
// List<ShopCategoryEntity> list = this.list(new QueryWrapper<ShopCategoryEntity>().eq("parent_cid", 1).eq("show_status", 1));
List<ShopCategoryEntity> list = this.list(new QueryWrapper<ShopCategoryEntity>().eq("name", "医学视频").eq("show_status", 1));
return list;
}
@@ -68,6 +71,11 @@ public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryDao, ShopCa
return list;
}
@Override
public List<String> findBookId(String bookId) {
return null;
}
@Override
public List<Integer> findPoid(Integer oid) {
List<Integer> list = new ArrayList<>();

View File

@@ -1,5 +1,6 @@
package com.peanut.modules.book.service.impl;
import com.peanut.common.utils.ExcludeEmptyQueryWrapper;
import com.peanut.modules.book.entity.ShopCategoryEntity;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@@ -11,7 +12,6 @@ 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.ShopProductDao;
import com.peanut.modules.book.entity.ShopProductEntity;
import com.peanut.modules.book.service.ShopProductService;
@@ -22,14 +22,12 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
@Override
public PageUtils queryPage(Map<String, Object> params) {
String userid = (String) params.get("userid");
IPage<ShopProductEntity> page = this.page(
new Query<ShopProductEntity>().getPage(params),
new QueryWrapper<ShopProductEntity>()
new ExcludeEmptyQueryWrapper<ShopProductEntity>().like("product_name", params.get("key"))
.notLike("book_ids",",")
);
return new PageUtils(page);
}
@@ -39,7 +37,6 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
new Query<ShopProductEntity>().getPage(params),
new QueryWrapper<ShopProductEntity>()
);
return new PageUtils(page);
}
@@ -49,4 +46,24 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
return list;
}
@Override
public PageUtils getNewBook(Map<String, Object> params) {
IPage<ShopProductEntity> page = this.page(
new Query<ShopProductEntity>().getPage(params),
new QueryWrapper<ShopProductEntity>().orderByDesc("create_time")
);
return new PageUtils(page);
}
@Override
public PageUtils selectListqueryPage(Map<String, Object> params) {
Object name = params.get("name");
IPage<ShopProductEntity> page = this.page(
new Query<ShopProductEntity>().getPage(params),
new ExcludeEmptyQueryWrapper<ShopProductEntity>().like("product_name", params.get("key"))
);
return new PageUtils(page);
}
}

View File

@@ -23,6 +23,7 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
@@ -63,6 +64,7 @@ public class ShopSeckillServiceImpl extends ServiceImpl<ShopSeckillDao, ShopSeck
IPage<ShopSeckillEntity> page = this.page(
new Query<ShopSeckillEntity>().getPage(params),
new QueryWrapper<ShopSeckillEntity>()
);
return new PageUtils(page);
@@ -90,6 +92,17 @@ public class ShopSeckillServiceImpl extends ServiceImpl<ShopSeckillDao, ShopSeck
saveSessionInfo(seckilProdVo);
saveSessionProdInfo(seckilProdVo);
Set<String> keys = stringRedisTemplate.keys(SESSIONS_CACHE_PREFIX + "*");
long time = new Date().getTime();
for(String key : keys){
String replace = key.replace(SESSIONS_CACHE_PREFIX, "");
String[] s = replace.split("_");
long endTime = Long.parseLong(s[1]);
if(endTime <= time){
stringRedisTemplate.delete(key);
}
}
}
@Override
@@ -104,6 +117,7 @@ public class ShopSeckillServiceImpl extends ServiceImpl<ShopSeckillDao, ShopSeck
long startTime = Long.parseLong(s[0]);
long endTime = Long.parseLong(s[1]);
if (time >= startTime && time <= endTime ) {
List<String> list = stringRedisTemplate.opsForList().range(key, -100, 100);

View File

@@ -1,24 +1,19 @@
package com.peanut.modules.book.service.impl;
import com.peanut.modules.book.entity.BookEntity;
import com.peanut.modules.book.entity.MyUserEntity;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.common.utils.ExcludeEmptyQueryWrapper;
import com.peanut.common.utils.PageUtils;
import com.peanut.common.utils.Query;
import com.peanut.modules.book.dao.TransactionDetailsDao;
import com.peanut.modules.book.entity.TransactionDetailsEntity;
import com.peanut.modules.book.service.BookService;
import com.peanut.modules.book.service.MyUserService;
import com.peanut.modules.book.service.TransactionDetailsService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.TransactionDetailsDao;
import com.peanut.modules.book.entity.TransactionDetailsEntity;
import com.peanut.modules.book.service.TransactionDetailsService;
@Service("transactionDetailsService")
@@ -34,7 +29,9 @@ public class TransactionDetailsServiceImpl extends ServiceImpl<TransactionDetail
IPage<TransactionDetailsEntity> page = this.page(
new Query<TransactionDetailsEntity>().getPage(params),
new QueryWrapper<TransactionDetailsEntity>().eq(StringUtils.isNotBlank(userId),"user_id",userId)
new ExcludeEmptyQueryWrapper<TransactionDetailsEntity>()
.eq(StringUtils.isNotBlank(userId),"user_id",userId)
.eq("tel",params.get("key")).or().like("user_name",params.get("key")).orderByDesc("create_time")
);
return new PageUtils(page);

View File

@@ -1,6 +1,9 @@
package com.peanut.modules.book.service.impl;
import com.peanut.modules.book.entity.BuyOrderEntity;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -26,5 +29,39 @@ public class UserEbookBuyServiceImpl extends ServiceImpl<UserEbookBuyDao, UserEb
return new PageUtils(page);
}
@Override
public PageUtils queryPages(Map<String, Object> params) {
Integer userid = Integer.valueOf((String) params.get("id"));
IPage<UserEbookBuyEntity> page = this.page(
new Query<UserEbookBuyEntity>().getPage(params),
new QueryWrapper<UserEbookBuyEntity>()
.eq("user_id",userid)
);
return new PageUtils(page);
}
}