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
be739e04
Commit
be739e04
authored
Feb 02, 2024
by
韩桐桐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(两个规定):接口中查询不到当前单位orgCode问题
parent
eaa93019
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
87 deletions
+84
-87
PersonIdentifyTzsAspect.java
...m/yeejoin/amos/patrol/config/PersonIdentifyTzsAspect.java
+84
-87
No files found.
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/config/PersonIdentifyTzsAspect.java
View file @
be739e04
//package com.yeejoin.amos.patrol.config;
package
com
.
yeejoin
.
amos
.
patrol
.
config
;
//
//
//import com.alibaba.fastjson.JSON;
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.RedisKey;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
//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.patrol.business.feign.JcsFeignClient
;
//import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import
com.yeejoin.amos.patrol.exception.PermissionException
;
//import com.yeejoin.amos.patrol.exception.PermissionException;
import
org.apache.commons.lang3.StringUtils
;
//import org.apache.commons.lang3.StringUtils;
import
org.aspectj.lang.JoinPoint
;
//import org.aspectj.lang.JoinPoint;
import
org.aspectj.lang.annotation.Aspect
;
//import org.aspectj.lang.annotation.Aspect;
import
org.aspectj.lang.annotation.Before
;
//import org.aspectj.lang.annotation.Before;
import
org.aspectj.lang.annotation.Pointcut
;
//import org.aspectj.lang.annotation.Pointcut;
import
org.springframework.beans.factory.annotation.Autowired
;
//import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
//import org.springframework.beans.factory.annotation.Value;
import
org.springframework.core.annotation.Order
;
//import org.springframework.core.annotation.Order;
import
org.springframework.stereotype.Component
;
//import org.springframework.http.HttpStatus;
import
org.springframework.web.bind.annotation.ResponseBody
;
//import org.springframework.stereotype.Component;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
//import org.springframework.util.ObjectUtils;
//import org.springframework.web.bind.annotation.ResponseBody;
/**
//import org.typroject.tyboot.core.foundation.context.RequestContext;
* @author DELL
//
*/
///**
@Aspect
// * @author DELL
@Component
// */
@ResponseBody
//@Aspect
@Order
(
value
=
1
)
//@Component
public
class
PersonIdentifyTzsAspect
{
//@ResponseBody
//@Order(value = 1)
@Autowired
//public class PersonIdentifyTzsAspect {
RedisUtils
redisUtils
;
//
@Autowired
// @Autowired
private
JcsFeignClient
jcsFeignClient
;
// RedisUtils redisUtils;
// @Autowired
@Value
(
"${logic}"
)
// private JcsFeignClient jcsFeignClient;
Boolean
logic
;
//
// @Value("${logic}")
@Pointcut
(
"execution(public * com.yeejoin.amos.*.business.controller..*(..))"
)
// Boolean logic;
public
void
userDate
()
{
//
// @Pointcut("execution(public * com.yeejoin.amos.*.business.controller..*(..))")
}
// public void userDate() {
//
// }
@Before
(
"userDate()"
)
//
public
void
personIdentity
(
JoinPoint
joinPoint
)
throws
PermissionException
{
//
// @Before("userDate()")
// public void personIdentity(JoinPoint joinPoint) throws PermissionException {
//定时任务没有token
//
if
(
RequestContext
.
getExeUserId
()==
null
||
RequestContext
.
getToken
()==
null
){
//
// //定时任务没有token
}
else
{
// if(RequestContext.getExeUserId()==null|| RequestContext.getToken()==null){
ReginParams
reginParam
=
JSON
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
//
if
(
reginParam
!=
null
)
{
// }else {
if
(
reginParam
.
getPersonIdentity
()
==
null
||
StringUtils
.
isEmpty
(
reginParam
.
getPersonIdentity
().
getBizOrgCode
())
)
{
// ReginParams reginParam = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String
userId
=
reginParam
.
getUserModel
().
getUserId
();
// if (reginParam != null ) {
// if (reginParam.getPersonIdentity() == null || StringUtils.isEmpty(reginParam.getPersonIdentity().getBizOrgCode()) ) {
if
(
userId
!=
null
)
{
// String userId = reginParam.getUserModel().getUserId();
// FeignClientResult responseModel = jcsFeignClient.selectById(userId);
//
//
// if (userId != null) {
//
//// FeignClientResult responseModel = jcsFeignClient.selectById(userId);
// if (ObjectUtils.isEmpty(responseModel.getResult()) || responseModel.getStatus() != HttpStatus.OK.value()) {
////
// throw new RuntimeException(responseModel.getDevMessage());
////
//// if (ObjectUtils.isEmpty(responseModel.getResult()) || responseModel.getStatus() != HttpStatus.OK.value()) {
//// throw new RuntimeException(responseModel.getDevMessage());
//// }
//// String s = JSONObject.toJSONString(responseModel.getResult());
//// ReginParams.PersonIdentity personIdentity = JSONObject.parseObject(s, ReginParams.PersonIdentity.class);
// ReginParams.PersonIdentity personIdentity = new ReginParams.PersonIdentity();
// // ReginParams.PersonIdentity personIdentity = (ReginParams.PersonIdentity) Bean.mapToBean((Map<String, Object>) responseModel.getResult(), ReginParams.PersonIdentity.class);
// //电力默认走公司权限
// if (!logic) {
// personIdentity.setBizOrgCode(StringUtils.isEmpty(reginParam.getCompany().getOrgCode()) ? "-1" : reginParam.getCompany().getOrgCode());
// }
// }
//
// String s = JSONObject.toJSONString(responseModel.getResult());
// reginParam.setPersonIdentity(personIdentity);
// ReginParams.PersonIdentity personIdentity = JSONObject.parseObject(s, ReginParams.PersonIdentity.class);
// redisUtils.set(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()), JSONObject.toJSONString(reginParam));
ReginParams
.
PersonIdentity
personIdentity
=
new
ReginParams
.
PersonIdentity
();
//
// ReginParams.PersonIdentity personIdentity = (ReginParams.PersonIdentity) Bean.mapToBean((Map<String, Object>) responseModel.getResult(), ReginParams.PersonIdentity.class);
// }
//电力默认走公司权限
// }
// if (!logic) {
// }
personIdentity
.
setBizOrgCode
(
StringUtils
.
isEmpty
(
reginParam
.
getCompany
().
getOrgCode
())
?
"-1"
:
reginParam
.
getCompany
().
getOrgCode
());
// }
// }
// }
//
reginParam
.
setPersonIdentity
(
personIdentity
);
//}
redisUtils
.
set
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
()),
JSONObject
.
toJSONString
(
reginParam
));
//
}
}
}
}
}
}
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