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
10fb5222
Commit
10fb5222
authored
Nov 04, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加区域树
parent
23fcd536
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
50 deletions
+66
-50
setup-project-manager/src/main/java/com/mortals/xhx/daemon/demo/http-client.env.json
...ain/java/com/mortals/xhx/daemon/demo/http-client.env.json
+0
-11
setup-project-manager/src/main/java/com/mortals/xhx/module/base/model/BaseAreaTreeSelect.java
...com/mortals/xhx/module/base/model/BaseAreaTreeSelect.java
+6
-4
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/web/SetupProjectController.java
.../mortals/xhx/module/setup/web/SetupProjectController.java
+37
-20
setup-project-manager/src/test/java/httpclient/http-client.env.json
...ect-manager/src/test/java/httpclient/http-client.env.json
+3
-6
setup-project-manager/src/test/java/httpclient/system.http
setup-project-manager/src/test/java/httpclient/system.http
+20
-9
No files found.
setup-project-manager/src/main/java/com/mortals/xhx/daemon/demo/http-client.env.json
deleted
100644 → 0
View file @
23fcd536
{
"local"
:
{
"baseUrl"
:
"http://192.168.0.217:17211"
},
"dev"
:
{
"baseUrl"
:
"http://192.168.0.251:1023"
},
"other"
:
{
"baseUrl"
:
"http://192.168.0.30:17211"
}
}
\ No newline at end of file
setup-project-manager/src/main/java/com/mortals/xhx/module/base/model/BaseAreaTreeSelect.java
View file @
10fb5222
...
...
@@ -29,7 +29,7 @@ public class BaseAreaTreeSelect implements Serializable {
/**
* 节点ID
*/
private
Lo
ng
id
;
private
Stri
ng
id
;
/**
* 节点名称
...
...
@@ -39,6 +39,7 @@ public class BaseAreaTreeSelect implements Serializable {
* 区域编码
*/
private
String
areaCode
;
/**
* 是否叶子节点
*/
...
...
@@ -68,11 +69,12 @@ public class BaseAreaTreeSelect implements Serializable {
public
BaseAreaTreeSelect
()
{};
public
BaseAreaTreeSelect
(
BaseAreaEntity
entity
)
{
this
.
id
=
entity
.
getId
();
this
.
id
=
entity
.
getI
i
d
();
this
.
label
=
entity
.
getName
();
this
.
children
=
new
ArrayList
();
if
(
"False"
.
equalsIgnoreCase
(
entity
.
getHaveSonArea
()))
{
this
.
isLeaf
=
true
;
this
.
children
=
new
ArrayList
();
}
else
{
this
.
isLeaf
=
false
;
}
...
...
@@ -91,7 +93,7 @@ public class BaseAreaTreeSelect implements Serializable {
public
BaseAreaTreeSelect
deserialze
(
DefaultJSONParser
parser
,
Type
type
,
Object
fieldName
)
{
BaseAreaTreeSelect
node
=
new
BaseAreaTreeSelect
();
JSONObject
jsonObject
=
parser
.
parseObject
();
node
.
setId
(
jsonObject
.
get
Lo
ng
(
"id"
));
node
.
setId
(
jsonObject
.
get
Stri
ng
(
"id"
));
node
.
setLabel
(
jsonObject
.
getString
(
"label"
));
JSONArray
jsonArray
=
jsonObject
.
getJSONArray
(
"children"
);
List
<
BaseAreaTreeSelect
>
children
=
new
ArrayList
<>();
...
...
setup-project-manager/src/main/java/com/mortals/xhx/module/setup/web/SetupProjectController.java
View file @
10fb5222
...
...
@@ -5,6 +5,7 @@ import cn.hutool.core.io.FileUtil;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.exception.AppException
;
...
...
@@ -23,6 +24,7 @@ import com.mortals.xhx.module.setup.model.SetupProjectQuery;
import
com.mortals.xhx.module.setup.service.SetupDbService
;
import
com.mortals.xhx.module.setup.service.SetupProjectService
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.util.ObjectUtils
;
...
...
@@ -42,6 +44,7 @@ import java.util.Map;
*/
@RestController
@RequestMapping
(
"setup/project"
)
@Slf4j
public
class
SetupProjectController
extends
BaseCRUDJsonBodyMappingController
<
SetupProjectService
,
SetupProjectEntity
,
Long
>
{
...
...
@@ -242,34 +245,48 @@ public class SetupProjectController extends BaseCRUDJsonBodyMappingController<Se
*
* @return
*/
@PostMapping
(
"/site/
add
"
)
@PostMapping
(
"/site/
updateSite
"
)
@UnAuth
public
String
updateSite
(
@RequestBody
SiteEntity
siteEntity
)
{
JSONObject
ret
=
new
JSONObject
();
int
code
=
VALUE_RESULT_SUCCESS
;
if
(
ObjectUtils
.
isEmpty
(
siteEntity
.
getSiteName
()))
throw
new
AppException
(
"请输入站点名称"
);
SetupProjectEntity
setupProject
=
this
.
service
.
get
(
siteEntity
.
getId
());
if
(
ObjectUtils
.
isEmpty
(
setupProject
))
throw
new
AppException
(
"请先创建项目"
);
if
(
ObjectUtils
.
isEmpty
(
setupProject
.
getAreaCode
()))
throw
new
AppException
(
"请先创建区域"
);
if
(
ObjectUtils
.
isEmpty
(
siteEntity
.
getSiteName
()))
throw
new
AppException
(
"请输入站点名称!"
);
if
(
ObjectUtils
.
isEmpty
(
siteEntity
.
getAreaCode
()))
throw
new
AppException
(
"请先选择区域!"
);
try
{
String
resp
=
HttpUtil
.
post
(
"http://127.0.0.1:11078/base/
site/api/add
"
,
JSON
.
toJSONString
(
siteEntity
));
Rest
rest
=
JSON
.
parseObject
(
resp
,
Rest
.
class
);
log
.
info
(
JSON
.
toJSONString
(
rest
)
);
//生成子区域/base/area/genSubAreaByAreaName
String
resp
=
HttpUtil
.
post
(
"http://127.0.0.1:11078/base/
area/genSubAreaByAreaName
"
,
JSON
.
toJSONString
(
siteEntity
));
Rest
<
String
>
rest
=
JSON
.
parseObject
(
resp
,
new
TypeReference
<
Rest
<
String
>>()
{
}
);
if
(
YesNoEnum
.
YES
.
getValue
()
==
rest
.
getCode
())
{
ret
.
put
(
KEY_RESULT_MSG
,
"站点添加成功!"
);
resp
=
HttpUtil
.
post
(
"http://127.0.0.1:11078/base/site/api/add"
,
JSON
.
toJSONString
(
siteEntity
));
log
.
info
(
"站点添加返回:{}"
,
resp
);
Rest
<
SiteEntity
>
siteAddRest
=
JSON
.
parseObject
(
resp
,
new
TypeReference
<
Rest
<
SiteEntity
>>()
{
});
if
(
YesNoEnum
.
YES
.
getValue
()
==
siteAddRest
.
getCode
())
{
//更新所有项目的站点编码与名称
SetupProjectEntity
setupProjectEntity
=
new
SetupProjectEntity
();
setupProjectEntity
.
setId
(
siteEntity
.
getId
());
setupProjectEntity
.
setSiteName
(
siteEntity
.
getSiteName
());
// setupProjectEntity.setSiteCode();
//setupProjectEntity.setSiteId();
setupProjectEntity
.
setSiteName
(
siteAddRest
.
getData
().
getSiteName
());
setupProjectEntity
.
setSiteCode
(
siteAddRest
.
getData
().
getSiteCode
());
setupProjectEntity
.
setSiteId
(
siteAddRest
.
getData
().
getId
());
setupProjectEntity
.
setAreaCode
(
siteAddRest
.
getData
().
getAreaCode
());
setupProjectEntity
.
setAreaName
(
siteAddRest
.
getData
().
getAreaName
());
this
.
service
.
getDao
().
update
(
setupProjectEntity
);
this
.
service
.
update
(
setupProjectEntity
);
//todo 更新门户站点信息,用户站点树等
//todo 更加站点编码生成基础服务应用,并部署
}
else
{
throw
new
AppException
(
"站点添加失败! "
+
rest
.
getMsg
());
}
// ret.put(KEY_RESULT_DATA, resp);
}
else
{
throw
new
AppException
(
"子区域更新失败! "
+
rest
.
getMsg
());
}
ret
.
put
(
KEY_RESULT_MSG
,
"站点添加成功!"
);
}
catch
(
Exception
e
)
{
code
=
VALUE_RESULT_FAILURE
;
...
...
setup-project-manager/src/test/java/httpclient/http-client.env.json
View file @
10fb5222
{
"local"
:
{
"baseUrl"
:
"http://1
92.168.0.224/
"
"baseUrl"
:
"http://1
27.0.0.1:18000/m
"
},
"dev"
:
{
"baseUrl"
:
"http://1
92.168.0.64:80/
"
"baseUrl"
:
"http://1
27.0.0.1:18000/m
"
},
"test"
:
{
"baseUrl"
:
"http://192.168.0.121:80/"
},
"portal"
:
{
"baseUrl"
:
"http://192.168.0.98:11072/zwfw"
"baseUrl"
:
"http://192.168.0.250:8082/m"
}
}
\ No newline at end of file
setup-project-manager/src/test/java/httpclient/system.http
View file @
10fb5222
###
POST
http://localhost:8081
/db/importDb
POST
{{baseUrl}}
/db/importDb
Content-Type: multipart/form-data; boundary=WebAppBoundary
--WebAppBoundary
...
...
@@ -13,7 +13,7 @@ Content-Disposition: form-data; name="file"; filename="file.sql"
###上传数据库文件
POST
http://localhost:8081
/file/commonupload
POST
{{baseUrl}}
/file/commonupload
Content-Type: multipart/form-data; boundary=WebAppBoundary
--WebAppBoundary
...
...
@@ -24,7 +24,7 @@ Content-Disposition: form-data; name="file"; filename="file.sql"
###上传资源文件
POST
http://localhost:8081
/file/commonupload
POST
{{baseUrl}}
/file/commonupload
Content-Type: multipart/form-data; boundary=WebAppBoundary
--WebAppBoundary
...
...
@@ -34,7 +34,7 @@ Content-Disposition: form-data; name="file"; filename="file.zip"
--WebAppBoundary--
###测试链接数据库
POST
http://localhost:8081
/m/db/connect
POST
{{baseUrl}}
/m/db/connect
Content-Type: application/json
{
...
...
@@ -48,7 +48,7 @@ Content-Type: application/json
###测试导入sql数据库文件
POST
http://localhost:8081
/db/init
POST
{{baseUrl}}
/db/init
Content-Type: application/json
{
...
...
@@ -62,14 +62,14 @@ Content-Type: application/json
###测试导入sql数据库文件 form
POST
http://localhost:8081
/db/init
POST
{{baseUrl}}
/db/init
Content-Type: application/x-www-form-urlencoded
dbFilePath=/file/fileupload/1724915454477.sql&dbHost=localhost&dbName=test1&dbPort=3306&userName=root&password=12345678
###测试导入资源文件
POST
http://localhost:8081
/resource/init
POST
{{baseUrl}}
/resource/init
Content-Type: application/json
{
...
...
@@ -78,7 +78,7 @@ Content-Type: application/json
###测试项目部署1
POST
http://localhost:8081
/project/distribute
POST
{{baseUrl}}
/project/distribute
Content-Type: application/json
{
...
...
@@ -87,7 +87,7 @@ Content-Type: application/json
###测试项目部署2
POST
http://localhost:8081
/project/distribute
POST
{{baseUrl}}
/project/distribute
Content-Type: application/json
{
...
...
@@ -95,4 +95,15 @@ Content-Type: application/json
}
###区域树测试
POST {{baseUrl}}/base/area/treeselect
Content-Type: application/json
{}
###区域查看
GET {{baseUrl}}/base/area/getListByParentId?parentId=6182157d00ce41559e001a89d87f4057
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