From 928399eceec50e3d37ea08669a12789a9410a9d2 Mon Sep 17 00:00:00 2001
From: 沙世明 <shashiming@prec-tech.com>
Date: 星期二, 22 十一月 2022 16:51:16 +0800
Subject: [PATCH] 111
---
force-app/main/default/classes/TenderInformationHandler.cls | 172 +++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 142 insertions(+), 30 deletions(-)
diff --git a/force-app/main/default/classes/TenderInformationHandler.cls b/force-app/main/default/classes/TenderInformationHandler.cls
index b7e7901..8ed2f99 100644
--- a/force-app/main/default/classes/TenderInformationHandler.cls
+++ b/force-app/main/default/classes/TenderInformationHandler.cls
@@ -47,6 +47,9 @@
if (!StaticParameter.EscapeOtherUpdateTenOwner) {
updateTenOwner();
}
+ // 20221011 ljh SWAG-CK28WT start
+ updateTenOwnerJC();
+ // 20221011 ljh SWAG-CK28WT end
//20220804 you 璇环浠诲姟
updateOppotunityBeforeUpdate();
@@ -59,7 +62,7 @@
// updateTenOwner();
}
protected override void afterUpdate() {
- addShare();
+ addShare();
//sednMessage(); 20220729 you 鎷涙爣椤圭洰 鍙栨秷鍙戦�侀偖浠堕�氱煡
updateWin();
@@ -70,8 +73,8 @@
//updateOpportunity();//2022-5-18 yjk XLIU-CEJ38N 娉ㄩ噴鎺�
}
-//淇敼椤圭洰闃舵锛岀敱 缁撴灉鍙樹负鍏朵粬锛岋紝鐩稿叧浠诲姟鍙栨秷
-public void updateOppotunityBeforeUpdate() {
+ //淇敼椤圭洰闃舵锛岀敱 缁撴灉鍙樹负鍏朵粬锛岋紝鐩稿叧浠诲姟鍙栨秷
+ public void updateOppotunityBeforeUpdate() {
Set<String> Tenids = new Set<String>();//鎷涙爣椤圭洰id锛屾煡璇ink
Set<String> oppTens = new Set<String>();//鎷涙爣椤圭洰id锛屾煡璇ink
List<String> oppIds = new List<String>();//璇环
@@ -131,12 +134,11 @@
}
update opportunities;
}
-
-
-}
-//20220718 you 璇环浠诲姟 end
+ }
+ //20220718 you 璇环浠诲姟 end
+ // 20221027 updateOpportunity() 鍏ㄦ枃鎼滅储杩� 娌℃湁璋冪敤鐨勶紝鏂规硶寮曠敤宸茬粡娉ㄩ噴锛岃鐩栫巼涓嶅鏂规硶浣撲篃娉ㄩ噴锛圫WAG-CKL5UC锛�,
//2022-3-29 yjk SWAG-CCL6R7
- private void updateOpportunity(){
+ /*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){
@@ -149,8 +151,8 @@
}
}
}
- }
-//20220729 you
+ }*/
+ //20220729 you
//public void sednMessage() {
// //瑙勫垯鏉′欢
// //ISCHANGED(InfoType__c) && Text(InfoType__c) = '3锛氱粨鏋�' && (Text(IsBid__c) = '鏄�' || ( Text(IsBid__c) = '鍚�' && OpportunityNum__c != null && OpportunityNum__c > 0) )
@@ -462,6 +464,12 @@
//鍙栧�奸『搴忔槸锛氭墍鏈変汉锛屼箣鍚庢槸gi鍔╃悊锛屾帴涓嬫潵鏄痵p鍔╃悊锛屾帴涓嬫潵鏄垬鐣ョ瀹ゆ墍鏈変汉 鎵�浠ュ�掔潃鏉�
List<Tender_information__Share> tenShareList = new List<Tender_information__Share>();
for (Tender_information__c tenc : newList) {
+ // 20221013 ljh SWAG-CK28WT start
+ // 闆嗛噰椤圭洰 鍚庣画鍏变韩涓嶉渶瑕侊紝鍙妸鍘熸潵鐨勫叡浜垹闄�
+ if(tenc.CentralizedProject__c){
+ continue;
+ }
+ // 20221013 ljh SWAG-CK28WT start
//涓�涓猰ap涓� 閽堝涓�鏉℃嫑鎶曟爣璁″垝鐨勫叡浜�
Map<Id, Tender_information__Share> sharemap = new Map<Id, Tender_information__Share>();
//1.鍏堣缃� 鍖婚櫌鎷呭綋鐨勫叡浜�
@@ -591,7 +599,7 @@
tenShareList.addAll(sharemap.values());
}
-
+
//鐜板湪鐢ㄧ殑鏄叏鍒犲叏鍔犵殑鏂规硶锛屾病鏈夊啀鍒ゆ柇鏄惁鍙戠敓鏀瑰彉浜�
//鍒犻櫎
List<Tender_information__Share> beforeShareList =
@@ -618,7 +626,6 @@
for (OCM_Management_Province__c mp : [SELECT id, Name, GI_assistant__c, SP_assistant__c, SP_assistant__r.IsActive, GI_assistant__r.IsActive, Window2__c, Window2__r.IsActive, Admin_assistant3__c, Admin_assistant3__r.IsActive, TenderAssistant1__c, TenderAssistant1__r.IsActive, TenderAssistant2__c, TenderAssistant2__r.IsActive, Window1__c, Window1__r.IsActive FROM OCM_Management_Province__c]) {
mpMap.put(mp.Name, mp);
}
-
//璁剧疆GI/SP鍔╃悊 琛屾斂鍔╃悊銆佸鍝佺獥鍙�
//鐩存帴璁剧疆 淇℃伅璐熻矗浜�(鍔╃悊) 涓篏I鍔╃悊
for (Tender_information__c info : newList) {
@@ -641,13 +648,17 @@
info.GI_assistant__c = ocm.GI_assistant__c;
}
if (info.InfoOwner__c != ocm.GI_assistant__c) {
- info.InfoOwner__c = ocm.GI_assistant__c;
+ if(info.CentralizedProject__c == false){ // 20221012 ljh SWAG-CK28WT 娣诲姞鐨刬f
+ info.InfoOwner__c = ocm.GI_assistant__c;
+ }
}
}
// 澧炲姞GI鍔╃悊涓虹┖鏃剁殑澶勭悊锛屾竻绌烘嫑鏍囬」鐩殑GI鍔╃悊鍜屼俊鎭礋璐d汉锛堝姪鐞嗭級 20210813
else if (ocm.GI_assistant__c == null || !ocm.GI_assistant__r.IsActive) {
info.GI_assistant__c = null;
- info.InfoOwner__c = null;
+ if(info.CentralizedProject__c == false){ // 20221012 ljh SWAG-CK28WT 娣诲姞鐨刬f
+ info.InfoOwner__c = null;
+ }
}
if (ocm.SP_assistant__r.IsActive && info.SP_assistant__c != ocm.SP_assistant__c) {
info.SP_assistant__c = ocm.SP_assistant__c;
@@ -700,12 +711,33 @@
|| tenDepartList.contains('01210000000QezoAAC')
|| tenDepartList.contains('01210000000QeztAAC')){
System.debug('=====-----'+info.department_selection__c);
- info.InfoOwner__c = info.SP_assistant__c;
+ if(info.CentralizedProject__c == false){ // 20221012 ljh SWAG-CK28WT 娣诲姞鐨刬f
+ info.InfoOwner__c = info.SP_assistant__c;
+ }
+
}
}
// add 鎴樼暐绉戝鍒嗙被涓烘櫘澶栫銆佹硨灏跨銆佸绉戙�佽�抽蓟鍠夌鏃讹紝淇℃伅璐熻矗浜猴紙鍔╃悊锛変慨鏀逛负 SP鍔╃悊 2021銆�11銆�11 fxk end
+ // 20221012 ljh SWAG-CK28WT start
+ if(info.CentralizedProject__c){
+ // 娓呴櫎杩欎簺浜鸿祴鍊� 锛堝氨娌℃湁鏉冮檺浜嗭級
+ info.GI_assistant__c = null;
+ info.SP_assistant__c = null;
+ info.Window2__c = null;
+ info.TenderAssistant1__c = null;
+ info.TenderAssistant2__c = null;
+ info.YingyeWindow__c = null;
+ }
+ // 20221012 ljh SWAG-CK28WT end
}
+ // 20221027 ljh SWAG-CKL5UC add start
+ // 椤圭洰涓綋缁撴灉璁板綍鏃ユ湁鍊煎叕鍛婅褰曟棩涓虹┖鏃讹紝缁欏叕鍛婅褰曟棩璧嬪�奸�昏緫=缁撴灉璁板綍鏃�-15澶�
+ if(info.ResultDate__c != null && info.publicDate__c == null){
+ info.publicDate__c = info.ResultDate__c.addDays(-15);
+ }
+ // 20221027 ljh SWAG-CKL5UC add start
}
+
}
// fxk 2021/8/3 鍙嶉�昏緫鍒犻櫎 Star
private void updateTenDel() {
@@ -726,6 +758,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寰幆: ');
@@ -737,7 +770,10 @@
System.debug(LoggingLevel.INFO, '*** tOldMap: ' + tOldMap.get(t.Id).relativeDate__c);
System.debug(LoggingLevel.INFO, '*** t.relativeDate__c: ' + t.relativeDate__c);
// if(tOldMap.get(t.Id).relativeDate__c != null && t.relativeDate__c != tOldMap.get(t.Id).relativeDate__c){
- if(t.relativeDate__c != null && t.relativeDate__c != tOldMap.get(t.Id).relativeDate__c){
+ //lt 20221114 DB202211270805 銆愮揣鎬ャ�戞嫑鏍囬」鐩槸鍚︽寜鏃跺叧鑱旇绠楅敊璇� start
+ // if(t.relativeDate__c != null && t.relativeDate__c != tOldMap.get(t.Id).relativeDate__c){
+ if(((t.OBSAP_relativeTime__c != null || t.relativeTime_F__c != null) && t.Tender_Olympus__c == null) || (t.relativeDate__c != null && t.relativeDate__c != tOldMap.get(t.Id).relativeDate__c)){
+ //lt 20221114 DB202211270805 銆愮揣鎬ャ�戞嫑鏍囬」鐩槸鍚︽寜鏃跺叧鑱旇绠楅敊璇� end
System.debug(LoggingLevel.INFO, '*** 杩涘叆if璇彞: ');
String datastr = String.valueOf(t.relativeDate__c);
cd.add( Date.valueOf(datastr.substring(0,10)) );
@@ -746,27 +782,41 @@
}
}
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 涓爣鏃朵慨鏀瑰叧鑱旇浠风殑鎷涙爣椤圭洰鍚嶅拰涓爣鏃堕棿
private void updateWin() {
List<String> tenderIds = new List<String>();
List<String> lostWinIds = new List<String>();
-
+ // 20221028 ljh SWAG-CKL5UC start
+ Map<Id,Tender_information__c> tendMap = New Map<Id,Tender_information__c>();
+ Map<Id,Opportunity> updateOpp = New Map<Id,Opportunity>();
+ // 20221028 ljh SWAG-CKL5UC end
for (Tender_information__c ten : newList) {
/** 20220614 SWAG-CFD4SU you 鏇存敼锛岃浠蜂紭鍏堟樉绀洪」鐩樁娈垫渶鏂扮殑鎷涙爣椤圭洰淇℃伅
if ('3锛氱粨鏋�'.equals(ten.InfoType__c) && !'3锛氱粨鏋�'.equals((oldMap.get(ten.Id).InfoType__c))) {
@@ -779,6 +829,13 @@
if((String.isNotBlank(ten.InfoType__c) && ten.InfoType__c != oldMap.get(ten.Id).InfoType__c) || (String.isNotBlank(ten.subInfoType__c) && ten.subInfoType__c != oldMap.get(ten.Id).subInfoType__c) || System.Label.TenderToOpp == '1'){
tenderIds.add(ten.Id);
}
+ // 20221028 ljh SWAG-CKL5UC add start
+ // 鍏宠仈璇环鐨� 璇环椤甸潰鍒涘缓鏃ユ櫄浜庢嫑鏍囬」鐩叕鍛婅褰曟棩锛屾紡鍗曟暟涓�1
+ // 鍏宠仈璇环鐨� && 鏇存柊鏈夊��
+ if(ten.OpportunityNum__c > 0 && Trigger.isUpdate && oldMap.get(ten.Id).publicDate__c == null && ten.publicDate__c != null){
+ tendMap.put(ten.Id, ten);
+ }
+ // 20221028 ljh SWAG-CKL5UC add end
}
if (tenderIds.size() > 0) {
@@ -884,6 +941,22 @@
}
}
**/
+ // 20221028 ljh SWAG-CKL5UC add start
+ if(tendMap.size() > 0){
+ List<Tender_Opportunity_Link__c> links = [select id, Opportunity__c, Tender_information__c, Opportunity__r.Created_Day__c ,Opportunity__r.LeakageNumber__c,Opportunity__r.LeadSource from Tender_Opportunity_Link__c where Tender_information__c in :tendMap.keySet()];
+ for(Tender_Opportunity_Link__c lk:links){
+ if(lk.Opportunity__r.Created_Day__c > tendMap.get(lk.Tender_information__c).publicDate__c && lk.Opportunity__r.LeadSource == '鎷涙爣缃�'){
+ Opportunity opp = new Opportunity();
+ opp.Id = lk.Opportunity__c;
+ opp.LeakageNumber__c = 1;
+ updateOpp.put(opp.Id,opp);
+ }
+ }
+ }
+ if(updateOpp.size() > 0){
+ update updateOpp.values();
+ }
+ // 20221028 ljh SWAG-CKL5UC add end
}
public void updateTenOwner() {
@@ -1176,7 +1249,46 @@
}
// StaticParameter.EscapeOtherUpdateTenOwner = true;
}
-
+ /*
+ 闆嗛噰椤圭洰瀵艰嚧鎵�鏈変汉鏇存柊
+ **/
+ // 20221011 ljh SWAG-CK28WT
+ public void updateTenOwnerJC() {
+ //
+ String OCSM_province = '甯傚満浼佸垝鏈儴';
+ Id OwnerIdStr;
+ List<OCM_Management_Province__c> ompList = [select Id,TenderAssistant1__c,TenderAssistant1__r.IsActive,TenderAssistant2__c from OCM_Management_Province__c where name =:OCSM_province];
+ if(ompList.size() > 0 && ompList[0].TenderAssistant1__r.IsActive){
+ OwnerIdStr = ompList[0].TenderAssistant1__c;
+ }
+ System.debug('zheli00:'+OwnerIdStr);
+ for (Tender_information__c nObj : newList) {
+ Tender_information__c oObj = oldMap.get(nObj.Id);
+ if (nObj.CentralizedProject__c != oObj.CentralizedProject__c) {
+ if(nObj.CentralizedProject__c && OwnerIdStr != null){
+ /**
+ 鏈儴鑷姩鍙樻垚甯傚満浼佸垝鏈儴锛岄」鐩姪鐞嗗拰鎵�鏈変汉閮芥槸甯傚満浼佸垝鏈儴鐨勪汉锛�
+ 鍙朞CSM绠$悊鐪侀〉闈㈢淮鎶ょ殑甯傚満浼佸垝鏈儴锛屾嫑鏍囬」鐩姪鐞�1锛�
+ */
+ nObj.OwnerId = OwnerIdStr;
+ nObj.InfoOwner__c = OwnerIdStr;
+ }else if(!nObj.CentralizedProject__c){
+ /**
+ 鍙栨秷鍕鹃�夊悗杩斿洖钀ヤ笟閮ㄩ棬鐨勭渷鍜屾湰閮紝
+ 鎵�鏈変汉鏍规嵁鍏宠仈鍖婚櫌鍜屾垬鐣ョ瀹ゅ彇鎷呭綋鐨勫悕瀛椼��
+ */
+ updateTenOwner();
+ }
+ }
+ // 濡傛灉瑙﹀彂 鏇存柊鎵�鏈変汉 娌℃湁璇环鍒� 杩樻槸甯傚満浼佸垝鏈儴
+ if (!StaticParameter.EscapeOtherUpdateTenOwner) {
+ if(nObj.CentralizedProject__c && OwnerIdStr != null && (nObj.OpportunityNum__c == 0 || nObj.OpportunityNum__c == null)){
+ nObj.OwnerId = OwnerIdStr;
+ nObj.InfoOwner__c = OwnerIdStr;
+ }
+ }
+ }
+ }
// 涓爣浠诲姟 搴熸爣娴佹爣鏃舵竻绌轰腑鏍囨棩
public void clearConfirmationofAward() {
List<String> tenders = new List<String>();
--
Gitblit v1.9.1