Procházet zdrojové kódy

Merge remote-tracking branch 'origin/dev_v2.2.0' into dev_v2.2.0

wangliang před 3 roky
rodič
revize
d2068d074d

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

@@ -36,8 +36,11 @@
                 AND a.paper_number = b.paper_number
                 LEFT JOIN
             exam_task_detail c ON b.id = c.exam_task_id
+                LEFT JOIN
+            t_f_flow_approve d ON b.flow_id = d.flow_id
         WHERE
-            a.exam_detail_id = #{examDetailId} AND b.status = #{status}
+            a.exam_detail_id = #{examDetailId}
+            AND (b.status = 'SUBMIT' and (d.status is null or d.status = #{status}))
     </select>
     <select id="listByExamDetailIdAndStatus" resultMap="BaseResultMap">
         SELECT

+ 23 - 22
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/TeachcloudCommonServiceImpl.java

@@ -2,6 +2,7 @@ package com.qmth.teachcloud.common.service.impl;
 
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.util.ZipUtil;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -277,7 +278,7 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
                     sysPrivilegeQueryWrapper.lambda().in(SysPrivilege::getId, privilegeIds)
                             .eq(SysPrivilege::getType, PrivilegeEnum.URL)
                             .eq(SysPrivilege::getProperty, PrivilegePropertyEnum.AUTH);
-                    if(Objects.isNull(tbSchool)){
+                    if (Objects.isNull(tbSchool)) {
                         sysPrivilegeQueryWrapper.lambda().isNull(SysPrivilege::getSchoolId);
                     } else {
                         sysPrivilegeQueryWrapper.lambda().eq(SysPrivilege::getSchoolId, user.getSchoolId());
@@ -318,14 +319,14 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
         QueryWrapper<SysPrivilege> queryWrapper = new QueryWrapper<>();
         queryWrapper.lambda().eq(SysPrivilege::getSchoolId, SystemConstant.DEFAULT_PRIVILEGE_SCHOOL);
         List<SysPrivilege> sysPrivileges = sysPrivilegeService.list(queryWrapper);
-        if (sysPrivileges.size() == 0){
+        if (sysPrivileges.size() == 0) {
             throw ExceptionResultEnum.ERROR.exception("默认学校权限不存在");
         }
         Map<Long, Long> map = new HashMap<>();
         List<SysPrivilege> newList = new ArrayList<>();
         for (Long newSchoolId : targetSchoolIdSet) {
             BasicSchool basicSchool = basicSchoolService.getById(newSchoolId);
-            if (Objects.isNull(basicSchool)){
+            if (Objects.isNull(basicSchool)) {
                 throw ExceptionResultEnum.ERROR.exception("未找到学校信息");
             }
             for (SysPrivilege sysPrivilege : sysPrivileges) {
@@ -338,11 +339,11 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
             }
         }
         for (SysPrivilege sysPrivilege : newList) {
-            if(Objects.nonNull(sysPrivilege.getParentId())){
+            if (Objects.nonNull(sysPrivilege.getParentId())) {
                 sysPrivilege.setParentId(map.get(sysPrivilege.getParentId()));
             }
             String relateId = sysPrivilege.getRelated();
-            if(StringUtils.isNotBlank(relateId)){
+            if (StringUtils.isNotBlank(relateId)) {
                 String[] relateIds = relateId.split(",");
                 List<String> newRelateIds = new ArrayList<>();
                 for (String id : relateIds) {
@@ -495,10 +496,10 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
         } else {
             if (uploadFileEnum == UploadFileEnum.PAPER) {
 //                url = ossUtil.getPrivateUrl(filePath);
-                url = fileStoreUtil.getPrivateUrl(filePath,uploadFileEnum.getFssType());
+                url = fileStoreUtil.getPrivateUrl(filePath, uploadFileEnum.getFssType());
             } else {
 //                url = dictionaryConfig.aliYunOssDomain().getUrl() + File.separator + filePath;
-                url = fileStoreUtil.getPrivateUrl(filePath,uploadFileEnum.getFssType());
+                url = fileStoreUtil.getPrivateUrl(filePath, uploadFileEnum.getFssType());
             }
         }
         return url;
@@ -524,10 +525,10 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
         } else {
             if (isExpire) {
 //                pathUrl = ossUtil.getPrivateUrl(path);
-                pathUrl = fileStoreUtil.getPrivateUrl(path,fileStoreUtil.getUploadEnumByPath(path).getFssType());
+                pathUrl = fileStoreUtil.getPrivateUrl(path, fileStoreUtil.getUploadEnumByPath(path).getFssType());
             } else {
 //                pathUrl = dictionaryConfig.aliYunOssDomain().getUrl() + File.separator + path;
-                pathUrl = fileStoreUtil.getPrivateUrl(path,fileStoreUtil.getUploadEnumByPath(path).getFssType());
+                pathUrl = fileStoreUtil.getPrivateUrl(path, fileStoreUtil.getUploadEnumByPath(path).getFssType());
             }
 
         }
@@ -554,17 +555,17 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
         JSONObject jsonObject = JSONObject.parseObject(attachment.getPath());
         String attachmentType = (String) jsonObject.get(SystemConstant.TYPE);
         String filePath = (String) jsonObject.get(SystemConstant.PATH);
-        UploadFileEnum uploadFileEnum = UploadFileEnum.valueOf((String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
+        UploadFileEnum uploadFileEnum = jsonObject.get(SystemConstant.UPLOAD_TYPE).toString().contains(UploadFileEnum.HTML.name()) ? UploadFileEnum.HTML : UploadFileEnum.valueOf((String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
 
         if (Objects.equals(attachmentType, SystemConstant.LOCAL)) {
             pathUrl = SystemConstant.HTTP + dictionaryConfig.sysDomain().getFileHost() + File.separator + filePath;
         } else {
             if (isExpire) {
 //                pathUrl = ossUtil.getPrivateUrl(filePath);
-                pathUrl = fileStoreUtil.getPrivateUrl(filePath,uploadFileEnum.getFssType());
+                pathUrl = fileStoreUtil.getPrivateUrl(filePath, uploadFileEnum.getFssType());
             } else {
 //                pathUrl = dictionaryConfig.aliYunOssDomain().getUrl() + File.separator + filePath;
-                pathUrl = fileStoreUtil.getPrivateUrl(filePath,uploadFileEnum.getFssType());
+                pathUrl = fileStoreUtil.getPrivateUrl(filePath, uploadFileEnum.getFssType());
             }
 
         }
@@ -584,7 +585,7 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
         JSONObject object = JSONObject.parseObject(path);
         String filePath = object.getString(SystemConstant.PATH);
         String type = object.getString(SystemConstant.TYPE);
-        UploadFileEnum uploadType = Enum.valueOf(UploadFileEnum.class,(String) object.get(SystemConstant.UPLOAD_TYPE));
+        UploadFileEnum uploadType = Enum.valueOf(UploadFileEnum.class, (String) object.get(SystemConstant.UPLOAD_TYPE));
 
         if (filePath.endsWith(SystemConstant.HTML_PREFIX) || filePath.endsWith(SystemConstant.FTL_PREFIX)) {
             StringBuffer sb = new StringBuffer();
@@ -593,7 +594,7 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
                 if (type.equals(SystemConstant.OSS)) {
 //                    byte[] bytes = ossUtil.ossDownload(filePath);
 //                    fis = new ByteArrayInputStream(bytes);
-                    fis = fileStoreUtil.ossDownloadIs(filePath,uploadType.getFssType());
+                    fis = fileStoreUtil.ossDownloadIs(filePath, uploadType.getFssType());
                 } else {
                     String url = SystemConstant.HTTP + dictionaryConfig.sysDomain().getFileHost() + File.separator + filePath;
                     File file = new File(url);
@@ -630,12 +631,12 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
         JSONObject jsonObject = JSONObject.parseObject(path);
         String attachmentType = (String) jsonObject.get(SystemConstant.TYPE);
         String filePath = pdf ? (String) jsonObject.get(SystemConstant.PDF_PATH) : (String) jsonObject.get(SystemConstant.PATH);
-        UploadFileEnum uploadType = Enum.valueOf(UploadFileEnum.class,(String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
+        UploadFileEnum uploadType = Enum.valueOf(UploadFileEnum.class, (String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
 
         if (Objects.equals(attachmentType, SystemConstant.OSS)) {
 //            byte[] data = ossUtil.ossDownload(filePath);
 //            inputStream = new ByteArrayInputStream(data);
-            inputStream = fileStoreUtil.ossDownloadIs(filePath,uploadType.getFssType());
+            inputStream = fileStoreUtil.ossDownloadIs(filePath, uploadType.getFssType());
         } else {
             StringJoiner localPath = new StringJoiner("").add(SystemConstant.TEMP_FILES_DIR).add(File.separator).add(filePath);
             inputStream = new FileInputStream(new File(localPath.toString()));
@@ -657,11 +658,11 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
         JSONObject jsonObject = JSONObject.parseObject(path);
         String attachmentType = (String) jsonObject.get(SystemConstant.TYPE);
         String filePath = pdf ? (String) jsonObject.get(SystemConstant.PDF_PATH) : (String) jsonObject.get(SystemConstant.PATH);
-        UploadFileEnum uploadType = Enum.valueOf(UploadFileEnum.class,(String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
+        UploadFileEnum uploadType = Enum.valueOf(UploadFileEnum.class, (String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
 
         if (Objects.equals(attachmentType, SystemConstant.OSS)) {
 //            data = ossUtil.ossDownload(filePath);
-            data = fileStoreUtil.ossDownload(filePath,uploadType.getFssType());
+            data = fileStoreUtil.ossDownload(filePath, uploadType.getFssType());
         } else {
             StringJoiner localPath = new StringJoiner("").add(SystemConstant.TEMP_FILES_DIR).add(File.separator).add(filePath);
             InputStream inputStream = new FileInputStream(new File(localPath.toString()));
@@ -686,12 +687,12 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
         JSONObject jsonObject = JSONObject.parseObject(path);
         String attachmentType = (String) jsonObject.get(SystemConstant.TYPE);
         String filePath = pdf ? (String) jsonObject.get(SystemConstant.PDF_PATH) : (String) jsonObject.get(SystemConstant.PATH);
-        UploadFileEnum uploadType = Enum.valueOf(UploadFileEnum.class,(String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
+        UploadFileEnum uploadType = Enum.valueOf(UploadFileEnum.class, (String) jsonObject.get(SystemConstant.UPLOAD_TYPE));
 
         StringJoiner localPath = new StringJoiner("").add(SystemConstant.TEMP_FILES_DIR).add(File.separator).add(filePath);
         if (Objects.equals(attachmentType, SystemConstant.OSS)) {
 //            file = ossUtil.ossDownload(filePath, localPath.toString());
-            file = fileStoreUtil.ossDownload(filePath, localPath.toString(),uploadType.getFssType());
+            file = fileStoreUtil.ossDownload(filePath, localPath.toString(), uploadType.getFssType());
         } else {
             file = new File(localPath.toString());
         }
@@ -703,13 +704,13 @@ public class TeachcloudCommonServiceImpl implements TeachcloudCommonService {
         JSONObject object = JSONObject.parseObject(attachment.getPath());
         String filePath = object.getString(SystemConstant.PATH);
         String type = object.getString(SystemConstant.TYPE);
-        UploadFileEnum uploadType = Enum.valueOf(UploadFileEnum.class,(String) object.get(SystemConstant.UPLOAD_TYPE));
+        UploadFileEnum uploadType = Enum.valueOf(UploadFileEnum.class, (String) object.get(SystemConstant.UPLOAD_TYPE));
 
         if (type.equals(SystemConstant.OSS)) {
             File localPath = new File(rootPath, fileName);
             try {
 //                File file = ossUtil.ossDownload(filePath, localPath.getPath());
-                File file = fileStoreUtil.ossDownload(filePath, localPath.getPath(),uploadType.getFssType());
+                File file = fileStoreUtil.ossDownload(filePath, localPath.getPath(), uploadType.getFssType());
                 return file;
             } catch (IOException e) {
                 throw ExceptionResultEnum.ERROR.exception("从OSS上下载文件失败");