【同步】新增 jdk8/11 精简版!

This commit is contained in:
YunaiV 2024-07-29 09:38:16 +08:00
parent 015dab27f6
commit 3435515b97
9 changed files with 0 additions and 420 deletions

View File

@ -1,27 +0,0 @@
package cn.iocoder.yudao.module.pay.api.notify.dto;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
/**
* 转账单的通知 Request DTO
*
* @author jason
*/
@Data
public class PayTransferNotifyReqDTO {
/**
* 商户转账单号
*/
@NotEmpty(message = "商户转账单号不能为空")
private String merchantTransferId;
/**
* 转账订单编号
*/
@NotNull(message = "转账订单编号不能为空")
private Long payTransferId;
}

View File

@ -1,47 +0,0 @@
package cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 示例业务转账订单 Base VO提供给添加修改详细的子 VO 使用
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/
@Data
public class PayDemoTransferRespVO {
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id;
@Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long appId;
@Schema(description = "转账金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "22338")
private Integer price;
@Schema(description = "转账类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer type;
@Schema(description = "收款人姓名", example = "test")
private String userName;
@Schema(description = "支付宝登录号", example = "32167")
private String alipayLogonId;
@Schema(description = "微信 openId", example = "31139")
private String openid;
@Schema(description = "转账状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Integer transferStatus;
@Schema(description = "转账订单编号", example = "23695")
private Long payTransferId;
@Schema(description = "转账支付成功渠道")
private String payChannelCode;
@Schema(description = "转账支付时间")
private LocalDateTime transferTime;
}

View File

@ -1,95 +0,0 @@
package cn.iocoder.yudao.module.pay.controller.admin.transfer.vo;
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
import cn.iocoder.yudao.module.pay.enums.transfer.PayTransferTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.Validator;
import javax.validation.constraints.*;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.NOT_IMPLEMENTED;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.pay.enums.transfer.PayTransferTypeEnum.*;
@Schema(description = "管理后台 - 发起转账 Request VO")
@Data
public class PayTransferCreateReqVO {
@Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "应用编号不能为空")
private Long appId;
@Schema(description = "商户转账单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "商户转账单编号不能为空")
private String merchantTransferId;
@Schema(description = "转账类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "转账类型不能为空")
@InEnum(PayTransferTypeEnum.class)
private Integer type;
@Schema(description = "转账渠道", requiredMode = Schema.RequiredMode.REQUIRED, example = "alipay_pc")
@NotEmpty(message = "转账渠道不能为空")
private String channelCode;
@Min(value = 1, message = "转账金额必须大于零")
@NotNull(message = "转账金额不能为空")
private Integer price;
@Schema(description = "转账标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "示例转账")
@NotEmpty(message = "转账标题不能为空")
private String subject;
@Schema(description = "收款人姓名", example = "test1")
@NotBlank(message = "收款人姓名不能为空", groups = {Alipay.class})
private String userName;
@Schema(description = "支付宝登录号", example = "test1@sandbox.com")
@NotBlank(message = "支付宝登录号不能为空", groups = {Alipay.class})
private String alipayLogonId;
@Schema(description = "微信 openId", example = "oLefc4g5Gxx")
@NotBlank(message = "微信 openId 不能为空", groups = {WxPay.class})
private String openid;
@Schema(description = "转账渠道的额外参数")
private Map<String, String> channelExtras;
public void validate(Validator validator) {
PayTransferTypeEnum transferType = typeOf(type);
switch (transferType) {
case ALIPAY_BALANCE: {
ValidationUtils.validate(validator, this, Alipay.class);
break;
}
case WX_BALANCE: {
ValidationUtils.validate(validator, this, WxPay.class);
break;
}
default: {
throw new UnsupportedOperationException("待实现");
}
}
}
@AssertTrue(message = "转账类型和转账渠道不匹配")
public boolean isValidChannelCode() {
PayTransferTypeEnum transferType = typeOf(type);
switch (transferType) {
case ALIPAY_BALANCE: {
return PayChannelEnum.isAlipay(channelCode);
}
case WX_BALANCE:
case BANK_CARD:
case WALLET_BALANCE: {
throw exception(NOT_IMPLEMENTED);
}
}
return Boolean.FALSE;
}
}

View File

@ -1,62 +0,0 @@
package cn.iocoder.yudao.module.pay.controller.admin.transfer.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @author jason
*/
@Schema(description = "管理后台 - 转账单分页项 Response VO")
@Data
public class PayTransferPageItemRespVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2931")
private Long id;
@Schema(description = "转账单号", requiredMode = Schema.RequiredMode.REQUIRED)
private String no;
@Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12831")
private Long appId;
@Schema(description = "转账渠道编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "24833")
private Long channelId;
@Schema(description = "转账渠道编码", requiredMode = Schema.RequiredMode.REQUIRED)
private String channelCode;
@Schema(description = "商户转账单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17481")
private String merchantTransferId;
@Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Integer type;
@Schema(description = "转账状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Integer status;
@Schema(description = "转账成功时间")
private LocalDateTime successTime;
@Schema(description = "转账金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "964")
private Integer price;
@Schema(description = "转账标题", requiredMode = Schema.RequiredMode.REQUIRED)
private String subject;
@Schema(description = "收款人姓名", example = "王五")
private String userName;
@Schema(description = "支付宝登录号", example = "29245")
private String alipayLogonId;
@Schema(description = "微信 openId", example = "26589")
private String openid;
@Schema(description = "渠道转账单号")
private String channelTransferNo;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
}

View File

@ -1,79 +0,0 @@
package cn.iocoder.yudao.module.pay.controller.admin.transfer.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.Map;
@Schema(description = "管理后台 - 转账单 Response VO")
@Data
public class PayTransferRespVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2931")
private Long id;
@Schema(description = "转账单号", requiredMode = Schema.RequiredMode.REQUIRED)
private String no;
@Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12831")
private Long appId;
@Schema(description = "转账渠道编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "24833")
private Long channelId;
@Schema(description = "转账渠道编码", requiredMode = Schema.RequiredMode.REQUIRED)
private String channelCode;
@Schema(description = "商户转账单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17481")
private String merchantTransferId;
@Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Integer type;
@Schema(description = "转账状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Integer status;
@Schema(description = "转账成功时间")
private LocalDateTime successTime;
@Schema(description = "转账金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "964")
private Integer price;
@Schema(description = "转账标题", requiredMode = Schema.RequiredMode.REQUIRED)
private String subject;
@Schema(description = "收款人姓名", example = "王五")
private String userName;
@Schema(description = "支付宝登录号", example = "29245")
private String alipayLogonId;
@Schema(description = "微信 openId", example = "26589")
private String openid;
@Schema(description = "异步通知商户地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
private String notifyUrl;
@Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED)
private String userIp;
@Schema(description = "渠道的额外参数")
private Map<String, String> channelExtras;
@Schema(description = "渠道转账单号")
private String channelTransferNo;
@Schema(description = "调用渠道的错误码")
private String channelErrorCode;
@Schema(description = "调用渠道的错误提示")
private String channelErrorMsg;
@Schema(description = "渠道的同步/异步通知的内容")
private String channelNotifyData;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
}

View File

@ -1,42 +0,0 @@
package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "用户 APP - 钱包充值记录 Resp VO")
@Data
public class AppPayWalletRechargeRespVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long id;
@Schema(description = "用户实际到账余额", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
private Integer totalPrice;
@Schema(description = "实际支付金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "20")
private Integer payPrice;
@Schema(description = "钱包赠送金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "80")
private Integer bonusPrice;
@Schema(description = "支付成功的支付渠道", requiredMode = Schema.RequiredMode.REQUIRED)
private String payChannelCode;
@Schema(description = "支付渠道名", example = "微信小程序支付")
private String payChannelName;
@Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED)
private Long payOrderId;
@Schema(description = "支付成功的外部订单号", requiredMode = Schema.RequiredMode.REQUIRED)
private String payOrderChannelOrderNo; // PayOrderDO channelOrderNo 字段
@Schema(description = "订单支付时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime payTime;
@Schema(description = "退款状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
private Integer refundStatus;
}

View File

@ -1,16 +0,0 @@
package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "用户 APP - 钱包流水统计 Request VO")
@Data
public class AppPayWalletTransactionSummaryRespVO {
@Schema(description = "累计支出,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000")
private Integer totalExpense;
@Schema(description = "累计收入,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000")
private Integer totalIncome;
}

View File

@ -1,21 +0,0 @@
package cn.iocoder.yudao.module.pay.convert.demo;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer.PayDemoTransferCreateReqVO;
import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer.PayDemoTransferRespVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoTransferDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* @author jason
*/
@Mapper
public interface PayDemoTransferConvert {
PayDemoTransferConvert INSTANCE = Mappers.getMapper(PayDemoTransferConvert.class);
PayDemoTransferDO convert(PayDemoTransferCreateReqVO bean);
PageResult<PayDemoTransferRespVO> convertPage(PageResult<PayDemoTransferDO> pageResult);
}

View File

@ -1,31 +0,0 @@
package cn.iocoder.yudao.module.pay.job.transfer;
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
import cn.iocoder.yudao.module.pay.service.transfer.PayTransferService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 转账订单的同步 Job
*
* 由于转账订单的转账结果有些渠道是异步通知进行同步的考虑到异步通知可能会失败小概率所以需要定时进行同步
*
* @author jason
*/
@Component
@Slf4j
public class PayTransferSyncJob {
@Resource
private PayTransferService transferService;
@XxlJob("payTransferSyncJob")
@TenantJob // 多租户
public void execute(String param) {
int count = transferService.syncTransfer();
log.info("[execute][同步转账订单 ({}) 个]", count);
}
}