lazhen
2024-07-24 07b96c69aebc192eb13de6950c255ef4e3f1fcc4
批量界面新增结果同标准功能有异
已修改5个文件
87 ■■■■■ 文件已修改
Calendars/BL/Relations/Relation_LibCal_ExplicitTimeInterval_LeadingETI_LibCal_ExplicitTimeInterval_.qbl 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Calendars/BL/Type_LibCal_LeadingParticipation/Method_AddSubscribers.qbl 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Calendars/BL/Type_LibCal_Participation/Method_CreateTimeInterval.qbl 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InterfaceLoginfo/StaticMethod_CallToken.qbl 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Calendars/BL/Relations/Relation_LibCal_ExplicitTimeInterval_LeadingETI_LibCal_ExplicitTimeInterval_.qbl
@@ -12,7 +12,6 @@
    Cardinality: '0to1'
    ObjectDefinition: LibCal_ExplicitTimeInterval
    OwningSide: 'Reference'
    InterfaceProperties { Accessibility: 'Module' }
  }
  RelationSide.RightSide SubscribingETI
  {
Calendars/BL/Type_LibCal_LeadingParticipation/Method_AddSubscribers.qbl
@@ -14,5 +14,4 @@
      this.AddSubscriber( subscriber, useLeadingPeriod_i );
    }
  *]
  InterfaceProperties { Accessibility: 'Module' }
}
Calendars/BL/Type_LibCal_Participation/Method_CreateTimeInterval.qbl
@@ -19,5 +19,4 @@
    
    return timeInterval;
  *]
  InterfaceProperties { Accessibility: 'Module' }
}
_Main/BL/Type_InterfaceLoginfo/StaticMethod_CallToken.qbl
@@ -10,11 +10,12 @@
    
    httpinterface.URL( Translations::InterfaceDataset_Token_URL() );
    httpinterface.MediaType( Translations::InterfaceDataset_ContentType() );
    httpinterface.PostMethod( false );
    httpinterface.Call();
    result := httpinterface.Result();
    
    resultJson     := JSON::Parse( result );
    token          := resultJson.Get( "access_token" ).AsString();
    token          := resultJson.Get( "access_token" ).GetString();
    
    return token;
  *]
_Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl
@@ -41,61 +41,40 @@
  TextBody:
  [*
    //事件创建二开方法
    //info( startDate_i, startTimeOfDay_i, endDate_i, endTimeOfDay_i, isAllDay_i, recurrenceInterval_i, patternType_i
    //      , patternDaily_IsEveryWeekday_i, periodType_i, periodStartDate_i, nrOfOccurrences_i, periodEndDate_i );
    //查询是否已有同名事件
    //查询是否已有同名在批量界面创建的事件s
    event := selectobject( owner_i, Event, event, event.Subject() = subject_i 
                           and event.EventType() = eventtype_i
                           and ( event.LeadingParticipation().EndDate() - event.LeadingParticipation().StartDate() ) = ( endDate_i - startDate_i )
                           and event.StartTimeOfDay() = startTimeOfDay_i
                           and event.EndTimeOfDay() = endTimeOfDay_i );
    //event := selectobject( owner_i, Event.LeadingParticipation, lp, lp.Event().Subject() = subject_i
    //                       and lp.Event().EventType() = eventtype_i
    //                       and ( lp.EndDate() - lp.StartDate() ) = ( endDate_i - startDate_i )
    //                       and lp.Event().StartTimeOfDay() = startTimeOfDay_i
    //                       and lp.Event().EndTimeOfDay() = endTimeOfDay_i );
                           and event.EventType() = eventtype_i );
    //只有通过批量创建界面且已有同名事件进入下面操作
    if( ismultiple and not isnull( event ) ){
      startdate := startDate_i;
      enddate   := startDate_i;
      dates := construct( Dates );
      dates.Add( startDate_i );
      //获取旧事件的开始事件和结束事件,以及所有时间点
      traverse( event, Participation.ExplicitTimeInterval, eti ){
        if( startdate > eti.Start().Date() ){
          startdate := eti.Start().Date();
      lp        := event.LeadingParticipation();
      timezone  := lp.Calendar().GetTimeZone();
      starttime := startDate_i.DateTime( timezone ).AddAsPeriod( timezone, startTimeOfDay_i );
      endtime   := endDate_i.DateTime( timezone ).AddAsPeriod( timezone, endTimeOfDay_i );
    //  startDate := starttime.Date( timezone );
    //  endDate   := endtime.Date( timezone ) - ifexpr( endtime = endtime.StartOfDay( timezone ), 1, 0 );
      lp.AddSubscribers( subscribers_i, true );;
      leadingETI := selectobject( lp, ExplicitTimeInterval, eti, eti.Start() = starttime and eti.End() = endtime );
      if( isnull( leadingETI ) ){
        leadingETI := lp.CreateTimeInterval( starttime, endtime, event.Capacity() );
        }
        if( enddate < eti.Start().Date() ) {
          enddate := eti.Start().Date();
        }
        if( not exists( dates, Elements, e, e = eti.Start().Date() ) ){
          dates.Add( eti.Start().Date() );
        }
      }
      //修改旧事件的间隔
      nrOfOccurrences_i := enddate - startdate + 1;
      startDate_i := startdate;
      endDate_i := ( event.LeadingParticipation().EndDate() - event.LeadingParticipation().StartDate() + startDate_i );
      periodStartDate_i := startdate;
      periodEndDate_i := enddate;
    //  info( startDate_i, startTimeOfDay_i, endDate_i, endTimeOfDay_i, isAllDay_i, recurrenceInterval_i, patternType_i
    //      , patternDaily_IsEveryWeekday_i, periodType_i, periodStartDate_i, nrOfOccurrences_i, periodEndDate_i );
      event := LibCal_Event::CreateUpdateFromUI( owner_i, event.LeadingParticipation(), subject_i, description_i, type_i, capacity_i, category_i, isDefault_i,
                                      startDate_i, startTimeOfDay_i, endDate_i, endTimeOfDay_i, isAllDay_i,
                                      isRecurring_i, recurrenceInterval_i,
                                      patternType_i, patternDaily_IsEveryWeekday_i, patternWeekly_Weekdays_i,
                                      patternMonthly_IsDay_i, patternMonthly_Day_i, patternMonthly_WeekOfMonth_i, patternMonthly_DayOfWeek_i,
                                      patternYearly_IsDate_i, patternYearly_Month_i, patternYearly_Day_i, patternYearly_WeekOfMonth_i, patternYearly_DayOfWeek_i,
                                      periodType_i, periodStartDate_i, nrOfOccurrences_i, periodEndDate_i, subscribers_i );
      //删掉不需要的时间点
      timeIntervals := construct( LibCal_ExplicitTimeIntervals );
      traverse( event, Participation.ExplicitTimeInterval, eti ){
    //    info( '------------------------------', eti.Start(), eti.End(), exists( dates, Elements, e, e = eti.Start().Date() ), '------------------', dates.Find( eti.Start().Date() ) );
        if( dates.Find( eti.Start().Date() ) < 0 ){
          timeIntervals.Add( eti );
        }
      }
      LibCal_ExplicitTimeInterval::Delete( timeIntervals, true );
    //  info( '-----------------------2-----------------', lp.ExplicitTimeInterval( relsize ) );
    //  if( not isnull( leadingETI ) ){
    //    traverse( lp, Subscription, subscription, subscribers_i.Find( subscription.Calendar() ) >= 0 and
    //              startDate <= subscription.Calendar().EndDate()   and
    //              endDate   >= subscription.Calendar().StartDate() and
    //              ( isnull( subscription.RecurrencePeriod() ) or
    //                ( startDate <= subscription.RecurrencePeriod().EndDate() and
    //                  endDate   >= subscription.RecurrencePeriod().StartDate() ) ) ){
    //      info( '-----------------------1-----------------', subscription.ExplicitTimeInterval( relsize ) );
    //      subscribingETI := subscription.CreateTimeInterval( starttime, endtime, event.Capacity() );
    //
    //      if( not isnull( subscribingETI ) ){
    //        subscribingETI.LeadingETI( relset, leadingETI );
    //      }
    //      info( '-----------------------4-----------------', subscription.ExplicitTimeInterval( relsize ) );
    //    }
    //  }
    //  info( '-----------------------3-----------------', lp.ExplicitTimeInterval( relsize ) );
    } else {
      event := LibCal_Event::CreateUpdateFromUI( owner_i, participation_i, subject_i, description_i, type_i, capacity_i, category_i, isDefault_i, 
                                      startDate_i, startTimeOfDay_i, endDate_i, endTimeOfDay_i, isAllDay_i,