扫码支付

This commit is contained in:
2025-03-07 15:39:54 +08:00
parent 196714760d
commit 4e4245ef24
3 changed files with 4 additions and 8 deletions

View File

@@ -171,6 +171,7 @@ public class CzgPayUtils {
// 获取响应体 // 获取响应体
String respStr = resp.body(); String respStr = resp.body();
if (StrUtil.isNotEmpty(respStr)) { if (StrUtil.isNotEmpty(respStr)) {
log.info("超掌柜交易请求响应元数据,{}", respStr);
CzgBaseRespParams respParams = JSONObject.parseObject(respStr, CzgBaseRespParams.class); CzgBaseRespParams respParams = JSONObject.parseObject(respStr, CzgBaseRespParams.class);
log.info("超掌柜交易请求响应,{}", respParams); log.info("超掌柜交易请求响应,{}", respParams);

View File

@@ -709,6 +709,9 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
} else { } else {
orderInfo.setDiscountRatio(BigDecimal.ZERO); orderInfo.setDiscountRatio(BigDecimal.ZERO);
} }
if (orderInfo.getOrderAmount().compareTo(BigDecimal.ZERO) == 0) {
orderInfo.setStatus(OrderStatusEnums.DONE.getCode());
}
saveOrUpdate(orderInfo); saveOrUpdate(orderInfo);
} }

View File

@@ -104,13 +104,6 @@ public class PayServiceImpl implements PayService {
private OrderInfo checkPay(CheckOrderPay checkOrderPay) { private OrderInfo checkPay(CheckOrderPay checkOrderPay) {
OrderInfo orderInfo = orderInfoService.checkOrderPay(checkOrderPay); OrderInfo orderInfo = orderInfoService.checkOrderPay(checkOrderPay);
if (orderInfo.getOrderAmount().compareTo(BigDecimal.ZERO) == 0) { if (orderInfo.getOrderAmount().compareTo(BigDecimal.ZERO) == 0) {
Executor delayedExecutor = CompletableFuture.delayedExecutor(3, TimeUnit.SECONDS);
// 使用延迟的Executor执行一个简单任务
CompletableFuture.runAsync(() -> {
orderInfoService.upOrderInfo(orderInfo, orderInfo.getOrderAmount(),
LocalDateTime.now(), null, PayEnums.CASH_PAY);
redisService.del(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId());
}, delayedExecutor);
throw new PaySuccessException(); throw new PaySuccessException();
} }
return orderInfo; return orderInfo;
@@ -161,7 +154,6 @@ public class PayServiceImpl implements PayService {
@Transactional @Transactional
public CzgResult<Object> cashPayOrder(OrderPayParamDTO payParam) { public CzgResult<Object> cashPayOrder(OrderPayParamDTO payParam) {
OrderInfo orderInfo = checkPay(payParam.getCheckOrderPay()); OrderInfo orderInfo = checkPay(payParam.getCheckOrderPay());
log.info("现金付款:{}", orderInfo);
orderInfoService.upOrderInfo(orderInfo, orderInfo.getOrderAmount(), orderInfoService.upOrderInfo(orderInfo, orderInfo.getOrderAmount(),
LocalDateTime.now(), null, PayEnums.CASH_PAY); LocalDateTime.now(), null, PayEnums.CASH_PAY);
if (orderInfo.getPointsNum() != null && orderInfo.getPointsNum() > 0) { if (orderInfo.getPointsNum() != null && orderInfo.getPointsNum() > 0) {