Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setup-manager
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
setup-manager
Commits
92e69484
Commit
92e69484
authored
Oct 30, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加前端解压
parent
2b148fc2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
18 deletions
+37
-18
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/service/impl/SetupProjectServiceImpl.java
...hx/module/setup/service/impl/SetupProjectServiceImpl.java
+37
-18
No files found.
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/service/impl/SetupProjectServiceImpl.java
View file @
92e69484
...
...
@@ -97,24 +97,20 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
//读取本工程的资源文件 检测压缩包类型
//String sourcePath = "/project/" + ProductDisEnum.getByValue(setupProjectEntity.getProjectCode()).getDesc() + "/" + ProductDisEnum.getByValue(setupProjectEntity.getProjectCode()).getValue() + ".tar.gz";
//InputStream inputStream = this.getClass().getResourceAsStream(sourcePath);
String
sourcePath
=
this
.
publishPath
+
"/temp/project/"
+
ProductDisEnum
.
getByValue
(
setupProjectEntity
.
getProjectCode
()).
getDesc
()
+
"/"
+
ProductDisEnum
.
getByValue
(
setupProjectEntity
.
getProjectCode
()).
getValue
()
+
".tar.gz"
;
String
sourcePath
=
this
.
publishPath
+
"/temp/project/"
+
ProductDisEnum
.
getByValue
(
setupProjectEntity
.
getProjectCode
()).
getDesc
()
+
"/"
+
ProductDisEnum
.
getByValue
(
setupProjectEntity
.
getProjectCode
()).
getValue
()
+
".tar.gz"
;
File
file
=
new
File
(
sourcePath
);
log
.
info
(
"文件存在:{}"
,
file
.
exists
());
File
destDir
=
new
File
(
setupProjectEntity
.
getProjectPath
());
if
(!
file
.
exists
())
{
if
(!
file
.
exists
())
{
throw
new
AppException
(
"请上传项目工程文件!"
);
}
final
TarGZipUnArchiver
ua
=
new
TarGZipUnArchiver
();
// Logging - as @Akom noted, logging is mandatory in newer versions, so you can use a code like this to configure it:
ConsoleLoggerManager
manager
=
new
ConsoleLoggerManager
();
manager
.
initialize
();
ua
.
enableLogging
(
manager
.
getLoggerForComponent
(
"bla"
));
// -- end of logging part
ua
.
setSourceFile
(
file
);
destDir
.
mkdirs
();
ua
.
setDestDirectory
(
destDir
);
...
...
@@ -125,8 +121,6 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
String str = RuntimeUtil.execForStr(shell);
log.info("解压命令结果:{}", str);*/
// InputStream inputStream = FileUtil.getInputStream(file);
///Hutoo.unGzip(inputStream, setupProjectEntity.getProjectPath());
...
...
@@ -162,9 +156,7 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
if
(
SystemUtil
.
getOsInfo
().
isLinux
())
{
//todo 执行部署脚本
//后端服务,创建service 启动服务
//RuntimeUtil.exec()
//callScript("project_deploy.sh","4",publicPath+"/bin/");
callScript
(
"project_deploy.sh"
,
"4"
,
publicPath
+
"/bin/"
);
}
else
if
(
SystemUtil
.
getOsInfo
().
isWindows
())
{
//todo
}
...
...
@@ -173,7 +165,36 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
}
else
if
(
ProjectTypeEnum
.
前端
.
getValue
()
==
setupProjectEntity
.
getProjectType
())
{
//TODO: 前端逻辑
//TODO: 前端逻辑 静态文件,只需要解压到指定目录即可
String
path
=
this
.
publishPath
+
"/temp/project/"
+
ProductDisEnum
.
getByValue
(
setupProjectEntity
.
getProjectCode
()).
getDesc
()
+
"/"
+
ProductDisEnum
.
getByValue
(
setupProjectEntity
.
getProjectCode
()).
getValue
();
String
sourceUiPath
=
path
+
".tar.gz"
;
File
uiFile
=
new
File
(
sourceUiPath
);
//查看zip文件是否存在
String
sourceUiZipPath
=
path
+
".zip"
;
File
uiZipFile
=
new
File
(
sourceUiZipPath
);
File
destDir
=
new
File
(
setupProjectEntity
.
getProjectPath
());
log
.
info
(
"tar文件存在:{},zip文件存在:{}"
,
uiFile
.
exists
(),
uiZipFile
.
exists
());
if
(
uiFile
.
exists
())
{
//解压tar.gz
final
TarGZipUnArchiver
ua
=
new
TarGZipUnArchiver
();
ConsoleLoggerManager
manager
=
new
ConsoleLoggerManager
();
manager
.
initialize
();
ua
.
enableLogging
(
manager
.
getLoggerForComponent
(
"bla"
));
ua
.
setSourceFile
(
uiFile
);
destDir
.
mkdirs
();
ua
.
setDestDirectory
(
destDir
);
ua
.
extract
();
}
else
if
(
uiZipFile
.
exists
())
{
ZipUtil
.
unzip
(
uiZipFile
,
destDir
);
}
else
{
throw
new
AppException
(
"请上传项目工程资源文件!"
);
}
}
else
if
(
ProjectTypeEnum
.
资源
.
getValue
()
==
setupProjectEntity
.
getProjectType
())
{
//TODO: 资源逻辑
}
...
...
@@ -347,7 +368,6 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
File
file
=
FileUtil
.
file
(
"F:/test.tar.gz"
);
InputStream
inputStream
=
FileUtil
.
getInputStream
(
file
);
///Hutoo.unGzip(inputStream, setupProjectEntity.getProjectPath());
...
...
@@ -357,7 +377,6 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
ZipUtils
.
unGzip
(
inputStream
,
"F:/"
);
// CompressorInputStream gz = CompressUtil.getIn("gz", FileUtil.getInputStream(file));
/* Extractor extractor = CompressUtil.createExtractor(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment