|
@@ -2,6 +2,7 @@ package com.fdkankan.fusion.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.fdkankan.fusion.common.ResultCode;
|
|
|
+import com.fdkankan.fusion.common.util.UploadToOssUtil;
|
|
|
import com.fdkankan.fusion.entity.CaseFiles;
|
|
|
import com.fdkankan.fusion.entity.CaseOverview;
|
|
|
import com.fdkankan.fusion.entity.CaseTabulation;
|
|
@@ -15,6 +16,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -32,6 +34,8 @@ public class CaseTabulationServiceImpl extends ServiceImpl<ICaseTabulationMapper
|
|
|
ICaseFilesService caseFilesService;
|
|
|
@Autowired
|
|
|
ICaseOverviewService caseOverviewService;
|
|
|
+ @Autowired
|
|
|
+ UploadToOssUtil uploadToOssUtil;
|
|
|
|
|
|
@Override
|
|
|
public List<CaseTabulation> getByCaseId(String caseId) {
|
|
@@ -51,6 +55,45 @@ public class CaseTabulationServiceImpl extends ServiceImpl<ICaseTabulationMapper
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public List<CaseTabulation> getByOverId(Integer overId) {
|
|
|
+ LambdaQueryWrapper<CaseTabulation> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(CaseTabulation::getOverviewId,overId);
|
|
|
+ return this.list(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void delByIds(List<Integer> ids) {
|
|
|
+ if(!ids.isEmpty()){
|
|
|
+ List<CaseTabulation> caseTabulations = this.listByIds(ids);
|
|
|
+ this.removeByIds(ids);
|
|
|
+ for (CaseTabulation caseTabulation : caseTabulations) {
|
|
|
+ delFile(caseTabulation);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void delFile(CaseTabulation caseTabulation) {
|
|
|
+ List<CaseTabulation> list = this.getByCover(caseTabulation.getListCover());
|
|
|
+ if(list.isEmpty()){
|
|
|
+ uploadToOssUtil.delete(caseTabulation.getListCover());
|
|
|
+ }
|
|
|
+ List<CaseTabulation> list2 = this.getByCover(caseTabulation.getMapUrl());
|
|
|
+ if(list2.isEmpty()){
|
|
|
+ uploadToOssUtil.delete(caseTabulation.getMapUrl());
|
|
|
+ }
|
|
|
+ List<CaseTabulation> list3 = this.getByCover(caseTabulation.getCover());
|
|
|
+ if(list3.isEmpty()){
|
|
|
+ uploadToOssUtil.delete(caseTabulation.getCover());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<CaseTabulation> getByCover(String listCover) {
|
|
|
+ LambdaQueryWrapper<CaseTabulation> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.and(e -> e.eq(CaseTabulation::getListCover,listCover).or().eq(CaseTabulation::getMapUrl,listCover).or().like(CaseTabulation::getCover,listCover));
|
|
|
+ return this.list(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public void addOrUpdate(CaseTabulation caseTabulation) {
|
|
|
if(caseTabulation.getId() != null){
|
|
|
CaseTabulation caseTabulation1 = this.getById(caseTabulation.getId());
|
|
@@ -102,5 +145,7 @@ public class CaseTabulationServiceImpl extends ServiceImpl<ICaseTabulationMapper
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|