From a6700debe3fd28bf950ef33937b31c1a6713af29 Mon Sep 17 00:00:00 2001
From: 李彤 <litong@prec-tech.com>
Date: 星期四, 08 十二月 2022 18:04:12 +0800
Subject: [PATCH] 【重要!学会会议】自办会关联OBPM决裁信息不更新会议开始日和结束日

---
 force-app/main/default/classes/NFM705Rest.cls |   50 ++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 38 insertions(+), 12 deletions(-)

diff --git a/force-app/main/default/classes/NFM705Rest.cls b/force-app/main/default/classes/NFM705Rest.cls
index 2396957..3250d0d 100644
--- a/force-app/main/default/classes/NFM705Rest.cls
+++ b/force-app/main/default/classes/NFM705Rest.cls
@@ -25,7 +25,7 @@
         public String Num; //浼氳缂栫爜 == Num__c
         public String StartDate; //寮�濮嬫棩鏈� == StartDate
         public String EndDate; //缁撴潫鏃ユ湡 == EndDate
-        public String BudgetType; //棰勭畻绫诲瀷 == Budget_Type__c
+        public String BudgetType; //棰勭畻绫诲瀷 == Implementation_Purpose__c
         public String OfficeCategory; //绉戝鍒嗙被 == OfficeCategory__c
         public String MeetingType; //浼氳绫诲瀷 == Meeting_Type__c   
         public String StateMaster; //鐪� == State_Master__c
@@ -163,7 +163,7 @@
                 aca.Num__c                          = ged.Num;
                 aca.StartDate__c                    = NFMUtil.parseDateTimeStr2Date(ged.StartDate);
                 aca.EndDate__c                      = NFMUtil.parseDateTimeStr2Date(ged.EndDate);
-                aca.BudgetType__c                   = ged.BudgetType;
+                aca.Implementation_Purpose1__c                   = ged.BudgetType;
                 aca.OfficeCategory__c               = GetOfficeCategory(ged.OfficeCategory, transferMap, iflog);
                 //aca.MeetingType__c                  = ged.MeetingType;
                 aca.MeetingType__c                  = DividingTypes(ged.IsCoOrganizingActivities,ged.ActivityTypeName);
@@ -188,7 +188,9 @@
                     aca.Id = oldacfcMap.get(ged.MeetingApprovedNo).Id;
                     aca.Num__c = String.isBlank(aca.Num__c) ? oldacfcMap.get(ged.MeetingApprovedNo).Num__c : aca.Num__c; 
                 } 
-                NumList.add(aca.Num__c);
+                if (String.isNotBlank(aca.Num__c)) {
+                    NumList.add(aca.Num__c);
+                }
                 system.debug('NumList------------->'+NumList);
                 // 纭鐢宠浜�
                 System.debug('aca.Id: ' + aca.Id);
@@ -208,13 +210,19 @@
             }
             List<Campaign> campaignList = NumList.size() > 0 ? [select Id, 
                                             Num__c, 
-                                            MeetingApprovedNo__c 
+                                            MeetingApprovedNo__c, 
+                                            State_Master__c, 
+                                            City_Master__c, 
+                                            WorkshopPlace__c,
+                                            RecordTypeId, 
+                                            Meeting_Type__c  
                                         from Campaign 
                                         where Num__c IN: NumList 
                                         ] : new List<Campaign>();
             // 鏌ユ壘鎵�鏈変汉
             if (user_nos != null && user_nos.size() > 0) {
-                users = [select Id, Employee_No__c from User where Employee_No__c in :user_nos];
+                // 2022-03-23 绱ф�ヤ慨澶� 鏈惎鐢ㄧ殑鐢ㄦ埛鏃犳硶璁剧疆鍏变韩
+                users = [select Id, Employee_No__c from User where Employee_No__c in :user_nos and IsActive = true];
                 if (users != null && users.size() > 0) {
                     String owner = '';
                     for (Application_for_Conference_Adjudication__c app : acaList) {
@@ -256,6 +264,7 @@
                 // }
                 // 鏇存柊宸插瓨鍦ㄧ殑鍐宠淇℃伅
                 System.debug('鏌ユ壘鍒扮殑浼氳: ' + campaignList.size());
+                System.debug('lt123鏌ユ壘鍒扮殑浼氳:--- ' + campaignList);
                 if (campaignList != null && campaignList.size() > 0) {
                     List<Campaign> updatelist = new List<Campaign>();
                     for (Campaign cam : campaignList) {
@@ -264,13 +273,28 @@
                                 cam.MeetingApprovedNo__c             = app.MeetingApprovedNo__c;
                                 cam.Meeting_Approved_No__c           = app.Id;
                                 if (app.MeetingType__c != '璧炲姪浼�') {
-                                    cam.StartDate                        = app.StartDate__c;
-                                    cam.EndDate                          = app.EndDate__c;
-                                    cam.Budget_Type__c                   = app.BudgetType__c;
+                                    //20221206 lt DB202212060256 start 
+                                    Id RtId = Schema.SObjectType.Campaign.getRecordTypeInfosByDeveloperName().get('Society').getRecordTypeId();
+                                    Id RtId2 = Schema.SObjectType.Campaign.getRecordTypeInfosByDeveloperName().get('BusinessTraining').getRecordTypeId();
+                                    
+                                    if(cam.RecordTypeId == RtId || cam.RecordTypeId == RtId2){
+                                        if (cam.Meeting_Type__c != '涓诲姙浼�'){
+                                            cam.StartDate                        = app.StartDate__c;
+                                            cam.EndDate                          = app.EndDate__c;
+                                        }
+                                    }
+                                    if(cam.RecordTypeId != RtId && cam.RecordTypeId != RtId2){
+                                        cam.StartDate                        = app.StartDate__c;
+                                        cam.EndDate                          = app.EndDate__c;
+                                    }
+                                    // cam.StartDate                        = app.StartDate__c;
+                                    // cam.EndDate                          = app.EndDate__c;
+                                    //20221206 lt DB202212060256 end
+                                    cam.Implementation_Purpose__c                   = app.Implementation_Purpose1__c;
                                     cam.OfficeCategory__c                = app.OfficeCategory__c;
                                     cam.Meeting_Type__c                  = app.MeetingType__c;
     
-                                    cam.WorkshopPlace__c                 = app.WorkshopPlace__c;
+                                    cam.WorkshopPlace__c                 = String.isNotBlank(app.WorkshopPlace__c) ? app.WorkshopPlace__c : cam.WorkshopPlace__c;
                                     cam.HostName__c                      = app.HostName__c;
                                     cam.cooperatorCompany__c             = app.CooperatorCompany__c;
                                     cam.Convening_Participants_Num__c    = app.ConveningParticipantsNum__c;
@@ -283,8 +307,8 @@
                                     // cam.Activity_Type_Name__c            = app.ActivityTypeName__c;
                                     cam.Activity_Type_Name__c            = app.Type_of_adjudication_meeting__c;
                                     // 杩欓噷闇�瑕侀澶栧姞鎿嶄綔
-                                    cam.State_Master__c                  = StateCityUtil.get_state(app.StateMaster__c);                 
-                                    cam.City_Master__c                   = StateCityUtil.get_city(app.CityMaster__c);
+                                    cam.State_Master__c                  = String.isNotBlank(app.StateMaster__c) ? StateCityUtil.get_state(app.StateMaster__c) : cam.State_Master__c;                 
+                                    cam.City_Master__c                   = String.isNotBlank(app.CityMaster__c)  ? StateCityUtil.get_city(app.CityMaster__c) : cam.City_Master__c;
                                 }
                                 
 
@@ -428,7 +452,7 @@
     //     cam.Meeting_Approved_No__c           = app.Id;
     //     cam.StartDate                        = app.StartDate__c;
     //     cam.EndDate                          = app.EndDate__c;
-    //     cam.Budget_Type__c                   = app.BudgetType__c;
+    //     cam.Implementation_Purpose__c                   = app.Implementation_Purpose1__c;
     //     cam.OfficeCategory__c                = app.OfficeCategory__c;
     //     cam.Meeting_Type__c                  = app.MeetingType__c;
     //     cam.Activity_Type_Name__c            = app.ActivityTypeName__c;
@@ -509,6 +533,8 @@
         }
         // 鍐嶆柊澧�
         if (insert_list != null && insert_list.size() > 0) {
+            System.debug('insert_list is: ');
+            System.debug(insert_list);
             insert insert_list;
         }
     }

--
Gitblit v1.9.1