//author : kkbes forbutton NewIntention 经销商询价对象
|
public with sharing class LexNewIntentionController {
|
|
@AuraEnabled
|
public static Agency_Opportunity__c init(String recordId){
|
Agency_Opportunity__c res = new Agency_Opportunity__c();
|
try{
|
res = [Select Id,Is_Transformed__c,Department_Class_Opp_Name__c,
|
Department_Name_Text__c,StageName__c,Close_Forecasted_Date__c,
|
Name,Purchase_Reason__c,Fund_Basis__c,Purchase_Type__c,
|
Sales_Method__c,Request__c,Request_Detail__c ,NewOpportunity_Agency_Apply_Status_F__c,Hospital_DC_Name__c,
|
Account_Opp__c,Department_Class_Opp__c
|
FROM Agency_Opportunity__c
|
WHERE Id = : recordId];
|
return res;
|
|
}
|
catch(Exception e){
|
System.debug(LoggingLevel.INFO, '*** e: ' + e);
|
return null;
|
}
|
|
}
|
|
|
@AuraEnabled
|
public static List<Account> getAccountByLongName(String Name){
|
List<Account> res = new List<Account>();
|
res = [Select id, name
|
From Account
|
WHERE Name = : Name];
|
return res;
|
|
}
|
|
@AuraEnabled
|
public static String updateAgencyOpportunity (String Id,String Status){
|
try {
|
Agency_Opportunity__c res = new Agency_Opportunity__c();
|
res.Id = Id;
|
res.NewOpportunity_Agency_Apply_Status__c = Status;
|
update res;
|
return 'success';
|
}
|
catch(Exception e){
|
String messageText='';
|
if(e.getMessage().contains(':')){
|
String eMessage =e.getMessage();
|
Integer left = eMessage.indexOf(',')+1;
|
Integer right= eMessage.lastIndexOf(':')+1;
|
if(right>eMessage.length()||right<=left){
|
right=eMessage.length();
|
}
|
String mes=eMessage.substring(left,right);
|
messageText = mes;
|
return messageText;
|
}else{
|
messageText=e.getMessage();
|
return messageText;
|
}
|
}
|
}
|
|
}
|