token 校验

退款
This commit is contained in:
2025-02-28 16:51:39 +08:00
parent 0c8a998006
commit 41686fa3ce
3 changed files with 24 additions and 7 deletions

View File

@@ -121,7 +121,7 @@ public class OrderPayController {
* 获取店铺订单支付URL
*/
@PostMapping("/shopPayApi/orderPayUrl")
public CzgResult<String> getOrderPayUrl(Long shopId, Long orderId, @RequestParam(required = false) String extend,
public CzgResult<String> getOrderPayUrl(@RequestHeader Long shopId, Long orderId, @RequestParam(required = false) String extend,
@RequestParam(required = false) CheckOrderPay checkOrderPay) {
AssertUtil.isNull(shopId, "店铺id不能为空");
AssertUtil.isNull(orderId, "订单Id不能为空");

View File

@@ -64,12 +64,13 @@ public class SaTokenConfigure implements WebMvcConfigurer {
ApplicationInfo.routePrefix = "";
SaRouter.match("/user/**").notMatch("/user/login", "/user/test", "/user/geo/**", "/user/home/**")
.notMatch("/pay/**")
.notMatch("/notify/**")
.check(r -> MyStpLogic.CLIENT_LOGIC.checkLogin())
.setHit(true)
// .match("/**")
.notMatch("/user/**")
.notMatch("/admin/auth/**")
.notMatch("/notify/**")
.check(r -> MyStpLogic.ADMIN_LOGIC.checkLogin());
})).addPathPatterns("/**");

View File

@@ -194,7 +194,7 @@ public class PayServiceImpl implements PayService {
if (payParam.getCheckOrderPay().getOrderId() == null) {
orderInfo = orderInfoService.createPayOrder(payParam.getShopId(), payParam.getCheckOrderPay().getOrderAmount(),
payParam.getCheckOrderPay().getRemark());
}else {
} else {
orderInfo = orderInfoService.getById(payParam.getCheckOrderPay().getOrderId());
}
String payOrderNo = orderInfo.getPlatformType() + IdUtil.getSnowflakeNextId();
@@ -501,7 +501,7 @@ public class PayServiceImpl implements PayService {
.bizEnum(ShopUserFlowBizEnum.ORDER_REFUND)
.build();
shopUserService.updateMoney(orderInfo.getShopId(), shopUserMoneyEditDTO);
} else {
} else if (!orderInfo.getPayType().equals(PayEnums.CASH_PAY.getValue())){
//退款 param.getRefundAmount()
refundOrder(orderInfo.getShopId(), orderInfo.getId(), orderInfo.getPayOrderId(),
refPayOrderNo, param.getRefundReason(), param.getRefundAmount());
@@ -515,9 +515,25 @@ public class PayServiceImpl implements PayService {
if (orderInfo.getRefundAmount().compareTo(orderInfo.getPayAmount()) < 0) {
throw new ValidateException("退单失败,可退金额不足");
}
//退款 refundAmountTotal
refundOrder(orderInfo.getShopId(), orderInfo.getId(), orderInfo.getPayOrderId(),
refPayOrderNo, param.getRefundReason(), refundAmountTotal);
//非现金退款
if (!param.isCash()) {
if (orderInfo.getPayType().equals(PayEnums.VIP_PAY.getValue())) {
ShopUser shopUser = shopUserService.getShopUserInfo(orderInfo.getShopId(), orderInfo.getUserId());
//会员支付 退钱
ShopUserMoneyEditDTO shopUserMoneyEditDTO = ShopUserMoneyEditDTO.builder()
.id(shopUser.getId())
.money(param.getRefundAmount())
.type(1)
.relationId(orderInfo.getId())
.bizEnum(ShopUserFlowBizEnum.ORDER_REFUND)
.build();
shopUserService.updateMoney(orderInfo.getShopId(), shopUserMoneyEditDTO);
} else if (!orderInfo.getPayType().equals(PayEnums.CASH_PAY.getValue())) {
//退款 param.getRefundAmount()
refundOrder(orderInfo.getShopId(), orderInfo.getId(), orderInfo.getPayOrderId(),
refPayOrderNo, param.getRefundReason(), param.getRefundAmount());
}
}
}
} else {
orderInfo.setOrderAmount(orderInfo.getOrderAmount().subtract(refundAmountTotal));