Commit 8f767caa by 吕明尚

自动添加保洁订单判断续单

parent 287d7118
......@@ -5,9 +5,11 @@ import com.dianping.openapi.sdk.api.oauth.entity.CustomerRefreshTokenResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import share.common.core.redis.RedisUtil;
import share.common.enums.OrderStatusEnum;
import share.common.enums.OrderTypeEnum;
import share.common.enums.ReceiptRdeisEnum;
import share.system.domain.SOrder;
import share.system.service.ISCleanRecordsService;
......@@ -16,6 +18,7 @@ import share.system.service.ISOrderService;
import share.system.service.QPService;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
......@@ -90,6 +93,23 @@ public class RedisTask {
if (ObjectUtils.isEmpty(sOrder)) {
return;
}
//查询当前门店房间下是否有续单
SOrder order = new SOrder();
order.setStoreId(sOrder.getStoreId());
order.setRoomId(sOrder.getRoomId());
order.setConsumerId(sOrder.getConsumerId());
order.setOrderType(OrderTypeEnum.RENEW.getCode());
order.setStatus(OrderStatusEnum.UNUSED.getCode());
//查询当前订单下是否存在未使用的续费订单
List<SOrder> sOrders = isOrderService.selectSOrderList(order);
if (!CollectionUtils.isEmpty(sOrders)) {
//删除当前的订单
redisUtil.delete(o);
//更改订单状态
sOrder.setStatus(OrderStatusEnum.USED.getCode());
isOrderService.updateById(sOrder);
return;
}
//更改订单状态
sOrder.setStatus(OrderStatusEnum.USED.getCode());
isOrderService.updateById(sOrder);
......
......@@ -242,6 +242,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
// 加入自动未支付自动取消队列
redisUtil.lPush(Constants.ORDER_AUTO_CANCEL_KEY, sOrder.getOrderNo());
}
save(sOrder);
if (response.getStatus().equals(YesNoEnum.yes.getFlag())) {
if (Objects.nonNull(request.getCouponId()) && request.getCouponId() != 0) {
SConsumerCoupon byId = consumerCouponService.getById(request.getCouponId());
......@@ -255,11 +256,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SConsumptionRecords sConsumptionRecords = new SConsumptionRecords();
sConsumptionRecords.setConsumerId(sOrder.getConsumerId());
sConsumptionRecords.setOrderId(sOrder.getId());
sConsumptionRecords.setName(sOrder.getPackName());
sConsumptionRecords.setName(user.getNickName());
sConsumptionRecords.setPrice(sOrder.getPayPrice());
sConsumptionRecordsService.insertSConsumptionRecords(sConsumptionRecords);
}
save(sOrder);
return response;
}
......
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