change author
This commit is contained in:
+2
-2
@@ -18,8 +18,8 @@ import java.util.concurrent.TimeUnit;
|
|||||||
/**
|
/**
|
||||||
* 支持redis cluster模式
|
* 支持redis cluster模式
|
||||||
*
|
*
|
||||||
* @author zlt
|
* @author owen 624191343@qq.com
|
||||||
* @date 2018/7/27 11:33
|
* @version 创建时间:2017年11月12日 上午22:57:51
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class RedisTemplateTokenStore implements TokenStore {
|
public class RedisTemplateTokenStore implements TokenStore {
|
||||||
|
|||||||
-32
@@ -1,32 +0,0 @@
|
|||||||
package com.central.common.utils;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 日期处理
|
|
||||||
*
|
|
||||||
* @author zlt
|
|
||||||
*/
|
|
||||||
public class DateUtils {
|
|
||||||
private DateUtils() {
|
|
||||||
throw new IllegalStateException("Utility class");
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 时间格式(yyyy-MM-dd) */
|
|
||||||
public final static String DATE_PATTERN = "yyyy-MM-dd";
|
|
||||||
/** 时间格式(yyyy-MM-dd HH:mm:ss) */
|
|
||||||
public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
|
|
||||||
|
|
||||||
public static String format(Date date) {
|
|
||||||
return format(date, DATE_PATTERN);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String format(Date date, String pattern) {
|
|
||||||
if(date != null){
|
|
||||||
SimpleDateFormat df = new SimpleDateFormat(pattern);
|
|
||||||
return df.format(date);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-32
@@ -1,32 +0,0 @@
|
|||||||
package com.central.common.utils;
|
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author zlt
|
|
||||||
* 正则表达式手机号码校验类
|
|
||||||
*/
|
|
||||||
public class PhoneUtil {
|
|
||||||
private PhoneUtil() {
|
|
||||||
throw new IllegalStateException("Utility class");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String REGEX = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(17[013678])|(18[0,5-9]))\\d{8}$";
|
|
||||||
private static Pattern P = Pattern.compile(REGEX);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 校验手机号
|
|
||||||
*
|
|
||||||
* @param phone
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static boolean checkPhone(String phone) {
|
|
||||||
if (phone == null || phone.length() != 11) {
|
|
||||||
return Boolean.FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Matcher m = P.matcher(phone);
|
|
||||||
return m.matches();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+2
-1
@@ -7,7 +7,8 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* spring获取bean工具类
|
* spring获取bean工具类
|
||||||
* @author zlt
|
*
|
||||||
|
* @author 作者 owen E-mail: 624191343@qq.com
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class SpringUtil implements ApplicationContextAware {
|
public class SpringUtil implements ApplicationContextAware {
|
||||||
|
|||||||
-38
@@ -1,38 +0,0 @@
|
|||||||
package com.central.common.utils;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import com.central.common.model.SysUser;
|
|
||||||
import org.springframework.security.core.Authentication;
|
|
||||||
|
|
||||||
import com.central.common.model.LoginAppUser;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取用户信息
|
|
||||||
*
|
|
||||||
* @author zlt
|
|
||||||
*/
|
|
||||||
public class SysUserUtil {
|
|
||||||
private SysUserUtil() {
|
|
||||||
throw new IllegalStateException("Utility class");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LoginAppUser getLoginAppUser(SysUser user) {
|
|
||||||
LoginAppUser login = new LoginAppUser();
|
|
||||||
BeanUtil.copyProperties(user, login);
|
|
||||||
return login;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取登陆的用户名
|
|
||||||
*/
|
|
||||||
public static String getUsername(Authentication authentication) {
|
|
||||||
Object principal = authentication.getPrincipal();
|
|
||||||
String username = null;
|
|
||||||
if (principal instanceof SysUser) {
|
|
||||||
username = ((SysUser) principal).getUsername();
|
|
||||||
} else if (principal instanceof String) {
|
|
||||||
username = (String) principal;
|
|
||||||
}
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+4
-3
@@ -4,12 +4,13 @@ import com.didispace.swagger.butler.EnableSwaggerButler;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zlt
|
|
||||||
* swagger 聚合文档配置
|
* swagger 聚合文档配置
|
||||||
* zuul routers 映射具体服务的/v2/api-docs swagger
|
* zuul routers 映射具体服务的/v2/api-docs swagger
|
||||||
|
*
|
||||||
|
* @author 作者 owen E-mail: 624191343@qq.com
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableSwaggerButler
|
@EnableSwaggerButler
|
||||||
public class SwaggerConfig {
|
public class SwaggerConfig {
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user