Jelajahi Sumber

Merge remote-tracking branch 'origin/dev_v3.0.1' into dev_v3.0.1

wangliang 3 tahun lalu
induk
melakukan
9a3b15a30e
19 mengubah file dengan 171 tambahan dan 54 penghapusan
  1. 9 0
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ExamTaskDto.java
  2. 2 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/EnumType.java
  3. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamPaperStructureMapper.java
  4. 8 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/DownloadServiceImpl.java
  5. 35 18
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamCardServiceImpl.java
  6. 7 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamPaperGroupMarkerServiceImpl.java
  7. 1 1
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamPaperStructureServiceImpl.java
  8. 8 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/TaskLogicServiceImpl.java
  9. 38 15
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/HtmlToJpgUtil.java
  10. 3 0
      distributed-print-business/src/main/resources/mapper/ExamTaskMapper.xml
  11. 1 0
      distributed-print-business/src/main/resources/mapper/TBSyncTaskMapper.xml
  12. 1 1
      distributed-print-business/src/main/resources/mapper/TeachStudentMapper.xml
  13. 4 1
      distributed-print/src/main/java/com/qmth/distributed/print/api/EnumsController.java
  14. 1 1
      distributed-print/src/main/java/com/qmth/distributed/print/api/ExamCardController.java
  15. 1 1
      distributed-print/src/main/resources/application-test.properties
  16. 12 1
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/result/SyncListResult.java
  17. 15 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/enums/TaskStatusEnum.java
  18. 23 8
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/HttpKit.java
  19. 1 1
      teachcloud-task/src/main/resources/application-task_test.properties

+ 9 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ExamTaskDto.java

@@ -20,6 +20,7 @@ public class ExamTaskDto {
     private String paperNumber;
     private String courseCode;
     private String courseName;
+    private String sequence;
     private String specialty;
     private String cardRuleId;
     private String cardRuleName;
@@ -163,6 +164,14 @@ public class ExamTaskDto {
         this.courseName = courseName;
     }
 
+    public String getSequence() {
+        return sequence;
+    }
+
+    public void setSequence(String sequence) {
+        this.sequence = sequence;
+    }
+
     public String getSpecialty() {
         return specialty;
     }

+ 2 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/enums/EnumType.java

@@ -27,7 +27,8 @@ public enum EnumType {
     EXAMINATION_DB_FIELDS_ENUM("考务数据导入-数据库所必须字段枚举"),
     CARD_TYPE("题卡类型"),
     SYSTEM_CODE_ENUM("系统编码类型"),
-    PUSH_TYPE_ENUM("同步云阅卷类型类型");
+    PUSH_TYPE_ENUM("同步云阅卷类型"),
+    TB_TASK_STATUS("同步云阅卷日志表状态类型");
 
     EnumType(String desc) {
         this.desc = desc;

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/mapper/ExamPaperStructureMapper.java

@@ -18,5 +18,5 @@ import java.util.List;
 public interface ExamPaperStructureMapper extends BaseMapper<ExamPaperStructure> {
     IPage<ExamPaperStructure> listByPropositionTeacherId(@Param("page") Page<ExamPaperStructure> page, @Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId, @Param("propositionTeacherId") Long propositionTeacherId, @Param("syncStatus") String syncStatus, @Param("structureStatusEnums") String[] structureStatusEnums);
 
-    List<ExamPaperStructure> listByPropositionTeacherId(@Param("schoolId") Long schoolId, @Param("propositionTeacherId") Long propositionTeacherId, @Param("syncStatus") String syncStatus, @Param("structureStatusEnums") String[] structureStatusEnums);
+    List<ExamPaperStructure> listByPropositionTeacherId(@Param("schoolId") Long schoolId, @Param("semesterId") Long semesterId, @Param("examId") Long examId, @Param("propositionTeacherId") Long propositionTeacherId, @Param("syncStatus") String syncStatus, @Param("structureStatusEnums") String[] structureStatusEnums);
 }

+ 8 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/DownloadServiceImpl.java

@@ -20,6 +20,7 @@ import com.qmth.distributed.print.business.service.DownloadService;
 import com.qmth.distributed.print.business.service.ExamPrintPlanService;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicAttachment;
+import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.service.BasicAttachmentService;
 import com.qmth.distributed.print.business.service.ExamCardDetailService;
@@ -32,6 +33,7 @@ import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.PageSizeEnum;
 import com.qmth.teachcloud.common.mapper.BasicAttachmentMapper;
 import com.qmth.teachcloud.common.service.AttachmentCommonService;
+import com.qmth.teachcloud.common.service.SysOrgService;
 import com.qmth.teachcloud.common.service.TeachcloudCommonService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
@@ -82,6 +84,9 @@ public class DownloadServiceImpl implements DownloadService {
     @Resource
     CreatePdfUtil createPdfUtil;
 
+    @Resource
+    SysOrgService sysOrgService;
+
     @Override
     public IPage<ExamTaskDetailDto> page(Long semesterId, Long examId, Long orgId, String courseName, Integer pageNumber, Integer pageSize) {
         Page<ExamTaskDetailDto> page = new Page<>(pageNumber, pageSize);
@@ -179,7 +184,9 @@ public class DownloadServiceImpl implements DownloadService {
         } else {
             Set<Long> orgIds = null;
             if (orgId != null) {
-                orgIds = teachcloudCommonService.listSubOrgIds(orgId);
+                List<Long> orgList = new ArrayList<>();
+                orgList.add(orgId);
+                orgIds = sysOrgService.findDeepOrgIdListByOrgIdList(orgList);
             }
             examTaskDetailDtoList = examTaskMapper.listExamTaskDetailDownloadByQuery(semesterId, examId, pCourseName, orgIds, null);
         }

+ 35 - 18
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamCardServiceImpl.java

@@ -22,7 +22,6 @@ import com.qmth.distributed.print.business.util.HtmlToJpgUtil;
 import com.qmth.teachcloud.common.bean.params.ArraysParams;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicAttachment;
-import com.qmth.teachcloud.common.entity.BasicExam;
 import com.qmth.teachcloud.common.entity.SysOrg;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.CardCreateMethodEnum;
@@ -33,7 +32,6 @@ import com.qmth.teachcloud.common.service.BasicCourseService;
 import com.qmth.teachcloud.common.service.TeachcloudCommonService;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -54,25 +52,25 @@ import java.util.stream.Collectors;
 @Service
 public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> implements ExamCardService {
 
-    @Autowired
+    @Resource
     private BasicExamRuleService basicExamRuleService;
 
-    @Autowired
+    @Resource
     private ExamCardDetailService examCardDetailService;
 
-    @Autowired
+    @Resource
     private ExamTaskDetailService examTaskDetailService;
 
-    @Autowired
+    @Resource
     private ExamTaskService examTaskService;
 
-    @Autowired
+    @Resource
     private BasicAttachmentService basicAttachmentService;
 
     @Resource
     TeachcloudCommonService teachcloudCommonService;
 
-    @Autowired
+    @Resource
     BasicCourseService basicCourseService;
 
     @Resource
@@ -81,9 +79,16 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
     @Resource
     HtmlToJpgUtil htmlToJpgUtil;
 
+    @Resource
+    BasicPrintConfigService basicPrintConfigService;
+
+    @Resource
+    BasicCardRuleService basicCardRuleService;
+
     @Transactional
     @Override
     public String saveExamCard(ExamCardParams examCardParams) throws Exception {
+        // ↓专卡
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         SysUser user = (SysUser) ServletUtil.getRequestUser();
 
@@ -118,8 +123,12 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
             examCardDetail = new ExamCardDetail();
             examCardDetail.setCardId(examCard.getId());
             examCardDetail.setContent(examCardParams.getContent());
-            examCardDetail.setHtmlContent(examCardParams.getHtmlContent());
-            examCardDetail.setJpgAttachmentInfo(JSON.toJSONString(htmlToJpgUtil.convertHtmlToJpgByCard(examCard.getTitle(),examCardParams.getHtmlContent(),PageSizeEnum.A3)));
+            String htmlContent = examCardParams.getHtmlContent();
+            List<ConvertJpgStorage> convertJpgStorageList = htmlToJpgUtil.convertHtmlToJpgByCard(examCard.getTitle(),htmlContent,PageSizeEnum.A3);
+            if (convertJpgStorageList.size() > 0){
+                examCardDetail.setJpgAttachmentInfo(JSON.toJSONString(convertJpgStorageList));
+            }
+            examCardDetail.setHtmlContent(htmlContent);
             examCardDetail.setAttachmentId(examCardParams.getAttachmentId());
             examCardDetail.insertInfo(user.getId());
             examCardDetailService.save(examCardDetail);
@@ -144,16 +153,20 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
                 throw ExceptionResultEnum.ERROR.exception("题卡数据有误");
             }
             examCardDetail.setContent(examCardParams.getContent());
-            examCardDetail.setHtmlContent(examCardParams.getHtmlContent());
-            examCardDetail.setJpgAttachmentInfo(JSON.toJSONString(htmlToJpgUtil.convertHtmlToJpgByCard(examCard.getTitle(),examCardParams.getHtmlContent(),PageSizeEnum.A3)));
+            String htmlContent = examCardParams.getHtmlContent();
+            List<ConvertJpgStorage> convertJpgStorageList = htmlToJpgUtil.convertHtmlToJpgByCard(examCard.getTitle(),htmlContent,PageSizeEnum.A3);
+            if (convertJpgStorageList.size() > 0){
+                examCardDetail.setJpgAttachmentInfo(JSON.toJSONString(convertJpgStorageList));
+            }
+            examCardDetail.setHtmlContent(htmlContent);
             examCardDetail.setAttachmentId(examCardParams.getAttachmentId());
             examCardDetail.updateInfo(user.getId());
             examCardDetailService.updateById(examCardDetail);
-
         }
 
         // 绑定命题任务
         examTaskDetailService.bindCardId(examCardParams.getExamTaskId(), examCard);
+
         return String.valueOf(examCard.getId());
     }
 
@@ -245,7 +258,7 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
             List<ExamCard> customCards = this.baseMapper.listCustom(schoolId, sysUser.getOrgId(), courseCode, CardTypeEnum.CUSTOM.name());
             if (!customCards.isEmpty()) {
                 // 只查自己创建的专卡
-                customCards = customCards.stream().filter(m-> Objects.equals(m.getCreateId(), sysUser.getId())).collect(Collectors.toList());
+                customCards = customCards.stream().filter(m -> Objects.equals(m.getCreateId(), sysUser.getId())).collect(Collectors.toList());
                 if (!customCards.isEmpty()) {
                     list.addAll(customCards);
                 }
@@ -369,8 +382,10 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
             } else {
                 throw ExceptionResultEnum.ERROR.exception("题卡创建方式异常");
             }
-            List<ConvertJpgStorage> convertJpgStorageList = htmlToJpgUtil.convertHtmlToJpgByCard(examCard.getTitle(),htmlContent, PageSizeEnum.A3);
-            examCardDetail.setJpgAttachmentInfo(JSON.toJSONString(convertJpgStorageList));
+            List<ConvertJpgStorage> convertJpgStorageList = htmlToJpgUtil.convertHtmlToJpgByCard(examCard.getTitle(),htmlContent,PageSizeEnum.A3);
+            if (convertJpgStorageList.size() > 0){
+                examCardDetail.setJpgAttachmentInfo(JSON.toJSONString(convertJpgStorageList));
+            }
             examCardDetailService.save(examCardDetail);
         }
         // 修改
@@ -418,8 +433,10 @@ public class ExamCardServiceImpl extends ServiceImpl<ExamCardMapper, ExamCard> i
             } else {
                 throw ExceptionResultEnum.ERROR.exception("题卡创建方式异常");
             }
-            List<ConvertJpgStorage> convertJpgStorageList = htmlToJpgUtil.convertHtmlToJpgByCard(examCard.getTitle(),htmlContent, PageSizeEnum.A3);
-            examCardDetail.setJpgAttachmentInfo(JSON.toJSONString(convertJpgStorageList));
+            List<ConvertJpgStorage> convertJpgStorageList = htmlToJpgUtil.convertHtmlToJpgByCard(examCard.getTitle(),htmlContent,PageSizeEnum.A3);
+            if (convertJpgStorageList.size() > 0){
+                examCardDetail.setJpgAttachmentInfo(JSON.toJSONString(convertJpgStorageList));
+            }
             examCardDetailService.updateById(examCardDetail);
 
             //删除权限

+ 7 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamPaperGroupMarkerServiceImpl.java

@@ -6,6 +6,8 @@ import com.qmth.distributed.print.business.bean.marking.Marker;
 import com.qmth.distributed.print.business.entity.ExamPaperGroupMarker;
 import com.qmth.distributed.print.business.mapper.ExamPaperGroupMarkerMapper;
 import com.qmth.distributed.print.business.service.ExamPaperGroupMarkerService;
+import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -29,7 +31,11 @@ public class ExamPaperGroupMarkerServiceImpl extends ServiceImpl<ExamPaperGroupM
             ExamPaperGroupMarker marker = new ExamPaperGroupMarker();
             marker.setGroupId(examPaperGroupId);
             marker.setMarkerId(e.getId());
-            marker.setLoginName(e.getLoginName());
+            String loginName = e.getLoginName();
+            if (!SystemConstant.strNotNull(loginName)){
+                throw ExceptionResultEnum.ERROR.exception("缺少评卷员用户登录名信息");
+            }
+            marker.setLoginName(loginName);
             return Stream.of(marker);
         }).collect(Collectors.toSet());
         this.saveBatch(examPaperGroupMarkerSet);

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

@@ -273,7 +273,7 @@ public class ExamPaperStructureServiceImpl extends ServiceImpl<ExamPaperStructur
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         String[] structureStatusEnums = new String[]{ExamPaperStructureStatusEnum.FINISH.name()};
-        List<ExamPaperStructure> examPaperStructureList = this.baseMapper.listByPropositionTeacherId(schoolId, sysUser.getId(), ExamPrintPlanSyncStatusEnum.FINISH.name(), structureStatusEnums);
+        List<ExamPaperStructure> examPaperStructureList = this.baseMapper.listByPropositionTeacherId(schoolId,null, null, sysUser.getId(), ExamPrintPlanSyncStatusEnum.FINISH.name(), structureStatusEnums);
         return CollectionUtils.isEmpty(examPaperStructureList) ? 0 : examPaperStructureList.size();
     }
 

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

@@ -1654,6 +1654,12 @@ public class TaskLogicServiceImpl implements TaskLogicService {
         String courseName = downloadPaperFileParam.getCourseName();
         Set<Long> idSet = downloadPaperFileParam.getIdSet();
 
+        // 如果idSet集合为空且查询条件的机构id也为空,则请求用户的机构id作为机构数据权限带入查询
+        SysUser requestUser = (SysUser) map.get(SystemConstant.USER);
+        if ((idSet == null || idSet.size() == 0) && !SystemConstant.longNotNull(orgId)){
+            orgId = requestUser.getOrgId();
+        }
+
 
         LocalDateTime nowTime = LocalDateTime.now();
         String zipJoiner = SystemConstant.TEMP_FILES_DIR + File.separator;
@@ -1669,7 +1675,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
             boolean cf = zipFile.createNewFile();
         }
 
-        // 文件路径
+        // 文件路径
         String zipLocalRootPath = SystemConstant.TEMP_FILES_DIR + File.separator + System.currentTimeMillis();
 
         ExamTaskPaperDto examTaskPaperDto = downloadService.findDownloadContent(schoolId, semesterId, examId, orgId, courseName, idSet);
@@ -1812,7 +1818,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
         tbTask.setResultFilePath(jsonObject.toJSONString());
         ConvertUtil.delFolder(zipLocalRootPath);
         zipFile.delete();
-        map.put("count", 1);
+        map.put("count", courseSet.size() + 1);
         return map;
     }
 

+ 38 - 15
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/HtmlToJpgUtil.java

@@ -1,9 +1,15 @@
 package com.qmth.distributed.print.business.util;
 
 import com.qmth.distributed.print.business.bean.marking.ConvertJpgStorage;
+import com.qmth.distributed.print.business.entity.BasicCardRule;
+import com.qmth.distributed.print.business.entity.ExamCard;
+import com.qmth.distributed.print.business.entity.ExamCardDetail;
+import com.qmth.distributed.print.business.enums.MakeMethodEnum;
 import com.qmth.distributed.print.business.service.PrintCommonService;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicAttachment;
+import com.qmth.teachcloud.common.enums.CardCreateMethodEnum;
+import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.PageSizeEnum;
 import com.qmth.teachcloud.common.enums.UploadFileEnum;
 import com.qmth.teachcloud.common.util.ConvertUtil;
@@ -37,12 +43,16 @@ public class HtmlToJpgUtil {
     @Resource
     PrintCommonService printCommonService;
 
+    @Resource
+    CreatePdfUtil createPdfUtil;
+
     private final static Logger log = LoggerFactory.getLogger(HtmlToJpgUtil.class);
 
     /**
      * 转换html -> jpg : 生成本地临时文件
-     * @param cardTitle 题卡名称
-     * @param htmlContent html内容
+     *
+     * @param cardTitle    题卡名称
+     * @param htmlContent  html内容
      * @param pageSizeEnum 转化pdf的纸张类型
      */
     public List<BasicAttachment> convertHtmlToJpg(String cardTitle, String htmlContent, PageSizeEnum pageSizeEnum) throws Exception {
@@ -70,7 +80,7 @@ public class HtmlToJpgUtil {
             }
             HtmlToPdfUtil.convert(htmlPath, pdfPath, pageSizeEnum);
             // pdf文件转jpg
-            List<File> jpgFileList = ConvertUtil.pdfToImageFile(pdfPath,jpgPath);
+            List<File> jpgFileList = ConvertUtil.pdfToImageFile(pdfPath, jpgPath);
 
             for (File jpgFile : jpgFileList) {
                 InputStream inputStream = new FileInputStream(jpgFile);
@@ -79,9 +89,9 @@ public class HtmlToJpgUtil {
                 BasicAttachment basicAttachment = printCommonService.saveAttachment(multipartFile, DigestUtils.md5Hex(multipartFile.getBytes()), UploadFileEnum.FILE);
                 basicAttachmentList.add(basicAttachment);
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             log.error(e.getMessage());
-        }finally {
+        } finally {
             ConvertUtil.delFolder(rootPath);
         }
         return basicAttachmentList;
@@ -89,19 +99,32 @@ public class HtmlToJpgUtil {
 
     /**
      * 转换html -> jpg : 生成本地临时文件
-     * @param cardTitle 题卡名称
-     * @param htmlContent html内容
+     *
+     * @param cardTitle    题卡名称
+     * @param htmlContent  题卡内容
      * @param pageSizeEnum 转化pdf的纸张类型
      */
     public List<ConvertJpgStorage> convertHtmlToJpgByCard(String cardTitle, String htmlContent, PageSizeEnum pageSizeEnum) throws Exception {
-        return this.convertHtmlToJpg(cardTitle,htmlContent,pageSizeEnum).stream().flatMap(e -> {
-            ConvertJpgStorage tmp = new ConvertJpgStorage();
-            String name = e.getName();
-            String index = name.substring(name.lastIndexOf("-") + 1);
+        List<ConvertJpgStorage> convertJpgStorageList = new ArrayList<>();
+        try {
+            String regex = "\\$\\{\\w+}";
+            htmlContent = htmlContent.replaceAll("<img src=\"data:image/png;base64,\\$\\{examNumber\\}\">", "");
+            htmlContent = htmlContent.replaceAll(regex, "");
+            convertJpgStorageList = this.convertHtmlToJpg(cardTitle, htmlContent, pageSizeEnum).stream().flatMap(e -> {
+                ConvertJpgStorage tmp = new ConvertJpgStorage();
+                String name = e.getName();
+                String index = name.substring(name.lastIndexOf("-") + 1);
+                tmp.setAttachmentId(e.getId());
+                tmp.setIndex(Integer.valueOf(index));
+                return Stream.of(tmp);
+            }).collect(Collectors.toList());
 
-            tmp.setAttachmentId(e.getId());
-            tmp.setIndex(Integer.valueOf(index));
-            return Stream.of(tmp);
-        }).collect(Collectors.toList());
+            if (convertJpgStorageList.size() == 0) {
+                throw ExceptionResultEnum.ERROR.exception("生成jpg文件异常");
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage());
+        }
+        return convertJpgStorageList;
     }
 }

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

@@ -35,6 +35,7 @@
         a.school_id schoolId,
         a.course_code courseCode,
         a.course_name courseName,
+        a.sequence,
         a.specialty,
         a.paper_number paperNumber,
         a.card_rule_id cardRuleId,
@@ -1339,6 +1340,7 @@
                 </foreach>
             </if>
         </where>
+        ORDER BY a.update_time DESC
     </select>
     <select id="listExamTaskDetailDownloadByQuery"
             resultType="com.qmth.distributed.print.business.bean.dto.ExamTaskDetailDto">
@@ -1400,5 +1402,6 @@
                 </foreach>
             </if>
         </where>
+        ORDER BY a.update_time DESC
     </select>
 </mapper>

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

@@ -6,6 +6,7 @@
             tbst.id,
             tbst.type,
             tbst.object_id objectId,
+            tbst.third_relate_id thirdRelateId,
             tbst.status,
             tbst.result,
             if(ISNULL(tbst.report_file_path),false,true) as hasReportFile,

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

@@ -32,6 +32,6 @@
                 AND (bs.student_name LIKE CONCAT('%',#{studentInfo},'%') OR bs.student_code LIKE CONCAT('%',#{studentInfo},'%'))
             </if>
         </where>
-        ORDER BY ts.create_time DESC
+        ORDER BY id
     </select>
 </mapper>

+ 4 - 1
distributed-print/src/main/java/com/qmth/distributed/print/api/EnumsController.java

@@ -101,8 +101,11 @@ public class EnumsController {
             // 系统自生成编码
             list = SystemCodeEnum.listTypes();
         } else if (type.equals(EnumType.PUSH_TYPE_ENUM.name())){
-            // 同步云阅卷类型类型
+            // 同步云阅卷类型
             list = PushTypeEnum.listTypes();
+        } else if (type.equals(EnumType.TB_TASK_STATUS.name())){
+            // 同步云阅卷日志表状态类型
+            list = TaskStatusEnum.listTypes();
         }
         return ResultUtil.ok(list);
     }

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

@@ -98,7 +98,7 @@ public class ExamCardController {
         return ResultUtil.ok(success);
     }
 
-    //====================================通卡接口(end)===================================
+    //====================================通卡接口(end)===================================
 
     /**
      * 新建

+ 1 - 1
distributed-print/src/main/resources/application-test.properties

@@ -12,7 +12,7 @@ spring.application.name=distributed-print
 #\u6570\u636E\u6E90\u914D\u7F6E
 db.host=192.168.10.136
 db.port=3307
-db.name=dps-v3.0-test
+db.name=dps-v3.0.1-test
 db.username=dps_test
 db.password=dps_test
 

+ 12 - 1
teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/result/SyncListResult.java

@@ -20,9 +20,12 @@ public class SyncListResult implements Serializable {
     @ApiModelProperty(value = "同步任务类型:USER_PUSH(用户推送),EXAM_PUSH(考试、考生、题卡推送),STRUCTURE_PUSH(试卷结构推送),SCORE_PUSH(成绩推送)")
     private String type;
 
-    @ApiModelProperty(value = "objectId")
+    @ApiModelProperty(value = "同步对象ID(包含计划ID、试卷结构ID)")
     private String objectId;
 
+    @ApiModelProperty(value = "云阅卷考试ID")
+    private String thirdRelateId;
+
     @ApiModelProperty(value = "任务状态,INIT:未开始,RUNNING:进行中,FINISH:已完成")
     private String status;
 
@@ -135,4 +138,12 @@ public class SyncListResult implements Serializable {
     public void setResultStr(String resultStr) {
         this.resultStr = resultStr;
     }
+
+    public String getThirdRelateId() {
+        return thirdRelateId;
+    }
+
+    public void setThirdRelateId(String thirdRelateId) {
+        this.thirdRelateId = thirdRelateId;
+    }
 }

+ 15 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/enums/TaskStatusEnum.java

@@ -1,5 +1,7 @@
 package com.qmth.teachcloud.common.enums;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Objects;
 
 /**
@@ -41,4 +43,17 @@ public enum TaskStatusEnum {
         }
         return null;
     }
+
+    public static List<EnumResult> listTypes() {
+        List<EnumResult> list = new ArrayList<>();
+        for (TaskStatusEnum value : TaskStatusEnum.values()) {
+            EnumResult result = new EnumResult();
+            result.setName(value.name());
+            result.setOrdinal(value.ordinal());
+            result.setCode(null);
+            result.setDesc(value.getTitle());
+            list.add(result);
+        }
+        return list;
+    }
 }

+ 23 - 8
teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/HttpKit.java

@@ -9,7 +9,7 @@ import org.slf4j.LoggerFactory;
 import java.io.*;
 import java.net.HttpURLConnection;
 import java.net.URL;
-import java.util.Date;
+import java.util.List;
 import java.util.Map;
 
 public class HttpKit {
@@ -172,10 +172,10 @@ public class HttpKit {
     public static String sendPost(String requestUrl, Map<String, String> requestHeader, Map<String, Object> formTexts, Map<String, String> files, String requestEncoding, String responseEncoding) {
         OutputStream out = null;
         BufferedReader reader = null;
-        String result = "";
+        StringBuilder result = new StringBuilder();
         try {
             if (requestUrl == null || requestUrl.isEmpty()) {
-                return result;
+                return result.toString();
             }
             URL realUrl = new URL(requestUrl);
             HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection();
@@ -245,14 +245,29 @@ public class HttpKit {
             }
             out.flush();
             out.close();
-//            out = null;
-            reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), responseEncoding));
+
+
+            int responseCode = connection.getResponseCode();
+            if (responseCode >= 400) {
+//                reader = new BufferedReader(new InputStreamReader(connection.getErrorStream(), responseEncoding));
+                Map<String, List<String>> responseProperties = connection.getHeaderFields();
+                if (responseProperties.containsKey("error-info")) {
+                    List<String> strings = responseProperties.get("error-info");
+                    if (!strings.isEmpty()) {
+                        String message = String.join(";", strings);
+                        throw ExceptionResultEnum.ERROR.exception(message);
+                    }
+                }
+                throw ExceptionResultEnum.ERROR.exception("接口调用错误");
+            } else {
+                reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), responseEncoding));
+            }
             String line;
             while ((line = reader.readLine()) != null) {
-                result += line;
+                result.append(line);
             }
         } catch (Exception e) {
-            throw ExceptionResultEnum.ERROR.exception("发送POST请求出现异常:" + e.getMessage());
+            throw ExceptionResultEnum.ERROR.exception("调用异常:" + e.getMessage());
         } finally {
             try {
                 if (out != null) {
@@ -265,7 +280,7 @@ public class HttpKit {
                 log.error(SystemConstant.LOG_ERROR, ex);
             }
         }
-        return result;
+        return result.toString();
     }
 
 }

+ 1 - 1
teachcloud-task/src/main/resources/application-task_test.properties

@@ -13,7 +13,7 @@ spring.application.name=teachcloud-task
 #\u6570\u636E\u6E90\u914D\u7F6E
 db.host=192.168.10.136
 db.port=3307
-db.name=dps-v3.0-test
+db.name=dps-v3.0.1-test
 db.username=dps_test
 db.password=dps_test