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
19595791
Commit
19595791
authored
Jul 05, 2019
by
陶光胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
省市区
parent
24602bfc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
ProvincesController.java
...java/com/gic/plug/web/controller/ProvincesController.java
+39
-0
No files found.
src/main/java/com/gic/plug/web/controller/ProvincesController.java
View file @
19595791
...
...
@@ -4,11 +4,14 @@ import com.gic.api.base.commons.ServiceResponse;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.plug.web.vo.CityVO
;
import
com.gic.plug.web.vo.CountyVO
;
import
com.gic.plug.web.vo.ProvinceVO
;
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
com.gic.store.utils.ErrorCode
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -57,4 +60,40 @@ public class ProvincesController {
}
return
RestResponse
.
success
();
}
@RequestMapping
(
"query-provinces"
)
@ResponseBody
public
Object
searchProvinces
(
String
search
){
ServiceResponse
<
List
<
ProvinceDTO
>>
serviceResponse
=
this
.
provincesApiService
.
queryProvinces
(
search
);
if
(
serviceResponse
.
isSuccess
()){
return
RestResponse
.
success
(
EntityUtil
.
changeEntityListByJSON
(
ProvinceVO
.
class
,
serviceResponse
.
getResult
()));
}
return
RestResponse
.
failure
(
serviceResponse
.
getCode
(),
serviceResponse
.
getMessage
());
}
@RequestMapping
(
"query-city"
)
@ResponseBody
public
Object
searchCitys
(
String
search
){
if
(
StringUtils
.
isBlank
(
search
)){
RestResponse
.
failure
(
ErrorCode
.
ERR_2
.
getCode
(),
ErrorCode
.
ERR_2
.
getMsg
());
}
ServiceResponse
<
List
<
CityDTO
>>
serviceResponse
=
this
.
provincesApiService
.
queryCity
(
search
);
if
(
serviceResponse
.
isSuccess
()){
return
RestResponse
.
success
(
EntityUtil
.
changeEntityListByJSON
(
CityVO
.
class
,
serviceResponse
.
getResult
()));
}
return
RestResponse
.
failure
(
serviceResponse
.
getCode
(),
serviceResponse
.
getMessage
());
}
@RequestMapping
(
"query-county"
)
@ResponseBody
public
Object
searchCounty
(
String
search
){
if
(
StringUtils
.
isBlank
(
search
)){
RestResponse
.
failure
(
ErrorCode
.
ERR_2
.
getCode
(),
ErrorCode
.
ERR_2
.
getMsg
());
}
ServiceResponse
<
List
<
CountyDTO
>>
serviceResponse
=
this
.
provincesApiService
.
queryCounty
(
search
);
if
(
serviceResponse
.
isSuccess
()){
return
RestResponse
.
success
(
EntityUtil
.
changeEntityListByJSON
(
CountyVO
.
class
,
serviceResponse
.
getResult
()));
}
return
RestResponse
.
failure
(
serviceResponse
.
getCode
(),
serviceResponse
.
getMessage
());
}
}
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