黄千龙
2023-03-08 962519811b7c4be07f30d09e791798b0ea79d3ae
force-app/main/default/classes/DealerPersonnelController.cls
@@ -86,24 +86,24 @@
                            inputList.add(inputValues);
                            
                            //导入的数据
                            System.debug('inputValues[0]===============>'+ inputValues[0]);
                            System.debug('inputValues[1]===============>'+ inputValues[1]);
                            System.debug('inputValues[2]===============>'+ inputValues[2]);
                            System.debug('inputValues[3]===============>'+ inputValues[3]);
                            //SWAG-CEW85A 【委托】消耗品&DAMS系统经销商人员管理——信息完善;fy start
                            System.debug('inputValues[4]===============>'+ inputValues[4]);
                            System.debug('inputValues[4]===============>'+ inputValues[5]);
                            System.debug('inputValues[6]===============>'+ inputValues[6]);
                            System.debug('inputValues[7]===============>'+ inputValues[7]);
                            System.debug('inputValues[8]===============>'+ inputValues[8]);
                            System.debug('inputValues[9]===============>'+ inputValues[9]);
                            System.debug('inputValues[10]===============>'+ inputValues[10]);
                            System.debug('inputValues[11]===============>'+ inputValues[11]);
                            System.debug('inputValues[12]===============>'+ inputValues[12]);
                            System.debug('inputValues[13]===============>'+ inputValues[13]);
                            System.debug('inputValues[14]===============>'+ inputValues[14]);
                            System.debug('inputValues[15]===============>'+ inputValues[15]);
                            System.debug('inputValues[16]===============>'+ inputValues[16]);
                            // System.debug('inputValues[0]===============>'+ inputValues[0]);
                            // System.debug('inputValues[1]===============>'+ inputValues[1]);
                            // System.debug('inputValues[2]===============>'+ inputValues[2]);
                            // System.debug('inputValues[3]===============>'+ inputValues[3]);
                            // //SWAG-CEW85A 【委托】消耗品&DAMS系统经销商人员管理——信息完善;fy start
                            // System.debug('inputValues[4]===============>'+ inputValues[4]);
                            // System.debug('inputValues[5]===============>'+ inputValues[5]);
                            // System.debug('inputValues[6]===============>'+ inputValues[6]);
                            // System.debug('inputValues[7]===============>'+ inputValues[7]);
                            // System.debug('inputValues[8]===============>'+ inputValues[8]);
                            // System.debug('inputValues[9]===============>'+ inputValues[9]);
                            // System.debug('inputValues[10]===============>'+ inputValues[10]);
                            // System.debug('inputValues[11]===============>'+ inputValues[11]);
                            // System.debug('inputValues[12]===============>'+ inputValues[12]);
                            // System.debug('inputValues[13]===============>'+ inputValues[13]);
                            // System.debug('inputValues[14]===============>'+ inputValues[14]);
                            // System.debug('inputValues[15]===============>'+ inputValues[15]);
                            // System.debug('inputValues[16]===============>'+ inputValues[16]);
                            //SWAG-CEW85A 【委托】消耗品&DAMS系统经销商人员管理——信息完善;fy end
                            
                        }
@@ -115,7 +115,10 @@
                Map<Id,String> ManagementCodeMap = new Map<Id,String>();
                List<Id> AccountIdList =new  List<Id>();
                //SWAG-CEW85A 【委托】消耗品&DAMS系统经销商人员管理——信息完善;fy end
                System.debug('managementCodeList===============>'+ managementCodeList);
                System.debug('CustomerNameList===============>'+ CustomerNameList);
                List<Account> accountList = [select id, Name,Management_Code__c from Account where Management_Code__c in: managementCodeList and Name in:CustomerNameList ];
                System.debug('iaccountList===============>'+ accountList);
                for(Account ac : accountList){ 
                    accountIdMap.put(ac.Management_Code__c,ac);
                    //SWAG-CEW85A 【委托】消耗品&DAMS系统经销商人员管理——信息完善;fy start
@@ -125,11 +128,23 @@
                }
                //SWAG-CEW85A 【委托】消耗品&DAMS系统经销商人员管理——信息完善;fy start
                //查询客户人员是否有数据
                //DB202301262139 SFDC经销商人员导入功能改进 start 0228
                // Map<String,Contact> contactIdMapName = new Map<String,Contact>();
                List<Contact> contactList = [select id, CManageCode__c,AccountId from Contact where AccountId in: AccountIdList and CManageCode__c in:CManageCodeList ];
                // List<Contact> contactList = [select id, CManageCode__c,AccountId,Name from Contact where AccountId in: AccountIdList ];
                //DB202301262139 SFDC经销商人员导入功能改进 end
                for(Contact cc : contactList){ 
                    //DB202301262139 SFDC经销商人员导入功能改进 start 0228
                    // String namekey = cc.Name.replace(' ', '');
                    // String contactKey2=ManagementCodeMap.get(cc.AccountId)+'_'+namekey;
                    // contactIdMapName.put(contactKey2,cc);
                    String contactKey=ManagementCodeMap.get(cc.AccountId)+'_'+cc.CManageCode__c;
                    contactIdMap.put(contactKey,cc);
                    //DB202301262139 SFDC经销商人员导入功能改进 end
                }
                //DB202301262139 SFDC经销商人员导入功能改进 start 0228
                // System.debug('contactIdMapName++'+contactIdMapName);
                //DB202301262139 SFDC经销商人员导入功能改进 start 0228
                List<Contact> cnupdateList = new List<Contact>();
                //SWAG-CEW85A 【委托】消耗品&DAMS系统经销商人员管理——信息完善;fy end
                List<Contact> cnList = new List<Contact>();
@@ -355,6 +370,10 @@
                    //SWAG-CEW85A 【委托】消耗品&DAMS系统经销商人员管理——信息完善;fy start
                    System.debug('001+'+lineList[3]+'_'+lineList[6]);
                    System.debug('002+'+contactIdMap.get(lineList[3]+'_'+lineList[6]));
                    //DB202301262139 SFDC经销商人员导入功能改进 start 0228
                    // System.debug('003+'+lineList[3]+'_'+lineList[0]);
                    // System.debug('004+'+contactIdMapName.get(lineList[3]+'_'+lineList[0]));
                    //DB202301262139 SFDC经销商人员导入功能改进 start 0228
                    //DB202301262139 SFDC经销商人员导入功能改进 start
                    if(errorflag1){
                        errorMage += 'error: 第' + lineNumber + '行 ('+lineList[0]+') 的数据'+errorMageHang;
@@ -365,7 +384,12 @@
                            con.Id=contactIdMap.get(lineList[3]+'_'+lineList[6]).Id;
                            cnupdateList.add(con);
                        }else {
                            //DB202301262139 SFDC经销商人员导入功能改进 start 0228
                            // if(!contactIdMapName.containsKey(lineList[3]+'_'+lineList[0])){
                            //     cnList.add(con);
                            // }
                            cnList.add(con);
                            //DB202301262139 SFDC经销商人员导入功能改进 end
                        }
                    //DB202301262139 SFDC经销商人员导入功能改进 start
                    }
@@ -525,7 +549,7 @@
    public static boolean VerifyCertificationLevel(String data) {
        //DB202301262139 SFDC经销商人员导入功能改进 start
        // if(data=='A'||data=='B'||data==''){
        if(data=='A级(失效)'||data=='B级'||data=='B级(失效)'||data=='B级未通过'||data=='初级'||data=='初级未通过'||data=='未认证'||data==''){
        if(data=='A级'||data=='A级未通过'||data=='A级未通过(失效)'||data=='A级(失效)'||data=='B级'||data=='B级(失效)'||data=='B级未通过'||data=='初级'||data=='初级未通过'||data=='未认证'||data==''){
        //DB202301262139 SFDC经销商人员导入功能改进 end
            return true;
        }