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

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.vo.TerminalAndChannelIdAndTimeVo;
import com.shxy.xymanager_common.vo.TerminalPhotoVo;
import com.shxy.xymanager_service.interaction.Cma;
import com.shxy.xymanager_service.service.TerminalPhotoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@ -1,23 +1,13 @@
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.TerminalScheduleRuleDao;
import com.shxy.xymanager_dao.dao.TerminalsDao;
import com.shxy.xymanager_service.interaction.Cma;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.sql.Time;
import java.util.Date;
import java.util.List;
@SpringBootTest
class XymanagerAdminApplicationTests {
@ -25,7 +15,6 @@ class XymanagerAdminApplicationTests {
TerminalsDao terminalsDao;
@Autowired
TerminalScheduleRuleDao terminalScheduleRuleDao;
@Autowired
LinesDao linesDao;
@ -61,6 +50,11 @@ class XymanagerAdminApplicationTests {
// }
// 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 Integer scheduleid;
private static final long serialVersionUID = 1L;
}

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

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

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

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

@ -10,7 +10,7 @@ import java.util.List;
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);

@ -136,9 +136,17 @@
<!-- &lt;!&ndash; <property name="useActualColumnNames" value="false"/>&ndash;&gt;-->
<!-- </table>-->
<table tableName="terminal_channel_mapper"
domainObjectName="TerminalChannelMapper"
mapperName="TerminalChannelMapperDao"
<!-- <table tableName="terminal_channel_mapper"-->
<!-- domainObjectName="TerminalChannelMapper"-->
<!-- 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"
enableSelectByExample="false" selectByExampleQueryId="false">
<!-- <property name="useActualColumnNames" value="false"/>-->

@ -37,6 +37,7 @@
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.dto.TerminalChannelsDto">
<result column="channel_id" jdbcType="INTEGER" property="id"/>
<result column="channel_name" jdbcType="VARCHAR" property="name"/>
<result column="schedule_id" jdbcType="INTEGER" property="scheduleid"/>
</collection>
</collection>
</collection>
@ -73,30 +74,58 @@
</if>
</select>
<select id="selectAllAndChannelByTermid" resultMap="LineAndTerminalMap">
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
from `lines` x,
terminals y,
dy_level z,
terminal_channel_mapper j,
terminal_channels k
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 x.status = #{status} and y.status = #{status} and z.status = #{status} and k.status = #{status}
<!-- 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 `lines` x,-->
<!-- terminals y,-->
<!-- dy_level z,-->
<!-- terminal_channel_mapper j,-->
<!-- terminal_channels k,-->
<!-- 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">
and y.id = #{termid}
</if>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">

@ -23,7 +23,14 @@
select
<include refid="Base_Column_List"/>
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 id="getLatestPhoto" resultMap="BaseResultMap">

@ -5,6 +5,7 @@ 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.entity.TerminalPositions;
import com.shxy.xymanager_common.entity.TerminalStatus;
import com.shxy.xymanager_common.entity.Terminals;
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.TerminalListModel;
import com.shxy.xymanager_common.page.PageUtils;
import com.shxy.xymanager_common.util.MyDateUtils;
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.TerminalsDao;
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.stereotype.Service;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -39,6 +43,8 @@ public class TerminalGpsServiceImpl implements TerminalGpsService {
@Autowired
private TerminalStatusDao terminalStatusDao;
@Autowired
private TerminalPositionsDao terminalPositionsDao;
// @Autowired
// private Cma cma;
@ -79,6 +85,7 @@ public class TerminalGpsServiceImpl implements TerminalGpsService {
/**
* GPS
*
* @param vo
* @return
*/
@ -87,10 +94,16 @@ public class TerminalGpsServiceImpl implements TerminalGpsService {
TerminalGpsModel model = new TerminalGpsModel();
// Cma cma = new Cma("47.96.238.157", 6891);
// boolean b = cma.requestGpsInfo(vo.getTermid().toString());
model.setLatitude(300);
model.setLongitude(200);
model.setTermid(vo.getTermid());
model.setRadius(10);
TerminalPositions bean = terminalPositionsDao.selectByPrimaryKey(vo.getTermid());
if (!BeanUtil.isEmpty(bean)) {
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;
if (b) {
return Asserts.success(model);

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

Loading…
Cancel
Save