Commit 47b46414 authored by fangxinjiang's avatar fangxinjiang

预派单调整

parent d2956930
...@@ -1600,23 +1600,27 @@ public class DateUtil { ...@@ -1600,23 +1600,27 @@ public class DateUtil {
} }
} }
public static boolean isDate(String dateText,String format) { public static boolean isDate(String dateText) {
if (dateText == null) { if (dateText == null) {
return true; return true;
} }
DateFormat df = null; DateFormat df = null;
try { try {
if (dateText.indexOf("-") >= 0) {
if (format != null) { df = new SimpleDateFormat(ISO_EXPANDED_DATE_FORMAT);
df = new SimpleDateFormat(format); df.setLenient(false);
} else { df.parse(dateText);
}else if (dateText.indexOf("/") >= 0) {
df = new SimpleDateFormat(DateUtil.DATETIME_PATTERN_XIEGANG);
df.setLenient(false);
df.parse(dateText);
}else{
df = new SimpleDateFormat(ISO_DATE_FORMAT); df = new SimpleDateFormat(ISO_DATE_FORMAT);
df.setLenient(false);
df.parse( dateText.replace("/","").replace("-","")
.replace(CommonConstants.YEAR,"").replace(CommonConstants.MONTH,"")
.replace(CommonConstants.DAY,""));
} }
df.setLenient(false);
df.parse( dateText.replace("/","").replace("-","")
.replace(CommonConstants.YEAR,"").replace(CommonConstants.MONTH,"")
.replace(CommonConstants.DAY,""));
} catch (ParseException e) { } catch (ParseException e) {
return true; return true;
} }
......
...@@ -759,8 +759,7 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -759,8 +759,7 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
if (checkAddRepeat(errorList, existsMap, i, info)) { if (checkAddRepeat(errorList, existsMap, i, info)) {
continue; continue;
} }
if (Common.isNotNull(info.getLeaveDate()) if (Common.isNotNull(info.getLeaveDate()) && DateUtil.isDate(info.getLeaveDate())){
&& DateUtil.isDate(info.getLeaveDate(),DateUtil.ISO_EXPANDED_DATE_FORMAT)){
errorList.add(new ErrorMessage(i, PreDispatchConstants.LEAVE_DATE_FORMAT_ERROR)); errorList.add(new ErrorMessage(i, PreDispatchConstants.LEAVE_DATE_FORMAT_ERROR));
continue; continue;
} }
......
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