提交 476a8172 编写于 作者: zlt2000's avatar zlt2000

change author

上级 d89b0a75
......@@ -18,8 +18,8 @@ import java.util.concurrent.TimeUnit;
/**
* 支持redis cluster模式
*
* @author zlt
* @date 2018/7/27 11:33
* @author owen 624191343@qq.com
* @version 创建时间:2017年11月12日 上午22:57:51
*/
@Slf4j
public class RedisTemplateTokenStore implements TokenStore {
......
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;
}
}
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();
}
}
......@@ -7,7 +7,8 @@ import org.springframework.stereotype.Component;
/**
* spring获取bean工具类
* @author zlt
*
* @author 作者 owen E-mail: 624191343@qq.com
*/
@Component
public class SpringUtil implements ApplicationContextAware {
......
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,12 +4,13 @@ import com.didispace.swagger.butler.EnableSwaggerButler;
import org.springframework.context.annotation.Configuration;
/**
* @author zlt
* swagger 聚合文档配置
* zuul routers 映射具体服务的/v2/api-docs swagger
* zuul routers 映射具体服务的/v2/api-docs swagger
*
* @author 作者 owen E-mail: 624191343@qq.com
*/
@Configuration
@EnableSwaggerButler
public class SwaggerConfig {
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册