时间拍照表和装置管理状态

jni
liuguijing 2 years ago
parent 4f9ee65a9f
commit e2121bbd92

@ -9,7 +9,6 @@ import com.shxy.xymanager_common.entity.TerminalPhoto;
import com.shxy.xymanager_common.model.TerminalPhotoListModel; import com.shxy.xymanager_common.model.TerminalPhotoListModel;
import com.shxy.xymanager_common.vo.TerminalAndChannelIdAndTimeVo; import com.shxy.xymanager_common.vo.TerminalAndChannelIdAndTimeVo;
import com.shxy.xymanager_common.vo.TerminalPhotoVo; import com.shxy.xymanager_common.vo.TerminalPhotoVo;
import com.shxy.xymanager_service.interaction.Cma;
import com.shxy.xymanager_service.service.TerminalPhotoService; import com.shxy.xymanager_service.service.TerminalPhotoService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;

@ -1,23 +1,13 @@
package com.shxy.xymanager_admin; package com.shxy.xymanager_admin;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.shxy.xymanager_common.entity.Lines;
import com.shxy.xymanager_common.entity.TerminalScheduleRule;
import com.shxy.xymanager_common.entity.Terminals;
import com.shxy.xymanager_common.util.MyDateUtils;
import com.shxy.xymanager_dao.dao.LinesDao; import com.shxy.xymanager_dao.dao.LinesDao;
import com.shxy.xymanager_dao.dao.TerminalScheduleRuleDao; import com.shxy.xymanager_dao.dao.TerminalScheduleRuleDao;
import com.shxy.xymanager_dao.dao.TerminalsDao; import com.shxy.xymanager_dao.dao.TerminalsDao;
import com.shxy.xymanager_service.interaction.Cma;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import java.sql.Time;
import java.util.Date;
import java.util.List;
@SpringBootTest @SpringBootTest
class XymanagerAdminApplicationTests { class XymanagerAdminApplicationTests {
@ -25,7 +15,6 @@ class XymanagerAdminApplicationTests {
TerminalsDao terminalsDao; TerminalsDao terminalsDao;
@Autowired @Autowired
TerminalScheduleRuleDao terminalScheduleRuleDao; TerminalScheduleRuleDao terminalScheduleRuleDao;
@Autowired @Autowired
LinesDao linesDao; LinesDao linesDao;
@ -61,6 +50,11 @@ class XymanagerAdminApplicationTests {
// } // }
// System.out.println(dateTime.toString()); // System.out.println(dateTime.toString());
Cma cma = new Cma("47.96.238.157", 6891);
boolean b = cma.requestCapture("XYH10H00000000022", (short) 1, (short) 255, (short) 0);
System.out.println(b);
// CmaDLL cmaDLL = new CmaDLL();
} }
} }

@ -10,6 +10,8 @@ public class TerminalChannelsDto implements Serializable {
private String name; private String name;
private Integer scheduleid;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

@ -77,6 +77,9 @@ public class DyLineTreeAndChannelListModel implements Serializable {
@ApiModelProperty(value = "通道名称", example = "123456") @ApiModelProperty(value = "通道名称", example = "123456")
private String name; private String name;
@ApiModelProperty(value = "拍照规则编号", example = "123456")
private Integer scheduleid;
} }
} }

@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -26,4 +27,7 @@ public class TerminalGpsModel implements Serializable {
@ApiModelProperty(value = "经度", example = "123456") @ApiModelProperty(value = "经度", example = "123456")
private double longitude; private double longitude;
@ApiModelProperty(value = "修改时间", example = "123456")
private Date updatetime;
} }

@ -18,6 +18,9 @@ public class TerminalPhotoListModel implements Serializable {
@ApiModelProperty(value = "时间", example = "[]") @ApiModelProperty(value = "时间", example = "[]")
private Date time; private Date time;
@ApiModelProperty(value = "照片数量", example = "123")
private Integer num;
@ApiModelProperty(value = "照片对象", example = "[]") @ApiModelProperty(value = "照片对象", example = "[]")
private List<PhotoBean> list; private List<PhotoBean> list;

@ -7,6 +7,7 @@ import lombok.Data;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.Date; import java.util.Date;
import java.util.List;
@Data @Data
@ApiModel(value = "装置和通道编号和查询时间", description = "装置和通道编号和查询时间描述") @ApiModel(value = "装置和通道编号和查询时间", description = "装置和通道编号和查询时间描述")
@ -18,7 +19,7 @@ public class TerminalAndChannelIdAndTimeVo {
@NotNull(message = "通道编号不能缺少") @NotNull(message = "通道编号不能缺少")
@ApiModelProperty(value = "通道编号", example = "123455") @ApiModelProperty(value = "通道编号", example = "123455")
private Integer channelid; private List<Integer> channelid;
@NotNull(message = "查询时间不能缺少") @NotNull(message = "查询时间不能缺少")
@ApiModelProperty(value = "查询时间", example = "123455") @ApiModelProperty(value = "查询时间", example = "123455")

@ -10,7 +10,7 @@ import java.util.List;
public interface TerminalPhotoDao { public interface TerminalPhotoDao {
List<TerminalPhoto> selectPhotoList(@Param("terminalid") Integer terminalid, @Param("channelid") Integer channelid, @Param("starttime") BigInteger starttime, @Param("endtime") BigInteger endtime); List<TerminalPhoto> selectPhotoList(@Param("terminalid") Integer terminalid, @Param("channelid") List<Integer> channelid, @Param("starttime") BigInteger starttime, @Param("endtime") BigInteger endtime);
int deleteByPrimaryKey(Long id); int deleteByPrimaryKey(Long id);

@ -136,9 +136,17 @@
<!-- &lt;!&ndash; <property name="useActualColumnNames" value="false"/>&ndash;&gt;--> <!-- &lt;!&ndash; <property name="useActualColumnNames" value="false"/>&ndash;&gt;-->
<!-- </table>--> <!-- </table>-->
<table tableName="terminal_channel_mapper" <!-- <table tableName="terminal_channel_mapper"-->
domainObjectName="TerminalChannelMapper" <!-- domainObjectName="TerminalChannelMapper"-->
mapperName="TerminalChannelMapperDao" <!-- mapperName="TerminalChannelMapperDao"-->
<!-- enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
<!-- enableSelectByExample="false" selectByExampleQueryId="false">-->
<!-- &lt;!&ndash; <property name="useActualColumnNames" value="false"/>&ndash;&gt;-->
<!-- </table>-->
<table tableName="terminal_positions"
domainObjectName="TerminalPositions"
mapperName="TerminalPositionsDao"
enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false"> enableSelectByExample="false" selectByExampleQueryId="false">
<!-- <property name="useActualColumnNames" value="false"/>--> <!-- <property name="useActualColumnNames" value="false"/>-->

@ -37,6 +37,7 @@
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.dto.TerminalChannelsDto"> <collection property="list" javaType="list" ofType="com.shxy.xymanager_common.dto.TerminalChannelsDto">
<result column="channel_id" jdbcType="INTEGER" property="id"/> <result column="channel_id" jdbcType="INTEGER" property="id"/>
<result column="channel_name" jdbcType="VARCHAR" property="name"/> <result column="channel_name" jdbcType="VARCHAR" property="name"/>
<result column="schedule_id" jdbcType="INTEGER" property="scheduleid"/>
</collection> </collection>
</collection> </collection>
</collection> </collection>
@ -73,46 +74,74 @@
</if> </if>
</select> </select>
<select id="selectAllAndChannelByTermid" resultMap="LineAndTerminalMap"> <select id="selectAllAndChannelByTermid" resultMap="LineAndTerminalMap">
select <!-- select-->
z.id as id, <!-- z.id as id,-->
z.name as name, <!-- z.name as name,-->
z.dy_value as dyvalue, <!-- z.dy_value as dyvalue,-->
x.id as line_id, <!-- x.id as line_id,-->
x.name as line_name, <!-- x.name as line_name,-->
x.bs_manufacturer as bs_manufacturer, <!-- x.bs_manufacturer as bs_manufacturer,-->
y.id as term_id, <!-- y.id as term_id,-->
y.tower_id as tower_id, <!-- y.tower_id as tower_id,-->
y.cmdid as cmdid, <!-- y.cmdid as cmdid,-->
y.display_name as display_name, <!-- y.display_name as display_name,-->
k.id as channel_id, <!-- k.id as channel_id,-->
k.channel_name as channel_name <!-- k.channel_name as channel_name,-->
from `lines` x, <!-- l.schedule_id as schedule_id-->
terminals y, <!-- from `lines` x,-->
dy_level z, <!-- terminals y,-->
terminal_channel_mapper j, <!-- dy_level z,-->
terminal_channels k <!-- terminal_channel_mapper j,-->
where z.id = x.dy_level_id and x.id = y.line_id and j.term_id = y.id and j.channel_id = k.id <!-- terminal_channels k,-->
and x.status = #{status} and y.status = #{status} and z.status = #{status} and k.status = #{status} <!-- terminal_schedulemapper l-->
<!-- where z.id = x.dy_level_id and x.id = y.line_id and j.term_id = y.id and j.channel_id = k.id and y.id = l.term_id and j.channel_id = l.channel_id-->
<!-- and x.status = #{status} and y.status = #{status} and z.status = #{status} and k.status = #{status}-->
<!-- <if test="termid != null">-->
<!-- and y.id = #{termid}-->
<!-- </if>-->
SELECT
z.id AS id,
z.name AS name,
z.dy_value AS dyvalue,
x.id AS line_id,
x.name AS line_name,
x.bs_manufacturer AS bs_manufacturer,
y.id AS term_id,
y.tower_id AS tower_id,
y.cmdid AS cmdid,
y.display_name AS display_name,
k.id AS channel_id,
k.channel_name AS channel_name,
l.schedule_id AS schedule_id
FROM
(((((dy_level z
left JOIN `lines` x ON z.id = x.dy_level_id)
left JOIN terminals y ON x.id = y.line_id)
left JOIN terminal_channel_mapper j ON j.term_id = y.id)
left JOIN terminal_channels k ON j.channel_id = k.id)
left JOIN terminal_schedulemapper l ON j.channel_id = l.channel_id)
where
x.status = #{status} and y.status = #{status} and z.status = #{status} and k.status = #{status}
<if test="termid != null"> <if test="termid != null">
and y.id = #{termid} and y.id = #{termid}
</if> </if>
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from terminal_channels delete from terminal_channels
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</delete> </delete>
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.TerminalChannels"> <insert id="insert" parameterType="com.shxy.xymanager_common.entity.TerminalChannels">
insert into terminal_channels (id, term_id, insert into terminal_channels (id, term_id,
channel_name, max_resolution_width, max_resolution_height channel_name, max_resolution_width, max_resolution_height
) )
values (#{id,jdbcType=INTEGER}, #{termId,jdbcType=INTEGER}, values (#{id,jdbcType=INTEGER}, #{termId,jdbcType=INTEGER},
#{channelName,jdbcType=VARCHAR}, #{maxResolutionWidth,jdbcType=INTEGER}, #{maxResolutionHeight,jdbcType=INTEGER} #{channelName,jdbcType=VARCHAR}, #{maxResolutionWidth,jdbcType=INTEGER}, #{maxResolutionHeight,jdbcType=INTEGER}
) )
</insert> </insert>
<insert id="insertList" > <insert id="insertList">
insert into terminal_channels insert into terminal_channels
(id,channel_name,max_resolution_width,max_resolution_height,status,create_time,update_time) (id,channel_name,max_resolution_width,max_resolution_height,status,create_time,update_time)
VALUES VALUES
@ -198,7 +227,7 @@
</set> </set>
where id in where id in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=","> <foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item.id} #{item.id}
</foreach> </foreach>
</update> </update>
</mapper> </mapper>

@ -23,7 +23,14 @@
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from terminal_photos from terminal_photos
where term_id = #{terminalid} and channel_id = #{channelid} and photo_time between #{starttime} and #{endtime} where term_id = #{terminalid} and photo_time between #{starttime} and #{endtime}
<if test="channelid != null">
and channel_id in
<foreach collection="channelid" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
order by photo_time desc
</select> </select>
<select id="getLatestPhoto" resultMap="BaseResultMap"> <select id="getLatestPhoto" resultMap="BaseResultMap">

@ -5,6 +5,7 @@ import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.shxy.xymanager_common.bean.ServiceBody; import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.entity.TerminalPositions;
import com.shxy.xymanager_common.entity.TerminalStatus; import com.shxy.xymanager_common.entity.TerminalStatus;
import com.shxy.xymanager_common.entity.Terminals; import com.shxy.xymanager_common.entity.Terminals;
import com.shxy.xymanager_common.enums.CommonStatus; import com.shxy.xymanager_common.enums.CommonStatus;
@ -12,7 +13,9 @@ import com.shxy.xymanager_common.exception.Asserts;
import com.shxy.xymanager_common.model.TerminalGpsModel; import com.shxy.xymanager_common.model.TerminalGpsModel;
import com.shxy.xymanager_common.model.TerminalListModel; import com.shxy.xymanager_common.model.TerminalListModel;
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.vo.*; import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_dao.dao.TerminalPositionsDao;
import com.shxy.xymanager_dao.dao.TerminalStatusDao; import com.shxy.xymanager_dao.dao.TerminalStatusDao;
import com.shxy.xymanager_dao.dao.TerminalsDao; import com.shxy.xymanager_dao.dao.TerminalsDao;
import com.shxy.xymanager_service.interaction.Cma; import com.shxy.xymanager_service.interaction.Cma;
@ -22,6 +25,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigInteger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -39,6 +43,8 @@ public class TerminalGpsServiceImpl implements TerminalGpsService {
@Autowired @Autowired
private TerminalStatusDao terminalStatusDao; private TerminalStatusDao terminalStatusDao;
@Autowired
private TerminalPositionsDao terminalPositionsDao;
// @Autowired // @Autowired
// private Cma cma; // private Cma cma;
@ -79,6 +85,7 @@ public class TerminalGpsServiceImpl implements TerminalGpsService {
/** /**
* GPS * GPS
*
* @param vo * @param vo
* @return * @return
*/ */
@ -87,10 +94,16 @@ public class TerminalGpsServiceImpl implements TerminalGpsService {
TerminalGpsModel model = new TerminalGpsModel(); TerminalGpsModel model = new TerminalGpsModel();
// Cma cma = new Cma("47.96.238.157", 6891); // Cma cma = new Cma("47.96.238.157", 6891);
// boolean b = cma.requestGpsInfo(vo.getTermid().toString()); // boolean b = cma.requestGpsInfo(vo.getTermid().toString());
model.setLatitude(300); TerminalPositions bean = terminalPositionsDao.selectByPrimaryKey(vo.getTermid());
model.setLongitude(200);
model.setTermid(vo.getTermid()); if (!BeanUtil.isEmpty(bean)) {
model.setRadius(10); model.setRadius(bean.getRadius());
model.setLongitude(bean.getLongitude());
model.setLatitude(bean.getLatitude());
model.setTermid(bean.getTermId());
BigInteger updatetime = MyDateUtils.TimeSecond2MillSecond(bean.getUpdateTime().longValue());
model.setUpdatetime(MyDateUtils.date(updatetime.longValue()));
}
boolean b = true; boolean b = true;
if (b) { if (b) {
return Asserts.success(model); return Asserts.success(model);

@ -56,6 +56,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
List<TerminalPhoto> list = terminalPhotoDao.selectPhotoList(vo.getTerminalid(), vo.getChannelid(), start, end); List<TerminalPhoto> list = terminalPhotoDao.selectPhotoList(vo.getTerminalid(), vo.getChannelid(), start, end);
boolean empty = CollectionUtil.isEmpty(list); boolean empty = CollectionUtil.isEmpty(list);
model.setTime(vo.getTime()); model.setTime(vo.getTime());
model.setNum(list.size());
if (empty) { if (empty) {
model.setList(new ArrayList<>()); model.setList(new ArrayList<>());
} else { } else {
@ -74,7 +75,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
BigInteger phototime = MyDateUtils.TimeSecond2MillSecond(item.getPhotoTime().longValue()); BigInteger phototime = MyDateUtils.TimeSecond2MillSecond(item.getPhotoTime().longValue());
photoBean.setPhotoTime(MyDateUtils.date(phototime.longValue())); photoBean.setPhotoTime(MyDateUtils.date(phototime.longValue()));
BigInteger rectime = MyDateUtils.TimeSecond2MillSecond(item.getRecvTime().longValue()); BigInteger rectime = MyDateUtils.TimeSecond2MillSecond(item.getRecvTime().longValue());
photoBean.setPhotoTime(MyDateUtils.date(rectime.longValue())); photoBean.setRecvTime(MyDateUtils.date(rectime.longValue()));
beans.add(photoBean); beans.add(photoBean);
} }
model.setList(beans); model.setList(beans);

Loading…
Cancel
Save