5系列
就是要注意對附件,使用jdk自帶工具,進行壓縮後儲存(否則nc端打開附件會出現亂碼)
AttachmentVO attachmentVO = new AttachmentVO();
attachmentVO.setPk_corp(info.getString("pk_corp"));
attachmentVO.setPk_user(info.getString("pk_user"));
attachmentVO.setUpload_date(new UFDate());
attachmentVO.setAttachment_name(strFileName);
attachmentVO.setPk_object(billid);
attachmentVO.setObject_type("hi_stapplyb_h");
attachmentVO.setView_times(Integer.valueOf(0));
attachmentVO.setStatus(2);
int iAttachmentSize = iFileLength / 1024;
attachmentVO.setAttachment_size(Integer.valueOf(iAttachmentSize != 0 ? iAttachmentSize : 1));
attachmentVO.setAttachment(parseByte);
PubDelegator.getIAttachment().upload(attachmentVO);
注意單據的附件字段值需要自己進行跟新
具體的方法可參考AttachmentDialog
6系列
進行附件查詢的僞sql(版本差異略有不同,但資料庫表就是以下幾張了):
select sm_filestoreview.FILEDATA from
SM_PUB_FILESYSTEM.pk_doc = sm_document_file.pk_file
sm_document_file.pk_file = sm_document_version.pk_file
sm_document_version.REALPATH = sm_filestoreview.FILEPATH
SM_PUB_FILESYSTEM.FILEPATH = 單據主鍵+附件名稱
上傳接口
外部調用:服務ip+/service/FileManageServlet(需要token驗證)
headInfo.put(“parentPath”, pPath);pPath即為單據主鍵
具體參數設定參照FileManageServletClient的uploadFile方法
内部調用:
IFileSystemService service = NCLocator.getInstance().lookup(IFileSystemService.class);
service.createNewFileNodeWithStream(parentPath, fileName, creator, in, fileLen);
具體參照FileSystemImplement的createNewFileNodeWithStream方法