--新增书评接口,端口修改
This commit is contained in:
@@ -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));
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
// }
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user