| | |
| | | String fileName = programFile.getOssName(); |
| | | try (InputStream inputStream = ossTemplate.statFileStream(fileName)) { |
| | | ByteArrayInputStream bos = new ByteArrayInputStream(inputStream.readAllBytes()); |
| | | boolean isText= FileContentUtil.isTextFile(bos); |
| | | boolean isText = StringUtils.endsWithIgnoreCase(fileName,".txt") || StringUtils.endsWithIgnoreCase(fileName,".nc")|| StringUtils.endsWithIgnoreCase(fileName,".xml"); |
| | | if(!isText){ |
| | | isText= FileContentUtil.isTextFile(bos); |
| | | } |
| | | if(isText){ |
| | | bos.reset(); |
| | | bos.reset(); |
| | | result = FileContentUtil.getContentFromStream(bos); |
| | | }else{ |
| | | result = "<非文本文件>"; |
| | |
| | | IOUtils.copy(ins,response.getOutputStream()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取关于流程的所有文件 |
| | | * @param processInstanceId 流程实例id |
| | | * @return 流程关联的文件列表 |
| | | */ |
| | | public List<FlowProgramFile> listByProcessInstanceId(String processInstanceId){ |
| | | return lambdaQuery() |
| | | .eq(FlowProgramFile::getProcessInstanceId, processInstanceId).list(); |
| | | } |
| | | } |