提交 execl导出解析 及 告警处理增加负责人
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package com.xinda.iot.convert;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* 告警详情JSON转换器
|
||||
*/
|
||||
public class AlertDetailConverter {
|
||||
|
||||
/**
|
||||
* 转换JSON字符串为指定格式
|
||||
* @param jsonStr JSON字符串
|
||||
* @return 格式化后的字符串
|
||||
*/
|
||||
public static String convert(String jsonStr) {
|
||||
if (jsonStr == null || jsonStr.trim().isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
JSONObject jsonObject = JSONObject.parseObject(jsonStr);
|
||||
String id = jsonObject.getString("id");
|
||||
String value = jsonObject.getString("value");
|
||||
String remark = jsonObject.getString("remark");
|
||||
|
||||
// 处理null值
|
||||
id = (id == null) ? "" : id;
|
||||
value = (value == null) ? "" : value;
|
||||
remark = (remark == null) ? "" : remark;
|
||||
|
||||
return String.format("ID名称:%s,变量值:%s,备注:%s", id, value, remark);
|
||||
} catch (Exception e) {
|
||||
// 解析失败时返回原始字符串
|
||||
return jsonStr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.xinda.iot.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xinda.iot.convert.AlertDetailConverter;
|
||||
import com.xinda.itsm.domain.RepairOrder;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -55,8 +56,22 @@ public class AlertLog extends BaseEntity
|
||||
|
||||
/** 告警详情 */
|
||||
@ApiModelProperty("告警详情")
|
||||
// @Excel(name = "告警值")
|
||||
private String detail;
|
||||
|
||||
/** 用于Excel导出的告警详情(转换后) */
|
||||
@Excel(name = "告警值")
|
||||
private String excelDetail;
|
||||
// 在setDetail时同步设置转换后的值
|
||||
public void setDetail(String detail) {
|
||||
this.detail = detail;
|
||||
this.excelDetail = AlertDetailConverter.convert(detail);
|
||||
}
|
||||
// 添加一个用于Excel导出的转换方法
|
||||
public String getExcelDetail() {
|
||||
return AlertDetailConverter.convert(detail);
|
||||
}
|
||||
|
||||
private Long userId;
|
||||
|
||||
private Integer enable;
|
||||
|
||||
@@ -51,6 +51,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="productId != null "> and al.product_id = #{productId}</if>
|
||||
<if test="serialNumber != null "> and al.serial_number = #{serialNumber}</if>
|
||||
<if test="userId != null "> and al.user_id = #{userId}</if>
|
||||
<if test="deviceId != null "> and al.device_id = #{deviceId}</if>
|
||||
<if test="deviceName != null and deviceName != ''"> and al.device_name like concat('%', #{deviceName}, '%')</if>
|
||||
<if test="createBy != null "> and al.create_by = #{createBy}</if>
|
||||
<if test="remark != null "> and al.remark = #{remark}</if>
|
||||
<if test="respPersonId != null "> and al.resp_person_id = #{respPersonId}</if>
|
||||
@@ -252,7 +254,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="enable != null">enable =#{enable},</if>
|
||||
<if test="orderId != null">orderId =#{orderId},</if>
|
||||
<if test="respPersonId != null">resp_person_id =#{respPersonId},</if>
|
||||
<if test="procPersonName != null and procPersonName != ''">proc_person_name,</if>
|
||||
<if test="procPersonName != null and procPersonName != ''">proc_person_name =#{procPersonName},</if>
|
||||
</trim>
|
||||
where alert_log_id = #{alertLogId}
|
||||
</update>
|
||||
|
||||
Reference in New Issue
Block a user