token 校验
退款
This commit is contained in:
@@ -121,7 +121,7 @@ public class OrderPayController {
|
|||||||
* 获取店铺订单支付URL
|
* 获取店铺订单支付URL
|
||||||
*/
|
*/
|
||||||
@PostMapping("/shopPayApi/orderPayUrl")
|
@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) {
|
@RequestParam(required = false) CheckOrderPay checkOrderPay) {
|
||||||
AssertUtil.isNull(shopId, "店铺id不能为空");
|
AssertUtil.isNull(shopId, "店铺id不能为空");
|
||||||
AssertUtil.isNull(orderId, "订单Id不能为空");
|
AssertUtil.isNull(orderId, "订单Id不能为空");
|
||||||
|
|||||||
@@ -64,12 +64,13 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
|||||||
ApplicationInfo.routePrefix = "";
|
ApplicationInfo.routePrefix = "";
|
||||||
|
|
||||||
SaRouter.match("/user/**").notMatch("/user/login", "/user/test", "/user/geo/**", "/user/home/**")
|
SaRouter.match("/user/**").notMatch("/user/login", "/user/test", "/user/geo/**", "/user/home/**")
|
||||||
|
.notMatch("/pay/**")
|
||||||
|
.notMatch("/notify/**")
|
||||||
.check(r -> MyStpLogic.CLIENT_LOGIC.checkLogin())
|
.check(r -> MyStpLogic.CLIENT_LOGIC.checkLogin())
|
||||||
.setHit(true)
|
.setHit(true)
|
||||||
// .match("/**")
|
// .match("/**")
|
||||||
.notMatch("/user/**")
|
.notMatch("/user/**")
|
||||||
.notMatch("/admin/auth/**")
|
.notMatch("/admin/auth/**")
|
||||||
.notMatch("/notify/**")
|
|
||||||
.check(r -> MyStpLogic.ADMIN_LOGIC.checkLogin());
|
.check(r -> MyStpLogic.ADMIN_LOGIC.checkLogin());
|
||||||
|
|
||||||
})).addPathPatterns("/**");
|
})).addPathPatterns("/**");
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ public class PayServiceImpl implements PayService {
|
|||||||
if (payParam.getCheckOrderPay().getOrderId() == null) {
|
if (payParam.getCheckOrderPay().getOrderId() == null) {
|
||||||
orderInfo = orderInfoService.createPayOrder(payParam.getShopId(), payParam.getCheckOrderPay().getOrderAmount(),
|
orderInfo = orderInfoService.createPayOrder(payParam.getShopId(), payParam.getCheckOrderPay().getOrderAmount(),
|
||||||
payParam.getCheckOrderPay().getRemark());
|
payParam.getCheckOrderPay().getRemark());
|
||||||
}else {
|
} else {
|
||||||
orderInfo = orderInfoService.getById(payParam.getCheckOrderPay().getOrderId());
|
orderInfo = orderInfoService.getById(payParam.getCheckOrderPay().getOrderId());
|
||||||
}
|
}
|
||||||
String payOrderNo = orderInfo.getPlatformType() + IdUtil.getSnowflakeNextId();
|
String payOrderNo = orderInfo.getPlatformType() + IdUtil.getSnowflakeNextId();
|
||||||
@@ -501,7 +501,7 @@ public class PayServiceImpl implements PayService {
|
|||||||
.bizEnum(ShopUserFlowBizEnum.ORDER_REFUND)
|
.bizEnum(ShopUserFlowBizEnum.ORDER_REFUND)
|
||||||
.build();
|
.build();
|
||||||
shopUserService.updateMoney(orderInfo.getShopId(), shopUserMoneyEditDTO);
|
shopUserService.updateMoney(orderInfo.getShopId(), shopUserMoneyEditDTO);
|
||||||
} else {
|
} else if (!orderInfo.getPayType().equals(PayEnums.CASH_PAY.getValue())){
|
||||||
//退款 param.getRefundAmount()
|
//退款 param.getRefundAmount()
|
||||||
refundOrder(orderInfo.getShopId(), orderInfo.getId(), orderInfo.getPayOrderId(),
|
refundOrder(orderInfo.getShopId(), orderInfo.getId(), orderInfo.getPayOrderId(),
|
||||||
refPayOrderNo, param.getRefundReason(), param.getRefundAmount());
|
refPayOrderNo, param.getRefundReason(), param.getRefundAmount());
|
||||||
@@ -515,9 +515,25 @@ public class PayServiceImpl implements PayService {
|
|||||||
if (orderInfo.getRefundAmount().compareTo(orderInfo.getPayAmount()) < 0) {
|
if (orderInfo.getRefundAmount().compareTo(orderInfo.getPayAmount()) < 0) {
|
||||||
throw new ValidateException("退单失败,可退金额不足");
|
throw new ValidateException("退单失败,可退金额不足");
|
||||||
}
|
}
|
||||||
//退款 refundAmountTotal
|
//非现金退款
|
||||||
refundOrder(orderInfo.getShopId(), orderInfo.getId(), orderInfo.getPayOrderId(),
|
if (!param.isCash()) {
|
||||||
refPayOrderNo, param.getRefundReason(), refundAmountTotal);
|
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 {
|
} else {
|
||||||
orderInfo.setOrderAmount(orderInfo.getOrderAmount().subtract(refundAmountTotal));
|
orderInfo.setOrderAmount(orderInfo.getOrderAmount().subtract(refundAmountTotal));
|
||||||
|
|||||||
Reference in New Issue
Block a user