|  | @@ -17,6 +17,7 @@ import org.springblade.archive.vo.ScanFolderVO;
 | 
	
		
			
				|  |  |  import org.springblade.business.entity.ArchiveFile;
 | 
	
		
			
				|  |  |  import org.springblade.business.feign.ArchiveFileClient;
 | 
	
		
			
				|  |  |  import org.springblade.common.utils.SnowFlakeUtil;
 | 
	
		
			
				|  |  | +import org.springblade.core.log.exception.ServiceException;
 | 
	
		
			
				|  |  |  import org.springblade.core.mp.support.Query;
 | 
	
		
			
				|  |  |  import org.springblade.core.oss.model.BladeFile;
 | 
	
		
			
				|  |  |  import org.springblade.core.tool.api.R;
 | 
	
	
		
			
				|  | @@ -185,6 +186,42 @@ public class ScanFileServiceImpl  extends ServiceImpl<ScanFileMapper, ScanFile>
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public boolean addScanFolder(Long projectId, Long contractId, String forderName, Long parentId) {
 | 
	
		
			
				|  |  | +            ScanFolder scanFolder = new ScanFolder();
 | 
	
		
			
				|  |  | +            scanFolder.setId(SnowFlakeUtil.getId());
 | 
	
		
			
				|  |  | +            scanFolder.setProjectId(projectId);
 | 
	
		
			
				|  |  | +            scanFolder.setContractId(contractId);
 | 
	
		
			
				|  |  | +            scanFolder.setFolderName(forderName);
 | 
	
		
			
				|  |  | +            scanFolder.setParentId(parentId);
 | 
	
		
			
				|  |  | +            scanFolder.setIsDeleted(0);
 | 
	
		
			
				|  |  | +            String folderPath="";
 | 
	
		
			
				|  |  | +            if(parentId!=0){
 | 
	
		
			
				|  |  | +                ScanFolder fatherFolder = scanFolderMapper.selectById(parentId);
 | 
	
		
			
				|  |  | +                if (fatherFolder!=null){
 | 
	
		
			
				|  |  | +                    String fatherPath = fatherFolder.getFolderPath();
 | 
	
		
			
				|  |  | +                    folderPath=fatherPath+"/"+forderName;
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }else {
 | 
	
		
			
				|  |  | +                 folderPath=ROOT_PREFIX+"/"+contractId+"/"+forderName;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            File folder = new File(folderPath);
 | 
	
		
			
				|  |  | +           if (!folder.exists()) {
 | 
	
		
			
				|  |  | +             boolean created = folder.mkdirs();
 | 
	
		
			
				|  |  | +             if (!created) {
 | 
	
		
			
				|  |  | +                throw new ServiceException("创建文件夹失败");
 | 
	
		
			
				|  |  | +             }
 | 
	
		
			
				|  |  | +           }
 | 
	
		
			
				|  |  | +          scanFolder.setFolderPath(folderPath);
 | 
	
		
			
				|  |  | +          int insert = scanFolderMapper.insert(scanFolder);
 | 
	
		
			
				|  |  | +          return insert == 1;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public boolean addScanFile(Long projectId, Long contractId, String forderName, Long forderId) {
 | 
	
		
			
				|  |  | +        return false;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 入口方法:扫描并入库指定contractId的所有文件夹
 | 
	
		
			
				|  |  |       * @param contractId 传入的合同ID(对应D:\PDF下的文件夹名)
 |