public class OppLoseController {
|
|
@AuraEnabled
|
public static InitData init(String taskId){
|
InitData res = new initData();
|
try{
|
task__c task = [SELECT id, OpportunityId__c , taskStatus__c
|
FROM task__c
|
WHERE Id =: taskId
|
LIMIT 1];
|
|
res.task = task;
|
res.taskStatus = task.taskStatus__c;
|
res.OpportunityId = task.OpportunityId__c;
|
|
Opportunity opp = [SELECT Sales_owner_buchangID__c,Manager_name__c,Sales_owner_buchang__c,
|
Sales_manager_departmentID__c,name,Sales_assistant_name__c,
|
Sales_assistant_ID__c,id,StageName,SAP_Send_OK__c,
|
Cnt_Lost_cancel_report__c,Bidding_Project_Name_Bid__c
|
FROM Opportunity
|
WHERE id =: task.OpportunityId__c];
|
System.debug('---lt123---task:---- ' + task);
|
System.debug('---lt123---opp:---- ' + opp);
|
System.debug(LoggingLevel.INFO, '*** opp: ' + opp);
|
|
res.StageName = opp.StageName;
|
res.SAP_Send_OK = opp.SAP_Send_OK__c;
|
res.Cnt_Lost_cancel_report = opp.Cnt_Lost_cancel_report__c;
|
res.Name = opp.Name;
|
res.Sales_assistant_name = opp.Sales_assistant_name__c;
|
res.Sales_assistant_ID = opp.Sales_assistant_ID__c;
|
res.Manager_name = opp.Manager_name__c;
|
res.Sales_manager_departmentID = opp.Sales_manager_departmentID__c;
|
res.Sales_owner_buchang = opp.Sales_owner_buchang__c;
|
res.Sales_owner_buchangID = opp.Sales_owner_buchangID__c;
|
RecordType re=[select Id from recordType where name='询价失单报告'];
|
res.reId=re.Id;
|
res.opp = opp;
|
System.debug(LoggingLevel.INFO, '*** res: ' + res);
|
}catch(Exception e){
|
System.debug(LoggingLevel.INFO, '*** e: ' + e);
|
}
|
return res;
|
}
|
|
public class ReturnData{
|
|
}
|
//OLY中标
|
@AuraEnabled
|
public static String taskOLYwinBid(String recordId) {
|
String messageText = '';
|
try {
|
Opportunity opp = [SELECT Id,ConfirmationofAward__c FROM Opportunity WHERE Id = :recordId LIMIT 1];
|
opp.Id = recordId;
|
opp.ConfirmationofAward__c = LightingButtonConstant.STATUS_OLYwinBid;
|
messageText = '1';
|
update opp;
|
System.debug(LoggingLevel.INFO, '*** winBid: ' + opp);
|
return messageText;
|
} catch (Exception e) {
|
// System.debug(LoggingLevel.INFO, '*** winBidXu: ' + ex);
|
// messageText = ex.getMessage();
|
// return messageText;
|
if(e.getMessage().contains(':')||System.Test.isrunningTest()){
|
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;
|
}
|
}
|
}
|
//竞争对手中标
|
@AuraEnabled
|
public static String taskLoseBid(String recordId) {
|
String messageText = '';
|
try {
|
Opportunity opp = [SELECT Id,ConfirmationofAward__c FROM Opportunity WHERE Id = :recordId LIMIT 1];
|
opp.Id = recordId;
|
opp.ConfirmationofAward__c = LightingButtonConstant.STATUS_Bid_LoseBid;
|
messageText = '1';
|
update opp;
|
System.debug(LoggingLevel.INFO, '*** winBid: ' + opp);
|
return messageText;
|
} catch (Exception e) {
|
// System.debug(LoggingLevel.INFO, '*** winBidXu: ' + ex);
|
// messageText = ex.getMessage();
|
// return messageText;
|
if(e.getMessage().contains(':')||System.Test.isrunningTest()){
|
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;
|
}
|
}
|
}
|
public class InitData{
|
//询价数据
|
@AuraEnabled
|
public Opportunity opp;
|
@AuraEnabled
|
public String StageName;
|
@AuraEnabled
|
public Boolean SAP_Send_OK;
|
@AuraEnabled
|
public Decimal Cnt_Lost_cancel_report;
|
@AuraEnabled
|
public String Name;
|
@AuraEnabled
|
public String Sales_assistant_name;
|
@AuraEnabled
|
public String Sales_assistant_ID;
|
@AuraEnabled
|
public String Manager_name;
|
@AuraEnabled
|
public String Sales_manager_departmentID;
|
@AuraEnabled
|
public String Sales_owner_buchang;
|
@AuraEnabled
|
public String Sales_owner_buchangID;
|
|
//任务
|
@AuraEnabled
|
public String OpportunityId;
|
@AuraEnabled
|
public String taskStatus;
|
@AuraEnabled
|
public task__c task;
|
@AuraEnabled
|
public String reId;
|
}
|
|
}
|