Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
data-server
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
licc
data-server
Commits
c93e4f31
Commit
c93e4f31
authored
Jun 11, 2021
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加用户实体类
parent
da2538d0
Pipeline
#368
failed with stages
Changes
12
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
130 additions
and
981 deletions
+130
-981
UsersMapper.java
...mapper/src/main/java/cn/wisenergy/mapper/UsersMapper.java
+0
-219
UsersMapper.xml
wisenergy-mapper/src/main/resources/mapper/UsersMapper.xml
+97
-405
UserRecharge.java
...el/src/main/java/cn/wisenergy/model/app/UserRecharge.java
+21
-0
UserService.java
...e/src/main/java/cn/wisenergy/service/app/UserService.java
+1
-31
UserServiceImpl.java
...n/java/cn/wisenergy/service/app/impl/UserServiceImpl.java
+3
-78
Application.java
...rgy-web-admin/src/main/java/cn/wisenergy/Application.java
+1
-0
UserController.java
...cn/wisenergy/web/admin/controller/app/UserController.java
+4
-20
DataAuthAspect.java
...src/main/java/cn/wisenergy/web/aspect/DataAuthAspect.java
+0
-69
SysLogAspect.java
...n/src/main/java/cn/wisenergy/web/aspect/SysLogAspect.java
+0
-93
WebLogAspect.java
...n/src/main/java/cn/wisenergy/web/aspect/WebLogAspect.java
+0
-63
AuthRealm.java
...rc/main/java/cn/wisenergy/web/shiro/filter/AuthRealm.java
+2
-2
application-dev.yml
wisenergy-web-admin/src/main/resources/application-dev.yml
+1
-1
No files found.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/UsersMapper.java
View file @
c93e4f31
...
...
@@ -6,8 +6,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author 86187
...
...
@@ -41,221 +39,4 @@ public interface UsersMapper extends BaseMapper<Users> {
*/
int
delById
(
@Param
(
"id"
)
Integer
id
);
List
<
Users
>
getList
();
/**
* 获取所有的非普通用户列表
*
* @return 非普通用户列表
*/
List
<
Users
>
findAllNotZeroUser
();
Users
findByName
(
String
name
);
String
findPswByName
(
String
UserName
);
void
save
(
Users
users
);
/**
* 获取用户信息
*
* @return 用户信息
*/
Users
getUserById
(
@Param
(
"id"
)
Long
id
);
/**
* 获取用户信息
*
* @param userId 用户id
* @return 用户信息
*/
Users
getByUserId
(
@Param
(
"userId"
)
String
userId
);
/**
* 获取用户信息
*
* @param userId 用户id
* @return 用户信息
*/
Integer
ByUserId
(
@Param
(
"userId"
)
String
userId
);
/**
* 获取用户信息
*
* @param
* @return 用户信息
*/
Integer
beInvitedCode1
(
@Param
(
"beInvitedCode"
)
String
beInvitedCode
);
/**
* 获取用户信息
*
* @param beInvitedCode 用户被邀请码
* @return 用户信息
*/
Users
getByBeInvitedCode
(
@Param
(
"beInvitedCode"
)
String
beInvitedCode
);
/**
* 获取黄金树以上会员用户
*
* @return
*/
List
<
Users
>
getAllGoldUser
();
/**
* 查询用户
*
* @param param
* @return
*/
public
List
<
Users
>
getUsersListByMap
(
Map
<
String
,
Object
>
param
);
//根据手机号查询用户Integer
Users
queryUsersByPhone
(
@Param
(
"userId"
)
String
userId
);
//根据用户的推荐人邀请码比对推荐人的本人邀请码,查询推荐人的用户ID
Integer
inviteCodeBeInvitedCode
(
@Param
(
"beInvitedCode"
)
Integer
beInvitedCode
);
/**
* 用户注册
*
* @param userId
* @param inviteCode
* @param beInvitedCode
* @param userLevel
*/
Integer
insertbyint
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"inviteCode"
)
String
inviteCode
,
@Param
(
"beInvitedCode"
)
String
beInvitedCode
,
@Param
(
"userLevel"
)
Integer
userLevel
,
@Param
(
"headImage"
)
String
headImage
,
@Param
(
"frozen"
)
Integer
frozen
);
Integer
save
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"beInvitedCode"
)
String
beInvitedCode
);
Users
edit1
(
int
userLevel
,
String
intiveCode
,
String
userId
);
Integer
getuserIdById
(
@Param
(
"userId"
)
String
userId
);
Integer
getById
(
@Param
(
"userId"
)
String
userId
);
String
BYQMById
(
@Param
(
"userId"
)
String
userId
);
/**
* 根据userid获取获取所有的直接推荐人
*
* @param inviteCode 用户本人的邀请码
* @return 所有填写此人的邀请码的用户
*/
List
<
Users
>
getByInviteCode
(
@Param
(
"inviteCode"
)
String
inviteCode
,
@Param
(
"userLevel"
)
int
userLevel
);
/**
* 通过邀请码,获取用户信息
*
* @param inviteCode 邀请码
* @return 用户信息
*/
Users
queryByInviteCode
(
@Param
(
"inviteCode"
)
String
inviteCode
);
/**
* 通过用户等级,获取该等级用户列表
*
* @param userLevel 用户等级
* @return 等级用户列表
*/
List
<
Users
>
getByLevel
(
@Param
(
"userLevel"
)
Integer
userLevel
);
/**
* @param
* @return
*/
Users
biInvitedCode1
(
@Param
(
"inviteCode"
)
String
inviteCode
);
/**
* 用户邀请码查询用户数据
*
* @param inviteCode
* @return
*/
Users
InvitedCode2
(
@Param
(
"inviteCode"
)
String
inviteCode
);
/**
* 根据用户的推荐人邀请码 查询上级用户的id
*
* @param beInvitedCode
* @return
*/
String
getUserByIntiveCode
(
String
beInvitedCode
);
String
getUserIdByIntiveCode
(
String
outerUserId
);
/**
* 获取所有的空投用户
* 且注册时间为一月之前
*
* @return
*/
List
<
Users
>
getAerialDeliveryUserBeforOneMonth
(
@Param
(
"before"
)
String
before
,
@Param
(
"now"
)
String
now
);
/**
* 随机获取一条小于当前id的用户 即: 比当前用户早注册的用户
*
* @param id
* @return
*/
Users
randOneGetUserByUserId
(
Integer
id
);
/**
* 根据邀请码获取所有的下级用户
*
* @param userId
* @return
*/
List
<
Users
>
getListByIntvitedCode
(
String
userId
);
/**
* 根据当前用户的推荐人邀请码获取推荐人的用户信息(上级用户信息)
*
* @param beInvitedCode
* @return
*/
Users
getuserByBeInvitedCode
(
String
beInvitedCode
);
/**
* 获取在团队中处于同一位置的用户集合
*
* @param beInvitedCode
* @return
*/
List
<
Users
>
getListUserByBeInvitedCode
(
String
beInvitedCode
);
/**
* 通过邀请码获取用户信息
*
* @param inviteCode
* @return
*/
Users
getUserByInviteCode
(
String
inviteCode
);
/**
* 根据用户的userid查询用户对象
*
* @param userId
* @return
*/
Users
getUserByUserId
(
String
userId
);
/**
* 分页查询所有用户信息
*
* @param map
* @return
*/
List
<
Users
>
getUserList
(
Map
<
String
,
Object
>
map
);
/**
* 统计用户总记录数
*
* @param map 入参
* @return 结果
*/
int
countUser
(
Map
<
String
,
Object
>
map
);
}
wisenergy-mapper/src/main/resources/mapper/UsersMapper.xml
View file @
c93e4f31
This diff is collapsed.
Click to expand it.
wisenergy-model/src/main/java/cn/wisenergy/model/app/UserRecharge.java
0 → 100644
View file @
c93e4f31
package
cn
.
wisenergy
.
model
.
app
;
import
lombok.Data
;
/**
* @author 86187
*/
@Data
public
class
UserRecharge
{
private
Long
id
;
/**
* 会员id
*/
private
Integer
userId
;
/**
* 币种id
*/
private
Integer
currencyId
;
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/UserService.java
View file @
c93e4f31
...
...
@@ -19,20 +19,9 @@ public interface UserService {
* @param userId 用户id
* @return 用户信息
*/
Users
getById
(
String
userId
);
Users
getById
(
Integer
userId
);
R
<
Integer
>
getById1
(
String
userId
);
Users
getUserById
(
Long
id
);
/**
* 获取用户信息
*
* @param userId 用户id
* @return 用户信息
*/
Users
getByUserId
(
String
userId
);
/**
* 根据手机号查询用户
...
...
@@ -44,23 +33,4 @@ public interface UserService {
*/
Users
queryUsersByOpenId
(
String
openId
);
/**
* 用户登出
*
* @param token
* @return
*/
int
logout
(
String
token
);
Integer
getUserIdById
(
String
userId
);
/**
* 设置用户头像
*
* @param userId 用户id
* @param headImage 头像图片地址
* @return true or false
*/
R
<
Boolean
>
setHeadImage
(
String
userId
,
String
headImage
);
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/UserServiceImpl.java
View file @
c93e4f31
package
cn
.
wisenergy
.
service
.
app
.
impl
;
import
cn.wisenergy.common.utils.*
;
import
cn.wisenergy.mapper.*
;
import
cn.wisenergy.model.app.*
;
import
cn.wisenergy.service.app.UserService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -23,91 +21,18 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, Users> implements
@Autowired
private
UsersMapper
usersMapper
;
@Autowired
private
RedisUtils
redisUtils
;
private
static
final
String
INVITE_CODE
=
"1"
;
@Override
public
Users
getById
(
String
userId
)
{
return
usersMapper
.
getByUserId
(
userId
);
}
@Override
public
R
<
Integer
>
getById1
(
String
userId
)
{
return
R
.
ok
(
usersMapper
.
ByUserId
(
userId
));
}
@Override
public
Users
getUserById
(
Long
id
)
{
return
this
.
usersMapper
.
getUserById
(
id
);
}
@Override
public
Users
getByUserId
(
String
userId
)
{
return
usersMapper
.
getByUserId
(
userId
);
public
Users
getById
(
Integer
userId
)
{
return
null
;
}
@Override
public
Users
queryUsersByPhone
(
String
userId
)
{
//查询数据库,看看是否存在该用户
return
usersMapper
.
getByUserId
(
userId
);
}
@Override
public
Users
queryUsersByOpenId
(
String
id
)
{
return
null
;
}
@Override
public
Integer
getUserIdById
(
String
userI
d
)
{
public
Users
queryUsersByOpenId
(
String
i
d
)
{
return
null
;
}
@Override
public
R
<
Boolean
>
setHeadImage
(
String
userId
,
String
headImage
)
{
log
.
info
(
"shop-mall[]UserServiceImpl[]setHeadImage[]input.param.userId,headImage:"
+
userId
,
headImage
);
if
(
StringUtils
.
isBlank
(
userId
)
||
StringUtils
.
isBlank
(
headImage
))
{
return
R
.
error
(
"入参不能为空!"
);
}
//获取用户信息
Users
users
=
usersMapper
.
getByUserId
(
userId
);
if
(
null
==
users
)
{
return
R
.
error
(
"用户信息不存在!"
);
}
//添加头像
users
.
setHeadImage
(
headImage
);
int
count
=
usersMapper
.
edit
(
users
);
if
(
count
==
0
)
{
return
R
.
error
(
"设置头像失败!"
);
}
return
R
.
ok
(
0
,
true
);
}
/**
* 用户登出
*
* @param token
* @return
*/
@Override
public
int
logout
(
String
token
)
{
int
succ
=
0
;
String
key
=
RedisKeyUtils
.
formatKeyWithPrefix
(
Constants
.
Redis
.
PREFIX_TOKEN
,
token
);
redisUtils
.
delete
(
key
);
if
(
redisUtils
.
getValue
(
key
)
==
null
)
{
succ
=
1
;
}
return
succ
;
}
}
wisenergy-web-admin/src/main/java/cn/wisenergy/Application.java
View file @
c93e4f31
...
...
@@ -10,6 +10,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* 配置netty启动
* @author 86187
*/
@EnableCaching
@SpringBootApplication
(
exclude
=
{
MultipartAutoConfiguration
.
class
})
...
...
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/UserController.java
View file @
c93e4f31
...
...
@@ -41,9 +41,9 @@ public class UserController extends BaseController {
private
RedisUtils
redisUtils
;
@ApiOperation
(
value
=
"获取用户信息"
,
notes
=
"获取用户信息"
,
httpMethod
=
"GET"
)
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户id"
,
dataType
=
"
String
"
)
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户id"
,
dataType
=
"
int
"
)
@GetMapping
(
"/user/getByUserId"
)
public
Users
getByUserId
(
String
userId
)
{
public
Users
getByUserId
(
Integer
userId
)
{
return
userService
.
getById
(
userId
);
}
...
...
@@ -54,13 +54,13 @@ public class UserController extends BaseController {
*/
@ApiOperation
(
value
=
"获取token接口"
,
notes
=
"获取token接口"
,
httpMethod
=
"POST"
)
@PostMapping
(
value
=
"/user/login"
)
public
R
<
String
>
login
(
String
id
)
{
public
R
<
String
>
login
(
Integer
id
)
{
if
(
null
==
id
)
{
return
R
.
error
(
"入参为空!"
);
}
//用户信息
Users
users
=
userService
.
getBy
User
Id
(
id
);
Users
users
=
userService
.
getById
(
id
);
// 创建token
String
token
=
jwtUtil
.
generateToken
(
users
);
...
...
@@ -68,20 +68,4 @@ public class UserController extends BaseController {
redisTemplate
.
opsForValue
().
set
(
RedisConsts
.
JWT_ACCESS_TOKEN
+
token
,
token
);
return
R
.
ok
(
token
);
}
@ApiOperation
(
value
=
"设置头像"
,
notes
=
"设置头像"
,
httpMethod
=
"POST"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户id"
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"headImage"
,
value
=
"头像Url"
,
dataType
=
"String"
)
})
@PostMapping
(
"/user/setHeadImage"
)
public
R
<
Boolean
>
setHeadImage
(
String
userId
,
String
headImage
)
{
log
.
info
(
"shop-mall[]UserController[]setHeadImage[]input.param.userId,headImage:"
+
userId
,
headImage
);
if
(
StringUtils
.
isBlank
(
userId
)
||
StringUtils
.
isBlank
(
headImage
))
{
return
R
.
error
(
"入参不能为空!"
);
}
return
userService
.
setHeadImage
(
userId
,
headImage
);
}
}
wisenergy-web-admin/src/main/java/cn/wisenergy/web/aspect/DataAuthAspect.java
deleted
100644 → 0
View file @
da2538d0
package
cn
.
wisenergy
.
web
.
aspect
;
import
cn.wisenergy.common.annotation.DataAuth
;
import
cn.wisenergy.common.constant.CommonConstants
;
import
cn.wisenergy.common.enums.RespCodeEnum
;
import
cn.wisenergy.common.utils.exception.Result
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.shiro.SecurityUtils
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.lang.reflect.Method
;
import
java.util.Map
;
/**
* 数据权限,切面处理类
*/
@Aspect
@Component
public
class
DataAuthAspect
{
@Autowired
AccountService
sysUserService
;
@Pointcut
(
"@annotation(cn.wisenergy.common.annotation.DataAuth)"
)
public
void
dataPointCut
()
{
}
@Around
(
"dataPointCut()"
)
public
Object
around
(
ProceedingJoinPoint
pjp
)
throws
Throwable
{
MethodSignature
signature
=
(
MethodSignature
)
pjp
.
getSignature
();
Method
method
=
signature
.
getMethod
();
// 获取方法上的注解
DataAuth
dataAuth
=
method
.
getAnnotation
(
DataAuth
.
class
);
if
(
dataAuth
!=
null
)
{
// 获取注解值
String
mapKey
=
dataAuth
.
value
();
// 获取请求参数
Object
[]
args
=
pjp
.
getArgs
();
for
(
Object
obj
:
args
)
{
if
(
obj
instanceof
Map
)
{
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
obj
;
// 获取当前用户
AccountInfo
sysUser
=
(
AccountInfo
)
SecurityUtils
.
getSubject
().
getPrincipal
();
if
(
sysUser
!=
null
)
{
// 超级管理员返回全量数据
if
(!
StringUtils
.
equals
(
sysUser
.
getId
().
toString
(),
CommonConstants
.
SUPER_ADMIN
))
{
// 查询用户的数据权限信息,如果存在数据权限集合,将集合存入请求参数map中
// Set<String> dataAuthList = sysUserService.getUserDataAuth(sysUser);
// if (dataAuthList != null && !dataAuthList.isEmpty()) {
// map.put(mapKey, dataAuthList);
// }
}
return
pjp
.
proceed
();
}
}
}
}
Result
result
=
new
Result
();
result
.
setResult
(
Result
.
RESULT_FLG
.
FAIL
.
getValue
());
result
.
setErrorCode
(
RespCodeEnum
.
DATA_AUTH_UNAUTHORIZED
.
getCode
());
result
.
setErrorMsg
(
RespCodeEnum
.
DATA_AUTH_UNAUTHORIZED
.
getMsg
());
return
result
;
}
}
wisenergy-web-admin/src/main/java/cn/wisenergy/web/aspect/SysLogAspect.java
deleted
100644 → 0
View file @
da2538d0
package
cn
.
wisenergy
.
web
.
aspect
;
import
cn.wisenergy.common.utils.exception.Result
;
import
cn.wisenergy.common.utils.ip.IpUtils
;
import
com.alibaba.fastjson.JSON
;
import
org.apache.shiro.SecurityUtils
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
import
java.lang.reflect.Method
;
import
java.util.Date
;
/**
* 系统日志,切面处理类
*/
@Aspect
@Component
public
class
SysLogAspect
{
// @Autowired
// private SysLogService sysLogService;
//
// @Pointcut("@annotation(cn.wisenergy.common.annotation.SysLog)")
// public void logPointCut() {
// }
//
// @Around("logPointCut()")
// public Object around(ProceedingJoinPoint point) throws Throwable {
// long beginTime = System.currentTimeMillis();
// //执行方法
// Object result = point.proceed();
// //执行时长(毫秒)
// long time = System.currentTimeMillis() - beginTime;
//
// //保存日志
// saveSysLog(point, time, result);
//
// return result;
// }
//
// private void saveSysLog(ProceedingJoinPoint joinPoint, long time,Object result) {
// MethodSignature signature = (MethodSignature) joinPoint.getSignature();
// Method method = signature.getMethod();
//
// SysLogEntity sysLog = new SysLogEntity();
// cn.wisenergy.common.annotation.SysLog syslog = method.getAnnotation(cn.wisenergy.common.annotation.SysLog.class);
// if(syslog != null){
// //注解上的描述
// sysLog.setOperation(syslog.value());
// }
//
// //请求的方法名
// String className = joinPoint.getTarget().getClass().getName();
// String methodName = signature.getName();
// sysLog.setMethod(className + "." + methodName + "()");
//
// //请求的参数
// Object[] args = joinPoint.getArgs();
// String params = JSON.toJSONString(args);
// sysLog.setParams(params);
//
// //返回值
// Result<?> r= (Result<?>) result;
// if("success".equals(r.getResult())) {
// sysLog.setState("成功");
// }else {
// sysLog.setState("失败");
// }
// //获取request
// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
// //设置IP地址
// sysLog.setIp(IpUtils.getIpAddr(request));
// //用户名
// SysUserEntity principal = (SysUserEntity) SecurityUtils.getSubject().getPrincipal();
// String username =principal.getUsername();
// sysLog.setUsername(username);
// sysLog.setTime(time);
// sysLog.setCreateDate(new Date());
// //保存系统日志
// try {
// sysLogService.save(sysLog);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
}
wisenergy-web-admin/src/main/java/cn/wisenergy/web/aspect/WebLogAspect.java
deleted
100644 → 0
View file @
da2538d0
package
cn
.
wisenergy
.
web
.
aspect
;
import
com.alibaba.fastjson.JSON
;
import
lombok.extern.slf4j.Slf4j
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.annotation.*
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
/**
* AOP日志
* @author 86187
*/
@Aspect
@Component
@Slf4j
public
class
WebLogAspect
{
/**
* 两个..代表所有子目录,最后括号里的两个..代表所有参数
*/
@Pointcut
(
"execution( * cn.wisenergy.web.admin.controller..*.*(..))"
)
public
void
logPointCut
()
{
}
@Before
(
"logPointCut()"
)
public
void
doBefore
(
JoinPoint
joinPoint
)
{
// 接收到请求,记录请求内容
ServletRequestAttributes
attributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
HttpServletRequest
request
=
attributes
.
getRequest
();
// 记录下请求内容
log
.
info
(
" ___________________________________________________________"
);
log
.
info
(
"| 请求地址 : {}"
,
request
.
getRequestURL
().
toString
());
log
.
info
(
"| 请求方式 : {}"
,
request
.
getMethod
());
// 获取执行的方法全路径
String
methodName
=
joinPoint
.
getSignature
().
getName
();
log
.
info
(
"| 执行方法 : {}.{}"
,
joinPoint
.
getSignature
().
getDeclaringTypeName
(),
methodName
);
}
/**
* returning的值和doAfterReturning的参数名一致
*/
@AfterReturning
(
returning
=
"ret"
,
pointcut
=
"logPointCut()"
)
public
void
doAfterReturning
(
Object
ret
)
{
// 处理完请求,返回内容
log
.
info
(
"| 返回值 : {}"
,
JSON
.
toJSONString
(
ret
));
log
.
info
(
" ———————————————————————————————————————————"
);
}
@Around
(
"logPointCut()"
)
public
Object
doAround
(
ProceedingJoinPoint
pjp
)
throws
Throwable
{
long
startTime
=
System
.
currentTimeMillis
();
// ob 为方法的返回值
Object
ob
=
pjp
.
proceed
();
log
.
info
(
"| 耗时 : {}"
,
(
System
.
currentTimeMillis
()
-
startTime
));
return
ob
;
}
}
wisenergy-web-admin/src/main/java/cn/wisenergy/web/shiro/filter/AuthRealm.java
View file @
c93e4f31
...
...
@@ -51,7 +51,7 @@ public class AuthRealm extends AuthorizingRealm {
*/
@Override
protected
AuthorizationInfo
doGetAuthorizationInfo
(
PrincipalCollection
principals
)
{
AccountInfo
user
=
(
AccountInfo
)
principals
.
getPrimaryPrincipal
();
Users
user
=
(
Users
)
principals
.
getPrimaryPrincipal
();
String
userId
=
user
.
getId
().
toString
();
//用户权限列表
// Set<String> permsSet = sysUserService.queryAllPerms(userId);
...
...
@@ -98,7 +98,7 @@ public class AuthRealm extends AuthorizingRealm {
throw new IncorrectCredentialsException(RespCodeEnum.TOKEN_IS_NOT_TIMEOUT.getMsg());
}*/
//查询用户信息
Users
users
=
authUserService
.
getBy
UserId
(
usersEntity
.
getUser
Id
());
Users
users
=
authUserService
.
getBy
Id
(
usersEntity
.
get
Id
());
// 判断请求token与redis中是否相同,如果token被刷新,则不判断
if
(!
refreshFlag
&&
!
StringUtils
.
equals
(
accessToken
,
redisToken
))
{
throw
new
IncorrectCredentialsException
(
RespCodeEnum
.
NO_AUTH_REQUEST
.
getMsg
());
...
...
wisenergy-web-admin/src/main/resources/application-dev.yml
View file @
c93e4f31
...
...
@@ -16,7 +16,7 @@ spring:
type
:
com.alibaba.druid.pool.DruidDataSource
druid
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://8.140.102.52:3306/
shop-mall
?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
url
:
jdbc:mysql://8.140.102.52:3306/
yashi
?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
username
:
root
password
:
adm4HYservice$
initial-size
:
10
...
...
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