ソースを参照

fix:下载管理

caozixuan 3 年 前
コミット
b48c1e29a1

+ 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);
         }

+ 7 - 1
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;
@@ -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;
     }
 

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

@@ -1340,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">
@@ -1401,5 +1402,6 @@
                 </foreach>
             </if>
         </where>
+        ORDER BY a.update_time DESC
     </select>
 </mapper>