| | |
| | | attachmentFse.setValue(CmnConst.ENCRPT_SIGN, Global.getPropertyToBoolean("file.encrypt", "true") ? 1 : 0); |
| | | attachmentFse.setValue(CmnConst.ATTACHMENT_SIZE, fileLength); |
| | | attachmentFse.setValue(CmnConst.UPLOAD_SIGN, needUpload2FileServerFlag ? 1 : 0); |
| | | |
| | | attachmentFse.setValue(CmnConst.FUNCTION_UUID, fse.getString(CmnConst.FUNCTION_UUID)); |
| | | attachmentFse.setValue(CmnConst.ATTACHMENT_CONTAINER, fse.getString(CmnConst.ATTACHMENT_CONTAINER)); |
| | | attachmentFse.setValue(CmnConst.ATTACHMENT_DOMAIN, fse.getString(CmnConst.ATTACHMENT_DOMAIN)); |
| | | attachmentFse.setValue(CmnConst.MODULE_UUID, fse.getString(CmnConst.MODULE_UUID)); |
| | |
| | | String viewOnlineSign = attachmentFse.getString(CmnConst.VIEW_ONLINE_SIGN); |
| | | boolean encrptSignFlag = "1".equals(attachmentFse.getString(CmnConst.ENCRPT_SIGN)); |
| | | boolean needOnlineViewFlag = "1".equals(fse.getString(CmnConst.NEED_ONLINE_VIEW)) && "1".equals(viewOnlineSign); |
| | | if (needOnlineViewFlag) { |
| | | // 需要在线预览且转换之后才能在线预览 |
| | | if (needOnlineViewFlag && !realFileName.endsWith(".xlsx") && !realFileName.endsWith(".xls")) { |
| | | // 需要在线预览且转换之后才能在线预览 excel 文件不需要转换直接输出预览 |
| | | dir += File.separator + CmnConst.TRANSFER_DIR_NAME; |
| | | } |
| | | |
| | |
| | | try { |
| | | temp.createNewFile(); |
| | | } catch (IOException e) { |
| | | throw new BaseException(FileCode.GET_FILE_FAIL.getValue(), FileCode.GET_FILE_FAIL.getText() + (e.getMessage() != null ? e.getMessage() : "")); |
| | | throw new BaseException(FileCode.GET_FILE_FAIL.getValue(), FileCode.GET_FILE_FAIL.getText() + (e.getMessage() != null ? e.getMessage() + ",uuid:" + attachmentFse.getUUID() : "")); |
| | | } |
| | | try (FileOutputStream fos = new FileOutputStream(temp); BufferedOutputStream out = new BufferedOutputStream(fos)) { |
| | | |
| | |
| | | return temp; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new BaseException(FileCode.GET_FILE_FAIL.getValue(), FileCode.GET_FILE_FAIL.getText() + (e.getMessage() != null ? e.getMessage() : "")); |
| | | throw new BaseException(FileCode.GET_FILE_FAIL.getValue(), FileCode.GET_FILE_FAIL.getText() + (e.getMessage() != null ? e.getMessage() + ",uuid:" + attachmentFse.getUUID() : "")); |
| | | } |
| | | } |
| | | throw new BaseException(FileCode.GET_FILE_FAIL.getValue(), FileCode.GET_FILE_FAIL.getText()); |
| | | throw new BaseException(FileCode.GET_FILE_FAIL.getValue(), FileCode.GET_FILE_FAIL.getText() + ",uuid:" + attachmentFse.getUUID()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public byte[] getFileContent(FieldSetEntity attachmentFse) throws BaseException { |
| | | if (attachmentFse == null || !CmnConst.PRODUCT_SYS_ATTACHMENTS.equals(attachmentFse.getTableName())) { |
| | | return new byte[16]; |
| | | //返回一个空的字节数组 |
| | | return new byte[0]; |
| | | } |
| | | try (ByteArrayOutputStream os = new ByteArrayOutputStream();) { |
| | | FTPService ftpService = new FTPService(); |