merge and modify config file

This commit is contained in:
Cauchy
2023-10-08 15:18:38 +08:00
12 changed files with 156 additions and 55 deletions

View File

@@ -1,11 +1,12 @@
package com.peanut.modules.book.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.common.utils.PageUtils;
import com.peanut.common.utils.R;
import com.peanut.modules.book.entity.BookClockinCommentEntity;
import com.peanut.modules.book.entity.BookClockinPunchEntity;
import com.peanut.modules.book.entity.BookEntity;
import com.peanut.modules.book.entity.MyUserEntity;
import com.peanut.modules.book.dao.UserEbookBuyDao;
import com.peanut.modules.book.entity.*;
import com.peanut.modules.book.service.BookClockinCommentService;
import com.peanut.modules.book.service.BookClockinPunchService;
import com.peanut.modules.book.service.BookService;
@@ -25,6 +26,8 @@ private BookService bookService;
private MyUserService myUserService;
@Autowired
private BookClockinCommentService bookClockinCommentService;
@Autowired
private UserEbookBuyDao userEbookBuyDao;
@@ -136,6 +139,42 @@ private BookClockinCommentService bookClockinCommentService;
}
/**
* 获取用户打卡已购图书
* @param userId
* @return
*/
@RequestMapping("/myClockBooks")
public R myClockBooks(@RequestParam Integer userId,@RequestParam Integer limit,@RequestParam Integer page){
MPJLambdaWrapper<UserEbookBuyEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(BookEntity.class);
wrapper.leftJoin(BookEntity.class,BookEntity::getId,UserEbookBuyEntity::getBookId);
wrapper.eq(UserEbookBuyEntity::getUserId,userId);
wrapper.eq(BookEntity::getDelFlag,0);
wrapper.eq(BookEntity::getClockIn,1);
Page<BookEntity> userBookEntityPage = userEbookBuyDao.selectJoinPage(new Page<BookEntity>(page, limit), BookEntity.class, wrapper);
return R.ok().put("page",userBookEntityPage);
}
/**
* 获取打卡推荐图书
* @param userId
* @param limit
* @param page
* @return
*/
@RequestMapping("/getBestClockBooks")
public R getBestClockBooks(@RequestParam Integer userId,@RequestParam Integer limit,@RequestParam Integer page){
String not_ex_sql = "select 1 from user_ebook_buy where book.id = book_id and user_id = "+userId;
LambdaQueryWrapper<BookEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BookEntity::getDelFlag,0);
wrapper.eq(BookEntity::getClockIn,1);
wrapper.notExists(not_ex_sql);
Page<BookEntity> bookEntityPage = bookService.getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
return R.ok().put("page",bookEntityPage);
}
/**
* 修改
*/

View File

@@ -59,6 +59,8 @@ public class BookController {
private ShopProductService shopProductService;
@Autowired
private ShopProudictBookService shopProudictBookService;
@Autowired
private ShopProductToLabelService shopProductToLabelService;
final ExecutorService fixedThreadPool = Executors.newFixedThreadPool(10);
/**
@@ -82,6 +84,21 @@ public class BookController {
return R.ok().put("page", page);
}
/**
* 获取精品图书
* @return
*/
@RequestMapping("/getJPBooks")
public R getJPBooks(){
LambdaQueryWrapper<ShopProductToLabelEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ShopProductToLabelEntity::getSplId,5);//精选图书
wrapper.eq(ShopProductToLabelEntity::getDelFlag,0);
List<Integer> pIds = shopProductToLabelService.getBaseMapper().selectList(wrapper).stream().map(ShopProductToLabelEntity::getProductId).collect(Collectors.toList());
List<ShopProductEntity> shopProductEntities = shopProductService.getBaseMapper().selectList(new LambdaQueryWrapper<ShopProductEntity>().in(ShopProductEntity::getProductId, pIds));
return R.ok().put("Products",shopProductEntities);
}
/**

View File

@@ -138,6 +138,56 @@ public class BookForumArticlesServiceController {
return R.ok().put("page",bookEntityPage);
}
/**
* 书集----已购图书
* @param userId
* @param limit
* @param page
* @return
*/
@RequestMapping("/getHasForumsAndBook")
public R getHasForumsAndBook(@RequestParam Integer userId,@RequestParam Integer limit,@RequestParam Integer page){
String ex_sql = "select 1 from user_ebook_buy where book.id = book_id and user_id = "+userId;
String existSql = "select 1 from book_forum_articles where book.id = bookid";
LambdaQueryWrapper<BookEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BookEntity::getDelFlag,0);
wrapper.exists(ex_sql);
wrapper.exists(existSql);
Page<BookEntity> bookEntityPage = bookService.getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
for (BookEntity b : bookEntityPage.getRecords()){
b.setForums(bookForumArticlesService.getForumsLimit(b.getId(), 4));
b.setForumNum(bookForumArticlesService.getForumsCount(b.getId()));
}
return R.ok().put("page",bookEntityPage);
}
/**
* 书集----推荐图书
* @param userId
* @param limit
* @param page
* @return
*/
@RequestMapping("/getBestForumsAndBook")
public R getBestForumsAndBook(@RequestParam Integer userId,@RequestParam Integer limit,@RequestParam Integer page){
String ex_sql = "select 1 from user_ebook_buy where book.id = book_id and user_id = "+userId;
String existSql = "select 1 from book_forum_articles where book.id = bookid";
LambdaQueryWrapper<BookEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BookEntity::getDelFlag,0);
wrapper.notExists(ex_sql);
wrapper.exists(existSql);
Page<BookEntity> bookEntityPage = bookService.getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
for (BookEntity b : bookEntityPage.getRecords()){
b.setForums(bookForumArticlesService.getForumsLimit(b.getId(), 4));
b.setForumNum(bookForumArticlesService.getForumsCount(b.getId()));
}
return R.ok().put("page",bookEntityPage);
}
/**
* 点赞书评帖子
* @param forum_id

View File

@@ -7,6 +7,7 @@ import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
@@ -85,6 +86,9 @@ public class BuyOrderController {
*/
private static final String ORDER_STATUS_TO_BE_RECEIVED = "2";
@Autowired
private ShopProudictBookService shopProudictBookService;
/**
* 列表
*/
@@ -263,6 +267,15 @@ public class BuyOrderController {
transactionDetailsEntity.setOrderType("购买健康超市用品!");
transactionDetailsService.save(transactionDetailsEntity);
//购买成功后,添加书到个人表中
List<Integer> pros = products.stream().map(BuyOrderDetailEntity::getProductId).collect(Collectors.toList());
for (Integer s : pros){
List<Integer> collect = shopProudictBookService.getBaseMapper().selectList(new LambdaQueryWrapper<ShopProudictBookEntity>()
.eq(ShopProudictBookEntity::getProudictId, s)
.eq(ShopProudictBookEntity::getDelFlag, 0)).stream().map(ShopProudictBookEntity::getBookId).collect(Collectors.toList());
userEbookBuyService.addBookForUser(buyOrder.getUserId(),collect);
}
}else{
return R.error("余额不足!");
}

View File

@@ -29,7 +29,6 @@ public class ShopProductLabelController {
@Autowired
private ShopProductLabelService shopProductLabelService;
@Autowired
private ShopProductToLabelService shopProductToLabelService;
@Autowired
@@ -92,7 +91,7 @@ public class ShopProductLabelController {
/**
*
* 废除
* @param params
* @return
*/
@@ -113,6 +112,7 @@ public class ShopProductLabelController {
MPJLambdaWrapper<ShopProductToLabelEntity> shopProductEntityMPJLambdaWrapper = new MPJLambdaWrapper<ShopProductToLabelEntity>();
shopProductEntityMPJLambdaWrapper.selectAll(ShopProductEntity.class);
shopProductEntityMPJLambdaWrapper.leftJoin(ShopProductEntity.class,ShopProductEntity::getProductId,ShopProductToLabelEntity::getProductId);
shopProductEntityMPJLambdaWrapper.eq(ShopProductToLabelEntity::getSplId,splId);
shopProductEntityMPJLambdaWrapper.eq(ShopProductToLabelEntity::getDelFlag,0);
shopProductEntityMPJLambdaWrapper.eq(ShopProductEntity::getDelFlag,0);
Page<ShopProductEntity> shopProductEntityPage = shopProductToLabelDao.selectJoinPage(new Page<ShopProductEntity>(page, limit), ShopProductEntity.class, shopProductEntityMPJLambdaWrapper);

View File

@@ -22,8 +22,7 @@ public interface UserEbookBuyService extends IService<UserEbookBuyEntity> {
List<Integer> getUserBookId(Integer userId);
void addBookForUser(Integer userId, List<Integer> bookIds);
}

View File

@@ -1,5 +1,6 @@
package com.peanut.modules.book.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -11,6 +12,7 @@ import com.peanut.modules.book.service.UserEbookBuyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -52,4 +54,17 @@ public class UserEbookBuyServiceImpl extends ServiceImpl<UserEbookBuyDao, UserEb
}
@Override
public void addBookForUser(Integer userId, List<Integer> bookIds) {
for (Integer i:bookIds){
List<UserEbookBuyEntity> userEbookBuyEntities = this.getBaseMapper().selectList(new LambdaQueryWrapper<UserEbookBuyEntity>().eq(UserEbookBuyEntity::getUserId, userId).eq(UserEbookBuyEntity::getBookId, i));
if(userEbookBuyEntities.size()==0){
UserEbookBuyEntity userEbookBuyEntity = new UserEbookBuyEntity();
userEbookBuyEntity.setUserId(userId);
userEbookBuyEntity.setBookId(i);
userEbookBuyEntity.setPayTime(new Date());
this.save(userEbookBuyEntity);
}
}
}
}

View File

@@ -32,12 +32,12 @@ import java.util.Base64;
public static final String apiV3Key = "4aYFklzaULeGlr7oJPZ6rHWKcxjihZUF"; // apiV3秘钥
//商户私钥路径
// public static final String privateKeyUrl = "/usr/local/hs/peanut_book/target/classes/cent/apiclient_key.pem";
public static final String privateKeyUrl = "C:/Users/Cauchy/IdeaProjects/nuttyreading-java/src/main/resources/cent/apiclient_key.pem";
public static final String privateKeyUrl = "/usr/local/hs/peanut_book/target/classes/cent/apiclient_key.pem";
//public static final String privateKeyUrl = "C:/Users/Cauchy/IdeaProjects/nuttyreading-java/src/main/resources/cent/apiclient_key.pem";
//平台证书路径
// public static final String wechatPayCertificateUrl = "/usr/local/hs/peanut_book/target/classes/cent/wechatpay_7B5676E3CDF56680D0414A009CE501C844DBE2D6.pem";
public static final String wechatPayCertificateUrl = "C:/Users/Cauchy/IdeaProjects/nuttyreading-java/src/main/resources/cent/wechatpay_7B5676E3CDF56680D0414A009CE501C844DBE2D6.pem";
public static final String wechatPayCertificateUrl = "/usr/local/hs/peanut_book/target/classes/cent/wechatpay_7B5676E3CDF56680D0414A009CE501C844DBE2D6.pem";
//public static final String wechatPayCertificateUrl = "C:/Users/Cauchy/IdeaProjects/nuttyreading-java/src/main/resources/cent/wechatpay_7B5676E3CDF56680D0414A009CE501C844DBE2D6.pem";
//第一步申请完证书后在API证书哪里点击管理证书就能看到
public static final String mchSerialNo = "679AECB2F7AC4183033F713828892BA640E4EEE3"; // 商户证书序列号

View File

@@ -1,10 +1,10 @@
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://59.110.212.44:3306/e_book_test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
url: jdbc:mysql://59.110.212.44:3306/e_book?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
url: jdbc:mysql://59.110.212.44:3306/e_book_test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
username: root
password: HSXY1234hsxy
initial-size: 10
@@ -42,13 +42,6 @@ spring:
username: admin
password: 751019
virtualHost: /
# redis:
# host: 82.157.238.238
# port: 6379
# password: redis970104
aliyun:
oss:
file:
@@ -63,18 +56,5 @@ aliyun:
templateCode: SMS_248840040
##多数据源的配置
#dynamic:
# datasource:
# slave1:
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://localhost:1433;DatabaseName=renren_security
# username: sa
# password: 123456
# slave2:
# driver-class-name: org.postgresql.Driver
# url: jdbc:postgresql://localhost:5432/renren_security
# username: renren
# password: 123456
server:
port: 9200

View File

@@ -1,10 +1,10 @@
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://59.110.212.44:3306/e_book?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
url: jdbc:mysql://59.110.212.44:3306/e_book_test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
url: jdbc:mysql://59.110.212.44:3306/e_book?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
username: root
password: HSXY1234hsxy
initial-size: 10
@@ -55,16 +55,5 @@ aliyun:
templateCode: SMS_248840040
##多数据源的配置
#dynamic:
# datasource:
# slave1:
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://localhost:1433;DatabaseName=renren_security
# username: sa
# password: 123456
# slave2:
# driver-class-name: org.postgresql.Driver
# url: jdbc:postgresql://localhost:5432/renren_security
# username: renren
# password: 123456
server:
port: 9100

View File

@@ -4,7 +4,6 @@ server:
uri-encoding: UTF-8
max-threads: 1000
min-spare-threads: 30
port: 9200
servlet:
context-path: /pb
@@ -12,7 +11,7 @@ connection-timeout: 6000000ms
spring:
# 环境 dev|test|prod
profiles:
active: prod
active: dev
# jackson时间格式化
jackson:
time-zone: GMT+8

View File

@@ -16,8 +16,8 @@ wxpay.notifyUrl: http://59.110.212.44:9100/pb/pay/payNotify
wxpay.refundNotifyUrl: http://pjm6m9.natappfree.cc/pay/refundNotify
# ???? /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.keyPemPath:C:/Users/Cauchy/IdeaProjects/nuttyreading-java/src/main/resources/cent/apiclient_key.pem
wxpay.keyPemPath:/usr/local/hs/peanut_book/target/classes/cent/apiclient_key.pem
#???????
wxpay.serialNo: 679AECB2F7AC4183033F713828892BA640E4EEE3
#???????