NC附件管理

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方法

猜你喜欢

转载自blog.csdn.net/guaizang/article/details/103722783
nc