lyhzzz 1 hónapja
szülő
commit
71a5ff67e8

+ 1 - 0
src/main/java/com/fdkankan/fusion/common/OssPath.java

@@ -7,6 +7,7 @@ public class OssPath {
     public final static String localPath = CacheUtil.basePath;
     public final static String MANAGE_FILE_PATH = "fusion/"+CacheUtil.environment+"/media-library/file/%s";
     public final static String MANAGE_MODEL_FILE_PATH = "fusion/"+CacheUtil.environment+"/media-library/model/%s";
+    public final static String MANAGE_SOURCE_FILE_PATH = "fusion/"+CacheUtil.environment+"/media-library/model/%s";
 
     public final static String MANAGE_FILE_DOWN_PATH = "fusion/"+CacheUtil.environment+"/media-library/down/%s";
 

+ 1 - 0
src/main/java/com/fdkankan/fusion/common/ResultCode.java

@@ -83,6 +83,7 @@ public enum ResultCode {
     FILE_TYPE_ERROR23(8031, "文件名不得含有中文"),
     MEDIO_NOT_EXIT(8032, "模型不存在"),
     DICT_NOT_EXITS(8033, "分组不存在"),
+    RECORD_NOT_EXITS(8034, "数据不存在或已删除"),
 
     ;
 

+ 16 - 0
src/main/java/com/fdkankan/fusion/controller/CaseOverviewController.java

@@ -1,9 +1,14 @@
 package com.fdkankan.fusion.controller;
 
 
+import com.fdkankan.fusion.common.ResultCode;
 import com.fdkankan.fusion.common.ResultData;
 import com.fdkankan.fusion.entity.CaseOverview;
+import com.fdkankan.fusion.exception.BusinessException;
 import com.fdkankan.fusion.service.ICaseOverviewService;
+import com.fdkankan.fusion.service.ICaseService;
+import com.fdkankan.fusion.service.ICaseTabulationService;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -21,6 +26,8 @@ public class CaseOverviewController {
 
     @Autowired
     ICaseOverviewService caseOverviewService;
+    @Autowired
+    ICaseTabulationService caseTabulationService;
 
 
     @GetMapping("/getByCaseId")
@@ -37,7 +44,16 @@ public class CaseOverviewController {
 
     @PostMapping("/addOrUpdate")
     public ResultData addOrUpdate (@RequestBody CaseOverview caseOverview){
+        if(caseOverview.getId() != null){
+            CaseOverview caseOverview1 = caseOverviewService.getById(caseOverview.getId());
+            if(caseOverview1 == null){
+                throw new BusinessException(ResultCode.RECORD_NOT_EXITS);
+            }
+        }
         caseOverviewService.saveOrUpdate(caseOverview);
+        caseOverview.getCaseTabulation().setOverviewId(caseOverview.getId());
+        caseOverview.getCaseTabulation().setCaseId(caseOverview.getCaseId());
+        caseTabulationService.addOrUpdate(caseOverview.getCaseTabulation());
         return ResultData.ok(caseOverview);
     }
 

+ 1 - 1
src/main/java/com/fdkankan/fusion/controller/CaseTabulationController.java

@@ -44,7 +44,7 @@ public class CaseTabulationController {
 
     @PostMapping("/addOrUpdate")
     public ResultData addOrUpdate (@RequestBody CaseTabulation caseTabulation){
-        caseTabulationService.saveOrUpdate(caseTabulation);
+        caseTabulationService.addOrUpdate(caseTabulation);
         return ResultData.ok(caseTabulation);
     }
 

+ 5 - 0
src/main/java/com/fdkankan/fusion/entity/CaseOverview.java

@@ -70,5 +70,10 @@ public class CaseOverview implements Serializable {
     @TableField("update_time")
     private Date updateTime;
 
+    @TableField("kankan_cover")
+    private String kankanCover;
+
+    @TableField(exist = false)
+    private CaseTabulation caseTabulation;
 
 }

+ 3 - 0
src/main/java/com/fdkankan/fusion/entity/CommonUpload.java

@@ -75,4 +75,7 @@ public class CommonUpload implements Serializable {
 
     @TableField("convert_type")
     private Integer convertType;
+
+    @TableField("source_file")
+    private String sourceFile;
 }

+ 1 - 1
src/main/java/com/fdkankan/fusion/service/ICommonUploadService.java

@@ -20,7 +20,7 @@ public interface ICommonUploadService extends IService<CommonUpload> {
 
     ResultData uploadFileNew( Integer dictId,MultipartFile file);
 
-    CommonUpload add(String replace, String url, String s, String uuid, FileTypeEnum fileTypeEnum,String resultFormat, String replace1, Integer status, String unzipPath, Integer dictId);
+    CommonUpload add(String replace, String url, String s, String uuid, FileTypeEnum fileTypeEnum,String resultFormat, String replace1, Integer status, String unzipPath, Integer dictId,String sourcePath);
 
     void updateStatus(Integer localPath, Integer i);
 

+ 10 - 3
src/main/java/com/fdkankan/fusion/service/impl/CaseTabulationServiceImpl.java

@@ -1,9 +1,11 @@
 package com.fdkankan.fusion.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.fusion.common.ResultCode;
 import com.fdkankan.fusion.entity.CaseFiles;
 import com.fdkankan.fusion.entity.CaseOverview;
 import com.fdkankan.fusion.entity.CaseTabulation;
+import com.fdkankan.fusion.exception.BusinessException;
 import com.fdkankan.fusion.mapper.ICaseTabulationMapper;
 import com.fdkankan.fusion.service.ICaseFilesService;
 import com.fdkankan.fusion.service.ICaseOverviewService;
@@ -50,7 +52,12 @@ public class CaseTabulationServiceImpl extends ServiceImpl<ICaseTabulationMapper
 
     @Override
     public void addOrUpdate(CaseTabulation caseTabulation) {
-
+        if(caseTabulation.getId() != null){
+            CaseTabulation caseTabulation1 = this.getById(caseTabulation.getId());
+            if(caseTabulation1 == null){
+                throw new BusinessException(ResultCode.RECORD_NOT_EXITS);
+            }
+        }
         this.saveOrUpdate(caseTabulation);
 
         if(StringUtils.isNotBlank(caseTabulation.getListCover()) || caseTabulation.getOverviewId() != null){
@@ -79,12 +86,12 @@ public class CaseTabulationServiceImpl extends ServiceImpl<ICaseTabulationMapper
             }
 
             if(caseTabulation.getOverviewId() != null){         //平面图
-                caseFiles.setFilesTypeId(41);
+                caseFiles.setFilesTypeId(1);
                 caseFiles.setFilesTitle("平面图");
                 caseFiles.setOverviewId(caseTabulation.getOverviewId() );
                 caseFiles.setTabulationId(caseTabulation.getId() );
             }else {
-                caseFiles.setFilesTypeId(42);
+                caseFiles.setFilesTypeId(1);
                 caseFiles.setFilesTitle("方位图");
                 caseFiles.setTabulationId(caseTabulation.getId() );
 

+ 11 - 6
src/main/java/com/fdkankan/fusion/service/impl/CommonUploadServiceImpl.java

@@ -101,7 +101,7 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
                 throw new BusinessException(ResultCode.FILE_TYPE_ERROR2);
             }
             String format = extName.replace(".", "");
-            CommonUpload commonUpload = commonUploadService.add(originalFilename.replace(extName, ""), url, String.valueOf(file.getSize()), uuid, fileTypeEnum, format,format,1,null,dictId);
+            CommonUpload commonUpload = commonUploadService.add(originalFilename.replace(extName, ""), url, String.valueOf(file.getSize()), uuid, fileTypeEnum, format,format,1,null,dictId,null);
             return ResultData.ok(commonUpload);
         }catch ( BusinessException e){
             log.info("upload-file-error:{}",e);
@@ -121,7 +121,10 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
         try {
             Long fileSize = file.length();
             String ossZipPath = String.format(OssPath.MANAGE_MODEL_FILE_PATH, UUID.randomUUID().toString().replace("-", ""));
+            String sourcePath = String.format(OssPath.MANAGE_SOURCE_FILE_PATH, UUID.randomUUID().toString().replace("-", ""));
             String unzipPath = CacheUtil.basePath  + ossZipPath;
+            ShellUtil.yunUpload(file.getPath(),sourcePath);
+
             ShellUtil.unZip(file.getPath(),unzipPath);
 
             //FileUtil.copyContent(file,new File(unzipPath),true);
@@ -171,19 +174,20 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
                 case "b3dm" :  url = uploadB3dm(unzipPath,modelFile); break;
                 case "las" :
                 case "ply" :  url = uploadLasOrPly(unzipPath,modelFile);break;
-                case "osgb":
-                    resultFormat = "b3dm";
+                case "osgb": resultFormat = "b3dm";
+
                     break;
                 default: break;
             }
 
             Integer status = StringUtils.isNotBlank(url) ?1:-1;
             url = StringUtils.isNotBlank(url) ?ossUrlPrefix + url:null;
+            sourcePath = StringUtils.isNotBlank(sourcePath) ?ossUrlPrefix + sourcePath:null;
             CommonUpload commonUpload = commonUploadService.add(oldName,url, String.valueOf(fileSize),
-                    null, fileTypeEnum, modelFileFormat,resultFormat,status,unZipFile.getPath(),dictId);
+                    null, fileTypeEnum, modelFileFormat,resultFormat,status,unZipFile.getPath(),dictId,sourcePath);
             if("osgb".equals(modelFileFormat)){
-                //commonUploadService.updateStatus(commonUpload.getId(),0);
                 uploadOsgb(commonUpload.getId()) ;
+                commonUpload = commonUploadService.getById(commonUpload.getId());
             }
             return ResultData.ok(commonUpload);
         } catch (BusinessException e){
@@ -264,7 +268,7 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
 
 
     @Override
-    public CommonUpload add(String fileName, String url, String fileSize, String uuid, FileTypeEnum fileTypeEnum, String resultFormat,String replace1, Integer status, String unzipPath, Integer dictId) {
+    public CommonUpload add(String fileName, String url, String fileSize, String uuid, FileTypeEnum fileTypeEnum, String resultFormat,String replace1, Integer status, String unzipPath, Integer dictId,String sourcePath) {
         CommonUpload upload = new CommonUpload();
         upload.setFileName(fileName);
         upload.setFileUrl(url);
@@ -275,6 +279,7 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
         upload.setFileFormat(resultFormat);
         upload.setResultFileFormat(replace1);
         upload.setStatus(status);
+        upload.setSourceFile(sourcePath);
         upload.setUnzipPath(unzipPath);
         if("osgb".equals(resultFormat)){
             upload.setConvertType(1);