Commit fe6258ae authored by xc's avatar xc

Merge remote-tracking branch 'origin/master'

parents dd821ac1 c1e00cfe
......@@ -61,5 +61,5 @@ public interface BannerMapper extends BaseMapper<Banner> {
*/
int editStatus(@Param("id") Integer id, @Param("status") Integer status);
List<Banner> getTopBanners(@Param("type") Integer type);
List<Banner> getTopBanners(@Param("type") Integer type );
}
......@@ -60,4 +60,6 @@ public interface UsersMapper extends BaseMapper<User> {
List<User> test(@Param("list") List<String> list);
List<User> getUserByStaffId(Map<String, Object> map);
Integer getVipUserNumbers(Map<String, Object> map);
}
......@@ -117,7 +117,10 @@
<include refid="cols_all"/>
from
<include refid="table"/>
where status=1 and type=#{type}
</select>
<update id="editStatus">
......
......@@ -71,7 +71,8 @@
<if test="createTime != null">and create_time &gt;= #{createTime}</if>
<if test="updateTime != null">and #{updateTime} &gt;= update_time</if>
<if test="isVip != null">and is_vip = #{isVip}</if>
<if test="openid != null">and openid =#{openid}</if>
<if test="openid != null">and openid =#{openid},</if>
<if test="vipMobile != null">vip_mobile =#{vipMobile}</if>
</sql>
<insert id="add" parameterType="cn.wisenergy.model.app.User" keyProperty="id" useGeneratedKeys="true">
......@@ -123,16 +124,16 @@
<where>
is_delete=0 and is_vip = 2
<if test="startTime != null">
<if test="startTime != null and startTime !=''">
and create_time
between #{startTime}
</if>
<if test="endTime != null">and #{endTime}</if>
<if test="endTime != null and endTime !=''">and #{endTime}</if>
<if test="userName != null">and user_name like ('%' #{userName} '%')</if>
<if test="userName != null and userName !=''">and user_name like ('%' #{userName} '%')</if>
<if test="phone != null">and phone like ('%' #{phone} '%')</if>
<if test="phone != null and phone !=''">and phone like ('%' #{phone} '%')</if>
order by create_time desc
<if test="pageNo != null">
limit #{pageNo},#{pageSize}
......@@ -205,5 +206,31 @@
</where>
</select>
<select id="getVipUserNumbers" resultType="java.lang.Integer">
SELECT COUNT(id)
FROM
<include refid="table"/>
<where>
is_delete=0 and is_vip = 1
<if test="list != null and (list.size)>0">
and id in
<foreach collection="list" index="index" item="id" separator="," open="(" close=")">
#{id.userVipId}
</foreach>
</if>
<if test="startTime != null">
and create_time
between #{startTime}
</if>
<if test="endTime != null">and #{endTime}</if>
<if test="userName != null">and user_name like ('%' #{userName} '%')</if>
<if test="phone != null">and phone like ('%' #{phone} '%')</if>
</where>
</select>
</mapper>
......@@ -49,9 +49,9 @@ public class Banner implements Serializable {
private Integer isHaveImage;
/**
* 广告类型: 1:顶部广告 2:底部广告
* 广告类型: 1:顶部广告 2:底部广告 3:app
*/
@ApiModelProperty(value = "广告类型: 1:顶部广告 2:底部广告",name = "type")
@ApiModelProperty(value = "广告类型: 1:顶部广告 2:底部广告 3:App",name = "type")
private Integer type;
/**
......@@ -77,4 +77,6 @@ public class Banner implements Serializable {
*/
@ApiModelProperty(value = "标题",name = "title")
private String title;
}
......@@ -21,9 +21,9 @@ public class BannerDto {
/**
* 广告类型: 1:顶部广告 2:底部广告
* 广告类型: 1:顶部广告 2:底部广告 3:App
*/
@ApiModelProperty(value = "广告类型: 1:顶部广告 2:底部广告",name = "type")
@ApiModelProperty(value = "广告类型: 1:顶部广告 2:底部广告 3:App",name = "type")
private Integer type;
/**
......@@ -55,4 +55,6 @@ public class BannerDto {
*/
@ApiModelProperty(value = "标题",name = "title")
private String title;
}
......@@ -46,5 +46,11 @@ public class StaffAddDto {
*/
@ApiModelProperty(value = "vip客户电话", name = "VipMobile")
private String VipMobile;
/**
* 员工id
*/
@ApiModelProperty(value = "员工id", name = "staffId")
private Integer staffId;
}
......@@ -71,4 +71,10 @@ public class UserCommitDto implements Serializable {
@ApiModelProperty(value = "flag:1:添加 2:编辑", name = "scoreInfo")
private Integer flag;
/**
* vip用户电话
*/
@ApiModelProperty(value = "vip用户电话", name = "vipMobile")
private String vipMobile;
}
......@@ -51,4 +51,10 @@ public class UserShowVo implements Serializable {
*/
@ApiModelProperty(value = "学生成绩信息",name = "scoreInfo")
private ScoreInfo scoreInfo;
/**
* vip用户电话
*/
@ApiModelProperty(value = "vip用户电话",name = "VipMobile")
private String VipMobile;
}
......@@ -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);
......
......@@ -26,6 +26,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletResponse;
......@@ -84,7 +85,6 @@ public class SchemeRecordServiceImpl extends ServiceImpl<SchemeRecordMapper, Sch
map.put("userId", queryVo.getUserId());
int total = schemeRecordMapper.count(map);
//根据用户id,查询方案记录列表
List<SchemeQueryRecord> list = schemeRecordMapper.getByUserId(queryVo.getUserId(),
queryVo.getStartNum(), queryVo.getEndNum());
......
......@@ -384,7 +384,6 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
}
//2、获取考生成绩
QueryWrapper<ScoreInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", schemeVo.getUserId());
......@@ -432,10 +431,10 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
if (secondCulture < cultureMin) {
return R.error("很抱歉,客户的成绩不满足报考条件,无法查询!");
}*/
if(cultureGrade<secondRule.getCultureMin()){
return R.error("很抱歉,客户的成绩不满足报考条件,无法查询!");
}
list = getCultureVipList(firstRule,secondRule,cultureGrade, totalMax,totalMin, locals, nameByIds);
if (cultureGrade < secondRule.getCultureMin()) {
return R.error("很抱歉,客户的成绩不满足报考条件,无法查询!");
}
list = getCultureVipList(firstRule, secondRule, cultureGrade, totalMax, totalMin, locals, nameByIds);
}
//(2)美术考生
......@@ -461,10 +460,10 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
if (secondCulture < secondRule.getCultureMin() && secondMajor < secondRule.getProfessionMin()) {
return R.error("很抱歉,客户的成绩不满足报考条件,无法查询!");
}*/
if(cultureGrade < secondRule.getCultureMin() || majorGrade < secondRule.getProfessionMin()){
return R.error("很抱歉,客户的成绩不满足报考条件,无法查询!");
}
list = getArtsVipList( firstRule,secondRule,cultureGrade,majorGrade,totalMax,totalMin, locals, nameByIds);
if (cultureGrade < secondRule.getCultureMin() || majorGrade < secondRule.getProfessionMin()) {
return R.error("很抱歉,客户的成绩不满足报考条件,无法查询!");
}
list = getArtsVipList(firstRule, secondRule, cultureGrade, majorGrade, totalMax, totalMin, locals, nameByIds);
}
//(3)文学编导考生
......@@ -490,10 +489,10 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
if (secondCulture < secondRule.getCultureMin() || secondMajor < secondRule.getProfessionMin()) {
return R.error("很抱歉,客户的专业成绩不满足报考条件,无法查询!");
}*/
if(cultureGrade < secondRule.getCultureMin() || majorGrade < secondRule.getProfessionMin()){
if (cultureGrade < secondRule.getCultureMin() || majorGrade < secondRule.getProfessionMin()) {
return R.error("很抱歉,客户的成绩不满足报考条件,无法查询!");
}
list = getLiteratureVipList(firstRule,secondRule,cultureGrade,majorGrade,totalMax,totalMin, locals, nameByIds);
list = getLiteratureVipList(firstRule, secondRule, cultureGrade, majorGrade, totalMax, totalMin, locals, nameByIds);
}
//(4)体育考生
......@@ -517,12 +516,12 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
double major = Double.parseDouble(schemeVo.getMajorGrade());*/
//计算综合成绩
/* double totalv = major * 750 / 100 * 0.7 + culture * 0.3 - value;*/
if(cultureGrade < secondRule.getCultureMin() || majorGrade < secondRule.getProfessionMin()){
/* double totalv = major * 750 / 100 * 0.7 + culture * 0.3 - value;*/
if (cultureGrade < secondRule.getCultureMin() || majorGrade < secondRule.getProfessionMin()) {
return R.error("很抱歉,客户的成绩不满足报考条件,无法查询!");
}
list = getSportsVipList(firstRule,secondRule,cultureGrade,majorGrade,totalMax,totalMin, locals, nameByIds);
list = getSportsVipList(firstRule, secondRule, cultureGrade, majorGrade, totalMax, totalMin, locals, nameByIds);
}
//4判断是否展示全部方案
......@@ -558,7 +557,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
* @param professionNames 专业名称
* @return vip文化生志愿列表
*/
private List<Volunteer> getCultureVipList(AdmissionRule firstRule, AdmissionRule secondRule,Double cultureGrade, Integer totalMax,Integer totalMin, List<String> locals, List<String> professionNames) {
private List<Volunteer> getCultureVipList(AdmissionRule firstRule, AdmissionRule secondRule, Double cultureGrade, Integer totalMax, Integer totalMin, List<String> locals, List<String> professionNames) {
double cultureMax = firstRule.getCultureMax();
double cultureMin = firstRule.getCultureMin();
......@@ -567,7 +566,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
Map<String, Object> map = new HashMap<>(16);
map.put("professionNames", professionNames);
map.put("locals", locals);
if (cultureGrade < cultureMax && totalMin >= cultureGrade) {
if (cultureGrade <= cultureMax && cultureGrade >= cultureMin) {
map.put("type", SchemeTypeEnums.UNDERGRADUATE_CULTURE.getCode());
map.put("totalMax", totalMax);
map.put("totalMin", totalMin);
......@@ -590,7 +589,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
* @param professionNames 专业名称
* @return 志愿方案列表
*/
private List<Volunteer> getArtsVipList( AdmissionRule firstRule ,AdmissionRule secondRule,Double cultureGrade,Double majorGrade, Integer totalMax,Integer totalMin, List<String> locals,
private List<Volunteer> getArtsVipList(AdmissionRule firstRule, AdmissionRule secondRule, Double cultureGrade, Double majorGrade, Integer totalMax, Integer totalMin, List<String> locals,
List<String> professionNames) {
//本科类比分 = 本年录取分 -去年录取分 + 考生分数
/*double culture = firstRule.getCurrentYearCulture() - firstRule.getCultureMin() + Double.parseDouble(schemeVo.getCultureGrade());
......@@ -607,7 +606,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
map.put("totalMin", totalMin);
list = volunteerMapper.getVolunteerListVip(map);
return list;
}else{
} else {
map.put("type", SchemeTypeEnums.JUNIOR_COLLEGE_ARTS.getCode());
map.put("totalMax", totalMax);
map.put("totalMin", totalMin);
......@@ -640,7 +639,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
* @param professionNames 专业名称
* @return 志愿方案列表
*/
private List<Volunteer> getLiteratureVipList(AdmissionRule firstRule ,AdmissionRule secondRule,Double cultureGrade,Double majorGrade, Integer totalMax,Integer totalMin, List<String> locals,
private List<Volunteer> getLiteratureVipList(AdmissionRule firstRule, AdmissionRule secondRule, Double cultureGrade, Double majorGrade, Integer totalMax, Integer totalMin, List<String> locals,
List<String> professionNames) {
//本科类比分 = 本年录取分 -去年录取分 + 考生分数
/*double culture = firstRule.getCurrentYearCulture() - firstRule.getCultureMin() + Double.parseDouble(queryVo.getCultureGrade());
......@@ -659,7 +658,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
map.put("locals", locals);
list = volunteerMapper.getVolunteerListVip(map);
return list;
}else{
} else {
map.put("type", SchemeTypeEnums.JUNIOR_COLLEGE_LITERATURE.getCode());
map.put("totalMax", totalMax);
map.put("totalMin", totalMin);
......@@ -687,27 +686,27 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
/**
* 获取vip体育生生志愿方案
*
* @param totalMax 考生综合成绩最高分
* @param totalMax 考生综合成绩最高分
* @param firstRule 本科规则
* @param secondRule 专科规
* @param professionNames 专业名称
* @return 志愿方案列表
*/
private List<Volunteer> getSportsVipList(AdmissionRule firstRule ,AdmissionRule secondRule,Double cultureGrade,Double majorGrade, Integer totalMax,Integer totalMin, List<String> locals,
private List<Volunteer> getSportsVipList(AdmissionRule firstRule, AdmissionRule secondRule, Double cultureGrade, Double majorGrade, Integer totalMax, Integer totalMin, List<String> locals,
List<String> professionNames) {
Map<String, Object> map = new HashMap<>(16);
map.put("professionNames", professionNames);
map.put("locals", locals);
//1、考生是否能报取体育本科
List<Volunteer> list = new ArrayList<>();
if (cultureGrade >= firstRule.getCultureMin()&&majorGrade>firstRule.getProfessionMin()) {
if (cultureGrade >= firstRule.getCultureMin() && majorGrade > firstRule.getProfessionMin()) {
map.put("type", SchemeTypeEnums.UNDERGRADUATE_SPORTS.getCode());
map.put("totalMax", totalMax);
map.put("totalMin", totalMin);
map.put("locals", locals);
list = volunteerMapper.getVolunteerListVip(map);
}else{
} else {
map.put("type", SchemeTypeEnums.JUNIOR_COLLEGE_SPORTS.getCode());
map.put("totalMax", totalMax);
map.put("totalMin", totalMin);
......
......@@ -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() );
......@@ -231,7 +240,8 @@ public class StaffUserVipServiceImpl extends ServiceImpl<LocalMapper, Local> imp
PageInfo<UserInfoDto> info = new PageInfo<>();
info.setPageSize(null==queryVo.getPageSize()?0:queryVo.getPageSize());
info.setPageNum(null==queryVo.getPageNo()?0:queryVo.getPageNo());
info.setTotal(usersMapper.getUserNumbers(map));
info.setTotal(usersMapper.getVipUserNumbers(map));
info.setList(list);
return R.ok(info);
......@@ -241,12 +251,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 +272,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);
}
......
......@@ -231,7 +231,7 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
user.setSex(userDto.getSex());
user.setExamType(userDto.getStudentType());
user.setUserName(userDto.getUserName());
user.setVipMobile(userDto.getVipMobile());
//3、要提交的用户的成绩信息
ScoreInfo scoreInfo = scoreInfoMapper.getByUserId(userDto.getUserId());
......@@ -285,7 +285,9 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
userShowVo.setSex(user.getSex());
userShowVo.setStudentType(user.getExamType());
userShowVo.setUserName(user.getUserName());
if(user.getVipMobile()!=null){
userShowVo.setVipMobile(user.getVipMobile());
}
//获取成绩信息
QueryWrapper<ScoreInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", user.getId());
......
......@@ -465,7 +465,7 @@ public class VolunteerManager {
userInfo.setPassword(secret);
userInfo.setIsDelete(0);
userInfo.setSource(source);
userInfo.setIsVip(2);
int count = usersMapper.add(userInfo);
if (count == 0) {
return R.error("考生注册失败!");
......
......@@ -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);
......@@ -109,12 +117,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();
......@@ -132,9 +142,11 @@ public class ShiroConfig {
return securityManager;
}
/**
/**
* 创建Realm
*/
@Bean
public ModularRealmAuthenticator modularRealmAuthenticator(){
//自己重写的ModularRealmAuthenticator
......@@ -164,9 +176,11 @@ public class ShiroConfig {
}
/**
/**
* 开启shrio注解
*/
@Bean
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) {
AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
......@@ -174,9 +188,11 @@ public class ShiroConfig {
return advisor;
}
/**
/**
*自定义sessionManager
*/
@Bean
public MySessionManager sessionManager() {
MySessionManager mySessionManager = new MySessionManager();
......@@ -185,10 +201,12 @@ public class ShiroConfig {
}
/**
/**
* 配置shiro redisManager
* 使用的是shiro-redis开源插件
*/
public IRedisManager redisManager() {
RedisManager redisManager = new RedisManager();
redisManager.setHost(host);
......@@ -197,10 +215,12 @@ public class ShiroConfig {
redisManager.setDatabase(5);
return redisManager;
}
/**
/**
* cacheManager 缓存 redis实现
* 使用的是shiro-redis开源插件
*/
@Bean
public RedisCacheManager cacheManagers() {
RedisCacheManager redisCacheManager = new RedisCacheManager();
......@@ -210,12 +230,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();
......@@ -224,11 +246,13 @@ public class ShiroConfig {
return redisSessionDAO;
}
/**
/**
* 限制同一账号登录同时登录人数控制
*
* @return
*/
@Bean
public KickoutSessionControlFilter kickoutSessionControlFilter() {
KickoutSessionControlFilter kickoutSessionControlFilter = new KickoutSessionControlFilter();
......@@ -239,4 +263,5 @@ public class ShiroConfig {
}
}
......@@ -12,7 +12,7 @@ import java.util.HashMap;
import java.util.Map;
/**
* 跨域配置拦截器,继承FormAuthenticationFilter
* 继承FormAuthenticationFilter登录认证
*/
public class AuthenticationFilter extends FormAuthenticationFilter {
@Override
......
......@@ -78,8 +78,8 @@ public class BannerController {
}
@ApiOperation(value = "获取顶部/底部广告", notes = "获取顶部/底部广告", httpMethod = "GET")
@ApiImplicitParam(name = "type", value = "广告类型:1:顶部 2:底部", dataType = "int", required = true)
@ApiOperation(value = "获取顶部/底部广告/app", notes = "获取顶部/底部广告/app", httpMethod = "GET")
@ApiImplicitParam(name = "type", value = "广告类型:1:顶部 2:底部 3:App", dataType = "int", required = true)
@GetMapping("/getBanners")
public R<List<Banner>> getBanners(Integer type) {
log.info("BannerController[]getBanners[]input.param.type:" + type);
......
......@@ -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) ||
......
......@@ -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("入参为空!");
......
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;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment