Browse Source

考务数据导入 - 优化提示

caozixuan 3 years ago
parent
commit
0209f67283

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/TaskLogicService.java

@@ -36,7 +36,7 @@ public interface TaskLogicService {
      */
     public Map<String, Object> executeExaminationLogic(Map<String, Object> map) throws Exception;
 
-    public Map<String, Object> executeImportExaminationLogic(Map<String, Object> map) throws IOException, Exception;
+    public Map<String, Object> executeImportExaminationLogic(Map<String, Object> map) throws Exception;
 
     /**
      * 下载pdf

+ 3 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/ConvertUtil.java

@@ -76,6 +76,9 @@ public class ConvertUtil {
         }
         String startTimeStr = date + " " + arr[0];
         String endTimeStr = date + " " + arr[1];
+        if (Objects.isNull(DateDisposeUtils.parseDate(startTimeStr)) || Objects.isNull(DateDisposeUtils.parseDate(endTimeStr))){
+            throw ExceptionResultEnum.ERROR.exception("提供的日期时间格式异常(请使用'-'隔开) \n【考试日期】 : " + date + "\n应该使用如下的格式 '考试日期' :2021-09-01");
+        }
         long startTime = DateDisposeUtils.parseDate(startTimeStr).getTime();
         long endTime = DateDisposeUtils.parseDate(endTimeStr).getTime();
         if (startTime >= endTime) {

+ 1 - 1
teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/ExcelUtil.java

@@ -260,7 +260,7 @@ public class ExcelUtil {
                     } else if (cell.getCellStyle().getDataFormat() == 22) {
                         sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
                     } else {
-                        throw new RuntimeException("日期格式错误!!!");
+                        throw new RuntimeException("日期格式错误!!!(请将excel单元格设置为文本格式或输入正确格式的日期)");
                     }
                     Date date = cell.getDateCellValue();
                     return sdf.format(date);