|
@@ -2,15 +2,19 @@ package com.fdkankan.fusion.controller;
|
|
|
|
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
+import cn.hutool.json.JSONArray;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.fdkankan.fusion.common.FilePath;
|
|
|
import com.fdkankan.fusion.common.ResultCode;
|
|
|
import com.fdkankan.fusion.common.ResultData;
|
|
|
import com.fdkankan.fusion.common.ResultCode;
|
|
|
+import com.fdkankan.fusion.common.util.FileWriterUtil;
|
|
|
import com.fdkankan.fusion.common.util.MD5Checksum;
|
|
|
import com.fdkankan.fusion.common.util.UploadToOssUtil;
|
|
|
+import com.fdkankan.fusion.entity.CommonUpload;
|
|
|
import com.fdkankan.fusion.entity.Model;
|
|
|
import com.fdkankan.fusion.exception.BusinessException;
|
|
|
+import com.fdkankan.fusion.request.AddByMediaLibraryParam;
|
|
|
import com.fdkankan.fusion.request.ModelPram;
|
|
|
import com.fdkankan.fusion.request.ScenePram;
|
|
|
import com.fdkankan.fusion.response.FileInfoVo;
|
|
@@ -45,6 +49,12 @@ public class ModelController extends BaseController{
|
|
|
IModelService modelService;
|
|
|
@Autowired
|
|
|
IFusionNumService fusionNumService;
|
|
|
+ @Autowired
|
|
|
+ ICommonUploadService commonUploadService;
|
|
|
+ @Autowired
|
|
|
+ ICaseService caseService;
|
|
|
+ @Autowired
|
|
|
+ ICaseNumService caseNumService;
|
|
|
|
|
|
|
|
|
@PostMapping("/uploadObj")
|
|
@@ -52,6 +62,32 @@ public class ModelController extends BaseController{
|
|
|
return ResultData.ok(modelService.uploadObj(file,getUserName()));
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/addByMediaLibrary")
|
|
|
+ public ResultData addByMediaLibrary(@RequestBody AddByMediaLibraryParam param) {
|
|
|
+ if(param.getCaseId() == null || param.getUploadId() == null ){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+ CommonUpload commonUpload = commonUploadService.getById(param.getUploadId());
|
|
|
+ if(commonUpload == null || StringUtils.isBlank(commonUpload.getFileUrl())){
|
|
|
+ throw new BusinessException(ResultCode.MEDIO_NOT_EXIT);
|
|
|
+ }
|
|
|
+ Model model = new Model();
|
|
|
+ model.setModelTitle(commonUpload.getFileName());
|
|
|
+ model.setModelSize(FileWriterUtil.setFileSize(Long.valueOf(commonUpload.getFileSize())));
|
|
|
+ model.setModelDateType(commonUpload.getFileFormat());
|
|
|
+ model.setModelType(commonUpload.getResultFileFormat());
|
|
|
+ model.setWgs84(commonUpload.getWgs84());
|
|
|
+ model.setGcj02(commonUpload.getGcj02());
|
|
|
+
|
|
|
+ JSONArray jsonArray = new JSONArray();
|
|
|
+ jsonArray.add(commonUpload.getFileUrl());
|
|
|
+ model.setModelGlbUrl(jsonArray.toJSONString());
|
|
|
+ modelService.save(model);
|
|
|
+
|
|
|
+ //caseNumService.addModeByCaseId(param.getCaseId(),model.getModelId());
|
|
|
+ return ResultData.ok(model);
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/uploadObjProgress")
|
|
|
public ResultData uploadAddVideoProgress(@RequestParam(required = false) Integer modelId) throws Exception {
|
|
|
String code = modelService.uploadObjProgress(modelId);
|