Commit 7b39e7a3 by 吕明尚

验卷增加判断,区别是团购劵还是时长劵

parent ea4d021b
......@@ -133,11 +133,11 @@ public class QPServiceImpl implements QPService {
}
});
List<SCoupon> sCoupons = isCouponService.selectSCouponByName(prepare.getDeal_title());
SCoupon sCoupon = new SCoupon();
SCoupon sCoupon = null;
if (!CollectionUtils.isEmpty(sCoupons)) {
sCoupon = isCouponService.selectSCouponByName(prepare.getDeal_title()).get(0);
}
if (!ObjectUtils.isEmpty(sCoupon)) {
if (ObjectUtils.isEmpty(sCoupon)) {
sConsumerCoupon.setCouponType(CouponTypeEnum.CASH.getCode());
sConsumerCoupon.setStoreType(StoreType.getCodeList());
sConsumerCoupon.setRoomType(RoomType.getCodeList());
......
......@@ -151,11 +151,11 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
sCleanRecords.setStatus(0);
sCleanRecords.setCreateTime(DateUtils.getNowDate());
boolean b = 0 < baseMapper.insertSCleanRecords(sCleanRecords);
if (b) {
SStore store = sStoreMapper.selectSStoreById(storeId);
SRoom room = sRoomMapper.selectSRoomById(roomId);
sendSms(storeId, store, room);
}
// if (b) {
// SStore store = sStoreMapper.selectSStoreById(storeId);
// SRoom room = sRoomMapper.selectSRoomById(roomId);
// sendSms(storeId, store, room);
// }
return b;
}
......
......@@ -120,7 +120,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
List<SCoupon> sCoupons = sCouponService.selectSCouponByIds(couponIds);
sCoupons.stream().forEach(item -> {
//判断ids里的优惠券id是否等于sCoupons里的优惠券id
if (Arrays.asList(couponIds).contains(item.getId())) {
if (Arrays.asList(couponIds).contains(item.getId()) && item.getCouponType().equals(CouponTypeEnum.DURATION.getCode())) {
//优惠券数量加一
item.setNumber(item.getNumber() + 1);
sCouponService.updateSCoupon(item);
......@@ -215,6 +215,9 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
if (sCoupon.getNumber().equals(ZERO)) {
throw new RuntimeException("优惠券数量为0");
}
if (!sCoupon.getCouponType().equals(CouponTypeEnum.DURATION.getCode())) {
throw new RuntimeException("只能赠送时长劵");
}
//创建优惠卷领取记录
SConsumerCoupon newSConsumerCoupon = new SConsumerCoupon();
newSConsumerCoupon.setCouponId(sCoupon.getId());
......@@ -236,6 +239,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
newSConsumerCoupon.setPlatformType(String.valueOf(sCoupon.getPlatformType()));
newSConsumerCoupon.setStartDate(sCoupon.getStartDate());
newSConsumerCoupon.setEndDate(sCoupon.getEndDate());
newSConsumerCoupon.setRemark(sCoupon.getRemark());
int insert = sConsumerCouponMapper.insert(newSConsumerCoupon);
if (insert > 0) {
//优惠券数量减一
......
......@@ -327,8 +327,14 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (response.getStatus().equals(YesNoEnum.yes.getFlag())) {
if (Objects.nonNull(request.getCouponId()) && request.getCouponId() != 0) {
SConsumerCoupon byId = consumerCouponService.getById(request.getCouponId());
if (StringUtils.isNotEmpty(byId.getCouponCode())) {
if (byId.getUseStatus().equals(UserStatusEnum.UNUSED.getCode())) {
//验劵
qpService.consume(byId.getCouponCode(), 1, sStore.getOpenShopUuid(), ConsumerCouponStatusEnum.ORDER.getCode());
} else {
throw new BaseException("优惠券已使用!");
}
}
SConsumerCoupon consumerCoupon = new SConsumerCoupon();
consumerCoupon.setId(request.getCouponId());
consumerCoupon.setUseStatus(UserStatusEnum.USED.getCode());
......@@ -361,11 +367,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
cn.hutool.core.date.DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN),
cn.hutool.core.date.DateUtil.format(cn.hutool.core.date.DateUtil.offsetMinute(new Date(), 1), DatePattern.NORM_DATETIME_PATTERN), "1");
SRoom sRoom = roomService.getById(sOrder.getRoomId());
//通知保洁人员
sConsumerService.selectListByStoreId(sOrder.getStoreId()).stream().forEach(item -> {
// 循环发送短信提示门店保洁打扫卫生
smsService.sendSmsCleanRecordsStopRemind(item.getPhone(), sStore, sRoom);
});
// //通知保洁人员
// sConsumerService.selectListByStoreId(sOrder.getStoreId()).stream().forEach(item -> {
// // 循环发送短信提示门店保洁打扫卫生
// smsService.sendSmsCleanRecordsStopRemind(item.getPhone(), sStore, sRoom);
// });
}
}
Map<String, String> map = new HashMap<>();
......@@ -723,7 +729,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SConsumerCoupon consumerCoupon = consumerCouponService.getById(couponId);
if (ObjectUtil.isNotEmpty(consumerCoupon)) {
if (consumerCoupon.getUseStatus().equals(UserStatusEnum.UNUSED.getCode())) {
if (StringUtils.isNotEmpty(consumerCoupon.getCouponCode())) {
//验劵
qpService.consume(consumerCoupon.getCouponCode(), 1, sStore.getOpenShopUuid(), ConsumerCouponStatusEnum.WECHAT.getCode());
}
consumerCoupon.setUseStatus(UserStatusEnum.USED.getCode());
consumerCouponService.updateById(consumerCoupon);
}
......@@ -736,10 +745,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
cn.hutool.core.date.DateUtil.format(cn.hutool.core.date.DateUtil.offsetMinute(new Date(), 1), DatePattern.NORM_DATETIME_PATTERN), "1");
SRoom sRoom = roomService.getById(sOrder.getRoomId());
//通知保洁人员
sConsumerService.selectListByStoreId(sOrder.getStoreId()).stream().forEach(item -> {
// 循环发送短信提示门店保洁打扫卫生
smsService.sendSmsCleanRecordsStopRemind(item.getPhone(), sStore, sRoom);
});
// sConsumerService.selectListByStoreId(sOrder.getStoreId()).stream().forEach(item -> {
// // 循环发送短信提示门店保洁打扫卫生
// smsService.sendSmsCleanRecordsStopRemind(item.getPhone(), sStore, sRoom);
// });
}
SConsumptionRecords sConsumptionRecords = new SConsumptionRecords();
sConsumptionRecords.setConsumerId(sOrder.getConsumerId());
......
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