mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-09-09 05:49:04 +00:00
ref 一些逻辑调整
This commit is contained in:
@@ -15,8 +15,10 @@
|
||||
- [x] 三方支付外部订单号规则优化: 支付P、退款R、分账A,根据环境加前缀:DEV_、DEMO_、PRE_
|
||||
- [ ] 金额显示统一使用元
|
||||
- [x] 使用切面统一处理API调用异常, 做统一包装返回
|
||||
- [ ] 合并支付通道和通道配置
|
||||
- [ ] 支付接口优化
|
||||
- [x] 支付接口优化
|
||||
- [ ] 前端增加对应的枚举
|
||||
- [ ] 优化自动分账逻辑
|
||||
- [ ] 前端查询条件适配
|
||||
|
||||
2.0.7: 分账完善和基础架构优化
|
||||
- [ ] 资金流水优化
|
||||
@@ -33,7 +35,7 @@
|
||||
- [ ] 对账回退及退款
|
||||
- [ ] 统计报表功能
|
||||
- [ ] 微信新增V3版本接口
|
||||
- [ ] 付款码支付自动路由到V2接口
|
||||
- [ ] 支付宝新增V3版本接口
|
||||
- [ ] 增加各类日志记录,例如钱包的各项操作
|
||||
- [ ] 增加撤销功能,用于处理线下支付订单的情况
|
||||
- [ ] 数据库表进行规则, 字段设置长度, 增加索引
|
||||
|
@@ -107,7 +107,7 @@ public class CashierService {
|
||||
BeanUtil.copyProperties(payModel, payOrderResult);
|
||||
return payOrderResult;
|
||||
} else {
|
||||
throw new BizException("订单状态异常,无法进行支付");
|
||||
throw new BizException(payModel.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2,7 +2,7 @@ package cn.bootx.platform.daxpay.admin.controller.system;
|
||||
|
||||
import cn.bootx.platform.common.core.rest.Res;
|
||||
import cn.bootx.platform.common.core.rest.ResResult;
|
||||
import cn.bootx.platform.daxpay.service.core.system.payinfo.service.PayWayInfoService;
|
||||
import cn.bootx.platform.daxpay.service.core.system.payinfo.service.PayMethodInfoService;
|
||||
import cn.bootx.platform.daxpay.service.dto.system.payinfo.PayMethodInfoDto;
|
||||
import cn.bootx.platform.daxpay.service.param.system.payinfo.PayWayInfoParam;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -19,27 +19,27 @@ import java.util.List;
|
||||
*/
|
||||
@Tag(name = "支付方式管理")
|
||||
@RestController
|
||||
@RequestMapping("/pay/way/info")
|
||||
@RequestMapping("/pay/method/info")
|
||||
@RequiredArgsConstructor
|
||||
public class PayWayInfoController {
|
||||
private final PayWayInfoService payWayInfoService;
|
||||
public class PayMethodInfoController {
|
||||
private final PayMethodInfoService payMethodInfoService;
|
||||
|
||||
@Operation(summary = "获取全部")
|
||||
@GetMapping("/findAll")
|
||||
public ResResult<List<PayMethodInfoDto>> findAll(){
|
||||
return Res.ok(payWayInfoService.findAll());
|
||||
return Res.ok(payMethodInfoService.findAll());
|
||||
}
|
||||
|
||||
@Operation(summary = "根据ID获取")
|
||||
@GetMapping("/findById")
|
||||
public ResResult<PayMethodInfoDto> findById(Long id){
|
||||
return Res.ok(payWayInfoService.findById(id));
|
||||
return Res.ok(payMethodInfoService.findById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "更新")
|
||||
@PostMapping("/update")
|
||||
public ResResult<Void> update(@RequestBody PayWayInfoParam param){
|
||||
payWayInfoService.update(param);
|
||||
payMethodInfoService.update(param);
|
||||
return Res.ok();
|
||||
}
|
||||
}
|
@@ -134,6 +134,9 @@ public interface WeChatPayCode {
|
||||
/** 退款处理中 */
|
||||
String REFUND_PROCESSING = "PROCESSING";
|
||||
|
||||
/** 退款处理中 */
|
||||
String REFUND_NOTEXIST = "REFUNDNOTEXIST";
|
||||
|
||||
/** 支付失败(刷卡支付) */
|
||||
String TRADE_PAYERROR = "PAYERROR";
|
||||
|
||||
|
@@ -23,7 +23,4 @@ public class ApiInfoLocal {
|
||||
|
||||
/** 请求参数是否签名 */
|
||||
private boolean reqSign;
|
||||
|
||||
/** 响应参数是否签名 */
|
||||
private boolean resSign;
|
||||
}
|
||||
|
@@ -121,6 +121,13 @@ public class WeChatPaySyncService {
|
||||
|
||||
// 设置微信支付网关订单号
|
||||
syncResult.setOutRefundNo(result.get(WeChatPayCode.REFUND_ID));
|
||||
// 返回码
|
||||
String errCode = result.get(WeChatPayCode.ERR_CODE);
|
||||
|
||||
// 退款单不存在
|
||||
if (Objects.equals(errCode, WeChatPayCode.REFUND_NOTEXIST)) {
|
||||
return syncResult.setSyncStatus(RefundSyncStatusEnum.NOT_FOUND);
|
||||
}
|
||||
// 状态
|
||||
String tradeStatus = result.get(WeChatPayCode.REFUND_STATUS);
|
||||
// 退款成功
|
||||
|
@@ -111,7 +111,7 @@ public class PayCloseService {
|
||||
.getClientIp();
|
||||
PayCloseRecord record = new PayCloseRecord()
|
||||
.setOrderNo(payOrder.getOrderNo())
|
||||
.setBizOrderNo(payOrder.getOutOrderNo())
|
||||
.setBizOrderNo(payOrder.getBizOrderNo())
|
||||
.setChannel(payOrder.getChannel())
|
||||
.setClosed(closed)
|
||||
.setErrorMsg(errMsg)
|
||||
|
@@ -50,7 +50,6 @@ public class PaySyncRecord extends MpCreateEntity implements EntityBaseFunction<
|
||||
@DbColumn(comment = "网关返回状态")
|
||||
private String outTradeStatus;
|
||||
|
||||
|
||||
/**
|
||||
* 同步类型 支付/退款
|
||||
* @see PaymentTypeEnum
|
||||
|
@@ -58,9 +58,6 @@ public class PayApiConfig extends MpBaseEntity implements EntityBaseFunction<Pay
|
||||
@DbColumn(comment = "请求参数是否签名")
|
||||
private boolean reqSign;
|
||||
|
||||
@DbColumn(comment = "响应参数是否签名")
|
||||
private boolean resSign;
|
||||
|
||||
@DbColumn(comment = "备注")
|
||||
private String remark;
|
||||
|
||||
|
@@ -4,7 +4,6 @@ import cn.bootx.platform.common.core.function.EntityBaseFunction;
|
||||
import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity;
|
||||
import cn.bootx.platform.daxpay.service.core.system.config.convert.PayChannelConfigConvert;
|
||||
import cn.bootx.platform.daxpay.service.dto.system.config.PayChannelConfigDto;
|
||||
import cn.bootx.platform.daxpay.service.param.system.payinfo.PayChannelInfoParam;
|
||||
import cn.bootx.table.modify.annotation.DbColumn;
|
||||
import cn.bootx.table.modify.annotation.DbTable;
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
@@ -53,10 +52,6 @@ public class PayChannelConfig extends MpBaseEntity implements EntityBaseFunction
|
||||
@DbColumn(comment = "备注")
|
||||
private String remark;
|
||||
|
||||
public static PayChannelConfig init(PayChannelInfoParam in){
|
||||
return PayChannelConfigConvert.CONVERT.convert(in);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换
|
||||
*/
|
||||
|
@@ -58,7 +58,6 @@ public class PayApiConfigService {
|
||||
ApiInfoLocal apiInfoLocal = PaymentContextLocal.get().getApiInfo();
|
||||
apiInfoLocal.setApiCode(api.getCode())
|
||||
.setReqSign(api.isReqSign())
|
||||
.setResSign(api.isResSign())
|
||||
.setNotice(api.isNotice())
|
||||
.setNoticeUrl(api.getNoticeUrl());
|
||||
}
|
||||
|
@@ -1,18 +1,18 @@
|
||||
package cn.bootx.platform.daxpay.service.core.system.payinfo.dao;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.daxpay.service.core.system.payinfo.entity.PayWayInfo;
|
||||
import cn.bootx.platform.daxpay.service.core.system.payinfo.entity.PayMethodInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
*
|
||||
* 支付方式
|
||||
* @author xxm
|
||||
* @since 2024/1/8
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class PayWayInfoManager extends BaseManager<PayWayInfoMapper, PayWayInfo> {
|
||||
public class PayMethodInfoManager extends BaseManager<PayMethodInfoMapper, PayMethodInfo> {
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
package cn.bootx.platform.daxpay.service.core.system.payinfo.dao;
|
||||
|
||||
import cn.bootx.platform.daxpay.service.core.system.payinfo.entity.PayWayInfo;
|
||||
import cn.bootx.platform.daxpay.service.core.system.payinfo.entity.PayMethodInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@@ -10,5 +10,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @since 2024/1/8
|
||||
*/
|
||||
@Mapper
|
||||
public interface PayWayInfoMapper extends BaseMapper<PayWayInfo> {
|
||||
public interface PayMethodInfoMapper extends BaseMapper<PayMethodInfo> {
|
||||
}
|
@@ -2,8 +2,8 @@ package cn.bootx.platform.daxpay.service.core.system.payinfo.service;
|
||||
|
||||
import cn.bootx.platform.common.core.exception.DataNotExistException;
|
||||
import cn.bootx.platform.common.core.util.ResultConvertUtil;
|
||||
import cn.bootx.platform.daxpay.service.core.system.payinfo.dao.PayWayInfoManager;
|
||||
import cn.bootx.platform.daxpay.service.core.system.payinfo.entity.PayWayInfo;
|
||||
import cn.bootx.platform.daxpay.service.core.system.payinfo.dao.PayMethodInfoManager;
|
||||
import cn.bootx.platform.daxpay.service.core.system.payinfo.entity.PayMethodInfo;
|
||||
import cn.bootx.platform.daxpay.service.dto.system.payinfo.PayMethodInfoDto;
|
||||
import cn.bootx.platform.daxpay.service.param.system.payinfo.PayWayInfoParam;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
@@ -23,15 +23,15 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PayWayInfoService {
|
||||
private final PayWayInfoManager manager;
|
||||
public class PayMethodInfoService {
|
||||
private final PayMethodInfoManager manager;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
public List<PayMethodInfoDto> findAll(){
|
||||
return manager.findAll().stream()
|
||||
.map(PayWayInfo::toDto)
|
||||
.map(PayMethodInfo::toDto)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class PayWayInfoService {
|
||||
* 更新
|
||||
*/
|
||||
public void update(PayWayInfoParam param){
|
||||
PayWayInfo info = manager.findById(param.getId()).orElseThrow(DataNotExistException::new);
|
||||
PayMethodInfo info = manager.findById(param.getId()).orElseThrow(DataNotExistException::new);
|
||||
BeanUtil.copyProperties(param,info, CopyOptions.create().ignoreNullValue());
|
||||
manager.updateById(info);
|
||||
}
|
@@ -29,12 +29,6 @@ public class PayApiConfigParam {
|
||||
@Schema(description = "请求参数是否签名")
|
||||
private boolean reqSign;
|
||||
|
||||
@Schema(description = "响应参数是否签名")
|
||||
private boolean resSign;
|
||||
|
||||
@Schema(description = "是否记录请求的信息")
|
||||
private boolean record;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
}
|
||||
|
Reference in New Issue
Block a user