查询订单状态接口开发
This commit is contained in:
parent
c9e8e99fe4
commit
2859213283
@ -16,7 +16,7 @@ import java.util.concurrent.locks.Lock;
|
|||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@RabbitListener(queues = "#{mqconfig.coupon_release_queue}")
|
@RabbitListener(queues = "${mqconfig.coupon_release_queue}")
|
||||||
public class CouponMQListener {
|
public class CouponMQListener {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -59,7 +59,16 @@ public class CouponMQListener {
|
|||||||
// 再发生问题就往外抛
|
// 再发生问题就往外抛
|
||||||
channel.basicReject(msgTag, true);
|
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.ApiOperation;
|
||||||
import io.swagger.annotations.ApiParam;
|
import io.swagger.annotations.ApiParam;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.jieyuu.enums.BizCodeEnum;
|
||||||
import net.jieyuu.enums.ClientType;
|
import net.jieyuu.enums.ClientType;
|
||||||
import net.jieyuu.enums.ProductOrderPayTypeEnum;
|
import net.jieyuu.enums.ProductOrderPayTypeEnum;
|
||||||
import net.jieyuu.request.ConfirmOrderRequest;
|
import net.jieyuu.request.ConfirmOrderRequest;
|
||||||
import net.jieyuu.service.ProductOrderService;
|
import net.jieyuu.service.ProductOrderService;
|
||||||
import net.jieyuu.utils.JsonData;
|
import net.jieyuu.utils.JsonData;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,10 +16,18 @@ public interface ProductOrderService extends IService<ProductOrderDO> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建订单
|
* 创建订单
|
||||||
|
*
|
||||||
* @param orderService
|
* @param orderService
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
JsonData confirmOrder(ProductOrderService orderService);
|
JsonData confirmOrder(ProductOrderService orderService);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询订单状态
|
||||||
|
*
|
||||||
|
* @param outTradeNo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String queryProductOrderState(String outTradeNo);
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package net.jieyuu.service.impl;
|
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.model.ProductOrderDO;
|
||||||
import net.jieyuu.mapper.ProductOrderMapper;
|
import net.jieyuu.mapper.ProductOrderMapper;
|
||||||
import net.jieyuu.service.ProductOrderService;
|
import net.jieyuu.service.ProductOrderService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import net.jieyuu.utils.JsonData;
|
import net.jieyuu.utils.JsonData;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -18,6 +21,9 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
public class ProductOrderServiceImpl extends ServiceImpl<ProductOrderMapper, ProductOrderDO> implements ProductOrderService {
|
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;
|
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