|
@@ -32,6 +32,7 @@ import cn.com.qmth.examcloud.core.basic.api.UserCloudService;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.bean.UserBean;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.request.GetUserReq;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.response.GetUserResp;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.base.ExportTaskStopException;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.base.utils.Check;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.base.utils.RoleUtil;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExportTaskEntity;
|
|
@@ -73,399 +74,415 @@ import cn.com.qmth.examcloud.web.security.ResourceManager;
|
|
|
@Service
|
|
|
public class AsyncExportServiceImpl implements AsyncExportService {
|
|
|
|
|
|
- private static final Logger LOG = LoggerFactory.getLogger(AsyncExportServiceImpl.class);
|
|
|
-
|
|
|
- private static final String TASK_EXPORT_DIR = "task_export";
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ExportTaskService exportTaskService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ExamRecordService examRecordService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ExamScoreService examScoreService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private SystemProperties systemConfig;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ExamStudentService examStudentService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ExamAuditService examAuditService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private UserCloudService userCloudService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ResourceManager resourceManager;
|
|
|
-
|
|
|
- @Override
|
|
|
- public void exportExamScheduling(String jsonParams, User user) {
|
|
|
- ExamStudentQuery req = new JsonMapper().parseJson(jsonParams, ExamStudentQuery.class);
|
|
|
- req.setRootOrgId(user.getRootOrgId());
|
|
|
- Check.isNull(req, "请求参数不能为空!");
|
|
|
- Check.isNull(req.getExamId(), "请先选择考试批次!");
|
|
|
-
|
|
|
- // 创建导出任务
|
|
|
- ExportTaskInfo task = new ExportTaskInfo();
|
|
|
- task.setRootOrgId(user.getRootOrgId());
|
|
|
- task.setExamId(req.getExamId());
|
|
|
- task.setType(ExportTaskType.EXAM_SCHEDULING);
|
|
|
- task.setStatus(ExportTaskStatus.WAITING);
|
|
|
- task.setCreator(user.getUserId());
|
|
|
- task.setJsonParams(jsonParams);
|
|
|
- exportTaskService.addExportTask(task);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void asyncExportExamScheduling(Long taskId, ExamStudentQuery req) {
|
|
|
- List<ExamStudentExcel> examRecords;
|
|
|
- List<ExamStudentInfo> examStudentInfoList;
|
|
|
- try {
|
|
|
- ExportTaskEntity task=exportTaskService.findById(taskId);
|
|
|
- UserDataRules uds=new UserDataRules(getUserDataRule(task.getCreator(),DataRuleType.ORG), getUserDataRule(task.getCreator(),DataRuleType.COURSE));
|
|
|
- examStudentInfoList = examStudentService.getExamStudentInfoListForAsync(uds,req);
|
|
|
- if (CollectionUtils.isEmpty(examStudentInfoList)) {
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "当前条件暂无数据,任务终止");
|
|
|
- return;
|
|
|
- }
|
|
|
- examRecords = ExamStudentEntityConvert.ofExcel(examStudentInfoList);
|
|
|
- fillStage(examRecords);
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- LOG.error(e.getMessage(), e);
|
|
|
- if (e instanceof StatusException) {
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR,
|
|
|
- ((StatusException) e).getDesc());
|
|
|
- } else {
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "导出数据异常");
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
- // 导出文件的存储路径
|
|
|
- Long examId = examStudentInfoList.get(0).getExamId();
|
|
|
- ExamSettingsCacheBean exam = CacheHelper.getExamSettings(examId);
|
|
|
- final String filePath = String.format("/%s/%s/%s/%s/%s_考试进度详情.xlsx", TASK_EXPORT_DIR, req.getRootOrgId(),
|
|
|
- dateDir(), randomUUID(), exam.getName());
|
|
|
- String tempFilePath = systemConfig.getTempDataDir() + File.separator + filePath;
|
|
|
- File tempFile = new File(tempFilePath);
|
|
|
- try {
|
|
|
- tempFile.getParentFile().mkdirs();
|
|
|
- tempFile.createNewFile();
|
|
|
- } catch (IOException e) {
|
|
|
- LOG.error(e.getMessage(), e);
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "生成导出文件异常");
|
|
|
- return;
|
|
|
- }
|
|
|
- try (FileOutputStream out = new FileOutputStream(tempFile);) {
|
|
|
-
|
|
|
- ExcelExportUtil.exportExcel(ExamStudentExcel.class, examRecords, out);
|
|
|
-
|
|
|
- // 上传至文件服务器
|
|
|
- FileStoragePathEnvInfo env = new FileStoragePathEnvInfo();
|
|
|
- env.setRootOrgId(String.valueOf(req.getRootOrgId()));
|
|
|
- env.setRelativePath(filePath);
|
|
|
- YunPathInfo oss = FileStorageUtil.saveFile(TASK_EXPORT_DIR, env, tempFile, null);
|
|
|
-
|
|
|
- LOG.info("asyncExportExamScheduling finished... " + oss.getRelativePath());
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.SUCCESS, null, oss.getRelativePath());
|
|
|
- } catch (Exception e) {
|
|
|
- LOG.error("asyncExportExamScheduling error... " + e);
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "上传至文件服务器异常");
|
|
|
- } finally {
|
|
|
- FileUtils.deleteQuietly(tempFile);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void fillStage(List<ExamStudentExcel> list) {
|
|
|
- if(CollectionUtils.isEmpty(list)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- for(ExamStudentExcel info:list) {
|
|
|
- if(info.getExamStageId()!=null) {
|
|
|
- ExamStageCacheBean stage=CacheHelper.getExamStage(info.getExamId(), info.getExamStageId());
|
|
|
- info.setExamStageOrder(stage.getStageOrder());
|
|
|
- info.setStageStartTime(stage.getStartTime());
|
|
|
- info.setStageEndTime(stage.getEndTime());
|
|
|
- info.setExamStage(stage.getStageOrder() + "("
|
|
|
+ private static final Logger LOG = LoggerFactory.getLogger(AsyncExportServiceImpl.class);
|
|
|
+
|
|
|
+ private static final String TASK_EXPORT_DIR = "task_export";
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExportTaskService exportTaskService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamRecordService examRecordService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamScoreService examScoreService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SystemProperties systemConfig;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamStudentService examStudentService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamAuditService examAuditService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UserCloudService userCloudService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ResourceManager resourceManager;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void exportExamScheduling(String jsonParams, User user) {
|
|
|
+ ExamStudentQuery req = new JsonMapper().parseJson(jsonParams, ExamStudentQuery.class);
|
|
|
+ req.setRootOrgId(user.getRootOrgId());
|
|
|
+ Check.isNull(req, "请求参数不能为空!");
|
|
|
+ Check.isNull(req.getExamId(), "请先选择考试批次!");
|
|
|
+
|
|
|
+ // 创建导出任务
|
|
|
+ ExportTaskInfo task = new ExportTaskInfo();
|
|
|
+ task.setRootOrgId(user.getRootOrgId());
|
|
|
+ task.setExamId(req.getExamId());
|
|
|
+ task.setType(ExportTaskType.EXAM_SCHEDULING);
|
|
|
+ task.setStatus(ExportTaskStatus.WAITING);
|
|
|
+ task.setCreator(user.getUserId());
|
|
|
+ task.setJsonParams(jsonParams);
|
|
|
+ exportTaskService.addExportTask(task);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void asyncExportExamScheduling(Long taskId, ExamStudentQuery req) {
|
|
|
+ List<ExamStudentExcel> examRecords;
|
|
|
+ List<ExamStudentInfo> examStudentInfoList;
|
|
|
+ try {
|
|
|
+ ExportTaskEntity task = exportTaskService.findById(taskId);
|
|
|
+ UserDataRules uds = new UserDataRules(getUserDataRule(task.getCreator(), DataRuleType.ORG),
|
|
|
+ getUserDataRule(task.getCreator(), DataRuleType.COURSE));
|
|
|
+ req.setTaskId(taskId);
|
|
|
+ examStudentInfoList = examStudentService.getExamStudentInfoListForAsync(uds, req);
|
|
|
+ if (CollectionUtils.isEmpty(examStudentInfoList)) {
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "当前条件暂无数据,任务终止");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ examRecords = ExamStudentEntityConvert.ofExcel(examStudentInfoList);
|
|
|
+ fillStage(examRecords);
|
|
|
+
|
|
|
+ } catch (ExportTaskStopException e) {
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.TERMINATE);
|
|
|
+ return;
|
|
|
+ } catch (Exception e) {
|
|
|
+ LOG.error(e.getMessage(), e);
|
|
|
+ if (e instanceof StatusException) {
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR,
|
|
|
+ ((StatusException) e).getDesc());
|
|
|
+ } else {
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "导出数据异常");
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 导出文件的存储路径
|
|
|
+ Long examId = examStudentInfoList.get(0).getExamId();
|
|
|
+ ExamSettingsCacheBean exam = CacheHelper.getExamSettings(examId);
|
|
|
+ final String filePath = String.format("/%s/%s/%s/%s/%s_考试进度详情.xlsx", TASK_EXPORT_DIR, req.getRootOrgId(),
|
|
|
+ dateDir(), randomUUID(), exam.getName());
|
|
|
+ String tempFilePath = systemConfig.getTempDataDir() + File.separator + filePath;
|
|
|
+ File tempFile = new File(tempFilePath);
|
|
|
+ try {
|
|
|
+ tempFile.getParentFile().mkdirs();
|
|
|
+ tempFile.createNewFile();
|
|
|
+ } catch (IOException e) {
|
|
|
+ LOG.error(e.getMessage(), e);
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "生成导出文件异常");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try (FileOutputStream out = new FileOutputStream(tempFile);) {
|
|
|
+
|
|
|
+ ExcelExportUtil.exportExcel(ExamStudentExcel.class, examRecords, out);
|
|
|
+
|
|
|
+ // 上传至文件服务器
|
|
|
+ FileStoragePathEnvInfo env = new FileStoragePathEnvInfo();
|
|
|
+ env.setRootOrgId(String.valueOf(req.getRootOrgId()));
|
|
|
+ env.setRelativePath(filePath);
|
|
|
+ YunPathInfo oss = FileStorageUtil.saveFile(TASK_EXPORT_DIR, env, tempFile, null);
|
|
|
+
|
|
|
+ LOG.info("asyncExportExamScheduling finished... " + oss.getRelativePath());
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.SUCCESS, null, oss.getRelativePath());
|
|
|
+ } catch (Exception e) {
|
|
|
+ LOG.error("asyncExportExamScheduling error... " + e);
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "上传至文件服务器异常");
|
|
|
+ } finally {
|
|
|
+ FileUtils.deleteQuietly(tempFile);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void fillStage(List<ExamStudentExcel> list) {
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for (ExamStudentExcel info : list) {
|
|
|
+ if (info.getExamStageId() != null) {
|
|
|
+ ExamStageCacheBean stage = CacheHelper.getExamStage(info.getExamId(), info.getExamStageId());
|
|
|
+ info.setExamStageOrder(stage.getStageOrder());
|
|
|
+ info.setStageStartTime(stage.getStartTime());
|
|
|
+ info.setStageEndTime(stage.getEndTime());
|
|
|
+ info.setExamStage(stage.getStageOrder() + "("
|
|
|
+ DateUtil.format(stage.getStartTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + "至"
|
|
|
+ DateUtil.format(stage.getEndTime(), DateUtil.DatePatterns.CHINA_DEFAULT) + ")");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void exportExamRecordDetails(String jsonParams, User user) {
|
|
|
- ExamRecordQuery req = new JsonMapper().parseJson(jsonParams, ExamRecordQuery.class);
|
|
|
- req.setRootOrgId(user.getRootOrgId());
|
|
|
- Check.isNull(req, "请求参数不能为空!");
|
|
|
- Check.isNull(req.getRootOrgId(), "学校ID不能为空!");
|
|
|
- Check.isNull(req.getExamId(), "考试ID不能为空!");
|
|
|
- Check.isNull(req.getCreator(), "创建人ID不能为空!");
|
|
|
-
|
|
|
-
|
|
|
- // 创建导出任务
|
|
|
- ExportTaskInfo task = new ExportTaskInfo();
|
|
|
- task.setRootOrgId(req.getRootOrgId());
|
|
|
- task.setExamId(req.getExamId());
|
|
|
- task.setType(ExportTaskType.EXAM_DETAIL);
|
|
|
- task.setStatus(ExportTaskStatus.WAITING);
|
|
|
- task.setCreator(req.getCreator());
|
|
|
- task.setJsonParams(jsonParams);
|
|
|
- exportTaskService.addExportTask(task);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void asyncExportExamRecordDetails(Long taskId, ExamRecordQuery req) {
|
|
|
- List<ExamRecordInfo> examRecords;
|
|
|
- try {
|
|
|
- ExportTaskEntity task=exportTaskService.findById(taskId);
|
|
|
- UserDataRules uds=new UserDataRules(getUserDataRule(task.getCreator(),DataRuleType.ORG), getUserDataRule(task.getCreator(),DataRuleType.COURSE));
|
|
|
-
|
|
|
- examRecords = examRecordService.getExamRecordDetailListForAsync(uds,req);
|
|
|
-
|
|
|
- if (CollectionUtils.isEmpty(examRecords)) {
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "当前条件暂无数据,任务终止");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- LOG.error(e.getMessage(), e);
|
|
|
- if (e instanceof StatusException) {
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR,
|
|
|
- ((StatusException) e).getDesc());
|
|
|
- } else {
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "导出数据异常");
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
- // 导出文件的存储路径
|
|
|
- String examName = examRecords.get(0).getExamName();
|
|
|
- final String filePath = String.format("/%s/%s/%s/%s/%s_考试明细.xlsx", TASK_EXPORT_DIR, req.getRootOrgId(),
|
|
|
- dateDir(), randomUUID(), examName);
|
|
|
- String tempFilePath = systemConfig.getTempDataDir() + File.separator + filePath;
|
|
|
- File tempFile = new File(tempFilePath);
|
|
|
- try {
|
|
|
- tempFile.getParentFile().mkdirs();
|
|
|
- tempFile.createNewFile();
|
|
|
- } catch (IOException e) {
|
|
|
- LOG.error(e.getMessage(), e);
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "生成导出文件异常");
|
|
|
- return;
|
|
|
- }
|
|
|
- try (FileOutputStream out = new FileOutputStream(tempFile);) {
|
|
|
-
|
|
|
- ExcelExportUtil.exportExcel(ExamRecordInfo.class, examRecords, out);
|
|
|
-
|
|
|
- // 上传至文件服务器
|
|
|
- FileStoragePathEnvInfo env = new FileStoragePathEnvInfo();
|
|
|
- env.setRootOrgId(String.valueOf(req.getRootOrgId()));
|
|
|
- env.setRelativePath(filePath);
|
|
|
- YunPathInfo oss = FileStorageUtil.saveFile(TASK_EXPORT_DIR, env, tempFile, null);
|
|
|
-
|
|
|
- LOG.info("asyncExportExamRecordDetails finished... " + oss.getRelativePath());
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.SUCCESS, null, oss.getRelativePath());
|
|
|
- } catch (Exception e) {
|
|
|
- LOG.info("asyncExportExamRecordDetails error... " + e.getMessage());
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "上传至文件服务器异常");
|
|
|
- } finally {
|
|
|
- FileUtils.deleteQuietly(tempFile);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void exportExamScoreStatistics(String jsonParams, User user) {
|
|
|
- ExamScoreQuery req = new JsonMapper().parseJson(jsonParams, ExamScoreQuery.class);
|
|
|
- req.setRootOrgId(user.getRootOrgId());
|
|
|
- Check.isNull(req, "请求参数不能为空!");
|
|
|
- Check.isNull(req.getRootOrgId(), "学校ID不能为空!");
|
|
|
- Check.isNull(req.getExamId(), "考试ID不能为空!");
|
|
|
- Check.isNull(req.getCreator(), "创建人ID不能为空!");
|
|
|
-
|
|
|
- // 创建导出任务
|
|
|
- ExportTaskInfo task = new ExportTaskInfo();
|
|
|
- task.setRootOrgId(req.getRootOrgId());
|
|
|
- task.setExamId(req.getExamId());
|
|
|
- task.setType(ExportTaskType.SCORE_STATISTIC);
|
|
|
- task.setStatus(ExportTaskStatus.WAITING);
|
|
|
- task.setCreator(req.getCreator());
|
|
|
- task.setJsonParams(jsonParams);
|
|
|
- exportTaskService.addExportTask(task);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void asyncExportExamScoreStatistics(Long taskId, ExamScoreQuery req) {
|
|
|
- List<ExamScoreInfo> examScores;
|
|
|
- try {
|
|
|
- ExportTaskEntity task=exportTaskService.findById(taskId);
|
|
|
- UserDataRules uds=new UserDataRules(getUserDataRule(task.getCreator(),DataRuleType.ORG), getUserDataRule(task.getCreator(),DataRuleType.COURSE));
|
|
|
-
|
|
|
- examScores = examScoreService.exportExamScoreListForAsync(uds,req);
|
|
|
- if (CollectionUtils.isEmpty(examScores)) {
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "当前条件暂无数据,任务终止");
|
|
|
- return;
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- LOG.error(e.getMessage(), e);
|
|
|
- if (e instanceof StatusException) {
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR,
|
|
|
- ((StatusException) e).getDesc());
|
|
|
- } else {
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "导出数据异常");
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
- // 导出文件的存储路径
|
|
|
- String examName = examScores.get(0).getExamName();
|
|
|
- final String filePath = String.format("/%s/%s/%s/%s/%s_成绩统计.xlsx", TASK_EXPORT_DIR, req.getRootOrgId(),
|
|
|
- dateDir(), randomUUID(), examName);
|
|
|
- String tempFilePath = systemConfig.getTempDataDir() + File.separator + filePath;
|
|
|
- File tempFile = new File(tempFilePath);
|
|
|
- try {
|
|
|
- tempFile.getParentFile().mkdirs();
|
|
|
- tempFile.createNewFile();
|
|
|
- } catch (IOException e) {
|
|
|
- LOG.error(e.getMessage(), e);
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "生成导出文件异常");
|
|
|
- return;
|
|
|
- }
|
|
|
- try (FileOutputStream out = new FileOutputStream(tempFile);) {
|
|
|
- ExcelExportUtil.exportExcel(ExamScoreInfo.class, examScores, out);
|
|
|
-
|
|
|
- // 上传至文件服务器
|
|
|
- FileStoragePathEnvInfo env = new FileStoragePathEnvInfo();
|
|
|
- env.setRootOrgId(String.valueOf(req.getRootOrgId()));
|
|
|
- env.setRelativePath(filePath);
|
|
|
- YunPathInfo oss = FileStorageUtil.saveFile(TASK_EXPORT_DIR, env, tempFile, null);
|
|
|
-
|
|
|
- LOG.info("asyncExportExamScoreStatistics finished... " + oss.getRelativePath());
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.SUCCESS, null, oss.getRelativePath());
|
|
|
- } catch (Exception e) {
|
|
|
- LOG.info("asyncExportExamScoreStatistics error... " + e.getMessage());
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "上传至文件服务器异常");
|
|
|
- } finally {
|
|
|
- FileUtils.deleteQuietly(tempFile);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void asyncExportExamAuditList(Long taskId, ExamAuditQuery req) {
|
|
|
- List<ExamAuditInfo> auditInfos;
|
|
|
- try {
|
|
|
- ExportTaskEntity task=exportTaskService.findById(taskId);
|
|
|
- UserDataRules uds=new UserDataRules(getUserDataRule(task.getCreator(),DataRuleType.ORG), getUserDataRule(task.getCreator(),DataRuleType.COURSE));
|
|
|
-
|
|
|
- auditInfos = examAuditService.getExamAudit(uds,req);
|
|
|
-
|
|
|
- if (CollectionUtils.isEmpty(auditInfos)) {
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "当前条件暂无数据,任务终止");
|
|
|
- return;
|
|
|
- }
|
|
|
- for (ExamAuditInfo examAuditInfo : auditInfos) {
|
|
|
- examAuditInfo.setIdentityNumber(
|
|
|
- IdentityNumberHelper.conceal(req.getRootOrgId(), examAuditInfo.getIdentityNumber()));
|
|
|
- }
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- LOG.error(e.getMessage(), e);
|
|
|
- if (e instanceof StatusException) {
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR,
|
|
|
- ((StatusException) e).getDesc());
|
|
|
- } else {
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "导出数据异常");
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
- // 导出文件的存储路径
|
|
|
- String examName = auditInfos.get(0).getExamName();
|
|
|
- final String filePath = String.format("/%s/%s/%s/%s/%s_监考已审.xlsx", TASK_EXPORT_DIR, req.getRootOrgId(),
|
|
|
- dateDir(), randomUUID(), examName);
|
|
|
- String tempFilePath = systemConfig.getTempDataDir() + File.separator + filePath;
|
|
|
- File tempFile = new File(tempFilePath);
|
|
|
- try {
|
|
|
- tempFile.getParentFile().mkdirs();
|
|
|
- tempFile.createNewFile();
|
|
|
- } catch (IOException e) {
|
|
|
- LOG.error(e.getMessage(), e);
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "生成导出文件异常");
|
|
|
- return;
|
|
|
- }
|
|
|
- try (FileOutputStream out = new FileOutputStream(tempFile);) {
|
|
|
-
|
|
|
- ExcelExportUtil.exportExcel(ExamAuditInfo.class, auditInfos, out);
|
|
|
-
|
|
|
- // 上传至文件服务器
|
|
|
- FileStoragePathEnvInfo env = new FileStoragePathEnvInfo();
|
|
|
- env.setRootOrgId(String.valueOf(req.getRootOrgId()));
|
|
|
- env.setRelativePath(filePath);
|
|
|
- YunPathInfo oss = FileStorageUtil.saveFile(TASK_EXPORT_DIR, env, tempFile, null);
|
|
|
-
|
|
|
- LOG.info("asyncExportExamAuditList finished... " + oss.getRelativePath());
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.SUCCESS, null, oss.getRelativePath());
|
|
|
- } catch (Exception e) {
|
|
|
- LOG.info("asyncExportExamAuditList error... " + e.getMessage());
|
|
|
- exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "上传至文件服务器异常");
|
|
|
- } finally {
|
|
|
- FileUtils.deleteQuietly(tempFile);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void exportExamAuditList(String query, User user) {
|
|
|
- ExamStudentQuery req = new JsonMapper().parseJson(query, ExamStudentQuery.class);
|
|
|
- req.setRootOrgId(user.getRootOrgId());
|
|
|
- Check.isNull(req, "请求参数不能为空!");
|
|
|
- Check.isNull(req.getExamId(), "请先选择考试批次!");
|
|
|
-
|
|
|
- // 创建导出任务
|
|
|
- ExportTaskInfo task = new ExportTaskInfo();
|
|
|
- task.setRootOrgId(user.getRootOrgId());
|
|
|
- task.setExamId(req.getExamId());
|
|
|
- task.setType(ExportTaskType.AUDIT);
|
|
|
- task.setStatus(ExportTaskStatus.WAITING);
|
|
|
- task.setCreator(user.getUserId());
|
|
|
- task.setJsonParams(query);
|
|
|
- exportTaskService.addExportTask(task);
|
|
|
- }
|
|
|
-
|
|
|
- private String randomUUID() {
|
|
|
- return UUID.randomUUID().toString().replace("-", "");
|
|
|
- }
|
|
|
-
|
|
|
- private String dateDir() {
|
|
|
- final String pattern = "yyyyMM";
|
|
|
- return new SimpleDateFormat(pattern).format(new Date());
|
|
|
- }
|
|
|
-
|
|
|
- private UserDataRule getUserDataRule(Long userId,DataRuleType dataRuleType) {
|
|
|
- UserDataRule userDataRule= new UserDataRule();
|
|
|
- userDataRule.setGlobalStatus(true);
|
|
|
- userDataRule.setRefIds(new HashSet<>());
|
|
|
- boolean isEnable = PropertyHolder.getBoolean("examcloud.data.rule.enable", false);
|
|
|
- if (!isEnable) {
|
|
|
- // 未启用数据权限
|
|
|
- return userDataRule;
|
|
|
- }
|
|
|
-
|
|
|
- GetUserReq getUserReq = new GetUserReq();
|
|
|
- getUserReq.setUserId(userId);
|
|
|
- GetUserResp getUserResp = userCloudService.getUser(getUserReq);
|
|
|
- UserBean userBean = getUserResp.getUserBean();
|
|
|
- if (userBean == null) {
|
|
|
- throw new StatusException("未找到用户");
|
|
|
- }
|
|
|
-
|
|
|
- boolean isAdmimUser = RoleUtil.hasAnyRoles(userBean, RoleMeta.SUPER_ADMIN, RoleMeta.ORG_ADMIN);
|
|
|
-
|
|
|
- if (isAdmimUser) {
|
|
|
- // “超管、机构管理员、学生” 暂例外
|
|
|
- return userDataRule;
|
|
|
- } else {
|
|
|
- userDataRule = resourceManager.loadUserDataRule(userId, dataRuleType);
|
|
|
- }
|
|
|
- return userDataRule;
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void exportExamRecordDetails(String jsonParams, User user) {
|
|
|
+ ExamRecordQuery req = new JsonMapper().parseJson(jsonParams, ExamRecordQuery.class);
|
|
|
+ req.setRootOrgId(user.getRootOrgId());
|
|
|
+ Check.isNull(req, "请求参数不能为空!");
|
|
|
+ Check.isNull(req.getRootOrgId(), "学校ID不能为空!");
|
|
|
+ Check.isNull(req.getExamId(), "考试ID不能为空!");
|
|
|
+ Check.isNull(req.getCreator(), "创建人ID不能为空!");
|
|
|
+
|
|
|
+ // 创建导出任务
|
|
|
+ ExportTaskInfo task = new ExportTaskInfo();
|
|
|
+ task.setRootOrgId(req.getRootOrgId());
|
|
|
+ task.setExamId(req.getExamId());
|
|
|
+ task.setType(ExportTaskType.EXAM_DETAIL);
|
|
|
+ task.setStatus(ExportTaskStatus.WAITING);
|
|
|
+ task.setCreator(req.getCreator());
|
|
|
+ task.setJsonParams(jsonParams);
|
|
|
+ exportTaskService.addExportTask(task);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void asyncExportExamRecordDetails(Long taskId, ExamRecordQuery req) {
|
|
|
+ List<ExamRecordInfo> examRecords;
|
|
|
+ try {
|
|
|
+ ExportTaskEntity task = exportTaskService.findById(taskId);
|
|
|
+ UserDataRules uds = new UserDataRules(getUserDataRule(task.getCreator(), DataRuleType.ORG),
|
|
|
+ getUserDataRule(task.getCreator(), DataRuleType.COURSE));
|
|
|
+ req.setTaskId(taskId);
|
|
|
+ examRecords = examRecordService.getExamRecordDetailListForAsync(uds, req);
|
|
|
+
|
|
|
+ if (CollectionUtils.isEmpty(examRecords)) {
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "当前条件暂无数据,任务终止");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (ExportTaskStopException e) {
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.TERMINATE);
|
|
|
+ return;
|
|
|
+ } catch (Exception e) {
|
|
|
+ LOG.error(e.getMessage(), e);
|
|
|
+ if (e instanceof StatusException) {
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR,
|
|
|
+ ((StatusException) e).getDesc());
|
|
|
+ } else {
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "导出数据异常");
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 导出文件的存储路径
|
|
|
+ String examName = examRecords.get(0).getExamName();
|
|
|
+ final String filePath = String.format("/%s/%s/%s/%s/%s_考试明细.xlsx", TASK_EXPORT_DIR, req.getRootOrgId(),
|
|
|
+ dateDir(), randomUUID(), examName);
|
|
|
+ String tempFilePath = systemConfig.getTempDataDir() + File.separator + filePath;
|
|
|
+ File tempFile = new File(tempFilePath);
|
|
|
+ try {
|
|
|
+ tempFile.getParentFile().mkdirs();
|
|
|
+ tempFile.createNewFile();
|
|
|
+ } catch (IOException e) {
|
|
|
+ LOG.error(e.getMessage(), e);
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "生成导出文件异常");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try (FileOutputStream out = new FileOutputStream(tempFile);) {
|
|
|
+
|
|
|
+ ExcelExportUtil.exportExcel(ExamRecordInfo.class, examRecords, out);
|
|
|
+
|
|
|
+ // 上传至文件服务器
|
|
|
+ FileStoragePathEnvInfo env = new FileStoragePathEnvInfo();
|
|
|
+ env.setRootOrgId(String.valueOf(req.getRootOrgId()));
|
|
|
+ env.setRelativePath(filePath);
|
|
|
+ YunPathInfo oss = FileStorageUtil.saveFile(TASK_EXPORT_DIR, env, tempFile, null);
|
|
|
+
|
|
|
+ LOG.info("asyncExportExamRecordDetails finished... " + oss.getRelativePath());
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.SUCCESS, null, oss.getRelativePath());
|
|
|
+ } catch (Exception e) {
|
|
|
+ LOG.info("asyncExportExamRecordDetails error... " + e.getMessage());
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "上传至文件服务器异常");
|
|
|
+ } finally {
|
|
|
+ FileUtils.deleteQuietly(tempFile);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void exportExamScoreStatistics(String jsonParams, User user) {
|
|
|
+ ExamScoreQuery req = new JsonMapper().parseJson(jsonParams, ExamScoreQuery.class);
|
|
|
+ req.setRootOrgId(user.getRootOrgId());
|
|
|
+ Check.isNull(req, "请求参数不能为空!");
|
|
|
+ Check.isNull(req.getRootOrgId(), "学校ID不能为空!");
|
|
|
+ Check.isNull(req.getExamId(), "考试ID不能为空!");
|
|
|
+ Check.isNull(req.getCreator(), "创建人ID不能为空!");
|
|
|
+
|
|
|
+ // 创建导出任务
|
|
|
+ ExportTaskInfo task = new ExportTaskInfo();
|
|
|
+ task.setRootOrgId(req.getRootOrgId());
|
|
|
+ task.setExamId(req.getExamId());
|
|
|
+ task.setType(ExportTaskType.SCORE_STATISTIC);
|
|
|
+ task.setStatus(ExportTaskStatus.WAITING);
|
|
|
+ task.setCreator(req.getCreator());
|
|
|
+ task.setJsonParams(jsonParams);
|
|
|
+ exportTaskService.addExportTask(task);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void asyncExportExamScoreStatistics(Long taskId, ExamScoreQuery req) {
|
|
|
+ List<ExamScoreInfo> examScores;
|
|
|
+ try {
|
|
|
+ ExportTaskEntity task = exportTaskService.findById(taskId);
|
|
|
+ UserDataRules uds = new UserDataRules(getUserDataRule(task.getCreator(), DataRuleType.ORG),
|
|
|
+ getUserDataRule(task.getCreator(), DataRuleType.COURSE));
|
|
|
+ req.setTaskId(taskId);
|
|
|
+ examScores = examScoreService.exportExamScoreListForAsync(uds, req);
|
|
|
+ if (CollectionUtils.isEmpty(examScores)) {
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "当前条件暂无数据,任务终止");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } catch (ExportTaskStopException e) {
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.TERMINATE);
|
|
|
+ return;
|
|
|
+ } catch (Exception e) {
|
|
|
+ LOG.error(e.getMessage(), e);
|
|
|
+ if (e instanceof StatusException) {
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR,
|
|
|
+ ((StatusException) e).getDesc());
|
|
|
+ } else {
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "导出数据异常");
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 导出文件的存储路径
|
|
|
+ String examName = examScores.get(0).getExamName();
|
|
|
+ final String filePath = String.format("/%s/%s/%s/%s/%s_成绩统计.xlsx", TASK_EXPORT_DIR, req.getRootOrgId(),
|
|
|
+ dateDir(), randomUUID(), examName);
|
|
|
+ String tempFilePath = systemConfig.getTempDataDir() + File.separator + filePath;
|
|
|
+ File tempFile = new File(tempFilePath);
|
|
|
+ try {
|
|
|
+ tempFile.getParentFile().mkdirs();
|
|
|
+ tempFile.createNewFile();
|
|
|
+ } catch (IOException e) {
|
|
|
+ LOG.error(e.getMessage(), e);
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "生成导出文件异常");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try (FileOutputStream out = new FileOutputStream(tempFile);) {
|
|
|
+ ExcelExportUtil.exportExcel(ExamScoreInfo.class, examScores, out);
|
|
|
+
|
|
|
+ // 上传至文件服务器
|
|
|
+ FileStoragePathEnvInfo env = new FileStoragePathEnvInfo();
|
|
|
+ env.setRootOrgId(String.valueOf(req.getRootOrgId()));
|
|
|
+ env.setRelativePath(filePath);
|
|
|
+ YunPathInfo oss = FileStorageUtil.saveFile(TASK_EXPORT_DIR, env, tempFile, null);
|
|
|
+
|
|
|
+ LOG.info("asyncExportExamScoreStatistics finished... " + oss.getRelativePath());
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.SUCCESS, null, oss.getRelativePath());
|
|
|
+ } catch (Exception e) {
|
|
|
+ LOG.info("asyncExportExamScoreStatistics error... " + e.getMessage());
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "上传至文件服务器异常");
|
|
|
+ } finally {
|
|
|
+ FileUtils.deleteQuietly(tempFile);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void asyncExportExamAuditList(Long taskId, ExamAuditQuery req) {
|
|
|
+ List<ExamAuditInfo> auditInfos;
|
|
|
+ try {
|
|
|
+ ExportTaskEntity task = exportTaskService.findById(taskId);
|
|
|
+ UserDataRules uds = new UserDataRules(getUserDataRule(task.getCreator(), DataRuleType.ORG),
|
|
|
+ getUserDataRule(task.getCreator(), DataRuleType.COURSE));
|
|
|
+ req.setTaskId(taskId);
|
|
|
+ auditInfos = examAuditService.getExamAudit(uds, req);
|
|
|
+
|
|
|
+ if (CollectionUtils.isEmpty(auditInfos)) {
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "当前条件暂无数据,任务终止");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for (ExamAuditInfo examAuditInfo : auditInfos) {
|
|
|
+ examAuditInfo.setIdentityNumber(
|
|
|
+ IdentityNumberHelper.conceal(req.getRootOrgId(), examAuditInfo.getIdentityNumber()));
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (ExportTaskStopException e) {
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.TERMINATE);
|
|
|
+ return;
|
|
|
+ } catch (Exception e) {
|
|
|
+ LOG.error(e.getMessage(), e);
|
|
|
+ if (e instanceof StatusException) {
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR,
|
|
|
+ ((StatusException) e).getDesc());
|
|
|
+ } else {
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "导出数据异常");
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 导出文件的存储路径
|
|
|
+ String examName = auditInfos.get(0).getExamName();
|
|
|
+ final String filePath = String.format("/%s/%s/%s/%s/%s_监考已审.xlsx", TASK_EXPORT_DIR, req.getRootOrgId(),
|
|
|
+ dateDir(), randomUUID(), examName);
|
|
|
+ String tempFilePath = systemConfig.getTempDataDir() + File.separator + filePath;
|
|
|
+ File tempFile = new File(tempFilePath);
|
|
|
+ try {
|
|
|
+ tempFile.getParentFile().mkdirs();
|
|
|
+ tempFile.createNewFile();
|
|
|
+ } catch (IOException e) {
|
|
|
+ LOG.error(e.getMessage(), e);
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "生成导出文件异常");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try (FileOutputStream out = new FileOutputStream(tempFile);) {
|
|
|
+
|
|
|
+ ExcelExportUtil.exportExcel(ExamAuditInfo.class, auditInfos, out);
|
|
|
+
|
|
|
+ // 上传至文件服务器
|
|
|
+ FileStoragePathEnvInfo env = new FileStoragePathEnvInfo();
|
|
|
+ env.setRootOrgId(String.valueOf(req.getRootOrgId()));
|
|
|
+ env.setRelativePath(filePath);
|
|
|
+ YunPathInfo oss = FileStorageUtil.saveFile(TASK_EXPORT_DIR, env, tempFile, null);
|
|
|
+
|
|
|
+ LOG.info("asyncExportExamAuditList finished... " + oss.getRelativePath());
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.SUCCESS, null, oss.getRelativePath());
|
|
|
+ } catch (Exception e) {
|
|
|
+ LOG.info("asyncExportExamAuditList error... " + e.getMessage());
|
|
|
+ exportTaskService.updateExportTaskStatus(taskId, ExportTaskStatus.ERROR, "上传至文件服务器异常");
|
|
|
+ } finally {
|
|
|
+ FileUtils.deleteQuietly(tempFile);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void exportExamAuditList(String query, User user) {
|
|
|
+ ExamStudentQuery req = new JsonMapper().parseJson(query, ExamStudentQuery.class);
|
|
|
+ req.setRootOrgId(user.getRootOrgId());
|
|
|
+ Check.isNull(req, "请求参数不能为空!");
|
|
|
+ Check.isNull(req.getExamId(), "请先选择考试批次!");
|
|
|
+
|
|
|
+ // 创建导出任务
|
|
|
+ ExportTaskInfo task = new ExportTaskInfo();
|
|
|
+ task.setRootOrgId(user.getRootOrgId());
|
|
|
+ task.setExamId(req.getExamId());
|
|
|
+ task.setType(ExportTaskType.AUDIT);
|
|
|
+ task.setStatus(ExportTaskStatus.WAITING);
|
|
|
+ task.setCreator(user.getUserId());
|
|
|
+ task.setJsonParams(query);
|
|
|
+ exportTaskService.addExportTask(task);
|
|
|
+ }
|
|
|
+
|
|
|
+ private String randomUUID() {
|
|
|
+ return UUID.randomUUID().toString().replace("-", "");
|
|
|
+ }
|
|
|
+
|
|
|
+ private String dateDir() {
|
|
|
+ final String pattern = "yyyyMM";
|
|
|
+ return new SimpleDateFormat(pattern).format(new Date());
|
|
|
+ }
|
|
|
+
|
|
|
+ private UserDataRule getUserDataRule(Long userId, DataRuleType dataRuleType) {
|
|
|
+ UserDataRule userDataRule = new UserDataRule();
|
|
|
+ userDataRule.setGlobalStatus(true);
|
|
|
+ userDataRule.setRefIds(new HashSet<>());
|
|
|
+ boolean isEnable = PropertyHolder.getBoolean("examcloud.data.rule.enable", false);
|
|
|
+ if (!isEnable) {
|
|
|
+ // 未启用数据权限
|
|
|
+ return userDataRule;
|
|
|
+ }
|
|
|
+
|
|
|
+ GetUserReq getUserReq = new GetUserReq();
|
|
|
+ getUserReq.setUserId(userId);
|
|
|
+ GetUserResp getUserResp = userCloudService.getUser(getUserReq);
|
|
|
+ UserBean userBean = getUserResp.getUserBean();
|
|
|
+ if (userBean == null) {
|
|
|
+ throw new StatusException("未找到用户");
|
|
|
+ }
|
|
|
+
|
|
|
+ boolean isAdmimUser = RoleUtil.hasAnyRoles(userBean, RoleMeta.SUPER_ADMIN, RoleMeta.ORG_ADMIN);
|
|
|
+
|
|
|
+ if (isAdmimUser) {
|
|
|
+ // “超管、机构管理员、学生” 暂例外
|
|
|
+ return userDataRule;
|
|
|
+ } else {
|
|
|
+ userDataRule = resourceManager.loadUserDataRule(userId, dataRuleType);
|
|
|
+ }
|
|
|
+ return userDataRule;
|
|
|
+ }
|
|
|
|
|
|
}
|