feat 增加订单和继续相关的控制器

This commit is contained in:
nws
2024-01-10 00:33:22 +08:00
parent cc81fdec87
commit 3ff914a235
107 changed files with 1161 additions and 293 deletions

View File

@@ -41,6 +41,7 @@
- [ ] (前端) 平台配置
- [ ] (前端) 接口配置
- **任务池**
- [ ] 支付宝方式支持
- [ ] 退款状态同步逻辑
- [ ] 退款回调的处理
- [ ] 支付状态同步处理考虑退款情况

View File

@@ -0,0 +1,65 @@
package cn.bootx.platform.daxpay.admin.controller.order;
import cn.bootx.platform.common.core.exception.DataNotExistException;
import cn.bootx.platform.common.core.rest.PageResult;
import cn.bootx.platform.common.core.rest.Res;
import cn.bootx.platform.common.core.rest.ResResult;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderChannelService;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderExtraService;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.dto.order.pay.PayOrderChannelDto;
import cn.bootx.platform.daxpay.service.dto.order.pay.PayOrderDto;
import cn.bootx.platform.daxpay.service.dto.order.pay.PayOrderExtraDto;
import cn.bootx.platform.daxpay.service.param.order.PayOrderQuery;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 支付订单控制器
* @author xxm
* @since 2024/1/9
*/
@Tag(name = "支付订单控制器")
@RestController
@RequestMapping("/order/pay")
@RequiredArgsConstructor
public class PayOrderController {
private final PayOrderService payOrderService;
private final PayOrderExtraService payOrderExtraService;
private final PayOrderChannelService payOrderChannelService;
@Operation(summary = "分页查询")
@GetMapping("/page")
public ResResult<PageResult<PayOrderDto>> page(PageParam pageParam, PayOrderQuery param){
return Res.ok(payOrderService.page(pageParam,param));
}
@Operation(summary = "查询订单详情")
@GetMapping("/findById")
public ResResult<PayOrderDto> findById(Long id){
PayOrderDto order = payOrderService.findById(id)
.map(PayOrder::toDto)
.orElseThrow(() -> new DataNotExistException("支付订单不存在"));
return Res.ok(order);
}
@Operation(summary = "查询支付订单扩展信息")
@GetMapping("/getExtraById")
public ResResult<PayOrderExtraDto> getExtraById(Long id){
return Res.ok(payOrderExtraService.findById(id));
}
@Operation(summary = "查询支付订单关联支付通道")
@GetMapping("/getChannels")
public ResResult<List<PayOrderChannelDto>> getChannels(Long paymentId){
return Res.ok(payOrderChannelService.findAllByPaymentId(paymentId));
}
}

View File

@@ -0,0 +1,41 @@
package cn.bootx.platform.daxpay.admin.controller.order;
import cn.bootx.platform.common.core.rest.PageResult;
import cn.bootx.platform.common.core.rest.Res;
import cn.bootx.platform.common.core.rest.ResResult;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.daxpay.service.core.order.refund.service.PayRefundOrderService;
import cn.bootx.platform.daxpay.service.dto.order.refund.PayRefundOrderDto;
import cn.bootx.platform.daxpay.service.param.order.PayRefundOrderQuery;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 支付退款控制器
* @author xxm
* @since 2024/1/9
*/
@Tag(name = "支付退款控制器")
@RestController
@RequestMapping("/order/refund")
@RequiredArgsConstructor
public class PayRefundOrderController {
private final PayRefundOrderService payRefundOrderService;
@Operation(summary = "分页查询")
@GetMapping("/page")
public ResResult<PageResult<PayRefundOrderDto>> page(PageParam pageParam, PayRefundOrderQuery query){
return Res.ok(payRefundOrderService.page(pageParam, query));
}
@Operation(summary = "查询单条")
@GetMapping("/findById")
public ResResult<PayRefundOrderDto> findById(Long paymentId){
return Res.ok(payRefundOrderService.findById(paymentId));
}
}

View File

@@ -0,0 +1,41 @@
package cn.bootx.platform.daxpay.admin.controller.record;
import cn.bootx.platform.common.core.rest.PageResult;
import cn.bootx.platform.common.core.rest.Res;
import cn.bootx.platform.common.core.rest.ResResult;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.daxpay.service.core.record.callback.service.PayCallbackRecordService;
import cn.bootx.platform.daxpay.service.dto.record.callback.PayCallbackRecordDto;
import cn.bootx.platform.daxpay.service.param.record.PayCallbackRecordQuery;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 支付回调信息记录
* @author xxm
* @since 2024/1/9
*/
@Tag(name = "支付回调信息记录")
@RestController
@RequestMapping("/record/callback")
@RequiredArgsConstructor
public class PayCallbackRecordController {
private final PayCallbackRecordService service;
@Operation(summary = "分页查询")
@GetMapping("/page")
public ResResult<PageResult<PayCallbackRecordDto>> page(PageParam pageParam, PayCallbackRecordQuery query){
return Res.ok(service.page(pageParam, query));
}
@Operation(summary = "查询单条")
@GetMapping("/findById")
public ResResult<PayCallbackRecordDto> findById(Long paymentId){
return Res.ok(service.findById(paymentId));
}
}

View File

@@ -0,0 +1,41 @@
package cn.bootx.platform.daxpay.admin.controller.record;
import cn.bootx.platform.common.core.rest.PageResult;
import cn.bootx.platform.common.core.rest.Res;
import cn.bootx.platform.common.core.rest.ResResult;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.daxpay.service.core.record.close.service.PayCloseRecordService;
import cn.bootx.platform.daxpay.service.dto.record.close.PayCloseRecordDto;
import cn.bootx.platform.daxpay.service.param.record.PayCloseRecordQuery;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
*
* @author xxm
* @since 2024/1/9
*/
@Tag(name = "支付订单关闭记录")
@RestController
@RequestMapping("/record/close")
@RequiredArgsConstructor
public class PayCloseRecordController {
private final PayCloseRecordService service;
@Operation(summary = "分页查询")
@GetMapping("/page")
public ResResult<PageResult<PayCloseRecordDto>> page(PageParam pageParam, PayCloseRecordQuery query){
return Res.ok(service.page(pageParam, query));
}
@Operation(summary = "查询单条")
@GetMapping("/findById")
public ResResult<PayCloseRecordDto> findById(Long paymentId){
return Res.ok(service.findById(paymentId));
}
}

View File

@@ -0,0 +1,41 @@
package cn.bootx.platform.daxpay.admin.controller.record;
import cn.bootx.platform.common.core.rest.PageResult;
import cn.bootx.platform.common.core.rest.Res;
import cn.bootx.platform.common.core.rest.ResResult;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.daxpay.service.core.record.repair.service.PayRepairRecordService;
import cn.bootx.platform.daxpay.service.dto.order.repair.PayRepairRecordDto;
import cn.bootx.platform.daxpay.service.param.record.PayRepairRecordQuery;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 支付修复记录控制器
* @author xxm
* @since 2024/1/9
*/
@Tag(name = "支付修复记录")
@RestController
@RequestMapping("/record/repair")
@RequiredArgsConstructor
public class PayRepairRecordController {
private final PayRepairRecordService service;
@Operation(summary = "分页查询")
@GetMapping("/page")
public ResResult<PageResult<PayRepairRecordDto>> page(PageParam pageParam, PayRepairRecordQuery query){
return Res.ok(service.page(pageParam, query));
}
@Operation(summary = "查询单条")
@GetMapping("/findById")
public ResResult<PayRepairRecordDto> findById(Long paymentId){
return Res.ok(service.findById(paymentId));
}
}

View File

@@ -0,0 +1,41 @@
package cn.bootx.platform.daxpay.admin.controller.record;
import cn.bootx.platform.common.core.rest.PageResult;
import cn.bootx.platform.common.core.rest.Res;
import cn.bootx.platform.common.core.rest.ResResult;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.daxpay.service.core.record.sync.service.PaySyncRecordService;
import cn.bootx.platform.daxpay.service.dto.record.sync.PaySyncRecordDto;
import cn.bootx.platform.daxpay.service.param.record.PaySyncRecordQuery;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 支付同步记录控制器
* @author xxm
* @since 2024/1/9
*/
@Tag(name = "支付同步记录控制器")
@RestController
@RequestMapping("/record/sync")
@RequiredArgsConstructor
public class PaySyncRecordController {
private final PaySyncRecordService service;
@Operation(summary = "分页查询")
@GetMapping("/page")
public ResResult<PageResult<PaySyncRecordDto>> page(PageParam pageParam, PaySyncRecordQuery query){
return Res.ok(service.page(pageParam, query));
}
@Operation(summary = "查询单条")
@GetMapping("/findById")
public ResResult<PaySyncRecordDto> findById(Long paymentId){
return Res.ok(service.findById(paymentId));
}
}

View File

@@ -8,10 +8,7 @@ import cn.bootx.platform.daxpay.service.param.system.payinfo.PayWayInfoParam;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -40,7 +37,7 @@ public class PayWayInfoController {
}
@Operation(summary = "更新")
@GetMapping("/update")
@PostMapping("/update")
public ResResult<Void> update(@RequestBody PayWayInfoParam param){
payWayInfoService.update(param);
return Res.ok();

View File

@@ -5,13 +5,13 @@ import lombok.Data;
import lombok.experimental.Accessors;
/**
* 支付订单可退款信息(不持久化,直接保存为json)
* 可退款信息(不持久化,直接保存为json)
* @author xxm
* @since 2023/12/18
*/
@Data
@Accessors(chain = true)
public class OrderRefundableInfo {
public class RefundableInfo {
/**
* @see PayChannelEnum#getCode()
*/

View File

@@ -1,7 +1,7 @@
package cn.bootx.platform.daxpay.service.common.typehandler;
import cn.bootx.platform.common.mybatisplus.handler.JacksonTypeReferenceHandler;
import cn.bootx.platform.daxpay.service.common.entity.OrderRefundableInfo;
import cn.bootx.platform.daxpay.service.common.entity.RefundableInfo;
import com.fasterxml.jackson.core.type.TypeReference;
import java.util.List;
@@ -11,13 +11,13 @@ import java.util.List;
* @author xxm
* @since 2024/1/3
*/
public class RefundableInfoTypeHandler extends JacksonTypeReferenceHandler<List<OrderRefundableInfo>> {
public class RefundableInfoTypeHandler extends JacksonTypeReferenceHandler<List<RefundableInfo>> {
/**
* 返回要反序列化的类型对象
*/
@Override
public TypeReference<List<OrderRefundableInfo>> getTypeReference() {
return new TypeReference<List<OrderRefundableInfo>>() {};
public TypeReference<List<RefundableInfo>> getTypeReference() {
return new TypeReference<List<RefundableInfo>>() {};
}
}

View File

@@ -4,7 +4,7 @@ import cn.bootx.platform.common.spring.exception.RetryableException;
import cn.bootx.platform.daxpay.code.PaySyncStatusEnum;
import cn.bootx.platform.daxpay.service.code.AliPayCode;
import cn.bootx.platform.daxpay.service.core.payment.sync.result.GatewaySyncResult;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
import com.alipay.api.AlipayApiException;
import com.alipay.api.domain.AlipayTradeCloseModel;

View File

@@ -2,12 +2,12 @@ package cn.bootx.platform.daxpay.service.core.channel.alipay.service;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.code.PayStatusEnum;
import cn.bootx.platform.daxpay.service.common.entity.OrderRefundableInfo;
import cn.bootx.platform.daxpay.service.common.entity.RefundableInfo;
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
import cn.bootx.platform.daxpay.service.core.channel.alipay.dao.AliPayOrderManager;
import cn.bootx.platform.daxpay.service.core.channel.alipay.entity.AliPayOrder;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.record.pay.service.PayOrderChannelService;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderChannelService;
import cn.bootx.platform.daxpay.param.pay.PayChannelParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -45,9 +45,9 @@ public class AliPayOrderService {
payOrderChannelService.updateChannel(payChannelParam,payOrder);
// 更新支付宝可退款类型信息
List<OrderRefundableInfo> refundableInfos = payOrder.getRefundableInfos();
List<RefundableInfo> refundableInfos = payOrder.getRefundableInfos();
refundableInfos.removeIf(payTypeInfo -> PayChannelEnum.ASYNC_TYPE_CODE.contains(payTypeInfo.getChannel()));
refundableInfos.add(new OrderRefundableInfo()
refundableInfos.add(new RefundableInfo()
.setChannel(PayChannelEnum.ALI.getCode())
.setAmount(payChannelParam.getAmount())
);

View File

@@ -3,7 +3,7 @@ package cn.bootx.platform.daxpay.service.core.channel.alipay.service;
import cn.bootx.platform.daxpay.service.code.AliPayCode;
import cn.bootx.platform.daxpay.service.common.context.AsyncRefundLocal;
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
import cn.hutool.core.util.IdUtil;
import com.alipay.api.AlipayApiException;

View File

@@ -8,7 +8,7 @@ import cn.bootx.platform.daxpay.service.common.context.AsyncPayLocal;
import cn.bootx.platform.daxpay.service.common.context.NoticeLocal;
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
import cn.bootx.platform.daxpay.service.core.channel.alipay.entity.AliPayConfig;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
import cn.bootx.platform.daxpay.param.channel.AliPayParam;
import cn.bootx.platform.daxpay.param.pay.PayChannelParam;

View File

@@ -6,7 +6,7 @@ import cn.bootx.platform.daxpay.code.PaySyncStatusEnum;
import cn.bootx.platform.daxpay.service.code.AliPayCode;
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
import cn.bootx.platform.daxpay.service.core.payment.sync.result.GatewaySyncResult;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.hutool.json.JSONUtil;
import com.alipay.api.AlipayApiException;
import com.alipay.api.domain.AlipayTradeQueryModel;

View File

@@ -3,7 +3,7 @@ package cn.bootx.platform.daxpay.service.core.channel.cash.service;
import cn.bootx.platform.daxpay.code.PayStatusEnum;
import cn.bootx.platform.daxpay.service.core.channel.cash.dao.CashPayOrderManager;
import cn.bootx.platform.daxpay.service.core.channel.cash.entity.CashPayOrder;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.param.pay.PayParam;
import cn.bootx.platform.daxpay.param.pay.PayChannelParam;
import lombok.RequiredArgsConstructor;

View File

@@ -43,20 +43,20 @@ public class Voucher extends MpBaseEntity implements EntityBaseFunction<VoucherD
private String mchAppCode;
/** 卡号 */
@DbComment("卡号")
@DbColumn(comment = "卡号")
@DbMySqlIndex(comment = "卡号索引")
private String cardNo;
/** 生成批次号 */
@DbComment("生成批次号")
@DbColumn(comment = "生成批次号")
private Long batchNo;
/** 面值 */
@DbComment("面值")
@DbColumn(comment = "面值")
private BigDecimal faceValue;
/** 余额 */
@DbComment("余额")
@DbColumn(comment = "余额")
private Integer balance;
/** 预冻结额度 */
@@ -65,22 +65,22 @@ public class Voucher extends MpBaseEntity implements EntityBaseFunction<VoucherD
/** 是否长期有效 */
@DbComment("是否长期有效")
@DbColumn(comment = "是否长期有效")
private boolean enduring;
/** 开始时间 */
@DbComment("开始时间")
@DbColumn(comment = "开始时间")
private LocalDateTime startTime;
/** 结束时间 */
@DbComment("结束时间")
@DbColumn(comment = "结束时间")
private LocalDateTime endTime;
/**
* 状态
* @see VoucherCode#STATUS_FORBIDDEN
*/
@DbComment("状态")
@DbColumn(comment = "状态")
private String status;
@Override

View File

@@ -5,7 +5,7 @@ import cn.bootx.platform.daxpay.code.PayStatusEnum;
import cn.bootx.platform.daxpay.service.core.channel.voucher.dao.VoucherPaymentManager;
import cn.bootx.platform.daxpay.service.core.channel.voucher.entity.VoucherPayOrder;
import cn.bootx.platform.daxpay.service.core.channel.voucher.entity.VoucherRecord;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.param.pay.PayParam;
import cn.bootx.platform.daxpay.param.pay.PayChannelParam;
import lombok.RequiredArgsConstructor;

View File

@@ -8,7 +8,7 @@ import cn.bootx.platform.daxpay.service.core.channel.voucher.entity.Voucher;
import cn.bootx.platform.daxpay.service.core.channel.voucher.entity.VoucherLog;
import cn.bootx.platform.daxpay.service.core.channel.voucher.entity.VoucherPayOrder;
import cn.bootx.platform.daxpay.service.core.channel.voucher.entity.VoucherRecord;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
import cn.bootx.platform.daxpay.param.channel.VoucherPayParam;
import cn.bootx.platform.daxpay.param.pay.PayChannelParam;

View File

@@ -5,7 +5,7 @@ import cn.bootx.platform.daxpay.code.PayStatusEnum;
import cn.bootx.platform.daxpay.service.core.channel.wallet.dao.WalletPaymentManager;
import cn.bootx.platform.daxpay.service.core.channel.wallet.entity.Wallet;
import cn.bootx.platform.daxpay.service.core.channel.wallet.entity.WalletPayOrder;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.param.pay.PayParam;
import cn.bootx.platform.daxpay.param.pay.PayChannelParam;
import lombok.RequiredArgsConstructor;

View File

@@ -9,7 +9,7 @@ import cn.bootx.platform.daxpay.service.core.channel.wallet.dao.WalletPaymentMan
import cn.bootx.platform.daxpay.service.core.channel.wallet.entity.Wallet;
import cn.bootx.platform.daxpay.service.core.channel.wallet.entity.WalletLog;
import cn.bootx.platform.daxpay.service.core.channel.wallet.entity.WalletPayOrder;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.exception.waller.WalletLackOfBalanceException;
import cn.bootx.platform.daxpay.exception.waller.WalletNotExistsException;
import lombok.RequiredArgsConstructor;

View File

@@ -5,7 +5,7 @@ import cn.bootx.platform.daxpay.service.code.WeChatPayCode;
import cn.bootx.platform.daxpay.service.common.context.AsyncRefundLocal;
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayConfig;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
import cn.hutool.core.util.StrUtil;
import com.ijpay.core.enums.SignType;

View File

@@ -3,13 +3,13 @@ package cn.bootx.platform.daxpay.service.core.channel.wechat.service;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.code.PayStatusEnum;
import cn.bootx.platform.daxpay.service.common.context.AsyncPayLocal;
import cn.bootx.platform.daxpay.service.common.entity.OrderRefundableInfo;
import cn.bootx.platform.daxpay.service.common.entity.RefundableInfo;
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
import cn.bootx.platform.daxpay.service.core.channel.wechat.dao.WeChatPayOrderManager;
import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayOrder;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.record.pay.service.PayOrderChannelService;
import cn.bootx.platform.daxpay.service.core.record.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderChannelService;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.param.pay.PayChannelParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -47,9 +47,9 @@ public class WeChatPayOrderService {
payOrderChannelService.updateChannel(payChannelParam,payOrder);
// 更新微信可退款类型信息
List<OrderRefundableInfo> refundableInfos = payOrder.getRefundableInfos();
List<RefundableInfo> refundableInfos = payOrder.getRefundableInfos();
refundableInfos.removeIf(payTypeInfo -> PayChannelEnum.ASYNC_TYPE_CODE.contains(payTypeInfo.getChannel()));
refundableInfos.add(new OrderRefundableInfo()
refundableInfos.add(new RefundableInfo()
.setChannel(PayChannelEnum.WECHAT.getCode())
.setAmount(payChannelParam.getAmount())
);

View File

@@ -11,7 +11,7 @@ import cn.bootx.platform.daxpay.service.code.WeChatPayWay;
import cn.bootx.platform.daxpay.service.common.context.AsyncPayLocal;
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayConfig;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.payment.sync.service.PaySyncService;
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
import cn.bootx.platform.daxpay.service.param.channel.wechat.WeChatPayParam;

View File

@@ -4,10 +4,10 @@ import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.code.PayRefundStatusEnum;
import cn.bootx.platform.daxpay.service.code.WeChatPayCode;
import cn.bootx.platform.daxpay.service.common.context.AsyncRefundLocal;
import cn.bootx.platform.daxpay.service.common.entity.OrderRefundableInfo;
import cn.bootx.platform.daxpay.service.common.entity.RefundableInfo;
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayConfig;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.IdUtil;
@@ -40,7 +40,7 @@ public class WechatRefundService {
*/
public void refund(PayOrder payOrder, int amount,
WeChatPayConfig weChatPayConfig) {
OrderRefundableInfo refundableInfo = payOrder.getRefundableInfos().stream()
RefundableInfo refundableInfo = payOrder.getRefundableInfos().stream()
.filter(o -> Objects.equals(o.getChannel(), PayChannelEnum.WECHAT.getCode()))
.findFirst()
.orElseThrow(() -> new PayFailureException("未找到微信支付的详细信息"));

View File

@@ -7,11 +7,11 @@ import cn.bootx.platform.daxpay.service.common.context.PlatformLocal;
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
import cn.bootx.platform.daxpay.service.core.notice.result.PayChannelResult;
import cn.bootx.platform.daxpay.service.core.notice.result.PayNoticeResult;
import cn.bootx.platform.daxpay.service.core.record.pay.dao.PayOrderChannelManager;
import cn.bootx.platform.daxpay.service.core.record.pay.dao.PayOrderExtraManager;
import cn.bootx.platform.daxpay.service.core.record.pay.dao.PayOrderManager;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrderExtra;
import cn.bootx.platform.daxpay.service.core.order.pay.dao.PayOrderChannelManager;
import cn.bootx.platform.daxpay.service.core.order.pay.dao.PayOrderExtraManager;
import cn.bootx.platform.daxpay.service.core.order.pay.dao.PayOrderManager;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrderExtra;
import cn.bootx.platform.daxpay.util.PaySignUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.ContentType;

View File

@@ -1,4 +1,4 @@
package cn.bootx.platform.daxpay.service.core.record.pay.builder;
package cn.bootx.platform.daxpay.service.core.order.pay.builder;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.code.PayStatusEnum;
@@ -6,10 +6,10 @@ import cn.bootx.platform.daxpay.service.common.context.AsyncPayLocal;
import cn.bootx.platform.daxpay.service.common.context.NoticeLocal;
import cn.bootx.platform.daxpay.service.common.context.PlatformLocal;
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrderChannel;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrderExtra;
import cn.bootx.platform.daxpay.service.common.entity.OrderRefundableInfo;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrderChannel;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrderExtra;
import cn.bootx.platform.daxpay.service.common.entity.RefundableInfo;
import cn.bootx.platform.daxpay.param.pay.PayParam;
import cn.bootx.platform.daxpay.param.pay.PayChannelParam;
import cn.bootx.platform.daxpay.result.pay.PayResult;
@@ -42,7 +42,7 @@ public class PaymentBuilder {
.getAsyncPayInfo()
.getExpiredTime();
// 可退款信息
List<OrderRefundableInfo> refundableInfos = buildRefundableInfo(payParam.getPayChannels());
List<RefundableInfo> refundableInfos = buildRefundableInfo(payParam.getPayChannels());
// 计算总价
int sumAmount = payParam.getPayChannels().stream()
.map(PayChannelParam::getAmount)
@@ -109,12 +109,12 @@ public class PaymentBuilder {
/**
* 构建支付订单的可退款信息列表
*/
private List<OrderRefundableInfo> buildRefundableInfo(List<PayChannelParam> payChannelParamList) {
private List<RefundableInfo> buildRefundableInfo(List<PayChannelParam> payChannelParamList) {
if (CollectionUtil.isEmpty(payChannelParamList)) {
return Collections.emptyList();
}
return payChannelParamList.stream()
.map(o-> new OrderRefundableInfo()
.map(o-> new RefundableInfo()
.setChannel(o.getChannel())
.setAmount(o.getAmount()))
.collect(Collectors.toList());

View File

@@ -0,0 +1,26 @@
package cn.bootx.platform.daxpay.service.core.order.pay.convert;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrderChannel;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrderExtra;
import cn.bootx.platform.daxpay.service.dto.order.pay.PayOrderChannelDto;
import cn.bootx.platform.daxpay.service.dto.order.pay.PayOrderDto;
import cn.bootx.platform.daxpay.service.dto.order.pay.PayOrderExtraDto;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
*
* @author xxm
* @since 2024/1/9
*/
@Mapper
public interface PayOrderConvert {
PayOrderConvert CONVERT = Mappers.getMapper(PayOrderConvert.class);
PayOrderExtraDto convert(PayOrderExtra in);
PayOrderDto convert(PayOrder in);
PayOrderChannelDto convert(PayOrderChannel in);
}

View File

@@ -1,7 +1,7 @@
package cn.bootx.platform.daxpay.service.core.record.pay.dao;
package cn.bootx.platform.daxpay.service.core.order.pay.dao;
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrderChannel;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrderChannel;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

View File

@@ -1,6 +1,6 @@
package cn.bootx.platform.daxpay.service.core.record.pay.dao;
package cn.bootx.platform.daxpay.service.core.order.pay.dao;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrderChannel;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrderChannel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

View File

@@ -1,7 +1,7 @@
package cn.bootx.platform.daxpay.service.core.record.pay.dao;
package cn.bootx.platform.daxpay.service.core.order.pay.dao;
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrderExtra;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrderExtra;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

View File

@@ -1,6 +1,6 @@
package cn.bootx.platform.daxpay.service.core.record.pay.dao;
package cn.bootx.platform.daxpay.service.core.order.pay.dao;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrderExtra;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrderExtra;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

View File

@@ -0,0 +1,38 @@
package cn.bootx.platform.daxpay.service.core.order.pay.dao;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.mybatisplus.base.MpIdEntity;
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.param.order.PayOrderQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
import java.util.Optional;
/**
* 支付订单
* @author xxm
* @since 2023/12/18
*/
@Slf4j
@Repository
@RequiredArgsConstructor
public class PayOrderManager extends BaseManager<PayOrderMapper, PayOrder> {
public Optional<PayOrder> findByBusinessNo(String businessNo) {
return findByField(PayOrder::getBusinessNo,businessNo);
}
/**
* 分页
*/
public Page<PayOrder> page(PageParam pageParam, PayOrderQuery query){
Page<PayOrder> mpPage = MpUtil.getMpPage(pageParam, PayOrder.class);
return lambdaQuery()
.orderByDesc(MpIdEntity::getId)
.page(mpPage);
}
}

View File

@@ -1,6 +1,6 @@
package cn.bootx.platform.daxpay.service.core.record.pay.dao;
package cn.bootx.platform.daxpay.service.core.order.pay.dao;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

View File

@@ -1,11 +1,14 @@
package cn.bootx.platform.daxpay.service.core.record.pay.entity;
package cn.bootx.platform.daxpay.service.core.order.pay.entity;
import cn.bootx.platform.common.core.annotation.BigField;
import cn.bootx.platform.common.core.function.EntityBaseFunction;
import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.code.PayStatusEnum;
import cn.bootx.platform.daxpay.service.common.entity.OrderRefundableInfo;
import cn.bootx.platform.daxpay.service.common.entity.RefundableInfo;
import cn.bootx.platform.daxpay.service.common.typehandler.RefundableInfoTypeHandler;
import cn.bootx.platform.daxpay.service.core.order.pay.convert.PayOrderConvert;
import cn.bootx.platform.daxpay.service.dto.order.pay.PayOrderDto;
import cn.bootx.table.modify.annotation.DbColumn;
import cn.bootx.table.modify.annotation.DbTable;
import cn.bootx.table.modify.mysql.annotation.DbMySqlFieldType;
@@ -31,7 +34,7 @@ import java.util.List;
@DbTable(comment = "支付订单")
@Accessors(chain = true)
@TableName(value = "pay_order",autoResultMap = true)
public class PayOrder extends MpBaseEntity {
public class PayOrder extends MpBaseEntity implements EntityBaseFunction<PayOrderDto> {
/** 关联的业务id */
@DbMySqlIndex(comment = "业务业务号索引",type = MySqlIndexType.UNIQUE)
@@ -67,13 +70,13 @@ public class PayOrder extends MpBaseEntity {
/**
* 退款信息列表
* @see OrderRefundableInfo
* @see RefundableInfo
*/
@TableField(typeHandler = RefundableInfoTypeHandler.class)
@BigField
@DbMySqlFieldType(MySqlFieldTypeEnum.LONGTEXT)
@DbColumn(comment = "退款信息列表")
private List<OrderRefundableInfo> refundableInfos;
private List<RefundableInfo> refundableInfos;
/**
* 支付状态
@@ -90,4 +93,11 @@ public class PayOrder extends MpBaseEntity {
@DbColumn(comment = "过期时间")
private LocalDateTime expiredTime;
/**
* 转换
*/
@Override
public PayOrderDto toDto() {
return PayOrderConvert.CONVERT.convert(this);
}
}

View File

@@ -1,10 +1,13 @@
package cn.bootx.platform.daxpay.service.core.record.pay.entity;
package cn.bootx.platform.daxpay.service.core.order.pay.entity;
import cn.bootx.platform.common.core.function.EntityBaseFunction;
import cn.bootx.platform.common.mybatisplus.base.MpCreateEntity;
import cn.bootx.platform.daxpay.param.channel.AliPayParam;
import cn.bootx.platform.daxpay.param.channel.VoucherPayParam;
import cn.bootx.platform.daxpay.param.channel.WalletPayParam;
import cn.bootx.platform.daxpay.param.channel.WeChatPayParam;
import cn.bootx.platform.daxpay.service.core.order.pay.convert.PayOrderConvert;
import cn.bootx.platform.daxpay.service.dto.order.pay.PayOrderChannelDto;
import cn.bootx.table.modify.annotation.DbColumn;
import cn.bootx.table.modify.annotation.DbTable;
import com.baomidou.mybatisplus.annotation.TableName;
@@ -22,7 +25,7 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
@DbTable(comment = "支付订单关联支付时通道信息")
@TableName("pay_order_channel")
public class PayOrderChannel extends MpCreateEntity {
public class PayOrderChannel extends MpCreateEntity implements EntityBaseFunction<PayOrderChannelDto> {
@DbColumn(comment = "支付id")
private Long paymentId;
@@ -47,4 +50,12 @@ public class PayOrderChannel extends MpCreateEntity {
*/
@DbColumn(comment = "附加支付参数")
private String channelExtra;
/**
* 转换
*/
@Override
public PayOrderChannelDto toDto() {
return PayOrderConvert.CONVERT.convert(this);
}
}

View File

@@ -1,13 +1,15 @@
package cn.bootx.platform.daxpay.service.core.record.pay.entity;
package cn.bootx.platform.daxpay.service.core.order.pay.entity;
import cn.bootx.platform.common.core.function.EntityBaseFunction;
import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity;
import cn.bootx.platform.daxpay.service.core.order.pay.convert.PayOrderConvert;
import cn.bootx.platform.daxpay.service.dto.order.pay.PayOrderExtraDto;
import cn.bootx.table.modify.annotation.DbColumn;
import cn.bootx.table.modify.annotation.DbTable;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@@ -24,7 +26,7 @@ import java.time.LocalDateTime;
@Accessors(chain = true)
@DbTable(comment = "支付订单扩展信息")
@TableName("pay_order_extra")
public class PayOrderExtra extends MpBaseEntity {
public class PayOrderExtra extends MpBaseEntity implements EntityBaseFunction<PayOrderExtraDto> {
/** 描述 */
@DbColumn(comment = "描述")
@@ -34,8 +36,8 @@ public class PayOrderExtra extends MpBaseEntity {
@DbColumn(comment = "支付终端ip")
private String clientIp;
/** 是否不启用异步通知 */
@DbColumn(comment = "是否不启用异步通知,以最后一次为准")
/** 是否不需要异步通知,以最后一次为准 */
@DbColumn(comment = "是否不需要异步通知")
private boolean notNotify;
/** 异步通知地址 */
@@ -43,17 +45,16 @@ public class PayOrderExtra extends MpBaseEntity {
@TableField(updateStrategy = FieldStrategy.ALWAYS)
private String notifyUrl;
/** 同步通知 */
/** 签名类型 */
@DbColumn(comment = "签名类型")
private String signType;
/** 签名 */
@DbColumn(comment = "签名,以最后一次为准")
/** 签名,以最后一次为准 */
@DbColumn(comment = "签名")
private String sign;
@Schema(description = "商户扩展参数,回调时会原样返回")
/** 商户扩展参数,回调时会原样返回 */
@DbColumn(comment = "商户扩展参数")
private String attach;
/** API版本号 */
@@ -72,4 +73,11 @@ public class PayOrderExtra extends MpBaseEntity {
@DbColumn(comment = "错误信息")
private String errorMsg;
/**
* 转换
*/
@Override
public PayOrderExtraDto toDto() {
return PayOrderConvert.CONVERT.convert(this);
}
}

View File

@@ -1,15 +1,18 @@
package cn.bootx.platform.daxpay.service.core.record.pay.service;
package cn.bootx.platform.daxpay.service.core.order.pay.service;
import cn.bootx.platform.common.core.util.ResultConvertUtil;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.service.core.record.pay.dao.PayOrderChannelManager;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrderChannel;
import cn.bootx.platform.daxpay.param.pay.PayChannelParam;
import cn.bootx.platform.daxpay.service.core.order.pay.dao.PayOrderChannelManager;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrderChannel;
import cn.bootx.platform.daxpay.service.dto.order.pay.PayOrderChannelDto;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Optional;
/**
@@ -23,6 +26,13 @@ import java.util.Optional;
public class PayOrderChannelService {
private final PayOrderChannelManager payOrderChannelManager;
/**
* 根据支付ID查询列表
*/
public List<PayOrderChannelDto> findAllByPaymentId(Long paymentId){
return ResultConvertUtil.dtoListConvert(payOrderChannelManager.findAllByPaymentId(paymentId));
}
/**
* 更新支付订单的通道信息
*/

View File

@@ -0,0 +1,28 @@
package cn.bootx.platform.daxpay.service.core.order.pay.service;
import cn.bootx.platform.common.core.exception.DataNotExistException;
import cn.bootx.platform.daxpay.service.core.order.pay.dao.PayOrderExtraManager;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrderExtra;
import cn.bootx.platform.daxpay.service.dto.order.pay.PayOrderExtraDto;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* 支付订单扩展信息
* @author xxm
* @since 2024/1/9
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class PayOrderExtraService {
private final PayOrderExtraManager payOrderExtraManager;
/**
* 查询详情
*/
public PayOrderExtraDto findById(Long id){
return payOrderExtraManager.findById(id).map(PayOrderExtra::toDto).orElseThrow(()->new DataNotExistException("支付订单扩展信息不存在"));
}
}

View File

@@ -1,12 +1,18 @@
package cn.bootx.platform.daxpay.service.core.record.pay.service;
package cn.bootx.platform.daxpay.service.core.order.pay.service;
import cn.bootx.platform.common.core.rest.PageResult;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.code.PayStatusEnum;
import cn.bootx.platform.daxpay.service.common.entity.OrderRefundableInfo;
import cn.bootx.platform.daxpay.service.core.record.pay.dao.PayOrderManager;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.timeout.service.PayExpiredTimeService;
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
import cn.bootx.platform.daxpay.service.common.entity.RefundableInfo;
import cn.bootx.platform.daxpay.service.core.order.pay.dao.PayOrderManager;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.timeout.service.PayExpiredTimeService;
import cn.bootx.platform.daxpay.service.dto.order.pay.PayOrderDto;
import cn.bootx.platform.daxpay.service.param.order.PayOrderQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -29,9 +35,17 @@ public class PayOrderService {
private final PayExpiredTimeService expiredTimeService;
//
// 支付完成常量集合
private final List<String> ORDER_FINISH = Arrays.asList(PayStatusEnum.CLOSE.getCode(), PayStatusEnum.SUCCESS.getCode());
/**
* 根据id查询
*/
public PageResult<PayOrderDto> page(PageParam pageParam, PayOrderQuery param) {
Page<PayOrder> page = payOrderManager.page(pageParam, param);
return MpUtil.convert2DtoPageResult(page);
}
/**
* 根据id查询
*/
@@ -73,8 +87,8 @@ public class PayOrderService {
*/
public void updateRefundSuccess(PayOrder payment, int amount, PayChannelEnum payChannelEnum) {
// 删除旧有的退款记录, 替换退款完的新的
List<OrderRefundableInfo> refundableInfos = payment.getRefundableInfos();
OrderRefundableInfo refundableInfo = refundableInfos.stream()
List<RefundableInfo> refundableInfos = payment.getRefundableInfos();
RefundableInfo refundableInfo = refundableInfos.stream()
.filter(o -> Objects.equals(o.getChannel(), payChannelEnum.getCode()))
.findFirst()
.orElseThrow(() -> new PayFailureException("退款数据不存在"));
@@ -83,4 +97,5 @@ public class PayOrderService {
refundableInfos.add(refundableInfo);
payment.setRefundableInfos(refundableInfos);
}
}

View File

@@ -1,7 +1,7 @@
package cn.bootx.platform.daxpay.service.core.record.refund.convert;
package cn.bootx.platform.daxpay.service.core.order.refund.convert;
import cn.bootx.platform.daxpay.service.core.record.refund.entity.PayRefundOrder;
import cn.bootx.platform.daxpay.service.dto.record.refund.PayRefundOrderDto;
import cn.bootx.platform.daxpay.service.core.order.refund.entity.PayRefundOrder;
import cn.bootx.platform.daxpay.service.dto.order.refund.PayRefundOrderDto;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

View File

@@ -1,11 +1,11 @@
package cn.bootx.platform.daxpay.service.core.record.refund.dao;
package cn.bootx.platform.daxpay.service.core.order.refund.dao;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.mybatisplus.base.MpIdEntity;
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
import cn.bootx.platform.daxpay.service.core.record.refund.entity.PayRefundOrder;
import cn.bootx.platform.daxpay.service.dto.record.refund.PayRefundOrderDto;
import cn.bootx.platform.daxpay.service.core.order.refund.entity.PayRefundOrder;
import cn.bootx.platform.daxpay.service.param.order.PayRefundOrderQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -22,12 +22,15 @@ import java.util.Objects;
@RequiredArgsConstructor
public class PayRefundOrderManager extends BaseManager<PayRefundOrderMapper, PayRefundOrder> {
public Page<PayRefundOrder> page(PageParam pageParam, PayRefundOrderDto param) {
/**
* 分页
*/
public Page<PayRefundOrder> page(PageParam pageParam, PayRefundOrderQuery query) {
Page<PayRefundOrder> mpPage = MpUtil.getMpPage(pageParam, PayRefundOrder.class);
return lambdaQuery().orderByDesc(MpIdEntity::getId)
.like(Objects.nonNull(param.getPaymentId()), PayRefundOrder::getPaymentId, param.getPaymentId())
.like(Objects.nonNull(param.getBusinessNo()), PayRefundOrder::getBusinessNo, param.getBusinessNo())
.like(Objects.nonNull(param.getTitle()), PayRefundOrder::getTitle, param.getTitle())
.like(Objects.nonNull(query.getPaymentId()), PayRefundOrder::getPaymentId, query.getPaymentId())
.like(Objects.nonNull(query.getBusinessNo()), PayRefundOrder::getBusinessNo, query.getBusinessNo())
.like(Objects.nonNull(query.getTitle()), PayRefundOrder::getTitle, query.getTitle())
.page(mpPage);
}

View File

@@ -1,6 +1,6 @@
package cn.bootx.platform.daxpay.service.core.record.refund.dao;
package cn.bootx.platform.daxpay.service.core.order.refund.dao;
import cn.bootx.platform.daxpay.service.core.record.refund.entity.PayRefundOrder;
import cn.bootx.platform.daxpay.service.core.order.refund.entity.PayRefundOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

View File

@@ -1,12 +1,12 @@
package cn.bootx.platform.daxpay.service.core.record.refund.entity;
package cn.bootx.platform.daxpay.service.core.order.refund.entity;
import cn.bootx.platform.common.core.function.EntityBaseFunction;
import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity;
import cn.bootx.platform.daxpay.code.PayRefundStatusEnum;
import cn.bootx.platform.daxpay.service.common.entity.OrderRefundableInfo;
import cn.bootx.platform.daxpay.service.common.entity.RefundableInfo;
import cn.bootx.platform.daxpay.service.common.typehandler.RefundableInfoTypeHandler;
import cn.bootx.platform.daxpay.service.core.record.refund.convert.RefundConvert;
import cn.bootx.platform.daxpay.service.dto.record.refund.PayRefundOrderDto;
import cn.bootx.platform.daxpay.service.core.order.refund.convert.RefundConvert;
import cn.bootx.platform.daxpay.service.dto.order.refund.PayRefundOrderDto;
import cn.bootx.table.modify.annotation.DbColumn;
import cn.bootx.table.modify.annotation.DbTable;
import cn.bootx.table.modify.mysql.annotation.DbMySqlFieldType;
@@ -79,7 +79,7 @@ public class PayRefundOrder extends MpBaseEntity implements EntityBaseFunction<P
@DbColumn(comment = "退款信息列表")
@TableField(typeHandler = RefundableInfoTypeHandler.class)
@DbMySqlFieldType(MySqlFieldTypeEnum.LONGTEXT)
private List<OrderRefundableInfo> refundableInfo;
private List<RefundableInfo> refundableInfo;
/**
* 退款状态

View File

@@ -1,12 +1,13 @@
package cn.bootx.platform.daxpay.service.core.record.refund.service;
package cn.bootx.platform.daxpay.service.core.order.refund.service;
import cn.bootx.platform.common.core.exception.DataNotExistException;
import cn.bootx.platform.common.core.rest.PageResult;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
import cn.bootx.platform.daxpay.service.core.record.refund.dao.PayRefundOrderManager;
import cn.bootx.platform.daxpay.service.core.record.refund.entity.PayRefundOrder;
import cn.bootx.platform.daxpay.service.dto.record.refund.PayRefundOrderDto;
import cn.bootx.platform.daxpay.service.core.order.refund.dao.PayRefundOrderManager;
import cn.bootx.platform.daxpay.service.core.order.refund.entity.PayRefundOrder;
import cn.bootx.platform.daxpay.service.dto.order.refund.PayRefundOrderDto;
import cn.bootx.platform.daxpay.service.param.order.PayRefundOrderQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -21,19 +22,15 @@ import org.springframework.stereotype.Service;
@Slf4j
@Service
@RequiredArgsConstructor
public class PayRefundRecordService {
public class PayRefundOrderService {
private final PayRefundOrderManager refundRecordManager;
// TODO 记录退款记录
/**
* 分页查询
*/
public PageResult<PayRefundOrderDto> page(PageParam pageParam, PayRefundOrderDto param) {
Page<PayRefundOrder> page = refundRecordManager.page(pageParam, param);
public PageResult<PayRefundOrderDto> page(PageParam pageParam, PayRefundOrderQuery query) {
Page<PayRefundOrder> page = refundRecordManager.page(pageParam, query);
return MpUtil.convert2DtoPageResult(page);
}

View File

@@ -8,8 +8,8 @@ import cn.bootx.platform.daxpay.code.PayStatusEnum;
import cn.bootx.platform.daxpay.service.core.payment.callback.result.PayCallbackResult;
import cn.bootx.platform.daxpay.service.core.payment.repair.param.PayRepairParam;
import cn.bootx.platform.daxpay.service.core.payment.repair.service.PayRepairService;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.record.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

View File

@@ -5,13 +5,13 @@ import cn.bootx.platform.daxpay.code.PayStatusEnum;
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
import cn.bootx.platform.daxpay.exception.pay.PayUnsupportedMethodException;
import cn.bootx.platform.daxpay.param.pay.PayCloseParam;
import cn.bootx.platform.daxpay.service.common.entity.OrderRefundableInfo;
import cn.bootx.platform.daxpay.service.common.entity.RefundableInfo;
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
import cn.bootx.platform.daxpay.service.core.payment.close.factory.PayCloseStrategyFactory;
import cn.bootx.platform.daxpay.service.core.record.close.entity.PayCloseRecord;
import cn.bootx.platform.daxpay.service.core.record.close.service.PayCloseRecordService;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.record.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.func.AbsPayCloseStrategy;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.lock.LockInfo;
@@ -76,7 +76,7 @@ public class PayCloseService {
// 1.获取支付方式(退款列表中提取),通过工厂生成对应的策略组
List<String> channels = payOrder.getRefundableInfos()
.stream()
.map(OrderRefundableInfo::getChannel)
.map(RefundableInfo::getChannel)
.collect(Collectors.toList());
List<AbsPayCloseStrategy> payCloseStrategies = PayCloseStrategyFactory.createAsyncLast(channels);
if (CollectionUtil.isEmpty(payCloseStrategies)) {

View File

@@ -44,12 +44,12 @@ public class PaymentSignService {
if (Objects.equals(PaySignTypeEnum.HMAC_SHA256.getCode(), signType)){
boolean verified = PaySignUtil.verifyHmacSha256Sign(param, platform.getSignSecret(), param.getSign());
if (!verified){
throw new PayFailureException("签名验证未通过");
throw new PayFailureException("未通过签名验证");
}
} else if (Objects.equals(PaySignTypeEnum.MD5.getCode(), signType)){
boolean verified = PaySignUtil.verifyMd5Sign(param, platform.getSignSecret(), param.getSign());
if (!verified){
throw new PayFailureException("签名验证未通过");
throw new PayFailureException("未通过签名验证");
}
} else {
throw new PayFailureException("签名方式错误");

View File

@@ -12,13 +12,13 @@ import cn.bootx.platform.daxpay.service.common.context.NoticeLocal;
import cn.bootx.platform.daxpay.service.common.context.PlatformLocal;
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
import cn.bootx.platform.daxpay.service.core.payment.sync.service.PaySyncService;
import cn.bootx.platform.daxpay.service.core.record.pay.builder.PaymentBuilder;
import cn.bootx.platform.daxpay.service.core.record.pay.dao.PayOrderChannelManager;
import cn.bootx.platform.daxpay.service.core.record.pay.dao.PayOrderExtraManager;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrderChannel;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrderExtra;
import cn.bootx.platform.daxpay.service.core.record.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.core.order.pay.builder.PaymentBuilder;
import cn.bootx.platform.daxpay.service.core.order.pay.dao.PayOrderChannelManager;
import cn.bootx.platform.daxpay.service.core.order.pay.dao.PayOrderExtraManager;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrderChannel;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrderExtra;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.util.PayUtil;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;

View File

@@ -8,9 +8,9 @@ import cn.bootx.platform.daxpay.param.pay.PayChannelParam;
import cn.bootx.platform.daxpay.param.pay.SimplePayParam;
import cn.bootx.platform.daxpay.result.pay.PayResult;
import cn.bootx.platform.daxpay.service.core.payment.pay.factory.PayStrategyFactory;
import cn.bootx.platform.daxpay.service.core.record.pay.builder.PaymentBuilder;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.record.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.core.order.pay.builder.PaymentBuilder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.func.AbsPayStrategy;
import cn.bootx.platform.daxpay.service.func.PayStrategyConsumer;
import cn.bootx.platform.daxpay.util.PayUtil;

View File

@@ -2,7 +2,7 @@ package cn.bootx.platform.daxpay.service.core.payment.pay.strategy;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.service.core.channel.cash.service.CashService;
import cn.bootx.platform.daxpay.service.core.record.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.exception.pay.PayAmountAbnormalException;
import cn.bootx.platform.daxpay.service.func.AbsPayStrategy;
import cn.bootx.platform.daxpay.param.pay.PayChannelParam;

View File

@@ -8,10 +8,10 @@ import cn.bootx.platform.daxpay.service.common.context.AsyncRefundLocal;
import cn.bootx.platform.daxpay.service.common.context.NoticeLocal;
import cn.bootx.platform.daxpay.service.common.context.PlatformLocal;
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.record.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.core.record.refund.dao.PayRefundOrderManager;
import cn.bootx.platform.daxpay.service.core.record.refund.entity.PayRefundOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.core.order.refund.dao.PayRefundOrderManager;
import cn.bootx.platform.daxpay.service.core.order.refund.entity.PayRefundOrder;
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
import cn.bootx.platform.daxpay.param.pay.RefundChannelParam;
import cn.bootx.platform.daxpay.param.pay.RefundParam;

View File

@@ -4,8 +4,8 @@ import cn.bootx.platform.common.core.exception.RepetitiveOperationException;
import cn.bootx.platform.common.core.util.ValidationUtil;
import cn.bootx.platform.daxpay.code.PayStatusEnum;
import cn.bootx.platform.daxpay.service.core.payment.refund.factory.PayRefundStrategyFactory;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.record.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.exception.pay.PayUnsupportedMethodException;
import cn.bootx.platform.daxpay.service.func.AbsPayRefundStrategy;
import cn.bootx.platform.daxpay.param.pay.RefundChannelParam;

View File

@@ -5,7 +5,7 @@ import cn.bootx.platform.daxpay.service.core.channel.alipay.entity.AliPayConfig;
import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayOrderService;
import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayRefundService;
import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayConfigService;
import cn.bootx.platform.daxpay.service.core.record.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.func.AbsPayRefundStrategy;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Scope;

View File

@@ -2,7 +2,7 @@ package cn.bootx.platform.daxpay.service.core.payment.refund.strategy;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.service.core.channel.cash.service.CashService;
import cn.bootx.platform.daxpay.service.core.record.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.func.AbsPayRefundStrategy;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Scope;

View File

@@ -3,7 +3,7 @@ package cn.bootx.platform.daxpay.service.core.payment.refund.strategy;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.service.core.channel.voucher.service.VoucherPayService;
import cn.bootx.platform.daxpay.service.core.channel.voucher.service.VoucherPayOrderService;
import cn.bootx.platform.daxpay.service.core.record.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.func.AbsPayRefundStrategy;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Scope;

View File

@@ -3,7 +3,7 @@ package cn.bootx.platform.daxpay.service.core.payment.refund.strategy;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.service.core.channel.wallet.service.WalletPayService;
import cn.bootx.platform.daxpay.service.core.channel.wallet.service.WalletPayOrderService;
import cn.bootx.platform.daxpay.service.core.record.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.func.AbsPayRefundStrategy;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Scope;

View File

@@ -5,7 +5,7 @@ import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayConf
import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WeChatPayConfigService;
import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WeChatPayOrderService;
import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WechatRefundService;
import cn.bootx.platform.daxpay.service.core.record.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.func.AbsPayRefundStrategy;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Scope;

View File

@@ -13,7 +13,7 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
public class RepairResult {
/** 修复前状态 */
private PayStatusEnum oldStatus;
private PayStatusEnum beforeStatus;
/** 修复后状态 */
private PayStatusEnum repairStatus;
}

View File

@@ -1,13 +1,13 @@
package cn.bootx.platform.daxpay.service.core.payment.repair.service;
import cn.bootx.platform.daxpay.code.PayStatusEnum;
import cn.bootx.platform.daxpay.service.common.entity.OrderRefundableInfo;
import cn.bootx.platform.daxpay.service.common.entity.RefundableInfo;
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
import cn.bootx.platform.daxpay.service.core.payment.repair.factory.PayRepairStrategyFactory;
import cn.bootx.platform.daxpay.service.core.payment.repair.param.PayRepairParam;
import cn.bootx.platform.daxpay.service.core.payment.repair.result.RepairResult;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.record.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.core.record.repair.entity.PayRepairRecord;
import cn.bootx.platform.daxpay.service.core.record.repair.service.PayRepairRecordService;
import cn.bootx.platform.daxpay.service.func.AbsPayRepairStrategy;
@@ -42,14 +42,14 @@ public class PayRepairService {
// 从退款记录中获取支付通道 退款记录中的支付通道跟支付时关联的支付通道一致
List<String> channels = order.getRefundableInfos()
.stream()
.map(OrderRefundableInfo::getChannel)
.map(RefundableInfo::getChannel)
.collect(Collectors.toList());
// 初始化修复参数
List<AbsPayRepairStrategy> repairStrategies = PayRepairStrategyFactory.createAsyncLast(channels);
repairStrategies.forEach(repairStrategy -> repairStrategy.initRepairParam(order, repairParam.getRepairSource()));
repairStrategies.forEach(AbsPayRepairStrategy::doBeforeHandler);
RepairResult repairResult = new RepairResult().setOldStatus(PayStatusEnum.findByCode(order.getStatus()));
RepairResult repairResult = new RepairResult().setBeforeStatus(PayStatusEnum.findByCode(order.getStatus()));
// 根据不同的类型执行对应的修复逻辑
switch (repairParam.getRepairType()) {
@@ -149,10 +149,12 @@ public class PayRepairService {
private void saveRecord(PayOrder order, PayRepairParam repairParam, RepairResult repairResult){
PayRepairRecord payRepairRecord = new PayRepairRecord()
.setBeforeStatus(repairResult.getOldStatus().getCode())
.setPaymentId(order.getId())
.setAsyncChannel(order.getAsyncChannel())
.setBusinessNo(order.getBusinessNo())
.setBeforeStatus(repairResult.getBeforeStatus().getCode())
.setAfterStatus(repairResult.getRepairStatus().getCode())
.setAmount(repairParam.getAmount())
.setBusinessNo(order.getBusinessNo())
.setRepairSource(repairParam.getRepairSource().getCode())
.setRepairType(repairParam.getRepairType().getCode());
recordService.saveRecord(payRepairRecord);

View File

@@ -6,8 +6,8 @@ import cn.bootx.platform.daxpay.service.core.channel.alipay.entity.AliPayConfig;
import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayCloseService;
import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayConfigService;
import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayOrderService;
import cn.bootx.platform.daxpay.service.core.record.pay.dao.PayOrderChannelManager;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrderChannel;
import cn.bootx.platform.daxpay.service.core.order.pay.dao.PayOrderChannelManager;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrderChannel;
import cn.bootx.platform.daxpay.service.func.AbsPayRepairStrategy;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

View File

@@ -6,8 +6,8 @@ import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayConf
import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WeChatPayCloseService;
import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WeChatPayConfigService;
import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WeChatPayOrderService;
import cn.bootx.platform.daxpay.service.core.record.pay.dao.PayOrderChannelManager;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrderChannel;
import cn.bootx.platform.daxpay.service.core.order.pay.dao.PayOrderChannelManager;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrderChannel;
import cn.bootx.platform.daxpay.service.func.AbsPayRepairStrategy;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

View File

@@ -15,8 +15,8 @@ import cn.bootx.platform.daxpay.service.core.payment.repair.param.PayRepairParam
import cn.bootx.platform.daxpay.service.core.payment.repair.service.PayRepairService;
import cn.bootx.platform.daxpay.service.core.payment.sync.factory.PaySyncStrategyFactory;
import cn.bootx.platform.daxpay.service.core.payment.sync.result.GatewaySyncResult;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.record.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayOrderService;
import cn.bootx.platform.daxpay.service.core.record.sync.entity.PaySyncRecord;
import cn.bootx.platform.daxpay.service.core.record.sync.service.PaySyncRecordService;
import cn.bootx.platform.daxpay.service.func.AbsPaySyncStrategy;

View File

@@ -1,7 +1,12 @@
package cn.bootx.platform.daxpay.service.core.record.callback.dao;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.mybatisplus.base.MpIdEntity;
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
import cn.bootx.platform.daxpay.service.core.record.callback.entity.PayCallbackRecord;
import cn.bootx.platform.daxpay.service.param.record.PayCallbackRecordQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
@@ -13,4 +18,14 @@ import org.springframework.stereotype.Repository;
@Slf4j
@Repository
public class PayCallbackRecordManager extends BaseManager<PayCallbackRecordMapper, PayCallbackRecord> {
/**
* 分页
*/
public Page<PayCallbackRecord> page(PageParam pageParam, PayCallbackRecordQuery param){
Page<PayCallbackRecord> mpPage = MpUtil.getMpPage(pageParam, PayCallbackRecord.class);
return lambdaQuery()
.orderByDesc(MpIdEntity::getId)
.page(mpPage);
}
}

View File

@@ -6,7 +6,7 @@ import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.code.PayStatusEnum;
import cn.bootx.platform.daxpay.service.core.record.callback.convert.PayCallbackRecordConvert;
import cn.bootx.platform.daxpay.service.dto.record.callback.PayCallbackRecordDto;
import cn.bootx.table.modify.annotation.DbComment;
import cn.bootx.table.modify.annotation.DbColumn;
import cn.bootx.table.modify.annotation.DbTable;
import cn.bootx.table.modify.mysql.annotation.DbMySqlFieldType;
import cn.bootx.table.modify.mysql.constants.MySqlFieldTypeEnum;
@@ -29,40 +29,40 @@ import java.time.LocalDateTime;
@TableName("pay_callback_record")
public class PayCallbackRecord extends MpCreateEntity implements EntityBaseFunction<PayCallbackRecordDto> {
/** 支付记录id */
@DbComment("支付记录id")
@DbColumn(comment = "支付记录id")
private Long paymentId;
/**
* 支付通道
* @see PayChannelEnum#getCode()
*/
@DbComment("支付通道")
@DbColumn(comment = "支付通道")
private String payChannel;
/** 通知消息 */
@DbMySqlFieldType(MySqlFieldTypeEnum.LONGTEXT)
@DbComment("通知消息")
@DbColumn(comment = "通知消息")
private String notifyInfo;
/**
* 支付状态
* @see PayStatusEnum
*/
@DbComment("支付状态")
@DbColumn(comment = "支付状态")
private String payStatus;
/**
* 回调处理状态
*/
@DbComment("回调处理状态")
@DbColumn(comment = "回调处理状态")
private String status;
/** 提示信息 */
@DbComment("提示信息")
@DbColumn(comment = "提示信息")
private String msg;
/** 回调时间 */
@DbComment("回调时间")
@DbColumn(comment = "回调时间")
private LocalDateTime notifyTime;
/**

View File

@@ -1,9 +1,13 @@
package cn.bootx.platform.daxpay.service.core.record.callback.service;
import cn.bootx.platform.common.core.exception.DataNotExistException;
import cn.bootx.platform.common.core.rest.PageResult;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
import cn.bootx.platform.daxpay.service.core.record.callback.dao.PayCallbackRecordManager;
import cn.bootx.platform.daxpay.service.core.record.callback.entity.PayCallbackRecord;
import cn.bootx.platform.daxpay.service.dto.record.callback.PayCallbackRecordDto;
import cn.bootx.platform.daxpay.service.param.record.PayCallbackRecordQuery;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -17,7 +21,6 @@ import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class PayCallbackRecordService {
private final PayCallbackRecordManager callbackRecordManager;
/**
@@ -26,4 +29,11 @@ public class PayCallbackRecordService {
public PayCallbackRecordDto findById(Long id) {
return callbackRecordManager.findById(id).map(PayCallbackRecord::toDto).orElseThrow(DataNotExistException::new);
}
/**
* 分页查询
*/
public PageResult<PayCallbackRecordDto> page(PageParam pageParam, PayCallbackRecordQuery param){
return MpUtil.convert2DtoPageResult(callbackRecordManager.page(pageParam,param));
}
}

View File

@@ -1,7 +1,12 @@
package cn.bootx.platform.daxpay.service.core.record.close.dao;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.mybatisplus.base.MpIdEntity;
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
import cn.bootx.platform.daxpay.service.core.record.close.entity.PayCloseRecord;
import cn.bootx.platform.daxpay.service.param.record.PayCloseRecordQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
@@ -16,5 +21,13 @@ import org.springframework.stereotype.Repository;
@RequiredArgsConstructor
public class PayCloseRecordManager extends BaseManager<PayCloseRecordMapper, PayCloseRecord> {
/**
* 分页
*/
public Page<PayCloseRecord> page(PageParam pageParam, PayCloseRecordQuery param){
Page<PayCloseRecord> mpPage = MpUtil.getMpPage(pageParam, PayCloseRecord.class);
return lambdaQuery()
.orderByDesc(MpIdEntity::getId)
.page(mpPage);
}
}

View File

@@ -6,7 +6,6 @@ import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.service.core.record.close.convert.PayCloseRecordConvert;
import cn.bootx.platform.daxpay.service.dto.record.close.PayCloseRecordDto;
import cn.bootx.table.modify.annotation.DbColumn;
import cn.bootx.table.modify.annotation.DbComment;
import cn.bootx.table.modify.annotation.DbTable;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@@ -26,27 +25,27 @@ import lombok.experimental.Accessors;
public class PayCloseRecord extends MpCreateEntity implements EntityBaseFunction<PayCloseRecordDto> {
/** 支付记录id */
@DbComment("支付记录id")
@DbColumn(comment = "支付记录id")
private Long paymentId;
/** 业务号 */
@DbComment("业务号")
@DbColumn(comment = "业务号")
private String businessNo;
/**
* 关闭的异步支付通道, 可以为空
* @see PayChannelEnum#getCode()
*/
@DbComment("关闭的异步支付通道")
@DbColumn(comment = "关闭的异步支付通道")
private String asyncChannel;
/**
* 是否关闭成功
*/
@DbComment("是否关闭成功")
@DbColumn(comment = "是否关闭成功")
private boolean closed;
@DbComment("错误消息")
@DbColumn(comment = "错误消息")
private String errorMsg;
/** 客户端IP */

View File

@@ -1,7 +1,13 @@
package cn.bootx.platform.daxpay.service.core.record.close.service;
import cn.bootx.platform.common.core.exception.DataNotExistException;
import cn.bootx.platform.common.core.rest.PageResult;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
import cn.bootx.platform.daxpay.service.core.record.close.dao.PayCloseRecordManager;
import cn.bootx.platform.daxpay.service.core.record.close.entity.PayCloseRecord;
import cn.bootx.platform.daxpay.service.dto.record.close.PayCloseRecordDto;
import cn.bootx.platform.daxpay.service.param.record.PayCloseRecordQuery;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -19,6 +25,24 @@ import org.springframework.transaction.annotation.Transactional;
public class PayCloseRecordService {
private final PayCloseRecordManager manager;
/**
* 根据id查询
*/
public PayCloseRecordDto findById(Long id) {
return manager.findById(id).map(PayCloseRecord::toDto).orElseThrow(DataNotExistException::new);
}
/**
* 分页查询
*/
public PageResult<PayCloseRecordDto> page(PageParam pageParam, PayCloseRecordQuery param){
return MpUtil.convert2DtoPageResult(manager.page(pageParam,param));
}
/**
* 新开事务进行记录保存
*/
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void saveRecord(PayCloseRecord record){
manager.save(record);

View File

@@ -1,23 +0,0 @@
package cn.bootx.platform.daxpay.service.core.record.pay.dao;
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
import java.util.Optional;
/**
* 支付订单
* @author xxm
* @since 2023/12/18
*/
@Slf4j
@Repository
@RequiredArgsConstructor
public class PayOrderManager extends BaseManager<PayOrderMapper, PayOrder> {
public Optional<PayOrder> findByBusinessNo(String businessNo) {
return findByField(PayOrder::getBusinessNo,businessNo);
}
}

View File

@@ -1,5 +1,7 @@
package cn.bootx.platform.daxpay.service.core.record.repair.convert;
import cn.bootx.platform.daxpay.service.core.record.repair.entity.PayRepairRecord;
import cn.bootx.platform.daxpay.service.dto.order.repair.PayRepairRecordDto;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@@ -11,4 +13,6 @@ import org.mapstruct.factory.Mappers;
@Mapper
public interface PayRepairRecordConvert {
PayRepairRecordConvert CONVERT = Mappers.getMapper(PayRepairRecordConvert.class);
PayRepairRecordDto convert(PayRepairRecord in);
}

View File

@@ -1,7 +1,12 @@
package cn.bootx.platform.daxpay.service.core.record.repair.dao;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.mybatisplus.base.MpIdEntity;
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
import cn.bootx.platform.daxpay.service.core.record.repair.entity.PayRepairRecord;
import cn.bootx.platform.daxpay.service.param.record.PayRepairRecordQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
@@ -15,4 +20,14 @@ import org.springframework.stereotype.Repository;
@Repository
@RequiredArgsConstructor
public class PayRepairRecordManager extends BaseManager<PayRepairRecordMapper, PayRepairRecord> {
/**
* 分页
*/
public Page<PayRepairRecord> page(PageParam pageParam, PayRepairRecordQuery param){
Page<PayRepairRecord> mpPage = MpUtil.getMpPage(pageParam, PayRepairRecord.class);
return lambdaQuery()
.orderByDesc(MpIdEntity::getId)
.page(mpPage);
}
}

View File

@@ -1,6 +1,9 @@
package cn.bootx.platform.daxpay.service.core.record.repair.entity;
import cn.bootx.platform.common.core.function.EntityBaseFunction;
import cn.bootx.platform.common.mybatisplus.base.MpCreateEntity;
import cn.bootx.platform.daxpay.service.core.record.repair.convert.PayRepairRecordConvert;
import cn.bootx.platform.daxpay.service.dto.order.repair.PayRepairRecordDto;
import cn.bootx.table.modify.annotation.DbColumn;
import cn.bootx.table.modify.annotation.DbTable;
import com.baomidou.mybatisplus.annotation.TableName;
@@ -18,7 +21,7 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
@TableName("pay_repair_record")
@DbTable(comment = "支付修复记录")
public class PayRepairRecord extends MpCreateEntity {
public class PayRepairRecord extends MpCreateEntity implements EntityBaseFunction<PayRepairRecordDto> {
/** 支付ID */
@DbColumn(comment = "支付ID")
@@ -36,6 +39,10 @@ public class PayRepairRecord extends MpCreateEntity {
@DbColumn(comment = "修复类型")
private String repairType;
/** 修复的异步通道 */
@DbColumn(comment = "修复的异步通道")
private String asyncChannel;
/** 修复前状态 */
@DbColumn(comment = "修复前状态")
private String beforeStatus;
@@ -48,4 +55,11 @@ public class PayRepairRecord extends MpCreateEntity {
@DbColumn(comment = "金额变动")
private Integer amount;
/**
* 转换
*/
@Override
public PayRepairRecordDto toDto() {
return PayRepairRecordConvert.CONVERT.convert(this);
}
}

View File

@@ -1,7 +1,13 @@
package cn.bootx.platform.daxpay.service.core.record.repair.service;
import cn.bootx.platform.common.core.exception.DataNotExistException;
import cn.bootx.platform.common.core.rest.PageResult;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
import cn.bootx.platform.daxpay.service.core.record.repair.dao.PayRepairRecordManager;
import cn.bootx.platform.daxpay.service.core.record.repair.entity.PayRepairRecord;
import cn.bootx.platform.daxpay.service.dto.order.repair.PayRepairRecordDto;
import cn.bootx.platform.daxpay.service.param.record.PayRepairRecordQuery;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -19,6 +25,20 @@ import org.springframework.transaction.annotation.Transactional;
public class PayRepairRecordService {
private final PayRepairRecordManager repairRecordManager;
/**
* 根据id查询
*/
public PayRepairRecordDto findById(Long id) {
return repairRecordManager.findById(id).map(PayRepairRecord::toDto).orElseThrow(DataNotExistException::new);
}
/**
* 分页查询
*/
public PageResult<PayRepairRecordDto> page(PageParam pageParam, PayRepairRecordQuery param){
return MpUtil.convert2DtoPageResult(repairRecordManager.page(pageParam,param));
}
/**
* 保存记录
*/

View File

@@ -5,7 +5,7 @@ import cn.bootx.platform.common.mybatisplus.base.MpIdEntity;
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
import cn.bootx.platform.daxpay.service.core.record.sync.entity.PaySyncRecord;
import cn.bootx.platform.daxpay.service.dto.record.sync.PaySyncRecordDto;
import cn.bootx.platform.daxpay.service.param.record.PaySyncRecordQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -23,7 +23,10 @@ import java.util.Objects;
@RequiredArgsConstructor
public class PaySyncRecordManager extends BaseManager<PaySyncRecordMapper, PaySyncRecord> {
public Page<PaySyncRecord> page(PageParam pageParam, PaySyncRecordDto param) {
/**
* 分页
*/
public Page<PaySyncRecord> page(PageParam pageParam, PaySyncRecordQuery param) {
Page<PaySyncRecord> mpPage = MpUtil.getMpPage(pageParam, PaySyncRecord.class);
return lambdaQuery().orderByDesc(MpIdEntity::getId)
.like(Objects.nonNull(param.getPaymentId()), PaySyncRecord::getPaymentId, param.getPaymentId())

View File

@@ -29,47 +29,47 @@ import lombok.experimental.Accessors;
public class PaySyncRecord extends MpCreateEntity implements EntityBaseFunction<PaySyncRecordDto> {
/** 支付记录id */
@DbComment("支付记录id")
@DbColumn(comment = "支付记录id")
private Long paymentId;
/** 业务号 */
@DbComment("业务号")
@DbColumn(comment = "业务号")
private String businessNo;
/**
* 支付通道
* @see PayChannelEnum#getCode()
*/
@DbComment("支付通道")
@DbColumn(comment = "支付通道")
private String channel;
/** 通知消息 */
@DbMySqlFieldType(MySqlFieldTypeEnum.LONGTEXT)
@DbComment("通知消息")
@DbColumn(comment = "通知消息")
private String syncInfo;
/**
* 网关返回状态
* @see PaySyncStatusEnum
*/
@DbComment("同步状态")
@DbColumn(comment = "同步状态")
private String gatewayStatus;
/**
* 支付单如果状态不一致, 是否进行修复
*/
@DbComment("是否进行修复")
@DbColumn(comment = "是否进行修复")
private boolean repairOrder;
/** 支付单修复前状态 */
@DbComment("支付单修复前状态")
@DbColumn(comment = "支付单修复前状态")
private String oldStatus;
/** 支付单修复后状态 */
@DbComment("支付单修复后状态")
@DbColumn(comment = "支付单修复后状态")
private String repairStatus;
@DbComment("错误消息")
@DbColumn(comment = "错误消息")
private String errorMsg;
/** 客户端IP */

View File

@@ -7,6 +7,7 @@ import cn.bootx.platform.common.mybatisplus.util.MpUtil;
import cn.bootx.platform.daxpay.service.core.record.sync.dao.PaySyncRecordManager;
import cn.bootx.platform.daxpay.service.core.record.sync.entity.PaySyncRecord;
import cn.bootx.platform.daxpay.service.dto.record.sync.PaySyncRecordDto;
import cn.bootx.platform.daxpay.service.param.record.PaySyncRecordQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -25,19 +26,11 @@ import org.springframework.transaction.annotation.Transactional;
public class PaySyncRecordService {
private final PaySyncRecordManager orderManager;
/**
* 记录同步记录 同步支付单的不进行记录
*/
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void saveRecord(PaySyncRecord paySyncRecord){
orderManager.save(paySyncRecord);
}
/**
* 分页查询
*/
public PageResult<PaySyncRecordDto> page(PageParam pageParam, PaySyncRecordDto param) {
Page<PaySyncRecord> page = orderManager.page(pageParam, param);
public PageResult<PaySyncRecordDto> page(PageParam pageParam, PaySyncRecordQuery query) {
Page<PaySyncRecord> page = orderManager.page(pageParam, query);
return MpUtil.convert2DtoPageResult(page);
}
@@ -47,4 +40,13 @@ public class PaySyncRecordService {
public PaySyncRecordDto findById(Long id) {
return orderManager.findById(id).map(PaySyncRecord::toDto).orElseThrow(DataNotExistException::new);
}
/**
* 记录同步记录 同步支付单的不进行记录
*/
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void saveRecord(PaySyncRecord paySyncRecord){
orderManager.save(paySyncRecord);
}
}

View File

@@ -61,6 +61,9 @@ public class PayApiConfig extends MpBaseEntity implements EntityBaseFunction<Pay
@DbColumn(comment = "是否记录请求的信息")
private boolean record;
@DbColumn(comment = "备注")
private String remark;
/**
* 转换
*/

View File

@@ -3,7 +3,7 @@ package cn.bootx.platform.daxpay.service.core.timeout.service;
import cn.bootx.platform.common.core.util.LocalDateTimeUtil;
import cn.bootx.platform.common.spring.exception.RetryableException;
import cn.bootx.platform.daxpay.code.PayStatusEnum;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.timeout.dao.PayExpiredTimeRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

View File

@@ -1,6 +1,6 @@
package cn.bootx.platform.daxpay.service.dto.channel.alipay;
import cn.bootx.platform.daxpay.service.dto.record.pay.PayOrderDto;
import cn.bootx.platform.daxpay.service.dto.order.pay.PayOrderDto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

View File

@@ -1,6 +1,6 @@
package cn.bootx.platform.daxpay.service.dto.channel.voucher;
import cn.bootx.platform.daxpay.service.dto.record.pay.PayOrderDto;
import cn.bootx.platform.daxpay.service.dto.order.pay.PayOrderDto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

View File

@@ -1,6 +1,6 @@
package cn.bootx.platform.daxpay.service.dto.channel.wallet;
import cn.bootx.platform.daxpay.service.dto.record.pay.PayOrderDto;
import cn.bootx.platform.daxpay.service.dto.order.pay.PayOrderDto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

View File

@@ -1,6 +1,6 @@
package cn.bootx.platform.daxpay.service.dto.channel.wechat;
import cn.bootx.platform.daxpay.service.dto.record.pay.PayOrderDto;
import cn.bootx.platform.daxpay.service.dto.order.pay.PayOrderDto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

View File

@@ -0,0 +1,19 @@
package cn.bootx.platform.daxpay.service.dto.order.pay;
import cn.bootx.platform.common.core.rest.dto.BaseDto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 支付订单关联通道信息
* @author xxm
* @since 2024/1/9
*/
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
@Schema(title = "支付订单关联通道信息")
public class PayOrderChannelDto extends BaseDto {
}

View File

@@ -0,0 +1,78 @@
package cn.bootx.platform.daxpay.service.dto.order.pay;
import cn.bootx.platform.common.core.rest.dto.BaseDto;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.code.PayStatusEnum;
import cn.bootx.platform.daxpay.service.common.entity.RefundableInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author xxm
* @since 2021/2/25
*/
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
@Schema(title = "具体支付日志基类")
public class PayOrderDto extends BaseDto {
/** 关联的业务号 */
@Schema(description = "关联的业务号")
private String businessNo;
/** 标题 */
@Schema(description = "标题")
private String title;
/** 是否是异步支付 */
@Schema(description = "是否是异步支付")
private boolean asyncPay;
/** 是否是组合支付 */
@Schema(description = "是否是组合支付")
private boolean combinationPay;
/**
* 异步支付通道
* @see PayChannelEnum#ASYNC_TYPE_CODE
*/
@Schema(description = "异步支付通道")
private String asyncChannel;
/** 金额 */
@Schema(description = "金额")
private Integer amount;
/** 可退款余额 */
@Schema(description = "可退款余额")
private Integer refundableBalance;
/**
* 退款信息列表
* @see RefundableInfo
*/
@Schema(description = "退款信息列表")
private List<RefundableInfo> refundableInfos;
/**
* 支付状态
* @see PayStatusEnum
*/
@Schema(description = "支付状态")
private String status;
/** 支付时间 */
@Schema(description = "支付时间")
private LocalDateTime payTime;
/** 过期时间 */
@Schema(description = "过期时间")
private LocalDateTime expiredTime;
}

View File

@@ -0,0 +1,19 @@
package cn.bootx.platform.daxpay.service.dto.order.pay;
import cn.bootx.platform.common.core.rest.dto.BaseDto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 支付订单扩展信息
* @author xxm
* @since 2024/1/9
*/
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
@Schema(title = "支付订单扩展信息")
public class PayOrderExtraDto extends BaseDto {
}

View File

@@ -1,8 +1,8 @@
package cn.bootx.platform.daxpay.service.dto.record.refund;
package cn.bootx.platform.daxpay.service.dto.order.refund;
import cn.bootx.platform.common.core.rest.dto.BaseDto;
import cn.bootx.platform.daxpay.code.PayRefundStatusEnum;
import cn.bootx.platform.daxpay.service.common.entity.OrderRefundableInfo;
import cn.bootx.platform.daxpay.service.common.entity.RefundableInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -49,7 +49,7 @@ public class PayRefundOrderDto extends BaseDto {
private LocalDateTime refundTime;
@Schema(description = "退款信息列表")
private List<OrderRefundableInfo> refundableInfo;
private List<RefundableInfo> refundableInfo;
/**
* @see PayRefundStatusEnum

View File

@@ -0,0 +1,51 @@
package cn.bootx.platform.daxpay.service.dto.order.repair;
import cn.bootx.platform.common.core.rest.dto.BaseDto;
import cn.bootx.table.modify.annotation.DbColumn;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 支付修复记录
* @author xxm
* @since 2024/1/9
*/
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
@Schema(title = "支付修复记录")
public class PayRepairRecordDto extends BaseDto {
/** 支付ID */
@Schema(description = "支付ID")
private Long paymentId;
/** 业务号 */
@Schema(description = "业务号")
private String businessNo;
/** 修复来源 */
@Schema(description = "修复来源")
private String repairSource;
/** 修复类型 */
@Schema(description = "修复类型")
private String repairType;
@DbColumn(comment = "修复的异步通道")
private String asyncChannel;
/** 修复前状态 */
@Schema(description = "修复前状态")
private String beforeStatus;
/** 修复后状态 */
@Schema(description = "修复后状态")
private String afterStatus;
/** 金额变动 */
@Schema(description = "金额变动")
private Integer amount;
}

View File

@@ -1,11 +1,17 @@
package cn.bootx.platform.daxpay.service.dto.record.callback;
import cn.bootx.platform.common.core.rest.dto.BaseDto;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.code.PayStatusEnum;
import cn.bootx.table.modify.mysql.annotation.DbMySqlFieldType;
import cn.bootx.table.modify.mysql.constants.MySqlFieldTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
/**
* 支付回调记录
* @author xxm
@@ -16,4 +22,41 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
@Schema(title = "回调记录")
public class PayCallbackRecordDto extends BaseDto {
/** 支付记录id */
@Schema(description = "支付记录id")
private Long paymentId;
/**
* 支付通道
* @see PayChannelEnum#getCode()
*/
@Schema(description = "支付通道")
private String payChannel;
/** 通知消息 */
@DbMySqlFieldType(MySqlFieldTypeEnum.LONGTEXT)
@Schema(description = "通知消息")
private String notifyInfo;
/**
* 支付状态
* @see PayStatusEnum
*/
@Schema(description = "支付状态")
private String payStatus;
/**
* 回调处理状态
*/
@Schema(description = "回调处理状态")
private String status;
/** 提示信息 */
@Schema(description = "提示信息")
private String msg;
/** 回调时间 */
@Schema(description = "回调时间")
private LocalDateTime notifyTime;
}

View File

@@ -1,6 +1,8 @@
package cn.bootx.platform.daxpay.service.dto.record.close;
import cn.bootx.platform.common.core.rest.dto.BaseDto;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.table.modify.annotation.DbColumn;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -16,4 +18,37 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
@Schema(title = "支付关闭记录")
public class PayCloseRecordDto extends BaseDto {
/** 支付记录id */
@Schema(description = "支付记录id")
private Long paymentId;
/** 业务号 */
@Schema(description = "业务号")
private String businessNo;
/**
* 关闭的异步支付通道, 可以为空
* @see PayChannelEnum#getCode()
*/
@Schema(description = "关闭的异步支付通道")
private String asyncChannel;
/**
* 是否关闭成功
*/
@Schema(description = "是否关闭成功")
private boolean closed;
/** 错误消息 */
@Schema(description = "错误消息")
private String errorMsg;
/** 客户端IP */
@DbColumn(comment = "客户端IP")
private String clientIp;
/** 请求链路ID */
@DbColumn(comment = "请求链路ID")
private String reqId;
}

View File

@@ -1,47 +0,0 @@
package cn.bootx.platform.daxpay.service.dto.record.pay;
import cn.bootx.platform.common.core.rest.dto.BaseDto;
import cn.bootx.platform.daxpay.code.PayStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* @author xxm
* @since 2021/2/25
*/
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
@Schema(title = "具体支付日志基类")
public class PayOrderDto extends BaseDto {
@Schema(description = "支付id")
private Long paymentId;
@Schema(description = "用户id")
private Long userId;
@Schema(description = "关联的业务id")
private String businessId;
@Schema(description = "金额")
private BigDecimal amount;
@Schema(description = "可退款金额")
private BigDecimal refundableBalance;
/**
* @see PayStatusEnum#getCode()
*/
@Schema(description = "支付状态")
private int payStatus;
@Schema(description = "支付时间")
private LocalDateTime payTime;
}

View File

@@ -3,7 +3,7 @@ package cn.bootx.platform.daxpay.service.dto.record.sync;
import cn.bootx.platform.common.core.rest.dto.BaseDto;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.code.PaySyncStatusEnum;
import cn.bootx.table.modify.annotation.DbComment;
import cn.bootx.table.modify.annotation.DbColumn;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -47,7 +47,7 @@ public class PaySyncRecordDto extends BaseDto {
/**
* 支付单如果状态不一致, 是否修复成功
*/
@DbComment("是否进行修复")
@DbColumn(comment = "是否进行修复")
private boolean repairOrder;
@Schema(description = "错误消息")

View File

@@ -47,4 +47,7 @@ public class PayApiConfigDto extends BaseDto {
@Schema(description = "是否记录请求的信息")
private boolean record;
@Schema(description = "备注")
private String remark;
}

View File

@@ -1,7 +1,7 @@
package cn.bootx.platform.daxpay.service.func;
import cn.bootx.platform.daxpay.service.common.exception.ExceptionInfo;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import lombok.Getter;
import lombok.Setter;

View File

@@ -2,7 +2,7 @@ package cn.bootx.platform.daxpay.service.func;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.service.common.exception.ExceptionInfo;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.param.pay.RefundChannelParam;
import cn.bootx.platform.daxpay.param.pay.RefundParam;
import lombok.Getter;

View File

@@ -1,7 +1,7 @@
package cn.bootx.platform.daxpay.service.func;
import cn.bootx.platform.daxpay.service.code.PayRepairSourceEnum;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import lombok.Getter;
import lombok.Setter;

View File

@@ -2,7 +2,7 @@ package cn.bootx.platform.daxpay.service.func;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.service.common.exception.ExceptionInfo;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.param.pay.PayParam;
import cn.bootx.platform.daxpay.param.pay.PayChannelParam;
import lombok.Getter;

View File

@@ -1,7 +1,7 @@
package cn.bootx.platform.daxpay.service.func;
import cn.bootx.platform.daxpay.code.PaySyncStatusEnum;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.payment.sync.result.GatewaySyncResult;
import lombok.Getter;
import lombok.Setter;

View File

@@ -1,6 +1,6 @@
package cn.bootx.platform.daxpay.service.func;
import cn.bootx.platform.daxpay.service.core.record.pay.entity.PayOrder;
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
import java.util.List;

View File

@@ -0,0 +1,16 @@
package cn.bootx.platform.daxpay.service.param.order;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 支付订单查询参数
* @author xxm
* @since 2024/1/9
*/
@Data
@Accessors(chain = true)
@Schema(title = "支付订单查询参数")
public class PayOrderQuery {
}

Some files were not shown because too many files have changed in this diff Show More