From 900c50a247705d6fe8833e84d31b5d51616b7c26 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 15 四月 2022 14:08:05 +0800
Subject: [PATCH] 20220415

---
 force-app/main/default/classes/NewLoanerApplicationController.cls |   53 +++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 43 insertions(+), 10 deletions(-)

diff --git a/force-app/main/default/classes/NewLoanerApplicationController.cls b/force-app/main/default/classes/NewLoanerApplicationController.cls
index de3eb9c..620a8fb 100644
--- a/force-app/main/default/classes/NewLoanerApplicationController.cls
+++ b/force-app/main/default/classes/NewLoanerApplicationController.cls
@@ -5,12 +5,27 @@
 	public String contactID {get; private set;}
 
 	public loaner_application__c la{get; private set;}
+
+	// Update 20220318 By Yang Kaiyu Start
+	public loaner_user__c lu {get; private set;}
+
+	public Contact con {get; private set;}
+	// Update 20220318 By Yang Kaiyu End
+
 	public String typeName {get; private set;}
 
 	public String userType {get; private set;}
 
 	public String baseUrl { get; set; }
     public String rtUrl { get; set; }
+
+	// Update 20220318 By Yang Kaiyu Start
+	public String staticResource {get; set;}
+	public String staticResourceContact {get; set;}
+	public String staticResourceLoanerUser {get; set;}
+
+	public String laid {get; set;}
+	// Update 20220318 By Yang Kaiyu End
 
 	public NewLoanerApplicationController() {
 		baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
@@ -30,6 +45,11 @@
 		userType = UserInfo.getUserType();
 		accountID = System.currentPageReference().getParameters().get('accid');
         contactID = System.currentPageReference().getParameters().get('conId');
+		// Update 20220318 By Yang Kaiyu End
+		staticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('loaner_application__c')); 
+		staticResourceContact = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact')); 
+		staticResourceLoanerUser = JSON.serialize(PIHelper.getPIIntegrationInfo('loaner_user__c')); 
+		// Update 20220318 By Yang Kaiyu End
 
         Account acc = [select id,ProductSegment__c from Account where id = :accountID];
         typeName = acc.ProductSegment__c;
@@ -37,12 +57,19 @@
                   .get(typeName).getRecordTypeId();
 		
 		la = new loaner_application__c();
+		// Update 20220318 By Yang Kaiyu End
+		lu = new loaner_user__c();
+		con = new Contact();
+		// Update 20220318 By Yang Kaiyu End
 		la.RecordTypeId= recordTypeId;
 		if(typeName == 'BS' && userType != 'Standard'){
 			la.RecordTypeId = System.label.bs_D_ID;
 		}
 		System.debug(la.RecordTypeId);
 		//ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,accountID));
+		// Update 20220318 By Yang Kaiyu End
+		con = [select id,AWS_Data_Id__c,Phone,Phone_Encrypted__c,Name,LastName_Encrypted__c,Address1__c from Contact where id = :contactID];
+		// Update 20220318 By Yang Kaiyu End
 		return null;
 	}
 
@@ -61,21 +88,27 @@
 	 	Savepoint sp = Database.setSavepoint();
         try {
             insert la;
-
-            loaner_user__c lu = new loaner_user__c();
+			
+            // loaner_user__c lu = new loaner_user__c();   // Update 20220412 By Chen Yanan
 	        lu.loaner_application__c = la.id;
 	        lu.Customer__c = accountID;
-		 	
-		 	if(contactID != null){
-		 		lu.Contact__c = contactID;
-		 		Contact contact = [select id,Phone,Name,Address1__c from Contact where id = :contactID];
-		 		lu.ContactNumber__c = contact.Phone;
+			// Update 20220318 By Yang Kaiyu Start
+			// System.debug('lu------------'+lu);
+		 	// if(contactID != null){
+		 	// 	lu.Contact__c = contactID;
+		 	// 	Contact contact = [select id,AWS_Data_Id__c,Phone,Phone_Encrypted__c,Name,LastName_Encrypted__c,Address1__c from Contact where id = :contactID];
+		 	// 	lu.ContactNumber__c = contact.Phone;
 		 		
-		 	}
+		 	// }
+			// Update 20220318 By Yang Kaiyu End
 	 		
             insert lu;
-            String url = baseUrl + '\\' + la.Id;
-            return new Pagereference(url);
+			// Update 20220318 By Yang Kaiyu Start
+			laid = la.id;
+            // String url = baseUrl + '\\' + la.Id;
+            // return new Pagereference(url);
+			return null;
+			// Update 20220318 By Yang Kaiyu End
         } catch (Exception e) {
             Database.rollback(sp);
             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, e.getMessage()));

--
Gitblit v1.9.1