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
863c8b36
Commit
863c8b36
authored
Nov 11, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加区域树
parent
d21571e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
setup-project-manager/src/main/java/com/mortals/xhx/daemon/task/CheckProjectStatusTaskImpl.java
...m/mortals/xhx/daemon/task/CheckProjectStatusTaskImpl.java
+16
-2
No files found.
setup-project-manager/src/main/java/com/mortals/xhx/daemon/task/CheckProjectStatusTaskImpl.java
View file @
863c8b36
...
@@ -7,7 +7,9 @@ import com.mortals.framework.exception.AppException;
...
@@ -7,7 +7,9 @@ import com.mortals.framework.exception.AppException;
import
com.mortals.framework.service.ITask
;
import
com.mortals.framework.service.ITask
;
import
com.mortals.framework.service.ITaskExcuteService
;
import
com.mortals.framework.service.ITaskExcuteService
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.base.system.user.service.UserService
;
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.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.service.SetupProjectService
;
import
com.mortals.xhx.module.setup.service.SetupProjectService
;
...
@@ -17,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -17,6 +19,7 @@ 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
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -43,10 +46,21 @@ public class CheckProjectStatusTaskImpl implements ITaskExcuteService {
...
@@ -43,10 +46,21 @@ public class CheckProjectStatusTaskImpl implements ITaskExcuteService {
//todo http://192.168.0.250:8848/nacos/v1/ns/catalog/instances?message=true&serviceName=bill-manager&clusterName=DEFAULT&groupName=DEFAULT_GROUP&pageSize=10&pageNo=1&namespaceId=smart-gov
//todo http://192.168.0.250:8848/nacos/v1/ns/catalog/instances?message=true&serviceName=bill-manager&clusterName=DEFAULT&groupName=DEFAULT_GROUP&pageSize=10&pageNo=1&namespaceId=smart-gov
String
serverUrl
=
nacosUrl
+
"/nacos/v1/ns/catalog/instances?message=true&serviceName="
+
setupProjectEntity
.
getProjectCode
()
+
"&clusterName=DEFAULT&groupName=DEFAULT_GROUP&pageSize=10&pageNo=1&namespaceId=smart-gov"
;
String
serverUrl
=
nacosUrl
+
"/nacos/v1/ns/catalog/instances?message=true&serviceName="
+
setupProjectEntity
.
getProjectCode
()
+
"&clusterName=DEFAULT&groupName=DEFAULT_GROUP&pageSize=10&pageNo=1&namespaceId=smart-gov"
;
String
resp
=
HttpUtil
.
get
(
serverUrl
);
String
resp
=
HttpUtil
.
get
(
serverUrl
);
NacosResponse
nacosResponse
=
JSON
.
parseObject
(
resp
,
new
TypeReference
<
NacosResponse
>()
{
NacosResponse
nacosResponse
=
JSON
.
parseObject
(
resp
,
new
TypeReference
<
NacosResponse
>()
{
});
});
int
count
=
nacosResponse
.
getCount
();
if
(
count
>
0
){
ListItem
item
=
nacosResponse
.
getList
().
get
(
0
);
String
serviceName
=
item
.
getServiceName
();
boolean
healthy
=
item
.
isHealthy
();
if
(
healthy
){
setupProjectEntity
.
setProjectStatus
(
ProjectStatusEnum
.
运行
.
getValue
());
}
else
{
setupProjectEntity
.
setProjectStatus
(
ProjectStatusEnum
.
停止
.
getValue
());
}
setupProjectEntity
.
setUpdateTime
(
new
Date
());
setupProjectService
.
update
(
setupProjectEntity
);
}
log
.
info
(
"服务实例详细查询url:{},返回:{},naocsResponse:{}"
,
serverUrl
,
resp
,
JSON
.
toJSONString
(
nacosResponse
));
log
.
info
(
"服务实例详细查询url:{},返回:{},naocsResponse:{}"
,
serverUrl
,
resp
,
JSON
.
toJSONString
(
nacosResponse
));
...
...
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