From 18f34d519cb498a94c4c69eafbd3c78e5872866c Mon Sep 17 00:00:00 2001 From: huangfeng Date: Mon, 13 May 2024 10:24:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4mntnStatus=E5=92=8Craw?= =?UTF-8?q?Report?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xymanager_common/entity/MntnStatus.java | 191 +++++++++++------- .../entity/MntnStatusExample.java | 70 +++++++ .../entity/View_Dy_Line_Tower_Terminals.java | 2 +- .../resources/mappers/MntnStatusMapper.xml | 27 ++- .../impl/TerminalExtServiceImpl.java | 10 +- 5 files changed, 210 insertions(+), 90 deletions(-) diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/MntnStatus.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/MntnStatus.java index 32d6be5..e8bd65b 100644 --- a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/MntnStatus.java +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/MntnStatus.java @@ -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 makeRawReport() { + private HashMap reportMap; + + public HashMap getReportMap() { + return reportMap; + } + + public void setReportMap(HashMap reportMap) { + this.reportMap = reportMap; + } + + public void makeRawReport() { if (StringUtils.isNotBlank(lastRawReport)) { try { HashMap 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 match(TerminalSelectVo vo) { - HashMap 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 it = map.keySet().iterator(); + Iterator 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 it = map.keySet().iterator(); + Iterator 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 it = map.keySet().iterator(); + Iterator 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; } + } \ No newline at end of file diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/MntnStatusExample.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/MntnStatusExample.java index 297b8d7..48c0d95 100644 --- a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/MntnStatusExample.java +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/MntnStatusExample.java @@ -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 values) { + addCriterion("`comment` in", values, "comment"); + return (Criteria) this; + } + + public Criteria andCommentNotIn(List 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; diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/View_Dy_Line_Tower_Terminals.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/View_Dy_Line_Tower_Terminals.java index 0785abc..8f4c1e7 100644 --- a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/View_Dy_Line_Tower_Terminals.java +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/View_Dy_Line_Tower_Terminals.java @@ -133,5 +133,5 @@ public class View_Dy_Line_Tower_Terminals implements Serializable { private TerminalPositions positions; private Long rebootCount; private TerminalBasicInfoHistory lastInfo; - private HashMap rawReport; + private MntnStatus mntnStatus; } \ No newline at end of file diff --git a/xymanager_dao/src/main/resources/mappers/MntnStatusMapper.xml b/xymanager_dao/src/main/resources/mappers/MntnStatusMapper.xml index 6105a75..b06c6c0 100644 --- a/xymanager_dao/src/main/resources/mappers/MntnStatusMapper.xml +++ b/xymanager_dao/src/main/resources/mappers/MntnStatusMapper.xml @@ -12,6 +12,7 @@ + @@ -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 @@ -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})