This commit is contained in:
wangjinlei
2023-10-17 15:45:28 +08:00
parent 93eddae8f0
commit bb9be1748b
8 changed files with 45 additions and 16 deletions

View File

@@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.peanut.common.utils.R; import com.peanut.common.utils.R;
import com.peanut.modules.app.service.UserService; import com.peanut.modules.app.service.UserService;
import com.peanut.modules.book.entity.BookClockEntryEntity; import com.peanut.modules.book.entity.BookClockEntryEntity;
import com.peanut.modules.book.entity.BookClockInChatEntity; import com.peanut.modules.book.entity.BookClockEntryChatEntity;
import com.peanut.modules.book.entity.UserEntity; import com.peanut.modules.book.entity.UserEntity;
import com.peanut.modules.book.service.BookClockEntryChatService; import com.peanut.modules.book.service.BookClockEntryChatService;
import com.peanut.modules.book.service.BookClockEntryService; import com.peanut.modules.book.service.BookClockEntryService;
@@ -66,7 +66,7 @@ public class BookClockForumController {
@RequestMapping(path = "/getChatList", method = RequestMethod.GET) @RequestMapping(path = "/getChatList", method = RequestMethod.GET)
public R getChatList(@RequestParam("entryId") Integer entryId, public R getChatList(@RequestParam("entryId") Integer entryId,
@RequestParam(value = "userId", required = false) Integer userId) { @RequestParam(value = "userId", required = false) Integer userId) {
QueryWrapper<BookClockInChatEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<BookClockEntryChatEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("entry_id", entryId); queryWrapper.eq("entry_id", entryId);
queryWrapper.eq("fid", 0); queryWrapper.eq("fid", 0);
if (userId != null) { if (userId != null) {
@@ -74,8 +74,8 @@ public class BookClockForumController {
} }
queryWrapper.orderByAsc("fid", "create_time"); queryWrapper.orderByAsc("fid", "create_time");
List<ClockInCommentVo> resultList = new ArrayList<>(); List<ClockInCommentVo> resultList = new ArrayList<>();
List<BookClockInChatEntity> chatEntityList = bookClockEntryChatService.list(queryWrapper); List<BookClockEntryChatEntity> chatEntityList = bookClockEntryChatService.list(queryWrapper);
for (BookClockInChatEntity entity : chatEntityList) { for (BookClockEntryChatEntity entity : chatEntityList) {
List<String> imageList = JSON.parseObject(entity.getImages(), new TypeReference<List<String>>() { List<String> imageList = JSON.parseObject(entity.getImages(), new TypeReference<List<String>>() {
}); });
entity.setImageList(imageList); entity.setImageList(imageList);
@@ -84,11 +84,11 @@ public class BookClockForumController {
UserEntity user = userService.getById(entity.getUserId()); UserEntity user = userService.getById(entity.getUserId());
vo.setNickName(user.getNickname()); vo.setNickName(user.getNickname());
vo.setAvatar(user.getAvatar()); vo.setAvatar(user.getAvatar());
QueryWrapper<BookClockInChatEntity> subQueryWrapper = new QueryWrapper<>(); QueryWrapper<BookClockEntryChatEntity> subQueryWrapper = new QueryWrapper<>();
subQueryWrapper.eq("fid", entity.getId()); subQueryWrapper.eq("fid", entity.getId());
List<BookClockInChatEntity> subClockInChatList = bookClockEntryChatService.list(subQueryWrapper); List<BookClockEntryChatEntity> subClockInChatList = bookClockEntryChatService.list(subQueryWrapper);
List<ClockInCommentVo> subCommentList = new ArrayList<>(); List<ClockInCommentVo> subCommentList = new ArrayList<>();
for (BookClockInChatEntity subChat : subClockInChatList) { for (BookClockEntryChatEntity subChat : subClockInChatList) {
ClockInCommentVo subVo = new ClockInCommentVo(); ClockInCommentVo subVo = new ClockInCommentVo();
BeanUtil.copyProperties(subChat, subVo); BeanUtil.copyProperties(subChat, subVo);
UserEntity subChatUser = userService.getById(subChat.getUserId()); UserEntity subChatUser = userService.getById(subChat.getUserId());
@@ -114,7 +114,7 @@ public class BookClockForumController {
* @return * @return
*/ */
@RequestMapping(path = "/addChat", method = RequestMethod.POST) @RequestMapping(path = "/addChat", method = RequestMethod.POST)
public R addChat(@RequestBody BookClockInChatEntity chat) { public R addChat(@RequestBody BookClockEntryChatEntity chat) {
List<String> imageList = chat.getImageList(); List<String> imageList = chat.getImageList();
if (imageList != null) { if (imageList != null) {
String images = JSON.toJSON(imageList).toString(); String images = JSON.toJSON(imageList).toString();

View File

@@ -685,7 +685,9 @@ public class BookController {
LambdaQueryWrapper<BookEntity> wrapper1 = new LambdaQueryWrapper<>(); LambdaQueryWrapper<BookEntity> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(BookEntity::getDelFlag,0); wrapper1.eq(BookEntity::getDelFlag,0);
wrapper1.in(BookEntity::getId,bookIds); if(bookIds.size()>0){
wrapper1.in(BookEntity::getId,bookIds);
}
Page<BookEntity> bookEntityPage = bookService.getBaseMapper().selectPage(new Page<>(page, limit), wrapper1); Page<BookEntity> bookEntityPage = bookService.getBaseMapper().selectPage(new Page<>(page, limit), wrapper1);
return R.ok().put("page",bookEntityPage); return R.ok().put("page",bookEntityPage);

View File

@@ -262,6 +262,30 @@ public class BuyOrderController {
return R.ok().put("orderSn", timeId); return R.ok().put("orderSn", timeId);
} }
/**
* 获取订单详情
* @param orderId
* @return
*/
@RequestMapping("/getOrderDetail")
public R getOrderDetail(@RequestParam Integer orderId){
LambdaQueryWrapper<BuyOrderEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BuyOrderEntity::getOrderId,orderId);
BuyOrderEntity one = buyOrderService.getOne(wrapper);
if(one.equals(null)){
return R.error("order error:order is null");
}
//添加用户信息
one.setUser(myUserService.getById(one.getUserId()));
//添加商品信息
LambdaQueryWrapper<BuyOrderDetailEntity> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(BuyOrderDetailEntity::getOrderId,orderId);
List<BuyOrderDetailEntity> buyOrderDetailEntities = buyOrderDetailService.getBaseMapper().selectList(wrapper1);
one.setProducts(buyOrderDetailEntities);
return R.ok().put("user",one);
}
/** /**
* 信息 * 信息

View File

@@ -1,9 +1,9 @@
package com.peanut.modules.book.dao; package com.peanut.modules.book.dao;
import com.github.yulichang.base.MPJBaseMapper; import com.github.yulichang.base.MPJBaseMapper;
import com.peanut.modules.book.entity.BookClockInChatEntity; import com.peanut.modules.book.entity.BookClockEntryChatEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface BookClockEntryChatDao extends MPJBaseMapper<BookClockInChatEntity> { public interface BookClockEntryChatDao extends MPJBaseMapper<BookClockEntryChatEntity> {
} }

View File

@@ -12,7 +12,7 @@ import java.util.List;
@Data @Data
@TableName("book_clock_entry_chat") @TableName("book_clock_entry_chat")
public class BookClockInChatEntity implements Serializable { public class BookClockEntryChatEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId @TableId

View File

@@ -169,4 +169,7 @@ public class BuyOrderEntity implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private Long timestamp; private Long timestamp;
@TableField(exist = false)
private MyUserEntity user;
} }

View File

@@ -1,7 +1,7 @@
package com.peanut.modules.book.service; package com.peanut.modules.book.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.book.entity.BookClockInChatEntity; import com.peanut.modules.book.entity.BookClockEntryChatEntity;
public interface BookClockEntryChatService extends IService<BookClockInChatEntity> { public interface BookClockEntryChatService extends IService<BookClockEntryChatEntity> {
} }

View File

@@ -2,10 +2,10 @@ package com.peanut.modules.book.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.book.dao.BookClockEntryChatDao; import com.peanut.modules.book.dao.BookClockEntryChatDao;
import com.peanut.modules.book.entity.BookClockInChatEntity; import com.peanut.modules.book.entity.BookClockEntryChatEntity;
import com.peanut.modules.book.service.BookClockEntryChatService; import com.peanut.modules.book.service.BookClockEntryChatService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service("bookClockEntryChatService") @Service("bookClockEntryChatService")
public class BookClockEntryChatImpl extends ServiceImpl<BookClockEntryChatDao, BookClockInChatEntity> implements BookClockEntryChatService { public class BookClockEntryChatImpl extends ServiceImpl<BookClockEntryChatDao, BookClockEntryChatEntity> implements BookClockEntryChatService {
} }