增加系统参数配置相关接口,增加店铺订单支付链接获取接口

This commit is contained in:
谭凯凯 2024-09-27 15:46:22 +08:00 committed by Tankaikai
parent bf735b1a31
commit f739b3b1a6
1 changed files with 1 additions and 9 deletions

View File

@ -3,8 +3,6 @@ package cn.ysk.cashier.controller.shop;
import cn.hutool.core.map.MapProxy; import cn.hutool.core.map.MapProxy;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil; import cn.hutool.core.util.URLUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.ysk.cashier.exception.BadRequestException; import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.system.enums.ParamsEnum; import cn.ysk.cashier.system.enums.ParamsEnum;
import cn.ysk.cashier.system.service.ParamsService; import cn.ysk.cashier.system.service.ParamsService;
@ -14,7 +12,6 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -39,9 +36,6 @@ public class ShopPayApiController {
private final ParamsService paramsService; private final ParamsService paramsService;
@Value("${spring.profiles.active}")
private String env;
@GetMapping("getOrderPayUrl") @GetMapping("getOrderPayUrl")
@ApiOperation("获取店铺订单支付URL") @ApiOperation("获取店铺订单支付URL")
@ApiImplicitParams({ @ApiImplicitParams({
@ -59,9 +53,7 @@ public class ShopPayApiController {
if(StrUtil.isBlank(orderId)){ if(StrUtil.isBlank(orderId)){
throw new BadRequestException("订单id不能为空"); throw new BadRequestException("订单id不能为空");
} }
String text = paramsService.getValue(ParamsEnum.SHOP_ORDER_PAY_BASE_URL.name()); String baseUrl = paramsService.getValue(ParamsEnum.SHOP_ORDER_PAY_BASE_URL.name());
JSONObject config = JSONUtil.parseObj(text);
String baseUrl = config.getStr(env);
String buildUrl = URLUtil.buildQuery(params, Charset.defaultCharset()); String buildUrl = URLUtil.buildQuery(params, Charset.defaultCharset());
String fullUrl = baseUrl.concat("?").concat(buildUrl); String fullUrl = baseUrl.concat("?").concat(buildUrl);
return ResponseEntity.ok().body(fullUrl); return ResponseEntity.ok().body(fullUrl);