public without sharing class AccountTriggerHandler {

    public static void setBusinesslicense(List<Account> newList, Map<Id, Account> newMap, List<Account> oldList, Map<Id, Account> oldMap) {

        Map<String, String> businesslicenseMap = new Map<String, String>();
        for (Account newAcc : newList) {
            if (newAcc.ParentId == null && String.isNotBlank(newAcc.Business_license__c) &&
                    newAcc.ProductSegment__c == 'BS' && newAcc.RecordTypeId == '012280000005gnE') {
                businesslicenseMap.put(newAcc.Id, newAcc.Business_license__c);
            }
        }

        if ( businesslicenseMap.size() > 0) {
            List<Account> accountList = [select Id, Name, ParentId, Business_license__c
                                         from Account
                                         where ParentId In:businesslicenseMap.keySet()];
            if (accountList.size() > 0) {

                for (Account acc : accountList) {

                    acc.Business_license__c = businesslicenseMap.get(acc.ParentId);
                }
                update accountList;
            }

        }

    }
    public static void setIsNew(List<Account> newList, Map<Id, Account> newMap, List<Account> oldList, Map<Id, Account> oldMap) {
        //当前登陆人ID
        String now_userId = UserInfo.getUserId();
        for (Account newAcc : newList) {
            // String profileId = UserInfo.getProfileId().subString(0, 15);
            //新的获取人员简档ID
            String new_profileId = calendarUtil.getMemberProfileID(UserInfo.getUserId().subString(0,15));

            //新增权限整理2021-05-10
            if (new_profileId.subString(0, 15) == System.label.Market_Department || new_profileId.subString(0, 15) == System.label.Market_Department1 || new_profileId.subString(0, 15) == System.label.Service_Owner || new_profileId.subString(0, 15) == System.label.Service_OwnerMinister 
                    || UserInfo.getUserType() == 'PowerPartner' || new_profileId.subString(0, 15) == System.label.IEPrototypeManager) {
            //新增权限整理2021-05-10
                newAcc.IsNew__c = true;
            } else {
                newAcc.WebsiteD__c = newAcc.Website;
                newAcc.FaxD__c = newAcc.Fax;
                //newAcc.CreatedByD__c = newAcc.CreatedBy;
                newAcc.PhoneD__c = newAcc.Phone;
                newAcc.Address1D__c = newAcc.Address1__c;
                newAcc.AssetANI4D__c = newAcc.AssetANI4__c;
                newAcc.AssetIE7D__c = newAcc.AssetIE7__c;
                newAcc.AssetNDT7D__c = newAcc.AssetNDT7__c;
                //newAcc.DealerD__c = newAcc.DealerName__c;
                //newAcc.DepartmentNameD__c = newAcc.DepartmentName__c;
                //newAcc.DivisionNameD__c = newAcc.DivissionName__c;
                newAcc.AssetRVI5D__c = newAcc.AssetRVI5__c;
                newAcc.EnglishNameD__c = newAcc.EnglishName__c;
                //newAcc.ExportRegulatedCustomerD__c = newAcc.Export_Regulated_Customer__c;
                //newAcc.FacilityNameD__c = newAcc.FacilityName__c;
                newAcc.AssetRVI2D__c = newAcc.AssetRVI2__c;
                newAcc.AssetNDT4D__c = newAcc.AssetNDT4__c;
                newAcc.IndustryCD__c = newAcc.IndustryC__c;
                newAcc.AssetRVI4D__c = newAcc.AssetRVI4__c;
                newAcc.AssetRVI3D__c = newAcc.AssetRVI3__c;
                //newAcc.KeyAccountD__c = newAcc.KeyAccount__c;
                newAcc.AssetIE5D__c = newAcc.AssetIE5__c;
                newAcc.AssetBS3D__c = newAcc.AssetBS3__c;
                newAcc.AssetIE3D__c = newAcc.AssetIE3__c;
                newAcc.AssetANI7D__c = newAcc.AssetANI7__c;
                newAcc.AssetNDT6D__c = newAcc.AssetNDT6__c;
                newAcc.MarketVerticalsD__c = newAcc.MarketVerticals__c;
                newAcc.AssetIE6D__c = newAcc.AssetIE6__c;
                newAcc.AssetIE2D__c = newAcc.AssetIE2__c;
                newAcc.AssetBS2D__c = newAcc.AssetBS2__c;
                newAcc.AssetANI3D__c = newAcc.AssetANI3__c;
                newAcc.AssetIE1D__c = newAcc.AssetIE1__c;
                newAcc.AssetBS1D__c = newAcc.AssetBS1__c;
                newAcc.AssetRVI1D__c = newAcc.AssetRVI1__c;
                newAcc.AssetNDT1D__c = newAcc.AssetNDT1__c;
                newAcc.AssetANI1D__c = newAcc.AssetANI1__c;
                newAcc.AssetNDT8D__c = newAcc.AssetNDT8__c;
                newAcc.AssetANI8D__c = newAcc.AssetANI8__c;
                newAcc.AssetBS5D__c = newAcc.AssetBS5__c;
                newAcc.AssetIE8D__c = newAcc.AssetIE8__c;
                newAcc.AssetRVI8D__c = newAcc.AssetRVI8__c;
                newAcc.AssetANI5D__c = newAcc.AssetANI5__c;
                //newAcc.ProvinceD__c = newAcc.Province__c;
                newAcc.AssetRVI6D__c = newAcc.AssetRVI6__c;
                newAcc.AssetANI2D__c = newAcc.AssetANI2__c;
                newAcc.AssetNDT3D__c = newAcc.AssetNDT3__c;
                newAcc.AssetNDT2D__c = newAcc.AssetNDT2__c;
                newAcc.AssetANI6D__c = newAcc.AssetANI6__c;
                //IE与LS分野的增加与修改
                newAcc.Sub_UseA__c = newAcc.Sub_Use1__c;
                newAcc.Sub_UseD__c = newAcc.Sub_Use__c;
                //newAcc.IndustryBD__c = newAcc.IndustryB__c;
               
                //IE与LS分野的增加与修改
                newAcc.UseD__c = newAcc.Use__c;
                newAcc.AssetRVI7D__c = newAcc.AssetRVI7__c;
                newAcc.AssetBS4D__c = newAcc.AssetBS4__c;
                newAcc.AssetIE4D__c = newAcc.AssetIE4__c;
                newAcc.AssetNDT5D__c = newAcc.AssetNDT5__c;
                newAcc.AccountStatusD__c = newAcc.AccountStatus__c;
                newAcc.CancelReasonD__c = newAcc.CancelReason__c;
                newAcc.CityD__c = newAcc.City__c;
                newAcc.PostCodeD__c = newAcc.PostCode__c;
                newAcc.DealerSelectOwner__c = newAcc.OwnerId;
                newAcc.FacilityNameD__c = newAcc.FacilityName__c;
                newAcc.DivisionName_D__c = newAcc.DivisionName__c;
                newAcc.DepartmentNameD__c = newAcc.DepartmentName__c;
                if (new_profileId.subString(0,15) == '00e28000000YKLo') {
                    newAcc.IsNew__c = true;
                }
               
            }
            //gwy 2021-06-04 LS 新增必填项OEM客户的标识
            /*if(newAcc.UserType__c == 'OEM客户' && newAcc.ProductSegment__c == 'BS'){
                newAcc.Whether_OEM__c = true;
            }*/
            //王鹏伟添加 服务部创建客户、联系人
            //00528000000YWC6 孙 学洋 00528000000YWC6
            //00528000000YWE7 吴 晓东 00528000000YWE7
            //00e28000000YQMx 简档：SSBG技术服务部（部长・副部长）00e28000000YQMx
            //00e28000001sZE6 简档：SSBG技术服务部担当 00e28000001sZE6
            // System.debug('profileId:' + profileId);
            System.debug('DealerSelectOwner__c:' + newAcc.DealerSelectOwner__c);
            if ((now_userId == '00528000000YWC6' || now_userId == '00528000000YWE7' || new_profileId.subString(0, 15) == '00e28000000YQMx' || new_profileId.subString(0, 15) == '00e28000001sZE6'
            //新增权限整理2021-05-10
                || new_profileId.subString(0, 15) == '00e28000000YQMx' || new_profileId.subString(0, 15) == '00e28000001sZE6')
            //新增权限整理2021-05-10
                && String.isNotBlank(newAcc.DealerSelectOwner__c)){
                newAcc.OwnerId = newAcc.DealerSelectOwner__c;
            }
            //王鹏伟添加结束
            //gwy 2021-06-08 客户取消邮编必填项
            //newAcc.PostCode__c = newAcc.PostCode__c == null ? '000000' : newAcc.PostCode__c;
            //newAcc.PostCodeD__c = newAcc.PostCodeD__c == null ? '000000' : newAcc.PostCodeD__c;
        }
    }

    public static void setSubUse(List<Account> newList, Map<Id, Account> newMap, List<Account> oldList, Map<Id, Account> oldMap) {
    //subuse代码优化,之前的subuse的值和赋值的三个字段,放到BatchIF转义表里面。
        List<String> externalList = new List<String>();
        for (Account acc : newList) {
            //2021-06-07 gwy 添加代码(自动填选项)
            String recordTypeId = acc.RecordTypeId;
            recordTypeId = recordTypeId.substring(0,15);
            // String recordTypeId = acc.RecordTypeId;
            //拼接值，并且把值全部放进列表里
            String externalValue = recordTypeId + ':' + acc.Sub_UseD__c;
            String externalValue1 = recordTypeId + ':' + acc.Sub_Use__c;
            if(acc.Sub_UseD__c != acc.Sub_Use__c){
               externalList.add(externalValue);
               externalList.add(externalValue1); 
            }else{
               externalList.add(externalValue);
            }
                
        } 
        //创建一个map,经过soql文查询后,符合条件,放入map。
        Map<String,String> batchIFMap= new Map<String,String>();
        if (externalList.size()>0) {
            List<BatchIF_Transfer__c> batchIFList = new List<BatchIF_Transfer__c>();
            batchIFList = [select External_Value__c,Internal_Value__c from BatchIF_Transfer__c where External_Value__c In: externalList];
            for (BatchIF_Transfer__c bt : batchIFList) {
            batchIFMap.put(bt.External_Value__c,bt.Internal_Value__c);
            }
        }

        //定义List,从map取值,进行分割赋值。有变化的就给他重新赋值。
        List<String> btList = new List<String>();
        for (Account acc : newList){
            String recordTypeid = acc.RecordTypeId;
            recordTypeid = recordTypeid.substring(0,15);
            String externalVal = recordTypeid + ':' + acc.Sub_UseD__c;
            String externalVal1 = recordTypeid + ':' + acc.Sub_Use__c;
            //acc.Sub_UseD__c
            if(batchIFMap.containsKey(externalVal)){
                btList = batchIFMap.get(externalVal).split(';');
                    acc.IndustryCD__c       = btList[0];
                    acc.MarketVerticalsD__c = btList[1];
                    acc.UseD__c             = btList[2];
            }else{
                //没有变化的不管，为空的或者变为空的给他赋值为空。
                if ((acc.ProductSegment__c == 'NDT' || acc.ProductSegment__c == 'IE' || acc.ProductSegment__c == 'RVI' || acc.ProductSegment__c == 'ANI') && acc.Sub_UseD__c == null) {
                    acc.IndustryCD__c       = null;
                    acc.MarketVerticalsD__c = null;
                    acc.UseD__c             = null;
                }     
            }
            //acc.Sub_Use__c
            if(batchIFMap.containsKey(externalVal1)){
                btList = batchIFMap.get(externalVal1).split(';');
                    acc.IndustryC__c       = btList[0];
                    acc.MarketVerticals__c = btList[1];
                    acc.Use__c             = btList[2];
            }else{
                //没有变化的不管，为空的或者变为空的给他赋值为空。
                if ((acc.ProductSegment__c == 'NDT' || acc.ProductSegment__c == 'IE' || acc.ProductSegment__c == 'RVI' || acc.ProductSegment__c == 'ANI') && acc.Sub_Use__c == null) {
                    acc.IndustryC__c       = null;
                    acc.MarketVerticals__c = null;
                    acc.Use__c             = null;
                }     
            }
        }
    }

        
        

        // for (Account newAcc : newList) {
        //     Account oldAcc = oldMap == null ? null : oldMap.get(newAcc.Id);
        //     //2021-06-07 gwy 添加代码(自动填选项) 
        //     if (newAcc.Sub_UseA__c != null) {
        //         newAcc.Sub_UseD__c = newAcc.Sub_UseA__c;
        //     }
        //         system.debug('====='+ oldAcc == null );
        //         system.debug('=====recordTypeId' + newAcc.recordTypeId);
        //         system.debug('=====Sub_UseD__c' + newAcc.Sub_UseD__c);
                
        //     if (oldAcc == null || newAcc.Sub_UseD__c != oldAcc.Sub_UseD__c) {
                
        //         system.debug('=====');
        //         system.debug('=====recordTypeId' + newAcc.recordTypeId);
        //         system.debug('=====Sub_UseD__c' + newAcc.Sub_UseD__c);

                // if (newAcc.recordTypeId == '01228000000TdF6') {
                //     if (newAcc.Sub_UseD__c == null || newAcc.Sub_UseD__c == '') {
                        // newAcc.IndustryCD__c = null;
                        // newAcc.MarketVerticalsD__c = null;
                        // newAcc.UseD__c = null;
                    // } else if (newAcc.Sub_UseD__c == 'LED') {
                    //     newAcc.IndustryCD__c = 'Electronics';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Electronic Device';
                    // } else if (newAcc.Sub_UseD__c == 'FPD') {
                    //     newAcc.IndustryCD__c = 'Electronics';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Electronic Device';
                    // } else if (newAcc.Sub_UseD__c == '半导体') {
                    //     newAcc.IndustryCD__c = 'Electronics';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Semiconductor';
                    // } else if (newAcc.Sub_UseD__c == '电子部品') {
                    //     newAcc.IndustryCD__c = 'Electronics';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Electronic Device';
                    // } else if (newAcc.Sub_UseD__c == '太阳能') {
                    //     newAcc.IndustryCD__c = 'Electronics';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Electronic Device';
                    // } else if (newAcc.Sub_UseD__c == '电子类_其他') {
                    //     newAcc.IndustryCD__c = 'Electronics';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Electronic Device';
                    // } else if (newAcc.Sub_UseD__c == '金属') {
                    //     newAcc.IndustryCD__c = 'Metal Manufacturing';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Casting';
                    // } else if (newAcc.Sub_UseD__c == '传统汽车') {
                    //     newAcc.IndustryCD__c = 'Automotive';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Automotive Body/Engine';
                    // } else if (newAcc.Sub_UseD__c == '石油地质') {
                    //     newAcc.IndustryCD__c = 'Mining/Geology';
                    //     newAcc.MarketVerticalsD__c = 'Natural Resources';
                    //     newAcc.UseD__c = 'Geology : Geological Surveys';
                    // } else if (newAcc.Sub_UseD__c == '五金模具') {
                    //     newAcc.IndustryCD__c = 'Metal Manufacturing';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Machined Parts';
                    // } else if (newAcc.Sub_UseD__c == '重工设备') {
                    //     newAcc.IndustryCD__c = 'Fabricated Metal Manufacturing';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing) Other';
                    // } else if (newAcc.Sub_UseD__c == '材料类_其他') {
                    //     newAcc.IndustryCD__c = 'Academic Research';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Industrial Scientific research';
                    // } else if (newAcc.Sub_UseD__c == '医疗器械') {
                    //     newAcc.IndustryCD__c = 'Medical Device/Equipment';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing) Other';
                    // } else if (newAcc.Sub_UseD__c == '激光加工') {
                    //     newAcc.IndustryCD__c = 'Other';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing) Other';
                    // } else if (newAcc.Sub_UseD__c == '制药') {
                    //     newAcc.IndustryCD__c = 'Pharmaceutical';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing) Other';
                    // } else if (newAcc.Sub_UseD__c == '动植物') {
                    //     newAcc.IndustryCD__c = 'Food/Feed/Agriculture';
                    //     newAcc.MarketVerticalsD__c = 'Other';
                    //     newAcc.UseD__c = '(Other) Other';
                    // } else if (newAcc.Sub_UseD__c == '新能源汽车') {
                    //     newAcc.IndustryCD__c = 'Automotive';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Automotive Body/Engine';
                    // } else if (newAcc.Sub_UseD__c == '5G-PCB') {
                    //     newAcc.IndustryCD__c = 'Electronics';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Electronic Device';
                    // } else if (newAcc.Sub_UseD__c == '5G-半导体') {
                    //     newAcc.IndustryCD__c = 'Electronics';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Electronic Device';
                    // } else if (newAcc.Sub_UseD__c == '5G-其他') {
                    //     newAcc.IndustryCD__c = 'Electronics';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Electronic Device';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-半导体-前道') {
                    //     newAcc.IndustryCD__c = 'Electronics';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-半导体-中期') {
                    //     newAcc.IndustryCD__c = 'Electronics';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-半导体-后道') {
                    //     newAcc.IndustryCD__c = 'Electronics';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-FPD') {
                    //     newAcc.IndustryCD__c = 'Electronics';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-3D 测量仪') {
                    //     newAcc.IndustryCD__c = 'Electronics';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-测试仪器') {
                    //     newAcc.IndustryCD__c = 'Electronics';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-拉曼光谱仪') {
                    //     newAcc.IndustryCD__c = 'Academic Research';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-血液') {
                    //     newAcc.IndustryCD__c = 'Medical Device/Equipment';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-尿液/粪便') {
                    //     newAcc.IndustryCD__c = 'Medical Device/Equipment';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-细胞学') {
                    //     newAcc.IndustryCD__c = 'Medical Device/Equipment';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-遗传学') {
                    //     newAcc.IndustryCD__c = 'Medical Device/Equipment';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-病理') {
                    //     newAcc.IndustryCD__c = 'Medical Device/Equipment';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-生殖') {
                    //     newAcc.IndustryCD__c = 'Medical Device/Equipment';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-高端显微镜') {
                    //     newAcc.IndustryCD__c = 'Academic Research';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-细胞观察') {
                    //     newAcc.IndustryCD__c = 'Academic Research';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-电子显微镜') {
                    //     newAcc.IndustryCD__c = 'Academic Research';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-高内涵') {
                    //     newAcc.IndustryCD__c = 'Academic Research';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-流式细胞仪') {
                    //     newAcc.IndustryCD__c = 'Academic Research';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-ODM') {
                    //     newAcc.IndustryCD__c = 'Other';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-精准医疗') {
                    //     newAcc.IndustryCD__c = 'Academic Research';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                    // } else if (newAcc.Sub_UseD__c == 'Compo-其他') {
                    //     newAcc.IndustryCD__c = 'Other';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = '(Manufacturing)OEM';
                //     }
                // } else if (newAcc.recordTypeId == '01228000000TdFG') {
                //     if (newAcc.Sub_UseD__c == null || newAcc.Sub_UseD__c == '') {
                //         newAcc.IndustryCD__c = null;
                //         newAcc.MarketVerticalsD__c = null;
                //         newAcc.UseD__c = null;
                    // } else if (newAcc.Sub_UseD__c == 'Automotive') {
                    //     newAcc.IndustryCD__c = 'Automotive';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Automotive Body/Engine';
                    // } else if (newAcc.Sub_UseD__c == 'Civil Aviation') {
                    //     newAcc.IndustryCD__c = 'Aerospace';
                    //     newAcc.MarketVerticalsD__c = 'Maintenance';
                    //     newAcc.UseD__c = '(Maintenance)Aviation Airframe/Engine';
                    // } else if (newAcc.Sub_UseD__c == 'Security/Defense') {
                    //     newAcc.IndustryCD__c = 'Government/Security/Defense';
                    //     newAcc.MarketVerticalsD__c = 'Other';
                    //     newAcc.UseD__c = '(Other) Other';
                    // } else if (newAcc.Sub_UseD__c == 'Oil,Gas&Chemical') {
                    //     newAcc.IndustryCD__c = 'Chemical/Petrochemical/Plastics';
                    //     newAcc.MarketVerticalsD__c = 'Maintenance';
                    //     newAcc.UseD__c = 'Weld Inspection';
                    // } else if (newAcc.Sub_UseD__c == 'Power') {
                    //     newAcc.IndustryCD__c = 'Power Generation';
                    //     newAcc.MarketVerticalsD__c = 'Maintenance';
                    //     newAcc.UseD__c = 'Heat Exchangers';
                    // } else if (newAcc.Sub_UseD__c == 'General Manufacturing') {
                    //     newAcc.IndustryCD__c = 'Metal Manufacturing';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Machined Parts';
                    // } else if (newAcc.Sub_UseD__c == 'Inspection/Service/Rental') {
                    //     newAcc.IndustryCD__c = 'Inspection/Lab/Rental Sevice Provider';
                    //     newAcc.MarketVerticalsD__c = 'Maintenance';
                    //     newAcc.UseD__c = 'Process Piping';
                    // } else if (newAcc.Sub_UseD__c == 'Others') {
                    //     newAcc.IndustryCD__c = 'Other';
                    //     newAcc.MarketVerticalsD__c = 'Other';
                    //     newAcc.UseD__c = '(Other) Other';
                    // } else if (newAcc.Sub_UseD__c == 'Thermal Power') {
                    //     newAcc.IndustryCD__c = 'Power Generation';
                    //     newAcc.MarketVerticalsD__c = 'Maintenance';
                    //     newAcc.UseD__c = 'Process piping';
                    // } else if (newAcc.Sub_UseD__c == 'Nuclear Power') {
                    //     newAcc.IndustryCD__c = 'Power Generation';
                    //     newAcc.MarketVerticalsD__c = 'Maintenance';
                    //     newAcc.UseD__c = 'Process piping';
                    // } else if (newAcc.Sub_UseD__c == 'Wind Power') {
                    //     newAcc.IndustryCD__c = 'Power Generation';
                    //     newAcc.MarketVerticalsD__c = 'Maintenance';
                    //     newAcc.UseD__c = 'Weld Inspection';
                    // } else if (newAcc.Sub_UseD__c == 'Power(other)') {
                    //     newAcc.IndustryCD__c = 'Power Generation';
                    //     newAcc.MarketVerticalsD__c = 'Maintenance';
                    //     newAcc.UseD__c = 'Corrosion';
                //     }
                // } else if (newAcc.recordTypeId == '01228000000TdFB') {
                //     if (newAcc.Sub_UseD__c == null || newAcc.Sub_UseD__c == '') {
                //         newAcc.IndustryCD__c = null;
                //         newAcc.MarketVerticalsD__c = null;
                //         newAcc.UseD__c = null;
                    // } else if (newAcc.Sub_UseD__c == 'Automotive') {
                    //     newAcc.IndustryCD__c = 'Automotive';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Automotive Body/Engine';
                    // } else if (newAcc.Sub_UseD__c == 'Civil Aviation') {
                    //     newAcc.IndustryCD__c = 'Aerospace';
                    //     newAcc.MarketVerticalsD__c = 'Maintenance';
                    //     newAcc.UseD__c = '(Maintenance)Aviation Airframe/Engine';
                    // } else if (newAcc.Sub_UseD__c == 'Security/Defense') {
                    //     newAcc.IndustryCD__c = 'Government/Security/Defense';
                    //     newAcc.MarketVerticalsD__c = 'Other';
                    //     newAcc.UseD__c = '(Other) Other';
                    // } else if (newAcc.Sub_UseD__c == 'Oil,Gas&Chemical') {
                    //     newAcc.IndustryCD__c = 'Chemical/Petrochemical/Plastics';
                    //     newAcc.MarketVerticalsD__c = 'Maintenance';
                    //     newAcc.UseD__c = 'Weld Inspection';
                    // } else if (newAcc.Sub_UseD__c == 'Power') {
                    //     newAcc.IndustryCD__c = 'Power Generation';
                    //     newAcc.MarketVerticalsD__c = 'Maintenance';
                    //     newAcc.UseD__c = 'Heat Exchangers';
                    // } else if (newAcc.Sub_UseD__c == 'General Manufacturing') {
                    //     newAcc.IndustryCD__c = 'Metal Manufacturing';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Machined Parts';
                    // } else if (newAcc.Sub_UseD__c == 'Inspection/Service/Rental') {
                    //     newAcc.IndustryCD__c = 'Inspection/Lab/Rental Sevice Provider';
                    //     newAcc.MarketVerticalsD__c = 'Maintenance';
                    //     newAcc.UseD__c = 'Process Piping';
                    // } else if (newAcc.Sub_UseD__c == 'Others') {
                    //     newAcc.IndustryCD__c = 'Other';
                    //     newAcc.MarketVerticalsD__c = 'Other';
                    //     newAcc.UseD__c = '(Other) Other';
                    // } else if (newAcc.Sub_UseD__c == 'Thermal Power') {
                    //     newAcc.IndustryCD__c = 'Power Generation';
                    //     newAcc.MarketVerticalsD__c = 'Maintenance';
                    //     newAcc.UseD__c = 'Heat Exchangers';
                    // } else if (newAcc.Sub_UseD__c == 'Nuclear Power') {
                    //     newAcc.IndustryCD__c = 'Power Generation';
                    //     newAcc.MarketVerticalsD__c = 'Maintenance';
                    //     newAcc.UseD__c = 'Process Piping';
                    // } else if (newAcc.Sub_UseD__c == 'Wind Power') {
                    //     newAcc.IndustryCD__c = 'Power Generation';
                    //     newAcc.MarketVerticalsD__c = 'Maintenance';
                    //     newAcc.UseD__c = 'Gear Box';
                    // } else if (newAcc.Sub_UseD__c == 'Power(other)') {
                    //     newAcc.IndustryCD__c = 'Power Generation';
                    //     newAcc.MarketVerticalsD__c = 'Maintenance';
                    //     newAcc.UseD__c = 'Corrosion';
                //     }
                // } else if (newAcc.recordTypeId == '01228000000TdFL') {
                //     if (newAcc.Sub_UseD__c == null || newAcc.Sub_UseD__c == '') {
                //         newAcc.IndustryCD__c = null;
                //         newAcc.MarketVerticalsD__c = null;
                //         newAcc.UseD__c = null;
                    // } else if (newAcc.Sub_UseD__c == '废旧金属') {
                    //     newAcc.IndustryCD__c = 'Recycling';
                    //     newAcc.MarketVerticalsD__c = 'Natural Resources';
                    //     newAcc.UseD__c = 'Alloy : Recycling';
                    // } else if (newAcc.Sub_UseD__c == '炼钢厂') {
                    //     newAcc.IndustryCD__c = 'Metal Manufacturing';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Tube/Rod/Bar/Sheet Metal';
                    // } else if (newAcc.Sub_UseD__c == 'PMI-石化行业') {
                    //     newAcc.IndustryCD__c = 'Chemical/Petrochemical/Plastics';
                    //     newAcc.MarketVerticalsD__c = 'Maintenance';
                    //     newAcc.UseD__c = 'PMI';
                    // } else if (newAcc.Sub_UseD__c == 'PMI-管道制造') {
                    //     newAcc.IndustryCD__c = 'Metal Manufacturing';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Pipelines';
                    // } else if (newAcc.Sub_UseD__c == 'PMI-金属制造') {
                    //     newAcc.IndustryCD__c = 'Metal Manufacturing';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Machined Parts';
                    // } else if (newAcc.Sub_UseD__c == 'PMI-电力') {
                    //     newAcc.IndustryCD__c = 'Power Generation';
                    //     newAcc.MarketVerticalsD__c = 'Maintenance';
                    //     newAcc.UseD__c = 'PMI';
                    // } else if (newAcc.Sub_UseD__c == 'RoHS') {
                    //     newAcc.IndustryCD__c = 'Electronics';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Electronic Device';
                    // } else if (newAcc.Sub_UseD__c == 'ELV') {
                    //     newAcc.IndustryCD__c = 'Automotive';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Electronic Device';
                    // } else if (newAcc.Sub_UseD__c == '玩具&皮革') {
                    //     newAcc.IndustryCD__c = 'Other';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Consumer Goods';
                    // } else if (newAcc.Sub_UseD__c == '贵金属-制造') {
                    //     newAcc.IndustryCD__c = 'Other';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Consumer Goods';
                    // } else if (newAcc.Sub_UseD__c == '贵金属-回收') {
                    //     newAcc.IndustryCD__c = 'Other';
                    //     newAcc.MarketVerticalsD__c = 'Natural Resources';
                    //     newAcc.UseD__c = 'Alloy : Precious Metals Recycling';
                    // } else if (newAcc.Sub_UseD__c == '勘探-政府') {
                    //     newAcc.IndustryCD__c = 'Mining/Geology';
                    //     newAcc.MarketVerticalsD__c = 'Natural Resources';
                    //     newAcc.UseD__c = 'Geology : Geological Surveys';
                    // } else if (newAcc.Sub_UseD__c == '勘探-矿业公司') {
                    //     newAcc.IndustryCD__c = 'Mining/Geology';
                    //     newAcc.MarketVerticalsD__c = 'Natural Resources';
                    //     newAcc.UseD__c = 'Mining : Exploration';
                    // } else if (newAcc.Sub_UseD__c == 'Mining-冶炼') {
                    //     newAcc.IndustryCD__c = 'Mining/Geology';
                    //     newAcc.MarketVerticalsD__c = 'Natural Resources';
                    //     newAcc.UseD__c = 'Mining : Processing & Refining & Metallurgy';
                    // } else if (newAcc.Sub_UseD__c == 'Mining-开采') {
                    //     newAcc.IndustryCD__c = 'Mining/Geology';
                    //     newAcc.MarketVerticalsD__c = 'Natural Resources';
                    //     newAcc.UseD__c = 'Mining : Production & Grade Control';
                    // } else if (newAcc.Sub_UseD__c == 'EPA') {
                    //     newAcc.IndustryCD__c = 'Government/Security/Defense';
                    //     newAcc.MarketVerticalsD__c = 'Natural Resources';
                    //     newAcc.UseD__c = 'Regulatory : Enviro-Soil';
                    // } else if (newAcc.Sub_UseD__c == '土壤修复') {
                    //     newAcc.IndustryCD__c = 'Recycling';
                    //     newAcc.MarketVerticalsD__c = 'Natural Resources';
                    //     newAcc.UseD__c = 'Regulatory : Enviro-Soil';
                    // } else if (newAcc.Sub_UseD__c == '土壤研究') {
                    //     newAcc.IndustryCD__c = 'Academic Research';
                    //     newAcc.MarketVerticalsD__c = 'Natural Resources';
                    //     newAcc.UseD__c = 'Regulatory : Enviro-Soil';
                    // } else if (newAcc.Sub_UseD__c == '考古&文物') {
                    //     newAcc.IndustryCD__c = 'Academic Research';
                    //     newAcc.MarketVerticalsD__c = 'Other';
                    //     newAcc.UseD__c = '(Other) Other';
                    // } else if (newAcc.Sub_UseD__c == '录井') {
                    //     newAcc.IndustryCD__c = 'Oil & Gas';
                    //     newAcc.MarketVerticalsD__c = 'Natural Resources';
                    //     newAcc.UseD__c = 'Mining : Exploration';
                    // } else if (newAcc.Sub_UseD__c == '制药') {
                    //     newAcc.IndustryCD__c = 'Pharmaceutical';
                    //     newAcc.MarketVerticalsD__c = 'Manufacturing';
                    //     newAcc.UseD__c = 'Chemical/Plastics/Rubber';
                    // } else if (newAcc.Sub_UseD__c == '三元催化剂') {
                    //     newAcc.IndustryCD__c = 'Automotive';
                    //     newAcc.MarketVerticalsD__c = 'Natural Resources';
                    //     newAcc.UseD__c = 'Alloy : Precious Metals Recycling';
                    // } else if (newAcc.Sub_UseD__c == 'Others') {
                    //     newAcc.IndustryCD__c = 'Other';
                    //     newAcc.MarketVerticalsD__c = 'Other';
                    //     newAcc.UseD__c = '(Other) Other';
                    // }Add 三元催化剂  by 符晓林 2016年6月6日
                
            // if (oldAcc == null || newAcc.Sub_Use__c != oldAcc.Sub_Use__c) {
            //     system.debug('=====');
            //     system.debug('=====recordTypeId' + newAcc.recordTypeId);
            //     system.debug('=====Sub_Use__c' + newAcc.Sub_Use__c);
            //     if (newAcc.recordTypeId == '01228000000TdF6') {
            //         //2021-06-07 gwy 添加代码(自动填选项)
            //         if (newAcc.Sub_Use__c == null || newAcc.Sub_Use__c == '') {
            //             newAcc.IndustryC__c = null;
            //             newAcc.MarketVerticals__c = null;
            //             newAcc.Use__c = null;
            //         } else if (newAcc.Sub_Use__c == 'LED') {
            //             newAcc.IndustryC__c = 'Electronics';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Electronic Device';
            //         } else if (newAcc.Sub_Use__c == 'FPD') {
            //             newAcc.IndustryC__c = 'Electronics';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Electronic Device';
            //         } else if (newAcc.Sub_Use__c == '半导体') {
            //             newAcc.IndustryC__c = 'Electronics';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Semiconductor';
            //         } else if (newAcc.Sub_Use__c == '电子部品') {
            //             newAcc.IndustryC__c = 'Electronics';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Electronic Device';
            //         } else if (newAcc.Sub_Use__c == '太阳能') {
            //             newAcc.IndustryC__c = 'Electronics';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Electronic Device';
            //         } else if (newAcc.Sub_Use__c == '电子类_其他') {
            //             newAcc.IndustryC__c = 'Electronics';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Electronic Device';
            //         } else if (newAcc.Sub_Use__c == '金属') {
            //             newAcc.IndustryC__c = 'Metal Manufacturing';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Casting';
            //         } else if (newAcc.Sub_Use__c == '传统汽车') {
            //             newAcc.IndustryC__c = 'Automotive';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Automotive Body/Engine';
            //         } else if (newAcc.Sub_Use__c == '石油地质') {
            //             newAcc.IndustryC__c = 'Mining/Geology';
            //             newAcc.MarketVerticals__c = 'Natural Resources';
            //             newAcc.Use__c = 'Geology : Geological Surveys';
            //         } else if (newAcc.Sub_Use__c == '五金模具') {
            //             newAcc.IndustryC__c = 'Metal Manufacturing';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Machined Parts';
            //         } else if (newAcc.Sub_Use__c == '重工设备') {
            //             newAcc.IndustryC__c = 'Fabricated Metal Manufacturing';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing) Other';
            //         } else if (newAcc.Sub_Use__c == '材料类_其他') {
            //             newAcc.IndustryC__c = 'Academic Research';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Industrial Scientific research';
            //         } else if (newAcc.Sub_Use__c == '医疗器械') {
            //             newAcc.IndustryC__c = 'Medical Device/Equipment';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing) Other';
            //         } else if (newAcc.Sub_Use__c == '激光加工') {
            //             newAcc.IndustryC__c = 'Other';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing) Other';
            //         } else if (newAcc.Sub_Use__c == '制药') {
            //             newAcc.IndustryC__c = 'Pharmaceutical';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing) Other';
            //         } else if (newAcc.Sub_Use__c == '动植物') {
            //             newAcc.IndustryC__c = 'Food/Feed/Agriculture';
            //             newAcc.MarketVerticals__c = 'Other';
            //             newAcc.Use__c = '(Other) Other';
            //         } else if (newAcc.Sub_Use__c == '新能源汽车') {
            //             newAcc.IndustryC__c = 'Automotive';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Automotive Body/Engine';
            //         } else if (newAcc.Sub_Use__c == '5G-PCB') {
            //             newAcc.IndustryC__c = 'Electronics';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Electronic Device';
            //         } else if (newAcc.Sub_Use__c == '5G-半导体') {
            //             newAcc.IndustryC__c = 'Electronics';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Electronic Device';
            //         } else if (newAcc.Sub_Use__c == '5G-其他') {
            //             newAcc.IndustryC__c = 'Electronics';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Electronic Device';
            //         } else if (newAcc.Sub_Use__c == 'Compo-半导体-前道') {
            //             newAcc.IndustryC__c = 'Electronics';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         } else if (newAcc.Sub_Use__c == 'Compo-半导体-中期') {
            //             newAcc.IndustryC__c = 'Electronics';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         } else if (newAcc.Sub_Use__c == 'Compo-半导体-后道') {
            //             newAcc.IndustryC__c = 'Electronics';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         } else if (newAcc.Sub_Use__c == 'Compo-FPD') {
            //             newAcc.IndustryC__c = 'Electronics';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         } else if (newAcc.Sub_Use__c == 'Compo-3D 测量仪') {
            //             newAcc.IndustryC__c = 'Electronics';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         } else if (newAcc.Sub_Use__c == 'Compo-测试仪器') {
            //             newAcc.IndustryC__c = 'Electronics';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         } else if (newAcc.Sub_Use__c == 'Compo-拉曼光谱仪') {
            //             newAcc.IndustryC__c = 'Academic Research';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         } else if (newAcc.Sub_Use__c == 'Compo-血液') {
            //             newAcc.IndustryC__c = 'Medical Device/Equipment';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         } else if (newAcc.Sub_Use__c == 'Compo-尿液/粪便') {
            //             newAcc.IndustryC__c = 'Medical Device/Equipment';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         } else if (newAcc.Sub_Use__c == 'Compo-细胞学') {
            //             newAcc.IndustryC__c = 'Medical Device/Equipment';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         } else if (newAcc.Sub_Use__c == 'Compo-遗传学') {
            //             newAcc.IndustryC__c = 'Medical Device/Equipment';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         } else if (newAcc.Sub_Use__c == 'Compo-病理') {
            //             newAcc.IndustryC__c = 'Medical Device/Equipment';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         } else if (newAcc.Sub_Use__c == 'Compo-生殖') {
            //             newAcc.IndustryC__c = 'Medical Device/Equipment';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         } else if (newAcc.Sub_Use__c == 'Compo-高端显微镜') {
            //             newAcc.IndustryC__c = 'Academic Research';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         } else if (newAcc.Sub_Use__c == 'Compo-细胞观察') {
            //             newAcc.IndustryC__c = 'Academic Research';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         } else if (newAcc.Sub_Use__c == 'Compo-电子显微镜') {
            //             newAcc.IndustryC__c = 'Academic Research';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         } else if (newAcc.Sub_Use__c == 'Compo-高内涵') {
            //             newAcc.IndustryC__c = 'Academic Research';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         } else if (newAcc.Sub_Use__c == 'Compo-流式细胞仪') {
            //             newAcc.IndustryC__c = 'Academic Research';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         } else if (newAcc.Sub_Use__c == 'Compo-ODM') {
            //             newAcc.IndustryC__c = 'Other';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         } else if (newAcc.Sub_Use__c == 'Compo-精准医疗') {
            //             newAcc.IndustryC__c = 'Academic Research';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         } else if (newAcc.Sub_Use__c == 'Compo-其他') {
            //             newAcc.IndustryC__c = 'Other';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '(Manufacturing)OEM';
            //         }
            //     } else if (newAcc.recordTypeId == '01228000000TdFG') {
            //         if (newAcc.Sub_Use__c == null || newAcc.Sub_Use__c == '') {
            //             newAcc.IndustryC__c = null;
            //             newAcc.MarketVerticals__c = null;
            //             newAcc.Use__c = null;
            //         } else if (newAcc.Sub_Use__c == 'Automotive') {
            //             newAcc.IndustryC__c = 'Automotive';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Automotive Body/Engine';
            //         } else if (newAcc.Sub_Use__c == 'Civil Aviation') {
            //             newAcc.IndustryC__c = 'Aerospace';
            //             newAcc.MarketVerticals__c = 'Maintenance';
            //             newAcc.Use__c = '(Maintenance)Aviation Airframe/Engine';
            //         } else if (newAcc.Sub_Use__c == 'Security/Defense') {
            //             newAcc.IndustryC__c = 'Government/Security/Defense';
            //             newAcc.MarketVerticals__c = 'Other';
            //             newAcc.Use__c = '(Other) Other';
            //         } else if (newAcc.Sub_Use__c == 'Oil,Gas&Chemical') {
            //             newAcc.IndustryC__c = 'Chemical/Petrochemical/Plastics';
            //             newAcc.MarketVerticals__c = 'Maintenance';
            //             newAcc.Use__c = 'Weld Inspection';
            //         } else if (newAcc.Sub_Use__c == 'Power') {
            //             newAcc.IndustryC__c = 'Power Generation';
            //             newAcc.MarketVerticals__c = 'Maintenance';
            //             newAcc.Use__c = 'Heat Exchangers';
            //         } else if (newAcc.Sub_Use__c == 'General Manufacturing') {
            //             newAcc.IndustryC__c = 'Metal Manufacturing';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Machined Parts';
            //         } else if (newAcc.Sub_Use__c == 'Inspection/Service/Rental') {
            //             newAcc.IndustryC__c = 'Inspection/Lab/Rental Sevice Provider';
            //             newAcc.MarketVerticals__c = 'Maintenance';
            //             newAcc.Use__c = 'Process Piping';
            //         } else if (newAcc.Sub_Use__c == 'Others') {
            //             newAcc.IndustryC__c = 'Other';
            //             newAcc.MarketVerticals__c = 'Other';
            //             newAcc.Use__c = '(Other) Other';
            //         } else if (newAcc.Sub_Use__c == 'Thermal Power') {
            //             newAcc.IndustryC__c = 'Power Generation';
            //             newAcc.MarketVerticals__c = 'Maintenance';
            //             newAcc.Use__c = 'Process piping';
            //         } else if (newAcc.Sub_Use__c == 'Nuclear Power') {
            //             newAcc.IndustryC__c = 'Power Generation';
            //             newAcc.MarketVerticals__c = 'Maintenance';
            //             newAcc.Use__c = 'Process piping';
            //         } else if (newAcc.Sub_Use__c == 'Wind Power') {
            //             newAcc.IndustryC__c = 'Power Generation';
            //             newAcc.MarketVerticals__c = 'Maintenance';
            //             newAcc.Use__c = 'Weld Inspection';
            //         } else if (newAcc.Sub_Use__c == 'Power(other)') {
            //             newAcc.IndustryC__c = 'Power Generation';
            //             newAcc.MarketVerticals__c = 'Maintenance';
            //             newAcc.Use__c = 'Corrosion';
            //         }
            //     } else if (newAcc.recordTypeId == '01228000000TdFB') {
            //         if (newAcc.Sub_Use__c == null || newAcc.Sub_Use__c == '') {
            //             newAcc.IndustryC__c = null;
            //             newAcc.MarketVerticals__c = null;
            //             newAcc.Use__c = null;
            //         } else if (newAcc.Sub_Use__c == 'Automotive') {
            //             newAcc.IndustryC__c = 'Automotive';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Automotive Body/Engine';
            //         } else if (newAcc.Sub_Use__c == 'Civil Aviation') {
            //             newAcc.IndustryC__c = 'Aerospace';
            //             newAcc.MarketVerticals__c = 'Maintenance';
            //             newAcc.Use__c = '(Maintenance)Aviation Airframe/Engine';
            //         } else if (newAcc.Sub_Use__c == 'Security/Defense') {
            //             newAcc.IndustryC__c = 'Government/Security/Defense';
            //             newAcc.MarketVerticals__c = 'Other';
            //             newAcc.Use__c = '(Other) Other';
            //         } else if (newAcc.Sub_Use__c == 'Oil,Gas&Chemical') {
            //             newAcc.IndustryC__c = 'Chemical/Petrochemical/Plastics';
            //             newAcc.MarketVerticals__c = 'Maintenance';
            //             newAcc.Use__c = 'Weld Inspection';
            //         } else if (newAcc.Sub_Use__c == 'Power') {
            //             newAcc.IndustryC__c = 'Power Generation';
            //             newAcc.MarketVerticals__c = 'Maintenance';
            //             newAcc.Use__c = 'Heat Exchangers';
            //         } else if (newAcc.Sub_Use__c == 'General Manufacturing') {
            //             newAcc.IndustryC__c = 'Metal Manufacturing';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Machined Parts';
            //         } else if (newAcc.Sub_Use__c == 'Inspection/Service/Rental') {
            //             newAcc.IndustryC__c = 'Inspection/Lab/Rental Sevice Provider';
            //             newAcc.MarketVerticals__c = 'Maintenance';
            //             newAcc.Use__c = 'Process Piping';
            //         } else if (newAcc.Sub_Use__c == 'Others') {
            //             newAcc.IndustryC__c = 'Other';
            //             newAcc.MarketVerticals__c = 'Other';
            //             newAcc.Use__c = '(Other) Other';
            //         } else if (newAcc.Sub_Use__c == 'Thermal Power') {
            //             newAcc.IndustryC__c = 'Power Generation';
            //             newAcc.MarketVerticals__c = 'Maintenance';
            //             newAcc.Use__c = 'Heat Exchangers';
            //         } else if (newAcc.Sub_Use__c == 'Nuclear Power') {
            //             newAcc.IndustryC__c = 'Power Generation';
            //             newAcc.MarketVerticals__c = 'Maintenance';
            //             newAcc.Use__c = 'Process Piping';
            //         } else if (newAcc.Sub_Use__c == 'Wind Power') {
            //             newAcc.IndustryC__c = 'Power Generation';
            //             newAcc.MarketVerticals__c = 'Maintenance';
            //             newAcc.Use__c = 'Gear Box';
            //         } else if (newAcc.Sub_Use__c == 'Power(other)') {
            //             newAcc.IndustryC__c = 'Power Generation';
            //             newAcc.MarketVerticals__c = 'Maintenance';
            //             newAcc.Use__c = 'Corrosion';
            //         }
            //     } else if (newAcc.recordTypeId == '01228000000TdFL') {
            //         if (newAcc.Sub_Use__c == null || newAcc.Sub_Use__c == '') {
            //             newAcc.IndustryC__c = null;
            //             newAcc.MarketVerticals__c = null;
            //             newAcc.Use__c = null;
            //         } else if (newAcc.Sub_Use__c == '废旧金属') {
            //             newAcc.IndustryC__c = 'Recycling';
            //             newAcc.MarketVerticals__c = 'Natural Resources';
            //             newAcc.Use__c = 'Alloy : Recycling';
            //         } else if (newAcc.Sub_Use__c == '炼钢厂') {
            //             newAcc.IndustryC__c = 'Metal Manufacturing';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = '   Tube/Rod/Bar/Sheet Metal';
            //         } else if (newAcc.Sub_Use__c == 'PMI-石化行业') {
            //             newAcc.IndustryC__c = 'Chemical/Petrochemical/Plastics';
            //             newAcc.MarketVerticals__c = 'Maintenance';
            //             newAcc.Use__c = 'PMI';
            //         } else if (newAcc.Sub_Use__c == 'PMI-管道制造') {
            //             newAcc.IndustryC__c = 'Metal Manufacturing';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Pipelines';
            //         } else if (newAcc.Sub_Use__c == 'PMI-金属制造') {
            //             newAcc.IndustryC__c = 'Metal Manufacturing';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Machined Parts';
            //         } else if (newAcc.Sub_Use__c == 'PMI-电力') {
            //             newAcc.IndustryC__c = 'Power Generation';
            //             newAcc.MarketVerticals__c = 'Maintenance';
            //             newAcc.Use__c = 'PMI';
            //         } else if (newAcc.Sub_Use__c == 'RoHS') {
            //             newAcc.IndustryC__c = 'Electronics';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Electronic Device';
            //         } else if (newAcc.Sub_Use__c == 'ELV') {
            //             newAcc.IndustryC__c = 'Automotive';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Electronic Device';
            //         } else if (newAcc.Sub_Use__c == '玩具&皮革') {
            //             newAcc.IndustryC__c = 'Other';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Consumer Goods';
            //         } else if (newAcc.Sub_Use__c == '贵金属-制造') {
            //             newAcc.IndustryC__c = 'Other';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Consumer Goods';
            //         } else if (newAcc.Sub_Use__c == '贵金属-回收') {
            //             newAcc.IndustryC__c = 'Other';
            //             newAcc.MarketVerticals__c = 'Natural Resources';
            //             newAcc.Use__c = 'Alloy : Precious Metals Recycling';
            //         } else if (newAcc.Sub_Use__c == '勘探-政府') {
            //             newAcc.IndustryC__c = 'Mining/Geology';
            //             newAcc.MarketVerticals__c = 'Natural Resources';
            //             newAcc.Use__c = 'Geology : Geological Surveys';
            //         } else if (newAcc.Sub_Use__c == '勘探-矿业公司') {
            //             newAcc.IndustryC__c = 'Mining/Geology';
            //             newAcc.MarketVerticals__c = 'Natural Resources';
            //             newAcc.Use__c = 'Mining : Exploration';
            //         } else if (newAcc.Sub_Use__c == 'Mining-冶炼') {
            //             newAcc.IndustryC__c = 'Mining/Geology';
            //             newAcc.MarketVerticals__c = 'Natural Resources';
            //             newAcc.Use__c = 'Mining : Processing & Refining & Metallurgy';
            //         } else if (newAcc.Sub_Use__c == 'Mining-开采') {
            //             newAcc.IndustryC__c = 'Mining/Geology';
            //             newAcc.MarketVerticals__c = 'Natural Resources';
            //             newAcc.Use__c = 'Mining : Production & Grade Control';
            //         } else if (newAcc.Sub_Use__c == 'EPA') {
            //             newAcc.IndustryC__c = 'Government/Security/Defense';
            //             newAcc.MarketVerticals__c = 'Natural Resources';
            //             newAcc.Use__c = 'Regulatory : Enviro-Soil';
            //         } else if (newAcc.Sub_Use__c == '土壤修复') {
            //             newAcc.IndustryC__c = 'Recycling';
            //             newAcc.MarketVerticals__c = 'Natural Resources';
            //             newAcc.Use__c = 'Regulatory : Enviro-Soil';
            //         } else if (newAcc.Sub_Use__c == '土壤研究') {
            //             newAcc.IndustryC__c = 'Academic Research';
            //             newAcc.MarketVerticals__c = 'Natural Resources';
            //             newAcc.Use__c = 'Regulatory : Enviro-Soil';
            //         } else if (newAcc.Sub_Use__c == '考古&文物') {
            //             newAcc.IndustryC__c = 'Academic Research';
            //             newAcc.MarketVerticals__c = 'Other';
            //             newAcc.Use__c = '(Other) Other';
            //         } else if (newAcc.Sub_Use__c == '录井') {
            //             newAcc.IndustryC__c = 'Oil & Gas';
            //             newAcc.MarketVerticals__c = 'Natural Resources';
            //             newAcc.Use__c = 'Mining : Exploration';
            //         } else if (newAcc.Sub_Use__c == '制药') {
            //             newAcc.IndustryC__c = 'Pharmaceutical';
            //             newAcc.MarketVerticals__c = 'Manufacturing';
            //             newAcc.Use__c = 'Chemical/Plastics/Rubber';
            //         } else if (newAcc.Sub_Use__c == '三元催化剂') {
            //             newAcc.IndustryC__c = 'Automotive';
            //             newAcc.MarketVerticals__c = 'Natural Resources';
            //             newAcc.Use__c = 'Alloy : Precious Metals Recycling';
            //         } else if (newAcc.Sub_Use__c == 'Others') {
            //             newAcc.IndustryC__c = 'Other';
            //             newAcc.MarketVerticals__c = 'Other';
            //             newAcc.Use__c = '(Other) Other';
            //         }//Add 三元催化剂  by 符晓林 2016年6月6日
            //     }
            //    }
            //}   

    public static void updateForDealer(List<Account> newList, Map<Id, Account> newMap, List<Account> oldList, Map<Id, Account> oldMap) {
        //王鹏伟 服务部修改联系人重新审批 判断当前修改的登陆人是否是孙学洋  吴晓东
        String now_userId = UserInfo.getUserId();
        Map<Id, Id> manager = new Map<Id, Id>();
        for (Account newAcc : newList) {
            Account oldAcc = oldMap.get(newAcc.Id);
            /*if (newAcc.DealerSelectOwner__c != null ) {
                manager.put(newAcc.DealerSelectOwner__c , newAcc.Id);
            }*/
            if (newAcc.WebsiteD__c != oldAcc.WebsiteD__c ||
                    newAcc.FaxD__c != oldAcc.FaxD__c ||
                    //newAcc.CreatedByD__c != oldAcc.CreatedBy ||
                    newAcc.PhoneD__c != oldAcc.PhoneD__c ||
                    newAcc.Address1D__c != oldAcc.Address1D__c ||
                    newAcc.AssetANI4D__c != oldAcc.AssetANI4D__c ||
                    newAcc.AssetIE7D__c != oldAcc.AssetIE7D__c ||
                    newAcc.AssetNDT7D__c != oldAcc.AssetNDT7D__c ||
                    //newAcc.DealerD__c != oldAcc.DealerD__c ||
                    //newAcc.DepartmentNameD__c != oldAcc.DepartmentNameD__c ||
                    //newAcc.DivisionNameD__c != oldAcc.DivissionNameD__c ||
                    newAcc.AssetRVI5D__c != oldAcc.AssetRVI5D__c ||
                    newAcc.EnglishNameD__c != oldAcc.EnglishNameD__c ||
                    //newAcc.ExportRegulatedCustomerD__c != oldAcc.ExportRegulatedCustomerD__c ||
                    //newAcc.FacilityNameD__c != oldAcc.FacilityNameD__c ||
                    newAcc.AssetRVI2D__c != oldAcc.AssetRVI2D__c ||
                    newAcc.AssetNDT4D__c != oldAcc.AssetNDT4D__c ||
                    newAcc.IndustryCD__c != oldAcc.IndustryCD__c ||
                    //gwy BS
                    //newAcc.IndustryBD__c != oldAcc.IndustryBD__c ||
                    newAcc.AssetRVI4D__c != oldAcc.AssetRVI4D__c ||
                    newAcc.AssetRVI3D__c != oldAcc.AssetRVI3D__c ||
                    //newAcc.KeyAccountD__c != oldAcc.KeyAccountD__c ||
                    newAcc.AssetIE5D__c != oldAcc.AssetIE5D__c ||
                    newAcc.AssetBS3D__c != oldAcc.AssetBS3D__c ||
                    newAcc.AssetIE3D__c != oldAcc.AssetIE3D__c ||
                    newAcc.AssetANI7D__c != oldAcc.AssetANI7D__c ||
                    newAcc.AssetNDT6D__c != oldAcc.AssetNDT6D__c ||
                    newAcc.MarketVerticalsD__c != oldAcc.MarketVerticalsD__c ||
                    newAcc.AssetIE6D__c != oldAcc.AssetIE6D__c ||
                    newAcc.AssetIE2D__c != oldAcc.AssetIE2D__c ||
                    newAcc.AssetBS2D__c != oldAcc.AssetBS2D__c ||
                    newAcc.AssetANI3D__c != oldAcc.AssetANI3D__c ||
                    newAcc.AssetIE1D__c != oldAcc.AssetIE1D__c ||
                    newAcc.AssetBS1D__c != oldAcc.AssetBS1D__c ||
                    newAcc.AssetRVI1D__c != oldAcc.AssetRVI1D__c ||
                    newAcc.AssetNDT1D__c != oldAcc.AssetNDT1D__c ||
                    newAcc.AssetANI1D__c != oldAcc.AssetANI1D__c ||
                    newAcc.AssetNDT8D__c != oldAcc.AssetNDT8D__c ||
                    newAcc.AssetANI8D__c != oldAcc.AssetANI8D__c ||
                    newAcc.AssetBS5D__c != oldAcc.AssetBS5D__c ||
                    newAcc.AssetIE8D__c != oldAcc.AssetIE8D__c ||
                    newAcc.AssetRVI8D__c != oldAcc.AssetRVI8D__c ||
                    newAcc.AssetANI5D__c != oldAcc.AssetANI5D__c ||
                    //newAcc.ProvinceD__c != oldAcc.ProvinceD__c ||
                    newAcc.AssetRVI6D__c != oldAcc.AssetRVI6D__c ||
                    newAcc.AssetANI2D__c != oldAcc.AssetANI2D__c ||
                    newAcc.AssetNDT3D__c != oldAcc.AssetNDT3D__c ||
                    newAcc.AssetNDT2D__c != oldAcc.AssetNDT2D__c ||
                    newAcc.AssetANI6D__c != oldAcc.AssetANI6D__c ||
                    newAcc.Sub_UseD__c != oldAcc.Sub_UseD__c ||
                    newAcc.Sub_UseA__c != oldAcc.Sub_UseA__c ||
                    newAcc.UseD__c != oldAcc.UseD__c ||
                    newAcc.AssetRVI7D__c != oldAcc.AssetRVI7D__c ||
                    newAcc.AssetBS4D__c != oldAcc.AssetBS4D__c ||
                    newAcc.AssetIE4D__c != oldAcc.AssetIE4D__c ||
                    newAcc.AssetNDT5D__c != oldAcc.AssetNDT5D__c ||
                    newAcc.AccountStatusD__c != oldAcc.AccountStatusD__c ||
                    newAcc.CancelReasonD__c != oldAcc.CancelReasonD__c ||
                    newAcc.CityD__c != oldAcc.CityD__c ||
                    newAcc.PostCodeD__c != oldAcc.PostCodeD__c ||
                    newAcc.DealerSelectOwner__c != oldAcc.DealerSelectOwner__c ||
                    newAcc.FacilityNameD__c != oldAcc.FacilityNameD__c ||
                    newAcc.DivisionName_D__c != oldAcc.DivisionName_D__c ||
                    newAcc.DepartmentNameD__c != oldAcc.DepartmentNameD__c) {
                // String profileId = UserInfo.getProfileId().subString(0, 15);
                //新的获取人员简档ID
                String new_profileId = calendarUtil.getMemberProfileID(UserInfo.getUserId().subString(0,15));
                //System.debug('profileId:'+profileId+'---------'+'new_profileId:'+new_profileId);
                //王鹏伟 添加判断  || now_userId =='00528000000YWC6' || now_userId =='00528000000YWE7'
                //00528000000YWC6 孙 学洋
                //00528000000YWE7 吴 晓东
                //王鹏伟 添加&&((oldCon.ProductSegmentIE__c == true || oldCon.ProductSegmentRVI__c == true) && oldCon.isServiceCreate__c == true)
                //服务部修改联系人信息 LS、NDT、ANI无需审批跳过审批状态变草案
                //新增权限整理2021-05-10
                if ((new_profileId.subString(0, 15) == System.label.Service_Owner
                        //新增权限整理2021-05-10
                        || UserInfo.getUserType() == 'PowerPartner' || now_userId == '00528000000YWC6' || now_userId == '00528000000YWE7')
                        && !((oldAcc.ProductSegment__c == 'BS' || oldAcc.ProductSegment__c == 'NDT' || oldAcc.ProductSegment__c == 'ANI') && oldAcc.serviceCreate__c == true)) {
                    newAcc.stautesD__c = 'Draft';
                }
            }


            if (newAcc.Website != oldAcc.Website) {
                newAcc.WebsiteD__c = newAcc.Website;
            }
            if (newAcc.Fax != oldAcc.Fax) {
                newAcc.FaxD__c = newAcc.Fax;
            }
            //newAcc.CreatedByD__c = newAcc.CreatedBy;
            if (newAcc.Phone != oldAcc.Phone) {
                newAcc.PhoneD__c = newAcc.Phone;
            }
            if (newAcc.Address1__c != oldAcc.Address1__c) {
                newAcc.Address1D__c = newAcc.Address1__c;
            }
            if (newAcc.AssetANI4__c != oldAcc.AssetANI4__c) {
                newAcc.AssetANI4D__c = newAcc.AssetANI4__c;
            }
            if (newAcc.AssetIE7__c != oldAcc.AssetIE7__c) {
                newAcc.AssetIE7D__c = newAcc.AssetIE7__c;
            }
            if (newAcc.AssetNDT7__c != oldAcc.AssetNDT7__c) {
                newAcc.AssetNDT7D__c = newAcc.AssetNDT7__c;
            }
            //newAcc.DealerD__c = newAcc.DealerName__c;
            //newAcc.DepartmentNameD__c = newAcc.DepartmentName__c;
            //newAcc.DivisionNameD__c = newAcc.DivissionName__c;
            if (newAcc.AssetRVI5__c != oldAcc.AssetRVI5__c) {
                newAcc.AssetRVI5D__c = newAcc.AssetRVI5__c;
            }
            if (newAcc.EnglishName__c != oldAcc.EnglishName__c) {
                newAcc.EnglishNameD__c = newAcc.EnglishName__c;
            }
            //newAcc.ExportRegulatedCustomerD__c = newAcc.Export_Regulated_Customer__c;
            //newAcc.FacilityNameD__c = newAcc.FacilityName__c;
            if (newAcc.AssetRVI2__c != oldAcc.AssetRVI2__c) {
                newAcc.AssetRVI2D__c = newAcc.AssetRVI2__c;
            }
            if (newAcc.AssetNDT4__c != oldAcc.AssetNDT4__c) {
                newAcc.AssetNDT4D__c = newAcc.AssetNDT4__c;
            }
            //gwy BS
            /*if (newAcc.IndustryB__c != oldAcc.IndustryB__c) {
                newAcc.IndustryBD__c = newAcc.IndustryB__c;
            }*/
            if (newAcc.IndustryC__c != oldAcc.IndustryC__c) {
                newAcc.IndustryCD__c = newAcc.IndustryC__c;
            }
            if (newAcc.AssetRVI4__c != oldAcc.AssetRVI4__c) {
                newAcc.AssetRVI4D__c = newAcc.AssetRVI4__c;
            }
            if (newAcc.AssetRVI3__c != oldAcc.AssetRVI3__c) {
                newAcc.AssetRVI3D__c = newAcc.AssetRVI3__c;
            }
            //newAcc.KeyAccountD__c = newAcc.KeyAccount__c;
            if (newAcc.AssetIE5__c != oldAcc.AssetIE5__c) {
                newAcc.AssetIE5D__c = newAcc.AssetIE5__c;
            }
            if (newAcc.AssetBS3__c != oldAcc.AssetBS3__c) {
                newAcc.AssetBS3D__c = newAcc.AssetBS3__c;
            }
            if (newAcc.AssetIE3__c != oldAcc.AssetIE3__c) {
                newAcc.AssetIE3D__c = newAcc.AssetIE3__c;
            }
            if (newAcc.AssetANI7__c != oldAcc.AssetANI7__c) {
                newAcc.AssetANI7D__c = newAcc.AssetANI7__c;
            }
            if (newAcc.AssetNDT6__c != oldAcc.AssetNDT6__c) {
                newAcc.AssetNDT6D__c = newAcc.AssetNDT6__c;
            }
            if (newAcc.MarketVerticals__c != oldAcc.MarketVerticals__c) {
                newAcc.MarketVerticalsD__c = newAcc.MarketVerticals__c;
            }
            if (newAcc.AssetIE6__c != oldAcc.AssetIE6__c) {
                newAcc.AssetIE6D__c = newAcc.AssetIE6__c;
            }
            if (newAcc.AssetIE2__c != oldAcc.AssetIE2__c) {
                newAcc.AssetIE2D__c = newAcc.AssetIE2__c;
            }
            if (newAcc.AssetBS2__c != oldAcc.AssetBS2__c) {
                newAcc.AssetBS2D__c = newAcc.AssetBS2__c;
            }
            if (newAcc.AssetANI3__c != oldAcc.AssetANI3__c) {
                newAcc.AssetANI3D__c = newAcc.AssetANI3__c;
            }
            if (newAcc.AssetIE1__c != oldAcc.AssetIE1__c) {
                newAcc.AssetIE1D__c = newAcc.AssetIE1__c;
            }
            if (newAcc.AssetBS1__c != oldAcc.AssetBS1__c) {
                newAcc.AssetBS1D__c = newAcc.AssetBS1__c;
            }
            if (newAcc.AssetRVI1__c != oldAcc.AssetRVI1__c) {
                newAcc.AssetRVI1D__c = newAcc.AssetRVI1__c;
            }
            if (newAcc.AssetNDT1__c != oldAcc.AssetNDT1__c) {
                newAcc.AssetNDT1D__c = newAcc.AssetNDT1__c;
            }
            if (newAcc.AssetANI1__c != oldAcc.AssetANI1__c) {
                newAcc.AssetANI1D__c = newAcc.AssetANI1__c;
            }
            if (newAcc.AssetNDT8__c != oldAcc.AssetNDT8__c) {
                newAcc.AssetNDT8D__c = newAcc.AssetNDT8__c;
            }
            if (newAcc.AssetANI8__c != oldAcc.AssetANI8__c) {
                newAcc.AssetANI8D__c = newAcc.AssetANI8__c;
            }
            if (newAcc.AssetBS5__c != oldAcc.AssetBS5__c) {
                newAcc.AssetBS5D__c = newAcc.AssetBS5__c;
            }
            if (newAcc.AssetIE8__c != oldAcc.AssetIE8__c) {
                newAcc.AssetIE8D__c = newAcc.AssetIE8__c;
            }
            if (newAcc.AssetRVI8__c != oldAcc.AssetRVI8__c) {
                newAcc.AssetRVI8D__c = newAcc.AssetRVI8__c;
            }
            if (newAcc.AssetANI5__c != oldAcc.AssetANI5__c) {
                newAcc.AssetANI5D__c = newAcc.AssetANI5__c;
            }
            //newAcc.ProvinceD__c = newAcc.Province__c;
            if (newAcc.AssetRVI6__c != oldAcc.AssetRVI6__c) {
                newAcc.AssetRVI6D__c = newAcc.AssetRVI6__c;
            }
            if (newAcc.AssetANI2__c != oldAcc.AssetANI2__c) {
                newAcc.AssetANI2D__c = newAcc.AssetANI2__c;
            }
            if (newAcc.AssetNDT3__c != oldAcc.AssetNDT3__c) {
                newAcc.AssetNDT3D__c = newAcc.AssetNDT3__c;
            }
            if (newAcc.AssetNDT2__c != oldAcc.AssetNDT2__c) {
                newAcc.AssetNDT2D__c = newAcc.AssetNDT2__c;
            }
            if (newAcc.AssetANI6__c != oldAcc.AssetANI6__c) {
                newAcc.AssetANI6D__c = newAcc.AssetANI6__c;
            }
            if (newAcc.Sub_Use1__c != oldAcc.Sub_Use1__c) {
                newAcc.Sub_UseA__c = newAcc.Sub_Use1__c;
            }
            if (newAcc.Sub_Use__c != oldAcc.Sub_Use__c) {
                newAcc.Sub_UseD__c = newAcc.Sub_Use__c;
            }
            if (newAcc.Use__c != oldAcc.Use__c) {
                newAcc.UseD__c = newAcc.Use__c;
            }
            if (newAcc.AssetRVI7__c != oldAcc.AssetRVI7__c) {
                newAcc.AssetRVI7D__c = newAcc.AssetRVI7__c;
            }
            if (newAcc.AssetBS4__c != oldAcc.AssetBS4__c) {
                newAcc.AssetBS4D__c = newAcc.AssetBS4__c;
            }
            if (newAcc.AssetIE4__c != oldAcc.AssetIE4__c) {
                newAcc.AssetIE4D__c = newAcc.AssetIE4__c;
            }
            if (newAcc.AssetNDT5__c != oldAcc.AssetNDT5__c) {
                newAcc.AssetNDT5D__c = newAcc.AssetNDT5__c;
            }

            if (newAcc.AccountStatus__c != oldAcc.AccountStatus__c) {
                newAcc.AccountStatusD__c = newAcc.AccountStatus__c;
            }
            if (newAcc.CancelReason__c != oldAcc.CancelReason__c) {
                newAcc.CancelReasonD__c = newAcc.CancelReason__c;
            }
            if (newAcc.City__c != oldAcc.City__c) {
                newAcc.CityD__c = newAcc.City__c;
            }
            if (newAcc.PostCode__c != oldAcc.PostCode__c) {
                newAcc.PostCodeD__c = newAcc.PostCode__c;
            }

            if (newAcc.OwnerId != oldAcc.OwnerId) {
                newAcc.DealerSelectOwner__c = newAcc.OwnerId;
            }
            //王鹏伟 新加  大区经理随审批人实时变化 开始
            if (newAcc.DealerSelectOwner__c != null ) {
                manager.put(newAcc.DealerSelectOwner__c , newAcc.Id);
            }
            //王鹏伟 新加  大区经理随审批人实时变化 结束
            if (newAcc.FacilityName__c != oldAcc.FacilityName__c) {
                newAcc.FacilityNameD__c = newAcc.FacilityName__c;
            }
            if (newAcc.DivisionName__c != oldAcc.DivisionName__c) {
                newAcc.DivisionName_D__c = newAcc.DivisionName__c;
            }
            if (newAcc.DepartmentName__c != oldAcc.DepartmentName__c) {
                newAcc.DepartmentNameD__c = newAcc.DepartmentName__c;
            }
            //gwy 2021-06-08 客户取消邮编必填项
            /*if (newAcc.PostCodeD__c == null) {
                newAcc.PostCodeD__c = '000000';
            }*/
            //王鹏伟新加 服务部创建客户联系人
            if ((newAcc.DealerSelectOwner__c != oldAcc.DealerSelectOwner__c) && String.isNotBlank(newAcc.DealerSelectOwner__c) && newAcc.serviceCreate__c == true) {
                newAcc.OwnerId = newAcc.DealerSelectOwner__c;
            }
            //王鹏伟新加 结束
            //   拼接客户  by hanchao 20160809
            // String new_profileId1 = UserInfo.getProfileId().subString(0,15);
            //新的获取人员简档ID
            String new_profileId1 = calendarUtil.getMemberProfileID(UserInfo.getUserId().subString(0,15));
            //System.debug('new_profileId1:'+new_profileId1+'---------'+'new_profileId1:'+new_profileId1);

            if ((new_profileId1.subString(0, 15) == System.label.Market_Department1 || new_profileId1.subString(0, 15) == System.label.Market_Department || new_profileId1.subString(0, 15) == System.label.Service_Owner 
                    || UserInfo.getUserType() == 'PowerPartner') &&
                    newAcc.IsNew__c == true && (newAcc.FacilityNameD__c != oldAcc.FacilityNameD__c ||
                                                newAcc.DivisionName_D__c != oldAcc.DivisionName_D__c ||
                                                newAcc.DepartmentNameD__c != oldAcc.DepartmentNameD__c )) {

                String DivisionName1;
                String DepartmentName1;
                if (newAcc.DivisionName_D__c == '无' || newAcc.DivisionName_D__c == null) {
                    DivisionName1 = '';
                } else {DivisionName1 = newAcc.DivisionName_D__c;}
                if (newAcc.DepartmentNameD__c == '无' || newAcc.DepartmentNameD__c == null) {
                    DepartmentName1 = '';
                } else {DepartmentName1 = newAcc.DepartmentNameD__c;}

                newAcc.Name = newAcc.FacilityNameD__c + DivisionName1 + ' ' + DepartmentName1;


            }
        }

        List<User> userList = new List<User>();
        Set<Id> userid = new Set<Id>();
        userid.addAll(manager.keySet());
        system.debug(manager);
        system.debug(userid);
        userList = [select id,SalesManager__c,BS_AsistGenManger__c from User where id in :userid];
        system.debug(userList);
        if (userList.size() > 0) {
            for (User use : userList) {
                Id accid = manager.get(use.Id);
                system.debug('Manager__c--accid:'+accid);
                system.debug('use:'+use);
                system.debug(newMap);
                if (newMap.get(accid).ProductSegment__c == 'BS') {
                    newMap.get(accid).Manager__c = use.BS_AsistGenManger__c;
                }else {
                    newMap.get(accid).Manager__c = use.SalesManager__c;
                }
                system.debug(newMap.get(accid).Manager__c);
            }
        }
    }

    public static void dealerAccountApproval(List<Account> newList, Map<Id, Account> newMap, List<Account> oldList, Map<Id, Account> oldMap) {
        for (Account newAcc : newList) {
            Account oldAcc = oldMap.get(newAcc.Id);
            // String new_profileId1 = UserInfo.getProfileId().subString(0,15);
            //新的获取人员简档ID
            String new_profileId1 = calendarUtil.getMemberProfileID(UserInfo.getUserId().subString(0,15));
            //System.debug('new_profileId1:'+new_profileId1+'---------'+'new_profileId1:'+new_profileId1);

            String record = newAcc.RecordTypeId;
            system.debug(record);
            //王鹏伟 服务部创建客户联系人 修改  添加判断条件 || newAcc.serviceCreate__c == true
            if (new_profileId1.subString(0, 15) == System.label.Market_Department || new_profileId1.subString(0, 15) == System.label.Market_Department1 || newAcc.serviceCreate__c == true
                ){
                if (newAcc.stautesD__c == 'Pass') {
                    newAcc.Website = newAcc.WebsiteD__c;
                    newAcc.Fax = newAcc.FaxD__c;
                    //newAcc.CreatedBy = newAcc.CreatedByD__c;
                    newAcc.Phone = newAcc.PhoneD__c;
                    newAcc.Address1__c = newAcc.Address1D__c;
                    newAcc.AssetANI4__c = newAcc.AssetANI4D__c;
                    newAcc.AssetIE7__c = newAcc.AssetIE7D__c;
                    newAcc.AssetNDT7__c = newAcc.AssetNDT7D__c;
                    //newAcc.Dealer__c = newAcc.DealerNameD__c;
                    //newAcc.DepartmentName__c = newAcc.DepartmentNameD__c;
                    //newAcc.DivisionName__c = newAcc.DivissionNameD__c;
                    newAcc.AssetRVI5__c = newAcc.AssetRVI5D__c;
                    newAcc.EnglishName__c = newAcc.EnglishNameD__c;
                    //newAcc.ExportRegulatedCustomer__c = newAcc.Export_Regulated_CustomerD__c;
                    //newAcc.FacilityName__c = newAcc.FacilityNameD__c;
                    newAcc.AssetRVI2__c = newAcc.AssetRVI2D__c;
                    newAcc.AssetNDT4__c = newAcc.AssetNDT4D__c;
                    //gwy 2021-06-15 更改
                    newAcc.IndustryC__c = newAcc.IndustryCD__c;
                    newAcc.IndustryB__c = newAcc.IndustryBD__c;
                    //newAcc.IndustryB__c = newAcc.IndustryBD__c;
                    newAcc.AssetRVI4__c = newAcc.AssetRVI4D__c;
                    newAcc.AssetRVI3__c = newAcc.AssetRVI3D__c;
                    //newAcc.KeyAccount__c = newAcc.KeyAccountD__c;
                    newAcc.AssetIE5__c = newAcc.AssetIE5D__c;
                    newAcc.AssetBS3__c = newAcc.AssetBS3D__c;
                    newAcc.AssetIE3__c = newAcc.AssetIE3D__c;
                    newAcc.AssetANI7__c = newAcc.AssetANI7D__c;
                    newAcc.AssetNDT6__c = newAcc.AssetNDT6D__c;
                    newAcc.MarketVerticals__c = newAcc.MarketVerticalsD__c;
                    newAcc.AssetIE6__c = newAcc.AssetIE6D__c;
                    newAcc.AssetIE2__c = newAcc.AssetIE2D__c;
                    newAcc.AssetBS2__c = newAcc.AssetBS2D__c;
                    newAcc.AssetANI3__c = newAcc.AssetANI3D__c;
                    newAcc.AssetIE1__c = newAcc.AssetIE1D__c;
                    newAcc.AssetBS1__c = newAcc.AssetBS1D__c;
                    newAcc.AssetRVI1__c = newAcc.AssetRVI1D__c;
                    newAcc.AssetNDT1__c = newAcc.AssetNDT1D__c;
                    newAcc.AssetANI1__c = newAcc.AssetANI1D__c;
                    newAcc.AssetNDT8__c = newAcc.AssetNDT8D__c;
                    newAcc.AssetANI8__c = newAcc.AssetANI8D__c;
                    newAcc.AssetBS5__c = newAcc.AssetBS5D__c;
                    newAcc.AssetIE8__c = newAcc.AssetIE8D__c;
                    newAcc.AssetRVI8__c = newAcc.AssetRVI8D__c;
                    newAcc.AssetANI5__c = newAcc.AssetANI5D__c;
                    //newAcc.Province__c = newAcc.ProvinceD__c;
                    newAcc.AssetRVI6__c = newAcc.AssetRVI6D__c;
                    newAcc.AssetANI2__c = newAcc.AssetANI2D__c;
                    newAcc.AssetNDT3__c = newAcc.AssetNDT3D__c;
                    newAcc.AssetNDT2__c = newAcc.AssetNDT2D__c;
                    newAcc.AssetANI6__c = newAcc.AssetANI6D__c;
                    newAcc.Sub_Use1__c = newAcc.Sub_UseA__c;
                    newAcc.Sub_Use__c = newAcc.Sub_UseD__c;
                    newAcc.Use__c = newAcc.UseD__c;
                    newAcc.AssetRVI7__c = newAcc.AssetRVI7D__c;
                    newAcc.AssetBS4__c = newAcc.AssetBS4D__c;
                    newAcc.AssetIE4__c = newAcc.AssetIE4D__c;
                    newAcc.AssetNDT5__c = newAcc.AssetNDT5D__c;

                    newAcc.AccountStatus__c = newAcc.AccountStatusD__c;
                    newAcc.CancelReason__c = newAcc.CancelReasonD__c;
                    newAcc.City__c = newAcc.CityD__c;
                    newAcc.PostCode__c = newAcc.PostCodeD__c;
                    newAcc.FacilityName__c = newAcc.FacilityNameD__c;
                    newAcc.DivisionName__c = newAcc.DivisionName_D__c;
                    newAcc.DepartmentName__c = newAcc.DepartmentNameD__c;

                    String DivisionName;
                    String DepartmentName;
                    if (newAcc.DivisionName__c == '无' || newAcc.DivisionName__c == null) {
                        DivisionName = '';
                    } else {DivisionName = newAcc.DivisionName__c;}
                    if (newAcc.DepartmentName__c == '无' || newAcc.DepartmentName__c == null) {
                        DepartmentName = '';
                    } else {DepartmentName = newAcc.DepartmentName__c;}

                    newAcc.Name = newAcc.FacilityNameD__c + DivisionName + ' ' + DepartmentName;

                    if (newAcc.IsNew__c = true) {
                        newAcc.IsNew__c = false;
                    }
                    if (String.isNotBlank(newAcc.DealerSelectOwner__c)) {
                        newAcc.OwnerId = newAcc.DealerSelectOwner__c;
                    }
                }
            }
            if (newAcc.stautesD__c != oldAcc.stautesD__c && record.substring(0, 15) != '012280000005gnE') {
                // 批准时
                if (newAcc.stautesD__c == 'Pass') {
                    newAcc.Website = newAcc.WebsiteD__c;
                    newAcc.Fax = newAcc.FaxD__c;
                    //newAcc.CreatedBy = newAcc.CreatedByD__c;
                    newAcc.Phone = newAcc.PhoneD__c;
                    newAcc.Address1__c = newAcc.Address1D__c;
                    newAcc.AssetANI4__c = newAcc.AssetANI4D__c;
                    newAcc.AssetIE7__c = newAcc.AssetIE7D__c;
                    newAcc.AssetNDT7__c = newAcc.AssetNDT7D__c;
                    //newAcc.Dealer__c = newAcc.DealerNameD__c;
                    //newAcc.DepartmentName__c = newAcc.DepartmentNameD__c;
                    //newAcc.DivisionName__c = newAcc.DivissionNameD__c;
                    newAcc.AssetRVI5__c = newAcc.AssetRVI5D__c;
                    newAcc.EnglishName__c = newAcc.EnglishNameD__c;
                    //newAcc.ExportRegulatedCustomer__c = newAcc.Export_Regulated_CustomerD__c;
                    //newAcc.FacilityName__c = newAcc.FacilityNameD__c;
                    newAcc.AssetRVI2__c = newAcc.AssetRVI2D__c;
                    newAcc.AssetNDT4__c = newAcc.AssetNDT4D__c;
                    //gwy 2021-06-15 更改
                    newAcc.IndustryB__c = newAcc.IndustryBD__c;
                    newAcc.IndustryC__c = newAcc.IndustryCD__c;
                    //newAcc.IndustryC__c = newAcc.IndustryBD__c;
                    //newAcc.IndustryB__c = newAcc.IndustryBD__c;
                    newAcc.AssetRVI4__c = newAcc.AssetRVI4D__c;
                    newAcc.AssetRVI3__c = newAcc.AssetRVI3D__c;
                    //newAcc.KeyAccount__c = newAcc.KeyAccountD__c;
                    newAcc.AssetIE5__c = newAcc.AssetIE5D__c;
                    newAcc.AssetBS3__c = newAcc.AssetBS3D__c;
                    newAcc.AssetIE3__c = newAcc.AssetIE3D__c;
                    newAcc.AssetANI7__c = newAcc.AssetANI7D__c;
                    newAcc.AssetNDT6__c = newAcc.AssetNDT6D__c;
                    newAcc.MarketVerticals__c = newAcc.MarketVerticalsD__c;
                    newAcc.AssetIE6__c = newAcc.AssetIE6D__c;
                    newAcc.AssetIE2__c = newAcc.AssetIE2D__c;
                    newAcc.AssetBS2__c = newAcc.AssetBS2D__c;
                    newAcc.AssetANI3__c = newAcc.AssetANI3D__c;
                    newAcc.AssetIE1__c = newAcc.AssetIE1D__c;
                    newAcc.AssetBS1__c = newAcc.AssetBS1D__c;
                    newAcc.AssetRVI1__c = newAcc.AssetRVI1D__c;
                    newAcc.AssetNDT1__c = newAcc.AssetNDT1D__c;
                    newAcc.AssetANI1__c = newAcc.AssetANI1D__c;
                    newAcc.AssetNDT8__c = newAcc.AssetNDT8D__c;
                    newAcc.AssetANI8__c = newAcc.AssetANI8D__c;
                    newAcc.AssetBS5__c = newAcc.AssetBS5D__c;
                    newAcc.AssetIE8__c = newAcc.AssetIE8D__c;
                    newAcc.AssetRVI8__c = newAcc.AssetRVI8D__c;
                    newAcc.AssetANI5__c = newAcc.AssetANI5D__c;
                    //newAcc.Province__c = newAcc.ProvinceD__c;
                    newAcc.AssetRVI6__c = newAcc.AssetRVI6D__c;
                    newAcc.AssetANI2__c = newAcc.AssetANI2D__c;
                    newAcc.AssetNDT3__c = newAcc.AssetNDT3D__c;
                    newAcc.AssetNDT2__c = newAcc.AssetNDT2D__c;
                    newAcc.AssetANI6__c = newAcc.AssetANI6D__c;
                    newAcc.Sub_Use1__c = newAcc.Sub_UseA__c;
                    newAcc.Sub_Use__c = newAcc.Sub_UseD__c;
                    newAcc.Use__c = newAcc.UseD__c;
                    newAcc.AssetRVI7__c = newAcc.AssetRVI7D__c;
                    newAcc.AssetBS4__c = newAcc.AssetBS4D__c;
                    newAcc.AssetIE4__c = newAcc.AssetIE4D__c;
                    newAcc.AssetNDT5__c = newAcc.AssetNDT5D__c;

                    newAcc.AccountStatus__c = newAcc.AccountStatusD__c;
                    newAcc.CancelReason__c = newAcc.CancelReasonD__c;
                    newAcc.City__c = newAcc.CityD__c;
                    newAcc.PostCode__c = newAcc.PostCodeD__c;
                    newAcc.FacilityName__c = newAcc.FacilityNameD__c;
                    newAcc.DivisionName__c = newAcc.DivisionName_D__c;
                    newAcc.DepartmentName__c = newAcc.DepartmentNameD__c;

                    String DivisionName;
                    String DepartmentName;
                    if (newAcc.DivisionName__c == '无' || newAcc.DivisionName__c == null) {
                        DivisionName = '';
                    } else {DivisionName = newAcc.DivisionName__c;}
                    if (newAcc.DepartmentName__c == '无' || newAcc.DepartmentName__c == null) {
                        DepartmentName = '';
                    } else {DepartmentName = newAcc.DepartmentName__c;}

                    newAcc.Name = newAcc.FacilityNameD__c + DivisionName + ' ' + DepartmentName;

                    if (newAcc.IsNew__c = true) {
                        newAcc.IsNew__c = false;
                    }
                    if (String.isNotBlank(newAcc.DealerSelectOwner__c)) {
                        newAcc.OwnerId = newAcc.DealerSelectOwner__c;
                    }
                }
                if (newAcc.stautesD__c == 'Reject' && newAcc.IsNew__c == false) {
                    newAcc.WebsiteD__c = newAcc.Website;
                    newAcc.FaxD__c = newAcc.Fax;
                    //newAcc.CreatedByD__c = newAcc.CreatedBy;
                    newAcc.PhoneD__c = newAcc.Phone;
                    newAcc.Address1D__c = newAcc.Address1__c;
                    newAcc.AssetANI4D__c = newAcc.AssetANI4__c;
                    newAcc.AssetIE7D__c = newAcc.AssetIE7__c;
                    newAcc.AssetNDT7D__c = newAcc.AssetNDT7__c;
                    //newAcc.DealerD__c = newAcc.DealerName__c;
                    //newAcc.DepartmentNameD__c = newAcc.DepartmentName__c;
                    //newAcc.DivisionNameD__c = newAcc.DivissionName__c;
                    newAcc.AssetRVI5D__c = newAcc.AssetRVI5__c;
                    newAcc.EnglishNameD__c = newAcc.EnglishName__c;
                    //newAcc.ExportRegulatedCustomerD__c = newAcc.Export_Regulated_Customer__c;
                    //newAcc.FacilityNameD__c = newAcc.FacilityName__c;
                    newAcc.AssetRVI2D__c = newAcc.AssetRVI2__c;
                    newAcc.AssetNDT4D__c = newAcc.AssetNDT4__c;
                    //gwy 2021-06-15 更改
                    //newAcc.IndustryBD__c = newAcc.IndustryB__c;
                    //newAcc.IndustryCD__c = newAcc.IndustryC__c;
                    //newAcc.IndustryCD__c = newAcc.IndustryB__c;
                    //newAcc.IndustryBD__c = newAcc.IndustryB__c;
                    newAcc.AssetRVI4D__c = newAcc.AssetRVI4__c;
                    newAcc.AssetRVI3D__c = newAcc.AssetRVI3__c;
                    //newAcc.KeyAccountD__c = newAcc.KeyAccount__c;
                    newAcc.AssetIE5D__c = newAcc.AssetIE5__c;
                    newAcc.AssetBS3D__c = newAcc.AssetBS3__c;
                    newAcc.AssetIE3D__c = newAcc.AssetIE3__c;
                    newAcc.AssetANI7D__c = newAcc.AssetANI7__c;
                    newAcc.AssetNDT6D__c = newAcc.AssetNDT6__c;
                    newAcc.MarketVerticalsD__c = newAcc.MarketVerticals__c;
                    newAcc.AssetIE6D__c = newAcc.AssetIE6__c;
                    newAcc.AssetIE2D__c = newAcc.AssetIE2__c;
                    newAcc.AssetBS2D__c = newAcc.AssetBS2__c;
                    newAcc.AssetANI3D__c = newAcc.AssetANI3__c;
                    newAcc.AssetIE1D__c = newAcc.AssetIE1__c;
                    newAcc.AssetBS1D__c = newAcc.AssetBS1__c;
                    newAcc.AssetRVI1D__c = newAcc.AssetRVI1__c;
                    newAcc.AssetNDT1D__c = newAcc.AssetNDT1__c;
                    newAcc.AssetANI1D__c = newAcc.AssetANI1__c;
                    newAcc.AssetNDT8D__c = newAcc.AssetNDT8__c;
                    newAcc.AssetANI8D__c = newAcc.AssetANI8__c;
                    newAcc.AssetBS5D__c = newAcc.AssetBS5__c;
                    newAcc.AssetIE8D__c = newAcc.AssetIE8__c;
                    newAcc.AssetRVI8D__c = newAcc.AssetRVI8__c;
                    newAcc.AssetANI5D__c = newAcc.AssetANI5__c;
                    //newAcc.ProvinceD__c = newAcc.Province__c;
                    newAcc.AssetRVI6D__c = newAcc.AssetRVI6__c;
                    newAcc.AssetANI2D__c = newAcc.AssetANI2__c;
                    newAcc.AssetNDT3D__c = newAcc.AssetNDT3__c;
                    newAcc.AssetNDT2D__c = newAcc.AssetNDT2__c;
                    newAcc.AssetANI6D__c = newAcc.AssetANI6__c;
                    newAcc.Sub_UseA__c = newAcc.Sub_Use1__c;
                    newAcc.Sub_UseD__c = newAcc.Sub_Use__c;
                    newAcc.UseD__c = newAcc.Use__c;
                    newAcc.AssetRVI7D__c = newAcc.AssetRVI7__c;
                    newAcc.AssetBS4D__c = newAcc.AssetBS4__c;
                    newAcc.AssetIE4D__c = newAcc.AssetIE4__c;
                    newAcc.AssetNDT5D__c = newAcc.AssetNDT5__c;

                    newAcc.AccountStatusD__c = newAcc.AccountStatus__c;
                    newAcc.CancelReasonD__c = newAcc.CancelReason__c;
                    newAcc.CityD__c = newAcc.City__c;
                    newAcc.PostCodeD__c = newAcc.PostCode__c;

                    newAcc.DealerSelectOwner__c = newAcc.OwnerId;
                    newAcc.FacilityNameD__c = newAcc.FacilityName__c;
                    newAcc.DivisionName_D__c = newAcc.DivisionName__c;
                    newAcc.DepartmentNameD__c = newAcc.DepartmentName__c;
                }
            }
            //gwy 2021-06-04 LS 新增必填项OEM客户的标识
            /*if(newAcc.UserType__c == 'OEM客户' && newAcc.ProductSegment__c == 'BS'){
                newAcc.Whether_OEM__c = true;
            }else{
                newAcc.Whether_OEM__c = false;
            }*/
        }
    }

    public static void dealerAccountApproval2(List<Account> newList, Map<Id, Account> newMap, List<Account> oldList, Map<Id, Account> oldMap) {
        List<String> accIdList = new List<String>();

        for (Account newAcc : newList) {
            Account oldAcc = oldMap.get(newAcc.Id);
            if (newAcc.stautesD__c != oldAcc.stautesD__c) {
                // 批准时
                if (newAcc.stautesD__c == 'Pass') {
                    accIdList.add(newAcc.Id);
                }
                // 市场战略部人员新建提交时 （韩超）
                if (newAcc.stautesD__c == 'Submit' && newAcc.IsStrCreated__c == true && newAcc.IsNew__c == true ) {
                    accIdList.add(newAcc.Id);
                }

            }
        }

        if (accIdList.size() > 0) {
            List<AccountShare> accsList = [select Id, accountId, UserOrGroupId, AccountAccessLevel, RowCause from AccountShare where accountId = :accIdList and RowCause = 'Team' and AccountAccessLevel = 'Read'];
            for (AccountShare accs : accsList) {
                accs.AccountAccessLevel = 'Edit';
            }
            if (accsList != null && accsList.size() > 0) {
                update accsList;
            }
        }
    }

    public static void setDealerGroup(List<Account> newList, Map<Id, Account> newMap, List<Account> oldList, Map<Id, Account> oldMap) {
        List<String> groupIdList = new List<String>();
        List<String> accIdList = new List<String>();
        List<String> specialDealerList = new List<String>();

        Map<String, String> userMap = new Map<String, String>();
        List<User> userList = [select id, accountId from User where ContactId != null];
        for (User u : userList) {
            userMap.put(u.id, u.accountId);
        }
        for (Account newAcc : newList) {

            accIdList.add(newAcc.Id);
            // String dealerId = userMap.get(newAcc.OwnerId);
            // 手动导入客户 XHL 20210818 
            String dealerId = String.isNotBlank(newAcc.ImportDealerId__c)? newAcc.ImportDealerId__c:userMap.get(newAcc.OwnerId);

            String groupId = StaticParameter.dealerGroupMap.get(dealerId == null ? '' : dealerId.substring(0, 15));
            Boolean flag = StaticParameter.specialDealerList.contains(dealerId == null ? '' : dealerId.substring(0, 15));
            if (flag) {
                specialDealerList.add(newAcc.Id);
            }
            if (groupId == null || groupId.length() == 0) {
                continue;
            }
            groupIdList.add(groupId);
            //accIdList.add(newAcc.Id);
        }
        List<GroupMember> gmList = [select id, groupId, userOrGroupId from GroupMember where groupId = :groupIdList];

        List<AccountTeamMember> insertList = new list<AccountTeamMember>();
        for (Account newAcc : newList) {
            // String dealerId = userMap.get(newAcc.OwnerId);
            // 手动导入客户 XHL 20210818 
            String dealerId = String.isNotBlank(newAcc.ImportDealerId__c)? newAcc.ImportDealerId__c:userMap.get(newAcc.OwnerId);
            String groupId = StaticParameter.dealerGroupMap.get(dealerId == null ? '' : dealerId.substring(0, 15));
            // 市场战略部新建保存时将创建者插入客户小组
            if (newAcc.IsStrCreated__c == true) {
                AccountTeamMember atm2 = new AccountTeamMember();
                atm2.accountId = newAcc.Id;
                atm2.userId = newAcc.CreatedById;
                atm2.teamMemberRole = 'Sales Manager';
                insertList.add(atm2);
            }
            if (specialDealerList.contains(newAcc.Id)) {
                AccountTeamMember atm = new AccountTeamMember();
                atm.accountId = newAcc.Id;
                atm.userId = newAcc.CreatedById;
                atm.teamMemberRole = 'Sales Manager';
                insertList.add(atm);
                continue;
            }
            //
            if (groupId == null || groupId.length() == 0) {
                continue;
            }

            for (GroupMember gm : gmList) {
                if (gm.groupId == groupId) {
                    AccountTeamMember atm = new AccountTeamMember();
                    atm.accountId = newAcc.Id;
                    atm.userId = gm.userOrGroupId;
                    atm.teamMemberRole = 'Sales Manager';
                    insertList.add(atm);
                }
            }


        }


        if (insertList != null && insertList.size() > 0) {
            insert insertList;
        }

        List<AccountShare> accsList = new List<AccountShare>();
        accsList = [select Id, accountId, UserOrGroupId, AccountAccessLevel, RowCause from AccountShare where accountId = :accIdList and RowCause = 'Team'];
        for (AccountShare accs : accsList) {
            accs.AccountAccessLevel = 'Edit';
        }
        if (accsList != null && accsList.size() > 0) {
            update accsList;
        }
    }
    /**
     * [updateCampaignRelationship description]市场活动页面创建客户
     * @param  newList    [description]
     * @param  newMap     [description]
     * @param  oldList    [description]
     * @param  oldMap     [description]
     * @param  HandleType [description]1.新增、2.变更、3.删除
     * @return            [description]
     */
    public static void  updateCampaignRelationship(List<Account> newList, Map<Id, Account> newMap, List<Account> oldList, Map<Id, Account> oldMap, string HandleType) {

        List<Account> accountList = new List<Account>();
        if ('1'.equals(HandleType)) {
            accountList = newList;
        } else {
            accountList = oldList;
        }
        List<CampaignRelationship__c> insertCampaignRelationshipList = new List<CampaignRelationship__c>();
        for (Account newAcc : accountList) {

            if (newAcc.AccountCampaign__c !=  null) {
                CampaignRelationship__c campaignRelationship = new CampaignRelationship__c();
                campaignRelationship.RelationshipCampaign__c = newAcc.AccountCampaign__c;
                campaignRelationship.RelationshipAccount__c = newAcc.Id;
                if (newAcc.RecordTypeId == '01228000000TdF6' || newAcc.RecordTypeId == '01228000000PvwI') {
                    campaignRelationship.RelationshipProductSegment__c = 'IE';
                } else if (newAcc.RecordTypeId == '01228000000TdFB' || newAcc.RecordTypeId == '01228000000PvwK') {
                    campaignRelationship.RelationshipProductSegment__c = 'RVI';
                } else if (newAcc.RecordTypeId == '01228000000TdFG' || newAcc.RecordTypeId == '01228000000PvwJ') {
                    campaignRelationship.RelationshipProductSegment__c = 'NDT';
                } else if (newAcc.RecordTypeId == '01228000000TdFL' || newAcc.RecordTypeId == '01228000000PvwG') {
                    campaignRelationship.RelationshipProductSegment__c = 'ANI';
                }
                insertCampaignRelationshipList.add(campaignRelationship);
            }
        }
        system.debug('insertCampaignRelationshipList--->' + insertCampaignRelationshipList);
        if (insertCampaignRelationshipList != null && insertCampaignRelationshipList.size() > 0) {
            insert insertCampaignRelationshipList;
        }
    }

    public static void CheckAccoutnNameChange(List<Account> newList, Map<Id, Account> newMap, List<Account> oldList, Map<Id, Account> oldMap) {
        List<String> idList = new List<String>();
        List<Account> checkAccountList = new List<Account>();
        //新的获取人员简档ID
        // String profileId = UserInfo.getProfileId().subString(0, 15);
        String new_profileId = calendarUtil.getMemberProfileID(UserInfo.getUserId().subString(0,15));
        
        //旧的获取简档ID  UserInfo.getProfileId().subString(0, 15)
        for (Account acc : newList) {
            Account oldAcc = oldMap.get(acc.Id);
            //新增权限整理2021-05-10
            if (UserInfo.getUserType() != 'PowerPartner' && 
                new_profileId.subString(0, 15) != '00e28000000wAuN' && new_profileId.subString(0, 15) != '00e28000000eN67' && new_profileId.subString(0, 15) != '00e28000001sIDP'
                ) {
            //新增权限整理2021-05-10
                System.debug(acc.Name);
                System.debug(oldAcc.Name);
                if ((acc.Name.trim() != oldAcc.Name.trim() || acc.FacilityName__c != oldAcc.FacilityName__c ||
                    acc.DivisionName__c != oldAcc.DivisionName__c || acc.DepartmentName__c  != oldAcc.DepartmentName__c ||
                    acc.FacilityNameD__c != oldAcc.FacilityNameD__c || acc.DivisionName_D__c != oldAcc.DivisionName_D__c ||
                    acc.DepartmentNameD__c != oldAcc.DepartmentNameD__c ) && oldAcc.stautesD__c != 'Submit') {

                    idList.add(acc.Id);
                    checkAccountList.add(acc);
                }
            }
        }

        if(idList.size() > 0){
            List<AccountTeamMember> accTeamList = new List<AccountTeamMember>();
            Set<String> havePartnerSet = new Set<String>();
            accTeamList = [SELECT id,user.userType,accountId FROM AccountTeamMember WHERE accountId IN : idList];
            if(accTeamList.size() > 0){
                for(AccountTeamMember atm : accTeamList){
                    if(atm.user.userType == 'PowerPartner'){
                        havePartnerSet.add(atm.accountId);
                    }
                }
            }

            for (Account acc : checkAccountList) {
               if (havePartnerSet.contains(acc.Id)) {
                   newMap.get(acc.Id).addError('不能修改已经分配给代理的客户。');
               }else{
                    if(acc.MarketingStrategyCreated__c || (acc.serviceCreate__c && (acc.ProductSegment__c == 'NDT' ||acc.ProductSegment__c == 'ANI' ||acc.ProductSegment__c == 'BS' ))){

                    }else{
                        newMap.get(acc.Id).stautesD__c = 'Draft';
                    }
               }
            }
        }
    }


   































































    public static void asd() {
        Integer i = 1;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;

    }

}