Commit 89564d2b by java-李谡

代码规范

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