模糊查询和图片地址优化

master
liuguijing 2 years ago
parent 862ce46b28
commit fb21540494

@ -1,19 +1,12 @@
package com.shxy.xymanager_common.util; package com.shxy.xymanager_common.util;
import cn.hutool.core.bean.BeanUtil;
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.shxy.xymanager_common.entity.TerminalStatus;
import com.shxy.xymanager_common.entity.Terminals;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.Map;
/** /**
* *
@ -26,12 +19,26 @@ public class TerminalUtils {
private static Integer hearttime; private static Integer hearttime;
private static String photoaddress;
private static String videoaddress;
@Value("${heart.time}") @Value("${heart.time}")
public void setHearttime(Integer time) { public void setHearttime(Integer time) {
TerminalUtils.hearttime = 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 { public class TerminalSelectVo {
@ApiModelProperty(value = "电压编号", example = "123455") @ApiModelProperty(value = "电压编号", example = "123455")
private Integer dyid; private Integer dyId;
@ApiModelProperty(value = "装置编号", example = "123455") @ApiModelProperty(value = "装置编号", example = "123455")
private Integer lineid; private Integer lineId;
@ApiModelProperty(value = "杆塔编号", example = "123455") @ApiModelProperty(value = "杆塔编号", example = "123455")
private Integer towerid; private Integer towerId;
@ApiModelProperty(value = "搜索内容", example = "搜索内容") @ApiModelProperty(value = "搜索内容", example = "搜索内容")
private String search; private String search;

@ -21,4 +21,7 @@ public interface RequestResultsDao {
int updateByPrimaryKey(RequestResults record); int updateByPrimaryKey(RequestResults record);
int updateByRequestIdList(@Param("list") List<Integer> requestidlist, @Param("status") Integer status); 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); BigInteger getLatestPhotoParam(Integer termId);
String getRequestResult(@Param("requestId") Integer requestId);
void deleteByMarkId(@Param("markId") Integer markId); void deleteByMarkId(@Param("markId") Integer markId);

@ -20,7 +20,7 @@ public interface TerminalsDao {
List<ChannelAndTermDto> selectChannelAndTermList(@Param("status") Integer status); 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); Terminals selectByCmdid(@Param("cmdid") String cmdid, @Param("status") Integer status);

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

@ -419,13 +419,6 @@
where term_id = #{termId,jdbcType=INTEGER} where term_id = #{termId,jdbcType=INTEGER}
</select> </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 id="selectCmdIdById" resultType="java.lang.Integer">
select select
term_id as termId term_id as termId

@ -39,10 +39,10 @@
<result column="latitude" jdbcType="DOUBLE" property="latitude"/> <result column="latitude" jdbcType="DOUBLE" property="latitude"/>
<result column="longitude" jdbcType="DOUBLE" property="longitude"/> <result column="longitude" jdbcType="DOUBLE" property="longitude"/>
<result column="status" jdbcType="INTEGER" property="status"/> <result column="status" jdbcType="INTEGER" property="status"/>
<result column="signal_strength_4g" jdbcType="SMALLINT" property="signalStrength4g"/> <result column="signal_strength_4g" jdbcType="TINYINT" property="signalStrength4g"/>
<result column="boot_time" jdbcType="INTEGER" property="bootTime"/> <result column="boot_time" jdbcType="BIGINT" property="bootTime"/>
<result column="battery_capacity" jdbcType="FLOAT" property="batteryCapacity"/> <result column="battery_capacity" jdbcType="REAL" property="batteryCapacity"/>
<result column="battery_voltage" jdbcType="FLOAT" property="batteryVoltage"/> <result column="battery_voltage" jdbcType="REAL" property="batteryVoltage"/>
<result column="last_heartbeat" jdbcType="BIGINT" property="lastHeartbeat"/> <result column="last_heartbeat" jdbcType="BIGINT" property="lastHeartbeat"/>
</resultMap> </resultMap>
@ -121,38 +121,49 @@
<select id="selectTermAndStatusList" resultMap="TermAndStatusMap"> <select id="selectTermAndStatusList" resultMap="TermAndStatusMap">
select select
a.id as id, d.id as id,
a.line_id as line_id, d.line_id as line_id,
a.tower_id as tower_id, d.tower_id as tower_id,
a.cmdid as cmdid, d.cmdid as cmdid,
a.org_id as org_id, d.org_id as org_id,
a.equip_name as equip_name, d.equip_name as equip_name,
a.display_name as display_name, d.display_name as display_name,
a.model as model, d.model as model,
a.essential_info_version as essential_info_version, d.essential_info_version as essential_info_version,
a.has_pan as has_pan, d.has_pan as has_pan,
a.bs_manufacturer as bs_manufacturer, d.bs_manufacturer as bs_manufacturer,
a.bs_production_date as bs_production_date, d.bs_production_date as bs_production_date,
a.bs_identifier as bs_identifier, d.bs_identifier as bs_identifier,
a.latitude as latitude, d.latitude as latitude,
a.longitude as longitude, d.longitude as longitude,
a.status as status, d.status as status,
b.signal_strength_4g as signal_strength_4g, e.last_heartbeat as last_heartbeat,
b.boot_time as boot_time, e.signal_strength_4g as signal_strength_4g,
b.battery_capacity as battery_capacity, e.boot_time as boot_time,
b.battery_voltage as battery_voltage, e.battery_capacity as battery_capacity,
b.last_heartbeat as last_heartbeat e.battery_voltage as battery_voltage
from from ((((dy_level a left join `lines` b on a.id = b.dy_level_id )
(terminals a left join terminal_status b on a.id = b.term_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> <where>
true true
<if test="status != null"> <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>
<if test="search != null"> <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> </if>
</where> </where>
order by a.create_time desc order by a.create_time desc
</select> </select>

@ -58,9 +58,9 @@ public class DyLevelServiceImpl implements DyLevelService {
BigInteger lastheartbeat = terminalsWithHeart.getLastheartbeat(); BigInteger lastheartbeat = terminalsWithHeart.getLastheartbeat();
boolean b = TerminalUtils.judgeTerminalStatus(lastheartbeat); boolean b = TerminalUtils.judgeTerminalStatus(lastheartbeat);
if (b) { 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()); 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(); BigInteger lastheartbeat = terminalsWithHeart.getLastheartbeat();
boolean b = TerminalUtils.judgeTerminalStatus(lastheartbeat); boolean b = TerminalUtils.judgeTerminalStatus(lastheartbeat);
if (b) { if (b) {
jsonObject.set("isonline", false); jsonObject.set("isonline", true);
jsonObject.set("errcode", 0); jsonObject.set("errcode", 0);
jsonObject.set("errmsg", "ok"); jsonObject.set("errmsg", "ok");
} else { } else {
jsonObject.set("isonline", true); jsonObject.set("isonline", false);
jsonObject.set("errcode", 0); jsonObject.set("errcode", 0);
jsonObject.set("errmsg", "ok"); 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.SystemConfigReqVo;
import com.shxy.xymanager_common.vo.SystemConfigVo; import com.shxy.xymanager_common.vo.SystemConfigVo;
import com.shxy.xymanager_common.vo.TerminalUpperComputerVo; 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.SystemConfigDao;
import com.shxy.xymanager_dao.dao.TerminalPhotoDao; import com.shxy.xymanager_dao.dao.TerminalPhotoDao;
import com.shxy.xymanager_service.service.SystemConfigService; import com.shxy.xymanager_service.service.SystemConfigService;
@ -33,7 +34,7 @@ public class SystemConfigServiceImpl implements SystemConfigService {
SystemConfigDao systemConfigDao; SystemConfigDao systemConfigDao;
@Autowired @Autowired
TerminalPhotoDao terminalPhotoDao; RequestResultsDao requestResultsDao;
@Override @Override
@ -65,7 +66,7 @@ public class SystemConfigServiceImpl implements SystemConfigService {
@Override @Override
public ServiceBody<SystemConfigModel> getSystemConfigDetail(SystemConfigReqVo vo) { public ServiceBody<SystemConfigModel> getSystemConfigDetail(SystemConfigReqVo vo) {
String result = terminalPhotoDao.getRequestResult(vo.getRequestId());//待修改 String result = requestResultsDao.getRequestResult(vo.getRequestId());//待修改
SystemConfigModel model = new SystemConfigModel(); SystemConfigModel model = new SystemConfigModel();
if(StringUtils.isNotBlank(result)) { if(StringUtils.isNotBlank(result)) {
model = JSONObject.parseObject(result, SystemConfigModel.class); model = JSONObject.parseObject(result, SystemConfigModel.class);
@ -90,7 +91,7 @@ public class SystemConfigServiceImpl implements SystemConfigService {
@Override @Override
public ServiceBody<UpperComputerInfoModel> getUpperComputerInfo(TerminalUpperComputerVo vo) { public ServiceBody<UpperComputerInfoModel> getUpperComputerInfo(TerminalUpperComputerVo vo) {
String result = terminalPhotoDao.getRequestResult(vo.getRequestId());//待修改 String result = requestResultsDao.getRequestResult(vo.getRequestId());//待修改
UpperComputerInfoModel model = new UpperComputerInfoModel(); UpperComputerInfoModel model = new UpperComputerInfoModel();
if(StringUtils.isNotBlank(result)) { if(StringUtils.isNotBlank(result)) {
model = JSONObject.parseObject(result, UpperComputerInfoModel.class); 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.model.TerminalImgAlarmParamsModel;
import com.shxy.xymanager_common.page.PageUtils; import com.shxy.xymanager_common.page.PageUtils;
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.TerminalAlarmIdVo; import com.shxy.xymanager_common.vo.TerminalAlarmIdVo;
import com.shxy.xymanager_common.vo.TerminalAlarmSelectVo; import com.shxy.xymanager_common.vo.TerminalAlarmSelectVo;
import com.shxy.xymanager_common.vo.UpdateTerminalAlarmParamsVo; import com.shxy.xymanager_common.vo.UpdateTerminalAlarmParamsVo;
@ -60,11 +61,6 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
@Autowired @Autowired
TowerDao towerDao; TowerDao towerDao;
@Value("${photo.address}")
private String photoaddress;
@Value("${video.address}")
private String videoaddress;
@Override @Override
public ServiceBody<TerminalAlarmListModel> getTerminalAlarmList(String requestIp, TerminalAlarmSelectVo vo) { public ServiceBody<TerminalAlarmListModel> getTerminalAlarmList(String requestIp, TerminalAlarmSelectVo vo) {
@ -94,14 +90,14 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
List<DyAndLineAndTowerAndTermDto> dtos = new ArrayList<>(); List<DyAndLineAndTowerAndTermDto> dtos = new ArrayList<>();
List<TerminalImgAlarmsDto> list = new ArrayList<>(); List<TerminalImgAlarmsDto> list = new ArrayList<>();
List<Integer> termidlist = new ArrayList<>(); List<Integer> termidlist = new ArrayList<>();
if (dyid == null || dyid.intValue() == 0) { if (dyid == null || dyid.intValue() == -1) {
PageUtils.SetPage(pageindex, pagesize); PageUtils.SetPage(pageindex, pagesize);
list = terminalImgAlarmsDao.selectAlarmsDetails(null, labellist, BigInteger.valueOf(start), BigInteger.valueOf(end)); list = terminalImgAlarmsDao.selectAlarmsDetails(null, labellist, BigInteger.valueOf(start), BigInteger.valueOf(end));
} else { } else {
if (lineid == null || lineid.intValue() == 0) { if (lineid == null || lineid.intValue() == -1) {
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, null, null, null, CommonStatus.EFFECTIVE.value()); dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, null, null, null, CommonStatus.EFFECTIVE.value());
} else { } else {
if (towerid == null || towerid.intValue() == 0) { if (towerid == null || towerid.intValue() == -1) {
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, lineid, null, null, CommonStatus.EFFECTIVE.value()); dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, lineid, null, null, CommonStatus.EFFECTIVE.value());
} else { } else {
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, lineid, towerid, null, CommonStatus.EFFECTIVE.value()); 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<Integer, TerminalChannels> termchannelMap = cacheService.getTermChannelMap();
Map<String, TerminalChannelMapper> termchannelMapMap = cacheService.getTermChannelMapMap(); Map<String, TerminalChannelMapper> termchannelMapMap = cacheService.getTermChannelMapMap();
// ArrayList<BigInteger> originidlist = new ArrayList<>(); // ArrayList<BigInteger> originidlist = new ArrayList<>();
// for (TerminalImgAlarmsDto item : list) { // for (TerminalImgAlarmsDto item : list) {
// originidlist.add(item.getPhotoOrgId()); // originidlist.add(item.getPhotoOrgId());
@ -176,17 +171,8 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
if (terminalPhoto != null) { if (terminalPhoto != null) {
Integer mediaType = terminalPhoto.getMediaType(); Integer mediaType = terminalPhoto.getMediaType();
String path = terminalPhoto.getPath(); String path = terminalPhoto.getPath();
if (mediaType != null) { String photoPath = TerminalUtils.getPhotoPath(mediaType, requestIp, path);
if (mediaType.intValue() == 0) { alarmBean.setPath(photoPath);
alarmBean.setPath(requestIp + photoaddress + path);
} else if (mediaType == 1) {
alarmBean.setPath(requestIp + videoaddress + path);
} else {
alarmBean.setPath("");
}
} else {
alarmBean.setPath("");
}
alarmBean.setPhotoWidth(terminalPhoto.getWidth()); alarmBean.setPhotoWidth(terminalPhoto.getWidth());
alarmBean.setPhotoHeight(terminalPhoto.getHeight()); alarmBean.setPhotoHeight(terminalPhoto.getHeight());
} else { } else {

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

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

Loading…
Cancel
Save