lyhzzz 1 ヶ月 前
コミット
af9524eee8

+ 6 - 0
src/main/java/com/fdkankan/fusion/entity/CaseFiles.java

@@ -88,5 +88,11 @@ public class CaseFiles implements Serializable {
     @TableField("content")
     private String content;
 
+    @TableField("overview_id")
+    private Integer overviewId;
+
+    @TableField("tabulation_id")
+    private Integer tabulationId;
+
 
 }

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

@@ -1,10 +1,7 @@
 package com.fdkankan.fusion.entity;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableLogic;
-import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.*;
+
 import java.io.Serializable;
 import java.util.Date;
 import lombok.Getter;
@@ -37,12 +34,32 @@ public class CaseOverview implements Serializable {
     @TableField("store")
     private String store;
 
+    @TableField("title")
+    private String title;
+
+    @TableField("list_cover")
+    private String listCover;
+
+    @TableField("cover")
+    private String cover;
     /**
      * 视口
      */
     @TableField("viewport")
     private String viewport;
 
+    @TableField("type")
+    private Integer type;
+
+    @TableField(value = "map_url",updateStrategy = FieldStrategy.IGNORED)
+    private String mapUrl;
+
+    @TableField("high")
+    private Integer high;
+
+    @TableField("width")
+    private Integer width;
+
     @TableField("tb_status")
     @TableLogic
     private Integer tbStatus;

+ 21 - 5
src/main/java/com/fdkankan/fusion/entity/CaseTabulation.java

@@ -1,10 +1,7 @@
 package com.fdkankan.fusion.entity;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableLogic;
-import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.*;
+
 import java.io.Serializable;
 import java.util.Date;
 import lombok.Getter;
@@ -37,6 +34,9 @@ public class CaseTabulation implements Serializable {
     @TableField("store")
     private String store;
 
+    @TableField("title")
+    private String title;
+
     /**
      * 视口
      */
@@ -70,4 +70,20 @@ public class CaseTabulation implements Serializable {
 
     @TableField("overview_id")
     private Integer overviewId;
+
+    @TableField(value = "map_url",updateStrategy = FieldStrategy.IGNORED)
+    private String mapUrl;
+
+    @TableField("high")
+    private Integer high;
+
+    @TableField("width")
+    private Integer width;
+
+    /**
+     * 封面图
+     */
+    @TableField("list_cover")
+    private String listCover;
+
 }

+ 6 - 0
src/main/java/com/fdkankan/fusion/service/ICaseFilesService.java

@@ -20,4 +20,10 @@ public interface ICaseFilesService extends IService<CaseFiles> {
     List<CaseFiles> getByCaseId(Integer caseId);
 
     void deleteByCaseId(Integer caseId);
+
+
+
+    CaseFiles getByTabulation(Integer tabulationId);
+
+    CaseFiles getByOverviewId(Integer overviewId);
 }

+ 2 - 0
src/main/java/com/fdkankan/fusion/service/ICaseTabulationService.java

@@ -18,4 +18,6 @@ public interface ICaseTabulationService extends IService<CaseTabulation> {
     List<CaseTabulation> getByCaseId(String caseId);
 
     List<CaseTabulation> getByOverviewId(String overviewId);
+
+    void addOrUpdate(CaseTabulation caseTabulation);
 }

+ 31 - 0
src/main/java/com/fdkankan/fusion/service/impl/CaseFilesServiceImpl.java

@@ -67,4 +67,35 @@ public class CaseFilesServiceImpl extends ServiceImpl<ICaseFilesMapper, CaseFile
             this.removeById(files.getFilesId());
         }
     }
+
+
+    private Long getCountByCase(Integer caseId, Integer filesTypeId, String online) {
+        LambdaQueryWrapper<CaseFiles> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(CaseFiles::getCaseId,caseId);
+        wrapper.eq(CaseFiles::getFilesTypeId,filesTypeId);
+        wrapper.eq(CaseFiles::getCreateType,online);
+        return this.count(wrapper);
+    }
+
+    @Override
+    public CaseFiles getByTabulation(Integer tabulationId) {
+        LambdaQueryWrapper<CaseFiles> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(CaseFiles::getTabulationId,tabulationId);
+        List<CaseFiles> list = this.list(wrapper);
+        if(list != null && !list.isEmpty()){
+            return list.get(0);
+        }
+        return null;
+    }
+
+    @Override
+    public CaseFiles getByOverviewId(Integer overviewId) {
+        LambdaQueryWrapper<CaseFiles> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(CaseFiles::getOverviewId,overviewId);
+        List<CaseFiles> list = this.list(wrapper);
+        if(list != null && !list.isEmpty()){
+            return list.get(0);
+        }
+        return null;
+    }
 }

+ 60 - 0
src/main/java/com/fdkankan/fusion/service/impl/CaseTabulationServiceImpl.java

@@ -1,10 +1,16 @@
 package com.fdkankan.fusion.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.fusion.entity.CaseFiles;
+import com.fdkankan.fusion.entity.CaseOverview;
 import com.fdkankan.fusion.entity.CaseTabulation;
 import com.fdkankan.fusion.mapper.ICaseTabulationMapper;
+import com.fdkankan.fusion.service.ICaseFilesService;
+import com.fdkankan.fusion.service.ICaseOverviewService;
 import com.fdkankan.fusion.service.ICaseTabulationService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -20,6 +26,11 @@ import java.util.List;
 @Service
 public class CaseTabulationServiceImpl extends ServiceImpl<ICaseTabulationMapper, CaseTabulation> implements ICaseTabulationService {
 
+    @Autowired
+    ICaseFilesService caseFilesService;
+    @Autowired
+    ICaseOverviewService caseOverviewService;
+
     @Override
     public List<CaseTabulation> getByCaseId(String caseId) {
         LambdaQueryWrapper<CaseTabulation> wrapper = new LambdaQueryWrapper<>();
@@ -35,4 +46,53 @@ public class CaseTabulationServiceImpl extends ServiceImpl<ICaseTabulationMapper
         wrapper.orderByDesc(CaseTabulation::getId);
         return this.list(wrapper);
     }
+
+    @Override
+    public void addOrUpdate(CaseTabulation caseTabulation) {
+
+        this.saveOrUpdate(caseTabulation);
+
+        if(StringUtils.isNotBlank(caseTabulation.getListCover()) || caseTabulation.getOverviewId() != null){
+            CaseFiles caseFiles  = new CaseFiles();
+            if(caseTabulation.getId()!=null){
+                CaseTabulation db = this.getById(caseTabulation.getId());
+                if(caseTabulation.getOverviewId() == null){
+                    caseTabulation.setOverviewId(db.getOverviewId());
+                }
+                CaseFiles dbCaseFile = caseFilesService.getByTabulation(caseTabulation.getId());
+                if(dbCaseFile != null){
+                    caseFiles.setFilesId(dbCaseFile.getFilesId());
+                }
+            }
+            if(caseTabulation.getOverviewId()!=null){
+                CaseFiles dbCaseFile = caseFilesService.getByOverviewId(caseTabulation.getOverviewId());
+                if(dbCaseFile != null){
+                    caseFiles.setFilesId(dbCaseFile.getFilesId());
+                }
+            }
+            caseFiles.setCaseId(caseTabulation.getCaseId());
+            caseFiles.setFilesUrl(caseTabulation.getListCover());
+            if(StringUtils.isBlank(caseTabulation.getListCover())){
+                CaseOverview caseOverview = caseOverviewService.getById(caseTabulation.getOverviewId());
+                caseFiles.setFilesUrl(caseOverview.getListCover());
+            }
+
+            if(caseTabulation.getOverviewId() != null){         //平面图
+                caseFiles.setFilesTypeId(41);
+                caseFiles.setFilesTitle("平面图");
+                caseFiles.setOverviewId(caseTabulation.getOverviewId() );
+                caseFiles.setTabulationId(caseTabulation.getId() );
+            }else {
+                caseFiles.setFilesTypeId(42);
+                caseFiles.setFilesTitle("方位图");
+                caseFiles.setTabulationId(caseTabulation.getId() );
+
+            }
+            caseFilesService.saveOrUpdate(caseFiles);
+        }
+
+
+
+
+    }
 }