|
|
@@ -1,5 +1,6 @@
|
|
|
package com.xunmei.system.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.crypto.digest.DigestUtil;
|
|
|
import cn.hutool.http.HttpException;
|
|
|
@@ -70,6 +71,8 @@ public class SysServerServiceImpl extends ServiceImpl<SysServerMapper, SysServer
|
|
|
@Resource
|
|
|
private MonitorCatConfig monitorCatConfig;
|
|
|
|
|
|
+ private static final String LOGS_DIR = "/log";
|
|
|
+
|
|
|
@Override
|
|
|
public TableDataInfo<SysServerPageVo> selectPage(SysServerPageDto req) {
|
|
|
|
|
|
@@ -231,8 +234,16 @@ public class SysServerServiceImpl extends ServiceImpl<SysServerMapper, SysServer
|
|
|
fileUploadByByteDto.setFilePath(parentPath.split("logs")[1]);
|
|
|
fileUploadByByteDto.setServerName(server.getServerIp());
|
|
|
//远程调用文件服务上传流 到指定目录保持为文件
|
|
|
- fileService.uploadFileByte(fileUploadByByteDto);
|
|
|
+ //fileService.uploadFileByte(fileUploadByByteDto);
|
|
|
|
|
|
+ //修改远程调用为本地存储
|
|
|
+ String localFilePath = fileService.getLocalPathPrefix().getData();
|
|
|
+ final String currentServerLogDir = localFilePath + LOGS_DIR + File.separator + fileUploadByByteDto.getServerName() + File.separator + fileUploadByByteDto.getFilePath();
|
|
|
+ final File file = new File(currentServerLogDir);
|
|
|
+ if (!file.exists()) {
|
|
|
+ file.mkdirs();
|
|
|
+ }
|
|
|
+ FileUtil.writeBytes(fileUploadByByteDto.getFileByte(), currentServerLogDir + File.separator + fileUploadByByteDto.getFileName());
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|