|  | @@ -11,6 +11,7 @@ import com.alibaba.fastjson2.TypeReference;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
	
		
			
				|  |  | +import com.xunmei.common.core.domain.file.dto.FileDownloadDto;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.domain.file.dto.FileUploadByByteDto;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.thread.ThreadPoolConfig;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.util.BeanHelper;
 | 
	
	
		
			
				|  | @@ -27,6 +28,7 @@ import com.xunmei.system.service.ISysServerService;
 | 
	
		
			
				|  |  |  import com.xunmei.system.vo.server.CheckListVo;
 | 
	
		
			
				|  |  |  import com.xunmei.system.vo.server.FileInfoVo;
 | 
	
		
			
				|  |  |  import com.xunmei.system.vo.server.SysServerPageVo;
 | 
	
		
			
				|  |  | +import feign.Response;
 | 
	
		
			
				|  |  |  import org.springframework.beans.BeanUtils;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Qualifier;
 | 
	
	
		
			
				|  | @@ -34,7 +36,8 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import java.io.File;
 | 
	
		
			
				|  |  | +import javax.servlet.http.HttpServletResponse;
 | 
	
		
			
				|  |  | +import java.io.*;
 | 
	
		
			
				|  |  |  import java.util.ArrayList;
 | 
	
		
			
				|  |  |  import java.util.Arrays;
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
	
		
			
				|  | @@ -203,6 +206,41 @@ public class SysServerServiceImpl extends ServiceImpl<SysServerMapper, SysServer
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public void downloadLogData(TransferLogDto req, HttpServletResponse response) {
 | 
	
		
			
				|  |  | +        final SysServer sysServer = getById(req.getServerId());
 | 
	
		
			
				|  |  | +        final String serverIp = sysServer.getServerIp();
 | 
	
		
			
				|  |  | +        FileDownloadDto dto=new FileDownloadDto();
 | 
	
		
			
				|  |  | +        dto.setServerName(serverIp);
 | 
	
		
			
				|  |  | +        dto.setFilePath(req.getParentPath().split("logs")[1]);
 | 
	
		
			
				|  |  | +        dto.setFileName(req.getPath());
 | 
	
		
			
				|  |  | +        final Response result = fileService.downloadLogData(dto);
 | 
	
		
			
				|  |  | +        InputStream inputStream = null;
 | 
	
		
			
				|  |  | +        BufferedInputStream bufferedInputStream = null;
 | 
	
		
			
				|  |  | +        BufferedOutputStream bufferedOutputStream = null;
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            //把流返回到前端
 | 
	
		
			
				|  |  | +            Response.Body body = result.body();
 | 
	
		
			
				|  |  | +            inputStream = body.asInputStream();
 | 
	
		
			
				|  |  | +            bufferedInputStream = new BufferedInputStream(inputStream);
 | 
	
		
			
				|  |  | +            bufferedOutputStream = new BufferedOutputStream(response.getOutputStream());
 | 
	
		
			
				|  |  | +            response.setHeader("Content-Type", "application/octet-stream;charset=UTF-8");
 | 
	
		
			
				|  |  | +            response.addHeader("Content-Length", "" + body.length());
 | 
	
		
			
				|  |  | +            response.setHeader("Content-Disposition", result.headers().get("Content-Disposition").toString().replace("[", "").replace("]", ""));
 | 
	
		
			
				|  |  | +            int length = 0;
 | 
	
		
			
				|  |  | +            byte[] temp = new byte[1024 * 10];
 | 
	
		
			
				|  |  | +            while ((length = bufferedInputStream.read(temp)) != -1) {
 | 
	
		
			
				|  |  | +                bufferedOutputStream.write(temp, 0, length);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            bufferedOutputStream.flush();
 | 
	
		
			
				|  |  | +            bufferedOutputStream.close();
 | 
	
		
			
				|  |  | +            bufferedInputStream.close();
 | 
	
		
			
				|  |  | +            inputStream.close();
 | 
	
		
			
				|  |  | +        } catch (IOException e) {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            throw new RuntimeException(e);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 查询服务器维护
 | 
	
		
			
				|  |  |       *
 |