wangwei 5 years ago
parent
commit
265f1f8698

+ 12 - 3
examcloud-task-service/src/main/java/cn/com/qmth/examcloud/task/service/job/ExamStudentImportParsingFileTask.java

@@ -13,6 +13,7 @@ import java.util.Set;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.math.NumberUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -179,18 +180,26 @@ public class ExamStudentImportParsingFileTask extends AbstractTask {
 				continue;
 			}
 
-			int trueNum = BooleanUtil.countTrue(null == d1, null == d2);
+			int trueNum = BooleanUtil.countTrue(null != d1, null != d2);
 			if (2 == trueNum) {
 				Date specialBeginTime = null;
 				Date specialEndTime = null;
 				try {
-					specialBeginTime = DateUtil.parseRandomly(d1);
+					if (NumberUtils.isCreatable(d1)) {
+						specialBeginTime = DateUtil.parseExcel(d1);
+					} else {
+						specialBeginTime = DateUtil.parseRandomly(d1);
+					}
 				} catch (Exception e) {
 					failRecords.add(buildFailRecord(es.getLineNum(), "考试开始时间格式错误"));
 					continue;
 				}
 				try {
-					specialEndTime = DateUtil.parseRandomly(d2);
+					if (NumberUtils.isCreatable(d2)) {
+						specialEndTime = DateUtil.parseExcel(d2);
+					} else {
+						specialEndTime = DateUtil.parseRandomly(d2);
+					}
 				} catch (Exception e) {
 					failRecords.add(buildFailRecord(es.getLineNum(), "考试结束时间格式错误"));
 					continue;