|  |  |  | @ -4,6 +4,8 @@ import java.io.File; | 
			
		
	
		
			
				
					|  |  |  |  | import java.io.IOException; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.ArrayList; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.Date; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.HashMap; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.List; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.Map; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.concurrent.TimeUnit; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -52,8 +54,27 @@ public class FileServiceImpl implements FileService { | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     private IdcService idcService; | 
			
		
	
		
			
				
					|  |  |  |  |     private String imagePath = "register/file/image2/"; | 
			
		
	
		
			
				
					|  |  |  |  |      | 
			
		
	
		
			
				
					|  |  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |  |     public BaseResponse upload(List<String> list) { | 
			
		
	
		
			
				
					|  |  |  |  |         return fileToUpload(list); | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |  |     public BaseResponse download(List<String> list) { | 
			
		
	
		
			
				
					|  |  |  |  |         return fileToDownload(list);  | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  |      | 
			
		
	
		
			
				
					|  |  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |  |     public BaseResponse fileUpload(HttpServletRequest request,Map<String,Object> params) { | 
			
		
	
		
			
				
					|  |  |  |  |         List<String> list = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |  |         String[] strs = params.get("fileName").toString().split(","); | 
			
		
	
		
			
				
					|  |  |  |  |         for(String str:strs) { | 
			
		
	
		
			
				
					|  |  |  |  |             list.add(str); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         return fileToUpload(list); | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  |      | 
			
		
	
		
			
				
					|  |  |  |  |     private BaseResponse fileToUpload(List<String> list) { | 
			
		
	
		
			
				
					|  |  |  |  |         String host=""; | 
			
		
	
		
			
				
					|  |  |  |  |         try { | 
			
		
	
		
			
				
					|  |  |  |  |             Map<String, Object> map = dbDao.get("select * from sync_data_set limit 1"); | 
			
		
	
	
		
			
				
					|  |  |  | @ -73,21 +94,26 @@ public class FileServiceImpl implements FileService { | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         if(StringUtils.isEmpty(host)) | 
			
		
	
		
			
				
					|  |  |  |  |             return ResultVOUtils.error(9999,"上传地址未配置,请至同步设置中进行设置"); | 
			
		
	
		
			
				
					|  |  |  |  |         if(params.get("fileName")!=null) { | 
			
		
	
		
			
				
					|  |  |  |  |             String fileName = params.get("fileName").toString(); | 
			
		
	
		
			
				
					|  |  |  |  |             String[] strs = fileName.split(","); | 
			
		
	
		
			
				
					|  |  |  |  |         if(list!=null) { | 
			
		
	
		
			
				
					|  |  |  |  |              | 
			
		
	
		
			
				
					|  |  |  |  |              | 
			
		
	
		
			
				
					|  |  |  |  |             String filePathSlash = filePath.substring(filePath.length() - 1).equals("/") ? "" : "/"; | 
			
		
	
		
			
				
					|  |  |  |  |             ArrayList<String> files = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |  |             boolean isExists = true; | 
			
		
	
		
			
				
					|  |  |  |  |             for(String str:strs) { | 
			
		
	
		
			
				
					|  |  |  |  |                 if (!StringUtils.isEmpty(str) && FileUtils.isFileExist(filePath + filePathSlash + imagePath + str)) { | 
			
		
	
		
			
				
					|  |  |  |  |                     files.add(filePath + filePathSlash + imagePath + str); | 
			
		
	
		
			
				
					|  |  |  |  |             List<String> noExitsList = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |  |             for(String strs:list) { | 
			
		
	
		
			
				
					|  |  |  |  |                 String[] str = strs.split(","); | 
			
		
	
		
			
				
					|  |  |  |  |                 for(String s:str) { | 
			
		
	
		
			
				
					|  |  |  |  |                     if (!StringUtils.isEmpty(s) && FileUtils.isFileExist(filePath + filePathSlash + imagePath + s)) { | 
			
		
	
		
			
				
					|  |  |  |  |                         files.add(filePath + filePathSlash + imagePath + s); | 
			
		
	
		
			
				
					|  |  |  |  |                     } else { | 
			
		
	
		
			
				
					|  |  |  |  |                         isExists = false; | 
			
		
	
		
			
				
					|  |  |  |  |                         noExitsList.add(s); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |             if(!isExists) | 
			
		
	
		
			
				
					|  |  |  |  |                 return ResultVOUtils.error(9999,filePath + filePathSlash + imagePath + strs[0]); | 
			
		
	
		
			
				
					|  |  |  |  |                 return ResultVOUtils.error(9999,"以下文件不存在:\n"+JSON.toJSONString(noExitsList)); | 
			
		
	
		
			
				
					|  |  |  |  |             String result = relayFile(files,host); | 
			
		
	
		
			
				
					|  |  |  |  |             if (IDCUtils.isJson(result)) { | 
			
		
	
		
			
				
					|  |  |  |  |                 BaseResponse baseResponse = JSON.parseObject(result,BaseResponse.class); | 
			
		
	
	
		
			
				
					|  |  |  | @ -101,6 +127,22 @@ public class FileServiceImpl implements FileService { | 
			
		
	
		
			
				
					|  |  |  |  |      | 
			
		
	
		
			
				
					|  |  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |  |     public BaseResponse fileDownload(HttpServletRequest request,Map<String,Object> params) { | 
			
		
	
		
			
				
					|  |  |  |  |         List<String> list = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |  |         String[] strs = params.get("fileName").toString().split(","); | 
			
		
	
		
			
				
					|  |  |  |  |         for(String str:strs) { | 
			
		
	
		
			
				
					|  |  |  |  |             list.add(str); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         return fileToDownload(list); | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  |      | 
			
		
	
		
			
				
					|  |  |  |  |      | 
			
		
	
		
			
				
					|  |  |  |  |     private BaseResponse fileToDownload(List<String> list) { | 
			
		
	
		
			
				
					|  |  |  |  |         Map<String,Object> params = new HashMap<String,Object>(); | 
			
		
	
		
			
				
					|  |  |  |  |         String fileName = ""; | 
			
		
	
		
			
				
					|  |  |  |  |         for(String str:list) { | 
			
		
	
		
			
				
					|  |  |  |  |             fileName +=fileName.length()>0 ? ","+str : str; | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         params.put("fileName", fileName); | 
			
		
	
		
			
				
					|  |  |  |  |         Map<String, Object> map = dbDao.get("select * from sync_data_set limit 1"); | 
			
		
	
		
			
				
					|  |  |  |  |         if(map!=null&&map.get("syncIp")!=null) { | 
			
		
	
		
			
				
					|  |  |  |  |         | 
			
		
	
	
		
			
				
					|  |  |  | 
 |