95 lines
2.9 KiB
Java
95 lines
2.9 KiB
Java
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;
|
|
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;
|
|
|
|
/**
|
|
* @Author: XinYi Song
|
|
* @Date: 2022/3/3 11:56
|
|
*/
|
|
@RestController
|
|
public class CameraController {
|
|
@Resource
|
|
private CameraService cameraService;
|
|
|
|
@Resource
|
|
private CameraDao cameraDao;
|
|
|
|
@Resource
|
|
private DeviceManagementDao deviceManagementDao;
|
|
|
|
@GetMapping("/getCameraInformation")
|
|
public List<CameraInformation> getCameraInformation(){
|
|
|
|
return cameraService.SelectCameraAll();
|
|
}
|
|
|
|
@GetMapping("/insertCameraInformation")
|
|
public boolean insertCameraInformation(CameraInformation cameraInformation){
|
|
try {
|
|
cameraService.InsertCamera(cameraInformation);
|
|
return true;
|
|
}
|
|
catch (Exception e){
|
|
return false;
|
|
|
|
}
|
|
}
|
|
|
|
@GetMapping("/SelectDeviceManagement")
|
|
public String 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();
|
|
System.out.println(contnetTotal);
|
|
|
|
DA tempBran = JSON.parseObject(contnetTotal, DA.class);
|
|
|
|
List<DA.DataDTO.PageDataDTO> pageData = tempBran.getData().getPageData();
|
|
List<ADD> 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";
|
|
}
|
|
}
|