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
7f8cd1c6
Commit
7f8cd1c6
authored
Feb 14, 2025
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加修改终端访问ip
parent
f3a67990
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
750 additions
and
12 deletions
+750
-12
setup-project-manager/db/add.sql
setup-project-manager/db/add.sql
+11
-1
setup-project-manager/src/main/java/com/mortals/xhx/daemon/task/CheckProjectStatusTaskImpl.java
...m/mortals/xhx/daemon/task/CheckProjectStatusTaskImpl.java
+60
-0
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/model/SetupProjectEntity.java
...om/mortals/xhx/module/setup/model/SetupProjectEntity.java
+22
-6
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/model/SetupProjectQuery.java
...com/mortals/xhx/module/setup/model/SetupProjectQuery.java
+413
-1
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/web/SetupProjectController.java
.../mortals/xhx/module/setup/web/SetupProjectController.java
+24
-0
setup-project-manager/src/main/resources/sqlmap/module/setup/SetupProjectMapper.xml
...main/resources/sqlmap/module/setup/SetupProjectMapper.xml
+220
-4
No files found.
setup-project-manager/db/add.sql
View file @
7f8cd1c6
update
mortals_xhx_setup_project
SET
siteId
=
null
,
siteCode
=
''
,
siteName
=
''
,
areaName
=
''
,
projectStatus
=
1
update
mortals_xhx_setup_project
SET
siteId
=
null
,
siteCode
=
''
,
siteName
=
''
,
areaName
=
''
,
projectStatus
=
1
;
\ No newline at end of file
ALTER
TABLE
mortals_xhx_setup_project
ADD
COLUMN
`clientToServerIp`
varchar
(
255
)
COMMENT
'终端连接客户端ip'
AFTER
areaName
;
ALTER
TABLE
mortals_xhx_setup_project
ADD
COLUMN
`clientToServerIpStatus`
tinyint
(
2
)
DEFAULT
'0'
COMMENT
'终端连接客户端ip更新状态'
AFTER
areaName
;
ALTER
TABLE
mortals_xhx_setup_project
ADD
COLUMN
`innerServerIp`
varchar
(
255
)
COMMENT
'服务端内部ip'
AFTER
areaName
;
ALTER
TABLE
mortals_xhx_setup_project
ADD
COLUMN
`innerServerIpStatus`
tinyint
(
2
)
DEFAULT
'0'
COMMENT
'服务端内部ip更新状态'
AFTER
areaName
;
setup-project-manager/src/main/java/com/mortals/xhx/daemon/task/CheckProjectStatusTaskImpl.java
View file @
7f8cd1c6
...
@@ -13,18 +13,22 @@ import com.mortals.xhx.base.system.user.service.UserService;
...
@@ -13,18 +13,22 @@ import com.mortals.xhx.base.system.user.service.UserService;
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.pdu.ListItem
;
import
com.mortals.xhx.common.pdu.ListItem
;
import
com.mortals.xhx.common.pdu.NacosResponse
;
import
com.mortals.xhx.common.pdu.NacosResponse
;
import
com.mortals.xhx.module.setup.model.SetupProjectEntity
;
import
com.mortals.xhx.module.setup.model.SetupProjectEntity
;
import
com.mortals.xhx.module.setup.model.SetupProjectQuery
;
import
com.mortals.xhx.module.setup.service.SetupProjectService
;
import
com.mortals.xhx.module.setup.service.SetupProjectService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.checkerframework.checker.units.qual.A
;
import
org.checkerframework.checker.units.qual.A
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
java.io.File
;
import
java.io.File
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -42,6 +46,62 @@ public class CheckProjectStatusTaskImpl implements ITaskExcuteService {
...
@@ -42,6 +46,62 @@ public class CheckProjectStatusTaskImpl implements ITaskExcuteService {
log
.
info
(
"检测项目运行状态任务"
);
log
.
info
(
"检测项目运行状态任务"
);
setupProjectService
.
updateProjectsStatus
();
setupProjectService
.
updateProjectsStatus
();
log
.
info
(
"检测项目运行状态任务完毕!"
);
log
.
info
(
"检测项目运行状态任务完毕!"
);
//更新项目服务ip
List
<
SetupProjectEntity
>
setupProjectEntities
=
setupProjectService
.
find
(
new
SetupProjectQuery
().
clientToServerIpStatus
(
YesNoEnum
.
NO
.
getValue
()));
for
(
SetupProjectEntity
setupProjectEntity
:
setupProjectEntities
)
{
if
(!
ObjectUtils
.
isEmpty
(
setupProjectEntity
.
getClientToServerIp
())
&&
setupProjectEntity
.
getProjectCode
().
equals
(
ProductDisEnum
.
基础服务后端
.
getValue
()))
{
try
{
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"serverIp"
,
setupProjectEntity
.
getClientToServerIp
());
//更新基础服务
String
resp
=
HttpUtil
.
get
(
"http://127.0.0.1:11078/base/param/updateServerIp"
,
params
);
Rest
rest
=
JSON
.
parseObject
(
resp
,
Rest
.
class
);
if
(
YesNoEnum
.
YES
.
getValue
()
==
rest
.
getCode
())
{
setupProjectEntity
.
setClientToServerIpStatus
(
YesNoEnum
.
YES
.
getValue
());
setupProjectService
.
update
(
setupProjectEntity
);
}
}
catch
(
Exception
e
)
{
log
.
info
(
"更新基础项目服务ip失败"
);
}
}
if
(!
ObjectUtils
.
isEmpty
(
setupProjectEntity
.
getClientToServerIp
())
&&
setupProjectEntity
.
getProjectCode
().
equals
(
ProductDisEnum
.
设备管理服务后端
.
getValue
()))
{
try
{
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"serverIp"
,
setupProjectEntity
.
getClientToServerIp
());
//更新基础服务
String
resp
=
HttpUtil
.
get
(
"http://127.0.0.1:11078/fm/param/updateServerIp"
,
params
);
Rest
rest
=
JSON
.
parseObject
(
resp
,
Rest
.
class
);
if
(
YesNoEnum
.
YES
.
getValue
()
==
rest
.
getCode
())
{
setupProjectEntity
.
setClientToServerIpStatus
(
YesNoEnum
.
YES
.
getValue
());
setupProjectService
.
update
(
setupProjectEntity
);
}
}
catch
(
Exception
e
)
{
log
.
info
(
"更新设备管理项目服务ip失败"
);
}
}
if
(!
ObjectUtils
.
isEmpty
(
setupProjectEntity
.
getClientToServerIp
())
&&
setupProjectEntity
.
getProjectCode
().
equals
(
ProductDisEnum
.
排号系统PHP后端
.
getValue
()))
{
try
{
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"serverIp"
,
setupProjectEntity
.
getClientToServerIp
());
//更新基础服务
/* String resp = HttpUtil.get("http://127.0.0.1:11078/fm/param/updateServerIp", params);
Rest rest = JSON.parseObject(resp, Rest.class);
if (YesNoEnum.YES.getValue() == rest.getCode()) {
setupProjectEntity.setClientToServerIpStatus(YesNoEnum.YES.getValue());
setupProjectService.update(setupProjectEntity);
}*/
}
catch
(
Exception
e
)
{
log
.
info
(
"更新排号项目服务ip失败"
);
}
}
}
}
}
...
...
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/model/SetupProjectEntity.java
View file @
7f8cd1c6
...
@@ -6,16 +6,14 @@ import cn.hutool.core.date.DateUtil;
...
@@ -6,16 +6,14 @@ import cn.hutool.core.date.DateUtil;
import
java.util.Date
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.mortals.framework.annotation.Excel
;
import
com.mortals.framework.annotation.Excel
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.framework.model.BaseEntityLong
;
import
com.mortals.framework.util.ThreadPool
;
import
com.mortals.xhx.module.setup.model.vo.SetupProjectVo
;
import
com.mortals.xhx.module.setup.model.vo.SetupProjectVo
;
import
lombok.Data
;
import
lombok.Data
;
/**
/**
* 项目工程信息实体对象
* 项目工程信息实体对象
*
*
* @author zxfei
* @author zxfei
* @date 202
4-10-2
4
* @date 202
5-02-1
4
*/
*/
@Data
@Data
public
class
SetupProjectEntity
extends
SetupProjectVo
{
public
class
SetupProjectEntity
extends
SetupProjectVo
{
...
@@ -101,6 +99,22 @@ public class SetupProjectEntity extends SetupProjectVo {
...
@@ -101,6 +99,22 @@ public class SetupProjectEntity extends SetupProjectVo {
* 区域名称
* 区域名称
*/
*/
private
String
areaName
;
private
String
areaName
;
/**
* 终端连接客户端ip
*/
private
String
clientToServerIp
;
/**
* 终端连接客户端ip更新状态
*/
private
Integer
clientToServerIpStatus
;
/**
* 服务端内部ip
*/
private
String
innerServerIp
;
/**
* 服务端内部ip更新状态
*/
private
Integer
innerServerIpStatus
;
@Override
@Override
public
int
hashCode
()
{
public
int
hashCode
()
{
return
this
.
getId
().
hashCode
();
return
this
.
getId
().
hashCode
();
...
@@ -120,7 +134,7 @@ public class SetupProjectEntity extends SetupProjectVo {
...
@@ -120,7 +134,7 @@ public class SetupProjectEntity extends SetupProjectVo {
public
void
initAttrValue
(){
public
void
initAttrValue
(){
this
.
name
=
""
;
this
.
name
=
""
;
this
.
projectCode
=
""
;
this
.
projectCode
=
""
;
this
.
projectPath
=
"
/home/publish/
"
;
this
.
projectPath
=
""
;
this
.
projectShell
=
""
;
this
.
projectShell
=
""
;
this
.
sourceProject
=
""
;
this
.
sourceProject
=
""
;
this
.
dbHost
=
"127.0.0.1"
;
this
.
dbHost
=
"127.0.0.1"
;
...
@@ -138,7 +152,9 @@ public class SetupProjectEntity extends SetupProjectVo {
...
@@ -138,7 +152,9 @@ public class SetupProjectEntity extends SetupProjectVo {
this
.
siteName
=
""
;
this
.
siteName
=
""
;
this
.
areaCode
=
""
;
this
.
areaCode
=
""
;
this
.
areaName
=
""
;
this
.
areaName
=
""
;
this
.
clientToServerIp
=
""
;
this
.
clientToServerIpStatus
=
0
;
this
.
innerServerIp
=
""
;
this
.
innerServerIpStatus
=
0
;
}
}
}
}
\ No newline at end of file
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/model/SetupProjectQuery.java
View file @
7f8cd1c6
This diff is collapsed.
Click to expand it.
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/web/SetupProjectController.java
View file @
7f8cd1c6
...
@@ -15,6 +15,7 @@ import com.mortals.framework.exception.AppException;
...
@@ -15,6 +15,7 @@ import com.mortals.framework.exception.AppException;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.OrderCol
;
import
com.mortals.framework.model.OrderCol
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
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
;
...
@@ -207,6 +208,29 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
...
@@ -207,6 +208,29 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
if
(!
ipv4
)
{
if
(!
ipv4
)
{
throw
new
AppException
(
"请输入正确的ip地址"
);
throw
new
AppException
(
"请输入正确的ip地址"
);
}
}
SetupProjectEntity
setupProjectBase
=
this
.
service
.
selectOne
(
new
SetupProjectQuery
().
projectCode
(
基础服务后端
.
getValue
()));
if
(!
ObjectUtils
.
isEmpty
(
setupProjectBase
))
{
setupProjectBase
.
setClientToServerIp
(
clientToServerIp
);
setupProjectBase
.
setClientToServerIpStatus
(
YesNoEnum
.
NO
.
getValue
());
this
.
service
.
update
(
setupProjectBase
);
}
SetupProjectEntity
setupProjectDevice
=
this
.
service
.
selectOne
(
new
SetupProjectQuery
().
projectCode
(
设备管理服务后端
.
getValue
()));
if
(!
ObjectUtils
.
isEmpty
(
setupProjectDevice
))
{
setupProjectDevice
.
setClientToServerIp
(
clientToServerIp
);
setupProjectDevice
.
setClientToServerIpStatus
(
YesNoEnum
.
NO
.
getValue
());
this
.
service
.
update
(
setupProjectDevice
);
}
SetupProjectEntity
setupProjectPHP
=
this
.
service
.
selectOne
(
new
SetupProjectQuery
().
projectCode
(
排号系统PHP后端
.
getValue
()));
if
(!
ObjectUtils
.
isEmpty
(
setupProjectPHP
))
{
setupProjectPHP
.
setClientToServerIp
(
clientToServerIp
);
setupProjectPHP
.
setClientToServerIpStatus
(
YesNoEnum
.
NO
.
getValue
());
this
.
service
.
update
(
setupProjectPHP
);
}
/*
/*
ipv4 = Validator.isIpv4(innerServerIp);
ipv4 = Validator.isIpv4(innerServerIp);
if (!ipv4) {
if (!ipv4) {
...
...
setup-project-manager/src/main/resources/sqlmap/module/setup/SetupProjectMapper.xml
View file @
7f8cd1c6
This diff is collapsed.
Click to expand it.
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