Default Changelist

This commit is contained in:
XinYi Song 2022-03-04 09:44:06 +08:00
parent 352cc40c5e
commit 736d5a8acc
8 changed files with 400 additions and 0 deletions

View File

@ -0,0 +1,45 @@
package com.xkrs.controller;
import com.xkrs.dao.CameraDao;
import com.xkrs.model.entity.CameraInformation;
import com.xkrs.service.CameraService;
import com.xkrs.service.FireService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author: XinYi Song
* @Date: 2022/3/3 11:56
*/
@RestController
public class CameraController {
@Resource
private CameraService cameraService;
@Resource
private CameraDao cameraDao;
@GetMapping("/Select")
public List<CameraInformation> getCameraInformation(){
return cameraService.SelectCameraAll();
}
@GetMapping("/Insert")
public boolean insertCameraInformation(CameraInformation cameraInformation){
try {
cameraService.InsertCamera(cameraInformation);
return true;
}
catch (Exception e){
return false;
}
}
}

View File

@ -99,6 +99,11 @@ public class TestController {
JsonNode jsonNode1 = daily.get(0); JsonNode jsonNode1 = daily.get(0);
return jsonNode1; return jsonNode1;
}
@GetMapping("/getmanagement")
public JsonNode getManagement(){
} }
@PostMapping("/updateVideoPath") @PostMapping("/updateVideoPath")

View File

@ -0,0 +1,28 @@
package com.xkrs.dao;
import com.xkrs.model.entity.Alarm;
import com.xkrs.model.entity.CameraInformation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
/**
* @Author: XinYi Song
* @Date: 2022/3/3 10:46
*/
public interface CameraDao extends JpaRepository<CameraInformation,Long>{
/**
* 查询摄像头信息
*/
/*@Query(value = "select * from camera_information",nativeQuery = true)
String selectCameraInformation();*/
/**
*将查询到的摄像头信息存入数据库中
*/
/* @Query(value = "INSERT INTO camera_information('camera_id','camera_position','camera_state','camera_type','camera_time','camera_name') " +
" VALUES('?1','?2','?3','?4','?5','?6')",nativeQuery = true)*/
//String insertCameraInformation(CameraInformation information);
}

View File

@ -0,0 +1,109 @@
package com.xkrs.model.entity;
import javax.persistence.*;
/**
* @Author: XinYi Song
* @Date: 2022/2/18 11:37
*/
@Entity
@Table(name = "CameraInformation")
public class CameraInformation {
/**
* 主键id
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "alarm_seq_gen")
@SequenceGenerator(name = "alarm_seq_gen", sequenceName = "alarm_id_seq",allocationSize = 1)
private Integer id;
/**
* 摄像头id
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String cameraId;
/**
* 位置
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String cameraPosition;
/**
* 状态
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String cameraState;
/**
* 类型
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String cameraType;
/**
* 安装时间
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String cameraTime;
/**
* 名称
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String cameraName;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCameraId() {
return cameraId;
}
public void setCameraId(String cameraId) {
this.cameraId = cameraId;
}
public String getCameraPosition() {
return cameraPosition;
}
public void setCameraPosition(String cameraPosition) {
this.cameraPosition = cameraPosition;
}
public String getCameraState() {
return cameraState;
}
public void setCameraState(String cameraState) {
this.cameraState = cameraState;
}
public String getCameraType() {
return cameraType;
}
public void setCameraType(String cameraType) {
this.cameraType = cameraType;
}
public String getCameraTime() {
return cameraTime;
}
public void setCameraTime(String cameraTime) {
this.cameraTime = cameraTime;
}
public String getCameraName() {
return cameraName;
}
public void setCameraName(String cameraName) {
this.cameraName = cameraName;
}
}

View File

@ -0,0 +1,130 @@
package com.xkrs.model.entity;
import javax.persistence.*;
/**
* @Author: XinYi Song
* @Date: 2022/3/4 8:23
*/
public class DeviceManagement {
/**
* 主键id
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "equipment_seq_gen")
@SequenceGenerator(name = "equipment_seq_gen", sequenceName = "equipment_id_seq",allocationSize = 1)
private Integer id;
/**
* 设备名称
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String deviceName;
/**
* 设备编码
*/
@Column(length = 32, columnDefinition = "varchar(65)")
private String deviceCode;
/**
* 设备唯一标识码
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String deviceSn;
/**
* 设备大类
*/
@Column(length = 32, columnDefinition = "varchar(65)")
private int deviceCategory;
/**
* 设备小类
*/
@Column(length = 32, columnDefinition = "varchar(65)")
private int deviceType;
/**
* 厂商类型
*/
@Column(length = 32, columnDefinition = "varchar(65)")
private String deviceManufacturer;
/**
* 设备型号
*/
@Column(length = 32, columnDefinition = "varchar(65)")
private String deviceModel;
/**
* 设备ip
*/
@Column(length = 32, columnDefinition = "varchar(65)")
private String deviceIp;
/**
* 设备端口
*/
@Column(length = 32, columnDefinition = "varchar(65)")
private int devicePort;
/**
* 设备所属组织
*/
@Column(length = 32, columnDefinition = "varchar(65)")
private String ownerCode;
/**
* 添加方式
*/
@Column(length = 32, columnDefinition = "varchar(65)")
private String loginType;
/**
* 登录名称
*/
@Column(length = 32, columnDefinition = "varchar(65)")
private String loginName;
/**
* 登录密码
*/
@Column(length = 32, columnDefinition = "varchar(65)")
private String loginPassword;
/**
* 主动注册代理端口
*/
@Column(length = 32, columnDefinition = "varchar(65)")
private int registProxyPort;
/**
* 主动注册服务器编码
*/
@Column(length = 32, columnDefinition = "varchar(65)")
private String registDeviceCode;
/**
* 通道描述
*/
@Column(length = 32, columnDefinition = "varchar(65)")
private String memo;
/**
* 在线状态
*/
@Column(length = 32, columnDefinition = "varchar(65)")
private int isOnline;
/**
* 光栅图
*/
@Column(length = 32, columnDefinition = "varchar(65)")
private long mapId;
/**
* 经度
*/
@Column(length = 32, columnDefinition = "varchar(65)")
private String gpsX;
/**
* 纬度
*/
@Column(length = 32, columnDefinition = "varchar(65)")
private String gpsY;
/**
* 设备所属子系统
*/
@Column(length = 32, columnDefinition = "varchar(65)")
private String subSystem;
/**
* 设备扩展属性
*/
@Column(length = 32, columnDefinition = "varchar(65)")
private String devExt;
}

View File

@ -0,0 +1,21 @@
package com.xkrs.service;
import com.xkrs.model.entity.CameraInformation;
import java.util.List;
/**
* @Author: XinYi Song
* @Date: 2022/3/3 11:42
*/
public interface CameraService {
/**
* 查询摄像头信息全部
* */
List<CameraInformation> SelectCameraAll();
/**
* 添加
* */
boolean InsertCamera(CameraInformation cameraInformation);
}

View File

@ -0,0 +1,43 @@
package com.xkrs.service.impl;
import com.xkrs.dao.CameraDao;
import com.xkrs.dao.FireDao;
import com.xkrs.model.entity.CameraInformation;
import com.xkrs.service.CameraService;
import com.xkrs.util.Query;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author: XinYi Song
* @Date: 2022/3/3 11:47
*/
public class CameraServiceImpl implements CameraService {
@Resource
private CameraDao cameraDao;
@Override
public List<CameraInformation> SelectCameraAll() {
List<CameraInformation> cameraInformations =cameraDao.findAll();
if (cameraInformations==null) {
System.out.println("实现错误");
}
return cameraInformations;
}
@Override
public boolean InsertCamera(CameraInformation cameraInformation) {
try {
cameraDao.save(cameraInformation);
return true;
}
catch (Exception e){
return false;
}
}
}

View File

@ -0,0 +1,19 @@
package com.xkrs.util;
import com.fasterxml.jackson.databind.JsonNode;
import java.util.HashMap;
import java.util.Map;
/**
* @Author: XinYi Song
* @Date: 2022/3/4 9:38
*/
public class ManagementUtil {
public static JsonNode getForecastWeather() {
String url = "http://portalweather.comsys.net.cn/weather03/api/weatherService/getDailyWeather?cityName=大同";
Map<String, String> map = new HashMap<>(3);
JsonNode jsonNode = RequestUtil.doGetJsonNode(url, map);
return jsonNode;
}
}