Commit 76553aef by 吕明尚

增加短信发送接口

parent 0e6ee4c2
...@@ -7,6 +7,7 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -7,6 +7,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.util.Store;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -66,12 +67,22 @@ public class OrderTask { ...@@ -66,12 +67,22 @@ public class OrderTask {
@Autowired @Autowired
private WechatNewService wechatNewService; private WechatNewService wechatNewService;
@Autowired
private SmsService smsService;
@Autowired
private ISStoreService storeService;
final int ZERO = 0; final int ZERO = 0;
//10分钟的常量 //10分钟的常量
final long TEN_MINUTES = 60 * 10; final long TEN_MINUTES = 60 * 10;
//9分钟的常量 //9分钟的常量
final long NINE_MINUTES = 60 * 9; final long NINE_MINUTES = 60 * 9;
//15分钟的常量
final long FIFTEEN_MINUTES = 60 * 15;
//14分钟的常量
final long FOURTEEN_MINUTES = 60 * 14;
public void autoCancel() { public void autoCancel() {
...@@ -230,11 +241,19 @@ public class OrderTask { ...@@ -230,11 +241,19 @@ public class OrderTask {
Date expirationTime = jsonObject.getDate("expirationTime"); Date expirationTime = jsonObject.getDate("expirationTime");
String orderNo = jsonObject.getStr("orderNo"); String orderNo = jsonObject.getStr("orderNo");
//时间到期前10分钟到9分 //时间到期前10分钟到9分
// long expire = (expirationTime.getTime() - new Date().getTime()) / 1000; long expire = (expirationTime.getTime() - new Date().getTime()) / 1000;
// if (expire < TEN_MINUTES && expire > NINE_MINUTES) { // if (expire < TEN_MINUTES && expire > NINE_MINUTES) {
// SOrder byOrderNo = orderService.getByOrderNo(String.valueOf(orderNo)); // SOrder byOrderNo = orderService.getByOrderNo(String.valueOf(orderNo));
// wechatNewService.sendMiniSubscribeMessage(byOrderNo, MessageReminderEnum.RESERVER); // wechatNewService.sendMiniSubscribeMessage(byOrderNo, MessageReminderEnum.RESERVER);
// } // }
//判断时间是否在15分钟到14分钟
if (expire < FIFTEEN_MINUTES && expire > FOURTEEN_MINUTES) {
SOrder byOrderNo = orderService.getByOrderNo(String.valueOf(orderNo));
SStore sStore = storeService.getById(byOrderNo.getStoreId());
SRoom sRoom = roomService.getById(byOrderNo.getRoomId());
smsService.sendSmsOrderStartRemind(byOrderNo.getConsumerPhone(), sStore, sRoom);
return;
}
if (expirationTime.getTime() < new Date().getTime()) { if (expirationTime.getTime() < new Date().getTime()) {
sOrders.add(orderService.getByOrderNo(String.valueOf(orderNo))); sOrders.add(orderService.getByOrderNo(String.valueOf(orderNo)));
} }
......
...@@ -16,6 +16,7 @@ import share.common.exception.base.BaseException; ...@@ -16,6 +16,7 @@ import share.common.exception.base.BaseException;
import share.system.domain.Device; 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.service.*; import share.system.service.*;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -50,6 +51,15 @@ public class RedisTask { ...@@ -50,6 +51,15 @@ public class RedisTask {
@Autowired @Autowired
private WechatNewService wechatNewService; private WechatNewService wechatNewService;
@Autowired
private SmsService smsService;
@Autowired
private ISStoreService storeService;
@Autowired
private ISOrderService orderService;
//15分钟的常量 //15分钟的常量
final long FIFTEEN_MINUTES = 60 * 15; final long FIFTEEN_MINUTES = 60 * 15;
//14分钟的常量 //14分钟的常量
...@@ -112,6 +122,10 @@ public class RedisTask { ...@@ -112,6 +122,10 @@ public class RedisTask {
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(String.valueOf(o));
SStore sStore = storeService.getById(byOrderNo.getStoreId());
SRoom sRoom = roomService.getById(byOrderNo.getRoomId());
smsService.sendSmsOrderEndRemind(byOrderNo.getConsumerPhone(), sStore, sRoom);
return; return;
} }
//判断时间是否在5分钟到4分钟 //判断时间是否在5分钟到4分钟
......
...@@ -279,6 +279,7 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme ...@@ -279,6 +279,7 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
List<SRoomVo> roomVoList1 = roomVoListMap.get(voList.get(i).getId()); List<SRoomVo> roomVoList1 = roomVoListMap.get(voList.get(i).getId());
if (CollectionUtils.isEmpty(roomVoList1)) { if (CollectionUtils.isEmpty(roomVoList1)) {
voList.remove(i); voList.remove(i);
i = -1;
} else { } else {
voList.get(i).setRoomVoList(roomVoList1); voList.get(i).setRoomVoList(roomVoList1);
} }
......
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