|
|
|
@ -34,6 +34,7 @@ import org.apache.commons.net.ftp.FTPSClient; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
@ -71,25 +72,31 @@ public class HikVisionServiceImpl implements HikVisionService { |
|
|
|
|
|
|
|
private String picPath; |
|
|
|
|
|
|
|
// @Value("${file.hrUavUrl:test}") |
|
|
|
@Value("${file.hrUavUrl:null}") |
|
|
|
// private String hrUavUrl = "http://192.168.4.167:2000/"; |
|
|
|
private String hrUavUrl = "http://192.168.4.160:2000/"; |
|
|
|
// private String hrUavUrl = "http://192.168.4.160:2000/"; |
|
|
|
private String hrUavUrl; |
|
|
|
|
|
|
|
// @Value("${file.hrFtpUrl:test}") |
|
|
|
private String hrFtpUrl = "ftp://ftpuser:atia2018@192.168.4.129:10012/"; |
|
|
|
@Value("${file.hrFtpUrl:null}") |
|
|
|
// private String hrFtpUrl = "ftp://ftpuser:atia2018@192.168.4.129:10012/"; |
|
|
|
private String hrFtpUrl; |
|
|
|
|
|
|
|
// @Value("${file.ftpUrlAddress:test}") |
|
|
|
private String ftpUrlAddress = "192.168.4.129"; |
|
|
|
@Value("${file.ftpUrlAddress:null}") |
|
|
|
private String ftpUrlAddress; |
|
|
|
// private String ftpUrlAddress = "192.168.4.129"; |
|
|
|
// private String ftpUrlAddress = "192.168.1.116"; |
|
|
|
|
|
|
|
// @Value("${file.ftpUrlAccount:test}") |
|
|
|
private String ftpUrlAccount = "ftpuser"; |
|
|
|
@Value("${file.ftpUrlAccount:null}") |
|
|
|
private String ftpUrlAccount; |
|
|
|
// private String ftpUrlAccount = "ftpuser"; |
|
|
|
|
|
|
|
// @Value("${file.ftpUrlPwd:test}") |
|
|
|
private String ftpUrlPwd = "atia2018"; |
|
|
|
@Value("${file.ftpUrlPwd:null}") |
|
|
|
private String ftpUrlPwd; |
|
|
|
// private String ftpUrlPwd = "atia2018"; |
|
|
|
|
|
|
|
// @Value("${file.ftpUrlPort:10000}") |
|
|
|
private Integer ftpUrlPort = 10012; |
|
|
|
@Value("${file.ftpUrlPort:null}") |
|
|
|
private Integer ftpUrlPort; |
|
|
|
// private Integer ftpUrlPort = 10012; |
|
|
|
// private Integer ftpUrlPort = 10990; |
|
|
|
|
|
|
|
// @Value("${file.produceEnvironment:true}") |
|
|
|
@ -759,7 +766,7 @@ public class HikVisionServiceImpl implements HikVisionService { |
|
|
|
g2d.drawString(line2, rectX + 5, rectY + 30); |
|
|
|
g2d.drawString(line3, rectX + 5, rectY + 45); |
|
|
|
|
|
|
|
// 在最高温度点画一个空心圆(红色边框) |
|
|
|
// 在最高温度点画一个空心圆(红色边框) |
|
|
|
if (maxTempX != null && maxTempY != null) { |
|
|
|
log.info("画最高温度的点,坐标:x={}, y={}", maxTempX, maxTempY); |
|
|
|
|
|
|
|
@ -934,7 +941,7 @@ public class HikVisionServiceImpl implements HikVisionService { |
|
|
|
String csvData = convertMatrixToCsv(temperatureMatrix); |
|
|
|
InputStream csvStream = new ByteArrayInputStream(csvData.getBytes(StandardCharsets.UTF_8)); |
|
|
|
|
|
|
|
String csvPath = picPath +pureName +".csv"; |
|
|
|
String csvPath = picPath + pureName + ".csv"; |
|
|
|
log.info("保存csv文件:{}", csvPath); |
|
|
|
picFtp(csvPath, csvStream, ftpUrlAddress, ftpUrlPort, ftpUrlAccount, ftpUrlPwd); |
|
|
|
} |
|
|
|
@ -1558,8 +1565,11 @@ public class HikVisionServiceImpl implements HikVisionService { |
|
|
|
return infraredInfo; |
|
|
|
} |
|
|
|
|
|
|
|
public TemperatureData TemperatureMeasurement(){ |
|
|
|
TemperatureData temperatureData =new TemperatureData(); |
|
|
|
public TemperatureData TemperatureMeasurement() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TemperatureData temperatureData = new TemperatureData(); |
|
|
|
OkHttpClient client = new OkHttpClient.Builder() |
|
|
|
.connectTimeout(5, TimeUnit.SECONDS) // 连接超时5秒 |
|
|
|
.readTimeout(10, TimeUnit.SECONDS) // 读取超时10秒 |
|
|
|
@ -1569,8 +1579,9 @@ public class HikVisionServiceImpl implements HikVisionService { |
|
|
|
|
|
|
|
// 构造 JSON 请求体 |
|
|
|
MediaType JSON = MediaType.parse("application/json; charset=utf-8"); |
|
|
|
String jsonBody = "{\"ip\":\"192.168.1.70\",\"port\":\"8000\",\"userName\":\"admin\",\"password\":\"AA123456\"}"; |
|
|
|
RequestBody body = RequestBody.create(JSON,jsonBody); |
|
|
|
String jsonBody = "{\"ip\":\"192.168.12.11\",\"port\":\"8000\",\"userName\":\"admin\",\"password\":\"sshw1234\"}"; |
|
|
|
log.info("JSON 请求体: " +jsonBody); |
|
|
|
RequestBody body = RequestBody.create(JSON, jsonBody); |
|
|
|
try { |
|
|
|
// 构建 multipart 请求体 |
|
|
|
// RequestBody requestBody = new MultipartBody.Builder() |
|
|
|
@ -1583,7 +1594,7 @@ public class HikVisionServiceImpl implements HikVisionService { |
|
|
|
|
|
|
|
// 构建请求 |
|
|
|
Request request = new Request.Builder() |
|
|
|
.url("http://192.168.4.248:8080/hw/cameraHong") |
|
|
|
.url("http://172.21.101.111:8080/hw/cameraHong") |
|
|
|
.post(body) |
|
|
|
.addHeader("Content-Type", "application/json") |
|
|
|
.build(); |
|
|
|
@ -1617,7 +1628,7 @@ public class HikVisionServiceImpl implements HikVisionService { |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
return temperatureData; |
|
|
|
return temperatureData; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@ -1627,6 +1638,14 @@ public class HikVisionServiceImpl implements HikVisionService { |
|
|
|
InputStream inputStream = downloadFtp(updatePath); |
|
|
|
if (inputStream == null) { |
|
|
|
log.info("图片地址" + updatePath + "无返回"); |
|
|
|
try { |
|
|
|
float[][] floats = exceptionHandling(); |
|
|
|
String csvData = convertMatrixToCsv(floats); |
|
|
|
InputStream csvStream = new ByteArrayInputStream(csvData.getBytes(StandardCharsets.UTF_8)); |
|
|
|
return csvStream; |
|
|
|
} catch (IOException e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// if (!produceEnvironment) { |
|
|
|
|