lyhzzz 3 years ago
parent
commit
b620e57cff

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

@@ -10,6 +10,7 @@ public enum ResultCode {
     UPLOAD_FILE_OBJ_ERROR(7007,"文件内容错误,缺少obj,或者mtl文件"),
     SYSTEM_HOT_ICON_NOT_EXIST(7008,"系统默认icon不存在"),
     SYSTEM_HOT_ICON_NOT_DELETE(7009,"系统默认icon不能删除"),
+    CASE_USE(7010,"案件或场景中使用模型,不能删除"),
 
     HOT_ICON_NOT_EXIST(7004,"热点icon不存在");
 

+ 2 - 2
src/main/java/com/fdkankan/fusion/entity/CaseEntity.java

@@ -45,10 +45,10 @@ public class CaseEntity implements Serializable {
     private Integer tbStatus;
 
     @TableField("create_time")
-    private Date createTime;
+    private String createTime;
 
     @TableField("update_time")
-    private Date updateTime;
+    private String updateTime;
 
 
 }

+ 1 - 0
src/main/java/com/fdkankan/fusion/request/ScenePram.java

@@ -11,4 +11,5 @@ public class ScenePram extends RequestBase {
     private String sceneName;
     private List<String> numList;
     private Integer haveVoid = 0;
+    private Integer status; //
 }

+ 3 - 2
src/main/java/com/fdkankan/fusion/response/SceneVo.java

@@ -1,9 +1,10 @@
 package com.fdkankan.fusion.response;
 
+import com.fdkankan.fusion.entity.Model;
 import lombok.Data;
 
 @Data
-public class SceneVo {
+public class SceneVo extends Model {
     private Long id;
     private Integer buildObjStatus;
     private String createTime;
@@ -17,5 +18,5 @@ public class SceneVo {
     private String title;
     private Integer viewCount;
     private Boolean isLaser;
-    private Integer type;       // 0 四维看看,看见场景,1 深时场景
+    private Integer type;       // 0 四维看看,1看见场景,2 深时场景,3 三维模型
 }

+ 3 - 0
src/main/java/com/fdkankan/fusion/service/IModelService.java

@@ -8,6 +8,7 @@ import com.fdkankan.fusion.request.ScenePram;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
+import java.util.List;
 
 /**
  * <p>
@@ -24,4 +25,6 @@ public interface IModelService extends IService<Model> {
     PageInfo pageList(ModelPram param, String token);
 
     void delete(Integer modelId);
+
+    List<Model> getListByModeId(List<String> numList);
 }

+ 24 - 8
src/main/java/com/fdkankan/fusion/service/impl/CaseServiceImpl.java

@@ -3,6 +3,7 @@ package com.fdkankan.fusion.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.fusion.entity.Model;
 import com.fdkankan.fusion.exception.BusinessException;
 import com.fdkankan.common.response.PageInfo;
 import com.fdkankan.common.util.JwtUtil;
@@ -15,8 +16,10 @@ import com.fdkankan.fusion.response.SceneVo;
 import com.fdkankan.fusion.service.ICaseNumService;
 import com.fdkankan.fusion.service.ICaseService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.fusion.service.IModelService;
 import com.fdkankan.fusion.service.ISceneService;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -41,6 +44,8 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, CaseEntity> implem
     ICaseNumService caseNumService;
     @Autowired
     FdHotService fdHotService;
+    @Autowired
+    IModelService modelService;
 
     @Override
     public PageInfo pageList(CaseParam param,String token) {
@@ -67,14 +72,25 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, CaseEntity> implem
             if(numList ==null || numList.size() <=0){
                 continue;
             }
-            ScenePram scenePram = new ScenePram();
-            scenePram.setType(type);
-            scenePram.setPageNum(1);
-            scenePram.setPageSize(99999);
-            scenePram.setNumList(typeMap.get(type));
-            PageInfo pageInfo = sceneService.pageList(scenePram,token);
-            List<SceneVo> list1 = (List<SceneVo>) pageInfo.getList();
-            listAll.addAll(list1);
+            if(type == 0 || type == 1 || type == 2){
+                ScenePram scenePram = new ScenePram();
+                scenePram.setType(type);
+                scenePram.setPageNum(1);
+                scenePram.setPageSize(99999);
+                scenePram.setNumList(typeMap.get(type));
+                PageInfo pageInfo = sceneService.pageList(scenePram,token);
+                List<SceneVo> list1 = (List<SceneVo>) pageInfo.getList();
+                listAll.addAll(list1);
+            }else if(type == 3){
+                List<SceneVo> voList = new ArrayList<>();
+                List<Model> modelList = modelService.getListByModeId(numList);
+                for (Model model : modelList) {
+                    SceneVo sceneVo = new SceneVo();
+                    BeanUtils.copyProperties(model,sceneVo);
+                    voList.add(sceneVo);
+                }
+                listAll.addAll(voList);
+            }
         }
         return listAll;
     }

+ 11 - 0
src/main/java/com/fdkankan/fusion/service/impl/ModelServiceImpl.java

@@ -132,5 +132,16 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
     public void delete(Integer modelId) {
         List<CaseNumEntity> caseNumEntityList = caseNumService.getByNum(modelId.toString());
         List<FusionNum> fusionNumList = fusionNumService.getByNum(modelId.toString());
+        if(caseNumEntityList.size() >0 || fusionNumList.size() >0){
+            throw new BusinessException(ResultCode.CASE_USE);
+        }
+        this.removeById(modelId);
+    }
+
+    @Override
+    public List<Model> getListByModeId(List<String> numList) {
+        LambdaQueryWrapper<Model> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(Model::getModelId,numList);
+        return this.list(wrapper);
     }
 }