Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
V
volunteer_service
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
volunteer_service
Commits
40d7a16c
Commit
40d7a16c
authored
Apr 12, 2021
by
cy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加vip用户增加员工id字段
parent
4979ce8b
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
93 additions
and
63 deletions
+93
-63
StaffAddDto.java
...del/src/main/java/cn/wisenergy/model/dto/StaffAddDto.java
+6
-0
AccountSerivceImpl.java
...ava/cn/wisenergy/service/app/impl/AccountSerivceImpl.java
+13
-11
StaffUserVipServiceImpl.java
...n/wisenergy/service/app/impl/StaffUserVipServiceImpl.java
+34
-12
ShiroConfig.java
...in/java/cn/wisenergy/service/shir/config/ShiroConfig.java
+37
-12
AuthenticationFilter.java
...n/wisenergy/service/shir/filter/AuthenticationFilter.java
+1
-1
SendSmsController.java
...wisenergy/web/admin/controller/app/SendSmsController.java
+1
-1
StaffUserVipController.java
...ergy/web/admin/controller/app/StaffUserVipController.java
+1
-1
FilterConfig.java
...n/src/main/java/cn/wisenergy/web/config/FilterConfig.java
+0
-25
No files found.
wisenergy-model/src/main/java/cn/wisenergy/model/dto/StaffAddDto.java
View file @
40d7a16c
...
...
@@ -46,5 +46,11 @@ public class StaffAddDto {
*/
@ApiModelProperty
(
value
=
"vip客户电话"
,
name
=
"VipMobile"
)
private
String
VipMobile
;
/**
* 员工id
*/
@ApiModelProperty
(
value
=
"员工id"
,
name
=
"staffId"
)
private
Integer
staffId
;
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/AccountSerivceImpl.java
View file @
40d7a16c
...
...
@@ -33,26 +33,23 @@ public class AccountSerivceImpl implements AccountSerivce {
@Override
public
R
<
AccountDto
>
getAccountInfo
(
AccountLoginVo
accountLoginVo
)
{
log
.
info
(
"AccountSerivceImpl[].getAccountInfo[].input.param:accountLoginVo:"
+
accountLoginVo
);
log
.
info
(
"AccountSerivceImpl[].getAccountInfo[].input.param:accountLoginVo:"
+
accountLoginVo
);
if
(
null
==
accountLoginVo
)
{
if
(
null
==
accountLoginVo
)
{
return
R
.
error
(
"账号或密码为空"
);
}
//判断参数是否为空
if
(
StringUtils
.
isEmpty
(
accountLoginVo
.
getUserName
())
||
StringUtils
.
isEmpty
(
accountLoginVo
.
getPassword
()))
{
if
(
StringUtils
.
isEmpty
(
accountLoginVo
.
getUserName
())
||
StringUtils
.
isEmpty
(
accountLoginVo
.
getPassword
()))
{
return
R
.
error
(
"账号或密码为空"
);
}
Subject
subject
=
SecurityUtils
.
getSubject
();
UserToken
userToken
=
new
UserToken
(
accountLoginVo
.
getUserName
(),
accountLoginVo
.
getPassword
(),
ADMIN_LOGIN_TYPE
);
//UsernamePasswordToken token = new UsernamePasswordToken(accountLoginVo.getUserName(),accountLoginVo.getPassword(),"admin" );
/
*/
/创建参数容器map
HashMap<String, Object> map = new HashMap<>(4);
map.put("userName",accountLoginVo.getUserName());
//创建参数容器map
/*
HashMap<String, Object> map = new HashMap<>(4);
map.put("userName",
accountLoginVo.getUserName());
//查询管理者信息
AccountInfo accountInfo = accountMapper.getAccountInfo(map);
if (null
==
accountInfo) {
if (null
==
accountInfo) {
return R.error("用户不存在");
}
...
...
@@ -63,8 +60,13 @@ public class AccountSerivceImpl implements AccountSerivce {
}
//查询超过则进行数据copy
AccountDto accountDto = new AccountDto();
BeanUtils.copyProperties(accountInfo,accountDto);*/
BeanUtils.copyProperties(accountInfo, accountDto);
return R.ok(0, accountDto);*/
//返回数据
Subject
subject
=
SecurityUtils
.
getSubject
();
UserToken
userToken
=
new
UserToken
(
accountLoginVo
.
getUserName
(),
accountLoginVo
.
getPassword
(),
ADMIN_LOGIN_TYPE
);
try
{
subject
.
login
(
userToken
);
kickoutSessionControlFilter
.
changeSession
(
2
);
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/StaffUserVipServiceImpl.java
View file @
40d7a16c
...
...
@@ -89,20 +89,29 @@ public class StaffUserVipServiceImpl extends ServiceImpl<LocalMapper, Local> imp
return
R
.
error
(
"账号或密码为空"
);
}
/*
//创建参数容器map
/*
//创建参数容器map
HashMap<String, Object> map = new HashMap<>(4);
map.put("loginName", loginVo.getLoginName());
//查询管理者信息
Staff staff = staffMapper.getStaff(map);
*/
/*
if (null == staff) {
Staff staff = staffMapper.getStaff(map);
if (null == staff) {
return R.error("用户不存在");
}
if (!staff.getPassword().equals(Md5Util.digestMD5(loginVo.getPassword()))) {
return R.error("账号或者密码错误");
}*/
}
QueryWrapper<Staff> objectQueryWrapper = new QueryWrapper<>();
objectQueryWrapper.eq("login_name",loginVo.getLoginName());
Staff staffInfo = staffMapper.selectOne(objectQueryWrapper);
StaffVo staffVo = new StaffVo();
staffVo.setId(staffInfo.getId());
staffVo.setLoginName(staffInfo.getLoginName());
staffVo.setStaffName(staffInfo.getStaffName());
staffVo.setPhone(staffInfo.getPhone());
staffVo.setSex(staffInfo.getSex());
return R.ok(0, staffVo);*/
Subject
subject
=
SecurityUtils
.
getSubject
();
String
credentialsSalt
=
Md5Util
.
digestMD5
(
loginVo
.
getPassword
()
);
...
...
@@ -241,12 +250,17 @@ public class StaffUserVipServiceImpl extends ServiceImpl<LocalMapper, Local> imp
@Override
public
R
<
Boolean
>
addVipUser
(
StaffAddDto
staffAddDto
)
{
log
.
info
(
"StaffUserVipServiceImpl[].addUserByPhone[].input.param:"
+
staffAddDto
);
if
(
null
==
staffAddDto
){
if
(
null
==
staffAddDto
||
staffAddDto
.
getStaffId
()
==
null
){
return
R
.
error
(
"入参为空"
);
}
if
(!
getUserInfo
(
staffAddDto
.
getVipMobile
())){
return
R
.
error
(
"该电话已存在"
);
}
R
<
Boolean
>
checkScore
=
volunteerManager
.
checkScore
(
staffAddDto
.
getScoreInfo
());
if
(
null
!=
checkScore
&&
checkScore
.
getCode
()
==
ERROR_CODE
)
{
return
R
.
error
(
checkScore
.
getMessage
());
}
User
user
=
new
User
();
user
.
setIsVip
(
1
);
user
.
setSchool
(
staffAddDto
.
getSchool
());
...
...
@@ -257,17 +271,25 @@ public class StaffUserVipServiceImpl extends ServiceImpl<LocalMapper, Local> imp
user
.
setUpdateTime
(
new
Date
());
user
.
setUserName
(
staffAddDto
.
getUserName
());
user
.
setVipMobile
(
staffAddDto
.
getVipMobile
());
usersMapper
.
insert
(
user
);
R
<
Boolean
>
checkScore
=
volunteerManager
.
checkScore
(
staffAddDto
.
getScoreInfo
());
if
(
null
!=
checkScore
&&
checkScore
.
getCode
()
==
ERROR_CODE
)
{
return
R
.
error
(
checkScore
.
getMessage
());
int
addUser
=
usersMapper
.
insert
(
user
);
if
(
addUser
==
0
){
return
R
.
error
(
"添加失败"
);
}
ScoreInfo
scoreInfo
=
staffAddDto
.
getScoreInfo
();
scoreInfo
.
setCreateTime
(
new
Date
());
scoreInfo
.
setUserId
(
user
.
getId
());
scoreInfo
.
setUpdateTime
(
new
Date
());
int
insert
=
scoreInfoMapper
.
insert
(
scoreInfo
);
int
addScore
=
scoreInfoMapper
.
insert
(
scoreInfo
);
if
(
addScore
==
0
){
return
R
.
error
(
"添加失败"
);
}
StaffUserVip
staffUserVip
=
new
StaffUserVip
();
staffUserVip
.
setIsDelete
(
0
);
staffUserVip
.
setStaffId
(
staffAddDto
.
getStaffId
());
staffUserVip
.
setUserVipId
(
user
.
getId
());
staffUserVip
.
setCreateTime
(
new
Date
());
staffUserVip
.
setUpdateTime
(
new
Date
());
int
insert
=
staffUserVipMapper
.
insert
(
staffUserVip
);
if
(
insert
>
0
){
return
R
.
ok
(
0
,
true
);
}
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/shir/config/ShiroConfig.java
View file @
40d7a16c
...
...
@@ -33,6 +33,7 @@ import java.util.Map;
@Configuration
public
class
ShiroConfig
{
//redis地址
@Value
(
"${spring.redis.host}"
)
private
String
host
;
...
...
@@ -49,16 +50,21 @@ public class ShiroConfig {
private
static
final
Integer
expireTime
=
3600
*
2
;
/**
/**
* 创建ShrioFilterFactoryBean
*/
@Bean
(
"shiroFilter"
)
@Bean
(
"shiroFilter"
)
public
ShiroFilterFactoryBean
getShiroFilterFactoryBean
(
DefaultWebSecurityManager
securityManager
){
ShiroFilterFactoryBean
shiroFilterFactoryBean
=
new
ShiroFilterFactoryBean
();
shiroFilterFactoryBean
.
setSecurityManager
(
securityManager
);
//添加shrio内置过滤器
/**
/**
* 常用的过滤器:
* anon:无需认证(登录)就可以访问
* authc:必须认证才能访问
...
...
@@ -66,10 +72,12 @@ public class ShiroConfig {
* perms:该资源必须得到资源权限才能访问
* role:该资源必须得到角色权限才能访问
*/
Map
<
String
,
String
>
filterChainDefinitionMap
=
new
LinkedHashMap
<>();
//自定义拦截器
Map
<
String
,
Filter
>
filtersMap
=
new
LinkedHashMap
<>();
Map
<
String
,
Filter
>
filtersMap
=
new
LinkedHashMap
<>();
filtersMap
.
put
(
"authc"
,
new
AuthenticationFilter
());
filtersMap
.
put
(
"kickout"
,
kickoutSessionControlFilter
());
shiroFilterFactoryBean
.
setFilters
(
filtersMap
);
...
...
@@ -104,12 +112,14 @@ public class ShiroConfig {
filterChainDefinitionMap
.
put
(
"/staffUser/**"
,
"kickout"
);
filterChainDefinitionMap
.
put
(
"/volunteer/**"
,
"kickout"
);
shiroFilterFactoryBean
.
setFilterChainDefinitionMap
(
filterChainDefinitionMap
);
return
shiroFilterFactoryBean
;
}
/**
/**
* 创建DefaultWebSecurityManager
*/
@Bean
public
DefaultWebSecurityManager
securityManager
()
{
DefaultWebSecurityManager
securityManager
=
new
DefaultWebSecurityManager
();
...
...
@@ -127,9 +137,11 @@ public class ShiroConfig {
return
securityManager
;
}
/**
/**
* 创建Realm
*/
@Bean
public
ModularRealmAuthenticator
modularRealmAuthenticator
(){
//自己重写的ModularRealmAuthenticator
...
...
@@ -159,9 +171,11 @@ public class ShiroConfig {
}
/**
/**
* 开启shrio注解
*/
@Bean
public
AuthorizationAttributeSourceAdvisor
authorizationAttributeSourceAdvisor
(
DefaultWebSecurityManager
securityManager
)
{
AuthorizationAttributeSourceAdvisor
advisor
=
new
AuthorizationAttributeSourceAdvisor
();
...
...
@@ -169,9 +183,11 @@ public class ShiroConfig {
return
advisor
;
}
/**
/**
*自定义sessionManager
*/
@Bean
public
MySessionManager
sessionManager
()
{
MySessionManager
mySessionManager
=
new
MySessionManager
();
...
...
@@ -180,10 +196,12 @@ public class ShiroConfig {
}
/**
/**
* 配置shiro redisManager
* 使用的是shiro-redis开源插件
*/
public
IRedisManager
redisManager
()
{
RedisManager
redisManager
=
new
RedisManager
();
redisManager
.
setHost
(
host
);
...
...
@@ -192,10 +210,12 @@ public class ShiroConfig {
redisManager
.
setDatabase
(
5
);
return
redisManager
;
}
/**
/**
* cacheManager 缓存 redis实现
* 使用的是shiro-redis开源插件
*/
@Bean
public
RedisCacheManager
cacheManagers
()
{
RedisCacheManager
redisCacheManager
=
new
RedisCacheManager
();
...
...
@@ -205,12 +225,14 @@ public class ShiroConfig {
return
redisCacheManager
;
}
/**
/**
* RedisSessionDAO shiro sessionDao层的实现 通过redis
* SessionDAO的作用是为Session提供CRUD并进行持久化的一个shiro组件
* MemorySessionDAO 直接在内存中进行会话维护
* EnterpriseCacheSessionDAO 提供了缓存功能的会话维护,默认情况下使用MapCache实现,内部使用ConcurrentHashMap保存缓存的会话。
*/
@Bean
public
RedisSessionDAO
redisSessionDAO
()
{
RedisSessionDAO
redisSessionDAO
=
new
RedisSessionDAO
();
...
...
@@ -219,11 +241,13 @@ public class ShiroConfig {
return
redisSessionDAO
;
}
/**
/**
* 限制同一账号登录同时登录人数控制
*
* @return
*/
@Bean
public
KickoutSessionControlFilter
kickoutSessionControlFilter
()
{
KickoutSessionControlFilter
kickoutSessionControlFilter
=
new
KickoutSessionControlFilter
();
...
...
@@ -234,4 +258,5 @@ public class ShiroConfig {
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/shir/filter/AuthenticationFilter.java
View file @
40d7a16c
...
...
@@ -12,7 +12,7 @@ import java.util.HashMap;
import
java.util.Map
;
/**
*
跨域配置拦截器,继承FormAuthenticationFilter
*
继承FormAuthenticationFilter登录认证
*/
public
class
AuthenticationFilter
extends
FormAuthenticationFilter
{
@Override
...
...
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/SendSmsController.java
View file @
40d7a16c
...
...
@@ -46,7 +46,7 @@ public class SendSmsController {
@ApiImplicitParam
(
name
=
"scene"
,
value
=
"场景类型 1:验证码登录 2:手机注册 3:修改密码 4:找回密码"
,
dataType
=
"int"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"source"
,
value
=
"来源 PC/APP"
,
dataType
=
"String"
,
required
=
true
)
})
@GetMapping
(
"/valid"
)
@GetMapping
(
"/valid"
)
public
R
<
Boolean
>
valid
(
String
phone
,
String
code
,
Integer
scene
,
String
source
)
{
log
.
info
(
"SendSmsController[]valid[]input.param:phone,code,type"
+
phone
,
code
,
scene
);
if
(
StringUtils
.
isBlank
(
phone
)
||
StringUtils
.
isBlank
(
code
)
||
StringUtils
.
isBlank
(
source
)
||
...
...
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/StaffUserVipController.java
View file @
40d7a16c
...
...
@@ -68,7 +68,7 @@ public class StaffUserVipController {
@ApiOperation
(
value
=
"vip客户方案查询"
,
notes
=
"vip客户方案查询"
,
httpMethod
=
"POST"
)
@ApiImplicitParam
(
name
=
"queryVo"
,
value
=
"志愿查询参数"
,
dataType
=
"SchemeVipVo"
)
@PostMapping
(
"/getSchemeList"
)
public
R
<
VolunteerVo
>
getSchemeList
(
SchemeVipVo
queryVo
)
{
public
R
<
VolunteerVo
>
getSchemeList
(
@RequestBody
SchemeVipVo
queryVo
)
{
log
.
info
(
"volunteer-service[]SchemeController[]getList[]input.param.queryVo:"
+
queryVo
);
if
(
null
==
queryVo
)
{
return
R
.
error
(
"入参为空!"
);
...
...
wisenergy-web-admin/src/main/java/cn/wisenergy/web/config/FilterConfig.java
deleted
100644 → 0
View file @
4979ce8b
package
cn
.
wisenergy
.
web
.
config
;
import
org.springframework.boot.web.servlet.FilterRegistrationBean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.filter.DelegatingFilterProxy
;
/**
* Filter配置
*/
@Configuration
public
class
FilterConfig
{
@Bean
public
FilterRegistrationBean
shiroFilterRegistration
()
{
FilterRegistrationBean
registration
=
new
FilterRegistrationBean
();
registration
.
setFilter
(
new
DelegatingFilterProxy
(
"shiroFilter"
));
//该值缺省为false,表示生命周期由SpringApplicationContext管理,设置为true则表示由ServletContainer管理
registration
.
addInitParameter
(
"targetFilterLifecycle"
,
"true"
);
registration
.
setEnabled
(
true
);
registration
.
setOrder
(
Integer
.
MAX_VALUE
-
1
);
registration
.
addUrlPatterns
(
"/*"
);
return
registration
;
}
}
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