|
@@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.itextpdf.text.*;
|
|
import com.itextpdf.text.*;
|
|
@@ -73,6 +74,7 @@ import org.springblade.system.entity.DictBiz;
|
|
import org.springblade.system.feign.IDictBizClient;
|
|
import org.springblade.system.feign.IDictBizClient;
|
|
import org.springblade.system.user.entity.User;
|
|
import org.springblade.system.user.entity.User;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -4102,8 +4104,73 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- public void deleteFile(String defaultDir,Long id){
|
|
|
|
|
|
+ @Override
|
|
|
|
+ @Async
|
|
|
|
+ public void fileNumberFlush(Long projectId, Long contractId, List<String> nodeIds,Integer isArchive) {
|
|
|
|
+ ArchiveProjectConfig config = archiveProjectConfigService.getByProjectIdOrNew(projectId);
|
|
|
|
+ List<ArchivesAutoVO4>list=baseMapper.selectAllArchiveAuto(projectId,contractId,nodeIds,isArchive);
|
|
|
|
+ if(list!=null && list.size()>0){
|
|
|
|
+ if(config.getDirType()==null||config.getDirType()==0){
|
|
|
|
+ List<ArchivesAuto> archivesAutos = setFileNumberByConfig(config, list);
|
|
|
|
+ this.updateBatchById(archivesAutos);
|
|
|
|
+ }else {
|
|
|
|
+ Map<Long, List<ArchivesAutoVO4>> map = list.stream().collect(Collectors.groupingBy(ArchivesAutoVO4::getParentId));
|
|
|
|
+ for (Map.Entry<Long, List<ArchivesAutoVO4>> entry : map.entrySet()) {
|
|
|
|
+ List<ArchivesAutoVO4> value = entry.getValue();
|
|
|
|
+ List<ArchivesAuto> archivesAutos = setFileNumberByConfig(config, value);
|
|
|
|
+ this.updateBatchById(archivesAutos);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean reBuildArchiveFrontPdfs(String archiveIds, Long projectId) {
|
|
|
|
+ if(StringUtils.isEmpty(archiveIds)){
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ String[] ids = archiveIds.split(",");
|
|
|
|
+ for (String archiveId : ids) {
|
|
|
|
+ ArchivesAuto auto = baseMapper.selectById(archiveId);
|
|
|
|
+ List<ArchiveFile> archiveFiles = archiveFileClient.getArchiveFileByArchiveID(Long.valueOf(archiveId));
|
|
|
|
+ archiveAutoPdfService.buildArchiveFrontPdfs(projectId,auto,archiveFiles,true);
|
|
|
|
+ baseMapper.updateById(auto);
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public List<ArchivesAuto> setFileNumberByConfig(ArchiveProjectConfig config,List<ArchivesAutoVO4> value){
|
|
|
|
+ int i=1;
|
|
|
|
+ List<ArchivesAuto>list=new ArrayList<>();
|
|
|
|
+ for (ArchivesAutoVO4 v:value) {
|
|
|
|
+ ArchivesAuto auto = new ArchivesAuto();
|
|
|
|
+ if(config.getIndexType()==null||config.getIndexType()==0){
|
|
|
|
+ v.setFileNumber(v.getFileNumberPrefix()+"_"+i);
|
|
|
|
+ }else {
|
|
|
|
+ String prefix = v.getFileNumberPrefix();
|
|
|
|
+ int index = i; // 编号从 1 开始
|
|
|
|
+ // 获取配置中的编号长度(最多多少位)
|
|
|
|
+ int numLength = config.getIndexNum();
|
|
|
|
+ // 默认最多4位,防止过长或无效值
|
|
|
|
+ if (numLength > 10) { // 限制最大为10位
|
|
|
|
+ numLength = 4;
|
|
|
|
+ }
|
|
|
|
+ // 使用 %0xd 格式化数字,x 表示总长度
|
|
|
|
+ String formattedIndex = String.format("%0" + numLength + "d", index);
|
|
|
|
+ // 设置最终档号
|
|
|
|
+ v.setFileNumber(prefix + "_" + formattedIndex);
|
|
|
|
+ }
|
|
|
|
+ auto.setId(v.getId());
|
|
|
|
+ auto.setFileNumber(v.getFileNumber());
|
|
|
|
+ list.add(auto);
|
|
|
|
+ i++;
|
|
|
|
+ }
|
|
|
|
+ return list;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public void deleteFile(String defaultDir,Long id){
|
|
String dir = defaultDir+"/"+id;
|
|
String dir = defaultDir+"/"+id;
|
|
String file = defaultDir+"/"+id+".zip";
|
|
String file = defaultDir+"/"+id+".zip";
|
|
// 多条命令执行
|
|
// 多条命令执行
|