xiaofei hace 1 año
padre
commit
629a90d641

+ 7 - 7
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/PrintCommonService.java

@@ -50,10 +50,10 @@ public interface PrintCommonService {
      * @throws IOException
      */
     BasicAttachment saveAttachmentPdf(ClassifyEnum classifyEnum, ExamDetail examDetail, BasicAttachment basicAttachment,
-            List<PdfDto> pdfList, Integer printCount, Integer sequence) throws IOException, DocumentException;
+                                      List<PdfDto> pdfList, Integer printCount, Integer sequence) throws IOException, DocumentException;
 
     void saveAttachmentSignPdf(PdfSignDto pdfFillDto, ExamDetail examDetail, List<PdfDto> pdfList, Integer printCount,
-            List<File> fileTempList, BasicTemplate basicTemplate);
+                               List<File> fileTempList, BasicTemplate basicTemplate);
 
     void saveAttachmentSignPdf(PdfSignDto pdfFillDto, ExamDetail examDetail, Integer printCount, BasicTemplate basicTemplate);
 
@@ -69,11 +69,11 @@ public interface PrintCommonService {
      * @throws IOException
      */
     BasicAttachment saveAttachmentHtml(String fileName, String htmlContent, Long userId, List<PdfDto> localFileList,
-            List<File> fileTempList) throws IOException;
+                                       List<File> fileTempList) throws IOException;
 
-    BasicAttachment saveAttachmentPdfFromHtml(String fileName, String htmlContent, Long userId, List<PdfDto> localFileList) throws IOException;
+    BasicAttachment saveAttachmentPdfFromHtml(String fileName, String htmlContent, Long userId, List<PdfDto> localFileList, List<File> fileTempList) throws IOException;
 
-    BasicAttachment saveAttachmentPdfFromHtml(String fileName, File file, Long userId, List<PdfDto> localFileList)
+    BasicAttachment saveAttachmentPdfFromHtml(String fileName, File file, Long userId, List<PdfDto> localFileList, List<File> fileTempList)
             throws IOException;
 
     /**
@@ -254,7 +254,7 @@ public interface PrintCommonService {
      * @return 结果
      */
     List<ExamStudent> createBatchStudentByStudentList(Long schoolId, Long examId, String semesterId, ExamTask examTask,
-            String extendFields, List<ExamTaskStudentObjectParam> examTaskStudentObjectParamList, Long examDetailCourseId, Long cardRuleId, SysUser sysUser);
+                                                      String extendFields, List<ExamTaskStudentObjectParam> examTaskStudentObjectParamList, Long examDetailCourseId, Long cardRuleId, SysUser sysUser);
 
     /**
      * 保存任务附件(导出)
@@ -285,7 +285,7 @@ public interface PrintCommonService {
     public void updateGradeBatchStatus(Long schoolId, Long examId, String paperNumber, String paperType);
 
     void saveAttachmentPackagePdf(PdfPackageDto pdfPackageDto, ExamDetail examDetail, List<PdfDto> variablePdfList,
-            Integer printCount, List<File> fileTempList);
+                                  Integer printCount, List<File> fileTempList);
 
     void saveAttachmentPackagePdf(PdfPackageDto pdfPackageDto, ExamDetail examDetail, Integer printCount);
 

+ 6 - 6
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/PrintCommonServiceImpl.java

@@ -68,7 +68,6 @@ import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
-import java.util.stream.Collectors;
 
 /**
  * @Description: 公共服务service impl
@@ -617,18 +616,19 @@ public class PrintCommonServiceImpl implements PrintCommonService {
      * @param htmlContent
      * @param userId
      * @param localFileList
+     * @param fileTempList
      * @return
      */
     @Override
     @Transactional
-    public BasicAttachment saveAttachmentPdfFromHtml(String fileName, String htmlContent, Long userId, List<PdfDto> localFileList) {
+    public BasicAttachment saveAttachmentPdfFromHtml(String fileName, String htmlContent, Long userId, List<PdfDto> localFileList, List<File> fileTempList) {
         BasicAttachment basicAttachment = null;
         File htmlFileTemp = null;
         try {
             htmlFileTemp = SystemConstant.getFileTempVar(SystemConstant.HTML_PREFIX);
             FileCopyUtils.copy(htmlContent.getBytes(StandardCharsets.UTF_8), htmlFileTemp);
 
-            return saveAttachmentPdfFromHtml(fileName, htmlFileTemp, userId, localFileList);
+            return saveAttachmentPdfFromHtml(fileName, htmlFileTemp, userId, localFileList, fileTempList);
         } catch (Exception e) {
             log.error(SystemConstant.LOG_ERROR, e);
             basicAttachmentService.deleteAttachment(basicAttachment);
@@ -647,7 +647,7 @@ public class PrintCommonServiceImpl implements PrintCommonService {
 
     @Override
     @Transactional
-    public BasicAttachment saveAttachmentPdfFromHtml(String fileName, File file, Long userId, List<PdfDto> localFileList) {
+    public BasicAttachment saveAttachmentPdfFromHtml(String fileName, File file, Long userId, List<PdfDto> localFileList, List<File> fileTempList) {
         BasicAttachment basicAttachment = null;
         File pdfFileTemp = null;
         try {
@@ -662,7 +662,7 @@ public class PrintCommonServiceImpl implements PrintCommonService {
 
             PdfDto pdfDto = PdfUtil.addPdfPage(pdfFileTemp);
             if (localFileList != null) {
-                localFileList.add(new PdfDto(filePathVo.getPath(), PageSizeEnum.A3, pdfDto.getPageCount()));
+                localFileList.add(new PdfDto(pdfFileTemp.getPath(), PageSizeEnum.A3, pdfDto.getPageCount()));
             }
             basicAttachment = new BasicAttachment(JSON.toJSONString(filePathVo), fileName, SystemConstant.PDF_PREFIX, new BigDecimal(file.length()), filePathVo.getMd5(), userId);
             basicAttachment.setPages(pdfDto.getActualPageCount());
@@ -680,7 +680,7 @@ public class PrintCommonServiceImpl implements PrintCommonService {
                 FileUtil.deleteFile(file);
             }
             if (pdfFileTemp != null) {
-                FileUtil.deleteFile(pdfFileTemp);
+                fileTempList.add(pdfFileTemp);
             }
         }
         return basicAttachment;

+ 2 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/PdfTaskLogicServiceImpl.java

@@ -287,7 +287,7 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
                 if (examStudentList != null && examStudentList.size() > 0) {
                     for (ExamStudent t : examStudentList) {
                         // 用带条码的模板
-                        createPdfNewUtil.examStudentHtml(examCardMap.get(t.getPaperType()).getHtmlContent(), t, t.getPaperType(), examDetail, tbTaskPdf.getCreateId(), createPdfDto.getCardPdfList(), basicCardRule);
+                        createPdfNewUtil.examStudentHtml(examCardMap.get(t.getPaperType()).getHtmlContent(), t, t.getPaperType(), examDetail, tbTaskPdf.getCreateId(), createPdfDto.getCardPdfList(), createPdfDto.getFileTempList(), basicCardRule);
                     }
                     examStudentService.updateBatchById(examStudentList);
                 } else if (examDetailCourse.getTotalSubjects() != null) {
@@ -298,7 +298,7 @@ public class PdfTaskLogicServiceImpl implements PdfTaskLogicService {
                         int seq = atomicInteger.getAndIncrement();
                         int mod = seq % examTaskDetail.getDrawCount();
                         String tempPaperType = paperTypes[mod];
-                        BasicAttachment basicAttachment = createPdfNewUtil.examStudentHtml(examCardMap.get(tempPaperType).getHtmlContent(), null, tempPaperType, examDetail, tbTaskPdf.getCreateId(), createPdfDto.getCardPdfList(), basicCardRule);
+                        BasicAttachment basicAttachment = createPdfNewUtil.examStudentHtml(examCardMap.get(tempPaperType).getHtmlContent(), null, tempPaperType, examDetail, tbTaskPdf.getCreateId(), createPdfDto.getCardPdfList(), createPdfDto.getFileTempList(), basicCardRule);
 
                         if (!stringBasicAttachmentMap.containsKey(tempPaperType)) {
                             stringBasicAttachmentMap.put(tempPaperType, basicAttachment);

+ 6 - 5
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/pdf/CreatePdfNewUtil.java

@@ -107,7 +107,7 @@ public class CreatePdfNewUtil {
         } else {
             File htmlFileTemp = SystemConstant.getFileTempVar(SystemConstant.HTML_PREFIX);
             File file = fileUploadService.downloadFile(basicAttachment.getId(), htmlFileTemp.getPath());
-            BasicAttachment attachment = printCommonService.saveAttachmentPdfFromHtml(String.valueOf(basicAttachment.getId()), file, examDetail.getCreateId(), null);
+            BasicAttachment attachment = printCommonService.saveAttachmentPdfFromHtml(String.valueOf(basicAttachment.getId()), file, examDetail.getCreateId(), null, null);
             FilePathVo filePathVo1 = JSON.parseObject(attachment.getPath(), FilePathVo.class);
             PrintPathVo printPathVo = new PrintPathVo(ClassifyEnum.CHECK_IN, filePathVo1.getUploadType(), filePathVo1.getType(), filePathVo1.getPath(), attachment.getMd5(), null, null);
             examDetail.setAttachmentPath(printCommonService.parseAttachmentPath(examDetail.getAttachmentPath(), printPathVo));
@@ -802,10 +802,11 @@ public class CreatePdfNewUtil {
      * @param examDetail         考场对象
      * @param userId             当前用户ID
      * @param examStudentPdfList 考生题卡集合
+     * @param fileTempList
      * @param basicCardRule      题卡规则
      */
     public BasicAttachment examStudentHtml(String studentHtml, ExamStudent examStudent, String paperType, ExamDetail examDetail,
-                                           Long userId, List<PdfDto> examStudentPdfList, BasicCardRule basicCardRule) throws IOException {
+                                           Long userId, List<PdfDto> examStudentPdfList, List<File> fileTempList, BasicCardRule basicCardRule) throws IOException {
         if (ExamNumberStyleEnum.PRINT.equals(basicCardRule.getExamNumberStyle())) {
             // 生成学生考号条码并将图片转成base64
             studentHtml = studentHtml.replaceAll("\\$\\{studentCodeBarcode\\}", examStudent != null && examStudent.getStudentCode() != null ? GoogleBarCodeUtil.createBarCode(examStudent.getStudentCode(), false) : "");
@@ -832,7 +833,7 @@ public class CreatePdfNewUtil {
         // 将其它未匹配到值的参数,填入空值
         studentHtml = studentHtml.replaceAll("\\$\\{[A-Za-z0-9]+\\}", "");
         //学生题卡
-        BasicAttachment examStudentAttachment = printCommonService.saveAttachmentPdfFromHtml(examStudent != null ? examStudent.getId() + "|" + examStudent.getStudentCode() : SystemConstant.getNanoId(), studentHtml, userId, examStudentPdfList);
+        BasicAttachment examStudentAttachment = printCommonService.saveAttachmentPdfFromHtml(examStudent != null ? examStudent.getId() + "|" + examStudent.getStudentCode() : SystemConstant.getNanoId(), studentHtml, userId, examStudentPdfList, fileTempList);
         if (examStudent != null) {
             examStudent.setAttachmentId(examStudentAttachment.getId());
         }
@@ -942,7 +943,7 @@ public class CreatePdfNewUtil {
      * @return
      * @throws IOException
      */
-    public BasicAttachment cardHtml(String packageCode, String cardContent, String paperType, Long userId, List<PdfDto> cardPdfList, BasicCardRule basicCardRule) throws
+    public BasicAttachment cardHtml(String packageCode, String cardContent, String paperType, Long userId, List<PdfDto> cardPdfList, List<File> fileTempList, BasicCardRule basicCardRule) throws
             IOException {
         //通用题卡
         String cardTemp = cardContent;
@@ -979,7 +980,7 @@ public class CreatePdfNewUtil {
         String packageCodeImg = GoogleBarCodeUtil.createBarCode(packageCode, false);
         cardTemp = cardTemp.replaceAll("\\$\\{packageCodeDom\\}", "<img src='" + "data:image/png;base64," + packageCodeImg + "'><p>" + packageCode + "</p>");
 
-        return printCommonService.saveAttachmentPdfFromHtml(packageCode + paperType, cardTemp, userId, cardPdfList);
+        return printCommonService.saveAttachmentPdfFromHtml(packageCode + paperType, cardTemp, userId, cardPdfList, fileTempList);
     }
 
     /**

+ 15 - 0
distributed-print-business/src/main/resources/db/delete-data.sql

@@ -9,6 +9,7 @@ DELETE t FROM basic_course t where t.school_id = #{schoolId};
 DELETE t FROM t_c_statistics_temp t where exists(select temp.* from(select be.id from basic_exam be where be.school_id = #{schoolId}) temp where t.exam_id = temp.id);
 DELETE t FROM t_c_statistics t where exists(select temp.* from(select be.id from basic_exam be where be.school_id = #{schoolId}) temp where t.exam_id = temp.id);
 delete from mark_arbitrate_history where exam_id in (select id from basic_exam where school_id = #{schoolId});
+delete from mark_document where exam_id in (select id from basic_exam where school_id = #{schoolId});
 delete from mark_group where exam_id in (select id from basic_exam where school_id = #{schoolId});
 delete from mark_group_student where exam_id in (select id from basic_exam where school_id = #{schoolId});
 delete from mark_header_subjective_score where exam_id in (select id from basic_exam where school_id = #{schoolId});
@@ -47,6 +48,8 @@ DELETE t FROM basic_teach_course t where t.school_id = #{schoolId};
 DELETE t FROM basic_student t where t.school_id = #{schoolId};
 DELETE t FROM basic_template t where t.school_id = #{schoolId};
 DELETE t FROM basic_template_org t where t.school_id = #{schoolId};
+DELETE t FROM basic_teach_clazz t where t.school_id = #{schoolId};
+DELETE t FROM basic_exam_student t where t.school_id = #{schoolId};
 DELETE t FROM basic_user_course t where t.school_id = #{schoolId};
 DELETE t FROM basic_verify_code t where t.school_id = #{schoolId};
 DELETE t FROM basic_role_data_permission t where t.school_id = #{schoolId};
@@ -55,6 +58,10 @@ DELETE t FROM client_print_data t where t.school_id = #{schoolId};
 DELETE t FROM client_status t where t.school_id = #{schoolId};
 
 DELETE t FROM cloud_user_push_status t where t.school_id = #{schoolId};
+DELETE t FROM course_target t where t.school_id = #{schoolId};
+DELETE t FROM course_evaluation t where t.school_id = #{schoolId};
+DELETE t FROM course_weight t where t.school_id = #{schoolId};
+DELETE t FROM course_dimension t where t.school_id = #{schoolId};
 
 DELETE t FROM exam_card_detail t where exists(select temp.* from(select ecd.id from exam_card_detail ecd join exam_card ec on ec.id = ecd.card_id where ec.school_id = #{schoolId}) temp where t.id = temp.id);
 DELETE t FROM exam_card t where t.school_id = #{schoolId};
@@ -68,6 +75,8 @@ DELETE t FROM exam_paper_structure t where t.school_id = #{schoolId};
 DELETE t FROM exam_print_plan t where t.school_id = #{schoolId};
 DELETE t FROM exam_student t where t.school_id = #{schoolId};
 DELETE t FROM exam_task t where t.school_id = #{schoolId};
+DELETE t FROM exam_task_assign_paper_type t where t.exam_id in (select id from basic_exam where school_id = #{schoolId});
+DELETE t FROM exam_task_paper_data t where exam_id in (select id from basic_exam where school_id = #{schoolId});
 DELETE t FROM exam_task_apply_temp t where t.school_id = #{schoolId};
 DELETE t FROM exam_task_detail t where exists(select temp.* from(select et.id from exam_task et where et.school_id = #{schoolId}) temp where t.exam_task_id = temp.id);
 DELETE t FROM exam_task_paper_log t where exists(select temp.* from(select et.id from exam_task et where et.school_id = #{schoolId}) temp where t.exam_task_id = temp.id);
@@ -97,6 +106,10 @@ DELETE t FROM sys_user t where t.school_id = #{schoolId};
 DELETE t FROM t_b_session t where t.school_id = #{schoolId};
 DELETE t FROM t_b_sync_task t where t.school_id = #{schoolId};
 DELETE t FROM t_b_task t where t.school_id = #{schoolId};
+DELETE t FROM t_b_task_pdf t where t.school_id = #{schoolId};
+DELETE t FROM t_c_paper_struct t where exam_id in (select id from basic_exam where school_id = #{schoolId});
+DELETE t FROM t_c_final_score t where exam_id in (select id from basic_exam where school_id = #{schoolId});
+DELETE t FROM t_c_usual_score t where exam_id in (select id from basic_exam where school_id = #{schoolId});
 DELETE t FROM t_f_flow_join t where exists(select temp.* from (select tffe.id from t_f_custom_flow_entity tffe join t_f_custom_flow tfcf on tfcf.id = tffe.t_f_custom_flow_id where tfcf.school_id = #{schoolId}) temp where t.flow_entity_id = temp.id);
 DELETE t FROM t_f_custom_flow_entity t where exists(select temp.* from(select tfcf.id from t_f_custom_flow tfcf where tfcf.school_id = #{schoolId}) temp where t.t_f_custom_flow_id = temp.id);
 DELETE t FROM t_f_custom_flow t where t.school_id = #{schoolId};
@@ -104,6 +117,8 @@ DELETE t FROM t_f_flow_approve t where t.school_id = #{schoolId};
 DELETE t FROM t_f_flow_log t where t.school_id = #{schoolId};
 DELETE t FROM t_g_error t where t.school_id = #{schoolId};
 DELETE t FROM t_m_mq_message t where t.school_id = #{schoolId};
+DELETE t FROM t_r_exam_student t where t.r_basic_info_id in (select id from t_r_basic_info t where exam_id in (select id from basic_exam where school_id = #{schoolId}));
+DELETE t FROM t_r_basic_info t where exam_id in (select id from basic_exam where school_id = #{schoolId});
 DELETE t FROM t_s_auth t where t.school_id = #{schoolId};
 DELETE t FROM t_school_privilege t where t.school_id = #{schoolId};
 DELETE t FROM t_school_role t where t.school_id = #{schoolId};