模糊查询和图片地址优化

master
liuguijing 2 years ago
parent 862ce46b28
commit fb21540494

@ -1,19 +1,12 @@
package com.shxy.xymanager_common.util;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import com.shxy.xymanager_common.entity.TerminalStatus;
import com.shxy.xymanager_common.entity.Terminals;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Map;
/**
*
@ -26,12 +19,26 @@ public class TerminalUtils {
private static Integer hearttime;
private static String photoaddress;
private static String videoaddress;
@Value("${heart.time}")
public void setHearttime(Integer time) {
TerminalUtils.hearttime = time;
}
@Value("${photo.address}")
public void setPhotoaddress(String photoaddress) {
TerminalUtils.photoaddress = photoaddress;
}
@Value("${video.address}")
public void setVideoaddress(String videoaddress) {
TerminalUtils.videoaddress = videoaddress;
}
/**
* 线
*
@ -51,4 +58,37 @@ public class TerminalUtils {
}
}
/**
*
*/
public static String getPhotoPath(Integer mediaType, String requestIp, String path) {
if (mediaType != null) {
if (mediaType.intValue() == 0) {
return requestIp + photoaddress + path;
} else if (mediaType == 1) {
return requestIp + videoaddress + path;
} else {
return "";
}
} else {
return "";
}
}
/**
*
*/
public static String getThumbPhotoPath(Integer mediaType, String requestIp, String path) {
if (mediaType.intValue() == 0) {
if (StringUtils.isNotBlank(path)) {
return requestIp + videoaddress + path;
} else {
return "";
}
} else {
return "";
}
}
}

@ -13,13 +13,13 @@ import javax.validation.constraints.Min;
public class TerminalSelectVo {
@ApiModelProperty(value = "电压编号", example = "123455")
private Integer dyid;
private Integer dyId;
@ApiModelProperty(value = "装置编号", example = "123455")
private Integer lineid;
private Integer lineId;
@ApiModelProperty(value = "杆塔编号", example = "123455")
private Integer towerid;
private Integer towerId;
@ApiModelProperty(value = "搜索内容", example = "搜索内容")
private String search;

@ -21,4 +21,7 @@ public interface RequestResultsDao {
int updateByPrimaryKey(RequestResults record);
int updateByRequestIdList(@Param("list") List<Integer> requestidlist, @Param("status") Integer status);
String getRequestResult(@Param("requestId") Integer requestId);
}

@ -53,7 +53,6 @@ public interface TerminalPhotoDao {
BigInteger getLatestPhotoParam(Integer termId);
String getRequestResult(@Param("requestId") Integer requestId);
void deleteByMarkId(@Param("markId") Integer markId);

@ -20,7 +20,7 @@ public interface TerminalsDao {
List<ChannelAndTermDto> selectChannelAndTermList(@Param("status") Integer status);
List<TerminalsAndStatusDto> selectTermAndStatusList(@Param("status") Integer status, @Param("towerid") List<Integer> towerid,@Param("search") String search);
List<TerminalsAndStatusDto> selectTermAndStatusList(@Param("status") Integer status, @Param("dyid") Integer dyid, @Param("lineid") Integer lineid, @Param("towerid") Integer towerid, @Param("search") String search);
Terminals selectByCmdid(@Param("cmdid") String cmdid, @Param("status") Integer status);

@ -52,7 +52,13 @@
#{id}
</foreach>
</if>
</select>
<select id="getRequestResult" resultType="java.lang.String">
select
data
from request_results
where request_id = #{requestId,jdbcType=TINYINT}
</select>
<update id="updateByPrimaryKeySelective" parameterType="com.shxy.xymanager_common.entity.RequestResults">

@ -419,13 +419,6 @@
where term_id = #{termId,jdbcType=INTEGER}
</select>
<select id="getRequestResult" resultType="java.lang.String">
select
data
from request_results
where request_id = #{requestId,jdbcType=TINYINT}
</select>
<!--<select id="selectCmdIdById" resultType="java.lang.Integer">
select
term_id as termId

@ -39,10 +39,10 @@
<result column="latitude" jdbcType="DOUBLE" property="latitude"/>
<result column="longitude" jdbcType="DOUBLE" property="longitude"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="signal_strength_4g" jdbcType="SMALLINT" property="signalStrength4g"/>
<result column="boot_time" jdbcType="INTEGER" property="bootTime"/>
<result column="battery_capacity" jdbcType="FLOAT" property="batteryCapacity"/>
<result column="battery_voltage" jdbcType="FLOAT" property="batteryVoltage"/>
<result column="signal_strength_4g" jdbcType="TINYINT" property="signalStrength4g"/>
<result column="boot_time" jdbcType="BIGINT" property="bootTime"/>
<result column="battery_capacity" jdbcType="REAL" property="batteryCapacity"/>
<result column="battery_voltage" jdbcType="REAL" property="batteryVoltage"/>
<result column="last_heartbeat" jdbcType="BIGINT" property="lastHeartbeat"/>
</resultMap>
@ -121,38 +121,49 @@
<select id="selectTermAndStatusList" resultMap="TermAndStatusMap">
select
a.id as id,
a.line_id as line_id,
a.tower_id as tower_id,
a.cmdid as cmdid,
a.org_id as org_id,
a.equip_name as equip_name,
a.display_name as display_name,
a.model as model,
a.essential_info_version as essential_info_version,
a.has_pan as has_pan,
a.bs_manufacturer as bs_manufacturer,
a.bs_production_date as bs_production_date,
a.bs_identifier as bs_identifier,
a.latitude as latitude,
a.longitude as longitude,
a.status as status,
b.signal_strength_4g as signal_strength_4g,
b.boot_time as boot_time,
b.battery_capacity as battery_capacity,
b.battery_voltage as battery_voltage,
b.last_heartbeat as last_heartbeat
from
(terminals a left join terminal_status b on a.id = b.term_id )
d.id as id,
d.line_id as line_id,
d.tower_id as tower_id,
d.cmdid as cmdid,
d.org_id as org_id,
d.equip_name as equip_name,
d.display_name as display_name,
d.model as model,
d.essential_info_version as essential_info_version,
d.has_pan as has_pan,
d.bs_manufacturer as bs_manufacturer,
d.bs_production_date as bs_production_date,
d.bs_identifier as bs_identifier,
d.latitude as latitude,
d.longitude as longitude,
d.status as status,
e.last_heartbeat as last_heartbeat,
e.signal_strength_4g as signal_strength_4g,
e.boot_time as boot_time,
e.battery_capacity as battery_capacity,
e.battery_voltage as battery_voltage
from ((((dy_level a left join `lines` b on a.id = b.dy_level_id )
left join towers c on b.id = c.line_id )
inner join terminals d on c.id = d.tower_id )
left join terminal_status e on e.term_id = d.id)
<where>
true
<if test="status != null">
and a.status = #{status}
and d.status = #{status}
</if>
<if test="dyid != null and dyid != -1">
and a.id = #{dyid}
</if>
<if test="lineid != null and lineid != -1">
and b.id = #{lineid}
</if>
<if test="towerid != null and towerid != -1">
and c.id = #{towerid}
</if>
<if test="search != null">
and a.cmdid like "%"#{search}"%"
and (b.name like "%"#{search}"%" or c.name like "%"#{search}"%" or d.cmdid like "%"#{search}"%")
</if>
</where>
order by a.create_time desc
</select>

@ -58,9 +58,9 @@ public class DyLevelServiceImpl implements DyLevelService {
BigInteger lastheartbeat = terminalsWithHeart.getLastheartbeat();
boolean b = TerminalUtils.judgeTerminalStatus(lastheartbeat);
if (b) {
beans.get(i).getList().get(j).getList().get(k).setOnlinestatus(CommonStatus.DELETE.value());
} else {
beans.get(i).getList().get(j).getList().get(k).setOnlinestatus(CommonStatus.EFFECTIVE.value());
} else {
beans.get(i).getList().get(j).getList().get(k).setOnlinestatus(CommonStatus.DELETE.value());
}
}
}

@ -214,11 +214,11 @@ public class OpenServiceImpl implements OpenService {
BigInteger lastheartbeat = terminalsWithHeart.getLastheartbeat();
boolean b = TerminalUtils.judgeTerminalStatus(lastheartbeat);
if (b) {
jsonObject.set("isonline", false);
jsonObject.set("isonline", true);
jsonObject.set("errcode", 0);
jsonObject.set("errmsg", "ok");
} else {
jsonObject.set("isonline", true);
jsonObject.set("isonline", false);
jsonObject.set("errcode", 0);
jsonObject.set("errmsg", "ok");
}

@ -13,6 +13,7 @@ import com.shxy.xymanager_common.util.StringUtils;
import com.shxy.xymanager_common.vo.SystemConfigReqVo;
import com.shxy.xymanager_common.vo.SystemConfigVo;
import com.shxy.xymanager_common.vo.TerminalUpperComputerVo;
import com.shxy.xymanager_dao.dao.RequestResultsDao;
import com.shxy.xymanager_dao.dao.SystemConfigDao;
import com.shxy.xymanager_dao.dao.TerminalPhotoDao;
import com.shxy.xymanager_service.service.SystemConfigService;
@ -33,7 +34,7 @@ public class SystemConfigServiceImpl implements SystemConfigService {
SystemConfigDao systemConfigDao;
@Autowired
TerminalPhotoDao terminalPhotoDao;
RequestResultsDao requestResultsDao;
@Override
@ -65,7 +66,7 @@ public class SystemConfigServiceImpl implements SystemConfigService {
@Override
public ServiceBody<SystemConfigModel> getSystemConfigDetail(SystemConfigReqVo vo) {
String result = terminalPhotoDao.getRequestResult(vo.getRequestId());//待修改
String result = requestResultsDao.getRequestResult(vo.getRequestId());//待修改
SystemConfigModel model = new SystemConfigModel();
if(StringUtils.isNotBlank(result)) {
model = JSONObject.parseObject(result, SystemConfigModel.class);
@ -90,7 +91,7 @@ public class SystemConfigServiceImpl implements SystemConfigService {
@Override
public ServiceBody<UpperComputerInfoModel> getUpperComputerInfo(TerminalUpperComputerVo vo) {
String result = terminalPhotoDao.getRequestResult(vo.getRequestId());//待修改
String result = requestResultsDao.getRequestResult(vo.getRequestId());//待修改
UpperComputerInfoModel model = new UpperComputerInfoModel();
if(StringUtils.isNotBlank(result)) {
model = JSONObject.parseObject(result, UpperComputerInfoModel.class);

@ -12,6 +12,7 @@ import com.shxy.xymanager_common.model.TerminalAlarmListModel;
import com.shxy.xymanager_common.model.TerminalImgAlarmParamsModel;
import com.shxy.xymanager_common.page.PageUtils;
import com.shxy.xymanager_common.util.MyDateUtils;
import com.shxy.xymanager_common.util.TerminalUtils;
import com.shxy.xymanager_common.vo.TerminalAlarmIdVo;
import com.shxy.xymanager_common.vo.TerminalAlarmSelectVo;
import com.shxy.xymanager_common.vo.UpdateTerminalAlarmParamsVo;
@ -60,11 +61,6 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
@Autowired
TowerDao towerDao;
@Value("${photo.address}")
private String photoaddress;
@Value("${video.address}")
private String videoaddress;
@Override
public ServiceBody<TerminalAlarmListModel> getTerminalAlarmList(String requestIp, TerminalAlarmSelectVo vo) {
@ -94,14 +90,14 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
List<DyAndLineAndTowerAndTermDto> dtos = new ArrayList<>();
List<TerminalImgAlarmsDto> list = new ArrayList<>();
List<Integer> termidlist = new ArrayList<>();
if (dyid == null || dyid.intValue() == 0) {
if (dyid == null || dyid.intValue() == -1) {
PageUtils.SetPage(pageindex, pagesize);
list = terminalImgAlarmsDao.selectAlarmsDetails(null, labellist, BigInteger.valueOf(start), BigInteger.valueOf(end));
} else {
if (lineid == null || lineid.intValue() == 0) {
if (lineid == null || lineid.intValue() == -1) {
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, null, null, null, CommonStatus.EFFECTIVE.value());
} else {
if (towerid == null || towerid.intValue() == 0) {
if (towerid == null || towerid.intValue() == -1) {
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, lineid, null, null, CommonStatus.EFFECTIVE.value());
} else {
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, lineid, towerid, null, CommonStatus.EFFECTIVE.value());
@ -126,7 +122,6 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
Map<Integer, TerminalChannels> termchannelMap = cacheService.getTermChannelMap();
Map<String, TerminalChannelMapper> termchannelMapMap = cacheService.getTermChannelMapMap();
// ArrayList<BigInteger> originidlist = new ArrayList<>();
// for (TerminalImgAlarmsDto item : list) {
// originidlist.add(item.getPhotoOrgId());
@ -176,17 +171,8 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
if (terminalPhoto != null) {
Integer mediaType = terminalPhoto.getMediaType();
String path = terminalPhoto.getPath();
if (mediaType != null) {
if (mediaType.intValue() == 0) {
alarmBean.setPath(requestIp + photoaddress + path);
} else if (mediaType == 1) {
alarmBean.setPath(requestIp + videoaddress + path);
} else {
alarmBean.setPath("");
}
} else {
alarmBean.setPath("");
}
String photoPath = TerminalUtils.getPhotoPath(mediaType, requestIp, path);
alarmBean.setPath(photoPath);
alarmBean.setPhotoWidth(terminalPhoto.getWidth());
alarmBean.setPhotoHeight(terminalPhoto.getHeight());
} else {

@ -66,15 +66,12 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
@Autowired
TerminalScheduleRuleService terminalScheduleRuleService;
@Autowired
CacheService cacheService;
RequestResultsDao requestResultsDao;
@Value("${photo.address}")
private String photoaddress;
@Value("${video.address}")
private String videoaddress;
@Autowired
CacheService cacheService;
/**
@ -117,13 +114,12 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
photoBean.setFileSize(item.getFileSize());
photoBean.setHeight(item.getHeight());
photoBean.setMediaType(item.getMediaType());
if (mediaType.intValue() == 0) {
photoBean.setPath(requestIp + photoaddress + item.getPath());
} else {
photoBean.setPath(requestIp + videoaddress + item.getPath());
if (StringUtils.isNotBlank(item.getThumb())) {
photoBean.setThumb(requestIp + videoaddress + item.getThumb());
}
String photoPath = TerminalUtils.getPhotoPath(mediaType, requestIp, item.getPath());
photoBean.setPath(photoPath);
String thumbPhotoPath = TerminalUtils.getThumbPhotoPath(mediaType, requestIp, item.getThumb());
if (StringUtils.isNotBlank(thumbPhotoPath)) {
photoBean.setThumb(thumbPhotoPath);
}
photoBean.setChannelName(termchannelMap.get(channelId).getChannelName());
if (termchannelMapMap != null) {
@ -179,17 +175,17 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
ArrayList<Integer> channelidlist = new ArrayList<>();
List<DyAndLineAndTowerAndTermDto> dtos = new ArrayList<>();
if (dyid == null || dyid.intValue() == 0) {
if (dyid == null || dyid.intValue() == -1) {
PageUtils.SetPage(pageindex, pagesize);
list = terminalPhotoDao.selectPhotoListByTermList(termidlist, channelidlist, BigInteger.valueOf(start), BigInteger.valueOf(end));
} else {
if (lineid == null || lineid.intValue() == 0) {
if (lineid == null || lineid.intValue() == -1) {
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, null, null, null, CommonStatus.EFFECTIVE.value());
} else {
if (towerid == null || towerid.intValue() == 0) {
if (towerid == null || towerid.intValue() == -1) {
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, lineid, null, null, CommonStatus.EFFECTIVE.value());
} else {
if (termid == null || termid.intValue() == 0) {
if (termid == null || termid.intValue() == -1) {
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, lineid, towerid, null, CommonStatus.EFFECTIVE.value());
} else {
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, lineid, towerid, termid, CommonStatus.EFFECTIVE.value());
@ -205,7 +201,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
}
}
}
if (channelid == null || channelid.intValue() == 0) {
if (channelid == null || channelid.intValue() == -1) {
} else {
channelidlist.add(channelid);
@ -243,11 +239,8 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
photoBean.setAlias(termchannelMapMap.get(item.getTermId() + "#" + item.getChannelId()).getAlias());
photoBean.setMediaType(item.getMediaType());
photoBean.setOrginalid(item.getOrginalId());
if (mediaType.intValue() == 0) {
photoBean.setPath(requestIp + photoaddress + item.getPath());
} else {
photoBean.setPath(requestIp + videoaddress + item.getPath());
}
String photoPath = TerminalUtils.getPhotoPath(mediaType, requestIp, item.getPath());
photoBean.setPath(photoPath);
photoBean.setPresetId(item.getPresetId());
long phototime = MyDateUtils.TimeSecond2MillSecond(item.getPhotoTime().longValue());
photoBean.setPhotoTime(MyDateUtils.date(phototime));
@ -328,13 +321,9 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
photoBean.setMediaType(item.getMediaType());
photoBean.setOrginalId(item.getOrginalId());
String path = item.getPath();
if (mediaType.intValue() == 0) {
photoBean.setPath(requestIp + photoaddress + path);
} else {
photoBean.setPath(requestIp + videoaddress + item.getPath());
}
String photoPath = TerminalUtils.getPhotoPath(mediaType, requestIp, item.getPath());
photoBean.setPath(photoPath);
if (path != null) {
photoBean.setPath(requestIp + photoaddress + path);
String[] split = path.split("/");
int length = split.length;
String s = split[length - 1];
@ -562,11 +551,8 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
long phototime = MyDateUtils.TimeSecond2MillSecond(terminalPhoto.getPhotoTime().longValue());
photosBean.setPhotoTime(MyDateUtils.date(phototime));
photosBean.setMediatype(mediatype);
if (mediatype.intValue() == 0) {
photosBean.setPath(requestIp + photoaddress + terminalPhoto.getPath());
} else {
photosBean.setPath(requestIp + videoaddress + terminalPhoto.getPath());
}
String photoPath = TerminalUtils.getPhotoPath(mediatype, requestIp, terminalPhoto.getPath());
photosBean.setPath(photoPath);
photosBean.setOrginalid(terminalPhoto.getOrginalId());
photosBean.setPresetId(terminalPhoto.getPresetId());
}
@ -616,7 +602,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
@Override
public ServiceBody<TerminalPhotosParamsModel> getLastedPhotoQueryParam(ReturnedPhotoParamsVo vo) {
String result = terminalPhotoDao.getRequestResult(vo.getRequestId());
String result = requestResultsDao.getRequestResult(vo.getRequestId());
TerminalPhotosParamsModel model = new TerminalPhotosParamsModel();
if (StringUtils.isNotBlank(result)) {
model = JSONObject.parseObject(result, TerminalPhotosParamsModel.class);
@ -632,7 +618,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
@Override
public ServiceBody<TerminalScheduleRuleTimeListModel> selectPhotoTime(TerminalReqPhotoTimeVo vo) {
String result = terminalPhotoDao.getRequestResult(vo.getRequestId());//待修改
String result = requestResultsDao.getRequestResult(vo.getRequestId());//待修改
TerminalScheduleRuleTimeListModel model = new TerminalScheduleRuleTimeListModel();
if (StringUtils.isNotBlank(result)) {
JSONObject resultObj = JSONObject.parseObject(result);
@ -715,11 +701,8 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
photoBean.setAlias(termchannelMapMap.get(item.getTermId() + "#" + item.getChannelId()).getAlias());
photoBean.setMediaType(item.getMediaType());
photoBean.setOrginalid(item.getOrginalId());
if (mediaType.intValue() == 0) {
photoBean.setPath(requestIp + photoaddress + item.getPath());
} else {
photoBean.setPath(requestIp + videoaddress + item.getPath());
}
String photoPath = TerminalUtils.getPhotoPath(mediaType, requestIp, item.getPath());
photoBean.setPath(photoPath);
photoBean.setPresetId(item.getPresetId());
long phototime = MyDateUtils.TimeSecond2MillSecond(item.getPhotoTime().longValue());
photoBean.setPhotoTime(MyDateUtils.date(phototime));

@ -69,10 +69,10 @@ public class TerminalServiceImpl implements TerminalService {
LinesDao linesDao;
@Autowired
CacheService cacheService;
RequestResultsDao requestResultsDao;
@Value("${photo.address}")
private String photoaddress;
@Autowired
CacheService cacheService;
/**
@ -84,100 +84,77 @@ public class TerminalServiceImpl implements TerminalService {
public ServiceBody<TerminalListModel> getTerminalList(TerminalSelectVo vo) {
Map<Integer, TowerDto> towerMap = cacheService.getTowerMap();
Map<Integer, TermAndChannelDto> termAndChannelMap = cacheService.getTermAndChannelMap();
Integer dyid = vo.getDyid();
Integer lineid = vo.getLineid();
Integer tower = vo.getTowerid();
Integer dyid = vo.getDyId();
Integer lineid = vo.getLineId();
Integer tower = vo.getTowerId();
String search = vo.getSearch();
if (StrUtil.isEmpty(search)) {
search = null;
}
List<DyLineAndTowertDto> dyLineAndTowertDtos = new ArrayList<>();
if (dyid == null || dyid.intValue() == -1) {
tower = null;
} else {
if (lineid == null || lineid.intValue() == -1) {
dyLineAndTowertDtos = dyLevelDao.selectDyAndLineAndTowerList(dyid, null, null, search);
} else {
if (tower == null || tower.intValue() == -1) {
dyLineAndTowertDtos = dyLevelDao.selectDyAndLineAndTowerList(dyid, lineid, null, search);
} else {
dyLineAndTowertDtos = dyLevelDao.selectDyAndLineAndTowerList(dyid, lineid, tower, search);
}
}
}
List<TerminalsAndStatusDto> list2 = new ArrayList<>();
TerminalListModel model = new TerminalListModel();
int pageindex = vo.getPageindex();
int pagesize = vo.getPagesize();
PageUtils.SetPage(pageindex, pagesize);
if (CollectionUtil.isNotEmpty(dyLineAndTowertDtos)) {
ArrayList<Integer> toweridlist = new ArrayList<>();
for (DyLineAndTowertDto item : dyLineAndTowertDtos) {
toweridlist.add(item.getTowerId());
}
list2 = terminalsDao.selectTermAndStatusList(null, toweridlist, search);
} else {
list2 = terminalsDao.selectTermAndStatusList(null, null, search);
}
List<TerminalsAndStatusDto> list2 = terminalsDao.selectTermAndStatusList(null, dyid, lineid, tower, search);
boolean empty = CollectionUtil.isEmpty(list2);
if (empty) {
model.setList(new ArrayList<>());
} else {
ArrayList<TerminalListModel.TerminalsBean> beanlist = new ArrayList<>();
for (TerminalsAndStatusDto item : list2) {
TerminalListModel.TerminalsBean terminalsBean = new TerminalListModel.TerminalsBean();
terminalsBean.setCmdId(item.getCmdid());
Integer towerid = item.getTowerid();
terminalsBean.setId(item.getId());
terminalsBean.setTowerId(towerid);
TowerDto towerDto = towerMap.get(towerid);
if (BeanUtil.isNotEmpty(towerDto)) {
terminalsBean.setTowerName(towerDto.getName());
terminalsBean.setLineId(towerDto.getLineId());
terminalsBean.setLineName(towerDto.getLineName());
}
terminalsBean.setCmdId(item.getCmdid());
terminalsBean.setOrgId(item.getOrgId());
terminalsBean.setEquipName(item.getEquipName());
terminalsBean.setDisplayName(item.getDisplayName());
terminalsBean.setModel(item.getModel());
terminalsBean.setEssentialInfoVersion(item.getEssentialInfoVersion());
terminalsBean.setHasPan(item.getHasPan());
terminalsBean.setBsManufacturer(item.getBsManufacturer());
terminalsBean.setBsProductionDate(item.getBsProductionDate());
terminalsBean.setBsIdentifier(item.getBsIdentifier());
terminalsBean.setLatitude(item.getLatitude());
terminalsBean.setLongitude(item.getLongitude());
terminalsBean.setSignalStrength4g(item.getSignalStrength4g());
terminalsBean.setBootTime(item.getBootTime());
terminalsBean.setBatteryCapacity(item.getBatteryCapacity());
terminalsBean.setBatteryVoltage(item.getBatteryVoltage());
terminalsBean.setLastHeartbeat(item.getLastHeartbeat());
terminalsBean.setStatus(item.getStatus());
boolean b = TerminalUtils.judgeTerminalStatus(item.getLastHeartbeat());
terminalsBean.setIsonline(b);
TermAndChannelDto termAndChannelDto = termAndChannelMap.get(item.getId());
ArrayList<TerminalListModel.ChannelBeans> list = new ArrayList<>();
if (BeanUtil.isEmpty(termAndChannelDto)) {
terminalsBean.setList(list);
} else {
List<TermChannelAndMapperDto> channellist = termAndChannelDto.getList();
if (CollectionUtil.isEmpty(channellist)) {
if (BeanUtil.isNotEmpty(item)) {
TerminalListModel.TerminalsBean terminalsBean = new TerminalListModel.TerminalsBean();
terminalsBean.setCmdId(item.getCmdid());
Integer towerid = item.getTowerid();
terminalsBean.setId(item.getId());
terminalsBean.setTowerId(towerid);
TowerDto towerDto = towerMap.get(towerid);
if (BeanUtil.isNotEmpty(towerDto)) {
terminalsBean.setTowerName(towerDto.getName());
terminalsBean.setLineId(towerDto.getLineId());
terminalsBean.setLineName(towerDto.getLineName());
}
terminalsBean.setCmdId(item.getCmdid());
terminalsBean.setOrgId(item.getOrgId());
terminalsBean.setEquipName(item.getEquipName());
terminalsBean.setDisplayName(item.getDisplayName());
terminalsBean.setModel(item.getModel());
terminalsBean.setEssentialInfoVersion(item.getEssentialInfoVersion());
terminalsBean.setHasPan(item.getHasPan());
terminalsBean.setBsManufacturer(item.getBsManufacturer());
terminalsBean.setBsProductionDate(item.getBsProductionDate());
terminalsBean.setBsIdentifier(item.getBsIdentifier());
terminalsBean.setLatitude(item.getLatitude());
terminalsBean.setLongitude(item.getLongitude());
terminalsBean.setSignalStrength4g(item.getSignalStrength4g());
terminalsBean.setBootTime(item.getBootTime());
terminalsBean.setBatteryCapacity(item.getBatteryCapacity());
terminalsBean.setBatteryVoltage(item.getBatteryVoltage());
terminalsBean.setLastHeartbeat(item.getLastHeartbeat());
terminalsBean.setStatus(item.getStatus());
boolean b = TerminalUtils.judgeTerminalStatus(item.getLastHeartbeat());
terminalsBean.setIsonline(b);
TermAndChannelDto termAndChannelDto = termAndChannelMap.get(item.getId());
ArrayList<TerminalListModel.ChannelBeans> list = new ArrayList<>();
if (BeanUtil.isEmpty(termAndChannelDto)) {
terminalsBean.setList(list);
} else {
for (TermChannelAndMapperDto dto : channellist) {
TerminalListModel.ChannelBeans e = new TerminalListModel.ChannelBeans();
e.setAlias(dto.getAlias());
e.setId(dto.getId());
e.setName(dto.getChannelname());
list.add(e);
List<TermChannelAndMapperDto> channellist = termAndChannelDto.getList();
if (CollectionUtil.isEmpty(channellist)) {
terminalsBean.setList(list);
} else {
for (TermChannelAndMapperDto dto : channellist) {
TerminalListModel.ChannelBeans e = new TerminalListModel.ChannelBeans();
e.setAlias(dto.getAlias());
e.setId(dto.getId());
e.setName(dto.getChannelname());
list.add(e);
}
terminalsBean.setList(list);
}
terminalsBean.setList(list);
}
beanlist.add(terminalsBean);
}
beanlist.add(terminalsBean);
}
model.setList(beanlist);
}
@ -389,9 +366,9 @@ public class TerminalServiceImpl implements TerminalService {
BigInteger lastheartbeat = terminalsWithHeart.getLastheartbeat();
boolean b = TerminalUtils.judgeTerminalStatus(lastheartbeat);
if (b) {
terminalsWithHeart.setOnlinestatus(CommonStatus.DELETE.value());
} else {
terminalsWithHeart.setOnlinestatus(CommonStatus.EFFECTIVE.value());
} else {
terminalsWithHeart.setOnlinestatus(CommonStatus.DELETE.value());
}
});
});
@ -419,7 +396,7 @@ public class TerminalServiceImpl implements TerminalService {
@Override
public ServiceBody<TerminalIdModel> selectTerminalId(Integer requestId) {
String result = terminalPhotoDao.getRequestResult(requestId);
String result = requestResultsDao.getRequestResult(requestId);
TerminalIdModel model = new TerminalIdModel();
if (StringUtils.isNotBlank(result)) {
model = JSONObject.parseObject(result, TerminalIdModel.class);
@ -461,7 +438,8 @@ public class TerminalServiceImpl implements TerminalService {
if (vo.getNeedPic() == 0) {
dto = terminalPhotoDao.selectPhotoMark(vo);
if (null != dto && StringUtils.isNotBlank(dto.getPath())) {
dto.setPath(requestIp + photoaddress + dto.getPath());
String photoPath = TerminalUtils.getPhotoPath(0, requestIp, dto.getPath());
dto.setPath(photoPath);
}
} else {
dto = terminalPhotoDao.selectPhotoWithoutPic(vo);

@ -8,6 +8,7 @@ import com.shxy.xymanager_common.model.*;
import com.shxy.xymanager_common.util.ProcessExecUtils;
import com.shxy.xymanager_common.util.StringUtils;
import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_dao.dao.RequestResultsDao;
import com.shxy.xymanager_dao.dao.TerminalPhotoDao;
import com.shxy.xymanager_service.service.TerminalVideoService;
import lombok.extern.slf4j.Slf4j;
@ -22,7 +23,7 @@ import org.springframework.stereotype.Service;
public class TerminalVideoServiceImpl implements TerminalVideoService {
@Autowired
TerminalPhotoDao terminalPhotoDao;
RequestResultsDao requestResultsDao;
@Override
public ServiceBody<String> updateVideoParam(VideoParamsVo vo) {
@ -44,7 +45,7 @@ public class TerminalVideoServiceImpl implements TerminalVideoService {
@Override
public ServiceBody<TerminalVideoParamsModel> selectVideoParam(Integer requestId) {
String result = terminalPhotoDao.getRequestResult(requestId);//待修改
String result = requestResultsDao.getRequestResult(requestId);
TerminalVideoParamsModel model = new TerminalVideoParamsModel();
if (StringUtils.isNotBlank(result)) {
model = JSONObject.parseObject(result, TerminalVideoParamsModel.class);

Loading…
Cancel
Save