You've already forked FrameTour-BE
逻辑调整
This commit is contained in:
@ -3,6 +3,7 @@ package com.ycwl.basic.service.impl.mobile;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ycwl.basic.biz.OrderBiz;
|
||||
import com.ycwl.basic.biz.TaskStatusBiz;
|
||||
import com.ycwl.basic.constant.BaseContextHandler;
|
||||
import com.ycwl.basic.mapper.*;
|
||||
import com.ycwl.basic.model.mobile.goods.*;
|
||||
@ -66,6 +67,8 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
private OrderBiz orderBiz;
|
||||
@Autowired
|
||||
private FaceRepository faceRepository;
|
||||
@Autowired
|
||||
private TaskStatusBiz taskStatusBiz;
|
||||
|
||||
public ApiResponse<List<GoodsPageVO>> goodsList(GoodsReqQuery query) {
|
||||
//查询原素材
|
||||
@ -256,7 +259,6 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
@Override
|
||||
public VideoTaskStatusVO getTaskStatusByFaceId(Long userId, Long faceId) {
|
||||
FaceEntity face = faceRepository.getFace(faceId);
|
||||
List<MemberVideoEntity> taskList = videoMapper.listRelationByFace(userId, faceId);
|
||||
VideoTaskStatusVO response = new VideoTaskStatusVO();
|
||||
response.setFaceId(faceId);
|
||||
if (face == null) {
|
||||
@ -264,6 +266,19 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
return response;
|
||||
}
|
||||
response.setScenicId(face.getScenicId());
|
||||
int faceCutStatus = taskStatusBiz.getFaceCutStatus(faceId);
|
||||
response.setCutStatus(faceCutStatus);
|
||||
if (faceCutStatus == 0) {
|
||||
// 切视频中,也显示正在处理
|
||||
response.setStatus(2);
|
||||
return response;
|
||||
}
|
||||
List<MemberVideoEntity> taskList = videoMapper.listRelationByFace(userId, faceId);
|
||||
if (faceCutStatus != 1 && taskList.isEmpty()) {
|
||||
// 视频切成了能够获取视频的状态,但是没有任务,还是显示正在处理
|
||||
response.setStatus(0);
|
||||
return response;
|
||||
}
|
||||
if (taskList.isEmpty()) {
|
||||
response.setStatus(0);
|
||||
return response;
|
||||
|
@ -26,7 +26,6 @@ import com.ycwl.basic.service.task.TaskService;
|
||||
import com.ycwl.basic.storage.StorageFactory;
|
||||
import com.ycwl.basic.storage.adapters.IStorageAdapter;
|
||||
import com.ycwl.basic.storage.utils.StorageUtil;
|
||||
import com.ycwl.basic.task.VideoPieceGetter;
|
||||
import com.ycwl.basic.utils.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -188,7 +187,7 @@ public class FaceServiceImpl implements FaceService {
|
||||
FaceRecognizeResp resp = new FaceRecognizeResp();
|
||||
resp.setUrl(faceUrl);
|
||||
resp.setFaceId(newFaceId);
|
||||
matchFaceId(newFaceId);
|
||||
matchFaceId(newFaceId, oldFaceId == null);
|
||||
return ApiResponse.success(resp);
|
||||
}
|
||||
|
||||
@ -197,8 +196,14 @@ public class FaceServiceImpl implements FaceService {
|
||||
return faceMapper.listByScenicAndUserId(scenicId, userId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SearchFaceRespVo matchFaceId(Long faceId) {
|
||||
return matchFaceId(faceId, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchFaceRespVo matchFaceId(Long faceId, boolean isNew) {
|
||||
FaceEntity face = faceRepository.getFace(faceId);
|
||||
if (face == null) {
|
||||
return null;
|
||||
|
@ -27,4 +27,5 @@ public interface FaceService {
|
||||
List<FaceRespVO> listByUser(Long userId, String scenicId);
|
||||
SearchFaceRespVo matchFaceId(Long faceId);
|
||||
|
||||
SearchFaceRespVo matchFaceId(Long faceId, boolean isNew);
|
||||
}
|
||||
|
@ -1,4 +0,0 @@
|
||||
package com.ycwl.basic.service.task;
|
||||
|
||||
public interface TaskTemplateService {
|
||||
}
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ycwl.basic.biz.OrderBiz;
|
||||
import com.ycwl.basic.biz.TaskStatusBiz;
|
||||
import com.ycwl.basic.biz.TemplateBiz;
|
||||
import com.ycwl.basic.constant.TaskConstant;
|
||||
import com.ycwl.basic.mapper.FaceMapper;
|
||||
@ -109,6 +110,8 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
@Autowired
|
||||
private OrderRepository orderRepository;
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
@Autowired
|
||||
private TaskStatusBiz taskStatusBiz;
|
||||
|
||||
|
||||
private RenderWorkerEntity getWorker(@NonNull WorkerAuthReqVo req) {
|
||||
@ -370,6 +373,12 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
if (faceSampleList.isEmpty()) {
|
||||
log.info("faceId:{} sample list not exist", faceId);
|
||||
}
|
||||
if (automatic == 1) {
|
||||
if (templateBiz.determineTemplateCanGenerate(templateId, faceId, false)) {
|
||||
// 临时写死,当自动生成视频,切片也算合成中,并更新状态
|
||||
taskStatusBiz.setFaceCutStatus(face.getId(), 0);
|
||||
}
|
||||
}
|
||||
List<Long> faceSampleIds = faceSampleList.stream().map(FaceSampleEntity::getId).collect(Collectors.toList());
|
||||
List<SourceEntity> sourceList = sourceMapper.listVideoByScenicFaceRelation(face.getScenicId(), faceId);
|
||||
// ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(face.getScenicId());
|
||||
@ -493,6 +502,8 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
}
|
||||
}
|
||||
videoMapper.addRelation(memberVideoEntity);
|
||||
// 任务生成了,需要更新切割任务状态
|
||||
taskStatusBiz.setFaceCutStatus(faceId, 2);
|
||||
};
|
||||
if (faceSampleIds.isEmpty()) {
|
||||
// 没有人脸样本
|
||||
|
@ -1,31 +0,0 @@
|
||||
package com.ycwl.basic.service.task.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ycwl.basic.mapper.TemplateMapper;
|
||||
import com.ycwl.basic.model.pc.template.entity.TemplateConfigEntity;
|
||||
import com.ycwl.basic.service.task.TaskTemplateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class TaskTemplateServiceImpl implements TaskTemplateService {
|
||||
@Autowired
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
@Autowired
|
||||
private TemplateMapper templateMapper;
|
||||
|
||||
private static final String TEMPLATE_KEY = "template:";
|
||||
private static final String TEMPLATE_CONFIG_KEY = "template:config:";
|
||||
|
||||
private TemplateConfigEntity getTemplateConfig(Long templateId) {
|
||||
if (redisTemplate.hasKey(TEMPLATE_CONFIG_KEY + templateId)) {
|
||||
return JSON.parseObject(redisTemplate.opsForValue().get(TEMPLATE_CONFIG_KEY + templateId), TemplateConfigEntity.class);
|
||||
}
|
||||
TemplateConfigEntity config = templateMapper.getConfig(templateId);
|
||||
if (config != null) {
|
||||
redisTemplate.opsForValue().set(TEMPLATE_CONFIG_KEY + templateId, JSON.toJSONString(config));
|
||||
}
|
||||
return config;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user