Matthew 2 years ago
commit 8bf7f8f27c

@ -115,7 +115,12 @@
<version>5.7.20</version>
</dependency>
<!--JNA:调用本地dll-->
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.9.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>

@ -8,10 +8,7 @@ import com.shxy.xymanager_common.bean.ServiceStatus;
import com.shxy.xymanager_common.model.DyLineTreeAndChannelListModel;
import com.shxy.xymanager_common.model.TerminalChannelListModel;
import com.shxy.xymanager_common.model.TerminalChannelMapperListModel;
import com.shxy.xymanager_common.vo.TerminalChannelIdListVo;
import com.shxy.xymanager_common.vo.TerminalChannelVo;
import com.shxy.xymanager_common.vo.TerminalIdVo;
import com.shxy.xymanager_common.vo.UpdateTerminalChannelVo;
import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_service.service.TerminalChannelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -38,8 +35,8 @@ public class ChannelController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getChannelList")
@Log(title = "获取所有通道列表", type = "查询")
public ResponseReult<TerminalChannelListModel> getChannelList() {
ServiceBody<TerminalChannelListModel> serviceBody = terminalChannelService.getChannelList();
public ResponseReult<TerminalChannelListModel> getChannelList(@RequestBody @Validated PageVo vo) {
ServiceBody<TerminalChannelListModel> serviceBody = terminalChannelService.getChannelList(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
@ -64,7 +61,7 @@ public class ChannelController extends BaseController {
@ApiOperation(value = "修改通道接口", notes = "获取通道列表接口", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/updateChannelList")
@Log(title = "修改通道列表", type = "查询")
@Log(title = "修改通道列表", type = "修改")
public ResponseReult<String> updateChannelList(@RequestBody @Validated UpdateTerminalChannelVo vo) {
ServiceBody<String> serviceBody = terminalChannelService.updateChannelList(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
@ -77,7 +74,7 @@ public class ChannelController extends BaseController {
@ApiOperation(value = "删除通道接口", notes = "获取通道列表接口", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/deleteChannelList")
@Log(title = "获取通道列表", type = "查询")
@Log(title = "删除通道接口", type = "修改")
public ResponseReult<String> deleteChannelList(@RequestBody @Validated TerminalChannelIdListVo vo) {
ServiceBody<String> serviceBody = terminalChannelService.deleteChannelList(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {

@ -42,4 +42,17 @@ public class TerminalPhotoController extends BaseController {
}
@ApiOperation(value = "图片查询", notes = "图片查询接口", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getPhotoList")
@Log(title = "获取设备列表", type = "查询")
public ResponseReult<TerminalPhotoListModel> getPhotoList(@RequestBody @Validated TerminalAndChannelIdAndTimeVo vo) {
ServiceBody<TerminalPhotoListModel> serviceBody = terminalPhotoService.getTerminalPhotoList(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
}
}
}

@ -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>

@ -93,6 +93,12 @@
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>
<!--JNA:调用本地dll-->
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
</dependency>
</dependencies>
<build>

@ -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;

@ -13,7 +13,14 @@ import java.util.List;
@Data
@ApiModel(value = "通道列表", description = "通道列表信息")
public class TerminalChannelListModel implements Serializable {
@ApiModelProperty(value = "总记录数", example = "120")
private long total;
@ApiModelProperty(value = "总页数", example = "120")
private int totalpage;
@ApiModelProperty(value = "当前页", example = "1")
private int currentpage;
@ApiModelProperty(value = "每页记录数", example = "1")
private int pagesize;
@ApiModelProperty(value = "通道列表对象", example = "[]")
private List<ChannelBean> list;

@ -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;
}
}

@ -12,5 +12,11 @@ import java.util.List;
public class TerminalChannelIdListVo {
@NotEmpty(message = "不能传入空值")
@ApiModelProperty(value = "通道编号数组", required = true, example = "A0001")
private List<Integer> list;
private List<ChannelIdItem> list;
@Data
private static class ChannelIdItem {
@ApiModelProperty(value = "通道编号", example = "123")
private Integer id;
}
}

@ -13,17 +13,17 @@ public class TerminalChannelVo {
@NotNull(message = "装置列表不能缺少")
@ApiModelProperty(value = "装置通道编号列表", example = "123455")
private List<Item> list;
private List<ChannelItem> list;
@Data
public static class Item {
public static class ChannelItem {
@NotNull(message = "通道编号")
@ApiModelProperty(value = "装置编号", example = "123455")
private Integer id;
@NotNull(message = "通道编号不能缺少")
@ApiModelProperty(value = "通道编号", example = "123455")
private Integer channelname;
private String channelname;
@ApiModelProperty(value = "分辨率W", example = "123456")
private Integer maxResolutionWidth;

@ -31,23 +31,18 @@ public class TerminalVo {
private String cmdid;
@ApiModelProperty(value = "原始 ID各厂家内部识别号", example = "12345678")
@NotBlank(message = "各厂家内部识别号不能缺少")
private Short orgId;
@ApiModelProperty(value = "装置名称", example = "名称名称")
@NotBlank(message = "装置名称不能缺少")
private String equipName;
@ApiModelProperty(value = "显示名", example = "名称名称")
@NotBlank(message = "显示名不能缺少")
private String displayName;
@ApiModelProperty(value = "装置型号", example = "型号型号")
@NotBlank(message = "装置型号不能缺少")
private String model;
@ApiModelProperty(value = "装置基本信息版本号", example = "型号型号")
@NotBlank(message = "装置基本信息版本号不能缺少")
private String essentialInfoVersion;
@ApiModelProperty(value = "是否带云台", example = " 0 不带云台 1带云台")
@ -55,23 +50,18 @@ public class TerminalVo {
private Byte hasPan;
@ApiModelProperty(value = "生产厂家", example = "生产厂家")
@NotBlank(message = "生产厂家不能缺少")
private String bsManufacturer;
@ApiModelProperty(value = "生产日期", example = "2022-06-12")
@NotBlank(message = "生产日期不能缺少")
private Date bsProductionDate;
@ApiModelProperty(value = "出厂编号", example = "123456")
@NotBlank(message = "出厂编号不能缺少")
private String bsIdentifier;
@ApiModelProperty(value = "纬度", example = "21321")
@NotBlank(message = "纬度不能缺少")
private Double latitude;
@ApiModelProperty(value = "经度", example = "213")
@NotBlank(message = "经度不能缺少")
private Double longitude;
}

@ -8,7 +8,7 @@ import javax.validation.constraints.NotNull;
import java.util.List;
@Data
@ApiModel(value = "通道对象", description = "通道对象描述")
@ApiModel(value = "修改通道对象", description = "修改通道对象描述")
public class UpdateTerminalChannelVo {
@NotNull(message = "通道编号")
@ -16,8 +16,8 @@ public class UpdateTerminalChannelVo {
private Integer id;
@NotNull(message = "通道编号不能缺少")
@ApiModelProperty(value = "通道编号", example = "123455")
private Integer channelname;
@ApiModelProperty(value = "通道名称", example = "123455")
private String channelname;
@NotNull(message = "通道编号状态")
@ApiModelProperty(value = "通道状态", example = "0---关闭 1--开启")

@ -22,6 +22,6 @@ public interface TerminalChannelsDao {
int updateByPrimaryKeySelective(@Param("data") TerminalChannels record,@Param("updateat") Date update);
int deleteList(@Param("list") List<Integer> list,@Param("status") Integer status,@Param("updateat") Date update);
int deleteList(@Param("list") List<TerminalChannels> list,@Param("status") Integer status,@Param("updateat") Date update);
}

@ -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);

@ -104,13 +104,23 @@
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.TerminalChannels">
insert into terminal_channels (id, term_id, channel_no,
insert into terminal_channels (id, term_id,
channel_name, max_resolution_width, max_resolution_height
)
values (#{id,jdbcType=INTEGER}, #{termId,jdbcType=INTEGER}, #{channelNo,jdbcType=TINYINT},
values (#{id,jdbcType=INTEGER}, #{termId,jdbcType=INTEGER},
#{channelName,jdbcType=VARCHAR}, #{maxResolutionWidth,jdbcType=INTEGER}, #{maxResolutionHeight,jdbcType=INTEGER}
)
</insert>
<insert id="insertList" >
insert into terminal_channels
(id,channel_name,max_resolution_width,max_resolution_height,status,create_time,update_time)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.id},#{item.channelName},#{item.maxResolutionWidth},#{item.maxResolutionHeight},#{status},#{createat},#{updateat})
</foreach>
</insert>
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.TerminalChannels">
insert into terminal_channels
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -186,9 +196,9 @@
update_time = #{updateat},
</if>
</set>
where
<foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
#{id}
where id in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item.id}
</foreach>
</update>
</mapper>

@ -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">

@ -140,17 +140,115 @@
<insert id="insertList">
insert into terminals
(line_id,tower_id,cmdid, org_id, equip_name, display_name, model, essential_info_version, has_pan,
bs_manufacturer, bs_production_date, bs_identifier, latitude, longitude,status, create_time,
update_time)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.lineid},#{item.towerid},#{item.cmdid},
#{item.orgId},#{item.equipName},#{item.displayName},
#{item.model},#{item.essentialInfoVersion},#{item.hasPan},
#{item.bsManufacturer},#{item.bsProductionDate},#{item.bsIdentifier},
#{item.latitude},#{item.longitude},#{status},
#{createat},#{updateat})
<foreach collection="list" item="item" index="index" separator=",">
<if test="index == 0">
<trim prefix="(" suffix=") values " suffixOverrides=",">
<if test="#{item.lineid} != null">
line_id,
</if>
<if test="#{item.towerid} != null">
tower_id,
</if>
<if test="#{item.cmdid} != null">
cmdid,
</if>
<if test="#{item.orgId} != null">
org_id,
</if>
<if test="#{item.equipName} != null">
equip_name,
</if>
<if test="#{item.displayName} != null">
display_name,
</if>
<if test="#{item.model} != null">
model,
</if>
<if test="#{item.essentialInfoVersion} != null">
essential_info_version,
</if>
<if test="#{item.hasPan} != null">
has_pan,
</if>
<if test="#{item.bsManufacturer} != null">
bs_manufacturer,
</if>
<if test="#{item.bsProductionDate} != null">
bs_production_date,
</if>
<if test="#{item.bsIdentifier} != null">
bs_identifier,
</if>
<if test="#{item.latitude} != null">
latitude,
</if>
<if test="#{item.longitude} != null">
longitude,
</if>
<if test="#{status} != null">
status,
</if>
<if test="#{createat} != null">
create_time,
</if>
<if test="#{updateat} != null">
update_time,
</if>
</trim>
</if>
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="#{item.lineid} != null">
#{item.lineid},
</if>
<if test="#{item.towerid} != null">
#{item.towerid},
</if>
<if test="#{item.cmdid} != null">
#{item.cmdid},
</if>
<if test="#{item.orgId} != null">
#{item.orgId},
</if>
<if test="#{item.equipName} != null">
#{item.equipName},
</if>
<if test="#{item.displayName} != null">
#{item.displayName},
</if>
<if test="#{item.model} != null">
#{item.model},
</if>
<if test="#{item.essentialInfoVersion} != null">
#{item.essentialInfoVersion},
</if>
<if test="#{item.hasPan} != null">
#{item.hasPan},
</if>
<if test="#{item.bsManufacturer} != null">
#{item.bsManufacturer},
</if>
<if test="#{item.bsProductionDate} != null">
#{item.bsProductionDate},
</if>
<if test="#{item.bsIdentifier} != null">
#{item.bsIdentifier},
</if>
<if test="#{item.latitude} != null">
#{item.latitude},
</if>
<if test="#{item.longitude} != null">
#{item.longitude},
</if>
<if test="#{status} != null">
#{status},
</if>
<if test="#{createat} != null">
#{createat},
</if>
<if test="#{updateat} != null">
#{updateat},
</if>
</trim>
</foreach>
</insert>

@ -3,19 +3,19 @@ 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 com.github.pagehelper.PageInfo;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.dto.DyLineAndTerminalAndChannelDto;
import com.shxy.xymanager_common.dto.TermChannelAndMapperDto;
import com.shxy.xymanager_common.entity.Lines;
import com.shxy.xymanager_common.entity.TerminalChannels;
import com.shxy.xymanager_common.enums.CommonStatus;
import com.shxy.xymanager_common.exception.Asserts;
import com.shxy.xymanager_common.model.DyLineTreeAndChannelListModel;
import com.shxy.xymanager_common.model.TerminalChannelListModel;
import com.shxy.xymanager_common.model.TerminalChannelMapperListModel;
import com.shxy.xymanager_common.vo.TerminalChannelIdListVo;
import com.shxy.xymanager_common.vo.TerminalChannelVo;
import com.shxy.xymanager_common.vo.TerminalIdVo;
import com.shxy.xymanager_common.vo.UpdateTerminalChannelVo;
import com.shxy.xymanager_common.page.PageUtils;
import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_dao.dao.TerminalChannelsDao;
import com.shxy.xymanager_service.service.TerminalChannelService;
import lombok.extern.slf4j.Slf4j;
@ -62,7 +62,8 @@ public class TerminalChannelServiceImpl implements TerminalChannelService {
*/
@Override
public ServiceBody<String> updateChannelList(UpdateTerminalChannelVo vo) {
TerminalChannels bean = BeanUtil.copyProperties(vo, TerminalChannels.class);
TerminalChannels bean = new TerminalChannels();
BeanUtil.copyProperties(vo, bean,CopyOptions.create().ignoreCase());
int i = terminalChannelsDao.updateByPrimaryKeySelective(bean, new Date());
if (i != 0) {
return Asserts.success("修改成功");
@ -71,9 +72,15 @@ public class TerminalChannelServiceImpl implements TerminalChannelService {
}
}
/**
*
* @param vo
* @return
*/
@Override
public ServiceBody<String> deleteChannelList(TerminalChannelIdListVo vo) {
int i = terminalChannelsDao.deleteList(vo.getList(), CommonStatus.DELETE.value(), new Date());
List<TerminalChannels> list = BeanUtil.copyToList(vo.getList(), TerminalChannels.class);
int i = terminalChannelsDao.deleteList(list, CommonStatus.DELETE.value(), new Date());
if (i != 0) {
return Asserts.success("删除成功");
} else {
@ -87,7 +94,10 @@ public class TerminalChannelServiceImpl implements TerminalChannelService {
* @return
*/
@Override
public ServiceBody<TerminalChannelListModel> getChannelList() {
public ServiceBody<TerminalChannelListModel> getChannelList(PageVo vo) {
int pageindex = vo.getPageindex();
int pagesize = vo.getPagesize();
PageUtils.SetPage(pageindex, pagesize);
TerminalChannelListModel model = new TerminalChannelListModel();
List<TerminalChannels> list = terminalChannelsDao.selectChannelList();
boolean empty = CollectionUtil.isEmpty(list);
@ -97,6 +107,17 @@ public class TerminalChannelServiceImpl implements TerminalChannelService {
List<TerminalChannelListModel.ChannelBean> channelBeans = BeanUtil.copyToList(list, TerminalChannelListModel.ChannelBean.class, CopyOptions.create().ignoreCase());
model.setList(channelBeans);
}
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);
}

@ -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);

@ -4,10 +4,7 @@ import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.model.DyLineTreeAndChannelListModel;
import com.shxy.xymanager_common.model.TerminalChannelListModel;
import com.shxy.xymanager_common.model.TerminalChannelMapperListModel;
import com.shxy.xymanager_common.vo.TerminalChannelIdListVo;
import com.shxy.xymanager_common.vo.TerminalChannelVo;
import com.shxy.xymanager_common.vo.TerminalIdVo;
import com.shxy.xymanager_common.vo.UpdateTerminalChannelVo;
import com.shxy.xymanager_common.vo.*;
/**
*
@ -42,7 +39,7 @@ public interface TerminalChannelService {
*
* @return
*/
ServiceBody<TerminalChannelListModel> getChannelList();
ServiceBody<TerminalChannelListModel> getChannelList(PageVo vo);
/**
*

Loading…
Cancel
Save