视频模板代码框架

This commit is contained in:
spllzh
2025-10-09 16:15:39 +08:00
parent 6dff49fcc1
commit b047a3be90
38 changed files with 971 additions and 116 deletions

View File

@@ -49,7 +49,7 @@ public class FaceDetectTest {
// 发送请求
RestTemplate restTemplate = new RestTemplate();
System.out.println("发送人脸检测请求到: " + API_URL);
System.out.println("发送图像检测请求到: " + API_URL);
System.out.println("请求参数: " + new ObjectMapper().writeValueAsString(requestBody));
ResponseEntity<String> response = restTemplate.exchange(
@@ -70,13 +70,13 @@ public class FaceDetectTest {
JsonNode jsonResponse = mapper.readTree(response.getBody());
System.out.println("解析后的响应: " + mapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonResponse));
// 检查是否有检测到人脸
// 检查是否有检测到图像
if (jsonResponse.has("output") && jsonResponse.get("output").has("faces")) {
JsonNode faces = jsonResponse.get("output").get("faces");
System.out.println("检测到人脸数量: " + faces.size());
System.out.println("检测到图像数量: " + faces.size());
for (int i = 0; i < faces.size(); i++) {
JsonNode face = faces.get(i);
System.out.println("人脸 " + (i + 1) + ": " + face.toString());
System.out.println("图像 " + (i + 1) + ": " + face.toString());
}
}
}
@@ -90,7 +90,7 @@ public class FaceDetectTest {
System.err.println("错误响应: " + e.getResponseBodyAsString());
e.printStackTrace();
} catch (Exception e) {
System.err.println("人脸检测请求失败: " + e.getMessage());
System.err.println("图像检测请求失败: " + e.getMessage());
e.printStackTrace();
}
}

View File

@@ -11,7 +11,7 @@ import org.springframework.transaction.annotation.Transactional;
import static org.junit.jupiter.api.Assertions.*;
/**
* 人脸检测控制器集成测试
* 图像检测控制器集成测试
*/
@SpringBootTest
@ActiveProfiles("test")
@@ -28,7 +28,7 @@ public class FaceDetectControllerIntegrationTest {
String testImageUrl = "http://101.35.52.237:19006/api/v1/download-shared-object/aHR0cDovLzEyNy4wLjAuMTo5MDA1L3NyYy1iYXNlLWF1ZGlvLXZpZGVvLyVFNSVCRSVBRSVFNCVCRiVBMSVFNSU5QiVCRSVFNyU4OSU4N18yMDI1MTAwNTEyMDIwNV81Nl80OS5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD0wRUE4RlhHQUlTN1FQSk9VQUZIOSUyRjIwMjUxMDA1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MTAwNVQwNDE3NDVaJlgtQW16LUV4cGlyZXM9NDMyMDAmWC1BbXotU2VjdXJpdHktVG9rZW49ZXlKaGJHY2lPaUpJVXpVeE1pSXNJblI1Y0NJNklrcFhWQ0o5LmV5SmhZMk5sYzNOTFpYa2lPaUl3UlVFNFJsaEhRVWxUTjFGUVNrOVZRVVpJT1NJc0ltVjRjQ0k2TVRjMU9UWTNPVGN4TkN3aWNHRnlaVzUwSWpvaWJXbHVhVzloWkcxcGJpSjkuLWhSOFRobUpXUFNQdGVQM2V4TzdITmlkUHQ1RXBDeWRJMVV2cG0yQXJxczJsR0hBcnBTeEZWZEdJY1ZOUHdKNlF2QUZjbUJQOWQtQmtFampyUXpGaGcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnZlcnNpb25JZD1udWxsJlgtQW16LVNpZ25hdHVyZT1mN2NjODUxNWFiYzgxZDFlNDZmNjg1YzBkMzAxMzM0MjAyZjM5NmIxODMzMzY4MGM0OWE3ZGYxYmQ5ODk5ZWM4";
try {
// 执行人脸检测
// 执行图像检测
FaceDetectLog result = faceDetectLogService.detectFaceAndSave(testImageUrl);
// 验证结果
@@ -38,10 +38,10 @@ public class FaceDetectControllerIntegrationTest {
assertEquals(testImageUrl, result.getImageUrl());
assertNotNull(result.getRequestTime());
System.out.println("人脸检测测试结果:");
System.out.println("图像检测测试结果:");
System.out.println("请求ID: " + result.getRequestId());
System.out.println("成功状态: " + result.getSuccess());
System.out.println("人脸数量: " + result.getFaceCount());
System.out.println("图像数量: " + result.getFaceCount());
System.out.println("处理时间: " + result.getProcessingTimeMs() + "ms");
System.out.println("HTTP状态码: " + result.getStatusCode());
@@ -55,7 +55,7 @@ public class FaceDetectControllerIntegrationTest {
}
} catch (Exception e) {
System.err.println("人脸检测测试失败: " + e.getMessage());
System.err.println("图像检测测试失败: " + e.getMessage());
e.printStackTrace();
}
}
@@ -66,7 +66,7 @@ public class FaceDetectControllerIntegrationTest {
String invalidImageUrl = "https://invalid-url.com/nonexistent.jpg";
try {
// 执行人脸检测
// 执行图像检测
FaceDetectLog result = faceDetectLogService.detectFaceAndSave(invalidImageUrl);
// 验证结果

View File

@@ -147,3 +147,5 @@ public class TtsRequestLogShortUrlTest {