模糊查询优化和缓存优化

master
liuguijing 2 years ago
parent 37cbdcbde8
commit 862ce46b28

@ -20,8 +20,4 @@ public class LineAndDyNameDto {
private Integer status; private Integer status;
private Integer dyId;
private Integer dyValue;
} }

@ -3,6 +3,7 @@ package com.shxy.xymanager_common.dto;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date; import java.util.Date;
@Data @Data
@ -43,9 +44,7 @@ public class TerminalsWithHeart implements Serializable {
private Date updateTime; private Date updateTime;
private Long lastheartbeat; private BigInteger lastheartbeat;
private Integer onlinestatus;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

@ -3,6 +3,7 @@ package com.shxy.xymanager_common.entity;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date; import java.util.Date;
@Data @Data
@ -41,7 +42,7 @@ public class Terminals implements Serializable {
private Date updateTime; private Date updateTime;
private Long lastheartbeat; private BigInteger lastheartbeat;
private Integer onlinestatus; private Integer onlinestatus;

@ -3,7 +3,6 @@ package com.shxy.xymanager_dao.dao;
import com.shxy.xymanager_common.dto.ChannelAndTermDto; import com.shxy.xymanager_common.dto.ChannelAndTermDto;
import com.shxy.xymanager_common.dto.TerminalInfoDto; import com.shxy.xymanager_common.dto.TerminalInfoDto;
import com.shxy.xymanager_common.dto.TerminalsAndStatusDto; import com.shxy.xymanager_common.dto.TerminalsAndStatusDto;
import com.shxy.xymanager_common.entity.TerminalStatus;
import com.shxy.xymanager_common.entity.Terminals; import com.shxy.xymanager_common.entity.Terminals;
import com.shxy.xymanager_common.vo.RelateTerminalListRuleIdVo; import com.shxy.xymanager_common.vo.RelateTerminalListRuleIdVo;
import com.shxy.xymanager_common.vo.TerminalIdUpdateVo; import com.shxy.xymanager_common.vo.TerminalIdUpdateVo;
@ -49,6 +48,4 @@ public interface TerminalsDao {
int updateCmd(TerminalIdUpdateVo vo); int updateCmd(TerminalIdUpdateVo vo);
List<TerminalStatus> getTerminalStatus(@Param("list")List<Terminals> list);
} }

@ -18,8 +18,6 @@
<result column="dy_level_id" jdbcType="INTEGER" property="dyLevelId"/> <result column="dy_level_id" jdbcType="INTEGER" property="dyLevelId"/>
<result column="dy_level_name" jdbcType="INTEGER" property="dyLevelName"/> <result column="dy_level_name" jdbcType="INTEGER" property="dyLevelName"/>
<result column="status" jdbcType="INTEGER" property="status"/> <result column="status" jdbcType="INTEGER" property="status"/>
<result column="dy_id" jdbcType="INTEGER" property="dyId"/>
<result column="dy_value" jdbcType="INTEGER" property="dyValue"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
@ -32,9 +30,7 @@
x.bs_manufacturer as bs_manufacturer, x.bs_manufacturer as bs_manufacturer,
x.dy_level_id as dy_level_id, x.dy_level_id as dy_level_id,
x.status as status, x.status as status,
y.name as dy_level_name, y.name as dy_level_name
y.dy_value as dy_value,
y.id as dy_id
from `lines` x, from `lines` x,
dy_level y dy_level y
where x.dy_level_id = y.id where x.dy_level_id = y.id

@ -56,7 +56,6 @@
where a.term_id = b.id and b.cmdid = #{cmdid} where a.term_id = b.id and b.cmdid = #{cmdid}
</select> </select>
<select id="selectAll" resultMap="BaseResultMap"> <select id="selectAll" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>

@ -43,7 +43,7 @@
<result column="boot_time" jdbcType="INTEGER" property="bootTime"/> <result column="boot_time" jdbcType="INTEGER" property="bootTime"/>
<result column="battery_capacity" jdbcType="FLOAT" property="batteryCapacity"/> <result column="battery_capacity" jdbcType="FLOAT" property="batteryCapacity"/>
<result column="battery_voltage" jdbcType="FLOAT" property="batteryVoltage"/> <result column="battery_voltage" jdbcType="FLOAT" property="batteryVoltage"/>
<result column="last_heartbeat" jdbcType="INTEGER" property="lastHeartbeat"/> <result column="last_heartbeat" jdbcType="BIGINT" property="lastHeartbeat"/>
</resultMap> </resultMap>
<resultMap id="ChannelAndTerm" type="com.shxy.xymanager_common.dto.ChannelAndTermDto"> <resultMap id="ChannelAndTerm" type="com.shxy.xymanager_common.dto.ChannelAndTermDto">
@ -506,15 +506,4 @@
set cmdid = #{newCmdId,jdbcType=VARCHAR} set cmdid = #{newCmdId,jdbcType=VARCHAR}
where cmdid = #{cmdId,jdbcType=VARCHAR} where cmdid = #{cmdId,jdbcType=VARCHAR}
</update> </update>
<select id="getTerminalStatus" resultType="com.shxy.xymanager_common.entity.TerminalStatus">
select
term_id as termId,
last_heartbeat as lastHeartbeat
from terminal_status
where term_id in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item.id}
</foreach>
</select>
</mapper> </mapper>

@ -16,7 +16,7 @@ public class XyCache {
@PostConstruct @PostConstruct
public void init() { public void init() {
//系统启动中。。。加载codeMap //系统启动中。。。加载codeMap
cacheService.updateDyMap(); // cacheService.updateDyMap();
cacheService.updateLineMap(); cacheService.updateLineMap();

@ -1,6 +1,5 @@
package com.shxy.xymanager_service.impl; package com.shxy.xymanager_service.impl;
import com.google.common.collect.Maps;
import com.shxy.xymanager_common.dto.LineAndDyNameDto; import com.shxy.xymanager_common.dto.LineAndDyNameDto;
import com.shxy.xymanager_common.dto.TermAndChannelDto; import com.shxy.xymanager_common.dto.TermAndChannelDto;
import com.shxy.xymanager_common.dto.TowerDto; import com.shxy.xymanager_common.dto.TowerDto;
@ -8,16 +7,18 @@ import com.shxy.xymanager_common.entity.*;
import com.shxy.xymanager_common.enums.CommonStatus; import com.shxy.xymanager_common.enums.CommonStatus;
import com.shxy.xymanager_dao.dao.*; import com.shxy.xymanager_dao.dao.*;
import com.shxy.xymanager_service.service.CacheService; import com.shxy.xymanager_service.service.CacheService;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut; import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
@ -49,9 +50,6 @@ public class CacheServiceImpl implements CacheService {
@Autowired @Autowired
TerminalImgAlarmParamsDao terminalImgAlarmParamsDao; TerminalImgAlarmParamsDao terminalImgAlarmParamsDao;
@Autowired
TerminalStatusDao terminalStatusDao;
// @Override // @Override
// @Cacheable(value = "globalParams", key = "#param") // @Cacheable(value = "globalParams", key = "#param")
// public GlobalParams getGlobalParams(String param) { // public GlobalParams getGlobalParams(String param) {
@ -292,28 +290,6 @@ public class CacheServiceImpl implements CacheService {
return lineMap; return lineMap;
} }
@Override
@Cacheable(value = "dyMap")
public Map<Integer,List<LineAndDyNameDto>> getDyMap() {
Map<Integer, List<LineAndDyNameDto>> lineMap;
List<LineAndDyNameDto> lineAndDyNameDtos = linesDao.selectAll(CommonStatus.EFFECTIVE.value());
lineMap = lineAndDyNameDtos.stream().collect(Collectors.groupingBy(LineAndDyNameDto::getDyId));
return lineMap;
}
@Override
@CachePut(value = "dyMap")
public Map<Integer, List<LineAndDyNameDto>> updateDyMap() {
Map<Integer, List<LineAndDyNameDto>> lineMap;
List<LineAndDyNameDto> lineAndDyNameDtos = linesDao.selectAll(CommonStatus.EFFECTIVE.value());
lineMap = lineAndDyNameDtos.stream().collect(Collectors.groupingBy(LineAndDyNameDto::getDyId));
return lineMap;
}
@Override @Override
@CachePut(value = "globalMap") @CachePut(value = "globalMap")

@ -5,23 +5,18 @@ import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUnit;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.shxy.xymanager_common.bean.ServiceBody; import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.dto.*; import com.shxy.xymanager_common.dto.DyLineAndTerminalWithHeartDto;
import com.shxy.xymanager_common.entity.DyLevel; import com.shxy.xymanager_common.entity.DyLevel;
import com.shxy.xymanager_common.entity.TerminalStatus; import com.shxy.xymanager_common.dto.TerminalsWithHeart;
import com.shxy.xymanager_common.entity.Terminals;
import com.shxy.xymanager_common.enums.CommonStatus; import com.shxy.xymanager_common.enums.CommonStatus;
import com.shxy.xymanager_common.exception.Asserts; import com.shxy.xymanager_common.exception.Asserts;
import com.shxy.xymanager_common.model.DyLineTreeListModel; import com.shxy.xymanager_common.model.DyLineTreeListModel;
import com.shxy.xymanager_common.model.DyListModel; import com.shxy.xymanager_common.model.DyListModel;
import com.shxy.xymanager_common.util.MyDateUtils; import com.shxy.xymanager_common.util.MyDateUtils;
import com.shxy.xymanager_common.util.TerminalUtils;
import com.shxy.xymanager_common.vo.TestVo; import com.shxy.xymanager_common.vo.TestVo;
import com.shxy.xymanager_dao.dao.DyLevelDao; import com.shxy.xymanager_dao.dao.DyLevelDao;
import com.shxy.xymanager_dao.dao.TerminalStatusDao;
import com.shxy.xymanager_dao.dao.TerminalsDao;
import com.shxy.xymanager_service.service.CacheService;
import com.shxy.xymanager_service.service.DyLevelService; import com.shxy.xymanager_service.service.DyLevelService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -31,8 +26,6 @@ import org.springframework.stereotype.Service;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* *
@ -44,15 +37,6 @@ public class DyLevelServiceImpl implements DyLevelService {
@Autowired @Autowired
DyLevelDao dyLevelDao; DyLevelDao dyLevelDao;
@Value("${heart.time}")
public Integer hearttime;
@Autowired
CacheService cacheService;
@Autowired
private TerminalsDao terminalsDao;
/** /**
* 线 * 线
* *
@ -61,26 +45,19 @@ public class DyLevelServiceImpl implements DyLevelService {
@Override @Override
public ServiceBody<DyLineTreeListModel> getdyTreeList() { public ServiceBody<DyLineTreeListModel> getdyTreeList() {
DyLineTreeListModel model = new DyLineTreeListModel(); DyLineTreeListModel model = new DyLineTreeListModel();
/*List<DyLineAndTerminalWithHeartDto> list = dyLevelDao.selectTreeList(CommonStatus.EFFECTIVE.value());*/ List<DyLineAndTerminalWithHeartDto> list = dyLevelDao.selectTreeList(CommonStatus.EFFECTIVE.value());
List<DyLineAndTerminalWithHeartDto> list = Lists.newArrayList();
getDyList(list);
boolean empty = CollectionUtil.isEmpty(list); boolean empty = CollectionUtil.isEmpty(list);
if (empty) { if (empty) {
model.setList(new ArrayList<>()); model.setList(new ArrayList<>());
} else { } else {
List<DyLineTreeListModel.DyListBean> beans = BeanUtil.copyToList(list, DyLineTreeListModel.DyListBean.class, CopyOptions.create().ignoreCase()); List<DyLineTreeListModel.DyListBean> beans = BeanUtil.copyToList(list, DyLineTreeListModel.DyListBean.class, CopyOptions.create().ignoreCase());
/*for (int i = 0; i < beans.size(); i++) { for (int i = 0; i < beans.size(); i++) {
for (int j = 0; j < beans.get(i).getList().size(); j++) { for (int j = 0; j < beans.get(i).getList().size(); j++) {
for (int k = 0; k < beans.get(i).getList().get(j).getList().size(); k++) { for (int k = 0; k < beans.get(i).getList().get(j).getList().size(); k++) {
// beans.get(i).getList().get(j).getList().get(k).setName(list.get(i).getList().get(j).getList().get(k).getDisplayName());
TerminalsWithHeart terminalsWithHeart = list.get(i).getList().get(j).getList().get(k); TerminalsWithHeart terminalsWithHeart = list.get(i).getList().get(j).getList().get(k);
if (!BeanUtil.isEmpty(terminalsWithHeart)) { BigInteger lastheartbeat = terminalsWithHeart.getLastheartbeat();
Long lastheartbeat = terminalsWithHeart.getLastheartbeat(); boolean b = TerminalUtils.judgeTerminalStatus(lastheartbeat);
if (!BeanUtil.isEmpty(lastheartbeat)) { if (b) {
long time = MyDateUtils.TimeSecond2MillSecond(lastheartbeat);
DateTime date = MyDateUtils.date(time);
long between = MyDateUtils.between(MyDateUtils.getNowDate(), date, DateUnit.MINUTE);
if (between > hearttime) {
beans.get(i).getList().get(j).getList().get(k).setOnlinestatus(CommonStatus.DELETE.value()); beans.get(i).getList().get(j).getList().get(k).setOnlinestatus(CommonStatus.DELETE.value());
} else { } else {
beans.get(i).getList().get(j).getList().get(k).setOnlinestatus(CommonStatus.EFFECTIVE.value()); beans.get(i).getList().get(j).getList().get(k).setOnlinestatus(CommonStatus.EFFECTIVE.value());
@ -88,72 +65,11 @@ public class DyLevelServiceImpl implements DyLevelService {
} }
} }
} }
}
}*/
model.setList(beans); model.setList(beans);
} }
return Asserts.success(model); return Asserts.success(model);
} }
private void getDyList(List<DyLineAndTerminalWithHeartDto> list) {
List<LineAndTerminalWithHeartDto> lineList = Lists.newArrayList();
Map<Integer, Terminals> terminalsMap = cacheService.getTerminalMap();
List<Terminals> termList = terminalsMap.values().stream().collect(Collectors.toList());
Map<Integer, TerminalStatus> statusMap = Maps.newHashMap();
List<TerminalStatus> terminalStatusDtos = terminalsDao.getTerminalStatus(termList);
for (TerminalStatus status : terminalStatusDtos) {
statusMap.put(status.getTermId(), status);
}
Map<Integer, TowerDto> towerMap = cacheService.getTowerMap();
List<TowerDto> towerList = towerMap.values().stream().collect(Collectors.toList());
Map<Integer, TowerDto> towerByLineMap = Maps.newHashMap();
for (TowerDto item : towerList) {
towerByLineMap.put(item.getLineId(), item);
}
termList.stream().forEach(var->{
if(null!=statusMap.get(var.getId())&&null!=statusMap.get(var.getId()).getLastHeartbeat()) {
long time = MyDateUtils.TimeSecond2MillSecond(statusMap.get(var.getId()).getLastHeartbeat().longValue());
DateTime date = MyDateUtils.date(time);
long between = MyDateUtils.between(MyDateUtils.getNowDate(), date, DateUnit.MINUTE);
if (between > hearttime) {
var.setOnlinestatus(CommonStatus.DELETE.value());
} else {
var.setOnlinestatus(CommonStatus.EFFECTIVE.value());
}
var.setLastheartbeat(statusMap.get(var.getId()).getLastHeartbeat().longValue());
}
if(null!=towerByLineMap.get(var.getLineid())) {
var.setTowerid(towerByLineMap.get(var.getLineid()).getId());
}
});
Map<Integer, List<Terminals>> termByLineIdMap = termList.stream().collect(Collectors.groupingBy(Terminals::getLineid));
Map<Integer, List<LineAndDyNameDto>> map = cacheService.getDyMap();
map.forEach((key, value) -> {
DyLineAndTerminalWithHeartDto dyDto = new DyLineAndTerminalWithHeartDto();
dyDto.setId(key);
dyDto.setName(value.get(0).getName());
dyDto.setDyValue(value.get(0).getDyValue());
for(LineAndDyNameDto line:value) {
List<TerminalsWithHeart> terminalList = Lists.newArrayList();
if(null!=termByLineIdMap.get(line.getId())) {
terminalList = BeanUtil.copyToList(termByLineIdMap.get(line.getId()), TerminalsWithHeart.class, CopyOptions.create().ignoreCase());
}
LineAndTerminalWithHeartDto lineDto = new LineAndTerminalWithHeartDto();
lineDto.setBsManufacturer(line.getBsManufacturer());
lineDto.setDyLevel(line.getDyLevelId());
lineDto.setName(line.getName());
lineDto.setId(line.getId());
lineDto.setList(terminalList);
lineList.add(lineDto);
}
dyDto.setList(lineList);
list.add(dyDto);
});
}
/** /**
* *

@ -15,6 +15,7 @@ import com.shxy.xymanager_common.enums.CommonStatus;
import com.shxy.xymanager_common.util.CmaUtil; import com.shxy.xymanager_common.util.CmaUtil;
import com.shxy.xymanager_common.util.MyDateUtils; import com.shxy.xymanager_common.util.MyDateUtils;
import com.shxy.xymanager_common.util.ProcessExecUtils; import com.shxy.xymanager_common.util.ProcessExecUtils;
import com.shxy.xymanager_common.util.TerminalUtils;
import com.shxy.xymanager_common.vo.OpenCmdidVo; import com.shxy.xymanager_common.vo.OpenCmdidVo;
import com.shxy.xymanager_common.vo.OpenDeviceCaptureVo; import com.shxy.xymanager_common.vo.OpenDeviceCaptureVo;
import com.shxy.xymanager_common.vo.UserLoginVo; import com.shxy.xymanager_common.vo.UserLoginVo;
@ -55,9 +56,6 @@ public class OpenServiceImpl implements OpenService {
@Value("${session.open_expire_time}") @Value("${session.open_expire_time}")
public Integer time; public Integer time;
@Value("${heart.time}")
public Integer hearttime;
/** /**
* *
* *
@ -213,11 +211,9 @@ public class OpenServiceImpl implements OpenService {
jsonObject.set("errmsg", "device not register"); jsonObject.set("errmsg", "device not register");
return jsonObject; return jsonObject;
} }
Long lastheartbeat = terminalsWithHeart.getLastheartbeat(); BigInteger lastheartbeat = terminalsWithHeart.getLastheartbeat();
long time = MyDateUtils.TimeSecond2MillSecond(lastheartbeat); boolean b = TerminalUtils.judgeTerminalStatus(lastheartbeat);
DateTime date = MyDateUtils.date(time); if (b) {
long between = MyDateUtils.between(MyDateUtils.getNowDate(), date, DateUnit.MINUTE);
if (between > hearttime) {
jsonObject.set("isonline", false); jsonObject.set("isonline", false);
jsonObject.set("errcode", 0); jsonObject.set("errcode", 0);
jsonObject.set("errmsg", "ok"); jsonObject.set("errmsg", "ok");

@ -76,8 +76,6 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
@Value("${video.address}") @Value("${video.address}")
private String videoaddress; private String videoaddress;
@Value("${heart.time}")
public Integer hearttime;
/** /**
* idid * idid

@ -10,7 +10,6 @@ import com.github.pagehelper.PageInfo;
import com.shxy.xymanager_common.bean.ServiceBody; import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.constant.Constants; import com.shxy.xymanager_common.constant.Constants;
import com.shxy.xymanager_common.dto.*; import com.shxy.xymanager_common.dto.*;
import com.shxy.xymanager_common.entity.Lines;
import com.shxy.xymanager_common.entity.TerminalChannelMapper; import com.shxy.xymanager_common.entity.TerminalChannelMapper;
import com.shxy.xymanager_common.entity.TerminalStatus; import com.shxy.xymanager_common.entity.TerminalStatus;
import com.shxy.xymanager_common.entity.Terminals; import com.shxy.xymanager_common.entity.Terminals;
@ -75,9 +74,6 @@ public class TerminalServiceImpl implements TerminalService {
@Value("${photo.address}") @Value("${photo.address}")
private String photoaddress; private String photoaddress;
@Value("${heart.time}")
public Integer hearttime;
/** /**
* *
@ -100,12 +96,12 @@ public class TerminalServiceImpl implements TerminalService {
tower = null; tower = null;
} else { } else {
if (lineid == null || lineid.intValue() == -1) { if (lineid == null || lineid.intValue() == -1) {
dyLineAndTowertDtos = dyLevelDao.selectDyAndLineAndTowerList(dyid, null, null,search); dyLineAndTowertDtos = dyLevelDao.selectDyAndLineAndTowerList(dyid, null, null, search);
} else { } else {
if (tower == null || tower.intValue() == -1) { if (tower == null || tower.intValue() == -1) {
dyLineAndTowertDtos = dyLevelDao.selectDyAndLineAndTowerList(dyid, lineid, null,search); dyLineAndTowertDtos = dyLevelDao.selectDyAndLineAndTowerList(dyid, lineid, null, search);
} else { } else {
dyLineAndTowertDtos = dyLevelDao.selectDyAndLineAndTowerList(dyid, lineid, tower,search); dyLineAndTowertDtos = dyLevelDao.selectDyAndLineAndTowerList(dyid, lineid, tower, search);
} }
} }
} }
@ -120,9 +116,9 @@ public class TerminalServiceImpl implements TerminalService {
for (DyLineAndTowertDto item : dyLineAndTowertDtos) { for (DyLineAndTowertDto item : dyLineAndTowertDtos) {
toweridlist.add(item.getTowerId()); toweridlist.add(item.getTowerId());
} }
list2 = terminalsDao.selectTermAndStatusList(null, toweridlist,search); list2 = terminalsDao.selectTermAndStatusList(null, toweridlist, search);
} else { } else {
list2 = terminalsDao.selectTermAndStatusList(null, null,search); list2 = terminalsDao.selectTermAndStatusList(null, null, search);
} }
boolean empty = CollectionUtil.isEmpty(list2); boolean empty = CollectionUtil.isEmpty(list2);
if (empty) { if (empty) {
@ -390,19 +386,13 @@ public class TerminalServiceImpl implements TerminalService {
list.stream().forEach(var -> { list.stream().forEach(var -> {
var.getList().forEach(item -> { var.getList().forEach(item -> {
item.getList().forEach(terminalsWithHeart -> { item.getList().forEach(terminalsWithHeart -> {
Long lastheartbeat = terminalsWithHeart.getLastheartbeat(); BigInteger lastheartbeat = terminalsWithHeart.getLastheartbeat();
if (!BeanUtil.isEmpty(lastheartbeat)) { boolean b = TerminalUtils.judgeTerminalStatus(lastheartbeat);
long time = MyDateUtils.TimeSecond2MillSecond(lastheartbeat); if (b) {
DateTime date = MyDateUtils.date(time);
long between = MyDateUtils.between(MyDateUtils.getNowDate(), date, DateUnit.MINUTE);
if (between > hearttime) {
terminalsWithHeart.setOnlinestatus(CommonStatus.DELETE.value()); terminalsWithHeart.setOnlinestatus(CommonStatus.DELETE.value());
} else { } else {
terminalsWithHeart.setOnlinestatus(CommonStatus.EFFECTIVE.value()); terminalsWithHeart.setOnlinestatus(CommonStatus.EFFECTIVE.value());
} }
}
}); });
}); });
}); });

@ -4,6 +4,9 @@ import com.shxy.xymanager_common.dto.LineAndDyNameDto;
import com.shxy.xymanager_common.dto.TermAndChannelDto; import com.shxy.xymanager_common.dto.TermAndChannelDto;
import com.shxy.xymanager_common.dto.TowerDto; import com.shxy.xymanager_common.dto.TowerDto;
import com.shxy.xymanager_common.entity.*; import com.shxy.xymanager_common.entity.*;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -109,11 +112,4 @@ public interface CacheService {
Map<Integer, Terminals> updateTerminalMap(); Map<Integer, Terminals> updateTerminalMap();
Map<Integer, LineAndDyNameDto> updateLineMap(); Map<Integer, LineAndDyNameDto> updateLineMap();
Map<Integer,List<LineAndDyNameDto>> updateDyMap();
Map<Integer,List<LineAndDyNameDto>> getDyMap();
} }

Loading…
Cancel
Save