Commit 3c65703d authored by yanzg's avatar yanzg

消除成功接收处理

parent 6a9da843
package com.yanzuoguang.util.helper; package com.yanzuoguang.util.helper;
import com.sun.corba.se.spi.presentation.rmi.IDLNameTranslator;
import com.yanzuoguang.util.exception.CodeException; import com.yanzuoguang.util.exception.CodeException;
import com.yanzuoguang.util.exception.ExceptionHelper; import com.yanzuoguang.util.exception.ExceptionHelper;
...@@ -36,8 +35,8 @@ public class DateHelper { ...@@ -36,8 +35,8 @@ public class DateHelper {
/** /**
* 获取时间 * 获取时间
* *
* @param from * @param from 来源时间
* @return * @return 结束时间
*/ */
public static Date getDateTime(Object from) { public static Date getDateTime(Object from) {
try { try {
...@@ -511,7 +510,7 @@ public class DateHelper { ...@@ -511,7 +510,7 @@ public class DateHelper {
* *
* @param format 格式 yyyy-MM-dd HH:mm:ss * @param format 格式 yyyy-MM-dd HH:mm:ss
* @param date 字符串 * @param date 字符串
* @return * @return 转换后的结果
*/ */
public static String getDateTimeString(String format, Date date) { public static String getDateTimeString(String format, Date date) {
String to = ""; String to = "";
...@@ -525,8 +524,8 @@ public class DateHelper { ...@@ -525,8 +524,8 @@ public class DateHelper {
* 比较时间 * 比较时间
* *
* @param from 对比时间 * @param from 对比时间
* @param to * @param to 结束时间
* @return * @return 对别结果
*/ */
public static int compare(Date from, Date to) { public static int compare(Date from, Date to) {
if (from == null && to == null) { if (from == null && to == null) {
...@@ -569,12 +568,21 @@ public class DateHelper { ...@@ -569,12 +568,21 @@ public class DateHelper {
* @param date 当前时间 yyyy-MM-dd HH:mm:ss * @param date 当前时间 yyyy-MM-dd HH:mm:ss
* @param from 开始时间 00:00:00 * @param from 开始时间 00:00:00
* @param to 结束时间 00:05:00 * @param to 结束时间 00:05:00
* @return * @return 是否在时间范围之内
*/ */
public static boolean isBetween(Date date, String from, String to) { public static boolean isBetween(Date date, String from, String to) {
if (date == null) {
return false;
}
Date fromDate = getDateTime(getDateTimeString(FORMAT_DAY_STRING + " " + from, date)); Date fromDate = getDateTime(getDateTimeString(FORMAT_DAY_STRING + " " + from, date));
Date toDate = getDateTime(getDateTimeString(FORMAT_DAY_STRING + " " + to, date)); Date toDate = getDateTime(getDateTimeString(FORMAT_DAY_STRING + " " + to, date));
return date.getTime() >= fromDate.getTime() && date.getTime() <= toDate.getTime(); if (fromDate != null && date.getTime() < fromDate.getTime()) {
return false;
}
if (toDate != null && date.getTime() > toDate.getTime()) {
return false;
}
return true;
} }
/** /**
......
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