You've already forked FrameTour-BE
删除人脸逻辑
This commit is contained in:
@ -59,6 +59,11 @@ AppFaceController {
|
||||
return faceService.getById(faceId);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{faceId}")
|
||||
public ApiResponse deleteFace(@PathVariable("faceId") Long faceId) {
|
||||
return faceService.deleteFace(faceId);
|
||||
}
|
||||
|
||||
@PostMapping("/{faceId}/match")
|
||||
public ApiResponse match(@PathVariable("faceId") Long faceId) {
|
||||
faceService.matchFaceId(faceId);
|
||||
|
@ -8,6 +8,7 @@ import com.ycwl.basic.model.wvp.WvpSyncReqVo;
|
||||
import com.ycwl.basic.service.pc.DeviceService;
|
||||
import com.ycwl.basic.storage.StorageFactory;
|
||||
import com.ycwl.basic.storage.adapters.IStorageAdapter;
|
||||
import com.ycwl.basic.storage.utils.StorageUtil;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -42,7 +43,7 @@ public class WvpController {
|
||||
@PostMapping("/scenic/{scenicId}/{taskId}/uploadUrl")
|
||||
public String uploadUrl(@PathVariable("scenicId") Long scenicId, @PathVariable("taskId") Long taskId) {
|
||||
IStorageAdapter adapter = StorageFactory.use("assets-ext");
|
||||
return adapter.getUrlForUpload(WvpPassiveStorageOperator.getUrlForTask(taskId));
|
||||
return adapter.getUrlForUpload(new Date(System.currentTimeMillis() + 1000 * 60 * 60), "video/mp4", StorageUtil.joinPath("video-source", taskId.toString() + ".mp4"));
|
||||
}
|
||||
@PostMapping("/scenic/{scenicId}/{taskId}/success")
|
||||
public ApiResponse<String> success(@PathVariable("scenicId") Long scenicId, @PathVariable("taskId") Long taskId, @RequestBody FileObject fileObject) {
|
||||
|
@ -72,4 +72,6 @@ public interface SourceMapper {
|
||||
int deleteNotRelateSource(int type, Date endDate);
|
||||
|
||||
int deleteNotBuyRelations(Long scenicId, Date endDate);
|
||||
|
||||
int deleteNotBuyFaceRelation(Long userId, Long faceId);
|
||||
}
|
||||
|
@ -52,4 +52,6 @@ public interface VideoMapper {
|
||||
VideoEntity getEntity(Long videoId);
|
||||
|
||||
int deleteNotBuyRelations(Long scenicId, Date endDate);
|
||||
|
||||
int deleteNotBuyFaceRelations(Long userId, Long faceId);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import com.ycwl.basic.mapper.FaceSampleMapper;
|
||||
import com.ycwl.basic.mapper.SourceMapper;
|
||||
import com.ycwl.basic.mapper.StatisticsMapper;
|
||||
import com.ycwl.basic.mapper.FaceMapper;
|
||||
import com.ycwl.basic.mapper.VideoMapper;
|
||||
import com.ycwl.basic.model.mobile.face.FaceRecognizeResp;
|
||||
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
||||
import com.ycwl.basic.model.mobile.statistic.req.StatisticsRecordAddReq;
|
||||
@ -64,6 +65,8 @@ public class FaceServiceImpl implements FaceService {
|
||||
private OrderBiz orderBiz;
|
||||
@Autowired
|
||||
private FaceRepository faceRepository;
|
||||
@Autowired
|
||||
private VideoMapper videoMapper;
|
||||
|
||||
@Override
|
||||
public ApiResponse<PageInfo<FaceRespVO>> pageQuery(FaceReqQuery faceReqQuery) {
|
||||
@ -274,4 +277,17 @@ public class FaceServiceImpl implements FaceService {
|
||||
return scenicDbSearchResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResponse deleteFace(Long faceId) {
|
||||
FaceEntity face = faceRepository.getFace(faceId);
|
||||
faceMapper.deleteById(faceId);
|
||||
faceRepository.clearFaceCache(faceId);
|
||||
new Thread(() -> {
|
||||
sourceMapper.deleteNotBuyFaceRelation(face.getMemberId(), faceId);
|
||||
videoMapper.deleteNotBuyFaceRelations(face.getMemberId(), faceId);
|
||||
faceService.deleteFaceSample(USER_FACE_DB_NAME+face.getScenicId().toString(), faceId.toString());
|
||||
}).start();
|
||||
return ApiResponse.success("删除成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,4 +29,6 @@ public interface FaceService {
|
||||
SearchFaceRespVo matchFaceId(Long faceId);
|
||||
|
||||
SearchFaceRespVo matchFaceId(Long faceId, boolean isNew);
|
||||
|
||||
ApiResponse deleteFace(Long faceId);
|
||||
}
|
||||
|
Reference in New Issue
Block a user