mirror of
https://gitee.com/zhijiantianya/yudao-cloud.git
synced 2025-12-26 07:06:24 +08:00
Merge pull request !220 from 芋道源码/revert-merge-216-master-jdk17
This commit is contained in:
commit
a5aa2c84e3
@ -1,9 +1,5 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.app.order;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.BooleanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.pay.api.notify.dto.PayOrderNotifyReqDTO;
|
||||
@ -94,22 +90,13 @@ public class AppTradeOrderController {
|
||||
@GetMapping("/get-detail")
|
||||
@Operation(summary = "获得交易订单")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "交易订单编号 或 微信小程序商品订单详情PATH配置的「${商品订单号} 」out_trade_no"),
|
||||
@Parameter(name = "id", description = "交易订单编号"),
|
||||
@Parameter(name = "sync", description = "是否同步支付状态", example = "true")
|
||||
})
|
||||
public CommonResult<AppTradeOrderDetailRespVO> getOrderDetail(@RequestParam("id") String id,
|
||||
@RequestParam(value = "sync", required = false) String syncParam) {
|
||||
public CommonResult<AppTradeOrderDetailRespVO> getOrderDetail(@RequestParam("id") Long id,
|
||||
@RequestParam(value = "sync", required = false) Boolean sync) {
|
||||
// 1.1 查询订单
|
||||
TradeOrderDO order;
|
||||
Boolean sync = null;
|
||||
if (CharSequenceUtil.isNotEmpty(syncParam)) {
|
||||
sync = BooleanUtil.toBoolean(syncParam);
|
||||
}
|
||||
if (ObjectUtil.isNotNull(sync)) {
|
||||
order = tradeOrderQueryService.getOrderByOutTradeNo(getLoginUserId(),id);
|
||||
} else {
|
||||
order = tradeOrderQueryService.getOrder(getLoginUserId(),Convert.toLong(id));
|
||||
}
|
||||
TradeOrderDO order = tradeOrderQueryService.getOrder(getLoginUserId(), id);
|
||||
if (order == null) {
|
||||
return success(null);
|
||||
}
|
||||
@ -118,7 +105,7 @@ public class AppTradeOrderController {
|
||||
&& TradeOrderStatusEnum.isUnpaid(order.getStatus()) && !order.getPayStatus()) {
|
||||
tradeOrderUpdateService.syncOrderPayStatusQuietly(order.getId(), order.getPayOrderId());
|
||||
// 重新查询,因为同步后,可能会有变化
|
||||
order = tradeOrderQueryService.getOrder(order.getId());
|
||||
order = tradeOrderQueryService.getOrder(id);
|
||||
}
|
||||
|
||||
// 2.1 查询订单项
|
||||
|
||||
@ -39,15 +39,7 @@ public interface TradeOrderQueryService {
|
||||
* @return 交易订单
|
||||
*/
|
||||
TradeOrderDO getOrder(Long userId, Long id);
|
||||
/**
|
||||
* 获得指定用户,指定的交易订单
|
||||
* PATH需包含「${商品订单号} 」,微信将把你在支付预下单接口填入的 out_trade_no 替换此内容,如「index/orderDetail?id=${商品订单号}&channel=1」。PATH最多输入1条。
|
||||
* https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order_center/order_center.html
|
||||
* @param userId 用户编号
|
||||
* @param outTradeNo 支付订单no
|
||||
* @return 交易订单
|
||||
*/
|
||||
TradeOrderDO getOrderByOutTradeNo(Long userId, String outTradeNo);
|
||||
|
||||
/**
|
||||
* 获得指定用户,指定活动,指定状态的交易订单
|
||||
*
|
||||
|
||||
@ -1,16 +1,13 @@
|
||||
package cn.iocoder.yudao.module.trade.service.order;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||
import cn.iocoder.yudao.module.pay.api.order.PayOrderApi;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderSummaryRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
|
||||
@ -60,8 +57,6 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
|
||||
@Resource
|
||||
private MemberUserApi memberUserApi;
|
||||
|
||||
@Resource
|
||||
private PayOrderApi payOrderApi;
|
||||
// =================== Order ===================
|
||||
|
||||
@Override
|
||||
@ -78,19 +73,6 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
|
||||
}
|
||||
return order;
|
||||
}
|
||||
@Override
|
||||
public TradeOrderDO getOrderByOutTradeNo(Long userId, String outTradeNo) {
|
||||
// PATH需包含「${商品订单号} 」,微信将把你在支付预下单接口填入的 out_trade_no 替换此内容,如「index/orderDetail?id=${商品订单号}&channel=1」。PATH最多输入1条。
|
||||
// https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/order_center/order_center.html
|
||||
// 小程序商品订单详情path配置为:pages/order/detail?id=${商品订单号}&comein_type=wechat
|
||||
// 通过 rpc payOrderNo -> tradeOrderId
|
||||
String id = outTradeNo;
|
||||
String merchantOrderId = payOrderApi.getMerchantOrderIdByPayOrderNo(outTradeNo).getCheckedData();
|
||||
if(CharSequenceUtil.isNotEmpty(merchantOrderId)){
|
||||
id = merchantOrderId;
|
||||
}
|
||||
return getSelf().getOrder(userId, Convert.toLong(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TradeOrderDO getOrderByUserIdAndStatusAndCombination(Long userId, Long combinationActivityId, Integer status) {
|
||||
|
||||
@ -39,8 +39,4 @@ public interface PayOrderApi {
|
||||
CommonResult<Boolean> updatePayOrderPrice(@RequestParam("id") Long id,
|
||||
@RequestParam("payPrice") Integer payPrice);
|
||||
|
||||
@PostMapping(PREFIX + "/getMerchantOrderIdByNo")
|
||||
@Operation(summary = "根据支付订单编号获取商户订单编号")
|
||||
@Parameter(name = "no", description = "支付单编号", example = "Pxxxx", required = true)
|
||||
CommonResult<String> getMerchantOrderIdByPayOrderNo(@RequestParam("no") String no);
|
||||
}
|
||||
|
||||
@ -37,8 +37,4 @@ public class PayOrderApiImpl implements PayOrderApi {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<String> getMerchantOrderIdByPayOrderNo(String no) {
|
||||
return success(payOrderService.getMerchantOrderIdByNo(no));
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,10 +48,6 @@ public interface PayOrderMapper extends BaseMapperX<PayOrderDO> {
|
||||
PayOrderDO::getMerchantOrderId, merchantOrderId);
|
||||
}
|
||||
|
||||
default PayOrderDO selectByNo(String no) {
|
||||
return selectOne(PayOrderDO::getNo, no);
|
||||
}
|
||||
|
||||
default int updateByIdAndStatus(Long id, Integer status, PayOrderDO update) {
|
||||
return update(update, new LambdaQueryWrapper<PayOrderDO>()
|
||||
.eq(PayOrderDO::getId, id).eq(PayOrderDO::getStatus, status));
|
||||
|
||||
@ -40,13 +40,6 @@ public interface PayOrderService {
|
||||
*/
|
||||
PayOrderDO getOrder(Long appId, String merchantOrderId);
|
||||
|
||||
/**
|
||||
* 获得商户订单编号
|
||||
*
|
||||
* @param no 编号
|
||||
* @return merchantOrderId
|
||||
*/
|
||||
String getMerchantOrderIdByNo(String no);
|
||||
/**
|
||||
* 获得支付订单列表
|
||||
*
|
||||
@ -162,4 +155,5 @@ public interface PayOrderService {
|
||||
* @return 过期的订单数量
|
||||
*/
|
||||
int expireOrder();
|
||||
|
||||
}
|
||||
|
||||
@ -84,17 +84,6 @@ public class PayOrderServiceImpl implements PayOrderService {
|
||||
return orderMapper.selectByAppIdAndMerchantOrderId(appId, merchantOrderId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMerchantOrderIdByNo(String no) {
|
||||
if(no.contains(payProperties.getOrderNoPrefix())){
|
||||
PayOrderDO order = orderMapper.selectByNo(no);
|
||||
if(ObjectUtil.isNotNull(order)){
|
||||
return order.getMerchantOrderId();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PayOrderDO> getOrderList(Collection<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user