xiaofei 2 жил өмнө
parent
commit
a6d24dff68

+ 1 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/DataSyncService.java

@@ -17,6 +17,7 @@ public interface DataSyncService {
     void syncObjectiveStructure(ExamPaperStructure examPaperStructure, TBSyncTask tbSyncTask);
 
     void syncMarkLeader(ExamPaperStructure examPaperStructure, TBSyncTask tbSyncTask);
+    void syncMarker(ExamPaperStructure examPaperStructure, TBSyncTask tbSyncTask);
 
     Integer saveSchool(Long schoolId, Integer thirdRelateId, String orgCode, String orgName);
 }

+ 3 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamPaperGroupService.java

@@ -3,6 +3,7 @@ package com.qmth.distributed.print.business.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.distributed.print.business.bean.marking.CardJpgResult;
 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.ExamPaperGroup;
 
 import java.util.List;
@@ -35,4 +36,6 @@ public interface ExamPaperGroupService extends IService<ExamPaperGroup> {
      * @param id 试卷结构表id
      */
     List<ExamPaperGroup> listByExamPaperStructureId(Long id);
+
+    void saveExamPaperGroupMarkerByGroupNumber(Long examPaperStructureId, Integer groupNumber, List<Marker> markerList);
 }

+ 27 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/DataSyncServiceImpl.java

@@ -8,6 +8,8 @@ import com.qmth.distributed.print.business.bean.dto.CardDetailDto;
 import com.qmth.distributed.print.business.bean.dto.ExamDetailCourseDto;
 import com.qmth.distributed.print.business.bean.dto.SyncExamStudentDto;
 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.ExamTaskSyncStatusEnum;
@@ -473,6 +475,31 @@ public class DataSyncServiceImpl implements DataSyncService {
         }
     }
 
+    @Async
+    @Override
+    public void syncMarker(ExamPaperStructure examPaperStructure, TBSyncTask tbSyncTask) {
+        // 同步初始参数
+        TaskResultEnum result = null;
+        String errorMessage = null;
+        try {
+            Long schoolId = examPaperStructure.getSchoolId();
+            // 科目代码(课程代码+卷型+课程序号)
+            String subjectCode = examPaperStructure.getCourseCode().concat(examPaperStructure.getPaperType()).concat(examPaperStructure.getSequence());
+            // 同步客观题
+            GroupInfo groupInfo = JSON.parseObject(tbSyncTask.getRemark(), GroupInfo.class);
+            List<Marker> markerList = groupInfo.getMarkerList();
+            for (Marker marker : markerList) {
+                cloudMarkingTaskUtils.saveMarker(schoolId, String.valueOf(examPaperStructure.getThirdRelateId()), subjectCode, groupInfo.getGroupNumber(), marker.getLoginName());
+            }
+            result = TaskResultEnum.SUCCESS;
+        } catch (ApiException e) {
+            result = TaskResultEnum.ERROR;
+            errorMessage = e.getMessage();
+        } finally {
+            tbSyncTaskService.updateStatusAndResultById(tbSyncTask.getId(), examPaperStructure.getThirdRelateId(), TaskStatusEnum.FINISH, result, errorMessage);
+        }
+    }
+
     /**
      * 创建考试
      *

+ 22 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamPaperGroupServiceImpl.java

@@ -12,11 +12,14 @@ import com.qmth.distributed.print.business.mapper.ExamPaperGroupMapper;
 import com.qmth.distributed.print.business.service.ExamPaperGroupMarkerService;
 import com.qmth.distributed.print.business.service.ExamPaperGroupService;
 import com.qmth.teachcloud.common.base.BaseEntity;
+import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.paperGroup.ScorePolicyEnum;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.util.Arrays;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.stream.Collectors;
@@ -63,7 +66,7 @@ public class ExamPaperGroupServiceImpl extends ServiceImpl<ExamPaperGroupMapper,
             this.save(examPaperGroup);
             // 新增后的分组id
             Long groupId = examPaperGroup.getId();
-            examPaperGroupMarkerService.saveExamPaperGroupMarkerByGroupId(groupId,markerList);
+            examPaperGroupMarkerService.saveExamPaperGroupMarkerByGroupId(groupId, markerList);
         }
     }
 
@@ -72,8 +75,8 @@ public class ExamPaperGroupServiceImpl extends ServiceImpl<ExamPaperGroupMapper,
     public void deleteExamPaperGroupInfo(Long examPaperStructureId) {
         // 要删除的分组id集合
         Set<Long> groupIdSet = this.list(new QueryWrapper<ExamPaperGroup>()
-                .lambda()
-                .eq(ExamPaperGroup::getExamPaperStructureId,examPaperStructureId))
+                        .lambda()
+                        .eq(ExamPaperGroup::getExamPaperStructureId, examPaperStructureId))
                 .stream()
                 .map(BaseEntity::getId)
                 .collect(Collectors.toSet());
@@ -91,4 +94,20 @@ public class ExamPaperGroupServiceImpl extends ServiceImpl<ExamPaperGroupMapper,
         queryWrapper.lambda().eq(ExamPaperGroup::getExamPaperStructureId, id);
         return this.baseMapper.selectList(queryWrapper);
     }
+
+    @Transactional
+    @Override
+    public void saveExamPaperGroupMarkerByGroupNumber(Long examPaperStructureId, Integer groupNumber, List<Marker> markerList) {
+        QueryWrapper<ExamPaperGroup> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(ExamPaperGroup::getExamPaperStructureId, examPaperStructureId)
+                .eq(ExamPaperGroup::getGroupNumber, groupNumber);
+        ExamPaperGroup examPaperGroup = this.getOne(queryWrapper);
+        if (examPaperGroup == null) {
+            throw ExceptionResultEnum.ERROR.exception("分组不存在");
+        }
+
+        // 删除分组下评卷员
+        examPaperGroupMarkerService.deleteExamPaperGroupMarkerService(new HashSet<>(Arrays.asList(examPaperGroup.getId())));
+        examPaperGroupMarkerService.saveExamPaperGroupMarkerByGroupId(examPaperGroup.getId(), markerList);
+    }
 }

+ 15 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/AsyncCloudMarkingTaskService.java

@@ -1,7 +1,9 @@
 package com.qmth.distributed.print.business.templete.execute;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.qmth.distributed.print.business.bean.dto.SyncExamTaskDto;
+import com.qmth.distributed.print.business.bean.marking.GroupInfo;
 import com.qmth.distributed.print.business.entity.ExamPaperStructure;
 import com.qmth.distributed.print.business.entity.TBSyncTask;
 import com.qmth.distributed.print.business.service.DataSyncService;
@@ -103,4 +105,17 @@ public class AsyncCloudMarkingTaskService {
         TBSyncTask tbSyncTask = tbSyncTaskService.saveTask(examPaperStructure.getSchoolId(), examPaperStructure.getId(), PushTypeEnum.MARK_LEADER_PUSH, null);
         dataSyncService.syncMarkLeader(examPaperStructure, tbSyncTask);
     }
+
+    /**
+     * 同步试卷结构、分组信息、评卷员绑定关系
+     *
+     * @param examPaperStructure 试卷结构对象
+     */
+    public void syncMarker(ExamPaperStructure examPaperStructure, GroupInfo groupInfo) {
+        if (examPaperStructure == null) {
+            throw ExceptionResultEnum.ERROR.exception("未找到同步数据");
+        }
+        TBSyncTask tbSyncTask = tbSyncTaskService.saveTask(examPaperStructure.getSchoolId(), examPaperStructure.getId(), PushTypeEnum.MARKER_PUSH, JSON.toJSONString(groupInfo));
+        dataSyncService.syncMarker(examPaperStructure, tbSyncTask);
+    }
 }

+ 4 - 0
distributed-print-business/src/main/resources/db/3.2.3更新脚本-增量.sql

@@ -31,6 +31,10 @@ INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence
 UPDATE `sys_privilege` SET `related` = '395,435,792,793' WHERE (`id` = '394');
 UPDATE `sys_privilege` SET `related` = '395,435,792,793' WHERE (`id` = '397');
 
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES ('767', '绑定评卷员', 'Bind', 'LINK', '488', '9', 'AUTH', '768', '1', '0', '1');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('768', '绑定评卷员', '/api/admin/exam/structure/bind_marker', 'URL', '488', '10', 'AUTH', '1', '1', '1');
+
+
 
 /*王亮新增*/
 INSERT INTO sys_role

+ 31 - 1
distributed-print/src/main/java/com/qmth/distributed/print/api/ExamPaperStructureController.java

@@ -1,11 +1,17 @@
 package com.qmth.distributed.print.api;
 
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.distributed.print.business.bean.marking.GroupInfo;
 import com.qmth.distributed.print.business.bean.result.EditResult;
+import com.qmth.distributed.print.business.entity.ExamPaperGroup;
+import com.qmth.distributed.print.business.entity.ExamPaperGroupMarker;
 import com.qmth.distributed.print.business.entity.ExamPaperStructure;
+import com.qmth.distributed.print.business.service.ExamPaperGroupMarkerService;
+import com.qmth.distributed.print.business.service.ExamPaperGroupService;
 import com.qmth.distributed.print.business.service.ExamPaperStructureService;
 import com.qmth.distributed.print.business.templete.execute.AsyncCloudMarkingTaskService;
 import com.qmth.teachcloud.common.annotation.OperationLogDetail;
@@ -40,6 +46,9 @@ public class ExamPaperStructureController {
     @Resource
     private ExamPaperStructureService examPaperStructureService;
 
+    @Resource
+    private ExamPaperGroupService examPaperGroupService;
+
     @Resource
     private AsyncCloudMarkingTaskService asyncCloudMarkingTaskService;
 
@@ -117,7 +126,7 @@ public class ExamPaperStructureController {
      */
     @ApiOperation(value = "设置科组长")
     @RequestMapping(value = "/bind_mark_leader", method = RequestMethod.POST)
-    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.UN_KNOW)
+    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.PUSH)
     public Result bindMarkLeader(@RequestBody String data) {
         ExamPaperStructure examPaperStructure = examPaperStructureService.bindMarkLeader(data);
         // 异步同步到云阅卷
@@ -125,6 +134,27 @@ public class ExamPaperStructureController {
         return ResultUtil.ok(true);
     }
 
+    /**
+     * 绑定评卷员
+     *
+     * @param data
+     * @return
+     */
+    @ApiOperation(value = "绑定评卷员")
+    @RequestMapping(value = "/bind_marker", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "更新成功", response = EditResult.class)})
+    @OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.PUSH)
+    public Result bindMarker(@RequestBody String data) {
+        JSONObject jsonObject = JSON.parseObject(data, JSONObject.class);
+        Long examPaperStructureId = jsonObject.getLong("paperStructureId");
+        GroupInfo groupInfo = jsonObject.getObject("groupInfo", GroupInfo.class);
+        examPaperGroupService.saveExamPaperGroupMarkerByGroupNumber(examPaperStructureId, groupInfo.getGroupNumber(), groupInfo.getMarkerList());
+        ExamPaperStructure examPaperStructure = examPaperStructureService.getById(examPaperStructureId);
+        // 异步同步到云阅卷
+        asyncCloudMarkingTaskService.syncMarker(examPaperStructure, groupInfo);
+        return ResultUtil.ok();
+    }
+
     /**
      * 保存客观题答案
      *

+ 1 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/enums/PushTypeEnum.java

@@ -17,6 +17,7 @@ public enum PushTypeEnum {
     STRUCTURE_GROUP_PUSH("试卷结构、分组、评卷员绑定关系数据推送"),
 
     MARK_LEADER_PUSH("科组长数据推送"),
+    MARKER_PUSH("评卷员数据推送"),
 
     PAPER_ANSWER_FILE_PUSH("试卷、标答文件推送"),
 

+ 2 - 2
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysOrgServiceImpl.java

@@ -159,7 +159,7 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
                         .eq(SysOrg::getCode, org.getCode());
                 SysOrg codeSysOrg = this.getOne(queryWrapper);
 
-                if(codeSysOrg != null && (org.getId() == null || !org.getId().equals(codeSysOrg.getId()))){
+                if (codeSysOrg != null && (org.getId() == null || !org.getId().equals(codeSysOrg.getId()))) {
                     throw ExceptionResultEnum.ERROR.exception("机构代码已存在");
                 }
             }
@@ -181,7 +181,7 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
             } else { // 修改
                 // 已经推送到云阅卷,不允许修改机构代码
                 SysOrg sysOrg = this.getById(org.getId());
-                if(!sysOrg.getCode().equals(org.getCode()) && sysOrg.getThirdRelateId() != null && sysOrg.getThirdRelateId() > 0){
+                if (sysOrg.getThirdRelateId() != null && !org.getCode().equals(sysOrg.getCode())) {
                     throw ExceptionResultEnum.ERROR.exception("机构已经同步到云阅卷,不支持修改机构代码");
                 }
                 org.updateInfo(sysUser.getId());