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/OPDPlanHandler.cls | 97 ++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 89 insertions(+), 8 deletions(-)
diff --git a/force-app/main/default/classes/OPDPlanHandler.cls b/force-app/main/default/classes/OPDPlanHandler.cls
index 7b036ff..7540370 100644
--- a/force-app/main/default/classes/OPDPlanHandler.cls
+++ b/force-app/main/default/classes/OPDPlanHandler.cls
@@ -268,7 +268,7 @@
//2021-08-13 mzy SWAG-C5RAZV 浜嬩欢鈥斺�旇鍒� 寤舵湡 璋冩煡 start
delayReason__c,
//2021-08-13 mzy SWAG-C5RAZV 浜嬩欢鈥斺�旇鍒� 寤舵湡 璋冩煡 end
- Subject from Event where Opd_Plan__c in: oSetIdSet];
+ Subject from Event where Opd_Plan__c in: oSetIdSet and EventStatus__c in ('02 鎺ュ彈','01 鍒嗛厤')];//2022-4-28 yjk 鎺掗櫎鎺夊凡缁忓畬鎴愮殑浜嬩欢
}
if (eventList.size() > 0) {
@@ -384,6 +384,7 @@
insert eveCloneList;
update taskList;
}
+
}
@@ -409,7 +410,29 @@
// 鍙栧緱User瀹℃壒浜�
List<User> uList = new List<User>();
if (userFlg) {
- uList = [select Id, SalesManager__c, SalesManager__r.Name from user where SalesManager__r.IsActive = true And id = :UserInfo.getUserId()];
+ //2022-07-20 zyh update SWAG-CGG7X9 start
+ // uList = [select Id, SalesManager__c, SalesManager__r.Name from user where SalesManager__r.IsActive = true And id = :UserInfo.getUserId()];
+ uList = [select Id,
+ SalesManager__c,
+ SalesManager__r.Name,
+ BuchangApprovalManagerSales__c,
+ BuchangApprovalManagerSales__r.Name,
+ Buzhang_Equipment_Manager__c,
+ // Buzhang_Equipment_Manager__r.Name,
+ ZongjianApprovalManager__c,
+ // ZongjianApprovalManager__r.Name,
+ TongkuoZongjian__c,
+ TongkuoZongjianHD__c,
+ // TongkuoZongjian__r.Name,
+ SalesManager__r.IsActive,
+ BuchangApprovalManagerSales__r.IsActive,
+ Buzhang_Equipment_Manager__r.IsActive,
+ ZongjianApprovalManager__r.IsActive,
+ TongkuoZongjian__r.IsActive,
+ TongkuoZongjianHD__r.IsActive,
+ Salesdepartment__c
+ from user where id = :UserInfo.getUserId()];
+ //2022-07-20 zyh update SWAG-CGG7X9 end
}
// 璁剧疆瀹℃壒浜�
@@ -418,8 +441,33 @@
&& (String.isBlank(oldMap.get(n.Id).Status__c) || oldMap.get(n.Id).Status__c.equals('鑽夋涓�')))
|| ((String.isNotBlank(n.noReportStatus__c) && n.noReportStatus__c.equals('鎻愪氦')
&& (String.isBlank(oldMap.get(n.Id).noReportStatus__c) || oldMap.get(n.Id).noReportStatus__c.equals('宸蹭繚瀛�'))))) {
-
- if (uList.size() > 0) {
+ //2022-07-20 zyh update SWAG-CGG7X9 start
+ if (uList[0].SalesManager__r.IsActive == true || String.isNotBlank(uList[0].SalesManager__c)) {
+ n.SalesManager__c = uList[0].SalesManager__c;
+ n.SalesManager_Txt__c = uList[0].SalesManager__r.Name;
+ }
+ if ('OPD'.equals(n.RentalReson__c) && String.isBlank(n.Related_Opportunity1_Name__c) && String.isBlank(n.Related_Opportunity2_Name__c)) {
+ if (uList[0].BuchangApprovalManagerSales__r.IsActive == true || String.isNotBlank(uList[0].BuchangApprovalManagerSales__c)) {
+ n.BuchangApprovalManagerSales__c = uList[0].BuchangApprovalManagerSales__c;
+ n.BuchangApprovalManagerSales_Txt__c = uList[0].BuchangApprovalManagerSales__r.Name;
+ }
+ if (uList[0].Buzhang_Equipment_Manager__r.IsActive == true || String.isNotBlank(uList[0].Buzhang_Equipment_Manager__c)) {
+ n.Buzhang_Equipment_Manager__c = uList[0].Buzhang_Equipment_Manager__c;
+ }
+ if (uList[0].ZongjianApprovalManager__r.IsActive == true || String.isNotBlank(uList[0].ZongjianApprovalManager__c)) {
+ n.ZongjianApprovalManager__c = uList[0].ZongjianApprovalManager__c;
+ }
+ if (uList[0].Salesdepartment__c == '1.鍗庡寳' || uList[0].Salesdepartment__c == '2.涓滃寳') {
+ if (uList[0].TongkuoZongjianHD__r.IsActive == true || String.isNotBlank(uList[0].TongkuoZongjianHD__c)) {
+ n.TongkuoZongjian__c = uList[0].TongkuoZongjianHD__c;
+ }
+ }else{
+ if (uList[0].TongkuoZongjian__r.IsActive == true || String.isNotBlank(uList[0].TongkuoZongjian__c)) {
+ n.TongkuoZongjian__c = uList[0].TongkuoZongjian__c;
+ }
+ }
+ }
+ /*if (uList.size() > 0) {
String MId = uList[0].SalesManager__c;
if (String.isBlank(MId)) {
n.addError('缁忕悊鏃犳晥锛岃鑱旂郴绠$悊鍛樸��');
@@ -431,7 +479,8 @@
}
}else {
n.addError('缁忕悊鏃犳晥/绂昏亴锛岃鑱旂郴绠$悊鍛樸��');
- }
+ }*/ //2022-07-20 zyh update
+ //2022-07-20 zyh update SWAG-CGG7X9 end
}else
//鎺ㄥ箍缁忕悊鍙戠敓鍙樺寲璧嬪�兼枃鏈瓧娈�
if(oldMap.get(n.Id).SalesManager__c != n.SalesManager__c){
@@ -448,7 +497,23 @@
}
}
- }
+ }else //2022-07-22 zyh add start
+ //鎺ㄥ箍鎬荤洃鍙戠敓鍙樺寲璧嬪�兼枃鏈瓧娈�
+ if(oldMap.get(n.Id).BuchangApprovalManagerSales__c != n.BuchangApprovalManagerSales__c){
+ //鎺ㄥ箍鎬荤洃 绛変簬绌�
+ if(String.isBlank(n.BuchangApprovalManagerSales__c)){
+ n.SalesManager_Txt__c = '';
+ }else {
+ List<User> tempUList = new List<User>();
+ tempUList = [select Id, Name from user where IsActive = true And id = :n.BuchangApprovalManagerSales__c];
+ if(tempUList.size() > 0){
+ n.BuchangApprovalManagerSales_Txt__c = tempUList[0].Name;
+ }else {
+ n.addError('鎬荤洃鏃犳晥/绂昏亴锛岃鑱旂郴绠$悊鍛樸��');
+ }
+ }
+
+ }//2022-07-22 zyh add end
}
}
@@ -561,8 +626,7 @@
if(t.OPDType__c=='瀛︿細'){
OpdTargetLastAcc.put(t.id,an.Id+'');//涓婅储骞� dcListMap.keySet() dcListMap.values()
}
- }
-
+ }
}
}
}
@@ -632,6 +696,7 @@
Integer buffer = Integer.valueOf(System.Label.opd_oldDate_update);//涓轰簡鍒锋柊prod涓婄殑鑰佹暟鎹�
//瀛樻斁妯″瀷鍑哄�熼厤濂楃殑id
List<OPDPlan__c> opdModelLendList = new List<OPDPlan__c> ();
+ Map<Id,Id> opdTaskIdMap = new Map<Id,Id>();//2022-6-24 yjk 寤舵湡鏃秓pd鏈搴斿欢鏈熶换鍔�
for (OPDPlan__c t : newList) {
if (Trigger.isUpdate && (oldMap.get(t.id).Status__c != t.Status__c && t.Status__c == '瀹℃壒涓�' || buffer==1)) {
@@ -667,8 +732,24 @@
// SWAG-BXW4AH XHL 20210312 鍥燨PD璁″垝 绯荤粺鑷姩寤舵湡 鍚� 浼氭竻绌� 澶囧搧鍑哄�熶紭鍏堝害涓庢帓搴忔棩鏈�
// 鍥犳 娉ㄦ帀 End
+
+ //2022-6-24 yjk 寤舵湡鏃秓pd鏈搴斿欢鏈熶换鍔� start
+ opdTaskIdMap.put(t.Task_ID__c,t.id);
+ //2022-6-24 yjk 寤舵湡鏃秓pd鏈搴斿欢鏈熶换鍔� end
}
+
+ //2022-6-24 yjk 寤舵湡鏃秓pd鏈搴斿欢鏈熶换鍔� start
+ List<Task__c> taskList = [select id,delayTask__c from Task__c where id in :opdTaskIdMap.keySet()];
+ for(Task__c tsk : taskList){
+ if(tsk != null && tsk.delayTask__c != null){
+ newMap.get(opdTaskIdMap.get(tsk.id)).Task_ID__c = taskList.get(0).delayTask__c;
+
+ }
+ }
+
+ //2022-6-24 yjk 寤舵湡鏃秓pd鏈搴斿欢鏈熶换鍔� end
+
if(opdModelLendList.size()>0){
updateModelLending(opdModelLendList);
}
--
Gitblit v1.9.1