图片轮询修改 图片地址判断修改 图片通道排序修改

master
liuguijing 2 years ago
parent b7ced77815
commit 50a22cc091

@ -6,6 +6,7 @@ import com.shxy.xymanager_common.base.ResponseReult;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.bean.ServiceStatus;
import com.shxy.xymanager_common.model.*;
import com.shxy.xymanager_common.util.HeaderUtil;
import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_service.service.TerminalAlarmService;
import io.swagger.annotations.Api;
@ -14,8 +15,10 @@ import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -32,8 +35,9 @@ public class TerminalAlarmController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getTerminalAlarmList")
@Log(title = "获取告警列表", type = "查询")
public ResponseReult<TerminalAlarmListModel> getTerminalAlarmList(@RequestBody @Validated TerminalAlarmSelectVo vo) {
ServiceBody<TerminalAlarmListModel> serviceBody = terminalAlarmService.getTerminalAlarmList(vo);
public ResponseReult<TerminalAlarmListModel> getTerminalAlarmList(@RequestHeader HttpHeaders headers, @RequestBody @Validated TerminalAlarmSelectVo vo) {
String requestIp = HeaderUtil.getRequestIp(headers);
ServiceBody<TerminalAlarmListModel> serviceBody = terminalAlarmService.getTerminalAlarmList(requestIp,vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {

@ -6,6 +6,7 @@ import com.shxy.xymanager_common.base.ResponseReult;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.bean.ServiceStatus;
import com.shxy.xymanager_common.model.*;
import com.shxy.xymanager_common.util.HeaderUtil;
import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_service.service.TerminalService;
import io.swagger.annotations.Api;
@ -14,6 +15,7 @@ import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -43,8 +45,9 @@ public class TerminalController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getCoordinate")
@Log(title = "获取绘制图标", type = "查询")
public ResponseReult<PhotoMarkModel> getCoordinate(@RequestBody @Validated MarkReqVo vo) {
ServiceBody<PhotoMarkModel> serviceBody = terminalService.getCoordinate(vo);
public ResponseReult<PhotoMarkModel> getCoordinate(@RequestHeader HttpHeaders headers, @RequestBody @Validated MarkReqVo vo) {
String requestIp = HeaderUtil.getRequestIp(headers);
ServiceBody<PhotoMarkModel> serviceBody = terminalService.getCoordinate(requestIp,vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {

@ -39,7 +39,7 @@ public class TerminalPhotoController extends BaseController {
@Log(title = "获取图片列表", type = "查询")
public ResponseReult<TerminalPhotoListModel> getTerminalPhotoList(@RequestHeader HttpHeaders headers, @RequestBody @Validated TerminalAndChannelIdAndTimeVo vo) {
String requestIp = HeaderUtil.getRequestIp(headers);
ServiceBody<TerminalPhotoListModel> serviceBody = terminalPhotoService.getTerminalPhotoList(requestIp,vo);
ServiceBody<TerminalPhotoListModel> serviceBody = terminalPhotoService.getTerminalPhotoList(requestIp, vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
@ -90,9 +90,9 @@ public class TerminalPhotoController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getPhotoList")
@Log(title = "图片查询", type = "查询")
public ResponseReult<TerminalPhotoSelectListModel> getPhotoList(@RequestHeader HttpHeaders headers,@RequestBody @Validated TerminalPhotoSelectVo vo) {
public ResponseReult<TerminalPhotoSelectListModel> getPhotoList(@RequestHeader HttpHeaders headers, @RequestBody @Validated TerminalPhotoSelectVo vo) {
String requestIp = HeaderUtil.getRequestIp(headers);
ServiceBody<TerminalPhotoSelectListModel> serviceBody = terminalPhotoService.getPhotoList(requestIp,vo);
ServiceBody<TerminalPhotoSelectListModel> serviceBody = terminalPhotoService.getPhotoList(requestIp, vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
@ -117,9 +117,9 @@ public class TerminalPhotoController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getPhotoBanner")
@Log(title = "图片轮询", type = "查询")
public ResponseReult<TerminalPhotosModel> getPhotoBanner(@RequestHeader HttpHeaders headers,@RequestBody @Validated PageVo vo) {
public ResponseReult<TerminalPhotosModel> getPhotoBanner(@RequestHeader HttpHeaders headers, @RequestBody @Validated PageVo vo) {
String requestIp = HeaderUtil.getRequestIp(headers);
ServiceBody<TerminalPhotosModel> serviceBody = terminalPhotoService.getPhotoBanner(requestIp,vo);
ServiceBody<TerminalPhotosModel> serviceBody = terminalPhotoService.getPhotoBanner(requestIp, vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
@ -171,9 +171,9 @@ public class TerminalPhotoController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getHistoryList")
@Log(title = "历史图片", type = "查询")
public ResponseReult<TerminalPhotoSelectListModel> getHistoryList(@RequestHeader HttpHeaders headers,@RequestBody @Validated TermIdAndChannelIdVo vo) {
public ResponseReult<TerminalPhotoSelectListModel> getHistoryList(@RequestHeader HttpHeaders headers, @RequestBody @Validated TermIdAndChannelIdVo vo) {
String requestIp = HeaderUtil.getRequestIp(headers);
ServiceBody<TerminalPhotoSelectListModel> serviceBody = terminalPhotoService.getHistoryList(requestIp,vo);
ServiceBody<TerminalPhotoSelectListModel> serviceBody = terminalPhotoService.getHistoryList(requestIp, vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {

@ -181,6 +181,8 @@ photo:
address: /photos/
video:
address: /videos/
system:
address: http://23.56.100.12
session:
expire_time: 3600
open_expire_time: 1800

@ -3,6 +3,7 @@ package com.shxy.xymanager_common.entity;
import lombok.Data;
import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
@Data
@ -15,6 +16,10 @@ public class TerminalChannelMapper implements Serializable {
private String alias;
private BigInteger photoId;
private BigInteger photoTime;
private Date createTime;
private Date updateTime;

@ -1,15 +1,27 @@
package com.shxy.xymanager_common.util;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;
import java.net.URL;
import java.util.List;
/**
*
*/
@Component
public class HeaderUtil {
private static String address;
@Value("${system.address}")
public void setHost(String address) {
HeaderUtil.address = address;
}
/**
*
*
@ -20,7 +32,16 @@ public class HeaderUtil {
String origin = httpHeaders.getOrigin();
if (StrUtil.isEmpty(origin)) {
List<String> list = httpHeaders.get("referer");
requestip = list.get(0);
if (CollectionUtil.isEmpty(list) || StrUtil.isEmpty(list.get(0))) {
requestip = address;
} else {
String s = list.get(0);
URL url = URLUtil.url(s);
String protocol = url.getProtocol();
String host = url.getHost();
int port = url.getPort();
requestip = protocol.concat("://").concat(host).concat(":").concat(String.valueOf(port));
}
} else {
requestip = origin;
}

@ -1,9 +1,9 @@
package com.shxy.xymanager_dao.dao;
import com.shxy.xymanager_common.entity.Lines;
import com.shxy.xymanager_common.entity.TerminalChannelMapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
@ -22,6 +22,8 @@ public interface TerminalChannelMapperDao {
List<TerminalChannelMapper> selectAll();
List<TerminalChannelMapper> selectAllByPhotoTime(@Param("time") BigInteger time);
int updateByPrimaryKeySelective(TerminalChannelMapper record);
int updateByPrimaryKey(TerminalChannelMapper record);

@ -33,13 +33,15 @@ public interface TerminalPhotoDao {
TerminalPhoto getLatestPhoto(@Param("termId") Integer termId);
List<TerminalPhoto> getLatestPhotoByTermidAndChannelid(@Param("termId") Integer termId,@Param("channelId") Integer channelId);
List<TerminalPhoto> getLatestPhotoByTermidAndChannelid(@Param("termId") Integer termId, @Param("channelId") Integer channelId);
List<TerminalPhoto> selectPhotosByIdList(@Param("list") List<BigInteger> list);
List<PhotoAndLineAndChannelDto> selectPhotos();
List<TermAndChannelLatestPhotoMapperDto> selectTermAndChannelLatestPhotoList(@Param("list") List<Integer> list);
List<TerminalPhoto> selectPhotoListForOpen(@Param("termId") Integer terminalid,@Param("starttime") BigInteger starttime, @Param("endtime") BigInteger endtime);
List<TerminalPhoto> selectPhotoListForOpen(@Param("termId") Integer terminalid, @Param("starttime") BigInteger starttime, @Param("endtime") BigInteger endtime);
List<TerminalPhotoScheduleDto> selectPhotoSchedule(TerminalPhotoTimeVo vo);
@ -53,12 +55,12 @@ public interface TerminalPhotoDao {
String getRequestResult(@Param("requestId") Integer requestId);
void deleteByMarkId(@Param("markId")Integer markId);
void deleteByMarkId(@Param("markId") Integer markId);
Integer addPhotoMark(PhotoMarkVo vo);
Integer addPhotoMarkPath(@Param("list")List<PhotoMarkVo.CoordinateBeans> list, @Param("markId")Integer id);
Integer addPhotoMarkPath(@Param("list") List<PhotoMarkVo.CoordinateBeans> list, @Param("markId") Integer id);
void updatePhotoMark(PhotoMarkVo vo);

@ -6,11 +6,13 @@
<result column="term_id" jdbcType="INTEGER" property="termId"/>
<result column="channel_id" jdbcType="INTEGER" property="channelId"/>
<result column="alias" jdbcType="VARCHAR" property="alias"/>
<result column="photo_id" jdbcType="BIGINT" property="photoId"/>
<result column="photo_time" jdbcType="BIGINT" property="photoTime"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap>
<sql id="Base_Column_List">
id, term_id, channel_id,alias, create_time, update_time
id, term_id, channel_id,alias, photo_id,photo_time,create_time, update_time
</sql>
<select id="selectByTermid" parameterType="java.lang.Integer" resultMap="BaseResultMap">
@ -24,6 +26,16 @@
<include refid="Base_Column_List"/>
from terminal_channel_mapper
</select>
<select id="selectAllByPhotoTime" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from terminal_channel_mapper
<if test="time != null">
where photo_time > #{time}
</if>
group by term_id,channel_id
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>

@ -106,7 +106,7 @@
<if test="termid != null">
and x.term_id = #{termid}
</if>
order by x.create_time asc
order by y.id asc
</select>
<select id="selectAllAndChannelByTermid" resultMap="LineAndTerminalMap">
SELECT

@ -117,7 +117,7 @@
from terminal_photos
<if test="list != null and list.size > 0">
where
<foreach collection="list" item="item" index="index" separator="or">
<foreach collection="list" item="item" index="index" separator="or">
(
<if test="item.photoOrgId != null">
orginal_id = #{item.photoOrgId}
@ -150,12 +150,17 @@
order by photo_time desc
</select>
<!-- <select id="selectPhotos" resultMap="BaseResultMap">-->
<!-- select-->
<!-- <include refid="Base_Column_List"/>-->
<!-- from terminal_photos-->
<!-- order by photo_time desc-->
<!-- </select>-->
<select id="selectPhotosByIdList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from terminal_photos
<if test="list != null and list.size > 0">
where id in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
<select id="selectPhotos" resultMap="PhotoAndLineAndChannelMap">
select

@ -2,6 +2,7 @@ package com.shxy.xymanager_framework.interaction;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import com.shxy.xymanager_common.annotation.JwtIgnore;
import com.shxy.xymanager_common.entity.SysUserSession;
@ -9,6 +10,7 @@ import com.shxy.xymanager_common.enums.HttpMethod;
import com.shxy.xymanager_common.exception.Asserts;
import com.shxy.xymanager_common.util.MyDateUtils;
import com.shxy.xymanager_service.service.SysUserService;
import javafx.beans.binding.NumberBinding;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -41,37 +43,37 @@ public class JwtInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// 忽略带JwtIgnore注解的请求, 不做后续token认证校验
// if (handler instanceof HandlerMethod) {
// HandlerMethod handlerMethod = (HandlerMethod) handler;
// JwtIgnore jwtIgnore = handlerMethod.getMethodAnnotation(JwtIgnore.class);
// if (jwtIgnore != null) {
// return true;
// }
// }
// if (HttpMethod.GET.name().equals(request.getMethod())) {
// response.setStatus(HttpServletResponse.SC_OK);
// return true;
// }
// // 获取请求头信息authorization信息
// final String sessionId = request.getHeader("sessionId");
// if (StrUtil.isBlank(sessionId)) {
// log.info("sessionId为空登录过期");
// Asserts.fail(401, "登录过期");
// }else{
// SysUserSession user = sysUserService.selectUserById(sessionId);
// if(user!=null) {
// BigInteger expireTime = user.getExpireTime();
//
// BigInteger currentTime = MyDateUtils.TimeMillSecond2Second(new DateTime());
// if (currentTime.subtract(expireTime).compareTo(time) > 0) {
// user.setExpireTime(currentTime.add(time));
// sysUserService.updateUserSession(user);
// }
// }else{
// log.info("sessionId为空登录过期");
// Asserts.fail(401, "登录过期");
// }
// }
if (handler instanceof HandlerMethod) {
HandlerMethod handlerMethod = (HandlerMethod) handler;
JwtIgnore jwtIgnore = handlerMethod.getMethodAnnotation(JwtIgnore.class);
if (jwtIgnore != null) {
return true;
}
}
if (HttpMethod.GET.name().equals(request.getMethod())) {
response.setStatus(HttpServletResponse.SC_OK);
return true;
}
// 获取请求头信息authorization信息
final String sessionId = request.getHeader("sessionId");
if (StrUtil.isBlank(sessionId)) {
log.info("sessionId为空登录过期");
Asserts.fail(401, "登录过期");
} else {
SysUserSession user = sysUserService.selectUserById(sessionId);
if (user != null) {
BigInteger expireTime = user.getExpireTime();
long currentTime = MyDateUtils.TimeMillSecond2Second(new DateTime());
if ((currentTime - expireTime.longValue()) > time.longValue()) {
user.setExpireTime(BigInteger.valueOf(currentTime).add(time));
sysUserService.updateUserSession(user);
}
} else {
log.info("sessionId为空登录过期");
Asserts.fail(401, "登录过期");
}
}
return true;
}

@ -64,7 +64,7 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
private String videoaddress;
@Override
public ServiceBody<TerminalAlarmListModel> getTerminalAlarmList(TerminalAlarmSelectVo vo) {
public ServiceBody<TerminalAlarmListModel> getTerminalAlarmList(String requestIp, TerminalAlarmSelectVo vo) {
TerminalAlarmListModel model = new TerminalAlarmListModel();
Integer dyid = vo.getDyId();
@ -171,12 +171,16 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
if (map != null) {
TerminalPhoto terminalPhoto = map.get(item.getTermId() + "#" + item.getPhotoOrgId());
if (terminalPhoto != null) {
String path = terminalPhoto.getPath();
Integer mediaType = terminalPhoto.getMediaType();
if (mediaType == 0) {
alarmBean.setPath(photoaddress + path);
} else if (mediaType == 1) {
alarmBean.setPath(videoaddress + path);
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("");
}

@ -49,6 +49,9 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
@Autowired
TerminalsDao terminalsDao;
@Autowired
TerminalChannelMapperDao terminalChannelMapperDao;
@Autowired
DyLevelDao dyLevelDao;
@ -64,12 +67,6 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
@Autowired
TerminalScheduleRuleService terminalScheduleRuleService;
@Value("${cma.server}")
private String server;
@Value("${cma.port}")
private int port;
@Value("${photo.address}")
private String photoaddress;
@ -328,7 +325,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
photoBean.setPath(requestIp + videoaddress + item.getPath());
}
if (path != null) {
photoBean.setPath(photoaddress + path);
photoBean.setPath(requestIp + photoaddress + path);
String[] split = path.split("/");
int length = split.length;
String s = split[length - 1];
@ -399,6 +396,92 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
* @param vo
* @return
*/
// @Override
// public ServiceBody<TerminalPhotosModel> getPhotoBanner(String requestIp, PageVo vo) {
// TerminalPhotosModel model = new TerminalPhotosModel();
//
// int pageindex = vo.getPageindex();
// int pagesize = vo.getPagesize();
// PageUtils.SetPage(pageindex, pagesize);
//
// List<ChannelAndTermDto> list = terminalsDao.selectChannelAndTermList(CommonStatus.EFFECTIVE.value());
// List<TerminalPhotosModel.PhotosBean> beans = new ArrayList<>();
//
// if (!CollectionUtil.isEmpty(list)) {
// Map<Integer, LineAndDyNameDto> lineMap = XyCache.lineMap;
// Map<String, TerminalChannelMapper> termchannelMapMap = XyCache.termchannelMapMap;
// List<Integer> termidlist = new ArrayList<>();
// for (ChannelAndTermDto item : list) {
// Integer termid = item.getTermid();
// termidlist.add(termid);
// }
// List<TermAndChannelLatestPhotoMapperDto> list2 = terminalPhotoDao.selectTermAndChannelLatestPhotoList(termidlist);
// for (ChannelAndTermDto item : list) {
// TerminalPhotosModel.PhotosBean photosBean = new TerminalPhotosModel.PhotosBean();
// Integer termid = item.getTermid();
// Integer channelid = item.getChannelid();
//
// photosBean.setTermid(termid);
// photosBean.setLineid(item.getLineid());
// photosBean.setChannnelname(item.getChannelname());
// if (termchannelMapMap != null) {
// TerminalChannelMapper terminalChannelMapper = termchannelMapMap.get(termid + "#" + channelid);
// if (terminalChannelMapper != null) {
// photosBean.setAlias(terminalChannelMapper.getAlias());
// } else {
// photosBean.setAlias("");
// }
// } else {
// photosBean.setAlias("");
// }
// photosBean.setChannelid(channelid);
// photosBean.setDisplayname(item.getDisplayname());
//
// LineAndDyNameDto lineAndDyNameDto = lineMap.get(item.getLineid());
// if (lineAndDyNameDto != null) {
// photosBean.setLinename(lineAndDyNameDto.getName());
// } else {
// photosBean.setLinename("");
// }
//
// for (int y = 0; y < list2.size(); y++) {
// TermAndChannelLatestPhotoMapperDto item2 = list2.get(y);
// if (termid.intValue() == item2.getTermid().intValue() && item.getChannelid().intValue() == item2.getChannelid().intValue()) {
// Integer mediatype = item2.getMediatype();
// if (mediatype != null && (mediatype.intValue() == 0 || mediatype.intValue() == 1)) {
// photosBean.setPath(item2.getPath());
// long recvtime = MyDateUtils.TimeSecond2MillSecond(item2.getRecvTime().longValue());
// photosBean.setRecvTime(MyDateUtils.date(recvtime));
// long phototime = MyDateUtils.TimeSecond2MillSecond(item2.getPhotoTime().longValue());
// photosBean.setPhotoTime(MyDateUtils.date(phototime));
// photosBean.setMediatype(mediatype);
// if (mediatype.intValue() == 0) {
// photosBean.setPath(requestIp + photoaddress + item2.getPath());
// } else {
// photosBean.setPath(requestIp + videoaddress + item2.getPath());
// }
// photosBean.setOrginalid(item2.getOrginalid());
// photosBean.setPresetId(item2.getPresetId());
// }
// break;
// }
// }
// beans.add(photosBean);
// }
// }
// model.setList(beans);
// PageInfo pageData = PageUtils.getPageData(list);
// int currentpage = pageData.getPageNum();
// model.setCurrentpage(currentpage);
// long total = pageData.getTotal();
// model.setTotal(total);
//
// int pageSize = pageData.getPageSize();
// model.setPagesize(pageSize);
// int pages = pageData.getPages();
// model.setTotalpage(pages);
// return Asserts.success(model);
// }
@Override
public ServiceBody<TerminalPhotosModel> getPhotoBanner(String requestIp, PageVo vo) {
TerminalPhotosModel model = new TerminalPhotosModel();
@ -407,26 +490,39 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
int pagesize = vo.getPagesize();
PageUtils.SetPage(pageindex, pagesize);
List<ChannelAndTermDto> list = terminalsDao.selectChannelAndTermList(CommonStatus.EFFECTIVE.value());
DateTime dateTime = MyDateUtils.offsetDay(new Date(), -1);
long l = MyDateUtils.TimeMillSecond2Second(dateTime);
List<TerminalChannelMapper> list = terminalChannelMapperDao.selectAllByPhotoTime(BigInteger.valueOf(l));
ArrayList<BigInteger> photolist = new ArrayList<>();
List<TerminalPhotosModel.PhotosBean> beans = new ArrayList<>();
if (!CollectionUtil.isEmpty(list)) {
if (CollectionUtil.isNotEmpty(list)) {
for (TerminalChannelMapper item : list) {
photolist.add(item.getPhotoId());
}
Map<Integer, LineAndDyNameDto> lineMap = XyCache.lineMap;
Map<String, TerminalChannelMapper> termchannelMapMap = XyCache.termchannelMapMap;
List<Integer> termidlist = new ArrayList<>();
for (ChannelAndTermDto item : list) {
Integer termid = item.getTermid();
termidlist.add(termid);
}
List<TermAndChannelLatestPhotoMapperDto> list2 = terminalPhotoDao.selectTermAndChannelLatestPhotoList(termidlist);
for (ChannelAndTermDto item : list) {
TerminalPhotosModel.PhotosBean photosBean = new TerminalPhotosModel.PhotosBean();
Integer termid = item.getTermid();
Integer channelid = item.getChannelid();
Map<Integer, TowerDto> towerMap = XyCache.towerMap;
Map<Integer, Terminals> terminalMap = XyCache.terminalMap;
Map<Integer, TerminalChannels> termchannelMap = XyCache.termchannelMap;
List<TerminalPhoto> photoList = terminalPhotoDao.selectPhotosByIdList(photolist);
for (TerminalChannelMapper item : list) {
TerminalPhotosModel.PhotosBean photosBean = new TerminalPhotosModel.PhotosBean();
Integer termid = item.getTermId();
Integer channelid = item.getChannelId();
BigInteger photoId = item.getPhotoId();
Integer lineid = null;
photosBean.setTermid(termid);
photosBean.setLineid(item.getLineid());
photosBean.setChannnelname(item.getChannelname());
Terminals terminals = terminalMap.get(termid);
if (terminals != null) {
lineid = terminals.getLineid();
photosBean.setLineid(lineid);
photosBean.setDisplayname(terminals.getDisplayName());
}
photosBean.setChannelid(channelid);
photosBean.setChannnelname(termchannelMap.get(channelid).getChannelName());
if (termchannelMapMap != null) {
TerminalChannelMapper terminalChannelMapper = termchannelMapMap.get(termid + "#" + channelid);
if (terminalChannelMapper != null) {
@ -437,34 +533,32 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
} else {
photosBean.setAlias("");
}
photosBean.setChannelid(channelid);
photosBean.setDisplayname(item.getDisplayname());
LineAndDyNameDto lineAndDyNameDto = lineMap.get(item.getLineid());
if (lineAndDyNameDto != null) {
photosBean.setLinename(lineAndDyNameDto.getName());
} else {
photosBean.setLinename("");
if (lineid != null) {
LineAndDyNameDto lineAndDyNameDto = lineMap.get(lineid);
if (lineAndDyNameDto != null) {
photosBean.setLinename(lineAndDyNameDto.getName());
} else {
photosBean.setLinename("");
}
}
for (int y = 0; y < list2.size(); y++) {
TermAndChannelLatestPhotoMapperDto item2 = list2.get(y);
if (termid.intValue() == item2.getTermid().intValue() && item.getChannelid().intValue() == item2.getChannelid().intValue()) {
Integer mediatype = item2.getMediatype();
for (int y = 0; y < photoList.size(); y++) {
TerminalPhoto terminalPhoto = photoList.get(y);
if (terminalPhoto.getId().longValue() == photoId.longValue()) {
Integer mediatype = terminalPhoto.getMediaType();
if (mediatype != null && (mediatype.intValue() == 0 || mediatype.intValue() == 1)) {
photosBean.setPath(item2.getPath());
long recvtime = MyDateUtils.TimeSecond2MillSecond(item2.getRecvTime().longValue());
photosBean.setPath(terminalPhoto.getPath());
long recvtime = MyDateUtils.TimeSecond2MillSecond(terminalPhoto.getRecvTime().longValue());
photosBean.setRecvTime(MyDateUtils.date(recvtime));
long phototime = MyDateUtils.TimeSecond2MillSecond(item2.getPhotoTime().longValue());
long phototime = MyDateUtils.TimeSecond2MillSecond(terminalPhoto.getPhotoTime().longValue());
photosBean.setPhotoTime(MyDateUtils.date(phototime));
photosBean.setMediatype(mediatype);
if (mediatype.intValue() == 0) {
photosBean.setPath(requestIp + photoaddress + item2.getPath());
photosBean.setPath(requestIp + photoaddress + terminalPhoto.getPath());
} else {
photosBean.setPath(requestIp + videoaddress + item2.getPath());
photosBean.setPath(requestIp + videoaddress + terminalPhoto.getPath());
}
photosBean.setOrginalid(item2.getOrginalid());
photosBean.setPresetId(item2.getPresetId());
photosBean.setOrginalid(terminalPhoto.getOrginalId());
photosBean.setPresetId(terminalPhoto.getPresetId());
}
break;
}

@ -12,7 +12,6 @@ import com.shxy.xymanager_common.dto.DyLineAndTerminalNoHeartDto;
import com.shxy.xymanager_common.dto.PhotoMarkDto;
import com.shxy.xymanager_common.dto.TerminalInfoDto;
import com.shxy.xymanager_common.dto.TerminalsAndLineAndChannelDto;
import com.shxy.xymanager_common.entity.GlobalParams;
import com.shxy.xymanager_common.entity.TerminalChannelMapper;
import com.shxy.xymanager_common.entity.Terminals;
import com.shxy.xymanager_common.enums.CommonStatus;
@ -35,7 +34,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import cn.hutool.core.date.DateUnit;
import javax.validation.constraints.NotBlank;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Date;
@ -369,7 +367,7 @@ public class TerminalServiceImpl implements TerminalService {
}
@Override
public ServiceBody<PhotoMarkModel> getCoordinate(MarkReqVo vo) {
public ServiceBody<PhotoMarkModel> getCoordinate(String requestIp, MarkReqVo vo) {
Map<String, String> globalParams = XyCache.globalParams;
String s = globalParams.get(GloableParamsType.ImgMark.value());
Integer integer = Integer.valueOf(s);
@ -379,7 +377,7 @@ public class TerminalServiceImpl implements TerminalService {
if (vo.getNeedPic() == 0) {
dto = terminalPhotoDao.selectPhotoMark(vo);
if (null != dto && StringUtils.isNotBlank(dto.getPath())) {
dto.setPath(photoaddress + dto.getPath());
dto.setPath(requestIp + photoaddress + dto.getPath());
}
} else {
dto = terminalPhotoDao.selectPhotoWithoutPic(vo);

@ -16,7 +16,7 @@ public interface TerminalAlarmService {
*
* @return
*/
ServiceBody<TerminalAlarmListModel> getTerminalAlarmList(TerminalAlarmSelectVo vo);
ServiceBody<TerminalAlarmListModel> getTerminalAlarmList(String requestIp, TerminalAlarmSelectVo vo);
/**
*

@ -88,6 +88,6 @@ public interface TerminalService {
ServiceBody<String> updateCoordinate(PhotoMarkVo vo);
ServiceBody<PhotoMarkModel> getCoordinate(MarkReqVo vo);
ServiceBody<PhotoMarkModel> getCoordinate(String requestIp, MarkReqVo vo);
}

Loading…
Cancel
Save