From 02f13923556d1936a0f5b251a4d889340fa26ed0 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Sat, 10 Jan 2026 14:59:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(printer):=20=E6=B7=BB=E5=8A=A0=E4=BA=BA?= =?UTF-8?q?=E8=84=B8=E5=9B=BE=E7=89=87URL=E9=87=8D=E5=AE=9A=E5=90=91?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 实现通过人脸样本ID重定向到人脸图片URL的功能 - 实现通过人脸ID重定向到人脸图片URL的功能 - 添加404状态码处理当人脸数据不存在或URL为空的情况 - 使用response.sendRedirect实现URL重定向逻辑 --- .../printer/PrinterTvController.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/main/java/com/ycwl/basic/controller/printer/PrinterTvController.java b/src/main/java/com/ycwl/basic/controller/printer/PrinterTvController.java index 30296a5b..c1890662 100644 --- a/src/main/java/com/ycwl/basic/controller/printer/PrinterTvController.java +++ b/src/main/java/com/ycwl/basic/controller/printer/PrinterTvController.java @@ -197,5 +197,36 @@ public class PrinterTvController { return ApiResponse.success(resp); } + /** + * 通过人脸样本ID重定向到人脸图片URL + * + * @param faceSampleId 人脸样本ID + * @param response HTTP响应 + */ + @GetMapping("/faceSample/{faceSampleId}/url") + public void redirectToFaceSampleUrl(@PathVariable Long faceSampleId, HttpServletResponse response) throws Exception { + FaceSampleEntity faceSample = faceRepository.getFaceSample(faceSampleId); + if (faceSample == null || faceSample.getFaceUrl() == null) { + response.setStatus(404); + return; + } + response.sendRedirect(faceSample.getFaceUrl()); + } + + /** + * 通过人脸ID重定向到人脸图片URL + * + * @param faceId 人脸ID + * @param response HTTP响应 + */ + @GetMapping("/face/{faceId}/url") + public void redirectToFaceUrl(@PathVariable Long faceId, HttpServletResponse response) throws Exception { + FaceEntity face = faceRepository.getFace(faceId); + if (face == null || face.getFaceUrl() == null) { + response.setStatus(404); + return; + } + response.sendRedirect(face.getFaceUrl()); + } }