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/NFM608Rest.cls |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/force-app/main/default/classes/NFM608Rest.cls b/force-app/main/default/classes/NFM608Rest.cls
index 80d9d65..c61c86f 100644
--- a/force-app/main/default/classes/NFM608Rest.cls
+++ b/force-app/main/default/classes/NFM608Rest.cls
@@ -69,10 +69,10 @@
         }
 
         BatchIF_Log__c rowData = [Select Id, Name, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c, Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c, retry_cnt__c from BatchIF_Log__c where RowDataFlg__c = true and Id =: rowData_Id];
-        String logstr = rowData.MessageGroupNumber__c + ' start\n';
+        String logstr = rowData.Name + ' start\n';//MessageGroupNumber__c
         BatchIF_Log__c iflog = new BatchIF_Log__c();
         iflog.Type__c = LOG_TYPE;
-        iflog.MessageGroupNumber__c = rowData.MessageGroupNumber__c;
+        iflog.MessageGroupNumber__c = rowData.Name;//rowData.MessageGroupNumber__c;
         iflog.Log__c = logstr;
         iflog.ErrorLog__c = '';
         insert iflog;
@@ -83,7 +83,7 @@
         }
         Savepoint sp = Database.setSavepoint();
         try {
-
+            rowData.retry_cnt__c = 0; //蹇呭姞
             // 蹇呭~瀛楁楠岃瘉 Start
             String dataComplete = verify(ged);
             // 蹇呭~瀛楁楠岃瘉 End
@@ -114,6 +114,23 @@
                     logstr += '鎷滆鍖哄垎 [ ' + ged.visitDistinction + ' ]鏃犳晥锛屾鏉℃暟鎹烦杩囦笉鎵ц \n';
                     return;
                 }
+                //鏃ユ姤瀹℃壒閫氳繃涔嬪悗锛屼笉鑳藉湪鍒涘缓鎶ュ憡涓�瑙�
+                if(null!=drc){
+                   if(drc.Status__c=='鎵胯獚'){
+                      logstr += '鏃ユ姤鐘舵�� [' + drc.Status__c +' ],姝ゆ潯鏁版嵁璺宠繃涓嶆墽琛� \n';
+                      return;
+                   }
+                }
+                Datetime startdate1 = NFMUtil.parseStr2DateTime(ged.visitStartDate);
+                Datetime enddate1 = NFMUtil.parseStr2DateTime(ged.visitEndDate);
+                Long timeDif = enddate1.getTime() - startdate1.getTime(); 
+                Integer ts = Integer.valueOf((enddate1.getTime() - startdate1.getTime()) / 1000 / 3600 /24);
+                system.debug( startdate1.getTime()+'==='+enddate1.getTime()+'==='+startdate1+'==='+enddate1+'==='+ts);
+                if(ts > 14){
+                   logstr += '浜嬩欢鐨勬寔缁椂闂翠笉鑳借秴杩� 14 澶�,姝ゆ潯鏁版嵁璺宠繃涓嶆墽琛� \n';
+                      return;
+                }
+                
                 // 鏌ユ壘璁块棶瀵硅薄
                 String contactId = null;
                 if (String.isNotBlank(ged.applicantId)) {
@@ -129,7 +146,6 @@
                 report.whatid__c = departmentAccount.Id;
                 // report.VisitType__c = ged.visitInfo;//浠诲姟绫诲瀷
                 report.Visitor1_ID__c = contactId; //瑷晱鑰�1
-                report.Visitor1__c = contactId; 
                 report.StartDateTime__c = NFMUtil.parseStr2DateTime(ged.visitStartDate);//寮�濮嬫椂闂�
                 report.ActivityDate__c = NFMUtil.parseDateTimeStr2Date(ged.visitStartDate);//娲诲姩鏃ユ湡
                 report.EndDateTime__c = NFMUtil.parseStr2DateTime(ged.visitEndDate);//缁撴潫鏃堕棿
@@ -147,8 +163,8 @@
                 insert report;
                 logstr +=  '鎶ュ憡涓�瑙� [ '+ged.replyID+' ] 淇濆瓨鎴愬姛锛乗n';
             }
+           // rowData.retry_cnt__c = 0; //蹇呭姞
             
-            rowData.retry_cnt__c = 0; //蹇呭姞
         } catch (Exception ex) {
             // 銈ㄣ儵銉笺亴鐧虹敓銇椼仧鍫村悎
             Database.rollback(sp);
@@ -193,7 +209,7 @@
         }
 
 
-        List < Daily_Report__c > drcs = [select Id, Reporter__r.Employee_No__c from Daily_Report__c where Reported_Date__c =: visitStartDate and Reporter__r.Employee_No__c =: ged.mngCd];
+        List < Daily_Report__c > drcs = [select Id, Reporter__r.Employee_No__c,Status__c from Daily_Report__c where Reported_Date__c =: visitStartDate and Reporter__r.Employee_No__c =: ged.mngCd];
         if (drcs.size() > 0) {
             result = drcs[0];
         } else {

--
Gitblit v1.9.1