| | |
| | | * @Author: chen jing wu |
| | | * @Date: 2023-04-12 11:16:07 |
| | | * @LastEditors: chen jing wu |
| | | * @LastEditTime: 2023-04-23 14:55:57 |
| | | * @LastEditTime: 2023-05-15 13:40:51 |
| | | */ |
| | | public with sharing class OpportunityLightingButtonController { |
| | | @AuraEnabled |
| | |
| | | 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); |
| | | res.profileId = UserInfo.getProfileId(); |
| | | res.systemProfileId = getProfileIdByName(lexLightingButtonConstant.SYSTEM_PROFILE_NAME); |
| | | res.j3ProfileId = getProfileIdByName(lexLightingButtonConstant.J3_PROFILE_NAME); |
| | | res.s61ProfileId = getProfileIdByName(lexLightingButtonConstant.S61_PROFILE_NAME); |
| | | res.s62ProfileId = getProfileIdByName(lexLightingButtonConstant.S62_PROFILE_NAME); |
| | | res.m4ProfileId = getProfileIdByName(lexLightingButtonConstant.M4_PROFILE_NAME); |
| | | } catch (Exception e) { |
| | | System.debug('e:****' + e); |
| | | } |
| | |
| | | return res; |
| | | } |
| | | @AuraEnabled |
| | | public static InitData initFoBeforeOPDPDFBtnButton(String recordId){ |
| | | public static InitData initForBeforeOPDPDFBtnButton(String recordId){ |
| | | InitData res = new InitData(); |
| | | try { |
| | | Opportunity opportunity = [ |
| | |
| | | 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); |
| | | res.profileId = UserInfo.getProfileId(); |
| | | res.systemProfileId = getProfileIdByName(lexLightingButtonConstant.SYSTEM_PROFILE_NAME); |
| | | res.s1ProfileId = getProfileIdByName(lexLightingButtonConstant.S1_PROFILE_NAME); |
| | | res.s4ProfileId = getProfileIdByName(lexLightingButtonConstant.S4_PROFILE_NAME); |
| | | } catch (Exception e) { |
| | | System.debug('e:****' + e); |
| | | } |
| | |
| | | return res; |
| | | } |
| | | @AuraEnabled |
| | | public static InitData initForCreateActivityButton(String recordId){ |
| | | InitData res = new InitData(); |
| | | try { |
| | | Opportunity opp = [ |
| | | select |
| | | AccountId |
| | | from Opportunity where Id =: recordId |
| | | ]; |
| | | res.accountId = opp.AccountId; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | } |
| | | return res; |
| | | } |
| | | @AuraEnabled |
| | | public static InitData initForAssignTaskButtonButton(String recordId){ |
| | | InitData res = new InitData(); |
| | | try { |
| | | Opportunity opp = [ |
| | | select |
| | | AccountId, |
| | | Name |
| | | from Opportunity where Id =: recordId |
| | | ]; |
| | | Account acc = [ |
| | | select |
| | | Name |
| | | from Account where Id =:opp.AccountId |
| | | ]; |
| | | res.accountId = opp.AccountId; |
| | | res.accountName = acc.Name; |
| | | res.name = opp.Name; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | } |
| | | return res; |
| | | } |
| | | @AuraEnabled |
| | | public static InitData initForChangeContractTypeButton(String recordId){ |
| | | InitData res = new InitData(); |
| | | try { |
| | | Opportunity opp = [ |
| | | select |
| | | StageName, |
| | | Estimation_Decision__c, |
| | | SAP_Send_OK__c, |
| | | If_Authorizing_Lock__c |
| | | from Opportunity where Id =: recordId |
| | | ]; |
| | | res.stageName = opp.StageName; |
| | | 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 string updateForAgencyAuthorizeButton(String recordId){ |
| | | try { |
| | | Opportunity opp = new Opportunity(); |
| | |
| | | Opportunity opp = new Opportunity(); |
| | | opp.Id = recordId; |
| | | if(flag){ |
| | | opp.Stock_apply_status__c = '填写完毕'; |
| | | opp.Stock_apply_status__c = lexLightingButtonConstant.STOCK_APPLY_STATUS_WRITE_OVER; |
| | | }else { |
| | | opp.Stock_apply_status__c = '草案中'; |
| | | opp.Stock_apply_status__c = lexLightingButtonConstant.STOCK_APPLY_STATUS_DRAFT; |
| | | } |
| | | update opp; |
| | | return null; |
| | |
| | | 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 |
| | | 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 |
| | | ]; |
| | | } catch (Exception e) { |
| | | System.debug('e:****' + e); |
| | |
| | | quotes = [ |
| | | select |
| | | id |
| | | from QuoteIrai__c where Note__c like :opportunityId and QuoteIrai_Status__c = '草案中' |
| | | from QuoteIrai__c where Note__c like :opportunityId and QuoteIrai_Status__c =:lexLightingButtonConstant.QUOTEIRAI_STATUS_DRAFT |
| | | ]; |
| | | } catch (Exception e) { |
| | | System.debug('e:****' + e); |
| | |
| | | Integer left = eMessage.indexOf(',') + 1; |
| | | Integer right = eMessage.length(); |
| | | return eMessage.substring(left,right); |
| | | } |
| | | } |
| | | @AuraEnabled |
| | | public static string getUserIdByName(String userName){ |
| | | User user = null; |
| | | try { |
| | | user = [ |
| | | select |
| | | Id |
| | | from User where Name =: userName |
| | | ]; |
| | | return user.Id; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | } |
| | | } |
| | | @AuraEnabled |
| | | public static string getProfileIdByName(String profileName){ |
| | | Profile pro = null; |
| | | try { |
| | | pro = [ |
| | | select |
| | | Id |
| | | from Profile where Name =: profileName |
| | | ]; |
| | | return pro.Id; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | } |
| | | } |
| | | public class InitData{ |
| | |
| | | public String siDecideID; |
| | | @AuraEnabled |
| | | public String opportunityNo; |
| | | @AuraEnabled |
| | | public String systemProfileId; |
| | | @AuraEnabled |
| | | public String j3ProfileId; |
| | | @AuraEnabled |
| | | public String s62ProfileId; |
| | | @AuraEnabled |
| | | public String s61ProfileId; |
| | | @AuraEnabled |
| | | public String m4ProfileId; |
| | | @AuraEnabled |
| | | public String s4ProfileId; |
| | | @AuraEnabled |
| | | public String s1ProfileId; |
| | | @AuraEnabled |
| | | public String accountName; |
| | | } |
| | | } |