From ec47f5ab5923a315bf22e0df5af7371e9668589e Mon Sep 17 00:00:00 2001
From: 张宇恒 <bxyun0@163.com>
Date: 星期五, 23 十二月 2022 11:16:18 +0800
Subject: [PATCH] 修理接口推送触发条件新加故障描述修理内容等
---
force-app/main/default/classes/OpportunityService.cls | 71 +++++++++++++++++++++++++++++++++--
1 files changed, 67 insertions(+), 4 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
}
// 鏌ヨ鎷涙爣鏁伴噺骞舵洿鏂�
--
Gitblit v1.9.1