From d8dc84a3d56df839895f1c417a4d9cbee763d262 Mon Sep 17 00:00:00 2001
From: 高章伟 <gaozhangwei@prec-tech.com>
Date: 星期五, 03 三月 2023 14:50:59 +0800
Subject: [PATCH] gzw 测试环境代码更新

---
 force-app/main/default/classes/TenderInformationHandler.cls |   83 +++++++++++++++++++++++++++--------------
 1 files changed, 54 insertions(+), 29 deletions(-)

diff --git a/force-app/main/default/classes/TenderInformationHandler.cls b/force-app/main/default/classes/TenderInformationHandler.cls
index 84e9ee3..de9c2b1 100644
--- a/force-app/main/default/classes/TenderInformationHandler.cls
+++ b/force-app/main/default/classes/TenderInformationHandler.cls
@@ -67,7 +67,8 @@
         updateWin();
 
         // 涓爣浠诲姟 搴熸爣娴佹爣鏃舵竻绌轰腑鏍囨棩
-        clearConfirmationofAward();
+        //20221208 you DB202211594688
+        //clearConfirmationofAward();
 
         //2022-3-29 yjk SWAG-CCL6R7
         //updateOpportunity();//2022-5-18 yjk XLIU-CEJ38N 娉ㄩ噴鎺� 
@@ -103,15 +104,20 @@
             }
         }
         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<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)];
+            //20221208 you DB202211594688 鏈夌‘璁や换鍔$殑璇环涓嶆竻
+          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,RecordType.Name,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)) and taskStatus__c <> '03 瀹屾垚'];
             for(task__c tsk : taskList){
-                tsk.taskStatus__c = '04 鍙栨秷';
-                tsk.cancelDate__c = date.today();
-                if(null!=InfoTypeMap && InfoTypeMap.containsKey(tsk.OpportunityId__c)){
-                   tsk.cancelReasonSelect__c = '淇敼椤圭洰闃舵';
+                if(tsk.RecordType.Name =='澶卞崟鎶ュ憡浠诲姟' && oppIds.contains(tsk.OpportunityId__c) && tsk.taskStatus__c !='03 瀹屾垚'){
+                  //涓嶅仛鎿嶄綔
                 }else{
-                   tsk.cancelReasonSelect__c = '娴佹爣/搴熸爣'; 
+                    tsk.taskStatus__c = '04 鍙栨秷';
+                    tsk.cancelDate__c = date.today();
+                    if(null!=InfoTypeMap && InfoTypeMap.containsKey(tsk.OpportunityId__c)){
+                       tsk.cancelReasonSelect__c = '淇敼椤圭洰闃舵';
+                    }else{
+                       tsk.cancelReasonSelect__c = '娴佹爣/搴熸爣'; 
+                    }
                 }
             }
              update taskList;
@@ -119,15 +125,19 @@
                 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
+                            if(tlink.RecordType.Name =='澶卞崟鎶ュ憡浠诲姟' && tlink.taskStatus__c !='03 瀹屾垚'){
+                              //涓嶅仛鎿嶄綔
+                            }else{
+                               //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
+                            }
                        }  
                     }
                 }
@@ -758,6 +768,7 @@
         Map<Id,Tender_information__c> tOldMap = (Map<Id,Tender_information__c>) Trigger.oldMap;
         Map<Id,Tender_information__c> tNewMap = (Map<Id,Tender_information__c>) Trigger.newMap;
         List<Date> cd = new List<Date>();
+        System.debug(LoggingLevel.INFO, '*** cd: ' + cd);
         System.debug(LoggingLevel.INFO, '*** tOldMap: ' + tOldMap);
         for(Tender_information__c t:(List<Tender_information__c>) Trigger.new){
             System.debug(LoggingLevel.INFO, '*** 杩涘叆for寰幆: ');
@@ -781,20 +792,31 @@
             }
         }
         Map<Date,String> lm = new Map<Date,String>();
-        for(OlympusCalendar__c oc:[SELECT Id,Date__c FROM OlympusCalendar__c WHERE Date__c IN:cd]){
-            lm.put(oc.Date__c,oc.Id); 
-            System.debug(LoggingLevel.INFO, '*** map璧嬪��: ');    
-        }
-
-        for(Tender_information__c l:(List<Tender_information__c>) Trigger.new){
-            if (l.relativeDate__c == null) {
-                continue;
+        if(cd.size() > 0){
+            for(OlympusCalendar__c oc:[SELECT Id,Date__c FROM OlympusCalendar__c WHERE Date__c IN:cd]){
+                lm.put(oc.Date__c,oc.Id); 
+                System.debug(LoggingLevel.INFO, '*** map璧嬪��: ');    
             }
-            String datastr = String.valueOf(l.relativeDate__c);
-            String dt = lm.get(Date.valueOf(datastr.substring(0,10)));
-            l.Tender_Olympus__c = dt;
-            System.debug(LoggingLevel.INFO, '*** l.Tender_Olympus__c: '+ l.Tender_Olympus__c);
+    
+            for(Tender_information__c l:(List<Tender_information__c>) Trigger.new){
+                //lt 20221114 DB202211270805 銆愮揣鎬ャ�戞嫑鏍囬」鐩槸鍚︽寜鏃跺叧鑱旇绠楅敊璇� start
+                // if (l.relativeDate__c == null) {
+                //     continue;
+                // }
+                if (l.relativeDate__c == null && l.OBSAP_relativeTime__c == null) {
+                    continue;
+                }
+                Datetime relativetime = l.OBSAP_relativeTime__c != null ? l.OBSAP_relativeTime__c : l.relativeTime__c;
+                // String datastr = String.valueOf(l.relativeDate__c);
+                String datastr = String.valueOf(relativetime);
+                //lt 20221114 DB202211270805 銆愮揣鎬ャ�戞嫑鏍囬」鐩槸鍚︽寜鏃跺叧鑱旇绠楅敊璇� end
+                String dt = lm.get(Date.valueOf(datastr.substring(0,10)));
+                System.debug(LoggingLevel.INFO, '*** dt: '+ dt);
+                l.Tender_Olympus__c = dt;
+                System.debug(LoggingLevel.INFO, '*** l.Tender_Olympus__c: '+ l.Tender_Olympus__c);
+            }
         }
+        
     }
 // fxk 2021/8/3 鍙嶉�昏緫鍒犻櫎 end
 // 20210824 涓爣鏃朵慨鏀瑰叧鑱旇浠风殑鎷涙爣椤圭洰鍚嶅拰涓爣鏃堕棿
@@ -1277,6 +1299,8 @@
             }
         }
     }
+    /** 
+    //20221208 you DB202211594688
     // 涓爣浠诲姟 搴熸爣娴佹爣鏃舵竻绌轰腑鏍囨棩
     public void clearConfirmationofAward() {
         List<String> tenders = new List<String>();
@@ -1312,4 +1336,5 @@
             }
         }
     }
+    **/
 }
\ No newline at end of file

--
Gitblit v1.9.1