Merge remote-tracking branch 'origin/main'

This commit is contained in:
attiya 2025-05-21 14:46:37 +08:00
commit 0db6040095
6 changed files with 86 additions and 15 deletions

View File

@ -318,7 +318,7 @@ public class UserOrdersServiceImpl extends ServiceImpl<UserOrdersMapper, EbikeUs
public void refund(Long orderId) { public void refund(Long orderId) {
QueryWrapper queryWrapper = QueryWrapper.create() QueryWrapper queryWrapper = QueryWrapper.create()
.where(EBIKE_USER_ORDERS.ORDER_ID.eq(orderId)) .where(EBIKE_USER_ORDERS.ORDER_ID.eq(orderId))
.where(EBIKE_USER_ORDERS.STATUS.eq(OrderStatus.PAID)); .where(EBIKE_USER_ORDERS.STATUS.eq(OrderStatus.REFUND_APPLYING));
EbikeUserOrders userOrders = this.mapper.selectOneByQuery(queryWrapper); EbikeUserOrders userOrders = this.mapper.selectOneByQuery(queryWrapper);
userOrders.setStatus(OrderStatus.REFUNDING); userOrders.setStatus(OrderStatus.REFUNDING);
this.mapper.update(userOrders); this.mapper.update(userOrders);
@ -338,7 +338,7 @@ public class UserOrdersServiceImpl extends ServiceImpl<UserOrdersMapper, EbikeUs
public void rejectRefund(Long orderId) { public void rejectRefund(Long orderId) {
QueryWrapper queryWrapper = QueryWrapper.create() QueryWrapper queryWrapper = QueryWrapper.create()
.where(EBIKE_USER_ORDERS.ORDER_ID.eq(orderId)) .where(EBIKE_USER_ORDERS.ORDER_ID.eq(orderId))
.where(EBIKE_USER_ORDERS.STATUS.eq(OrderStatus.REFUNDING)); .where(EBIKE_USER_ORDERS.STATUS.eq(OrderStatus.REFUND_APPLYING));
EbikeUserOrders userOrders = this.mapper.selectOneByQuery(queryWrapper); EbikeUserOrders userOrders = this.mapper.selectOneByQuery(queryWrapper);
userOrders.setStatus(OrderStatus.REFUND_REJECTED); userOrders.setStatus(OrderStatus.REFUND_REJECTED);
this.mapper.update(userOrders); this.mapper.update(userOrders);

View File

@ -2,9 +2,7 @@ package com.cdzy.payment.config;
import com.wechat.pay.java.core.Config; import com.wechat.pay.java.core.Config;
import com.wechat.pay.java.core.RSAPublicKeyConfig; import com.wechat.pay.java.core.RSAPublicKeyConfig;
import com.wechat.pay.java.core.cipher.RSASigner;
import com.wechat.pay.java.core.cipher.Signer; import com.wechat.pay.java.core.cipher.Signer;
import com.wechat.pay.java.core.util.PemUtil;
import com.wechat.pay.java.service.payments.jsapi.JsapiService; import com.wechat.pay.java.service.payments.jsapi.JsapiService;
import com.wechat.pay.java.service.refund.RefundService; import com.wechat.pay.java.service.refund.RefundService;
import lombok.Data; import lombok.Data;
@ -12,8 +10,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import java.security.PrivateKey;
/** /**
* 微信支付配置参数 * 微信支付配置参数
* *
@ -67,10 +63,15 @@ public class WxPayConfig {
*/ */
private Integer expireMinute = 1440; private Integer expireMinute = 1440;
/** /**
* 定时任务执行表达式 * 支付状态检查定时任务执行表达式
* 默认每12小时执行1次 * 默认每12小时执行1次
*/ */
private String cronExpression = "0 0 0,12 * * ?"; private String paySchedule = "0 0 0/12 * * ?";
/**
* 退款状态检查定时任务执行表达式
* 默认每30分钟执行1次
*/
private String refundSchedule = "0 0/30 * * * ?";
@Bean @Bean
public Config certificateConfig() { public Config certificateConfig() {

View File

@ -15,37 +15,88 @@ import java.time.LocalDateTime;
@Data @Data
public class OrderInfo { public class OrderInfo {
/**
* 订单编号
*/
private String orderId; private String orderId;
/**
* 车辆编号
*/
private String bikeCode; private String bikeCode;
/**
* 运营区域
*/
private String operate; private String operate;
/**
* 订单来源
*/
private String orderSource; private String orderSource;
/**
* 租借方式
*/
private String rentMethod; private String rentMethod;
/**
* 骑行状态
*/
private String cyclingState; private String cyclingState;
/**
* 还车类型
*/
private String returnCarType; private String returnCarType;
/**
* 开锁时间
*/
private LocalDateTime unLockTime; private LocalDateTime unLockTime;
/**
* 锁车时间
*/
private LocalDateTime lockTime; private LocalDateTime lockTime;
/**
* 骑行时长
*/
private String cyclingDuration; private String cyclingDuration;
/**
* 轨迹里程
*/
private String trajectoryMileage; private String trajectoryMileage;
/**
* 中控里程
*/
private String ecuMileage; private String ecuMileage;
/**
* 创建时间
*/
private LocalDateTime createTime; private LocalDateTime createTime;
/**
* 结束时间
*/
private LocalDateTime endTime; private LocalDateTime endTime;
/**
* 订单备注
*/
private String orderRemark; private String orderRemark;
/**
* 起始行政区域
*/
private String startRegion; private String startRegion;
/**
* 结束行政区域
*/
private String endRegion; private String endRegion;
} }

View File

@ -74,7 +74,7 @@ public class ResProcessedRefundDto {
/** /**
* 退款方式 * 退款方式
*/ */
private LocalDateTime refundMethod; private String refundMethod;
/** /**
* 支付方式 * 支付方式
@ -109,7 +109,8 @@ public class ResProcessedRefundDto {
/** /**
* 骑行设备编号 * 骑行设备编号
*/ */
private String ebikeCode;; private String ebikeCode;
;
/** /**
* 骑行开始时间 * 骑行开始时间

View File

@ -29,7 +29,9 @@ public class ScheduledTaskManager {
@PostConstruct @PostConstruct
public void init() { public void init() {
String CRON_EXPRESSION = wxPayConfig.getCronExpression(); String CRON_EXPRESSION_PAY = wxPayConfig.getPaySchedule();
String CRON_EXPRESSION_REFUND = wxPayConfig.getRefundSchedule();
// 启动定时任务 // 启动定时任务
// 1. 每隔30秒执行1次查询创建未超过5分钟并且未支付的订单 // 1. 每隔30秒执行1次查询创建未超过5分钟并且未支付的订单
threadPoolTaskScheduler.schedule(new Runnable() { threadPoolTaskScheduler.schedule(new Runnable() {
@ -41,7 +43,7 @@ public class ScheduledTaskManager {
log.error("checkOrderStatus 执行异常", e); log.error("checkOrderStatus 执行异常", e);
} }
} }
}, new CronTrigger(CRON_EXPRESSION)); }, new CronTrigger(CRON_EXPRESSION_PAY));
//========支付系统自动关闭不主动关闭每次发起请求的时候检测是否关闭======== //========支付系统自动关闭不主动关闭每次发起请求的时候检测是否关闭========
//// 2. 每隔30秒执行1次查询创建超过5分钟并且未支付的订单 //// 2. 每隔30秒执行1次查询创建超过5分钟并且未支付的订单
@ -66,7 +68,7 @@ public class ScheduledTaskManager {
log.error("checkRefundStatus 执行异常", e); log.error("checkRefundStatus 执行异常", e);
} }
} }
}, new CronTrigger(CRON_EXPRESSION)); }, new CronTrigger(CRON_EXPRESSION_REFUND));
} }
} }

View File

@ -43,9 +43,25 @@ payment:
pay-notify_url: http://192.168.2.156:10017/wxPayment/pay-notify pay-notify_url: http://192.168.2.156:10017/wxPayment/pay-notify
refund-notify_url: http://192.168.2.156:10017/wxPayment/refund-notify refund-notify_url: http://192.168.2.156:10017/wxPayment/refund-notify
expire-minutes: 1440 expire-minutes: 1440
cron-expression: 0 0 0,12 * * ? pay-schedule: 0 0 0/12 * * ?
refund-schedule: 0 0/30 * * * ?
task-scheduler-pool: task-scheduler-pool:
poolSize: 100 poolSize: 100
threadNamePrefix: task-scheduled- threadNamePrefix: task-scheduled-
waitForTasksToCompleteOnShutdown: true waitForTasksToCompleteOnShutdown: true
awaitTerminationSeconds: 30 awaitTerminationSeconds: 30
sa-token:
# token 名称(同时也是 cookie 名称)
token-name: Authorization
# token 有效期(单位:秒) 默认30天-1 代表永久有效
timeout: 2592000
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
active-timeout: -1
# 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录)
is-concurrent: true
# 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token
is-share: true
# token 风格默认可取值uuid、simple-uuid、random-32、random-64、random-128、tik
token-style: random-32
# 是否输出操作日志
is-log: true