From 8f889ef4e85582d09d147ac77a6a03576cd02002 Mon Sep 17 00:00:00 2001
From: XinYi Song <2037158277@qq.com>
Date: Sat, 5 Mar 2022 14:11:13 +0800
Subject: [PATCH] Default Changelist
---
pom.xml | 5 +
.../com/xkrs/SmartUrbanRuralApplication.java | 11 +
.../com/xkrs/controller/CameraController.java | 44 +-
.../com/xkrs/controller/TestController.java | 13 +-
.../com/xkrs/dao/DeviceManagementDao.java | 7 +-
src/main/java/com/xkrs/model/vo/ADD.java | 18 +
src/main/java/com/xkrs/model/vo/DA.java | 613 ++++++++++++++++++
.../java/com/xkrs/service/CameraService.java | 3 +-
.../xkrs/service/impl/CameraServiceImpl.java | 7 +-
9 files changed, 706 insertions(+), 15 deletions(-)
create mode 100644 src/main/java/com/xkrs/model/vo/ADD.java
create mode 100644 src/main/java/com/xkrs/model/vo/DA.java
diff --git a/pom.xml b/pom.xml
index 1251320..d0dc1b6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -199,6 +199,11 @@
jedis
3.7.0
+
+ cn.hutool
+ hutool-all
+ ${hutool-all.version}
+
diff --git a/src/main/java/com/xkrs/SmartUrbanRuralApplication.java b/src/main/java/com/xkrs/SmartUrbanRuralApplication.java
index bb6377e..256843c 100644
--- a/src/main/java/com/xkrs/SmartUrbanRuralApplication.java
+++ b/src/main/java/com/xkrs/SmartUrbanRuralApplication.java
@@ -1,9 +1,19 @@
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
@@ -14,6 +24,7 @@ import org.springframework.jms.annotation.EnableJms;
public class SmartUrbanRuralApplication {
public static void main(String[] args) {
+
SpringApplication.run(SmartUrbanRuralApplication.class, args);
}
diff --git a/src/main/java/com/xkrs/controller/CameraController.java b/src/main/java/com/xkrs/controller/CameraController.java
index d831fb6..a9c1151 100644
--- a/src/main/java/com/xkrs/controller/CameraController.java
+++ b/src/main/java/com/xkrs/controller/CameraController.java
@@ -1,9 +1,12 @@
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;
@@ -11,6 +14,8 @@ 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;
/**
@@ -47,9 +52,44 @@ public class CameraController {
}
@GetMapping("/SelectDeviceManagement")
- public List SelectDeviceManagement()
+ public String SelectDeviceManagement()
{
- return cameraService.SelectDevice();
+ 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();
+ System.out.println(contnetTotal);
+ DA tempBran = JSON.parseObject(contnetTotal, DA.class);
+
+ List pageData = tempBran.getData().getPageData();
+ List list1=new ArrayList<>();
+
+ for (DA.DataDTO.PageDataDTO item: pageData) {
+ ADD add=new ADD();
+ add.deviceName=item.getDeviceName();
+ add.deviCevode=item.getDeviceCode();
+ add.deviceSn=item.getDeviceSn();
+ add.deviceCategory=item.getDeviceCategory();
+ add.deviceManufacture=item.getDeviceManufacturer();
+ add.deviceType=item.getDeviceType();
+ add.deviceModel=item.getDeviceModel();
+ add.deviceLp=item.getDeviceIp();
+ add.devicePort=item.getDevicePort();
+ add.ownerCode=item.getOwnerCode();
+ list1.add(add);
+ }
+ cameraService.InsertPaging(list1);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return "over";
}
}
diff --git a/src/main/java/com/xkrs/controller/TestController.java b/src/main/java/com/xkrs/controller/TestController.java
index eca1cc3..85099ce 100644
--- a/src/main/java/com/xkrs/controller/TestController.java
+++ b/src/main/java/com/xkrs/controller/TestController.java
@@ -20,10 +20,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.transaction.Transactional;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
+import java.util.*;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
@@ -134,8 +131,9 @@ public class TestController {
* @return
*/
@GetMapping("/getPaging")
- public boolean getPaging( String para) {
+ public String getPaging( String para) {
String forecastWeather = ManagementUtil.getPaging(para);
+
List