bug fix
This commit is contained in:
@@ -47,7 +47,7 @@ public class BookClockForumController {
|
||||
*/
|
||||
@RequestMapping(path = "/getPostingInfo", method = RequestMethod.GET)
|
||||
public R getPostingInfo(@RequestParam("bookId") Integer bookId,
|
||||
@RequestParam("day") Integer day) {
|
||||
@RequestParam(value = "day") Integer day) {
|
||||
QueryWrapper<BookClockEntryEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("book_id", bookId);
|
||||
queryWrapper.eq("day", day);
|
||||
@@ -68,6 +68,7 @@ public class BookClockForumController {
|
||||
@RequestParam(value = "userId", required = false) Integer userId) {
|
||||
QueryWrapper<BookClockInChatEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("entry_id", entryId);
|
||||
queryWrapper.eq("fid", 0);
|
||||
if (userId != null) {
|
||||
queryWrapper.eq("user_id", userId);
|
||||
}
|
||||
@@ -83,6 +84,22 @@ public class BookClockForumController {
|
||||
UserEntity user = userService.getById(entity.getUserId());
|
||||
vo.setNickName(user.getNickname());
|
||||
vo.setAvatar(user.getAvatar());
|
||||
QueryWrapper<BookClockInChatEntity> subQueryWrapper = new QueryWrapper<>();
|
||||
subQueryWrapper.eq("fid", entity.getId());
|
||||
List<BookClockInChatEntity> subClockInChatList = bookClockEntryChatService.list(subQueryWrapper);
|
||||
List<ClockInCommentVo> subCommentList = new ArrayList<>();
|
||||
for (BookClockInChatEntity subChat : subClockInChatList) {
|
||||
ClockInCommentVo subVo = new ClockInCommentVo();
|
||||
BeanUtil.copyProperties(subChat, subVo);
|
||||
UserEntity subChatUser = userService.getById(subChat.getUserId());
|
||||
UserEntity pUser = userService.getById(subChat.getPuserId());
|
||||
subVo.setPuserNickName(pUser.getNickname());
|
||||
subVo.setPuserAvatar(pUser.getAvatar());
|
||||
subVo.setAvatar(subChatUser.getAvatar());
|
||||
subVo.setNickName(subChatUser.getNickname());
|
||||
subCommentList.add(subVo);
|
||||
}
|
||||
vo.setSubCommentList(subCommentList);
|
||||
resultList.add(vo);
|
||||
}
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
@@ -96,11 +113,13 @@ public class BookClockForumController {
|
||||
* @param chat
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(path = "/addChat")
|
||||
@RequestMapping(path = "/addChat", method = RequestMethod.POST)
|
||||
public R addChat(@RequestBody BookClockInChatEntity chat) {
|
||||
List<String> imageList = chat.getImageList();
|
||||
String images = JSON.toJSON(imageList).toString();
|
||||
chat.setImages(images);
|
||||
if (imageList != null) {
|
||||
String images = JSON.toJSON(imageList).toString();
|
||||
chat.setImages(images);
|
||||
}
|
||||
bookClockEntryChatService.save(chat);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@@ -295,10 +295,10 @@ public class ShopProductController {
|
||||
*/
|
||||
@RequestMapping("/infobook/{productId}")
|
||||
public R infobook(@PathVariable("productId") Integer productId) {
|
||||
List<ShopProductBookEntity> proudict = shopProductBookService.getBaseMapper().selectList(new QueryWrapper<ShopProductBookEntity>()
|
||||
List<ShopProductBookEntity> product = shopProductBookService.getBaseMapper().selectList(new QueryWrapper<ShopProductBookEntity>()
|
||||
.eq("product_id", productId));
|
||||
List<Object> list = new ArrayList<>();
|
||||
for (ShopProductBookEntity shopProductBookEntity : proudict) {
|
||||
for (ShopProductBookEntity shopProductBookEntity : product) {
|
||||
Integer bookId = shopProductBookEntity.getBookId();
|
||||
|
||||
List<ShopProductBookEntity> bookIds = shopProductBookService.getBaseMapper().selectList(new QueryWrapper<ShopProductBookEntity>()
|
||||
@@ -336,11 +336,11 @@ public class ShopProductController {
|
||||
shopProductService.save(shopProduct);
|
||||
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));
|
||||
String bookIdList = s;
|
||||
if (bookIdList != null) {
|
||||
Integer product = shopProduct.getProductId();
|
||||
shopProductBookEntity.setProductId(product);
|
||||
shopProductBookEntity.setBookId(Integer.valueOf(bookIdList));
|
||||
shopProductBookService.save(shopProductBookEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import cn.com.marsoft.tool.ToolObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
@@ -7,9 +8,11 @@ import com.peanut.modules.book.entity.*;
|
||||
import com.peanut.modules.book.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.peanut.common.utils.R.error;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("buy/record")
|
||||
public class UserRecordController {
|
||||
@@ -29,7 +32,7 @@ public class UserRecordController {
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public R list(@RequestParam Map<String, Object> params ){
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
PageUtils page = userRecordService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
@@ -37,22 +40,21 @@ public class UserRecordController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看我的评价
|
||||
* 查看我的评价
|
||||
*/
|
||||
@RequestMapping("/Allevaluations")
|
||||
public R Allevaluations(@RequestBody UserRecordEntity userRecordEntity){
|
||||
public R Allevaluations(@RequestBody UserRecordEntity userRecordEntity) {
|
||||
List<UserRecordEntity> userid = userRecordService.getBaseMapper().selectList(new QueryWrapper<UserRecordEntity>().eq("userid", userRecordEntity.getUserid()).orderByDesc("create_date"));
|
||||
return R.ok().put("Allevaluations",userid);
|
||||
return R.ok().put("Allevaluations", userid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看全部评价
|
||||
* 查看全部评价
|
||||
*/
|
||||
@RequestMapping("/All")
|
||||
public R All(@RequestBody UserRecordEntity userRecordEntity) {
|
||||
|
||||
|
||||
|
||||
List list = new ArrayList<>();
|
||||
//此处bookid实际传的是商品id
|
||||
List<UserRecordEntity> bookid = userRecordService.getBaseMapper().selectList(new QueryWrapper<UserRecordEntity>().eq("bookid", userRecordEntity.getBookid()).orderByDesc("create_date"));
|
||||
@@ -99,21 +101,19 @@ public class UserRecordController {
|
||||
list.add(map);
|
||||
|
||||
|
||||
|
||||
}
|
||||
return R.ok().put("list", list);
|
||||
}
|
||||
return R.error("该商品暂无评论");
|
||||
return R.error("该商品暂无评论");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/info/{id}")
|
||||
public R info(@PathVariable("id") Integer id){
|
||||
public R info(@PathVariable("id") Integer id) {
|
||||
UserRecordEntity userRecordEntity = userRecordService.getById(id);
|
||||
return R.ok().put("bookChapterContent", userRecordEntity);
|
||||
}
|
||||
@@ -122,7 +122,7 @@ public class UserRecordController {
|
||||
* 保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
public R save(@RequestBody UserRecordEntity userRecordEntity){
|
||||
public R save(@RequestBody UserRecordEntity userRecordEntity) {
|
||||
userRecordService.save(userRecordEntity);
|
||||
return R.ok();
|
||||
}
|
||||
@@ -131,7 +131,7 @@ public class UserRecordController {
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
public R update(@RequestBody UserRecordEntity userRecordEntity){
|
||||
public R update(@RequestBody UserRecordEntity userRecordEntity) {
|
||||
userRecordService.updateById(userRecordEntity);
|
||||
return R.ok();
|
||||
}
|
||||
@@ -140,7 +140,7 @@ public class UserRecordController {
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
public R delete(@RequestBody Integer[] ids){
|
||||
public R delete(@RequestBody Integer[] ids) {
|
||||
userRecordService.removeByIds(Arrays.asList(ids));
|
||||
userRecordService.getBaseMapper().deleteBatchIds(Arrays.asList(ids));
|
||||
return R.ok();
|
||||
@@ -148,38 +148,34 @@ public class UserRecordController {
|
||||
|
||||
|
||||
/*
|
||||
* test
|
||||
* */
|
||||
* test
|
||||
* */
|
||||
@RequestMapping("/commodityComment")
|
||||
public R commodityComment(String userid, String orderSn, String starLevel, String comment){
|
||||
userRecordService.commodityComment(userid, orderSn, starLevel, comment);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public R commodityComment(String userid, String orderSn, String starLevel, String comment) {
|
||||
userRecordService.commodityComment(userid, orderSn, starLevel, comment);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 生成评论
|
||||
* */
|
||||
* 生成评论
|
||||
* */
|
||||
@RequestMapping("/comment")
|
||||
public Object commodityComments( Integer userid, String orderSn, Integer bookid, String comment) {
|
||||
public Object commodityComments(Integer userid, String orderSn, Integer bookid, String comment) {
|
||||
|
||||
|
||||
BuyOrderEntity buyOrderEntity =buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrderEntity>()
|
||||
.eq("order_sn",orderSn).last("LIMIT 1").eq("order_status","3")
|
||||
//状态3为已收货
|
||||
BuyOrderEntity buyOrderEntity = buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrderEntity>()
|
||||
.eq("order_sn", orderSn).last("LIMIT 1").eq("order_status", "3")
|
||||
//状态3为已收货
|
||||
// .eq("order_status","3")
|
||||
);
|
||||
UserRecordEntity userRecordEntity = new UserRecordEntity();
|
||||
|
||||
|
||||
if (!ToolObject.isNullOrEmpty(buyOrderEntity))
|
||||
{
|
||||
if (!ToolObject.isNullOrEmpty(buyOrderEntity)) {
|
||||
return error("您已评价过了,请勿重复评论");
|
||||
//
|
||||
}else {
|
||||
} else {
|
||||
userRecordEntity.setId(buyOrderEntity.getOrderId());
|
||||
userRecordEntity.setContent(comment);
|
||||
//商品评价
|
||||
@@ -187,38 +183,35 @@ public class UserRecordController {
|
||||
userRecordEntity.setUserid(userid);
|
||||
userRecordEntity.setOrderSn(orderSn);
|
||||
userRecordEntity.setDelflag(0);
|
||||
userRecordEntity.setProudictId(bookid);
|
||||
userRecordEntity.setProductId(bookid);
|
||||
userRecordService.saveOrUpdate(userRecordEntity);
|
||||
return R.ok("成功").put("userRecordEntity",userRecordEntity);
|
||||
return R.ok("成功").put("userRecordEntity", userRecordEntity);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param recordEntity
|
||||
* @return 生成评论(上传图片,星级评价
|
||||
*
|
||||
*/
|
||||
@RequestMapping("/UserRecordcomment")
|
||||
public R commodity(@RequestBody UserRecordEntity recordEntity ) {
|
||||
public R commodity(@RequestBody UserRecordEntity recordEntity) {
|
||||
//todo 已收货限制字段,只可评价一次
|
||||
BuyOrderEntity buyOrderEntity =buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrderEntity>()
|
||||
.eq("order_sn",recordEntity.getOrderSn())
|
||||
BuyOrderEntity buyOrderEntity = buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrderEntity>()
|
||||
.eq("order_sn", recordEntity.getOrderSn())
|
||||
);
|
||||
|
||||
Integer orderId = buyOrderEntity.getOrderId();
|
||||
BuyOrderDetailEntity detailEntity = buyOrderDetailService.getBaseMapper().selectOne(new QueryWrapper<BuyOrderDetailEntity>().eq("Order_id", orderId).eq("product_id",recordEntity.getBookid()));
|
||||
BuyOrderDetailEntity detailEntity = buyOrderDetailService.getBaseMapper().selectOne(new QueryWrapper<BuyOrderDetailEntity>().eq("Order_id", orderId).eq("product_id", recordEntity.getBookid()));
|
||||
Integer orderId1 = detailEntity.getOrderId();
|
||||
UserRecordEntity userRecordEntity = userRecordService.getBaseMapper().selectOne(new QueryWrapper<UserRecordEntity>().eq("orderSn", recordEntity.getOrderSn()).eq("userid", recordEntity.getUserid()).eq("orderdid",orderId1).last("LIMIT 1"));
|
||||
UserRecordEntity userRecordEntity = userRecordService.getBaseMapper().selectOne(new QueryWrapper<UserRecordEntity>().eq("orderSn", recordEntity.getOrderSn()).eq("userid", recordEntity.getUserid()).eq("orderdid", orderId1).last("LIMIT 1"));
|
||||
|
||||
if (userRecordEntity != null) {
|
||||
return R.error("您已评价过");
|
||||
return R.error("您已评价过");
|
||||
}
|
||||
if (recordEntity.getImages()!=null) {
|
||||
if (recordEntity.getImages() != null) {
|
||||
List<Map<String, String>> imageList = (ArrayList<Map<String, String>>) recordEntity.getImages();
|
||||
String imageStr = "";
|
||||
for (Map m : imageList) {
|
||||
@@ -227,19 +220,17 @@ public class UserRecordController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
recordEntity.setImages(imageStr);
|
||||
}
|
||||
recordEntity.setDelflag(0);
|
||||
recordEntity.setOrderdId(orderId1);
|
||||
userRecordService.saveOrUpdate(recordEntity);
|
||||
recordEntity.setDelflag(0);
|
||||
recordEntity.setOrderdId(orderId1);
|
||||
userRecordService.saveOrUpdate(recordEntity);
|
||||
|
||||
|
||||
detailEntity.setRecordId(1);
|
||||
buyOrderDetailService.saveOrUpdate(detailEntity);
|
||||
detailEntity.setRecordId(1);
|
||||
buyOrderDetailService.saveOrUpdate(detailEntity);
|
||||
|
||||
|
||||
|
||||
return R.ok("成功").put("userRecordEntity",recordEntity);
|
||||
}
|
||||
return R.ok("成功").put("userRecordEntity", recordEntity);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user