Default Changelist

This commit is contained in:
XinYi Song 2022-03-05 14:11:13 +08:00
parent f903e2f3e2
commit 8f889ef4e8
9 changed files with 706 additions and 15 deletions

View File

@ -199,6 +199,11 @@
<artifactId>jedis</artifactId> <artifactId>jedis</artifactId>
<version>3.7.0</version> <version>3.7.0</version>
</dependency> </dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool-all.version}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -1,9 +1,19 @@
package com.xkrs; 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.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.jms.annotation.EnableJms; import org.springframework.jms.annotation.EnableJms;
import javax.annotation.Resource;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/** /**
* 启动类 * 启动类
* @author XinYi Song * @author XinYi Song
@ -14,6 +24,7 @@ import org.springframework.jms.annotation.EnableJms;
public class SmartUrbanRuralApplication { public class SmartUrbanRuralApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(SmartUrbanRuralApplication.class, args); SpringApplication.run(SmartUrbanRuralApplication.class, args);
} }

View File

@ -1,9 +1,12 @@
package com.xkrs.controller; package com.xkrs.controller;
import com.alibaba.fastjson.JSON;
import com.xkrs.dao.CameraDao; import com.xkrs.dao.CameraDao;
import com.xkrs.dao.DeviceManagementDao; import com.xkrs.dao.DeviceManagementDao;
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.DA;
import com.xkrs.service.CameraService; import com.xkrs.service.CameraService;
import com.xkrs.service.FireService; import com.xkrs.service.FireService;
import org.springframework.web.bind.annotation.GetMapping; 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 org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.*;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -47,9 +52,44 @@ public class CameraController {
} }
@GetMapping("/SelectDeviceManagement") @GetMapping("/SelectDeviceManagement")
public List<DeviceManagement> 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<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";
} }
} }

View File

@ -20,10 +20,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.transaction.Transactional; import javax.transaction.Transactional;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject; import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
@ -134,8 +131,9 @@ public class TestController {
* @return * @return
*/ */
@GetMapping("/getPaging") @GetMapping("/getPaging")
public boolean 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;
@ -144,6 +142,7 @@ public class TestController {
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
e.printStackTrace(); e.printStackTrace();
} }
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");
@ -162,7 +161,9 @@ public class TestController {
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);
} }
return true;
return "成功!";
} }
} }

View File

@ -2,6 +2,7 @@ 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 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;
@ -17,8 +18,8 @@ public interface DeviceManagementDao extends JpaRepository<DeviceManagement,Long
/** /**
* 添加设备分页信息 * 添加设备分页信息
*/ */
@Query(value = "Insert device_management('','','','','','','','','','','','','','','','','') " + @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','?11','?12','?13','?14','?15');",nativeQuery = true) "VALUES('?1','?2','?3','?4','?5','?6','?7','?8','?9','?10');",nativeQuery = true)
List<Map<String,Object>> selectDeviceManagement(DeviceManagement deviceManagement); String selectDeviceManagement(List<ADD> deviceManagement);
} }

View File

@ -0,0 +1,18 @@
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

@ -0,0 +1,613 @@
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,6 +2,7 @@ package com.xkrs.service;
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 java.util.List; import java.util.List;
@ -29,5 +30,5 @@ public interface CameraService {
/** /**
* 添加设备分页信息 * 添加设备分页信息
*/ */
boolean InsertPaging(DeviceManagement para); String InsertPaging(List<ADD> para);
} }

View File

@ -5,6 +5,7 @@ import com.xkrs.dao.DeviceManagementDao;
import com.xkrs.dao.FireDao; import com.xkrs.dao.FireDao;
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.service.CameraService; import com.xkrs.service.CameraService;
import com.xkrs.util.Query; import com.xkrs.util.Query;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -58,15 +59,15 @@ public class CameraServiceImpl implements CameraService {
} }
@Override @Override
public boolean InsertPaging(DeviceManagement para) public String InsertPaging(List<ADD> para)
{ {
try { try {
deviceManagementDao.selectDeviceManagement(para); deviceManagementDao.selectDeviceManagement(para);
return true; return "成功添加!";
} }
catch (Exception e){ catch (Exception e){
return false; return "失败1";
} }
} }
} }