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
2c265c37
Commit
2c265c37
authored
Nov 11, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加产品资源枚举类
parent
0f086a91
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
42 deletions
+54
-42
setup-project-manager/src/main/java/com/mortals/xhx/common/code/ProductDisEnum.java
...main/java/com/mortals/xhx/common/code/ProductDisEnum.java
+2
-1
setup-project-manager/src/main/java/com/mortals/xhx/common/code/ProjectTypeEnum.java
...ain/java/com/mortals/xhx/common/code/ProjectTypeEnum.java
+12
-10
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/service/impl/SetupProjectServiceImpl.java
...hx/module/setup/service/impl/SetupProjectServiceImpl.java
+40
-29
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/web/SetupProjectController.java
.../mortals/xhx/module/setup/web/SetupProjectController.java
+0
-2
No files found.
setup-project-manager/src/main/java/com/mortals/xhx/common/code/ProductDisEnum.java
View file @
2c265c37
...
...
@@ -32,7 +32,7 @@ public enum ProductDisEnum {
DATAV管理后台后端
(
"datav-manager"
,
"datav-manager"
),
DATAV管理后台前端
(
"datav-portal"
,
"datav-portal"
),
报表系统管理后端
(
"bill-manager"
,
"bill-manager"
),
报表系统管理前端
(
"bill-manager-ui
"
,
"bill-manager-ui
"
),
报表系统管理前端
(
"bill-manager-ui
"
,
"bill-manager-ui
"
),
存取件前端
(
"access-manager-ui"
,
"access-manager-ui"
),
窗口服务行为监察前端
(
"ai-xnjc-ui"
,
"ai-xnjc-ui"
),
...
...
@@ -49,6 +49,7 @@ public enum ProductDisEnum {
可视化播控前端
(
"bokong-manager"
,
"bokong-manager"
),
微官网前端
(
"weChat-ui"
,
"weChat-ui"
),
窗口评价前端
(
"window-evaluate"
,
"window-evaluate"
),
排号系统PHP后端
(
"number-manager-php"
,
"number-manager-php"
),
;
private
String
value
;
private
String
desc
;
...
...
setup-project-manager/src/main/java/com/mortals/xhx/common/code/ProjectTypeEnum.java
View file @
2c265c37
...
...
@@ -4,14 +4,16 @@ import java.util.LinkedHashMap;
import
java.util.Map
;
/**
* 项目类型(1.后端,2.前端,3.资源)枚举类
*
* @author zxfei
*/
* 项目类型(1.后端,2.前端,3.资源)枚举类
*
* @author zxfei
*/
public
enum
ProjectTypeEnum
{
后端
(
1
,
"后端"
),
前端
(
2
,
"前端"
),
资源
(
3
,
"资源"
);
资源
(
3
,
"资源"
),
PHP后端
(
4
,
"PHP后端"
),
;
private
Integer
value
;
private
String
desc
;
...
...
@@ -38,11 +40,11 @@ public enum ProjectTypeEnum {
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public
static
Map
<
String
,
String
>
getEnumMap
(
Integer
...
eItem
)
{
Map
<
String
,
String
>
resultMap
=
new
LinkedHashMap
<>();
for
(
ProjectTypeEnum
item
:
ProjectTypeEnum
.
values
())
{
...
...
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/service/impl/SetupProjectServiceImpl.java
View file @
2c265c37
...
...
@@ -66,8 +66,6 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
@Override
public
Rest
<
String
>
distribute
(
SetupProjectEntity
setupProjectEntity
,
Context
context
)
{
//TODO: 业务逻辑 判断是后端还是前端
if
(
ProjectTypeEnum
.
后端
.
getValue
()
==
setupProjectEntity
.
getProjectType
())
{
//TODO: 后端逻辑
//TODO: 判断打包文件是否存在,如果不存在 则使用默认的资源文件夹的包文件
...
...
@@ -83,7 +81,6 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
}
else
if
(
FileUtil
.
getSuffix
(
setupProjectEntity
.
getSourceProject
()).
equals
(
"tar.gz"
))
{
}
}
else
{
//读取本工程的资源文件 检测压缩包类型
//String sourcePath = "/project/" + ProductDisEnum.getByValue(setupProjectEntity.getProjectCode()).getDesc() + "/" + ProductDisEnum.getByValue(setupProjectEntity.getProjectCode()).getValue() + ".tar.gz";
...
...
@@ -106,31 +103,9 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
destDir
.
mkdirs
();
ua
.
setDestDirectory
(
destDir
);
ua
.
extract
();
/* String shell = "tar -zvxf " + sourcePath + " -C " + setupProjectEntity.getProjectPath();
log.info("解压命令:{}", shell);
String str = RuntimeUtil.execForStr(shell);
log.info("解压命令结果:{}", str);*/
// InputStream inputStream = FileUtil.getInputStream(file);
///Hutoo.unGzip(inputStream, setupProjectEntity.getProjectPath());
//Hutool
/* try {
ZipUtils.extractTarGZ(file, setupProjectEntity.getProjectPath());
} catch (IOException e) {
log.error("解压失败!{}", e.getMessage());
}*/
// ZipUtils.unGzip(inputStream, setupProjectEntity.getProjectPath());
String
publicPath
=
setupProjectEntity
.
getProjectPath
()
+
ProductDisEnum
.
getByValue
(
setupProjectEntity
.
getProjectCode
()).
getValue
();
File
sqlPath
=
new
File
(
publicPath
+
"/db/base.sql"
);
if
(
sqlPath
.
exists
())
{
//导入数据库业务
DbSetupEntity
dbSetupEntity
=
new
DbSetupEntity
();
dbSetupEntity
.
setDbPort
(
setupProjectEntity
.
getDbPort
());
...
...
@@ -157,10 +132,8 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
}
else
if
(
SystemUtil
.
getOsInfo
().
isWindows
())
{
//todo
}
}
}
else
if
(
ProjectTypeEnum
.
前端
.
getValue
()
==
setupProjectEntity
.
getProjectType
())
{
//TODO: 前端逻辑 静态文件,只需要解压到指定目录即可
String
path
=
this
.
publishPath
+
"/temp/project/"
+
ProductDisEnum
.
getByValue
(
setupProjectEntity
.
getProjectCode
()).
getDesc
()
+
"/"
+
ProductDisEnum
.
getByValue
(
setupProjectEntity
.
getProjectCode
()).
getValue
();
...
...
@@ -196,11 +169,49 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
}
else
if
(
ProjectTypeEnum
.
资源
.
getValue
()
==
setupProjectEntity
.
getProjectType
())
{
//TODO: 资源逻辑
}
}
else
if
(
ProjectTypeEnum
.
PHP后端
.
getValue
()
==
setupProjectEntity
.
getProjectType
())
{
//TODO: 解压php逻辑
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
(
"文件路径:{},存在:{}"
,
sourcePath
,
file
.
exists
());
File
destDir
=
new
File
(
setupProjectEntity
.
getProjectPath
());
if
(!
file
.
exists
())
{
throw
new
AppException
(
"请上传项目工程文件!"
);
}
final
TarGZipUnArchiver
ua
=
new
TarGZipUnArchiver
();
ConsoleLoggerManager
manager
=
new
ConsoleLoggerManager
();
manager
.
initialize
();
ua
.
enableLogging
(
manager
.
getLoggerForComponent
(
"bla"
));
ua
.
setSourceFile
(
file
);
destDir
.
mkdirs
();
ua
.
setDestDirectory
(
destDir
);
ua
.
extract
();
String
publicPath
=
setupProjectEntity
.
getProjectPath
()
+
ProductDisEnum
.
getByValue
(
setupProjectEntity
.
getProjectCode
()).
getValue
();
File
sqlPath
=
new
File
(
publicPath
+
"/db/base.sql"
);
if
(
sqlPath
.
exists
())
{
//导入数据库业务
DbSetupEntity
dbSetupEntity
=
new
DbSetupEntity
();
dbSetupEntity
.
setDbPort
(
setupProjectEntity
.
getDbPort
());
dbSetupEntity
.
setDbHost
(
setupProjectEntity
.
getDbHost
());
dbSetupEntity
.
setDbName
(
setupProjectEntity
.
getDbName
());
dbSetupEntity
.
setUserName
(
setupProjectEntity
.
getDbUser
());
dbSetupEntity
.
setPassword
(
setupProjectEntity
.
getDbPassword
());
dbSetupEntity
.
setDbFilePath
(
publicPath
+
"/db/base.sql"
);
log
.
info
(
"数据库db路径!{}"
,
dbSetupEntity
.
getDbFilePath
());
Rest
<
String
>
dbRest
=
setupDbService
.
initDb
(
dbSetupEntity
);
if
(
YesNoEnum
.
YES
.
getValue
()
!=
dbRest
.
getCode
())
{
log
.
info
(
"数据库初始化成功!"
);
}
}
setupProjectEntity
.
setProjectStatus
(
ProjectStatusEnum
.
已部署
.
getValue
());
this
.
update
(
setupProjectEntity
);
//判断打包文件是否存在,
}
return
Rest
.
ok
();
}
...
...
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/web/SetupProjectController.java
View file @
2c265c37
...
...
@@ -77,8 +77,6 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
protected
void
doListBefore
(
SetupProjectEntity
query
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
query
.
setSize
(
50
);
query
.
setOrderColList
(
Arrays
.
asList
(
new
OrderCol
(
"orderNum"
)));
super
.
doListBefore
(
query
,
model
,
context
);
}
...
...
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