From 928399eceec50e3d37ea08669a12789a9410a9d2 Mon Sep 17 00:00:00 2001
From: 沙世明 <shashiming@prec-tech.com>
Date: 星期二, 22 十一月 2022 16:51:16 +0800
Subject: [PATCH] 111

---
 force-app/main/default/classes/NFM606Controller.cls |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/force-app/main/default/classes/NFM606Controller.cls b/force-app/main/default/classes/NFM606Controller.cls
index 28d07d6..841a143 100644
--- a/force-app/main/default/classes/NFM606Controller.cls
+++ b/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 銆愬鎵樸�慡FDC涓娾�滃鏃﹀ぇ瀛﹂檮灞炰腑灞卞尰闄㈠帵闂ㄥ尰闄⑩�濈渷甯傞棶棰� LY 20221101 end
+        system.debug('1111111111111111111111111111');
+        if (con.Account.Parent_Management_Code__c =='8045004') {
+            state = 'CN-19';
+            city = 'CN-1917';
+        }
+        //LLIU-CKQ5FS 銆愬鎵樸�慡FDC涓娾�滃鏃﹀ぇ瀛﹂檮灞炰腑灞卞尰闄㈠帵闂ㄥ尰闄⑩�濈渷甯傞棶棰� LY 20221101 end
         ged.State = state;
         ged.City = city;
         ged.SalesBusinessDivision = salesdepartment_Dept;

--
Gitblit v1.9.1