Commit 47b46414 authored by fangxinjiang's avatar fangxinjiang

预派单调整

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