Commit f1cfe901 authored by 赵啸非's avatar 赵啸非

添加设备上线和下线的业务日志记录

parent edb164a4
...@@ -42,3 +42,10 @@ ALTER TABLE mortals_xhx_device ADD COLUMN `showWechatQrCode` tinyint(2) DEFA ...@@ -42,3 +42,10 @@ ALTER TABLE mortals_xhx_device ADD COLUMN `showWechatQrCode` tinyint(2) DEFA
ALTER TABLE mortals_xhx_device ADD COLUMN `orgName` varchar(128) COMMENT '所属机构' AFTER showWechatQrCode; ALTER TABLE mortals_xhx_device ADD COLUMN `orgName` varchar(128) COMMENT '所属机构' AFTER showWechatQrCode;
ALTER TABLE mortals_xhx_device_alarm_info
ADD COLUMN `push` tinyint(2) DEFAULT '0' COMMENT '是否推送',
ADD COLUMN `productId` bigint(20) DEFAULT '0' COMMENT '产品Id',
ADD COLUMN `productCode` varchar(256) DEFAULT '' COMMENT '产品编码',
ADD COLUMN `productName` varchar(256) DEFAULT '' COMMENT '产品名称'
...@@ -146,10 +146,19 @@ public class CustomerKeyExpirationListener implements MessageListener { ...@@ -146,10 +146,19 @@ public class CustomerKeyExpirationListener implements MessageListener {
alarmInfoEntity.setReceivePersonnelTelephone(deviceEntity.getLeadingOfficialTelephone()); alarmInfoEntity.setReceivePersonnelTelephone(deviceEntity.getLeadingOfficialTelephone());
alarmInfoEntity.setCreateTime(new Date()); alarmInfoEntity.setCreateTime(new Date());
alarmInfoEntity.setCreateUserId(1L); alarmInfoEntity.setCreateUserId(1L);
deviceAlarmInfoService.save(alarmInfoEntity);
// TODO: 2022/6/23 告警信息保存与发送 // TODO: 2022/6/23 告警信息保存与发送
AlarmConfigEntity alarmConfigEntity = alarmConfigService.selectOne(new AlarmConfigQuery().productId(productEntity.getId())); AlarmConfigEntity alarmConfigEntity = alarmConfigService.selectOne(new AlarmConfigQuery().productId(productEntity.getId()));
if (!ObjectUtils.isEmpty(alarmConfigEntity)) { if (!ObjectUtils.isEmpty(alarmConfigEntity)) {
/* if (alarmConfigEntity.getAlarmPusW1ay() == AlarmPusW1ayEnum.站内信息.getValue()) {
}*/
if(EnabledEnum.启用.getValue()==alarmConfigEntity.getEnabled()){
alarmInfoEntity.setProductId(productEntity.getId());
alarmInfoEntity.setProductCode(productEntity.getProductCode());
alarmInfoEntity.setProductName(productEntity.getProductName());
alarmInfoEntity.setPush(YesNoEnum.YES.getValue());
deviceAlarmInfoService.save(alarmInfoEntity);
}
if (alarmConfigEntity.getAlarmPusW1ay() == AlarmPusW1ayEnum.短信.getValue()) { if (alarmConfigEntity.getAlarmPusW1ay() == AlarmPusW1ayEnum.短信.getValue()) {
// TODO: 2022/7/4 发送短信 // TODO: 2022/7/4 发送短信
Rest<RespData<List<SmsSetPdu>>> respDataRest = smsSetFeign.list(new SmsSetPdu().siteId(deviceEntity.getSiteId())); Rest<RespData<List<SmsSetPdu>>> respDataRest = smsSetFeign.list(new SmsSetPdu().siteId(deviceEntity.getSiteId()));
...@@ -176,12 +185,20 @@ public class CustomerKeyExpirationListener implements MessageListener { ...@@ -176,12 +185,20 @@ public class CustomerKeyExpirationListener implements MessageListener {
alarmSmsSendService.save(alarmSmsSendEntity, null); alarmSmsSendService.save(alarmSmsSendEntity, null);
} }
} else { } else {
//推送站类
} }
} }
} }
} }
} }
// deviceAlarmInfoService.save(alarmInfoEntity);
} }
} }
} }
......
...@@ -9,7 +9,7 @@ import java.util.Map; ...@@ -9,7 +9,7 @@ import java.util.Map;
* @author zxfei * @author zxfei
*/ */
public enum AlarmPusW1ayEnum { public enum AlarmPusW1ayEnum {
不推送(0, "不推送"), 站内信息(0, "站内信息"),
短信(1, "短信"); 短信(1, "短信");
private Integer value; private Integer value;
private String desc; private String desc;
......
...@@ -3,6 +3,8 @@ package com.mortals.xhx.module.alarm.web; ...@@ -3,6 +3,8 @@ package com.mortals.xhx.module.alarm.web;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.AlarmPusW1ayEnum;
import com.mortals.xhx.common.code.EnabledEnum;
import com.mortals.xhx.module.alarm.model.AlarmConfigEntity; import com.mortals.xhx.module.alarm.model.AlarmConfigEntity;
import com.mortals.xhx.module.alarm.service.AlarmConfigService; import com.mortals.xhx.module.alarm.service.AlarmConfigService;
import com.mortals.xhx.module.product.model.ProductEntity; import com.mortals.xhx.module.product.model.ProductEntity;
...@@ -38,8 +40,8 @@ public class AlarmConfigController extends BaseCRUDJsonBodyMappingController<Ala ...@@ -38,8 +40,8 @@ public class AlarmConfigController extends BaseCRUDJsonBodyMappingController<Ala
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "alarmType", paramService.getParamBySecondOrganize("AlarmConfig","alarmType")); this.addDict(model, "alarmType", paramService.getParamBySecondOrganize("AlarmConfig","alarmType"));
this.addDict(model, "alarmLevel", paramService.getParamBySecondOrganize("AlarmConfig","alarmLevel")); this.addDict(model, "alarmLevel", paramService.getParamBySecondOrganize("AlarmConfig","alarmLevel"));
this.addDict(model, "alarmPusW1ay", paramService.getParamBySecondOrganize("AlarmConfig","alarmPusW1ay")); this.addDict(model, "alarmPusW1ay", AlarmPusW1ayEnum.getEnumMap());
this.addDict(model, "enabled", paramService.getParamBySecondOrganize("AlarmConfig","isUse")); this.addDict(model, "enabled", EnabledEnum.getEnumMap());
this.addDict(model, "productId", productService.find(new ProductEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getProductName()))); this.addDict(model, "productId", productService.find(new ProductEntity()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getProductName())));
super.init(model, context); super.init(model, context);
......
...@@ -4,12 +4,11 @@ import com.mortals.xhx.module.device.model.vo.DeviceAlarmInfoVo; ...@@ -4,12 +4,11 @@ import com.mortals.xhx.module.device.model.vo.DeviceAlarmInfoVo;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
/** /**
* 设备告警日志实体对象 * 设备告警日志实体对象
* *
* @author zxfei * @author zxfei
* @date 2023-04-27 * @date 2023-07-19
*/ */
@Data @Data
public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo { public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo {
...@@ -24,7 +23,7 @@ public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo { ...@@ -24,7 +23,7 @@ public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo {
*/ */
private Long alarmDevice; private Long alarmDevice;
/** /**
* 告警类型,(0.离线,1.在线,2.缺纸) * 告警类型,(0.离线)
*/ */
private Integer alarmType; private Integer alarmType;
/** /**
...@@ -59,33 +58,47 @@ public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo { ...@@ -59,33 +58,47 @@ public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo {
* 设备名称 * 设备名称
*/ */
private String deviceName; private String deviceName;
/**
* 是否推送
*/
private Integer push;
/**
* 产品Id
*/
private Long productId;
/**
* 产品编码
*/
private String productCode;
/**
* 产品名称
*/
private String productName;
@Override @Override
public int hashCode() { public int hashCode() {
return this.getAlarmDevice().hashCode(); return this.getId().hashCode();
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null) return false; if (obj == null) return false;
if (obj instanceof DeviceAlarmInfoEntity) { if (obj instanceof DeviceAlarmInfoEntity) {
DeviceAlarmInfoEntity tmp = (DeviceAlarmInfoEntity) obj; DeviceAlarmInfoEntity tmp = (DeviceAlarmInfoEntity) obj;
if (this.getAlarmDevice().equals(tmp.getAlarmDevice())) { if (this.getId() == tmp.getId()) {
return true; return true;
} }
} }
return false; return false;
} }
public void initAttrValue() { public void initAttrValue(){
this.alarmTime = null; this.alarmTime = null;
this.alarmDevice = null; this.alarmDevice = -1L;
this.alarmType = null; this.alarmType = -1;
this.alarmLevel = null; this.alarmLevel = -1;
this.alarmReceivePersonnel = ""; this.alarmReceivePersonnel = "";
...@@ -95,10 +108,18 @@ public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo { ...@@ -95,10 +108,18 @@ public class DeviceAlarmInfoEntity extends DeviceAlarmInfoVo {
this.alarmContent = ""; this.alarmContent = "";
this.siteId = null; this.siteId = -1L;
this.deviceCode = ""; this.deviceCode = "";
this.deviceName = ""; this.deviceName = "";
this.push = 0;
this.productId = -1L;
this.productCode = "";
this.productName = "";
} }
} }
\ No newline at end of file
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