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
c1babc5d
Commit
c1babc5d
authored
Nov 11, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加产品资源枚举类
parent
405a430e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
39 deletions
+29
-39
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/service/impl/SetupProjectServiceImpl.java
...hx/module/setup/service/impl/SetupProjectServiceImpl.java
+25
-35
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/web/SetupProjectController.java
.../mortals/xhx/module/setup/web/SetupProjectController.java
+4
-4
No files found.
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/service/impl/SetupProjectServiceImpl.java
View file @
c1babc5d
package
com.mortals.xhx.module.setup.service.impl
;
package
com.mortals.xhx.module.setup.service.impl
;
import
cn.hutool.Hutool
;
import
cn.hutool.core.compress.Gzip
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.util.CharsetUtil
;
import
cn.hutool.core.util.RuntimeUtil
;
import
cn.hutool.core.util.ZipUtil
;
import
cn.hutool.core.util.ZipUtil
;
import
cn.hutool.db.DbUtil
;
import
cn.hutool.db.DbUtil
;
import
cn.hutool.extra.compress.CompressUtil
;
import
cn.hutool.extra.compress.extractor.Extractor
;
import
cn.hutool.system.OsInfo
;
import
cn.hutool.system.SystemUtil
;
import
cn.hutool.system.SystemUtil
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.util.ThreadPool
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.xhx.base.system.upload.service.UploadService
;
import
com.mortals.xhx.base.system.upload.service.UploadService
;
import
com.mortals.xhx.common.code.ProductDisEnum
;
import
com.mortals.xhx.common.code.ProductDisEnum
;
import
com.mortals.xhx.common.code.ProjectStatusEnum
;
import
com.mortals.xhx.common.code.ProjectStatusEnum
;
import
com.mortals.xhx.common.code.ProjectTypeEnum
;
import
com.mortals.xhx.common.code.ProjectTypeEnum
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.utils.ZipUtils
;
import
com.mortals.xhx.common.utils.ZipUtils
;
import
com.mortals.xhx.module.setup.dao.SetupProjectDao
;
import
com.mortals.xhx.module.setup.mode.DbSetupEntity
;
import
com.mortals.xhx.module.setup.mode.DbSetupEntity
;
import
com.mortals.xhx.module.setup.mode.SiteEntity
;
import
com.mortals.xhx.module.setup.mode.SiteEntity
;
import
com.mortals.xhx.module.setup.model.SetupProjectEntity
;
import
com.mortals.xhx.module.setup.model.SetupProjectQuery
;
import
com.mortals.xhx.module.setup.model.SetupProjectQuery
;
import
com.mortals.xhx.module.setup.service.SetupDbService
;
import
com.mortals.xhx.module.setup.service.SetupDbService
;
import
org.apache.commons.compress.compressors.CompressorInputStream
;
import
com.mortals.xhx.module.setup.service.SetupProjectService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.codehaus.plexus.archiver.tar.TarGZipUnArchiver
;
import
org.codehaus.plexus.archiver.tar.TarGZipUnArchiver
;
import
org.codehaus.plexus.logging.console.ConsoleLoggerManager
;
import
org.codehaus.plexus.logging.console.ConsoleLoggerManager
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.*
;
import
javax.sql.DataSource
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charset
;
import
java.sql.Connection
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.PreparedStatement
;
...
@@ -36,22 +42,6 @@ import java.sql.ResultSet;
...
@@ -36,22 +42,6 @@ import java.sql.ResultSet;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.function.Function
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.xhx.module.setup.dao.SetupProjectDao
;
import
com.mortals.xhx.module.setup.model.SetupProjectEntity
;
import
com.mortals.xhx.module.setup.service.SetupProjectService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.sql.DataSource
;
/**
/**
* SetupProjectService
* SetupProjectService
...
@@ -222,7 +212,7 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
...
@@ -222,7 +212,7 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
boolean
exist
=
FileUtil
.
exist
(
projectPath
);
boolean
exist
=
FileUtil
.
exist
(
projectPath
);
if
(!
exist
)
throw
new
AppException
(
"请先上传项目工程文件!"
);
if
(!
exist
)
throw
new
AppException
(
"请先上传项目工程文件!"
);
//2.部署并启动项目 包括网关,基础服务,门户服务,设备管理系统,前端,后端资源等等
//2.部署并启动项目 包括网关,基础服务
后端
,门户服务,设备管理系统,前端,后端资源等等
buildGateWay
(
context
);
buildGateWay
(
context
);
buildBaseManager
(
context
);
buildBaseManager
(
context
);
buildBaseManagerUi
(
context
);
buildBaseManagerUi
(
context
);
...
@@ -243,20 +233,20 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
...
@@ -243,20 +233,20 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
}
}
private
void
buildBaseManager
(
Context
context
)
{
private
void
buildBaseManager
(
Context
context
)
{
log
.
info
(
"开始部署基础服务"
);
log
.
info
(
"开始部署基础服务
后端
"
);
SetupProjectEntity
setupProject
=
this
.
selectOne
(
new
SetupProjectQuery
().
projectCode
(
ProductDisEnum
.
基础服务
.
getValue
()));
SetupProjectEntity
setupProject
=
this
.
selectOne
(
new
SetupProjectQuery
().
projectCode
(
ProductDisEnum
.
基础服务
后端
.
getValue
()));
this
.
distribute
(
setupProject
,
context
);
this
.
distribute
(
setupProject
,
context
);
}
}
private
void
buildBaseManagerUi
(
Context
context
)
{
private
void
buildBaseManagerUi
(
Context
context
)
{
log
.
info
(
"开始部署基础服务前端"
);
log
.
info
(
"开始部署基础服务
后端
前端"
);
SetupProjectEntity
setupProject
=
this
.
selectOne
(
new
SetupProjectQuery
().
projectCode
(
ProductDisEnum
.
基础服务前端
.
getValue
()));
SetupProjectEntity
setupProject
=
this
.
selectOne
(
new
SetupProjectQuery
().
projectCode
(
ProductDisEnum
.
基础服务前端
.
getValue
()));
this
.
distribute
(
setupProject
,
context
);
this
.
distribute
(
setupProject
,
context
);
}
}
private
void
buildPortalManager
(
Context
context
)
{
private
void
buildPortalManager
(
Context
context
)
{
log
.
info
(
"开始部署门户服务"
);
log
.
info
(
"开始部署门户服务"
);
SetupProjectEntity
setupProject
=
this
.
selectOne
(
new
SetupProjectQuery
().
projectCode
(
ProductDisEnum
.
门户服务
.
getValue
()));
SetupProjectEntity
setupProject
=
this
.
selectOne
(
new
SetupProjectQuery
().
projectCode
(
ProductDisEnum
.
门户服务
后端
.
getValue
()));
this
.
distribute
(
setupProject
,
context
);
this
.
distribute
(
setupProject
,
context
);
}
}
...
@@ -268,7 +258,7 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
...
@@ -268,7 +258,7 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
private
void
buildDeviceManager
(
Context
context
)
{
private
void
buildDeviceManager
(
Context
context
)
{
log
.
info
(
"开始部署设备管理服务"
);
log
.
info
(
"开始部署设备管理服务"
);
SetupProjectEntity
setupProject
=
this
.
selectOne
(
new
SetupProjectQuery
().
projectCode
(
ProductDisEnum
.
设备管理服务
.
getValue
()));
SetupProjectEntity
setupProject
=
this
.
selectOne
(
new
SetupProjectQuery
().
projectCode
(
ProductDisEnum
.
设备管理服务
后端
.
getValue
()));
this
.
distribute
(
setupProject
,
context
);
this
.
distribute
(
setupProject
,
context
);
}
}
...
@@ -280,7 +270,7 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
...
@@ -280,7 +270,7 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
private
void
buildLogManager
(
Context
context
)
{
private
void
buildLogManager
(
Context
context
)
{
log
.
info
(
"开始部署设备管理服务"
);
log
.
info
(
"开始部署设备管理服务"
);
SetupProjectEntity
setupProject
=
this
.
selectOne
(
new
SetupProjectQuery
().
projectCode
(
ProductDisEnum
.
设备管理服务
.
getValue
()));
SetupProjectEntity
setupProject
=
this
.
selectOne
(
new
SetupProjectQuery
().
projectCode
(
ProductDisEnum
.
设备管理服务
后端
.
getValue
()));
this
.
distribute
(
setupProject
,
context
);
this
.
distribute
(
setupProject
,
context
);
}
}
...
@@ -320,7 +310,7 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
...
@@ -320,7 +310,7 @@ public class SetupProjectServiceImpl extends AbstractCRUDServiceImpl<SetupProjec
// @Override
// @Override
public
Rest
<
String
>
updateBaseSystem
(
SiteEntity
siteEntity
)
{
public
Rest
<
String
>
updateBaseSystem
(
SiteEntity
siteEntity
)
{
//获取数据库连接 如果基础服务不存在 则提示
//获取数据库连接 如果基础服务
后端
不存在 则提示
DbSetupEntity
dbSetupEntity
=
new
DbSetupEntity
();
DbSetupEntity
dbSetupEntity
=
new
DbSetupEntity
();
dbSetupEntity
.
setDbName
(
siteEntity
.
getDbName
());
dbSetupEntity
.
setDbName
(
siteEntity
.
getDbName
());
...
...
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/web/SetupProjectController.java
View file @
c1babc5d
...
@@ -39,7 +39,7 @@ import java.util.HashMap;
...
@@ -39,7 +39,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
static
com
.
mortals
.
xhx
.
common
.
code
.
ProductDisEnum
.
基础服务
;
import
static
com
.
mortals
.
xhx
.
common
.
code
.
ProductDisEnum
.
*
;
/**
/**
* 项目工程信息
* 项目工程信息
...
@@ -279,7 +279,7 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
...
@@ -279,7 +279,7 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
//todo 在/home/publish/app/ 目录下 更加站点编码生成基础服务应用 创建自助服务应用
//todo 在/home/publish/app/ 目录下 更加站点编码生成基础服务应用 创建自助服务应用
String
projectPath
=
this
.
publishPath
+
"/app/"
+
siteAddRest
.
getData
().
getSiteCode
();
String
projectPath
=
this
.
publishPath
+
"/app/"
+
siteAddRest
.
getData
().
getSiteCode
();
//解压资源文件
//解压资源文件
String
sourcePath
=
this
.
publishPath
+
"/temp/project/"
+
基础服务
.
getValue
()
+
"/app.tar.gz"
;
String
sourcePath
=
this
.
publishPath
+
"/temp/project/"
+
基础服务
后端
.
getValue
()
+
"/app.tar.gz"
;
File
file
=
new
File
(
sourcePath
);
File
file
=
new
File
(
sourcePath
);
log
.
info
(
"文件存在:{} ,文件地址:{}"
,
file
.
exists
(),
sourcePath
);
log
.
info
(
"文件存在:{} ,文件地址:{}"
,
file
.
exists
(),
sourcePath
);
File
destDir
=
new
File
(
projectPath
);
File
destDir
=
new
File
(
projectPath
);
...
@@ -297,7 +297,7 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
...
@@ -297,7 +297,7 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
projectPath
=
this
.
publishPath
+
"/app/"
;
projectPath
=
this
.
publishPath
+
"/app/"
;
//解压资源文件
//解压资源文件
sourcePath
=
this
.
publishPath
+
"/temp/project/"
+
基础服务
.
getValue
()
+
"/other.tar.gz"
;
sourcePath
=
this
.
publishPath
+
"/temp/project/"
+
基础服务
后端
.
getValue
()
+
"/other.tar.gz"
;
file
=
new
File
(
sourcePath
);
file
=
new
File
(
sourcePath
);
destDir
=
new
File
(
projectPath
);
destDir
=
new
File
(
projectPath
);
manager
.
initialize
();
manager
.
initialize
();
...
@@ -485,7 +485,7 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
...
@@ -485,7 +485,7 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
try
{
try
{
//todo 检测是否初始安装,是否已经安装了base-manager,如果没有则进入引导界面进行安装
//todo 检测是否初始安装,是否已经安装了base-manager,如果没有则进入引导界面进行安装
SetupProjectQuery
setupProjectQuery
=
new
SetupProjectQuery
();
SetupProjectQuery
setupProjectQuery
=
new
SetupProjectQuery
();
setupProjectQuery
.
setProjectCode
(
基础服务
.
getValue
());
setupProjectQuery
.
setProjectCode
(
基础服务
后端
.
getValue
());
SetupProjectEntity
setupProjectEntity
=
this
.
service
.
selectOne
(
setupProjectQuery
);
SetupProjectEntity
setupProjectEntity
=
this
.
service
.
selectOne
(
setupProjectQuery
);
if
(
ObjectUtils
.
isEmpty
(
setupProjectEntity
)){
if
(
ObjectUtils
.
isEmpty
(
setupProjectEntity
)){
throw
new
AppException
(
"基础服务不存在"
);
throw
new
AppException
(
"基础服务不存在"
);
...
...
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