forked from dyf/fys-Multi-tenant
feat(mqtt): 添加报警检查服务实现多阶段报警处理
- 实现 AlarmCheckService 提供延迟队列消费者功能 - 添加 AlarmDelayProvider 接口定义延迟检查任务 - 集成 AlarmStageConfig 支持租户配置报警阶段延迟时间 - 重构 AliyunVoiceUtil 返回完整响应对象而非字符串 - 在 AppDeviceController 中新增 AlarmList 接口查询设备告警列表 - 扩展设备相关控制器支持数据来源枚举参数传递 - 新增 Xinghan 指令控制器提供 HBY018A 设备专用接口 - 定义 DataSourceEnum 枚举区分 APP 和 Web 数据来源 - 扩展 Device 实体类增加紧急联系人和通知配置字段 - 添加 DeviceAlarm 实体类告警状态和等级属性 - 新增 DeviceContactPhoneBo 处理设备联系人信息 - 优化设备操作记录日志支持数据来源标识 - 实现设备自定义语音短信消息编辑功能 - 添加设备通知开关和紧急联系人设置接口
This commit is contained in:
@ -0,0 +1,106 @@
|
||||
package com.fuyuanshen.equipment.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.fuyuanshen.common.core.domain.R;
|
||||
import com.fuyuanshen.common.core.validate.AddGroup;
|
||||
import com.fuyuanshen.common.core.validate.EditGroup;
|
||||
import com.fuyuanshen.common.excel.utils.ExcelUtil;
|
||||
import com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
|
||||
import com.fuyuanshen.common.log.annotation.Log;
|
||||
import com.fuyuanshen.common.log.enums.BusinessType;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.common.web.core.BaseController;
|
||||
import com.fuyuanshen.equipment.domain.bo.SmsSendRecordBo;
|
||||
import com.fuyuanshen.equipment.domain.vo.SmsSendRecordVo;
|
||||
import com.fuyuanshen.equipment.service.ISmsSendRecordService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 报警通知记录(短信/语音)
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/system/sendRecord")
|
||||
public class SmsSendRecordController extends BaseController {
|
||||
|
||||
private final ISmsSendRecordService smsSendRecordService;
|
||||
|
||||
/**
|
||||
* 查询报警通知记录(短信/语音)列表
|
||||
*/
|
||||
@SaCheckPermission("system:sendRecord:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<SmsSendRecordVo> list(SmsSendRecordBo bo, PageQuery pageQuery) {
|
||||
return smsSendRecordService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 报警通知记录(短信/语音)列表
|
||||
*/
|
||||
@SaCheckPermission("system:sendRecord:export")
|
||||
@Log(title = "报警通知记录(短信/语音)", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(SmsSendRecordBo bo, HttpServletResponse response) {
|
||||
List<SmsSendRecordVo> list = smsSendRecordService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "报警通知记录(短信/语音)", SmsSendRecordVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取报警通知记录(短信/语音)详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("system:sendRecord:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<SmsSendRecordVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(smsSendRecordService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增报警通知记录(短信/语音)
|
||||
*/
|
||||
@SaCheckPermission("system:sendRecord:add")
|
||||
@Log(title = "报警通知记录(短信/语音)", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody SmsSendRecordBo bo) {
|
||||
return toAjax(smsSendRecordService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改报警通知记录(短信/语音)
|
||||
*/
|
||||
@SaCheckPermission("system:sendRecord:edit")
|
||||
@Log(title = "报警通知记录(短信/语音)", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SmsSendRecordBo bo) {
|
||||
return toAjax(smsSendRecordService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除报警通知记录(短信/语音)
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("system:sendRecord:remove")
|
||||
@Log(title = "报警通知记录(短信/语音)", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(smsSendRecordService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
||||
@ -183,4 +183,25 @@ public class Device extends TenantEntity {
|
||||
@Schema(title = "轨迹ID(高德)")
|
||||
private Long trid;
|
||||
|
||||
/**
|
||||
* 联系人1手机
|
||||
*/
|
||||
private String contact1Phone;
|
||||
/**
|
||||
* 联系人2手机
|
||||
*/
|
||||
private String contact2Phone;
|
||||
/**
|
||||
* 自定义语音文本
|
||||
*/
|
||||
private String sosVoiceMsg;
|
||||
/**
|
||||
* 自定义短信文本
|
||||
*/
|
||||
private String sosSmsMsg;
|
||||
/**
|
||||
* 通知开关,0关闭,1短信,2语音,3全开
|
||||
*/
|
||||
private Integer notificationEnabled;
|
||||
|
||||
}
|
||||
|
||||
@ -109,5 +109,13 @@ public class DeviceAlarm extends TenantEntity {
|
||||
@Schema(title = "设备IMEI")
|
||||
@AutoMapping(target = "deviceImei")
|
||||
private String deviceImei;
|
||||
/**
|
||||
* 告警状态,0 解除告警, 1 告警中
|
||||
*/
|
||||
private Integer alarmState;
|
||||
/**
|
||||
* 警报等级
|
||||
*/
|
||||
private Integer alarmLevel;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,79 @@
|
||||
package com.fuyuanshen.equipment.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fuyuanshen.common.tenant.core.TenantEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 报警通知记录(短信/语音)对象 sms_send_record
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("sms_send_record")
|
||||
public class SmsSendRecord extends TenantEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 关联的报警记录ID
|
||||
*/
|
||||
private Long alarmId;
|
||||
|
||||
/**
|
||||
* 设备IMEI(冗余方便查询)
|
||||
*/
|
||||
private String deviceImei;
|
||||
|
||||
/**
|
||||
* 通知类型:SMS-短信, VOICE-语音呼叫
|
||||
*/
|
||||
private String notifyType;
|
||||
|
||||
/**
|
||||
* 接收通知的手机号
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 消息内容(短信内容或语音模板参数)
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 短信/语音模板ID
|
||||
*/
|
||||
private String templateId;
|
||||
|
||||
/**
|
||||
* 发送状态:0-待发送, 1-成功, 2-失败
|
||||
*/
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 平台返回的状态码
|
||||
*/
|
||||
private String responseCode;
|
||||
|
||||
/**
|
||||
* 平台返回的描述信息
|
||||
*/
|
||||
private String responseMsg;
|
||||
|
||||
/**
|
||||
* 实际发送时间(调用平台时间)
|
||||
*/
|
||||
private Date sendTime;
|
||||
|
||||
|
||||
}
|
||||
@ -119,4 +119,9 @@ public class DeviceAlarmBo extends TenantEntity {
|
||||
*/
|
||||
private Integer alarmState;
|
||||
|
||||
/**
|
||||
* 警报等级
|
||||
*/
|
||||
private Integer alarmLevel;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
package com.fuyuanshen.equipment.domain.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DeviceContactPhoneBo {
|
||||
private Long deviceId;
|
||||
/**
|
||||
* 联系人1手机
|
||||
*/
|
||||
private String contact1Phone;
|
||||
/**
|
||||
* 联系人2手机
|
||||
*/
|
||||
private String contact2Phone;
|
||||
/**
|
||||
* 通知开关
|
||||
*/
|
||||
private Integer notificationEnabled;
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
package com.fuyuanshen.equipment.domain.bo;
|
||||
|
||||
import com.fuyuanshen.common.core.validate.AddGroup;
|
||||
import com.fuyuanshen.common.core.validate.EditGroup;
|
||||
import com.fuyuanshen.common.mybatis.core.domain.BaseEntity;
|
||||
import com.fuyuanshen.equipment.domain.DeviceLog;
|
||||
import com.fuyuanshen.equipment.domain.SmsSendRecord;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = SmsSendRecord.class, reverseConvertGenerate = false)
|
||||
public class SmsSendRecordBo extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 关联的报警记录ID
|
||||
*/
|
||||
@NotNull(message = "关联的报警记录ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long alarmId;
|
||||
|
||||
/**
|
||||
* 设备IMEI(冗余方便查询)
|
||||
*/
|
||||
@NotBlank(message = "设备IMEI(冗余方便查询)不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String deviceImei;
|
||||
|
||||
/**
|
||||
* 通知类型:SMS-短信, VOICE-语音呼叫
|
||||
*/
|
||||
@NotBlank(message = "通知类型:SMS-短信, VOICE-语音呼叫不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String notifyType;
|
||||
|
||||
/**
|
||||
* 接收通知的手机号
|
||||
*/
|
||||
@NotBlank(message = "接收通知的手机号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 消息内容(短信内容或语音模板参数)
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 短信/语音模板ID
|
||||
*/
|
||||
private String templateId;
|
||||
|
||||
/**
|
||||
* 发送状态:0-待发送, 1-成功, 2-失败
|
||||
*/
|
||||
@NotNull(message = "发送状态:0-待发送, 1-成功, 2-失败不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 平台返回的状态码
|
||||
*/
|
||||
private String responseCode;
|
||||
|
||||
/**
|
||||
* 平台返回的描述信息
|
||||
*/
|
||||
private String responseMsg;
|
||||
|
||||
/**
|
||||
* 实际发送时间(调用平台时间)
|
||||
*/
|
||||
private Date sendTime;
|
||||
}
|
||||
@ -136,4 +136,13 @@ public class DeviceAlarmVo implements Serializable {
|
||||
@Schema(name = "设备图片")
|
||||
private String devicePic;
|
||||
|
||||
/**
|
||||
* 警报等级
|
||||
*/
|
||||
private Integer alarmLevel;
|
||||
/**
|
||||
* 租户编号
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,87 @@
|
||||
package com.fuyuanshen.equipment.domain.vo;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import com.fuyuanshen.common.excel.annotation.ExcelDictFormat;
|
||||
import com.fuyuanshen.common.excel.convert.ExcelDictConvert;
|
||||
import com.fuyuanshen.equipment.domain.DeviceLog;
|
||||
import com.fuyuanshen.equipment.domain.SmsSendRecord;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = SmsSendRecord.class)
|
||||
public class SmsSendRecordVo implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ExcelProperty(value = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 关联的报警记录ID
|
||||
*/
|
||||
@ExcelProperty(value = "关联的报警记录ID")
|
||||
private Long alarmId;
|
||||
|
||||
/**
|
||||
* 设备IMEI(冗余方便查询)
|
||||
*/
|
||||
@ExcelProperty(value = "设备IMEI", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "冗=余方便查询")
|
||||
private String deviceImei;
|
||||
|
||||
/**
|
||||
* 通知类型:SMS-短信, VOICE-语音呼叫
|
||||
*/
|
||||
@ExcelProperty(value = "通知类型:SMS-短信, VOICE-语音呼叫")
|
||||
private String notifyType;
|
||||
|
||||
/**
|
||||
* 接收通知的手机号
|
||||
*/
|
||||
@ExcelProperty(value = "接收通知的手机号")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 消息内容(短信内容或语音模板参数)
|
||||
*/
|
||||
@ExcelProperty(value = "消息内容", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "短=信内容或语音模板参数")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 短信/语音模板ID
|
||||
*/
|
||||
@ExcelProperty(value = "短信/语音模板ID")
|
||||
private String templateId;
|
||||
|
||||
/**
|
||||
* 发送状态:0-待发送, 1-成功, 2-失败
|
||||
*/
|
||||
@ExcelProperty(value = "发送状态:0-待发送, 1-成功, 2-失败")
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 平台返回的状态码
|
||||
*/
|
||||
@ExcelProperty(value = "平台返回的状态码")
|
||||
private String responseCode;
|
||||
|
||||
/**
|
||||
* 平台返回的描述信息
|
||||
*/
|
||||
@ExcelProperty(value = "平台返回的描述信息")
|
||||
private String responseMsg;
|
||||
|
||||
/**
|
||||
* 实际发送时间(调用平台时间)
|
||||
*/
|
||||
@ExcelProperty(value = "实际发送时间", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "调=用平台时间")
|
||||
private Date sendTime;
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.fuyuanshen.equipment.enums;
|
||||
|
||||
/**
|
||||
* 数据来源枚举
|
||||
*/
|
||||
public enum DataSourceEnum {
|
||||
/**
|
||||
* 默认数据源
|
||||
*/
|
||||
APP(0, "app"),
|
||||
/**
|
||||
* 默认数据源
|
||||
*/
|
||||
Web(1, "web");
|
||||
|
||||
|
||||
private final Integer code;
|
||||
private final String name;
|
||||
|
||||
DataSourceEnum(Integer code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.fuyuanshen.equipment.mapper;
|
||||
|
||||
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import com.fuyuanshen.equipment.domain.SmsSendRecord;
|
||||
import com.fuyuanshen.equipment.domain.vo.SmsSendRecordVo;
|
||||
|
||||
public interface SmsSendRecordMapper extends BaseMapperPlus<SmsSendRecord, SmsSendRecordVo> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package com.fuyuanshen.equipment.service;
|
||||
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.equipment.domain.bo.SmsSendRecordBo;
|
||||
import com.fuyuanshen.equipment.domain.vo.SmsSendRecordVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 报警通知记录(短信/语音)Service接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
public interface ISmsSendRecordService {
|
||||
|
||||
/**
|
||||
* 查询报警通知记录(短信/语音)
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 报警通知记录(短信/语音)
|
||||
*/
|
||||
SmsSendRecordVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询报警通知记录(短信/语音)列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 报警通知记录(短信/语音)分页列表
|
||||
*/
|
||||
TableDataInfo<SmsSendRecordVo> queryPageList(SmsSendRecordBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的报警通知记录(短信/语音)列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 报警通知记录(短信/语音)列表
|
||||
*/
|
||||
List<SmsSendRecordVo> queryList(SmsSendRecordBo bo);
|
||||
|
||||
/**
|
||||
* 新增报警通知记录(短信/语音)
|
||||
*
|
||||
* @param bo 报警通知记录(短信/语音)
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(SmsSendRecordBo bo);
|
||||
|
||||
/**
|
||||
* 修改报警通知记录(短信/语音)
|
||||
*
|
||||
* @param bo 报警通知记录(短信/语音)
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(SmsSendRecordBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除报警通知记录(短信/语音)信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,141 @@
|
||||
package com.fuyuanshen.equipment.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuyuanshen.common.core.utils.MapstructUtils;
|
||||
import com.fuyuanshen.common.core.utils.StringUtils;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.equipment.domain.SmsSendRecord;
|
||||
import com.fuyuanshen.equipment.domain.bo.SmsSendRecordBo;
|
||||
import com.fuyuanshen.equipment.domain.vo.SmsSendRecordVo;
|
||||
import com.fuyuanshen.equipment.mapper.SmsSendRecordMapper;
|
||||
import com.fuyuanshen.equipment.service.ISmsSendRecordService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 报警通知记录(短信/语音)Service业务层处理
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SmsSendRecordServiceImpl implements ISmsSendRecordService {
|
||||
|
||||
private final SmsSendRecordMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询报警通知记录(短信/语音)
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 报警通知记录(短信/语音)
|
||||
*/
|
||||
@Override
|
||||
public SmsSendRecordVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询报警通知记录(短信/语音)列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 报警通知记录(短信/语音)分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<SmsSendRecordVo> queryPageList(SmsSendRecordBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SmsSendRecord> lqw = buildQueryWrapper(bo);
|
||||
Page<SmsSendRecordVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的报警通知记录(短信/语音)列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 报警通知记录(短信/语音)列表
|
||||
*/
|
||||
@Override
|
||||
public List<SmsSendRecordVo> queryList(SmsSendRecordBo bo) {
|
||||
LambdaQueryWrapper<SmsSendRecord> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SmsSendRecord> buildQueryWrapper(SmsSendRecordBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<SmsSendRecord> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(SmsSendRecord::getId);
|
||||
lqw.eq(bo.getAlarmId() != null, SmsSendRecord::getAlarmId, bo.getAlarmId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDeviceImei()), SmsSendRecord::getDeviceImei, bo.getDeviceImei());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getNotifyType()), SmsSendRecord::getNotifyType, bo.getNotifyType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getPhone()), SmsSendRecord::getPhone, bo.getPhone());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getContent()), SmsSendRecord::getContent, bo.getContent());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getTemplateId()), SmsSendRecord::getTemplateId, bo.getTemplateId());
|
||||
lqw.eq(bo.getStatus() != null, SmsSendRecord::getStatus, bo.getStatus());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getResponseCode()), SmsSendRecord::getResponseCode, bo.getResponseCode());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getResponseMsg()), SmsSendRecord::getResponseMsg, bo.getResponseMsg());
|
||||
lqw.eq(bo.getSendTime() != null, SmsSendRecord::getSendTime, bo.getSendTime());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增报警通知记录(短信/语音)
|
||||
*
|
||||
* @param bo 报警通知记录(短信/语音)
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(SmsSendRecordBo bo) {
|
||||
SmsSendRecord add = MapstructUtils.convert(bo, SmsSendRecord.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改报警通知记录(短信/语音)
|
||||
*
|
||||
* @param bo 报警通知记录(短信/语音)
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(SmsSendRecordBo bo) {
|
||||
SmsSendRecord update = MapstructUtils.convert(bo, SmsSendRecord.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(SmsSendRecord entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除报警通知记录(短信/语音)信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -20,6 +20,9 @@
|
||||
<if test="bo.deviceName != null">
|
||||
and d.device_name like concat('%', #{bo.deviceName}, '%')
|
||||
</if>
|
||||
<if test="bo.deviceId != null">
|
||||
and da.device_id = #{bo.deviceId}
|
||||
</if>
|
||||
<if test="bo.deviceType != null">
|
||||
and dt.id = #{bo.deviceType}
|
||||
</if>
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fuyuanshen.system.mapper.SmsSendRecordMapper">
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user