| | |
| | | } |
| | | @TestVisible |
| | | protected override void afterInsert() { |
| | | Set<Id> ids = new Set<Id>(); |
| | | for (ContentDocumentLink link : newList) { |
| | | ids.add(link.ContentDocumentId); |
| | | } |
| | | List<ContentVersion> version = [select Id from ContentVersion where ContentDocumentId in: ids and FileType = 'SNOTE']; |
| | | if(version != null){ |
| | | NotetoPdf(); |
| | | } |
| | | // 修理ID |
| | | NotetoPdf(); |
| | | // NoteMail(); |
| | | NoteMail(); |
| | | } |
| | | // 修理和QIS新建备注时,生成对应的PDF |
| | | private void NotetoPdf() { |
| | | StaticParameter.AttachmentTrigger = false; |
| | | List<String> Rlist = new List<String>(); |
| | | // QisID |
| | | for (ContentDocumentLink link : newList) { |
| | |
| | | // } |
| | | // } |
| | | // List<Attachment> NtList = [Select id,ParentId,Name,Body FROM Attachment where Id in : Rlist]; |
| | | List<ContentVersion> verList = [select Id,Title,VersionData,ContentDocumentId from ContentVersion where ContentDocumentId in: Rlist]; |
| | | List<ContentVersion> verList = [select Id,TextPreview,Title,VersionData,ContentDocumentId from ContentVersion where ContentDocumentId in: Rlist]; |
| | | Map<Id,Repair__c> updateRprMap = new Map<Id,Repair__c>(); |
| | | Map<Id,QIS_Report__c> updateQisMap = new Map<Id,QIS_Report__c>(); |
| | | for (Repair__c re :[select id,Name,SerialNumber__c,Delivered_Product__r.Name,HP_Name__c |
| | |
| | | String accountname = updateRprMap.containsKey(link.LinkedEntityId)? updateRprMap.get(link.LinkedEntityId).HP_Name__c : updateQisMap.get(link.LinkedEntityId).Hospital__r.Name; |
| | | String title = ''; |
| | | String body = ''; |
| | | title = '【修理/QIS】:' + titName + '已新增文件,请查看'; |
| | | if(version.TextPreview != null){ |
| | | title = '【修理/QIS】:' + titName + '已新增备注,请查看'; |
| | | }else{ |
| | | title = '【修理/QIS】:' + titName + '已新增文件,请查看'; |
| | | } |
| | | |
| | | body += '用户名:' + accountname; |
| | | body += '<br/>'; |
| | | body += '产品名称/型号 :' + prname; |