|
@@ -75,6 +75,8 @@ import org.springblade.system.entity.DictBiz;
|
|
|
import org.springblade.system.feign.IDictBizClient;
|
|
|
import org.springblade.system.user.entity.User;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
+import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -137,6 +139,8 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
private final IArchiveExpertConclusionService expertConclusionService;
|
|
|
private final ITraceLogService iTraceLogService;
|
|
|
|
|
|
+ private final JdbcTemplate jdbcTemplate;
|
|
|
+
|
|
|
//表格高度
|
|
|
private static int high = 20;
|
|
|
//表格宽度
|
|
@@ -4038,7 +4042,9 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
String[] ids = archiveIds.split(",");
|
|
|
for (String archiveId : ids) {
|
|
|
ArchivesAuto auto = baseMapper.selectById(archiveId);
|
|
|
- List<ArchiveFile> archiveFiles = archiveFileClient.getArchiveFileByArchiveID(Long.valueOf(archiveId));
|
|
|
+ String sql="select * from u_archive_file where archive_id = "+archiveId+" and is_deleted = 0 order by sort,sort_num,create_time";
|
|
|
+ //List<ArchiveFile> archiveFiles = archiveFileClient.getArchiveFileByArchiveID(Long.valueOf(archiveId));
|
|
|
+ List<ArchiveFile> archiveFiles= jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ArchiveFile.class));
|
|
|
archiveAutoPdfService.buildArchiveFrontPdfs(projectId,auto,archiveFiles,true);
|
|
|
baseMapper.updateById(auto);
|
|
|
}
|
|
@@ -4047,30 +4053,50 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
|
|
|
@Override
|
|
|
public boolean findAndReplace(List<ArchivesAuto> archivesAutos, FindAndReplaceDto dto) {
|
|
|
+ List<ArchivesAuto>updates = new ArrayList<>();
|
|
|
for (ArchivesAuto archivesAuto : archivesAutos) {
|
|
|
+ ArchivesAuto auto = new ArchivesAuto();
|
|
|
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())) {
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ int lastIndex = 0;
|
|
|
+ // 查找所有匹配的位置
|
|
|
int index = name.indexOf(dto.getQuery());
|
|
|
- if (index != -1) {
|
|
|
- StringBuilder sb = new StringBuilder(name);
|
|
|
+ while (index != -1) {
|
|
|
+ // 添加未处理部分(从上一个 lastIndex 到当前 index)
|
|
|
+ sb.append(name, lastIndex, index);
|
|
|
+
|
|
|
+ // 根据位置插入替换内容
|
|
|
if (dto.getPosition() != null) {
|
|
|
switch (dto.getPosition()) {
|
|
|
- case 1: // 在查询内容前插入替换内容
|
|
|
- sb.insert(index, dto.getReplace());
|
|
|
+ case 1: // 在查询内容前插入
|
|
|
+ sb.append(dto.getReplace());
|
|
|
+ sb.append(dto.getQuery());
|
|
|
break;
|
|
|
- case 2: // 在查询内容后插入替换内容
|
|
|
- sb.insert(index + dto.getQuery().length(), dto.getReplace());
|
|
|
+ case 2: // 在查询内容后插入
|
|
|
+ sb.append(dto.getQuery());
|
|
|
+ sb.append(dto.getReplace());
|
|
|
break;
|
|
|
default:
|
|
|
throw new ServiceException("请选择正确的定位条件");
|
|
|
}
|
|
|
+ } else {
|
|
|
+ sb.append(dto.getQuery()); // 没有指定位置时保留原内容
|
|
|
}
|
|
|
- archivesAuto.setName(sb.toString()); // 更新名称
|
|
|
+ // 更新 lastIndex 到当前匹配结束位置
|
|
|
+ lastIndex = index + dto.getQuery().length();
|
|
|
+ // 继续查找下一个匹配项
|
|
|
+ index = name.indexOf(dto.getQuery(), lastIndex);
|
|
|
}
|
|
|
- }else {
|
|
|
- throw new ServiceException("没有找到原内容");
|
|
|
+ // 添加剩余的部分
|
|
|
+ sb.append(name.substring(lastIndex));
|
|
|
+ // 更新名称
|
|
|
+ archivesAuto.setName(sb.toString());
|
|
|
+ auto.setId(archivesAuto.getId());
|
|
|
+ auto.setName(archivesAuto.getName());
|
|
|
+ updates.add(auto);
|
|
|
}
|
|
|
}
|
|
|
} else if (dto.getType()==2) {
|
|
@@ -4079,8 +4105,9 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
if (StringUtils.isNotEmpty(name)&&name.contains(dto.getQuery())) {
|
|
|
String newName = name.replaceAll(dto.getQuery(), dto.getReplace());
|
|
|
archivesAuto.setName(newName);
|
|
|
- }else {
|
|
|
- throw new ServiceException("没有找到原内容");
|
|
|
+ auto.setId(archivesAuto.getId());
|
|
|
+ auto.setName(archivesAuto.getName());
|
|
|
+ updates.add(auto);
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
@@ -4089,13 +4116,17 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
if (StringUtils.isNotEmpty(name)&&name.contains(dto.getQuery())) {
|
|
|
String newName = name.replaceAll(dto.getQuery(), "");
|
|
|
archivesAuto.setName(newName);
|
|
|
- }else {
|
|
|
- throw new ServiceException("没有找到原内容");
|
|
|
+ auto.setId(archivesAuto.getId());
|
|
|
+ auto.setName(archivesAuto.getName());
|
|
|
+ updates.add(auto);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return this.updateBatchById(archivesAutos);
|
|
|
+ if(!updates.isEmpty()){
|
|
|
+ return this.updateBatchById(archivesAutos);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
public List<ArchivesAuto> setFileNumberByConfig(ArchiveProjectConfig config,List<ArchivesAutoVO4> value){
|