|
@@ -184,7 +184,7 @@ public class OrderController {
|
|
|
|
|
|
|
|
OrderDon orderDon = orderDonService.submit(payRequest);
|
|
OrderDon orderDon = orderDonService.submit(payRequest);
|
|
|
|
|
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult(orderDon);
|
|
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(hideOrderId(orderDon));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -206,30 +206,33 @@ public class OrderController {
|
|
|
|
|
|
|
|
UpgradeOrderDon orderDon = orderDonService.submitUpgrade(payRequest);
|
|
UpgradeOrderDon orderDon = orderDonService.submitUpgrade(payRequest);
|
|
|
|
|
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult(orderDon);
|
|
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(hideOrderId(orderDon));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 0元订单确认
|
|
|
|
|
- */
|
|
|
|
|
- @PostMapping("/post/order/status/{orderId}")
|
|
|
|
|
|
|
+ /*
|
|
|
|
|
+ * 0元订单确认 / 套餐0元订单确认 —— 已停用(2026-10-23)
|
|
|
|
|
+ * 前端(web-yinhe2 源码、dist、后台)均无调用; 0元订单在下单时已直接完成:
|
|
|
|
|
+ * OrderDonServiceImpl.submit / submitUpgrade 中 money == 0 时调用 unifiedHandler*OrderNotify。
|
|
|
|
|
+ * service 层 zeroOrderConfirm / zeroUpgradeOrderConfirm 保留未删, 如需恢复取消下面注释即可。
|
|
|
|
|
+ *
|
|
|
|
|
+ @PostMapping("/post/order/status/{orderNo}")
|
|
|
@Deprecated
|
|
@Deprecated
|
|
|
- public Result<String> zeroOrderConfirm(@PathVariable Long orderId) {
|
|
|
|
|
|
|
+ public Result<String> zeroOrderConfirm(@PathVariable String orderNo) {
|
|
|
|
|
+ Long orderId = resolveOrderId(orderNo);
|
|
|
authorizePayment(orderId, false);
|
|
authorizePayment(orderId, false);
|
|
|
orderDonService.zeroOrderConfirm(orderId);
|
|
orderDonService.zeroOrderConfirm(orderId);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 套餐0元订单确认
|
|
|
|
|
- */
|
|
|
|
|
- @PostMapping("/post/upgrade/order/status/{orderId}")
|
|
|
|
|
|
|
+ @PostMapping("/post/upgrade/order/status/{orderNo}")
|
|
|
@Deprecated
|
|
@Deprecated
|
|
|
- public Result<String> zeroUpgradeOrderConfirm(@PathVariable Long orderId) {
|
|
|
|
|
|
|
+ public Result<String> zeroUpgradeOrderConfirm(@PathVariable String orderNo) {
|
|
|
|
|
+ Long orderId = resolveUpgradeOrderId(orderNo);
|
|
|
authorizePayment(orderId, true);
|
|
authorizePayment(orderId, true);
|
|
|
orderDonService.zeroUpgradeOrderConfirm(orderId);
|
|
orderDonService.zeroUpgradeOrderConfirm(orderId);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
|
|
|
+ */
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -251,6 +254,56 @@ public class OrderController {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 用户端只认订单号, 不再接收/返回订单 id(防止按自增 id 遍历)
|
|
|
|
|
+ */
|
|
|
|
|
+ private static final java.util.regex.Pattern ORDER_NO_PATTERN = java.util.regex.Pattern.compile("^[0-9A-Za-z_-]{1,64}$");
|
|
|
|
|
+
|
|
|
|
|
+ private static final String ORDER_NOT_FOUND = "订单不存在或无权操作";
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 订单号 -> 订单 id; 只做映射, 归属校验仍由各接口原有逻辑负责
|
|
|
|
|
+ */
|
|
|
|
|
+ private Long resolveOrderId(String orderNo) {
|
|
|
|
|
+ String no = StrUtil.trim(orderNo);
|
|
|
|
|
+ if (StrUtil.isEmpty(no) || !ORDER_NO_PATTERN.matcher(no).matches()) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance(ORDER_NOT_FOUND);
|
|
|
|
|
+ }
|
|
|
|
|
+ OrderDon order = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
|
|
+ .select(OrderDon::getId)
|
|
|
|
|
+ .eq(OrderDon::getOrderNo, no)
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ if (order == null) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance(ORDER_NOT_FOUND);
|
|
|
|
|
+ }
|
|
|
|
|
+ return order.getId();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 套餐订单号 -> 套餐订单 id
|
|
|
|
|
+ */
|
|
|
|
|
+ private Long resolveUpgradeOrderId(String orderNo) {
|
|
|
|
|
+ String no = StrUtil.trim(orderNo);
|
|
|
|
|
+ if (StrUtil.isEmpty(no) || !ORDER_NO_PATTERN.matcher(no).matches()) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance(ORDER_NOT_FOUND);
|
|
|
|
|
+ }
|
|
|
|
|
+ UpgradeOrderDon order = paymentUpgradeMapper.selectOne(Wrappers.lambdaQuery(UpgradeOrderDon.class)
|
|
|
|
|
+ .select(UpgradeOrderDon::getId)
|
|
|
|
|
+ .eq(UpgradeOrderDon::getOrderNo, no)
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ if (order == null) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance(ORDER_NOT_FOUND);
|
|
|
|
|
+ }
|
|
|
|
|
+ return order.getId();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 下单接口返回前去掉订单 id, 前端用 orderNo(返回副本, 不改原对象)
|
|
|
|
|
+ */
|
|
|
|
|
+ private static <T extends BaseEntity> T hideOrderId(T order) {
|
|
|
|
|
+ return com.cyksj.web.util.OrderIdHider.hide(order);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@FunctionalInterface
|
|
@FunctionalInterface
|
|
|
private interface PaymentCall<T> { T run() throws Exception; }
|
|
private interface PaymentCall<T> { T run() throws Exception; }
|
|
|
|
|
|
|
@@ -286,8 +339,9 @@ public class OrderController {
|
|
|
throw BusinessRuntimeException.getInstance("支付请求过于频繁,请稍后重试");
|
|
throw BusinessRuntimeException.getInstance("支付请求过于频繁,请稍后重试");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @PostMapping("/post/pay/{orderId}")
|
|
|
|
|
- public Result<H5JsPayParams> pay(@PathVariable Long orderId) throws Exception {
|
|
|
|
|
|
|
+ @PostMapping("/post/pay/{orderNo}")
|
|
|
|
|
+ public Result<H5JsPayParams> pay(@PathVariable String orderNo) throws Exception {
|
|
|
|
|
+ Long orderId = resolveOrderId(orderNo);
|
|
|
authorizePayment(orderId, false);
|
|
authorizePayment(orderId, false);
|
|
|
final String methodName = "吊起微信支付";
|
|
final String methodName = "吊起微信支付";
|
|
|
log.info("{}[start] orderId:{}",methodName,orderId);
|
|
log.info("{}[start] orderId:{}",methodName,orderId);
|
|
@@ -301,8 +355,9 @@ public class OrderController {
|
|
|
* 调用生成订单之后
|
|
* 调用生成订单之后
|
|
|
* 微信网页预下单获取交易链接生成二维码
|
|
* 微信网页预下单获取交易链接生成二维码
|
|
|
*/
|
|
*/
|
|
|
- @PostMapping("/get/wx/orderQrCode/{orderId}")
|
|
|
|
|
- public Result<String> createUnifiedOrderQr(@PathVariable Long orderId) throws Exception {
|
|
|
|
|
|
|
+ @PostMapping("/get/wx/orderQrCode/{orderNo}")
|
|
|
|
|
+ public Result<String> createUnifiedOrderQr(@PathVariable String orderNo) throws Exception {
|
|
|
|
|
+ Long orderId = resolveOrderId(orderNo);
|
|
|
authorizePayment(orderId, false);
|
|
authorizePayment(orderId, false);
|
|
|
//预下单
|
|
//预下单
|
|
|
H5JsPayParams payParams = invokePayment(orderId, () -> orderDonService.wxPcWebPay(orderId, "NATIVE"));
|
|
H5JsPayParams payParams = invokePayment(orderId, () -> orderDonService.wxPcWebPay(orderId, "NATIVE"));
|
|
@@ -385,7 +440,8 @@ public class OrderController {
|
|
|
* 手机支付
|
|
* 手机支付
|
|
|
*/
|
|
*/
|
|
|
@PostMapping("/post/pay/zfb")
|
|
@PostMapping("/post/pay/zfb")
|
|
|
- public Result<String> aliPay(@RequestBody @Validated AlipayOrderDonReq re) throws Exception {
|
|
|
|
|
|
|
+ public Result<String> aliPay(@RequestBody AlipayOrderDonReq re) throws Exception {
|
|
|
|
|
+ re.setOrderId(resolveOrderId(re.getOrderNo()));
|
|
|
authorizePayment(re.getOrderId(), false);
|
|
authorizePayment(re.getOrderId(), false);
|
|
|
AliPayParams aliPayParams = invokePayment(re.getOrderId(), () -> orderDonService.aliPay(re, ZfbProductCode.MOBILE_WEB.getProductCode(), null));
|
|
AliPayParams aliPayParams = invokePayment(re.getOrderId(), () -> orderDonService.aliPay(re, ZfbProductCode.MOBILE_WEB.getProductCode(), null));
|
|
|
// response.setContentType("text/html;charset=" + BaseZfbConfig.charset);
|
|
// response.setContentType("text/html;charset=" + BaseZfbConfig.charset);
|
|
@@ -400,7 +456,8 @@ public class OrderController {
|
|
|
* 套餐支付宝支付
|
|
* 套餐支付宝支付
|
|
|
*/
|
|
*/
|
|
|
@PostMapping("/post/pay/upgrade/zfb")
|
|
@PostMapping("/post/pay/upgrade/zfb")
|
|
|
- public Result<String> aliPayUpgrade(@RequestBody @Validated AlipayOrderDonReq re) throws Exception {
|
|
|
|
|
|
|
+ public Result<String> aliPayUpgrade(@RequestBody AlipayOrderDonReq re) throws Exception {
|
|
|
|
|
+ re.setOrderId(resolveUpgradeOrderId(re.getOrderNo()));
|
|
|
authorizePayment(re.getOrderId(), true);
|
|
authorizePayment(re.getOrderId(), true);
|
|
|
AliPayParams aliPayParams = invokePayment(re.getOrderId(), () -> orderDonService.aliPayUpgrade(re, ZfbProductCode.MOBILE_WEB.getProductCode(),null));
|
|
AliPayParams aliPayParams = invokePayment(re.getOrderId(), () -> orderDonService.aliPayUpgrade(re, ZfbProductCode.MOBILE_WEB.getProductCode(),null));
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(aliPayParams.getBody());
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(aliPayParams.getBody());
|
|
@@ -412,7 +469,8 @@ public class OrderController {
|
|
|
* pc网页内嵌二维码
|
|
* pc网页内嵌二维码
|
|
|
*/
|
|
*/
|
|
|
@PostMapping("/get/zfb/orderQrCode")
|
|
@PostMapping("/get/zfb/orderQrCode")
|
|
|
- public Result<String> zfbWebQrCode(@RequestBody @Validated AlipayOrderDonReq re) throws Exception {
|
|
|
|
|
|
|
+ public Result<String> zfbWebQrCode(@RequestBody AlipayOrderDonReq re) throws Exception {
|
|
|
|
|
+ re.setOrderId(resolveOrderId(re.getOrderNo()));
|
|
|
authorizePayment(re.getOrderId(), false);
|
|
authorizePayment(re.getOrderId(), false);
|
|
|
AliPayParams aliPayParams = invokePayment(re.getOrderId(), () -> orderDonService.aliPay(re, ZfbProductCode.PC_WEB.getProductCode(), BaseZfbConfig.qrPayMode_orderCode));
|
|
AliPayParams aliPayParams = invokePayment(re.getOrderId(), () -> orderDonService.aliPay(re, ZfbProductCode.PC_WEB.getProductCode(), BaseZfbConfig.qrPayMode_orderCode));
|
|
|
// response.setContentType("text/html;charset=" + BaseZfbConfig.charset);
|
|
// response.setContentType("text/html;charset=" + BaseZfbConfig.charset);
|
|
@@ -428,7 +486,8 @@ public class OrderController {
|
|
|
* pc网页内嵌二维码
|
|
* pc网页内嵌二维码
|
|
|
*/
|
|
*/
|
|
|
@PostMapping("/get/zfb/upgrade/orderQrCode")
|
|
@PostMapping("/get/zfb/upgrade/orderQrCode")
|
|
|
- public Result<String> zfbWebQrCodeUpgrade(@RequestBody @Validated AlipayOrderDonReq re) throws Exception {
|
|
|
|
|
|
|
+ public Result<String> zfbWebQrCodeUpgrade(@RequestBody AlipayOrderDonReq re) throws Exception {
|
|
|
|
|
+ re.setOrderId(resolveUpgradeOrderId(re.getOrderNo()));
|
|
|
authorizePayment(re.getOrderId(), true);
|
|
authorizePayment(re.getOrderId(), true);
|
|
|
AliPayParams aliPayParams = invokePayment(re.getOrderId(), () -> orderDonService.aliPayUpgrade(re, ZfbProductCode.PC_WEB.getProductCode(), BaseZfbConfig.qrPayMode_orderCode));
|
|
AliPayParams aliPayParams = invokePayment(re.getOrderId(), () -> orderDonService.aliPayUpgrade(re, ZfbProductCode.PC_WEB.getProductCode(), BaseZfbConfig.qrPayMode_orderCode));
|
|
|
// response.setContentType("text/html;charset=" + BaseZfbConfig.charset);
|
|
// response.setContentType("text/html;charset=" + BaseZfbConfig.charset);
|
|
@@ -444,7 +503,8 @@ public class OrderController {
|
|
|
* pc网页跳转二维码
|
|
* pc网页跳转二维码
|
|
|
*/
|
|
*/
|
|
|
@PostMapping("/get/zfb/orderRedirect")
|
|
@PostMapping("/get/zfb/orderRedirect")
|
|
|
- public Result<String> zfbWebRedirectQrCode(@RequestBody @Validated AlipayOrderDonReq re) throws Exception {
|
|
|
|
|
|
|
+ public Result<String> zfbWebRedirectQrCode(@RequestBody AlipayOrderDonReq re) throws Exception {
|
|
|
|
|
+ re.setOrderId(resolveOrderId(re.getOrderNo()));
|
|
|
authorizePayment(re.getOrderId(), false);
|
|
authorizePayment(re.getOrderId(), false);
|
|
|
AliPayParams aliPayParams = invokePayment(re.getOrderId(), () -> orderDonService.aliPay(re, ZfbProductCode.PC_WEB.getProductCode(), BaseZfbConfig.qrPayMode_redirect));
|
|
AliPayParams aliPayParams = invokePayment(re.getOrderId(), () -> orderDonService.aliPay(re, ZfbProductCode.PC_WEB.getProductCode(), BaseZfbConfig.qrPayMode_redirect));
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(aliPayParams.getBody());
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(aliPayParams.getBody());
|
|
@@ -578,11 +638,11 @@ public class OrderController {
|
|
|
/**
|
|
/**
|
|
|
* 获取订单详情
|
|
* 获取订单详情
|
|
|
*/
|
|
*/
|
|
|
- @GetMapping("/get/{orderId}")
|
|
|
|
|
- public Result<OrderDetailView> detail(@PathVariable Long orderId, Boolean isNoLogin) {
|
|
|
|
|
|
|
+ @GetMapping("/get/{orderNo}")
|
|
|
|
|
+ public Result<OrderDetailView> detail(@PathVariable String orderNo, Boolean isNoLogin) {
|
|
|
Long userId = StpUserUtil.getLoginIdAsLong();
|
|
Long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
|
|
|
|
|
- OrderDetailView detail = orderDonService.getDetail(orderId, userId);
|
|
|
|
|
|
|
+ OrderDetailView detail = orderDonService.getDetail(resolveOrderId(orderNo), userId);
|
|
|
|
|
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(detail);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(detail);
|
|
|
}
|
|
}
|
|
@@ -590,19 +650,17 @@ public class OrderController {
|
|
|
/**
|
|
/**
|
|
|
* 取消订单
|
|
* 取消订单
|
|
|
*/
|
|
*/
|
|
|
- @GetMapping("/get/close/{orderId}")
|
|
|
|
|
- public Result<String> closeOrder(@PathVariable Long orderId) {
|
|
|
|
|
|
|
+ @GetMapping("/get/close/{orderNo}")
|
|
|
|
|
+ public Result<String> closeOrder(@PathVariable String orderNo) {
|
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
- orderDonService.closeOrder(orderId, userId);
|
|
|
|
|
|
|
+ orderDonService.closeOrder(resolveOrderId(orderNo), userId);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @GetMapping("/get/order/status/{orderId}")
|
|
|
|
|
- public Result<OrderDonSearchView> getOrderStatusById(@PathVariable Long orderId) {
|
|
|
|
|
|
|
+ @GetMapping("/get/order/status/{orderNo}")
|
|
|
|
|
+ public Result<OrderDonSearchView> getOrderStatusById(@PathVariable String orderNo) {
|
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
- if (orderId < 1) {
|
|
|
|
|
- throw BusinessRuntimeException.getInstance("订单不存在");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Long orderId = resolveOrderId(orderNo);
|
|
|
OrderDonSearchView orderDonView = beanSearcher.searchFirst(OrderDonSearchView.class, MapUtils.builder()
|
|
OrderDonSearchView orderDonView = beanSearcher.searchFirst(OrderDonSearchView.class, MapUtils.builder()
|
|
|
.put("orderId", String.format("where id = %s and user_id = %s", orderId, userId))
|
|
.put("orderId", String.format("where id = %s and user_id = %s", orderId, userId))
|
|
|
.build());
|
|
.build());
|
|
@@ -640,12 +698,10 @@ public class OrderController {
|
|
|
/**
|
|
/**
|
|
|
* 查询套餐订单支付状态
|
|
* 查询套餐订单支付状态
|
|
|
*/
|
|
*/
|
|
|
- @GetMapping("/get/upgrade/order/status/{orderId}")
|
|
|
|
|
- public Result<UpgradeOrderDonSearchView> getUpgradeOrderStatusById(@PathVariable Long orderId) {
|
|
|
|
|
|
|
+ @GetMapping("/get/upgrade/order/status/{orderNo}")
|
|
|
|
|
+ public Result<UpgradeOrderDonSearchView> getUpgradeOrderStatusById(@PathVariable String orderNo) {
|
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
- if (orderId < 1) {
|
|
|
|
|
- throw BusinessRuntimeException.getInstance("订单不存在");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Long orderId = resolveUpgradeOrderId(orderNo);
|
|
|
UpgradeOrderDonSearchView orderDonView = beanSearcher.searchFirst(UpgradeOrderDonSearchView.class, MapUtils.builder()
|
|
UpgradeOrderDonSearchView orderDonView = beanSearcher.searchFirst(UpgradeOrderDonSearchView.class, MapUtils.builder()
|
|
|
.put("orderId", String.format("where id = %s and user_id = %s", orderId, userId))
|
|
.put("orderId", String.format("where id = %s and user_id = %s", orderId, userId))
|
|
|
.build());
|
|
.build());
|
|
@@ -655,10 +711,28 @@ public class OrderController {
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(orderDonView);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(orderDonView);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 按订单号批量查询订单
|
|
|
|
|
+ * 原来免登录 + 按 id 查任意订单(可遍历全站订单), 现改为: 必须登录, 按订单号查, 只返回本人(含绑定账号)的订单
|
|
|
|
|
+ */
|
|
|
@PostMapping("/get/noLogin/order")
|
|
@PostMapping("/get/noLogin/order")
|
|
|
- public Result<List<OrderDonView>> getSearchResult(@RequestBody List<Long> orderIds) {
|
|
|
|
|
|
|
+ public Result<List<OrderDonView>> getSearchResult(@RequestBody List<String> orderNos) {
|
|
|
|
|
+ long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
|
|
+ List<String> nos = orderNos == null ? Collections.emptyList() : orderNos.stream()
|
|
|
|
|
+ .map(StrUtil::trim)
|
|
|
|
|
+ .filter(no -> StrUtil.isNotEmpty(no) && ORDER_NO_PATTERN.matcher(no).matches())
|
|
|
|
|
+ .distinct()
|
|
|
|
|
+ .limit(50)
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ List<Long> userIds = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
|
|
+ if (nos.isEmpty() || CollUtil.isEmpty(userIds)) {
|
|
|
|
|
+ // 声明为 List, 避免 ArrayList 同时匹配 toResult 的 Serializable/Collection 重载产生歧义
|
|
|
|
|
+ List<OrderDonView> empty = Collections.emptyList();
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(empty);
|
|
|
|
|
+ }
|
|
|
List<OrderDonView> orderDonViews = beanSearcher.searchAll(OrderDonView.class, MapUtils.builder()
|
|
List<OrderDonView> orderDonViews = beanSearcher.searchAll(OrderDonView.class, MapUtils.builder()
|
|
|
- .field(OrderDonView::getId, orderIds).op(Operator.InList)
|
|
|
|
|
|
|
+ .field(OrderDonView::getOrderNo, nos).op(Operator.InList)
|
|
|
|
|
+ .field(OrderDonView::getUserId, userIds).op(Operator.InList)
|
|
|
.orderBy(OrderDonView::getId).desc().build());
|
|
.orderBy(OrderDonView::getId).desc().build());
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(orderDonViews);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(orderDonViews);
|
|
|
}
|
|
}
|
|
@@ -753,8 +827,9 @@ public class OrderController {
|
|
|
/**
|
|
/**
|
|
|
* paypal支付
|
|
* paypal支付
|
|
|
*/
|
|
*/
|
|
|
- @PostMapping("/paypal/pay/{orderId}")
|
|
|
|
|
- public Result<String> paypalPay(@PathVariable Long orderId,String successUrl) throws Exception {
|
|
|
|
|
|
|
+ @PostMapping("/paypal/pay/{orderNo}")
|
|
|
|
|
+ public Result<String> paypalPay(@PathVariable String orderNo,String successUrl) throws Exception {
|
|
|
|
|
+ Long orderId = resolveOrderId(orderNo);
|
|
|
authorizePayment(orderId, false);
|
|
authorizePayment(orderId, false);
|
|
|
final String methodName = "paypal支付";
|
|
final String methodName = "paypal支付";
|
|
|
log.info("{}[start] orderId:{}",methodName,orderId);
|
|
log.info("{}[start] orderId:{}",methodName,orderId);
|
|
@@ -780,9 +855,10 @@ public class OrderController {
|
|
|
/**
|
|
/**
|
|
|
* stripe支付
|
|
* stripe支付
|
|
|
*/
|
|
*/
|
|
|
- @PostMapping("/stripe/pay/{orderId}")
|
|
|
|
|
- public Result<String> stripePay(@PathVariable Long orderId,String successUrl) throws Exception {
|
|
|
|
|
|
|
+ @PostMapping("/stripe/pay/{orderNo}")
|
|
|
|
|
+ public Result<String> stripePay(@PathVariable String orderNo,String successUrl) throws Exception {
|
|
|
final String methodName = "stripe支付";
|
|
final String methodName = "stripe支付";
|
|
|
|
|
+ Long orderId = resolveOrderId(orderNo);
|
|
|
authorizePayment(orderId, false);
|
|
authorizePayment(orderId, false);
|
|
|
log.info("{}[start] orderId:{}",methodName,orderId);
|
|
log.info("{}[start] orderId:{}",methodName,orderId);
|
|
|
String payUrl = invokePayment(orderId, () -> stripeService.checkOutStripe(orderId, successUrl));
|
|
String payUrl = invokePayment(orderId, () -> stripeService.checkOutStripe(orderId, successUrl));
|
|
@@ -901,11 +977,12 @@ public class OrderController {
|
|
|
/**
|
|
/**
|
|
|
* 获取套餐订单详情
|
|
* 获取套餐订单详情
|
|
|
*/
|
|
*/
|
|
|
- @GetMapping("/get/upgrade/{orderId}")
|
|
|
|
|
- public Result<UpgradeOrderDetailView> upgradeOrderDetail(@PathVariable Long orderId) {
|
|
|
|
|
- Long userId = StpUserUtil.getUserIdAfterLogin();
|
|
|
|
|
|
|
+ @GetMapping("/get/upgrade/{orderNo}")
|
|
|
|
|
+ public Result<UpgradeOrderDetailView> upgradeOrderDetail(@PathVariable String orderNo) {
|
|
|
|
|
+ // 原来用 getUserIdAfterLogin(): 未登录时 userId=null, service 不加用户过滤, 任何人都能查任意套餐订单; 改为必须登录
|
|
|
|
|
+ Long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
|
|
|
|
|
- UpgradeOrderDetailView detail = orderDonService.getUpgradeOrderDetail(orderId, userId);
|
|
|
|
|
|
|
+ UpgradeOrderDetailView detail = orderDonService.getUpgradeOrderDetail(resolveUpgradeOrderId(orderNo), userId);
|
|
|
|
|
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(detail);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(detail);
|
|
|
}
|
|
}
|
|
@@ -913,10 +990,10 @@ public class OrderController {
|
|
|
/**
|
|
/**
|
|
|
* 取消套餐订单
|
|
* 取消套餐订单
|
|
|
*/
|
|
*/
|
|
|
- @GetMapping("/get/close/upgrade/{orderId}")
|
|
|
|
|
- public Result<String> closeUpgradeOrder(@PathVariable Long orderId) {
|
|
|
|
|
|
|
+ @GetMapping("/get/close/upgrade/{orderNo}")
|
|
|
|
|
+ public Result<String> closeUpgradeOrder(@PathVariable String orderNo) {
|
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
- orderDonService.closeUpgradeOrder(orderId, userId);
|
|
|
|
|
|
|
+ orderDonService.closeUpgradeOrder(resolveUpgradeOrderId(orderNo), userId);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -970,7 +1047,7 @@ public class OrderController {
|
|
|
|
|
|
|
|
OrderDon orderDon = orderDonService.submitRenewUpgrade(payRequest);
|
|
OrderDon orderDon = orderDonService.submitRenewUpgrade(payRequest);
|
|
|
|
|
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult(orderDon);
|
|
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(hideOrderId(orderDon));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -981,7 +1058,7 @@ public class OrderController {
|
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
payRequest.setUserId(userId);
|
|
payRequest.setUserId(userId);
|
|
|
OrderDon orderDon = orderDonService.ccDeductSubmitOrder(payRequest);
|
|
OrderDon orderDon = orderDonService.ccDeductSubmitOrder(payRequest);
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult(orderDon);
|
|
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(hideOrderId(orderDon));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1049,16 +1126,16 @@ public class OrderController {
|
|
|
String ip = ServletUtil.getClientIP(request);
|
|
String ip = ServletUtil.getClientIP(request);
|
|
|
orderPayRequest.setIp(ip);
|
|
orderPayRequest.setIp(ip);
|
|
|
OrderDon orderDon = orderDonService.userBenefitsSubmit(orderPayRequest);
|
|
OrderDon orderDon = orderDonService.userBenefitsSubmit(orderPayRequest);
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult(orderDon);
|
|
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(hideOrderId(orderDon));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 是否是实物可选多张车票权益记录
|
|
* 是否是实物可选多张车票权益记录
|
|
|
*/
|
|
*/
|
|
|
- @GetMapping("/get/combo/optional/ticket/record/{orderId}")
|
|
|
|
|
- public Result<UserPayEquipmentAvailableBenefits> getComboOptionalTicketRecord(@PathVariable Long orderId) {
|
|
|
|
|
|
|
+ @GetMapping("/get/combo/optional/ticket/record/{orderNo}")
|
|
|
|
|
+ public Result<UserPayEquipmentAvailableBenefits> getComboOptionalTicketRecord(@PathVariable String orderNo) {
|
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
- UserPayEquipmentAvailableBenefits userPayEquipmentAvailableBenefits = orderDonService.getComboOptionalTicketRecord(userId, orderId);
|
|
|
|
|
|
|
+ UserPayEquipmentAvailableBenefits userPayEquipmentAvailableBenefits = orderDonService.getComboOptionalTicketRecord(userId, resolveOrderId(orderNo));
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(userPayEquipmentAvailableBenefits);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(userPayEquipmentAvailableBenefits);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1080,8 +1157,9 @@ public class OrderController {
|
|
|
/**
|
|
/**
|
|
|
* paypalV2支付
|
|
* paypalV2支付
|
|
|
*/
|
|
*/
|
|
|
- @PostMapping("/paypalV2/pay/{orderId}")
|
|
|
|
|
- public Result<String> paypalV2Pay(@PathVariable Long orderId,String successUrl) throws Exception {
|
|
|
|
|
|
|
+ @PostMapping("/paypalV2/pay/{orderNo}")
|
|
|
|
|
+ public Result<String> paypalV2Pay(@PathVariable String orderNo,String successUrl) throws Exception {
|
|
|
|
|
+ Long orderId = resolveOrderId(orderNo);
|
|
|
authorizePayment(orderId, false);
|
|
authorizePayment(orderId, false);
|
|
|
final String methodName = "paypal支付";
|
|
final String methodName = "paypal支付";
|
|
|
log.info("{}[start] orderId:{}",methodName,orderId);
|
|
log.info("{}[start] orderId:{}",methodName,orderId);
|
|
@@ -1106,8 +1184,18 @@ public class OrderController {
|
|
|
/**
|
|
/**
|
|
|
* 领取GPT镜像天卡
|
|
* 领取GPT镜像天卡
|
|
|
*/
|
|
*/
|
|
|
- @PostMapping("/receive/gptMirror/dayCard/{orderId}")
|
|
|
|
|
- public Result<String> receiveGptMirrorDayCard(@PathVariable Long orderId) throws Exception {
|
|
|
|
|
|
|
+ @PostMapping("/receive/gptMirror/dayCard/{orderNo}")
|
|
|
|
|
+ public Result<String> receiveGptMirrorDayCard(@PathVariable String orderNo) throws Exception {
|
|
|
|
|
+ long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
|
|
+ Long orderId = resolveOrderId(orderNo);
|
|
|
|
|
+ // 原来没有归属校验, 登录用户可拿别人的订单领天卡; 只允许本人(含绑定账号)的订单
|
|
|
|
|
+ OrderDon order = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
|
|
+ .select(OrderDon::getId, OrderDon::getUserId)
|
|
|
|
|
+ .eq(OrderDon::getId, orderId));
|
|
|
|
|
+ List<Long> userIds = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
|
|
+ if (order == null || CollUtil.isEmpty(userIds) || !userIds.contains(order.getUserId())) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance(ORDER_NOT_FOUND);
|
|
|
|
|
+ }
|
|
|
orderDonService.receiveGptMirrorDayCard(orderId);
|
|
orderDonService.receiveGptMirrorDayCard(orderId);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|