/**
|
* 2021-11-09 mzy SWAG-C8KCZZ
|
* 【委托】营业担当SFDC系统首页增加“未接受任务”(未转化询价)提醒功能申请
|
*/
|
public with sharing class AgencyOpportunityManageCotroller {
|
public AgencyOpportunityManageCotroller() {
|
|
}
|
|
//获取当前用户可以查看到的未转换成询价的经销商询价
|
public static AgencyOpportunityView getCurrentAgencyOpportunity(){
|
AgencyOpportunityView tempView = new AgencyOpportunityView();
|
// 提醒权限:2S1_销售医院担当
|
String myUserID = UserInfo.getUserId();
|
User currentUser = [SELECT Id,ProfileId FROM user Where Id = :myUserID];
|
//String currentUserProfileId = String.valueOf(currentUser.ProfileId).substring(0,15);
|
String currentUserProfileId = currentUser.ProfileId;
|
if(currentUserProfileId.equals(System.Label.ProfileId2S1HP) || currentUserProfileId.equals(System.Label.ProfileId_2S4)
|
|| currentUserProfileId.equals(System.Label.ProfileId_2S4_Chief) ){
|
//当前登录用户简档为2S1_销售医院担当
|
tempView.isShow = true;
|
//查找未转换成询价的经销商询价
|
tempView.AgencyOpportunityList = goSelectByCurrentUser();
|
}
|
return tempView;
|
}
|
|
//查找未转换成询价的经销商询价
|
public static List<Agency_Opportunity__c> goSelectByCurrentUser(){
|
//定义变量保存查询结果
|
List<Agency_Opportunity__c> AgencyOpportunityList= new List<Agency_Opportunity__c>();
|
//查询
|
String sql = 'SELECT Id FROM Agency_Opportunity__c ';
|
//条件拼接
|
//记录类型
|
sql += 'WHERE RecordType_Name__c = \'Opportunity\' ';
|
//询价阶段
|
sql += 'AND StageName__c NOT IN (\'中标签约\',\'失单\',\'取消\') ';
|
//已转换
|
sql += 'AND Is_Transformed__c = false ';
|
//是否OCSM共享询价
|
sql += 'AND OCM_Change_To_Opportunity_Flg__c = false ';
|
//营业担当确认
|
sql += 'AND No_Convert_Reason__c IN (\'\',\'2.询价尚未成熟\',null) ';
|
AgencyOpportunityList = Database.query(sql);
|
|
return AgencyOpportunityList;
|
}
|
|
|
public class AgencyOpportunityView {
|
//是否显示
|
@AuraEnabled
|
public Boolean isShow;
|
//查询结果
|
@AuraEnabled
|
public List<Agency_Opportunity__c> AgencyOpportunityList;
|
|
public AgencyOpportunityView(){
|
this.isShow = false;
|
this.AgencyOpportunityList = new List<Agency_Opportunity__c>();
|
}
|
}
|
}
|