Commit 5ec2a8d4 by 吕明尚

在订单结束前30分钟进行保洁消息通知

parent e3121473
...@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil; ...@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import com.dianping.openapi.sdk.api.oauth.entity.CustomerRefreshTokenResponse; import com.dianping.openapi.sdk.api.oauth.entity.CustomerRefreshTokenResponse;
import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -17,6 +18,7 @@ import share.system.domain.Device; ...@@ -17,6 +18,7 @@ import share.system.domain.Device;
import share.system.domain.SOrder; import share.system.domain.SOrder;
import share.system.domain.SRoom; import share.system.domain.SRoom;
import share.system.domain.SStore; import share.system.domain.SStore;
import share.system.mapper.SConsumerMapper;
import share.system.service.*; import share.system.service.*;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -60,6 +62,14 @@ public class RedisTask { ...@@ -60,6 +62,14 @@ public class RedisTask {
@Autowired @Autowired
private ISOrderService orderService; private ISOrderService orderService;
@Autowired
private SConsumerService sConsumerService;
//30分钟的常量
final long THIRTY_MINUTES = 60 * 30;
//29分钟的常量
final long THIRTY_NINE_MINUTES = 60 * 29;
//15分钟的常量 //15分钟的常量
final long FIFTEEN_MINUTES = 60 * 15; final long FIFTEEN_MINUTES = 60 * 15;
//14分钟的常量 //14分钟的常量
...@@ -68,6 +78,8 @@ public class RedisTask { ...@@ -68,6 +78,8 @@ public class RedisTask {
final long FIVE_MINUTES = 60 * 5; final long FIVE_MINUTES = 60 * 5;
//4分钟的常量 //4分钟的常量
final long FOUR_MINUTES = 60 * 4; final long FOUR_MINUTES = 60 * 4;
//3分钟的常量
final long THREE_MINUTES = 60 * 3;
public void AuToReceiptCode() { public void AuToReceiptCode() {
...@@ -117,14 +129,26 @@ public class RedisTask { ...@@ -117,14 +129,26 @@ 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");
//判断时间是否在15分钟到14分钟 SOrder byOrderNo = orderService.getByOrderNo(jsonObject.getStr("orderNo"));
long expire = (expirationTime.getTime() - new Date().getTime()) / 1000; long expire = (expirationTime.getTime() - new Date().getTime()) / 1000;
//订单结束前30分钟,发送保洁消息
if (expire < THIRTY_MINUTES && expire > THIRTY_NINE_MINUTES) {
SStore store = storeService.getById(byOrderNo.getStoreId());
SRoom room = roomService.getById(byOrderNo.getRoomId());
sConsumerService.selectListByStoreId(byOrderNo.getStoreId()).stream().forEach(item -> {
// 循环发送短信提示门店保洁打扫卫生
smsService.sendSmsCleanRecords(item.getPhone(), store, room);
});
}
//判断时间是否在15分钟到14分钟
if (expire < FIFTEEN_MINUTES && expire > FOURTEEN_MINUTES) { if (expire < FIFTEEN_MINUTES && expire > FOURTEEN_MINUTES) {
//语音 //语音
getResult(o, jsonObject, VoiceEnum.RENEWAL_REMINDER1.getCode()); getResult(o, jsonObject, VoiceEnum.RENEWAL_REMINDER1.getCode());
SOrder byOrderNo = orderService.getByOrderNo(jsonObject.getStr("orderNo"));
SStore sStore = storeService.getById(byOrderNo.getStoreId()); SStore sStore = storeService.getById(byOrderNo.getStoreId());
SRoom sRoom = roomService.getById(byOrderNo.getRoomId()); SRoom sRoom = roomService.getById(byOrderNo.getRoomId());
// smsService.sendSmsCleanRecordsRemind15(byOrderNo.getConsumerPhone(), sStore, sRoom);
smsService.sendSmsOrderEndRemind(byOrderNo.getConsumerPhone(), sStore, sRoom); smsService.sendSmsOrderEndRemind(byOrderNo.getConsumerPhone(), sStore, sRoom);
return; return;
} }
...@@ -181,7 +205,7 @@ public class RedisTask { ...@@ -181,7 +205,7 @@ public class RedisTask {
DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN),
DateUtil.format(DateUtil.offsetMinute(new Date(), 1), DatePattern.NORM_DATETIME_PATTERN), "1"); DateUtil.format(DateUtil.offsetMinute(new Date(), 1), DatePattern.NORM_DATETIME_PATTERN), "1");
//延时5分钟断电 //延时5分钟断电
deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(), OpTypeEnum.CUT_ELECTRIC.getCode(), true, FIVE_MINUTES); deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(), OpTypeEnum.CUT_ELECTRIC.getCode(), true, THREE_MINUTES);
} }
} }
}); });
......
...@@ -122,4 +122,6 @@ public interface SConsumerService extends IService<SConsumer> ...@@ -122,4 +122,6 @@ public interface SConsumerService extends IService<SConsumer>
int addCleanConsumer(SConsumer sConsumer); int addCleanConsumer(SConsumer sConsumer);
int deleteCleanConsumerByIds(Long[] ids); int deleteCleanConsumerByIds(Long[] ids);
public List<SConsumer> selectListByStoreId(Long storeId);
} }
...@@ -143,7 +143,7 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC ...@@ -143,7 +143,7 @@ public class SCleanRecordsServiceImpl extends ServiceImpl<SCleanRecordsMapper,SC
if (b) { if (b) {
SStore store = sStoreMapper.selectSStoreById(storeId); SStore store = sStoreMapper.selectSStoreById(storeId);
SRoom room = sRoomMapper.selectSRoomById(roomId); SRoom room = sRoomMapper.selectSRoomById(roomId);
sendSms(storeId,store,room); // sendSms(storeId,store,room);
} }
return b; return b;
} }
......
...@@ -105,6 +105,7 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer ...@@ -105,6 +105,7 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
return baseMapper.deleteSConsumerByIds(ids); return baseMapper.deleteSConsumerByIds(ids);
} }
/** /**
* 删除会员用户信息 * 删除会员用户信息
* *
...@@ -221,6 +222,11 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer ...@@ -221,6 +222,11 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
return baseMapper.selectUnallocatedList(sConsumer); return baseMapper.selectUnallocatedList(sConsumer);
} }
public List<SConsumer> selectListByStoreId(Long storeId) {
return baseMapper.selectListByStoreId(storeId);
}
@Override @Override
public int addCleanConsumer(SConsumer sConsumer) { public int addCleanConsumer(SConsumer sConsumer) {
LambdaQueryWrapper<SConsumer> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SConsumer> queryWrapper = new LambdaQueryWrapper<>();
......
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