From e14d6d0619330cad423f06493e3aa2371faa2a8f Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期六, 09 九月 2023 14:02:23 +0800
Subject: [PATCH] Sit期间修改

---
 force-app/main/default/classes/NotetoPdfHandler.cls |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/force-app/main/default/classes/NotetoPdfHandler.cls b/force-app/main/default/classes/NotetoPdfHandler.cls
index 2c54f00..909df59 100644
--- a/force-app/main/default/classes/NotetoPdfHandler.cls
+++ b/force-app/main/default/classes/NotetoPdfHandler.cls
@@ -16,13 +16,19 @@
     }
     @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();
     }
 	// 淇悊鍜孮IS鏂板缓澶囨敞鏃讹紝鐢熸垚瀵瑰簲鐨凱DF
     private void NotetoPdf() {
-    	StaticParameter.AttachmentTrigger = false;
 	    List<String> Rlist = new List<String>();
 	    // QisID
 	    for (ContentDocumentLink link : newList) {
@@ -63,7 +69,7 @@
         //     }
         // }
         // 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
@@ -96,7 +102,12 @@
             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;

--
Gitblit v1.9.1