Commit 7d0976b0 by 吕明尚

修改可以优惠券查询

parent 70868f48
......@@ -6,10 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import share.common.annotation.Excel;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;
......@@ -27,7 +24,6 @@ public class CouponRequest {
private Long roomId;
@ApiModelProperty(value = "下单模式(1:小时模式,2:套餐模式)", required = true)
@NotNull(message = "下单模式不能为空")
private Integer orderMode;
@ApiModelProperty(value = "下单类型(1:预定,2:续单)", required = true)
......@@ -37,6 +33,9 @@ public class CouponRequest {
@ApiModelProperty(value = "套餐ID")
private Long packageId;
@ApiModelProperty(value = "标签id")
private Long roomLabelId;
/**
* 预约开始时间
*/
......
......@@ -20,6 +20,7 @@ import share.system.mapper.SConsumerCouponMapper;
import share.system.request.CouponRequest;
import share.system.service.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
......@@ -48,6 +49,9 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
@Autowired
private SConsumerService sConsumerService;
@Resource
private RoomLabelService roomLabelService;
private static final Integer ZERO = 0;
......@@ -206,11 +210,23 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
queryWrapper.orderByDesc(SConsumerCoupon::getOriginalPrice);
//查询用户未使用的优惠券
List<SConsumerCoupon> sConsumerCoupons = baseMapper.selectList(queryWrapper);
//计算时长
BigDecimal timeLong = DateUtils.differentHour(couponRequest.getPreStartDate(), couponRequest.getPreEndDate());
if (CollectionUtils.isEmpty(sConsumerCoupons)) {
return new ArrayList<>();
}
//计算时长
BigDecimal timeLong = DateUtils.differentHour(couponRequest.getPreStartDate(), couponRequest.getPreEndDate());
if (!ObjectUtils.isEmpty(couponRequest.getRoomLabelId())) {
RoomLabel roomLabel = roomLabelService.selectRoomLabelById(couponRequest.getRoomLabelId());
if (ObjectUtils.isEmpty(roomLabel.getPackId())) {
couponRequest.setOrderMode(BuyTypeEnum.TIME.getCode());
} else {
couponRequest.setOrderMode(BuyTypeEnum.PACK.getCode());
}
} else if (!ObjectUtils.isEmpty(couponRequest.getPackageId())) {
couponRequest.setOrderMode(BuyTypeEnum.PACK.getCode());
} else {
throw new RuntimeException("参数异常");
}
List<SConsumerCouponVo> voList = new ArrayList<>();
//查询所有门店
List<SStore> sStores = sStoreService.list();
......
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