From 988f9735377909b6310301e582c15804e004783f Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期六, 07 十月 2023 10:36:13 +0800
Subject: [PATCH] 近期修改cjw
---
force-app/main/default/classes/OpportunityLightingButtonController.cls | 266 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 263 insertions(+), 3 deletions(-)
diff --git a/force-app/main/default/classes/OpportunityLightingButtonController.cls b/force-app/main/default/classes/OpportunityLightingButtonController.cls
index e88cb1e..886fa74 100644
--- a/force-app/main/default/classes/OpportunityLightingButtonController.cls
+++ b/force-app/main/default/classes/OpportunityLightingButtonController.cls
@@ -4,9 +4,24 @@
* @Author: chen jing wu
* @Date: 2023-04-12 11:16:07
* @LastEditors: chen jing wu
- * @LastEditTime: 2023-05-24 16:34:15
+ * @LastEditTime: 2023-09-25 13:20:57
*/
public with sharing class OpportunityLightingButtonController {
+ @AuraEnabled
+ public static List<Lost_cancel_report__c> queryForEditLostButton(String recordId){
+ List<Lost_cancel_report__c> res = new List<Lost_cancel_report__c>();
+ try {
+ List<Lost_cancel_report__c> re = [
+ select id,
+ Report_Status__c,
+ RecordTypeId
+ from Lost_cancel_report__c where RecordTypeId != '01210000000R4hHAAS' and Opportunity__c =: recordId];
+ res = re;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ return res;
+ }
@AuraEnabled
public static InitData initForPredictedDateChangeButton(String recordId){
InitData res = new InitData();
@@ -45,9 +60,21 @@
IF_Submit__c ,
Trade__c,
Is_Corrosion__c,
- If_Authorizing_Lock__c
+ If_Authorizing_Lock__c,
+ AccDealerBlacklist__c,
+ Agency1__c,
+ Agency2__c,
+ Hospital__c,
+ OwnerId,
+ Sales_assistant_name_text__c
from Opportunity where Id =: recordId
];
+ res.AccDealerBlacklist = opportunity.AccDealerBlacklist__c;
+ res.angency1 = opportunity.Agency1__c;
+ res.angency2 = opportunity.Agency2__c;
+ res.accname = opportunity.Hospital__c;
+ res.ownerids = opportunity.OwnerId;
+ res.ddid = opportunity.Sales_assistant_name_text__c;
res.agency1Id = opportunity.Agency1_ID_18__c;
res.stageName = opportunity.StageName;
res.sapSendOK = opportunity.SAP_Send_OK__c;
@@ -184,6 +211,7 @@
res.systemProfileId = getProfileIdByName(lexLightingButtonConstant.SYSTEM_PROFILE_NAME);
res.s1ProfileId = getProfileIdByName(lexLightingButtonConstant.S1_PROFILE_NAME);
res.s4ProfileId = getProfileIdByName(lexLightingButtonConstant.S4_PROFILE_NAME);
+ res.recordTypeId = Schema.SObjectType.Request_tedner_doc__c.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_AUTHORIZATION_REQUEST).getRecordTypeId();
} catch (Exception e) {
System.debug('e:****' + e);
}
@@ -223,6 +251,7 @@
res.salesManagerDepartmentID = opportunity.Sales_manager_departmentID__c;
res.salesOwnerBuchang = opportunity.Sales_owner_buchang__c;
res.salesOwnerBuchangID = opportunity.Sales_owner_buchangID__c;
+ res.recordTypeId = Schema.SObjectType.Lost_cancel_report__c.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_OPPO_CANCEL_REPORT).getRecordTypeId();
} catch (Exception e) {
throw new AuraHandledException(e.getMessage());
}
@@ -236,6 +265,7 @@
select
StageName,
SAP_Send_OK__c,
+ Cnt_Lost_cancel_Draft__c,
Cnt_Lost_cancel_report__c,
Name,
Sales_assistant_name__c,
@@ -256,11 +286,42 @@
res.salesManagerDepartmentID = opportunity.Sales_manager_departmentID__c;
res.salesOwnerBuchang = opportunity.Sales_owner_buchang__c;
res.salesOwnerBuchangID = opportunity.Sales_owner_buchangID__c;
+ res.cntLostCancelDraft = opportunity.Cnt_Lost_cancel_Draft__c;
} catch (Exception e) {
throw new AuraHandledException(e.getMessage());
}
return res;
}
+ @AuraEnabled
+ public static InitData initForLexQuoteEntryNewbotton(String recordId){
+ InitData res = new InitData();
+ try {
+ Opportunity opportunity = [
+ select
+ Agency_Is_Delete__c,
+ Account_Is_Active__c,
+ Hospital_Is_Active__c,
+ RecordTypeId,
+ Estimation_Decision__c
+ from Opportunity where Id =: recordId
+ ];
+ res.agencyIsDeletec = opportunity.Agency_Is_Delete__c;
+ res.accountIsActivec = opportunity.Account_Is_Active__c;
+ res.hospitalIsActivec = opportunity.Hospital_Is_Active__c;
+ res.recordTypeId = opportunity.RecordTypeId;
+ res.estimationDecisionc = opportunity.Estimation_Decision__c;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ return res;
+ }
+ @AuraEnabled
+ public static Boolean describeSObjectCommon (String objname)
+ {
+ Schema.DescribeSobjectResult schemaMap = Schema.describeSObjects(new String[]{objname})[0];
+ return schemaMap.isCreateable();
+ }
+
@AuraEnabled
public static InitData initForQuotationRequestButton(String recordId){
InitData res = new InitData();
@@ -304,7 +365,11 @@
CurrencyIsoCode
from Opportunity where Id =: recordId
];
+ Report cnyReport = [SELECT Id FROM Report WHERE Name = :lexLightingButtonConstant.REPORT_NAME_FOR_CNY limit 1];
+ Report usdReport = [SELECT Id FROM Report WHERE Name = :lexLightingButtonConstant.REPORT_NAME_FOR_USD limit 1];
res.currencyIsoCode = opportunity.CurrencyIsoCode;
+ res.reportForCNYId = cnyReport.Id;
+ res.reportForUSDId = usdReport.Id;
} catch (Exception e) {
throw new AuraHandledException(e.getMessage());
}
@@ -425,6 +490,7 @@
res.accountId = opp.AccountId;
res.accountName = acc.Name;
res.name = opp.Name;
+ // res.recordTypeId = Schema.SObjectType.Task.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_INQUIRY_FOLLOW_UP).getRecordTypeId();
} catch (Exception e) {
throw new AuraHandledException(e.getMessage());
}
@@ -446,6 +512,57 @@
res.estimationDecision = opp.Estimation_Decision__c;
res.sapSendOK = opp.SAP_Send_OK__c;
res.ifAuthorizingLock = opp.If_Authorizing_Lock__c;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ return res;
+ }
+
+ @AuraEnabled
+ public static InitData initForSpecilaApplyCreateButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Opportunity opp = [
+ select
+ Forecast_this_month__c
+ from Opportunity where Id =: recordId
+ ];
+ res.oppForecastStatus = opp.Forecast_this_month__c;
+ res.recordTypeId = Schema.SObjectType.OpportunitySpecialApply__c.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_SPECIL_APPLY_CREATE).getRecordTypeId();
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ return res;
+ }
+ @AuraEnabled
+ public static InitData initForSpecilaApplyCreateAchButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Statu_Achievements__c ach = [
+ select
+ Id,
+ Monthly_forecast_shipping__c,
+ Opportunity__c
+ from Statu_Achievements__c where Id =: recordId
+ ];
+ res.oppId = ach.Opportunity__c;
+ res.oppForecastStatus = ach.Monthly_forecast_shipping__c;
+ res.recordTypeId = Schema.SObjectType.OpportunitySpecialApply__c.getRecordTypeInfosByName().get(lexLightingButtonConstant.RECORD_TYPE_NAME_BY_SPECIL_APPLY_CREATE_ACH).getRecordTypeId();
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ return res;
+ }
+ @AuraEnabled
+ public static InitData initForNewOpportunityFileButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Opportunity opp = [
+ select
+ Stock_apply_status__c
+ from Opportunity where Id =: recordId
+ ];
+ res.stockApplyStatus = opp.Stock_apply_status__c;
} catch (Exception e) {
throw new AuraHandledException(e.getMessage());
}
@@ -568,7 +685,7 @@
select id,
Tender_information__r.subInfoType__c
from Tender_Opportunity_Link__c
- where (Tender_information__r.subInfoType__c =:lexLightingButtonConstant.SUB_INFO_TYPE_SCRAPPED_LABEL OR Tender_information__r.subInfoType__c =:lexLightingButtonConstant.SUB_INFO_TYPE_FLOW_LABEL) and Opportunity__c =: recordId
+ where (Tender_information__r.subInfoType__c =:lexLightingButtonConstant.SUB_INFO_TYPE_SCRAPPED_LABEL OR Tender_information__r.subInfoType__c =:lexLightingButtonConstant.SUB_INFO_TYPE_FLOW_LABEL OR Tender_information__r.TerminateApprovalStatus__c= :lexLightingButtonConstant.SUB_INFO_TYPE_APPROVE) and Opportunity__c =: recordId
];
} catch (Exception e) {
System.debug('e:****' + e);
@@ -679,6 +796,115 @@
} catch (Exception e) {
throw new AuraHandledException(e.getMessage());
}
+ }
+ @AuraEnabled
+ public static string queryForProfileId(){
+ return UserInfo.getProfileId();
+ }
+ @AuraEnabled
+ public static Boolean queryQuote(String estimationId){
+ Boolean bo;
+ try {
+ Quote qu = [select Have_Virtual__c from Quote where Id =: estimationId];
+ bo = qu.Have_Virtual__c;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ return bo;
+ }
+
+ @AuraEnabled
+ public static String initCopy(String recordId){
+ String s='';
+ try {
+ String objectName = 'Opportunity'; // 瑕佽幏鍙栧瓧娈电殑瀵硅薄鍚�
+ Map<String, Schema.SObjectType> globalDescribe = Schema.getGlobalDescribe();
+ Schema.SObjectType objType = globalDescribe.get(objectName);
+ if (objType != null) {
+ Schema.DescribeSObjectResult objDescribe = objType.getDescribe();
+ Map<String, Schema.SObjectField> fieldMap = objDescribe.fields.getMap();
+ s+='SELECT ';
+ // 鐜板湪锛宖ieldMap涓寘鍚簡瀵硅薄鐨勬墍鏈夊瓧娈典俊鎭�
+ for (String fieldName : fieldMap.keySet()) {
+ if(!fieldName.equals('id')
+ &&!fieldName.equals('Id') &&!fieldName.equals('Opportunity_No__c'))
+ s+=fieldName+',';
+ }
+
+ s=s.removeEnd(',');
+ s+=' FROM Opportunity where id=\''+recordId+'\'';
+ system.debug('SQL:'+s);
+ List<Opportunity> opportunitys = Database.query(s);
+ s='';
+ if(opportunitys.size()>0){
+ system.debug('in!');
+ for (String fieldName : fieldMap.keySet()) {
+ String formaF=fieldMap.get(fieldName).getDescribe().getName();
+ if(opportunitys.get(0).get(fieldName)!=null&&!opportunitys.get(0).get(fieldName).equals('null')){
+ if(formaF.equals('Id')
+ ||formaF.equals('OwnerId')
+ ||formaF.equals('CreatedDate')
+ ||formaF.equals('CreatedById')
+ )
+ {
+ continue;
+ }
+ Object val=opportunitys.get(0).get(fieldName);
+ if(val instanceof Date ){
+ String str=String.valueOf(val);
+ str=str.replace(' ','T');
+ str+='.000Z';
+ s+=formaF+'='+str+',';
+ }else if (val instanceof DateTime){
+ String str=String.valueOf(val);
+ str=str.replace(' ','T');
+ str+='.000Z';
+ s+=formaF+'='+str+',';
+ }else{
+ s+=formaF+'='+opportunitys.get(0).get(fieldName)+',';
+ }
+
+ }
+ }
+ s=s.removeEnd(',');
+ return s;
+ }
+ }
+ return s;
+ } catch (Exception e) {
+ System.debug(e.getMessage());
+ }
+ return s;
+ }
+
+ public static String forma(String str){
+ String res='';
+ String stra='a';
+ Integer a=stra.charAt(0);
+ String strz='z';
+ Integer z=strz.charAt(0);
+ String strAa='A';
+ Integer bA=strAa.charAt(0);
+ String strZz='Z';
+ Integer bZ=strZz.charAt(0);
+ String strx='_';
+ Integer x=strx.charAt(0);
+ List<Integer> charArr = new List<Integer>();
+ Integer change=bA-a;
+ Integer st=(str.charAt(0)+change);
+ charArr.add(st);
+ for(Integer i=0;i<str.length()-2;i++){
+ Integer c=str.charAt(i);
+ Integer nextC=str.charAt(i+1);
+ if(c==x&&nextC>=a&&nextC<z&&i!=str.length()-2){
+ nextC+=change;
+ }
+ charArr.add(nextC);
+ }
+ res=String.fromCharArray(charArr);
+ res+=str.substring(str.length()-1,str.length());
+
+ return res;
}
@AuraEnabled
public static String changeTrade(String oppId){
@@ -833,5 +1059,39 @@
public String s1ProfileId;
@AuraEnabled
public String accountName;
+ @AuraEnabled
+ public String recordTypeId;
+ @AuraEnabled
+ public String reportForCNYId;
+ @AuraEnabled
+ public String reportForUSDId;
+ @AuraEnabled
+ public String oppForecastStatus;
+ @AuraEnabled
+ public String oppId;
+ @AuraEnabled
+ public String AccDealerBlacklist;
+ @AuraEnabled
+ public String angency1;
+ @AuraEnabled
+ public String angency2;
+ @AuraEnabled
+ public String accname;
+ @AuraEnabled
+ public String ownerids;
+ @AuraEnabled
+ public String ddid;
+ @AuraEnabled
+ public String agencyIsDeletec;
+ @AuraEnabled
+ public String accountIsActivec;
+ @AuraEnabled
+ public String hospitalIsActivec;
+ @AuraEnabled
+ public Boolean estimationDecisionc;
+ @AuraEnabled
+ public String reportStatus;
+ @AuraEnabled
+ public String reportId;
}
}
\ No newline at end of file
--
Gitblit v1.9.1