111
沙世明
2022-11-22 928399eceec50e3d37ea08669a12789a9410a9d2
force-app/main/default/classes/NFM606Controller.cls
@@ -111,6 +111,9 @@
            Account.Parent.ParentId,
            UniqueNumber__c,
            AWS_Data_Id__c,
            ChargeState__c, // 20220829 ljh LLIU-CHR8FF  add
            Account.RecordTypeId,// 20220829 ljh LLIU-CHR8FF  add
            ChargeState__r.Level1_Code__c,// 20220829 ljh LLIU-CHR8FF  add
            Name, Email from Contact where id in: conIdList AND RecordTypeId != '01210000000QtkyAAC'
        ];
        String logstr = iflog.Log__c + ' ' + 'NumberOfRecord=' + conList.size() + '\n';
@@ -163,7 +166,7 @@
                me.NumberOfRecord       = '' + gds.GeData.size();
                gds.Monitoring = me;
                logstr = iflog.Log__c + '\nNumberOfRecord=' + gds.GeData.size() + ' ';
                NFMUtil.Monitoring Monitoring   = new NFMUtil.Monitoring();
                Monitoring.Tag                  = gds.Monitoring.Tag;
@@ -196,9 +199,9 @@
        if (rowData != null) {
            upsert rowData;
        }
        iflog.Log__c =  logstr;
        system.debug('======================================'+logstr);
        iflog.Log__c = iflog.Log__c + logstr;
        upsert iflog;
    }
    private static GeData getStateAndCity(GeData ged,Contact con){
@@ -206,7 +209,16 @@
        String city = '';
        String salesdepartment_Dept = '';
        if (String.isBlank(con.Account.ParentId)) {//医院/经销商下的联系人,获取医院/经销商的省和市的编码;销售本部
            state =  con.Account.State_Master__r.Level1_Code__c;
            // 20220829 ljh LLIU-CHR8FF update start
            // state =  con.Account.State_Master__r.Level1_Code__c;
            Id AgencyId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId();
            // System.debug('aaa000zheli'+con.ChargeState__c+'~'+AgencyId+'~'+con.Account.RecordTypeId+'~'+con.Account.State_Master__c);
            if(String.isNotBlank(con.ChargeState__c) && con.Account.RecordTypeId == AgencyId &&String.valueOf(con.ChargeState__c).substring(0,15) != String.valueOf(con.Account.State_Master__c).substring(0,15)){
                state =  con.ChargeState__r.Level1_Code__c;
            }else{
                state =  con.Account.State_Master__r.Level1_Code__c;
            }
            // 20220829 ljh LLIU-CHR8FF update end
            city =  con.Account.City_Master__r.Level2_Code__c;
            salesdepartment_Dept =  con.Account.Salesdepartment_Dept__c; //销售本部             
        } else if(String.isNotBlank(con.Account.Parent.ParentId)){//科室下的联系人, 获取医院的省和市的编码;销售本部
@@ -218,6 +230,13 @@
            city = con.Account.Hospital_Department_Class__r.City_Master__r.Level2_Code__c;//市
            salesdepartment_Dept = con.Account.Hospital_Department_Class__r.Salesdepartment_Dept__c;//销售本部
        }
        //LLIU-CKQ5FS 【委托】SFDC上“复旦大学附属中山医院厦门医院”省市问题 LY 20221101 end
        system.debug('1111111111111111111111111111');
        if (con.Account.Parent_Management_Code__c =='8045004') {
            state = 'CN-19';
            city = 'CN-1917';
        }
        //LLIU-CKQ5FS 【委托】SFDC上“复旦大学附属中山医院厦门医院”省市问题 LY 20221101 end
        ged.State = state;
        ged.City = city;
        ged.SalesBusinessDivision = salesdepartment_Dept;