人脸识别日志

This commit is contained in:
2024-12-26 15:32:41 +08:00
parent 64504fdf3b
commit 473e7080a1
9 changed files with 239 additions and 43 deletions

View File

@ -0,0 +1,72 @@
package com.ycwl.basic.model.pc.faceDetectLog.entity;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.facebody.model.v20191230.SearchFaceRequest;
import com.aliyuncs.facebody.model.v20191230.SearchFaceResponse;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ycwl.basic.model.pc.faceDetectLog.resp.MatchLocalRecord;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
@TableName("face_detect_log")
public class FaceDetectLog {
@TableId(type = IdType.AUTO)
private Integer id;
private Date createTime;
private String reason;
private String faceUrl;
private String dbName;
private String matchRawResult;
private String matchLocalRecord;
public static FaceDetectLog quickCreate(String reason) {
FaceDetectLog log = new FaceDetectLog();
log.reason = reason;
return log;
}
public static FaceDetectLog quickCreate(String reason, SearchFaceRequest request) {
FaceDetectLog log = new FaceDetectLog();
log.reason = reason;
return log.fillRequest(request);
}
public FaceDetectLog fillRequest(SearchFaceRequest request) {
this.dbName = request.getDbName();
this.faceUrl = request.getImageUrl();
this.createTime = new Date();
return this;
}
public FaceDetectLog fillResponse(SearchFaceResponse response) {
this.matchRawResult = JSONObject.toJSONString(response.getData());
return this;
}
public List<MatchLocalRecord> matchLocalRecord() {
if (matchLocalRecord == null) {
return null;
}
return JSONArray.parseArray(matchLocalRecord, MatchLocalRecord.class);
}
public void matchLocalRecord(List<MatchLocalRecord> matchLocalRecord) {
if (matchLocalRecord == null) {
this.matchLocalRecord = null;
} else {
this.matchLocalRecord = JSONArray.toJSONString(matchLocalRecord);
}
}
}

View File

@ -0,0 +1,11 @@
package com.ycwl.basic.model.pc.faceDetectLog.resp;
import lombok.Data;
@Data
public class MatchLocalRecord {
private Long faceSampleId;
private String faceUrl;
private Float confidence;
private String idStr;
}