Эх сурвалжийг харах

3.1.0-考生推送试卷类型

xiaof 3 жил өмнө
parent
commit
edd665b0ea

+ 10 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/SyncExamStudentDto.java

@@ -16,6 +16,8 @@ public class SyncExamStudentDto extends ExamStudent {
 
     private String sequence;
 
+    private String packageCode;
+
     public String getCourseCode() {
         return courseCode;
     }
@@ -47,4 +49,12 @@ public class SyncExamStudentDto extends ExamStudent {
     public void setSequence(String sequence) {
         this.sequence = sequence;
     }
+
+    public String getPackageCode() {
+        return packageCode;
+    }
+
+    public void setPackageCode(String packageCode) {
+        this.packageCode = packageCode;
+    }
 }

+ 4 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/DataSyncServiceImpl.java

@@ -3,7 +3,6 @@ package com.qmth.distributed.print.business.service.impl;
 import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.Update;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.qmth.boot.api.exception.ApiException;
 import com.qmth.distributed.print.business.bean.dto.SyncExamCardDto;
@@ -491,7 +490,10 @@ public class DataSyncServiceImpl implements DataSyncService {
                 String teacher = "无";
                 String subjectCode = examStudent.getCourseCode() + examStudent.getPaperType() + examStudent.getSequence(); // 取试卷编号
                 String subjectName = examStudent.getCourseName();
-                boolean syncStudent = cloudMarkingTaskUtils.syncStudent(schoolId, examId, examNumber, studentCode, name, college, className, teacher, subjectCode, subjectName, null, null, null, null);
+                String packageCode = examStudent.getPackageCode();
+                // 试卷类型和客观题试卷类型一致  update by 20220713
+                String paperType = examStudent.getPaperType();
+                boolean syncStudent = cloudMarkingTaskUtils.syncStudent(schoolId, examId, examNumber, studentCode, name, college, className, teacher, subjectCode, subjectName, packageCode, paperType, null, null);
 
                 if (syncStudent) {
                     UpdateWrapper<ExamStudent> updateWrapper = new UpdateWrapper<>();

+ 15 - 9
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/push/AsyncPushTaskTemplate.java

@@ -73,8 +73,7 @@ public abstract class AsyncPushTaskTemplate {
      * @param tbSyncTask
      */
     public void createTxt(TBSyncTask tbSyncTask) {
-//        OssUtil ossUtil = SpringContextHolder.getBean(OssUtil.class);
-        TBTaskService tbTaskService = SpringContextHolder.getBean(TBTaskService.class);
+        FileStoreUtil fileStoreUtil = SpringContextHolder.getBean(FileStoreUtil.class);
         ByteArrayOutputStream out = null;
         InputStream inputStream = null;
         try {
@@ -82,21 +81,29 @@ public abstract class AsyncPushTaskTemplate {
             out.write(tbSyncTask.getSummary().getBytes(StandardCharsets.UTF_8));
             byte[] bookByteAry = out.toByteArray();
             inputStream = new ByteArrayInputStream(bookByteAry);
-            LocalDateTime nowTime = LocalDateTime.now();
+
+            DictionaryConfig dictionaryConfig = SpringContextHolder.getBean(DictionaryConfig.class);
             StringJoiner stringJoiner = new StringJoiner("");
+            JSONObject json = new JSONObject();
+            if (Objects.nonNull(dictionaryConfig) && dictionaryConfig.sysDomain().isOss()) {
+                json.put(SystemConstant.TYPE, SystemConstant.OSS);
+            } else {
+                stringJoiner.add(SystemConstant.TEMP_FILES_DIR).add(File.separator);
+                json.put(SystemConstant.TYPE, SystemConstant.LOCAL);
+            }
             stringJoiner.add(UploadFileEnum.FILE.getTitle()).add(File.separator);
+            LocalDateTime nowTime = LocalDateTime.now();
             stringJoiner.add(String.valueOf(nowTime.getYear())).add(File.separator)
                     .add(String.format("%02d", nowTime.getMonthValue())).add(File.separator)
                     .add(String.format("%02d", nowTime.getDayOfMonth()))
                     .add(File.separator).add(SystemConstant.getUuid()).add(TXT_PREFIX);
+
             String path = stringJoiner.toString().replaceAll("\\\\","/");
-            boolean oss = dictionaryConfig.sysDomain().isOss();
+            String type = (String) json.get(SystemConstant.TYPE);
 
-            JSONObject json = new JSONObject();
-            if (oss) {//上传至oss
-                FileStoreUtil fileStoreUtil = SpringContextHolder.getBean(FileStoreUtil.class);
+            //上传至oss
+            if (Objects.equals(type, SystemConstant.OSS)) {
                 fileStoreUtil.ossUpload(path, inputStream, DigestUtils.md5Hex(new ByteArrayInputStream(bookByteAry)), fileStoreUtil.getUploadEnumByPath(stringJoiner.toString()).getFssType());
-                json.put(SystemConstant.TYPE, SystemConstant.OSS);
             } else {//上传至服务器
                 File finalFile = new File(stringJoiner.toString());
                 if (!finalFile.exists()) {
@@ -104,7 +111,6 @@ public abstract class AsyncPushTaskTemplate {
                     finalFile.createNewFile();
                 }
                 FileUtils.copyInputStreamToFile(inputStream, finalFile);
-                json.put(SystemConstant.TYPE, SystemConstant.LOCAL);
             }
             json.put(SystemConstant.PATH, path);
             json.put(SystemConstant.UPLOAD_TYPE, UploadFileEnum.FILE);

+ 1 - 0
distributed-print-business/src/main/resources/mapper/ExamStudentMapper.xml

@@ -108,6 +108,7 @@
                a.clazz_name    clazzName,
                a.extend_fields extendFields,
                a.paper_type    paperType,
+               c.package_code pachageCode,
                et.sequence
         FROM exam_student a
                  LEFT JOIN