From b606e20fed40239d3520f0576f99167ea48e1834 Mon Sep 17 00:00:00 2001
From: 李金换 <lijinhuan@prec-tech.com>
Date: 星期三, 30 十一月 2022 16:02:59 +0800
Subject: [PATCH] 询价状态2

---
 force-app/main/default/classes/EnquiryBoostTypeBatch.cls |   67 +++++++++++++++++++++------------
 1 files changed, 43 insertions(+), 24 deletions(-)

diff --git a/force-app/main/default/classes/EnquiryBoostTypeBatch.cls b/force-app/main/default/classes/EnquiryBoostTypeBatch.cls
index 9553ee7..921d1c2 100644
--- a/force-app/main/default/classes/EnquiryBoostTypeBatch.cls
+++ b/force-app/main/default/classes/EnquiryBoostTypeBatch.cls
@@ -42,41 +42,58 @@
     global void execute(Database.BatchableContext BC, list<Rental_Apply__c> scope) {
         if(scope != null && scope.size() > 0){
             List<Rental_Apply__c> addListRentalApply = new List<Rental_Apply__c>();
+            // 20221129 ljh DB202211366462 璇环鐘舵��2 start
+            String InquiryStatusMapping = System.Label.Inquiry_Status_Mapping;
+            Map<String, Object> mapping = (Map<String, Object>) JSON.deserializeUntyped(InquiryStatusMapping);
+            // 20221129 ljh DB202211366462 璇环鐘舵��2 end
             for(Rental_Apply__c ra : scope){
                 String newFollowPclStatus2Text = ra.Follow_pcl_status2_Text__c;
                 String newFollowPclStatus2 = ra.Follow_pcl_status2__c;
                 Rental_Apply__c raData = new Rental_Apply__c();
                 raData.id = ra.id;
+                
                 if(newFollowPclStatus2Text != null){
+                    // 20221129 ljh DB202211366462 璇环鐘舵��2 start
                     //璺熻繘涓�
-                    if(newFollowPclStatus2Text == '寮曞悎 : -' || newFollowPclStatus2Text == '寮曞悎 : 00 杩樻病鏇存柊' || newFollowPclStatus2Text == '寮曞悎 : 01 杩樻病鎷滆' || newFollowPclStatus2Text == '寮曞悎 : 02 璺熻繘涓�'){
-                        raData.Inquiry_Status_History__c = 1;
-                    }else if(newFollowPclStatus2Text == '寮曞悎 : 03 宸叉巿鏉�'){//宸叉巿鏉�
-                        raData.Inquiry_Status_History__c = 2;
-                    }else if(newFollowPclStatus2Text == '寮曞悎 : 04 宸蹭腑鏍�' || newFollowPclStatus2Text == '寮曞悎 : 05 浠锋牸鐢宠涓�' || newFollowPclStatus2Text == '寮曞悎 : 06 鐢ㄦ埛鏈绾�' || newFollowPclStatus2Text == '寮曞悎 : 07 鐢ㄦ埛宸茬绾�'
-                         || newFollowPclStatus2Text == '寮曞悎 : 08 宸茬绾�'){//鍑嗗绛剧害
-                        raData.Inquiry_Status_History__c = 3;
-                    }else if(newFollowPclStatus2Text == '鍑鸿嵎 : -' || newFollowPclStatus2Text == '瀹屼簡 : -'  || newFollowPclStatus2Text == '娉ㄦ畫 : -' || newFollowPclStatus2Text == '瀹屼簡 : 08 宸茬绾�'){//宸茶璐�
-                        raData.Inquiry_Status_History__c = 4;
-                    }else if(newFollowPclStatus2Text == '鍓婇櫎 : 17 鍙栨秷' || newFollowPclStatus2Text == '鏁楁垿 : 18 澶卞崟'){//0.鍙栨秷  0.澶卞崟 
-                        raData.Inquiry_Status_History__c = 0;
-                    }
+                    // if(newFollowPclStatus2Text == '寮曞悎 : -' || newFollowPclStatus2Text == '寮曞悎 : 00 杩樻病鏇存柊' || newFollowPclStatus2Text == '寮曞悎 : 01 杩樻病鎷滆' || newFollowPclStatus2Text == '寮曞悎 : 02 璺熻繘涓�'){
+                    //     raData.Inquiry_Status_History__c = 1;
+                    // }else if(newFollowPclStatus2Text == '寮曞悎 : 03 宸叉巿鏉�'){//宸叉巿鏉�
+                    //     raData.Inquiry_Status_History__c = 2;
+                    // }else if(newFollowPclStatus2Text == '寮曞悎 : 04 宸蹭腑鏍�' || newFollowPclStatus2Text == '寮曞悎 : 05 浠锋牸鐢宠涓�' || newFollowPclStatus2Text == '寮曞悎 : 06 鐢ㄦ埛鏈绾�' || newFollowPclStatus2Text == '寮曞悎 : 07 鐢ㄦ埛宸茬绾�'
+                    //      || newFollowPclStatus2Text == '寮曞悎 : 08 宸茬绾�'){//鍑嗗绛剧害
+                    //     raData.Inquiry_Status_History__c = 3;
+                    // }else if(newFollowPclStatus2Text == '鍑鸿嵎 : -' || newFollowPclStatus2Text == '瀹屼簡 : -'  || newFollowPclStatus2Text == '娉ㄦ畫 : -' || newFollowPclStatus2Text == '瀹屼簡 : 08 宸茬绾�'){//宸茶璐�
+                    //     raData.Inquiry_Status_History__c = 4;
+                    // }else if(newFollowPclStatus2Text == '鍓婇櫎 : 17 鍙栨秷' || newFollowPclStatus2Text == '鏁楁垿 : 18 澶卞崟'){//0.鍙栨秷  0.澶卞崟 
+                    //     raData.Inquiry_Status_History__c = 0;
+                    // }
+                    raData.Inquiry_Status_History__c = mapping.get(newFollowPclStatus2Text) != null ? Integer.valueOf(mapping.get(newFollowPclStatus2Text)) : null;
+                    // System.debug('zheli00:'+mapping.get(newFollowPclStatus2Text));
+                    // 20221129 ljh DB202211366462 璇环鐘舵��2 end
                 }
                 if(newFollowPclStatus2 != null){
+                    // 20221129 ljh DB202211366462 璇环鐘舵��2 start
                     //璺熻繘涓�
-                    if(newFollowPclStatus2 == '寮曞悎 : -' || newFollowPclStatus2 == '寮曞悎 : 00 杩樻病鏇存柊' || newFollowPclStatus2 == '寮曞悎 : 01 杩樻病鎷滆' || newFollowPclStatus2 == '寮曞悎 : 02 璺熻繘涓�'){
-                        raData.Inquiry_Status_Now__c = 1;
-                    }else if(newFollowPclStatus2 == '寮曞悎 : 03 宸叉巿鏉�'){//宸叉巿鏉�
-                        raData.Inquiry_Status_Now__c = 2;
-                    }else if(newFollowPclStatus2 == '寮曞悎 : 04 宸蹭腑鏍�' || newFollowPclStatus2 == '寮曞悎 : 05 浠锋牸鐢宠涓�' || newFollowPclStatus2 == '寮曞悎 : 06 鐢ㄦ埛鏈绾�' || newFollowPclStatus2 == '寮曞悎 : 07 鐢ㄦ埛宸茬绾�'
-                         || newFollowPclStatus2 == '寮曞悎 : 08 宸茬绾�'){//鍑嗗绛剧害
-                        raData.Inquiry_Status_Now__c = 3;
-                    }else if(newFollowPclStatus2 == '鍑鸿嵎 : -' || newFollowPclStatus2 == '瀹屼簡 : -'  || newFollowPclStatus2 == '娉ㄦ畫 : -' || newFollowPclStatus2 == '瀹屼簡 : 08 宸茬绾�'){//宸茶璐�
-                        raData.Inquiry_Status_Now__c = 4;
-                    }else if(newFollowPclStatus2 == '鍓婇櫎 : 17 鍙栨秷' || newFollowPclStatus2 == '鏁楁垿 : 18 澶卞崟'){//0.鍙栨秷  0.澶卞崟
-                        raData.Inquiry_Status_Now__c = 0;
-                    }
+                    // if(newFollowPclStatus2 == '寮曞悎 : -' || newFollowPclStatus2 == '寮曞悎 : 00 杩樻病鏇存柊' || newFollowPclStatus2 == '寮曞悎 : 01 杩樻病鎷滆' || newFollowPclStatus2 == '寮曞悎 : 02 璺熻繘涓�'){
+                    //     raData.Inquiry_Status_Now__c = 1;
+                    // }else if(newFollowPclStatus2 == '寮曞悎 : 03 宸叉巿鏉�'){//宸叉巿鏉�
+                    //     raData.Inquiry_Status_Now__c = 2;
+                    // }else if(newFollowPclStatus2 == '寮曞悎 : 04 宸蹭腑鏍�' || newFollowPclStatus2 == '寮曞悎 : 05 浠锋牸鐢宠涓�' || newFollowPclStatus2 == '寮曞悎 : 06 鐢ㄦ埛鏈绾�' || newFollowPclStatus2 == '寮曞悎 : 07 鐢ㄦ埛宸茬绾�'
+                    //      || newFollowPclStatus2 == '寮曞悎 : 08 宸茬绾�'){//鍑嗗绛剧害
+                    //     raData.Inquiry_Status_Now__c = 3;
+                    // }else if(newFollowPclStatus2 == '鍑鸿嵎 : -' || newFollowPclStatus2 == '瀹屼簡 : -'  || newFollowPclStatus2 == '娉ㄦ畫 : -' || newFollowPclStatus2 == '瀹屼簡 : 08 宸茬绾�'){//宸茶璐�
+                    //     raData.Inquiry_Status_Now__c = 4;
+                    // }else if(newFollowPclStatus2 == '鍓婇櫎 : 17 鍙栨秷' || newFollowPclStatus2 == '鏁楁垿 : 18 澶卞崟'){//0.鍙栨秷  0.澶卞崟
+                    //     raData.Inquiry_Status_Now__c = 0;
+                    // }
+                     
+                    
+                    raData.Inquiry_Status_Now__c = mapping.get(newFollowPclStatus2) != null ? Integer.valueOf(mapping.get(newFollowPclStatus2)) : null;
+                    // System.debug('zheli01:'+mapping.get(newFollowPclStatus2));
+                    // 20221129 ljh DB202211366462 璇环鐘舵��2 end
                 }
+                // Boolean aa = raData.Inquiry_Status_Now__c != ra.Inquiry_Status_Now__c;
+                // System.debug('zheli03:'+aa+raData.Inquiry_Status_Now__c +'~~'+ ra.Inquiry_Status_Now__c);
                 //涓轰簡鍑忓皯update锛屽鏋滃�兼病鏈夊彂鐢熷彉鍖栵紝閭d箞涓嶉渶瑕佹洿鏂�
                 if((raData.Inquiry_Status_Now__c != ra.Inquiry_Status_Now__c) || (raData.Inquiry_Status_History__c != ra.Inquiry_Status_History__c)){
                     addListRentalApply.add(raData);
@@ -84,8 +101,10 @@
             }
             Savepoint sp = Database.setSavepoint();
             try{
+                // System.debug('zheli05:');
                 update addListRentalApply;
             }catch(exception e){
+                // System.debug('zheli04:'+e.getMessage());
                 errStr = e.getMessage()+'\n';
                 errStr += e.getLineNumber()+'\n';
                 Database.rollback(sp);

--
Gitblit v1.9.1