You've already forked FrameTour-BE
bug
This commit is contained in:
@@ -10,7 +10,7 @@ import java.util.Date;
|
||||
|
||||
public interface TaskService {
|
||||
TaskSyncRespVo handleSyncTask(TaskReqVo req);
|
||||
void createRenderTask(Long scenicId, Long templateId, Long faceId);
|
||||
boolean createRenderTask(Long scenicId, Long templateId, Long faceId);
|
||||
|
||||
TemplateRespVO workerGetTemplate(Long templateId, WorkerAuthReqVo req);
|
||||
|
||||
|
@@ -32,6 +32,7 @@ import com.ycwl.basic.model.pc.faceSample.resp.FaceSampleRespVO;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
||||
import com.ycwl.basic.model.task.resp.AddFaceSampleRespVo;
|
||||
import com.ycwl.basic.model.task.resp.SearchFaceRespVo;
|
||||
import com.ycwl.basic.repository.FaceRepository;
|
||||
import com.ycwl.basic.service.task.TaskFaceService;
|
||||
import com.ycwl.basic.storage.StorageFactory;
|
||||
import com.ycwl.basic.storage.adapters.IStorageAdapter;
|
||||
@@ -71,6 +72,8 @@ public class TaskFaceServiceImpl implements TaskFaceService {
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
@Autowired
|
||||
private FaceDetectLogMapper logMapper;
|
||||
@Autowired
|
||||
private FaceRepository faceRepository;
|
||||
|
||||
private IAcsClient getClient() {
|
||||
DefaultProfile profile = DefaultProfile.getProfile(
|
||||
@@ -91,6 +94,7 @@ public class TaskFaceServiceImpl implements TaskFaceService {
|
||||
faceEntity.setScore(respVo.getScore());
|
||||
faceEntity.setMatchSampleIds(StringUtils.join(respVo.getSampleListIds(), ","));
|
||||
faceMapper.update(faceEntity);
|
||||
faceRepository.clearFaceCache(faceId);
|
||||
}
|
||||
return respVo;
|
||||
}
|
||||
@@ -162,7 +166,9 @@ public class TaskFaceServiceImpl implements TaskFaceService {
|
||||
AddFaceSampleRespVo respVo = addFaceSample(faceSampleRespVO.getScenicId().toString(), entityId, faceSampleRespVO.getFaceUrl(), faceSampleId.toString());
|
||||
FaceSampleEntity faceSampleEntity = new FaceSampleEntity();
|
||||
faceSampleEntity.setId(faceSampleId);
|
||||
faceSampleEntity.setScore(respVo.getScore());
|
||||
if (respVo != null) {
|
||||
faceSampleEntity.setScore(respVo.getScore());
|
||||
}
|
||||
faceSampleEntity.setUpdateAt(new Date());
|
||||
faceSampleMapper.update(faceSampleEntity);
|
||||
addFaceSampleUrlCache(faceSampleId, faceSampleRespVO.getFaceUrl());
|
||||
@@ -178,6 +184,7 @@ public class TaskFaceServiceImpl implements TaskFaceService {
|
||||
try {
|
||||
client.getAcsResponse(request);
|
||||
} catch (ClientException e) {
|
||||
log.error("addFaceEntity", e);
|
||||
return null;
|
||||
}
|
||||
AddFaceRequest addFaceRequest = new AddFaceRequest();
|
||||
@@ -191,6 +198,7 @@ public class TaskFaceServiceImpl implements TaskFaceService {
|
||||
respVo.setScore(acsResponse.getData().getQualitieScore());
|
||||
return respVo;
|
||||
} catch (ClientException e) {
|
||||
log.error("addFaceEntity", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -16,9 +16,9 @@ import com.ycwl.basic.mapper.TaskMapper;
|
||||
import com.ycwl.basic.mapper.TemplateMapper;
|
||||
import com.ycwl.basic.mapper.VideoMapper;
|
||||
import com.ycwl.basic.model.mobile.order.PriceObj;
|
||||
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
||||
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
||||
import com.ycwl.basic.model.pc.faceSample.entity.FaceSampleEntity;
|
||||
import com.ycwl.basic.model.pc.faceSample.resp.FaceSampleRespVO;
|
||||
import com.ycwl.basic.model.pc.member.resp.MemberRespVO;
|
||||
import com.ycwl.basic.model.pc.mp.MpConfigEntity;
|
||||
import com.ycwl.basic.model.pc.renderWorker.entity.RenderWorkerEntity;
|
||||
@@ -42,6 +42,7 @@ import com.ycwl.basic.notify.NotifyFactory;
|
||||
import com.ycwl.basic.notify.adapters.INotifyAdapter;
|
||||
import com.ycwl.basic.notify.entity.NotifyContent;
|
||||
import com.ycwl.basic.notify.enums.NotifyType;
|
||||
import com.ycwl.basic.repository.FaceRepository;
|
||||
import com.ycwl.basic.repository.ScenicRepository;
|
||||
import com.ycwl.basic.repository.VideoTaskRepository;
|
||||
import com.ycwl.basic.service.task.TaskService;
|
||||
@@ -100,6 +101,8 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
private ScenicRepository scenicRepository;
|
||||
@Autowired
|
||||
private TemplateBiz templateBiz;
|
||||
@Autowired
|
||||
private FaceRepository faceRepository;
|
||||
|
||||
private RenderWorkerEntity getWorker(@NonNull WorkerAuthReqVo req) {
|
||||
String accessKey = req.getAccessKey();
|
||||
@@ -151,32 +154,18 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createRenderTask(Long scenicId, Long templateId, Long faceId) {
|
||||
// 有人脸,找视频
|
||||
if (faceId == null) {
|
||||
return;
|
||||
}
|
||||
public boolean createRenderTask(Long scenicId, Long templateId, Long faceId) {
|
||||
boolean canGenerate = templateBiz.determineTemplateCanGenerate(templateId, faceId);
|
||||
if (!canGenerate) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
TemplateConfigEntity config = templateRepository.getTemplateConfig(templateId);
|
||||
FaceRespVO faceRespVO = faceMapper.getById(faceId);
|
||||
if (faceRespVO == null) {
|
||||
return;
|
||||
FaceEntity face = faceRepository.getFace(faceId);
|
||||
if (face == null) {
|
||||
return false;
|
||||
}
|
||||
Map<String, List<SourceRespVO>> sourcesMap = Arrays.stream(faceRespVO.getMatchSampleIds().split(","))
|
||||
.map(Long::valueOf)
|
||||
.map(sampleId -> faceSampleMapper.getById(sampleId))
|
||||
.filter(Objects::nonNull)
|
||||
.map(FaceSampleRespVO::getSourceId)
|
||||
.map(sourceId -> sourceMapper.getById(sourceId))
|
||||
List<SourceEntity> sourceEntityList = sourceMapper.listVideoByScenicFaceRelation(scenicId, faceId);
|
||||
Map<String, List<SourceEntity>> sourcesMap = sourceEntityList.stream()
|
||||
.collect(Collectors.groupingBy(item -> item.getDeviceId().toString()));
|
||||
if (config != null) {
|
||||
if (config.getMinimalPlaceholderFill() > sourcesMap.size()) {
|
||||
throw new RuntimeException("请先游玩后在来生成吧~");
|
||||
}
|
||||
}
|
||||
TaskEntity taskEntity = new TaskEntity();
|
||||
taskEntity.setId(SnowFlakeUtil.getLongId());
|
||||
taskEntity.setFaceId(faceId);
|
||||
@@ -185,6 +174,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
taskEntity.setTaskParams(JSON.toJSONString(sourcesMap));
|
||||
taskEntity.setStatus(0);
|
||||
taskMapper.add(taskEntity);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -250,8 +240,11 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
@Override
|
||||
public void createTaskByFaceIdAndTempalteId(Long faceId, Long templateId, int automatic) {
|
||||
FaceRespVO faceRespVO = faceMapper.getById(faceId);
|
||||
if (faceRespVO == null) {
|
||||
return;
|
||||
}
|
||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(faceRespVO.getScenicId());
|
||||
List<FaceSampleEntity> faceSampleList = faceSampleMapper.listByIds(Arrays.stream(faceRespVO.getMatchSampleIds().split(",")).map(Long::valueOf).collect(Collectors.toList()));
|
||||
List<FaceSampleEntity> faceSampleList = faceRepository.getFaceSampleList(faceId);
|
||||
if (faceSampleList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -296,13 +289,16 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
VideoPieceGetter.Task task = new VideoPieceGetter.Task();
|
||||
task.faceId = faceId;
|
||||
task.faceSampleIds = faceSampleIds;
|
||||
task.templateId = templateId;
|
||||
task.memberId = faceRespVO.getMemberId();
|
||||
task.callback = () -> {
|
||||
log.info("task callback");
|
||||
boolean canGenerate = templateBiz.determineTemplateCanGenerate(templateId, faceId);
|
||||
if (!canGenerate) {
|
||||
log.info("task callback: 不能生成");
|
||||
return;
|
||||
}
|
||||
List<SourceEntity> videoSourceList = sourceMapper.listVideoByFaceRelation(faceId);
|
||||
List<SourceEntity> videoSourceList = sourceMapper.listVideoByScenicFaceRelation(faceRespVO.getScenicId(), faceId);
|
||||
Map<String, List<SourceEntity>> sourcesMap = videoSourceList.stream()
|
||||
.peek(item -> item.setUrl(item.getVideoUrl()))
|
||||
.collect(Collectors.groupingBy(item -> item.getDeviceId().toString()));
|
||||
@@ -329,7 +325,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
taskEntity.setTaskParams(JSON.toJSONString(sourcesMap));
|
||||
taskMapper.add(taskEntity);
|
||||
memberVideoEntity.setTaskId(taskEntity.getId());
|
||||
} else{
|
||||
} else {
|
||||
memberVideoEntity.setTaskId(list.get(0).getId());
|
||||
VideoEntity video = videoMapper.findByTaskId(list.get(0).getId());
|
||||
if (video != null) {
|
||||
@@ -483,32 +479,24 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
return;
|
||||
}
|
||||
ScenicEntity scenic = scenicRepository.getScenic(item.getScenicId());
|
||||
String title = "您在【" + scenic.getName() + "】的影像";
|
||||
String title = "您在【" + scenic.getName() + "】的专属影像";
|
||||
String page = "pages/videoSynthesis/buy?scenicId=" + item.getScenicId() + "&faceId=" + item.getFaceId() + "&id=" + item.getVideoId();
|
||||
/**
|
||||
* 景点 {{thing5.DATA}}
|
||||
* 视频名称 {{thing1.DATA}}
|
||||
* 游玩时间 {{time2.DATA}}
|
||||
* 生成时间 {{time4.DATA}}
|
||||
* 备注 {{thing3.DATA}}
|
||||
*/
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
Map<String, Object> dataParam = new HashMap<>();
|
||||
Map<String, String> scenicMap = new HashMap<>();
|
||||
scenicMap.put("value", scenic.getName());
|
||||
dataParam.put("thing5", scenicMap);
|
||||
Map<String, String> videoMap = new HashMap<>();
|
||||
TemplateRespVO template = templateRepository.getTemplate(item.getTemplateId());
|
||||
videoMap.put("value", template.getName());
|
||||
dataParam.put("thing1", videoMap);
|
||||
Map<String, String> timeMap = new HashMap<>();
|
||||
timeMap.put("value", DateUtil.format(getTaskShotDate(taskId), "yyyy-MM-dd"));
|
||||
dataParam.put("time2", timeMap);
|
||||
Map<String, String> timeMap2 = new HashMap<>();
|
||||
timeMap2.put("value", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm"));
|
||||
dataParam.put("time4", timeMap2);
|
||||
Map<String, String> remarkMap = new HashMap<>();
|
||||
remarkMap.put("value", "您的游玩Vlog已经等候多时,快来看看吧");
|
||||
remarkMap.put("value", "请及时查看视频,48小时后系统删除");
|
||||
dataParam.put("thing3", remarkMap);
|
||||
params.put("data", dataParam);
|
||||
params.put("page", page);
|
||||
|
Reference in New Issue
Block a user