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
6b8b178e
Commit
6b8b178e
authored
Feb 01, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加分类查询返回组
parent
8d2e1af0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
17 deletions
+43
-17
base-manager/src/main/java/com/mortals/xhx/module/site/model/vo/SiteVo.java
...ain/java/com/mortals/xhx/module/site/model/vo/SiteVo.java
+4
-0
base-manager/src/main/java/com/mortals/xhx/module/site/web/SiteController.java
.../java/com/mortals/xhx/module/site/web/SiteController.java
+35
-11
base-manager/src/test/java/com/mortals/httpclient/site/SiteController.http
...test/java/com/mortals/httpclient/site/SiteController.http
+4
-6
No files found.
base-manager/src/main/java/com/mortals/xhx/module/site/model/vo/SiteVo.java
View file @
6b8b178e
...
@@ -26,4 +26,8 @@ public class SiteVo extends BaseEntityLong {
...
@@ -26,4 +26,8 @@ public class SiteVo extends BaseEntityLong {
private
Integer
areaLevel
;
private
Integer
areaLevel
;
private
Integer
total
=
0
;
private
List
<
SiteEntity
>
subList
=
new
ArrayList
<>();
}
}
\ No newline at end of file
base-manager/src/main/java/com/mortals/xhx/module/site/web/SiteController.java
View file @
6b8b178e
...
@@ -257,11 +257,12 @@ public class SiteController extends BaseCRUDJsonBodyMappingController<SiteServic
...
@@ -257,11 +257,12 @@ public class SiteController extends BaseCRUDJsonBodyMappingController<SiteServic
public
String
getFlatSitesGroupByAreaCode
(
@RequestBody
SiteQuery
site
)
{
public
String
getFlatSitesGroupByAreaCode
(
@RequestBody
SiteQuery
site
)
{
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
String
busiDesc
=
"根据区域编码查询站点列表"
+
this
.
getModuleDesc
();
String
busiDesc
=
"根据区域编码查询站点列表"
+
this
.
getModuleDesc
();
List
<
SiteEntity
>
group
=
new
ArrayList
<>();
Map
<
String
,
List
<
SiteEntity
>>
collect
=
new
HashMap
<>();
Map
<
String
,
List
<
SiteEntity
>>
collect
=
new
HashMap
<>();
try
{
try
{
if
(
ObjectUtils
.
isEmpty
(
site
.
getAreaName
())
&&
ObjectUtils
.
isEmpty
(
site
.
getAreaCode
()))
{
if
(
ObjectUtils
.
isEmpty
(
site
.
getAreaName
())
&&
ObjectUtils
.
isEmpty
(
site
.
getAreaCode
()))
{
List
<
SiteEntity
>
siteEntities
=
this
.
service
.
find
(
new
SiteQuery
());
List
<
SiteEntity
>
siteEntities
=
this
.
service
.
find
(
new
SiteQuery
());
collect
=
siteEntities
.
stream
().
collect
(
Collectors
.
groupingBy
(
SiteEntity:
:
getArea
Nam
e
));
collect
=
siteEntities
.
stream
().
collect
(
Collectors
.
groupingBy
(
SiteEntity:
:
getArea
Cod
e
));
}
else
{
}
else
{
if
(!
ObjectUtils
.
isEmpty
(
site
.
getSiteName
()))
{
if
(!
ObjectUtils
.
isEmpty
(
site
.
getSiteName
()))
{
List
<
SiteEntity
>
siteEntities
=
this
.
service
.
find
(
new
SiteQuery
().
siteName
(
site
.
getSiteName
()));
List
<
SiteEntity
>
siteEntities
=
this
.
service
.
find
(
new
SiteQuery
().
siteName
(
site
.
getSiteName
()));
...
@@ -283,12 +284,22 @@ public class SiteController extends BaseCRUDJsonBodyMappingController<SiteServic
...
@@ -283,12 +284,22 @@ public class SiteController extends BaseCRUDJsonBodyMappingController<SiteServic
.
flatMap
(
areaCode
->
this
.
service
.
getFlatSitesByAreaCode
(
areaCode
,
getContext
()).
stream
())
.
flatMap
(
areaCode
->
this
.
service
.
getFlatSitesByAreaCode
(
areaCode
,
getContext
()).
stream
())
.
distinct
()
.
distinct
()
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
collect
=
siteEntityList
.
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getAreaName
()));
collect
=
siteEntityList
.
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getAreaCode
()));
}
}
jsonObject
.
put
(
KEY_RESULT_DATA
,
collect
);
group
=
collect
.
entrySet
().
stream
().
map
(
item
->
{
AreaEntity
areaEntity
=
areaService
.
getCache
(
item
.
getKey
());
SiteEntity
siteEntity
=
new
SiteEntity
();
siteEntity
.
setAreaName
(
areaEntity
.
getName
());
siteEntity
.
setAreaCode
(
areaEntity
.
getAreaCode
());
siteEntity
.
setSubList
(
item
.
getValue
());
siteEntity
.
setTotal
(
item
.
getValue
().
size
());
return
siteEntity
;
}).
sorted
(
Comparator
.
comparing
(
SiteEntity:
:
getAreaCode
)).
collect
(
Collectors
.
toList
());
jsonObject
.
put
(
KEY_RESULT_DATA
,
group
);
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
jsonObject
.
put
(
KEY_RESULT_MSG
,
"查询站点列表成功!"
);
jsonObject
.
put
(
KEY_RESULT_MSG
,
"查询站点
分组
列表成功!"
);
if
(!
ObjectUtils
.
isEmpty
(
getContext
())
&&
!
ObjectUtils
.
isEmpty
(
getContext
().
getUser
()))
{
if
(!
ObjectUtils
.
isEmpty
(
getContext
())
&&
!
ObjectUtils
.
isEmpty
(
getContext
().
getUser
()))
{
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
...
@@ -374,26 +385,39 @@ public class SiteController extends BaseCRUDJsonBodyMappingController<SiteServic
...
@@ -374,26 +385,39 @@ public class SiteController extends BaseCRUDJsonBodyMappingController<SiteServic
public
String
getSitesGroupByAreaLevel
(
@RequestBody
SiteQuery
site
)
{
public
String
getSitesGroupByAreaLevel
(
@RequestBody
SiteQuery
site
)
{
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
String
busiDesc
=
"根据区域等级查询当前区域所有站点"
+
this
.
getModuleDesc
();
String
busiDesc
=
"根据区域等级查询当前区域所有站点"
+
this
.
getModuleDesc
();
Map
<
String
,
List
<
SiteEntity
>>
collect
=
new
HashMap
<>();
Map
<
Integer
,
List
<
SiteEntity
>>
collect
=
new
HashMap
<>();
try
{
List
<
SiteEntity
>
groupList
=
new
ArrayList
<>();
try
{
if
(
ObjectUtils
.
isEmpty
(
site
.
getAreaLevel
()))
{
if
(
ObjectUtils
.
isEmpty
(
site
.
getAreaLevel
()))
{
//全部
//全部
for
(
int
i
=
1
;
i
<=
5
;
i
++)
{
for
(
int
i
=
1
;
i
<=
5
;
i
++)
{
site
.
setAreaLevel
(
i
);
site
.
setAreaLevel
(
i
);
Rest
<
List
<
SiteEntity
>>
rest
=
this
.
service
.
getAreaSitesByAreaLevel
(
site
,
getContext
());
Rest
<
List
<
SiteEntity
>>
rest
=
this
.
service
.
getAreaSitesByAreaLevel
(
site
,
getContext
());
String
areaName
=
AreaLevelEnum
.
getByValue
(
i
).
getDesc
();
//
String areaName = AreaLevelEnum.getByValue(i).getDesc();
collect
.
put
(
areaName
,
rest
.
getData
());
collect
.
put
(
i
,
rest
.
getData
());
}
}
}
else
{
}
else
{
Rest
<
List
<
SiteEntity
>>
rest
=
this
.
service
.
getAreaSitesByAreaLevel
(
site
,
getContext
());
Rest
<
List
<
SiteEntity
>>
rest
=
this
.
service
.
getAreaSitesByAreaLevel
(
site
,
getContext
());
if
(
YesNoEnum
.
YES
.
getValue
()
==
rest
.
getCode
())
{
if
(
YesNoEnum
.
YES
.
getValue
()
==
rest
.
getCode
())
{
collect
=
rest
.
getData
().
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getArea
Name
()));
collect
=
rest
.
getData
().
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getArea
Level
()));
jsonObject
.
put
(
KEY_RESULT_DATA
,
collect
);
jsonObject
.
put
(
KEY_RESULT_DATA
,
collect
);
}
}
}
}
//排序统计
for
(
int
i
=
1
;
i
<=
5
;
i
++)
{
List
<
SiteEntity
>
siteEntities
=
collect
.
get
(
i
);
SiteEntity
siteEntity
=
new
SiteEntity
();
siteEntity
.
setAreaName
(
AreaLevelEnum
.
getByValue
(
i
).
getDesc
());
if
(!
ObjectUtils
.
isEmpty
(
siteEntities
))
{
siteEntity
.
setTotal
(
siteEntities
.
size
());
siteEntity
.
setSubList
(
siteEntities
);
}
groupList
.
add
(
siteEntity
);
}
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
jsonObject
.
put
(
KEY_RESULT_DATA
,
collec
t
);
jsonObject
.
put
(
KEY_RESULT_DATA
,
groupLis
t
);
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
jsonObject
.
put
(
KEY_RESULT_MSG
,
busiDesc
+
"成功!"
);
jsonObject
.
put
(
KEY_RESULT_MSG
,
busiDesc
+
"成功!"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
base-manager/src/test/java/com/mortals/httpclient/site/SiteController.http
View file @
6b8b178e
...
@@ -128,16 +128,14 @@ Content-Type: application/json
...
@@ -128,16 +128,14 @@ Content-Type: application/json
}
}
###站点分组列表
###站点
区
分组列表
POST {{baseUrl}}/site/getFlatSitesGroupByAreaCode
POST {{baseUrl}}/site/getFlatSitesGroupByAreaCode
Content-Type: application/json
Content-Type: application/json
{
{"areaName":"象鼻街道"}
}
###站点分组列表
###站点
区域
分组列表
POST {{baseUrl}}/site/getSitesGroupByAreaLevel
POST {{baseUrl}}/site/getSitesGroupByAreaLevel
Content-Type: application/json
Content-Type: application/json
{
{"areaLevel":2}
}
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