如何上传文件到NCC单据附件
form:如何上传文件附件到NCC单据 - 用友NCCloud - 用友之家-用友软件论坛 - (oyonyou.com)
private void upLoadPdf(MsgBean msgBean, EInvoiceStatusVO statusvo) throws BusinessException {
String pdf = msgBean.getPdf();
if (!StringUtils.isEmpty(pdf)) {
byte[] data = org.apache.commons.codec.binary.Base64.decodeBase64(pdf.getBytes(Charset.forName(CharEncoding.UTF_8)));
InputStream input = new ByteArrayInputStream(data);
String fpHm = statusvo.getFphm();
String fpDM = statusvo.getFpdm();
String id = statusvo.getCsourcebillid();
FileHeader fileHeader = FileStorageClient.getInstance().uploadFile(
IAttachManageConst.RIAMoudleID,"电子发票_" + fpDM +"_"+ fpHm + ".pdf", input, true);
if (fileHeader != null) {
String pk_doc = fileHeader.getPath();
String name = fileHeader.getName();
long size1 = fileHeader.getFileSize();
IFileSystemService service = NCLocator.getInstance().lookup(IFileSystemService.class);
NCFileVO attach = new NCFileVO();
attach.setPath(name);
attach.setCreator(InvocationInfoProxy.getInstance().getUserId());
attach.setIsdoc("z");
attach.setFileLen(size1);
attach.setPk_doc(pk_doc);
service.createCloudFileNode(id, InvocationInfoProxy.getInstance().getUserId(), attach);
}
}
}