高章伟
2023-03-03 d8dc84a3d56df839895f1c417a4d9cbee763d262
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';
@@ -123,7 +126,8 @@
                //ged.ContactId = String.isBlank(con.) ? '':con.AWS_UnifiedI_Contact_ID__c; //AWS 智慧医疗ID
                ////update to AWS_UnifiedI_Contact_ID__c sushanhu 20220228 end
                ged.ServiceUserId = String.isBlank(con.ServicePlatformCode__c) ? '':con.ServicePlatformCode__c; //服务平台用户ID???
                ged.Mobile = String.isNotBlank(con.UniqueNumber__c) ? con.UniqueNumber__c:con.MobilePhone;//手机
                //ged.Mobile = String.isNotBlank(con.UniqueNumber__c) ? con.UniqueNumber__c:con.MobilePhone;//手机
                ged.Mobile = con.MobilePhone;//手机      zhj 新方案改造 不需要UniqueNumber__c
                ged.PersonManagementCode = con.CManageCode__c; //人员管理编码
                ged.Status = '有效'.equals(con.Isactive__c) ? true:false ;//状态
                ged.Name = con.Name;//姓名
@@ -142,7 +146,6 @@
                    ged.Hospital = con.Account.Parent_Management_Code__c;//医院编码
                    ged.Department = con.Account.Management_Code__c; //科室编码
                    ged.AgentFlag = false;//医院
                }
                // 经销商
                if ('01210000000QfWiAAK'.equals(con.RecordTypeId)) {
@@ -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;