提交 8c952484 authored 作者: yangqi's avatar yangqi

1

上级 4abae0fa
...@@ -3,7 +3,6 @@ package cn.lefull.api; ...@@ -3,7 +3,6 @@ package cn.lefull.api;
import cn.lefull.common.annotation.NoAuth; import cn.lefull.common.annotation.NoAuth;
import cn.lefull.common.response.ApiResponse; import cn.lefull.common.response.ApiResponse;
import cn.lefull.service.ali.FaceService; import cn.lefull.service.ali.FaceService;
import jdk.nashorn.internal.objects.annotations.Property;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -37,7 +36,6 @@ public class FaceController { ...@@ -37,7 +36,6 @@ public class FaceController {
@NoAuth @NoAuth
@GetMapping("/addFace") @GetMapping("/addFace")
public ApiResponse<Object> addFace(String dbName, String entityId, String labels) throws Exception { public ApiResponse<Object> addFace(String dbName, String entityId, String labels) throws Exception {
//System.out.println("数据库名" + dbName + " entityId:" + entityId + " labels:" + labels);
faceService.addFace(dbName, entityId, labels); faceService.addFace(dbName, entityId, labels);
return new ApiResponse<>(); return new ApiResponse<>();
} }
......
package cn.lefull.common.utils;
/**
* @author 杨奇
*/
public class Utils {
public static void checkStringNotEmpty(String str, String name) throws Exception {
if(str == null || str.isEmpty()){
throw new Exception(name + "为空");
}
}
}
package cn.lefull.service.ali; package cn.lefull.service.ali;
import cn.lefull.common.sdk.ali.base.Face; import cn.lefull.common.sdk.ali.base.Face;
import cn.lefull.common.utils.Utils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -23,6 +24,9 @@ public class FaceService { ...@@ -23,6 +24,9 @@ public class FaceService {
} }
public void addFace(String dbName, String entityId, String labels) throws Exception { public void addFace(String dbName, String entityId, String labels) throws Exception {
Utils.checkStringNotEmpty(dbName, "dbName");
Utils.checkStringNotEmpty(entityId, "entityId");
Utils.checkStringNotEmpty(labels, "labels");
face.addFace(dbName, entityId, labels); face.addFace(dbName, entityId, labels);
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论