From 08a21f49f2eaf9cfc19ceb67b196cc36ba689305 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 13 五月 2022 20:52:25 +0800
Subject: [PATCH] FIxSWOPageIssue

---
 force-app/main/default/classes/SWOController.cls |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/force-app/main/default/classes/SWOController.cls b/force-app/main/default/classes/SWOController.cls
index 6164b52..a35cca6 100644
--- a/force-app/main/default/classes/SWOController.cls
+++ b/force-app/main/default/classes/SWOController.cls
@@ -6,6 +6,7 @@
 	public String accId {get; set;}
 	public String conId {get; set;}
 	public List<EmailInfo> mailList {get; set;}
+	public String mailListStr {get{return JSON.serialize(mailList);} set;}// 20220512 PI鏀归�� by zhj
 
 	public String baseUrl {get; set;}
 	public String type {get; set;}
@@ -34,12 +35,13 @@
 	private String SwoStatus;
     public String staticResource { get; private set; }// 20220313 PI鏀归�� by Chen Yanan
     public String contactstaticResource { get; private set; }// 20220313 PI鏀归�� by Chen Yanan
+	public String staticResourceMailMerge { get; private set; }// 20220512 PI鏀归�� by zhj
     public String contactAWSDataId { get; private set; }// 20220313 PI鏀归�� by Chen Yanan
-	public String contactName { get; private set; }// 20220422 PI鏀归�� by zhj
+	public String contactName { get; private set; }// 20220522 PI鏀归�� by zhj
 	public String swoawsDataId{set;get;}// 20220313 PI鏀归�� by Chen Yanan
     public Boolean isNew { get; set; }// 20220313 PI鏀归�� by Chen Yanan
-	public String frontCaseId { get; set; }// 20220422 PI鏀归�� by zhj
-	public String frontSwoId { get; set; }// 20220424 PI鏀归�� by zhj
+	public String frontCaseId { get; set; }// 20220522 PI鏀归�� by zhj
+	public String frontSwoId { get; set; }// 20220524 PI鏀归�� by zhj
 	//ASSIGNEDTO__c
 	public SWOController() {
 		
@@ -54,6 +56,7 @@
 		type = System.currentPageReference().getParameters().get('type');
         staticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('SWO__c'));// 20220313 PI鏀归�� by Chen Yanan
         contactstaticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact'));// 20220313 PI鏀归�� by Chen Yanan
+		staticResourceMailMerge = JSON.serialize(PIHelper.getPIIntegrationInfo('Mail_Merge__c'));// 20220512 PI鏀归�� by zhj
 	}
 
 	public void init() {
@@ -80,8 +83,6 @@
 			// ca = [select id, NUMBER__c,COMPANY__c,CONTACT__c,SUBJECT__c from User_FaultInfo__c where id = : caseId];
 			ca = [select id, NUMBER__c,COMPANY__c,CONTACT__c,SUBJECT__c, CONTACT__r.AWS_Data_Id__c, CONTACT__r.Name, CONTACT__r.Email from User_FaultInfo__c where id = : caseId];// 20220313 PI鏀归�� by Chen Yanan
 			temp = [select id from SWO__c where CASE_NUMBER__c = :caseId];
-			contactAWSDataId = String.isNotBlank(ca.CONTACT__r.AWS_Data_Id__c)?ca.CONTACT__r.AWS_Data_Id__c:'';
-			contactName = String.isNotBlank(ca.CONTACT__r.Name)?ca.CONTACT__r.Name:'';
 		}
 		System.debug('ca' + ca.NUMBER__c);
 		System.debug('temp' + temp.size());
@@ -107,7 +108,6 @@
 			if (swoList.size() > 0) {
 				swo = swoList[0];
 				swoawsDataId = swo.AWS_Data_Id__c;// 20220313 PI鏀归�� by Chen Yanan
-				// contactAWSDataId = String.isNotBlank(swo.CONTACT__r.AWS_Data_Id__c)?swo.CONTACT__r.AWS_Data_Id__c:'';// 20220313 PI鏀归�� by Chen Yanan
 			}
 			//鍒濆鍖栬褰昐WO 鍘熷ASSIGNED TO锛屼繚瀛樻椂鍒ゆ柇鐢ㄦ埛鏄惁鍙樻洿锛屽鏋滃彉鏇寸粰鐢ㄦ埛鍙戦�侀偖浠�
 			assignedUser = swo.ASSIGNEDTO__c;
@@ -117,7 +117,7 @@
 			List<FileAddress__c> attList = new List<FileAddress__c>();
 			Map<String, List<FileAddress__c>> attMap = new Map<String, List<FileAddress__c>>();
 
-			Map<String, Mail_Merge__c> mailMap = new Map<String, Mail_Merge__c>([select id, FROM__c, ccName__c, SUBJECT__c, MESSAGE__c, DATE__c, toName__c, EMAIL_SENT__c from Mail_Merge__c where SWO__c = :swoid order by id]);
+			Map<String, Mail_Merge__c> mailMap = new Map<String, Mail_Merge__c>([select id, FROM__c, ccName__c, SUBJECT__c, MESSAGE__c, DATE__c, toName__c, EMAIL_SENT__c ,AWS_Data_Id__c from Mail_Merge__c where SWO__c = :swoid order by id]);
 			//mailMap = [select id,FROM__c,ccName__c,SUBJECT__c,MESSAGE__c from Mail_Merge__c where SWO__c = :id order by id];
 
 			if (mailMap != null) {
@@ -190,6 +190,13 @@
 			swo.SWO_STATUS__c = 'Not Started';
 			System.debug('SWO: ' + swo);
 		}
+		// update PIPL 20220426 By Chen Yanan Start
+		System.debug('contactAWSDataId: ' + swo.CONTACT__c);
+		if(swo.CONTACT__c != null || ca.CONTACT__c != null){
+			contactAWSDataId = String.isNotBlank(swo.CONTACT__r.AWS_Data_Id__c)?swo.CONTACT__r.AWS_Data_Id__c:(String.isNotBlank(ca.CONTACT__r.AWS_Data_Id__c)?ca.CONTACT__r.AWS_Data_Id__c:'');// 20220313 PI鏀归�� by Chen Yanan
+			contactName = String.isNotBlank(swo.CONTACT__r.Name)?swo.CONTACT__r.Name:(String.isNotBlank(ca.CONTACT__r.Name)?ca.CONTACT__r.Name:'');// 20220313 PI鏀归�� by Chen Yanan
+		}
+		// update PIPL 20220426 By Chen Yanan End
 		SwoStatus = swo.SWO_STATUS__c;
 	}
 

--
Gitblit v1.9.1