You've already forked FrameTour-BE
Java21
This commit is contained in:
@@ -41,9 +41,7 @@ import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.aliyuncs.IAcsClient;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -84,7 +82,7 @@ public class TaskFaceServiceImpl implements TaskFaceService {
|
||||
|
||||
private IAcsClient getClient() {
|
||||
AliFaceBodyAdapter use = (AliFaceBodyAdapter) FaceBodyFactory.use();
|
||||
return use.getClient().getClient();
|
||||
return use.getClient().client();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -222,7 +220,7 @@ public class TaskFaceServiceImpl implements TaskFaceService {
|
||||
if (StringUtils.isNumeric(dbName)) { // 景区
|
||||
allFaceSampleList = faceSampleMapper.listByIds(allFaceSampleIds);
|
||||
if (!acceptFaceSampleIds.isEmpty()) {
|
||||
Long firstFaceSampleId = acceptFaceSampleIds.get(0);
|
||||
Long firstFaceSampleId = acceptFaceSampleIds.getFirst();
|
||||
Optional<FaceSampleEntity> firstFaceSample = allFaceSampleList.stream().filter(faceSample -> faceSample.getId().equals(firstFaceSampleId)).findAny();
|
||||
if (firstFaceSample.isPresent()) {
|
||||
if (tourMinutes > 0) {
|
||||
|
@@ -130,8 +130,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
if (accessKey == null) {
|
||||
return null;
|
||||
}
|
||||
RenderWorkerEntity worker = renderWorkerMapper.findByAccessKey(accessKey);
|
||||
return worker;
|
||||
return renderWorkerMapper.findByAccessKey(accessKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -209,9 +208,6 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
|
||||
@Override
|
||||
public TemplateRespVO workerGetTemplate(@NonNull Long templateId, @NonNull WorkerAuthReqVo req) {
|
||||
if (templateId == null) {
|
||||
return null;
|
||||
}
|
||||
RenderWorkerEntity worker = getWorker(req);
|
||||
if (worker == null) {
|
||||
return null;
|
||||
@@ -274,7 +270,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
if (templatePlaceholder.stream().distinct().count() == templatePlaceholder.size()) {
|
||||
sourcesMap.forEach((key, value) -> {
|
||||
// 每个value只保留第一个
|
||||
value.removeIf(item -> !value.get(0).equals(item));
|
||||
value.removeIf(item -> !value.getFirst().equals(item));
|
||||
});
|
||||
} else {
|
||||
log.info("task callback: 模板占位符有重复,templateId: {}", templateId);
|
||||
@@ -300,7 +296,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
taskReqQuery.setTemplateId(templateId);
|
||||
List<TaskEntity> templateTaskList = taskMapper.listEntity(taskReqQuery);
|
||||
if (!templateTaskList.isEmpty()) {
|
||||
taskEntity = templateTaskList.get(0);
|
||||
taskEntity = templateTaskList.getFirst();
|
||||
log.info("已有旧生成的视频:{}", taskEntity);
|
||||
MemberVideoEntity taskVideoRelation = videoMapper.queryRelationByMemberTask(face.getMemberId(), taskEntity.getId());
|
||||
if (taskVideoRelation != null) {
|
||||
@@ -326,10 +322,10 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
memberVideoEntity.setTaskId(taskEntity.getId());
|
||||
} else {
|
||||
log.info("重复task! faceId:{},templateId:{},taskParams:{}", faceId, templateId, sourcesMap);
|
||||
memberVideoEntity.setTaskId(list.get(0).getId());
|
||||
VideoEntity video = videoMapper.findByTaskId(list.get(0).getId());
|
||||
memberVideoEntity.setTaskId(list.getFirst().getId());
|
||||
VideoEntity video = videoMapper.findByTaskId(list.getFirst().getId());
|
||||
if (video != null) {
|
||||
IsBuyRespVO isBuy = orderBiz.isBuy(face.getMemberId(), list.get(0).getScenicId(), 0, video.getId());
|
||||
IsBuyRespVO isBuy = orderBiz.isBuy(face.getMemberId(), list.getFirst().getScenicId(), 0, video.getId());
|
||||
if (isBuy.isBuy()) {
|
||||
memberVideoEntity.setIsBuy(1);
|
||||
memberVideoEntity.setOrderId(isBuy.getOrderId());
|
||||
@@ -376,11 +372,9 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
}
|
||||
if (Integer.valueOf(3).equals(scenicConfig.getBookRoutine()) || Integer.valueOf(4).equals(scenicConfig.getBookRoutine())) {
|
||||
// 生成全部视频的逻辑
|
||||
templateList.forEach(template -> {
|
||||
createTaskByFaceIdAndTempalteId(faceId, template.getId(), 1);
|
||||
});
|
||||
templateList.forEach(template -> createTaskByFaceIdAndTempalteId(faceId, template.getId(), 1));
|
||||
} else {
|
||||
createTaskByFaceIdAndTempalteId(faceId, templateList.get(0).getId(), 1);
|
||||
createTaskByFaceIdAndTempalteId(faceId, templateList.getFirst().getId(), 1);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@@ -433,7 +427,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
// }
|
||||
// videoMapper.addRelation(memberVideo);
|
||||
// new Thread(() -> {
|
||||
// sendVideoGeneratedServiceNotification(list.get(0).getId(), faceRespVO.getMemberId());
|
||||
// sendVideoGeneratedServiceNotification(list.getFirst().getId(), faceRespVO.getMemberId());
|
||||
// }).start();
|
||||
// }
|
||||
// });
|
||||
@@ -474,7 +468,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
if (templatePlaceholder.stream().distinct().count() == templatePlaceholder.size()) {
|
||||
sourcesMap.forEach((key, value) -> {
|
||||
// 每个value只保留第一个
|
||||
value.removeIf(item -> !value.get(0).equals(item));
|
||||
value.removeIf(item -> !value.getFirst().equals(item));
|
||||
});
|
||||
} else {
|
||||
log.info("task callback: 模板占位符有重复,templateId: {}", templateId);
|
||||
@@ -500,7 +494,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
taskReqQuery.setTemplateId(templateId);
|
||||
List<TaskEntity> templateTaskList = taskMapper.listEntity(taskReqQuery);
|
||||
if (!templateTaskList.isEmpty()) {
|
||||
taskEntity = templateTaskList.get(0);
|
||||
taskEntity = templateTaskList.getFirst();
|
||||
log.info("已有旧生成的视频:{}", taskEntity);
|
||||
MemberVideoEntity taskVideoRelation = videoMapper.queryRelationByMemberTask(face.getMemberId(), taskEntity.getId());
|
||||
if (taskVideoRelation != null) {
|
||||
@@ -526,10 +520,10 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
memberVideoEntity.setTaskId(taskEntity.getId());
|
||||
} else {
|
||||
log.info("重复task! faceId:{},templateId:{},taskParams:{}", faceId, templateId, sourcesMap);
|
||||
memberVideoEntity.setTaskId(list.get(0).getId());
|
||||
VideoEntity video = videoMapper.findByTaskId(list.get(0).getId());
|
||||
memberVideoEntity.setTaskId(list.getFirst().getId());
|
||||
VideoEntity video = videoMapper.findByTaskId(list.getFirst().getId());
|
||||
if (video != null) {
|
||||
IsBuyRespVO isBuy = orderBiz.isBuy(face.getMemberId(), list.get(0).getScenicId(), 0, video.getId());
|
||||
IsBuyRespVO isBuy = orderBiz.isBuy(face.getMemberId(), list.getFirst().getScenicId(), 0, video.getId());
|
||||
if (isBuy.isBuy()) {
|
||||
memberVideoEntity.setIsBuy(1);
|
||||
memberVideoEntity.setOrderId(isBuy.getOrderId());
|
||||
@@ -626,9 +620,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
}
|
||||
}
|
||||
videoMapper.updateRelationWhenTaskSuccess(taskId, video.getId(), isBuy);
|
||||
new Thread(() -> {
|
||||
sendVideoGeneratedServiceNotification(taskId);
|
||||
}).start();
|
||||
new Thread(() -> sendVideoGeneratedServiceNotification(taskId)).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -657,6 +649,9 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
return null;
|
||||
}
|
||||
RenderWorkerEntity worker = getWorker(req);
|
||||
if (worker == null) {
|
||||
return null;
|
||||
}
|
||||
IStorageAdapter adapter;
|
||||
try {
|
||||
adapter = StorageFactory.get(worker.getStoreType());
|
||||
@@ -677,9 +672,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
|
||||
public void sendVideoGeneratedServiceNotification(Long taskId) {
|
||||
List<MemberVideoEntity> memberVideo = videoMapper.listRelationByTask(taskId);
|
||||
memberVideo.forEach(item -> {
|
||||
sendVideoGeneratedServiceNotification(taskId, item.getMemberId());
|
||||
});
|
||||
memberVideo.forEach(item -> sendVideoGeneratedServiceNotification(taskId, item.getMemberId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user