From d8dc84a3d56df839895f1c417a4d9cbee763d262 Mon Sep 17 00:00:00 2001
From: 高章伟 <gaozhangwei@prec-tech.com>
Date: 星期五, 03 三月 2023 14:50:59 +0800
Subject: [PATCH] gzw 测试环境代码更新

---
 force-app/main/default/classes/NFM704Rest.cls |   93 ++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 85 insertions(+), 8 deletions(-)

diff --git a/force-app/main/default/classes/NFM704Rest.cls b/force-app/main/default/classes/NFM704Rest.cls
index 0e20bc5..fc1ea27 100644
--- a/force-app/main/default/classes/NFM704Rest.cls
+++ b/force-app/main/default/classes/NFM704Rest.cls
@@ -5,7 +5,11 @@
 
 @RestResource(urlMapping='/NFM704/*')
 global with sharing class NFM704Rest {
-
+     //add Response to aws 20220421 add sushanhu start
+   
+     static Boolean SFStatus=true;
+     static String SFMessage='';
+    //add Response to aws 20220421 add sushanhu end
     global class GeDatas {
         public NFMUtil.Monitoring Monitoring;
         public  GeData[] GeData;
@@ -28,7 +32,18 @@
         public String Speciality;   //鎿呴暱鐨勬墜鏈�
         public String ProfessionalField;    //涓撲笟棰嗗煙
         public String Society1;  //瀛︿細鍚嶇О
-        public String EventStatus; //瀛︿細鑱岀О
+        public String EventStatus; //瀛︿細鑱岀О // 甯︽湁绠ご 鍒囧壊鑾峰彇EventStatuslist pi鏀归�犱箣鍚� 瀛�***
+        //add for pipl  by sushanhu 20220420 start
+        // public String HCPLevelEncrypted; //HCP绛夌骇瀵嗘枃                //zhj鏂版柟妗堟敼閫� 2022-12-07
+        // public String NameEncrypted;    //濮撳悕                       //zhj鏂版柟妗堟敼閫� 2022-12-07
+        // public String MobileEncrypted;   //鐢佃瘽                      //zhj鏂版柟妗堟敼閫� 2022-12-07
+        // public String TechnicalTitleEncrypted; //鎶�鏈亴绉�            //zhj鏂版柟妗堟敼閫� 2022-12-07
+        // public String SpecialityEncrypted;   //鎿呴暱鐨勬墜鏈�            //zhj鏂版柟妗堟敼閫� 2022-12-07
+        // public String ProfessionalFieldEncrypted;    //涓撲笟棰嗗煙      //zhj鏂版柟妗堟敼閫� 2022-12-07
+        // public List<String> EventStatusEncryptedList; //瀛︿細鑱岀О 澶囨敞鏈夐�昏緫 甯︽湁绠ご 鍒囧壊鑾峰彇EventStatuslist 瀛榟ash      //zhj鏂版柟妗堟敼閫� 2022-12-07
+        public String DataId;//AWSDATAID
+        //public String WorkingSeniorityEncrypted;//涓村簥宸ヤ綔骞撮檺瀵嗘枃
+        //add for pipl  by sushanhu 20220420 end                        //zhj鏂版柟妗堟敼閫� 2022-12-07
     }
 
     @HttpPost
@@ -36,7 +51,9 @@
         //鍙栧緱鎺ュ彛浼犺緭鍐呭
         String strData = RestContext.request.requestBody.toString();
         GeDatas ges = (GeDatas) JSON.deserializeStrict(strData, GeDatas.class);
-    
+        //add Response to aws 20220421 add sushanhu start
+        NFMUtil.NFMResponse result = NFMUtil.getNFMResponse();
+        //add Response to aws 20220421 add sushanhu end
         if(ges == null) {
             return;
         }
@@ -57,8 +74,16 @@
         RestResponse res = RestContext.response;
         res.addHeader('Content-Type', 'application/json');
         res.statusCode = 200;
-        String jsonResponse = '{"Result":{"Result": "00", "Message":""}}';
+        // String jsonResponse = '{"Result":{"Result": "00", "Message":""}}';
+        // res.responseBody = blob.valueOf(jsonResponse);
+        //updata response toAWS sushanhu for pipl 20220421 start
+        result.SFStatus=SFStatus;
+        result.SFMessage=SFMessage;
+        //String jsonResponse =JSON.serialize(result);
+        String jsonResponse ='{"SFMessage":"","staticResponse":{"Result":{"Result":"00","Message":""}},"SFStatus":true}';
+        system.debug('result---'+jsonResponse);
         res.responseBody = blob.valueOf(jsonResponse);
+        //updata response toAWS sushanhu for pipl 20220421 end
         return;
 
     }
@@ -92,6 +117,11 @@
 
         Savepoint sp = Database.setSavepoint();
 
+        // 704鏀瑰杽 2023-02-09 ssm start
+        // 澧炲姞涓�涓爣璁帮紝褰撳洖浼犳暟鎹噷锛屽尰闄㈢鐞嗙紪鐮佷负绌烘椂锛屾姤閿欎絾涓嶉噸鍙�
+        Boolean error_without_resend = false;
+        // 704鏀瑰杽 2023-02-09 ssm end
+
         try{
             //绠$悊缂栫爜List
             List<String> DoctorNoList = new List<String>();
@@ -120,7 +150,8 @@
             List<Contact> conList = [select Id,
                                             Management_Code__c, //鍖婚櫌绠$悊缂栫爜
                                             CManageCode__c     //浜哄憳绠$悊缂栫爜
-                                            from Contact WHERE CManageCode__c IN:DoctorNoList];
+                                            from Contact WHERE CManageCode__c IN:DoctorNoList
+                                            and CManageCode__c != null];
             system.debug('conList============>'+conList);
             
             for(Contact con : conList ){
@@ -162,13 +193,21 @@
                         con.OwnerId = accMap.get(ged.HospitalMCode).GI_Main__c;//鎵�鏈変汉鍙栧尰闄笂鐨勬秷鍖栫鎷呭綋
                         con.AccountId = accMap.get(ged.HospitalMCode).Id;//鏂板缓鑱旂郴浜烘斁鍒板尰闄笅
                         con.LastName = ged.Name;
+                        // add by sushanhu for pipl 20220420 start
+                        //con.LastName_Encrypted__c =ged.NameEncrypted;         //zhj鏂版柟妗堟敼閫� 2022-12-07
+                        // add by sushanhu for pipl 20220420 end
                         con.FirstName = '';
                         con = assignment(ged,con);
                     }
                     upsertList.add(con);
                 }else{//鍚�
-                    continue;
+                    // continue;
                     logstr += '涓嶅瓨鍦ㄧ殑鍖婚櫌绠$悊缂栫爜:['+accMap.get(ged.HospitalMCode)+']/n';
+                    // 704鏀瑰杽 2023-02-09 ssm start
+                    // 璁剧疆鏍囪涓簍rue
+                    error_without_resend = true;
+                    // 704鏀瑰杽 2023-02-09 ssm end
+                    throw new ControllerUtil.myException('涓嶅瓨鍦ㄧ殑鍖婚櫌绠$悊缂栫爜:['+accMap.get(ged.HospitalMCode)+']');
                 }
 
                 // //AccountId
@@ -188,7 +227,7 @@
             system.debug('upsertList==================>'+upsertList);
             if(upsertList.size() > 0 ){
                 // Update updateList;
-                Oly_TriggerHandler.bypass('ConsumableOrderTrigger');
+                Oly_TriggerHandler.bypass('ContactTriggerHandler');
                 UpSert upsertList;
             }
 
@@ -202,10 +241,24 @@
             logstr += '\n' + ex.getMessage();
             iflog.ErrorLog__c = ex.getMessage() + '\n' + ex.getStackTraceString() + '\n' + iflog.ErrorLog__c;
             // 寮傚父閲嶅彂
-            rowData = NFMUtil.LogAutoSend(rowData, ex, null);
+            // 704鏀瑰杽 2023-02-09 ssm start
+            if (error_without_resend) {
+                // retry_cnt璁剧疆涓�0
+                rowData.retry_cnt__c = 0;
+                logstr += '\nend';
+                rowData.ErrorLog__c += ex.getMessage() + '\n' + ex.getStackTraceString() + '\n';
+                iflog.ErrorLog__c += ex.getMessage() + '\n' + ex.getStackTraceString() + '\n';
+                iflog.Log__c += logstr;
+                upsert iflog;
+                upsert rowData;
+            } else {
+                rowData = NFMUtil.LogAutoSend(rowData, ex, null);
+            }
+            // 704鏀瑰杽 2023-02-09 ssm end
         }
         iflog.Log__c = logstr;
         upsert iflog;
+        upsert rowData;
     }
 
     public static String verify(GeData ged){
@@ -250,6 +303,17 @@
         con.TechnicalTitleOBPM__c   = ged.TechnicalTitle;//鎶�鏈亴绉�
         con.SpecialityOBPM__c       = ged.Speciality;//鎿呴暱鐨勬墜鏈�
         con.ProfessionalField__c    = ged.ProfessionalField;//涓撲笟棰嗗煙
+        //add by sushanhu 20220420 for pipl start 
+        // con.HCPLevel_Encrypted__c   = ged.HCPLevelEncrypted;                     //zhj鏂版柟妗堟敼閫� 2022-12-07
+        // con.NameOBPM_Encrypted__c   = ged.NameEncrypted;                         //zhj鏂版柟妗堟敼閫� 2022-12-07
+        // con.MobileOBPM_Encrypted__c    = ged.MobileEncrypted;                    //zhj鏂版柟妗堟敼閫� 2022-12-07
+        // con.WorkingSeniorityOBPM_Encrypted__c = ged.WorkingSeniorityEncrypted;   //zhj鏂版柟妗堟敼閫� 2022-12-07
+        // con.TechnicalTitleOBPM_Encrypted__c = ged.TechnicalTitleEncrypted;       //zhj鏂版柟妗堟敼閫� 2022-12-07
+        // con.ProfessionalField_Encrypted__c = ged.ProfessionalFieldEncrypted;     //zhj鏂版柟妗堟敼閫� 2022-12-07
+        // con.SpecialityOBPM_Encrypted__c = ged.SpecialityEncrypted;               //zhj鏂版柟妗堟敼閫� 2022-12-07
+        con.AWS_Data_Id__c          = ged.DataId;
+        //add by sushanhu 20220420 for pipl end
+
         if(societyList.size()>0){
             con.Learn_name1__c          = societyList[0];//瀛︿細鍚嶇О1
         }
@@ -261,12 +325,25 @@
         }
         if(eventStatusList.size()>0){
             con.Learn_serve1__c         = eventStatusList[0];//瀛︿細鑱岀О1
+            // add by sushanhu for pipl 20220420 start
+            //zhj鏂版柟妗堟敼閫� 2022-12-07 start
+            // if(ged.EventStatusEncryptedList.size()>0){
+            //      con.Learn_serve1_Encrypted__c =ged.EventStatusEncryptedList[0];
+            // }
+            //zhj鏂版柟妗堟敼閫� 2022-12-07 end
+            // add by sushanhu for pipl 20220420 end
         }
         if(eventStatusList.size()>1){
             con.Learn_serve2__c         = eventStatusList[1];//瀛︿細鑱岀О2
+            // add by sushanhu for pipl 20220420 start
+            //con.Learn_serve2_Encrypted__c =ged.EventStatusEncryptedList[1];   //zhj鏂版柟妗堟敼閫� 2022-12-07
+            // add by sushanhu for pipl 20220420 end
         }
         if(eventStatusList.size()>2){
             con.Learn_serve3__c         = eventStatusList[2];//瀛︿細鑱岀О3
+            // add by sushanhu for pipl 20220420 start
+            //con.Learn_serve3_Encrypted__c =ged.EventStatusEncryptedList[2];   //zhj鏂版柟妗堟敼閫� 2022-12-07
+            // add by sushanhu for pipl 20220420 end
         }
         return con;
     }

--
Gitblit v1.9.1