Przeglądaj źródła

摄像头信息获取

温红权 9 lat temu
rodzic
commit
8ee21ba7f7

+ 39 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/bean/Webcam.java

@@ -0,0 +1,39 @@
+package com.xintong.visualinspection.bean;
+
+import java.util.Date;
+
+import lombok.Data;
+
+@Data
+public class Webcam {
+	private Integer id;
+	private String device_id;
+	private String device_description;
+	private String line_code;
+	private String high_speedname;
+	private String direction;
+	private String section_belongs;
+	private String management_unit;
+	private String mileage_stake;
+	private String brand;
+	private String specification;
+	private String maintenance_unit;
+	private Float longitude;
+	private Float latitude;
+	private Float longitude_supermap;
+	private Float latitude_supermap;
+	private String mileage_stake_supermap;
+	private Integer location;
+	private String type;
+	private String device_status;
+	private String remark;
+	private String devicemangetype;
+	private Date update_time;
+	private String device_id_pre;
+	private String devicenumber;
+	private String ip;
+	private Integer port;
+	private Integer channel;
+}
+
+

+ 0 - 4
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/UserController.java

@@ -29,10 +29,6 @@ import com.xintong.visualinspection.service.UserService;
  * @author wenhongquan
  *
  */
-/**
- * @author wenhongquan
- *
- */
 @RestController
 @RequestMapping("/user")
 public class UserController extends BaseController {

+ 69 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/WebcamController.java

@@ -0,0 +1,69 @@
+package com.xintong.visualinspection.controller;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.xintong.visualinspection.bean.User;
+import com.xintong.visualinspection.bean.Webcam;
+import com.xintong.visualinspection.err.BusinessException;
+import com.xintong.visualinspection.service.WebcamService;
+
+/**
+ * 文件名:TestController
+ * 版本信息:日期:2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
+ */
+/**
+ * @author wenhongquan
+ *
+ */
+@RestController
+@RequestMapping("/webcam")
+public class WebcamController extends BaseController {
+
+	@Autowired
+	private WebcamService webcamService;
+
+	@RequestMapping(value = "/getAllVideo/{page}/{size}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
+	public String getAllVideo(@PathVariable Integer page, @PathVariable Integer size) {
+		try {
+			PageHelper.startPage(page, size);
+			List<Webcam> webcams = webcamService.getAll();
+
+			return returnResult(0, "获取成功", new PageInfo(webcams));
+		} catch (Exception e) {
+			throw new BusinessException(20001);
+		}
+	}
+
+	@RequestMapping(value = "/getVideoByDeptAndLane/{page}/{size}", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
+	public String getVideoByDeptAndLane(@PathVariable Integer page, @PathVariable Integer size,
+			@RequestBody Webcam webcam) {
+		try {
+			PageHelper.startPage(page, size);
+			List<Webcam> webcams = webcamService.getWebcams(webcam);
+
+			return returnResult(0, "获取成功", new PageInfo(webcams));
+		} catch (Exception e) {
+			throw new BusinessException(20001);
+		}
+	}
+
+	@RequestMapping(value = "/getVideoById/{webcamid}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
+	public String getVideoById(@PathVariable Integer webcamid) {
+		try {
+			Webcam u = webcamService.getOne(webcamid);
+			return returnResult(0, "获取成功", u);
+		} catch (Exception e) {
+			throw new BusinessException(20001);
+		}
+	}
+
+}

+ 19 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/dao/cluster/WebcamDao.java

@@ -0,0 +1,19 @@
+package com.xintong.visualinspection.dao.cluster;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import com.xintong.visualinspection.bean.Webcam;
+
+/**
+ * 文件名:UserInfoDao
+ * 版本信息:日期:2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
+ */
+@Mapper
+public interface WebcamDao {
+    public List<Webcam> getAll();
+    public Webcam getOne(Integer id);
+    public List<Webcam> getWebcams(Webcam webcam);
+
+}

+ 84 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/cluster/WebcamMapper.xml

@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.xintong.visualinspection.dao.cluster.WebcamDao">
+	<resultMap id="BaseResultMap" type="com.xintong.visualinspection.bean.Webcam">
+		<id column="id" property="id" jdbcType="INTEGER" />
+		<result column="device_id" property="device_id" jdbcType="VARCHAR" />
+		<result column="device_description" property="device_description"
+			jdbcType="VARCHAR" />
+		<result column="line_code" property="line_code"
+			jdbcType="VARCHAR" />
+		<result column="high_speedname" property="high_speedname"
+			jdbcType="VARCHAR" />
+		<result column="direction" property="direction"
+			jdbcType="VARCHAR" />
+		<result column="section_belongs" property="section_belongs"
+			jdbcType="VARCHAR" />
+		<result column="management_unit" property="management_unit"
+			jdbcType="VARCHAR" />
+		<result column="mileage_stake" property="mileage_stake"
+			jdbcType="VARCHAR" />
+		<result column="brand" property="brand"
+			jdbcType="VARCHAR" />
+		<result column="specification" property="specification"
+			jdbcType="VARCHAR" />
+		<result column="longitude" property="longitude"
+			jdbcType="FLOAT" />
+		<result column="latitude" property="latitude"
+			jdbcType="FLOAT" />
+		<result column="longitude_supermap" property="longitude_supermap"
+			jdbcType="FLOAT" />
+		<result column="latitude_supermap" property="latitude_supermap"
+			jdbcType="FLOAT" />
+		<result column="mileage_stake_supermap" property="mileage_stake_supermap"
+			jdbcType="VARCHAR" />
+		<result column="location" property="location"
+			jdbcType="INTEGER" />
+		<result column="type" property="type"
+			jdbcType="VARCHAR" />
+		<result column="device_status" property="device_status"
+			jdbcType="VARCHAR" />
+		<result column="remark" property="remark"
+			jdbcType="VARCHAR" />
+		<result column="devicemangetype" property="devicemangetype"
+			jdbcType="VARCHAR" />
+		<result column="update_time" property="update_time"
+			jdbcType="DATE" />
+		<result column="device_id_pre" property="device_id_pre"
+			jdbcType="VARCHAR" />
+		<result column="devicenumber" property="devicenumber"
+			jdbcType="VARCHAR" />
+		<result column="ip" property="ip"
+			jdbcType="VARCHAR" />
+		<result column="port" property="port"
+			jdbcType="INTEGER" />
+		<result column="channel" property="channel"
+			jdbcType="INTEGER" />
+	
+	</resultMap>
+	
+
+	<select id="getAll" resultMap="BaseResultMap">
+		SELECT
+		*
+		FROM
+		t_br_layer_webcam
+	</select>
+
+	<select id="getOne" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+		SELECT
+		*
+		FROM t_br_layer_webcam
+		WHERE id = #{id}
+	</select>
+
+	<select id="getWebcams" parameterType="com.xintong.visualinspection.bean.Webcam"
+		resultMap="BaseResultMap">
+		SELECT
+		*
+		FROM t_br_layer_webcam
+		where 1=1
+		<if test="management_unit != null">and management_unit = #{management_unit} </if>
+		<if test="location != null and location != 0">and location = #{location} </if>
+	</select>
+</mapper>

+ 15 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/WebcamService.java

@@ -0,0 +1,15 @@
+package com.xintong.visualinspection.service;
+
+import java.util.List;
+
+import com.xintong.visualinspection.bean.Webcam;
+
+/**
+ * 文件名:UserService
+ * 版本信息:日期:2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
+ */
+public interface WebcamService {
+    public List<Webcam> getAll();
+    public Webcam getOne(Integer id);
+    public List<Webcam> getWebcams(Webcam webcam);
+}

+ 47 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/WebcamServiceImpl.java

@@ -0,0 +1,47 @@
+package com.xintong.visualinspection.service.impl;
+
+import java.util.List;
+
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.xintong.visualinspection.bean.Webcam;
+import com.xintong.visualinspection.dao.cluster.WebcamDao;
+import com.xintong.visualinspection.service.BaseService;
+import com.xintong.visualinspection.service.UserService;
+import com.xintong.visualinspection.service.WebcamService;
+
+/**
+ * 文件名:UserServiceImpl
+ * 版本信息:日期:2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
+ */
+@Service
+public class WebcamServiceImpl extends BaseService implements WebcamService {
+
+    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(UserService.class);
+
+
+    @Autowired
+    private WebcamDao webcamDao;
+
+
+	@Override
+	public List<Webcam> getAll() {
+		return webcamDao.getAll();
+	}
+
+
+	@Override
+	public Webcam getOne(Integer id) {
+	    return webcamDao.getOne(id);
+	}
+
+
+	@Override
+	public List<Webcam> getWebcams(Webcam webcam) {
+		return webcamDao.getWebcams(webcam);
+	}
+
+
+}

+ 28 - 8
VisualInspection_server/temp

@@ -1,8 +1,28 @@
-ID` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
-  `ORGANNAME` varchar(150) DEFAULT NULL COMMENT '组织机构名称',
-  `REMARK` varchar(80) DEFAULT NULL COMMENT '备注',
-  `PARENTID` int(11) DEFAULT NULL COMMENT '父节点ID',
-  `CLASSTYPE` varchar(80) DEFAULT NULL COMMENT '班次类型  (1 两班 2 三班)',
-  `ORGANCODE` varchar(80) DEFAULT NULL COMMENT '机构编码',
-  `ISSHOW` varchar(10) DEFAULT NULL COMMENT '是否显示,0:不显示,1:显示',
-  `DEPTYPE` varchar(2) DEFAULT NULL COMMENT '单位类型 10 公司 20 养护 30 交警 40 路政 50 外协',
+`ID` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
+`DEVICE_ID` varchar(30) DEFAULT NULL COMMENT '设备编号',
+`DEVICE_DESCRIPTION` varchar(30) DEFAULT NULL COMMENT '设备描述',
+`LINE_CODE` varchar(30) DEFAULT NULL COMMENT '路线代码',
+`HIGH_SPEEDNAME` varchar(30) DEFAULT NULL COMMENT '高速名称',
+`DIRECTION` varchar(30) DEFAULT NULL COMMENT '方向',
+`SECTION_BELONGS` varchar(30) DEFAULT NULL COMMENT '所属路段',
+`MANAGEMENT_UNIT` varchar(80) DEFAULT NULL COMMENT '管理单位',
+`MILEAGE_STAKE` varchar(30) DEFAULT NULL COMMENT '里程桩号',
+`BRAND` varchar(30) DEFAULT NULL COMMENT '品牌',
+`SPECIFICATION` varchar(30) DEFAULT NULL COMMENT '规格型号',
+`MAINTENANCE_UNIT` varchar(80) DEFAULT NULL COMMENT '维护单位',
+`LONGITUDE` float(11,8) DEFAULT NULL COMMENT '经度',
+`LATITUDE` float(11,8) DEFAULT NULL COMMENT '纬度',
+`LONGITUDE_SUPERMAP` float(11,8) DEFAULT NULL,
+`LATITUDE_SUPERMAP` float(11,8) DEFAULT NULL,
+`MILEAGE_STAKE_SUPERMAP` varchar(30) DEFAULT NULL,
+`LOCATION` int(11) DEFAULT NULL COMMENT '所属位置',
+`TYPE` varchar(10) DEFAULT NULL COMMENT '类型',
+`DEVICE_STATUS` varchar(10) DEFAULT NULL COMMENT '设备状态(1正常,2故障)',
+`REMARK` varchar(300) DEFAULT NULL COMMENT '备注',
+`DEVICEMANGETYPE` varchar(2) DEFAULT NULL,
+`UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间',
+`DEVICE_ID_PRE` varchar(30) DEFAULT NULL COMMENT '联网需要的ID',
+`DEVICENUMBER` varchar(30) DEFAULT NULL,
+`IP` varchar(30) DEFAULT NULL COMMENT 'IP',
+`PORT` int(11) DEFAULT NULL COMMENT '端口',
+`CHANNEL` int(11) DEFAULT NULL COMMENT '通道号',