查询订单状态接口开发
This commit is contained in:
parent
c9e8e99fe4
commit
2859213283
@ -16,7 +16,7 @@ import java.util.concurrent.locks.Lock;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RabbitListener(queues = "#{mqconfig.coupon_release_queue}")
|
||||
@RabbitListener(queues = "${mqconfig.coupon_release_queue}")
|
||||
public class CouponMQListener {
|
||||
|
||||
@Autowired
|
||||
@ -59,7 +59,16 @@ public class CouponMQListener {
|
||||
// 再发生问题就往外抛
|
||||
channel.basicReject(msgTag, true);
|
||||
}
|
||||
|
||||
|
||||
// finally {
|
||||
// lock.unlock();
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
// @RabbitHandler
|
||||
// public void releaseCouponRecord2(String msg, Message message, Channel channel) throws IOException {
|
||||
// log.info(msg);
|
||||
// channel.basicAck(message.getMessageProperties().getDeliveryTag(), true);
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
@ -5,17 +5,15 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.jieyuu.enums.BizCodeEnum;
|
||||
import net.jieyuu.enums.ClientType;
|
||||
import net.jieyuu.enums.ProductOrderPayTypeEnum;
|
||||
import net.jieyuu.request.ConfirmOrderRequest;
|
||||
import net.jieyuu.service.ProductOrderService;
|
||||
import net.jieyuu.utils.JsonData;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
@ -75,5 +73,20 @@ public class ProductOrderController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单状态
|
||||
* 此接口不登录拦截,可以增加密钥用于rpc通行
|
||||
*
|
||||
* @param outTradeNo
|
||||
* @return
|
||||
*/
|
||||
|
||||
@ApiOperation("查询订单状态")
|
||||
@GetMapping("/query_state")
|
||||
JsonData queryProductOrderState(@ApiParam("订单号") @RequestParam("out_trade_no") String outTradeNo) {
|
||||
String state = orderService.queryProductOrderState(outTradeNo);
|
||||
return StringUtils.isBlank(state) ? JsonData.buildResult(BizCodeEnum.ORDER_CONFIRM_NOT_EXIST) : JsonData.buildSuccess();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import net.jieyuu.utils.JsonData;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author jieyuu
|
||||
@ -16,10 +16,18 @@ public interface ProductOrderService extends IService<ProductOrderDO> {
|
||||
|
||||
/**
|
||||
* 创建订单
|
||||
*
|
||||
* @param orderService
|
||||
* @return
|
||||
*/
|
||||
JsonData confirmOrder(ProductOrderService orderService);
|
||||
|
||||
|
||||
/**
|
||||
* 查询订单状态
|
||||
*
|
||||
* @param outTradeNo
|
||||
* @return
|
||||
*/
|
||||
String queryProductOrderState(String outTradeNo);
|
||||
}
|
||||
|
@ -1,10 +1,13 @@
|
||||
package net.jieyuu.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.sun.org.apache.bcel.internal.generic.RETURN;
|
||||
import net.jieyuu.model.ProductOrderDO;
|
||||
import net.jieyuu.mapper.ProductOrderMapper;
|
||||
import net.jieyuu.service.ProductOrderService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import net.jieyuu.utils.JsonData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@ -18,13 +21,16 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class ProductOrderServiceImpl extends ServiceImpl<ProductOrderMapper, ProductOrderDO> implements ProductOrderService {
|
||||
|
||||
@Autowired
|
||||
private ProductOrderMapper productOrderMapper;
|
||||
|
||||
/**
|
||||
* * 防重提交
|
||||
* * 用户微服务-确认收货地址
|
||||
* * 商品微服务-获取最新购物项和价格
|
||||
* * 订单验价
|
||||
* * 优惠券微服务-获取优惠券
|
||||
* * 验证价格
|
||||
* * 优惠券微服务-获取优惠券
|
||||
* * 验证价格
|
||||
* * 锁定优惠券
|
||||
* * 锁定商品库存
|
||||
* * 创建订单对象
|
||||
@ -40,4 +46,21 @@ public class ProductOrderServiceImpl extends ServiceImpl<ProductOrderMapper, Pro
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单状态
|
||||
*
|
||||
* @param outTradeNo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String queryProductOrderState(String outTradeNo) {
|
||||
|
||||
ProductOrderDO productOrderDO = productOrderMapper.selectOne(new QueryWrapper<ProductOrderDO>().eq("out-trade_no", outTradeNo));
|
||||
if (productOrderDO == null) {
|
||||
return "";
|
||||
} else {
|
||||
return productOrderDO.getState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user