change - 添加短信告警推送,修改nacos环境

breach-zhy
wenjy 5 months ago
parent e5c3c4e176
commit 2c5f6886f9

@ -14,10 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
# 配置文件格式
file-extension: yml
# 共享配置

@ -14,10 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
# 配置文件格式
file-extension: yml
# 共享配置
@ -33,7 +35,8 @@ spring:
datasource:
ds1:
nacos:
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
dataId: sentinel-ruoyi-gateway
groupId: DEFAULT_GROUP
data-type: json

@ -14,10 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
# 配置文件格式
file-extension: yml
# 共享配置

@ -447,8 +447,8 @@ public class HwMonitorPlatformController extends BaseController {
* */
@PostMapping("/AlarmInfosExport")
@RequiresPermissions("business:monitor:alarm")
public void AlarmInfosExport(HttpServletResponse response) {
List<AlarmInfoExportVo> alarmInfoExportVos = hwAlarmInfoService.selectAlarmInfoExport();
public void AlarmInfosExport(HttpServletResponse response,Date startTime,Date endTime) {
List<AlarmInfoExportVo> alarmInfoExportVos = hwAlarmInfoService.selectAlarmInfoExport(startTime,endTime);
ExcelUtil<AlarmInfoExportVo> util = new ExcelUtil<AlarmInfoExportVo>(AlarmInfoExportVo.class);
util.exportExcel(response,alarmInfoExportVos,"报警数据导出");
}

@ -93,6 +93,16 @@ public class HwAlarmRule extends BaseEntity
private Double triggerDataB;
/**
*
*/
private Long triggerTimeFrame;
/**
*
*/
private String phoneNumbers;
@Excel(name = "所属租户")
private String tenantName;
@ -354,6 +364,22 @@ public class HwAlarmRule extends BaseEntity
this.alarmInfoFlag = alarmInfoFlag;
}
public Long getTriggerTimeFrame() {
return triggerTimeFrame;
}
public void setTriggerTimeFrame(Long triggerTimeFrame) {
this.triggerTimeFrame = triggerTimeFrame;
}
public String getPhoneNumbers() {
return phoneNumbers;
}
public void setPhoneNumbers(String phoneNumbers) {
this.phoneNumbers = phoneNumbers;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -98,6 +98,8 @@ public class HwDeviceMode extends BaseEntity {
private String sceneName;
private String deviceModelType;
/**
*
*/
@ -231,6 +233,14 @@ public class HwDeviceMode extends BaseEntity {
this.sceneName = sceneName;
}
public String getDeviceModelType() {
return deviceModelType;
}
public void setDeviceModelType(String deviceModelType) {
this.deviceModelType = deviceModelType;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -113,6 +113,8 @@ public class HwDeviceModeFunction extends BaseEntity
// @Excel(name = "预留字段")
private String propertyField;
private String deviceModelType;
private List<HwDeviceModeParameter> inputParameters;
private List<HwDeviceModeParameter> outputParameters;
@ -316,6 +318,14 @@ public class HwDeviceModeFunction extends BaseEntity
this.outputParameters = outputParameters;
}
public String getDeviceModelType() {
return deviceModelType;
}
public void setDeviceModelType(String deviceModelType) {
this.deviceModelType = deviceModelType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -64,6 +64,8 @@ public class HwDeviceModeParameter extends BaseEntity
@Excel(name = "预留字段,步长")
private BigDecimal propertyStep;
private String deviceModelType;
public void setModeParameterId(Long modeParameterId)
{
this.modeParameterId = modeParameterId;
@ -155,6 +157,14 @@ public class HwDeviceModeParameter extends BaseEntity
return propertyStep;
}
public String getDeviceModelType() {
return deviceModelType;
}
public void setDeviceModelType(String deviceModelType) {
this.deviceModelType = deviceModelType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -17,7 +17,7 @@ public class AlarmInfoExportVo {
@Excel(name = "报警区域")
private String areaName;
@Excel(name = "计量箱名称")
@Excel(name = "报警位置")
private String monitorUnitName;
@Excel(name = "报警级别名称")
@ -29,6 +29,15 @@ public class AlarmInfoExportVo {
@Excel(name = "报警时间")
private String alarmTime;
@Excel(name = "ID")
private String monitor_unit_id;
@Excel(name = "状态")
private String monitor_unit_status;
@Excel(name = "类型")
private String monitor_unit_type_name;
public Long getAlarmInfoId() {
return alarmInfoId;
}
@ -77,6 +86,30 @@ public class AlarmInfoExportVo {
this.alarmTime = alarmTime;
}
public String getMonitor_unit_id() {
return monitor_unit_id;
}
public void setMonitor_unit_id(String monitor_unit_id) {
this.monitor_unit_id = monitor_unit_id;
}
public String getMonitor_unit_status() {
return monitor_unit_status;
}
public void setMonitor_unit_status(String monitor_unit_status) {
this.monitor_unit_status = monitor_unit_status;
}
public String getMonitor_unit_type_name() {
return monitor_unit_type_name;
}
public void setMonitor_unit_type_name(String monitor_unit_type_name) {
this.monitor_unit_type_name = monitor_unit_type_name;
}
@Override
public String toString() {
return "AlarmInfoExportVo{" +

@ -1,10 +1,12 @@
package com.ruoyi.business.mapper;
import java.util.Date;
import java.util.List;
import com.ruoyi.business.domain.HwAlarmInfo;
import com.ruoyi.business.domain.VO.AlarmInfoExportVo;
import com.ruoyi.business.domain.VO.AlarmInfoVo;
import com.ruoyi.business.domain.VO.AlarmTypeVo;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
@ -80,7 +82,7 @@ public interface HwAlarmInfoMapper
/**
*
* */
List<AlarmInfoExportVo> selectAlarmInfoExport();
List<AlarmInfoExportVo> selectAlarmInfoExport(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
/**
*

@ -1,5 +1,6 @@
package com.ruoyi.business.service;
import java.util.Date;
import java.util.List;
import com.ruoyi.business.domain.HwAlarmInfo;
import com.ruoyi.business.domain.VO.AlarmInfoExportVo;
@ -73,6 +74,6 @@ public interface IHwAlarmInfoService
/**
*
* */
List<AlarmInfoExportVo> selectAlarmInfoExport();
List<AlarmInfoExportVo> selectAlarmInfoExport(Date startTime, Date endTime);
}

@ -1,5 +1,6 @@
package com.ruoyi.business.service.impl;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -152,7 +153,7 @@ public class HwAlarmInfoServiceImpl implements IHwAlarmInfoService {
}
@Override
public List<AlarmInfoExportVo> selectAlarmInfoExport() {
return hwAlarmInfoMapper.selectAlarmInfoExport();
public List<AlarmInfoExportVo> selectAlarmInfoExport(Date startTime, Date endTime) {
return hwAlarmInfoMapper.selectAlarmInfoExport(startTime,endTime);
}
}

@ -14,10 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
# 配置文件格式
file-extension: yml
# 共享配置

@ -48,6 +48,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="alarmLevelName" column="alarm_level_name" />
<result property="alarmTypeName" column="alarm_type_name" />
<result property="alarmTime" column="alarm_time" />
<result property="monitor_unit_id" column="monitor_unit_id" />
<result property="monitor_unit_status" column="monitor_unit_status" />
<result property="monitor_unit_type_name" column="monitor_unit_type_name" />
</resultMap>
@ -192,14 +195,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
exists (select 1 from hw_device hd where hai.device_id=hd.device_id and hd.device_status='1'
and hd.monitor_unit_id=#{monitorUnitId})
</select>
<select id="selectAlarmInfoExport" resultMap="AlarmInfoExportVoResult">
select hai.alarm_info_id,
hai.alarm_time,
hmu.monitor_unit_name,hal.alarm_level_name,hat.alarm_type_name,ha.area_name
from hw_alarm_info hai left join hw_monitor_unit hmu on hai.monitor_unit_id = hmu.monitor_unit_id
left join hw_alarm_level hal on hai.alarm_level_id=hal.alarm_level_id
left join hw_alarm_type hat on hai.alarm_type_id=hat.alarm_type_id
left join hw_area ha on ha.area_id = hmu.area_id
<select id="selectAlarmInfoExport" parameterType="Date" resultMap="AlarmInfoExportVoResult">
select hai.alarm_info_id,
hai.alarm_time,
hmu.monitor_unit_name,
hal.alarm_level_name,
hat.alarm_type_name,
ha.area_name,
hmu.monitor_unit_id,
CASE hmu.monitor_unit_status when 1 then '正常' else '异常' end as monitor_unit_status,
hmu.monitor_unit_type_id,
hmut.monitor_unit_type_name
from hw_alarm_info hai
left join hw_monitor_unit hmu on hai.monitor_unit_id = hmu.monitor_unit_id
left join hw_alarm_level hal on hai.alarm_level_id = hal.alarm_level_id
left join hw_alarm_type hat on hai.alarm_type_id = hat.alarm_type_id
left join hw_area ha on ha.area_id = hmu.area_id
left join hw_monitor_unit_type hmut on hmu.monitor_unit_type_id = hmut.monitor_unit_type_id
where hai.alarm_time between #{startTime} and #{endTime}
</select>
<update id="updateHwAlarmInfoAllByDevice" parameterType="HwAlarmInfo">
update hw_alarm_info

@ -32,6 +32,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="alarmTypeName" column="alarm_type_name" />
<result property="alarmLevelName" column="alarm_level_name" />
<result property="ruleDeviceName" column="device_name" />
<result property="triggerTimeFrame" column="trigger_time_frame"/>
<result property="phoneNumbers" column="phone_numbers"/>
</resultMap>
<resultMap id="HwAlarmRuleHwAlarmRuleLinkResult" type="HwAlarmRule" extends="HwAlarmRuleResult">
@ -52,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectHwAlarmRuleVo">
select alarm_rule_id, alarm_rule_name, tenant_id, scene_id, language_code, alarm_level_id, alarm_type_id, rule_type, rule_device_id, rule_function_total, trigger_expression, link_flag, alarm_rule_status, alarm_push_flag, alarm_push_content, alarm_recover_content, remark, create_by, create_time, update_by, update_time, alarm_rule_field from hw_alarm_rule har
select alarm_rule_id, alarm_rule_name, tenant_id, scene_id, language_code, alarm_level_id, alarm_type_id, rule_type, rule_device_id, rule_function_total, trigger_expression, link_flag, alarm_rule_status, alarm_push_flag, alarm_push_content, alarm_recover_content, remark, create_by, create_time, update_by, update_time, alarm_rule_field,trigger_time_frame,phone_numbers from hw_alarm_rule har
</sql>
<select id="selectHwAlarmRuleList" parameterType="HwAlarmRule" resultMap="HwAlarmRuleResult">
@ -119,7 +121,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectHwAlarmRuleByAlarmRuleId" parameterType="Long" resultMap="HwAlarmRuleHwAlarmRuleLinkResult">
select a.alarm_rule_id, a.alarm_rule_name, a.tenant_id, a.scene_id, a.language_code, a.alarm_level_id, a.alarm_type_id, a.rule_type, a.rule_device_id, a.rule_function_total, a.trigger_expression, a.link_flag, a.alarm_rule_status, a.alarm_push_flag, a.alarm_push_content, a.alarm_recover_content, a.remark, a.create_by, a.create_time, a.update_by, a.update_time, a.alarm_rule_field,
select a.alarm_rule_id, a.alarm_rule_name, a.tenant_id, a.scene_id, a.language_code, a.alarm_level_id, a.alarm_type_id, a.rule_type, a.rule_device_id, a.rule_function_total, a.trigger_expression, a.link_flag, a.alarm_rule_status, a.alarm_push_flag, a.alarm_push_content, a.alarm_recover_content, a.remark, a.create_by, a.create_time, a.update_by, a.update_time, a.alarm_rule_field,a.trigger_time_frame,a.phone_numbers,
b.rule_link_id as sub_rule_link_id, b.alarm_rule_type as sub_alarm_rule_type, b.alarm_rule_id as sub_alarm_rule_id, b.link_type as sub_link_type, b.link_device_id as sub_link_device_id, b.link_device_function_id as sub_link_device_function_id, b.link_device_function_identifier as sub_link_device_function_identifier, b.link_device_function_data as sub_link_device_function_data, hd.device_name as sub_link_device_name,hdmf.function_name as sub_link_device_mode_function_name
from hw_alarm_rule a
left join hw_alarm_rule_link b on b.alarm_rule_id = a.alarm_rule_id and b.alarm_rule_type=1
@ -152,6 +154,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="alarmRuleField != null">alarm_rule_field,</if>
<if test="triggerTimeFrame != null">trigger_time_frame,</if>
<if test="phoneNumbers != null">phone_numbers,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="alarmRuleName != null and alarmRuleName != ''">#{alarmRuleName},</if>
@ -175,6 +179,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="alarmRuleField != null">#{alarmRuleField},</if>
<if test="triggerTimeFrame != null">#{triggerTimeFrame},</if>
<if test="phoneNumbers != null">#{phoneNumbers},</if>
</trim>
</insert>
@ -202,6 +208,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="alarmRuleField != null">alarm_rule_field = #{alarmRuleField},</if>
<if test="triggerTimeFrame != null">trigger_time_frame = #{triggerTimeFrame},</if>
<if test="phoneNumbers != null">phone_numbers = #{phoneNumbers},</if>
</trim>
where alarm_rule_id = #{alarmRuleId}
</update>

@ -25,6 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="deviceModeField" column="device_mode_field" />
<result property="sceneName" column="scene_name" />
<result property="tenantName" column="tenant_name" />
<result property="deviceModelType" column="device_model_type" />
</resultMap>
<resultMap id="HwDeviceModeHwDeviceModeFunctionResult" type="HwDeviceMode" extends="HwDeviceModeResult">
@ -53,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="deviceRegister" column="sub_device_register" />
<result property="propertyStep" column="sub_property_step" />
<result property="propertyField" column="sub_property_field" />
<result property="deviceModelType" column="device_model_type" />
</resultMap>
<resultMap type="HwDeviceModeParameter" id="HwDeviceModeParameterResult">
@ -66,11 +68,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="dataDefinition" column="data_definition" />
<result property="propertyUnit" column="property_unit" />
<result property="propertyStep" column="property_step" />
<result property="deviceModelType" column="device_model_type" />
</resultMap>
<sql id="selectHwDeviceModeVo">
select device_mode_id, device_mode_name, tenant_id, scene_id, language_code, gps_flag, device_mode_status, common_flag, mode_classfication,mode_type, device_mode_pic, data_verify_level, remark, create_by, create_time, update_by, update_time, device_mode_field from hw_device_mode hdm
select device_mode_id, device_mode_name, tenant_id, scene_id, language_code, gps_flag, device_mode_status, common_flag, mode_classfication,mode_type, device_mode_pic, data_verify_level, remark, create_by, create_time, update_by, update_time, device_mode_field,device_model_type from hw_device_mode hdm
</sql>
<sql id="selectHwDeviceModeParameterVo">
@ -100,7 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectHwDeviceModeByDeviceModeId" parameterType="Long" resultMap="HwDeviceModeHwDeviceModeFunctionResult">
select a.device_mode_id, a.device_mode_name, a.tenant_id, a.scene_id, a.language_code, a.gps_flag, a.device_mode_status, a.common_flag, a.mode_classfication, a.device_mode_pic, a.data_verify_level, a.remark, a.create_by, a.create_time, a.update_by, a.update_time, a.device_mode_field,
b.mode_function_id as sub_mode_function_id, b.device_mode_id as sub_device_mode_id, b.function_mode as sub_function_mode, b.coordinate as sub_coordinate, b.function_name as sub_function_name, b.function_identifier as sub_function_identifier, b.function_type as sub_function_type, b.data_type as sub_data_type, b.data_definition as sub_data_definition, b.function_formula as sub_function_formula, b.property_unit as sub_property_unit, b.display_flag as sub_display_flag, b.rw_flag as sub_rw_flag, b.invoke_method as sub_invoke_method, b.event_type as sub_event_type, b.remark as sub_remark, b.acquisition_formula as sub_acquisition_formula, b.order_flag as sub_order_flag, b.device_register as sub_device_register, b.property_step as sub_property_step, b.property_field as sub_property_field
b.mode_function_id as sub_mode_function_id, a.device_model_type,b.device_mode_id as sub_device_mode_id, b.function_mode as sub_function_mode, b.coordinate as sub_coordinate, b.function_name as sub_function_name, b.function_identifier as sub_function_identifier, b.function_type as sub_function_type, b.data_type as sub_data_type, b.data_definition as sub_data_definition, b.function_formula as sub_function_formula, b.property_unit as sub_property_unit, b.display_flag as sub_display_flag, b.rw_flag as sub_rw_flag, b.invoke_method as sub_invoke_method, b.event_type as sub_event_type, b.remark as sub_remark, b.acquisition_formula as sub_acquisition_formula, b.order_flag as sub_order_flag, b.device_register as sub_device_register, b.property_step as sub_property_step, b.property_field as sub_property_field
from hw_device_mode a
left join hw_device_mode_function b on b.device_mode_id = a.device_mode_id
where a.device_mode_id = #{deviceModeId}
@ -126,6 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="deviceModeField != null">device_mode_field,</if>
<if test="deviceModelType != null">device_model_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceModeName != null and deviceModeName != ''">#{deviceModeName},</if>
@ -145,6 +149,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="deviceModeField != null">#{deviceModeField},</if>
<if test="deviceModelType != null">#{deviceModelType},</if>
</trim>
</insert>
@ -168,6 +173,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="deviceModeField != null">device_mode_field = #{deviceModeField},</if>
<if test="deviceModelType != null">device_model_type = #{deviceModelType},</if>
</trim>
where device_mode_id = #{deviceModeId}
</update>
@ -300,7 +306,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectHwDeviceModeJoinList" parameterType="HwDeviceMode" resultMap="HwDeviceModeResult">
select hdm.device_mode_id,hdm.device_mode_name,hdm.gps_flag,hdm.mode_classfication,
hs.scene_name,ht.tenant_name,hdm.tenant_id,hdm.scene_id,hdm.common_flag,hdm.device_mode_status,hdm.device_mode_pic
hs.scene_name,ht.tenant_name,hdm.tenant_id,hdm.scene_id,hdm.common_flag,hdm.device_mode_status,hdm.device_mode_pic,hdm.device_model_type
from hw_device_mode hdm
left join hw_scene hs on hdm.scene_id = hs.scene_id
left join hw_tenant ht on hdm.tenant_id=ht.tenant_id

@ -76,7 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="tenanBoardTopic != null and tenantBoardTopic != ''">tenant_board_topic,</if>
<if test="tenantBoardTopic != null and tenantBoardTopic != ''">tenant_board_topic,</if>
<if test="tenantBoardPic != null and tenantBoardPic != ''">tenant_board_pic,</if>
<if test="tenantGrade != null">tenant_grade,</if>
<if test="tenantField != null">tenant_field,</if>
@ -98,7 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="tenanBoardTopic != null and tenanBoardTopic != ''">#{tenanBoardTopic},</if>
<if test="tenantBoardTopic != null and tenantBoardTopic != ''">#{tenantBoardTopic},</if>
<if test="tenantBoardPic != null and tenantBoardPic != ''">#{tenantBoardPic},</if>
<if test="tenantGrade != null">#{tenantGrade},</if>
<if test="tenantField != null">#{tenantField},</if>
@ -124,7 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="tenanBoardTopic != null and tenanBoardTopic != ''">tenant_board_topic = #{tenanBoardTopic},</if>
<if test="tenantBoardTopic != null and tenantBoardTopic != ''">tenant_board_topic = #{tenantBoardTopic},</if>
<if test="tenantBoardPic != null and tenantBoardPic != ''">tenant_board_pic = #{tenantBoardPic},</if>
<if test="tenantGrade != null">tenant_grade = #{tenantGrade},</if>
<if test="tenantField != null">tenant_field = #{tenantField},</if>

@ -97,6 +97,11 @@
<version>1.19.0</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>alibabacloud-dysmsapi20170525</artifactId>
<version>2.0.24</version>
</dependency>
</dependencies>

@ -0,0 +1,34 @@
package com.ruoyi.dataprocess.domain;
public class AlarmMsgTemplateParam {
private String parentname;
private String sensorID;
private String warning;
public String getParentname() {
return parentname;
}
public void setParentname(String parentname) {
this.parentname = parentname;
}
public String getSensorID() {
return sensorID;
}
public void setSensorID(String sensorID) {
this.sensorID = sensorID;
}
public String getWarning() {
return warning;
}
public void setWarning(String warning) {
this.warning = warning;
}
}

@ -109,6 +109,16 @@ public class HwAlarmRule extends BaseEntity
@Excel(name = "设备")
private String ruleDeviceName;
/**
*
*/
private Long triggerTimeFrame;
/**
*
*/
private String phoneNumbers;
public void setAlarmRuleId(Long alarmRuleId)
{
this.alarmRuleId = alarmRuleId;
@ -345,6 +355,22 @@ public class HwAlarmRule extends BaseEntity
this.ruleDeviceName = ruleDeviceName;
}
public Long getTriggerTimeFrame() {
return triggerTimeFrame;
}
public void setTriggerTimeFrame(Long triggerTimeFrame) {
this.triggerTimeFrame = triggerTimeFrame;
}
public String getPhoneNumbers() {
return phoneNumbers;
}
public void setPhoneNumbers(String phoneNumbers) {
this.phoneNumbers = phoneNumbers;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -36,6 +36,8 @@ public class HwDevice extends BaseEntity
@Excel(name = "所属监控单元关联表hw_monitor_unit字段monitor_unit_id")
private Long monitorUnitId;
private String monitorUnitName;
/** 设备类型1网关设备2网关子设备3直连设备 */
@Excel(name = "设备类型", readConverterExp = "1=网关设备2网关子设备3直连设备")
private String deviceType;
@ -331,6 +333,14 @@ public class HwDevice extends BaseEntity
return onlineStatus;
}
public String getMonitorUnitName() {
return monitorUnitName;
}
public void setMonitorUnitName(String monitorUnitName) {
this.monitorUnitName = monitorUnitName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -21,6 +21,13 @@ public interface HwDeviceMapper
*/
public HwDevice selectHwDeviceByDeviceCode(String deviceCode);
/**
*
* @param deviceCode
* @return
*/
public HwDevice GetDeviceById(Long deviceCode);
/**
*
*

@ -3,6 +3,11 @@ package com.ruoyi.dataprocess.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.auth.credentials.Credential;
import com.aliyun.auth.credentials.provider.StaticCredentialProvider;
import com.aliyun.sdk.service.dysmsapi20170525.AsyncClient;
import com.aliyun.sdk.service.dysmsapi20170525.models.SendSmsRequest;
import com.aliyun.sdk.service.dysmsapi20170525.models.SendSmsResponse;
import com.ruoyi.common.core.constant.HwDictConstants;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.TdEngineConstants;
@ -21,8 +26,10 @@ import com.ruoyi.dataprocess.service.CommanHandleService;
import com.ruoyi.dataprocess.service.IDataProcessService;
import com.ruoyi.tdengine.api.RemoteTdEngineService;
import com.ruoyi.tdengine.api.domain.TdField;
import com.ruoyi.tdengine.api.domain.TdHistorySelectDto;
import com.ruoyi.tdengine.api.domain.TdTableVo;
import com.sun.org.apache.xpath.internal.operations.Bool;
import darabonba.core.client.ClientOverrideConfiguration;
import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -41,6 +48,8 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicBoolean;
/**
@ -54,6 +63,10 @@ import java.util.concurrent.atomic.AtomicBoolean;
public class DataProcessServiceImpl extends CommanHandleService implements IDataProcessService {
private static final Logger logger = LoggerFactory.getLogger(DataProcessServiceImpl.class);
private final String AccessKeyId = "LTAI5tPoTQHh8HHst2toxtGa";
private final String AccessKeySecret = "K8OIuSNgsSnpGMJ2PdqIJFYyUqL38m";
@Resource
private RemoteTdEngineService remoteTdEngineService;
@ -205,7 +218,7 @@ public class DataProcessServiceImpl extends CommanHandleService implements IData
tdTableVo.setTableName(tableName);
tdTableVo.setSchemaFields(schemaFields);
final R<?> insertResult = this.remoteTdEngineService.insertTable(tdTableVo, SecurityConstants.INNER);
final R<?> insertResult = this.remoteTdEngineService.insertTable(tdTableVo , SecurityConstants.INNER);
if (insertResult.getCode() == ResultEnums.SUCCESS.getCode()) {
logger.info("Insert data result: {}", insertResult.getMsg());
} else {
@ -410,6 +423,20 @@ public class DataProcessServiceImpl extends CommanHandleService implements IData
hwAlarmInfoMapper.insertHwAlarmInfo(alarmInfo);
this.insertHwAlarmDetail(alarmInfo);
this.handleAlarmLink(alarmRule, topic, subDeviceCode);
try {
HwDevice hwDevice = hwDeviceMapper.GetDeviceById(deviceId);
if(hwDevice != null){
AlarmMsgTemplateParam alarmMsgTemplateParam = new AlarmMsgTemplateParam();
alarmMsgTemplateParam.setWarning(alarmRule.getAlarmRuleName());
alarmMsgTemplateParam.setParentname(hwDevice.getMonitorUnitName());
alarmMsgTemplateParam.setSensorID(deviceId.toString());
SendAlarmInfoToSms(alarmRule.getPhoneNumbers(),alarmMsgTemplateParam);
}
} catch (ExecutionException | InterruptedException e) {
throw new RuntimeException(e.getMessage());
}
break;
}
}
@ -489,6 +516,43 @@ public class DataProcessServiceImpl extends CommanHandleService implements IData
}
}
/**
*
* @param phoneNumbers
* @param alarmMsgTemplateParam
* @throws ExecutionException
* @throws InterruptedException
*/
private void SendAlarmInfoToSms(String phoneNumbers,AlarmMsgTemplateParam alarmMsgTemplateParam ) throws ExecutionException, InterruptedException {
StaticCredentialProvider provider = StaticCredentialProvider.create(Credential.builder()
.accessKeyId(AccessKeyId)
.accessKeySecret(AccessKeySecret)
.build());
AsyncClient client = AsyncClient.builder()
.region("cn-shenzhen") // Region ID
.credentialsProvider(provider)
.overrideConfiguration(
ClientOverrideConfiguration.create()
.setEndpointOverride("dysmsapi.aliyuncs.com")
)
.build();
String jsonString = com.alibaba.fastjson2.JSONArray.toJSONString(alarmMsgTemplateParam);
SendSmsRequest sendSmsRequest = SendSmsRequest.builder()
.phoneNumbers(phoneNumbers)
.signName("深圳市金瑞铭科技")
.templateCode("SMS_468740027")
.templateParam(jsonString)
.build();
CompletableFuture<SendSmsResponse> response = client.sendSms(sendSmsRequest);
SendSmsResponse resp = response.get();
client.close();
}
public static void main(String[] args) {
System.out.println(System.currentTimeMillis());

@ -33,10 +33,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
# 配置文件格式
file-extension: yml
# 共享配置

@ -34,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="deviceField" column="device_field" />
<result property="tenantId" column="tenant_id" />
<result property="onlineStatus" column="online_status" />
<result property="monitorUnitName" column="monitor_unit_name" />
</resultMap>
<sql id="selectHwDeviceVo">
@ -45,6 +46,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where device_code = #{deviceCode} limit 1
</select>
<select id="GetDeviceById" parameterType="Long" resultMap="HwDeviceResult">
select t1.device_code,
t1.device_name,
t2.monitor_unit_name,
t1.device_location,
t1.remark
from hw_device t1
left join hw_monitor_unit t2 on t1.monitor_unit_id = t2.monitor_unit_id
where t1.device_id = #{deviceCode} limit 1
</select>
<update id="updateHwDevice" parameterType="HwDevice">
update hw_device
<trim prefix="SET" suffixOverrides=",">

@ -29,7 +29,8 @@ spring:
nacos:
config:
# 配置中心地址
server-addr: 124.70.63.37:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
# 配置文件格式
file-extension: yml
# 共享配置

@ -14,10 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
# 配置文件格式
file-extension: yml
# 共享配置

@ -14,10 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: localhost:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
config:
# 配置中心地址
server-addr: localhost:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
# 配置文件格式
file-extension: yml
# 共享配置

@ -14,10 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
# 配置文件格式
file-extension: yml
# 共享配置

@ -14,10 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
# 配置文件格式
file-extension: yml
# 共享配置

@ -14,10 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
# 配置文件格式
file-extension: yml
# 共享配置

@ -14,10 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
# 配置文件格式
file-extension: yml
# 共享配置

@ -9,15 +9,17 @@ spring:
name: ruoyi-monitor
profiles:
# 环境配置
active: druid
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 175.27.215.92:8848
namespace: jrm_iot
# 配置文件格式
file-extension: yml
# 共享配置

Loading…
Cancel
Save