Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-webapp-plug
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
base_platform_enterprise
gic-webapp-plug
Commits
f127c889
Commit
f127c889
authored
Jul 31, 2019
by
zhiwj
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
4bceae29
b6049242
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
ProvincesController.java
...java/com/gic/plug/web/controller/ProvincesController.java
+37
-0
No files found.
src/main/java/com/gic/plug/web/controller/ProvincesController.java
View file @
f127c889
package
com
.
gic
.
plug
.
web
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.webapi.reponse.RestResponse
;
...
...
@@ -11,6 +12,7 @@ import com.gic.store.dto.CityDTO;
import
com.gic.store.dto.CountyDTO
;
import
com.gic.store.dto.ProvinceDTO
;
import
com.gic.store.service.ProvincesApiService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
...
...
@@ -139,4 +141,39 @@ public class ProvincesController {
}
return
RestResponse
.
success
(
result
);
}
@RequestMapping
(
"dict-provinces-citys"
)
@ResponseBody
public
RestResponse
listProvincesCitys
(){
ServiceResponse
<
List
<
ProvinceDTO
>>
serviceResponse
=
this
.
provincesApiService
.
selectAllProvince
();
ServiceResponse
<
List
<
CityDTO
>>
serviceResponse1
=
this
.
provincesApiService
.
selectAllCity
();
List
<
JSONObject
>
result
=
new
ArrayList
<>();
if
(
serviceResponse
.
isSuccess
()){
List
<
ProvinceDTO
>
list
=
serviceResponse
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
for
(
ProvinceDTO
provinceDTO
:
list
){
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"provinceId"
,
provinceDTO
.
getProvinceId
());
jsonObject
.
put
(
"provinceName"
,
provinceDTO
.
getProvinceName
());
if
(
serviceResponse1
.
isSuccess
()){
List
<
CityDTO
>
cityDTOList
=
serviceResponse1
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
cityDTOList
)){
List
<
JSONObject
>
jsonObjectList
=
new
ArrayList
<>();
for
(
CityDTO
cityDTO
:
cityDTOList
){
if
(
cityDTO
.
getProvinceId
().
equals
(
provinceDTO
.
getProvinceId
())){
JSONObject
object
=
new
JSONObject
();
object
.
put
(
"cityId"
,
cityDTO
.
getCityId
());
object
.
put
(
"cityName"
,
cityDTO
.
getCityName
());
jsonObjectList
.
add
(
object
);
}
}
jsonObject
.
put
(
"children"
,
jsonObjectList
);
}
}
result
.
add
(
jsonObject
);
}
}
}
return
RestResponse
.
success
(
result
);
}
}
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