Commit dd181812 authored by machengbo's avatar machengbo

no message

parent 8ce57638
package com.jz.common.Constant; package com.jz.common.constant;
/** /**
* @ClassName: CommonConstant * @ClassName: CommonConstant
......
package com.jz.common.Enum; package com.jz.common.enums;
/** /**
* 删除标识 * 删除标识
......
package com.jz.common.Enum; package com.jz.common.enums;
/** /**
* 商品数据类型 * 商品数据类型
......
package com.jz.manage.commonsUtils; package com.jz.common.utils;
import java.io.Serializable; import java.io.Serializable;
import java.text.ParseException; import java.text.ParseException;
......
package com.jz.manage.commonsUtils; package com.jz.common.utils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
...@@ -14,7 +14,7 @@ import java.util.concurrent.TimeUnit; ...@@ -14,7 +14,7 @@ import java.util.concurrent.TimeUnit;
* Redis工具类 * Redis工具类
*/ */
@Component @Component
public class RedisUntil { public class RedisUtil {
@Autowired @Autowired
private RedisTemplate<String, Object> redisTemplate; private RedisTemplate<String, Object> redisTemplate;
......
package com.jz.common.utils; package com.jz.common.utils;
import com.jz.common.Constant.CommonConstant; import com.jz.common.constant.CommonConstant;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
......
package com.jz.manage.commonsUtils; package com.jz.common.utils;
import java.awt.*; import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
......
/*
package com.ma.demo.commonsUtils;
import com.ma.demo.service.UserService;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
public class LoginUntil implements Serializable {
private static UserService userService;
static {
userService = SpringApplicationProvider.getBean(UserService.class);
}
public static int loginLog(String userId) throws Exception{
Map map = new HashMap<>();
map.put("userId",userId);
map.put("loginTime", CommonsUtil.getCurrentTime());
map.put("status","01");
map.put("creTime", CommonsUtil.getCurrentTime());
userService.addLoginLog(map);
return 1;
}
public static int loginOutLog(String userId) throws Exception{
Map map = new HashMap<>();
map.put("userId",userId);
map.put("logOutTime", CommonsUtil.getCurrentTime());
map.put("status","02");
map.put("creTime", CommonsUtil.getCurrentTime());
return userService.addLoginOutLog(map);
}
}
*/
/*
package com.ma.demo.config.shiroConfig;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.authc.credential.SimpleCredentialsMatcher;
*/
/*
* 密码比较器
* *//*
public class CredentialMatcher extends SimpleCredentialsMatcher {
@Override
public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) {
UsernamePasswordToken usernamePasswordToken = (UsernamePasswordToken) token;
//获得用登录输入的密码:(可以采用加盐(salt)的方式去检验)
String password = new String(usernamePasswordToken.getPassword());
//获得数据库中的密码
String dbPassword = (String) info.getCredentials();
return this.equals(password, dbPassword);
}
}
*/
/*
package com.ma.demo.config.shiroConfig;
import com.ma.demo.entity.Menu;
import com.ma.demo.entity.Roles;
import com.ma.demo.entity.User;
import com.ma.demo.service.UserService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.shiro.authc.*;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
public class MyShiroRealm extends AuthorizingRealm {
private final static Logger log = LoggerFactory.getLogger(MyShiroRealm.class);
@Autowired
private UserService userService;
*/
/*
*身份认证,登录,获取身份验证信息
* Shiro中,最终是通过 Realm 来获取应用程序中的用户、角色及权限信息的
*//*
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
UsernamePasswordToken utoken = (UsernamePasswordToken) token;//获取用户输入的token
//String userToken = (String) token.getCredentials();
log.info("******用户的token" + token.getPrincipal() + "******");
String username = utoken.getUsername();
log.info(username);
User user = userService.selectByUsername(username);
log.info(user.toString());
//放入shiro.调用CredentialsMatcher检验密码
return new SimpleAuthenticationInfo(user, user.getPassword(), this.getClass().getName());
}
*/
/*
*授权
* @param principals 权限信息 身份集合
* *//*
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
User user = (User) principals.fromRealm(this.getClass().getName()).iterator().next();
List<String> permissionList = new ArrayList();
List<String> roleNameList = new ArrayList();
Set<Roles> roleSet = user.getRoles();
if (CollectionUtils.isNotEmpty(roleSet)) {
for (Roles role : roleSet) {
roleNameList.add(role.getRoleName());
Set<Menu> menusSet = role.getMenus();
if (CollectionUtils.isNotEmpty(menusSet)) {
for (Menu menu : menusSet) {
permissionList.add(menu.getMenuName());
}
}
}
}
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
info.addStringPermissions(permissionList);
info.addRoles(roleNameList);
return info;
}
*/
/**
* 清除当前用户的权限认证缓存
*
* @param principals 权限信息 身份集合
*//*
@Override
public void clearCache(PrincipalCollection principals) {
super.clearCache(principals);
}
}
*/
/*
package com.ma.demo.config.shiroConfig;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Service;
@ConfigurationProperties("hayek.shiro") //指明前缀
@Service
public class ShiroProperties {
private String anonUrl;
private String loginUrl;
private String successUrl;
private String logoutUrl;
private String unauthorizedUrl;
private int cookieTimeout;
private String sessionIdName;
private long sessionTimeout;
public int getCookieTimeout() {
return cookieTimeout;
}
public void setCookieTimeout(int cookieTimeout) {
this.cookieTimeout = cookieTimeout;
}
public String getAnonUrl() {
return anonUrl;
}
public void setAnonUrl(String anonUrl) {
this.anonUrl = anonUrl;
}
public String getLoginUrl() {
return loginUrl;
}
public void setLoginUrl(String loginUrl) {
this.loginUrl = loginUrl;
}
public String getSuccessUrl() {
return successUrl;
}
public void setSuccessUrl(String successUrl) {
this.successUrl = successUrl;
}
public String getLogoutUrl() {
return logoutUrl;
}
public void setLogoutUrl(String logoutUrl) {
this.logoutUrl = logoutUrl;
}
public String getUnauthorizedUrl() {
return unauthorizedUrl;
}
public void setUnauthorizedUrl(String unauthorizedUrl) {
this.unauthorizedUrl = unauthorizedUrl;
}
public String getSessionIdName() {
return sessionIdName;
}
public void setSessionIdName(String sessionIdName) {
this.sessionIdName = sessionIdName;
}
public long getSessionTimeout() {
return sessionTimeout;
}
public void setSessionTimeout(long sessionTimeout) {
this.sessionTimeout = sessionTimeout;
}
public String getExpireIn() {
return expireIn;
}
public void setExpireIn(String expireIn) {
this.expireIn = expireIn;
}
private String expireIn;
}
*/
package com.jz.manage.commonsUtils.intercept; package com.jz.manage.intercept;
import java.lang.annotation.*; import java.lang.annotation.*;
......
/* /*
package com.ma.demo.commonsUtils.intercept; package com.ma.demo.utils.intercept;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.ma.demo.commonsUtils.CommonsUtil; import com.ma.demo.utils.CommonsUtil;
import com.ma.demo.entity.SysOperateLog; import com.ma.demo.entity.SysOperateLog;
import com.ma.demo.entity.User; import com.ma.demo.entity.User;
import com.ma.demo.service.SysOperateLogService; import com.ma.demo.service.SysOperateLogService;
...@@ -41,7 +41,7 @@ public class SystemLogAspect { ...@@ -41,7 +41,7 @@ public class SystemLogAspect {
* Service层切点 * Service层切点
*//* *//*
@Pointcut("@annotation( com.ma.demo.commonsUtils.intercept.SysOperaterLog)") @Pointcut("@annotation( com.ma.demo.utils.intercept.SysOperaterLog)")
public void serviceAspect() { public void serviceAspect() {
} }
......
package com.jz.manage.commonsUtils; package com.jz.manage.utils;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
......
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