force-app/main/default/classes/NFM707Rest.cls
@@ -135,16 +135,24 @@
                // if (campaignMap.size() > 0) {
                //     update campaignMap.values();
                // }
                List<Campaign> camNoList = [select id,Num__c,MeetingApprovedNo__c,Meeting_Approved_No__c
                List<Campaign> camNoList = [select id,Num__c,MeetingApprovedNo__c,Meeting_Approved_No__c, Meeting_Approved_No__r.MeetingApprovedNo__c, CampaignStatus__c
                                    from Campaign 
                                    where MeetingApprovedNo__c in: camList];
                                    where Meeting_Approved_No__r.MeetingApprovedNo__c in: camList and CampaignStatus__c = '会议结束'];
                // System.debug(camNoList);
                if (camNoList != null && camNoList.size() > 0) {
                    List<String> cam_ids = new List<String>();
                    for(Campaign cam : camNoList) {
                        // System.debug('cam: ' + cam.Num__c + '|' + cam.Meeting_Approved_No__c + '|' + cam.Meeting_Approved_No__r.MeetingApprovedNo__c);
                        Application_for_Conference_Adjudication__c app = acaMap.get(cam.Meeting_Approved_No__r.MeetingApprovedNo__c);
                        // System.debug('app: ' + (app != null ? app.Id : 'null'));
                        cam_ids.add(cam.id);
                        for (Result_for_Conference_Adjudication__c rca : rcaList) {
                            if (cam.Meeting_Approved_No__c == rca.Application_for_Conference_Adjudication__c) {
                            // System.debug('rca: ' + rca.Application_for_Conference_Adjudication__c);
                            if (cam.Meeting_Approved_No__c == rca.Application_for_Conference_Adjudication__c || (app != null && app.Id == rca.Application_for_Conference_Adjudication__c)) {
                                // 更新会议日程
                                cam.Meeting_Report__c = rca.Id;
                                cam.Society_Hold_Place__c = rca.SocietyHoldPlace__c;
                                cam.Competitor__c = rca.Competitor__c;
                                // 更新报告日期和状态
                                cam.Report_approved_day__c = Date.today();
                                cam.Approved_day__c = Date.today();
@@ -154,6 +162,16 @@
                        }
                    }
                    update camNoList;
                    // 更新OPD计划
                    List<OPDPlan__c> opdlist = [select id,status__c from OPDPlan__c WHERE OPDType__c = '学会' and status__c != '完毕' and Campaign__c in: cam_ids];
                    //将OPD计划的状态更新为 完毕
                    if (opdlist != null && opdlist.size() > 0) {
                        for (OPDPlan__c opdc : opdlist) {
                            opdc.Status__c= '完毕';
                        }
                        update opdlist;
                    }
                }
          }
            logstr += '\nend';