Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart_gov_platform
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
赵啸非
smart_gov_platform
Commits
65f87228
Commit
65f87228
authored
Jun 28, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加站点查询子站点接口
parent
baef4566
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
4 deletions
+60
-4
base-manager/src/main/java/com/mortals/xhx/module/site/service/SiteService.java
...java/com/mortals/xhx/module/site/service/SiteService.java
+8
-0
base-manager/src/main/java/com/mortals/xhx/module/site/service/impl/SiteServiceImpl.java
...mortals/xhx/module/site/service/impl/SiteServiceImpl.java
+29
-4
base-manager/src/main/java/com/mortals/xhx/module/site/web/SiteController.java
.../java/com/mortals/xhx/module/site/web/SiteController.java
+23
-0
No files found.
base-manager/src/main/java/com/mortals/xhx/module/site/service/SiteService.java
View file @
65f87228
...
@@ -47,6 +47,14 @@ public interface SiteService extends ICRUDCacheService<SiteEntity, Long> {
...
@@ -47,6 +47,14 @@ public interface SiteService extends ICRUDCacheService<SiteEntity, Long> {
List
<
SiteEntity
>
getFlatSitesByAreaCode
(
String
areaCode
,
Context
context
);
List
<
SiteEntity
>
getFlatSitesByAreaCode
(
String
areaCode
,
Context
context
);
/**
* 根据Site获取子站点
*
* @param context
* @return
*/
List
<
SiteEntity
>
getFlatSitesBySiteId
(
Long
siteId
,
Context
context
);
void
setSiteTree
(
List
<
SiteTreeSelect
>
list
,
Context
context
);
void
setSiteTree
(
List
<
SiteTreeSelect
>
list
,
Context
context
);
...
...
base-manager/src/main/java/com/mortals/xhx/module/site/service/impl/SiteServiceImpl.java
View file @
65f87228
...
@@ -206,14 +206,39 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
...
@@ -206,14 +206,39 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
List
<
SiteEntity
>
siteEntities
=
this
.
find
(
new
SiteQuery
());
List
<
SiteEntity
>
siteEntities
=
this
.
find
(
new
SiteQuery
());
for
(
SiteEntity
siteEntity
:
siteEntities
)
{
for
(
SiteEntity
siteEntity
:
siteEntities
)
{
boolean
bool
=
getSite
(
areaCode
,
siteEntity
.
getAreaCode
(),
siteList
,
siteEntity
);
boolean
bool
=
getSite
(
areaCode
,
siteEntity
.
getAreaCode
(),
siteList
,
siteEntity
);
if
(
bool
)
continue
;
if
(
bool
)
continue
;
}
}
return
siteList
;
return
siteList
;
}
}
private
boolean
getSite
(
String
rootAreaCode
,
String
areaCode
,
List
<
SiteEntity
>
siteList
,
SiteEntity
siteEntity
)
{
@Override
public
List
<
SiteEntity
>
getFlatSitesBySiteId
(
Long
siteId
,
Context
context
)
{
List
<
SiteEntity
>
siteList
=
new
ArrayList
<>();
if
(
ObjectUtils
.
isEmpty
(
siteId
))
{
throw
new
AppException
(
"站点Id不能为空!"
);
}
SiteEntity
siteCache
=
this
.
getCache
(
siteId
.
toString
());
if
(
ObjectUtils
.
isEmpty
(
siteCache
))
{
throw
new
AppException
(
"站点不存在,siteId:"
+
siteId
);
}
siteList
.
add
(
siteCache
);
AreaEntity
areaEntity
=
areaService
.
getExtCache
(
siteCache
.
getAreaCode
());
if
(
ObjectUtils
.
isEmpty
(
areaEntity
))
{
throw
new
AppException
(
String
.
format
(
"区域不存在!区域编码:%s"
,
siteCache
.
getAreaCode
()));
}
List
<
SiteEntity
>
siteEntities
=
this
.
find
(
new
SiteQuery
());
for
(
SiteEntity
siteEntity
:
siteEntities
)
{
boolean
bool
=
getSite
(
siteCache
.
getAreaCode
(),
siteEntity
.
getAreaCode
(),
siteList
,
siteEntity
);
if
(
bool
)
continue
;
}
return
siteList
;
}
private
boolean
getSite
(
String
rootAreaCode
,
String
areaCode
,
List
<
SiteEntity
>
siteList
,
SiteEntity
siteEntity
)
{
// AreaEntity areaTemp = areaService.getExtCache(siteEntity.getAreaCode());
// AreaEntity areaTemp = areaService.getExtCache(siteEntity.getAreaCode());
if
(
rootAreaCode
.
equals
(
areaCode
))
{
if
(
rootAreaCode
.
equals
(
areaCode
))
{
siteList
.
add
(
siteEntity
);
siteList
.
add
(
siteEntity
);
...
@@ -224,7 +249,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
...
@@ -224,7 +249,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
if
(!
ObjectUtils
.
isEmpty
(
areaTemp
.
getPid
()))
{
if
(!
ObjectUtils
.
isEmpty
(
areaTemp
.
getPid
()))
{
AreaEntity
areaEntity
=
areaService
.
selectOne
(
new
AreaQuery
().
iid
(
areaTemp
.
getPid
()));
AreaEntity
areaEntity
=
areaService
.
selectOne
(
new
AreaQuery
().
iid
(
areaTemp
.
getPid
()));
if
(!
ObjectUtils
.
isEmpty
(
areaEntity
))
{
if
(!
ObjectUtils
.
isEmpty
(
areaEntity
))
{
return
getSite
(
rootAreaCode
,
areaEntity
.
getAreaCode
(),
siteList
,
siteEntity
);
return
getSite
(
rootAreaCode
,
areaEntity
.
getAreaCode
(),
siteList
,
siteEntity
);
}
}
}
}
return
false
;
return
false
;
...
...
base-manager/src/main/java/com/mortals/xhx/module/site/web/SiteController.java
View file @
65f87228
...
@@ -138,6 +138,29 @@ public class SiteController extends BaseCRUDJsonBodyMappingController<SiteServic
...
@@ -138,6 +138,29 @@ public class SiteController extends BaseCRUDJsonBodyMappingController<SiteServic
return
jsonObject
.
toJSONString
();
return
jsonObject
.
toJSONString
();
}
}
/**
* 根据站点id查询站点列表子集,包含当前站点
*/
@PostMapping
(
value
=
"getFlatSitesByAreaIds"
)
@UnAuth
public
String
getFlatSitesBySiteId
(
@RequestBody
SiteQuery
site
)
{
JSONObject
jsonObject
=
new
JSONObject
();
Map
<
String
,
Object
>
model
=
new
HashMap
<>();
String
busiDesc
=
"根据站点id查询站点列表子集"
+
this
.
getModuleDesc
();
try
{
List
<
SiteEntity
>
siteEntityList
=
this
.
service
.
getFlatSitesBySiteId
(
site
.
getId
(),
getContext
());
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
jsonObject
.
put
(
KEY_RESULT_DATA
,
siteEntityList
);
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
jsonObject
.
put
(
KEY_RESULT_MSG
,
busiDesc
+
"成功!"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"获取异常"
,
e
);
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_FAILURE
);
jsonObject
.
put
(
KEY_RESULT_MSG
,
super
.
convertException
(
e
));
}
return
jsonObject
.
toJSONString
();
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
//深度克隆
//深度克隆
...
...
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