public with sharing class LexSIAbortBtnController { public LexSIAbortBtnController() { } @AuraEnabled public static Boolean init(String recordId){ try{ Opportunity i=[select Estimation_Decision__c from Opportunity where id = :recordId]; return i.Estimation_Decision__c; }catch(Exception e){ System.debug('LexSIAbortBtnController init error: '+e.getMessage()); } return null; } @AuraEnabled public static String setAbortSI(String isoID,String AbortReason){ List updateList = new List(); List oppidList = new List(); List Opplist = new List(); if(AbortReason==null||String.isBlank(AbortReason)){ return '请输入终止SI需求原因'; }else{ updateList = [SELECT id,Abort_SI_Reason__c,Abort_Date__c,Opportunity_ID__c from IS_Opportunity_Demand__c where id = :isoID]; for(IS_Opportunity_Demand__c iso : updateList){ iso.Abort_SI_Reason__c = AbortReason; iso.Abort_Date__c = Date.today(); oppidList.add(iso.Opportunity_ID__c); } Opplist = [SELECT Project_decide_date__c , Stock_Submit_Date__c , Stock_Confrim_Date__c from Opportunity WHERE id in:oppidList]; for(Opportunity ops : Opplist){ ops.Project_decide_date__c = null; ops.Stock_Submit_Date__c = null; ops.Stock_Confrim_Date__c = null; } Savepoint sp = Database.setSavepoint(); try{ update Opplist; update updateList; return 'Fin'; }catch (Exception o){ Database.rollback(sp); return 'DataBase is Crashed,Connect with the Developer PLEASE'; } } } public class InitData{ @AuraEnabled public String id; @AuraEnabled public Boolean delFlag; } }