perf 一些微调

This commit is contained in:
DaxPay
2024-06-26 19:43:37 +08:00
parent 5c274aa293
commit 3770a85a78
8 changed files with 15 additions and 7 deletions

View File

@@ -16,9 +16,9 @@ import java.util.List;
@AllArgsConstructor
public enum AllocReceiverTypeEnum {
/** 个人 */
WX_PERSONAL("wx_personal", "个人"),
WX_PERSONAL("wx_personal", "openId"),
/** 商户 */
WX_MERCHANT("wx_merchant", "商户"),
WX_MERCHANT("wx_merchant", "商户"),
/** userId 以2088开头的纯16位数字 */
ALI_USER_ID("ali_user_id", "用户ID"),

View File

@@ -18,6 +18,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.List;
/**
@@ -67,6 +68,7 @@ public class AllocationReceiverController {
@Operation(summary = "添加")
@PostMapping("/add")
public ResResult<Void> add(@RequestBody AllocReceiverAddParam param){
param.setReqTime(LocalDateTime.now());
ValidationUtil.validateParam(param);
receiverService.addAndSync(param);
return Res.ok();
@@ -76,6 +78,7 @@ public class AllocationReceiverController {
@Operation(summary = "删除")
@PostMapping("/delete")
public ResResult<Void> delete(@RequestBody AllocReceiverRemoveParam param){
param.setReqTime(LocalDateTime.now());
ValidationUtil.validateParam(param);
receiverService.remove(param);
return Res.ok();

View File

@@ -19,7 +19,7 @@ public enum AllocReceiverTypeEnum {
/** 个人 */
WX_PERSONAL("wx_personal","PERSONAL_OPENID", "个人"),
/** 商户 */
WX_MERCHANT("wx_merchant","MERCHANT_ID", "商户"),
WX_MERCHANT("wx_merchant","MERCHANT_ID", "商户"),
/** userId 以2088开头的纯16位数字 */
ALI_USER_ID("ali_user_id","userId", "用户ID"),

View File

@@ -157,7 +157,7 @@ public class AliPayCallbackService {
public void resolveRefundData() {
CallbackLocal callback = PaymentContextLocal.get().getCallbackInfo();
Map<String, String> callbackParam = callback.getCallbackParam();
// 退款订单Id
// 退款订单
callback.setTradeNo(callbackParam.get(OUT_BIZ_NO));
// 退款状态
callback.setOutStatus(callbackParam.get(TRADE_STATUS));

View File

@@ -122,7 +122,7 @@ public class AliPayCloseService {
}
// 其他状态
else {
throw new TradeStatusErrorException("当前交易状态不支持关闭操作, 请对订单同步状态后再进行操作");
throw new TradeStatusErrorException("当前交易无法关闭操作, 请对订单同步状态后再进行操作");
}
}
}

View File

@@ -31,7 +31,7 @@ public class ClientNoticeRecord extends MpCreateEntity implements EntityBaseFunc
private Long taskId;
/** 请求次数 */
@DbColumn(comment = "请求次数", length = 3, isNull = false)
@DbColumn(comment = "请求次数", length = 3)
private Integer reqCount;
/** 发送是否成功 */

View File

@@ -38,7 +38,7 @@ public class AliPayAllocationReceiverStrategy extends AbsAllocationReceiverStrat
*/
@Override
public String getChannel() {
return PayChannelEnum.WECHAT.getCode();
return PayChannelEnum.ALI.getCode();
}
/**

View File

@@ -3,6 +3,7 @@ package cn.daxpay.single.service.core.payment.close.service;
import cn.bootx.platform.common.core.exception.RepetitiveOperationException;
import cn.daxpay.single.core.code.PayStatusEnum;
import cn.daxpay.single.core.exception.OperationFailException;
import cn.daxpay.single.core.exception.PayFailureException;
import cn.daxpay.single.core.exception.TradeNotExistException;
import cn.daxpay.single.core.exception.TradeStatusErrorException;
import cn.daxpay.single.core.param.payment.pay.PayCloseParam;
@@ -85,6 +86,10 @@ public class PayCloseService {
log.error("关闭订单失败:", e);
// 记录关闭失败的记录
this.saveRecord(payOrder, false, e.getMessage());
result.setCode(1).setMsg(e.getMessage());
if (e instanceof PayFailureException){
throw e;
}
throw new OperationFailException("关闭订单失败");
}
}