From 9d700af56eb43532d2e1f7100e257610de38123d Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Tue, 10 Oct 2023 14:04:34 +0800 Subject: [PATCH] =?UTF-8?q?clock=E6=89=93=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../book/controller/UserClockController.java | 76 +++++++++++++++++++ .../book/entity/BookClockEntryEntity.java | 6 +- src/main/resources/weChatConfig.properties | 11 ++- 3 files changed, 88 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/peanut/modules/book/controller/UserClockController.java diff --git a/src/main/java/com/peanut/modules/book/controller/UserClockController.java b/src/main/java/com/peanut/modules/book/controller/UserClockController.java new file mode 100644 index 00000000..3b5c644a --- /dev/null +++ b/src/main/java/com/peanut/modules/book/controller/UserClockController.java @@ -0,0 +1,76 @@ +package com.peanut.modules.book.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.peanut.common.utils.R; +import com.peanut.modules.book.entity.BookClockEntryEntity; +import com.peanut.modules.book.service.BookClockEntryChatService; +import com.peanut.modules.book.service.BookClockEntryService; +import com.peanut.modules.book.service.UserBookClockService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("book/clock") +public class UserClockController { + + @Autowired + private UserBookClockService userBookClockService; + @Autowired + private BookClockEntryService bookClockEntryService; + @Autowired + private BookClockEntryChatService bookClockEntryChatService; + + /** + * 获取书打卡列表 + * @param bookId + * @param limit + * @param page + * @return + */ + @RequestMapping("/getBookClocks") + public R getBookClocks(@RequestParam Integer bookId,@RequestParam Integer limit,@RequestParam Integer page){ + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(BookClockEntryEntity::getBookId,bookId); + wrapper.eq(BookClockEntryEntity::getDelFlag,0); + wrapper.orderByAsc(BookClockEntryEntity::getDay); + Page bookClockEntryEntityPage = bookClockEntryService.getBaseMapper().selectPage(new Page(page, limit), wrapper); + return R.ok().put("page",bookClockEntryEntityPage); + } + + /** + * 新增读书打卡 + * @param bookClockEntry + * @return + */ + @RequestMapping("/addBookClock") + public R addBookClock(@RequestBody BookClockEntryEntity bookClockEntry){ + bookClockEntryService.save(bookClockEntry); + return R.ok(); + } + + /** + * 删除读书打卡 + * @param entryId + * @return + */ + @RequestMapping("/delBookClock") + public R delBookClock(@RequestParam Integer entryId){ + bookClockEntryService.removeById(entryId); + return R.ok(); + } + + /** + * 修改读书打卡 + * @return + */ + @RequestMapping("/updateBookClock") + public R updateBookClock(@RequestBody BookClockEntryEntity bookClockEntry){ + bookClockEntryService.updateById(bookClockEntry); + return R.ok(); + } + +} diff --git a/src/main/java/com/peanut/modules/book/entity/BookClockEntryEntity.java b/src/main/java/com/peanut/modules/book/entity/BookClockEntryEntity.java index 9a9d6a2f..d78ff8ec 100644 --- a/src/main/java/com/peanut/modules/book/entity/BookClockEntryEntity.java +++ b/src/main/java/com/peanut/modules/book/entity/BookClockEntryEntity.java @@ -9,7 +9,7 @@ import java.io.Serializable; import java.util.Date; @Data -@TableName("user_clock_entry") +@TableName("book_clock_entry") public class BookClockEntryEntity implements Serializable { private static final long serialVersionUID = 1L; @@ -19,6 +19,10 @@ public class BookClockEntryEntity implements Serializable { private Integer bookId; + private String image; + + private String video; + private String content; private Date createTime; diff --git a/src/main/resources/weChatConfig.properties b/src/main/resources/weChatConfig.properties index 70ec1e92..271238cb 100644 --- a/src/main/resources/weChatConfig.properties +++ b/src/main/resources/weChatConfig.properties @@ -9,15 +9,18 @@ wxpay.notifyUrl:https://testapi.nuttyreading.com/pay/payNotify # ?? url wxpay.refundNotifyUrl:http://pjm6m9.natappfree.cc/pay/refundNotify # key pem -wxpay.keyPemPath:/usr/local/hs/peanut_book/target/classes/cent/apiclient_key.pem +#wxpay.keyPemPath:/usr/local/hs/peanut_book/target/classes/cent/apiclient_key.pem #wxpay.keyPemPath:C:/Users/Cauchy/IdeaProjects/nuttyreading-java/src/main/resources/cent/apiclient_key.pem +wxpay.keyPemPath:D:/hs/nuttyreading-java/src/main/resources/cent/apiclient_key.pem # ??? wxpay.serialNo:679AECB2F7AC4183033F713828892BA640E4EEE3 # API v3 key wxpay.apiV3Key:4aYFklzaULeGlr7oJPZ6rHWKcxjihZUF # ???? -wxpay.wechatPayCertificateUrl:/usr/local/hs/peanut_book/target/classes/cent/wechatpay_7B5676E3CDF56680D0414A009CE501C844DBE2D6.pem +#wxpay.wechatPayCertificateUrl:/usr/local/hs/peanut_book/target/classes/cent/wechatpay_7B5676E3CDF56680D0414A009CE501C844DBE2D6.pem # wxpay.wechatPayCertificateUrl:C:/Users/Cauchy/IdeaProjects/nuttyreading-java/src/main/resources/cent/wechatpay_7B5676E3CDF56680D0414A009CE501C844DBE2D6.pem + wxpay.wechatPayCertificateUrl:D:/hs/nuttyreading-java/src/main/resources/cent/wechatpay_7B5676E3CDF56680D0414A009CE501C844DBE2D6.pem # ?? url -wxpay.privateKeyUrl:/usr/local/hs/peanut_book/target/classes/cent/apiclient_key.pem -#wxpay.privateKeyUrl:C:/Users/Cauchy/IdeaProjects/nuttyreading-java/src/main/resources/cent/apiclient_key.pem \ No newline at end of file +#wxpay.privateKeyUrl:/usr/local/hs/peanut_book/target/classes/cent/apiclient_key.pem +#wxpay.privateKeyUrl:C:/Users/Cauchy/IdeaProjects/nuttyreading-java/src/main/resources/cent/apiclient_key.pem +wxpay.privateKeyUrl:D:/hs/nuttyreading-java/src/main/resources/cent/apiclient_key.pem \ No newline at end of file