fix: 调整mntnStatus和rawReport

dev
huangfeng 1 year ago
parent 8385372492
commit 18f34d519c

@ -8,7 +8,6 @@ import lombok.extern.slf4j.Slf4j;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@Slf4j
public class MntnStatus {
@ -60,6 +59,14 @@ public class MntnStatus {
*/
private Long rawReportTime;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_status.comment
*
* @mbg.generated
*/
private String comment;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column mntn_status.create_time
@ -216,6 +223,28 @@ public class MntnStatus {
this.rawReportTime = rawReportTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_status.comment
*
* @return the value of mntn_status.comment
* @mbg.generated
*/
public String getComment() {
return comment;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column mntn_status.comment
*
* @param comment the value for mntn_status.comment
* @mbg.generated
*/
public void setComment(String comment) {
this.comment = comment;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column mntn_status.create_time
@ -282,7 +311,17 @@ public class MntnStatus {
this.lastRawReport = lastRawReport;
}
public HashMap<String, Object> makeRawReport() {
private HashMap<String, Object> reportMap;
public HashMap<String, Object> getReportMap() {
return reportMap;
}
public void setReportMap(HashMap<String, Object> reportMap) {
this.reportMap = reportMap;
}
public void makeRawReport() {
if (StringUtils.isNotBlank(lastRawReport)) {
try {
HashMap<String, Object> map = JSONUtil.json2Object(lastRawReport, HashMap.class);
@ -290,83 +329,80 @@ public class MntnStatus {
if (msg != null) {
String[] strs = ((String) msg).split(",");
for (String str : strs) {
String[] vs = str.split(":");
if (vs.length == 2) {
if (vs[0].equals("i1服务器")) {
map.put("cma", vs[1]);
} else if (vs[0].equals("i1")) {
map.put("i1Version", vs[1]);
} else if (vs[0].equals("yw")) {
map.put("maintainVersion", vs[1]);
} else if (vs[0].equals("心跳间隔")) {
map.put("heartbeatDuration", vs[1]);
} else if (vs[0].equals("电池")) {
map.put("battery", vs[1]);
} else if (vs[0].equals("系统重启")) {
map.put("rebootTimes", vs[1]);
} else if (vs[0].equals("重启")) {
map.put("rebootTimes", vs[1]);
} else if (vs[0].equals("i1重启")) {
map.put("i1RebootTimes", vs[1]);
} else if (vs[0].equals("收")) {
map.put("recv", vs[1]);
} else if (vs[0].equals("拍")) {
map.put("photoTimes", vs[1]);
} else if (vs[0].equals("成")) {
map.put("success", vs[1]);
} else if (vs[0].equals("败")) {
map.put("failure", vs[1]);
} else if (vs[0].equals("传")) {
map.put("uploads", vs[1]);
} else if (vs[0].equals("心跳累计")) {
map.put("numberOfHb", vs[1]);
} else if (vs[0].equals("心跳")) {
map.put("numberOfHb", vs[1]);
} else if (vs[0].equals("网络异常")) {
map.put("networkError", vs[1]);
} else if (vs[0].equals("网络")) {
map.put("networkError", vs[1]);
} else if (vs[0].equals("信号1")) {
map.put("signature1", vs[1]);
} else if (vs[0].equals("信号2")) {
map.put("signature2", vs[1]);
} else if (vs[0].equals("卡1")) {
map.put("simcard1", vs[1]);
} else if (vs[0].equals("卡2")) {
map.put("simcard2", vs[1]);
} else if (vs[0].equals("mcu")) {
map.put("mcu", vs[1]);
} else if (vs[0].equals("ai")) {
map.put("aiVersion", vs[1]);
} else if (vs[0].equals("cam")) {
map.put("cameraService", vs[1]);
} else if (vs[0].equals("主板温度")) {
map.put("mainBoardTmp", vs[1]);
} else if (vs[0].equals("电池温度")) {
map.put("batteryTmp", vs[1]);
} else if (vs[0].equals("剩余存储空间")) {
map.put("freeROM", vs[1]);
}
str = str.trim();
if (str.startsWith("i1服务器:")) {
map.put("cma", str.replaceFirst("i1服务器:", ""));
} else if (str.startsWith("i1:")) {
map.put("i1Version", str.replaceFirst("i1:", ""));
} else if (str.startsWith("yw:")) {
map.put("maintainVersion", str.replaceFirst("yw:", ""));
} else if (str.startsWith("心跳间隔:")) {
map.put("heartbeatDuration", str.replaceFirst("心跳间隔:", ""));
} else if (str.startsWith("电池:")) {
map.put("battery", str.replaceFirst("电池:", ""));
} else if (str.startsWith("系统重启:")) {
map.put("rebootTimes", str.replaceFirst("系统重启:", ""));
} else if (str.startsWith("重启:")) {
map.put("rebootTimes", str.replaceFirst("重启:", ""));
} else if (str.startsWith("i1重启:")) {
map.put("i1RebootTimes", str.replaceFirst("i1重启:", ""));
} else if (str.startsWith("收:")) {
map.put("recv", str.replaceFirst("收:", ""));
} else if (str.startsWith("拍:")) {
map.put("photoTimes", str.replaceFirst("拍:", ""));
} else if (str.startsWith("成:")) {
map.put("success", str.replaceFirst("成:", ""));
} else if (str.startsWith("败:")) {
map.put("failure", str.replaceFirst("败:", ""));
} else if (str.startsWith("传:")) {
map.put("uploads", str.replaceFirst("传:", ""));
} else if (str.startsWith("心跳累计:")) {
map.put("numberOfHb", str.replaceFirst("心跳累计:", ""));
} else if (str.startsWith("心跳:")) {
map.put("numberOfHb", str.replaceFirst("心跳:", ""));
} else if (str.startsWith("网络异常:")) {
map.put("networkError", str.replaceFirst("网络异常:", ""));
} else if (str.startsWith("网络:")) {
map.put("networkError", str.replaceFirst("网络:", ""));
} else if (str.startsWith("信号1:")) {
map.put("signature1", str.replaceFirst("信号1:", ""));
} else if (str.startsWith("信号2:")) {
map.put("signature2", str.replaceFirst("信号2:", ""));
} else if (str.startsWith("卡1:")) {
map.put("simcard1", str.replaceFirst("卡1:", ""));
} else if (str.startsWith("卡2:")) {
map.put("simcard2", str.replaceFirst("卡2:", ""));
} else if (str.startsWith("mcu:")) {
map.put("mcu", str.replaceFirst("mcu", ""));
} else if (str.startsWith("ai:")) {
map.put("aiVersion", str.replaceFirst("ai:", ""));
} else if (str.startsWith("cam:")) {
map.put("cameraService", str.replaceFirst("cam:", ""));
} else if (str.startsWith("主板温度:")) {
map.put("mainBoardTmp", str.replaceFirst("主板温度:", ""));
} else if (str.startsWith("电池温度:")) {
map.put("batteryTmp", str.replaceFirst("电池温度:", ""));
} else if (str.startsWith("剩余存储空间:")) {
map.put("freeROM", str.replaceFirst("剩余存储空间:", ""));
}
}
}
return map;
reportMap = map;
} catch (Exception e) {
log.error("makeRawReport error, lastRawReport=" + lastRawReport, e);
}
}
return null;
}
public HashMap<String, Object> match(TerminalSelectVo vo) {
HashMap<String, Object> map = this.makeRawReport();
if (map != null) {
public boolean match(TerminalSelectVo vo) {
this.makeRawReport();
if (reportMap != null) {
if (StringUtils.isNotBlank(vo.getVersion())) {
int v = 0;
Iterator<String> it = map.keySet().iterator();
Iterator<String> it = reportMap.keySet().iterator();
while (it.hasNext()) {
String key = it.next();
Object value = map.get(key);
Object value = reportMap.get(key);
if (key.toLowerCase().contains("version")) {
if (value.toString().contains(vo.getVersion())) {
v = 1;
@ -376,20 +412,20 @@ public class MntnStatus {
}
if (vo.getVersionExclude()) {
if (v == 0) {
return map;
return true;
}
} else {
if (v == 1) {
return map;
return true;
}
}
}
if (StringUtils.isNotBlank(vo.getCma())) {
int c = 0;
Iterator<String> it = map.keySet().iterator();
Iterator<String> it = reportMap.keySet().iterator();
while (it.hasNext()) {
String key = it.next();
Object value = map.get(key);
Object value = reportMap.get(key);
if (key.toLowerCase().contains("cma")) {
if (value.toString().contains(vo.getCma())) {
c = 1;
@ -399,20 +435,20 @@ public class MntnStatus {
}
if (vo.getCmaExclude()) {
if (c == 0) {
return map;
return true;
}
} else {
if (c == 1) {
return map;
return true;
}
}
}
if (StringUtils.isNotBlank(vo.getOid())) {
int d = 0;
Iterator<String> it = map.keySet().iterator();
Iterator<String> it = reportMap.keySet().iterator();
while (it.hasNext()) {
String key = it.next();
Object value = map.get(key);
Object value = reportMap.get(key);
if (key.toLowerCase().contains("oid")) {
if (value.toString().contains(vo.getCma())) {
d = 1;
@ -422,15 +458,16 @@ public class MntnStatus {
}
if (vo.getOidExclude()) {
if (d == 0) {
return map;
return true;
}
} else {
if (d == 1) {
return map;
return true;
}
}
}
}
return null;
return false;
}
}

@ -565,6 +565,76 @@ public class MntnStatusExample {
return (Criteria) this;
}
public Criteria andCommentIsNull() {
addCriterion("`comment` is null");
return (Criteria) this;
}
public Criteria andCommentIsNotNull() {
addCriterion("`comment` is not null");
return (Criteria) this;
}
public Criteria andCommentEqualTo(String value) {
addCriterion("`comment` =", value, "comment");
return (Criteria) this;
}
public Criteria andCommentNotEqualTo(String value) {
addCriterion("`comment` <>", value, "comment");
return (Criteria) this;
}
public Criteria andCommentGreaterThan(String value) {
addCriterion("`comment` >", value, "comment");
return (Criteria) this;
}
public Criteria andCommentGreaterThanOrEqualTo(String value) {
addCriterion("`comment` >=", value, "comment");
return (Criteria) this;
}
public Criteria andCommentLessThan(String value) {
addCriterion("`comment` <", value, "comment");
return (Criteria) this;
}
public Criteria andCommentLessThanOrEqualTo(String value) {
addCriterion("`comment` <=", value, "comment");
return (Criteria) this;
}
public Criteria andCommentLike(String value) {
addCriterion("`comment` like", value, "comment");
return (Criteria) this;
}
public Criteria andCommentNotLike(String value) {
addCriterion("`comment` not like", value, "comment");
return (Criteria) this;
}
public Criteria andCommentIn(List<String> values) {
addCriterion("`comment` in", values, "comment");
return (Criteria) this;
}
public Criteria andCommentNotIn(List<String> values) {
addCriterion("`comment` not in", values, "comment");
return (Criteria) this;
}
public Criteria andCommentBetween(String value1, String value2) {
addCriterion("`comment` between", value1, value2, "comment");
return (Criteria) this;
}
public Criteria andCommentNotBetween(String value1, String value2) {
addCriterion("`comment` not between", value1, value2, "comment");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;

@ -133,5 +133,5 @@ public class View_Dy_Line_Tower_Terminals implements Serializable {
private TerminalPositions positions;
private Long rebootCount;
private TerminalBasicInfoHistory lastInfo;
private HashMap<String, Object> rawReport;
private MntnStatus mntnStatus;
}

@ -12,6 +12,7 @@
<result column="mode_time" jdbcType="BIGINT" property="modeTime" />
<result column="last_ip" jdbcType="VARCHAR" property="lastIp" />
<result column="raw_report_time" jdbcType="BIGINT" property="rawReportTime" />
<result column="comment" jdbcType="VARCHAR" property="comment" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
@ -93,7 +94,7 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
term_id, in_maintain, quick_hb, mode_time, last_ip, raw_report_time, create_time,
term_id, in_maintain, quick_hb, mode_time, last_ip, raw_report_time, `comment`, create_time,
update_time
</sql>
<sql id="Blob_Column_List">
@ -178,12 +179,12 @@
-->
insert into mntn_status (term_id, in_maintain, quick_hb,
mode_time, last_ip, raw_report_time,
create_time, update_time, last_raw_report
)
`comment`, create_time, update_time,
last_raw_report)
values (#{termId,jdbcType=INTEGER}, #{inMaintain,jdbcType=TINYINT}, #{quickHb,jdbcType=TINYINT},
#{modeTime,jdbcType=BIGINT}, #{lastIp,jdbcType=VARCHAR}, #{rawReportTime,jdbcType=BIGINT},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{lastRawReport,jdbcType=LONGVARCHAR}
)
#{comment,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{lastRawReport,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.MntnStatus">
<!--
@ -210,6 +211,9 @@
<if test="rawReportTime != null">
raw_report_time,
</if>
<if test="comment != null">
`comment`,
</if>
<if test="createTime != null">
create_time,
</if>
@ -239,6 +243,9 @@
<if test="rawReportTime != null">
#{rawReportTime,jdbcType=BIGINT},
</if>
<if test="comment != null">
#{comment,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
@ -285,6 +292,9 @@
<if test="row.rawReportTime != null">
raw_report_time = #{row.rawReportTime,jdbcType=BIGINT},
</if>
<if test="row.comment != null">
`comment` = #{row.comment,jdbcType=VARCHAR},
</if>
<if test="row.createTime != null">
create_time = #{row.createTime,jdbcType=TIMESTAMP},
</if>
@ -311,6 +321,7 @@
mode_time = #{row.modeTime,jdbcType=BIGINT},
last_ip = #{row.lastIp,jdbcType=VARCHAR},
raw_report_time = #{row.rawReportTime,jdbcType=BIGINT},
`comment` = #{row.comment,jdbcType=VARCHAR},
create_time = #{row.createTime,jdbcType=TIMESTAMP},
update_time = #{row.updateTime,jdbcType=TIMESTAMP},
last_raw_report = #{row.lastRawReport,jdbcType=LONGVARCHAR}
@ -330,6 +341,7 @@
mode_time = #{row.modeTime,jdbcType=BIGINT},
last_ip = #{row.lastIp,jdbcType=VARCHAR},
raw_report_time = #{row.rawReportTime,jdbcType=BIGINT},
`comment` = #{row.comment,jdbcType=VARCHAR},
create_time = #{row.createTime,jdbcType=TIMESTAMP},
update_time = #{row.updateTime,jdbcType=TIMESTAMP}
<if test="example != null">
@ -358,6 +370,9 @@
<if test="rawReportTime != null">
raw_report_time = #{rawReportTime,jdbcType=BIGINT},
</if>
<if test="comment != null">
`comment` = #{comment,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
@ -381,6 +396,7 @@
mode_time = #{modeTime,jdbcType=BIGINT},
last_ip = #{lastIp,jdbcType=VARCHAR},
raw_report_time = #{rawReportTime,jdbcType=BIGINT},
`comment` = #{comment,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
last_raw_report = #{lastRawReport,jdbcType=LONGVARCHAR}
@ -397,6 +413,7 @@
mode_time = #{modeTime,jdbcType=BIGINT},
last_ip = #{lastIp,jdbcType=VARCHAR},
raw_report_time = #{rawReportTime,jdbcType=BIGINT},
`comment` = #{comment,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where term_id = #{termId,jdbcType=INTEGER}

@ -118,20 +118,16 @@ public class TerminalExtServiceImpl implements TerminalExtService {
List<View_Dy_Line_Tower_Terminals> result = new ArrayList<>();
for (View_Dy_Line_Tower_Terminals item : list) {
MntnStatus status = statusMapper.selectByPrimaryKey(item.getId());
item.setMntnStatus(status);
if (vo.needMatch()) {
if (status != null) {
HashMap<String, Object> map = status.match(vo);
if (map != null) {
item.setRawReport(map);
if (status.match(vo)) {
result.add(item);
}
}
} else {
if (status != null) {
HashMap<String, Object> map = status.makeRawReport();
if (map != null) {
item.setRawReport(map);
}
status.makeRawReport();
}
result.add(item);
}

Loading…
Cancel
Save