|
@@ -10,7 +10,7 @@ import com.qmth.distributed.print.business.bean.dto.SyncExamTaskDto;
|
|
|
import com.qmth.distributed.print.business.bean.marking.GroupInfo;
|
|
|
import com.qmth.distributed.print.business.bean.marking.Marker;
|
|
|
import com.qmth.distributed.print.business.entity.*;
|
|
|
-import com.qmth.distributed.print.business.enums.ExamPaperStructureStatusEnum;
|
|
|
+import com.qmth.distributed.print.business.enums.ExamPaperStructureStatusTypeEnum;
|
|
|
import com.qmth.distributed.print.business.enums.ExamTaskSyncStatusEnum;
|
|
|
import com.qmth.distributed.print.business.service.*;
|
|
|
import com.qmth.teachcloud.common.bean.dto.stmms.GroupDetailDTO;
|
|
@@ -18,12 +18,17 @@ import com.qmth.teachcloud.common.bean.dto.stmms.PicConfig;
|
|
|
import com.qmth.teachcloud.common.bean.dto.stmms.QuestionBaseDTO;
|
|
|
import com.qmth.teachcloud.common.bean.dto.stmms.QuestionDTO;
|
|
|
import com.qmth.teachcloud.common.config.DictionaryConfig;
|
|
|
-import com.qmth.teachcloud.common.contant.SpringContextHolder;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
-import com.qmth.teachcloud.common.entity.*;
|
|
|
+import com.qmth.teachcloud.common.entity.BasicAttachment;
|
|
|
+import com.qmth.teachcloud.common.entity.BasicCollege;
|
|
|
+import com.qmth.teachcloud.common.entity.SysOrg;
|
|
|
+import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
import com.qmth.teachcloud.common.enums.*;
|
|
|
import com.qmth.teachcloud.common.enums.userPush.SpecialPrivilegeEnum;
|
|
|
-import com.qmth.teachcloud.common.service.*;
|
|
|
+import com.qmth.teachcloud.common.service.BasicAttachmentService;
|
|
|
+import com.qmth.teachcloud.common.service.SysOrgService;
|
|
|
+import com.qmth.teachcloud.common.service.SysUserService;
|
|
|
+import com.qmth.teachcloud.common.service.TeachcloudCommonService;
|
|
|
import com.qmth.teachcloud.common.sync.CloudMarkingTaskUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
@@ -84,6 +89,9 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
|
@Resource
|
|
|
private ExamPaperGroupMarkerService examPaperGroupMarkerService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private ExamPaperClassMarkerService examPaperClassMarkerService;
|
|
|
+
|
|
|
@Resource
|
|
|
ExamTaskService examTaskService;
|
|
|
|
|
@@ -212,27 +220,21 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
|
@Async
|
|
|
@Override
|
|
|
public void syncPaperStructureAndGroup(ExamPaperStructure examPaperStructure, TBSyncTask tbSyncTask) {
|
|
|
- // 开始同步
|
|
|
- ExamPaperStructureStatusEnum structureStatus = ExamPaperStructureStatusEnum.INIT;
|
|
|
// 同步初始参数
|
|
|
TaskResultEnum result = null;
|
|
|
String mainProgress = "<b>步骤:删除分组->主观题结构->主观题分组->绑定评卷员</b><br>";
|
|
|
String errorMessage = "";
|
|
|
- try {
|
|
|
- String paperTypes = examPaperStructure.getPaperType();
|
|
|
- if (StringUtils.isBlank(paperTypes)) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("没有可同步的试卷类型");
|
|
|
- }
|
|
|
|
|
|
- Long schoolId = examPaperStructure.getSchoolId();
|
|
|
- // 云阅卷考试ID
|
|
|
- String examId = String.valueOf(examPaperStructure.getThirdRelateId());
|
|
|
- // 科目代码(课程代码+卷型+课程序号)
|
|
|
- String subjectCode = examPaperStructure.getCourseCode().concat(examPaperStructure.getPaperType()).concat(examPaperStructure.getSequence());
|
|
|
+ Long schoolId = examPaperStructure.getSchoolId();
|
|
|
+ // 云阅卷考试ID
|
|
|
+ String examId = String.valueOf(examPaperStructure.getThirdRelateId());
|
|
|
+ // 科目代码(课程代码+卷型+课程序号)
|
|
|
+ String subjectCode = examPaperStructure.getCourseCode().concat(examPaperStructure.getPaperType()).concat(examPaperStructure.getSequence());
|
|
|
|
|
|
- // 同步中
|
|
|
- tbSyncTaskService.updateStatusAndResultById(tbSyncTask.getId(), examPaperStructure.getThirdRelateId(), TaskStatusEnum.RUNNING, null, null);
|
|
|
+ // 同步中
|
|
|
+ tbSyncTaskService.updateStatusAndResultById(tbSyncTask.getId(), examPaperStructure.getThirdRelateId(), TaskStatusEnum.RUNNING, null, null);
|
|
|
|
|
|
+ try {
|
|
|
// 同步分组(检查,若存在,先删除)
|
|
|
errorMessage = "[删除分组]";
|
|
|
int i = 0;
|
|
@@ -253,7 +255,8 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
// 主观题不传试卷类型 update by 20220711
|
|
|
- cloudMarkingTaskUtils.syncPaperStructure(schoolId, examId, subjectCode, false, null, syncSubjectiveStructureDatas);
|
|
|
+ boolean syncPaperStructure = cloudMarkingTaskUtils.syncPaperStructure(schoolId, examId, subjectCode, false, null, syncSubjectiveStructureDatas);
|
|
|
+ examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.STRUCTURE.getType(), "sync", syncPaperStructure));
|
|
|
}
|
|
|
|
|
|
// 清掉云阅卷主观题答案
|
|
@@ -267,8 +270,6 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- structureStatus = ExamPaperStructureStatusEnum.SUBJECTIVE_FINISH;
|
|
|
-
|
|
|
errorMessage = "[主观题分组]";
|
|
|
List<ExamPaperGroup> examPaperGroups = examPaperGroupService.listByExamPaperStructureId(examPaperStructure.getId());
|
|
|
if (!CollectionUtils.isEmpty(examPaperGroups)) {
|
|
@@ -297,34 +298,49 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
|
}
|
|
|
groupDetailDTOS.add(groupDetailDTO);
|
|
|
}
|
|
|
- cloudMarkingTaskUtils.saveMarkerGroup(schoolId, examId, subjectCode, 0, groupDetailDTOS);
|
|
|
+ boolean saveMarkerGroup = cloudMarkingTaskUtils.saveMarkerGroup(schoolId, examId, subjectCode, 0, groupDetailDTOS);
|
|
|
+ examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.GROUP.getType(), "sync", saveMarkerGroup));
|
|
|
}
|
|
|
- structureStatus = ExamPaperStructureStatusEnum.GROUP_FINISH;
|
|
|
|
|
|
// 同步绑定评卷员
|
|
|
- errorMessage = "[绑定评卷员]";
|
|
|
- String orgCode = cloudMarkingTaskUtils.isCollegeMode(schoolId) ? sysOrgService.findCollegeByCourseCode(schoolId, examPaperStructure.getCourseCode()).getCode() : null;
|
|
|
- SysConfigService sysConfigService = SpringContextHolder.getBean(SysConfigService.class);
|
|
|
- SysConfig sysConfig = sysConfigService.getByKey("sys.user.initPassword");
|
|
|
- for (ExamPaperGroup examPaperGroup : examPaperGroups) {
|
|
|
- List<ExamPaperGroupMarker> examPaperGroupMarkers = examPaperGroupMarkerService.listByGroupId(examPaperGroup.getId());
|
|
|
- for (ExamPaperGroupMarker examPaperGroupMarker : examPaperGroupMarkers) {
|
|
|
- // 推送用户
|
|
|
- SysUser markerUser = sysUserService.getById(examPaperGroupMarker.getMarkerId());
|
|
|
- cloudMarkingTaskUtils.syncUser(SpecialPrivilegeEnum.MARKER.getPrefix() + markerUser.getLoginName(), markerUser.getRealName(), sysConfig.getConfigValue(), SpecialPrivilegeEnum.MARKER.getValue(), markerUser.getEnable(), schoolId, orgCode);
|
|
|
- // 绑定评卷员
|
|
|
- cloudMarkingTaskUtils.saveMarker(schoolId, examId, subjectCode, examPaperGroup.getGroupNumber(), examPaperGroupMarker.getLoginName());
|
|
|
+ try {
|
|
|
+ errorMessage = "[绑定评卷员]";
|
|
|
+ String orgCode = cloudMarkingTaskUtils.isCollegeMode(schoolId) ? sysOrgService.findCollegeByCourseCode(schoolId, examPaperStructure.getCourseCode()).getCode() : null;
|
|
|
+ for (ExamPaperGroup examPaperGroup : examPaperGroups) {
|
|
|
+ List<ExamPaperGroupMarker> examPaperGroupMarkers = examPaperGroupMarkerService.listByGroupId(examPaperGroup.getId());
|
|
|
+ for (ExamPaperGroupMarker examPaperGroupMarker : examPaperGroupMarkers) {
|
|
|
+ // 推送用户
|
|
|
+ SysUser markerUser = sysUserService.getById(examPaperGroupMarker.getMarkerId());
|
|
|
+ cloudMarkingTaskUtils.syncUser(SpecialPrivilegeEnum.MARKER.getPrefix() + markerUser.getLoginName(), markerUser.getRealName(), SpecialPrivilegeEnum.MARKER.getValue(), markerUser.getEnable(), schoolId, orgCode);
|
|
|
+ // 绑定评卷员
|
|
|
+ cloudMarkingTaskUtils.saveMarker(schoolId, examId, subjectCode, examPaperGroup.getGroupNumber(), examPaperGroupMarker.getLoginName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.MARKER.getType(), "sync", true));
|
|
|
+ } catch (IllegalAccessException e) {
|
|
|
+ examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.MARKER.getType(), "sync", false));
|
|
|
+ }
|
|
|
+
|
|
|
+ errorMessage = "[分班阅]";
|
|
|
+ List<ExamPaperClassMarker> examPaperClassMarkers = examPaperClassMarkerService.listByExamPaperStructureId(examPaperStructure.getId());
|
|
|
+ if (!CollectionUtils.isEmpty(examPaperClassMarkers)) {
|
|
|
+ try {
|
|
|
+ for (ExamPaperClassMarker examPaperClassMarker : examPaperClassMarkers) {
|
|
|
+ String className = examPaperClassMarker.getClassName();
|
|
|
+ List<String> classNames = Arrays.asList(className.split(","));
|
|
|
+ cloudMarkingTaskUtils.saveUserClass(schoolId, examId, examPaperClassMarker.getLoginName(), classNames);
|
|
|
+ }
|
|
|
+ examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.CLASS.getType(), "sync", true));
|
|
|
+ } catch (Exception e) {
|
|
|
+ examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.CLASS.getType(), "sync", false));
|
|
|
}
|
|
|
}
|
|
|
- structureStatus = ExamPaperStructureStatusEnum.FINISH;
|
|
|
result = TaskResultEnum.SUCCESS;
|
|
|
} catch (Exception e) {
|
|
|
result = TaskResultEnum.ERROR;
|
|
|
errorMessage = errorMessage + e.getMessage();
|
|
|
} finally {
|
|
|
- examPaperStructure.setStatus(structureStatus);
|
|
|
examPaperStructureService.updateById(examPaperStructure);
|
|
|
-
|
|
|
tbSyncTaskService.updateStatusAndResultById(tbSyncTask.getId(), examPaperStructure.getThirdRelateId(), TaskStatusEnum.FINISH, result, mainProgress + errorMessage);
|
|
|
}
|
|
|
}
|
|
@@ -418,19 +434,18 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
|
}
|
|
|
}
|
|
|
String paperAnswerUrl = JSONObject.toJSONString(paperAnswerJsons);
|
|
|
-
|
|
|
// 更新url
|
|
|
- UpdateWrapper<ExamPaperStructure> updateWrapper = new UpdateWrapper<>();
|
|
|
- updateWrapper.lambda().set(ExamPaperStructure::getPaperAnswer, paperAnswerUrl).eq(ExamPaperStructure::getId, examPaperStructure.getId());
|
|
|
- examPaperStructureService.update(updateWrapper);
|
|
|
+ examPaperStructure.setPaperAnswer(paperAnswerUrl);
|
|
|
+ examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.ANSWER_FILE.getType(), "sync", true));
|
|
|
}
|
|
|
-
|
|
|
result = TaskResultEnum.SUCCESS;
|
|
|
} catch (ApiException e) {
|
|
|
+ examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.ANSWER_FILE.getType(), "sync", false));
|
|
|
result = TaskResultEnum.ERROR;
|
|
|
errorMessage = e.getMessage();
|
|
|
} finally {
|
|
|
tbSyncTaskService.updateStatusAndResultById(tbSyncTask.getId(), examPaperStructure.getThirdRelateId(), TaskStatusEnum.FINISH, result, errorMessage);
|
|
|
+ examPaperStructureService.updateById(examPaperStructure);
|
|
|
if (paperFile != null) {
|
|
|
paperFile.delete();
|
|
|
}
|
|
@@ -506,19 +521,19 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
|
// 推送用户
|
|
|
String orgCode = cloudMarkingTaskUtils.isCollegeMode(schoolId) ? sysOrgService.findCollegeByCourseCode(schoolId, examPaperStructure.getCourseCode()).getCode() : null;
|
|
|
SysUser markerUser = sysUserService.getById(object.getLong("id"));
|
|
|
- SysConfigService sysConfigService = SpringContextHolder.getBean(SysConfigService.class);
|
|
|
- SysConfig sysConfig = sysConfigService.getByKey("sys.user.initPassword");
|
|
|
- cloudMarkingTaskUtils.syncUser(SpecialPrivilegeEnum.SUBJECT_HEADER.getPrefix() + markerUser.getLoginName(), markerUser.getRealName(), sysConfig.getConfigValue(), SpecialPrivilegeEnum.SUBJECT_HEADER.getValue(), markerUser.getEnable(), schoolId, orgCode);
|
|
|
-
|
|
|
+ cloudMarkingTaskUtils.syncUser(SpecialPrivilegeEnum.SUBJECT_HEADER.getPrefix() + markerUser.getLoginName(), markerUser.getRealName(), SpecialPrivilegeEnum.SUBJECT_HEADER.getValue(), markerUser.getEnable(), schoolId, orgCode);
|
|
|
cloudMarkingTaskUtils.saveMarkLeader(schoolId, subjectCode, object.getString("loginName"), orgCode);
|
|
|
}
|
|
|
}
|
|
|
+ examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.MARKER_LEADER.getType(), "sync", true));
|
|
|
result = TaskResultEnum.SUCCESS;
|
|
|
} catch (Exception e) {
|
|
|
+ examPaperStructure.setStatus(ExamPaperStructure.parseStatus(examPaperStructure.getStatus(), ExamPaperStructureStatusTypeEnum.MARKER_LEADER.getType(), "sync", false));
|
|
|
result = TaskResultEnum.ERROR;
|
|
|
errorMessage = e.getMessage();
|
|
|
} finally {
|
|
|
tbSyncTaskService.updateStatusAndResultById(tbSyncTask.getId(), examPaperStructure.getThirdRelateId(), TaskStatusEnum.FINISH, result, errorMessage);
|
|
|
+ examPaperStructureService.updateById(examPaperStructure);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -537,11 +552,9 @@ public class DataSyncServiceImpl implements DataSyncService {
|
|
|
List<Marker> markerList = groupInfo.getMarkerList();
|
|
|
|
|
|
String orgCode = cloudMarkingTaskUtils.isCollegeMode(schoolId) ? sysOrgService.findCollegeByCourseCode(schoolId, examPaperStructure.getCourseCode()).getCode() : null;
|
|
|
- SysConfigService sysConfigService = SpringContextHolder.getBean(SysConfigService.class);
|
|
|
- SysConfig sysConfig = sysConfigService.getByKey("sys.user.initPassword");
|
|
|
for (Marker marker : markerList) {
|
|
|
// 推送用户
|
|
|
- cloudMarkingTaskUtils.syncUser(SpecialPrivilegeEnum.MARKER.getPrefix() + marker.getLoginName(), marker.getName(), sysConfig.getConfigValue(), SpecialPrivilegeEnum.MARKER.getValue(), true, schoolId, orgCode);
|
|
|
+ cloudMarkingTaskUtils.syncUser(SpecialPrivilegeEnum.MARKER.getPrefix() + marker.getLoginName(), marker.getName(), SpecialPrivilegeEnum.MARKER.getValue(), true, schoolId, orgCode);
|
|
|
// 绑定评卷员
|
|
|
cloudMarkingTaskUtils.saveMarker(schoolId, String.valueOf(examPaperStructure.getThirdRelateId()), subjectCode, groupInfo.getGroupNumber(), marker.getLoginName());
|
|
|
}
|