Compare commits

..

4 Commits

Author SHA1 Message Date
menxipeng
ed305d5bee pl 2025-12-03 20:26:06 +08:00
menxipeng
813614df58 登陆放开 2025-11-26 23:59:51 +08:00
menxipeng
98565c9150 微信支付部分 2025-11-26 22:40:03 +08:00
menxipeng
30589acd69 微信支付部分 2025-11-25 23:32:39 +08:00
26 changed files with 1248 additions and 505 deletions

View File

@@ -44,27 +44,39 @@ public class FileController extends BaseController {
// 获取文件字节
if (objectName.equals("musicFile")) {
LoginUser userInfo = SecurityUtils.getLoginUser();
if (userInfo == null){
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
response.setContentType("application/json;charset=UTF-8");
response.getWriter().write("{\"code\":401,\"msg\":\"用户未登录\"}");
return;
}
SysUser sysUser = userInfo.getUser();
if (sysUser == null) {
// if (userInfo == null){
// response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
// response.setContentType("application/json;charset=UTF-8");
// response.getWriter().write("{\"code\":401,\"msg\":\"用户未登录\"}");
// return;
// }
// SysUser sysUser = userInfo.getUser();
//if (sysUser == null) {
// if (StrUtil.isBlank(musicId)) {
// response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
// response.setContentType("application/json;charset=UTF-8");
// response.getWriter().write("{\"code\":400,\"msg\":\"音乐ID不能为空\"}");
// return;
// }
ShopUser shopUser = userInfo.getShopUser();
if (shopUser == null) {
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.setContentType("application/json;charset=UTF-8");
response.getWriter().write("{\"code\":401,\"msg\":\"用户未登录\"}");
return;
}
//MusicInfo musicInfo = musicInfoMapper.selectByMusicId(musicId);
//ShopUser shopUser = userInfo.getShopUser();
// if (shopUser == null) {
// response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
// response.setContentType("application/json;charset=UTF-8");
// response.getWriter().write("{\"code\":401,\"msg\":\"用户未登录\"}");
// return;
// }else{
// // 检查会员时间
// if (!MusicUtil.getShopIsVip(shopUser)) {
// if (shopUser.getVip() == 1){
// // 会员已过期修改为非会员
// shopUser.setVip(2L);
// shopUserMapper.updateShopUser(shopUser);
// }
// }
// }
//shopUser = shopUserMapper.selectShopUserByUserId(userId);
// MusicInfo musicInfo = musicInfoMapper.selectByMusicId(musicId);
//
@@ -84,7 +96,7 @@ public class FileController extends BaseController {
// return;
// }
// }
}
// }
}
// 设置响应头

View File

@@ -0,0 +1,83 @@
package com.ruoyi.web.controller.back;
import com.alipay.easysdk.factory.Factory;
import com.ruoyi.system.service.IOrderInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
/**
* 描述:
*
* @author MXP by 2025/11/25
*/
@RestController
@RequestMapping("/call/back")
public class HandleAlipayNotify {
private static final Logger log = LoggerFactory.getLogger(HandleAlipayNotify.class);
@Autowired
private IOrderInfoService orderService;
@PostMapping("/alipay")
public String handleAlipayNotify(HttpServletRequest request) {
try {
// 1. 将异步通知的参数转换为Map
Map<String, String> params = new HashMap<>();
Map<String, String[]> requestParams = request.getParameterMap();
log.info("支付宝异步通知参数: {}", requestParams);
for (String name : requestParams.keySet()) {
String[] values = requestParams.get(name);
String valueStr = "";
for (int i = 0; i < values.length; i++) {
valueStr = (i == values.length - 1) ? valueStr + values[i] : valueStr + values[i] + ",";
}
params.put(name, valueStr);
}
log.info("支付宝异步通知处理后参数: {}", params);
// 2. 验证签名(非常重要!防止伪造通知)
// 使用SDK验证签名
boolean signVerified = Factory
.Payment
.Common()
.verifyNotify(params);
if (signVerified) {
// 签名验证成功,说明通知是支付宝发的
// 3. 验证商户APP_ID是否匹配
String appId = params.get("app_id");
if (!"<你的APPID>".equals(appId)) {
return "failure";
}
// 4. 处理业务逻辑
String tradeStatus = params.get("trade_status");
String outTradeNo = params.get("out_trade_no"); // 你的订单号
String tradeNo = params.get("trade_no"); // 支付宝的交易号
if ("TRADE_SUCCESS".equals(tradeStatus)) {
// 支付成功!
orderService.processPaymentAliResult(outTradeNo, tradeNo);
return "success";
}
} else {
// 签名验证失败,记录日志,可能是恶意请求
return "failure";
}
} catch (Exception e) {
e.printStackTrace();
}
// 处理失败,支付宝会稍后重发通知
return "failure";
}
}

View File

@@ -1,16 +1,30 @@
package com.ruoyi.web.controller.back;
import com.ruoyi.common.core.domain.entity.OrderInfo;
import com.ruoyi.common.enums.OrderStatus;
import cn.hutool.json.JSONUtil;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.IOrderInfoService;
import com.ruoyi.system.util.WeChatPayUtil;
import com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier;
import com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner;
import com.wechat.pay.contrib.apache.httpclient.auth.Verifier;
import com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Credentials;
import com.wechat.pay.contrib.apache.httpclient.util.PemUtil;
import com.wechat.pay.java.core.notification.NotificationConfig;
import com.wechat.pay.java.core.notification.NotificationParser;
import com.wechat.pay.java.core.notification.RequestParam;
import com.wechat.pay.java.service.payments.model.Transaction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.bind.ValidationException;
import java.nio.charset.StandardCharsets;
import java.security.PrivateKey;
import java.util.HashMap;
import java.util.Map;
@@ -18,93 +32,120 @@ import java.util.Map;
@RequestMapping("/call/back")
public class WechatPayNotifyController {
private static final Logger log = LoggerFactory.getLogger(WechatPayNotifyController.class);
@Autowired
private IOrderInfoService orderService;
/**
* 微信支付结果回调接口
* POST /api/wechat/pay/notify
*/
@PostMapping("/wechat")
public Map<String, String> handleWechatPayNotify(HttpServletRequest request,
HttpServletResponse response) {
public Map<String, String> handleWechatPayNotify(HttpServletRequest request, HttpServletResponse response) {
Map<String, String> result = new HashMap<>();
try {
System.out.println("收到微信支付回调通知");
// 1. 读取请求体
String requestBody = getRequestBody(request);
log.info("微信支付回调参数: {}", requestBody);
if (StringUtils.isEmpty(requestBody)) {
result.put("code", "FAIL");
result.put("message", "请求体为空");
return result;
}
// 1. 构建回调参数
RequestParam requestParam = buildRequestParam(request);
// 2. 获取请求头中的关键信息
String wechatpaySignature = request.getHeader("Wechatpay-Signature");
String wechatpayTimestamp = request.getHeader("Wechatpay-Timestamp");
String wechatpayNonce = request.getHeader("Wechatpay-Nonce");
String wechatpaySerial = request.getHeader("Wechatpay-Serial");
String wechatpaySignatureType = request.getHeader("Wechatpay-Signature-Type");
NotificationParser parser = new NotificationParser();
// 2. 解析并验证通知
log.info("回调头部信息:");
log.info("Wechatpay-Signature: " + wechatpaySignature);
log.info("Wechatpay-Timestamp: " + wechatpayTimestamp);
log.info("Wechatpay-Nonce: " + wechatpayNonce);
log.info("Wechatpay-Serial: " + wechatpaySerial);
log.info("Wechatpay-Signature-Type: " + wechatpaySignatureType);
// 3. 验证必要的请求头
if (StringUtils.isEmpty(wechatpaySignature) ||
StringUtils.isEmpty(wechatpayTimestamp) ||
StringUtils.isEmpty(wechatpayNonce) ||
StringUtils.isEmpty(wechatpaySerial)) {
result.put("code", "FAIL");
result.put("message", "缺少必要的微信支付头部信息");
return result;
}
// 4. 构建 RequestParam
RequestParam requestParam = new RequestParam.Builder()
.serialNumber(wechatpaySerial)
.nonce(wechatpayNonce)
.signature(wechatpaySignature)
.timestamp(wechatpayTimestamp)
.signType(wechatpaySignatureType)
.body(requestBody)
.build();
// 5. 初始化验证器 - 正确的方式
NotificationParser parser = new NotificationParser((NotificationConfig) WeChatPayUtil.getConfig());
// 6. 解析并验证通知
Transaction transaction = parser.parse(requestParam, Transaction.class);
System.out.println("解析支付通知成功:");
System.out.println("商户订单号: " + transaction.getOutTradeNo());
System.out.println("微信支付订单号: " + transaction.getTransactionId());
System.out.println("交易状态: " + transaction.getTradeState());
System.out.println("交易类型: " + transaction.getTradeType());
System.out.println("金额: " + transaction.getAmount().getTotal());
log.info("接收到微信支付回调:{}", JSONUtil.toJsonStr(transaction));
// 3. 处理业务逻辑
orderService.processPaymentResult(transaction);
// if (processResult) {
// // 4. 返回成功响应
// result.put("code", "SUCCESS");
// result.put("message", "成功");
// System.out.println("支付回调处理成功");
// } else {
// result.put("code", "FAIL");
// result.put("message", "处理失败");
// System.err.println("支付回调处理失败");
// }
// 7. 处理业务逻辑
//processPaymentResult(transaction, result);
} catch (Exception e) {
System.err.println("支付回调处理异常: " + e.getMessage());
} catch (ValidationException e) {
// logger.error("签名验证失败", e);
e.printStackTrace();
// 返回失败响应
result.put("code", "FAIL");
result.put("message", "签名验证失败");
} catch (Exception e) {
e.printStackTrace();
//logger.error("微信支付回调处理失败", e);
result.put("code", "FAIL");
result.put("message", "处理异常: " + e.getMessage());
}
return result;
// Map<String, String> result = new HashMap<>();
//
// try {
// // 1. 构建回调参数
// RequestParam requestParam = buildRequestParam(request);
//
//
//
//
// NotificationParser parser = new NotificationParser();
// // 2. 解析并验证通知
// Transaction transaction = parser.parse(requestParam, Transaction.class);
//
// log.info("接收到微信支付回调:{}", JSONUtil.toJsonStr( transaction));
//
// // 3. 处理业务逻辑
// orderService.processPaymentResult(transaction);
//
// //4. 返回成功响应
// result.put("code", "SUCCESS");
// result.put("message", "成功");
// } catch (Exception e) {
// log.error("支付回调处理异常: " + e.getMessage());
// e.printStackTrace();
// // 返回失败响应
// result.put("code", "FAIL");
// result.put("message", "处理异常: " + e.getMessage());
// }
// return result;
}
/**
* 从HttpServletRequest构建RequestParam
*/
private RequestParam buildRequestParam(HttpServletRequest request) throws Exception {
// 获取微信回调的头部信息
String wechatpaySerial = request.getHeader("Wechatpay-Serial");
String wechatpaySignature = request.getHeader("Wechatpay-Signature");
String wechatpayTimestamp = request.getHeader("Wechatpay-Timestamp");
String wechatpayNonce = request.getHeader("Wechatpay-Nonce");
String wechatpaySignatureType = request.getHeader("Wechatpay-Signature-Type");
System.out.println("回调头部信息:");
System.out.println("Wechatpay-Serial: " + wechatpaySerial);
System.out.println("Wechatpay-Timestamp: " + wechatpayTimestamp);
System.out.println("Wechatpay-Nonce: " + wechatpayNonce);
System.out.println("Wechatpay-Signature-Type: " + wechatpaySignatureType);
// 读取请求体
String body = getRequestBody(request);
System.out.println("回调请求体: " + body);
return new RequestParam.Builder()
.serialNumber(wechatpaySerial)
.nonce(wechatpayNonce)
.signature(wechatpaySignature)
.timestamp(wechatpayTimestamp)
.signType(wechatpaySignatureType)
.body(body)
.build();
}
/**
* 读取请求体内容
@@ -127,7 +168,7 @@ public class WechatPayNotifyController {
// */
// private boolean handleRefund(Order order, Transaction transaction) {
// // 实现退款逻辑
// System.out.println("处理退款: " + order.getOutTradeNo());
// log.info("处理退款: " + order.getOutTradeNo());
// return true;
// }
//
@@ -136,7 +177,7 @@ public class WechatPayNotifyController {
// */
// private boolean handleClosedPayment(Order order, Transaction transaction) {
// // 实现订单关闭逻辑
// System.out.println("处理订单关闭: " + order.getOutTradeNo());
// log.info("处理订单关闭: " + order.getOutTradeNo());
// return true;
// }
}

View File

@@ -55,6 +55,12 @@ public class ClientOrderInfoController extends BaseController
return orderInfoService.wechatPay(orderId);
}
// 查询支付结果
@GetMapping("/transactions")
public AjaxResult paymentCallback(@RequestParam("orderId") String orderId){
return orderInfoService.findTransactions(orderId);
}
/**
* 支付订单
*/

View File

@@ -5,8 +5,10 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.MusicInfo;
import com.ruoyi.common.core.domain.entity.Notifications;
import com.ruoyi.common.core.domain.entity.PlaStatus;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.mapper.PlaStatusMapper;
import com.ruoyi.system.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -93,4 +95,13 @@ public class IndexController extends BaseController {
List<Notifications> result = notificationsService.selectNotificationsByUserId(userId);
return AjaxResult.success(result);
}
@Autowired
private PlaStatusMapper plaStatusMapper;
@GetMapping("/palStatus")
public AjaxResult palStatus(){
PlaStatus plaStatus = plaStatusMapper.selectPlaStatusById(1L);
return AjaxResult.success(plaStatus.getShareStatus());
}
}

View File

@@ -114,17 +114,20 @@ public class MusicController extends BaseController {
@RequestMapping("/getMusicInfo/{musicId}")
public AjaxResult getMusicInfo(@PathVariable String musicId){
Long userId = SecurityUtils.getUserId();
if (userId == null){
return AjaxResult.error(401,"用户未登录或用户ID为空");
}
MusicInfo musicInfo = musicService.getMusicInfo(userId, musicId);
if (musicInfo != null){
// 增加历史
musicService.addHistoryMusic(musicId);
return AjaxResult.success(musicInfo);
if (userId != null){
MusicInfo musicInfo = musicService.getMusicInfo(userId, musicId);
if (musicInfo != null){
// 增加历史
musicService.addHistoryMusic(musicId);
return AjaxResult.success(musicInfo);
}else {
return new AjaxResult(HttpStatus.USER_VIP_EXPIRE, "请开通会员");
}
}else {
return new AjaxResult(HttpStatus.USER_VIP_EXPIRE, "请开通会员");
MusicInfo musicInfo = musicService.getMusicInfo(null, musicId);
return AjaxResult.success(musicInfo);
}
}
// 新增用户混音

View File

@@ -0,0 +1,230 @@
# 项目相关配置
ruoyi:
# 名称
name: RuoYi
# 版本
version: 3.9.0
# 版权年份
copyrightYear: 2025
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: D:/ruoyi/uploadPath
# 获取ip地址开关
addressEnabled: false
# 验证码类型 math 数字计算 char 字符验证
captchaType: math
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
port: 8080
servlet:
# 应用的访问路径
context-path: /
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# 连接数满后的排队数默认为100
accept-count: 1000
threads:
# tomcat最大线程数默认为200
max: 800
# Tomcat启动初始化的线程数默认值10
min-spare: 100
# 日志配置
logging:
level:
com.ruoyi: debug
org.springframework: warn
# 用户配置
user:
password:
# 密码最大错误次数
maxRetryCount: 5
# 密码锁定时间默认10分钟
lockTime: 10
# Spring配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://rm-t4ng7k83rzt5281yido.mysql.singapore.rds.aliyuncs.com:3306/musicpro?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: music
password: Q1w2e3r4
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置连接超时时间
connectTimeout: 30000
# 配置网络超时时间
socketTimeout: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# 资源信息
messages:
# 国际化资源文件路径
basename: i18n/messages
# 文件上传
servlet:
multipart:
# 单个文件大小
max-file-size: 500MB
# 设置总上传的文件大小
max-request-size: 1000MB
# 服务模块
devtools:
restart:
# 热部署开关
enabled: true
# redis 配置
redis:
host: 116.204.124.80
# 端口默认为6379
port: 16379
# 数据库索引
database: 0
# 密码
password: Lwz19520416443@
# 地址
# host: 127.0.0.1
# # 端口默认为6379
# port: 6379
# # 数据库索引
# database: 0
# # 密码
# password:
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
thymeleaf:
cache: false
prefix: classpath:/templates/
suffix: .html
encoding: UTF-8
# token配置
token:
# 令牌自定义标识
header: Authorization
# 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期默认30分钟
expireTime: 1440
# MyBatis配置
mybatis:
# 搜索指定包别名
typeAliasesPackage: com.ruoyi.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
configuration:
auto-mapping-behavior: partial
map-underscore-to-camel-case: true
# PageHelper分页插件
pagehelper:
helperDialect: mysql
supportMethodsArguments: true
params: count=countSql
# Swagger配置
swagger:
# 是否开启swagger
enabled: true
# 请求前缀
pathMapping: /dev-api
# 防止XSS攻击
xss:
# 过滤开关
enabled: true
# 排除链接(多个用逗号分隔)
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
ali:
accessKeyId: LTAI5tAZPz1BecFgfPwFSnps
accessKeySecret: 9Qp2TeLMgjvhCwyjQuxSSIYaffzBpL
appId:
merchantPrivateKey:
merchantCertPath:
alipayCertPath:
alipayRootCertPath:
encryptKey:
notifyUrl:
umApp:
appAliKey: 204941627
appAliSecret: snxhb85RWiLAegYc20hEwTsOEIkZfIaS
androidSecret: nmabfppid2dfgqsxg4yecmppslpcrjeb
androidKey: 68cbcf86c261f2773322b918
# IOSKey: 68a99a66ec2b5b6f8825b8b1
IOSSecret: 48n5d5m8l6svar6srxag6uxovqpaifgp
# androidKey: 687b2df479267e0210b79b6f
IOSKey: 68ef6aa88560e34872ca7b41
#Q1w2e3r4
wechat:
appId: wx87084c0b6aa7aed6
merchantId: 1732990772
privateKeyPath: D:\musicpro\apiclient_key.pem
merchantCertPath: D:\musicpro\apiclient_cert.pem
wechatPayCertPath: D:\musicpro\pub_key.pem
publicKeyId: PUB_KEY_ID_0117329907722025112100111619002400
apiV3Key: ASSSUNTvttuiwqazuu12tnftANtfb004

View File

@@ -1,61 +1,3 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://rm-t4ng7k83rzt5281yido.mysql.singapore.rds.aliyuncs.com:3306/musicpro?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: music
password: Q1w2e3r4
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置连接超时时间
connectTimeout: 30000
# 配置网络超时时间
socketTimeout: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true

View File

@@ -0,0 +1,223 @@
# 项目相关配置
ruoyi:
# 名称
name: RuoYi
# 版本
version: 3.9.0
# 版权年份
copyrightYear: 2025
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: D:/ruoyi/uploadPath
# 获取ip地址开关
addressEnabled: false
# 验证码类型 math 数字计算 char 字符验证
captchaType: math
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
port: 8080
servlet:
# 应用的访问路径
context-path: /
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# 连接数满后的排队数默认为100
accept-count: 1000
threads:
# tomcat最大线程数默认为200
max: 800
# Tomcat启动初始化的线程数默认值10
min-spare: 100
# 日志配置
logging:
level:
com.ruoyi: debug
org.springframework: warn
# 用户配置
user:
password:
# 密码最大错误次数
maxRetryCount: 5
# 密码锁定时间默认10分钟
lockTime: 10
# Spring配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://rm-t4ng7k83rzt5281yido.mysql.singapore.rds.aliyuncs.com:3306/musicpro?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: music
password: Q1w2e3r4
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置连接超时时间
connectTimeout: 30000
# 配置网络超时时间
socketTimeout: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# 资源信息
messages:
# 国际化资源文件路径
basename: i18n/messages
# 文件上传
servlet:
multipart:
# 单个文件大小
max-file-size: 500MB
# 设置总上传的文件大小
max-request-size: 1000MB
# 服务模块
devtools:
restart:
# 热部署开关
enabled: true
# redis 配置
redis:
# 地址
host: 127.0.0.1
# 端口默认为6379
port: 6379
# 数据库索引
database: 0
# # 密码
# password:
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
thymeleaf:
cache: false
prefix: classpath:/templates/
suffix: .html
encoding: UTF-8
# token配置
token:
# 令牌自定义标识
header: Authorization
# 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期默认30分钟
expireTime: 1440
# MyBatis配置
mybatis:
# 搜索指定包别名
typeAliasesPackage: com.ruoyi.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
configuration:
auto-mapping-behavior: partial
map-underscore-to-camel-case: true
# PageHelper分页插件
pagehelper:
helperDialect: mysql
supportMethodsArguments: true
params: count=countSql
# Swagger配置
swagger:
# 是否开启swagger
enabled: true
# 请求前缀
pathMapping: /dev-api
# 防止XSS攻击
xss:
# 过滤开关
enabled: true
# 排除链接(多个用逗号分隔)
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
ali:
accessKeyId: LTAI5tAZPz1BecFgfPwFSnps
accessKeySecret: 9Qp2TeLMgjvhCwyjQuxSSIYaffzBpL
appId:
merchantPrivateKey:
merchantCertPath:
alipayCertPath:
alipayRootCertPath:
encryptKey:
notifyUrl:
umApp:
appAliKey: 204941627
appAliSecret: snxhb85RWiLAegYc20hEwTsOEIkZfIaS
androidSecret: nmabfppid2dfgqsxg4yecmppslpcrjeb
androidKey: 68cbcf86c261f2773322b918
# IOSKey: 68a99a66ec2b5b6f8825b8b1
IOSSecret: 48n5d5m8l6svar6srxag6uxovqpaifgp
# androidKey: 687b2df479267e0210b79b6f
IOSKey: 68ef6aa88560e34872ca7b41
#Q1w2e3r4
wechat:
appId: wx87084c0b6aa7aed6
merchantId: 1732990772
privateKeyPath: /home/cert/apiclient_key.pem
merchantCertPath: /home/cert/apiclient_cert.pem
wechatPayCertPath: /home/cert/pub_key.pem
publicKeyId: PUB_KEY_ID_0117329907722025112100111619002400
apiV3Key: ASSSUNTvttuiwqazuu12tnftANtfb004

View File

@@ -1,166 +1,4 @@
# 项目相关配置
ruoyi:
# 名称
name: RuoYi
# 版本
version: 3.9.0
# 版权年份
copyrightYear: 2025
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: D:/ruoyi/uploadPath
# 获取ip地址开关
addressEnabled: false
# 验证码类型 math 数字计算 char 字符验证
captchaType: math
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
port: 8080
servlet:
# 应用的访问路径
context-path: /
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# 连接数满后的排队数默认为100
accept-count: 1000
threads:
# tomcat最大线程数默认为200
max: 800
# Tomcat启动初始化的线程数默认值10
min-spare: 100
# 日志配置
logging:
level:
com.ruoyi: debug
org.springframework: warn
# 用户配置
user:
password:
# 密码最大错误次数
maxRetryCount: 5
# 密码锁定时间默认10分钟
lockTime: 10
# Spring配置
spring:
# 资源信息
messages:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: druid
# 文件上传
servlet:
multipart:
# 单个文件大小
max-file-size: 500MB
# 设置总上传的文件大小
max-request-size: 1000MB
# 服务模块
devtools:
restart:
# 热部署开关
enabled: true
# redis 配置
redis:
# host: 116.204.124.80
# # 端口默认为6379
# port: 16379
# # 数据库索引
# database: 0
# # 密码
# password: Lwz19520416443@
# 地址
host: 127.0.0.1
# 端口默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
password:
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
thymeleaf:
cache: false
prefix: classpath:/templates/
suffix: .html
encoding: UTF-8
active: pro
# token配置
token:
# 令牌自定义标识
header: Authorization
# 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期默认30分钟
expireTime: 1440
# MyBatis配置
mybatis:
# 搜索指定包别名
typeAliasesPackage: com.ruoyi.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
configuration:
auto-mapping-behavior: partial
map-underscore-to-camel-case: true
# PageHelper分页插件
pagehelper:
helperDialect: mysql
supportMethodsArguments: true
params: count=countSql
# Swagger配置
swagger:
# 是否开启swagger
enabled: true
# 请求前缀
pathMapping: /dev-api
# 防止XSS攻击
xss:
# 过滤开关
enabled: true
# 排除链接(多个用逗号分隔)
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
ali:
accessKeyId: LTAI5tAZPz1BecFgfPwFSnps
accessKeySecret: 9Qp2TeLMgjvhCwyjQuxSSIYaffzBpL
umApp:
appAliKey: 204941627
appAliSecret: snxhb85RWiLAegYc20hEwTsOEIkZfIaS
androidSecret: nmabfppid2dfgqsxg4yecmppslpcrjeb
androidKey: 68cbcf86c261f2773322b918
# IOSKey: 68a99a66ec2b5b6f8825b8b1
IOSSecret: 48n5d5m8l6svar6srxag6uxovqpaifgp
# androidKey: 687b2df479267e0210b79b6f
IOSKey: 68ef6aa88560e34872ca7b41
#Q1w2e3r4
wechat:
appId: wx87084c0b6aa7aed6
merchantId: 1732990772
privateKeyPath: D:\musicpro\apiclient_key.pem
merchantCertPath: D:\musicpro\apiclient_cert.pem
wechatPayCertPath: D:\musicpro\pub_key.pem
publicKeyId: PUB_KEY_ID_0117329907722025112100111619002400
apiV3Key: ASSSUNTvttuiwqazuu12tnftANtfb004

View File

@@ -0,0 +1,27 @@
package com.ruoyi.common.core.domain.entity;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 【请填写功能名称】对象 pla_status
*
* @author ruoyi
* @date 2025-11-30
*/
@Data
public class PlaStatus extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Boolean shareStatus;
}

View File

@@ -1,6 +1,7 @@
package com.ruoyi.common.core.domain.entity;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import lombok.Getter;
@@ -14,7 +15,7 @@ public class ShopUserResq {
private String username;
private String password;
private String phone;
private Long userId;
@@ -28,4 +29,6 @@ public class ShopUserResq {
private String deviceId;
private String token;
@Excel(name = "1 vip 2 非vip")
private Long vip;
}

View File

@@ -50,7 +50,7 @@ public class MusicUtil {
}
// 处理跨越日期的情况(结束时间早于开始时间)
if (startDate != null && endDate.before(startDate)) {
if (endDate.before(startDate)) {
// 当前时间 >= 开始时间 或 当前时间 <= 结束时间
return now.after(startDate) || now.before(endDate) || now.equals(startDate) || now.equals(endDate);
} else {

View File

@@ -135,9 +135,19 @@ public class SecurityConfig
// /client/index/getCategory
// /client/index/re/bind/music
// /client/index/re/music
// /client/index/getCategory
// /client/index/cate/music
// /client/consult/list
// /client/index/re/music
// /client/share/list
requests.antMatchers("/login", "/register","/client/shopLogin","/file/download/**", "/captchaImage",
"/client/getCode","/client/file/**","/call/back/**","/client/index/getBanner",
"/client/index/getCategory","/client/index/re/bind/music","/client/index/re/music","/client/version/getLastVersion").permitAll()
"/client/index/getCategory","/client/index/re/bind/music","/client/index/re/music",
"/client/version/getLastVersion","/client/search/list","/client/music/find","/client" +
"/index/getCategory","/client/index/cate/music/**","/client/consult/list",
"/client/index/re/music/**","/client/share/list","/file/download/**",
"/client/music/getMusicInfo/**","/client/music/getPrevMusicId","/client/music" +
"/getNextMusicId","/client/index/palStatus").permitAll()
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

View File

@@ -36,6 +36,19 @@
<version>0.2.17</version>
</dependency>
<!-- 微信支付V3 目前新版本-->
<dependency>
<groupId>com.github.wechatpay-apiv3</groupId>
<artifactId>wechatpay-apache-httpclient</artifactId>
<version>0.4.9</version>
</dependency>
<dependency>
<groupId>com.alipay.sdk</groupId>
<artifactId>alipay-easysdk</artifactId>
<version>2.2.3</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,62 @@
package com.ruoyi.system.mapper;
import com.ruoyi.common.core.domain.entity.PlaStatus;
import java.util.List;
/**
* 【请填写功能名称】Mapper接口
*
* @author ruoyi
* @date 2025-11-30
*/
public interface PlaStatusMapper
{
/**
* 查询【请填写功能名称】
*
* @param id 【请填写功能名称】主键
* @return 【请填写功能名称】
*/
public PlaStatus selectPlaStatusById(Long id);
/**
* 查询【请填写功能名称】列表
*
* @param plaStatus 【请填写功能名称】
* @return 【请填写功能名称】集合
*/
public List<PlaStatus> selectPlaStatusList(PlaStatus plaStatus);
/**
* 新增【请填写功能名称】
*
* @param plaStatus 【请填写功能名称】
* @return 结果
*/
public int insertPlaStatus(PlaStatus plaStatus);
/**
* 修改【请填写功能名称】
*
* @param plaStatus 【请填写功能名称】
* @return 结果
*/
public int updatePlaStatus(PlaStatus plaStatus);
/**
* 删除【请填写功能名称】
*
* @param id 【请填写功能名称】主键
* @return 结果
*/
public int deletePlaStatusById(Long id);
/**
* 批量删除【请填写功能名称】
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deletePlaStatusByIds(Long[] ids);
}

View File

@@ -59,4 +59,6 @@ public interface ProductMapper
* @return 结果
*/
public int deleteProductByIds(String[] ids);
Product selectProductByPageType(String packageType);
}

View File

@@ -138,4 +138,8 @@ public interface IOrderInfoService
AjaxResult wechatPay(String orderId);
AjaxResult processPaymentResult(Transaction transaction);
AjaxResult findTransactions(String transactionId);
AjaxResult processPaymentAliResult(String outTradeNo, String tradeNo);
}

View File

@@ -335,6 +335,10 @@ public class CShopUserServiceImpl implements ShopUserService {
return null;
}
}
if (!MusicUtil.getShopIsVip(member)){
shopUser.setVip(2L);
member.setVip(2L);
};
// 修改外设id
shopUserMapper.updateDeviceIdByPhone(shopUser);
return member;

View File

@@ -23,8 +23,7 @@ import java.util.stream.Collectors;
* @date 2025-07-15
*/
@Service
public class MusicInfoServiceImpl implements IMusicInfoService
{
public class MusicInfoServiceImpl implements IMusicInfoService {
@Autowired
private MusicInfoMapper musicInfoMapper;
@Autowired
@@ -38,8 +37,6 @@ public class MusicInfoServiceImpl implements IMusicInfoService
@Autowired
private ShopUserMapper shopUserMapper;
/**
* 查询音乐信息
*
@@ -47,8 +44,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
* @return 音乐信息
*/
@Override
public MusicInfo selectMusicInfoById(String id)
{
public MusicInfo selectMusicInfoById(String id) {
return musicInfoMapper.selectMusicInfoById(id);
}
@@ -59,8 +55,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
* @return 音乐信息
*/
@Override
public List<MusicInfo> selectMusicInfoList(MusicInfo musicInfo)
{
public List<MusicInfo> selectMusicInfoList(MusicInfo musicInfo) {
return musicInfoMapper.selectMusicInfoList(musicInfo);
}
@@ -71,8 +66,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
* @return 结果
*/
@Override
public int insertMusicInfo(MusicInfo musicInfo)
{
public int insertMusicInfo(MusicInfo musicInfo) {
musicInfo.setCreateTime(DateUtils.getNowDate());
musicInfo.setMusicId(IdUtil.getSnowflakeNextId());
@@ -89,8 +83,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
* @return 结果
*/
@Override
public int updateMusicInfo(MusicInfo musicInfo)
{
public int updateMusicInfo(MusicInfo musicInfo) {
musicInfo.setUpdateTime(DateUtils.getNowDate());
return musicInfoMapper.updateMusicInfo(musicInfo);
}
@@ -102,8 +95,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
* @return 结果
*/
@Override
public int deleteMusicInfoByIds(String[] ids)
{
public int deleteMusicInfoByIds(String[] ids) {
return musicInfoMapper.deleteMusicInfoByIds(ids);
}
@@ -114,8 +106,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
* @return 结果
*/
@Override
public int deleteMusicInfoById(String id)
{
public int deleteMusicInfoById(String id) {
return musicInfoMapper.deleteMusicInfoById(id);
}
@@ -126,8 +117,8 @@ public class MusicInfoServiceImpl implements IMusicInfoService
}
@Override
public List<MusicInfo> selectMusicInfoByCid(String categoryId,MusicInfo musicInfo) {
return musicInfoMapper.selectMusicInfoByCid(categoryId,musicInfo);
public List<MusicInfo> selectMusicInfoByCid(String categoryId, MusicInfo musicInfo) {
return musicInfoMapper.selectMusicInfoByCid(categoryId, musicInfo);
}
@Override
@@ -139,11 +130,11 @@ public class MusicInfoServiceImpl implements IMusicInfoService
public int addLikeMusic(String musicId) {
Long userId = SecurityUtils.getUserId();
//查找是否已经存在我喜欢的音乐
UserLikeMusic userLikeMusic = musicInfoMapper.selectMusicAndUserLike(userId,musicId);
if (userLikeMusic != null){
UserLikeMusic userLikeMusic = musicInfoMapper.selectMusicAndUserLike(userId, musicId);
if (userLikeMusic != null) {
return 1;
}
return musicInfoMapper.insertLikeMusic(userId,musicId);
return musicInfoMapper.insertLikeMusic(userId, musicId);
}
@Override
@@ -154,15 +145,15 @@ public class MusicInfoServiceImpl implements IMusicInfoService
@Override
public int cancelLikeMusic(String[] musicId) {
Long userId = SecurityUtils.getUserId();
return musicInfoMapper.delLikeMusic(userId,musicId);
return musicInfoMapper.delLikeMusic(userId, musicId);
}
@Override
public int addHistoryMusic(String musicId) {
Long userId = SecurityUtils.getUserId();
// 先删除在田间
musicInfoMapper.delHistoryUAndM(userId,musicId);
return musicInfoMapper.insertHistory(userId,musicId);
musicInfoMapper.delHistoryUAndM(userId, musicId);
return musicInfoMapper.insertHistory(userId, musicId);
}
@Override
@@ -180,20 +171,21 @@ public class MusicInfoServiceImpl implements IMusicInfoService
// return null;
// }
// }
// 查询是否是用户喜欢
UserLikeMusic userLikeMusic = userLikeMusicMapper.selectUserLikeMusicAndUserId(userId, musicId);
if (userLikeMusic != null){
musicInfo.setLike(true);
}
// 查询是否是用户分类
UserCollect userCollect = userCollectMapper.selectUserCollectAndUserId(userId, musicId);
if (userCollect != null){
musicInfo.setCollect(true);
musicInfo.setUserCollect(userCollect);
if (userId != null) {
// 查询是否是用户喜欢
UserLikeMusic userLikeMusic = userLikeMusicMapper.selectUserLikeMusicAndUserId(userId, musicId);
if (userLikeMusic != null) {
musicInfo.setLike(true);
}
// 查询是否是用户分类
UserCollect userCollect = userCollectMapper.selectUserCollectAndUserId(userId, musicId);
if (userCollect != null) {
musicInfo.setCollect(true);
musicInfo.setUserCollect(userCollect);
}
}
// 判断是否是是混音
if (musicInfo.getMusicType().equals(MusicType.MIXING.getMusicType())){
if (musicInfo.getMusicType().equals(MusicType.MIXING.getMusicType())) {
// 查询混音相关信息
MusicSceneRelate relateInfo = relateMapper.selectByMusicId(musicId);
String sceneIds = relateInfo.getSceneIds();
@@ -208,7 +200,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
@Override
public MusicInfo addMixMusicInfo(MusicMaxReq param) {
//TODO:
// Long userId = SecurityUtils.getUserId();
// Long userId = SecurityUtils.getUserId();
Long userId = 10000L;
//String musicId = String.valueOf(param.getMusicId());
String sceneIds = param.getSceneIds();
@@ -217,22 +209,22 @@ public class MusicInfoServiceImpl implements IMusicInfoService
// 新增混音音乐标签
//MusicInfo musicInfo = musicInfoMapper.selectByMusicId(musicId);
//if (musicInfo != null){
long newMusicId = IdUtil.getSnowflakeNextId();
param.setMusicId(newMusicId);
if (param.getName() == null || (param.getName()).isEmpty()){
param.setName(userName + DateUtil.current());
}
param.setMusicType(MusicType.MIXING.getMusicType());
//param.setMusicAddr(musicInfo.getMusicAddr());
musicInfoMapper.insertMusicInfo(param);
MusicSceneRelate musicSceneRelate = new MusicSceneRelate();
musicSceneRelate.setMusicId(String.valueOf(newMusicId));
musicSceneRelate.setSceneIds(sceneIds);
musicSceneRelate.setUserId(userId);
musicSceneRelate.setSceneInfo(sceneJson);
//musicSceneRelate.setSourceMusicId(musicId);
relateMapper.insertMusicSceneRelate(musicSceneRelate);
return param;
long newMusicId = IdUtil.getSnowflakeNextId();
param.setMusicId(newMusicId);
if (param.getName() == null || (param.getName()).isEmpty()) {
param.setName(userName + DateUtil.current());
}
param.setMusicType(MusicType.MIXING.getMusicType());
//param.setMusicAddr(musicInfo.getMusicAddr());
musicInfoMapper.insertMusicInfo(param);
MusicSceneRelate musicSceneRelate = new MusicSceneRelate();
musicSceneRelate.setMusicId(String.valueOf(newMusicId));
musicSceneRelate.setSceneIds(sceneIds);
musicSceneRelate.setUserId(userId);
musicSceneRelate.setSceneInfo(sceneJson);
//musicSceneRelate.setSourceMusicId(musicId);
relateMapper.insertMusicSceneRelate(musicSceneRelate);
return param;
//}
//return null;
}
@@ -246,7 +238,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
String sourceMusicId = param.getSourceMusicId();
// 查询混音音乐
MusicInfo musicInfo = musicInfoMapper.selectByMusicId(String.valueOf(musicId));
if (musicInfo != null){
if (musicInfo != null) {
// 先删除在新增
relateMapper.deleteByMusicId(musicId);
//musicSceneMapper.selectMusicSceneById()
@@ -265,18 +257,18 @@ public class MusicInfoServiceImpl implements IMusicInfoService
@Override
public List<MusicInfo> selectMusicInfoByReId(String reId) {
return musicInfoMapper.selectMusicInfoByReId(reId);
return musicInfoMapper.selectMusicInfoByReId(reId);
}
/**
* 获取上一首播放的音乐ID
*
* @param userId 用户ID
* @param playMode 播放模式1-顺序播放2-随机播放
* @param playlistType 播放列表类型1-历史播放2-分类播放3-推荐播放4-收藏播放5-喜欢播放
* @param categoryId 分类ID当playlistType=2时必填
* @param collectId 收藏ID当playlistType=4时必填
* @param reId 推荐ID当playlistType=3时必填
* @param userId 用户ID
* @param playMode 播放模式1-顺序播放2-随机播放
* @param playlistType 播放列表类型1-历史播放2-分类播放3-推荐播放4-收藏播放5-喜欢播放
* @param categoryId 分类ID当playlistType=2时必填
* @param collectId 收藏ID当playlistType=4时必填
* @param reId 推荐ID当playlistType=3时必填
* @param currentMusicId 当前播放的音乐ID用于顺序播放时获取上一首
* @return 上一首音乐ID
*/
@@ -284,44 +276,47 @@ public class MusicInfoServiceImpl implements IMusicInfoService
public String getPrevMusicId(Long userId, Integer playMode, Integer playlistType, String categoryId, String collectId, String reId, String currentMusicId) {
List<MusicInfo> musicList = null;
// 根据播放列表类型获取对应的音乐列表
switch (playlistType) {
case 1: // 历史播放
musicList = musicInfoMapper.selectHistoryMusicByUser(userId);
break;
case 2: // 分类播放
if (categoryId == null || categoryId.isEmpty()) {
return null; // 分类播放必须提供分类ID
}
musicList = musicInfoMapper.selectMusicInfoByCid(categoryId,new MusicInfo());
break;
case 3: // 推荐播放
if (reId == null || reId.isEmpty()) {
return null; // 推荐播放必须提供推荐ID
}
musicList = musicInfoMapper.selectRecommendMusicByReId(reId);
break;
case 4: // 收藏播放
if (collectId == null || collectId.isEmpty()) {
return null; // 收藏播放必须提供收藏ID
}
musicList = musicInfoMapper.selectMusicByCollectId(collectId);
break;
case 5: // 喜欢播放
musicList = musicInfoMapper.selectLikeMusicByUser(userId);
break;
case 6: // 喜欢播放
return musicInfoMapper.selectListRandomMusic(currentMusicId);
default:
return null;
if (userId != null) {
switch (playlistType) {
case 1: // 历史播放
musicList = musicInfoMapper.selectHistoryMusicByUser(userId);
break;
case 2: // 分类播放
if (categoryId == null || categoryId.isEmpty()) {
return null; // 分类播放必须提供分类ID
}
musicList = musicInfoMapper.selectMusicInfoByCid(categoryId, new MusicInfo());
break;
case 3: // 推荐播放
if (reId == null || reId.isEmpty()) {
return null; // 推荐播放必须提供推荐ID
}
musicList = musicInfoMapper.selectRecommendMusicByReId(reId);
break;
case 4: // 收藏播放
if (collectId == null || collectId.isEmpty()) {
return null; // 收藏播放必须提供收藏ID
}
musicList = musicInfoMapper.selectMusicByCollectId(collectId);
break;
case 5: // 喜欢播放
musicList = musicInfoMapper.selectLikeMusicByUser(userId);
break;
case 6: // 喜欢播放
return musicInfoMapper.selectListRandomMusic(currentMusicId);
default:
return null;
}
} else {
return musicInfoMapper.selectListRandomMusic(currentMusicId);
}
// 根据播放列表类型获取对应的音乐列表
// 如果列表为空返回null
if (musicList == null || musicList.isEmpty()) {
return null;
}
// 根据播放模式获取上一首音乐ID
if (playMode == 1) { // 顺序播放
// 按照ID排序列表
@@ -331,8 +326,6 @@ public class MusicInfoServiceImpl implements IMusicInfoService
return idA.compareTo(idB);
});
// 如果没有当前音乐ID返回列表中的最后一首
if (currentMusicId == null || currentMusicId.isEmpty()) {
return musicList.get(musicList.size() - 1).getMusicId().toString();
@@ -369,11 +362,11 @@ public class MusicInfoServiceImpl implements IMusicInfoService
/**
* 获取下一首播放的音乐ID
*
* @param userId 用户ID
* @param playMode 播放模式1-顺序播放2-随机播放
* @param playlistType 播放列表类型1-历史播放2-分类播放3-推荐播放4-收藏播放5-喜欢播放 6-列表随机
* @param categoryId 分类ID当playlistType=2时必填
* @param collectId 收藏ID当playlistType=4时必填
* @param userId 用户ID
* @param playMode 播放模式1-顺序播放2-随机播放
* @param playlistType 播放列表类型1-历史播放2-分类播放3-推荐播放4-收藏播放5-喜欢播放 6-列表随机
* @param categoryId 分类ID当playlistType=2时必填
* @param collectId 收藏ID当playlistType=4时必填
* @param currentMusicId 当前播放的音乐ID用于顺序播放时获取下一首
* @return 下一首音乐ID
*/
@@ -381,36 +374,40 @@ public class MusicInfoServiceImpl implements IMusicInfoService
public String getNextMusicId(Long userId, Integer playMode, Integer playlistType, String categoryId, String collectId, String reId, String currentMusicId) {
List<MusicInfo> musicList = null;
// 根据播放列表类型获取对应的音乐列表
switch (playlistType) {
case 1: // 历史播放
musicList = musicInfoMapper.selectHistoryMusicByUser(userId);
break;
case 2: // 分类播放
if (categoryId == null || categoryId.isEmpty()) {
return null; // 分类播放必须提供分类ID
}
musicList = musicInfoMapper.selectMusicInfoByCid(categoryId,new MusicInfo());
break;
case 3: // 推荐播放
if (reId == null || reId.isEmpty()) {
return null; // 推荐播放必须提供推荐ID
}
musicList = musicInfoMapper.selectRecommendMusicByReId(reId);
break;
case 4: // 收藏播放
if (collectId == null || collectId.isEmpty()) {
return null; // 收藏播放必须提供收藏ID
}
musicList = musicInfoMapper.selectMusicByCollectId(collectId);
break;
case 5: // 喜欢播放
musicList = musicInfoMapper.selectLikeMusicByUser(userId);
break;
case 6: // 喜欢播放
return musicInfoMapper.selectListRandomMusic(currentMusicId);
default:
return null;
if (userId != null) {
// 根据播放列表类型获取对应的音乐列表
switch (playlistType) {
case 1: // 历史播放
musicList = musicInfoMapper.selectHistoryMusicByUser(userId);
break;
case 2: // 分类播放
if (categoryId == null || categoryId.isEmpty()) {
return null; // 分类播放必须提供分类ID
}
musicList = musicInfoMapper.selectMusicInfoByCid(categoryId, new MusicInfo());
break;
case 3: // 推荐播放
if (reId == null || reId.isEmpty()) {
return null; // 推荐播放必须提供推荐ID
}
musicList = musicInfoMapper.selectRecommendMusicByReId(reId);
break;
case 4: // 收藏播放
if (collectId == null || collectId.isEmpty()) {
return null; // 收藏播放必须提供收藏ID
}
musicList = musicInfoMapper.selectMusicByCollectId(collectId);
break;
case 5: // 喜欢播放
musicList = musicInfoMapper.selectLikeMusicByUser(userId);
break;
case 6: // 喜欢播放
return musicInfoMapper.selectListRandomMusic(currentMusicId);
default:
return null;
}
} else {
return musicInfoMapper.selectListRandomMusic(currentMusicId);
}
// 如果列表为空返回null
@@ -468,7 +465,6 @@ public class MusicInfoServiceImpl implements IMusicInfoService
}
}
/**
* 根据用户ID查询喜欢的音乐数量
*
@@ -500,7 +496,6 @@ public class MusicInfoServiceImpl implements IMusicInfoService
@Override
public List<MusicInfo> findLikeSearch(String search) {
// 根据作者名称或音乐名称模糊搜索音乐
List<MusicInfo> musicList = musicInfoMapper.selectMusicInfoBySearch(search);
@@ -524,9 +519,9 @@ public class MusicInfoServiceImpl implements IMusicInfoService
}
//TODO: 待完善
public Map<String, String> getMixMusicInfo(String musicId){
public Map<String, String> getMixMusicInfo(String musicId) {
MusicInfo musicInfo = musicInfoMapper.selectByMusicId(musicId);
if (musicInfo.getMusicType().equals(MusicType.MIXING.getMusicType())){
if (musicInfo.getMusicType().equals(MusicType.MIXING.getMusicType())) {
// 获取混音信息
relateMapper.selectByMusicId(musicId);
@@ -537,7 +532,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
@Override
public MusicInfo selectUserLikeMusic(String musicId, Long userId) {
MusicInfo musicInfo = musicInfoMapper.selectUserLikeMusic(musicId, userId);
if (musicInfo != null){
if (musicInfo != null) {
musicInfo.setLike(true);
return musicInfo;
}

View File

@@ -6,21 +6,23 @@ import com.ruoyi.common.core.domain.dto.PaymentRequest;
import com.ruoyi.common.core.domain.dto.RefundRequest;
import com.ruoyi.common.core.domain.entity.OrderInfo;
import com.ruoyi.common.core.domain.entity.PayStatusEnum;
import com.ruoyi.common.core.domain.entity.Product;
import com.ruoyi.common.core.domain.entity.ShopUser;
import com.ruoyi.common.core.domain.vo.OrderInfoVO;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.domain.vo.OrderInfoVO;
import com.ruoyi.common.enums.OrderStatus;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.mapper.OrderInfoMapper;
import com.ruoyi.system.mapper.ProductMapper;
import com.ruoyi.system.service.IOrderInfoService;
import com.ruoyi.system.service.ShopUserService;
import com.ruoyi.system.util.AppleyPay;
import com.ruoyi.system.util.PaymentUtil;
import com.ruoyi.system.util.WeChatPayUtil;
import com.wechat.pay.java.service.payments.app.model.PrepayWithRequestPaymentResponse;
import com.wechat.pay.java.service.payments.model.Transaction;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -51,6 +53,12 @@ public class OrderInfoServiceImpl implements IOrderInfoService
@Autowired
private WeChatPayUtil weChatPayUtil;
@Autowired
private ShopUserService shopUserService;
@Autowired
private ProductMapper productMapper;
/**
* 查询【请填写功能名称】
@@ -147,7 +155,8 @@ public class OrderInfoServiceImpl implements IOrderInfoService
orderInfo.setOrderId(System.currentTimeMillis()); // 使用时间戳作为订单号
orderInfo.setOrderName(request.getOrderName());
orderInfo.setUserId(loginUser.getUserId());
orderInfo.setAmount(new BigDecimal(request.getAmount()));
Product product = productMapper.selectProductByPageType(request.getPackageType());
orderInfo.setAmount(product.getCurrentPrice());
orderInfo.setPayType(request.getPayType());
orderInfo.setPackageType(request.getPackageType());
orderInfo.setDeviceType(request.getDeviceType());
@@ -391,6 +400,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService
return AjaxResult.success("获取微信支付参数成功",result);
}
@Override
public AjaxResult processPaymentResult(Transaction transaction) {
try {
@@ -413,43 +423,46 @@ public class OrderInfoServiceImpl implements IOrderInfoService
return AjaxResult.success("订单已支付,跳过处理");
}
if ((OrderStatus.CREATED.getCode()).equals(order.getPayStatus())) {
//order.getAmount() 元转分
int amount = order.getAmount().multiply(new BigDecimal(100)).intValue();
//order.getAmount() 元转分
int amount = order.getAmount().multiply(new BigDecimal(100)).intValue();
// 3. 验证金额是否一致
if (amount != totalAmount) {
return AjaxResult.error("金额不一致");
}
// 3. 验证金额是否一致
if (amount != totalAmount) {
return AjaxResult.error("金额不一致");
// 4. 根据交易状态处理业务
if ("SUCCESS".equals(tradeState)) {
// 计算服务开始和结束时间
Date startTime = new Date();
// 支付成功
// 设置订单信息
order.setPayStatus(2L); // 2-已完成
order.setPayTime(DateUtils.getNowDate());
order.setStartTime(startTime);
order.setTradeNo(transactionId);
order.setCallbackContent(outTradeNo); // 保存交易ID
order.setCallTime(DateUtils.getNowDate());
order.setUpdateTime(DateUtils.getNowDate());
Date endTime = AppleyPay.calculateEndTime(startTime, order.getPackageType());
order.setEndTime(endTime);
// 更新用户VIP时间
shopUserService.updateShopUserVipTime(order.getUserId(), order.getPackageType());
orderInfoMapper.updateOrderInfo(order);
return AjaxResult.success();
} else if ("REFUND".equals(tradeState)) {
// 转入退款
//return handleRefund(order, transaction);
} else if ("CLOSED".equals(tradeState)) {
// 已关闭
//return handleClosedPayment(order, transaction);
} else {
// 其他状态
log.info("未知状态: " + tradeState);
// 仍然返回成功,避免微信重复通知
}
}
// 4. 根据交易状态处理业务
if ("SUCCESS".equals(tradeState)) {
// 计算服务开始和结束时间
Date startTime = new Date();
// 支付成功
// 设置订单信息
order.setPayStatus(2L); // 2-已完成
order.setPayTime(DateUtils.getNowDate());
order.setStartTime(startTime);
order.setTradeNo(transactionId);
order.setCallbackContent(outTradeNo); // 保存交易ID
order.setCallTime(DateUtils.getNowDate());
order.setUpdateTime(DateUtils.getNowDate());
Date endTime = AppleyPay.calculateEndTime(startTime, order.getPackageType());
order.setEndTime(endTime);
return AjaxResult.success();
} else if ("REFUND".equals(tradeState)) {
// 转入退款
//return handleRefund(order, transaction);
} else if ("CLOSED".equals(tradeState)) {
// 已关闭
//return handleClosedPayment(order, transaction);
} else {
// 其他状态
log.info("未知状态: " + tradeState);
// 仍然返回成功,避免微信重复通知
}
} catch (Exception e) {
log.error("处理订单异常: {}", e.getMessage());
e.printStackTrace();
@@ -459,6 +472,62 @@ public class OrderInfoServiceImpl implements IOrderInfoService
}
// 重试状态码
private static final int RETRY_CODES = 677;
@Override
public AjaxResult findTransactions(String orderId) {
OrderInfo orderInfo = orderInfoMapper.selectOrderByOrderId(orderId);
if(orderInfo == null){
return AjaxResult.error("未找到对应订单");
}
String transactionId = orderInfo.getTradeNo();
if(transactionId == null){
return new AjaxResult(RETRY_CODES,"未找到对应订单");
}
Transaction transaction = weChatPayUtil.queryOrder(transactionId);
if(transaction == null){
return new AjaxResult(RETRY_CODES,"未找到对应订单");
}
return AjaxResult.success( transaction);
}
@Override
public AjaxResult processPaymentAliResult(String outTradeNo, String tradeNo) {
// 1. 根据商户订单号查询本地订单
OrderInfo order = orderInfoMapper.selectOrderByOrderId(outTradeNo);
if (order == null) {
return AjaxResult.error("未找到对应订单");
}
// 2. 检查订单是否已经处理过(防止重复通知)
if ((OrderStatus.PAID.getCode()).equals(order.getPayStatus())) {
return AjaxResult.success("订单已支付,跳过处理");
}
if ((OrderStatus.CREATED.getCode()).equals(order.getPayStatus())) {
// 计算服务开始和结束时间
Date startTime = new Date();
// 支付成功
// 设置订单信息
order.setPayStatus(2L); // 2-已完成
order.setPayTime(DateUtils.getNowDate());
order.setStartTime(startTime);
order.setTradeNo(tradeNo);
order.setCallbackContent(outTradeNo); // 保存交易ID
order.setCallTime(DateUtils.getNowDate());
order.setUpdateTime(DateUtils.getNowDate());
Date endTime = AppleyPay.calculateEndTime(startTime, order.getPackageType());
order.setEndTime(endTime);
// 更新用户VIP时间
shopUserService.updateShopUserVipTime(order.getUserId(), order.getPackageType());
orderInfoMapper.updateOrderInfo(order);
return AjaxResult.success();
}
return AjaxResult.error("处理订单异常");
}
@Override
@Transactional
public AjaxResult confirmShipment(String orderId) {

View File

@@ -0,0 +1,60 @@
package com.ruoyi.system.util;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.kernel.Config;
import com.alipay.easysdk.kernel.util.ResponseChecker;
import com.alipay.easysdk.payment.app.models.AlipayTradeAppPayResponse;
import com.alipay.easysdk.payment.facetoface.models.AlipayTradePrecreateResponse;
import com.ruoyi.common.core.domain.entity.OrderInfo;
/**
* 描述:
*
* @author MXP by 2025/11/25
*/
public class AliPayUtil {
public static void main(String[] args) throws Exception {
// 1. 设置参数(全局只需设置一次)
}
public String prepayWithRequestPayment(OrderInfo orderInfo){
Factory.setOptions(getOptions());
try {
AlipayTradeAppPayResponse response = Factory
.Payment
.App()
.pay(orderInfo.getOrderName(),
String.valueOf(orderInfo.getOrderId()),
String.valueOf(orderInfo.getAmount()));
return response.getBody() ;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
private static Config getOptions() {
Config config = new Config();
config.protocol = "https";
config.gatewayHost = "openapi.alipay.com";
config.signType = "RSA2";
config.appId = "<-- 请填写您的AppId例如2019091767145019 -->";
// 为避免私钥随源码泄露,推荐从文件中读取私钥字符串而不是写入源码中
config.merchantPrivateKey = "<-- 请填写您的应用私钥例如MIIEvQIBADANB ... ... -->";
//注证书文件路径支持设置为文件系统中的路径或CLASS_PATH中的路径优先从文件系统中加载加载失败后会继续尝试从CLASS_PATH中加载
config.merchantCertPath = "<-- 请填写您的应用公钥证书文件路径,例如:/foo/appCertPublicKey_2019051064521003.crt -->";
config.alipayCertPath = "<-- 请填写您的支付宝公钥证书文件路径,例如:/foo/alipayCertPublicKey_RSA2.crt -->";
config.alipayRootCertPath = "<-- 请填写您的支付宝根证书文件路径,例如:/foo/alipayRootCert.crt -->";
//注:如果采用非证书模式,则无需赋值上面的三个证书路径,改为赋值如下的支付宝公钥字符串即可
// config.alipayPublicKey = "<-- 请填写您的支付宝公钥例如MIIBIjANBg... -->";
//可设置异步通知接收服务地址(可选)
config.notifyUrl = "<-- 请填写您的支付类接口异步通知接收服务地址例如https://www.test.com/callback -->";
//可设置AES密钥调用AES加解密相关接口时需要可选
config.encryptKey = "<-- 请填写您的AES密钥例如aa4BtZ4tspm2wnXLb1ThQA== -->";
return config;
}
}

View File

@@ -2,6 +2,7 @@ package com.ruoyi.system.util;
import com.ruoyi.common.constant.WeChatConfig;
import com.ruoyi.common.core.domain.entity.OrderInfo;
import com.wechat.pay.contrib.apache.httpclient.auth.*;
import com.wechat.pay.java.core.Config;
import com.wechat.pay.java.core.RSAPublicKeyConfig;
import com.wechat.pay.java.core.util.PemUtil;
@@ -9,10 +10,17 @@ import com.wechat.pay.java.service.payments.app.AppServiceExtension;
import com.wechat.pay.java.service.payments.app.model.Amount;
import com.wechat.pay.java.service.payments.app.model.PrepayRequest;
import com.wechat.pay.java.service.payments.app.model.PrepayWithRequestPaymentResponse;
import com.wechat.pay.java.service.payments.app.model.QueryOrderByIdRequest;
import com.wechat.pay.java.service.payments.model.Transaction;
import org.springframework.stereotype.Component;
import java.io.ByteArrayInputStream;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
import java.util.Collections;
import java.util.List;
/**
* 描述:
@@ -22,23 +30,9 @@ import java.security.cert.X509Certificate;
@Component
public class WeChatPayUtil {
public PrepayWithRequestPaymentResponse prepayWithRequestPayment(OrderInfo orderInfo){
public PrepayWithRequestPaymentResponse prepayWithRequestPayment(OrderInfo orderInfo) {
// 2. 加载商户证书并获取序列号
X509Certificate merchantCertificate = PemUtil.loadX509FromPath(WeChatConfig.MERCHANT_CERT_PATH);
String merchantSerialNumber = merchantCertificate.getSerialNumber().toString(16).toUpperCase();
Config config =
new RSAPublicKeyConfig.Builder()
.merchantId(WeChatConfig.MERCHANT_ID)
.privateKeyFromPath(WeChatConfig.PRIVATE_KEY_PATH)
.publicKeyFromPath(WeChatConfig.WECHAT_PAY_CERT_PATH)
.publicKeyId(WeChatConfig.PUBLIC_KEY_ID)
.merchantSerialNumber(merchantSerialNumber)
.apiV3Key(WeChatConfig.API_V3_KEY)
.build();
AppServiceExtension service = new AppServiceExtension.Builder().config(config).build();
AppServiceExtension service = Options();
// 跟之前下单示例一样,填充预下单参数
PrepayRequest request = new PrepayRequest();
request.setAppid(WeChatConfig.APP_ID);
@@ -50,6 +44,7 @@ public class WeChatPayUtil {
Amount amount = new Amount();
// orderInfo.getAmount() 元转分
amount.setTotal(orderInfo.getAmount().multiply(new BigDecimal(100)).intValue());
//amount.setTotal(orderInfo.getAmount().multiply(new BigDecimal(100)).intValue());
amount.setCurrency("CNY");
request.setAmount(amount);
// response包含了调起支付所需的所有参数可直接用于前端调起支付
@@ -64,4 +59,50 @@ public class WeChatPayUtil {
}
// 查询支付结果
public Transaction queryOrder(String transactionId) {
AppServiceExtension service;
service = Options();
QueryOrderByIdRequest request = new QueryOrderByIdRequest();
request.setTransactionId(transactionId);
request.setMchid(WeChatConfig.MERCHANT_ID);
return service.queryOrderById(request);
}
public static AppServiceExtension Options() {
return new AppServiceExtension.Builder().config(getConfig()).build();
}
public static Config getConfig() {
X509Certificate merchantCertificate = PemUtil.loadX509FromPath(WeChatConfig.MERCHANT_CERT_PATH);
String merchantSerialNumber = merchantCertificate.getSerialNumber().toString(16).toUpperCase();
return new RSAPublicKeyConfig.Builder()
.merchantId(WeChatConfig.MERCHANT_ID)
.privateKeyFromPath(WeChatConfig.PRIVATE_KEY_PATH)
.publicKeyFromPath(WeChatConfig.WECHAT_PAY_CERT_PATH)
.publicKeyId(WeChatConfig.PUBLIC_KEY_ID)
.merchantSerialNumber(merchantSerialNumber)
.apiV3Key(WeChatConfig.API_V3_KEY)
.build();
}
/**
* 获取验证器(推荐方式)
*/
public static Verifier getVerifier() {
// 加载商户私钥
PrivateKey merchantPrivateKey = PemUtil.loadPrivateKeyFromPath(WeChatConfig.PRIVATE_KEY_PATH);
X509Certificate merchantCertificate = PemUtil.loadX509FromPath(WeChatConfig.MERCHANT_CERT_PATH);
String merchantSerialNumber = merchantCertificate.getSerialNumber().toString(16).toUpperCase();
// 创建自动更新平台证书的验证器
AutoUpdateCertificatesVerifier verifier = new AutoUpdateCertificatesVerifier(
new WechatPay2Credentials(WeChatConfig.MERCHANT_ID, new PrivateKeySigner(merchantSerialNumber, merchantPrivateKey)),
(WeChatConfig.API_V3_KEY).getBytes(StandardCharsets.UTF_8)
);
return verifier;
}
}

View File

@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.PlaStatusMapper">
<resultMap type="PlaStatus" id="PlaStatusResult">
<result property="id" column="id" />
<result property="shareStatus" column="share_status" />
</resultMap>
<sql id="selectPlaStatusVo">
select id, share_status from pla_status
</sql>
<select id="selectPlaStatusList" parameterType="PlaStatus" resultMap="PlaStatusResult">
<include refid="selectPlaStatusVo"/>
<where>
<if test="shareStatus != null "> and share_status = #{shareStatus}</if>
</where>
</select>
<select id="selectPlaStatusById" parameterType="Long" resultMap="PlaStatusResult">
<include refid="selectPlaStatusVo"/>
where id = #{id}
</select>
<insert id="insertPlaStatus" parameterType="PlaStatus" useGeneratedKeys="true" keyProperty="id">
insert into pla_status
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="shareStatus != null">share_status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="shareStatus != null">#{shareStatus},</if>
</trim>
</insert>
<update id="updatePlaStatus" parameterType="PlaStatus">
update pla_status
<trim prefix="SET" suffixOverrides=",">
<if test="shareStatus != null">share_status = #{shareStatus},</if>
</trim>
where id = #{id}
</update>
<delete id="deletePlaStatusById" parameterType="Long">
delete from pla_status where id = #{id}
</delete>
<delete id="deletePlaStatusByIds" parameterType="String">
delete from pla_status where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -122,4 +122,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="selectProductByPageType" resultMap="ProductResult">
select * from product where product_type = #{productType}
</select>
</mapper>

View File

@@ -260,7 +260,11 @@
</update>
<update id="updateDeviceIdByPhone">
update shop_user set device_id = #{deviceId} where shop_user.phone = #{phone}
update shop_user set device_id = #{deviceId}
<if test="vip != null">
,vip = #{vip}
</if>
where shop_user.phone = #{phone}
</update>
<select id="selectDeviceIdShopUserByUserIds" resultType="java.lang.String">