|  |  | @ -12,10 +12,7 @@ import com.glxp.api.annotation.AuthRuleAnnotation; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.common.enums.ResultEnum; |  |  |  | import com.glxp.api.common.enums.ResultEnum; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.common.res.BaseResponse; |  |  |  | import com.glxp.api.common.res.BaseResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.common.util.ResultVOUtils; |  |  |  | import com.glxp.api.common.util.ResultVOUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.constant.BasicExportStatusEnum; |  |  |  | import com.glxp.api.constant.*; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.constant.BasicExportTypeEnum; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.constant.BasicProcessStatus; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.constant.ConstantStatus; |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.dao.auth.*; |  |  |  | import com.glxp.api.dao.auth.*; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.dao.basic.*; |  |  |  | import com.glxp.api.dao.basic.*; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.dao.inout.*; |  |  |  | import com.glxp.api.dao.inout.*; | 
			
		
	
	
		
		
			
				
					|  |  | @ -62,8 +59,12 @@ import org.springframework.web.bind.annotation.RequestBody; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.web.bind.annotation.RestController; |  |  |  | import org.springframework.web.bind.annotation.RestController; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.annotation.Resource; |  |  |  | import javax.annotation.Resource; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import javax.servlet.ServletOutputStream; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import javax.servlet.http.HttpServletResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.validation.Valid; |  |  |  | import javax.validation.Valid; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.io.*; |  |  |  | import java.io.*; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import java.net.URLEncoder; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import java.nio.charset.StandardCharsets; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.Date; |  |  |  | import java.util.Date; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.List; |  |  |  | import java.util.List; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -359,7 +360,7 @@ public class SpsSyncDownloadController { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .taskId(taskId) |  |  |  |                     .taskId(taskId) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .startTime(new Date()) |  |  |  |                     .startTime(new Date()) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .endTime(new Date()) |  |  |  |                     .endTime(new Date()) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .status(1) |  |  |  |                     .status(StatusEnum.SUCCESS.getCode()) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     .updateTime(new Date()) |  |  |  |                     .updateTime(new Date()) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .type(upLoadRequest.getExportType().getRemark()) |  |  |  |                     .type(upLoadRequest.getExportType().getRemark()) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .idDatas(upLoadRequest.getExportType().getKey()) |  |  |  |                     .idDatas(upLoadRequest.getExportType().getKey()) | 
			
		
	
	
		
		
			
				
					|  |  | @ -1142,5 +1143,63 @@ public class SpsSyncDownloadController { | 
			
		
	
		
		
			
				
					
					|  |  |  |         return ResultVOUtils.success("上传成功"); |  |  |  |         return ResultVOUtils.success("上传成功"); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @GetMapping("/sps/sync/download/info/file") | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public void downloadFile(HttpServletResponse response,String id){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (StrUtil.isBlank(id)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             throw new RuntimeException("缺少唯一标识"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         BasicDownloadStatusEntity info = basicDownloadService.getById(id); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (info == null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             throw new RuntimeException("数据不存在"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (StrUtil.isBlank(info.getCacheFilePath())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             throw new RuntimeException("文件未生成"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         File file = new File(info.getCacheFilePath()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (!file.exists()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             throw new RuntimeException("文件丢失"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         String[] split = info.getCacheFilePath().split("/"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         String enFileName = URLEncoder.encode(split[split.length - 1], StandardCharsets.UTF_8); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         // 设值返回文件属性,浏览器会根据属性调用下载文件方法
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         response.addHeader("Content-Disposition", "attachment;filename=" + enFileName); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         // 前端获取文件名,需要解码
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         response.addHeader("downLoadName", enFileName); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         // 定义输出流
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ServletOutputStream outputStream = null; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         FileInputStream fileInputStream = null; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         try { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outputStream = response.getOutputStream(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             // 定义输出类型为二进制流输出
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             response.setContentType("application/octet-stream"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             fileInputStream = new FileInputStream(file); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             byte[] bytes = new byte[fileInputStream.available()]; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             fileInputStream.read(bytes); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             // 把流写入response
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outputStream.write(bytes); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             // flush落盘
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outputStream.flush(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             // 关闭输出流
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outputStream.close(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } catch (IOException e) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             throw new RuntimeException(e); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } finally { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (outputStream != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 try { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     outputStream.close(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } catch (IOException e) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     throw new RuntimeException(e); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (fileInputStream != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 try { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     fileInputStream.close(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } catch (IOException e) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     throw new RuntimeException(e); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | 
 |