|
@@ -15,13 +15,13 @@ import java.util.UUID;
|
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import cn.com.qmth.examcloud.api.commons.security.bean.User;
|
|
|
import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
|
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
|
|
|
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
|
|
|
import cn.com.qmth.examcloud.commons.util.JsonMapper;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.base.utils.Check;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.dao.enums.ExportTaskStatus;
|
|
@@ -54,7 +54,7 @@ import cn.com.qmth.examcloud.web.filestorage.YunPathInfo;
|
|
|
@Service
|
|
|
public class AsyncExportServiceImpl implements AsyncExportService {
|
|
|
|
|
|
- private static final ExamCloudLog log = ExamCloudLogFactory.getLog(AsyncExportServiceImpl.class);
|
|
|
+ private static final Logger LOG = LoggerFactory.getLogger(AsyncExportServiceImpl.class);
|
|
|
|
|
|
private static final String TASK_EXPORT_DIR = "task_export";
|
|
|
|
|
@@ -104,7 +104,7 @@ public class AsyncExportServiceImpl implements AsyncExportService {
|
|
|
examRecords = ExamStudentEntityConvert.ofExcel(examStudentInfoList);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
- log.error(e.getMessage());
|
|
|
+ LOG.error(e.getMessage());
|
|
|
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());
|
|
|
exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "生成导出文件异常");
|
|
|
return;
|
|
|
}
|
|
@@ -138,10 +138,10 @@ public class AsyncExportServiceImpl implements AsyncExportService {
|
|
|
env.setRelativePath(filePath);
|
|
|
YunPathInfo oss = FileStorageUtil.saveFile(TASK_EXPORT_DIR, env, tempFile, null);
|
|
|
|
|
|
- log.info("asyncExportExamScheduling finished... " + oss.getRelativePath());
|
|
|
+ LOG.info("asyncExportExamScheduling finished... " + oss.getRelativePath());
|
|
|
exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.SUCCESS, null, oss.getRelativePath());
|
|
|
} catch (Exception e) {
|
|
|
- log.error("asyncExportExamScheduling error... " + e);
|
|
|
+ LOG.error("asyncExportExamScheduling error... " + e);
|
|
|
exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "上传至文件服务器异常");
|
|
|
} finally {
|
|
|
FileUtils.deleteQuietly(tempFile);
|
|
@@ -181,7 +181,7 @@ public class AsyncExportServiceImpl implements AsyncExportService {
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
- log.error(e.getMessage());
|
|
|
+ LOG.error(e.getMessage());
|
|
|
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());
|
|
|
exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "生成导出文件异常");
|
|
|
return;
|
|
|
}
|
|
@@ -214,10 +214,10 @@ public class AsyncExportServiceImpl implements AsyncExportService {
|
|
|
env.setRelativePath(filePath);
|
|
|
YunPathInfo oss = FileStorageUtil.saveFile(TASK_EXPORT_DIR, env, tempFile, null);
|
|
|
|
|
|
- log.info("asyncExportExamRecordDetails finished... " + oss.getRelativePath());
|
|
|
+ LOG.info("asyncExportExamRecordDetails finished... " + oss.getRelativePath());
|
|
|
exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.SUCCESS, null, oss.getRelativePath());
|
|
|
} catch (Exception e) {
|
|
|
- log.info("asyncExportExamRecordDetails error... " + e.getMessage());
|
|
|
+ LOG.info("asyncExportExamRecordDetails error... " + e.getMessage());
|
|
|
exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "上传至文件服务器异常");
|
|
|
} finally {
|
|
|
FileUtils.deleteQuietly(tempFile);
|
|
@@ -254,7 +254,7 @@ public class AsyncExportServiceImpl implements AsyncExportService {
|
|
|
return;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- log.error(e.getMessage());
|
|
|
+ LOG.error(e.getMessage());
|
|
|
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());
|
|
|
exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "生成导出文件异常");
|
|
|
return;
|
|
|
}
|
|
@@ -286,10 +286,10 @@ public class AsyncExportServiceImpl implements AsyncExportService {
|
|
|
env.setRelativePath(filePath);
|
|
|
YunPathInfo oss = FileStorageUtil.saveFile(TASK_EXPORT_DIR, env, tempFile, null);
|
|
|
|
|
|
- log.info("asyncExportExamScoreStatistics finished... " + oss.getRelativePath());
|
|
|
+ LOG.info("asyncExportExamScoreStatistics finished... " + oss.getRelativePath());
|
|
|
exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.SUCCESS, null, oss.getRelativePath());
|
|
|
} catch (Exception e) {
|
|
|
- log.info("asyncExportExamScoreStatistics error... " + e.getMessage());
|
|
|
+ LOG.info("asyncExportExamScoreStatistics error... " + e.getMessage());
|
|
|
exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "上传至文件服务器异常");
|
|
|
} finally {
|
|
|
FileUtils.deleteQuietly(tempFile);
|