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/ConsumablesApplyOrLendBatch.cls | 357 ++++++++---------------------------------------------------
1 files changed, 49 insertions(+), 308 deletions(-)
diff --git a/force-app/main/default/classes/ConsumablesApplyOrLendBatch.cls b/force-app/main/default/classes/ConsumablesApplyOrLendBatch.cls
index 541446a..f51adc5 100644
--- a/force-app/main/default/classes/ConsumablesApplyOrLendBatch.cls
+++ b/force-app/main/default/classes/ConsumablesApplyOrLendBatch.cls
@@ -67,7 +67,7 @@
query += 'OCM_dept_category__c,ShareFlag__c,Job_Category__c,Strategic_userFSEGI__c,hospitalLeaderGI__c,Strategic_userFSESP__c,hospitalLeaderSP__c, ';
query += 'hospitalLeaderGIchange__c,hospitalLeaderSPchange__c, OPDPlan__r.Status__c,Shippment_ng_num__c,ProducLeader_Share__c, ';
query += ' Hospital__r.GI_Product_Leader__c,Hospital__r.BF_Product_Leader__c,Hospital__r.GS_Product_Leader__c,Hospital__r.URO_Produc_Leader__c,Hospital__r.GYN_Product_Leader__c,Hospital__r.ENT_Product_Leader__c,Hospital__r.ET_Product_Leader__c ';
- query += ' FROM Rental_Apply__c WHERE (ShareFlag__c = true or hospitalLeaderGIchange__c = true or hospitalLeaderSPchange__c = true or (Shippment_ng_num__c = 0 and OPDPlan__c != null and OPDPlan__r.Status__c IN (\'瀹屾瘯鏈姤鍛奬',\'寰呮彁浜ゆ姤鍛奬'))) AND Strategic_dept__c= \''+strategicDept+'\' ORDER BY Strategic_dept__c';
+ query += ' FROM Rental_Apply__c WHERE (ShareFlag__c = true or hospitalLeaderGIchange__c = true or hospitalLeaderSPchange__c = true or (Shippment_ng_num__c = 0 and OPDPlan__c != null and OPDPlan__r.Status__c IN (\'瀹屾瘯鏈姤鍛奬',\'寰呮彁浜ゆ姤鍛奬'))) AND Strategic_dept__c = \''+strategicDept+'\' ORDER BY Strategic_dept__c';
}
//update wangweipeng 鏂板澶囧搧鐨勪骇鍝佹媴褰撲汉鍏变韩 2021/10/15 end
//update by rentx 2020-11-16 SFDC-BVA5VJ end
@@ -75,177 +75,12 @@
update iflog;
return Database.getQueryLocator(query);
}
- //娉ㄩ噴 by rentx 2021-01-04 SFDC-BWQ3MX
- /*global void execute(Database.BatchableContext BC, list<Sobject> scope) {
-
- //add by rentx 2020-11-17 start
- List<Rental_Apply__c> ratList = new List<Rental_Apply__c>();
- List<Rental_Apply__c> raoList = new List<Rental_Apply__c>();
- //add by rentx 2020-11-17 end
-
-
+ global void execute(Database.BatchableContext BC, list<Rental_Apply__c> RentalApply) {
+ // 20220412 ljh 鏁寸悊 start
+ // ShareFlag__c hospitalLeaderGIchange__c hospitalLeaderSPchange__c 涓虹湡鐨勬椂鍊欑┖鏇存柊鍗冲彲
+ Map<String,Rental_Apply__c> raMap = new Map<String,Rental_Apply__c>();
+ // 20220412 ljh 鏁寸悊 end
//鍏变韩鏉冮檺鍙樻洿
- List<Rental_Apply__c> RentalApply = new List<Rental_Apply__c>();
- List<Rental_Apply__c> raList = new List<Rental_Apply__c>();
- List<Rental_Apply__Share> delStrategList = new List<Rental_Apply__Share>();
- List<Rental_Apply__Share> addStrategList = new List<Rental_Apply__Share>();
- List<String> ParentIdList = new List<String>();
- List<String> UserOrGroupIdList = new List<String>();
- Map<String, String> PUMap = new Map<String, String>();
-
- List<String> UserIDList = new List<String>();
- List<String> IsActiveNoList = new List<String>();
- RentalApply = scope;
- if(RentalApply.size()>0){
- //鐢ㄦ埛鏈惎鐢ㄦ棤娉曟彃鍏ュ埌鍏变韩琛� start
- for(Rental_Apply__c ra:RentalApply){
- if(ra.Strategic_user__c !=null){
- UserIDList.add(ra.Strategic_user__c);
- }
- //add by rentx 2020-11-27
- if (ra.Strategic_userFSEGI__c != null) {
- UserIDList.add(ra.Strategic_userFSEGI__c);
- }
- if (ra.Strategic_userFSESP__c != null) {
- UserIDList.add(ra.Strategic_userFSESP__c);
-
- }
- //add by rentx 2020-11-27
-
- }
- for(User user:[Select Id,Name,IsActive From User WHERE Id in:UserIDList]){
- //鏈惎鐢�
- if(!user.IsActive){
- String userId = (String)user.Id;
- userId = userId.substring(0,15);
- IsActiveNoList.add(userId);
- }
- }
- //鐢ㄦ埛鏈惎鐢ㄦ棤娉曟彃鍏ュ埌鍏变韩琛� end
- for(Rental_Apply__c ra:RentalApply){
- //鍒犻櫎鍘熸潵鐨勫叡浜�
- if(String.isNotBlank(ra.ShareStrategicUser__c)){
- PUMap.put(ra.Id,ra.ShareStrategicUser__c);
- ParentIdList.add(ra.Id);
- UserOrGroupIdList.add(ra.ShareStrategicUser__c);
- }
- //澧炲姞鏂扮殑
- //鎵�鏈夎�呰繕鏈夋湇鍔℃湇鍔¢儴瀹℃壒浜虹浉鍚屼笉鐢ㄥ姞 鐢ㄦ埛鏈惎鐢ㄦ棤娉曟彃鍏ュ埌鍏变韩琛�
- if(ra.Strategic_user__c !=null&& !IsActiveNoList.contains(ra.Strategic_user__c)){
- if(
- ((ra.Approver_of_Service_Department__c !=null&&!ra.Strategic_user__c.equals(ra.Approver_of_Service_Department__c))||ra.Approver_of_Service_Department__c ==null)
- &&!ra.Strategic_user__c.equals(ra.OwnerId)){
- Rental_Apply__Share ras = new Rental_Apply__Share(
- RowCause = 'Manual',
- ParentId = ra.Id,
- UserOrGroupId = ra.Strategic_user__c,
- AccessLevel = 'read'
- );
-
- addStrategList.add(ras);
- }
- Rental_Apply__c r_a = new Rental_Apply__c();
- r_a.Id = ra.Id;
- r_a.ShareStrategicUser__c = ra.Strategic_user__c;
- raList.add(r_a);
- }
-
- //add by rentx 2020-11-16 SFDC-BVA5VJ start
- //鍒ゆ柇鎴樼暐绉戝 鐩存帴鍒犱簡鍐嶅姞
- String dept = ra.OCM_dept_category__c;
- if ((ra.Job_Category__c =='閿�鍞湇鍔�') && (dept.equals('娑堝寲绉�') ||dept.equals('鍛煎惛绉�') || dept.equals('ET') || dept.equals('鍏朵粬'))
- && ra.Strategic_userFSEGI__c != null && !IsActiveNoList.contains(ra.Strategic_userFSEGI__c) && !ra.OwnerId.equals(ra.Strategic_userFSEGI__c)) {
- //鍔犲叆鍏变韩
- Rental_Apply__Share ras = makeData(ra.Id,ra.Strategic_userFSEGI__c);
- addStrategList.add(ras);
- //鍒犻櫎鍘熸潵鐨勫叡浜�
- PUMap.put(ra.Id,ra.hospitalLeaderGI__c);
- ParentIdList.add(ra.Id);
- UserOrGroupIdList.add(ra.hospitalLeaderGI__c);
- if (String.isNotBlank(ra.hospitalLeaderSP__c)) {
- PUMap.put(ra.Id,ra.hospitalLeaderSP__c);
- UserOrGroupIdList.add(ra.hospitalLeaderSP__c);
- }
- //鏇存柊瀛楁
- Rental_Apply__c rac = new Rental_Apply__c();
- rac.Id = ra.Id;
- rac.hospitalLeaderGI__c = ra.Strategic_userFSEGI__c;
- ratList.add(rac);
-
- }
- if ((ra.Job_Category__c =='閿�鍞湇鍔�') &&
- (dept.equals('鏅绉�') ||dept.equals('娉屽翱绉�') || dept.equals('濡囩') || dept.equals('鑰抽蓟鍠夌') || dept.equals('鍏朵粬'))
- && ra.Strategic_userFSESP__c != null && !IsActiveNoList.contains(ra.Strategic_userFSESP__c) && !ra.OwnerId.equals(ra.Strategic_userFSESP__c)) {
- //鍔犲叆鍏变韩
- Rental_Apply__Share ras = makeData(ra.Id,ra.Strategic_userFSESP__c);
- addStrategList.add(ras);
- //鍒犻櫎鍘熸潵鐨勫叡浜�
- PUMap.put(ra.Id,ra.hospitalLeaderSP__c);
- ParentIdList.add(ra.Id);
- UserOrGroupIdList.add(ra.hospitalLeaderSP__c);
- if (String.isNotBlank(ra.hospitalLeaderGI__c)) {
- PUMap.put(ra.Id,ra.hospitalLeaderGI__c);
- UserOrGroupIdList.add(ra.hospitalLeaderGI__c);
- }
- //鏇存柊瀛楁
- Rental_Apply__c rac = new Rental_Apply__c();
- rac.Id = ra.Id;
- rac.hospitalLeaderSP__c = ra.Strategic_userFSESP__c;
- raoList.add(rac);
-
- }
-
-
- }
- //鍒犻櫎鍘熸潵鐨勫叡浜�
- delStrategList = [SELECT Id,ParentId,UserOrGroupId FROM Rental_Apply__Share WHERE RowCause ='Manual' AND ParentId in :ParentIdList AND UserOrGroupId in :UserOrGroupIdList];
- for(Integer m=0; m<delStrategList.size(); m++){
- if(String.isBlank(PUMap.get(delStrategList[m].ParentId))){
- delStrategList.remove(m);
- }
- }
- if(delStrategList.size()>0){
- delete delStrategList;
- }
- //澧炲姞
- if (addStrategList.size() > 0) {
- insert addStrategList;
- }
- //鏇存柊澶囧搧鍊熷嚭
- if(raList.size()>0){
- update raList;
- }
-
- //鏇存柊澶囧搧鍊熷嚭 -- hospleaderGI瀛楁
- if (ratList.size() > 0) {
- update ratList;
- }
- //鏇存柊澶囧搧鍊熷嚭 -- hospleaderSP瀛楁
- if (raoList.size() > 0) {
- update raoList;
- }
- }
- }*/
- //update by rentx 2021-01-04 SFDC-BWQ3MX
- global void execute(Database.BatchableContext BC, list<Sobject> scope) {
- //鍘熸潵鐨勬槸灏嗘垬鐣ョ瀹ゆ墍鏈変汉鍔犲叆鍒板叡浜〃涓� 鐜板湪闇�瑕佸皢GI/SP涓绘媴褰撲篃鍔犲叆骞朵笖鍒犻櫎涔嬪墠鐨勫叡浜�
- //add by rentx 2020-11-17 start
- List<Rental_Apply__c> ratList = new List<Rental_Apply__c>();
- List<Rental_Apply__c> raoList = new List<Rental_Apply__c>();
- //add by rentx 2020-11-17 end
-
- //鍏变韩鏉冮檺鍙樻洿
- List<Rental_Apply__c> RentalApply = new List<Rental_Apply__c>();
- List<Rental_Apply__c> raList = new List<Rental_Apply__c>();
- List<Rental_Apply__Share> delStrategList = new List<Rental_Apply__Share>();
- List<Rental_Apply__Share> addStrategList = new List<Rental_Apply__Share>();
- List<String> ParentIdList = new List<String>();
- List<String> UserOrGroupIdList = new List<String>();
- Map<String, String> PUMap = new Map<String, String>();
-
- List<String> UserIDList = new List<String>();
- List<String> IsActiveNoList = new List<String>();
-
//add wangweipeng 鏂板澶囧搧鐨勪骇鍝佹媴褰撲汉鍏变韩 2021/10/15 start
//鏀堕泦浜у搧鎷呭綋浜轰腑鏂囧悕
List<String> productLeaderNameList = new List<String>();
@@ -257,29 +92,15 @@
//鏂板鍊熷嚭澶囧搧鐢宠浜у搧鎷呭綋鍏变韩浜�
List<Rental_Apply__Share> insRentalApplyShare = new List<Rental_Apply__Share>();
//淇敼鍊熷嚭澶囧搧鐢宠鐨勪骇鍝佹媴褰撲汉鍏变韩璁板綍
- List<Rental_Apply__c> updateRac = new List<Rental_Apply__c>();
+ // List<Rental_Apply__c> updateRac = new List<Rental_Apply__c>();
//鑾峰彇鎵�鏈夋弧瓒虫潯浠剁殑澶囧搧id
List<String> raIdList = new List<String>();
//鑾峰彇澶囧搧鐨勪骇鍝佹媴褰撲汉鍏变韩鏁版嵁
Map<String,List<Rental_Apply__Share>> raShareMap = new Map<String,List<Rental_Apply__Share>>();
//add wangweipeng 鏂板澶囧搧鐨勪骇鍝佹媴褰撲汉鍏变韩 2021/10/15 end
-
-
- RentalApply = scope;
+ System.debug('zheli000');
if(RentalApply.size()>0){
- //鐢ㄦ埛鏈惎鐢ㄦ棤娉曟彃鍏ュ埌鍏变韩琛� start
for(Rental_Apply__c ra:RentalApply){
- if(ra.Strategic_user__c !=null){
- UserIDList.add(ra.Strategic_user__c);
- }
- //add by rentx 鍒ゆ柇鐢ㄦ埛鏄惁鍚敤
- if (ra.Strategic_userFSEGI__c != null) {
- UserIDList.add(ra.Strategic_userFSEGI__c);
- }
- if (ra.Strategic_userFSESP__c != null) {
- UserIDList.add(ra.Strategic_userFSESP__c);
- }
- //add by rentx
//add wangweipeng 鏂板澶囧搧鐨勪骇鍝佹媴褰撲汉鍏变韩 2021/10/15 start
//鏀堕泦浜у搧鎷呭綋浜� 鍙敹闆� opd璁″垝涓哄畬姣曟湭鎶ュ憡 澶囧搧 鍑哄簱鏈畬浜嗘暟 绛変簬0锛堝凡鍑哄簱锛�
//鏀堕泦鐨勪骇鍝佹媴褰撲汉涓轰腑鏂囧悕
@@ -297,22 +118,13 @@
}
//add wangweipeng 鏂板澶囧搧鐨勪骇鍝佹媴褰撲汉鍏变韩 2021/10/15 end
}
- for(User user:[Select Id,Name,IsActive From User WHERE Id in:UserIDList]){
- //鏈惎鐢�
- if(!user.IsActive){
- String userId = (String)user.Id;
- userId = userId.substring(0,15);
- IsActiveNoList.add(userId);
- }
- }
-
//add wangweipeng 鏂板澶囧搧鐨勪骇鍝佹媴褰撲汉鍏变韩 2021/10/15 start
//鐢变簬浜у搧鎷呭綋鑾峰彇鐨勯兘鏄腑鏂囧悕瀛楋紝鎵�浠ラ渶瑕佽幏鍙栧埌浠栫殑id锛屽苟涓斿幓鎺夋病鍚敤鐨勪汉鍛�
List<User> userList;
if(productLeaderNameList.size() > 0){
- for(String ss : productLeaderNameList){
- // System.debug('---------------'+ss);
- }
+ // for(String ss : productLeaderNameList){
+ // // System.debug('---------------'+ss);
+ // }
//鑾峰彇鎷呭綋浜虹殑user瀵硅薄
userList = [select id,name,Alias,Alias__c from user where IsActive = true and Alias__c != null and Alias__c = :productLeaderNameList order by CreatedDate desc];
}else{
@@ -334,70 +146,25 @@
}
}
}
+ System.debug('zheli00');
//add wangweipeng 鏂板澶囧搧鐨勪骇鍝佹媴褰撲汉鍏变韩 2021/10/15 end
-
- //鐢ㄦ埛鏈惎鐢ㄦ棤娉曟彃鍏ュ埌鍏变韩琛� end
for(Rental_Apply__c ra:RentalApply){
- //濡傛灉鎴樼暐绉戝涓绘媴褰撳彂鐢熷彉鏇� --涔嬪墠鐨勯�昏緫 update by rentx 2021-01-04 SFDC-BWQ3MX
+ //濡傛灉鎴樼暐绉戝涓绘媴褰撳彂鐢熷彉鏇�
if (ra.ShareFlag__c == true) {
- //鍒犻櫎鍘熸潵鐨勫叡浜�
- if(String.isNotBlank(ra.ShareStrategicUser__c)){
- PUMap.put(ra.Id,ra.ShareStrategicUser__c);
- ParentIdList.add(ra.Id);
- UserOrGroupIdList.add(ra.ShareStrategicUser__c);
+ raMap.put(ra.Id,new Rental_Apply__c(id=ra.Id)); // 20220412 ljh add
+ //add wangweipeng 鏂板澶囧搧鐨勪骇鍝佹媴褰撲汉鍏变韩 2021/10/15 start
+ //鏉冮檺琛ㄤ腑鐨勬垬鐣ョ瀹や富鎷呭綋 瀛楁鍙戠敓鍙樺寲锛岄偅涔堣褰曚竴涓嬪綋鍓嶄慨鏀圭殑鍐呭
+ if(RentalApplyMapData.containsKey(ra.Id)){
+ Rental_Apply__c raa = RentalApplyMapData.get(ra.Id);
+ raa.ShareStrategicUser__c = ra.Strategic_user__c;
+ RentalApplyMapData.put(raa.id,raa);
}
- //澧炲姞鏂扮殑
- //鎵�鏈夎�呰繕鏈夋湇鍔℃湇鍔¢儴瀹℃壒浜虹浉鍚屼笉鐢ㄥ姞 鐢ㄦ埛鏈惎鐢ㄦ棤娉曟彃鍏ュ埌鍏变韩琛�
- if(ra.Strategic_user__c !=null&& (IsActiveNoList.size() ==0 || !IsActiveNoList.contains(ra.Strategic_user__c))){
- if(
- ((ra.Approver_of_Service_Department__c !=null&&!ra.Strategic_user__c.equals(ra.Approver_of_Service_Department__c))||ra.Approver_of_Service_Department__c ==null)
- &&!ra.Strategic_user__c.equals(ra.OwnerId)){
- Rental_Apply__Share ras = new Rental_Apply__Share(
- RowCause = 'Manual',
- ParentId = ra.Id,
- UserOrGroupId = ra.Strategic_user__c,
- AccessLevel = 'read'
- );
-
- addStrategList.add(ras);
- }
- Rental_Apply__c r_a = new Rental_Apply__c();
- r_a.Id = ra.Id;
- r_a.ShareStrategicUser__c = ra.Strategic_user__c;
- raList.add(r_a);
-
- //add wangweipeng 鏂板澶囧搧鐨勪骇鍝佹媴褰撲汉鍏变韩 2021/10/15 start
- //鏉冮檺琛ㄤ腑鐨勬垬鐣ョ瀹や富鎷呭綋 瀛楁鍙戠敓鍙樺寲锛岄偅涔堣褰曚竴涓嬪綋鍓嶄慨鏀圭殑鍐呭
- if(RentalApplyMapData.containsKey(ra.Id)){
- Rental_Apply__c raa = RentalApplyMapData.get(ra.Id);
- raa.ShareStrategicUser__c = ra.Strategic_user__c;
- RentalApplyMapData.put(raa.id,raa);
- }
- //add wangweipeng 鏂板澶囧搧鐨勪骇鍝佹媴褰撲汉鍏变韩 2021/10/15 end
- }
+ //add wangweipeng 鏂板澶囧搧鐨勪骇鍝佹媴褰撲汉鍏变韩 2021/10/15 end
}
//update by rentx 2021-01-04 SFDC-BWQ3MX
//濡傛灉鎴樼暐绉戝GI鎷呭綋鍙戠敓鍙樻洿
if (ra.hospitalLeaderGIchange__c == true) {
- //鍒犻櫎鍘熸潵鐨勫叡浜�
- if(String.isNotBlank(ra.hospitalLeaderGI__c)){
- PUMap.put(ra.Id,ra.hospitalLeaderGI__c);
- ParentIdList.add(ra.Id);
- UserOrGroupIdList.add(ra.hospitalLeaderGI__c);
- }
- //鍒ゆ柇
- String dept = ra.OCM_dept_category__c;
- if (ra.Strategic_userFSEGI__c != null && (IsActiveNoList.size() ==0 || !IsActiveNoList.contains(ra.Strategic_userFSEGI__c)) && !ra.OwnerId.equals(ra.Strategic_userFSEGI__c)) {
- //鍔犲叆鍏变韩
- Rental_Apply__Share ras = makeData(ra.Id,ra.Strategic_userFSEGI__c);
- addStrategList.add(ras);
- }
- //鏇存柊瀛楁
- Rental_Apply__c rac = new Rental_Apply__c();
- rac.Id = ra.Id;
- rac.hospitalLeaderGI__c = ra.Strategic_userFSEGI__c;
- ratList.add(rac);
-
+ raMap.put(ra.Id,new Rental_Apply__c(id=ra.Id)); // 20220412 ljh add
//add wangweipeng 鏂板澶囧搧鐨勪骇鍝佹媴褰撲汉鍏变韩 2021/10/15 start
//鎴樼暐绉戝FSEGI鎷呭綋 鍙戠敓鍙樺寲锛岃褰曚竴涓嬪鍝佷慨鏀圭殑鍐呭
if(RentalApplyMapData.containsKey(ra.Id)){
@@ -410,24 +177,7 @@
//update by rentx 2021-01-04 SFDC-BWQ3MX
//濡傛灉鎴樼暐绉戝SP鎷呭綋鍙戠敓鍙樻洿
if (ra.hospitalLeaderSPchange__c == true) {
- //鍒犻櫎鍘熸潵鐨勫叡浜�
- if(String.isNotBlank(ra.hospitalLeaderSP__c)){
- PUMap.put(ra.Id,ra.hospitalLeaderSP__c);
- ParentIdList.add(ra.Id);
- UserOrGroupIdList.add(ra.hospitalLeaderSP__c);
- }
- //鍒ゆ柇
- if (ra.Strategic_userFSESP__c != null && (IsActiveNoList.size() ==0 || !IsActiveNoList.contains(ra.Strategic_userFSESP__c)) && !ra.OwnerId.equals(ra.Strategic_userFSESP__c)) {
- //鍔犲叆鍏变韩
- Rental_Apply__Share ras = makeData(ra.Id,ra.Strategic_userFSESP__c);
- addStrategList.add(ras);
- }
- //鏇存柊瀛楁
- Rental_Apply__c rac = new Rental_Apply__c();
- rac.Id = ra.Id;
- rac.hospitalLeaderSP__c = ra.Strategic_userFSESP__c;
- raoList.add(rac);
-
+ raMap.put(ra.Id,new Rental_Apply__c(id=ra.Id)); // 20220412 ljh add
//add wangweipeng 鏂板澶囧搧鐨勪骇鍝佹媴褰撲汉鍏变韩 2021/10/15 start
//鎴樼暐绉戝FSESP鎷呭綋 鍙戠敓鍙樺寲锛岃褰曚竴涓嬩慨鏀瑰唴瀹�
if(RentalApplyMapData.containsKey(ra.Id)){
@@ -543,16 +293,22 @@
insRentalApplyShare.add(makeData3(newRA.id,userId));
}
}
+ // 20220413 ljh update start
//淇敼澶囧搧鐨勪骇鍝佹媴褰撲汉瀛楁鍊�
- updateRac.add(new Rental_Apply__c(id=newRA.id,ProducLeader_Share__c=productLeaderUserIdStr));
+ // updateRac.add(new Rental_Apply__c(id=newRA.id,ProducLeader_Share__c=productLeaderUserIdStr));
+ raMap.put(newRA.id,new Rental_Apply__c(id=newRA.id,ProducLeader_Share__c=productLeaderUserIdStr));
+ // 20220413 ljh update end
}
}
}else{
//濡傛灉 ProducLeader_Share__c 瀛楁涓嶄负绌猴紝骞朵笖娌℃湁鎵惧埌褰撳墠澶囧搧闇�瑕佸叡浜殑浜у搧鎷呭綋浜�
//璇佹槑浠ュ墠鍏变韩浜嗕骇鍝佹媴褰撲汉锛屼絾鏄幇鍦ㄤ骇鍝佹媴褰撲汉鍋氫簡淇敼锛堢郴缁熶腑娌℃壘鍒版垨姝や汉宸茬粡閫氳繃鍏跺畠鍏变韩鍘熷洜鍏变韩浜嗭級鎴栧埗绌轰簡锛屾墍浠ョ洿鎺ユ妸浠ュ墠鍏变韩鐨勪汉鍒犻櫎鎺夊氨琛�
delRentalApplyShare.add(newRA.id);
+ // 20220413 ljh update start
//淇敼澶囧搧鐨勪骇鍝佹媴褰撲汉瀛楁鍊�
- updateRac.add(new Rental_Apply__c(id=newRA.id,ProducLeader_Share__c=''));
+ // updateRac.add(new Rental_Apply__c(id=newRA.id,ProducLeader_Share__c=''));
+ raMap.put(newRA.id,new Rental_Apply__c(id=newRA.id,ProducLeader_Share__c=''));
+ // 20220413 ljh update end
}
}else{
//濡傛灉ProducLeader_Share__c瀛楁涓虹┖锛屽苟涓斿綋鍓嶅鍝佺殑浜у搧鎷呭綋浜洪渶瑕佸叡浜紝閭d箞灏遍渶瑕佹垜浠柊澧炲叡浜紝骞舵妸鍏变韩浜篿d锛岃褰曞埌褰撳墠澶囧搧涓�
@@ -566,8 +322,11 @@
insRentalApplyShare.add(makeData3(newRA.id,userId));
}
}
+ // 20220413 ljh update start
//淇敼澶囧搧鐨勪骇鍝佹媴褰撲汉瀛楁鍊�
- updateRac.add(new Rental_Apply__c(id=newRA.id,ProducLeader_Share__c=productLeaderUserIdStr));
+ // updateRac.add(new Rental_Apply__c(id=newRA.id,ProducLeader_Share__c=productLeaderUserIdStr));
+ raMap.put(newRA.id,new Rental_Apply__c(id=newRA.id,ProducLeader_Share__c=productLeaderUserIdStr));
+ // 20220413 ljh update end
}
}
}
@@ -575,43 +334,18 @@
//濡傛灉娌℃湁浜у搧褰撲絾浜猴紝浣嗘槸瀛楁涓嶄负绌猴紝閭d箞璇佹槑锛屽綋鍓嶅鍝佺殑浜у搧鎷呭綋浜烘湁鍙樺姩鍊艰缃负绌轰簡锛岄偅涔堟垜浠渶瑕佸鐞嗕互鍓嶅凡缁忓叡浜殑浜у搧鎷呭綋浜�
if(String.isNotBlank(ra.ProducLeader_Share__c)){
delRentalApplyShare.add(ra.id);
+ // 20220413 ljh update start
//淇敼澶囧搧鐨勪骇鍝佹媴褰撲汉瀛楁鍊�
- updateRac.add(new Rental_Apply__c(id=ra.id,ProducLeader_Share__c=''));
+ // updateRac.add(new Rental_Apply__c(id=ra.id,ProducLeader_Share__c=''));
+ raMap.put(ra.Id,new Rental_Apply__c(id=ra.id,ProducLeader_Share__c=''));
+ // 20220413 ljh update end
}
}
}
//add wangweipeng 鏂板澶囧搧鐨勪骇鍝佹媴褰撲汉鍏变韩 2021/10/15 end
}
- //鍒犻櫎鍘熸潵鐨勫叡浜�
- delStrategList = [SELECT Id,ParentId,UserOrGroupId FROM Rental_Apply__Share WHERE RowCause ='Manual' AND ParentId in :ParentIdList AND UserOrGroupId in :UserOrGroupIdList];
- for(Integer m=0; m<delStrategList.size(); m++){
- if(String.isBlank(PUMap.get(delStrategList[m].ParentId))){
- delStrategList.remove(m);
- }
- }
Savepoint sp = Database.setSavepoint();
- try{
- if(delStrategList.size()>0){
- delete delStrategList;
- }
- //澧炲姞
- if (addStrategList.size() > 0) {
- insert addStrategList;
- }
- //鏇存柊澶囧搧鍊熷嚭
- if(raList.size()>0){
- update raList;
- }
- //鏇存柊澶囧搧鍊熷嚭GI
- if (ratList.size() > 0) {
- update ratList;
- }
- //鏇存柊澶囧搧鍊熷嚭SP
- if (raoList.size() > 0) {
- update raoList;
- }
- //add by rentx 2021-01-04 SFDC-BWQ3MX start
-
+ try{
//add wangweipeng 鏂板澶囧搧鐨勪骇鍝佹媴褰撲汉鍏变韩 2021/10/18 start
//浠ヤ笅鏄鍝佸�熷嚭鐢宠鐨勪骇鍝佹媴褰撲汉鍏变韩
//鍒犻櫎鍘熸潵鐨勪骇鍝佹媴褰撳叡浜汉
@@ -625,10 +359,17 @@
if(insRentalApplyShare != null && insRentalApplyShare.size() > 0){
insert insRentalApplyShare;
}
+ // 20220413 ljh update start
//淇敼浜у搧鎷呭綋鍏变韩浜�
- if(updateRac != null && updateRac.size() > 0){
- update updateRac;
+ // if(updateRac != null && updateRac.size() > 0){
+ // update updateRac;
+ // }
+ // System.debug('zheli:'+raMap.size());
+ if(raMap != null && raMap.size() > 0){
+ // System.debug('zheli:'+raMap.values());
+ update raMap.values();
}
+ // 20220413 ljh update end
//add wangweipeng 鏂板澶囧搧鐨勪骇鍝佹媴褰撲汉鍏变韩 2021/10/18 end
}catch(Exception e){
--
Gitblit v1.9.1