预警调试

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; 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.domain.TbDevAttribute;
import com.bonus.base.service.TbDevAttributeService; import com.bonus.base.service.TbDevAttributeService;
import com.bonus.base.vo.TbDevAttributeVo; import com.bonus.base.vo.TbDevAttributeVo;
@ -12,8 +12,6 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
/** /**
@ -95,6 +93,13 @@ public class TbDevAttributeController extends BaseController {
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, TbDevAttribute record) { public void export(HttpServletResponse response, TbDevAttribute record) {
List<TbDevAttributeVo> list = tbDevAttributeService.queryAll(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); ExcelUtil<TbDevAttributeVo> util = new ExcelUtil<>(TbDevAttributeVo.class);
util.exportExcel(response, list, "预警告警异常记录"); util.exportExcel(response, list, "预警告警异常记录");
} }

View File

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

View File

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

View File

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

View File

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