diff --git a/src/main/java/com/peanut/config/MyRedissonConfig.java b/src/main/java/com/peanut/config/MyRedissonConfig.java
index 3da272c8..e9555a61 100644
--- a/src/main/java/com/peanut/config/MyRedissonConfig.java
+++ b/src/main/java/com/peanut/config/MyRedissonConfig.java
@@ -3,24 +3,23 @@ package com.peanut.config;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.core.env.Environment;
@Configuration
public class MyRedissonConfig {
- @Autowired
- private Environment environment;
+ @Value("${redisAddress}")
+ private String redisAddress;
+
+ @Value("${redisPassword}")
+ private String redisPassword;
@Bean
public RedissonClient redissonClient() {
- String redisHost = environment.getProperty("spring.redis.host");
- String redisPassword = environment.getProperty("spring.redis.password");
Config config = new Config();
- config.useSingleServer().setAddress("redis://"+redisHost+":6379").setPassword(redisPassword);
- RedissonClient redissonClient = Redisson.create(config);
- return redissonClient;
+ config.useSingleServer().setAddress(redisAddress).setPassword(redisPassword);
+ return Redisson.create(config);
}
}
diff --git a/src/main/java/com/peanut/config/MybatisPlusConfig.java b/src/main/java/com/peanut/config/MybatisPlusConfig.java
index 143baa69..85741f7e 100644
--- a/src/main/java/com/peanut/config/MybatisPlusConfig.java
+++ b/src/main/java/com/peanut/config/MybatisPlusConfig.java
@@ -1,8 +1,8 @@
/**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
- *
+ *
* https://www.renren.io
- *
+ *
* 版权所有,侵权必究!
*/
@@ -27,5 +27,4 @@ public class MybatisPlusConfig {
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
-
}
diff --git a/src/main/java/com/peanut/modules/book/controller/BookClockForumController.java b/src/main/java/com/peanut/modules/book/controller/BookClockForumController.java
index c8bea1c7..c01e6340 100644
--- a/src/main/java/com/peanut/modules/book/controller/BookClockForumController.java
+++ b/src/main/java/com/peanut/modules/book/controller/BookClockForumController.java
@@ -1,14 +1,21 @@
package com.peanut.modules.book.controller;
+import cn.hutool.core.bean.BeanUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.peanut.common.utils.R;
+import com.peanut.modules.app.service.UserService;
+import com.peanut.modules.book.entity.BookClockEntryEntity;
import com.peanut.modules.book.entity.BookClockInChatEntity;
-import com.peanut.modules.book.entity.BookClockInEntity;
+import com.peanut.modules.book.entity.UserEntity;
import com.peanut.modules.book.service.BookClockEntryChatService;
-import com.peanut.modules.book.service.BookClockinService;
+import com.peanut.modules.book.service.BookClockEntryService;
+import com.peanut.modules.book.vo.ClockInCommentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -18,14 +25,18 @@ import java.util.Map;
* @Author: Cauchy
* @CreateTime: 2023/10/11
*/
-@RestController("/book/clockForum")
+@RestController
+@RequestMapping("/book/clockInForum")
public class BookClockForumController {
@Autowired
private BookClockEntryChatService bookClockEntryChatService;
@Autowired
- private BookClockinService bookClockinService;
+ private BookClockEntryService bookClockEntryService;
+
+ @Autowired
+ private UserService userService;
/**
* 获取论坛内容
@@ -36,11 +47,11 @@ public class BookClockForumController {
*/
@RequestMapping(path = "/getPostingInfo", method = RequestMethod.GET)
public R getPostingInfo(@RequestParam("bookId") Integer bookId,
- @RequestParam("day") Integer day) {
- QueryWrapper queryWrapper = new QueryWrapper<>();
+ @RequestParam(value = "day") Integer day) {
+ QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("book_id", bookId);
queryWrapper.eq("day", day);
- BookClockInEntity entity = bookClockinService.getOne(queryWrapper);
+ BookClockEntryEntity entity = bookClockEntryService.getOne(queryWrapper);
Map result = new HashMap<>();
result.put("result", entity);
return R.ok(result);
@@ -53,11 +64,44 @@ public class BookClockForumController {
* @return
*/
@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) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("entry_id", entryId);
- queryWrapper.orderByAsc("f_id", "create_time");
- List resultList = bookClockEntryChatService.list(queryWrapper);
+ queryWrapper.eq("fid", 0);
+ if (userId != null) {
+ queryWrapper.eq("user_id", userId);
+ }
+ queryWrapper.orderByAsc("fid", "create_time");
+ List resultList = new ArrayList<>();
+ List chatEntityList = bookClockEntryChatService.list(queryWrapper);
+ for (BookClockInChatEntity entity : chatEntityList) {
+ List imageList = JSON.parseObject(entity.getImages(), new TypeReference>() {
+ });
+ entity.setImageList(imageList);
+ ClockInCommentVo vo = new ClockInCommentVo();
+ BeanUtil.copyProperties(entity, vo);
+ UserEntity user = userService.getById(entity.getUserId());
+ vo.setNickName(user.getNickname());
+ vo.setAvatar(user.getAvatar());
+ QueryWrapper subQueryWrapper = new QueryWrapper<>();
+ subQueryWrapper.eq("fid", entity.getId());
+ List subClockInChatList = bookClockEntryChatService.list(subQueryWrapper);
+ List 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 result = new HashMap<>();
result.put("chatList", resultList);
return R.ok(result);
@@ -71,6 +115,11 @@ public class BookClockForumController {
*/
@RequestMapping(path = "/addChat", method = RequestMethod.POST)
public R addChat(@RequestBody BookClockInChatEntity chat) {
+ List imageList = chat.getImageList();
+ if (imageList != null) {
+ String images = JSON.toJSON(imageList).toString();
+ chat.setImages(images);
+ }
bookClockEntryChatService.save(chat);
return R.ok();
}
diff --git a/src/main/java/com/peanut/modules/book/controller/BookClockinCommentController.java b/src/main/java/com/peanut/modules/book/controller/BookClockinCommentController.java
index 7cd8cf4c..ca8c33ee 100644
--- a/src/main/java/com/peanut/modules/book/controller/BookClockinCommentController.java
+++ b/src/main/java/com/peanut/modules/book/controller/BookClockinCommentController.java
@@ -8,7 +8,7 @@ import com.peanut.modules.book.entity.BookClockInEntity;
import com.peanut.modules.book.entity.BookClockinPunchEntity;
import com.peanut.modules.book.service.BookClockinCommentService;
import com.peanut.modules.book.service.BookClockinPunchService;
-import com.peanut.modules.book.service.BookClockinService;
+import com.peanut.modules.book.service.BookClockInService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
@@ -28,7 +28,7 @@ public class BookClockinCommentController {
@Autowired
private BookClockinPunchService bookClockinPunchService;
@Autowired
- private BookClockinService bookClockinService;
+ private BookClockInService bookClockinService;
/**
* 列表 倒叙
diff --git a/src/main/java/com/peanut/modules/book/controller/BookClockinController.java b/src/main/java/com/peanut/modules/book/controller/BookClockinController.java
index d30abd72..bb2953c9 100644
--- a/src/main/java/com/peanut/modules/book/controller/BookClockinController.java
+++ b/src/main/java/com/peanut/modules/book/controller/BookClockinController.java
@@ -15,7 +15,7 @@ import java.util.*;
@RequestMapping("book/clockin")
public class BookClockinController {
@Autowired
- private BookClockinService bookClockinService;
+ private BookClockInService bookClockinService;
@Autowired
private BookTaskService bookTaskService;
@Autowired
diff --git a/src/main/java/com/peanut/modules/book/controller/BookTaskController.java b/src/main/java/com/peanut/modules/book/controller/BookTaskController.java
index 4e4666c8..ef9c9167 100644
--- a/src/main/java/com/peanut/modules/book/controller/BookTaskController.java
+++ b/src/main/java/com/peanut/modules/book/controller/BookTaskController.java
@@ -26,7 +26,7 @@ public class BookTaskController {
@Autowired
private BookService bookService;
@Autowired
- private BookClockinService bookClockinService;
+ private BookClockInService bookClockinService;
@Autowired
private MyUserService myUserService;
@Autowired
diff --git a/src/main/java/com/peanut/modules/book/controller/ShopProductController.java b/src/main/java/com/peanut/modules/book/controller/ShopProductController.java
index ff7a3691..c7629ca7 100644
--- a/src/main/java/com/peanut/modules/book/controller/ShopProductController.java
+++ b/src/main/java/com/peanut/modules/book/controller/ShopProductController.java
@@ -295,10 +295,10 @@ public class ShopProductController {
*/
@RequestMapping("/infobook/{productId}")
public R infobook(@PathVariable("productId") Integer productId) {
- List proudict = shopProductBookService.getBaseMapper().selectList(new QueryWrapper()
+ List product = shopProductBookService.getBaseMapper().selectList(new QueryWrapper()
.eq("product_id", productId));
List