|
@@ -35,7 +35,7 @@ import java.util.List;
|
|
|
* @date 2023-06-06
|
|
* @date 2023-06-06
|
|
|
*/
|
|
*/
|
|
|
@Service
|
|
@Service
|
|
|
-public class OutEsServiceImpl implements IOutEsService {
|
|
|
|
|
|
|
+public class OutEsServiceImpl extends OutBaseService implements IOutEsService {
|
|
|
private static final Logger log = LoggerFactory.getLogger(OutEsServiceImpl.class);
|
|
private static final Logger log = LoggerFactory.getLogger(OutEsServiceImpl.class);
|
|
|
@Resource
|
|
@Resource
|
|
|
private ISysConfigService sysConfigService;
|
|
private ISysConfigService sysConfigService;
|
|
@@ -110,11 +110,7 @@ public class OutEsServiceImpl implements IOutEsService {
|
|
|
int port = jsonObject.getIntValue("port");
|
|
int port = jsonObject.getIntValue("port");
|
|
|
String scheme = jsonObject.getString("scheme");
|
|
String scheme = jsonObject.getString("scheme");
|
|
|
//外网临时目录
|
|
//外网临时目录
|
|
|
- String tmpDir = sysConfigService.selectConfigByKey("out.dir.tmp");
|
|
|
|
|
-
|
|
|
|
|
- if (!tmpDir.endsWith(Constants.DIR_END)) {
|
|
|
|
|
- tmpDir += "/";
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ String tmpDir = tmpDIr();
|
|
|
|
|
|
|
|
String time = DateUtils.dateTimeNow();
|
|
String time = DateUtils.dateTimeNow();
|
|
|
|
|
|
|
@@ -149,16 +145,7 @@ public class OutEsServiceImpl implements IOutEsService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//获取外网同步正式目录
|
|
//获取外网同步正式目录
|
|
|
- String syncDir = sysConfigService.selectConfigByKey("out.dir.sync");
|
|
|
|
|
-
|
|
|
|
|
- if (!syncDir.endsWith(Constants.DIR_END)) {
|
|
|
|
|
- syncDir += "/";
|
|
|
|
|
- }
|
|
|
|
|
- //如果没有目录,则创建目录
|
|
|
|
|
- file = new File(syncDir);
|
|
|
|
|
- if (!file.exists()) {
|
|
|
|
|
- file.mkdirs();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ String syncDir = syncDIr();
|
|
|
|
|
|
|
|
//打包文件--start
|
|
//打包文件--start
|
|
|
//生成zip文件全路径名
|
|
//生成zip文件全路径名
|
|
@@ -170,7 +157,7 @@ public class OutEsServiceImpl implements IOutEsService {
|
|
|
CompressZip.zip(targetDir, zipFile);
|
|
CompressZip.zip(targetDir, zipFile);
|
|
|
//打包文件--end
|
|
//打包文件--end
|
|
|
|
|
|
|
|
- //生成描述txt文件--start
|
|
|
|
|
|
|
+ //生成描述json文件--start
|
|
|
try {
|
|
try {
|
|
|
String descName = syncDir + "sync-99-" + time + ".json";
|
|
String descName = syncDir + "sync-99-" + time + ".json";
|
|
|
String md5 = DigestUtils.md5Hex(Files.newInputStream(zipFile.toPath()));
|
|
String md5 = DigestUtils.md5Hex(Files.newInputStream(zipFile.toPath()));
|
|
@@ -183,8 +170,7 @@ public class OutEsServiceImpl implements IOutEsService {
|
|
|
mapper.writeValue(descFile, desc);
|
|
mapper.writeValue(descFile, desc);
|
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
|
}
|
|
}
|
|
|
- //生成描述txt文件--end
|
|
|
|
|
-
|
|
|
|
|
|
|
+ //生成描述json文件--end
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// elasticdump --input http://localhost:9200/test --output /mnt/test_index_mapping.json --type=mapping
|
|
// elasticdump --input http://localhost:9200/test --output /mnt/test_index_mapping.json --type=mapping
|