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
47c21f43
Commit
47c21f43
authored
Jun 06, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改区域列表查询
parent
2491521d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
58 additions
and
27 deletions
+58
-27
base-manager/src/main/java/com/mortals/xhx/base/framework/interceptor/AuthUserInterceptor.java
...s/xhx/base/framework/interceptor/AuthUserInterceptor.java
+11
-0
base-manager/src/test/java/com/mortals/httpclient/window/WindowBusinessController.http
...m/mortals/httpclient/window/WindowBusinessController.http
+1
-2
common-lib/src/main/java/com/mortals/xhx/feign/area/IApiAreaFeign.java
...c/main/java/com/mortals/xhx/feign/area/IApiAreaFeign.java
+9
-12
portal-manager/src/main/java/com/mortals/xhx/module/area/service/AreaService.java
...java/com/mortals/xhx/module/area/service/AreaService.java
+3
-4
portal-manager/src/main/java/com/mortals/xhx/module/area/service/impl/AreaServiceImpl.java
...mortals/xhx/module/area/service/impl/AreaServiceImpl.java
+6
-6
portal-manager/src/main/java/com/mortals/xhx/module/area/web/AreaController.java
.../java/com/mortals/xhx/module/area/web/AreaController.java
+3
-3
portal-manager/src/test/java/com/mortals/httpclient/area/AreaController.http
...test/java/com/mortals/httpclient/area/AreaController.http
+25
-0
No files found.
base-manager/src/main/java/com/mortals/xhx/base/framework/interceptor/AuthUserInterceptor.java
View file @
47c21f43
package
com.mortals.xhx.base.framework.interceptor
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.service.IAuthTokenService
;
import
com.mortals.framework.service.IUser
;
import
com.mortals.framework.util.AESUtil
;
import
com.mortals.framework.utils.ServletUtils
;
import
com.mortals.framework.web.interceptor.BaseInterceptor
;
import
com.mortals.xhx.base.framework.config.InterceptorConfig
;
import
com.mortals.xhx.common.code.ApiRespCodeEnum
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.method.HandlerMethod
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.lang.reflect.Method
;
/**
* 用户权限验证,基于token
...
...
@@ -36,6 +40,13 @@ public class AuthUserInterceptor extends BaseInterceptor {
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
JSONObject
ret
=
new
JSONObject
();
HandlerMethod
handlerMethod
=
(
HandlerMethod
)
handler
;
Method
method
=
handlerMethod
.
getMethod
();
UnAuth
annotation
=
method
.
getAnnotation
(
UnAuth
.
class
);
if
(
annotation
!=
null
)
{
//取消校验
return
true
;
}
try
{
String
uri
=
request
.
getServletPath
();
//校验配置的请求路径是否需要检查权限
...
...
base-manager/src/test/java/com/mortals/httpclient/window/WindowBusinessController.http
View file @
47c21f43
...
...
@@ -4,8 +4,7 @@ POST {{baseUrl}}/window/business/list
Content-Type: application/json
{
"windowId":6529 ,
"siteBusinessId":4300 ,
"siteBusinessId":3,
"page":1,
"size":10
}
...
...
common-lib/src/main/java/com/mortals/xhx/feign/area/IApiAreaFeign.java
View file @
47c21f43
...
...
@@ -28,8 +28,7 @@ public interface IApiAreaFeign extends IFeign {
* @return
*/
@PostMapping
(
value
=
"/area/list"
)
String
list
(
@RequestBody
AreaEntity
query
,
@RequestHeader
(
name
=
"Authorization"
,
required
=
true
)
String
token
);
String
list
(
@RequestBody
AreaEntity
query
);
/**
...
...
@@ -39,8 +38,7 @@ public interface IApiAreaFeign extends IFeign {
* @return
*/
@GetMapping
(
value
=
"/area/info"
)
String
viewAreaInfo
(
@RequestParam
(
value
=
"id"
)
Long
id
,
@RequestHeader
(
name
=
"Authorization"
,
required
=
true
)
String
token
);
String
viewAreaInfo
(
@RequestParam
(
value
=
"id"
)
Long
id
);
/**
...
...
@@ -50,8 +48,7 @@ public interface IApiAreaFeign extends IFeign {
* @return
*/
@GetMapping
(
value
=
"/area/getListByParentId"
)
String
getListByParentId
(
@RequestParam
(
value
=
"parentId"
)
String
parentId
,
@RequestHeader
(
name
=
"Authorization"
,
required
=
true
)
String
token
);
String
getListByParentId
(
@RequestParam
(
value
=
"parentId"
)
String
parentId
);
}
...
...
@@ -63,8 +60,8 @@ class AreaFeignFallbackFactory implements FallbackFactory<IApiAreaFeign> {
public
IApiAreaFeign
create
(
Throwable
t
)
{
return
new
IApiAreaFeign
()
{
@Override
public
String
list
(
AreaEntity
query
,
String
token
)
{
log
.
error
(
"暂时无法获取区域列表信息,请稍后再试!query:{}
,token:{}"
,
JSON
.
toJSONString
(
query
),
token
);
public
String
list
(
AreaEntity
query
)
{
log
.
error
(
"暂时无法获取区域列表信息,请稍后再试!query:{}
"
,
JSON
.
toJSONString
(
query
)
);
log
.
error
(
t
.
getMessage
());
ApiResp
<
String
>
failResp
=
new
ApiResp
<>();
failResp
.
setCode
(
ApiRespCodeEnum
.
FAILED
.
getValue
());
...
...
@@ -73,8 +70,8 @@ class AreaFeignFallbackFactory implements FallbackFactory<IApiAreaFeign> {
}
@Override
public
String
viewAreaInfo
(
Long
id
,
String
token
)
{
log
.
error
(
"暂时无法获取区域信息,请稍后再试!parentId:{}
,token:{}"
,
id
,
token
);
public
String
viewAreaInfo
(
Long
id
)
{
log
.
error
(
"暂时无法获取区域信息,请稍后再试!parentId:{}
"
,
id
);
log
.
error
(
t
.
getMessage
());
ApiResp
<
String
>
failResp
=
new
ApiResp
<>();
failResp
.
setCode
(
ApiRespCodeEnum
.
FAILED
.
getValue
());
...
...
@@ -83,8 +80,8 @@ class AreaFeignFallbackFactory implements FallbackFactory<IApiAreaFeign> {
}
@Override
public
String
getListByParentId
(
String
parentId
,
String
token
)
{
log
.
error
(
"暂时无法获取区域信息,请稍后再试!parentId:{}
,token:{}"
,
parentId
,
token
);
public
String
getListByParentId
(
String
parentId
)
{
log
.
error
(
"暂时无法获取区域信息,请稍后再试!parentId:{}
"
,
parentId
);
log
.
error
(
t
.
getMessage
());
ApiResp
<
String
>
failResp
=
new
ApiResp
<>();
failResp
.
setCode
(
ApiRespCodeEnum
.
FAILED
.
getValue
());
...
...
portal-manager/src/main/java/com/mortals/xhx/module/area/service/AreaService.java
View file @
47c21f43
...
...
@@ -51,7 +51,7 @@ public interface AreaService extends ICRUDService<AreaEntity, Long> {
* @param context
* @return
*/
String
getListByParentId
(
String
parentId
,
String
token
,
Context
context
);
String
getListByParentId
(
String
parentId
,
Context
context
);
/**
...
...
@@ -61,15 +61,14 @@ public interface AreaService extends ICRUDService<AreaEntity, Long> {
* @param context
* @return
*/
String
viewArea
(
Long
id
,
String
token
,
Context
context
);
String
viewArea
(
Long
id
,
Context
context
);
/**
* 查询区域列表信息
* @param query
* @param token
* @param context
* @return
*/
String
list
(
AreaEntity
query
,
String
token
,
Context
context
);
String
list
(
AreaEntity
query
,
Context
context
);
}
\ No newline at end of file
portal-manager/src/main/java/com/mortals/xhx/module/area/service/impl/AreaServiceImpl.java
View file @
47c21f43
...
...
@@ -37,11 +37,11 @@ public class AreaServiceImpl extends AbstractCRUDServiceImpl<AreaDao, AreaEntity
@Override
public
String
getListByParentId
(
String
parentId
,
String
token
,
Context
context
)
{
public
String
getListByParentId
(
String
parentId
,
Context
context
)
{
if
(
ObjectUtils
.
isEmpty
(
parentId
))
{
parentId
=
"0"
;
}
String
resp
=
apiAreaFeign
.
getListByParentId
(
parentId
,
token
);
String
resp
=
apiAreaFeign
.
getListByParentId
(
parentId
);
ApiResp
apiResp
=
JSON
.
parseObject
(
resp
,
ApiResp
.
class
);
if
(
apiResp
.
getCode
()
!=
YesNoEnum
.
YES
.
getValue
())
{
...
...
@@ -53,8 +53,8 @@ public class AreaServiceImpl extends AbstractCRUDServiceImpl<AreaDao, AreaEntity
}
@Override
public
String
viewArea
(
Long
id
,
String
token
,
Context
context
)
{
String
resp
=
apiAreaFeign
.
viewAreaInfo
(
id
,
token
);
public
String
viewArea
(
Long
id
,
Context
context
)
{
String
resp
=
apiAreaFeign
.
viewAreaInfo
(
id
);
ApiResp
apiResp
=
JSON
.
parseObject
(
resp
,
ApiResp
.
class
);
if
(
apiResp
.
getCode
()
!=
YesNoEnum
.
YES
.
getValue
())
{
throw
new
AppException
(
"获取区域数据失败:"
+
apiResp
.
getMsg
());
...
...
@@ -64,9 +64,9 @@ public class AreaServiceImpl extends AbstractCRUDServiceImpl<AreaDao, AreaEntity
}
@Override
public
String
list
(
AreaEntity
query
,
String
token
,
Context
context
)
{
public
String
list
(
AreaEntity
query
,
Context
context
)
{
log
.
info
(
"areaListReq==》{}"
,
JSON
.
toJSONString
(
query
));
String
resp
=
apiAreaFeign
.
list
(
query
,
token
);
String
resp
=
apiAreaFeign
.
list
(
query
);
ApiResp
apiResp
=
JSON
.
parseObject
(
resp
,
ApiResp
.
class
);
if
(
apiResp
.
getCode
()
!=
YesNoEnum
.
YES
.
getValue
())
{
throw
new
AppException
(
"获取区域列表数据失败:"
+
apiResp
.
getMsg
());
...
...
portal-manager/src/main/java/com/mortals/xhx/module/area/web/AreaController.java
View file @
47c21f43
...
...
@@ -56,7 +56,7 @@ public class AreaController extends BaseCRUDJsonBodyMappingController<AreaServic
Context
context
=
this
.
getContext
();
try
{
String
token
=
authTokenService
.
getToken
(
request
);
String
resp
=
this
.
service
.
viewArea
(
id
,
token
,
context
);
String
resp
=
this
.
service
.
viewArea
(
id
,
context
);
this
.
recordSysLog
(
this
.
request
,
busiDesc
+
" 【成功】"
);
return
resp
;
}
catch
(
Exception
e
)
{
...
...
@@ -74,7 +74,7 @@ public class AreaController extends BaseCRUDJsonBodyMappingController<AreaServic
String
busiDesc
=
"查询"
+
this
.
getModuleDesc
();
try
{
String
token
=
authTokenService
.
getToken
(
request
);
String
resp
=
this
.
service
.
list
(
query
,
token
,
context
);
String
resp
=
this
.
service
.
list
(
query
,
context
);
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
return
resp
;
}
catch
(
Exception
e
)
{
...
...
@@ -117,7 +117,7 @@ public class AreaController extends BaseCRUDJsonBodyMappingController<AreaServic
String
busiDesc
=
"查询"
+
this
.
getModuleDesc
()
+
"子节点"
;
try
{
String
token
=
authTokenService
.
getToken
(
request
);
String
retStr
=
this
.
service
.
getListByParentId
(
parentId
,
token
,
getContext
());
String
retStr
=
this
.
service
.
getListByParentId
(
parentId
,
getContext
());
recordSysLog
(
request
,
busiDesc
+
"【成功】"
);
return
retStr
;
}
catch
(
Exception
e
)
{
...
...
portal-manager/src/test/java/com/mortals/httpclient/area/AreaController.http
0 → 100644
View file @
47c21f43
###区域列表
GET {{baseUrl}}/area/getListByParentId?parentId=0
Authorization: {{authToken}}
Accept: application/json
###区域列表
POST {{baseUrl}}/area/list
Content-Type: application/json
{
"areaCode":"510000000000",
"page":1,
"size":5
}
###区域查看
GET {{baseUrl}}/area/info?id=5
Authorization: {{authToken}}
Accept: application/json
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