| | |
| | | |
| | | @Override |
| | | public IPage<AttachVO> selectAttachPage(IPage<AttachVO> page, AttachPageParam attach) { |
| | | List<AttachVO> attachVOS = baseMapper.selectAttachPage(page, attach); |
| | | // 创建部门 |
| | | if (!AuthUtil.isAdministrator()) { |
| | | List<Long> deptList = SysCache.getDeptChildIds(Long.valueOf(AuthUtil.getDeptId())); |
| | | attach.setDeptList(deptList); |
| | | } |
| | | List<AttachVO> attachVOS = baseMapper.selectAttachPage(page, attach); |
| | | return page.setRecords(attachVOS); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public Long findResultNumByJobId(String jobId) { |
| | | return baseMapper.selectCount(Wrappers.<Attach>lambdaQuery() |
| | | .eq(Attach::getIsGenerateAiImg, 0) |
| | | .eq(Attach::getIsDeleted, 0) |
| | | .eq(Attach::getPatrolTaskId, jobId).in(Attach::getResultType, AttachResultTypeEnum.getTheAttachmentType())); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 下载附件 |
| | | * @param param 下载参数 |
| | | * |
| | | * @param param 下载参数 |
| | | * @param outputStream 输出流 |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | @Override |
| | | public Boolean downloadByByte(AttachmentDownloadParam param, OutputStream outputStream) throws IOException { |
| | | // 如果附件id集合并且任务id集合参数都为空,就判断起止时间是否都有为空,如果都为空,则返回错误 |
| | | param.setAreaCode(HeaderUtils.formatAreaCode(param.getAreaCode())); |
| | | if (CollectionUtils.isEmpty(param.getAttachIds()) && CollectionUtils.isEmpty(param.getWayLineJobIds())) { |
| | | // 判断起止时间是否为空 |
| | | if (StringUtils.isEmpty(param.getStartTime()) || StringUtils.isEmpty(param.getEndTime())) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | public Boolean downloadByByte(String param, OutputStream outputStream) throws IOException { |
| | | AttachmentDownloadParam attachmentDownloadParam = new AttachmentDownloadParam(); |
| | | attachmentDownloadParam.setAttachIds(Func.toLongList(param)); |
| | | // 获取附件列表 |
| | | List<AttachVO> attachList = getAttachList(param); |
| | | List<AttachVO> attachList = getAttachList(attachmentDownloadParam); |
| | | if (CollectionUtils.isEmpty(attachList)) { |
| | | return false; |
| | | } |
| | |
| | | } catch (Exception e) { |
| | | log.error("创建zip文件失败", e); |
| | | return false; |
| | | }finally { |
| | | } finally { |
| | | if (outputStream != null) { |
| | | try { |
| | | outputStream.flush(); |