From 01f207d979d6be17c8cdec293feab48828c0ec3e Mon Sep 17 00:00:00 2001 From: 黄千龙 <huangqianlong@prec-tech.com> Date: 星期五, 08 四月 2022 14:22:52 +0800 Subject: [PATCH] Merge branch 'master' of http://47.92.229.245:8089/r/OlyMEBG --- force-app/main/default/classes/StraightBackAddressController.cls | 55 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 47 insertions(+), 8 deletions(-) diff --git a/force-app/main/default/classes/StraightBackAddressController.cls b/force-app/main/default/classes/StraightBackAddressController.cls index c2a0a89..6a358f5 100644 --- a/force-app/main/default/classes/StraightBackAddressController.cls +++ b/force-app/main/default/classes/StraightBackAddressController.cls @@ -12,6 +12,7 @@ public String tableDataStr{ get; set; } public String staticResource {get; set;} public String staticResourceContact {get; set;} + public String staticResourceRepair {get; set;} public Contact newCon{get; set;} /***************搴曢儴 缂栬緫鍜屾柊澧炵殑 瀵硅薄*******************/ @@ -66,7 +67,14 @@ public String contactNameValue{set;get;} public String contactIdValue{set;get;} public String addressDataIds{set;get;} + public String sfRecordId{set;get;} // Add by Li Jun for PIPL 20220308 End + + public String accRecordTypeId {set;get;}//褰撳墠 璁板綍绫诲瀷id + + public String accOfficeTypeId {set;get;}//璁板綍绫诲瀷id 鍔炰簨澶� + public String accAgencyTypeId {set;get;}//璁板綍绫诲瀷id 璨╁2搴� + public String accAgencyContactTypeId {set;get;}//璁板綍绫诲瀷id 缁忛攢鍟嗚仈绯讳汉 public StraightBackAddressController() { //鑾峰彇url鏁版嵁 @@ -94,15 +102,21 @@ staticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('Address__c')); staticResourceContact = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact')); + staticResourceRepair = JSON.serialize(PIHelper.getPIIntegrationInfo('Repair__c')); } /** * 寮�濮嬫柟娉� */ public PageReference init(){ - System.debug('RepairId-----'+RepairId); + Schema.RecordTypeInfo recordTypeValue = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Office'); + if(recordTypeValue == null){ + recordTypeValue = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('office'); + } + accOfficeTypeId = recordTypeValue.getRecordTypeId(); + accAgencyTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId(); + accAgencyContactTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('AgencyContact').getRecordTypeId(); String RepairSql = makeTextRepairSql(RepairId); - System.debug('RepairSql-----'+RepairSql); try{ pc = Database.query(RepairSql); system.debug('pc = ' + pc); @@ -144,14 +158,24 @@ }catch(exception e){ //澶辫触鎻愮ず ApexPages.addMessages(e); - System.debug(e.getMessage()); - System.debug(e.getlineNumber()); } insUpdData = new Address__c(); newCon = new Contact(); return null; } - + //鏌ヨ瀹㈡埛璁板綍绫诲瀷 + public PageReference queryRecordType(){ + if(insUpdData.Customer__c!=null){ + String accid = insUpdData.Customer__c; + Account acc = [SELECT id,name,RecordTypeId FROM Account WHERE id =: accid]; + System.debug('acc---'+acc); + System.debug('insUpdData---'+insUpdData); + if(acc!=null&&acc.RecordTypeId!=null&&insUpdData.Customer__c!=null){ + accRecordTypeId = acc.RecordTypeId; + } + } + return null; + } //缂栬緫鑾峰彇鏁版嵁 public PageReference onEditor(){ if(!String.isBlank(UpdId)){ @@ -498,10 +522,16 @@ surname = surname.substring(0,1); } System.debug('newCon = '+newCon); - addContact = new Contact(LastName=surname,FirstName=monicker,AccountId=insUpdData.Customer__c,RecordTypeId=typeL,AWS_Data_Id__c = newCon.AWS_Data_Id__c,LastName_Encrypted__c=newCon.LastName_Encrypted__c); + addContact = new Contact(LastName = surname, + FirstName = monicker, + AccountId = insUpdData.Customer__c, + RecordTypeId = typeL, + AWS_Data_Id__c = newCon.AWS_Data_Id__c, + LastName_Encrypted__c = newCon.LastName_Encrypted__c); try{ //鏂板涓�鏉¤仈绯讳汉鏁版嵁 insert addContact; + sfRecordId = addContact.id; insUpdData.Create_Contacts__c = ''; }catch(Exception e){ //ApexPages.addMessages(e); @@ -532,6 +562,7 @@ try{ //鏂板鎴栦慨鏀规暟鎹� upsert insUpdData; + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '淇濆瓨鎴愬姛锛�')); isSearchBtn = true; //淇濆瓨鎴愬姛锛岄渶瑕佸垵濮嬪寲涓�涓嬫瀵硅薄锛岄槻姝㈠啀娆$偣鍑绘鎸夐挳淇濆瓨涓�涓潯鍚屾牱鐨勬暟鎹� @@ -557,12 +588,12 @@ //鏌ヨ淇悊琛ㄦ暟鎹� private String makeTextRepairSql(String uuid){ - String RepairSql = 'SELECT ID,NAME,HP_ID__c,HP_Name__c,Delivered_Product__c,FSE_ApplyForRepair_time__c,SAP_Transfer_time__c,Dealer__c,Dealer__r.Name,Returns_Product_way__c,Address_Type_Index__c FROM Repair__c where id = \''+RepairId+'\''; + String RepairSql = 'SELECT ID,NAME,HP_ID__c,HP_Name__c,Delivered_Product__c,FSE_ApplyForRepair_time__c,SAP_Transfer_time__c,Dealer__c,Dealer__r.Name,Returns_Product_way__c,Address_Type_Index__c,AWS_Data_Id__c FROM Repair__c where id = \''+RepairId+'\''; return RepairSql; } //鏌ヨ鍦板潃琛ㄦ暟鎹� private String makeTextAddressSql(String typeSearchId) { - String AddressSql = 'SELECT AWS_Data_Id__c,ID,Address_Classification__c,Customer__c,Customer__r.Name,Contacts__c,Contacts__r.Name,Contacts__r.AWS_Data_Id__c,Telephone__c' + String AddressSql = 'SELECT AWS_Data_Id__c,ID,Address_Classification__c,Customer__c,Customer__r.Name,Customer__r.Type,Customer__r.RecordTypeId,Contacts__c,Contacts__r.Name,Contacts__r.AWS_Data_Id__c,Telephone__c' +',Province__c,Province__r.Name,City__c,City__r.name,Detailed_Address__c,Create_Contacts__c,ZipCode__c,CreatedByid,Detailed_Address_Encrypted__c,Telephone_Encrypted__c,ZipCode_Encrypted__c,Contacts__r.LastName_Encrypted__c' + ' FROM Address__c where id != null'; //绫诲瀷绛涢�� @@ -653,6 +684,14 @@ class AddressData { //鏁版嵁 public Address__c address { get; set; } + + public string addressJson { get{ + if (address == null) { + return null; + } + return JSON.serialize(address); + } } + //缂栬緫鎸夐挳鏄惁灞曠ず public String canEdit { get; private set; } //缂栬緫鎸夐挳鏄惁灞曠ず -- Gitblit v1.9.1