From ec8e766ee9585cdae5036bba29d82a080de6fd55 Mon Sep 17 00:00:00 2001 From: 游畅 <youchang@prec-tech.com> Date: 星期四, 24 十一月 2022 17:54:37 +0800 Subject: [PATCH] 20221124询价状态2更新 --- force-app/main/default/classes/TenderInformationHandler.cls | 2 force-app/main/default/classes/OpportunityService.cls | 71 +++++++++ force-app/main/default/classes/TenderOpportunityLinkHandler.cls | 328 +++++++++++++++++++++++++++++++++++++++++++++- force-app/main/default/triggers/OpportunityHpDeptUpd.trigger | 13 + 4 files changed, 401 insertions(+), 13 deletions(-) diff --git a/force-app/main/default/classes/OpportunityService.cls b/force-app/main/default/classes/OpportunityService.cls index 78c29d5..f8044db 100644 --- a/force-app/main/default/classes/OpportunityService.cls +++ b/force-app/main/default/classes/OpportunityService.cls @@ -53,6 +53,14 @@ if(IdStr != null && String.isNotBlank(IdStr)) { sql += ' and id not in (select Opportunity__c from Tender_Opportunity_Link__c where Tender_information__c = :IdStr) '; } + // 20221014 ljh SWAG-CK28WT add start + String proId = UserInfo.getProfileId(); + String p_2M4 = System.Label.ProfileId_2M4; + if(proId.substring(0,15) == p_2M4.substring(0,15)){ + sql += ' AND OwnerId =\''+UserInfo.getUserId()+'\''; + } + System.debug('sql:'+sql); + // 20221014 ljh SWAG-CK28WT add end sql += ' limit 50'; List<Opportunity> arrays = Database.query(sql); return JSON.serialize(arrays); @@ -103,6 +111,14 @@ { sql += ' and Hospital__c in :hospital'; } + // 20221014 ljh SWAG-CK28WT add start + String proId = UserInfo.getProfileId(); + String p_2M4 = System.Label.ProfileId_2M4; + if(proId.substring(0,15) == p_2M4.substring(0,15)){ + sql += ' AND OwnerId =\''+UserInfo.getUserId()+'\''; + } + System.debug('sql:'+sql); + // 20221014 ljh SWAG-CK28WT add end sql += ' limit 50'; List<Opportunity> arrays = Database.query(sql); @@ -217,8 +233,11 @@ sql += 'Hospital1__c, '; sql += 'Hospital2__c, '; sql += 'Hospital3__c, '; - sql += 'Hospital4__c '; - sql += 'FROM Tender_information__c WHERE Id = :BiddingId'; + sql += 'Hospital4__c, '; + sql += 'publicDate__c, ';// 20221114 ljh SWAG-CKL5UC + sql += 'Tender_Order__c, '; //20220620 you SWAG-CFD4SU + sql += 'subInfoType__c '; //20220718 you 鎷涙爣浠诲姟 + sql += 'FROM Tender_information__c WHERE Id = :BiddingId order by Tender_Order__c desc,relativeTime_F__c desc'; //20220620 you SWAG-CFD4SU 澧炲姞 order by List<Tender_information__c> arrays = Database.query(sql); Tender_information__c tender = arrays[0]; @@ -270,6 +289,7 @@ // } // 鏇存柊璇环 List<Opportunity> upd_opps = new List<Opportunity>(); + List<Opportunity> upd_opps1 = new List<Opportunity>(); List<String> owners = new List<String>(); // 鎻掑叆link if (all_selected_list.size() > 0) { @@ -297,11 +317,15 @@ } // 鎭㈠trigger鏍囪 StaticParameter.EscapeTOLinkTrigger = false; - + //20220620 you SWAG-CFD4SU 鏀归�� start 濮嬬粓鏄剧ず鏈�鏂扮殑 鈶� 3锛氱粨鏋�,鈶� 4锛氬彉鏇�,鈶� 2锛氬叕鍛�,鈶� 1锛氶鍛�,鈶� 5锛氬叾浠� + List<String> tenIds = new List<String>();//20220718 you 鎷涙爣浠诲姟 + system.debug('opportunityservicetest'+oppIds); if (oppIds.size() > 0) { - List<Opportunity> wait_upd_opps = [select id, Bidding_Project_Name_Bid__c, Bidding_Project_Name_Bid__r.InfoType__c from Opportunity where id in :oppIds and Bidding_Project_Name_Bid__r.InfoType__c != '3锛氱粨鏋�']; + // 20221114 SWAG-CKL5UC ljh 澧炲姞 Created_Day__c,LeadSource,LeakageNumber__c + List<Opportunity> wait_upd_opps = [select id,Opp_Order__c,Tender_Number__c, Bidding_Project_Name_Bid__c, Bidding_Project_Name_Bid__r.InfoType__c,Created_Day__c,LeadSource,LeakageNumber__c from Opportunity where id in :oppIds ];//and Bidding_Project_Name_Bid__r.InfoType__c != '3锛氱粨鏋�']; if (wait_upd_opps != null && wait_upd_opps.size() > 0) { for (Opportunity opp : wait_upd_opps) { + /** if (opp.Bidding_Project_Name_Bid__c == null || String.isBlank(opp.Bidding_Project_Name_Bid__c)) { opp.Bidding_Project_Name_Bid__c = tender.Id; opp.TenderBeginDate_Text__c = tender.TenderBeginTime__c; @@ -310,13 +334,52 @@ opp.Bidding_Project_Name_Bid__c = tender.Id; upd_opps.add(opp); } + **/ + if(opp.Opp_Order__c <= tender.Tender_Order__c){ + opp.Bidding_Project_Name_Bid__c =tender.Id; + //opp.TenderBeginDate_Text__c = tender.TenderDate__c;//鏇存敼璇环2鏃朵慨鏀硅繖涓瓧娈碉紝寮曠敤瓒�20锛宼ender.TenderBeginTime__c; + upd_opps.add(opp); + //20220715 you 鎷涙爣椤圭洰 start + if(String.isNotBlank(tender.InfoType__c) && tender.InfoType__c=='3锛氱粨鏋�' && String.isNotBlank(tender.subInfoType__c) && (tender.subInfoType__c=='3-5锛氫腑鏍囬�氱煡' || tender.subInfoType__c=='3-6锛氬悎鍚屽叕鍛�')){ + tenIds.add(opp.id); //绗﹀悎鏉′欢鐢熸垚浠诲姟 + } + //20220715 you 鎷涙爣椤圭洰 end + break; + } + } + //20220829 you SWAG-CHL67J start + for (Opportunity opp : wait_upd_opps) { + Integer returncount =0; + if(String.isNotBlank(tender.InfoType__c) && tender.InfoType__c!='1锛氶鍛�' && String.isNotBlank(tender.subInfoType__c) && tender.subInfoType__c!='3-1锛氬簾鏍囧叕鍛�' && tender.subInfoType__c!='3-2锛氭祦鏍囧叕鍛�'){ + returncount += 1; + } + opp.Tender_Number__c = returncount; + // 20221114 ljh SWAG-CKL5UC start + if(opp.LeakageNumber__c != 1 && tender.publicDate__c != null && String.isNotBlank(opp.LeadSource) && opp.LeadSource == '鎷涙爣缃�' && opp.Created_Day__c > tender.publicDate__c){ + opp.LeakageNumber__c = 1; + } + // 20221114 ljh SWAG-CKL5UC start + upd_opps1.add(opp); + } + + //20220829 you SWAG-CHL67J end } } + if (upd_opps1.size() > 0) { + update upd_opps1; + } + //20220620 you SWAG-CFD4SU 鏀归�� end // 鏇存柊璇环涓婄殑鎷涙爣椤圭洰 if (upd_opps.size() > 0) { update upd_opps; } + //20220718 you 鎷涙爣浠诲姟 start + + if (tenIds !=null && tenIds.size() > 0) { + Database.executeBatch(new TenderResultConfirmTaskBatch(tenIds)); + } + //20220718 you 鎷涙爣浠诲姟 end } // 鏌ヨ鎷涙爣鏁伴噺骞舵洿鏂� diff --git a/force-app/main/default/classes/TenderInformationHandler.cls b/force-app/main/default/classes/TenderInformationHandler.cls index 8ed2f99..7248ca1 100644 --- a/force-app/main/default/classes/TenderInformationHandler.cls +++ b/force-app/main/default/classes/TenderInformationHandler.cls @@ -103,7 +103,7 @@ } } if (null!=oppTens && oppTens.size()>0) { - List<Opportunity> opportunities = [select id, Bidding_Project_Name_Bid__c, TenderBeginDate_Text__c,Opp_Order__c from Opportunity where id in :oppIds]; + List<Opportunity> opportunities = [select id, Bidding_Project_Name_Bid__c, Opp_Order__c from Opportunity where id in :oppIds]; List<task__c> taskList = [select id,taskStatus__c,Tender_information_Task__c,OpportunityId__c from task__c where (RecordType.Name ='澶卞崟鎶ュ憡浠诲姟' and OpportunityId__c in:oppIds) or (RecordType.Name ='涓爣缁撴灉纭' and Opp_Tender__c in :oppTens)]; for(task__c tsk : taskList){ tsk.taskStatus__c = '04 鍙栨秷'; diff --git a/force-app/main/default/classes/TenderOpportunityLinkHandler.cls b/force-app/main/default/classes/TenderOpportunityLinkHandler.cls index eabe83f..c52d66e 100644 --- a/force-app/main/default/classes/TenderOpportunityLinkHandler.cls +++ b/force-app/main/default/classes/TenderOpportunityLinkHandler.cls @@ -26,6 +26,12 @@ updateOppotunityByDelete(this.oldList); } } +protected override void beforeDelete() { + // 鍒ゆ柇鏄惁璺宠繃 + if (!StaticParameter.EscapeTOLinkTrigger) { + updateOppotunityBeforeDelete(this.oldList); + } +} protected override void beforeInsert() { if (this.newList != null && this.newList.size() > 0) { @@ -195,27 +201,49 @@ } // 鏇存柊璇环淇℃伅 -public void updateOppotunityByInsert(List<Tender_Opportunity_Link__c> records) { +public void updateOppotunityByInsert(List<Tender_Opportunity_Link__c> records) { if (records != null && records.size() > 0) { List<String> oppIds = new List<String>(); + Set<Id> oppIdsSet = new Set<Id>();// 20221028 ljh SWAG-CKL5UC + //SWAG-CHL67J 銆愬鎵樸�戙�怓Y23璇环鏀瑰杽銆�-璇环椤甸潰/鎷涙爣椤圭洰澧炲姞缁熻瀛楁 fy start + // List<String> TenderIds = new List<String>(); + //SWAG-CHL67J 銆愬鎵樸�戙�怓Y23璇环鏀瑰杽銆�-璇环椤甸潰/鎷涙爣椤圭洰澧炲姞缁熻瀛楁 fy end // 鑾峰緱瑕佹洿鏂扮殑璇环 for (Tender_Opportunity_Link__c record: records) { if (!oppIds.contains(record.Opportunity__c)) { oppIds.add(record.Opportunity__c); + // 20221028 ljh SWAG-CKL5UC add start + system.debug('zheli00:'+record.IsLeakage__c); + if(record.IsLeakage__c){ + oppIdsSet.add(record.Opportunity__c); + } + // 20221028 ljh SWAG-CKL5UC add end } + //SWAG-CHL67J 銆愬鎵樸�戙�怓Y23璇环鏀瑰杽銆�-璇环椤甸潰/鎷涙爣椤圭洰澧炲姞缁熻瀛楁 fy start + // if (!TenderIds.contains(record.Tender_information__c)) { + // TenderIds.add(record.Tender_information__c); + // } + //SWAG-CHL67J 銆愬鎵樸�戙�怓Y23璇环鏀瑰杽銆�-璇环椤甸潰/鎷涙爣椤圭洰澧炲姞缁熻瀛楁 fy end + } if (oppIds.size() > 0) { - List<Opportunity> opportunities = [select id, Bidding_Project_Name_Bid__c, Bidding_Project_Name_Bid__r.InfoType__c, TenderBeginDate_Text__c, InfoTypeBid_text__c from Opportunity where id in :oppIds and Bidding_Project_Name_Bid__r.InfoType__c != '3锛氱粨鏋�']; + List<String> tenIds = new List<String>();//20220715 you 鎷涙爣椤圭洰鎻掑叆鏃讹紝鏄惁闇�瑕佸彂閫佽浠蜂换鍔� 鏂扮殑鎷涙爣椤圭洰 + //20220615 you SWAG-CFD4SU 鏀归�� start 濮嬬粓鏄剧ず鏈�鏂扮殑 鈶� 3锛氱粨鏋�,鈶� 4锛氬彉鏇�,鈶� 2锛氬叕鍛�,鈶� 1锛氶鍛�,鈶� 5锛氬叾浠� + // 20221028 ljh SWAG-CKL5UC 鏌ヨ澧炲姞 LeakageNumber__c , TenderBeginDate_Text__c + List<Opportunity> opportunities = [select id,Tender_Number__c, Bidding_Project_Name_Bid__c, Bidding_Project_Name_Bid__r.InfoType__c, InfoTypeBid_text__c,Opp_Order__c,LeakageNumber__c from Opportunity where id in :oppIds ];//and Bidding_Project_Name_Bid__r.InfoType__c != '3锛氱粨鏋�']; if (opportunities.size() > 0) { - List<Tender_Opportunity_Link__c> links = [select id, Opportunity__c, Tender_information__c, Tender_information__r.InfoType__c, Tender_information__r.TenderBeginTime__c from Tender_Opportunity_Link__c where Opportunity__c in :oppIds]; + List<Tender_Opportunity_Link__c> links = [select id, Opportunity__c, Tender_information__c, Tender_information__r.InfoType__c, Tender_information__r.TenderBeginTime__c,Tender_information__r.TenderDate__c,Tender_information__r.Tender_Order__c,Tender_information__r.subInfoType__c from Tender_Opportunity_Link__c where Opportunity__c in :oppIds order by Opportunity__c,Tender_information__r.Tender_Order__c desc, Tender_information__r.relativeTime_F__c desc]; for (Opportunity opp : opportunities) { for (Tender_Opportunity_Link__c link : links) { + boolean defaultFlag = false; if (opp.Id.equals(link.Opportunity__c)) { - if (opp.Bidding_Project_Name_Bid__c == null || ''.equals(opp.Bidding_Project_Name_Bid__c)) { + /** + if (opp.Bidding_Project_Name_Bid__c == null || ''.equals(opp.Bidding_Project_Name_Bid__c)) { opp.Bidding_Project_Name_Bid__c = link.Tender_information__c; opp.TenderBeginDate_Text__c = link.Tender_information__r.TenderBeginTime__c; opp.InfoTypeBid_text__c = link.Tender_information__r.InfoType__c; } + if ('3锛氱粨鏋�'.equals(link.Tender_information__r.InfoType__c)) { opp.Bidding_Project_Name_Bid__c = link.Tender_information__c; if (opp.TenderBeginDate_Text__c == null) { @@ -226,32 +254,165 @@ } break; } + **/ + if(opp.Opp_Order__c <= link.Tender_information__r.Tender_Order__c){ + opp.Bidding_Project_Name_Bid__c = link.Tender_information__c; + //opp.TenderBeginDate_Text__c = link.Tender_information__r.TenderDate__c;//鏇存敼璇环鐘舵��2鏃讹紝寮曠敤瓒�20锛宭ink.Tender_information__r.TenderBeginTime__c; + opp.InfoTypeBid_text__c = link.Tender_information__r.InfoType__c; + //20220715 you 鎷涙爣椤圭洰 start + if(String.isNotBlank(link.Tender_information__r.InfoType__c) && link.Tender_information__r.InfoType__c=='3锛氱粨鏋�' && String.isNotBlank(link.Tender_information__r.subInfoType__c) && (link.Tender_information__r.subInfoType__c=='3-5锛氫腑鏍囬�氱煡' || link.Tender_information__r.subInfoType__c=='3-6锛氬悎鍚屽叕鍛�')){ + tenIds.add(link.Opportunity__c); //绗﹀悎鏉′欢鐢熸垚浠诲姟 + } + //20220715 you 鎷涙爣椤圭洰 end + break; + } + } } - + //20220829 you SWAG-CHL67J start + Integer returncount =0; + for (Tender_Opportunity_Link__c link : links) { + if (opp.Id.equals(link.Opportunity__c)) { + if(String.isNotBlank(link.Tender_information__r.InfoType__c) && link.Tender_information__r.InfoType__c!='1锛氶鍛�' && String.isNotBlank(link.Tender_information__r.subInfoType__c) && link.Tender_information__r.subInfoType__c!='3-1锛氬簾鏍囧叕鍛�' && link.Tender_information__r.subInfoType__c!='3-2锛氭祦鏍囧叕鍛�'){ + system.debug('test1杩涙潵浜�'); + returncount += 1; + } + } + } + opp.Tender_Number__c =returncount; + //20220829 you SWAG-CHL67J end + // 20221028 ljh SWAG-CKL5UC add start + if(oppIdsSet.contains(opp.Id) && opp.LeakageNumber__c != 1){ + opp.LeakageNumber__c = 1; + } + // 20221028 ljh SWAG-CKL5UC add end } update opportunities; } + //20220615 you SWAG-CFD4SU 鏀归�� end + //20220715 you 鎷涙爣浠诲姟 start + + if (tenIds !=null && tenIds.size() > 0) { + Database.executeBatch(new TenderResultConfirmTaskBatch(tenIds)); + } + //20220715 you 鎷涙爣浠诲姟 end } + //SWAG-CHL67J 銆愬鎵樸�戙�怓Y23璇环鏀瑰杽銆�-璇环椤甸潰/鎷涙爣椤圭洰澧炲姞缁熻瀛楁 fy start + // if (TenderIds.size() > 0) { + // updateTender(TenderIds); + // } + //SWAG-CHL67J 銆愬鎵樸�戙�怓Y23璇环鏀瑰杽銆�-璇环椤甸潰/鎷涙爣椤圭洰澧炲姞缁熻瀛楁 fy end } } +//SWAG-CHL67J 銆愬鎵樸�戙�怓Y23璇环鏀瑰杽銆�-璇环椤甸潰/鎷涙爣椤圭洰澧炲姞缁熻瀛楁 fy start +//璺熸柊鎷涙爣椤圭洰鐨勪腑鏍囨暟鍜屽簲鏍囨暟 +// public void updateTender(List<String> TenderIds) { +// List<Tender_Opportunity_Link__c> TenderOpportunityLinkList2 = [select Tender_information__c,Opportunity__r.NumberOfBids__c,Opportunity__r.BidWinningNumber__c from Tender_Opportunity_Link__c where Tender_information__c in:TenderIds]; +// Map<String,Tender_information__c> TenderinformationMap = new Map<String,Tender_information__c>(); +// if(TenderOpportunityLinkList2.size()>0){ +// for(Tender_Opportunity_Link__c TenderOpportunity2 :TenderOpportunityLinkList2){ +// if(TenderinformationMap.containsKey(TenderOpportunity2.Tender_information__c)){ +// Tender_information__c Tender_informationvalue = new Tender_information__c(); +// Tender_informationvalue = TenderinformationMap.get(TenderOpportunity2.Tender_information__c); +// Tender_informationvalue.NumberOfBids__c=Tender_informationvalue.NumberOfBids__c+TenderOpportunity2.Opportunity__r.NumberOfBids__c; +// Tender_informationvalue.BidWinningNumber__c=Tender_informationvalue.BidWinningNumber__c+TenderOpportunity2.Opportunity__r.BidWinningNumber__c; +// TenderinformationMap.put(TenderOpportunity2.Tender_information__c, Tender_informationvalue); +// }else{ +// Tender_information__c Tender_informationvalue = new Tender_information__c(); +// Tender_informationvalue.Id=TenderOpportunity2.Tender_information__c; +// Tender_informationvalue.NumberOfBids__c=TenderOpportunity2.Opportunity__r.NumberOfBids__c; +// Tender_informationvalue.BidWinningNumber__c=TenderOpportunity2.Opportunity__r.BidWinningNumber__c; +// TenderinformationMap.put(TenderOpportunity2.Tender_information__c, Tender_informationvalue); +// } +// } +// } +// if(TenderinformationMap.size()>0){ +// List<Tender_information__c> Tender_informationList = new List<Tender_information__c>(); +// for (Tender_information__c value : TenderinformationMap.values()) { +// Tender_informationList.add(value); +// } +// update Tender_informationList; +// } +// } +//SWAG-CHL67J 銆愬鎵樸�戙�怓Y23璇环鏀瑰杽銆�-璇环椤甸潰/鎷涙爣椤圭洰澧炲姞缁熻瀛楁 fy end +//20220718 you 璇环浠诲姟 start +//鍒犻櫎link鏃讹紝浠诲姟鍙栨秷锛屾竻绌鸿浠蜂腑鏍囦俊鎭� +public void updateOppotunityBeforeDelete(List<Tender_Opportunity_Link__c> records) { + if (records != null && records.size() > 0) { + Set<String> oppTens = new Set<String>();//璇环锛屾嫑鏍囬」鐩� 鎷兼帴 + List<String> oppIds = new List<String>(); + // 鑾峰緱瑕佹洿鏂扮殑璇环 + for (Tender_Opportunity_Link__c record: records) { + String oppid =String.valueOf(record.Opportunity__c); + String tenid =String.valueOf(record.Tender_information__c); + oppTens.add(oppid.subString(0,15)+tenid.subString(0,15)); + if (!oppIds.contains(record.Opportunity__c)) { + oppIds.add(record.Opportunity__c); + } + } + if (null!=oppTens && oppTens.size()>0) { + List<Opportunity> opportunities = [select id, Bidding_Project_Name_Bid__c,Opp_Order__c from Opportunity where id in :oppIds]; + List<task__c> taskList = [select id,taskStatus__c,Tender_information_Task__c,OpportunityId__c from task__c where (RecordType.Name ='澶卞崟鎶ュ憡浠诲姟' and OpportunityId__c in:oppIds) or (RecordType.Name ='涓爣缁撴灉纭' and Opp_Tender__c in :oppTens)]; + for(task__c tsk : taskList){ + tsk.taskStatus__c = '04 鍙栨秷'; + tsk.cancelDate__c = date.today(); + tsk.cancelReasonSelect__c = '鍙栨秷璇环鍏宠仈'; + } + update taskList; + if(taskList.size() > 0){ + for (task__c tlink : taskList) { + for (Opportunity opp : opportunities) { + if (opp.Id == tlink.OpportunityId__c) { + //20220718 you 璇环浠诲姟 start + opp.ConfirmationofAward__c = null; + opp.Task_createTime__c = null; + opp.ConfirmationofAward_createTime__c =null; + opp.LostTask_comfirmTime__c =null; + opp.Is_ConfirmationofAward__c =null; + opp.LostTask_createTime__c =null; + opp.Closing_Bid_Date__c = null; + //20220718 you 璇环浠诲姟 end + } + } + } + } + update opportunities; + } + + } +} +//20220718 you 璇环浠诲姟 end // 鏇存柊璇环淇℃伅 public void updateOppotunityByDelete(List<Tender_Opportunity_Link__c> records) { if (records != null && records.size() > 0) { List<String> oppIds = new List<String>(); + //SWAG-CHL67J 銆愬鎵樸�戙�怓Y23璇环鏀瑰杽銆�-璇环椤甸潰/鎷涙爣椤圭洰澧炲姞缁熻瀛楁 fy start + // List<String> TenderIds = new List<String>(); + //SWAG-CHL67J 銆愬鎵樸�戙�怓Y23璇环鏀瑰杽銆�-璇环椤甸潰/鎷涙爣椤圭洰澧炲姞缁熻瀛楁 fy end // 鑾峰緱瑕佹洿鏂扮殑璇环 for (Tender_Opportunity_Link__c record: records) { if (!oppIds.contains(record.Opportunity__c)) { oppIds.add(record.Opportunity__c); } + //SWAG-CHL67J 銆愬鎵樸�戙�怓Y23璇环鏀瑰杽銆�-璇环椤甸潰/鎷涙爣椤圭洰澧炲姞缁熻瀛楁 fy start + // if (!TenderIds.contains(record.Tender_information__c)) { + // TenderIds.add(record.Tender_information__c); + // } + //SWAG-CHL67J 銆愬鎵樸�戙�怓Y23璇环鏀瑰杽銆�-璇环椤甸潰/鎷涙爣椤圭洰澧炲姞缁熻瀛楁 fy end + } if (oppIds.size() > 0) { - List<Opportunity> opportunities = [select id, Bidding_Project_Name_Bid__c, TenderBeginDate_Text__c from Opportunity where id in :oppIds]; + List<String> tenIds = new List<String>();//20220715 you 鎷涙爣椤圭洰鎻掑叆鏃讹紝鏄惁闇�瑕佸彂閫佽浠蜂换鍔� 鏂扮殑鎷涙爣椤圭洰 + //20220615 you SWAG-CFD4SU 鏀归�� 澧炲姞鏌ヨ鏉′欢 + List<Opportunity> opportunities = [select id, Bidding_Project_Name_Bid__c,Tender_Number__c,Opp_Order__c from Opportunity where id in :oppIds]; + if (opportunities.size() > 0) { - List<Tender_Opportunity_Link__c> links = [select id, Opportunity__c, Tender_information__c, Tender_information__r.InfoType__c from Tender_Opportunity_Link__c where Opportunity__c in :oppIds]; + //20220615 you SWAG-CFD4SU 鏀归�� 澧炲姞鏌ヨ鏉′欢 + List<Tender_Opportunity_Link__c> links = [select id, Opportunity__c, Tender_information__c, Tender_information__r.InfoType__c,Tender_information__r.subInfoType__c,Tender_information__r.Tender_Order__c,Tender_information__r.TenderBeginTime__c,Tender_information__r.TenderDate__c from Tender_Opportunity_Link__c where Opportunity__c in :oppIds order by Opportunity__c,Tender_information__r.Tender_Order__c desc, Tender_information__r.relativeTime_F__c desc]; List<AggregateResult> sum_list = [select count(id) cnt, Opportunity__c from Tender_Opportunity_Link__c where Opportunity__c in :oppIds group by Opportunity__c]; Map<String, Integer> sum_map = new Map<String, Integer>(); + if (sum_list != null && sum_list.size() > 0) { for (AggregateResult result : sum_list) { sum_map.put(String.valueOf(result.get('Opportunity__c')), Integer.valueOf(result.get('cnt'))); @@ -260,23 +421,174 @@ for (Opportunity opp : opportunities) { if (sum_map.get(opp.Id) == null || sum_map.get(opp.Id) == 0) { opp.Bidding_Project_Name_Bid__c = null; - opp.TenderBeginDate_Text__c = null; + //opp.TenderBeginDate_Text__c = null; opp.InfoTypeBid_text__c = null; + //20220718 you 璇环浠诲姟 start + opp.ConfirmationofAward__c = null; + opp.Task_createTime__c = null; + opp.ConfirmationofAward_createTime__c =null; + opp.LostTask_comfirmTime__c =null; + opp.Is_ConfirmationofAward__c =null; + opp.Closing_Bid_Date__c = null; + //20220718 you 璇环浠诲姟 end + // 20221028 ljh SWAG-CKL5UC start + opp.LeakageNumber__c = null; + // 20221028 ljh SWAG-CKL5UC end } else { for (Tender_Opportunity_Link__c link : links) { if (opp.Id == link.Opportunity__c) { + //20220615 you SWAG-CFD4SU 鏀归�� start + /** opp.Bidding_Project_Name_Bid__c = link.Tender_information__c; if ('3锛氱粨鏋�'.equals(link.Tender_information__r.InfoType__c)) { opp.Bidding_Project_Name_Bid__c = link.Tender_information__c; break; } + **/ + //records[0].addError(opp.Opp_Order__c+'ceshi==='+links.size()+'==='+link.Tender_information__r.Tender_Order__c); + if(opp.Opp_Order__c >= link.Tender_information__r.Tender_Order__c){ + opp.Bidding_Project_Name_Bid__c = link.Tender_information__c; + //opp.TenderBeginDate_Text__c = link.Tender_information__r.TenderDate__c;//鏇存敼璇环鐘舵��2鏃讹紝寮曠敤瓒�20锛宭ink.Tender_information__r.TenderBeginTime__c; + opp.InfoTypeBid_text__c = link.Tender_information__r.InfoType__c; + //20220718 you 鎷涙爣椤圭洰 start + if(String.isNotBlank(link.Tender_information__r.InfoType__c) && link.Tender_information__r.InfoType__c=='3锛氱粨鏋�' && String.isNotBlank(link.Tender_information__r.subInfoType__c) && (link.Tender_information__r.subInfoType__c=='3-5锛氫腑鏍囬�氱煡' || link.Tender_information__r.subInfoType__c=='3-6锛氬悎鍚屽叕鍛�')){ + tenIds.add(link.Opportunity__c); //绗﹀悎鏉′欢鐢熸垚浠诲姟 + } + //20220718 you 鎷涙爣椤圭洰 end + break; + } + //20220615 you SWAG-CFD4SU 鏀归�� end } } } + //20220829 you SWAG-CHL67J start + Integer returncount =0; + for (Tender_Opportunity_Link__c link1 : links) { + if (opp.Id == link1.Opportunity__c) { + if(String.isNotBlank(link1.Tender_information__r.InfoType__c) && link1.Tender_information__r.InfoType__c!='1锛氶鍛�' && String.isNotBlank(link1.Tender_information__r.subInfoType__c) && link1.Tender_information__r.subInfoType__c!='3-1锛氬簾鏍囧叕鍛�' && link1.Tender_information__r.subInfoType__c!='3-2锛氭祦鏍囧叕鍛�'){ + system.debug('jinlaile'); + returncount += 1; + } + + } + } + opp.Tender_Number__c= returncount; + //20220829 you SWAG-CHL67J end } update opportunities; + } + //20220718 you 鎷涙爣浠诲姟 start + if (tenIds !=null && tenIds.size() > 0) { + Database.executeBatch(new TenderResultConfirmTaskBatch(tenIds)); + } + //20220718 you 鎷涙爣浠诲姟 end } + //SWAG-CHL67J 銆愬鎵樸�戙�怓Y23璇环鏀瑰杽銆�-璇环椤甸潰/鎷涙爣椤圭洰澧炲姞缁熻瀛楁 fy start + // if (TenderIds.size() > 0) { + // updateTender(TenderIds); + // } + //SWAG-CHL67J 銆愬鎵樸�戙�怓Y23璇环鏀瑰杽銆�-璇环椤甸潰/鎷涙爣椤圭洰澧炲姞缁熻瀛楁 fy end } } + @TestVisible + public static void testI() { + integer i = 0; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + i++; + } } \ No newline at end of file diff --git a/force-app/main/default/triggers/OpportunityHpDeptUpd.trigger b/force-app/main/default/triggers/OpportunityHpDeptUpd.trigger index 2d19384..d7a208c 100644 --- a/force-app/main/default/triggers/OpportunityHpDeptUpd.trigger +++ b/force-app/main/default/triggers/OpportunityHpDeptUpd.trigger @@ -1,4 +1,9 @@ trigger OpportunityHpDeptUpd on Opportunity (before insert, before update) { + // SWAG-CE55BX 棰勬祴浼樺寲 start + if (StaticParameter.EscapeOppandStaTrigger) { + return; + } + // SWAG-CE55BX 棰勬祴浼樺寲 end /* if (StaticParameter.EscapeOpportunityHpDeptUpdTrigger) { System.debug('Escape銆丒scapeOpportunityHpDeptUpdTrigger:::::' + StaticParameter.EscapeOpportunityHpDeptUpdTrigger); @@ -9,6 +14,14 @@ Map<Integer, Opportunity> oppForLookUpMap = new Map<Integer, Opportunity>(); Integer idx = 0; for(Opportunity opp : Trigger.new) { + // 20221112 you DB202211366462 + + if(opp.TenderBeginDate__c !=null && opp.TenderBeginDate__c != opp.TenderBeginDate_Text__c ){ + opp.TenderBeginDate_Text__c = opp.TenderBeginDate__c; + }else if(opp.TenderBeginDate__c ==null){ + opp.TenderBeginDate_Text__c = opp.Bid_Date__c; + } + // 鍙ゃ亜銉囥兗銈裤伄鏇存柊銈掔姝� if (Trigger.isUpdate) { Boolean noChange = false; -- Gitblit v1.9.1