From a1b500c74db7ed741ab4bebbd42530fd30b89bf9 Mon Sep 17 00:00:00 2001
From: yangjieke <yangjieke@prec-tech.com>
Date: 星期五, 01 四月 2022 10:07:17 +0800
Subject: [PATCH] SWAG-CCL6R7 补充

---
 force-app/main/default/triggers/OpportunityBefUpd.trigger   |   11 +++++++++++
 force-app/main/default/classes/TenderInformationHandler.cls |   21 +++++++++++++++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/classes/TenderInformationHandler.cls b/force-app/main/default/classes/TenderInformationHandler.cls
index 4f8fe52..17de6fe 100644
--- a/force-app/main/default/classes/TenderInformationHandler.cls
+++ b/force-app/main/default/classes/TenderInformationHandler.cls
@@ -46,6 +46,7 @@
         if (!StaticParameter.EscapeOtherUpdateTenOwner) {
             updateTenOwner();
         }
+                
     }
 
     protected override void afterInsert() {
@@ -58,6 +59,26 @@
         addShare();
         sednMessage();
         updateWin();
+
+        //2022-3-29 yjk SWAG-CCL6R7
+        updateOpportunity();
+    }
+
+
+    //2022-3-29 yjk SWAG-CCL6R7
+    private void updateOpportunity(){
+        for(Tender_information__c newOne : newList){
+            Tender_information__c oldOne = oldMap.get(newOne.id);
+            if(oldOne.ResultDate__c == null && newOne.ResultDate__c != null){
+                List<Opportunity> oppList = [select id,Closing_Bid_Date__c  from Opportunity where Bidding_Project_Name_Bid__c = :newOne.id];
+                if(oppList.size() > 0){
+                    for(Opportunity opp : oppList){
+                        opp.Closing_Bid_Date__c = newOne.ResultDate__c;
+                    }
+                    update oppList;
+                }
+            }
+        }
     }
 
     public void sednMessage() {
diff --git a/force-app/main/default/triggers/OpportunityBefUpd.trigger b/force-app/main/default/triggers/OpportunityBefUpd.trigger
index 51c22ea..61b4720 100644
--- a/force-app/main/default/triggers/OpportunityBefUpd.trigger
+++ b/force-app/main/default/triggers/OpportunityBefUpd.trigger
@@ -2,8 +2,10 @@
  * Opportunity浣滄垚寰�(銈炽償銉�)銆乼rigger銇仸闆嗚▓闋呯洰銈抧ull銇仚銈�
  * 鍟嗚珖銇�屽璨�/鍐呰部銆嶃仺銆岄�氳波銆嶃伄鍊ゃ亴涓�鑷淬仌銇涖倠銉堛儶銈兗銇с仚銆�
  * 鍟嗚珖銇墍鏈夎�呫�愩偡銈广儐銉犮�戙伀鎵�鏈夎�呫伄Id銈掑叆銈屻倠
+ * OpportunityBefInsUpdTriggerTest
  */
 trigger OpportunityBefUpd on Opportunity (before insert, before update) {
+
     List<String> idlist = new List<String>();
     if(Trigger.isInsert){
         //璇环鎷呭綋浜哄拰鎴樼暐绉戝鎷呭綋浜轰笉涓�鑷�,鍦ㄨ繖閲屽悓姝� 20170512 XFUU-ALB9JK
@@ -50,6 +52,15 @@
             //if(ops.State_Owner__c == '鑳介噺') ops.STMS_Package_Sale__c = true;
             // opIds.add(ops.Id);
             // acs.add(ops.)
+
+            //2022-3-29 yjk SWAG-CCL6R7
+            Opportunity oldOne = Trigger.oldMap.get(ops.id);
+            if(oldOne.Bidding_Project_Name_Bid__c==null  && ops.Bidding_Project_Name_Bid__c !=null ){
+                List<Tender_information__c> ticList = [select id,ResultDate__c from Tender_information__c where id = :ops.Bidding_Project_Name_Bid__c];
+                
+                ops.Closing_Bid_Date__c = ticList.size() == 1? ticList.get(0).ResultDate__c : null ;
+
+            }
         }
         // System.debug('====================='+opIds);
         // //鍦ㄨ浠疯Е鍙戝櫒閲屾敼杩欎釜楠岃瘉锛屾帓闄ゅ鍝佺姸鎬佹槸鍙栨秷鐨勶紝鍙鏄湁澶囧搧锛屽氨涓嶅厑璁告洿鏀规渶缁堢敤鎴枫��

--
Gitblit v1.9.1