19626
2023-09-09 e14d6d0619330cad423f06493e3aa2371faa2a8f
force-app/main/default/classes/NFM401Controller.cls
@@ -583,27 +583,35 @@
                //     }
                // }
                List<ContentDocumentLink> attList = rAMap.get(rr.id);
                if (attList != null && attList.size() > 0) {
                    List<Id> idList = new List<Id>();
                    for(ContentDocumentLink rpd : attList){
                        ContentVersion version = [
                        idList.add(rpd.ContentDocumentId);
                    }
                    List<ContentVersion> version = [
                            select
                            Title,
                            VersionData,
                            ContentSize
                            from ContentVersion where ContentDocumentId =: rpd.ContentDocumentId
                        from ContentVersion where ContentDocumentId in: idList
                        ];
                    Integer i = 0;
                    for(ContentDocumentLink rpd : attList){
                        //2020-11-05  如果附件大小超过1.5mb 发送邮件提示
                        if (version.ContentSize > 1048576) {
                            sendemail(version,'修理'+rr.Name);
                        if (version[i].ContentSize > 1048576) {
                            sendemail(version[i],'修理'+rr.Name);
                        }else{
                            Attachment_element Attachmentdet = new Attachment_element();
                            RepairRequest.ATTACHMENT.add(Attachmentdet);
                            Attachmentdet.FILE_DATA = EncodingUtil.base64Encode(version.VersionData);
                            Attachmentdet.FILE_DATA = EncodingUtil.base64Encode(version[i].VersionData);
                            Attachmentdet.ATTACHMENT_FIELD_NAME = 'COMPLAINTS_DOCUMENT_ATTACHMENT';
                            Attachmentdet.FILE_NAME = version.Title;
                            Attachmentdet.FILE_NAME = version[i].Title;
                            Attachmentdet.GLOBAL_ATTRIBUTE1 = 'COMPLAINT';
                            Attachmentdet.RECORD_INSERTED_DATE = NFMUtil.formatDate2Str(Date.today());
                        }
                        i++;
                    }
                }
            }