|
@@ -20,6 +20,7 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
+import com.alibaba.nacos.common.utils.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
@@ -35,6 +36,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
|
import org.springblade.archive.dto.ArchiveWarningDTO;
|
|
|
+import org.springblade.archive.dto.FindAndReplaceDto;
|
|
|
import org.springblade.archive.dto.JiLinQueryDto;
|
|
|
import org.springblade.archive.dto.SaveApplyDTO;
|
|
|
import org.springblade.archive.entity.*;
|
|
@@ -77,7 +79,6 @@ import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
@@ -1260,10 +1261,9 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
}
|
|
|
archiveFileClient.updateArchiveFileForCreateArchive(waitArchiveFiles);
|
|
|
try {
|
|
|
-// for (ArchiveFile saveVo : waitArchiveFiles) {
|
|
|
-// metadataClassificationClient.createMetadataFile(saveVo.getId(), 0);
|
|
|
-// }
|
|
|
- batchCreateMetadataFiles(waitArchiveFiles);
|
|
|
+ for (ArchiveFile saveVo : waitArchiveFiles) {
|
|
|
+ metadataClassificationClient.createMetadataFile(saveVo.getId(), 0);
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -1319,7 +1319,9 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
}
|
|
|
archiveFileClient.updateArchiveFileForCreateArchive(waitArchiveFiles);
|
|
|
try {
|
|
|
- batchCreateMetadataFiles(waitArchiveFiles);
|
|
|
+ for (ArchiveFile saveVo : waitArchiveFiles) {
|
|
|
+ metadataClassificationClient.createMetadataFile(saveVo.getId(), 0);
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -1366,10 +1368,9 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
}
|
|
|
archiveFileClient.updateArchiveFileForCreateArchive(waitArchiveFiles);
|
|
|
try {
|
|
|
-// for (ArchiveFile saveVo : waitArchiveFiles) {
|
|
|
-// metadataClassificationClient.createMetadataFile(saveVo.getId(), 0);
|
|
|
-// }
|
|
|
- batchCreateMetadataFiles(waitArchiveFiles);
|
|
|
+ for (ArchiveFile saveVo : waitArchiveFiles) {
|
|
|
+ metadataClassificationClient.createMetadataFile(saveVo.getId(), 0);
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -1422,10 +1423,9 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
}
|
|
|
archiveFileClient.updateArchiveFileForCreateArchive(waitArchiveFiles);
|
|
|
try {
|
|
|
-// for (ArchiveFile saveVo : waitArchiveFiles) {
|
|
|
-// metadataClassificationClient.createMetadataFile(saveVo.getId(), 0);
|
|
|
-// }
|
|
|
- batchCreateMetadataFiles(waitArchiveFiles);
|
|
|
+ for (ArchiveFile saveVo : waitArchiveFiles) {
|
|
|
+ metadataClassificationClient.createMetadataFile(saveVo.getId(), 0);
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -4034,6 +4034,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
if(StringUtils.isEmpty(archiveIds)){
|
|
|
return false;
|
|
|
}
|
|
|
+ archiveAutoPdfService.assignArchiveTableUrl();
|
|
|
String[] ids = archiveIds.split(",");
|
|
|
for (String archiveId : ids) {
|
|
|
ArchivesAuto auto = baseMapper.selectById(archiveId);
|
|
@@ -4044,6 +4045,59 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean findAndReplace(List<ArchivesAuto> archivesAutos, FindAndReplaceDto dto) {
|
|
|
+ for (ArchivesAuto archivesAuto : archivesAutos) {
|
|
|
+ if(dto.getType()==1){
|
|
|
+ if(StringUtils.isNotEmpty(dto.getQuery())&&StringUtils.isNotEmpty(dto.getReplace())){
|
|
|
+ String name = archivesAuto.getName();
|
|
|
+ if (StringUtils.isNotEmpty(name)&&name.contains(dto.getQuery())) {
|
|
|
+ int index = name.indexOf(dto.getQuery());
|
|
|
+ if (index != -1) {
|
|
|
+ StringBuilder sb = new StringBuilder(name);
|
|
|
+ if (dto.getPosition() != null) {
|
|
|
+ switch (dto.getPosition()) {
|
|
|
+ case 1: // 在查询内容前插入替换内容
|
|
|
+ sb.insert(index, dto.getReplace());
|
|
|
+ break;
|
|
|
+ case 2: // 在查询内容后插入替换内容
|
|
|
+ sb.insert(index + dto.getQuery().length(), dto.getReplace());
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ throw new ServiceException("请选择正确的定位条件");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ archivesAuto.setName(sb.toString()); // 更新名称
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ throw new ServiceException("没有找到原内容");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (dto.getType()==2) {
|
|
|
+ if(StringUtils.isNotEmpty(dto.getQuery())&&StringUtils.isNotEmpty(dto.getReplace())){
|
|
|
+ String name = archivesAuto.getName();
|
|
|
+ if (StringUtils.isNotEmpty(name)&&name.contains(dto.getQuery())) {
|
|
|
+ String newName = name.replaceAll(dto.getQuery(), dto.getReplace());
|
|
|
+ archivesAuto.setName(newName);
|
|
|
+ }else {
|
|
|
+ throw new ServiceException("没有找到原内容");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if(StringUtils.isNotEmpty(dto.getQuery())){
|
|
|
+ String name = archivesAuto.getName();
|
|
|
+ if (StringUtils.isNotEmpty(name)&&name.contains(dto.getQuery())) {
|
|
|
+ String newName = name.replaceAll(dto.getQuery(), "");
|
|
|
+ archivesAuto.setName(newName);
|
|
|
+ }else {
|
|
|
+ throw new ServiceException("没有找到原内容");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return this.updateBatchById(archivesAutos);
|
|
|
+ }
|
|
|
+
|
|
|
public List<ArchivesAuto> setFileNumberByConfig(ArchiveProjectConfig config,List<ArchivesAutoVO4> value){
|
|
|
int i=1;
|
|
|
List<ArchivesAuto>list=new ArrayList<>();
|
|
@@ -4074,7 +4128,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
}
|
|
|
|
|
|
|
|
|
- public void deleteFile(String defaultDir,Long id){
|
|
|
+ public void deleteFile(String defaultDir,Long id){
|
|
|
String dir = defaultDir+"/"+id;
|
|
|
String file = defaultDir+"/"+id+".zip";
|
|
|
// 多条命令执行
|