Просмотр исходного кода

[日程安排]修复了在某些情况下无法更新重复日程的问题

o2lee 5 лет назад
Родитель
Сommit
2ccbba7859

+ 11 - 19
o2server/x_calendar_assemble_control/src/main/java/com/x/calendar/assemble/control/service/Calendar_EventServiceAdv.java

@@ -362,8 +362,11 @@ public class Calendar_EventServiceAdv{
 			Recur recur = rule.getRecur();
 			Recur recur = rule.getRecur();
 			recur.setUntil( new net.fortuna.ical4j.model.Date(repeatEndTime) );		
 			recur.setUntil( new net.fortuna.ical4j.model.Date(repeatEndTime) );		
 			calendar_EventRepeatMaster.setRecurrenceRule( new RRule(recur).getValue());
 			calendar_EventRepeatMaster.setRecurrenceRule( new RRule(recur).getValue());
-			
-			calendar_EventRepeatMaster_new = copyEventPropertyToMaster( calendar_event );
+
+			calendar_EventRepeatMaster_new = new Calendar_EventRepeatMaster();
+			calendar_EventRepeatMaster_new.setRecurrenceStartTime( calendar_EventRepeatMaster.getRecurrenceStartTime());
+			calendar_EventRepeatMaster_new.setStartTime( calendar_EventRepeatMaster.getStartTime() );
+			calendar_EventRepeatMaster_new = copyEventPropertyToMaster( calendar_event, calendar_EventRepeatMaster_new );
 			calendar_EventRepeatMaster_new.setRecurrenceStartTime( calendar_event.getStartTime() );
 			calendar_EventRepeatMaster_new.setRecurrenceStartTime( calendar_event.getStartTime() );
 
 
 			//处理新的calendar_EventRepeatMaster_new的备注信息,原来的calendar_EventRepeatMaster不动
 			//处理新的calendar_EventRepeatMaster_new的备注信息,原来的calendar_EventRepeatMaster不动
@@ -665,7 +668,7 @@ public class Calendar_EventServiceAdv{
 	 * @param o2_calendar_event
 	 * @param o2_calendar_event
 	 * @return
 	 * @return
 	 */
 	 */
-	public net.fortuna.ical4j.model.Calendar parseToiCal( Calendar_Event o2_calendar_event ){
+	public Calendar parseToiCal( Calendar_Event o2_calendar_event ){
 		// 创建日历
 		// 创建日历
         Calendar calendar = null;
         Calendar calendar = null;
 		try {
 		try {
@@ -782,7 +785,7 @@ public class Calendar_EventServiceAdv{
 	 * @throws IOException
 	 * @throws IOException
 	 */
 	 */
 	public Boolean validateCalendar( Calendar_Event o2_calendar_event ) throws ValidationException, IOException{
 	public Boolean validateCalendar( Calendar_Event o2_calendar_event ) throws ValidationException, IOException{
-		net.fortuna.ical4j.model.Calendar calendar = parseToiCal(o2_calendar_event);
+		Calendar calendar = parseToiCal(o2_calendar_event);
 		calendar.validate();
 		calendar.validate();
 		return true;
 		return true;
 	}
 	}
@@ -795,7 +798,7 @@ public class Calendar_EventServiceAdv{
 	 * @throws IOException
 	 * @throws IOException
 	 */
 	 */
 	public void writeiCal( Calendar_Event o2_calendar_event, String path ) throws ValidationException, IOException{
 	public void writeiCal( Calendar_Event o2_calendar_event, String path ) throws ValidationException, IOException{
-		net.fortuna.ical4j.model.Calendar calendar = parseToiCal(o2_calendar_event);
+		Calendar calendar = parseToiCal(o2_calendar_event);
 		FileOutputStream fout = new FileOutputStream("D://2.ics");
 		FileOutputStream fout = new FileOutputStream("D://2.ics");
         CalendarOutputter outputter = new CalendarOutputter();
         CalendarOutputter outputter = new CalendarOutputter();
         outputter.output(calendar, fout );
         outputter.output(calendar, fout );
@@ -809,7 +812,7 @@ public class Calendar_EventServiceAdv{
 	 * @throws IOException
 	 * @throws IOException
 	 */
 	 */
 	public void wirteiCal( Calendar_Event o2_calendar_event, OutputStream out ) throws ValidationException, IOException{
 	public void wirteiCal( Calendar_Event o2_calendar_event, OutputStream out ) throws ValidationException, IOException{
-		net.fortuna.ical4j.model.Calendar calendar = parseToiCal(o2_calendar_event);
+		Calendar calendar = parseToiCal(o2_calendar_event);
         CalendarOutputter outputter = new CalendarOutputter();
         CalendarOutputter outputter = new CalendarOutputter();
         outputter.output(calendar, out );
         outputter.output(calendar, out );
 	}
 	}
@@ -821,7 +824,7 @@ public class Calendar_EventServiceAdv{
 	 * @throws IOException
 	 * @throws IOException
 	 */
 	 */
 	public String getiCalContent( Calendar_Event o2_calendar_event) throws ValidationException, IOException{
 	public String getiCalContent( Calendar_Event o2_calendar_event) throws ValidationException, IOException{
-		net.fortuna.ical4j.model.Calendar calendar = parseToiCal(o2_calendar_event);
+		Calendar calendar = parseToiCal(o2_calendar_event);
 		CalendarOutputter calendarOutputter = new CalendarOutputter(false); 
 		CalendarOutputter calendarOutputter = new CalendarOutputter(false); 
 		ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
 		ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
 		calendarOutputter.output(calendar, baos); 
 		calendarOutputter.output(calendar, baos); 
@@ -845,16 +848,6 @@ public class Calendar_EventServiceAdv{
 		}
 		}
 	}
 	}
 	
 	
-	/**
-	 * 根据calendar_event创建一个新的重复主体
-	 * @param calendar_event
-	 * @return
-	 */
-	private Calendar_EventRepeatMaster copyEventPropertyToMaster( Calendar_Event calendar_event ) {
-		Calendar_EventRepeatMaster calendar_EventRepeatMaster = new Calendar_EventRepeatMaster();
-		return copyEventPropertyToMaster( calendar_event, calendar_EventRepeatMaster );
-	}
-	
 	/**
 	/**
 	 * 根据calendar_event信息更新一个新的重复主体
 	 * 根据calendar_event信息更新一个新的重复主体
 	 * @param calendar_event
 	 * @param calendar_event
@@ -871,7 +864,7 @@ public class Calendar_EventServiceAdv{
 			
 			
 			//修改一下开始时间的时分秒
 			//修改一下开始时间的时分秒
 			String newRecurrenceStartTime_str = dateOperation.getDate( recurrenceStartTime, "yyyy-MM-dd") + " " + dateOperation.getDate( startTime_event, "HH:mm:ss");
 			String newRecurrenceStartTime_str = dateOperation.getDate( recurrenceStartTime, "yyyy-MM-dd") + " " + dateOperation.getDate( startTime_event, "HH:mm:ss");
-			String newStartTime_str = dateOperation.getDate( startTime, "yyyy-MM-dd") + " " + dateOperation.getDate( startTime_event, "HH:mm:ss");
+			String newStartTime_str = dateOperation.getDate( startTime_event, "yyyy-MM-dd") + " " + dateOperation.getDate( startTime_event, "HH:mm:ss");
 			try {
 			try {
 				recurrenceStartTime_new = dateOperation.getDateFromString( newRecurrenceStartTime_str, "yyyy-MM-dd HH:mm:ss");
 				recurrenceStartTime_new = dateOperation.getDateFromString( newRecurrenceStartTime_str, "yyyy-MM-dd HH:mm:ss");
 			} catch (Exception e) {
 			} catch (Exception e) {
@@ -884,7 +877,6 @@ public class Calendar_EventServiceAdv{
 				startTime_new = startTime;
 				startTime_new = startTime;
 				e.printStackTrace();
 				e.printStackTrace();
 			}
 			}
-			
 			calendar_EventRepeatMaster.setAlarm( calendar_event.getAlarm() );
 			calendar_EventRepeatMaster.setAlarm( calendar_event.getAlarm() );
 			calendar_EventRepeatMaster.setAlarmTime( calendar_event.getAlarmTime() );
 			calendar_EventRepeatMaster.setAlarmTime( calendar_event.getAlarmTime() );
 			calendar_EventRepeatMaster.setCalendarId( calendar_event.getCalendarId() );
 			calendar_EventRepeatMaster.setCalendarId( calendar_event.getCalendarId() );