fix: 修正运维使用的心跳时间

dev
huangfeng 1 year ago
parent 8a31c7c9fb
commit 6c2aaec49c

@ -1,7 +1,11 @@
package com.shxy.xymanager_common.entity; package com.shxy.xymanager_common.entity;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import com.alibaba.excel.util.StringUtils; import com.alibaba.excel.util.StringUtils;
import com.shxy.xymanager_common.util.MyDateUtils;
import com.shxy.xymanager_common.util.RawReportUtil; import com.shxy.xymanager_common.util.RawReportUtil;
import com.shxy.xymanager_common.util.xinyin.TerminalUtils;
import com.shxy.xymanager_common.vo.TerminalSelectVo; import com.shxy.xymanager_common.vo.TerminalSelectVo;
import java.util.Date; import java.util.Date;
@ -397,8 +401,27 @@ public class MntnStatus {
} }
} }
} }
if (vo.getIsonline() != null) {
if (vo.getIsonline().equals(this.getOnlinestatus())) {
return true;
}
}
} }
return false; return false;
} }
public Integer getOnlinestatus() {
if (rawReportTime == null) {
return 0;
}
long time = MyDateUtils.TimeSecond2MillSecond(rawReportTime);
DateTime date = MyDateUtils.date(time);
long between = MyDateUtils.between(MyDateUtils.getNowDate(), date, DateUnit.MINUTE);
if (between > TerminalUtils.hearttime) {
return 0;
} else {
return 1;
}
}
} }

@ -69,6 +69,8 @@ public class RawReportUtil {
map.put("batteryTmp", str.replaceFirst("电池温度:", "")); map.put("batteryTmp", str.replaceFirst("电池温度:", ""));
} else if (str.startsWith("剩余存储空间:")) { } else if (str.startsWith("剩余存储空间:")) {
map.put("freeROM", str.replaceFirst("剩余存储空间:", "")); map.put("freeROM", str.replaceFirst("剩余存储空间:", ""));
} else if (str.startsWith("剩余空间:")) {
map.put("freeROM", str.replaceFirst("剩余空间:", ""));
} }
} }
} }

@ -63,6 +63,9 @@ public class TerminalSelectVo {
if (StringUtils.isNotBlank(oid)) { if (StringUtils.isNotBlank(oid)) {
return true; return true;
} }
if (isonline != null) {
return true;
}
return false; return false;
} }
} }

@ -128,7 +128,10 @@ public class TerminalExtServiceImpl implements TerminalExtService {
@Override @Override
public List<View_Dy_Line_Tower_Terminals> getExtTerminalList(TerminalSelectVo vo) { public List<View_Dy_Line_Tower_Terminals> getExtTerminalList(TerminalSelectVo vo) {
Integer online = vo.getIsonline();
vo.setIsonline(null);
PageInfo<View_Dy_Line_Tower_Terminals> page = this.getTerminalList(vo); PageInfo<View_Dy_Line_Tower_Terminals> page = this.getTerminalList(vo);
vo.setIsonline(online);
List<View_Dy_Line_Tower_Terminals> result = this.fillReport(page.getList(), vo); List<View_Dy_Line_Tower_Terminals> result = this.fillReport(page.getList(), vo);
return result; return result;
} }
@ -138,7 +141,12 @@ public class TerminalExtServiceImpl implements TerminalExtService {
List<View_Dy_Line_Tower_Terminals> result = new ArrayList<>(); List<View_Dy_Line_Tower_Terminals> result = new ArrayList<>();
for (View_Dy_Line_Tower_Terminals item : list) { for (View_Dy_Line_Tower_Terminals item : list) {
MntnStatus status = statusMapper.selectByPrimaryKey(item.getId()); MntnStatus status = statusMapper.selectByPrimaryKey(item.getId());
item.setMntnStatus(status); if (status != null) {
item.setMntnStatus(status);
if (status.getRawReportTime() != null) {
item.setLastHeartbeat(BigInteger.valueOf(status.getRawReportTime()));
}
}
if (vo.needMatch()) { if (vo.needMatch()) {
if (status != null) { if (status != null) {
if (status.match(vo)) { if (status.match(vo)) {

Loading…
Cancel
Save