|
@@ -1,16 +1,21 @@
|
|
|
package com.qmth.distributed.print.business.templete.execute;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.qmth.distributed.print.business.bean.dto.SyncExamTaskDto;
|
|
|
import com.qmth.distributed.print.business.entity.ExamPaperStructure;
|
|
|
import com.qmth.distributed.print.business.entity.TBSyncTask;
|
|
|
import com.qmth.distributed.print.business.service.DataSyncService;
|
|
|
import com.qmth.distributed.print.business.service.TBSyncTaskService;
|
|
|
+import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.entity.SysConfig;
|
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.teachcloud.common.enums.PushTypeEnum;
|
|
|
+import com.qmth.teachcloud.common.enums.SyncModeEnum;
|
|
|
+import com.qmth.teachcloud.common.service.CommonCacheService;
|
|
|
import com.qmth.teachcloud.common.service.SysConfigService;
|
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
@@ -27,9 +32,6 @@ public class AsyncCloudMarkingTaskService {
|
|
|
|
|
|
private final static Logger log = LoggerFactory.getLogger(AsyncCloudMarkingTaskService.class);
|
|
|
|
|
|
- @Resource
|
|
|
- private SysConfigService sysConfigService;
|
|
|
-
|
|
|
@Lazy
|
|
|
@Resource
|
|
|
private DataSyncService dataSyncService;
|
|
@@ -37,15 +39,6 @@ public class AsyncCloudMarkingTaskService {
|
|
|
@Resource
|
|
|
private TBSyncTaskService tbSyncTaskService;
|
|
|
|
|
|
- public boolean isSync() {
|
|
|
- SysConfig sysConfig = sysConfigService.getByKey("sys.sync.enable");
|
|
|
- boolean isSync = sysConfig != null && "true".equals(sysConfig.getConfigValue());
|
|
|
- if (!isSync) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("未开启同步开关");
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 同步考试、考生、科目、题卡
|
|
|
*
|
|
@@ -53,12 +46,10 @@ public class AsyncCloudMarkingTaskService {
|
|
|
* @param objectId 同步对象ID(命题任务Id)
|
|
|
* @param thirdRelateId 云阅卷考试ID
|
|
|
*/
|
|
|
- public void syncExamAndStudentAndCard(Long schoolId, Long objectId, Long thirdRelateId, String thirdRelateName, String examTime, JSONObject object) {
|
|
|
- if (isSync()) {
|
|
|
- TBSyncTask tbSyncTask = tbSyncTaskService.saveTask(schoolId, objectId, PushTypeEnum.EXAM_PUSH, JSONObject.toJSONString(object));
|
|
|
- SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
- dataSyncService.syncExamAndStudentAndCard(thirdRelateId, thirdRelateName, examTime, tbSyncTask, sysUser);
|
|
|
- }
|
|
|
+ public void syncExamAndStudentAndCard(Long schoolId, Long objectId, Long thirdRelateId, String thirdRelateName, String examTime, List<SyncExamTaskDto> params) {
|
|
|
+ TBSyncTask tbSyncTask = tbSyncTaskService.saveTask(schoolId, objectId, PushTypeEnum.EXAM_PUSH, JSONObject.toJSONString(params));
|
|
|
+ SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
+ dataSyncService.syncExamAndStudentAndCard(thirdRelateId, thirdRelateName, examTime, tbSyncTask, sysUser);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -70,10 +61,8 @@ public class AsyncCloudMarkingTaskService {
|
|
|
if (examPaperStructure == null) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("未找到同步数据");
|
|
|
}
|
|
|
- if (isSync()) {
|
|
|
- TBSyncTask tbSyncTask = tbSyncTaskService.saveTask(examPaperStructure.getSchoolId(), examPaperStructure.getId(), PushTypeEnum.STRUCTURE_GROUP_PUSH, null);
|
|
|
- dataSyncService.syncPaperStructureAndGroup(examPaperStructure, tbSyncTask);
|
|
|
- }
|
|
|
+ TBSyncTask tbSyncTask = tbSyncTaskService.saveTask(examPaperStructure.getSchoolId(), examPaperStructure.getId(), PushTypeEnum.STRUCTURE_GROUP_PUSH, null);
|
|
|
+ dataSyncService.syncPaperStructureAndGroup(examPaperStructure, tbSyncTask);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -85,10 +74,8 @@ public class AsyncCloudMarkingTaskService {
|
|
|
if (examPaperStructure == null) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("请先设置评卷参数");
|
|
|
}
|
|
|
- if (isSync()) {
|
|
|
- TBSyncTask tbSyncTask = tbSyncTaskService.saveTask(examPaperStructure.getSchoolId(), examPaperStructure.getId(), PushTypeEnum.PAPER_ANSWER_FILE_PUSH, null);
|
|
|
- dataSyncService.syncPaperAndAnswer(examPaperStructure, tbSyncTask);
|
|
|
- }
|
|
|
+ TBSyncTask tbSyncTask = tbSyncTaskService.saveTask(examPaperStructure.getSchoolId(), examPaperStructure.getId(), PushTypeEnum.PAPER_ANSWER_FILE_PUSH, null);
|
|
|
+ dataSyncService.syncPaperAndAnswer(examPaperStructure, tbSyncTask);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -100,10 +87,8 @@ public class AsyncCloudMarkingTaskService {
|
|
|
if (examPaperStructure == null) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("请先设置评卷参数");
|
|
|
}
|
|
|
- if (isSync()) {
|
|
|
- TBSyncTask tbSyncTask = tbSyncTaskService.saveTask(examPaperStructure.getSchoolId(), examPaperStructure.getId(), PushTypeEnum.OBJECTIVE_ANSWER_PUSH, null);
|
|
|
- dataSyncService.syncObjectiveStructure(examPaperStructure, tbSyncTask);
|
|
|
- }
|
|
|
+ TBSyncTask tbSyncTask = tbSyncTaskService.saveTask(examPaperStructure.getSchoolId(), examPaperStructure.getId(), PushTypeEnum.OBJECTIVE_ANSWER_PUSH, null);
|
|
|
+ dataSyncService.syncObjectiveStructure(examPaperStructure, tbSyncTask);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -115,9 +100,7 @@ public class AsyncCloudMarkingTaskService {
|
|
|
if (examPaperStructure == null) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("请先设置评卷参数");
|
|
|
}
|
|
|
- if (isSync()) {
|
|
|
- TBSyncTask tbSyncTask = tbSyncTaskService.saveTask(examPaperStructure.getSchoolId(), examPaperStructure.getId(), PushTypeEnum.MARK_LEADER_PUSH, null);
|
|
|
- dataSyncService.syncMarkLeader(examPaperStructure, tbSyncTask);
|
|
|
- }
|
|
|
+ TBSyncTask tbSyncTask = tbSyncTaskService.saveTask(examPaperStructure.getSchoolId(), examPaperStructure.getId(), PushTypeEnum.MARK_LEADER_PUSH, null);
|
|
|
+ dataSyncService.syncMarkLeader(examPaperStructure, tbSyncTask);
|
|
|
}
|
|
|
}
|