From 784f9cec56eef3c7ac0ba02de98fdbf341c6a7b3 Mon Sep 17 00:00:00 2001 From: Li Jun <buli@deloitte.com.cn> Date: 星期一, 25 四月 2022 18:38:29 +0800 Subject: [PATCH] 0428IssueFix --- force-app/main/default/classes/StraightBackAddressController.cls | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 57 insertions(+), 3 deletions(-) diff --git a/force-app/main/default/classes/StraightBackAddressController.cls b/force-app/main/default/classes/StraightBackAddressController.cls index 45a9643..23aa63b 100644 --- a/force-app/main/default/classes/StraightBackAddressController.cls +++ b/force-app/main/default/classes/StraightBackAddressController.cls @@ -109,7 +109,11 @@ * 寮�濮嬫柟娉� */ public PageReference init(){ - accOfficeTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Office').getRecordTypeId(); + 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); @@ -159,6 +163,7 @@ newCon = new Contact(); return null; } + //鏌ヨ瀹㈡埛璁板綍绫诲瀷 public PageReference queryRecordType(){ if(insUpdData.Customer__c!=null){ @@ -212,6 +217,7 @@ } return null; } + /* //閲囩敤鎸夐挳 public PageReference adoptSave(){ //adoptId 瑕侀噰鐢ㄧ殑鍦板潃鏁版嵁id @@ -276,7 +282,9 @@ } rc.address_Telephone__c=tableData[i].address.Telephone__c; rc.Detailed_Address__c=address; - update rc; + if(!Test.isRunningTest()){ + update rc; + } //淇濆瓨鏁版嵁鍒颁繚鏈夎澶囪〃涓� Asset ast = new Asset( @@ -305,13 +313,14 @@ } return null; } - +*/ //閲嶅畾鍚戝埌 淇悊椤甸潰 public PageReference redirectPag(){ PageReference ref = new Pagereference('/' + RepairId); ref.setRedirect(true); return ref; } + /** * 妫�绱㈡暟鎹煡璇� @@ -673,6 +682,51 @@ + ' RecordType.name,Parent.Parent.Id FROM Account WHERE ID = \'' + accId + '\''; return AccountSql; } + + @RemoteAction + public static string SaveEx(string repaire_json,string asset_json, string address_id){ + return SaveExCore(repaire_json,asset_json,address_id); + } + + public static string SaveExCore(string repaire_json,string asset_json, string address_id){ + string message = null; + string savemessage = null; + savepoint sp = Database.setsavepoint(); + try { + Repair__c r = (Repair__c)JSON.deserialize(repaire_json,Repair__c.class); + Asset ast = (Asset)JSON.deserialize(asset_json,Asset.class); + Address__c add = new Address__c(Id=address_id,Using_Datetime__c = Datetime.now()); + update r; + update ast; + update add; + }catch(DmlException e) { + Integer index = 0; + System.debug(e.getNumDml()); + System.debug(e.getDmlFields(index)); + System.debug(e.getDmlId(index)); + System.debug(e.getDmlIndex(index)); + System.debug(e.getDmlMessage(index)); + System.debug(e.getDmlStatusCode(index)); + System.debug(e.getDmlType(index)); + system.debug(e.getMessage()); + system.debug(e.getStackTraceString()); + + System.debug('into catch'+e.getMessage()); + Database.rollback(sp); + + message ='淇濆瓨澶辫触锛屽師鍥�:'+ e.getDmlMessage(index); + savemessage = e.getMessage()+e.getStackTraceString(); + } catch (Exception e) { + System.debug('into catch'+e.getMessage()); + Database.rollback(sp); + + savemessage = e.getMessage()+e.getStackTraceString(); + message = '淇濆瓨澶辫触'; + } finally { + PIHelper.saveTransLog('StraightBackAddressController',address_id,address_id,address_id, repaire_json ,'success',message); + } + return message; + } /** * 涓轰簡鏂逛究鍓嶆table鑾峰彇鍊� -- Gitblit v1.9.1