Commit 932d41f0 by 吕明尚

增加根据订单编号查询订单

parent 88cb6cf1
...@@ -63,6 +63,14 @@ public class SOrderController extends BaseController ...@@ -63,6 +63,14 @@ public class SOrderController extends BaseController
} }
/** /**
* 获取订单详细信息
*/
@GetMapping(value = "/orderNo")
public AjaxResult queryByOrderNo(@RequestParam("orderNo") String orderNo) {
return success(sOrderService.selectSOrderByOrderNo(orderNo));
}
/**
* 开门 * 开门
*/ */
@ApiOperation(value = "开门") @ApiOperation(value = "开门")
......
...@@ -134,4 +134,8 @@ public class SOrder extends BaseEntity ...@@ -134,4 +134,8 @@ public class SOrder extends BaseEntity
@TableField(select = false) @TableField(select = false)
private Integer isDelete; private Integer isDelete;
@TableField(exist = false)
private Integer buyType;
} }
...@@ -61,4 +61,6 @@ public interface SConsumerCouponMapper extends BaseMapper<SConsumerCoupon> ...@@ -61,4 +61,6 @@ public interface SConsumerCouponMapper extends BaseMapper<SConsumerCoupon>
public int deleteSConsumerCouponByIds(Long[] ids); public int deleteSConsumerCouponByIds(Long[] ids);
int selectSConsumerCouponConut(SConsumerCoupon sConsumerCoupon); int selectSConsumerCouponConut(SConsumerCoupon sConsumerCoupon);
List<SConsumerCoupon> querySConsumerCouponList(SConsumerCoupon sConsumerCoupon);
} }
...@@ -122,4 +122,6 @@ public interface ISOrderService extends IService<SOrder> ...@@ -122,4 +122,6 @@ public interface ISOrderService extends IService<SOrder>
* @return * @return
*/ */
boolean cancel(String orderNo); boolean cancel(String orderNo);
SOrder selectSOrderByOrderNo(String orderNo);
} }
...@@ -99,7 +99,7 @@ public class QPServiceImpl implements QPService { ...@@ -99,7 +99,7 @@ public class QPServiceImpl implements QPService {
if (byId == null) { if (byId == null) {
throw new RuntimeException("未找到对应的券码"); throw new RuntimeException("未找到对应的券码");
} }
if(StringUtils.isBlank(byId.getCouponCode())){ if (StringUtils.isBlank(byId.getCouponCode())) {
throw new RuntimeException("未找到对应的券码"); throw new RuntimeException("未找到对应的券码");
} }
TuangouReceiptGetConsumedReponseEntity getconsumed = getconsumed(byId.getCouponCode()); TuangouReceiptGetConsumedReponseEntity getconsumed = getconsumed(byId.getCouponCode());
......
...@@ -130,7 +130,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe ...@@ -130,7 +130,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
sConsumerCoupon.setUseStatus(ConsumerCouponUseStatusEnum.WAIT_USE.getCode()); sConsumerCoupon.setUseStatus(ConsumerCouponUseStatusEnum.WAIT_USE.getCode());
sConsumerCoupon.setConsumerId(user.getId()); sConsumerCoupon.setConsumerId(user.getId());
//查询用户未使用的优惠券 //查询用户未使用的优惠券
List<SConsumerCoupon> sConsumerCoupons = sConsumerCouponMapper.selectSConsumerCouponList(sConsumerCoupon); List<SConsumerCoupon> sConsumerCoupons = sConsumerCouponMapper.querySConsumerCouponList(sConsumerCoupon);
//计算时长 //计算时长
BigDecimal bigDecimal = DateUtils.differentHour(couponRequest.getPreStartDate(), couponRequest.getPreEndDate()); BigDecimal bigDecimal = DateUtils.differentHour(couponRequest.getPreStartDate(), couponRequest.getPreEndDate());
if (CollectionUtils.isEmpty(sConsumerCoupons)) { if (CollectionUtils.isEmpty(sConsumerCoupons)) {
......
...@@ -233,6 +233,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen ...@@ -233,6 +233,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
sOrder.setTotalPrice(request.getTotalFee()); sOrder.setTotalPrice(request.getTotalFee());
sOrder.setCouponPrice(request.getCouponFee()); sOrder.setCouponPrice(request.getCouponFee());
sOrder.setPayPrice(request.getPayFee()); sOrder.setPayPrice(request.getPayFee());
sOrder.setBuyType(request.getBuyType());
//设置订单号 //设置订单号
sOrder.setOrderNo(BaseUtil.getOrderNo(PayTypeEnum.getEnumByCode(request.getPayType()).getValue())); sOrder.setOrderNo(BaseUtil.getOrderNo(PayTypeEnum.getEnumByCode(request.getPayType()).getValue()));
sOrder.setConsumerId(user.getId()); sOrder.setConsumerId(user.getId());
...@@ -241,6 +242,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen ...@@ -241,6 +242,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
sOrder.setPayStatus(YesNoEnum.no.getIndex()); sOrder.setPayStatus(YesNoEnum.no.getIndex());
sOrder.setStatus(OrderStatusEnum.UNUSED.getCode()); sOrder.setStatus(OrderStatusEnum.UNUSED.getCode());
sOrder.setRefundStatus(RefundStatusEnum.UNREFUND.getCode()); sOrder.setRefundStatus(RefundStatusEnum.UNREFUND.getCode());
sOrder.setPackId(request.getPackId());
//计算订单时长 //计算订单时长
sOrder.setTimeLong(DateUtils.differentHour(sOrder.getPreStartDate(),sOrder.getPreEndDate()).toString()); sOrder.setTimeLong(DateUtils.differentHour(sOrder.getPreStartDate(),sOrder.getPreEndDate()).toString());
if(Objects.nonNull(sOrder.getPackId())&& sOrder.getPackId() != 0){ if(Objects.nonNull(sOrder.getPackId())&& sOrder.getPackId() != 0){
...@@ -380,6 +382,13 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen ...@@ -380,6 +382,13 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
} }
@Override @Override
public SOrder selectSOrderByOrderNo(String orderNo) {
LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SOrder::getOrderNo, orderNo);
return getOne(queryWrapper);
}
@Override
public String openDoor(Long id) { public String openDoor(Long id) {
SOrder sOrder = sOrderMapper.selectSOrderById(id); SOrder sOrder = sOrderMapper.selectSOrderById(id);
if (Objects.isNull(sOrder)) { if (Objects.isNull(sOrder)) {
...@@ -455,7 +464,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen ...@@ -455,7 +464,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
* 计算使用优惠券后的订单金额 * 计算使用优惠券后的订单金额
*/ */
private void computedCouponPrice(ComputedOrderPriceResponse priceResponse, SConsumer user, SConsumerCoupon consumerCoupon){ private void computedCouponPrice(ComputedOrderPriceResponse priceResponse, SConsumer user, SConsumerCoupon consumerCoupon){
if (ObjectUtil.isNull(consumerCoupon) || !consumerCoupon.getCouponId().equals(user.getId())) { if (ObjectUtil.isNull(consumerCoupon) || !consumerCoupon.getConsumerId().equals(user.getId())) {
throw new BaseException("优惠券领取记录不存在!"); throw new BaseException("优惠券领取记录不存在!");
} }
if (CouponStatusEnum.USED.getValue().compareTo(consumerCoupon.getUseStatus()) == 0) { if (CouponStatusEnum.USED.getValue().compareTo(consumerCoupon.getUseStatus()) == 0) {
......
...@@ -74,6 +74,16 @@ ...@@ -74,6 +74,16 @@
<select id="selectSConsumerCouponConut" resultType="java.lang.Integer"> <select id="selectSConsumerCouponConut" resultType="java.lang.Integer">
select count(1) from s_consumer_coupon where consumer_id = #{consumerId} and use_status = 0 select count(1) from s_consumer_coupon where consumer_id = #{consumerId} and use_status = 0
</select> </select>
<select id="querySConsumerCouponList" parameterType="SConsumerCoupon" resultMap="SConsumerCouponResult">
<include refid="selectSConsumerCouponVo"/>
<where>
1=1
and is_delete = '0'
and end_date >= NOW()
and use_status = '0'
<if test="consumerId != null ">and consumer_id = #{consumerId}</if>
</where>
</select>
<insert id="insertSConsumerCoupon" parameterType="SConsumerCoupon" useGeneratedKeys="true" keyProperty="id"> <insert id="insertSConsumerCoupon" parameterType="SConsumerCoupon" useGeneratedKeys="true" keyProperty="id">
insert into s_consumer_coupon insert into s_consumer_coupon
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment