Commit a80302d0 by 吕明尚

优惠卷只能领取一次

parent 21b3972c
......@@ -61,5 +61,5 @@ public interface SOrderMapper extends BaseMapper<SOrder>
*/
public int deleteSOrderByIds(Long[] ids);
SOrder selectSOrderByNo();
SOrder selectSOrderByNo(String orderNo);
}
package share.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.dianping.openapi.sdk.api.oauth.CustomerRefreshToken;
import com.dianping.openapi.sdk.api.oauth.DynamicToken;
import com.dianping.openapi.sdk.api.oauth.entity.CustomerRefreshTokenResponse;
......@@ -11,6 +12,7 @@ import com.dianping.openapi.sdk.api.oauth.enums.GrantType;
import com.dianping.openapi.sdk.api.tuangou.*;
import com.dianping.openapi.sdk.api.tuangou.entity.*;
import com.dianping.openapi.sdk.httpclient.DefaultOpenAPIClient;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -18,6 +20,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import share.common.enums.PlatformTypeEnum;
import share.common.enums.SourceTypeEnum;
import share.system.domain.Device;
import share.system.domain.SConsumer;
import share.system.domain.SConsumerCoupon;
import share.system.domain.SCoupon;
......@@ -57,6 +60,13 @@ public class QPServiceImpl implements QPService {
if (sCoupon == null) {
throw new RuntimeException("未找到对应的优惠券");
}
//查询领取记录表
LambdaQueryWrapper<SConsumerCoupon> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SConsumerCoupon::getCouponId, prepare.getDeal_title());
SConsumerCoupon one = isConsumerCouponService.getOne(queryWrapper);
if (ObjectUtils.isNotEmpty(one)) {
throw new RuntimeException("该优惠券以领取");
}
//执行验券
// List<TuangouReceiptConsumeResponseEntity> consume = consume(code, count);
// consume.forEach(item -> {
......
......@@ -417,7 +417,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
@Override
public MqttxVo openDoor(String orderNo) {
SOrder sOrder = sOrderMapper.selectSOrderByNo();
SOrder sOrder = sOrderMapper.selectSOrderByNo(orderNo);
if (Objects.isNull(sOrder)) {
throw new BaseException("订单不存在!");
}
......@@ -433,7 +433,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper,SOrder> implemen
}
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
MqttxVo mqttxVo = mqttxService.openOrCloseDevice(one.getDevId(), user.getNickName(), "10");
if (sOrder.getStatus().equals(OrderStatusEnum.INUSE.getCode())) {
if (sOrder.getStatus().equals(OrderStatusEnum.UNUSED.getCode())) {
//更改订单状态,房间状态,开始时间,结束时间
sOrder.setStatus(1);
//计算预约开始和结束时间时长
......
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