Commit c46efc2b by 吕明尚

优惠卷修改问题

parent 6c1ccafa
......@@ -87,16 +87,16 @@ public class QPServiceImpl implements QPService {
queryWrapper.eq(SConsumerCoupon::getDealId, prepare.getDeal_id());
queryWrapper.eq(SConsumerCoupon::getCouponCode, code);
queryWrapper.eq(SConsumerCoupon::getUseStatus, UserStatusEnum.UNUSED.getCode());
SConsumerCoupon two = isConsumerCouponService.getOne(queryWrapper);
if (ObjectUtils.isNotEmpty(two)) {
SConsumerCoupon couponTwo = isConsumerCouponService.getOne(queryWrapper);
if (ObjectUtils.isNotEmpty(couponTwo)) {
//判断是否本人领取过
if (!two.getConsumerId().equals(user.getId())) {
return null;
} else {
if (couponTwo.getConsumerId().equals(user.getId())) {
//领取删除原来的
isConsumerCouponService.deleteSConsumerCouponById(two.getId());
isConsumerCouponService.deleteSConsumerCouponById(couponTwo.getId());
//删除redis
redisUtil.delete(ReceiptRdeisEnum.PREPARE.getValue() + prepare.getReceipt_code());
} else {
return null;
}
}
//根据优惠卷名称查询优惠劵配置
......
......@@ -136,14 +136,18 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
if (CollectionUtils.isEmpty(sConsumerCoupons)) {
return sConsumerCoupons;
}
//查询所有门店
List<SStore> sStores = sStoreService.list();
//查询所有房间
List<SRoom> sRooms = sRoomService.list();
//迭代
sConsumerCoupons.forEach(item -> {
if (item.getStartDate().compareTo(couponRequest.getPreStartDate()) <= 0 && item.getEndDate().compareTo(couponRequest.getPreEndDate()) >= 0) {
SimpleDateFormat sdf1 = new SimpleDateFormat("HH:mm");
String proStartTime = sdf1.format(couponRequest.getPreStartDate());
if (proStartTime.compareTo(item.getCouponTimeStart()) >= 0) {
SStore sStore = sStoreService.getById(couponRequest.getStoreId());
SRoom byId = sRoomService.getById(couponRequest.getRoomId());
SStore sStore = sStores.stream().filter(store -> store.getId().equals(couponRequest.getStoreId())).findFirst().orElse(null);
SRoom byId = sRooms.stream().filter(room -> room.getId().equals(couponRequest.getRoomId())).findFirst().orElse(null);
BigDecimal subtract = new BigDecimal(item.getMinDuration());
if (item.getCouponType().equals(CouponTypeEnum.PACKAGE.getCode())) {
if (couponRequest.getOrderMode().equals(BuyTypeEnum.PACK.getCode())) {
......
......@@ -919,12 +919,22 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if (Objects.isNull(sRoomVo)) {
throw new BaseException("房间不存在!");
}
Device device = new Device();
device.setRoomId(sOrder.getRoomId());
device.setDevType(DeviceType.DEVICE_CCEE.getCode());
List<Device> deviceList = deviceService.selectDeviceList(device);
LambdaQueryWrapper<Device> deviceLambdaQueryWrapper = new LambdaQueryWrapper<>();
deviceLambdaQueryWrapper.eq(Device::getRoomId, sOrder.getRoomId());
deviceLambdaQueryWrapper.in(Device::getDevType, DeviceType.DEVICE_CCEE.getCode(), DeviceType.DEVICE_0001.getCode());
List<Device> deviceList = deviceService.list(deviceLambdaQueryWrapper);
if (CollectionUtils.isEmpty(deviceList)) {
throw new BaseException("设备不存在!");
throw new BaseException("房间设备缺失!");
}
if (deviceList.stream().filter(device ->
device.getDevType().equals(DeviceType.DEVICE_CCEE.getCode())
).collect(Collectors.toList()).isEmpty()) {
throw new BaseException("房间门锁设备不存在!");
}
if (deviceList.stream().filter(item ->
item.getDevType().equals(DeviceType.DEVICE_0001.getCode())
).collect(Collectors.toList()).isEmpty()) {
throw new BaseException("房间取电设备不存在!");
}
if (sOrder.getStatus().equals(OrderStatusEnum.UNUSED.getCode())) {
if (RoomStatusEnum.HOLD.getValue().compareTo(sRoomVo.getStatus())==0
......@@ -956,10 +966,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
Device device1 = new Device();
device1.setRoomId(sOrder.getRoomId());
device1.setDevType(DeviceType.DEVICE_0001.getCode());
List<Device> deviceList1 = deviceService.selectDeviceList(device1);
if (CollectionUtils.isEmpty(deviceList1)) {
throw new BaseException("设备不存在!");
}
redisUtils.delete(ReceiptRdeisEnum.ORDER_NO.getValue() + sOrder.getOrderNo());
// wechatNewService.sendMiniSubscribeMessage(sOrder, MessageReminderEnum.START);
//开门、取电
......
......@@ -189,7 +189,7 @@
<trim prefix="SET" suffixOverrides=",">
<if test="consumerId != null">consumer_id = #{consumerId},</if>
<if test="couponId != null">coupon_id = #{couponId},</if>
<if test="dealId != null">deal_id = #{dealId}</if>
<if test="dealId != null">deal_id = #{dealId},</if>
<if test="couponCode != null and couponCode != ''">coupon_code = #{couponCode},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="couponType != null">coupon_type = #{couponType},</if>
......
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