Commit f2ba6e18 by 吕明尚

Merge branch 'test' into dev-lms

parents 561312a5 67969ce6
...@@ -161,6 +161,7 @@ public class QPServiceImplAspect { ...@@ -161,6 +161,7 @@ public class QPServiceImplAspect {
LambdaQueryWrapper<SConsumerCoupon> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SConsumerCoupon> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SConsumerCoupon::getCouponCode, couponCode); lambdaQueryWrapper.eq(SConsumerCoupon::getCouponCode, couponCode);
lambdaQueryWrapper.eq(SConsumerCoupon::getUseStatus, code); lambdaQueryWrapper.eq(SConsumerCoupon::getUseStatus, code);
lambdaQueryWrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex());
SConsumerCoupon one = sConsumerCouponService.getOne(lambdaQueryWrapper); SConsumerCoupon one = sConsumerCouponService.getOne(lambdaQueryWrapper);
if (one == null) { if (one == null) {
// 处理查询不到SConsumerCoupon的情况,例如抛出异常或记录日志 // 处理查询不到SConsumerCoupon的情况,例如抛出异常或记录日志
......
...@@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import share.common.enums.UserStatusEnum; import share.common.enums.UserStatusEnum;
import share.common.enums.YesNoEnum;
import share.system.domain.SConsumerCoupon; import share.system.domain.SConsumerCoupon;
import share.system.service.ISConsumerCouponService; import share.system.service.ISConsumerCouponService;
import share.system.service.impl.QPServiceImpl; import share.system.service.impl.QPServiceImpl;
...@@ -23,6 +24,7 @@ public class CouponRetryTask { ...@@ -23,6 +24,7 @@ public class CouponRetryTask {
public void AuToRetryCoupon() { public void AuToRetryCoupon() {
LambdaQueryWrapper<SConsumerCoupon> consumerCouponWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SConsumerCoupon> consumerCouponWrapper = new LambdaQueryWrapper<>();
consumerCouponWrapper.eq(SConsumerCoupon::getUseStatus, UserStatusEnum.UNUSED.getCode()); consumerCouponWrapper.eq(SConsumerCoupon::getUseStatus, UserStatusEnum.UNUSED.getCode());
consumerCouponWrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex());
List<SConsumerCoupon> sConsumerCoupons = sConsumerCouponService.list(consumerCouponWrapper); List<SConsumerCoupon> sConsumerCoupons = sConsumerCouponService.list(consumerCouponWrapper);
List<SConsumerCoupon> expiredSConsumerCounpons = Optional.ofNullable(sConsumerCoupons).orElse(new ArrayList<>()).stream().filter(item -> { List<SConsumerCoupon> expiredSConsumerCounpons = Optional.ofNullable(sConsumerCoupons).orElse(new ArrayList<>()).stream().filter(item -> {
if (item.getEndDate().compareTo(new Date()) < 0) { if (item.getEndDate().compareTo(new Date()) < 0) {
......
...@@ -99,6 +99,7 @@ public class RedisTask { ...@@ -99,6 +99,7 @@ public class RedisTask {
//获取所有待使用的优惠卷 //获取所有待使用的优惠卷
LambdaQueryWrapper<SConsumerCoupon> wrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<SConsumerCoupon> wrapper = Wrappers.lambdaQuery();
wrapper.eq(SConsumerCoupon::getUseStatus, CouponStatusEnum.NORMAL.getValue()); wrapper.eq(SConsumerCoupon::getUseStatus, CouponStatusEnum.NORMAL.getValue());
wrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex());
wrapper.isNotNull(SConsumerCoupon::getCouponCode); wrapper.isNotNull(SConsumerCoupon::getCouponCode);
List<SConsumerCoupon> coupons = isConsumerCouponService.list(wrapper); List<SConsumerCoupon> coupons = isConsumerCouponService.list(wrapper);
List<SStore> stores = storeService.list(); List<SStore> stores = storeService.list();
...@@ -128,7 +129,7 @@ public class RedisTask { ...@@ -128,7 +129,7 @@ public class RedisTask {
// 获取所有待使用的优惠卷 // 获取所有待使用的优惠卷
List<SConsumerCoupon> availableCoupons = isConsumerCouponService.list( List<SConsumerCoupon> availableCoupons = isConsumerCouponService.list(
new LambdaQueryWrapper<SConsumerCoupon>().eq(SConsumerCoupon::getUseStatus, CouponStatusEnum.NORMAL.getValue()) new LambdaQueryWrapper<SConsumerCoupon>().eq(SConsumerCoupon::getUseStatus, CouponStatusEnum.NORMAL.getValue()).eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex())
); );
Set<Long> availableCouponIds = availableCoupons.stream().map(SConsumerCoupon::getId).collect(Collectors.toSet()); Set<Long> availableCouponIds = availableCoupons.stream().map(SConsumerCoupon::getId).collect(Collectors.toSet());
......
...@@ -107,6 +107,7 @@ public class QPServiceImpl implements QPService { ...@@ -107,6 +107,7 @@ public class QPServiceImpl implements QPService {
LambdaQueryWrapper<SConsumerCoupon> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SConsumerCoupon> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SConsumerCoupon::getCouponCode, code); queryWrapper.eq(SConsumerCoupon::getCouponCode, code);
queryWrapper.eq(SConsumerCoupon::getUseStatus, UserStatusEnum.UNUSED.getCode()); queryWrapper.eq(SConsumerCoupon::getUseStatus, UserStatusEnum.UNUSED.getCode());
queryWrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex());
SConsumerCoupon unUsedCoupon = isConsumerCouponService.getOne(queryWrapper); SConsumerCoupon unUsedCoupon = isConsumerCouponService.getOne(queryWrapper);
if (ObjectUtils.isNotEmpty(unUsedCoupon)) { if (ObjectUtils.isNotEmpty(unUsedCoupon)) {
throw new RuntimeException("该券已被领取"); throw new RuntimeException("该券已被领取");
...@@ -129,7 +130,7 @@ public class QPServiceImpl implements QPService { ...@@ -129,7 +130,7 @@ public class QPServiceImpl implements QPService {
List<TuangouDealQueryShopDealResponseEntity> groupActivities = queryshopdeal(openShopUuid); List<TuangouDealQueryShopDealResponseEntity> groupActivities = queryshopdeal(openShopUuid);
groupActivities.forEach(o -> { groupActivities.forEach(o -> {
//套餐名称相同并且在售卖中 //套餐名称相同并且在售卖中
if (prepare.getDeal_title().equals(o.getTitle()) && saleStatusEnum.SELLING.getCode().equals(o.getSale_status())) { if (prepare.getDealgroup_id().equals(o.getDealgroup_id()) && saleStatusEnum.SELLING.getCode().equals(o.getSale_status())) {
Date receiptEndDate = DateUtil.parse(o.getReceipt_end_date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN); Date receiptEndDate = DateUtil.parse(o.getReceipt_end_date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN);
Date receiptBeginDate = DateUtil.parse(o.getReceipt_begin_date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN); Date receiptBeginDate = DateUtil.parse(o.getReceipt_begin_date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN);
sConsumerCoupon.setStartDate(receiptBeginDate); sConsumerCoupon.setStartDate(receiptBeginDate);
......
...@@ -90,6 +90,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe ...@@ -90,6 +90,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
LambdaQueryWrapper<SConsumerCoupon> queryWrapper = new LambdaQueryWrapper<SConsumerCoupon>(); LambdaQueryWrapper<SConsumerCoupon> queryWrapper = new LambdaQueryWrapper<SConsumerCoupon>();
queryWrapper.eq(SConsumerCoupon::getConsumerId,user.getId()); queryWrapper.eq(SConsumerCoupon::getConsumerId,user.getId());
queryWrapper.eq(SConsumerCoupon::getUseStatus,useStatus); queryWrapper.eq(SConsumerCoupon::getUseStatus,useStatus);
queryWrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex());
if(UserStatusEnum.EXPIRED.getCode().compareTo(useStatus)==0){ if(UserStatusEnum.EXPIRED.getCode().compareTo(useStatus)==0){
//已过期查询3个月以内的 //已过期查询3个月以内的
queryWrapper.gt(SConsumerCoupon::getEndDate,DateUtils.addMonths(new Date(),-3)); queryWrapper.gt(SConsumerCoupon::getEndDate,DateUtils.addMonths(new Date(),-3));
......
...@@ -19,6 +19,7 @@ import share.common.core.page.TableSupport; ...@@ -19,6 +19,7 @@ import share.common.core.page.TableSupport;
import share.common.enums.CouponTypeEnum; import share.common.enums.CouponTypeEnum;
import share.common.enums.RoomType; import share.common.enums.RoomType;
import share.common.enums.StoreType; import share.common.enums.StoreType;
import share.common.enums.YesNoEnum;
import share.common.utils.DateUtils; import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -225,7 +226,7 @@ public class SCouponServiceImpl extends ServiceImpl<SCouponMapper, SCoupon> impl ...@@ -225,7 +226,7 @@ public class SCouponServiceImpl extends ServiceImpl<SCouponMapper, SCoupon> impl
List<SCouponVo> sCouponVoList = convertDoListToVoList(sCouponList); List<SCouponVo> sCouponVoList = convertDoListToVoList(sCouponList);
//获取sCouponVoList的id集合 //获取sCouponVoList的id集合
List<Long> ids = sCouponVoList.stream().map(SCoupon::getId).collect(Collectors.toList()); List<Long> ids = sCouponVoList.stream().map(SCoupon::getId).collect(Collectors.toList());
List<SConsumerCoupon> sConsumerCoupons = sConsumerCouponService.list(new LambdaQueryWrapper<>(SConsumerCoupon.class).in(SConsumerCoupon::getCouponId, ids)); List<SConsumerCoupon> sConsumerCoupons = sConsumerCouponService.list(new LambdaQueryWrapper<>(SConsumerCoupon.class).in(SConsumerCoupon::getCouponId, ids).eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex()));
//统计每个couponId的出现次数 //统计每个couponId的出现次数
Map<Long, Long> collect = sConsumerCoupons.stream().collect(Collectors.groupingBy(SConsumerCoupon::getCouponId, Collectors.counting())); Map<Long, Long> collect = sConsumerCoupons.stream().collect(Collectors.groupingBy(SConsumerCoupon::getCouponId, Collectors.counting()));
sCouponVoList.stream().forEach(item -> { sCouponVoList.stream().forEach(item -> {
......
...@@ -316,7 +316,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -316,7 +316,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SStore sStore = storeService.getById(request.getStoreId()); SStore sStore = storeService.getById(request.getStoreId());
SRoom room = roomService.getById(request.getRoomId()); SRoom room = roomService.getById(request.getRoomId());
if (ObjectUtil.isNotEmpty(room) && room.getIsDirtyRoom().equals(YesNoEnum.yes.getIndex())) { if (ObjectUtil.isNotEmpty(room) && room.getIsDirtyRoom().equals(YesNoEnum.yes.getIndex())) {
throw new BaseException("当前房间未保洁,请选择其他房间"); throw new BaseException("未保洁,不能预定!");
} }
//生成订单 //生成订单
SOrder sOrder = generatSOrder(request, user); SOrder sOrder = generatSOrder(request, user);
...@@ -497,10 +497,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -497,10 +497,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} }
//排除上笔订单 //排除上笔订单
queryWrapper.ne(SOrder::getOrderNo, request.getPreOrderNo()); queryWrapper.ne(SOrder::getOrderNo, request.getPreOrderNo());
// //订单结束时间在 【预定开始时间-30分钟保洁 和 预定结束时间】区间内
// queryWrapper.apply("IFNULL(end_date,pre_end_date) BETWEEN '"
// + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.addMinutes(request.getPreStartDate(), -Constants.ROOM_LOCK_DELAY_MINUTE))
// + "' AND '" + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, request.getPreEndDate()) + "' ");
//订单开始时间在 【预定开始时间 和 预定结束时间+30分保洁】区间内
//订单结束时间在 【预定开始时间-30分钟保洁 和 预定结束时间】区间内 //订单结束时间在 【预定开始时间-30分钟保洁 和 预定结束时间】区间内
queryWrapper.apply("IFNULL(end_date,pre_end_date) BETWEEN '" queryWrapper.apply("(IFNULL(start_date,pre_start_date) BETWEEN '"
+ DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, request.getPreStartDate())
+ "' AND '" + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.addMinutes(request.getPreEndDate(), Constants.ROOM_LOCK_DELAY_MINUTE)) + "' " +
"OR IFNULL(end_date,pre_end_date) BETWEEN '"
+ DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.addMinutes(request.getPreStartDate(), -Constants.ROOM_LOCK_DELAY_MINUTE)) + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.addMinutes(request.getPreStartDate(), -Constants.ROOM_LOCK_DELAY_MINUTE))
+ "' AND '" + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, request.getPreEndDate()) + "' "); + "' AND '" + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, request.getPreEndDate()) + "' )");
break; break;
default: default:
throw new BaseException("订单类型异常!"); throw new BaseException("订单类型异常!");
......
...@@ -85,7 +85,9 @@ ...@@ -85,7 +85,9 @@
<select id="selectSConsumerCouponList" parameterType="SConsumerCoupon" resultMap="SConsumerCouponResult"> <select id="selectSConsumerCouponList" parameterType="SConsumerCoupon" resultMap="SConsumerCouponResult">
<include refid="selectSConsumerCouponVo"/> <include refid="selectSConsumerCouponVo"/>
<where> where
1=1
and is_delete = '0'
<if test="consumerId != null "> and consumer_id = #{consumerId}</if> <if test="consumerId != null "> and consumer_id = #{consumerId}</if>
<if test="couponId != null "> and coupon_id = #{couponId}</if> <if test="couponId != null "> and coupon_id = #{couponId}</if>
<if test="storeId !=null">and store_id = #{storeId}</if> <if test="storeId !=null">and store_id = #{storeId}</if>
...@@ -109,19 +111,21 @@ ...@@ -109,19 +111,21 @@
<if test="useDate != null "> and use_date = #{useDate}</if> <if test="useDate != null "> and use_date = #{useDate}</if>
<if test="useStatus != null and useStatus != '' or useStatus==0">and use_status = #{useStatus}</if> <if test="useStatus != null and useStatus != '' or useStatus==0">and use_status = #{useStatus}</if>
<if test="weeks != null and weeks != ''">and weeks = #{weeks}</if> <if test="weeks != null and weeks != ''">and weeks = #{weeks}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
<if test="deleteBy != null and deleteBy != ''"> and delete_by = #{deleteBy}</if> <if test="deleteBy != null and deleteBy != ''"> and delete_by = #{deleteBy}</if>
<if test="deleteTime != null "> and delete_time = #{deleteTime}</if> <if test="deleteTime != null "> and delete_time = #{deleteTime}</if>
</where>
ORDER BY create_time DESC ORDER BY create_time DESC
</select> </select>
<select id="selectSConsumerCouponById" parameterType="Long" resultMap="SConsumerCouponResult"> <select id="selectSConsumerCouponById" parameterType="Long" resultMap="SConsumerCouponResult">
<include refid="selectSConsumerCouponVo"/> <include refid="selectSConsumerCouponVo"/>
where id = #{id} where id = #{id} and is_delete = '0'
</select> </select>
<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
and is_delete = '0'
</select> </select>
<select id="querySConsumerCouponList" parameterType="SConsumerCoupon" resultMap="SConsumerCouponResult"> <select id="querySConsumerCouponList" parameterType="SConsumerCoupon" resultMap="SConsumerCouponResult">
<include refid="selectSConsumerCouponVo"/> <include refid="selectSConsumerCouponVo"/>
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
<sql id="selectSRoomVo"> <sql id="selectSRoomVo">
select id, select id,
store_id, store_id,
sort,
name, name,
room_type, room_type,
images, images,
......
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