Merge branch 'tkk' into test

This commit is contained in:
Tankaikai 2024-09-27 15:56:17 +08:00
commit 408209950b
1 changed files with 8 additions and 8 deletions

View File

@ -31,7 +31,7 @@ import java.util.Map;
@RestController
@RequiredArgsConstructor
@Api(tags = "店铺支付相关接口")
@RequestMapping("/api/shop-pay-api")
@RequestMapping(value = {"/api/shop-pay-api", "/api/shopPayApi"})
public class ShopPayApiController {
private final ParamsService paramsService;
@ -39,28 +39,28 @@ public class ShopPayApiController {
@GetMapping("getOrderPayUrl")
@ApiOperation("获取店铺订单支付URL")
@ApiImplicitParams({
@ApiImplicitParam(name = "orderId", value = "订单id", paramType = "query", required = true, dataType="String") ,
@ApiImplicitParam(name = "shopId", value = "店铺id", paramType = "query",required = true, dataType="String") ,
@ApiImplicitParam(name = "orderId", value = "订单id", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "shopId", value = "店铺id", paramType = "query", required = true, dataType = "String"),
})
public ResponseEntity url(@RequestParam Map<String, Object> params) {
MapProxy mapProxy = MapProxy.create(params);
String shopId = mapProxy.getStr("shopId");
String orderId = mapProxy.getStr("orderId");
try {
if(StrUtil.isBlank(shopId)){
if (StrUtil.isBlank(shopId)) {
throw new BadRequestException("店铺id不能为空");
}
if(StrUtil.isBlank(orderId)){
if (StrUtil.isBlank(orderId)) {
throw new BadRequestException("订单id不能为空");
}
String baseUrl = paramsService.getValue(ParamsEnum.SHOP_ORDER_PAY_BASE_URL.name());
String buildUrl = URLUtil.buildQuery(params, Charset.defaultCharset());
String fullUrl = baseUrl.concat("?").concat(buildUrl);
return ResponseEntity.ok().body(fullUrl);
}catch (BadRequestException e){
} catch (BadRequestException e) {
return ResponseEntity.badRequest().body(e.getMessage());
}catch (Exception e){
log.error("获取店铺订单支付URL异常",e);
} catch (Exception e) {
log.error("获取店铺订单支付URL异常", e);
return ResponseEntity.ok().body("获取店铺订单支付URL异常");
}
}