Browse Source

1、报警添加微信通知功能,增加模板。

dev
25604 14 hours ago
parent
commit
5210bcdd58
  1. 6
      mh-admin/src/main/resources/application-dev.yml
  2. 16
      mh-admin/src/main/resources/application-prod.yml
  3. 2
      mh-admin/src/main/resources/application.yml
  4. 6
      mh-common/src/main/java/com/mh/common/core/domain/entity/AlarmRecords.java
  5. 4
      mh-quartz/src/main/java/com/mh/quartz/task/PushDataToWechatTask.java
  6. 3
      mh-system/src/main/java/com/mh/system/service/device/impl/CollectionParamsManageServiceImpl.java
  7. 6
      mh-system/src/main/java/com/mh/system/service/operation/impl/AlarmRecordsServiceImpl.java

6
mh-admin/src/main/resources/application-dev.yml

@ -1,7 +1,7 @@
# 项目相关配置
mh:
# 名称
name: mz
name: MH
# 版本
version: 1.0.0
# 版权年份
@ -98,8 +98,8 @@ spring:
# 主库数据源
master:
#添加allowMultiQueries=true 在批量更新时才不会出错
# url: jdbc:postgresql://127.0.0.1:5432/eemcs_hw_dev
url: jdbc:postgresql://127.0.0.1:5432/eemcs
url: jdbc:postgresql://127.0.0.1:5432/eemcs_hw_dev
# url: jdbc:postgresql://127.0.0.1:5432/eemcs
username: postgres
password: mh@803
# 从库数据源

16
mh-admin/src/main/resources/application-prod.yml

@ -1,7 +1,7 @@
# 项目相关配置
mh:
# 名称
name: mz
name: hw
# 版本
version: 1.0.0
# 版权年份
@ -16,7 +16,7 @@ mh:
# 开发环境配置
server:
# 服务器的HTTP端口,默认为8080
port: 8091
port: 8090
servlet:
# 应用的访问路径
context-path: /
@ -63,7 +63,7 @@ spring:
# 端口,默认为6379
port: 6379
# 数据库索引
database: 14
database: 0
# 密码
password:
# 连接超时时间
@ -82,9 +82,9 @@ spring:
rabbitmq:
host: 127.0.0.1
port: 5672
username: eemcs_mz
username: eemcs
password: mh@803
virtual-host: /eemcs_mz
virtual-host: /eemcs
listener:
direct:
prefetch: 2
@ -98,8 +98,8 @@ spring:
# 主库数据源
master:
#添加allowMultiQueries=true 在批量更新时才不会出错
url: jdbc:postgresql://127.0.0.1:5505/eemcs
# url: jdbc:postgresql://127.0.0.1:5505/eemcs
url: jdbc:postgresql://127.0.0.1:5505/eemcs_hw
# url: jdbc:postgresql://127.0.0.1:5505/eemcs
username: postgres
password: mhtech@803
# 从库数据源
@ -195,7 +195,7 @@ mqttSpring:
port: 1883
username: sa
password: sa123
client-id: eemcs_mz_mqtt_pro
client-id: eemcs_hw_mqtt_pro
# If the protocol is ws/wss, this value is required.
path:
# Topics that need to be subscribed when initially connecting to mqtt, multiple topics are divided by ",".

2
mh-admin/src/main/resources/application.yml

@ -1,6 +1,6 @@
spring:
profiles:
active: dev
active: prod
# 用户配置
user:

6
mh-common/src/main/java/com/mh/common/core/domain/entity/AlarmRecords.java

@ -86,13 +86,13 @@ public class AlarmRecords implements Serializable {
/**
* 是否发送通知 0未发送 1已发送
*/
private int isSend;
private Integer isSend;
public int getIsSend() {
public Integer getIsSend() {
return isSend;
}
public void setIsSend(int isSend) {
public void setIsSend(Integer isSend) {
this.isSend = isSend;
}

4
mh-quartz/src/main/java/com/mh/quartz/task/PushDataToWechatTask.java

@ -92,7 +92,7 @@ public class PushDataToWechatTask {
private void pushDeviceArmParams(Map<String, Object> map, PushMsgEntity pushMsgEntity, AlarmRecords alarmRecords2) {
pushMsgEntity.setTouser(map.get("open_id").toString());
pushMsgEntity.setTemplateId(map.get("template_id").toString());
pushMsgEntity.setUrl("http://jnd2.mhwsh.net:8765/");
pushMsgEntity.setUrl("http://bajnd.mhwsh.net:9090/");
First first = new First();
first.setValue("设备告警通知");
pushMsgEntity.setFirst(first);
@ -135,7 +135,7 @@ public class PushDataToWechatTask {
private void pushDeviceExceptionParams(Map<String, Object> map, PushMsgEntity pushMsgEntity, AlarmRecords alarmRecords2) {
pushMsgEntity.setTouser(map.get("open_id").toString());
pushMsgEntity.setTemplateId(map.get("template_id").toString());
pushMsgEntity.setUrl("http://jnd2.mhwsh.net:8765/");
pushMsgEntity.setUrl("http://bajnd.mhwsh.net:9090/");
First first = new First();
first.setValue("设备异常告警提醒");
pushMsgEntity.setFirst(first);

3
mh-system/src/main/java/com/mh/system/service/device/impl/CollectionParamsManageServiceImpl.java

@ -249,6 +249,9 @@ public class CollectionParamsManageServiceImpl implements ICollectionParamsManag
deviceMonitorVO.setDeviceType(param.getMtType());
deviceMonitorVO.setCollectName(param.getOtherName());
deviceMonitorVO.setCollectTime(param.getCurTime());
if (null == param.getCurValue()) {
param.setCurValue(new BigDecimal(0));
}
// 判断如果是压力,放大1000倍,并保留一位小数
if (param.getParamType().equals("13")) {
BigDecimal bigDecimal = param.getCurValue();

6
mh-system/src/main/java/com/mh/system/service/operation/impl/AlarmRecordsServiceImpl.java

@ -110,8 +110,10 @@ public class AlarmRecordsServiceImpl implements IAlarmRecordsService {
// 是否已处理,0:未处理,1:已处理
queryWrapper.eq("status", alarmRecords.getStatus());
// 是否已经发送短信,0:未发送,1:已发送
queryWrapper.eq("is_send", alarmRecords.getIsSend());
if (null != alarmRecords.getIsSend()) {
// 是否已经发送短信,0:未发送,1:已发送
queryWrapper.eq("is_send", alarmRecords.getIsSend());
}
queryWrapper.orderByDesc("create_time");
return alarmRecordsMapper.selectList(queryWrapper);

Loading…
Cancel
Save