预警调试

This commit is contained in:
mashuai 2024-09-20 10:00:18 +08:00
parent 13caf8636c
commit e7986c5ac9
5 changed files with 29 additions and 8 deletions

View File

@ -1,6 +1,6 @@
package com.bonus.base.controller;
import com.bonus.base.domain.TbBdRecord;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.bonus.base.domain.TbDevAttribute;
import com.bonus.base.service.TbDevAttributeService;
import com.bonus.base.vo.TbDevAttributeVo;
@ -12,8 +12,6 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
@ -95,6 +93,13 @@ public class TbDevAttributeController extends BaseController {
@PostMapping("/export")
public void export(HttpServletResponse response, TbDevAttribute record) {
List<TbDevAttributeVo> list = tbDevAttributeService.queryAll(record);
if (CollectionUtils.isNotEmpty(list)) {
for (TbDevAttributeVo attribute : list) {
if (attribute.getWarnName() == null) {
attribute.setWarnName("");
}
}
}
ExcelUtil<TbDevAttributeVo> util = new ExcelUtil<>(TbDevAttributeVo.class);
util.exportExcel(response, list, "预警告警异常记录");
}

View File

@ -1,10 +1,8 @@
package com.bonus.base.domain;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import lombok.Data;
@ -79,9 +77,11 @@ public class TbDevAttribute implements Serializable {
*/
@ApiModelProperty(value="检测时间")
@Size(max = 32,message = "检测时间最大长度要小于 32")
@Excel(name = "预警时间")
private String jcTime;
@ApiModelProperty(value="预警处置")
private String remarks;
@ApiModelProperty(value="开始时间")
private String startTime;

View File

@ -73,7 +73,6 @@ public class TbDevAttributeServiceImpl implements TbDevAttributeService{
attribute.setWarnName(attribute.getJcName() + "超过阈值");
attribute.setStatus("未处置");
} else {
attribute.setWarnName("正常");
attribute.setStatus("已处置");
}
}

View File

@ -5,6 +5,8 @@ import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Size;
/**
* @Author ma_sh
* @create 2024/9/19 19:52
@ -46,7 +48,18 @@ public class TbDevAttributeVo extends TbDevAttribute {
@Excel(name = "预警内容")
private String warnName;
/**
* 检测时间
*/
@ApiModelProperty(value="检测时间")
@Excel(name = "预警时间")
private String jcTime;
@ApiModelProperty(value="状态")
@Excel(name = "状态")
private String status;
@ApiModelProperty(value="预警处置")
@Excel(name = "预警处置")
private String remarks;
}

View File

@ -41,7 +41,8 @@
tda.del_flag as delFlag,
tda.rel_code as relCode,
tda.is_warn as isWarn,
tda.jc_time as jcTime
tda.jc_time as jcTime,
tda.remarks as remarks
from tb_dev_attribute tda
left join tb_device td on tda.dev_id = td.id and td.del_flag = 0
left join sys_dict_data sdd on sdd.dict_code = td.dev_type
@ -173,6 +174,9 @@
<if test="jcTime != null and jcTime != ''">
jc_time = #{jcTime,jdbcType=VARCHAR},
</if>
<if test="remarks != null and remarks != ''">
remarks = #{remarks},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>