Commit 29341e77 by 吕明尚

修改自动添加保洁定时任务

parent 59428dc2
...@@ -226,11 +226,15 @@ public class RedisTask { ...@@ -226,11 +226,15 @@ public class RedisTask {
String value = redisUtil.get(String.valueOf(o)); String value = redisUtil.get(String.valueOf(o));
JSONObject jsonObject = new JSONObject(value); JSONObject jsonObject = new JSONObject(value);
Date expirationTime = jsonObject.getDate("expirationTime"); Date expirationTime = jsonObject.getDate("expirationTime");
SOrder sOrder = sOrders.stream().filter(item -> item.getOrderNo().equals(jsonObject.getStr("orderNo"))).findFirst().orElse(null); SOrder sOrder;
sOrder = sOrders.stream().filter(item -> item.getOrderNo().equals(jsonObject.getStr("orderNo"))).findFirst().orElse(null);
if (ObjectUtils.isEmpty(sOrder)) { if (ObjectUtils.isEmpty(sOrder)) {
redisUtil.delete(o); sOrder = isOrderService.getByOrderNo(jsonObject.getStr("orderNo"));
logger.info("订单号为:" + jsonObject.getStr("orderNo") + "的订单不存在"); if (ObjectUtils.isEmpty(sOrder)) {
throw new BaseException("订单不存在!"); redisUtil.delete(o);
logger.info("订单号为:{}的订单不存在", jsonObject.getStr("orderNo"));
throw new BaseException("订单不存在!");
}
} }
long expire = (expirationTime.getTime() - new Date().getTime()) / 1000; long expire = (expirationTime.getTime() - new Date().getTime()) / 1000;
//判断时间是否在15分钟到14分钟 //判断时间是否在15分钟到14分钟
...@@ -242,9 +246,10 @@ public class RedisTask { ...@@ -242,9 +246,10 @@ public class RedisTask {
DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode()); DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode());
logger.info("订单号为:" + sOrder.getOrderNo() + "的订单距离结束时间还有15分钟"); logger.info("订单号为:" + sOrder.getOrderNo() + "的订单距离结束时间还有15分钟");
// 从门店集合中判断门店id相同的门店对象 // 从门店集合中判断门店id相同的门店对象
SStore sStore = sStoreList.stream().filter(item -> item.getId().equals(sOrder.getStoreId())).findFirst().orElse(null); SOrder finalSOrder = sOrder;
SStore sStore = sStoreList.stream().filter(item -> item.getId().equals(finalSOrder.getStoreId())).findFirst().orElse(null);
// 从房间集合中判断房间id相同的房间对象 // 从房间集合中判断房间id相同的房间对象
SRoom sRoom = sRoomList.stream().filter(item -> item.getId().equals(sOrder.getRoomId())).findFirst().orElse(null); SRoom sRoom = sRoomList.stream().filter(item -> item.getId().equals(finalSOrder.getRoomId())).findFirst().orElse(null);
// 通知用户 // 通知用户
smsService.sendSmsOrderEndRemind(sOrder.getConsumerPhone(), sStore, sRoom); smsService.sendSmsOrderEndRemind(sOrder.getConsumerPhone(), sStore, sRoom);
//推送订单结束消息 //推送订单结束消息
......
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