欣影管理平台装置通道表修改

jni
liuguijing 2 years ago
parent 7a7b024230
commit 6fe1fa45a4

@ -21,8 +21,8 @@
value="%d{yyyy-MM-dd HH:mm:ss.SSS} %highlight{%-5level}[%thread] %style{%logger{36}}{cyan} : %msg%n"/>
<!-- 定义日志存储的路径,不要配置相对路径 -->
<property name="FILE_PATH" value="/usr/local/home/manager/logs"/>
<property name="FILE_NAME" value="xymanagerbackendlog"/>
<property name="FILE_PATH" value="/var/xymp/xymanagerLogs/"/>
<property name="FILE_NAME" value="xymanagerlog"/>
</Properties>
<appenders>

@ -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
@ -13,7 +14,7 @@ public class TerminalPhoto implements Serializable {
private Integer channelId;
private Byte presetId;
private Integer presetId;
private Integer width;
@ -21,9 +22,9 @@ public class TerminalPhoto implements Serializable {
private Integer fileSize;
private Date photoTime;
private BigInteger photoTime;
private Date recvTime;
private BigInteger recvTime;
private String path;

@ -34,7 +34,7 @@ public class TerminalPhotoListModel implements Serializable {
private Integer channelId;
@ApiModelProperty(value = "预置位编号", example = "123456")
private Byte presetId;
private Integer presetId;
@ApiModelProperty(value = "宽度", example = "123456")
private Integer width;

@ -9,6 +9,7 @@ import cn.hutool.core.lang.Range;
import org.apache.commons.lang3.time.DateFormatUtils;
import java.lang.management.ManagementFactory;
import java.math.BigInteger;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -31,8 +32,8 @@ public class MyDateUtils extends DateUtil {
public static String[] parsePatterns = {
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", "yyyy年MM月dd日",
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", "HH时mm分", "HH:mm","HH:mm:ss",
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM","yyyyMMdd"};
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", "HH时mm分", "HH:mm", "HH:mm:ss",
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM", "yyyyMMdd"};
/**
* Date
@ -116,6 +117,7 @@ public class MyDateUtils extends DateUtil {
}
return format(str, "HH:mm");
}
/**
* "MM/dd"
*/
@ -125,6 +127,7 @@ public class MyDateUtils extends DateUtil {
}
return format(str, "MM/dd");
}
/**
*
*/
@ -132,12 +135,14 @@ public class MyDateUtils extends DateUtil {
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
return new Date(time);
}
/**
* "yyyy-MM-dd HH:mm"
*/
public static String formatYmdHmTime(Date date) {
return null == date ? null : DatePattern.NORM_DATETIME_MINUTE_FORMAT.format(date);
}
/**
*
*/
@ -159,10 +164,23 @@ public class MyDateUtils extends DateUtil {
return day + "天" + hour + "小时" + min + "分钟";
}
// public static String dfdsa(Date start, Date end, DateField unit, int step, boolean isIncludeStart, boolean isIncludeEnd){
// new Range(DateUtil.date(start), DateUtil.date(end), (current, end1, index) -> {
// DateTime dt = DateUtil.date(start).offsetNew(unit, (index + 1) * step);
// return dt.isAfter(end1) ? null : dt;
// }, isIncludeStart, isIncludeEnd);
// }
/**
* 1310
*
* @return
*/
public static BigInteger TimeMillSecond2Second(DateTime dateTime) {
BigInteger l = BigInteger.valueOf(Math.floorDiv(dateTime.getTime(), 1000l));
return l;
}
/**
* 1013
*
* @return
*/
public static BigInteger TimeSecond2MillSecond(long time) {
BigInteger l = BigInteger.valueOf(time * 1000l);
return l;
}
}

@ -4,12 +4,13 @@ import com.shxy.xymanager_common.entity.TerminalPhoto;
import org.apache.ibatis.annotations.Param;
import javax.xml.crypto.Data;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
public interface TerminalPhotoDao {
List<TerminalPhoto> selectPhotoList(@Param("terminalid") Integer terminalid, @Param("channelid") Integer channelid, @Param("time") Date time);
List<TerminalPhoto> selectPhotoList(@Param("terminalid") Integer terminalid, @Param("channelid") Integer channelid, @Param("starttime") BigInteger starttime, @Param("endtime") BigInteger endtime);
int deleteByPrimaryKey(Long id);

@ -5,12 +5,12 @@
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="term_id" jdbcType="INTEGER" property="termId"/>
<result column="channel_id" jdbcType="INTEGER" property="channelId"/>
<result column="preset_id" jdbcType="TINYINT" property="presetId"/>
<result column="preset_id" jdbcType="INTEGER" property="presetId"/>
<result column="width" jdbcType="INTEGER" property="width"/>
<result column="height" jdbcType="INTEGER" property="height"/>
<result column="file_size" jdbcType="INTEGER" property="fileSize"/>
<result column="photo_time" jdbcType="TIMESTAMP" property="photoTime"/>
<result column="recv_time" jdbcType="TIMESTAMP" property="recvTime"/>
<result column="photo_time" jdbcType="BIGINT" property="photoTime"/>
<result column="recv_time" jdbcType="BIGINT" property="recvTime"/>
<result column="path" jdbcType="VARCHAR" property="path"/>
<result column="manual_request" jdbcType="TINYINT" property="manualRequest"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
@ -23,7 +23,7 @@
select
<include refid="Base_Column_List"/>
from terminal_photos
where term_id = #{terminalid} and channel_id = #{channelid} and photo_time = date_format(#{time},'%y%m%d')
where term_id = #{terminalid} and channel_id = #{channelid} and photo_time between #{starttime} and #{endtime}
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">

@ -1,12 +1,12 @@
package com.shxy.xymanager_service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.entity.TerminalPhoto;
import com.shxy.xymanager_common.exception.Asserts;
import com.shxy.xymanager_common.model.TerminalPhotoListModel;
import com.shxy.xymanager_common.util.MyDateUtils;
import com.shxy.xymanager_common.vo.TerminalAndChannelIdAndTimeVo;
import com.shxy.xymanager_dao.dao.TerminalPhotoDao;
import com.shxy.xymanager_service.service.TerminalPhotoService;
@ -14,7 +14,9 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
@ -36,13 +38,35 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
@Override
public ServiceBody<TerminalPhotoListModel> getTerminalPhotoList(TerminalAndChannelIdAndTimeVo vo) {
TerminalPhotoListModel model = new TerminalPhotoListModel();
List<TerminalPhoto> list = terminalPhotoDao.selectPhotoList(vo.getTerminalid(), vo.getChannelid(),vo.getTime());
Date time = vo.getTime();
DateTime begindateTime = MyDateUtils.beginOfDay(time);
DateTime enddateTime = MyDateUtils.endOfDay(time);
BigInteger start = MyDateUtils.TimeMillSecond2Second(begindateTime);
BigInteger end = MyDateUtils.TimeMillSecond2Second(enddateTime);
List<TerminalPhoto> list = terminalPhotoDao.selectPhotoList(vo.getTerminalid(), vo.getChannelid(), start, end);
boolean empty = CollectionUtil.isEmpty(list);
model.setTime(vo.getTime());
if (empty) {
model.setList(new ArrayList<>());
} else {
List<TerminalPhotoListModel.PhotoBean> beans = BeanUtil.copyToList(list, TerminalPhotoListModel.PhotoBean.class, CopyOptions.create().ignoreCase());
List<TerminalPhotoListModel.PhotoBean> beans = new ArrayList<>();
for (TerminalPhoto item : list) {
TerminalPhotoListModel.PhotoBean photoBean = new TerminalPhotoListModel.PhotoBean();
photoBean.setChannelId(item.getChannelId());
photoBean.setFileSize(item.getFileSize());
photoBean.setHeight(item.getHeight());
photoBean.setManualRequest(item.getManualRequest());
photoBean.setPath("http://47.96.238.157/image/"+item.getPath());
photoBean.setId(item.getId());
photoBean.setTermId(item.getTermId());
photoBean.setWidth(item.getWidth());
photoBean.setPresetId(item.getPresetId());
BigInteger phototime = MyDateUtils.TimeSecond2MillSecond(item.getPhotoTime().longValue());
photoBean.setPhotoTime(MyDateUtils.date(phototime.longValue()));
BigInteger rectime = MyDateUtils.TimeSecond2MillSecond(item.getRecvTime().longValue());
photoBean.setPhotoTime(MyDateUtils.date(rectime.longValue()));
beans.add(photoBean);
}
model.setList(beans);
}
return Asserts.success(model);

Loading…
Cancel
Save