--新增书评接口,端口修改

This commit is contained in:
yc13649764453
2023-09-12 18:10:26 +08:00
parent 408782f7aa
commit 4deeb605f8
28 changed files with 703 additions and 563 deletions

View File

@@ -38,7 +38,7 @@ public class AuthorController {
* 列表
*/
@RequestMapping("/list")
@RequiresPermissions("book:author:list")
// @RequiresPermissions("book:author:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = authorService.queryPage(params);
@@ -67,7 +67,7 @@ public class AuthorController {
* 信息
*/
@RequestMapping("/info/{id}")
@RequiresPermissions("book:author:info")
// @RequiresPermissions("book:author:info")
public R info(@PathVariable("id") Integer id){
AuthorEntity author = authorService.getById(id);
return R.ok().put("author", author);
@@ -95,7 +95,7 @@ public class AuthorController {
* 保存
*/
@RequestMapping("/save")
@RequiresPermissions("book:author:save")
// @RequiresPermissions("book:author:save")
public R save(@RequestBody AuthorEntity author){
authorService.save(author);
@@ -106,7 +106,7 @@ public class AuthorController {
* 修改
*/
@RequestMapping("/update")
@RequiresPermissions("book:author:update")
// @RequiresPermissions("book:author:update")
public R update(@RequestBody AuthorEntity author){
authorService.updateById(author);
@@ -117,7 +117,7 @@ public class AuthorController {
* 删除
*/
@RequestMapping("/delete")
@RequiresPermissions("book:author:delete")
// @RequiresPermissions("book:author:delete")
public R delete(@RequestBody Integer[] ids){
authorService.removeByIds(Arrays.asList(ids));

View File

@@ -184,7 +184,7 @@ public class BookController {
* 保存
*/
@RequestMapping("/save")
@RequiresPermissions("book:book:save")
public R save(@RequestBody BookEntity book) {
bookService.save(book);
@@ -196,7 +196,7 @@ public class BookController {
* 修改
*/
@RequestMapping("/update")
@RequiresPermissions("book:book:update")
public R update(@RequestBody BookEntity book) {
bookService.updateById(book);
@@ -207,7 +207,7 @@ public class BookController {
* 删除
*/
@RequestMapping("/delete")
@RequiresPermissions("book:book:delete")
public R delete(@RequestBody Integer[] ids) {
bookService.removeByIds(Arrays.asList(ids));

View File

@@ -1,15 +1,14 @@
package com.peanut.modules.book.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.peanut.common.utils.PageUtils;
import com.peanut.common.utils.R;
import com.peanut.modules.book.entity.BookForumArticlesEntity;
import com.peanut.modules.book.entity.BookForumCommentEntity;
import com.peanut.modules.book.service.BookForumArticlesService;
import com.peanut.modules.book.service.BookForumCommenService;
import com.peanut.modules.book.entity.*;
import com.peanut.modules.book.service.*;
import com.peanut.modules.book.vo.BookForumArticlesVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
import java.util.*;
@RestController
@RequestMapping("forum/articles")
@@ -18,6 +17,12 @@ public class BookForumArticlesServiceController {
private BookForumArticlesService bookForumArticlesService;
@Autowired
private BookForumCommenService bookForumCommenService;
@Autowired
private BookService bookService;
@Autowired
private AuthorService authorService;
@Autowired
private PublisherService publisherService;
/**
* 列表 (开始时间倒叙) 后台get请求
@@ -34,13 +39,100 @@ public class BookForumArticlesServiceController {
*/
@RequestMapping("/descupdatelist")
public R Descupdatelist(@RequestParam Map<String, Object> params){
PageUtils page = bookForumArticlesService.queryPages(params);
return R.ok().put("page", page);
}
@RequestMapping("/desc/{page}")
public R Descupd(@RequestParam Map<String, Object> params,@PathVariable("page") Integer page){
HashMap<Object, Object> map = new HashMap<>();
List list = new ArrayList<>();
List<BookForumArticlesEntity> newBookList_all = bookForumArticlesService.getBaseMapper().selectList(new QueryWrapper<BookForumArticlesEntity>()
.orderByDesc("create_time"));
List<BookForumArticlesEntity> newBookList = new ArrayList<>();
int start = (page-1)*2;
int end = (page-1)*2+2;
if((page-1)*2 >= newBookList_all.size()){
start = newBookList_all.size();
}
if((page-1)*2+2 >= newBookList_all.size()){
end = newBookList_all.size();
}
newBookList = newBookList_all.subList(start,end);
for (BookForumArticlesEntity book : newBookList) {
String bookid = "";
String publisherName = "";
BookForumArticlesVO bookForumArticlesVO = new BookForumArticlesVO();
String bookid1 = String.valueOf(book.getBookid());
String image = book.getImage();
String content = book.getContent();
String title = book.getTitle();
Date createTime = book.getCreateTime();
String[] authorIds = bookid1.split(",");
List<String> bookids = Arrays.asList(authorIds);
List<BookEntity> id = bookService.getBaseMapper().selectList(new QueryWrapper<BookEntity>().in("id", bookids));
for (BookEntity bookentity : id) {
String authorName = "";
String images = bookentity.getImages();
String name = bookentity.getName();
Integer id1 = bookentity.getId();
String authorId = bookentity.getAuthorId();
String[] author = authorId.split(",");
List<String> authorList = Arrays.asList(author);
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;
String publisherId = bookentity.getPublisherId();
String[] publisherIds = publisherId.split(",");
List<String> publisherList = Arrays.asList(publisherIds);
List<PublisherEntity> publisherEntities = publisherService.getBaseMapper().selectList(new QueryWrapper<PublisherEntity>().in("id", publisherList));
for (PublisherEntity publisherEntity : publisherEntities) {
publisherName += "," + publisherEntity.getPublisherName();
}
publisherName = publisherName.startsWith(",") ? publisherName.substring(1) : publisherName;
bookForumArticlesVO.setBookid(bookid1);
bookForumArticlesVO.setAuthorName(authorName);
bookForumArticlesVO.setPublisherName(publisherName);
bookForumArticlesVO.setBookName(name);
bookForumArticlesVO.setBookimage(images);
bookForumArticlesVO.setImage(image);
bookForumArticlesVO.setTitle(title);
bookForumArticlesVO.setContent(content);
bookForumArticlesVO.setCreate_time(createTime);
list.add(bookForumArticlesVO);
System.out.println(list);
}
}
map.put("list",list);
return R.ok().put("descupdatelist",map);
}
/**
@@ -61,6 +153,7 @@ public class BookForumArticlesServiceController {
@RequestMapping("/appinfo/{id}")
public R appinfo(@PathVariable("id") Integer id){
BookForumArticlesEntity forumArticles = bookForumArticlesService.getById(id);
return R.ok().put("BookForumArticlesEntity", forumArticles);
}
@@ -68,7 +161,7 @@ public class BookForumArticlesServiceController {
/**
* 保存
* 手动输入
*/
@RequestMapping("/save")
@@ -79,6 +172,46 @@ public class BookForumArticlesServiceController {
return R.ok();
}
// /**
// * 列表 (修改时间倒叙) app页面
// */
// @RequestMapping("/importlist")
// public R importlist(@RequestParam Map<String, Object> params){
//
// PageUtils page = bookForumArticlesService.importlistqueryPages(params);
// return R.ok().put("page", page);
// }
/**
* 导入
*/
@RequestMapping("/importsave")
public R importsave(@RequestBody BookForumArticlesEntity bookForumArticlesEntity){
//读后感导入加用户id 头像,
bookForumArticlesEntity.setCreateTime(new Date());
bookForumArticlesEntity.setDelflag(0);
return R.ok();
}
/**
* 修改
*/

View File

@@ -43,7 +43,6 @@ public class BookForumCommentController {
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Integer id){
BookForumCommentEntity forumCom = bookForumCommentService.getById(id);
return R.ok().put("BookForumCommentEntity", forumCom);
}
@@ -73,7 +72,7 @@ public class BookForumCommentController {
/**
* 删除
* 删除buy/record/All
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids){
@@ -83,7 +82,15 @@ public class BookForumCommentController {
/**
* 列表 (后台书评导入列表)
*/
@GetMapping("/importlist")
public R importlist(@RequestParam Map<String, Object> params){
PageUtils page = bookForumCommentService.importlistqueryPages(params);
return R.ok().put("page", page);
}

View File

@@ -561,21 +561,21 @@ public class MyUserController {
}
/**
* @Description: app微信登陆
* @Author: z.hw
*/
@RequestMapping("/appUserAuthorLogin")
// @ApiOperation(value = "getUserInfoByAppCode", notes = "不分页", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
// @ApiResponses(value = {
// @ApiResponse(code = 404, message = "Not Found"),
// @ApiResponse(code = 400, message = "No Name Provided"),
// })
public R getUserInfoByApp(@Validated @RequestBody UserAppAuthorEntity userAppAuthorEntity) {
return userService.getUserInfoByApp(userAppAuthorEntity);
}
//
// /**
// * @Description: app微信登陆
// * @Author: z.hw
// */
// @RequestMapping("/appUserAuthorLogin")
//// @ApiOperation(value = "getUserInfoByAppCode", notes = "不分页", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
//// @ApiResponses(value = {
//// @ApiResponse(code = 404, message = "Not Found"),
//// @ApiResponse(code = 400, message = "No Name Provided"),
//// })
// public R getUserInfoByApp(@Validated @RequestBody UserAppAuthorEntity userAppAuthorEntity) {
//
// return userService.getUserInfoByApp(userAppAuthorEntity);
// }
//
}

View File

@@ -39,7 +39,7 @@ public class PublisherController {
* 列表
*/
@RequestMapping("/list")
@RequiresPermissions("book:publisher:list")
// @RequiresPermissions("book:publisher:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = publisherService.queryPage(params);
@@ -68,7 +68,7 @@ public class PublisherController {
* 信息
*/
@RequestMapping("/info/{id}")
@RequiresPermissions("book:publisher:info")
// @RequiresPermissions("book:publisher:info")
public R info(@PathVariable("id") Integer id){
PublisherEntity publisher = publisherService.getById(id);
@@ -99,7 +99,7 @@ public class PublisherController {
* 保存
*/
@RequestMapping("/save")
@RequiresPermissions("book:publisher:save")
// @RequiresPermissions("book:publisher:save")
public R save(@RequestBody PublisherEntity publisher){
publisher.setDelFlag(0);
publisherService.save(publisher);
@@ -111,7 +111,7 @@ public class PublisherController {
* 修改
*/
@RequestMapping("/update")
@RequiresPermissions("book:publisher:update")
// @RequiresPermissions("book:publisher:update")
public R update(@RequestBody PublisherEntity publisher){
publisherService.updateById(publisher);
@@ -122,7 +122,7 @@ public class PublisherController {
* 删除
*/
@RequestMapping("/delete")
@RequiresPermissions("book:publisher:delete")
// @RequiresPermissions("book:publisher:delete")
public R delete(@RequestBody Integer[] ids){
publisherService.removeByIds(Arrays.asList(ids));

View File

@@ -40,6 +40,27 @@ public class ShopProductController {
private BuyOrderDetailService buyOrderDetailService;
@Autowired
private BookService bookService;
// 商品销量 productSalesVolume
/**
* 精选商品 列表
*/
@RequestMapping("/listproductSales")
// @RequiresPermissions("book:shopproduct:list")
public R listproductSales(@RequestParam Map<String, Object> params){
PageUtils page = shopProductService.queryPageproductSales(params);
return R.ok().put("page", page);
}
/**
* 列表
*/

View File

@@ -7,6 +7,12 @@ import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 打卡评论追评表
*
*/
@Data
@TableName("book_clockin_comment")
public class BookClockinCommentEntity implements Serializable {

View File

@@ -9,7 +9,7 @@ import java.util.Date;
/**
*
* 打卡表
* 打卡评论
* @author
* @email
* @date

View File

@@ -5,7 +5,7 @@ import java.io.Serializable;
import java.util.Date;
/**
* 签到
* 签到
*/
@Data
@TableName("book_clockin_punch")

View File

@@ -68,4 +68,14 @@ public class BookForumArticlesEntity {
@TableField("del_flag")
@TableLogic
private Integer delflag;
@TableField("author")
private String author;
@TableField("publishername")
private String publishername;
}

View File

@@ -14,9 +14,7 @@ import java.util.Date;
@TableName("book_forum_comment")
public class BookForumCommentEntity {
/**
* id bfa_id userid content images create_time update_time
*/
/**
* id
*/

View File

@@ -11,7 +11,7 @@ import java.math.BigDecimal;
import java.util.Date;
/**
* 签到列表内容
* 发布打卡内容
*
*/
@Data

View File

@@ -10,4 +10,7 @@ public interface BookForumArticlesService extends IService<BookForumArticlesEn
PageUtils queryPage(Map<String, Object> params);
PageUtils queryPages(Map<String, Object> params);
}

View File

@@ -8,4 +8,6 @@ import java.util.Map;
public interface BookForumCommenService extends IService<BookForumCommentEntity> {
PageUtils queryPage(Map<String, Object> params);
PageUtils importlistqueryPages(Map<String, Object> params);
}

View File

@@ -27,5 +27,7 @@ public interface ShopProductService extends IService<ShopProductEntity> {
PageUtils getNewBook(Map<String, Object> params);
PageUtils selectListqueryPage(Map<String, Object> params);
PageUtils queryPageproductSales(Map<String, Object> params);
}

View File

@@ -6,10 +6,19 @@ 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.BookForumArticlesDao;
import com.peanut.modules.book.entity.AuthorEntity;
import com.peanut.modules.book.entity.BookEntity;
import com.peanut.modules.book.entity.BookForumArticlesEntity;
import com.peanut.modules.book.entity.PublisherEntity;
import com.peanut.modules.book.service.AuthorService;
import com.peanut.modules.book.service.BookForumArticlesService;
import com.peanut.modules.book.service.BookService;
import com.peanut.modules.book.service.PublisherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@Service
@@ -26,17 +35,27 @@ public class BookForumArticlesServiceImpl extends ServiceImpl<BookForumArticlesD
);
return new PageUtils(page);
}
@Override
public PageUtils queryPages(Map<String, Object> params) {
String bookid = (String) params.get("bookid");
IPage<BookForumArticlesEntity> page = this.page(
new Query<BookForumArticlesEntity>().getPage(params),
new QueryWrapper<BookForumArticlesEntity>().eq("bookid",bookid)
);
return new PageUtils(page);
}
}

View File

@@ -28,4 +28,15 @@ public class BookForumCommenServiceImpl extends ServiceImpl<BookForumCommentDao,
return new PageUtils(page);
}
@Override
public PageUtils importlistqueryPages(Map<String, Object> params) {
Object b = params.get("bfid");
IPage<BookForumCommentEntity> page = this.page(
new Query<BookForumCommentEntity>().getPage(params),
new QueryWrapper<BookForumCommentEntity>().eq("bfa_id",b).orderByDesc("create_time")
);
return new PageUtils(page);
}
}

View File

@@ -8,9 +8,7 @@ import com.google.common.base.Joiner;
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;
import com.peanut.modules.book.service.BookChapterService;
import com.peanut.modules.book.service.PublisherService;
import com.peanut.modules.book.service.*;
import com.peanut.modules.book.vo.BookIndexVo;
import com.peanut.modules.sys.service.SysDictDataService;
import com.spire.doc.Document;
@@ -35,7 +33,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.book.dao.BookDao;
import com.peanut.modules.book.service.BookService;
import org.springframework.util.CollectionUtils;
@@ -52,6 +49,8 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
private BookChapterService bookChapterService;
@Autowired
ConstantPropertiesUtils constantPropertiesUtils;
@Autowired
private BookForumArticlesService bookForumArticlesService;
@@ -108,6 +107,8 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
String[] split = type.split(",");
for (String tp : split) {
SysDictDataEntity dict = sysDictDataService.getBaseMapper().selectOne(new QueryWrapper<SysDictDataEntity>()
.eq("dict_type", tp).eq("dict_label", "book_type"));
@@ -659,7 +660,9 @@ public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements
return false;
}
}
}

View File

@@ -65,5 +65,15 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
return new PageUtils(page);
}
@Override
public PageUtils queryPageproductSales(Map<String, Object> params) {
IPage<ShopProductEntity> page = this.page(
new Query<ShopProductEntity>().getPage(params),
new QueryWrapper<ShopProductEntity>().orderByDesc("sum_sales")
);
System.out.println("page"+page);
return new PageUtils(page);
}
}