From 74e6a383570060d05c58f731fa7cd9f241db50bd Mon Sep 17 00:00:00 2001
From: twysparks <twysparks@163.com>
Date: 星期四, 20 四月 2023 14:07:42 +0800
Subject: [PATCH] Merge branch 'LEX_dev' of http://47.92.229.245:8089/r/lightningupdate into LEX_dev
---
force-app/main/default/classes/OpportunityLightingButtonController.cls | 524 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 524 insertions(+), 0 deletions(-)
diff --git a/force-app/main/default/classes/OpportunityLightingButtonController.cls b/force-app/main/default/classes/OpportunityLightingButtonController.cls
new file mode 100644
index 0000000..5c0b778
--- /dev/null
+++ b/force-app/main/default/classes/OpportunityLightingButtonController.cls
@@ -0,0 +1,524 @@
+/*
+ * @Description:
+ * @version:
+ * @Author: chen jing wu
+ * @Date: 2023-04-12 11:16:07
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-04-14 17:24:54
+ */
+public with sharing class OpportunityLightingButtonController {
+ @AuraEnabled
+ public static InitData initForPredictedDateChangeButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Opportunity opportunity = [
+ select
+ DirectLossFLG__c,
+ Created_Day__c
+ from Opportunity where Id =: recordId];
+ res.createdDay = opportunity.Created_Day__c;
+ res.directLossFLG = opportunity.DirectLossFLG__c;
+ } catch (Exception e) {
+ System.debug('e:****' + e);
+ }
+ return res;
+ }
+ @AuraEnabled
+ public static InitData initForAgencyAuthorizeButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Opportunity opportunity = [
+ select
+ Agency1_ID_18__c,
+ StageName,
+ SAP_Send_OK__c,
+ Opp_order_Type__c,
+ If_Have_170__c,
+ If_Have_AH__c,
+ Cnt_Lost_cancel_Draft__c,
+ Cnt_Lost_cancel_report__c,
+ Estimation_Id__c,
+ DetailNum__c,
+ Estimation_Decision__c,
+ Sales_Root__c,
+ AcecideCntCheck__c,
+ IF_Submit__c ,
+ Trade__c,
+ Is_Corrosion__c,
+ If_Authorizing_Lock__c
+ from Opportunity where Id =: recordId
+ ];
+ res.agency1Id = opportunity.Agency1_ID_18__c;
+ res.stageName = opportunity.StageName;
+ res.sapSendOK = opportunity.SAP_Send_OK__c;
+ res.oppOrderType = opportunity.Opp_order_Type__c;
+ res.ifHave170 = opportunity.If_Have_170__c;
+ res.ifHaveAH = opportunity.If_Have_AH__c;
+ res.cntLostCancelDraft = opportunity.Cnt_Lost_cancel_Draft__c;
+ res.cntLostCancelReport = opportunity.Cnt_Lost_cancel_report__c;
+ res.estimationId = opportunity.Estimation_Id__c;
+ res.detailNum = opportunity.DetailNum__c;
+ res.estimationDecision = opportunity.Estimation_Decision__c;
+ res.salesRoot = opportunity.Sales_Root__c;
+ res.acecideCntCheck = opportunity.AcecideCntCheck__c;
+ res.ifSubmit = opportunity.IF_Submit__c;
+ res.trade = opportunity.Trade__c;
+ res.isCorrosion = opportunity.Is_Corrosion__c;
+ res.ifAuthorizingLock = opportunity.If_Authorizing_Lock__c;
+ String profile18 = UserInfo.getProfileId();
+ res.profileId = profile18.substring(0,profile18.length() - 3);
+ } catch (Exception e) {
+ System.debug('e:****' + e);
+ }
+ return res;
+ }
+ @AuraEnabled
+ public static InitData initForLoseBidButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Opportunity opportunity = [
+ select
+ ifOpenBid__c
+ from Opportunity where Id =: recordId
+ ];
+ res.ifOpenBid = opportunity.ifOpenBid__c;
+ } catch (Exception e) {
+ System.debug('e:****' + e);
+ }
+ return res;
+ }
+ @AuraEnabled
+ public static InitData initForOLYwinBidButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Opportunity opportunity = [
+ select
+ ifOpenBid__c
+ from Opportunity where Id =: recordId
+ ];
+ res.ifOpenBid = opportunity.ifOpenBid__c;
+ } catch (Exception e) {
+ System.debug('e:****' + e);
+ }
+ return res;
+ }
+ @AuraEnabled
+ public static InitData initForCreateEventButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Opportunity opportunity = [
+ select
+ AccountId
+ from Opportunity where Id =: recordId];
+ res.accountId = opportunity.AccountId;
+ } catch (Exception e) {
+ System.debug('e:****' + e);
+ }
+ return res;
+ }
+ @AuraEnabled
+ public static InitData initFoBeforeOPDPDFBtnButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Opportunity opportunity = [
+ select
+ AccountId
+ from Opportunity where Id =: recordId
+ ];
+ res.accountId = opportunity.AccountId;
+ res.userId = UserInfo.getUserId();
+ } catch (Exception e) {
+ System.debug('e:****' + e);
+ }
+ return res;
+ }
+ @AuraEnabled
+ public static InitData initFoBeforeOPDPDFBtnSISButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Opportunity opportunity = [
+ select
+ AccountId
+ from Opportunity where Id =: recordId
+ ];
+ res.accountId = opportunity.AccountId;
+ res.userId = UserInfo.getUserId();
+ } catch (Exception e) {
+ System.debug('e:****' + e);
+ }
+ return res;
+ }
+ @AuraEnabled
+ public static InitData initForRequestDBButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Opportunity opportunity = [
+ select
+ StageName,
+ SAP_Send_OK__c,
+ Cnt_Lost_cancel_report__c,
+ Cnt_Lost_cancel_Draft__c,
+ Agency1__c,
+ Agency1_ID_18__c,
+ Name,
+ Bid_Planned_Date__c,
+ Sales_assistant_name__c,
+ Sales_assistant_ID__c
+ from Opportunity where Id =: recordId
+ ];
+ res.stageName = opportunity.StageName;
+ res.sapSendOK = opportunity.SAP_Send_OK__c;
+ res.cntLostCancelReport = opportunity.Cnt_Lost_cancel_report__c;
+ res.cntLostCancelDraft = opportunity.Cnt_Lost_cancel_Draft__c;
+ res.agency1 = opportunity.Agency1__c;
+ res.agency1Id = opportunity.Agency1_ID_18__c;
+ res.name = opportunity.Name;
+ res.bidPlannedDate = opportunity.Bid_Planned_Date__c;
+ res.salesAssistantName = opportunity.Sales_assistant_name__c;
+ res.salesAssistantID = opportunity.Sales_assistant_ID__c;
+ String profileId18 = UserInfo.getProfileId();
+ res.profileId = profileId18.substring(0, profileId18.length() - 3);
+ } catch (Exception e) {
+ System.debug('e:****' + e);
+ }
+ return res;
+ }
+ @AuraEnabled
+ public static InitData initForCancelReportButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Opportunity opportunity = [
+ select
+ StageName,
+ SAP_Send_OK__c,
+ Cnt_Lost_cancel_report__c,
+ Cnt_Lost_cancel_Draft__c,
+ Job_category__c,
+ Bidding_Project_Name_Bid__c,
+ Name,
+ Sales_assistant_name__c,
+ Sales_assistant_ID__c,
+ Manager_name__c,
+ Sales_manager_departmentID__c,
+ Sales_owner_buchang__c,
+ Sales_owner_buchangID__c
+ from Opportunity where Id =: recordId
+ ];
+ res.stageName = opportunity.StageName;
+ res.sapSendOK = opportunity.SAP_Send_OK__c;
+ res.cntLostCancelReport = opportunity.Cnt_Lost_cancel_report__c;
+ res.cntLostCancelDraft = opportunity.Cnt_Lost_cancel_Draft__c;
+ res.jobCategory = opportunity.Job_category__c;
+ res.biddingProjectNameBid = opportunity.Bidding_Project_Name_Bid__c;
+ res.name = opportunity.Name;
+ res.salesAssistantName = opportunity.Sales_assistant_name__c;
+ res.salesAssistantID = opportunity.Sales_assistant_ID__c;
+ res.managerName = opportunity.Manager_name__c;
+ res.salesManagerDepartmentID = opportunity.Sales_manager_departmentID__c;
+ res.salesOwnerBuchang = opportunity.Sales_owner_buchang__c;
+ res.salesOwnerBuchangID = opportunity.Sales_owner_buchangID__c;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ return res;
+ }
+ @AuraEnabled
+ public static InitData initForLostReportButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Opportunity opportunity = [
+ select
+ StageName,
+ SAP_Send_OK__c,
+ Cnt_Lost_cancel_report__c,
+ Name,
+ Sales_assistant_name__c,
+ Sales_assistant_ID__c,
+ Manager_name__c,
+ Sales_manager_departmentID__c,
+ Sales_owner_buchang__c,
+ Sales_owner_buchangID__c
+ from Opportunity where Id =: recordId
+ ];
+ res.stageName = opportunity.StageName;
+ res.sapSendOK = opportunity.SAP_Send_OK__c;
+ res.cntLostCancelReport = opportunity.Cnt_Lost_cancel_report__c;
+ res.name = opportunity.Name;
+ res.salesAssistantName = opportunity.Sales_assistant_name__c;
+ res.salesAssistantID = opportunity.Sales_assistant_ID__c;
+ res.managerName = opportunity.Manager_name__c;
+ res.salesManagerDepartmentID = opportunity.Sales_manager_departmentID__c;
+ res.salesOwnerBuchang = opportunity.Sales_owner_buchang__c;
+ res.salesOwnerBuchangID = opportunity.Sales_owner_buchangID__c;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ return res;
+ }
+ @AuraEnabled
+ public static InitData initForQuotationRequestButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Opportunity opportunity = [
+ select
+ Bidding_Project_Name_Bid__r.Id,
+ Estimation_Id__c
+ from Opportunity where Id =: recordId
+ ];
+ res.biddingProjectNameBidId = opportunity.Bidding_Project_Name_Bid__r.Id;
+ res.estimationId = opportunity.Estimation_Id__c;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ return res;
+ }
+ @AuraEnabled
+ public static InitData initForStockApplyButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Opportunity opportunity = [
+ select
+ Stock_apply_status__c,
+ Last_opportunity_file__r.Id
+ from Opportunity where Id =: recordId
+ ];
+ res.stockApplyStatus = opportunity.Stock_apply_status__c;
+ res.lastOpportunityFileId = opportunity.Last_opportunity_file__r.Id;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ return res;
+ }
+ @AuraEnabled
+ public static InitData initForQuotationProductNewButton(String recordId){
+ InitData res = new InitData();
+ try {
+ Opportunity opportunity = [
+ select
+ CurrencyIsoCode
+ from Opportunity where Id =: recordId
+ ];
+ res.currencyIsoCode = opportunity.CurrencyIsoCode;
+ } catch (Exception e) {
+ throw new AuraHandledException(e.getMessage());
+ }
+ return res;
+ }
+ @AuraEnabled
+ public static string updateForAgencyAuthorizeButton(String recordId){
+ try {
+ Opportunity opp = new Opportunity();
+ opp.Id = recordId;
+ opp.If_Authorizing__c = true;
+ opp.if_Interface_Lock__c = true;
+ opp.IF_Submit__c = true;
+ update opp;
+ return null;
+ } catch (Exception e) {
+ String eMessage = e.getMessage();
+ Integer left = eMessage.indexOf(',') + 1;
+ Integer right = eMessage.length();
+ return eMessage.substring(left,right);
+ }
+ }
+ @AuraEnabled
+ public static string updateForLoseBidButton(String recordId){
+ try {
+ Opportunity opp = new Opportunity();
+ opp.Id = recordId;
+ opp.ConfirmationofAward__c = LightingButtonConstant.OPPORTUNITY_CONFIRMATION_OF_AWARD_LOSE_BID;
+ update opp;
+ return null;
+ } catch (Exception e) {
+ String eMessage = e.getMessage();
+ Integer left = eMessage.indexOf(',') + 1;
+ Integer right = eMessage.length();
+ return eMessage.substring(left,right);
+ }
+ }
+ @AuraEnabled
+ public static string updateForOLYwinBidButton(String recordId){
+ try {
+ Opportunity opp = [select ConfirmationofAward__c,Closing_Bid_Date__c from Opportunity where Id =: recordId];
+ opp.ConfirmationofAward__c = LightingButtonConstant.OPPORTUNITY_CONFIRMATION_OF_AWARD_OLY_WIN_BID;
+ if (opp.Closing_Bid_Date__c == null) {
+ opp.Closing_Bid_Date__c = Date.today();
+ }
+ update opp;
+ return null;
+ } catch (Exception e) {
+ String eMessage = e.getMessage();
+ Integer left = eMessage.indexOf(',') + 1;
+ Integer right = eMessage.length();
+ return eMessage.substring(left,right);
+ }
+ }
+ @AuraEnabled
+ public static string updateForStockApplyButton(String recordId,Boolean flag){
+ try {
+ Opportunity opp = new Opportunity();
+ opp.Id = recordId;
+ if(flag){
+ opp.Stock_apply_status__c = '濉啓瀹屾瘯';
+ }else {
+ opp.Stock_apply_status__c = '鑽夋涓�';
+ }
+ update opp;
+ return null;
+ } catch (Exception e) {
+ String eMessage = e.getMessage();
+ Integer left = eMessage.indexOf(',') + 1;
+ Integer right = eMessage.length();
+ return eMessage.substring(left,right);
+ }
+ }
+ @AuraEnabled
+ public static List<InquiryPredictsDateChange__c> queryForPredictedDateChangeButton(String recordId){
+ List<InquiryPredictsDateChange__c> rac = null;
+ try {
+ rac = [
+ select
+ id
+ from InquiryPredictsDateChange__c where Predicted_Date_Status__c = :LightingButtonConstant.PREDICTED_DATE_STATUS and Opportunity__c =:recordId];
+ } catch (Exception e) {
+ System.debug('e:****' + e);
+ }
+ return rac;
+ }
+ @AuraEnabled
+ public static List<task__c> queryForLoseBidButton(String recordId){
+ List<task__c> tasks = null;
+ try {
+ String obscureName = '%' + LightingButtonConstant.TASK_NAME_BY_CONFIRMATION_OF_WINNING_BID + '%';
+ tasks = [
+ select
+ taskStatus__c
+ from task__c where OpportunityId__c =: recordId and name like :obscureName];
+ } catch (Exception e) {
+ System.debug('e:****' + e);
+ }
+ return tasks;
+ }
+ @AuraEnabled
+ public static List<task__c> queryForOLYwinBidButton(String recordId){
+ List<task__c> tasks = null;
+ try {
+ String obscureName = '%' + LightingButtonConstant.TASK_NAME_BY_CONFIRMATION_OF_WINNING_BID + '%';
+ tasks = [
+ select
+ taskStatus__c
+ from task__c where OpportunityId__c =: recordId and name like :obscureName];
+ } catch (Exception e) {
+ System.debug('e:****' + e);
+ }
+ return tasks;
+ }
+ @AuraEnabled
+ public static List<Tender_Opportunity_Link__c> queryForCancelReportButton(String recordId){
+ List<Tender_Opportunity_Link__c> links = null;
+ try {
+ links = [
+ select id,
+ Tender_information__r.subInfoType__c
+ from Tender_Opportunity_Link__c
+ where (Tender_information__r.subInfoType__c = '3-1锛氬簾鏍囧叕鍛�' OR Tender_information__r.subInfoType__c ='3-2锛氭祦鏍囧叕鍛�') and Opportunity__c =: recordId
+ ];
+ } catch (Exception e) {
+ System.debug('e:****' + e);
+ }
+ return links;
+ }
+ @AuraEnabled
+ public static List<QuoteIrai__c > queryForQuotationRequestButton(String recordId){
+ List<QuoteIrai__c> quotes = null;
+ try {
+ String opportunityId = '%' + recordId + '%';
+ quotes = [
+ select
+ id
+ from QuoteIrai__c where Note__c like :opportunityId and QuoteIrai_Status__c = '鑽夋涓�'
+ ];
+ } catch (Exception e) {
+ System.debug('e:****' + e);
+ }
+ return quotes;
+ }
+ public class InitData{
+ @AuraEnabled
+ public Boolean directLossFLG;
+ @AuraEnabled
+ public Date createdDay;
+ @AuraEnabled
+ public String agency1Id;
+ @AuraEnabled
+ public String agency1;
+ @AuraEnabled
+ public String stageName;
+ @AuraEnabled
+ public Boolean sapSendOK;
+ @AuraEnabled
+ public String oppOrderType;
+ @AuraEnabled
+ public Boolean ifHave170;
+ @AuraEnabled
+ public Boolean ifHaveAH;
+ @AuraEnabled
+ public Decimal cntLostCancelDraft;
+ @AuraEnabled
+ public Decimal cntLostCancelReport;
+ @AuraEnabled
+ public String estimationId;
+ @AuraEnabled
+ public Decimal detailNum;
+ @AuraEnabled
+ public Boolean estimationDecision;
+ @AuraEnabled
+ public String salesRoot;
+ @AuraEnabled
+ public Boolean acecideCntCheck;
+ @AuraEnabled
+ public Boolean ifSubmit;
+ @AuraEnabled
+ public String trade;
+ @AuraEnabled
+ public Boolean isCorrosion;
+ @AuraEnabled
+ public Boolean ifAuthorizingLock;
+ @AuraEnabled
+ public String profileId;
+ @AuraEnabled
+ public String ifOpenBid;
+ @AuraEnabled
+ public String accountId;
+ @AuraEnabled
+ public String userId;
+ @AuraEnabled
+ public String name;
+ @AuraEnabled
+ public Date bidPlannedDate;
+ @AuraEnabled
+ public String salesAssistantName;
+ @AuraEnabled
+ public String salesAssistantID;
+ @AuraEnabled
+ public String jobCategory;
+ @AuraEnabled
+ public String biddingProjectNameBid;
+ @AuraEnabled
+ public String managerName;
+ @AuraEnabled
+ public String salesManagerDepartmentID;
+ @AuraEnabled
+ public String salesOwnerBuchang;
+ @AuraEnabled
+ public String salesOwnerBuchangID;
+ @AuraEnabled
+ public String biddingProjectNameBidId;
+ @AuraEnabled
+ public String stockApplyStatus;
+ @AuraEnabled
+ public String lastOpportunityFileId;
+ @AuraEnabled
+ public String currencyIsoCode;
+ }
+}
\ No newline at end of file
--
Gitblit v1.9.1