From 19ae52ae3e06c44c646ae6b45dc2b0d7f2cead88 Mon Sep 17 00:00:00 2001
From: 李彤 <litong@prec-tech.com>
Date: 星期一, 15 五月 2023 18:55:53 +0800
Subject: [PATCH] 招标项目终止
---
force-app/main/default/classes/TenderInformationHandler.cls | 122 +++++++++++++++++++++++++++++++---------
1 files changed, 95 insertions(+), 27 deletions(-)
diff --git a/force-app/main/default/classes/TenderInformationHandler.cls b/force-app/main/default/classes/TenderInformationHandler.cls
index de9c2b1..1e4df89 100644
--- a/force-app/main/default/classes/TenderInformationHandler.cls
+++ b/force-app/main/default/classes/TenderInformationHandler.cls
@@ -40,6 +40,7 @@
}
protected override void beforeUpdate() {
+ SetIsReactionOpp(); //lt DB202304062844 20230515 椤圭洰缁堟娴佺▼寮�鍙� add
//鍙嶉�昏緫鍒犻櫎 fxk
changeRelateOppDate();
updateTenDel();
@@ -81,14 +82,16 @@
List<String> oppIds = new List<String>();//璇环
// 鑾峰緱瑕佹洿鏂扮殑璇环
for (Tender_information__c record: newList) {
- if ( ( ('3-5锛氫腑鏍囬�氱煡'.equals((oldMap.get(record.Id).subInfoType__c)) || '3-6锛氬悎鍚屽叕鍛�'.equals((oldMap.get(record.Id).subInfoType__c)) ) && ('3-1锛氬簾鏍囧叕鍛�'.equals(record.subInfoType__c) || '3-2锛氭祦鏍囧叕鍛�'.equals(record.subInfoType__c) )) || (!'3锛氱粨鏋�'.equals(record.InfoType__c) && '3锛氱粨鏋�'.equals((oldMap.get(record.Id).InfoType__c)))) {
+ //lt 20230425 鎷涙爣缁堟 add || ('鎵瑰噯'.equals(record.TerminateApprovalStatus__c) && !'鎵瑰噯'.equals((oldMap.get(record.Id).TerminateApprovalStatus__c)))
+ if ( ( ('3-5锛氫腑鏍囬�氱煡'.equals((oldMap.get(record.Id).subInfoType__c)) || '3-6锛氬悎鍚屽叕鍛�'.equals((oldMap.get(record.Id).subInfoType__c)) ) && ('3-1锛氬簾鏍囧叕鍛�'.equals(record.subInfoType__c) || '3-2锛氭祦鏍囧叕鍛�'.equals(record.subInfoType__c) )) || (!'3锛氱粨鏋�'.equals(record.InfoType__c) && '3锛氱粨鏋�'.equals((oldMap.get(record.Id).InfoType__c))) || ('鎵瑰噯'.equals(record.TerminateApprovalStatus__c) && !'鎵瑰噯'.equals((oldMap.get(record.Id).TerminateApprovalStatus__c)))) {
Tenids.add(record.id);
}
}
Map<String,String> InfoTypeMap = new Map<String,String>(); //鍒ゆ柇鏄惁鏄洜涓轰腑鏍囦慨鏀瑰緱
+ Map<String,String> TerminationStateMap = new Map<String,String>(); //lt 20230425 鎷涙爣缁堟 add
if(null!=Tenids && Tenids.size()>0){
-
- List<Tender_Opportunity_Link__c> TenOppLinkList = [select id, Tender_information__c,Tender_information__r.InfoType__c, Opportunity__c from Tender_Opportunity_Link__c where Tender_information__c in :Tenids];
+ //lt 20230425 鎷涙爣缁堟 add Tender_information__r.TerminateApprovalStatus__c,
+ List<Tender_Opportunity_Link__c> TenOppLinkList = [select id, Tender_information__c,Tender_information__r.InfoType__c, Tender_information__r.TerminateApprovalStatus__c, Opportunity__c from Tender_Opportunity_Link__c where Tender_information__c in :Tenids];
if(null!=TenOppLinkList && TenOppLinkList.size()>0){
for(Tender_Opportunity_Link__c topl :TenOppLinkList){
String oppid =String.valueOf(topl.Opportunity__c);
@@ -97,52 +100,105 @@
if (!oppIds.contains(topl.Opportunity__c)) {
oppIds.add(topl.Opportunity__c);
}
- if(!'3锛氱粨鏋�'.equals(topl.Tender_information__r.InfoType__c)){
+ //lt DB202304062844 20230515 椤圭洰缁堟娴佺▼寮�鍙� update if(!'3锛氱粨鏋�'.equals(topl.Tender_information__r.InfoType__c)) --- if(!'3锛氱粨鏋�'.equals(NewMap.get(topl.Tender_information__c).InfoType__c))
+ if(!'3锛氱粨鏋�'.equals(NewMap.get(topl.Tender_information__c).InfoType__c)){
InfoTypeMap.put(topl.Opportunity__c,topl.Tender_information__c);
}
+ //lt 20230425 鎷涙爣缁堟 start
+ System.debug('---lt123---topl.Tender_information__r.TerminateApprovalStatus__c:'+topl.Tender_information__r.TerminateApprovalStatus__c);
+ if('鎵瑰噯'.equals(newMap.get(topl.Tender_information__c).TerminateApprovalStatus__c)){
+ TerminationStateMap.put(topl.Opportunity__c,topl.Tender_information__c);
+ }
+ //lt 20230425 鎷涙爣缁堟 end
}
}
}
if (null!=oppTens && oppTens.size()>0) {
//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 瀹屾垚'];
+ List<Opportunity> opportunities = [select id, Bidding_Project_Name_Bid__c, Opp_Order__c,ConfirmationofAward__c from Opportunity where id in :oppIds];
+ //lt 20230425 鎷涙爣缁堟 add Tender_information_Task__r.TerminateApprovalStatus__c 20230510 add and taskStatus__c <> '04 鍙栨秷'
+ //lt DB202304062844 20230515 椤圭洰缁堟娴佺▼寮�鍙� update taskStatus__c <> '03 瀹屾垚' and taskStatus__c <> '04 鍙栨秷' --- taskStatus__c = '02 鎺ュ彈'
+ List<task__c> taskList = [select id,taskStatus__c,RecordType.Name,Tender_information_Task__c,
+ OpportunityId__c,Tender_information_Task__r.TerminateApprovalStatus__c
+ from task__c
+ where ((RecordType.Name ='澶卞崟鎶ュ憡浠诲姟' and OpportunityId__c in:oppIds)
+ or (RecordType.Name ='涓爣缁撴灉纭' and Opp_Tender__c in :oppTens))
+ and taskStatus__c = '02 鎺ュ彈'];
for(task__c tsk : taskList){
- if(tsk.RecordType.Name =='澶卞崟鎶ュ憡浠诲姟' && oppIds.contains(tsk.OpportunityId__c) && tsk.taskStatus__c !='03 瀹屾垚'){
+ System.debug('---lt123---TerminationStateMap:'+TerminationStateMap);
+ System.debug('---lt123---tsk.Tender_information_Task__r.TerminateApprovalStatus__c:'+tsk.Tender_information_Task__r.TerminateApprovalStatus__c);
+ //lt DB202304062844 20230515 椤圭洰缁堟娴佺▼寮�鍙� update !='03 瀹屾垚' --- == '02 鎺ュ彈'
+ if(tsk.RecordType.Name =='澶卞崟鎶ュ憡浠诲姟' && oppIds.contains(tsk.OpportunityId__c) && tsk.taskStatus__c == '02 鎺ュ彈'){
//涓嶅仛鎿嶄綔
}else{
tsk.taskStatus__c = '04 鍙栨秷';
tsk.cancelDate__c = date.today();
if(null!=InfoTypeMap && InfoTypeMap.containsKey(tsk.OpportunityId__c)){
tsk.cancelReasonSelect__c = '淇敼椤圭洰闃舵';
- }else{
+ }
+ //lt 20230425 鎷涙爣缁堟 start
+ else if(null!=TerminationStateMap && TerminationStateMap.containsKey(tsk.OpportunityId__c)){
+ tsk.cancelReasonSelect__c = '椤圭洰缁堟';
+ }
+ //lt 20230425 鎷涙爣缁堟 end
+ else{
tsk.cancelReasonSelect__c = '娴佹爣/搴熸爣';
}
}
}
- update taskList;
- if(taskList.size() > 0){
- for (task__c tlink : taskList) {
- for (Opportunity opp : opportunities) {
- if (opp.Id == tlink.OpportunityId__c) {
- 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
- }
- }
+ update taskList;
+ //lt DB202304062844 20230515 椤圭洰缁堟娴佺▼寮�鍙� start
+ // if(taskList.size() > 0){
+ if(opportunities.size() > 0){
+ for (Opportunity opp : opportunities) {
+ Boolean upd_flg = null!=TerminationStateMap && TerminationStateMap.containsKey(opp.Id) && opp.ConfirmationofAward__c == '绔炰簤瀵规墜涓爣' ? false : true;
+ if (!upd_flg) {
+ continue;
}
+ for (task__c tlink : taskList) {
+ if (opp.Id == tlink.OpportunityId__c) {
+ //lt DB202304062844 20230515 椤圭洰缁堟娴佺▼寮�鍙� update !='03 瀹屾垚' --- == '02 鎺ュ彈'
+ if(tlink.RecordType.Name =='澶卞崟鎶ュ憡浠诲姟' && tlink.taskStatus__c == '02 鎺ュ彈'){
+ upd_flg = false;
+ break;
+ //涓嶅仛鎿嶄綔
+ // }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;
+ // //lt DB202304062844 20230515 椤圭洰缁堟娴佺▼寮�鍙� start
+ // if(tlink.Tender_information_Task__r.TerminateApprovalStatus__c == '鎵瑰噯' && opp.ConfirmationofAward__c == 'OLY涓爣'){
+ // opp.Closing_Bid_Date__c = null;
+ // }
+ // //lt DB202304062844 20230515 椤圭洰缁堟娴佺▼寮�鍙� end
+ // //opp.Closing_Bid_Date__c = null;
+ // //20220718 you 璇环浠诲姟 end
+ }
+ }
+ }
+ if (upd_flg) {
+ //lt DB202304062844 20230515 椤圭洰缁堟娴佺▼寮�鍙� start
+ if(null!=TerminationStateMap && TerminationStateMap.containsKey(opp.Id) && opp.ConfirmationofAward__c == 'OLY涓爣'){
+ opp.Closing_Bid_Date__c = null;
+ }
+ //lt DB202304062844 20230515 椤圭洰缁堟娴佺▼寮�鍙� end
+ 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;
+ }
}
}
+ //lt DB202304062844 20230515 椤圭洰缁堟娴佺▼寮�鍙� end
+ StaticParameter.EscapeOppandStaTrigger = true; //lt DB202304062844 20230515 椤圭洰缁堟娴佺▼寮�鍙� 璺宠繃璇环trigger start
update opportunities;
+ StaticParameter.EscapeOppandStaTrigger = false; //lt DB202304062844 20230515 椤圭洰缁堟娴佺▼寮�鍙� end
}
}
//20220718 you 璇环浠诲姟 end
@@ -1337,4 +1393,16 @@
}
}
**/
+
+ //lt DB202304062844 20230515 椤圭洰缁堟娴佺▼寮�鍙� start subInfoType__c
+ //濡傛灉椤圭洰闃舵鍙戠敓鍙樺寲 鎴栬�呴樁娈佃ˉ鍏呰鏄庡彂鐢熷彉鍖� 鎴栬�呯粓姝㈠鎵瑰彂鐢熷彉鍖栦笖瀹℃壒閫氳繃 鎶婃嫑鏍囬」鐩笂鐨処sReactionOpp__c璁剧疆涓簍rue
+ public void SetIsReactionOpp() {
+ for(Tender_information__c newTen : newList){
+ Tender_information__c oldTen = oldMap.get(newTen.Id);
+ if(newTen.InfoType__c != oldTen.InfoType__c || newTen.subInfoType__c != oldTen.subInfoType__c || (newTen.TerminateApprovalStatus__c != oldTen.TerminateApprovalStatus__c && newTen.TerminateApprovalStatus__c == '鎵瑰噯')){
+ newTen.IsReactionOpp__c = true;
+ }
+ }
+ }
+ //lt DB202304062844 20230515 椤圭洰缁堟娴佺▼寮�鍙� end
}
\ No newline at end of file
--
Gitblit v1.9.1