Compare commits

..

3 Commits

Author SHA1 Message Date
6e1cf8aafb Merge branch 'master' into dev_fire 2022-03-04 20:30:21 +08:00
36e9d31941 初始化火情事件表 2022-03-04 17:29:00 +08:00
39ea504f16 订阅大华火情事件 2022-03-04 16:40:48 +08:00
21 changed files with 353 additions and 1263 deletions

11
pom.xml
View File

@ -96,8 +96,8 @@
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId> mysql</groupId>
<artifactId> mysql-connector-java</artifactId>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
@ -192,7 +192,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
<!-- <scope>provided</scope>-->
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/redis.clients/jedis -->
@ -201,11 +201,6 @@
<artifactId>jedis</artifactId>
<version>3.7.0</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool-all.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>

View File

@ -1,21 +1,12 @@
package com.xkrs;
import com.alibaba.fastjson.JSON;
import com.xkrs.model.vo.ADD;
import com.xkrs.model.vo.DA;
import com.xkrs.service.CameraService;
import com.xkrs.service.impl.CameraServiceImpl;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.jms.annotation.EnableJms;
import javax.annotation.Resource;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/**
* 启动类
*
* @author XinYi Song
**/
@SpringBootApplication
@ -24,7 +15,6 @@ import java.util.List;
public class SmartUrbanRuralApplication {
public static void main(String[] args) {
SpringApplication.run(SmartUrbanRuralApplication.class, args);
}

View File

@ -1,12 +1,9 @@
package com.xkrs.controller;
import com.alibaba.fastjson.JSON;
import com.xkrs.dao.CameraDao;
import com.xkrs.dao.DeviceManagementDao;
import com.xkrs.model.entity.CameraInformation;
import com.xkrs.model.entity.DeviceManagement;
import com.xkrs.model.vo.ADD;
import com.xkrs.model.vo.DA;
import com.xkrs.service.CameraService;
import com.xkrs.service.FireService;
import org.springframework.web.bind.annotation.GetMapping;
@ -14,8 +11,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/**
@ -33,7 +28,6 @@ public class CameraController {
@Resource
private DeviceManagementDao deviceManagementDao;
@GetMapping("/getCameraInformation")
public List<CameraInformation> getCameraInformation(){
@ -50,85 +44,12 @@ public class CameraController {
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")
public String SelectDeviceManagement()
public List<DeviceManagement> SelectDeviceManagement()
{
File file = new File("C:\\Users\\HP\\Desktop\\摄像头设备信息.txt");
try {
BufferedReader br=new BufferedReader(new FileReader(file));
String contnetTotal="";
String s;
while (( s=br.readLine())!=null){
contnetTotal+=s;
}
br.close();
DA tempBran = JSON.parseObject(contnetTotal, DA.class);
List<DA.DataDTO.PageDataDTO> pageData = tempBran.getData().getPageData();
for (DA.DataDTO.PageDataDTO item: pageData) {
DeviceManagement add=new DeviceManagement();
add.setDeviceName(item.getDeviceName());
add.setDeviceCode(item.getDeviceCode());
add.setDeviceSn(item.getDeviceSn());
add.setDeviceCategory(item.getDeviceCategory());
add.setDeviceManufacturer(item.getDeviceManufacturer());
add.setDeviceType(item.getDeviceType());
add.setDeviceModel(item.getDeviceModel());
add.setDeviceIp(item.getDeviceIp());
add.setDevicePort(item.getDevicePort());
add.setOwnerCode(item.getOwnerCode());
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);
}
System.out.println("111");
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return "1";
return cameraService.SelectDevice();
}
}

View File

@ -3,15 +3,11 @@ package com.xkrs.controller;
import com.xkrs.common.encapsulation.PromptMessageEnum;
import com.xkrs.dao.EquipmentDao;
import com.xkrs.dao.FireDao;
import com.xkrs.model.entity.Fire;
import com.xkrs.service.FireService;
import com.xkrs.util.Query;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.List;
@ -40,92 +36,100 @@ public class FireController {
/**
* 根据设备编号获取火情信息
*
* @param code
* @return
*/
@GetMapping("/getFireInformation")
public String getFireInformation(@RequestParam("code") String code){
public String getFireInformation(@RequestParam("code") String code) {
return fireService.getFireInformation(code);
}
/**
* 根据设备编码和时间段查询火情信息
*
* @param code
* @param startTime
* @param endTime
* @return
*/
@GetMapping("/selectFireBetweenTime")
public String selectFireBetweenTime(@RequestParam("code") String code, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime){
return fireService.selectFireBetweenTime(code,startTime,endTime);
public String selectFireBetweenTime(@RequestParam("code") String code, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime) {
return fireService.selectFireBetweenTime(code, startTime, endTime);
}
/**
* 查询最新的300条火情信息
*
* @return
*/
@GetMapping("/findThreeHundredData")
public String findThreeHundredData(){
public String findThreeHundredData() {
return fireService.findThreeHundredData();
}
/**
* 查询一个月中每一天各个街道的火情数量
*
* @param beginTime
* @param endTime
* @return
*/
@GetMapping("/selectEveryDayCount")
public String selectEveryDayCount(@RequestParam("beginTime") String beginTime,@RequestParam("endTime") String endTime){
public String selectEveryDayCount(@RequestParam("beginTime") String beginTime, @RequestParam("endTime") String endTime) {
List<Map<String, Object>> maps = equipmentDao.selectEveryDayCount(beginTime, endTime);
if(maps == null || maps.size() == 0){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"该月暂时没有火情信息!",locale);
if (maps == null || maps.size() == 0) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "该月暂时没有火情信息!", locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,maps,locale);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, maps, locale);
}
/**
* 查询一年中每个月的各个街道的火情数量
*
* @param beginTime
* @param endTime
* @return
*/
@GetMapping("/selectEveryMonthCount")
public String selectEveryMonthCount(@RequestParam("beginTime") String beginTime,@RequestParam("endTime") String endTime){
public String selectEveryMonthCount(@RequestParam("beginTime") String beginTime, @RequestParam("endTime") String endTime) {
List<Map<String, Object>> maps = equipmentDao.selectEveryMonthCount(beginTime, endTime);
if(maps == null || maps.size() == 0){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"该年暂时没有火情信息!",locale);
if (maps == null || maps.size() == 0) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "该年暂时没有火情信息!", locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,maps,locale);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, maps, locale);
}
/**
* 修改火点状态
*
* @param map
* @return
*/
@PostMapping("/updateFireState")
public String updateFireState(@RequestBody Map map){
public String updateFireState(@RequestBody Map map) {
String alarmCode = (String) map.get("alarmCode");
return fireService.updateFireState(alarmCode);
}
/**
* 查询已处理和未处理的火点的数量
*
* @param street
* @param month
* @return
*/
@GetMapping("/selectProcessedNum")
public String selectProcessedNum(@RequestParam("street") String street,@RequestParam("month") String month){
public String selectProcessedNum(@RequestParam("street") String street, @RequestParam("month") String month) {
Map<String, Object> stringObjectMap = fireDao.selectProcessed(street, month);
BigInteger processed = (BigInteger) stringObjectMap.get("processed");
Map<String, Object> stringObjectMap1 = fireDao.selectNotProcessed(street, month);
BigInteger notprocessed = (BigInteger) stringObjectMap1.get("notprocessed");
Map<String,Object> map = new HashMap<>(3);
map.put("processed",processed);
map.put("notProcessed",notprocessed);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,map,locale);
Map<String, Object> map = new HashMap<>(3);
map.put("processed", processed);
map.put("notProcessed", notprocessed);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, map, locale);
}
}

View File

@ -4,38 +4,31 @@ import com.dahuatech.icc.event.model.v202011.EventSubscribeRequest;
import com.dahuatech.icc.event.model.v202011.EventSubscribeResponse;
import com.dahuatech.icc.oauth.http.DefaultClient;
import com.dahuatech.icc.oauth.http.IClient;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.xkrs.common.encapsulation.PromptMessageEnum;
import org.apache.http.util.TextUtils;
import org.springframework.context.i18n.LocaleContextHolder;
import com.xkrs.service.FireEventService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.Locale;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
import javax.annotation.Resource;
/**
* ./start.sh
* sudo tail -f nohup.out
* /home/sxy/server/SmartUrbanRural
* @Author: XinYi Song
* @Date: 2022/2/11 9:03
*/
@RestController
public class FireEventController {
Locale locale = LocaleContextHolder.getLocale();
@Resource
private FireEventService fireEventService;
/**
* 订阅火情事件
*/
@GetMapping("/subscribeFireEvent")
public String subscribeFireEvent() {
public void subscribeFireEvent() {
try {
//118.24.27.47:6820
String host = "111.53.13.180:4433";
String username = "system";
String password = "Admin@123";
@ -50,41 +43,21 @@ public class FireEventController {
subscribeRequest.body(mqinfo);
EventSubscribeResponse subscribeResponse = iClient.doAction(subscribeRequest, subscribeRequest.getResponseClass());
System.out.println("----结束执行----{}------事件订阅" + subscribeResponse.toString());
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, subscribeResponse, locale);
} catch (Exception e) {
e.printStackTrace();
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "订阅火情事件失败", locale);
}
/**
* 接收火情事件
*/
@PostMapping("/receiveFireEvent")
public void receiveFireEvent(@RequestBody String message) throws IOException {
JsonNode jsonNode = new ObjectMapper().readTree(message);
String category = jsonNode.get("category").asText();
String method = jsonNode.get("method").asText();
String subsystem = jsonNode.get("subsystem").asText();
String info = jsonNode.get("info").asText();
boolean fireEventForCategory = (!TextUtils.isEmpty(category)) && "alarm".equals(category);
boolean fireEventForMethod = (!TextUtils.isEmpty(method)) && "alarm.msg".equals(method);
boolean fireEventForSubsystem = (!TextUtils.isEmpty(subsystem)) && "admin".equals(subsystem);
boolean hasInfo = true;
//火情事件
if (fireEventForCategory && fireEventForMethod && fireEventForSubsystem && hasInfo) {
return;
public void receiveFireEvent(@RequestBody Object fireEvent) {
try {
System.out.println("----接收火情事件----{}------" + fireEvent.toString());
} catch (Exception e) {
e.printStackTrace();
}
boolean firePictureForCategory = (!TextUtils.isEmpty(category)) && "business".equals(category);
boolean firePictureForMethod = (!TextUtils.isEmpty(method)) && "vms.notifyAlarmPicture".equals(method);
boolean firePictureForSubsystem = (!TextUtils.isEmpty(subsystem)) && "admin".equals(subsystem);
//火情图片
if (firePictureForCategory && firePictureForMethod && firePictureForSubsystem && hasInfo) {
return;
}
}
/**
@ -92,7 +65,7 @@ public class FireEventController {
*/
@GetMapping("/selectFireEvent")
public String selectFireEvent() {
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "selectFireEvent", locale);
return fireEventService.selectFireEventList();
}
}

View File

@ -1,127 +0,0 @@
package com.xkrs.controller;
public class Temp {
/**
* {
* "id":null,
* "category":"alarm",
* "method":"alarm.msg",
* "info":{
* "orgName":"热成像云台",
* "nodeCode":"1000042$1$0$1",
* "deviceCode":"1000042",
* "alarmCode":"{6E750E9B-9DB4-9C42-983F-B5117E2B8F67}",
* "alarmPicture":"",
* "nodeType":2,
* "deviceName":"固定桥村北",
* "alarmDate":"1646471854",
* "alarmGrade":2,
* "isSave":true,
* "unitType":1,
* "unitSeq":0,
* "extend":{
* "params":[
* {
* "fTemperature":0,
* "nDistance":1000,
* "nThermoHFOV":520,
* "nPresetId":1,
* "stuBoundingBox":{
* "nTop":4096,
* "nBottom":4369,
* "nLeft":3686,
* "nRight":3891
* },
* "stuFiringGPS":{
* "dbAltitude":0,
* "dwLatidude":0,
* "dwLongitude":0
* },
* "nThermoVFOV":390,
* "stuPTZPosition":{
* "nPositionX":2123,
* "nPositionY":2,
* "nZoom":1
* },
* "nTemperatureUnit":1,
* "fsid":2267,
* "fAltitude":150,
* "GPS_POINT":{
* "dwLatidude":39.873801,
* "dwLongitude":113.49956299999999
* }
* },
* {
* "fTemperature":0,
* "nDistance":1000,
* "nThermoHFOV":520,
* "nPresetId":1,
* "stuBoundingBox":{
* "nTop":5188,
* "nBottom":5461,
* "nLeft":1433,
* "nRight":2457
* },
* "stuFiringGPS":{
* "dbAltitude":0,
* "dwLatidude":0,
* "dwLongitude":0
* },
* "nThermoVFOV":390,
* "stuPTZPosition":{
* "nPositionX":2123,
* "nPositionY":2,
* "nZoom":1
* },
* "nTemperatureUnit":1,
* "fsid":2267,
* "fAltitude":150,
* "GPS_POINT":{
* "dwLatidude":39.873801,
* "dwLongitude":113.49956299999999
* }
* }
* ]
* },
* "alarmType":5122,
* "linkIds":"598970c2f97a422fbfeae77d02ffc8a5",
* "channelSeq":1,
* "orgCode":"001001",
* "channelName":"固定桥村北热成像",
* "alarmStat":1,
* "isEvent":false
* },
* "subsystem":"admin",
* "userIds":null,
* "sid":null,
* "domainId":null,
* "infoArray":null,
* "protocol":null
* }
*/
/**
* {
* "id":null,
* "category":"business",
* "method":"vms.notifyAlarmPicture",
* "info":{
* "chnName":"施家会村可见光",
* "pictureSize":"",
* "alarmCode":"{B73E8BD6-60A5-D549-80B8-B03FDB68C76F}",
* "alarmDate":"1646471804",
* "picture":"d7e12fe8-938d-11ec-9713-00ddb6910ecd/20220305/1/dsf_4d9cb367-9c5f-11ec-8e91-00ddb6910ecd_28749380_29339566.jpg"
* },
* "subsystem":"admin",
* "userIds":null,
* "sid":null,
* "domainId":null,
* "infoArray":null,
* "protocol":null
* }
*/
}

View File

@ -20,7 +20,10 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
@ -131,39 +134,35 @@ public class TestController {
* @return
*/
@GetMapping("/getPaging")
public String getPaging( String para) {
public boolean getPaging( String para) {
String forecastWeather = ManagementUtil.getPaging(para);
// List<Map<String, String>> listObjectFir = (List<Map<String, String>>) JSONArray.parse(forecastWeather);
// ObjectMapper objectMapper = new ObjectMapper();
// JsonNode jsonNode = null;
// try {
// jsonNode = objectMapper.readTree(forecastWeather);
// } catch (JsonProcessingException e) {
// e.printStackTrace();
// }
// List<DeviceManagement> item= new ArrayList<>();
// String method = jsonNode.get("method").asText();
// if("vms.alarm.msg".equals(method)){
// JsonNode info = jsonNode.get("info");
// DeviceManagement fire = new DeviceManagement();
// fire.setDeviceName(info.get("deviceName").asText());
// fire.setDeviceCode(info.get("deviceCode").asText());
// fire.setDeviceSn(info.get("deviceSn").asText());
// fire.setDeviceCategory(Integer.valueOf(info.get("deviceCategory").asText()));
// fire.setDeviceType(Integer.valueOf(info.get("deviceType").asText()));
// fire.setDeviceManufacturer(info.get("deviceManufacturer").asText());
// fire.setDeviceModel(info.get("deviceModel").asText());
// fire.setDeviceIp(info.get("deviceIp").asText());
// fire.setDevicePort(Integer.valueOf(info.get("devicePort").asText()));
// fire.setOwnerCode(info.get("ownerCode").asText());
// //fire.setOwnerOrgName(Integer.valueOf(info.get("ownerOrgName").asText()));
//// fire.setIsOnline(Integer.valueOf(info.get("isOnline").asText()));
//// fire.setSubSystem(info.get("subSystem").asText());
//// fire.setDevExt(info.get("devExt").asText());
// item.add(fire);
// }
return forecastWeather;
List<Map<String, String>> listObjectFir = (List<Map<String, String>>) JSONArray.parse(forecastWeather);
ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonNode = null;
try {
jsonNode = objectMapper.readTree(forecastWeather);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
String method = jsonNode.get("method").asText();
if("vms.alarm.msg".equals(method)){
JsonNode info = jsonNode.get("info");
DeviceManagement fire = new DeviceManagement();
fire.setDeviceName(info.get("deviceName").asText());
fire.setDeviceCode(info.get("deviceCode").asText());
fire.setDeviceSn(info.get("deviceSn").asText());
fire.setDeviceCategory(Integer.valueOf(info.get("deviceCategory").asText()));
fire.setDeviceType(Integer.valueOf(info.get("deviceType").asText()));
fire.setDeviceManufacturer(info.get("deviceManufacturer").asText());
fire.setDeviceModel(info.get("deviceModel").asText());
fire.setDeviceIp(info.get("deviceIp").asText());
fire.setDevicePort(Integer.valueOf(info.get("devicePort").asText()));
fire.setOwnerCode(info.get("ownerCode").asText());
//fire.setOwnerOrgName(Integer.valueOf(info.get("ownerOrgName").asText()));
fire.setIsOnline(Integer.valueOf(info.get("isOnline").asText()));
fire.setSubSystem(info.get("subSystem").asText());
fire.setDevExt(info.get("devExt").asText());
}
return true;
}
}

View File

@ -2,13 +2,10 @@ package com.xkrs.dao;
import com.xkrs.model.entity.CameraInformation;
import com.xkrs.model.entity.DeviceManagement;
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.Query;
import java.util.List;
import java.util.Locale;
import java.util.Map;
/**
@ -17,16 +14,11 @@ import java.util.Map;
*/
public interface DeviceManagementDao extends JpaRepository<DeviceManagement,Long> {
/**
* 查询视频连接
* 添加设备分页信息
*/
@Query(value = "SELECT device_code,live_video FROM device_management",nativeQuery = true)
List<Map<String,String>> Videotape();
@Query(value = "Insert device_management('','','','','','','','','','','','','','','','','') " +
"VALUES('?1','?2','?3','?4','?5','?6','?7','?8','?9','?10','?11','?12','?13','?14','?15');",nativeQuery = true)
List<Map<String,Object>> selectDeviceManagement(DeviceManagement deviceManagement);
/**
* 查询全部设备信息
*/
@Query(value = "SELECT * FROM device_management",nativeQuery = true)
List<Map<String,String>> equipment();
}

View File

@ -0,0 +1,15 @@
package com.xkrs.dao;
import com.xkrs.model.entity.FireEvent;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Component;
/**
* @Author: XinYi Song
* @Date: 2022/2/8 17:12
*/
@Component
public interface FireEventDao extends JpaRepository<FireEvent, Long>, JpaSpecificationExecutor<FireEvent> {
}

View File

@ -7,7 +7,7 @@ import javax.persistence.*;
* @Date: 2022/3/4 8:23
*/
@Entity
@Table(name = "device_management")
@Table(name = "DeviceManagement")
public class DeviceManagement {
/**
* 主键id
@ -66,88 +66,76 @@ public class DeviceManagement {
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String ownerCode;
/**
* 设备端口
* 添加方式
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String updateTime;
private String loginType;
/**
* 设备所属组织
* 登录名称
*/
@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)")
private int isOnline;
// /**
// * 添加方式
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private String loginType;
// /**
// * 登录名称
// */
// @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)")
// 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;
/**
* 光栅图
*/
@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;
/**
* 实时视频
*/
@ -242,116 +230,52 @@ public class DeviceManagement {
this.ownerCode = ownerCode;
}
// public String getLoginType() {
// 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 String getLoginType() {
return loginType;
}
public void setLiveVideo(String liveVideo) {
this.liveVideo = liveVideo;
public void setLoginType(String loginType) {
this.loginType = loginType;
}
public String getUpdateTime() {
return updateTime;
public String getLoginName() {
return loginName;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
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() {
@ -361,4 +285,44 @@ public class DeviceManagement {
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;
}
}

View File

@ -0,0 +1,23 @@
package com.xkrs.model.entity;
import javax.persistence.*;
/**
* 大华推送的火情事件
*/
@Entity
@Table(name = "fire_event")
public class FireEvent {
/**
* 主键id
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "fire_event_seq_gen")
@SequenceGenerator(name = "fire_event_seq_gen", sequenceName = "fire_event_id_seq", allocationSize = 1)
private Integer id;
@Column(length = 85, columnDefinition = "varchar(85)")
private String temp;
}

View File

@ -1,18 +0,0 @@
package com.xkrs.model.vo;
/**
* @Author: XinYi Song
* @Date: 2022/3/4 21:30
*/
public class ADD {
public String deviceName;
public String deviCevode;
public String deviceSn;
public int deviceCategory;
public int deviceType;
public String deviceManufacture;
public String deviceModel;
public String deviceLp;
public int devicePort;
public String ownerCode;
}

View File

@ -1,613 +0,0 @@
package com.xkrs.model.vo;
import java.util.List;
/**
* @Author: XinYi Song
* @Date: 2022/3/4 21:31
*/
public class DA {
private Boolean success;
private DataDTO data;
private String code;
private String errMsg;
public Boolean getSuccess() {
return success;
}
public void setSuccess(Boolean success) {
this.success = success;
}
public DataDTO getData() {
return data;
}
public void setData(DataDTO data) {
this.data = data;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getErrMsg() {
return errMsg;
}
public void setErrMsg(String errMsg) {
this.errMsg = errMsg;
}
public static class DataDTO {
private List<PageDataDTO> pageData;
private Integer currentPage;
private Integer totalPage;
private Integer pageSize;
private Integer totalRows;
public List<PageDataDTO> getPageData() {
return pageData;
}
public void setPageData(List<PageDataDTO> pageData) {
this.pageData = pageData;
}
public Integer getCurrentPage() {
return currentPage;
}
public void setCurrentPage(Integer currentPage) {
this.currentPage = currentPage;
}
public Integer getTotalPage() {
return totalPage;
}
public void setTotalPage(Integer totalPage) {
this.totalPage = totalPage;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public Integer getTotalRows() {
return totalRows;
}
public void setTotalRows(Integer totalRows) {
this.totalRows = totalRows;
}
public static class PageDataDTO {
private String deviceName;
private String deviceCode;
private String deviceSn;
private Integer deviceCategory;
private Integer deviceType;
private String deviceManufacturer;
private String protocol;
private String deviceModel;
private String deviceIp;
private Integer devicePort;
private String ownerCode;
private String loginType;
private String loginName;
private String loginPassword;
private Boolean isPwdChange;
private String registServerCode;
private Integer isOnline;
private String onlineUpdateTime;
private Integer onlineUpdateVersion;
private String offlineReason;
private Integer isVirtual;
private String subSystem;
private DataDTO.PageDataDTO.DevExtDTO devExt;
private List<UnitsDTO> units;
private String updateTime;
private String deviceMac;
private Integer registProxyPort;
private String registDeviceCode;
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceCode() {
return deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public String getDeviceSn() {
return deviceSn;
}
public void setDeviceSn(String deviceSn) {
this.deviceSn = deviceSn;
}
public Integer getDeviceCategory() {
return deviceCategory;
}
public void setDeviceCategory(Integer deviceCategory) {
this.deviceCategory = deviceCategory;
}
public Integer getDeviceType() {
return deviceType;
}
public void setDeviceType(Integer deviceType) {
this.deviceType = deviceType;
}
public String getDeviceManufacturer() {
return deviceManufacturer;
}
public void setDeviceManufacturer(String deviceManufacturer) {
this.deviceManufacturer = deviceManufacturer;
}
public String getProtocol() {
return protocol;
}
public void setProtocol(String protocol) {
this.protocol = protocol;
}
public String getDeviceModel() {
return deviceModel;
}
public void setDeviceModel(String deviceModel) {
this.deviceModel = deviceModel;
}
public String getDeviceIp() {
return deviceIp;
}
public void setDeviceIp(String deviceIp) {
this.deviceIp = deviceIp;
}
public Integer getDevicePort() {
return devicePort;
}
public void setDevicePort(Integer devicePort) {
this.devicePort = devicePort;
}
public String getOwnerCode() {
return ownerCode;
}
public void setOwnerCode(String ownerCode) {
this.ownerCode = ownerCode;
}
public String getLoginType() {
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 Boolean getPwdChange() {
return isPwdChange;
}
public void setPwdChange(Boolean pwdChange) {
isPwdChange = pwdChange;
}
public String getRegistServerCode() {
return registServerCode;
}
public void setRegistServerCode(String registServerCode) {
this.registServerCode = registServerCode;
}
public Integer getIsOnline() {
return isOnline;
}
public void setIsOnline(Integer isOnline) {
this.isOnline = isOnline;
}
public String getOnlineUpdateTime() {
return onlineUpdateTime;
}
public void setOnlineUpdateTime(String onlineUpdateTime) {
this.onlineUpdateTime = onlineUpdateTime;
}
public Integer getOnlineUpdateVersion() {
return onlineUpdateVersion;
}
public void setOnlineUpdateVersion(Integer onlineUpdateVersion) {
this.onlineUpdateVersion = onlineUpdateVersion;
}
public String getOfflineReason() {
return offlineReason;
}
public void setOfflineReason(String offlineReason) {
this.offlineReason = offlineReason;
}
public Integer getIsVirtual() {
return isVirtual;
}
public void setIsVirtual(Integer isVirtual) {
this.isVirtual = isVirtual;
}
public String getSubSystem() {
return subSystem;
}
public void setSubSystem(String subSystem) {
this.subSystem = subSystem;
}
public DevExtDTO getDevExt() {
return devExt;
}
public void setDevExt(DevExtDTO devExt) {
this.devExt = devExt;
}
public List<UnitsDTO> getUnits() {
return units;
}
public void setUnits(List<UnitsDTO> units) {
this.units = units;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public String getDeviceMac() {
return deviceMac;
}
public void setDeviceMac(String deviceMac) {
this.deviceMac = deviceMac;
}
public Integer getRegistProxyPort() {
return registProxyPort;
}
public void setRegistProxyPort(Integer registProxyPort) {
this.registProxyPort = registProxyPort;
}
public String getRegistDeviceCode() {
return registDeviceCode;
}
public void setRegistDeviceCode(String registDeviceCode) {
this.registDeviceCode = registDeviceCode;
}
public static class DevExtDTO {
private String pictureServerCode;
private String videoServerCode;
public String getPictureServerCode() {
return pictureServerCode;
}
public void setPictureServerCode(String pictureServerCode) {
this.pictureServerCode = pictureServerCode;
}
public String getVideoServerCode() {
return videoServerCode;
}
public void setVideoServerCode(String videoServerCode) {
this.videoServerCode = videoServerCode;
}
}
public static class UnitsDTO {
private Integer unitType;
private Integer unitSeq;
private DataDTO.PageDataDTO.UnitsDTO.UnitExtDTO unitExt;
private List<ChannelsDTO> channels;
public Integer getUnitType() {
return unitType;
}
public void setUnitType(Integer unitType) {
this.unitType = unitType;
}
public Integer getUnitSeq() {
return unitSeq;
}
public void setUnitSeq(Integer unitSeq) {
this.unitSeq = unitSeq;
}
public UnitExtDTO getUnitExt() {
return unitExt;
}
public void setUnitExt(UnitExtDTO unitExt) {
this.unitExt = unitExt;
}
public List<ChannelsDTO> getChannels() {
return channels;
}
public void setChannels(List<ChannelsDTO> channels) {
this.channels = channels;
}
public static class UnitExtDTO {
private String streamType;
private Integer zeroChnEncode;
private Integer assistStream;
public String getStreamType() {
return streamType;
}
public void setStreamType(String streamType) {
this.streamType = streamType;
}
public Integer getZeroChnEncode() {
return zeroChnEncode;
}
public void setZeroChnEncode(Integer zeroChnEncode) {
this.zeroChnEncode = zeroChnEncode;
}
public Integer getAssistStream() {
return assistStream;
}
public void setAssistStream(Integer assistStream) {
this.assistStream = assistStream;
}
}
public static class ChannelsDTO {
private String channelName;
private Integer channelSeq;
private String channelType;
private String cameraType;
private String capability;
private String ownerCode;
private String channelCode;
private Integer stat;
private Integer isOnline;
private String onlineUpdateTime;
private Integer onlineUpdateVersion;
private DataDTO.PageDataDTO.UnitsDTO.ChannelsDTO.ChExtDTO chExt;
private Integer isVirtual;
public String getChannelName() {
return channelName;
}
public void setChannelName(String channelName) {
this.channelName = channelName;
}
public Integer getChannelSeq() {
return channelSeq;
}
public void setChannelSeq(Integer channelSeq) {
this.channelSeq = channelSeq;
}
public String getChannelType() {
return channelType;
}
public void setChannelType(String channelType) {
this.channelType = channelType;
}
public String getCameraType() {
return cameraType;
}
public void setCameraType(String cameraType) {
this.cameraType = cameraType;
}
public String getCapability() {
return capability;
}
public void setCapability(String capability) {
this.capability = capability;
}
public String getOwnerCode() {
return ownerCode;
}
public void setOwnerCode(String ownerCode) {
this.ownerCode = ownerCode;
}
public String getChannelCode() {
return channelCode;
}
public void setChannelCode(String channelCode) {
this.channelCode = channelCode;
}
public Integer getStat() {
return stat;
}
public void setStat(Integer stat) {
this.stat = stat;
}
public Integer getIsOnline() {
return isOnline;
}
public void setIsOnline(Integer isOnline) {
this.isOnline = isOnline;
}
public String getOnlineUpdateTime() {
return onlineUpdateTime;
}
public void setOnlineUpdateTime(String onlineUpdateTime) {
this.onlineUpdateTime = onlineUpdateTime;
}
public Integer getOnlineUpdateVersion() {
return onlineUpdateVersion;
}
public void setOnlineUpdateVersion(Integer onlineUpdateVersion) {
this.onlineUpdateVersion = onlineUpdateVersion;
}
public ChExtDTO getChExt() {
return chExt;
}
public void setChExt(ChExtDTO chExt) {
this.chExt = chExt;
}
public Integer getIsVirtual() {
return isVirtual;
}
public void setIsVirtual(Integer isVirtual) {
this.isVirtual = isVirtual;
}
public static class ChExtDTO {
}
}
}
}
}
}

View File

@ -2,7 +2,6 @@ package com.xkrs.service;
import com.xkrs.model.entity.CameraInformation;
import com.xkrs.model.entity.DeviceManagement;
import com.xkrs.model.vo.ADD;
import java.util.List;
@ -26,18 +25,9 @@ public interface CameraService {
* @return
*/
List<DeviceManagement> SelectDevice();
/**
* 查询摄像头信息
* @return
*/
String Videotape();
/**
*
*/
String Selectequipment();
/**
* 添加设备分页信息
*/
String InsertPaging(List<DeviceManagement> para);
boolean InsertPaging(DeviceManagement para);
}

View File

@ -0,0 +1,11 @@
package com.xkrs.service;
/**
* @Author: XinYi Song
* @Date: 2022/2/11 8:51
*/
public interface FireEventService {
String selectFireEventList();
}

View File

@ -1,7 +1,5 @@
package com.xkrs.service;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @Author: XinYi Song
* @Date: 2022/2/11 8:51
@ -10,6 +8,7 @@ public interface FireService {
/**
* 根据设备编码获取火情信息
*
* @param code
* @return
*/
@ -17,6 +16,7 @@ public interface FireService {
/**
* 根据设备编码和时间段查询火情信息
*
* @param code
* @param startTime
* @param endTime
@ -26,12 +26,14 @@ public interface FireService {
/**
* 查询最新三百条火情信息
*
* @return
*/
String findThreeHundredData();
/**
* 修改火点状态
*
* @param alarmCode
* @return
*/

View File

@ -1,25 +1,16 @@
package com.xkrs.service.impl;
import com.xkrs.common.encapsulation.PromptMessageEnum;
import com.xkrs.dao.CameraDao;
import com.xkrs.dao.DeviceManagementDao;
import com.xkrs.dao.FireDao;
import com.xkrs.model.entity.CameraInformation;
import com.xkrs.model.entity.DeviceManagement;
import com.xkrs.model.vo.ADD;
import com.xkrs.service.CameraService;
import com.xkrs.util.Query;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
/**
* @Author: XinYi Song
@ -33,12 +24,10 @@ public class CameraServiceImpl implements CameraService {
@Resource
private DeviceManagementDao deviceManagementDao;
Locale locale = LocaleContextHolder.getLocale();
@Override
public List<CameraInformation> SelectCameraAll() {
List<CameraInformation> cameraInformations = cameraDao.findAll();
if (cameraInformations == null) {
List<CameraInformation> cameraInformations =cameraDao.findAll();
if (cameraInformations==null) {
System.out.println("实现错误");
}
return cameraInformations;
@ -49,45 +38,35 @@ public class CameraServiceImpl implements CameraService {
try {
cameraDao.save(cameraInformation);
return true;
} catch (Exception e) {
return true;
}
catch (Exception e){
return false;
}
}
@Override
public List<DeviceManagement> SelectDevice() {
List<DeviceManagement> deviceManagements = deviceManagementDao.findAll();
if (deviceManagements == null) {
List<DeviceManagement> deviceManagements =deviceManagementDao.findAll();
if (deviceManagements==null) {
System.out.println("实现错误");
}
return deviceManagements;
}
@Override
public String Videotape() {
List<Map<String,String>> stringObjectMap = deviceManagementDao.Videotape();
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,stringObjectMap,locale);
}
@Override
public String Selectequipment() {
List<Map<String,String>> stringObjectMap = deviceManagementDao.equipment();
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,stringObjectMap,locale);
}
@Override
public String InsertPaging(List<DeviceManagement> para) {
public boolean InsertPaging(DeviceManagement para)
{
try {
deviceManagementDao.selectDeviceManagement(para);
return true;
}
catch (Exception e){
DeviceManagement deviceManagement = new DeviceManagement();
return "成功添加!";
} catch (Exception e) {
return e.getMessage();
return false;
}
}
}

View File

@ -0,0 +1,30 @@
package com.xkrs.service.impl;
import com.xkrs.common.encapsulation.PromptMessageEnum;
import com.xkrs.dao.FireEventDao;
import com.xkrs.model.entity.FireEvent;
import com.xkrs.service.FireEventService;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Locale;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
@Service
public class FireEventServiceImpl implements FireEventService {
@Resource
private FireEventDao fireEventDao;
private Locale locale = LocaleContextHolder.getLocale();
@Override
public String selectFireEventList() {
List<FireEvent> fireEventList = fireEventDao.findAll();
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, fireEventList, locale);
}
}

View File

@ -34,71 +34,74 @@ public class FireServerImpl implements FireService {
Locale locale = LocaleContextHolder.getLocale();
/**
* 根据设备编码获取火情的信息
*
* @param code
* @return
*/
@Cacheable(keyGenerator = "keyGenerator",unless="#result == null")
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
@Override
public String getFireInformation(String code) {
List<Fire> byDeviceCode = fireDao.findByDeviceCode(code);
if(byDeviceCode == null || byDeviceCode.size() == 0){
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"暂时没有该设备的火情信息!",locale);
if (byDeviceCode == null || byDeviceCode.size() == 0) {
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "暂时没有该设备的火情信息!", locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,byDeviceCode,locale);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, byDeviceCode, locale);
}
/**
* 根据设备编码和时间段查询火情信息
*
* @param code
* @param startTime
* @param endTime
* @return
*/
@Cacheable(keyGenerator = "keyGenerator",unless="#result == null")
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
@Override
public String selectFireBetweenTime(String code, String startTime, String endTime) {
List<Fire> fires = query.selectFireBetweenTime(code, startTime, endTime);
if(fires == null || fires.size() == 0){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没有该设备编号或时间段内的火情!",locale);
if (fires == null || fires.size() == 0) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有该设备编号或时间段内的火情!", locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,fires,locale);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, fires, locale);
}
/**
* 查询最新300条火情信息
*
* @return
*/
@Cacheable(keyGenerator = "keyGenerator",unless="#result == null")
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
@Override
public String findThreeHundredData() {
List<Fire> threeHundredData = fireDao.findThreeHundredData();
if(threeHundredData == null || threeHundredData.size() == 0){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时没有火情信息!",locale);
if (threeHundredData == null || threeHundredData.size() == 0) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有火情信息!", locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,threeHundredData,locale);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, threeHundredData, locale);
}
/**
* 修改火点状态
*
* @param alarmCode
* @return
*/
@CacheEvict(value = "FireServiceCache",allEntries = true)
@CacheEvict(value = "FireServiceCache", allEntries = true)
@Transactional(rollbackOn = Exception.class)
@Override
public String updateFireState(String alarmCode) {
Fire byAlarmCode = fireDao.findByAlarmCode(alarmCode);
if(byAlarmCode == null){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"火情编码错误,请检查!",locale);
if (byAlarmCode == null) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "火情编码错误,请检查!", locale);
}
if("1".equals(byAlarmCode.getFireState())){
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"该火情已处理!",locale);
if ("1".equals(byAlarmCode.getFireState())) {
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG, "该火情已处理!", locale);
}
fireDao.updateFireState(alarmCode);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"修改成功!",locale);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale);
}
}

View File

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

View File

@ -124,48 +124,6 @@ public class RequestUtil {
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请求
* @param url