Commit 300f3d9e authored by yanzg's avatar yanzg

消除成功接收处理

parent d353d6f7
......@@ -447,7 +447,7 @@ public class DateHelper {
/**
* 增加月份处理
*
* @param date 当前日期
* @param date 当前日期
* @param month 需要增加的月份
* @return 增加之后的值
*/
......@@ -462,7 +462,7 @@ public class DateHelper {
* 增加日期处理
*
* @param date 当前日期
* @param day 需要增加的日期
* @param day 需要增加的日期
* @return 增加之后的值
*/
public static Date addDay(Date date, int day) {
......@@ -619,4 +619,18 @@ public class DateHelper {
public static String toYear(Date time) {
return getDateTimeString("yyyy-01-01", time);
}
/**
* 判断是否时时间格式字符串
*
* @param from 来源字符串
* @return 是否时时间字符串
*/
public static boolean isDateFormat(String from) {
try {
return DateAutoHelper.getAutoDate(from) != null;
} catch (Exception ex) {
return false;
}
}
}
......@@ -5,10 +5,12 @@ import com.yanzuoguang.dao.DaoConst;
import com.yanzuoguang.db.Impl.AllBeanRowMapper;
import com.yanzuoguang.util.base.ObjectHelper;
import com.yanzuoguang.util.exception.CodeException;
import com.yanzuoguang.util.helper.DateHelper;
import com.yanzuoguang.util.helper.StringHelper;
import com.yanzuoguang.util.vo.InitDao;
import com.yanzuoguang.util.vo.MapRow;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -309,14 +311,25 @@ public abstract class BaseDaoImpl extends BaseDaoSql implements BaseDao {
protected <T extends Object> String getMd5(String sqlName, T model) {
SqlData sql = this.getSql(sqlName);
StringBuilder sb = new StringBuilder();
String date = StringHelper.EMPTY;
for (SqlDataField field : sql.sqlDataFields) {
if (sb.length() > 0) {
sb.append(":");
}
Object item = ObjectHelper.get(model, field.paraName);
String itemString = String.valueOf(item);
if (item instanceof Date) {
date = DateHelper.getDateTimeString((Date) item);
} else if (DateHelper.isDateFormat(itemString)) {
date = itemString;
}
sb.append(item);
}
return StringHelper.md5(sb.toString());
if (StringHelper.isEmpty(date)) {
return StringHelper.getNewMD5Id(DateHelper.getDateTime(date), sb.toString());
} else {
return StringHelper.md5(sb.toString());
}
}
/**
......
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