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
693d08fb
Commit
693d08fb
authored
Jan 31, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加分类查询返回组
parent
493411c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
0 deletions
+92
-0
base-manager/src/main/java/com/mortals/xhx/module/site/web/SiteController.java
.../java/com/mortals/xhx/module/site/web/SiteController.java
+92
-0
No files found.
base-manager/src/main/java/com/mortals/xhx/module/site/web/SiteController.java
View file @
693d08fb
...
...
@@ -12,6 +12,8 @@ import com.mortals.framework.util.ThreadPool;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.param.service.ParamService
;
import
com.mortals.xhx.base.system.user.model.UserEntity
;
import
com.mortals.xhx.common.code.AreaLevelEnum
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.keys.RedisCacheKeys
;
import
com.mortals.xhx.common.utils.SyncDeptThread
;
import
com.mortals.xhx.common.utils.SyncGovMatterDetailThread
;
...
...
@@ -247,6 +249,58 @@ public class SiteController extends BaseCRUDJsonBodyMappingController<SiteServic
return
jsonObject
.
toJSONString
();
}
/**
* 根据区域编码查询站点分组列表
*/
@PostMapping
(
value
=
"getFlatSitesGroupByAreaCode"
)
@UnAuth
public
String
getFlatSitesGroupByAreaCode
(
@RequestBody
SiteQuery
site
)
{
JSONObject
jsonObject
=
new
JSONObject
();
String
busiDesc
=
"根据区域编码查询站点列表"
+
this
.
getModuleDesc
();
Map
<
String
,
List
<
SiteEntity
>>
collect
=
new
HashMap
<>();
try
{
if
(
ObjectUtils
.
isEmpty
(
site
.
getAreaName
())
&&
ObjectUtils
.
isEmpty
(
site
.
getAreaCode
()))
{
List
<
SiteEntity
>
siteEntities
=
this
.
service
.
find
(
new
SiteQuery
());
collect
=
siteEntities
.
stream
().
collect
(
Collectors
.
groupingBy
(
SiteEntity:
:
getAreaName
));
}
else
{
if
(!
ObjectUtils
.
isEmpty
(
site
.
getSiteName
()))
{
List
<
SiteEntity
>
siteEntities
=
this
.
service
.
find
(
new
SiteQuery
().
siteName
(
site
.
getSiteName
()));
if
(!
ObjectUtils
.
isEmpty
(
siteEntities
))
{
site
.
setAreaCodeList
(
siteEntities
.
stream
().
map
(
i
->
i
.
getAreaCode
()).
collect
(
Collectors
.
toList
()));
}
}
if
(!
ObjectUtils
.
isEmpty
(
site
.
getAreaName
()))
{
List
<
AreaEntity
>
areaEntities
=
areaService
.
find
(
new
AreaQuery
().
name
(
site
.
getAreaName
()));
if
(!
ObjectUtils
.
isEmpty
(
areaEntities
))
{
site
.
setAreaCodeList
(
areaEntities
.
stream
().
map
(
i
->
i
.
getAreaCode
()).
collect
(
Collectors
.
toList
()));
}
}
if
(
ObjectUtils
.
isEmpty
(
site
.
getAreaCodeList
()))
{
site
.
setAreaCodeList
(
Arrays
.
asList
(
site
.
getAreaCode
()));
}
List
<
SiteEntity
>
siteEntityList
=
site
.
getAreaCodeList
().
stream
()
.
flatMap
(
areaCode
->
this
.
service
.
getFlatSitesByAreaCode
(
areaCode
,
getContext
()).
stream
())
.
distinct
()
.
collect
(
Collectors
.
toList
());
collect
=
siteEntityList
.
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getAreaName
()));
}
jsonObject
.
put
(
KEY_RESULT_DATA
,
collect
);
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
jsonObject
.
put
(
KEY_RESULT_MSG
,
"查询站点列表成功!"
);
if
(!
ObjectUtils
.
isEmpty
(
getContext
())
&&
!
ObjectUtils
.
isEmpty
(
getContext
().
getUser
()))
{
recordSysLog
(
request
,
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
();
}
/**
* 根据区域获取子站点数量
...
...
@@ -312,6 +366,44 @@ public class SiteController extends BaseCRUDJsonBodyMappingController<SiteServic
}
/**
* 根据区域等级查询当前区域所有站点
*/
@PostMapping
(
value
=
"getSitesGroupByAreaLevel"
)
@UnAuth
public
String
getSitesGroupByAreaLevel
(
@RequestBody
SiteQuery
site
)
{
JSONObject
jsonObject
=
new
JSONObject
();
String
busiDesc
=
"根据区域等级查询当前区域所有站点"
+
this
.
getModuleDesc
();
Map
<
String
,
List
<
SiteEntity
>>
collect
=
new
HashMap
<>();
try
{
if
(
ObjectUtils
.
isEmpty
(
site
.
getAreaLevel
()))
{
//全部
for
(
int
i
=
1
;
i
<=
5
;
i
++)
{
site
.
setAreaLevel
(
i
);
Rest
<
List
<
SiteEntity
>>
rest
=
this
.
service
.
getAreaSitesByAreaLevel
(
site
,
getContext
());
String
areaName
=
AreaLevelEnum
.
getByValue
(
i
).
getDesc
();
collect
.
put
(
areaName
,
rest
.
getData
());
}
}
else
{
Rest
<
List
<
SiteEntity
>>
rest
=
this
.
service
.
getAreaSitesByAreaLevel
(
site
,
getContext
());
if
(
YesNoEnum
.
YES
.
getValue
()
==
rest
.
getCode
())
{
collect
=
rest
.
getData
().
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getAreaName
()));
jsonObject
.
put
(
KEY_RESULT_DATA
,
collect
);
}
}
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
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
();
}
@Override
protected
int
infoAfter
(
Long
id
,
Map
<
String
,
Object
>
model
,
SiteEntity
entity
,
Context
context
)
throws
AppException
{
this
.
service
.
changeUrlPath
(
entity
);
...
...
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