public with sharing class LexRequestCloseController {
|
public LexRequestCloseController() {
|
|
}
|
@AuraEnabled
|
public static Task init(String recordId){
|
|
try{
|
Task task=[SELECT Status FROM Task where id = :recordId];
|
return task;
|
}catch(Exception e){
|
System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e);
|
}
|
return null;
|
}
|
@AuraEnabled
|
public static UpdateResult updateTask(
|
String recordId,
|
String Status
|
) {
|
UpdateResult result = new UpdateResult();
|
result.recordId = recordId;
|
try{
|
// 更新记录并获取结果
|
if(recordId==null) return null;
|
Task rac = new Task( id=recordId);
|
|
if(String.isNotBlank(Status)){
|
rac.Status=Status;
|
}
|
|
rac.Request_completed_time__c=System.now();
|
if(rac.id==null)return null;
|
update rac;
|
result.success = true;
|
result.errors = new List<String>();
|
return result;
|
}catch(Exception e){
|
result.success = false;
|
result.errors = new List<String>();
|
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);
|
if (System.Test.isrunningTest()) {
|
return null;
|
}
|
result.errors.add(mes);
|
}else{
|
if (System.Test.isrunningTest()) {
|
return null;
|
}
|
result.errors.add(e.getMessage());
|
}
|
System.debug(LoggingLevel.INFO,'Rental_Apply__c update Error : ' + e);
|
}
|
return result;
|
}
|
@AuraEnabled
|
public static String getProfileId(){
|
return UserInfo.getProfileId().substring(0,15);
|
}
|
@AuraEnabled
|
public static List<String> getProfileIds(){
|
List<Profile> res=[SELECT id FROM Profile where name='OBA2_询价管理' OR name='OBA7_询价+招标管理'];
|
List<String> ids=new List<String>();
|
for (Profile p:res ) {
|
String idd=p.Id;
|
|
ids.add(idd.substring(0,15));
|
}
|
|
return ids;
|
}
|
public class UpdateResult {
|
@AuraEnabled public String recordId {get;set;}
|
@AuraEnabled public Boolean success {get;set;}
|
@AuraEnabled public List<String> errors {get;set;}
|
}
|
}
|