Commit 1552c30a authored by “yiyousong”'s avatar “yiyousong”
parents e6b0bf0e d55e6f3e
...@@ -168,11 +168,13 @@ export default { ...@@ -168,11 +168,13 @@ export default {
const content = formatter(this.tableData, column, val); const content = formatter(this.tableData, column, val);
if (content) { if (content) {
if (val == '0') { if (val == '0') {
return <el-tag size='mini'>{content}</el-tag> return <el-tag type={'warning'} size='mini'>{content}</el-tag>
} else if (val == '1') { } else if (val == '1') {
return <el-tag type={'danger'} size='mini'>{content}</el-tag> return <el-tag type={'danger'} size='mini'>{content}</el-tag>
} else if (val == '2') { } else if (val == '2') {
return <el-tag type={'success'} size='mini'>{content}</el-tag> return <el-tag type={'success'} size='mini'>{content}</el-tag>
}else{
return <el-tag size='mini'>{content}</el-tag>
} }
} else { } else {
return val return val
......
...@@ -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 '产品名称'
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
<profiles.redis.username></profiles.redis.username> <profiles.redis.username></profiles.redis.username>
<profiles.redis.password>12345678</profiles.redis.password> <profiles.redis.password>12345678</profiles.redis.password>
<profiles.redis.database>6</profiles.redis.database> <profiles.redis.database>6</profiles.redis.database>
<profiles.rabbitmq.host>192.168.0.251</profiles.rabbitmq.host> <profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port> <profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>root_mq</profiles.rabbitmq.username> <profiles.rabbitmq.username>root_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>xhx@2022</profiles.rabbitmq.password> <profiles.rabbitmq.password>xhx@2022</profiles.rabbitmq.password>
......
...@@ -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
...@@ -242,27 +242,27 @@ public class DeviceEntity extends DeviceVo { ...@@ -242,27 +242,27 @@ public class DeviceEntity extends DeviceVo {
this.deviceMac = ""; this.deviceMac = "";
this.siteId = null; this.siteId = 0L;
this.siteCode = ""; this.siteCode = "";
this.siteName = ""; this.siteName = "";
this.platformId = null; this.platformId = 0L;
this.platformName = ""; this.platformName = "";
this.productId = null; this.productId = 0L;
this.productName = ""; this.productName = "";
this.skinId = null; this.skinId = 0L;
this.skinName = ""; this.skinName = "";
this.homeUrl = ""; this.homeUrl = "";
this.deviceFirmId = null; this.deviceFirmId = 0L;
this.deviceFirmname = ""; this.deviceFirmname = "";
...@@ -274,9 +274,9 @@ public class DeviceEntity extends DeviceVo { ...@@ -274,9 +274,9 @@ public class DeviceEntity extends DeviceVo {
this.lati = ""; this.lati = "";
this.deviceInBuilding = null; this.deviceInBuilding = 1;
this.deviceInFloor = null; this.deviceInFloor = 1;
this.defectsLiabilityPeriod = null; this.defectsLiabilityPeriod = null;
...@@ -318,7 +318,7 @@ public class DeviceEntity extends DeviceVo { ...@@ -318,7 +318,7 @@ public class DeviceEntity extends DeviceVo {
this.productCode = ""; this.productCode = "";
this.hallId = null; this.hallId = 0L;
this.hallName = ""; this.hallName = "";
......
...@@ -69,15 +69,9 @@ public class DeviceAlarmInfoServiceImpl extends AbstractCRUDServiceImpl<DeviceAl ...@@ -69,15 +69,9 @@ public class DeviceAlarmInfoServiceImpl extends AbstractCRUDServiceImpl<DeviceAl
DeviceAlarmInfoQuery deviceAlarmInfoQuery = new DeviceAlarmInfoQuery(); DeviceAlarmInfoQuery deviceAlarmInfoQuery = new DeviceAlarmInfoQuery();
deviceAlarmInfoQuery.setAlarmTimeStart(DateUtil.today()); deviceAlarmInfoQuery.setAlarmTimeStart(DateUtil.today());
deviceAlarmInfoQuery.setAlarmTimeEnd(DateUtil.today()); deviceAlarmInfoQuery.setAlarmTimeEnd(DateUtil.today());
List<OrderCol> orderCols = new ArrayList<>(); deviceAlarmInfoQuery.setOrderColList(Arrays.asList(new OrderCol("alarmTime",OrderCol.DESCENDING)));
OrderCol orderCol = new OrderCol();
orderCol.setColName("alarmTime");
orderCol.setSortKind(OrderCol.DESCENDING);
orderCols.add(orderCol);
deviceAlarmInfoQuery.setOrderColList(orderCols);
List<DeviceAlarmInfoEntity> deviceAlarmInfoList = this.find(deviceAlarmInfoQuery); List<DeviceAlarmInfoEntity> deviceAlarmInfoList = this.find(deviceAlarmInfoQuery);
//统计总设备数量 //统计总设备数量
List<DeviceEntity> deviceList = deviceService.find(new DeviceQuery().siteId(siteId)); List<DeviceEntity> deviceList = deviceService.find(new DeviceQuery().siteId(siteId));
//设备总量 //设备总量
......
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