|
@@ -3,26 +3,26 @@ package com.fdkankan.ucenter.service.impl;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
|
-import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.common.util.JwtUtil;
|
|
|
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
|
import com.fdkankan.ucenter.common.Result;
|
|
|
+import com.fdkankan.ucenter.common.constants.ConstantFilePath;
|
|
|
import com.fdkankan.ucenter.entity.ScenePlus;
|
|
|
import com.fdkankan.ucenter.entity.ScenePlusExt;
|
|
|
import com.fdkankan.ucenter.entity.ScenePro;
|
|
|
import com.fdkankan.ucenter.entity.User;
|
|
|
-import com.fdkankan.ucenter.service.IInnerService;
|
|
|
-import com.fdkankan.ucenter.service.IScenePlusExtService;
|
|
|
-import com.fdkankan.ucenter.service.IScenePlusService;
|
|
|
-import com.fdkankan.ucenter.service.ISceneProService;
|
|
|
-import com.fdkankan.ucenter.service.IUserService;
|
|
|
-import java.util.Objects;
|
|
|
+import com.fdkankan.ucenter.service.*;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.io.File;
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* TODO
|
|
@@ -49,6 +49,9 @@ public class InnerServiceImpl implements IInnerService {
|
|
|
@Autowired
|
|
|
private RedisUtil redisUtil;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private FYunFileServiceInterface fYunFileService;
|
|
|
+
|
|
|
@Override
|
|
|
public Result createTokenByNum(String num) {
|
|
|
|
|
@@ -106,4 +109,44 @@ public class InnerServiceImpl implements IInnerService {
|
|
|
}
|
|
|
return Result.success("成功", dataSource);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result downloadCapture(String num) {
|
|
|
+
|
|
|
+ ScenePro scenePro = sceneProService.getByNum(num);
|
|
|
+ ScenePlus scenePlus = scenePlusService.getByNum(num);
|
|
|
+ if (ObjectUtils.isEmpty(scenePlus) && ObjectUtils.isEmpty(scenePro)) {
|
|
|
+ return Result.failure("场景为空");
|
|
|
+ }
|
|
|
+ String dataSource = null;
|
|
|
+ if(!ObjectUtils.isEmpty(scenePlus)){
|
|
|
+ ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
|
|
|
+ dataSource = scenePlusExt.getDataSource();
|
|
|
+ }else{
|
|
|
+ dataSource = scenePro.getDataSource();
|
|
|
+ }
|
|
|
+
|
|
|
+ String ossPath = ConstantFilePath.OSS_PREFIX
|
|
|
+ + dataSource.replace(ConstantFilePath.BUILD_MODEL_PATH, "")
|
|
|
+ .replace(ConstantFilePath.BUILD_MODEL_LASER_PATH, "");
|
|
|
+ if (!ossPath.endsWith("/")) {
|
|
|
+ ossPath = ossPath.concat("/");
|
|
|
+ }
|
|
|
+
|
|
|
+ fYunFileService.downloadFileByCommand(dataSource + File.separator + "capture", ossPath);
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result querySceneNum(String path) {
|
|
|
+ ScenePro scenePro = sceneProService.findByFileId(path);
|
|
|
+ if (!ObjectUtils.isEmpty(scenePro)) {
|
|
|
+ return Result.success(scenePro.getNum());
|
|
|
+ }
|
|
|
+ ScenePlusExt scenePlusExt = scenePlusExtService.getByUnicode(path);
|
|
|
+ if (!ObjectUtils.isEmpty(scenePlusExt)) {
|
|
|
+ return Result.success(scenePlusService.getById(scenePlusExt.getPlusId()).getNum());
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|