| | |
| | | public static Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe(); |
| | | public static String sobjectTypeValue = 'Consum_Apply__c'; |
| | | public Boolean isNewMode{set;get;} |
| | | public Boolean isCloneMode{protected set;get;} |
| | | public String rtTypeId {get; set;} |
| | | public String AWSDataId{set;get;} |
| | | public List<String> encryptedAPIList{set;get;} |
| | |
| | | public NewConsumApplyController(ApexPages.StandardController controller) { |
| | | ApiPrefix = 'PIBackApi'; |
| | | isNewMode = true; |
| | | isCloneMode = false; |
| | | Input_Required_Field_Msg = Label.Input_Required_Field_Msg; |
| | | PIPL_Input_Account_Error_Msg = label.PIPL_Input_Account_Error_Msg; |
| | | //获取所有字段 |
| | | List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Consum_Apply__c').getDescribe().fields.getMap().keyset()); |
| | | Map<string,string> mso = ApexPages.currentPage().getParameters(); |
| | | if(mso != null && mso.containsKey('newclone')){ |
| | | isCloneMode = true; |
| | | } |
| | | if (!Test.isRunningTest()) { |
| | | controller.addFields(fieldList); |
| | | } |
| | |
| | | //新建 |
| | | rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); |
| | | obj.put('OwnerId',UserInfo.getUserId()); |
| | | Map<string,string> mso = ApexPages.currentPage().getParameters(); |
| | | // Map<string,string> mso = ApexPages.currentPage().getParameters(); |
| | | system.debug('mso='+mso); |
| | | if(mso.containsKey('00N10000008rdgs')){ |
| | | controller.getRecord().put('demo_purpose2__c',mso.get('00N10000008rdgs')); |
| | |
| | | Response resp = new Response(); |
| | | Savepoint sp = Database.setSavepoint(); |
| | | String rid = ''; |
| | | Boolean isClone = false; |
| | | String awsDataId = ''; |
| | | |
| | | try{ |
| | | System.debug('abcde'); |
| | | if(isNew){ |
| | | awsDataId = (String)consumApplyInfo.get('AWS_Data_Id__c'); |
| | | System.debug('awsDataId = ' + awsDataId); |
| | | Consum_Apply__c[] ConsumApplys = [select id from Consum_Apply__c where AWS_Data_Id__c =:awsDataId]; |
| | | if(!isNew){ |
| | | isClone = ConsumApplys.size() == 0; |
| | | } |
| | | if(isNew || isClone){ |
| | | System.debug('consumApplyInfozhj = ' + consumApplyInfo); |
| | | insert consumApplyInfo; |
| | | System.debug('consumApplyInfo.Id' + consumApplyInfo.Id); |
| | | }else{ |
| | | System.debug('into update'); |
| | | String awsDataId = (String)consumApplyInfo.get('AWS_Data_Id__c'); |
| | | System.debug('awsDataId = ' + awsDataId); |
| | | Consum_Apply__c[] ConsumApplys = [select id from Consum_Apply__c where AWS_Data_Id__c =:awsDataId]; |
| | | // String awsDataId = (String)consumApplyInfo.get('AWS_Data_Id__c'); |
| | | // System.debug('awsDataId = ' + awsDataId); |
| | | // Consum_Apply__c[] ConsumApplys = [select id from Consum_Apply__c where AWS_Data_Id__c =:awsDataId]; |
| | | System.debug('ConsumApplys[0].id = ' + ConsumApplys[0].id); |
| | | consumApplyInfo.put('Id',ConsumApplys[0].id);//For testing; |
| | | update consumApplyInfo; |