Default Changelist

This commit is contained in:
XinYi Song 2022-03-05 17:56:39 +08:00
parent acdaf4c3a4
commit b5de1fc8f0
8 changed files with 375 additions and 219 deletions

View File

@ -33,6 +33,7 @@ public class CameraController {
@Resource @Resource
private DeviceManagementDao deviceManagementDao; private DeviceManagementDao deviceManagementDao;
@GetMapping("/getCameraInformation") @GetMapping("/getCameraInformation")
public List<CameraInformation> getCameraInformation(){ public List<CameraInformation> getCameraInformation(){
@ -49,8 +50,48 @@ public class CameraController {
return false; return false;
} }
} }
/**
* 返回全部信息
* @param
* @return
*/
@GetMapping("/findEquipment1")
public String Selectequipment(){
try
{
return cameraService.Selectequipment();
}
catch (Exception E)
{
return E.getMessage();
}
}
/**
* 查询实时视频连接
* @return
*/
@GetMapping("/findVideoPath1")
public String selectVideotape(){
try {
return cameraService.Videotape();
}
catch (Exception e){
return e.getMessage();
}
}
/**
* 添加设备信息
* @return
*/
@GetMapping("/SelectDeviceManagement") @GetMapping("/SelectDeviceManagement")
public String SelectDeviceManagement() public String SelectDeviceManagement()
{ {
@ -63,32 +104,31 @@ public class CameraController {
contnetTotal+=s; contnetTotal+=s;
} }
br.close(); br.close();
System.out.println(contnetTotal);
DA tempBran = JSON.parseObject(contnetTotal, DA.class); DA tempBran = JSON.parseObject(contnetTotal, DA.class);
List<DA.DataDTO.PageDataDTO> pageData = tempBran.getData().getPageData(); List<DA.DataDTO.PageDataDTO> pageData = tempBran.getData().getPageData();
List<ADD> list1=new ArrayList<>();
for (DA.DataDTO.PageDataDTO item: pageData) { for (DA.DataDTO.PageDataDTO item: pageData) {
ADD add=new ADD(); DeviceManagement add=new DeviceManagement();
add.deviceName=item.getDeviceName(); add.setDeviceName(item.getDeviceName());
add.deviCevode=item.getDeviceCode(); add.setDeviceCode(item.getDeviceCode());
add.deviceSn=item.getDeviceSn(); add.setDeviceSn(item.getDeviceSn());
add.deviceCategory=item.getDeviceCategory(); add.setDeviceCategory(item.getDeviceCategory());
add.deviceManufacture=item.getDeviceManufacturer(); add.setDeviceManufacturer(item.getDeviceManufacturer());
add.deviceType=item.getDeviceType(); add.setDeviceType(item.getDeviceType());
add.deviceModel=item.getDeviceModel(); add.setDeviceModel(item.getDeviceModel());
add.deviceLp=item.getDeviceIp(); add.setDeviceIp(item.getDeviceIp());
add.devicePort=item.getDevicePort(); add.setDevicePort(item.getDevicePort());
add.ownerCode=item.getOwnerCode(); add.setOwnerCode(item.getOwnerCode());
list1.add(add); add.setLiveVideo("http://111.53.13.180:7086/live/cameraid/"+item.getDeviceCode()+ "%240/substream/1.m3u8");
add.setIsOnline(item.getIsOnline());
add.setUpdateTime(item.getOnlineUpdateTime());
deviceManagementDao.save(add);
} }
cameraService.InsertPaging(list1); System.out.println("111");
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
return "over"; return "1";
} }
} }

View File

@ -134,36 +134,36 @@ public class TestController {
public String getPaging( String para) { public String getPaging( String para) {
String forecastWeather = ManagementUtil.getPaging(para); String forecastWeather = ManagementUtil.getPaging(para);
List<Map<String, String>> listObjectFir = (List<Map<String, String>>) JSONArray.parse(forecastWeather); // List<Map<String, String>> listObjectFir = (List<Map<String, String>>) JSONArray.parse(forecastWeather);
ObjectMapper objectMapper = new ObjectMapper(); // ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonNode = null; // JsonNode jsonNode = null;
try { // try {
jsonNode = objectMapper.readTree(forecastWeather); // jsonNode = objectMapper.readTree(forecastWeather);
} catch (JsonProcessingException e) { // } catch (JsonProcessingException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
List<DeviceManagement> item= new ArrayList<>(); // List<DeviceManagement> item= new ArrayList<>();
String method = jsonNode.get("method").asText(); // String method = jsonNode.get("method").asText();
if("vms.alarm.msg".equals(method)){ // if("vms.alarm.msg".equals(method)){
JsonNode info = jsonNode.get("info"); // JsonNode info = jsonNode.get("info");
DeviceManagement fire = new DeviceManagement(); // DeviceManagement fire = new DeviceManagement();
fire.setDeviceName(info.get("deviceName").asText()); // fire.setDeviceName(info.get("deviceName").asText());
fire.setDeviceCode(info.get("deviceCode").asText()); // fire.setDeviceCode(info.get("deviceCode").asText());
fire.setDeviceSn(info.get("deviceSn").asText()); // fire.setDeviceSn(info.get("deviceSn").asText());
fire.setDeviceCategory(Integer.valueOf(info.get("deviceCategory").asText())); // fire.setDeviceCategory(Integer.valueOf(info.get("deviceCategory").asText()));
fire.setDeviceType(Integer.valueOf(info.get("deviceType").asText())); // fire.setDeviceType(Integer.valueOf(info.get("deviceType").asText()));
fire.setDeviceManufacturer(info.get("deviceManufacturer").asText()); // fire.setDeviceManufacturer(info.get("deviceManufacturer").asText());
fire.setDeviceModel(info.get("deviceModel").asText()); // fire.setDeviceModel(info.get("deviceModel").asText());
fire.setDeviceIp(info.get("deviceIp").asText()); // fire.setDeviceIp(info.get("deviceIp").asText());
fire.setDevicePort(Integer.valueOf(info.get("devicePort").asText())); // fire.setDevicePort(Integer.valueOf(info.get("devicePort").asText()));
fire.setOwnerCode(info.get("ownerCode").asText()); // fire.setOwnerCode(info.get("ownerCode").asText());
//fire.setOwnerOrgName(Integer.valueOf(info.get("ownerOrgName").asText())); // //fire.setOwnerOrgName(Integer.valueOf(info.get("ownerOrgName").asText()));
fire.setIsOnline(Integer.valueOf(info.get("isOnline").asText())); //// fire.setIsOnline(Integer.valueOf(info.get("isOnline").asText()));
fire.setSubSystem(info.get("subSystem").asText()); //// fire.setSubSystem(info.get("subSystem").asText());
fire.setDevExt(info.get("devExt").asText()); //// fire.setDevExt(info.get("devExt").asText());
item.add(fire); // item.add(fire);
} // }
return "成功!"; return forecastWeather;
} }
} }

View File

@ -3,10 +3,12 @@ package com.xkrs.dao;
import com.xkrs.model.entity.CameraInformation; import com.xkrs.model.entity.CameraInformation;
import com.xkrs.model.entity.DeviceManagement; import com.xkrs.model.entity.DeviceManagement;
import com.xkrs.model.vo.ADD; import com.xkrs.model.vo.ADD;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
/** /**
@ -15,11 +17,17 @@ import java.util.Map;
*/ */
public interface DeviceManagementDao extends JpaRepository<DeviceManagement,Long> { public interface DeviceManagementDao extends JpaRepository<DeviceManagement,Long> {
/**
* 添加设备分页信息
*/
@Query(value = "Insert device_management('device_name','device_code','device_sn','device_category','device_type','device_manufacture','device_model','device_lp','device_port','owner_code') " +
"VALUES('?1','?2','?3','?4','?5','?6','?7','?8','?9','?10');",nativeQuery = true)
String selectDeviceManagement(List<ADD> deviceManagement);
/**
* 查询视频连接
*/
/*,device_name,device_sn,device_type,device_manufacturer*/
@Query(value = "SELECT device_code,live_video FROM device_management",nativeQuery = true)
List<Map<String,String>> Videotape();
/**
* 查询全部设备信息
*/
@Query(value = "SELECT * FROM device_management",nativeQuery = true)
List<Map<String,String>> equipment();
} }

View File

@ -7,7 +7,7 @@ import javax.persistence.*;
* @Date: 2022/3/4 8:23 * @Date: 2022/3/4 8:23
*/ */
@Entity @Entity
@Table(name = "DeviceManagement") @Table(name = "device_management")
public class DeviceManagement { public class DeviceManagement {
/** /**
* 主键id * 主键id
@ -66,76 +66,88 @@ public class DeviceManagement {
*/ */
@Column(length = 32, columnDefinition = "varchar(32)") @Column(length = 32, columnDefinition = "varchar(32)")
private String ownerCode; private String ownerCode;
/** /**
* 添加方式 * 设备端口
*/ */
@Column(length = 32, columnDefinition = "varchar(32)") @Column(length = 32, columnDefinition = "varchar(32)")
private String loginType; private String updateTime;
/** /**
* 登录名称 * 设备所属组织
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String loginName;
/**
* 登录密码
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String loginPassword;
/**
* 主动注册代理端口
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private int registProxyPort;
/**
* 主动注册服务器编码
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String registDeviceCode;
/**
* 通道描述
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String memo;
/**
* 在线状态
*/ */
@Column(length = 32, columnDefinition = "varchar(32)") @Column(length = 32, columnDefinition = "varchar(32)")
private int isOnline; private int isOnline;
/** // /**
* 光栅图 // * 添加方式
*/ // */
@Column(length = 32, columnDefinition = "varchar(32)") // @Column(length = 32, columnDefinition = "varchar(32)")
private long mapId; // private String loginType;
/** // /**
* 经度 // * 登录名称
*/ // */
@Column(length = 32, columnDefinition = "varchar(32)") // @Column(length = 32, columnDefinition = "varchar(32)")
private String gpsX; // private String loginName;
/** // /**
* 纬度 // * 登录密码
*/ // */
@Column(length = 32, columnDefinition = "varchar(32)") // @Column(length = 32, columnDefinition = "varchar(32)")
private String gpsY; // private String loginPassword;
/** // /**
* 设备所属子系统 // * 主动注册代理端口
*/ // */
@Column(length = 32, columnDefinition = "varchar(32)") // @Column(length = 32, columnDefinition = "varchar(32)")
private String subSystem; // private int registProxyPort;
/** // /**
* 设备扩展属性 // * 主动注册服务器编码
*/ // */
@Column(length = 32, columnDefinition = "varchar(32)") // @Column(length = 32, columnDefinition = "varchar(32)")
private String devExt; // private String registDeviceCode;
/** // /**
* 通道序号 // * 通道描述
*/ // */
@Column(length = 32, columnDefinition = "varchar(32)") // @Column(length = 32, columnDefinition = "varchar(32)")
private String channelSeq; // private String memo;
/** // /**
*通道名称 // * 在线状态
*/ // */
@Column(length = 32, columnDefinition = "varchar(32)") // @Column(length = 32, columnDefinition = "varchar(32)")
private String channelName; // private int isOnline;
// /**
// * 光栅图
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private long mapId;
// /**
// * 经度
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private String gpsX;
// /**
// * 纬度
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private String gpsY;
// /**
// * 设备所属子系统
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private String subSystem;
// /**
// * 设备扩展属性
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private String devExt;
// /**
// * 通道序号
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private String channelSeq;
// /**
// *通道名称
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private String channelName;
/** /**
* 实时视频 * 实时视频
*/ */
@ -230,52 +242,116 @@ public class DeviceManagement {
this.ownerCode = ownerCode; this.ownerCode = ownerCode;
} }
public String getLoginType() { // public String getLoginType() {
return loginType; // return loginType;
// }
//
// public void setLoginType(String loginType) {
// this.loginType = loginType;
// }
//
// public String getLoginName() {
// return loginName;
// }
//
// public void setLoginName(String loginName) {
// this.loginName = loginName;
// }
//
// public String getLoginPassword() {
// return loginPassword;
// }
//
// public void setLoginPassword(String loginPassword) {
// this.loginPassword = loginPassword;
// }
//
// public int getRegistProxyPort() {
// return registProxyPort;
// }
//
// public void setRegistProxyPort(int registProxyPort) {
// this.registProxyPort = registProxyPort;
// }
//
// public String getRegistDeviceCode() {
// return registDeviceCode;
// }
//
// public void setRegistDeviceCode(String registDeviceCode) {
// this.registDeviceCode = registDeviceCode;
// }
//
// public String getMemo() {
// return memo;
// }
//
// public void setMemo(String memo) {
// this.memo = memo;
// }
//
// public int getIsOnline() {
// return isOnline;
// }
//
// public void setIsOnline(int isOnline) {
// this.isOnline = isOnline;
// }
//
// public long getMapId() {
// return mapId;
// }
//
// public void setMapId(long mapId) {
// this.mapId = mapId;
// }
//
// public String getGpsX() {
// return gpsX;
// }
//
// public void setGpsX(String gpsX) {
// this.gpsX = gpsX;
// }
//
// public String getGpsY() {
// return gpsY;
// }
//
// public void setGpsY(String gpsY) {
// this.gpsY = gpsY;
// }
//
// public String getSubSystem() {
// return subSystem;
// }
//
// public void setSubSystem(String subSystem) {
// this.subSystem = subSystem;
// }
//
// public String getDevExt() {
// return devExt;
// }
//
// public void setDevExt(String devExt) {
// this.devExt = devExt;
// }
public String getLiveVideo() {
return liveVideo;
} }
public void setLoginType(String loginType) { public void setLiveVideo(String liveVideo) {
this.loginType = loginType; this.liveVideo = liveVideo;
} }
public String getLoginName() { public String getUpdateTime() {
return loginName; return updateTime;
} }
public void setLoginName(String loginName) { public void setUpdateTime(String updateTime) {
this.loginName = loginName; this.updateTime = updateTime;
}
public String getLoginPassword() {
return loginPassword;
}
public void setLoginPassword(String loginPassword) {
this.loginPassword = loginPassword;
}
public int getRegistProxyPort() {
return registProxyPort;
}
public void setRegistProxyPort(int registProxyPort) {
this.registProxyPort = registProxyPort;
}
public String getRegistDeviceCode() {
return registDeviceCode;
}
public void setRegistDeviceCode(String registDeviceCode) {
this.registDeviceCode = registDeviceCode;
}
public String getMemo() {
return memo;
}
public void setMemo(String memo) {
this.memo = memo;
} }
public int getIsOnline() { public int getIsOnline() {
@ -285,44 +361,4 @@ public class DeviceManagement {
public void setIsOnline(int isOnline) { public void setIsOnline(int isOnline) {
this.isOnline = isOnline; this.isOnline = isOnline;
} }
public long getMapId() {
return mapId;
}
public void setMapId(long mapId) {
this.mapId = mapId;
}
public String getGpsX() {
return gpsX;
}
public void setGpsX(String gpsX) {
this.gpsX = gpsX;
}
public String getGpsY() {
return gpsY;
}
public void setGpsY(String gpsY) {
this.gpsY = gpsY;
}
public String getSubSystem() {
return subSystem;
}
public void setSubSystem(String subSystem) {
this.subSystem = subSystem;
}
public String getDevExt() {
return devExt;
}
public void setDevExt(String devExt) {
this.devExt = devExt;
}
} }

View File

@ -26,9 +26,18 @@ public interface CameraService {
* @return * @return
*/ */
List<DeviceManagement> SelectDevice(); List<DeviceManagement> SelectDevice();
/**
* 查询摄像头信息
* @return
*/
String Videotape();
/**
*
*/
String Selectequipment();
/** /**
* 添加设备分页信息 * 添加设备分页信息
*/ */
String InsertPaging(List<ADD> para); String InsertPaging(List<DeviceManagement> para);
} }

View File

@ -1,5 +1,6 @@
package com.xkrs.service.impl; package com.xkrs.service.impl;
import com.xkrs.common.encapsulation.PromptMessageEnum;
import com.xkrs.dao.CameraDao; import com.xkrs.dao.CameraDao;
import com.xkrs.dao.DeviceManagementDao; import com.xkrs.dao.DeviceManagementDao;
import com.xkrs.dao.FireDao; import com.xkrs.dao.FireDao;
@ -8,10 +9,17 @@ import com.xkrs.model.entity.DeviceManagement;
import com.xkrs.model.vo.ADD; import com.xkrs.model.vo.ADD;
import com.xkrs.service.CameraService; import com.xkrs.service.CameraService;
import com.xkrs.util.Query; import com.xkrs.util.Query;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
/** /**
* @Author: XinYi Song * @Author: XinYi Song
@ -25,6 +33,8 @@ public class CameraServiceImpl implements CameraService {
@Resource @Resource
private DeviceManagementDao deviceManagementDao; private DeviceManagementDao deviceManagementDao;
Locale locale = LocaleContextHolder.getLocale();
@Override @Override
public List<CameraInformation> SelectCameraAll() { public List<CameraInformation> SelectCameraAll() {
List<CameraInformation> cameraInformations = cameraDao.findAll(); List<CameraInformation> cameraInformations = cameraDao.findAll();
@ -40,13 +50,10 @@ public class CameraServiceImpl implements CameraService {
try { try {
cameraDao.save(cameraInformation); cameraDao.save(cameraInformation);
return true; return true;
} } catch (Exception e) {
catch (Exception e){
return false; return false;
} }
} }
@Override @Override
@ -59,15 +66,28 @@ public class CameraServiceImpl implements CameraService {
} }
@Override @Override
public String InsertPaging(List<ADD> para) public String Videotape() {
{ List<Map<String,String>> stringObjectMap = deviceManagementDao.Videotape();
try { return outputEncapsulationObject(PromptMessageEnum.SUCCESS,stringObjectMap,locale);
deviceManagementDao.selectDeviceManagement(para);
return "成功添加!";
}
catch (Exception e){
return "失败1"; }
@Override
public String Selectequipment() {
List<Map<String,String>> stringObjectMap = deviceManagementDao.equipment();
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,stringObjectMap,locale);
}
@Override
public String InsertPaging(List<DeviceManagement> para) {
try {
DeviceManagement deviceManagement = new DeviceManagement();
return "成功添加!";
} catch (Exception e) {
return e.getMessage();
} }
} }
} }

View File

@ -14,15 +14,16 @@ import java.util.Map;
*/ */
public class ManagementUtil { public class ManagementUtil {
public static JsonNode getManagement() { public static JsonNode getManagement() {
String url = "https://111.53.13.180:4433/evo-apigw/evo-brm/1.0.0/device?deviceCode=100001"; String url = "https://111.53.13.180:4433/evo-apigw/evo-brm/1.0.0/device?deviceCode=1001339";
Map<String, String> map = new HashMap<>(3); Map<String, String> map = new HashMap<>(3);
JsonNode jsonNode = RequestUtil.doGetJsonNode(url, map); JsonNode jsonNode = RequestUtil.doGetJsonNode(url, map);
return jsonNode; return jsonNode;
} }
//https://{{host}}/evo-apigw/evo-brm/{{version}}/device/1001339
public static String getPaging(String para) { public static String getPaging(String para) {
String url = "https://111.53.13.180:4433/evo-apigw/evo-brm/1.2.0/device/subsystem/page"; String url = "https://111.53.13.180:4433/evo-apigw/evo-brm/1.2.0/devic?deviceCode="+para;
String jsonNode = RequestUtil.doPostJson(url, para); String jsonNode = RequestUtil.getPost(url);
return jsonNode; return jsonNode;
} }

View File

@ -124,6 +124,48 @@ public class RequestUtil {
return result; return result;
} }
/**
* get设备详细信息查询
* @param url
* @return String
*/
public static String getPost(String url) {
// 创建Httpclient对象
CloseableHttpClient httpclient = HttpClients.createDefault();
String resultString = "";
CloseableHttpResponse response = null;
try {
URI uri = new URI(url);
// 创建http GET请求
HttpGet httpGet = new HttpGet(uri);
// 执行请求
response = httpclient.execute(httpGet);
// 判断返回状态是否为200
if (response.getStatusLine().getStatusCode() == 200) {
resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
ObjectMapper objectMapper = new ObjectMapper();
//使用ObjectMapper对象对 User对象进行转换
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (response != null) {
response.close();
}
httpclient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return resultString;
}
/** /**
* 带参数的get请求 * 带参数的get请求
* @param url * @param url