1.通过AttachmentServiceHelper.getAttachments()获取源附件:
List<Map<String,Object>> attachments = AttachmentServiceHelper.getAttachments("cas_claimbill",claimbillPK,"attachmentpanel");
2.附件地址和最近修改时间不能直接使用:
if(attachment.get("lastModified") instanceof Date){
Date date = (Date)attachment.get("lastModified");
attachment.put("lastModified",date.getTime());
}
if(attachment.containsKey("attPkId")){
DynamicObject dbAttachment = BusinessDataServiceHelper.londSingle(attachment.get("attkId")," bos_attachment","ffileid");
attachment.put("url",dbAttachment.getstring("ffileid"));
}
3.上传附件到目标单:
AttachmentServiceHelper.upload("cas_recbill", recbillPK,"attachmentpanel", attachments);