|
@@ -7,6 +7,7 @@ import com.fdkankan.common.constant.ErrorCode;
|
|
|
import com.fdkankan.common.constant.SceneConstant;
|
|
|
import com.fdkankan.common.constant.SceneKind;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
+import com.fdkankan.contro.common.Result;
|
|
|
import com.fdkankan.contro.entity.ScenePlus;
|
|
|
import com.fdkankan.contro.entity.ScenePlusExt;
|
|
|
import com.fdkankan.contro.entity.ScenePro;
|
|
@@ -43,23 +44,28 @@ public class GenerateObjFileServiceImpl implements IGenerateObjFileService {
|
|
|
private ISceneUpgradeMapper sceneUpgradeMapper;
|
|
|
|
|
|
@Override
|
|
|
- public void generateObjFile(String num) {
|
|
|
+ public Result generateObjFile(String num) {
|
|
|
ScenePro sceneProEntity = sceneProService.getByNum(num);
|
|
|
|
|
|
+ //v4版本生成obj
|
|
|
if(ObjectUtils.isEmpty(sceneProEntity) || sceneProEntity.getIsUpgrade() == CommonStatus.YES.code().intValue()){
|
|
|
- generatePlusObjFile(num);
|
|
|
- return;
|
|
|
+ return generatePlusObjFile(num);
|
|
|
}
|
|
|
+ //v3版本生成obj
|
|
|
+ return generateProObjFile(num);
|
|
|
+ }
|
|
|
|
|
|
+ public Result generateProObjFile(String num) {
|
|
|
+ ScenePro sceneProEntity = sceneProService.getByNum(num);
|
|
|
if(sceneProEntity.getSceneSource() != 4 && sceneProEntity.getSceneSource() != 5){
|
|
|
- throw new BusinessException(ErrorCode.FAILURE_CODE_3003, "只能操作激光场景");
|
|
|
+ return Result.failure(ErrorCode.FAILURE_CODE_3003.code(), "只能操作激光场景");
|
|
|
}
|
|
|
|
|
|
// 拷贝文件
|
|
|
String path = sceneProEntity.getDataSource();
|
|
|
String ossPath = path.replace("/mnt/data","home")+"/data.fdage";
|
|
|
if(!fYunFileService.fileExist(ossPath)){
|
|
|
- throw new BusinessException(ErrorCode.FAILURE_CODE_3037);
|
|
|
+ return Result.failure(ErrorCode.FAILURE_CODE_3037.code(), ErrorCode.FAILURE_CODE_3037.message());
|
|
|
}
|
|
|
|
|
|
LambdaUpdateWrapper<ScenePro> updateWrapper = new LambdaUpdateWrapper<>();
|
|
@@ -93,25 +99,26 @@ public class GenerateObjFileServiceImpl implements IGenerateObjFileService {
|
|
|
mqMsg.setBuildType(sceneProEntity.getBuildType());
|
|
|
mqMsg.setPath(sceneProEntity.getDataSource());
|
|
|
mqProducer.sendByWorkQueue(queueObjModelingPre,mqMsg);
|
|
|
+
|
|
|
+ return Result.success();
|
|
|
}
|
|
|
|
|
|
- public void generatePlusObjFile(String num) {
|
|
|
+ public Result generatePlusObjFile(String num) {
|
|
|
ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
|
|
|
|
if(ObjectUtils.isEmpty(scenePlus)){
|
|
|
- throw new BusinessException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
|
|
|
+ return Result.failure(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
|
|
|
}
|
|
|
|
|
|
if(scenePlus.getSceneSource() != 4 && scenePlus.getSceneSource() !=5){
|
|
|
- throw new BusinessException(ErrorCode.FAILURE_CODE_3003.code(), "只能操作激光场景");
|
|
|
+ return Result.failure(ErrorCode.FAILURE_CODE_3003.code(), "只能操作激光场景");
|
|
|
}
|
|
|
|
|
|
ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
|
|
|
String ossPath = scenePlusExt.getDataSource().replace("/mnt/data","home")+"/data.fdage";
|
|
|
if(!fYunFileService.fileExist(ossPath)){
|
|
|
- throw new BusinessException(ErrorCode.FAILURE_CODE_3037);
|
|
|
-
|
|
|
+ return Result.failure(ErrorCode.FAILURE_CODE_3037.code(), ErrorCode.FAILURE_CODE_3037.message());
|
|
|
}
|
|
|
|
|
|
LambdaUpdateWrapper<ScenePlus> updateWrapper = new LambdaUpdateWrapper<>();
|
|
@@ -136,5 +143,7 @@ public class GenerateObjFileServiceImpl implements IGenerateObjFileService {
|
|
|
mqMsg.setBuildType(scenePlusExt.getBuildType());
|
|
|
mqMsg.setPath(scenePlusExt.getDataSource());
|
|
|
mqProducer.sendByWorkQueue(queueObjModelingPre,mqMsg);
|
|
|
+
|
|
|
+ return Result.success();
|
|
|
}
|
|
|
}
|