xiaof 3 anni fa
parent
commit
b0a214323f

+ 7 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamPrintPlanMapper.java

@@ -30,6 +30,13 @@ public interface ExamPrintPlanMapper extends BaseMapper<ExamPrintPlan> {
                                              @Param("endTime") Long endTime,
                                              @Param("orgIds") Set<Long> orgIds);
 
+    IPage<PrintPlanResult> findPrintPlanSyncPage(@Param("iPage") Page<PrintPlanResult> iPage,
+                                             @Param("schoolId") Long schoolId,
+                                             @Param("printPlanId") Long printPlanId,
+                                             @Param("startTime") Long startTime,
+                                             @Param("endTime") Long endTime,
+                                             @Param("orgIds") Set<Long> orgIds);
+
     List<PrintPlanBrief> list(@Param("schoolId") Long schoolId, @Param("source") String source, @Param("module") String module, @Param("status") String[] status, @Param("orgIds") Set<Long> orgIds);
 
     IPage<ClientPrintTaskDto> listClientPrintTask(Page<ClientPrintTaskDto> page, @Param("schoolId") Long schoolId, @Param("machineCode") String machineCode, @Param("printPlanId") String printPlanId, @Param("status") String status, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("examPlace") String examPlace, @Param("examRoom") String examRoom, @Param("examStartTime") Long examStartTime, @Param("examEndTime") Long examEndTime, @Param("isDownload") Boolean isDownload, @Param("validate") Boolean validate, @Param("orgIds") Set<Long> orgIds, @Param("examDetailStatus") String[] examDetailStatus);

+ 2 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ExamPrintPlanService.java

@@ -39,6 +39,8 @@ public interface ExamPrintPlanService extends IService<ExamPrintPlan> {
      */
     IPage<PrintPlanResult> printPlanPage(Long schoolId, List<Long> printPlanIdList, PrintPlanStatusEnum status, Long startTime, Long endTime, int pageNumber, int pageSize);
 
+    IPage<PrintPlanResult> printPlanSyncPage(Long schoolId, Long printPlanId, Long startTime, Long endTime, int pageNumber, int pageSize);
+
     /**
      * 印刷计划模糊名称
      *

+ 20 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamPrintPlanServiceImpl.java

@@ -100,6 +100,26 @@ public class ExamPrintPlanServiceImpl extends ServiceImpl<ExamPrintPlanMapper, E
         return page;
     }
 
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public IPage<PrintPlanResult> printPlanSyncPage(Long schoolId, Long printPlanId, Long startTime, Long endTime, int pageNumber, int pageSize) {
+        Set<Long> orgIds = teachcloudCommonService.listSubOrgIds(null);
+        IPage<PrintPlanResult> page = examPrintPlanMapper.findPrintPlanSyncPage(new Page<>(pageNumber, pageSize), schoolId, printPlanId, startTime, endTime, orgIds);
+        List<PrintPlanResult> list = page.getRecords();
+        for (PrintPlanResult printPlanResult : list) {
+            List<Map> variableContent = JSONObject.parseArray(printPlanResult.getVariableContentTemp(), Map.class);
+            List<Map> ordinaryContent = JSONObject.parseArray(printPlanResult.getOrdinaryContentTemp(), Map.class);
+            printPlanResult.setVariableContent(variableContent);
+            printPlanResult.setOrdinaryContent(ordinaryContent);
+
+            double totalSubjects = examDetailService.calculateTotalSubjects(printPlanResult.getId());
+            double totalPackages = examDetailService.calculateTotalPackages(printPlanResult.getId());
+            printPlanResult.setTotalSubjects((int) totalSubjects);
+            printPlanResult.setTotalPackages((int) totalPackages);
+        }
+        return page;
+    }
+
     @Transactional(rollbackFor = Exception.class)
     @Override
     public List<PrintPlanBrief> printPlanBriefQuery(String source, String module) {

+ 24 - 23
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java

@@ -1340,20 +1340,22 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                 throw ExceptionResultEnum.ERROR.exception("通用规则未设置");
             }
 
-            if(Objects.isNull(examTask.getId())) {
-                if (StringUtils.isNotBlank(examTask.getPaperNumber())) {
-                    QueryWrapper<ExamTask> taskQueryWrapper = new QueryWrapper<>();
-                    taskQueryWrapper.lambda().eq(ExamTask::getSchoolId, schoolId).eq(ExamTask::getPaperNumber, examTask.getPaperNumber());
-                    ExamTask task = this.getOne(taskQueryWrapper);
-                    if (task != null && Objects.nonNull(examTask.getId()) && examTask.getId().longValue() != task.getId().longValue()) {
-                        throw ExceptionResultEnum.ERROR.exception("试卷编号已存在");
-                    }
-                } else {
-                    // 试卷编号生成规则:年月日(例如:20100419)+0000(例如:0001)顺序编号
-                    String paperNumber = printCommonService.createPaperNumber(schoolId);
-                    examTask.setPaperNumber(paperNumber);
+            if (StringUtils.isNotBlank(examTask.getPaperNumber())) {
+                QueryWrapper<ExamTask> taskQueryWrapper = new QueryWrapper<>();
+                taskQueryWrapper.lambda().eq(ExamTask::getSchoolId, schoolId).eq(ExamTask::getPaperNumber, examTask.getPaperNumber());
+                if (Objects.nonNull(examTask.getId())) {
+                    taskQueryWrapper.lambda().ne(ExamTask::getId, examTask.getId());
+                }
+                ExamTask task = this.getOne(taskQueryWrapper);
+                if (task != null) {
+                    throw ExceptionResultEnum.ERROR.exception("试卷编号已存在");
                 }
             } else {
+                // 试卷编号生成规则:年月日(例如:20100419)+0000(例如:0001)顺序编号
+                String paperNumber = printCommonService.createPaperNumber(schoolId);
+                examTask.setPaperNumber(paperNumber);
+            }
+            if (Objects.nonNull(examTask.getId())) {
                 ExamTask task = this.getById(examTask.getId());
                 examTask.setFlowId(task.getFlowId());
             }
@@ -1381,16 +1383,6 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
 
             // 提交时,校验
             if (ExamStatusEnum.SUBMIT.name().equals(examTaskDetail.getOperateType())) {
-                if (Objects.nonNull(examTask.getFlowId())) {
-                    // 审核一级
-                    Task task = taskService.createTaskQuery().processInstanceId(String.valueOf(examTask.getFlowId())).singleResult();
-                    if (Objects.nonNull(task)) {
-                        Map<String, Object> map1 = new HashMap<>();
-                        map1.computeIfAbsent(SystemConstant.FLOW_TASK_ID, v -> task.getId());
-                        activitiService.taskApprove(map1);
-                    }
-                }
-
                 if (StringUtils.isBlank(examTaskDetail.getPaperType())) {
                     throw ExceptionResultEnum.ERROR.exception("试卷类型不能为空");
                 }
@@ -1415,7 +1407,6 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                 }
 
                 // 是否强制包含试卷
-
                 List<Map> paperAttachmentIds = JSONObject.parseArray(examTaskDetail.getPaperAttachmentIds(), Map.class);
                 // 未上传试卷的类型个数
                 long count = paperAttachmentIds.stream().filter(m -> StringUtils.isBlank(m.get("attachmentId").toString())).count();
@@ -1432,6 +1423,16 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                         throw ExceptionResultEnum.ERROR.exception("所有类型的试卷文件必须全部上传或全部不上传");
                     }
                 }
+
+                if (Objects.nonNull(examTask.getFlowId())) {
+                    // 审核一级
+                    Task task = taskService.createTaskQuery().processInstanceId(String.valueOf(examTask.getFlowId())).singleResult();
+                    if (Objects.nonNull(task)) {
+                        Map<String, Object> map1 = new HashMap<>();
+                        map1.computeIfAbsent(SystemConstant.FLOW_TASK_ID, v -> task.getId());
+                        activitiService.taskApprove(map1);
+                    }
+                }
             }
 
             QueryWrapper<ExamTaskDetail> queryWrapper = new QueryWrapper<>();

+ 5 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/PrintCommonServiceServiceImpl.java

@@ -115,6 +115,9 @@ public class PrintCommonServiceServiceImpl implements PrintCommonService {
     @Resource
     private FileStoreUtil fileStoreUtil;
 
+    @Resource
+    TeachcloudCommonService teachcloudCommonService;
+
 
     /**
      * 保存附件
@@ -543,9 +546,10 @@ public class PrintCommonServiceServiceImpl implements PrintCommonService {
     @Override
     public List<BasicCourse> list(String param, List<Long> printPlanIdList) {
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
+        Set<Long> orgIds = teachcloudCommonService.listSubOrgIds(null);
         if (printPlanIdList.size() == 0) {
             QueryWrapper<BasicCourse> queryWrapper = new QueryWrapper<>();
-            queryWrapper.lambda().eq(BasicCourse::getSchoolId, schoolId);
+            queryWrapper.lambda().eq(BasicCourse::getSchoolId, schoolId).in(BasicCourse::getTeachingRoomId, orgIds);
             if (StringUtils.isNotBlank(param)) {
                 queryWrapper.lambda().and(i -> i.like(BasicCourse::getCode, SystemConstant.translateSpecificSign(param))
                         .or().like(BasicCourse::getName, SystemConstant.translateSpecificSign(param)));

+ 54 - 0
distributed-print-business/src/main/resources/mapper/ExamPrintPlanMapper.xml

@@ -88,6 +88,60 @@
         </where>
         ORDER BY a.update_time DESC
     </select>
+    <select id="findPrintPlanSyncPage"
+            resultType="com.qmth.distributed.print.business.bean.result.PrintPlanResult">
+        SELECT
+        a.id,
+        a.name,
+        a.exam_start_time AS examStartTime,
+        a.exam_end_time AS examEndTime,
+        a.status,
+        (
+        SELECT
+        COUNT(
+        DISTINCT ( course_code ))
+        FROM
+        exam_detail_course
+        WHERE
+        exam_detail_id IN ( SELECT id FROM exam_detail WHERE print_plan_id = a.id )) AS totalGates,
+        a.print_content AS printContent,
+        a.backup_method AS backupMethod,
+        a.backup_count AS backupCount,
+        a.draw_rule AS drawRule,
+        a.variable_content AS variableContentTemp,
+        a.ordinary_content AS ordinaryContentTemp,
+        a.create_id AS createId,
+        a.create_time AS createTime,
+        b.real_name AS createName,
+        a.third_relate_id thirdRelateId,
+        a.third_relate_name thirdRelateName,
+        a.sync_status syncStatus
+        FROM
+        exam_print_plan a
+        LEFT JOIN
+        sys_user b on a.create_id = b.id
+        <where>
+            <if test="schoolId != null and schoolId > 0">
+                and a.school_id = #{schoolId}
+            </if>
+            <if test="printPlanId!= null and printPlanId != ''">
+                and a.id = #{printPlanId}
+            </if>
+            <if test="startTime != null and startTime > 0">
+                and a.create_time >= #{startTime}
+            </if>
+            <if test="endTime != null and endTime > 0">
+                and #{endTime} >= a.create_time
+            </if>
+            <if test="orgIds != null">
+                AND b.org_id IN
+                <foreach collection="orgIds" item="item" index="index" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+        ORDER BY a.update_time DESC
+    </select>
     <select id="list" resultType="com.qmth.distributed.print.business.bean.result.PrintPlanBrief">
         select a.id, a.name, a.status from exam_print_plan a left join sys_user b on a.create_id = b.id
         <where>

+ 2 - 2
distributed-print-business/src/main/resources/mapper/ExamTaskMapper.xml

@@ -333,10 +333,10 @@
         f.setup,
         f.status as auditStatus,
         f.status as flowStatus,
-        false as myself,
         a.teacher_name teacherName,
         a.lecturer_name lecturerName,
-        so.name teachingRoomName
+        so.name teachingRoomName,
+        false as myself
         FROM
         exam_task a
         LEFT JOIN

+ 2 - 6
distributed-print/src/main/java/com/qmth/distributed/print/api/ExamPrintPlanSyncController.java

@@ -35,7 +35,6 @@ public class ExamPrintPlanSyncController {
      * 需要合并的计划查询
      *
      * @param printPlanId
-     * @param status
      * @param startTime
      * @param endTime
      * @param pageNumber
@@ -45,17 +44,14 @@ public class ExamPrintPlanSyncController {
     @ApiOperation(value = "印刷计划合并管理-计划查询")
     @RequestMapping(value = "/list_sync", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
-    public Result findPrintPlanPage(@ApiParam(value = "印刷计划ID") @RequestParam(required = false) String printPlanId,
-                                    @ApiParam(value = "印刷计划状态") @RequestParam(required = false) PrintPlanStatusEnum status,
+    public Result findPrintPlanPage(@ApiParam(value = "印刷计划ID") @RequestParam(required = false) Long printPlanId,
                                     @ApiParam(value = "计划创建时间段开始时间") @RequestParam(required = false) Long startTime,
                                     @ApiParam(value = "计划创建时间段结束时间") @RequestParam(required = false) Long endTime,
                                     @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber,
                                     @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
 
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
-        List<Long> idList = new ArrayList<>();
-        idList.add(SystemConstant.convertIdToLong(printPlanId));
-        return ResultUtil.ok(examPrintPlanService.printPlanPage(schoolId, idList, status, startTime, endTime, pageNumber, pageSize));
+        return ResultUtil.ok(examPrintPlanService.printPlanSyncPage(schoolId, printPlanId, startTime, endTime, pageNumber, pageSize));
     }
 
     /**

+ 8 - 8
distributed-print/src/main/java/com/qmth/distributed/print/api/ExamTaskController.java

@@ -1,19 +1,20 @@
 package com.qmth.distributed.print.api;
 
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.qmth.boot.api.annotation.Aac;
-import com.qmth.boot.api.annotation.BOOL;
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.boot.api.exception.ApiException;
-import com.qmth.distributed.print.business.bean.dto.*;
+import com.qmth.distributed.print.business.bean.dto.ExamTaskDetailCardDto;
+import com.qmth.distributed.print.business.bean.dto.ExamTaskImportDto;
+import com.qmth.distributed.print.business.bean.dto.ExamTaskPrintDto;
 import com.qmth.distributed.print.business.bean.params.ExamTaskApplyParam;
 import com.qmth.distributed.print.business.bean.result.EditResult;
 import com.qmth.distributed.print.business.entity.*;
-import com.qmth.distributed.print.business.enums.*;
+import com.qmth.distributed.print.business.enums.ExamStatusEnum;
+import com.qmth.distributed.print.business.enums.MakeMethodEnum;
+import com.qmth.distributed.print.business.enums.MessageEnum;
+import com.qmth.distributed.print.business.enums.ReviewStatusEnum;
 import com.qmth.distributed.print.business.service.*;
 import com.qmth.distributed.print.business.templete.execute.AsyncCreatePdfTempleteService;
 import com.qmth.distributed.print.business.templete.execute.AsyncTaskReviewSampleExportService;
-import com.qmth.teachcloud.common.bean.dto.BlurryUserDto;
 import com.qmth.teachcloud.common.bean.params.ArraysParams;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicAttachment;
@@ -24,7 +25,6 @@ import com.qmth.teachcloud.common.enums.TaskTypeEnum;
 import com.qmth.teachcloud.common.enums.UploadFileEnum;
 import com.qmth.teachcloud.common.service.BasicAttachmentService;
 import com.qmth.teachcloud.common.service.TBTaskService;
-import com.qmth.teachcloud.common.service.TeachcloudCommonService;
 import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
@@ -587,7 +587,7 @@ public class ExamTaskController {
             printCommonService.checkData(task.getSchoolId(), task.getCourseCode(), task.getPaperNumber(), (SysUser) ServletUtil.getRequestUser());
         }
 
-        return ResultUtil.ok(String.valueOf(task.getId()), "");
+        return ResultUtil.ok(task);
     }
 
     /**