Commit 89564d2b by java-李谡

代码规范

parent f07cde2a
......@@ -6,7 +6,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class PathFormat {
private static final Pattern pattern = Pattern.compile("\\{([^\\}]+)\\}", Pattern.CASE_INSENSITIVE);
private static final String TIME = "time";
private static final String FULL_YEAR = "yyyy";
private static final String YEAR = "yy";
......@@ -16,137 +16,123 @@ public class PathFormat {
private static final String MINUTE = "ii";
private static final String SECOND = "ss";
private static final String RAND = "rand";
private static Date currentDate = null;
public static String parse ( String input ) {
Pattern pattern = Pattern.compile( "\\{([^\\}]+)\\}", Pattern.CASE_INSENSITIVE );
public static String parse(String input) {
Matcher matcher = pattern.matcher(input);
PathFormat.currentDate = new Date();
StringBuffer sb = new StringBuffer();
while ( matcher.find() ) {
matcher.appendReplacement(sb, PathFormat.getString( matcher.group( 1 ) ) );
while (matcher.find()) {
matcher.appendReplacement(sb, PathFormat.getString(matcher.group(1)));
}
matcher.appendTail(sb);
return sb.toString();
}
/**
* 格式化路径, 把windows路径替换成标准路径
*
* @param input 待格式化的路径
* @return 格式化后的路径
*/
public static String format ( String input ) {
return input.replace( "\\", "/" );
public static String format(String input) {
return input.replace("\\", "/");
}
public static String parse ( String input, String filename ) {
Pattern pattern = Pattern.compile( "\\{([^\\}]+)\\}", Pattern.CASE_INSENSITIVE );
public static String parse(String input, String filename) {
Matcher matcher = pattern.matcher(input);
String matchStr = null;
PathFormat.currentDate = new Date();
StringBuffer sb = new StringBuffer();
while ( matcher.find() ) {
matchStr = matcher.group( 1 );
if ( matchStr.indexOf( "filename" ) != -1 ) {
filename = filename.replace( "$", "\\$" ).replaceAll( "[\\/:*?\"<>|]", "" );
matcher.appendReplacement(sb, filename );
while (matcher.find()) {
matchStr = matcher.group(1);
if (matchStr.indexOf("filename") != -1) {
filename = filename.replace("$", "\\$").replaceAll("[\\/:*?\"<>|]", "");
matcher.appendReplacement(sb, filename);
} else {
matcher.appendReplacement(sb, PathFormat.getString( matchStr ) );
matcher.appendReplacement(sb, PathFormat.getString(matchStr));
}
}
matcher.appendTail(sb);
return sb.toString();
}
private static String getString ( String pattern ) {
private static String getString(String pattern) {
pattern = pattern.toLowerCase();
// time 处理
if ( pattern.indexOf( PathFormat.TIME ) != -1 ) {
if (pattern.indexOf(PathFormat.TIME) != -1) {
return PathFormat.getTimestamp();
} else if ( pattern.indexOf( PathFormat.FULL_YEAR ) != -1 ) {
} else if (pattern.indexOf(PathFormat.FULL_YEAR) != -1) {
return PathFormat.getFullYear();
} else if ( pattern.indexOf( PathFormat.YEAR ) != -1 ) {
} else if (pattern.indexOf(PathFormat.YEAR) != -1) {
return PathFormat.getYear();
} else if ( pattern.indexOf( PathFormat.MONTH ) != -1 ) {
} else if (pattern.indexOf(PathFormat.MONTH) != -1) {
return PathFormat.getMonth();
} else if ( pattern.indexOf( PathFormat.DAY ) != -1 ) {
} else if (pattern.indexOf(PathFormat.DAY) != -1) {
return PathFormat.getDay();
} else if ( pattern.indexOf( PathFormat.HOUR ) != -1 ) {
} else if (pattern.indexOf(PathFormat.HOUR) != -1) {
return PathFormat.getHour();
} else if ( pattern.indexOf( PathFormat.MINUTE ) != -1 ) {
} else if (pattern.indexOf(PathFormat.MINUTE) != -1) {
return PathFormat.getMinute();
} else if ( pattern.indexOf( PathFormat.SECOND ) != -1 ) {
} else if (pattern.indexOf(PathFormat.SECOND) != -1) {
return PathFormat.getSecond();
} else if ( pattern.indexOf( PathFormat.RAND ) != -1 ) {
return PathFormat.getRandom( pattern );
} else if (pattern.indexOf(PathFormat.RAND) != -1) {
return PathFormat.getRandom(pattern);
}
return pattern;
}
private static String getTimestamp () {
private static String getTimestamp() {
return System.currentTimeMillis() + "";
}
private static String getFullYear () {
return new SimpleDateFormat( "yyyy" ).format( PathFormat.currentDate );
private static String getFullYear() {
return new SimpleDateFormat("yyyy").format(PathFormat.currentDate);
}
private static String getYear () {
return new SimpleDateFormat( "yy" ).format( PathFormat.currentDate );
private static String getYear() {
return new SimpleDateFormat("yy").format(PathFormat.currentDate);
}
private static String getMonth () {
return new SimpleDateFormat( "MM" ).format( PathFormat.currentDate );
private static String getMonth() {
return new SimpleDateFormat("MM").format(PathFormat.currentDate);
}
private static String getDay () {
return new SimpleDateFormat( "dd" ).format( PathFormat.currentDate );
private static String getDay() {
return new SimpleDateFormat("dd").format(PathFormat.currentDate);
}
private static String getHour () {
return new SimpleDateFormat( "HH" ).format( PathFormat.currentDate );
private static String getHour() {
return new SimpleDateFormat("HH").format(PathFormat.currentDate);
}
private static String getMinute () {
return new SimpleDateFormat( "mm" ).format( PathFormat.currentDate );
private static String getMinute() {
return new SimpleDateFormat("mm").format(PathFormat.currentDate);
}
private static String getSecond () {
return new SimpleDateFormat( "ss" ).format( PathFormat.currentDate );
private static String getSecond() {
return new SimpleDateFormat("ss").format(PathFormat.currentDate);
}
private static String getRandom ( String pattern ) {
private static String getRandom(String pattern) {
int length = 0;
pattern = pattern.split( ":" )[ 1 ].trim();
length = Integer.parseInt( pattern );
return ( Math.random() + "" ).replace( ".", "" ).substring( 0, length );
pattern = pattern.split(":")[1].trim();
length = Integer.parseInt(pattern);
return (Math.random() + "").replace(".", "").substring(0, length);
}
public static void main(String[] args) {
......
......@@ -432,13 +432,8 @@ public class GConstants {
if(!dir.endsWith("/")) {
dir += "/";
}
// System.out.println("file.upload.dir: " + dir);
return dir;
}
// public static String getBaseUrl(HttpServletRequest req){
//
// return IMAGE_BASE_URL;
// }
/**
* 获取工程路径
* @return
......
......@@ -33,11 +33,13 @@ import java.util.regex.Pattern;
/**
* SQL工具类
*
* @author poplar.yfyang / thinkgem
* @version 2013-8-28
*/
public class SQLHelper {
private static final Pattern p = Pattern.compile("order\\s*by[\\w|\\W|\\s|\\S]*", Pattern.CASE_INSENSITIVE);
/**
* 对SQL参数(?)设值,参考org.apache.ibatis.executor.parameter.DefaultParameterHandler
*
......@@ -107,7 +109,6 @@ public class SQLHelper {
countSql = "select count(1) from (" + sql + ") tmp_count";
}else{
countSql = "select count(1) from (" + removeOrders(sql) + ") tmp_count";
// countSql = "select count(1) " + removeSelect(removeOrders(sql));
}
Connection conn = connection;
PreparedStatement ps = null;
......@@ -163,26 +164,25 @@ public class SQLHelper {
return sql;
}
}
/**
/**
* 去除qlString的select子句。
* @param hql
* @return
* @param qlString
* @return
*/
@SuppressWarnings("unused")
private static String removeSelect(String qlString){
int beginPos = qlString.toLowerCase().indexOf("from");
return qlString.substring(beginPos);
}
/**
}
/**
* 去除hql的orderBy子句。
* @param hql
* @return
* @param qlString
* @return
*/
private static String removeOrders(String qlString) {
Pattern p = Pattern.compile("order\\s*by[\\w|\\W|\\s|\\S]*", Pattern.CASE_INSENSITIVE);
Matcher m = p.matcher(qlString);
private static String removeOrders(String qlString) {
Matcher m = p.matcher(qlString);
StringBuffer sb = new StringBuffer();
while (m.find()) {
m.appendReplacement(sb, "");
......
......@@ -3,18 +3,18 @@
*/
package com.ejweb.core.utils;
import java.io.Serializable;
import java.security.SecureRandom;
//import java.util.UUID;
import org.activiti.engine.impl.cfg.IdGenerator;
import org.apache.shiro.session.Session;
import org.apache.shiro.session.mgt.eis.SessionIdGenerator;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import java.io.Serializable;
import java.security.SecureRandom;
/**
* 封装各种生成唯一性ID算法的工具类.
*
* @author ThinkGem
* @version 2013-01-15
*/
......@@ -23,17 +23,16 @@ import org.springframework.stereotype.Service;
public class IdGen implements IdGenerator, SessionIdGenerator {
private static SecureRandom random = new SecureRandom();
/**
* 封装JDK自带的UUID, 通过Random数字生成, 中间无-分割.
*/
public static String uuid() {
return IdWorker.getNextId();
// return UUID.randomUUID().toString().replaceAll("-", "");
}
/**
* 使用SecureRandom随机生成Long.
* 使用SecureRandom随机生成Long.
*/
public static long randomLong() {
return Math.abs(random.nextLong());
......@@ -47,29 +46,18 @@ public class IdGen implements IdGenerator, SessionIdGenerator {
random.nextBytes(randomBytes);
return Encodes.encodeBase62(randomBytes);
}
/**
* Activiti ID 生成
*/
@Override
public String getNextId() {
return IdWorker.getNextId();
// return IdGen.uuid();
}
@Override
public Serializable generateId(Session session) {
return IdWorker.getNextId();
// return IdGen.uuid();
}
// public static void main(String[] args) {
// System.out.println(IdGen.uuid());
// System.out.println(IdGen.uuid().length());
// System.out.println(new IdGen().getNextId());
// for (int i=0; i<1000; i++){
// System.out.println(IdGen.randomLong() + " " + IdGen.randomBase62(5));
// }
// }
}
......@@ -6,7 +6,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class PathFormatUtils {
private static final Pattern pattern = Pattern.compile("\\{([^\\}]+)\\}", Pattern.CASE_INSENSITIVE);
private static final String TIME = "time";
private static final String FULL_YEAR = "yyyy";
private static final String YEAR = "yy";
......@@ -16,142 +16,111 @@ public class PathFormatUtils {
private static final String MINUTE = "ii";
private static final String SECOND = "ss";
private static final String RAND = "rand";
private static Date currentDate = null;
public static String parse ( String input ) {
Pattern pattern = Pattern.compile( "\\{([^\\}]+)\\}", Pattern.CASE_INSENSITIVE );
public static String parse(String input) {
Matcher matcher = pattern.matcher(input);
PathFormatUtils.currentDate = new Date();
StringBuffer sb = new StringBuffer();
while ( matcher.find() ) {
matcher.appendReplacement(sb, PathFormatUtils.getString( matcher.group( 1 ) ) );
while (matcher.find()) {
matcher.appendReplacement(sb, PathFormatUtils.getString(matcher.group(1)));
}
matcher.appendTail(sb);
return sb.toString();
}
/**
* 格式化路径, 把windows路径替换成标准路径
*
* @param input 待格式化的路径
* @return 格式化后的路径
*/
public static String format ( String input ) {
return input.replace( "\\", "/" );
public static String format(String input) {
return input.replace("\\", "/");
}
public static String parse ( String input, String filename ) {
Pattern pattern = Pattern.compile( "\\{([^\\}]+)\\}", Pattern.CASE_INSENSITIVE );
public static String parse(String input, String filename) {
Matcher matcher = pattern.matcher(input);
String matchStr = null;
PathFormatUtils.currentDate = new Date();
StringBuffer sb = new StringBuffer();
while ( matcher.find() ) {
matchStr = matcher.group( 1 );
if ( matchStr.indexOf( "filename" ) != -1 ) {
filename = filename.replace( "$", "\\$" ).replaceAll( "[\\/:*?\"<>|]", "" );
matcher.appendReplacement(sb, filename );
while (matcher.find()) {
matchStr = matcher.group(1);
if (matchStr.indexOf("filename") != -1) {
filename = filename.replace("$", "\\$").replaceAll("[\\/:*?\"<>|]", "");
matcher.appendReplacement(sb, filename);
} else {
matcher.appendReplacement(sb, PathFormatUtils.getString( matchStr ) );
matcher.appendReplacement(sb, PathFormatUtils.getString(matchStr));
}
}
matcher.appendTail(sb);
return sb.toString();
}
private static String getString ( String pattern ) {
private static String getString(String pattern) {
pattern = pattern.toLowerCase();
// time 处理
if ( pattern.indexOf( PathFormatUtils.TIME ) != -1 ) {
if (pattern.indexOf(PathFormatUtils.TIME) != -1) {
return PathFormatUtils.getTimestamp();
} else if ( pattern.indexOf( PathFormatUtils.FULL_YEAR ) != -1 ) {
} else if (pattern.indexOf(PathFormatUtils.FULL_YEAR) != -1) {
return PathFormatUtils.getFullYear();
} else if ( pattern.indexOf( PathFormatUtils.YEAR ) != -1 ) {
} else if (pattern.indexOf(PathFormatUtils.YEAR) != -1) {
return PathFormatUtils.getYear();
} else if ( pattern.indexOf( PathFormatUtils.MONTH ) != -1 ) {
} else if (pattern.indexOf(PathFormatUtils.MONTH) != -1) {
return PathFormatUtils.getMonth();
} else if ( pattern.indexOf( PathFormatUtils.DAY ) != -1 ) {
} else if (pattern.indexOf(PathFormatUtils.DAY) != -1) {
return PathFormatUtils.getDay();
} else if ( pattern.indexOf( PathFormatUtils.HOUR ) != -1 ) {
} else if (pattern.indexOf(PathFormatUtils.HOUR) != -1) {
return PathFormatUtils.getHour();
} else if ( pattern.indexOf( PathFormatUtils.MINUTE ) != -1 ) {
} else if (pattern.indexOf(PathFormatUtils.MINUTE) != -1) {
return PathFormatUtils.getMinute();
} else if ( pattern.indexOf( PathFormatUtils.SECOND ) != -1 ) {
} else if (pattern.indexOf(PathFormatUtils.SECOND) != -1) {
return PathFormatUtils.getSecond();
} else if ( pattern.indexOf( PathFormatUtils.RAND ) != -1 ) {
return PathFormatUtils.getRandom( pattern );
} else if (pattern.indexOf(PathFormatUtils.RAND) != -1) {
return PathFormatUtils.getRandom(pattern);
}
return pattern;
}
private static String getTimestamp () {
private static String getTimestamp() {
return System.currentTimeMillis() + "";
}
private static String getFullYear () {
return new SimpleDateFormat( "yyyy" ).format( PathFormatUtils.currentDate );
}
private static String getYear () {
return new SimpleDateFormat( "yy" ).format( PathFormatUtils.currentDate );
}
private static String getMonth () {
return new SimpleDateFormat( "MM" ).format( PathFormatUtils.currentDate );
private static String getFullYear() {
return new SimpleDateFormat("yyyy").format(PathFormatUtils.currentDate);
}
private static String getDay () {
return new SimpleDateFormat( "dd" ).format( PathFormatUtils.currentDate );
private static String getYear() {
return new SimpleDateFormat("yy").format(PathFormatUtils.currentDate);
}
private static String getHour () {
return new SimpleDateFormat( "HH" ).format( PathFormatUtils.currentDate );
private static String getMonth() {
return new SimpleDateFormat("MM").format(PathFormatUtils.currentDate);
}
private static String getMinute () {
return new SimpleDateFormat( "mm" ).format( PathFormatUtils.currentDate );
private static String getDay() {
return new SimpleDateFormat("dd").format(PathFormatUtils.currentDate);
}
private static String getSecond () {
return new SimpleDateFormat( "ss" ).format( PathFormatUtils.currentDate );
private static String getHour() {
return new SimpleDateFormat("HH").format(PathFormatUtils.currentDate);
}
private static String getRandom ( String pattern ) {
int length = 0;
pattern = pattern.split( ":" )[ 1 ].trim();
length = Integer.parseInt( pattern );
return ( Math.random() + "" ).replace( ".", "" ).substring( 0, length );
private static String getMinute() {
return new SimpleDateFormat("mm").format(PathFormatUtils.currentDate);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
private static String getSecond() {
return new SimpleDateFormat("ss").format(PathFormatUtils.currentDate);
}
private static String getRandom(String pattern) {
int length = 0;
pattern = pattern.split(":")[1].trim();
length = Integer.parseInt(pattern);
return (Math.random() + "").replace(".", "").substring(0, length);
}
}
......@@ -31,6 +31,8 @@ import java.util.regex.Pattern;
@Service
@Transactional(readOnly = true)
public class VerifyService extends CrudService<VerifyDao, VerifyEntity> {
private static final Pattern pattern = Pattern.compile("[0-9]*");
@Autowired
private VerifyDao verifyDao;
@Autowired
......@@ -71,7 +73,9 @@ public class VerifyService extends CrudService<VerifyDao, VerifyEntity> {
} else {
Integer day = verifyDao.getDay(entity);
if (day != null) {
if (day <= 0) day = 0;
if (day <= 0) {
day = 0;
}
day = 90 - day;
if (day < 0) {
entity.setExpiryDate("0");
......@@ -113,7 +117,6 @@ public class VerifyService extends CrudService<VerifyDao, VerifyEntity> {
}
public boolean isNumeric(String str) {
Pattern pattern = Pattern.compile("[0-9]*");
Matcher isNum = pattern.matcher(str);
if (!isNum.matches()) {
return false;
......@@ -124,15 +127,15 @@ public class VerifyService extends CrudService<VerifyDao, VerifyEntity> {
@Transactional(readOnly = false)
public String saveVerify(VerifyEntity verifyEntity) {
String verifNo = verifyEntity.getVerifNo();
if (null!=verifNo&& ""!=verifNo){
if (null != verifNo && "" != verifNo) {
List<VerifyEntity> validator = verifyDao.findverifNo(verifyEntity);
if (validator.size()!=0){
if (validator.size() != 0) {
return "1";
}
}
VerifyUpdateUserEntity vue=new VerifyUpdateUserEntity();
VerifyUpdateUserEntity vue = new VerifyUpdateUserEntity();
VerifyEntity verifyDao2 = verifyDao.get2(verifyEntity.getId());
if (verifyDao2!=null){
if (verifyDao2 != null) {
vue.setId(verifyEntity.getId());
vue.setOperateUser(verifyEntity.getOperateUser());
vue.setReason(verifyEntity.getReason());
......@@ -155,7 +158,7 @@ public class VerifyService extends CrudService<VerifyDao, VerifyEntity> {
// 如果不是航线则结束
if ("06".equals(verifyEntity.getVerifType()) || "07".equals(verifyEntity.getVerifType())
|| "08".equals(verifyEntity.getVerifType())) {
return"";
return "";
}
ConnectEntity connect = new ConnectEntity();
connect.preInsert(); // 生成id
......@@ -189,7 +192,7 @@ public class VerifyService extends CrudService<VerifyDao, VerifyEntity> {
verif.setAreaSt(verifyEntity.getAreaSt());
verif.setFlightNo(verifyEntity.getFlightNo());
verifyDao.update(verifyEntity);
return"";
return "";
}
// 判断是否主数据
else if ("1".equals(verifyEntity.getConnect().getIsMain())) {
......@@ -206,11 +209,10 @@ public class VerifyService extends CrudService<VerifyDao, VerifyEntity> {
connect.setFlightNo(verifyEntity.getFlightNo());
connectDao.update(verifyEntity.getConnect());
}
return"";
return "";
}
public List<VerifyEntity> CheckValidator(VerifyEntity verifyEntity) {
return verifyDao.findValidator(verifyEntity);
}
......
......@@ -16,47 +16,46 @@ import java.util.List;
@Service
@Transactional(readOnly = true)
public class GroupChatService extends CrudService<GroupChatDao,GroupChatEntity> {
public class GroupChatService extends CrudService<GroupChatDao, GroupChatEntity> {
@Autowired
private GroupChatDao dao;
public Page<GroupChatEntity> findList(Page<GroupChatEntity> page, GroupChatEntity groupSeatEntity) {
groupSeatEntity.setPage(page);
PageHelper.startPage(page.getPageNo(), page.getPageSize());
List<GroupChatEntity> list=dao.findList(groupSeatEntity);
List<GroupChatEntity> list = dao.findList(groupSeatEntity);
page.setList(list);
return page;
}
public List<GroupMemberEntity> getMemberList(GroupChatEntity entity) {
List<GroupMemberEntity> list = dao.getMemberList(entity);
/* for(GroupMemberEntity e:list){
GroupMemberEntity user=dao.getMember(e.getId());
}*/
List<GroupMemberEntity> list = dao.getMemberList(entity);
return list;
}
public GroupMemberEntity getSeatMember(GroupChatEntity entity) {
return dao.getSeatMember(entity);
return dao.getSeatMember(entity);
}
public Page<GroupMemberEntity> findChatList(Page<GroupChatEntity> page,Page<GroupMemberEntity> pages, GroupChatEntity groupChatEntity) {
public Page<GroupMemberEntity> findChatList(Page<GroupChatEntity> page, Page<GroupMemberEntity> pages, GroupChatEntity groupChatEntity) {
groupChatEntity.setPage(page);
PageHelper.startPage(page.getPageNo(), page.getPageSize());
List<GroupMemberEntity> list=dao.findChatList(groupChatEntity);
List<GroupMemberEntity> list = dao.findChatList(groupChatEntity);
for(GroupMemberEntity e:list){
if("TXT".equals(e.getMessageType())){
for (GroupMemberEntity e : list) {
if ("TXT".equals(e.getMessageType())) {
continue;
}
switch(e.getMessageType()){
switch (e.getMessageType()) {
case "PIC":
case "FILE":
case "VOICE":
case "VIDEO":
String content=e.getContent();
content=content.substring(11);
ContentEntity data= JSON.parseObject(content,ContentEntity.class);
String content = e.getContent();
content = content.substring(11);
ContentEntity data = JSON.parseObject(content, ContentEntity.class);
e.setData(data);
break;
default:
......
......@@ -55,6 +55,7 @@ import com.ejweb.modules.sys.utils.UserUtils;
@Controller
@RequestMapping(value = "${adminPath}/contact/airportBase")
public class AirportBaseController extends BaseController{
private static final Pattern pattern = Pattern.compile("\\d+\\.\\d+$|-\\d+\\.\\d+$");
@Autowired
private AirportBaseService airportBaseService;
@Autowired
......@@ -290,8 +291,6 @@ public class AirportBaseController extends BaseController{
}
private Map<String,Integer> getDate(String time){
Map<String,Integer> map = new HashMap<>();
Pattern pattern = Pattern.compile("\\d+\\.\\d+$|-\\d+\\.\\d+$");
Matcher isNum = pattern.matcher(time);
if( isNum.matches() ){
Double d18=Double.parseDouble(time);
......
......@@ -33,8 +33,6 @@ import com.google.common.collect.Maps;
/**
* 登录Controller
* @author ThinkGem
* @version 2013-5-31
*/
@Controller
public class LoginController extends BaseController{
......@@ -49,12 +47,6 @@ public class LoginController extends BaseController{
public String login(HttpServletRequest request, HttpServletResponse response, Model model) {
Principal principal = UserUtils.getPrincipal();
// // 默认页签模式
// String tabmode = CookieUtils.getCookie(request, "tabmode");
// if (tabmode == null){
// CookieUtils.setCookie(response, "tabmode", "1");
// }
CookieUtils.setCookie(response, "tabmode", GConstants.getValue("tabmode", "1"));
if (logger.isDebugEnabled()){
......@@ -70,12 +62,6 @@ public class LoginController extends BaseController{
if(principal != null && !principal.isMobileLogin()){
return "redirect:" + adminPath;
}
// String view;
// view = "/WEB-INF/views/modules/sys/sysLogin.jsp";
// view = "classpath:";
// view += "jar:file:/D:/GitHub/jeesite/src/main/webapp/WEB-INF/lib/jeesite.jar!";
// view += "/"+getClass().getName().replaceAll("\\.", "/").replace(getClass().getSimpleName(), "")+"view/sysLogin";
// view += ".jsp";
return "modules/sys/sysLogin";
}
......@@ -111,20 +97,16 @@ public class LoginController extends BaseController{
logger.debug("login fail, active session size: {}, message: {}, exception: {}",
sessionDAO.getActiveSessions(false).size(), message, exception);
}
// 非授权异常,登录失败,验证码加1。
if (!UnauthorizedException.class.getName().equals(exception)){
model.addAttribute("isValidateCodeLogin", isValidateCodeLogin(username, true, false));
}
// 验证失败清空验证码
request.getSession().setAttribute(ValidateCodeServlet.VALIDATE_CODE, IdGen.uuid());
// 如果是手机登录,则返回JSON字符串
if (mobile){
return renderString(response, model);
}
return "modules/sys/sysLogin";
}
......@@ -165,40 +147,10 @@ public class LoginController extends BaseController{
return "redirect:" + adminPath + "/login";
}
// // 登录成功后,获取上次登录的当前站点ID
// UserUtils.putCache("siteId", StringUtils.toLong(CookieUtils.getCookie(request, "siteId")));
// System.out.println("==========================a");
// try {
// byte[] bytes = com.ejweb.core.utils.FileUtils.readFileToByteArray(
// com.ejweb.core.utils.FileUtils.getFile("c:\\sxt.dmp"));
// UserUtils.getSession().setAttribute("kkk", bytes);
// UserUtils.getSession().setAttribute("kkk2", bytes);
// } catch (Exception e) {
// e.printStackTrace();
// }
//// for (int i=0; i<1000000; i++){
//// //UserUtils.getSession().setAttribute("a", "a");
//// request.getSession().setAttribute("aaa", "aa");
//// }
// System.out.println("==========================b");
return "modules/sys/sysIndex";
}
/**
* 获取主题方案
*/
// @RequestMapping(value = "/theme/{theme}")
// public String getThemeInCookie(@PathVariable String theme, HttpServletRequest request, HttpServletResponse response){
// if (StringUtils.isNotBlank(theme)){
// CookieUtils.setCookie(response, "theme", theme);
// }else{
// theme = CookieUtils.getCookie(request, "theme");
// }
// return "redirect:"+request.getParameter("url");
// }
/**
* 是否是验证码登录
* @param useruame 用户名
* @param isFail 计数加1
......
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