|
|
|
@ -7,6 +7,7 @@ import cn.hutool.http.HttpUtil;
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
import com.supervision.manage.dto.HumanStatusDTO;
|
|
|
|
|
import com.supervision.manage.service.FileManageService;
|
|
|
|
|
import com.supervision.manage.service.HumanManageService;
|
|
|
|
|
import com.supervision.model.FileResource;
|
|
|
|
|
import com.supervision.model.Human;
|
|
|
|
|
import com.supervision.service.HumanService;
|
|
|
|
@ -27,16 +28,18 @@ public class HumanManageTask {
|
|
|
|
|
|
|
|
|
|
private final HumanService humanService;
|
|
|
|
|
private final FileManageService fileManageService;
|
|
|
|
|
private final HumanManageService humanManageService;
|
|
|
|
|
@Value("${humanGenerate.baseUrl}")
|
|
|
|
|
private String humanBaseUrl;
|
|
|
|
|
@Value("${humanGenerate.status}")
|
|
|
|
|
private String status;
|
|
|
|
|
|
|
|
|
|
@Scheduled(fixedDelay = 1000 * 60 * 2)
|
|
|
|
|
public void refreshHumanUid() {
|
|
|
|
|
public void refreshHumanUid() throws Exception {
|
|
|
|
|
log.info("定时任务检查数字人形象");
|
|
|
|
|
List<Human> humanList = humanService.lambdaQuery().eq(Human::getStatus, 2).list();
|
|
|
|
|
for (Human human : humanList) {
|
|
|
|
|
|
|
|
|
|
silent:
|
|
|
|
|
if (StrUtil.isBlank(human.getSilentVideoFileId())) {
|
|
|
|
|
if (StrUtil.isNotBlank(human.getSilentTaskUid())) {
|
|
|
|
@ -57,14 +60,11 @@ public class HumanManageTask {
|
|
|
|
|
FileResource fileResource = convertBase64ToFile("silent", human.getImageName(), silentDTO.getVideo());
|
|
|
|
|
// 为最后更新状态准备
|
|
|
|
|
human.setSilentVideoFileId(fileResource.getId());
|
|
|
|
|
humanService.lambdaUpdate().set(Human::getSilentVideoFileId, fileResource.getId()).eq(Human::getId, human.getId()).update();
|
|
|
|
|
humanService.updateById(human);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("数字人保存静默视频失败", e);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// TODO 如果没有UID,这时就需要重新获取图片,重新生成了
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -88,13 +88,16 @@ public class HumanManageTask {
|
|
|
|
|
FileResource fileResource = convertBase64ToFile("dynamic", human.getImageName(), dynamicDTO.getVideo());
|
|
|
|
|
// 为最后更新状态准备
|
|
|
|
|
human.setDynamicVideoFileId(fileResource.getId());
|
|
|
|
|
humanService.lambdaUpdate().set(Human::getDynamicVideoFileId, fileResource.getId()).eq(Human::getId, human.getId()).update();
|
|
|
|
|
humanService.updateById(human);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("数字人保存动态视频失败", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 这里考虑一种异常情况,就是提交失败了.重新提交
|
|
|
|
|
humanManageService.generateHuman(human.getId());
|
|
|
|
|
|
|
|
|
|
// 如果两者都走完了,校验如果全部有值,说明就完成了
|
|
|
|
|
if (StrUtil.isAllNotBlank(human.getSilentVideoFileId(), human.getDynamicVideoFileId())) {
|
|
|
|
|
humanService.lambdaUpdate().set(Human::getStatus, 1).eq(Human::getId, human.getId()).update();
|
|
|
|
|