Commit f44e14a4 by YG8999

短信提醒代码

parent 252bbed9
......@@ -54,7 +54,7 @@ public class Constants
public static final int NUM_ONE_HUNDRED = 100;
//验证码过期时间
public static final String CONFIG_KEY_SMS_CODE_EXPIRE = "1";
public static final String CONFIG_KEY_SMS_CODE_EXPIRE = "5";
//头部 token令牌key
......
package share.common.enums;
/**
* @className: share.common.enums.SmsTypeEnum
* @description: 短信类型
* @author: lwj
* @create: 2023-11-28 16:57
*/
public enum SmsTypeEnum {
SMS_CODE_TEMP(1,"sms.code.template","短信验证码"),
SMS_CLEAN_RECORDS_TEMP(2,"sms.clean.records.template","保洁任务短信提示"),
SMS_CLEAN_RECORDS_TEMP_15(3,"sms.clean.records.template.15","即将保洁任务短信提醒")
;
private Integer code;
private String value;
private String name;
SmsTypeEnum(Integer code, String value, String name) {
this.code = code;
this.value = value;
this.name = name;
}
public Integer getCode(){
return code;
}
public String getValue() {
return value;
}
public String getName() {
return name;
}
}
......@@ -20,6 +20,7 @@ import share.common.annotation.Log;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.enums.BusinessType;
import share.common.enums.CleaningStatusEnum;
import share.system.domain.SCleanRecords;
import share.system.domain.SConsumer;
import share.system.domain.vo.FrontTokenComponent;
......@@ -105,7 +106,7 @@ public class SCleanRecordsController extends BaseController
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sCleanRecords.setConsumerId(user.getId());
sCleanRecords.setStartDate(DateUtil.date());
sCleanRecords.setStatus(1);
sCleanRecords.setStatus(CleaningStatusEnum.CLEANING.getCode());
return toAjax(sCleanRecordsService.startCleanRecords(sCleanRecords));
}
......@@ -120,7 +121,7 @@ public class SCleanRecordsController extends BaseController
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
sCleanRecords.setConsumerId(user.getId());
sCleanRecords.setEndDate(DateUtil.date());
sCleanRecords.setStatus(2);
sCleanRecords.setStatus(CleaningStatusEnum.CLEANED.getCode());
return toAjax(sCleanRecordsService.updateSCleanRecords(sCleanRecords));
}
......
......@@ -43,7 +43,7 @@ public class SmsLog extends BaseEntity
/** 结果:1-成功,2-失败 */
@Excel(name = "结果:1-成功,2-失败")
private Long result;
private Integer result;
/** 返回内容 */
@Excel(name = "返回内容")
......
package share.system.service;
import share.system.domain.vo.DeviceParamVo;
import share.system.domain.vo.MqttxVo;
/**
* @className: share.system.service.DeviceOpService
......@@ -37,4 +38,17 @@ public interface DeviceOpService {
*/
void addGatewayDevice(String devId, String userName);
/**
* 远程语音播报
* @param roomId 房间id
* @param phone 操作用户
* @param content 语音内容
* @param startTime 开始时间
* @param endTime 结束时间
* @param number 播报次数
* @return
*/
void actionExecute(Long roomId, String phone,
String content, String startTime, String endTime, String number);
}
......@@ -12,12 +12,6 @@ import share.system.domain.SStore;
public interface SmsService {
/**
* 查询短信模板接口
* @param
*/
JSONArray queryTemplate();
/**
* 发送短信验证码
* @param phone
* @return
......@@ -25,10 +19,34 @@ public interface SmsService {
boolean sendSmsCode(String phone);
/**
* 发送保洁打扫提示短信
* 发送保洁任务提示短信
* @param phone
* @return
*/
boolean sendSmsCleanRecords(String phone, SStore store, SRoom room);
/**
* 发送即将保洁任务提示短信(订单结束前15分钟)
* @param phone
* @return
*/
boolean sendSmsCleanRecordsRemind15(String phone, SStore store, SRoom room);
/**
* 发送订单即将开始提示短信(订单开始前15分钟)
* @param phone
* @return
*/
boolean sendSmsOrderStartRemind(String phone, SStore store, SRoom room);
/**
* 发送订单即将结束提示短信(订单结束前15分钟)
* @param phone
* @return
*/
boolean sendSmsOrderEndRemind(String phone, SStore store, SRoom room);
}
......@@ -124,6 +124,25 @@ public class DeviceOpServiceImpl implements DeviceOpService {
deviceLogService.addDeviceLog(mqttxVo, userName);
}
@Override
public void actionExecute(Long roomId, String phone, String content,
String startTime, String endTime, String number) {
SRoom room = roomMapper.selectSRoomById(roomId);
if (room != null) {
Device param = new Device();
param.setRoomId(room.getId());
param.setDevType(DeviceType.DEVICE_0001.getCode());
List<Device> list = deviceMapper.selectDeviceList(param);
for (Device device : list) {
// 获取mqtt的topic、payload
MqttxVo mqttxVo = mqttxService.actionExecute(device.getDevId(), phone, content, startTime, endTime, number);
// 发送mqtt消息
mqttGatewayComponent.sendToMqtt(mqttxVo.getTopic(), 0, mqttxVo.getPayload());
// 写日志记录
deviceLogService.addDeviceLog(mqttxVo, phone);
}
}
}
}
......@@ -203,13 +203,20 @@ public class SCleanRecordsServiceImpl implements ISCleanRecordsService
@Override
public int startCleanRecords(SCleanRecords sCleanRecords) {
LambdaQueryWrapper<SCleanRecords> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SCleanRecords::getStatus,1);
queryWrapper.eq(SCleanRecords::getStatus,CleaningStatusEnum.CLEANING.getCode());
queryWrapper.eq(SCleanRecords::getConsumerId,sCleanRecords.getConsumerId());
queryWrapper.ne(SCleanRecords::getId,sCleanRecords.getId());
List<SCleanRecords> list = sCleanRecordsMapper.selectList(queryWrapper);
if (list.size() > 0) {
throw new RuntimeException("当前用户有未结束的保洁任务");
}
SCleanRecords records = sCleanRecordsMapper.selectSCleanRecordsById(sCleanRecords.getId());
if (records == null) {
throw new RuntimeException("当前保洁任务不存在!");
}
if (!records.getStatus().equals(CleaningStatusEnum.UNCLEAN.getCode())) {
throw new RuntimeException("当前保洁任务已开始或完成");
}
return updateSCleanRecords(sCleanRecords);
}
......
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