Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
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
项目统一框架
amos-boot-biz
Commits
8d83a490
Commit
8d83a490
authored
Aug 22, 2021
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.接口增加异常判断
parent
28b54d3c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
10 deletions
+13
-10
JCSFeignClient.java
...ejoin/amos/maintenance/business/feign/JCSFeignClient.java
+2
-1
PersonIdentifyAspect.java
...amos/maintenance/core/framework/PersonIdentifyAspect.java
+10
-8
application.properties
...tem-maintenance/src/main/resources/application.properties
+1
-1
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/feign/JCSFeignClient.java
View file @
8d83a490
package
com
.
yeejoin
.
amos
.
maintenance
.
business
.
feign
;
package
com
.
yeejoin
.
amos
.
maintenance
.
business
.
feign
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
...
@@ -18,5 +19,5 @@ public interface JCSFeignClient {
...
@@ -18,5 +19,5 @@ public interface JCSFeignClient {
* @return ResponseModel<ReginParams.PersonIdentity>
* @return ResponseModel<ReginParams.PersonIdentity>
*/
*/
@GetMapping
(
value
=
"jcs/org-usr/{userId}/userUnit"
)
@GetMapping
(
value
=
"jcs/org-usr/{userId}/userUnit"
)
ResponseModel
<
ReginParams
.
PersonIdentity
>
getUserUnit
(
@PathVariable
String
userId
);
FeignClientResult
getUserUnit
(
@PathVariable
String
userId
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/core/framework/PersonIdentifyAspect.java
View file @
8d83a490
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.maintenance.business.feign.JCSFeignClient
;
import
com.yeejoin.amos.maintenance.business.feign.JCSFeignClient
;
import
com.yeejoin.amos.maintenance.exception.PermissionException
;
import
com.yeejoin.amos.maintenance.exception.PermissionException
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.JoinPoint
;
...
@@ -13,9 +14,9 @@ import org.aspectj.lang.annotation.Before;
...
@@ -13,9 +14,9 @@ import org.aspectj.lang.annotation.Before;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
/**
/**
* @author DELL
* @author DELL
...
@@ -31,20 +32,21 @@ public class PersonIdentifyAspect {
...
@@ -31,20 +32,21 @@ public class PersonIdentifyAspect {
@Autowired
@Autowired
JCSFeignClient
jcsFeignClient
;
JCSFeignClient
jcsFeignClient
;
final
int
HTTP_OK_STATUS
=
200
;
@Before
(
value
=
"@annotation(com.yeejoin.amos.maintenance.core.framework.PersonIdentify) && @annotation(permission)"
)
@Before
(
value
=
"@annotation(com.yeejoin.amos.maintenance.core.framework.PersonIdentify) && @annotation(permission)"
)
public
void
personIdentity
(
JoinPoint
joinPoint
,
PersonIdentify
permission
)
throws
PermissionException
{
public
void
personIdentity
(
JoinPoint
joinPoint
,
PersonIdentify
permission
)
throws
PermissionException
{
ReginParams
reginParam
=
JSON
.
parseObject
(
redisUtils
.
get
(
buildKey
(
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
ReginParams
reginParam
=
JSON
.
parseObject
(
redisUtils
.
get
(
buildKey
(
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
if
(
permission
.
isNeedIdentity
()
&&
reginParam
!=
null
)
{
if
(
permission
.
isNeedIdentity
()
&&
reginParam
!=
null
)
{
//调用jcs,进行人员身份判断,是维保公司人员还是业主单位人员
//调用jcs,进行人员身份判断,是维保公司人员还是业主单位人员
String
userId
=
reginParam
.
getUserModel
().
getUserId
();
String
userId
=
reginParam
.
getUserModel
().
getUserId
();
ResponseModel
<
ReginParams
.
PersonIdentity
>
responseModel
=
jcsFeignClient
.
getUserUnit
(
userId
);
FeignClientResult
responseModel
=
jcsFeignClient
.
getUserUnit
(
userId
);
if
(
responseModel
!=
null
)
{
if
(
ObjectUtils
.
isEmpty
(
responseModel
.
getResult
())
||
responseModel
.
getStatus
()
!=
HTTP_OK_STATUS
)
{
ReginParams
.
PersonIdentity
personIdentity
=
responseModel
.
getResult
();
throw
new
RuntimeException
(
responseModel
.
getDevMessage
());
reginParam
.
setPersonIdentity
(
personIdentity
);
redisUtils
.
set
(
buildKey
(
RequestContext
.
getToken
()),
JSONObject
.
toJSONString
(
reginParam
));
}
else
{
throw
new
RuntimeException
(
"用户信息校验失败"
);
}
}
ReginParams
.
PersonIdentity
personIdentity
=
(
ReginParams
.
PersonIdentity
)
responseModel
.
getResult
();
reginParam
.
setPersonIdentity
(
personIdentity
);
redisUtils
.
set
(
buildKey
(
RequestContext
.
getToken
()),
JSONObject
.
toJSONString
(
reginParam
));
}
}
}
}
...
...
amos-boot-system-maintenance/src/main/resources/application.properties
View file @
8d83a490
...
@@ -35,7 +35,7 @@ equip.feign.name=AMOS-EQUIPMANAGE
...
@@ -35,7 +35,7 @@ equip.feign.name=AMOS-EQUIPMANAGE
equip.feign.prefix
=
/equip
equip.feign.prefix
=
/equip
input.custom.prefix
=
QYZD
input.custom.prefix
=
QYZD
input.statute.prefix
=
FG
input.statute.prefix
=
FG
jcs.fegin.name
=
JCS
-GJQ
jcs.fegin.name
=
JCS
Security.fegin.name
=
AMOS-API-PRIVILEGE
Security.fegin.name
=
AMOS-API-PRIVILEGE
...
...
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