deason 4 years ago
parent
commit
747ab037bf

+ 4 - 0
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/bean/exporttask/ExportTask.java

@@ -30,14 +30,18 @@ public class ExportTask extends Thread {
 		for (;;) {
 			ExportTaskEntity et = exportTaskService.findExportTaskToDispose();
 			if (et == null) {
+				log.info("ExportTask sleep...");
 				Util.sleep(30);
 				continue;
 			}
+
 			String cacheLock = "$_CACHE_LOCK:OE_EXPORT_TASK:" + et.getId();
 			Boolean lock = redisClient.setIfAbsent(cacheLock, cacheLock, cacheLockTimeout);
 			if (!lock) {
+				log.info("ExportTask lock... " + cacheLock);
 				continue;
 			}
+
 			try {
 				exportTaskService.startExportTask(et.getId());
 				if (ExportTaskType.EXAM_DETAIL.equals(et.getType())) {

+ 6 - 6
examcloud-core-oe-admin-service/src/main/java/cn/com/qmth/examcloud/core/oe/admin/service/impl/AsyncExportServiceImpl.java

@@ -104,7 +104,7 @@ public class AsyncExportServiceImpl implements AsyncExportService {
 			examRecords = ExamStudentEntityConvert.ofExcel(examStudentInfoList);
 
 		} catch (Exception e) {
-			log.error(e.getMessage());
+			log.error(e.getMessage(),e);
 			if (e instanceof StatusException) {
 				exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR,
 						((StatusException) e).getDesc());
@@ -124,7 +124,7 @@ public class AsyncExportServiceImpl implements AsyncExportService {
 			tempFile.getParentFile().mkdirs();
 			tempFile.createNewFile();
 		} catch (IOException e) {
-			log.error(e.getMessage());
+			log.error(e.getMessage(),e);
 			exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "生成导出文件异常");
 			return;
 		}
@@ -181,7 +181,7 @@ public class AsyncExportServiceImpl implements AsyncExportService {
 			}
 
 		} catch (Exception e) {
-			log.error(e.getMessage());
+			log.error(e.getMessage(),e);
 			if (e instanceof StatusException) {
 				exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR,
 						((StatusException) e).getDesc());
@@ -200,7 +200,7 @@ public class AsyncExportServiceImpl implements AsyncExportService {
 			tempFile.getParentFile().mkdirs();
 			tempFile.createNewFile();
 		} catch (IOException e) {
-			log.error(e.getMessage());
+			log.error(e.getMessage(),e);
 			exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "生成导出文件异常");
 			return;
 		}
@@ -254,7 +254,7 @@ public class AsyncExportServiceImpl implements AsyncExportService {
 				return;
 			}
 		} catch (Exception e) {
-			log.error(e.getMessage());
+			log.error(e.getMessage(),e);
 			if (e instanceof StatusException) {
 				exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR,
 						((StatusException) e).getDesc());
@@ -273,7 +273,7 @@ public class AsyncExportServiceImpl implements AsyncExportService {
 			tempFile.getParentFile().mkdirs();
 			tempFile.createNewFile();
 		} catch (IOException e) {
-			log.error(e.getMessage());
+			log.error(e.getMessage(),e);
 			exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "生成导出文件异常");
 			return;
 		}