From 49dfe80719274f1548737d2e73f78d0604081ccc Mon Sep 17 00:00:00 2001
From: 李彤 <litong@prec-tech.com>
Date: 星期四, 18 五月 2023 10:30:21 +0800
Subject: [PATCH] 青岛拆分代码

---
 force-app/main/default/classes/AWSServiceTool2V2.cls |   79 +++++++++++++++++++++++++++++++++------
 1 files changed, 66 insertions(+), 13 deletions(-)

diff --git a/force-app/main/default/classes/AWSServiceTool2V2.cls b/force-app/main/default/classes/AWSServiceTool2V2.cls
index a8ec45d..1deab34 100644
--- a/force-app/main/default/classes/AWSServiceTool2V2.cls
+++ b/force-app/main/default/classes/AWSServiceTool2V2.cls
@@ -76,18 +76,30 @@
         }
 
         //1.鏌ヨ鍑哄搴斾慨鐞嗙殑鏁版嵁
-        Repair__c repair = [select Id,Hospital__c,address_Contacts__c,AWS_Data_Id__c from Repair__c where id=:rid];
+        // gzw DB202212270703 20230301 澶囧搧鍦板潃瀵煎叆鏀归�� start
+        // Repair__c repair = [select Id,Hospital__c,address_Contacts__c,AWS_Data_Id__c from Repair__c where id=:rid];
+        Repair__c repair = [select Id,Hospital__c,address_Contacts__c,AWS_Data_Id__c,Returns_Product_way__c,
+                                Incharge_Staff__r.Profile.name,Incharge_Staff__r.UserRole.name, 
+                                Incharge_Staff__r.Branch__c from Repair__c where id=:rid];
+        // gzw DB202212270703 20230301 澶囧搧鍦板潃瀵煎叆鏀归�� end
         Account ac = [SELECT id,OCM_man_province_txt__c,FieldCity_Master_Name__c from Account where id =:repair.Hospital__c];
         String province = '';
         String city = '';
         String provinceAndCity = '';
-        if('灞变笢' == ac.OCM_man_province_txt__c){
-            if('鐑熷彴甯�' == ac.FieldCity_Master_Name__c || '濞佹捣甯�' == ac.FieldCity_Master_Name__c || '鏃ョ収甯�' == ac.FieldCity_Master_Name__c 
-                || '闈掑矝甯�' == ac.FieldCity_Master_Name__c || '娼嶅潑甯�' == ac.FieldCity_Master_Name__c){
-                provinceAndCity = matchupMap.get('灞变笢,闈掑矝甯�');
-            }else{
-                provinceAndCity = matchupMap.get('灞变笢,娴庡崡甯�');
-            }
+        //DB202303246427 LY 20230329 start 
+        // if('灞变笢' == ac.OCM_man_province_txt__c){
+        //     if('鐑熷彴甯�' == ac.FieldCity_Master_Name__c || '濞佹捣甯�' == ac.FieldCity_Master_Name__c || '鏃ョ収甯�' == ac.FieldCity_Master_Name__c 
+        //         || '闈掑矝甯�' == ac.FieldCity_Master_Name__c || '娼嶅潑甯�' == ac.FieldCity_Master_Name__c){
+        //         provinceAndCity = matchupMap.get('灞变笢,闈掑矝甯�');
+        //     }else{
+        //         provinceAndCity = matchupMap.get('灞变笢,娴庡崡甯�');
+        //     }
+        
+        if ('闈掑矝' == ac.OCM_man_province_txt__c) {
+            provinceAndCity = matchupMap.get('灞变笢,闈掑矝甯�');
+        }else if ('灞变笢' == ac.OCM_man_province_txt__c) {
+            provinceAndCity = matchupMap.get('灞变笢,娴庡崡甯�');
+        //DB202303246427 LY 20230329 end
         }else{
             provinceAndCity = matchupMap.get(ac.OCM_man_province_txt__c);
         }
@@ -95,12 +107,53 @@
             province = provinceAndCity.split(',')[0];
             city = provinceAndCity.split(',')[1];
         }
-        String addressSQl = 'SELECT ID,AWS_Data_Id__c,Customer__c,Customer_Name__c,Contacts__c,Contacts__r.AWS_Data_Id__c,Contacts_Name__c,Telephone__c,Province__c,Province_Name__c,City__c,City_Name__c,Detailed_Address__c,ZipCode__c'
-        + ' from Address__c  '
-        + ' where Address_Classification__c =  \'鍔炰簨澶刓' and Province_Name__c =: province and City_Name__c =: city '
-        + ' order by Using_Datetime__c desc NULLS LAST ';
-        system.debug('addressSQl='+addressSQl);
+        // DB202212270703 20230301 澶囧搧鍦板潃瀵煎叆鏀归�� start
+        String beipCenter = '';
+        if (repair.Returns_Product_way__c == '澶囧搧涓績') {
+            if(repair.Incharge_Staff__c == null){
+                beipCenter = '';
+            }else if (repair.Incharge_Staff__r.Profile.name.startsWith('2B3')) {
+                beipCenter = '鍖椾含澶囧搧涓績';
+            }else if (repair.Incharge_Staff__r.Profile.name.startsWith('2B2')) {
+                if (repair.Incharge_Staff__r.Branch__c == '鍖椾含') {
+                    beipCenter = '鍖椾含澶囧搧涓績';
+                }else if (repair.Incharge_Staff__r.Branch__c == '涓婃捣') {
+                    beipCenter = '鍗庝笢澶囧搧涓績';
+                }else if (repair.Incharge_Staff__r.Branch__c == '骞垮窞') {
+                    beipCenter = '骞垮窞澶囧搧涓績';
+                }
+            }else if (repair.Incharge_Staff__r.UserRole.name == 'CTEC鏁欒偛鏈儴') {
+                if (repair.Incharge_Staff__r.Branch__c == '鍖椾含') {
+                    beipCenter = '鍖椾含C-TEC';
+                }else if (repair.Incharge_Staff__r.Branch__c == '涓婃捣') {
+                    beipCenter = '涓婃捣C-TEC';
+                }else if (repair.Incharge_Staff__r.Branch__c == '骞垮窞') {
+                    beipCenter = '骞垮窞C-TEC';
+                }
+            }
+        }
+        system.debug('beipCenter=========='+beipCenter);
+        String addressSQl = 'SELECT ID,AWS_Data_Id__c,Customer__c,Customer_Name__c,Contacts__c,Contacts__r.AWS_Data_Id__c,Contacts_Name__c,Telephone__c,Province__c,Province_Name__c,City__c,City_Name__c,Detailed_Address__c,ZipCode__c from Address__c ';
+        if (String.isNotBlank(beipCenter)) {
+            addressSQl += ' where Address_Classification__c =  \'澶囧搧\' and Beipin_Center__c = \'' + beipCenter + '\'';
+        }else{
+            addressSQl += ' where Address_Classification__c =  \'鍔炰簨澶刓' and Province_Name__c =\'' + province + '\'';
+            addressSQl += 'and City_Name__c =\'' + city + '\'';
+        }
+        addressSQl += ' order by Using_Datetime__c desc NULLS LAST ';
+        system.debug('addressSQl=============='+addressSQl);
         List<Address__c> addressList = Database.query(addressSQl);
+
+
+
+
+        // String addressSQl = 'SELECT ID,AWS_Data_Id__c,Customer__c,Customer_Name__c,Contacts__c,Contacts__r.AWS_Data_Id__c,Contacts_Name__c,Telephone__c,Province__c,Province_Name__c,City__c,City_Name__c,Detailed_Address__c,ZipCode__c'
+        // + ' from Address__c  '
+        // + ' where Address_Classification__c =  \'鍔炰簨澶刓' and Province_Name__c =: province and City_Name__c =: city '
+        // + ' order by Using_Datetime__c desc NULLS LAST ';
+        // system.debug('addressSQl='+addressSQl);
+        // List<Address__c> addressList = Database.query(addressSQl);
+        // DB202212270703 20230301 澶囧搧鍦板潃瀵煎叆鏀归�� end
         //寮�濮嬬粍瑁呮暟鎹�
         List<AWSServiceTool2V2.EncryptPushRequestBody> EncryptPushList = new List<AWSServiceTool2V2.EncryptPushRequestBody>();
         AWSServiceTool2V2.EncryptPushRequestBody EncryptPush = new AWSServiceTool2V2.EncryptPushRequestBody();

--
Gitblit v1.9.1