From e3c02c03dd2de442bbced87236f60a13a1cd154e Mon Sep 17 00:00:00 2001
From: 高章伟 <gaozhangwei@prec-tech.com>
Date: 星期四, 02 三月 2023 17:51:57 +0800
Subject: [PATCH] gzw 正式环境最新代码更新

---
 force-app/main/default/classes/StraightBackAddressController.cls |  169 +++++++++++++++++++++++++++++--------------------------
 1 files changed, 89 insertions(+), 80 deletions(-)

diff --git a/force-app/main/default/classes/StraightBackAddressController.cls b/force-app/main/default/classes/StraightBackAddressController.cls
index 23aa63b..afd360a 100644
--- a/force-app/main/default/classes/StraightBackAddressController.cls
+++ b/force-app/main/default/classes/StraightBackAddressController.cls
@@ -1,4 +1,4 @@
-public without sharing class StraightBackAddressController {
+global without sharing class StraightBackAddressController {
     /**
      * 椤甸潰椤堕儴妫�绱㈡暟鎹�
      */
@@ -145,6 +145,12 @@
                     }
                 }else if('杩旈�佸姙浜嬪'.equals(pc.Returns_Product_way__c)){
                     optionAddressClassification.Address_Classification__c = '鍔炰簨澶�';
+                // 
+                }else if ('澶囧搧涓績'.equals(pc.Returns_Product_way__c)) {
+                    optionAddressClassification.Address_Classification__c = '澶囧搧';
+                // 
+
+
                 }else{
                     //鑾峰彇褰撳墠淇悊鐨勮繑閫佺粡閿�鍟�
                     if(!String.isBlank(pc.Dealer__c) && '杩旈�佺粡閿�鍟�'.equals(pc.Returns_Product_way__c)){
@@ -320,7 +326,7 @@
         ref.setRedirect(true);
         return ref;
     }
-	
+    
 
     /**
      * 妫�绱㈡暟鎹煡璇�
@@ -349,18 +355,6 @@
                     tableData.add(new AddressData(accoutList[0],'none','inline','none','鍖婚櫌'));
                 }
             }
-            //鍔炰簨澶�
-            /*if('鍔炰簨澶�'.equals(typeText)){
-                String AccountOfficeSql = makeTextAccOfficeSql();
-                //鑾峰彇鍦板潃淇℃伅
-                List<Account> accDataList = Database.query(AccountOfficeSql);
-                if(accDataList != null && accDataList.size() > 0){
-                    for(Integer i = 0;i<accDataList.size();i++){
-                        indexCou++;
-                        tableData.add(new AddressData(accDataList[i],'none','鍔炰簨澶�'));
-                    }
-                }
-            }*/
             //缁忛攢鍟嗭細
             //1锛氬鏋滄煡鍒板鏉$粡閿�鍟嗭紝骞朵笖鍦ㄥ湴鍧�涓煡鍒版湁鏁版嵁锛屽彧鏄剧ず鍦板潃鏁版嵁锛屽鏋滃湴鍧�鏁版嵁娌℃煡涓嶅埌锛屽氨涓嶆樉绀猴紝
             //2锛氬鏋滄煡鍒版湁涓�鏉$粡閿�鍟嗭紝閭d箞绗竴琛屽氨鏄缁忛攢鍟嗘暟鎹紝浠庣浜岃寮�濮嬩负鍦板潃鏁版嵁
@@ -391,7 +385,9 @@
                     
                     if(dataList[i].Address_Classification__c == '鍔炰簨澶�'){
                         tableData.add(new AddressData(dataList[i],'none','none','inline'));
-                    }else{
+                    }else if (dataList[i].Address_Classification__c == '澶囧搧'){
+                        tableData.add(new AddressData(dataList[i],'none','none','inline'));
+                    } else{
                         //鍙兘鏀硅嚜宸卞垱寤虹殑鍦板潃鏁版嵁锛岀郴缁熺鐞嗗憳銆丟PI_绯荤粺绠$悊鍛楴ew 娌¢檺鍒�
                         if(loginPerson == createId ||loginPerson == '00e10000000dzzG' ||loginPerson == '00e10000000Y3o5'){
                             tableData.add(new AddressData(dataList[i],'inline','inline','inline'));
@@ -425,10 +421,12 @@
      */
     public PageReference save(){
         system.debug('Address value:'+JSON.serialize(insUpdData));       
-        if(String.isNotBlank(contactIdValue)&&String.isNotEmpty(contactIdValue)){
-            system.debug('Contact Value:'+contactIdValue);
-            insUpdData.Contacts__c = contactIdValue;
-        }
+        // WLIG-CCX4BB 銆愬鎵樸�戜慨鐞嗙洿杩旀敹璐у湴鍧�鍔熻兘鏀归�� thh 20220513 start
+        // if(String.isNotBlank(contactIdValue)&&String.isNotEmpty(contactIdValue)){
+        //     system.debug('Contact Value:'+contactIdValue);
+        //     insUpdData.Contacts__c = contactIdValue;
+        // }
+        // WLIG-CCX4BB 銆愬鎵樸�戜慨鐞嗙洿杩旀敹璐у湴鍧�鍔熻兘鏀归�� thh 20220513 end
         system.debug('Address value:'+JSON.serialize(insUpdData));
         savepoint sp = Database.setsavepoint();
         if(insUpdData != null){
@@ -459,6 +457,7 @@
                 this.insUpdData.Telephone__c.addError('涓嶈兘涓虹┖锛�');
             }
             //璇︾粏鍦板潃涓嶈兘涓虹┖
+            System.debug('insUpdData.Detailed_Address__c1:' + insUpdData.Detailed_Address__c);
             if(String.isBlank(insUpdData.Detailed_Address__c)){
                 flag = false;
                 this.insUpdData.Detailed_Address__c.addError('璇︾粏鍦板潃涓嶈兘涓虹┖锛�');
@@ -504,65 +503,70 @@
                     }
                 }
             }
-            //鍒ゆ柇鑱旂郴浜烘槸鍚﹂兘涓虹┖
-            if(insUpdData.Contacts__c == null || String.isBlank(insUpdData.Contacts__c)){
+            //WLIG-CCX4BB 銆愬鎵樸�戜慨鐞嗙洿杩旀敹璐у湴鍧�鍔熻兘鏀归�� thh 20220513 start 
+            //鍒ゆ柇鑱旂郴浜烘槸鍚︿负绌�
+            System.debug('insUpdData.ContactName__c1:' + insUpdData.ContactName__c);
+            if(String.isBlank(insUpdData.ContactName__c)){
+                this.insUpdData.ContactName__c.addError('銆愯仈绯讳汉銆戜笉鑳戒负绌猴紒');
                 //鍒ゆ柇鏂板缓鑱旂郴浜烘槸鍚︿负绌�
-                if(insUpdData.Create_Contacts__c == null || String.isBlank(insUpdData.Create_Contacts__c)){
-                    flag = false;
-                    this.insUpdData.Create_Contacts__c.addError('銆愯仈绯讳汉銆戝拰銆愯仈绯讳汉锛堟柊寤猴級銆戜笉鑳藉悓鏃朵负绌猴紒');
-                }else{//濡傛灉鑱旂郴浜轰负绌猴紝浣嗘槸鏂板缓鑱旂郴浜轰笉涓虹┖锛岄偅涔堟柊澧炰竴鏉¤仈绯讳汉鏁版嵁
-                    if(flag){
-                        String typeL = '';//绫诲瀷
-                        if(insUpdData.Address_Classification__c == '鍖婚櫌'){
-                            typeL = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Doctor').getRecordTypeId();//鍖诲斧
-                        }else if(insUpdData.Address_Classification__c == '缁忛攢鍟�'){
-                            typeL = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId();//璨╁2搴�
-                        }else if(insUpdData.Address_Classification__c == '鍔炰簨澶�'){
-                            typeL = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Internal_staff').getRecordTypeId();//绀惧唴鍛樺伐
-                        }
-                        String surname = String.valueOf(insUpdData.Create_Contacts__c);//濮�
-                        String monicker = '';//鍚�
-                        if(surname.length() >= 2){
-                            monicker = surname.substring(1,surname.length());
-                            surname = surname.substring(0,1);
-                        }
-                        System.debug('newCon = '+newCon);
-                        addContact = new Contact(LastName = surname,
-                                                FirstName = monicker,
-                                                AccountId = insUpdData.Customer__c,
-                                                RecordTypeId = typeL,
-                                                AWS_Data_Id__c = newCon.AWS_Data_Id__c,
-                                                LastName_Encrypted__c = newCon.LastName_Encrypted__c);
-                        try{
-                            //鏂板涓�鏉¤仈绯讳汉鏁版嵁
-                            insert addContact;
-                            sfRecordId = addContact.id;
-                            insUpdData.Create_Contacts__c = '';
-                        }catch(Exception e){
-                            //ApexPages.addMessages(e);
-                            Database.rollback(sp);
-                            //澶辫触鎻愮ず
-                            System.debug('myException caught when save or submit: ' + e.getMessage() + e.getStackTraceString());
-                            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage()));
-                            isSearchBtn = false;
-                            return null;
-                        }
-                        insUpdData.Contacts__c = addContact.id;
-                        //name璧嬪��
-                        /*if(insUpdData.Contacts__c == null){
-                            insUpdData.name =  insUpdData.Customer__r.Name+'_'+insUpdData.Contacts__r.Name;
-                        }else{
-                            insUpdData.name =  insUpdData.Customer__r.Name+'_'+insUpdData.Create_Contacts__c;
-                        }*/
-                    }
-                }
-            }else{//鑱旂郴浜哄拰鏂板缓鑱旂郴浜轰笉鑳介兘鏈夊��
-                //鍒ゆ柇鏂板缓鑱旂郴浜烘槸鍚︿负绌�
-                if(!String.isBlank(insUpdData.Create_Contacts__c)){
-                    flag = false;
-                    this.insUpdData.Create_Contacts__c.addError('銆愯仈绯讳汉銆戝拰銆愯仈绯讳汉锛堟柊寤猴級銆戜笉鑳藉悓鏃堕兘鏈夊�硷紒');
-                }
+                // if(insUpdData.Create_Contacts__c == null || String.isBlank(insUpdData.Create_Contacts__c)){
+                //     flag = false;
+                //     this.insUpdData.Create_Contacts__c.addError('銆愯仈绯讳汉銆戝拰銆愯仈绯讳汉锛堟柊寤猴級銆戜笉鑳藉悓鏃朵负绌猴紒');
+                // }else{//濡傛灉鑱旂郴浜轰负绌猴紝浣嗘槸鏂板缓鑱旂郴浜轰笉涓虹┖锛岄偅涔堟柊澧炰竴鏉¤仈绯讳汉鏁版嵁
+                //     if(flag){
+                //         String typeL = '';//绫诲瀷
+                //         if(insUpdData.Address_Classification__c == '鍖婚櫌'){
+                //             typeL = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Doctor').getRecordTypeId();//鍖诲斧
+                //         }else if(insUpdData.Address_Classification__c == '缁忛攢鍟�'){
+                //             typeL = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId();//璨╁2搴�
+                //         }else if(insUpdData.Address_Classification__c == '鍔炰簨澶�'){
+                //             typeL = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Internal_staff').getRecordTypeId();//绀惧唴鍛樺伐
+                //         }
+                //         String surname = String.valueOf(insUpdData.Create_Contacts__c);//濮�
+                //         String monicker = '';//鍚�
+                //         if(surname.length() >= 2){
+                //             monicker = surname.substring(1,surname.length());
+                //             surname = surname.substring(0,1);
+                //         }
+                //         System.debug('newCon = '+newCon);
+                //         addContact = new Contact(LastName = surname,
+                //                                 FirstName = monicker,
+                //                                 AccountId = insUpdData.Customer__c,
+                //                                 RecordTypeId = typeL,
+                //                                 AWS_Data_Id__c = newCon.AWS_Data_Id__c,
+                //                                 LastName_Encrypted__c = newCon.LastName_Encrypted__c);
+                //         try{
+                //             //鏂板涓�鏉¤仈绯讳汉鏁版嵁
+                //             insert addContact;
+                //             sfRecordId = addContact.id;
+                //             insUpdData.Create_Contacts__c = '';
+                //         }catch(Exception e){
+                //             //ApexPages.addMessages(e);
+                //             Database.rollback(sp);
+                //             //澶辫触鎻愮ず
+                //             System.debug('myException caught when save or submit: ' + e.getMessage() + e.getStackTraceString());
+                //             ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage()));
+                //             isSearchBtn = false;
+                //             return null;
+                //         }
+                //         insUpdData.Contacts__c = addContact.id;
+                //         //name璧嬪��
+                //         /*if(insUpdData.Contacts__c == null){
+                //             insUpdData.name =  insUpdData.Customer__r.Name+'_'+insUpdData.Contacts__r.Name;
+                //         }else{
+                //             insUpdData.name =  insUpdData.Customer__r.Name+'_'+insUpdData.Create_Contacts__c;
+                //         }*/
+                //     }
+                // }
             }
+            // else{//鑱旂郴浜哄拰鏂板缓鑱旂郴浜轰笉鑳介兘鏈夊��
+            //     //鍒ゆ柇鏂板缓鑱旂郴浜烘槸鍚︿负绌�
+            //     if(!String.isBlank(insUpdData.Create_Contacts__c)){
+            //         flag = false;
+            //         this.insUpdData.Create_Contacts__c.addError('銆愯仈绯讳汉銆戝拰銆愯仈绯讳汉锛堟柊寤猴級銆戜笉鑳藉悓鏃堕兘鏈夊�硷紒');
+            //     }
+            // }
+            //WLIG-CCX4BB 銆愬鎵樸�戜慨鐞嗙洿杩旀敹璐у湴鍧�鍔熻兘鏀归�� thh 20220513 end
             if(flag){
                 try{
                     //鏂板鎴栦慨鏀规暟鎹�
@@ -598,9 +602,14 @@
     }
     //鏌ヨ鍦板潃琛ㄦ暟鎹�
     private String makeTextAddressSql(String typeSearchId) {
-        String AddressSql = 'SELECT AWS_Data_Id__c,ID,Address_Classification__c,Customer__c,Customer__r.Name,Customer__r.Type,Customer__r.RecordTypeId,Contacts__c,Contacts__r.Name,Contacts__r.AWS_Data_Id__c,Telephone__c'
-                        +',Province__c,Province__r.Name,City__c,City__r.name,Detailed_Address__c,Create_Contacts__c,ZipCode__c,CreatedByid,Detailed_Address_Encrypted__c,Telephone_Encrypted__c,ZipCode_Encrypted__c,Contacts__r.LastName_Encrypted__c'
+        // WLIG-CCX4BB 銆愬鎵樸�戜慨鐞嗙洿杩旀敹璐у湴鍧�鍔熻兘鏀归�� thh 20220513 start 
+        // String AddressSql = 'SELECT AWS_Data_Id__c,ID,Address_Classification__c,Customer__c,Customer__r.Name,Customer__r.Type,Customer__r.RecordTypeId,Contacts__c,Contacts__r.Name,Contacts__r.AWS_Data_Id__c,ContactName__c,Telephone__c,ContactName_Encrypted__c' //zhj 鏂版柟妗堟敼閫� 鍘婚櫎Encrypted__c 2022-12-05
+        //                 +',Province__c,Province__r.Name,City__c,City__r.name,Detailed_Address__c,Create_Contacts__c,ZipCode__c,CreatedByid,Detailed_Address_Encrypted__c,Telephone_Encrypted__c,ZipCode_Encrypted__c,Contacts__r.LastName_Encrypted__c'
+        //                 + ' FROM Address__c where id != null';
+        String AddressSql = 'SELECT AWS_Data_Id__c,ID,Address_Classification__c,Customer__c,Customer__r.Name,Customer__r.Type,Customer__r.RecordTypeId,Contacts__c,Contacts__r.Name,Contacts__r.AWS_Data_Id__c,ContactName__c,Telephone__c' //zhj 鏂版柟妗堟敼閫� 鍘婚櫎Encrypted__c 2022-12-05
+                        +',Province__c,Province__r.Name,City__c,City__r.name,Detailed_Address__c,Create_Contacts__c,ZipCode__c,CreatedByid'
                         + ' FROM Address__c where id != null';
+        // WLIG-CCX4BB 銆愬鎵樸�戜慨鐞嗙洿杩旀敹璐у湴鍧�鍔熻兘鏀归�� thh 20220513 end 
         //绫诲瀷绛涢��
         if(!String.isBlank(typeText)){
             if('鍖婚櫌'.equals(typeText)){
@@ -684,7 +693,7 @@
     }
     
     @RemoteAction
-    public static string SaveEx(string repaire_json,string asset_json, string address_id){
+    global static string SaveEx(string repaire_json,string asset_json, string address_id){
         return SaveExCore(repaire_json,asset_json,address_id);
     }
 
@@ -708,7 +717,7 @@
             System.debug(e.getDmlMessage(index));
             System.debug(e.getDmlStatusCode(index));
             System.debug(e.getDmlType(index));
-			system.debug(e.getMessage());
+            system.debug(e.getMessage());
             system.debug(e.getStackTraceString());
 
             System.debug('into catch'+e.getMessage());

--
Gitblit v1.9.1