Merge remote-tracking branch 'origin/develop/clock_in'
# Conflicts: # src/main/java/com/peanut/config/MyRedissonConfig.java
This commit is contained in:
@@ -3,23 +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);
|
||||
config.useSingleServer().setAddress(redisAddress).setPassword(redisPassword);
|
||||
RedissonClient redissonClient = Redisson.create(config);
|
||||
return redissonClient;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* Copyright (c) 2016-2019 人人开源 All rights reserved.
|
||||
*
|
||||
* <p>
|
||||
* https://www.renren.io
|
||||
*
|
||||
* <p>
|
||||
* 版权所有,侵权必究!
|
||||
*/
|
||||
|
||||
@@ -27,5 +27,4 @@ public class MybatisPlusConfig {
|
||||
public PaginationInterceptor paginationInterceptor() {
|
||||
return new PaginationInterceptor();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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<BookClockInEntity> queryWrapper = new QueryWrapper<>();
|
||||
@RequestParam(value = "day") Integer day) {
|
||||
QueryWrapper<BookClockEntryEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("book_id", bookId);
|
||||
queryWrapper.eq("day", day);
|
||||
BookClockInEntity entity = bookClockinService.getOne(queryWrapper);
|
||||
BookClockEntryEntity entity = bookClockEntryService.getOne(queryWrapper);
|
||||
Map<String, Object> 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<BookClockInChatEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("entry_id", entryId);
|
||||
queryWrapper.orderByAsc("f_id", "create_time");
|
||||
List<BookClockInChatEntity> resultList = bookClockEntryChatService.list(queryWrapper);
|
||||
queryWrapper.eq("fid", 0);
|
||||
if (userId != null) {
|
||||
queryWrapper.eq("user_id", userId);
|
||||
}
|
||||
queryWrapper.orderByAsc("fid", "create_time");
|
||||
List<ClockInCommentVo> resultList = new ArrayList<>();
|
||||
List<BookClockInChatEntity> chatEntityList = bookClockEntryChatService.list(queryWrapper);
|
||||
for (BookClockInChatEntity entity : chatEntityList) {
|
||||
List<String> imageList = JSON.parseObject(entity.getImages(), new TypeReference<List<String>>() {
|
||||
});
|
||||
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<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<>();
|
||||
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<String> imageList = chat.getImageList();
|
||||
if (imageList != null) {
|
||||
String images = JSON.toJSON(imageList).toString();
|
||||
chat.setImages(images);
|
||||
}
|
||||
bookClockEntryChatService.save(chat);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* 列表 倒叙
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -26,7 +26,7 @@ public class BookTaskController {
|
||||
@Autowired
|
||||
private BookService bookService;
|
||||
@Autowired
|
||||
private BookClockinService bookClockinService;
|
||||
private BookClockInService bookClockinService;
|
||||
@Autowired
|
||||
private MyUserService myUserService;
|
||||
@Autowired
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -22,6 +23,7 @@ import java.util.*;
|
||||
* @CreateTime: 2023/10/11
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/book/userClockIn")
|
||||
public class UserBookClockController {
|
||||
@Autowired
|
||||
@@ -41,17 +43,23 @@ public class UserBookClockController {
|
||||
queryWrapper.eq("book_id", bookId);
|
||||
queryWrapper.eq("user_id", userId);
|
||||
UserBookClockEntity userBookClock = userBookClockService.getOne(queryWrapper);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
if (userBookClock == null) {
|
||||
return R.error("未获取到该用户的打卡信息");
|
||||
result.put("beginDate", new Date());
|
||||
result.put("currentDay", 1);
|
||||
result.put("clockInDayList", new ArrayList<>());
|
||||
return R.ok(result);
|
||||
}
|
||||
// 1. 获取打卡初始日期
|
||||
Date beginDate = userBookClock.getBeginDate();
|
||||
Date today = new Date();
|
||||
long between = DateUtil.between(beginDate, today, DateUnit.DAY);
|
||||
// 2. 获取打卡天数列表
|
||||
String clocksStr = userBookClock.getClocks();
|
||||
List<Integer> clockInDayList = JSON.parseObject(clocksStr, new TypeReference<List<Integer>>() {
|
||||
});
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("beginDate", beginDate);
|
||||
result.put("currentDay", between + 1);
|
||||
result.put("clockInDayList", clockInDayList);
|
||||
return R.ok(result);
|
||||
}
|
||||
@@ -64,7 +72,8 @@ public class UserBookClockController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(path = "/clockIn", method = RequestMethod.GET)
|
||||
public R clockIn(@RequestParam("bookId") Integer bookId, @RequestParam("userId") Integer userId) {
|
||||
public R clockIn(@RequestParam("bookId") Integer bookId,
|
||||
@RequestParam("userId") Integer userId) {
|
||||
// 查询是否有该用户打卡记录,如果没有,说明是第一天打卡
|
||||
QueryWrapper<UserBookClockEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("book_id", bookId);
|
||||
@@ -90,7 +99,10 @@ public class UserBookClockController {
|
||||
Date beginDate = userBookClock.getBeginDate();
|
||||
Date today = new Date();
|
||||
long between = DateUtil.between(beginDate, today, DateUnit.DAY);
|
||||
clockInDaysList.add((int) between);
|
||||
if (clockInDaysList.contains((int) between + 1)) {
|
||||
return R.error("今天打卡已完成,不可重复打卡!");
|
||||
}
|
||||
clockInDaysList.add((int) (between + 1));
|
||||
String clockInDaysListStr = JSON.toJSON(clockInDaysList).toString();
|
||||
userBookClock.setClocks(clockInDaysListStr);
|
||||
userBookClockService.updateById(userBookClock);
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import cn.com.marsoft.tool.ToolObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.google.gson.Gson;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
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 java.util.stream.Collectors;
|
||||
|
||||
import static com.peanut.common.utils.R.error;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("buy/record")
|
||||
public class UserRecordController {
|
||||
@@ -31,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);
|
||||
@@ -39,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"));
|
||||
@@ -101,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);
|
||||
}
|
||||
@@ -124,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();
|
||||
}
|
||||
@@ -133,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();
|
||||
}
|
||||
@@ -142,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();
|
||||
@@ -150,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);
|
||||
//商品评价
|
||||
@@ -189,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) {
|
||||
@@ -229,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
package com.peanut.modules.book.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@TableName("book_clock_entry_chat")
|
||||
public class BookClockInChatEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -20,12 +24,21 @@ public class BookClockInChatEntity implements Serializable {
|
||||
//子对话开启的层数
|
||||
private Integer fid;
|
||||
//回复于某人id
|
||||
private Integer pUserId;
|
||||
@TableField("p_user_id")
|
||||
private Integer puserId;
|
||||
|
||||
private String content;
|
||||
|
||||
@TableField("p_chat_id")
|
||||
private Integer pchatId;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<String> imageList;
|
||||
|
||||
private String images;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class OrderCartEntity implements Serializable {
|
||||
/**
|
||||
* 套装参数
|
||||
*/
|
||||
private Integer proudictBook;
|
||||
private Integer productBook;
|
||||
/**
|
||||
* 商品数量
|
||||
*/
|
||||
|
||||
@@ -6,8 +6,6 @@ import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@@ -24,13 +22,13 @@ public class ShopProductToLabelEntity {
|
||||
|
||||
@TableField("del_flag")
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* 不存入数据库,返回商品详情
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<ShopProductEntity> shopproudicts;
|
||||
private List<ShopProductEntity> shopProducts;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<Object> shopp;
|
||||
|
||||
@@ -4,13 +4,11 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.peanut.modules.book.to.UserRecordDto;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@TableName("user_record")
|
||||
@@ -26,39 +24,37 @@ public class UserRecordEntity {
|
||||
|
||||
// 类型(商品评价01,听书评价02,观看电子书评价03)
|
||||
@TableField("type")
|
||||
private String type ;
|
||||
private String type;
|
||||
|
||||
// 内容
|
||||
@TableField("content")
|
||||
private Object content ;
|
||||
private Object content;
|
||||
//快递单号
|
||||
@TableField("orderCode")
|
||||
private String orderCode;
|
||||
private String orderCode;
|
||||
|
||||
@TableField("proudict_id")
|
||||
private Integer proudictId;
|
||||
@TableField("product_id")
|
||||
private Integer productId;
|
||||
//订单号
|
||||
@TableField("orderSn")
|
||||
private String orderSn;
|
||||
// 关联客户
|
||||
@TableField("userid")
|
||||
private Integer userid ;
|
||||
private Integer userid;
|
||||
//逻辑删除:未删除0 -1删除
|
||||
@TableField("delFlag")
|
||||
@TableLogic
|
||||
private Integer delflag;
|
||||
private Integer delflag;
|
||||
//关联图书id
|
||||
@TableField("bookid")
|
||||
private Integer bookid ;
|
||||
//图片url
|
||||
// @TableField("images")
|
||||
// private String[] images;
|
||||
private Integer bookid;
|
||||
|
||||
@TableField("images")
|
||||
private Object images;
|
||||
|
||||
//星级 1=一星,5=五星
|
||||
@TableField("starLevel")
|
||||
private String starLevel;
|
||||
private String starLevel;
|
||||
|
||||
/**
|
||||
* 表情存储
|
||||
@@ -67,18 +63,18 @@ public class UserRecordEntity {
|
||||
private Object emoji;
|
||||
|
||||
@TableField("name")
|
||||
private Object name;
|
||||
private Object name;
|
||||
@TableField("tag")
|
||||
private Object tag;
|
||||
private Object tag;
|
||||
|
||||
@TableField("orderdid")
|
||||
private Integer orderdid;
|
||||
private Integer orderdId;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private Object avatar;
|
||||
private Object avatar;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Object nickname;
|
||||
private Object nickname;
|
||||
|
||||
}
|
||||
|
||||
@@ -6,10 +6,8 @@ import com.peanut.modules.book.entity.BookClockInEntity;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface BookClockinService extends IService<BookClockInEntity> {
|
||||
public interface BookClockInService extends IService<BookClockInEntity> {
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
|
||||
|
||||
|
||||
PageUtils queryPagemylist(Map<String, Object> params);
|
||||
}
|
||||
@@ -2,19 +2,16 @@ package com.peanut.modules.book.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.modules.book.entity.BuyOrderEntity;
|
||||
import com.peanut.modules.book.entity.UserRecordEntity;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface UserRecordService extends IService<UserRecordEntity> {
|
||||
|
||||
|
||||
//todo 传参参数 用户id 购买订单id 星级评价 内容
|
||||
public Object commodityComment(String userid, String orderSn, String starLevel, String comment);
|
||||
void commodityComment(String userid, String orderSn, String starLevel, String comment);
|
||||
|
||||
PageUtils queryPage(Map<String, Object> params);
|
||||
|
||||
|
||||
@@ -7,24 +7,24 @@ import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.Query;
|
||||
import com.peanut.modules.book.dao.BookClockinDao;
|
||||
import com.peanut.modules.book.entity.BookClockInEntity;
|
||||
import com.peanut.modules.book.service.BookClockinService;
|
||||
import com.peanut.modules.book.service.BookClockInService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class BookClockinServiceImpl extends ServiceImpl<BookClockinDao, BookClockInEntity> implements BookClockinService {
|
||||
public class BookClockInServiceImpl extends ServiceImpl<BookClockinDao, BookClockInEntity> implements BookClockInService {
|
||||
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
Object book =params.get("bookid");
|
||||
Object book = params.get("bookid");
|
||||
Object taskid = params.get("taskid");
|
||||
IPage<BookClockInEntity> page = this.page(
|
||||
new Query<BookClockInEntity>().getPage(params),
|
||||
new QueryWrapper<BookClockInEntity>()
|
||||
.eq("book_id",book)
|
||||
.eq("task_id",taskid)
|
||||
.eq("book_id", book)
|
||||
.eq("task_id", taskid)
|
||||
.orderByDesc("create_time")
|
||||
|
||||
);
|
||||
@@ -79,7 +79,7 @@ public class ShopProductBookServiceImpl extends ServiceImpl<ShopProductBookDao,
|
||||
|
||||
@Override
|
||||
public List<Integer> getBookIdsByProductId(Integer productId) {
|
||||
List<ShopProductBookEntity> spbs = this.list(new QueryWrapper<ShopProductBookEntity>().eq("del_flag", 0).eq("proudict_id", productId));
|
||||
List<ShopProductBookEntity> spbs = this.list(new QueryWrapper<ShopProductBookEntity>().eq("del_flag", 0).eq("product_id", productId));
|
||||
List<Integer> ids = new ArrayList();
|
||||
for (ShopProductBookEntity s : spbs) {
|
||||
ids.add(s.getBookId());
|
||||
@@ -93,9 +93,9 @@ public class ShopProductBookServiceImpl extends ServiceImpl<ShopProductBookDao,
|
||||
wrapper.eq(ShopProductBookEntity::getBookId, bookId);
|
||||
wrapper.eq(ShopProductBookEntity::getDelFlag, 0);
|
||||
wrapper.groupBy(ShopProductBookEntity::getProductId);
|
||||
List<ShopProductBookEntity> shopProudictBookEntities = this.getBaseMapper().selectList(wrapper);
|
||||
List<ShopProductBookEntity> shopProductBookEntities = this.getBaseMapper().selectList(wrapper);
|
||||
List ids = new ArrayList();
|
||||
for (ShopProductBookEntity s : shopProudictBookEntities) {
|
||||
for (ShopProductBookEntity s : shopProductBookEntities) {
|
||||
ids.add(s.getProductId());
|
||||
}
|
||||
if (ids.size() == 0) {
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.peanut.modules.book.service.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.peanut.common.utils.ExcludeEmptyQueryWrapper;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.Query;
|
||||
@@ -16,7 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -52,7 +50,7 @@ public class ShopProductToLabelServiceImpl extends ServiceImpl<ShopProductToLabe
|
||||
.eq("product_id",ptlId)
|
||||
);
|
||||
|
||||
shopProductToLabelEntity.setShopproudicts(ShopProduct);
|
||||
shopProductToLabelEntity.setShopProducts(ShopProduct);
|
||||
}
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import com.aliyun.oss.OSS;
|
||||
import com.aliyun.oss.OSSClientBuilder;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -6,7 +7,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.common.utils.*;
|
||||
import com.peanut.modules.book.dao.UserRecordDao;
|
||||
import com.peanut.modules.book.entity.BookEntity;
|
||||
import com.peanut.modules.book.entity.MyUserEntity;
|
||||
import com.peanut.modules.book.entity.UserRecordEntity;
|
||||
import com.peanut.modules.book.service.MyUserService;
|
||||
@@ -14,7 +14,6 @@ import com.peanut.modules.book.service.UserRecordService;
|
||||
import org.joda.time.DateTime;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.InputStream;
|
||||
@@ -22,28 +21,27 @@ import java.util.*;
|
||||
|
||||
|
||||
@Service("UserRecordServiceImpl")
|
||||
public class UserRecordServiceImpl extends ServiceImpl<UserRecordDao, UserRecordEntity> implements UserRecordService {
|
||||
public class UserRecordServiceImpl extends ServiceImpl<UserRecordDao, UserRecordEntity> implements UserRecordService {
|
||||
|
||||
@Autowired
|
||||
private MyUserService myUserService;
|
||||
|
||||
|
||||
@Override
|
||||
public Object commodityComment(String userid, String orderSn, String starLevel, String comment) {
|
||||
public void commodityComment(String userid, String orderSn, String starLevel, String comment) {
|
||||
|
||||
|
||||
|
||||
return R.ok("成功");
|
||||
R.ok("成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
String proudictid = (String) params.get("proudictId");
|
||||
String productId = (String) params.get("proudictId");
|
||||
IPage<UserRecordEntity> page = page(
|
||||
new Query<UserRecordEntity>().getPage(params),
|
||||
new QueryWrapper<UserRecordEntity>()
|
||||
//订单号,开始时间
|
||||
.eq("bookid", proudictid).orderByDesc("create_date")
|
||||
.eq("bookid", productId).orderByDesc("create_date")
|
||||
// .eq("")
|
||||
|
||||
);
|
||||
@@ -61,6 +59,7 @@ public class UserRecordServiceImpl extends ServiceImpl<UserRecordDao, UserRecor
|
||||
|
||||
return new PageUtils(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadFile(MultipartFile file) {
|
||||
|
||||
@@ -91,8 +90,6 @@ public class UserRecordServiceImpl extends ServiceImpl<UserRecordDao, UserRecor
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.peanut.modules.book.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 用户评论信息 Vo
|
||||
* @Author: Cauchy
|
||||
* @CreateTime: 2023/10/12
|
||||
*/
|
||||
@Data
|
||||
public class ClockInCommentVo {
|
||||
private Integer id;
|
||||
|
||||
private Integer entryId;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private Integer fid;
|
||||
|
||||
private Integer pUserId;
|
||||
|
||||
private String content;
|
||||
|
||||
private Integer pChatId;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Integer delFlag;
|
||||
|
||||
private List<String> imageList;
|
||||
|
||||
private String images;
|
||||
|
||||
private String nickName;
|
||||
|
||||
private String avatar;
|
||||
|
||||
private String puserNickName;
|
||||
|
||||
private String puserAvatar;
|
||||
|
||||
private List<ClockInCommentVo> subCommentList;
|
||||
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.peanut.modules.book.vo;
|
||||
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -36,7 +35,7 @@ public class ShopCartVo {
|
||||
/**
|
||||
* 商品活动单价
|
||||
*/
|
||||
private Integer proudictBook;
|
||||
private Integer productBook;
|
||||
private String image;
|
||||
|
||||
private String productName;
|
||||
|
||||
@@ -53,7 +53,7 @@ public class WeChatPayController {
|
||||
private TransactionDetailsService transactionDetailsService;
|
||||
|
||||
@Autowired
|
||||
private ShopProductBookService shopProudictBookService;
|
||||
private ShopProductBookService shopProductBookService;
|
||||
|
||||
@Autowired
|
||||
private UserEbookBuyService userEbookBuyService;
|
||||
@@ -127,7 +127,7 @@ public class WeChatPayController {
|
||||
BuyOrderEntity orderEntity = buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrderEntity>().eq("order_sn", orderNo));
|
||||
BigDecimal realMoney = orderEntity.getRealMoney();
|
||||
// 查询订单的所有 book_id
|
||||
List<Integer> orderBookIdList = shopProudictBookService.getOrderBookId(order.getOrderSn());
|
||||
List<Integer> orderBookIdList = shopProductBookService.getOrderBookId(order.getOrderSn());
|
||||
// 去重
|
||||
Set<Integer> set = new HashSet<>(orderBookIdList);
|
||||
orderBookIdList.clear();
|
||||
|
||||
@@ -3,7 +3,7 @@ spring:
|
||||
redis:
|
||||
open: false # 是否开启redis缓存 true开启 false关闭
|
||||
database: 0
|
||||
host: 39.106.36.183
|
||||
host: 59.110.212.44
|
||||
port: 6379
|
||||
password: Jgll2015 # 密码(默认为空)
|
||||
timeout: 6000000ms # 连接超时时长(毫秒)
|
||||
@@ -70,4 +70,7 @@ aliyun:
|
||||
templateCode: SMS_248840040
|
||||
|
||||
server:
|
||||
port: 9200
|
||||
port: 9200
|
||||
|
||||
redisAddress: redis://59.110.212.44:6379
|
||||
redisPassword: Jgll2015
|
||||
@@ -69,4 +69,7 @@ aliyun:
|
||||
templateCode: SMS_248840040
|
||||
|
||||
server:
|
||||
port: 9100
|
||||
port: 9100
|
||||
|
||||
redisAddress: redis://59.110.212.44:6379
|
||||
redisPassword: Jgll2015
|
||||
@@ -13,7 +13,7 @@
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="proudictBook" column="proudict_book"/>
|
||||
<result property="productBook" column="product_book"/>
|
||||
|
||||
</resultMap>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<result property="orderCode" column="orderCode"/>
|
||||
<result property="orderSn" column="orderSn"/>
|
||||
<result property="starLevel" column="starLevel"/>
|
||||
<result property="proudictId" column="proudict_id"/>
|
||||
<result property="productId" column="product_id"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user