mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 15:21:53 +08:00
【功能优化】支付:支付应用,增加 appKey 标识,用于不同接入方的标识
This commit is contained in:
parent
6eb40aa544
commit
1dadfb8fba
12
pom.xml
12
pom.xml
@ -16,14 +16,14 @@
|
|||||||
<module>yudao-module-system</module>
|
<module>yudao-module-system</module>
|
||||||
<module>yudao-module-infra</module>
|
<module>yudao-module-infra</module>
|
||||||
<module>yudao-module-member</module>
|
<module>yudao-module-member</module>
|
||||||
<module>yudao-module-bpm</module>
|
<!-- <module>yudao-module-bpm</module>-->
|
||||||
<module>yudao-module-report</module>
|
<!-- <module>yudao-module-report</module>-->
|
||||||
<module>yudao-module-mp</module>
|
<!-- <module>yudao-module-mp</module>-->
|
||||||
<module>yudao-module-pay</module>
|
<module>yudao-module-pay</module>
|
||||||
<module>yudao-module-mall</module>
|
<module>yudao-module-mall</module>
|
||||||
<module>yudao-module-crm</module>
|
<!-- <module>yudao-module-crm</module>-->
|
||||||
<module>yudao-module-erp</module>
|
<!-- <module>yudao-module-erp</module>-->
|
||||||
<module>yudao-module-ai</module>
|
<!-- <module>yudao-module-ai</module>-->
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
|
@ -101,7 +101,7 @@ public interface TradeOrderConvert {
|
|||||||
default PayOrderCreateReqDTO convert(TradeOrderDO order, List<TradeOrderItemDO> orderItems,
|
default PayOrderCreateReqDTO convert(TradeOrderDO order, List<TradeOrderItemDO> orderItems,
|
||||||
TradeOrderProperties orderProperties) {
|
TradeOrderProperties orderProperties) {
|
||||||
PayOrderCreateReqDTO createReqDTO = new PayOrderCreateReqDTO()
|
PayOrderCreateReqDTO createReqDTO = new PayOrderCreateReqDTO()
|
||||||
.setAppKey(orderProperties.getAppKey()).setUserIp(order.getUserIp());
|
.setAppKey(orderProperties.getPayAppKey()).setUserIp(order.getUserIp());
|
||||||
// 商户相关字段
|
// 商户相关字段
|
||||||
createReqDTO.setMerchantOrderId(String.valueOf(order.getId()));
|
createReqDTO.setMerchantOrderId(String.valueOf(order.getId()));
|
||||||
String subject = orderItems.get(0).getSpuName();
|
String subject = orderItems.get(0).getSpuName();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.trade.framework.order.config;
|
package cn.iocoder.yudao.module.trade.framework.order.config;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -19,17 +20,15 @@ import java.time.Duration;
|
|||||||
@Validated
|
@Validated
|
||||||
public class TradeOrderProperties {
|
public class TradeOrderProperties {
|
||||||
|
|
||||||
/**
|
private static final String PAY_APP_KEY_DEFAULT = "mall";
|
||||||
* 默认应用标识
|
|
||||||
*/
|
|
||||||
private static final String APP_KEY_DEFAULT = "mall";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 应用标识,用于区分不同的应用程序
|
* 支付应用标识
|
||||||
* 通过注解@NotNull确保应用标识不能为空
|
*
|
||||||
|
* 在 pay 模块的 [支付管理 -> 应用信息] 里添加
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "应用标识不能为空")
|
@NotEmpty(message = "Pay 应用标识不能为空")
|
||||||
private String appKey = APP_KEY_DEFAULT;
|
private String payAppKey = PAY_APP_KEY_DEFAULT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付超时时间
|
* 支付超时时间
|
||||||
|
@ -99,7 +99,7 @@ public class TradeOrderUpdateServiceTest extends BaseDbUnitTest {
|
|||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
when(tradeOrderProperties.getAppKey()).thenReturn("demo");
|
when(tradeOrderProperties.getPayAppKey()).thenReturn("mall");
|
||||||
when(tradeOrderProperties.getPayExpireTime()).thenReturn(Duration.ofDays(1));
|
when(tradeOrderProperties.getPayExpireTime()).thenReturn(Duration.ofDays(1));
|
||||||
when(tradeNoRedisDAO.generate(anyString())).thenReturn(IdUtil.randomUUID());
|
when(tradeNoRedisDAO.generate(anyString())).thenReturn(IdUtil.randomUUID());
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,10 @@ import jakarta.validation.constraints.*;
|
|||||||
@Data
|
@Data
|
||||||
public class PayAppBaseVO {
|
public class PayAppBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "应用标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudao")
|
||||||
|
@NotEmpty(message = "应用标识不能为空")
|
||||||
|
private String appKey;
|
||||||
|
|
||||||
@Schema(description = "应用名", requiredMode = Schema.RequiredMode.REQUIRED, example = "小豆")
|
@Schema(description = "应用名", requiredMode = Schema.RequiredMode.REQUIRED, example = "小豆")
|
||||||
@NotNull(message = "应用名不能为空")
|
@NotNull(message = "应用名不能为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
|
package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import lombok.Data;
|
||||||
import lombok.*;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 支付应用信息创建 Request VO")
|
@Schema(description = "管理后台 - 支付应用信息创建 Request VO")
|
||||||
@Data
|
@Data
|
||||||
@ -9,8 +11,4 @@ import lombok.*;
|
|||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class PayAppCreateReqVO extends PayAppBaseVO {
|
public class PayAppCreateReqVO extends PayAppBaseVO {
|
||||||
|
|
||||||
@Schema(description = "应用标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudao")
|
|
||||||
@NotNull(message = "应用标识不能为空")
|
|
||||||
private String appKey;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,9 +17,6 @@ public class PayAppPageItemRespVO extends PayAppBaseVO {
|
|||||||
@Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
@Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Schema(description = "应用标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudao")
|
|
||||||
private String appKey;
|
|
||||||
|
|
||||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class PayAppPageReqVO extends PageParam {
|
|||||||
@Schema(description = "应用名", example = "小豆")
|
@Schema(description = "应用名", example = "小豆")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@Schema(description = "应用标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudao")
|
@Schema(description = "应用标识", example = "yudao")
|
||||||
private String appKey;
|
private String appKey;
|
||||||
|
|
||||||
@Schema(description = "开启状态", example = "0")
|
@Schema(description = "开启状态", example = "0")
|
||||||
|
@ -14,8 +14,4 @@ public class PayAppUpdateReqVO extends PayAppBaseVO {
|
|||||||
@NotNull(message = "应用编号不能为空")
|
@NotNull(message = "应用编号不能为空")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Schema(description = "应用标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudao")
|
|
||||||
@NotNull(message = "应用标识不能为空")
|
|
||||||
private String appKey;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@ public class PayProperties {
|
|||||||
private static final String ORDER_NO_PREFIX = "P";
|
private static final String ORDER_NO_PREFIX = "P";
|
||||||
private static final String REFUND_NO_PREFIX = "R";
|
private static final String REFUND_NO_PREFIX = "R";
|
||||||
|
|
||||||
|
private static final String WALLET_PAY_APP_KEY_DEFAULT = "wallet";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付回调地址
|
* 支付回调地址
|
||||||
*
|
*
|
||||||
@ -49,4 +51,10 @@ public class PayProperties {
|
|||||||
@NotEmpty(message = "退款订单 no 的前缀不能为空")
|
@NotEmpty(message = "退款订单 no 的前缀不能为空")
|
||||||
private String refundNoPrefix = REFUND_NO_PREFIX;
|
private String refundNoPrefix = REFUND_NO_PREFIX;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 钱包支付应用 AppKey
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "钱包支付应用 AppKey 不能为空")
|
||||||
|
private String walletPayAppKey = WALLET_PAY_APP_KEY_DEFAULT;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.pay.service.app;
|
package cn.iocoder.yudao.module.pay.service.app;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppCreateReqVO;
|
import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppPageReqVO;
|
import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppPageReqVO;
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppUpdateReqVO;
|
import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppUpdateReqVO;
|
||||||
@ -20,7 +18,6 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*;
|
import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*;
|
||||||
@ -46,8 +43,9 @@ public class PayAppServiceImpl implements PayAppService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createApp(PayAppCreateReqVO createReqVO) {
|
public Long createApp(PayAppCreateReqVO createReqVO) {
|
||||||
// 验证appKey是否重复
|
// 验证 appKey 是否重复
|
||||||
validateAppKeyDuplicate(null, createReqVO.getAppKey());
|
validateEmailUnique(null, createReqVO.getAppKey());
|
||||||
|
|
||||||
// 插入
|
// 插入
|
||||||
PayAppDO app = PayAppConvert.INSTANCE.convert(createReqVO);
|
PayAppDO app = PayAppConvert.INSTANCE.convert(createReqVO);
|
||||||
appMapper.insert(app);
|
appMapper.insert(app);
|
||||||
@ -59,13 +57,28 @@ public class PayAppServiceImpl implements PayAppService {
|
|||||||
public void updateApp(PayAppUpdateReqVO updateReqVO) {
|
public void updateApp(PayAppUpdateReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
validateAppExists(updateReqVO.getId());
|
validateAppExists(updateReqVO.getId());
|
||||||
// 验证appKey是否重复
|
// 验证 appKey 是否重复
|
||||||
validateAppKeyDuplicate(updateReqVO.getId(), updateReqVO.getAppKey());
|
validateEmailUnique(updateReqVO.getId(), updateReqVO.getAppKey());
|
||||||
|
|
||||||
// 更新
|
// 更新
|
||||||
PayAppDO updateObj = PayAppConvert.INSTANCE.convert(updateReqVO);
|
PayAppDO updateObj = PayAppConvert.INSTANCE.convert(updateReqVO);
|
||||||
appMapper.updateById(updateObj);
|
appMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void validateEmailUnique(Long id, String appKey) {
|
||||||
|
PayAppDO app = appMapper.selectByAppKey(appKey);
|
||||||
|
if (app == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 如果 id 为空,说明不用比较是否为相同 appKey 的应用
|
||||||
|
if (id == null) {
|
||||||
|
throw exception(APP_KEY_EXISTS);
|
||||||
|
}
|
||||||
|
if (!app.getId().equals(id)) {
|
||||||
|
throw exception(APP_KEY_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateAppStatus(Long id, Integer status) {
|
public void updateAppStatus(Long id, Integer status) {
|
||||||
// 校验商户存在
|
// 校验商户存在
|
||||||
@ -119,63 +132,31 @@ public class PayAppServiceImpl implements PayAppService {
|
|||||||
@Override
|
@Override
|
||||||
public PayAppDO validPayApp(Long appId) {
|
public PayAppDO validPayApp(Long appId) {
|
||||||
PayAppDO app = appMapper.selectById(appId);
|
PayAppDO app = appMapper.selectById(appId);
|
||||||
// 校验支付应用数据是否存在以及可用
|
return validatePayApp(app);
|
||||||
return validatePayAppDO(app);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PayAppDO validPayApp(String appKey) {
|
public PayAppDO validPayApp(String appKey) {
|
||||||
PayAppDO app = appMapper.selectByAppKey(appKey);
|
PayAppDO app = appMapper.selectByAppKey(appKey);
|
||||||
// 校验支付应用数据是否存在以及可用
|
return validatePayApp(app);
|
||||||
return validatePayAppDO(app);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验支付应用实体的有效性
|
* 校验支付应用实体的有效性:存在 + 开启
|
||||||
* 主要包括存在性检查和禁用状态检查
|
|
||||||
*
|
*
|
||||||
* @param app 待校验的支付应用实体
|
* @param app 待校验的支付应用实体
|
||||||
* @return 校验通过的支付应用实体
|
* @return 校验通过的支付应用实体
|
||||||
* @throws IllegalArgumentException 如果支付应用实体不存在或已被禁用
|
|
||||||
*/
|
*/
|
||||||
private PayAppDO validatePayAppDO(PayAppDO app) {
|
private PayAppDO validatePayApp(PayAppDO app) {
|
||||||
// 校验是否存在
|
// 校验是否存在
|
||||||
if (app == null) {
|
if (app == null) {
|
||||||
throw exception(ErrorCodeConstants.APP_NOT_FOUND);
|
throw exception(ErrorCodeConstants.APP_NOT_FOUND);
|
||||||
}
|
}
|
||||||
// 校验是否禁用
|
// 校验是否禁用
|
||||||
if (CommonStatusEnum.DISABLE.getStatus().equals(app.getStatus())) {
|
if (CommonStatusEnum.isDisable(app.getStatus())) {
|
||||||
throw exception(ErrorCodeConstants.APP_IS_DISABLE);
|
throw exception(ErrorCodeConstants.APP_IS_DISABLE);
|
||||||
}
|
}
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 校验应用密钥是否重复
|
|
||||||
* 在新增或更新支付应用时,确保应用密钥(appKey)的唯一性
|
|
||||||
* 如果是在新增情况下,检查数据库中是否已存在相同的appKey
|
|
||||||
* 如果是在更新情况下,检查数据库中是否存在除当前应用外的其他应用使用了相同的appKey
|
|
||||||
*
|
|
||||||
* @param payAppId 支付应用的ID,更新时使用,新增时可能为null
|
|
||||||
* @param payAppKey 支付应用的密钥,用于校验是否重复
|
|
||||||
* @throws RuntimeException 如果发现appKey重复,抛出运行时异常
|
|
||||||
*/
|
|
||||||
private void validateAppKeyDuplicate(Long payAppId, String payAppKey) {
|
|
||||||
// 新增时,校验appKey是否重复
|
|
||||||
if (Objects.isNull(payAppId) && StrUtil.isNotBlank(payAppKey)) {
|
|
||||||
if (appMapper.selectCount(PayAppDO::getAppKey, payAppKey) > 0) {
|
|
||||||
throw exception(APP_KEY_EXISTS);
|
|
||||||
}
|
|
||||||
// 更新时,校验appKey是否重复
|
|
||||||
} else if (Objects.nonNull(payAppId) && StrUtil.isNotBlank(payAppKey)) {
|
|
||||||
LambdaQueryWrapperX<PayAppDO> queryWrapper = new LambdaQueryWrapperX<>();
|
|
||||||
queryWrapper.eq(PayAppDO::getAppKey, payAppKey)
|
|
||||||
.ne(PayAppDO::getId, payAppId);
|
|
||||||
if (appMapper.selectCount(queryWrapper) > 0) {
|
|
||||||
throw exception(APP_KEY_EXISTS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*;
|
|||||||
public class PayDemoOrderServiceImpl implements PayDemoOrderService {
|
public class PayDemoOrderServiceImpl implements PayDemoOrderService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接入的实力应用编号
|
* 接入的支付应用标识
|
||||||
*
|
*
|
||||||
* 从 [支付管理 -> 应用信息] 里添加
|
* 从 [支付管理 -> 应用信息] 里添加
|
||||||
*/
|
*/
|
||||||
|
@ -199,8 +199,8 @@ public class PayRefundServiceImpl implements PayRefundService {
|
|||||||
* @param channel 支付渠道
|
* @param channel 支付渠道
|
||||||
* @param notify 通知
|
* @param notify 通知
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
// 注意,如果是方法内调用该方法,需要通过 getSelf().notifyRefund(channel, notify) 调用,否则事务不生效
|
// 注意,如果是方法内调用该方法,需要通过 getSelf().notifyRefund(channel, notify) 调用,否则事务不生效
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void notifyRefund(PayChannelDO channel, PayRefundRespDTO notify) {
|
public void notifyRefund(PayChannelDO channel, PayRefundRespDTO notify) {
|
||||||
// 情况一:退款成功
|
// 情况一:退款成功
|
||||||
if (PayRefundStatusRespEnum.isSuccess(notify.getStatus())) {
|
if (PayRefundStatusRespEnum.isSuccess(notify.getStatus())) {
|
||||||
|
@ -18,6 +18,7 @@ import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletRechargeMapper;
|
|||||||
import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum;
|
import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum;
|
||||||
import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum;
|
import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum;
|
||||||
import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
|
import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
|
||||||
|
import cn.iocoder.yudao.module.pay.framework.pay.config.PayProperties;
|
||||||
import cn.iocoder.yudao.module.pay.service.order.PayOrderService;
|
import cn.iocoder.yudao.module.pay.service.order.PayOrderService;
|
||||||
import cn.iocoder.yudao.module.pay.service.refund.PayRefundService;
|
import cn.iocoder.yudao.module.pay.service.refund.PayRefundService;
|
||||||
import cn.iocoder.yudao.module.system.api.social.SocialClientApi;
|
import cn.iocoder.yudao.module.system.api.social.SocialClientApi;
|
||||||
@ -51,11 +52,6 @@ import static cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum.*;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class PayWalletRechargeServiceImpl implements PayWalletRechargeService {
|
public class PayWalletRechargeServiceImpl implements PayWalletRechargeService {
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO 芋艿:放到 payconfig
|
|
||||||
*/
|
|
||||||
private static final String WALLET_PAY_APP_KEY = "wallet";
|
|
||||||
|
|
||||||
private static final String WALLET_RECHARGE_ORDER_SUBJECT = "钱包余额充值";
|
private static final String WALLET_RECHARGE_ORDER_SUBJECT = "钱包余额充值";
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@ -68,9 +64,13 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService {
|
|||||||
private PayRefundService payRefundService;
|
private PayRefundService payRefundService;
|
||||||
@Resource
|
@Resource
|
||||||
private PayWalletRechargePackageService payWalletRechargePackageService;
|
private PayWalletRechargePackageService payWalletRechargePackageService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
public SocialClientApi socialClientApi;
|
public SocialClientApi socialClientApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PayProperties payProperties;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public PayWalletRechargeDO createWalletRecharge(Long userId, Integer userType, String userIp,
|
public PayWalletRechargeDO createWalletRecharge(Long userId, Integer userType, String userIp,
|
||||||
@ -92,7 +92,7 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService {
|
|||||||
|
|
||||||
// 2.1 创建支付单
|
// 2.1 创建支付单
|
||||||
Long payOrderId = payOrderService.createOrder(new PayOrderCreateReqDTO()
|
Long payOrderId = payOrderService.createOrder(new PayOrderCreateReqDTO()
|
||||||
.setAppKey(WALLET_PAY_APP_KEY).setUserIp(userIp)
|
.setAppKey(payProperties.getWalletPayAppKey()).setUserIp(userIp)
|
||||||
.setMerchantOrderId(recharge.getId().toString()) // 业务的订单编号
|
.setMerchantOrderId(recharge.getId().toString()) // 业务的订单编号
|
||||||
.setSubject(WALLET_RECHARGE_ORDER_SUBJECT).setBody("")
|
.setSubject(WALLET_RECHARGE_ORDER_SUBJECT).setBody("")
|
||||||
.setPrice(recharge.getPayPrice())
|
.setPrice(recharge.getPayPrice())
|
||||||
@ -174,7 +174,7 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService {
|
|||||||
String walletRechargeId = String.valueOf(id);
|
String walletRechargeId = String.valueOf(id);
|
||||||
String refundId = walletRechargeId + "-refund";
|
String refundId = walletRechargeId + "-refund";
|
||||||
Long payRefundId = payRefundService.createPayRefund(new PayRefundCreateReqDTO()
|
Long payRefundId = payRefundService.createPayRefund(new PayRefundCreateReqDTO()
|
||||||
.setAppKey(WALLET_PAY_APP_KEY).setUserIp(userIp)
|
.setAppKey(payProperties.getWalletPayAppKey()).setUserIp(userIp)
|
||||||
.setMerchantOrderId(walletRechargeId)
|
.setMerchantOrderId(walletRechargeId)
|
||||||
.setMerchantRefundId(refundId)
|
.setMerchantRefundId(refundId)
|
||||||
.setReason("想退钱").setPrice(walletRecharge.getPayPrice()));
|
.setReason("想退钱").setPrice(walletRecharge.getPayPrice()));
|
||||||
|
@ -98,9 +98,12 @@ public class AlipayPayClientConfig implements PayClientConfig {
|
|||||||
private String rootCertContent;
|
private String rootCertContent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接口内容加密方式,如果为空,将使用无加密方式
|
* 接口内容加密方式
|
||||||
* 如果要加密,目前支付宝只有 AES 一种加密方式
|
*
|
||||||
* <a href="https://opendocs.alipay.com/common/02mse3">支付宝开放平台</a>
|
* 1. 如果为空,将使用无加密方式
|
||||||
|
* 2. 如果要加密,目前支付宝只有 AES 一种加密方式
|
||||||
|
*
|
||||||
|
* @see <a href="https://opendocs.alipay.com/common/02mse3">支付宝开放平台</a>
|
||||||
* @see AlipayPayClientConfig#ENC_TYPE_AES
|
* @see AlipayPayClientConfig#ENC_TYPE_AES
|
||||||
*/
|
*/
|
||||||
private String encryptType;
|
private String encryptType;
|
||||||
|
@ -40,17 +40,17 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 数据报表。默认注释,保证编译速度 -->
|
<!-- 数据报表。默认注释,保证编译速度 -->
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<!-- <groupId>cn.iocoder.boot</groupId>-->
|
||||||
<artifactId>yudao-module-report-biz</artifactId>
|
<!-- <artifactId>yudao-module-report-biz</artifactId>-->
|
||||||
<version>${revision}</version>
|
<!-- <version>${revision}</version>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
<!-- 工作流。默认注释,保证编译速度 -->
|
<!-- 工作流。默认注释,保证编译速度 -->
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<!-- <groupId>cn.iocoder.boot</groupId>-->
|
||||||
<artifactId>yudao-module-bpm-biz</artifactId>
|
<!-- <artifactId>yudao-module-bpm-biz</artifactId>-->
|
||||||
<version>${revision}</version>
|
<!-- <version>${revision}</version>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
<!-- 支付服务。默认注释,保证编译速度 -->
|
<!-- 支付服务。默认注释,保证编译速度 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
@ -59,11 +59,11 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 微信公众号模块。默认注释,保证编译速度 -->
|
<!-- 微信公众号模块。默认注释,保证编译速度 -->
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<!-- <groupId>cn.iocoder.boot</groupId>-->
|
||||||
<artifactId>yudao-module-mp-biz</artifactId>
|
<!-- <artifactId>yudao-module-mp-biz</artifactId>-->
|
||||||
<version>${revision}</version>
|
<!-- <version>${revision}</version>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<!-- 商城相关模块。默认注释,保证编译速度-->
|
<!-- 商城相关模块。默认注释,保证编译速度-->
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -88,25 +88,25 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- CRM 相关模块。默认注释,保证编译速度 -->
|
<!-- CRM 相关模块。默认注释,保证编译速度 -->
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<!-- <groupId>cn.iocoder.boot</groupId>-->
|
||||||
<artifactId>yudao-module-crm-biz</artifactId>
|
<!-- <artifactId>yudao-module-crm-biz</artifactId>-->
|
||||||
<version>${revision}</version>
|
<!-- <version>${revision}</version>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<!-- ERP 相关模块。默认注释,保证编译速度 -->
|
<!-- ERP 相关模块。默认注释,保证编译速度 -->
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<!-- <groupId>cn.iocoder.boot</groupId>-->
|
||||||
<artifactId>yudao-module-erp-biz</artifactId>
|
<!-- <artifactId>yudao-module-erp-biz</artifactId>-->
|
||||||
<version>${revision}</version>
|
<!-- <version>${revision}</version>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<!-- AI 大模型相关模块。默认注释,保证编译速度 -->
|
<!-- AI 大模型相关模块。默认注释,保证编译速度 -->
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<!-- <groupId>cn.iocoder.boot</groupId>-->
|
||||||
<artifactId>yudao-module-ai-biz</artifactId>
|
<!-- <artifactId>yudao-module-ai-biz</artifactId>-->
|
||||||
<version>${revision}</version>
|
<!-- <version>${revision}</version>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<!-- spring boot 配置所需依赖 -->
|
<!-- spring boot 配置所需依赖 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -45,7 +45,7 @@ spring:
|
|||||||
primary: master
|
primary: master
|
||||||
datasource:
|
datasource:
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://39.105.15.179:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
|
||||||
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例
|
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例
|
||||||
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
|
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
|
||||||
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
|
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
|
||||||
@ -54,26 +54,26 @@ spring:
|
|||||||
# url: jdbc:kingbase8://127.0.0.1:54321/test # 人大金仓 KingbaseES 连接的示例
|
# url: jdbc:kingbase8://127.0.0.1:54321/test # 人大金仓 KingbaseES 连接的示例
|
||||||
# url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例
|
# url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例
|
||||||
username: root
|
username: root
|
||||||
password: 3WLiVUBEwTbvAfsh
|
password: 123456
|
||||||
# username: sa # SQL Server 连接的示例
|
# username: sa # SQL Server 连接的示例
|
||||||
# password: Yudao@2024 # SQL Server 连接的示例
|
# password: Yudao@2024 # SQL Server 连接的示例
|
||||||
# username: SYSDBA # DM 连接的示例
|
# username: SYSDBA # DM 连接的示例
|
||||||
# password: SYSDBA001 # DM 连接的示例
|
# password: SYSDBA001 # DM 连接的示例
|
||||||
# username: root # OpenGauss 连接的示例
|
# username: root # OpenGauss 连接的示例
|
||||||
# password: Yudao@2024 # OpenGauss 连接的示例
|
# password: Yudao@2024 # OpenGauss 连接的示例
|
||||||
# slave: # 模拟从库,可根据自己需要修改
|
slave: # 模拟从库,可根据自己需要修改
|
||||||
# lazy: true # 开启懒加载,保证启动速度
|
lazy: true # 开启懒加载,保证启动速度
|
||||||
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
|
||||||
# username: root
|
username: root
|
||||||
# password: 123456
|
password: 123456
|
||||||
|
|
||||||
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
||||||
data:
|
data:
|
||||||
redis:
|
redis:
|
||||||
host: 39.105.15.179 # 地址
|
host: 127.0.0.1 # 地址
|
||||||
port: 6379 # 端口
|
port: 6379 # 端口
|
||||||
database: 0 # 数据库索引
|
database: 0 # 数据库索引
|
||||||
password: 3WLiVUBEwTbvAfsh # 密码,建议生产环境开启
|
# password: dev # 密码,建议生产环境开启
|
||||||
|
|
||||||
--- #################### 定时任务相关配置 ####################
|
--- #################### 定时任务相关配置 ####################
|
||||||
|
|
||||||
@ -110,18 +110,18 @@ spring:
|
|||||||
|
|
||||||
# rocketmq 配置项,对应 RocketMQProperties 配置类
|
# rocketmq 配置项,对应 RocketMQProperties 配置类
|
||||||
rocketmq:
|
rocketmq:
|
||||||
name-server: 117.72.39.77:9876 # RocketMQ Namesrv
|
name-server: 127.0.0.1:9876 # RocketMQ Namesrv
|
||||||
|
|
||||||
#spring:
|
spring:
|
||||||
# # RabbitMQ 配置项,对应 RabbitProperties 配置类
|
# RabbitMQ 配置项,对应 RabbitProperties 配置类
|
||||||
# rabbitmq:
|
rabbitmq:
|
||||||
# host: 127.0.0.1 # RabbitMQ 服务的地址
|
host: 127.0.0.1 # RabbitMQ 服务的地址
|
||||||
# port: 5672 # RabbitMQ 服务的端口
|
port: 5672 # RabbitMQ 服务的端口
|
||||||
# username: rabbit # RabbitMQ 服务的账号
|
username: rabbit # RabbitMQ 服务的账号
|
||||||
# password: rabbit # RabbitMQ 服务的密码
|
password: rabbit # RabbitMQ 服务的密码
|
||||||
# # Kafka 配置项,对应 KafkaProperties 配置类
|
# Kafka 配置项,对应 KafkaProperties 配置类
|
||||||
# kafka:
|
kafka:
|
||||||
# bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔
|
bootstrap-servers: 127.0.0.1:9092 # 指定 Kafka Broker 地址,可以设置多个,以逗号分隔
|
||||||
|
|
||||||
--- #################### 服务保障相关配置 ####################
|
--- #################### 服务保障相关配置 ####################
|
||||||
|
|
||||||
|
@ -309,7 +309,6 @@ yudao:
|
|||||||
end-code: 9999 # 这里配置 9999 的原因是,测试方便。
|
end-code: 9999 # 这里配置 9999 的原因是,测试方便。
|
||||||
trade:
|
trade:
|
||||||
order:
|
order:
|
||||||
app-key: mall
|
|
||||||
pay-expire-time: 2h # 支付的过期时间
|
pay-expire-time: 2h # 支付的过期时间
|
||||||
receive-expire-time: 14d # 收货的过期时间
|
receive-expire-time: 14d # 收货的过期时间
|
||||||
comment-expire-time: 7d # 评论的过期时间
|
comment-expire-time: 7d # 评论的过期时间
|
||||||
|
Loading…
Reference in New Issue
Block a user