package cn.updev.Action.Todo;

/**
 * Created by hypo on 15-11-25.
 */
public class TodoListAction {
}

@@ -28,76 +28,2606 @@
 o;%0A%0A
-/**%0A * Created by hypo on 15-11-25.%0A */%0Apublic class TodoListAction %7B
+import cn.updev.EventWeight.Weight.EventWeight;%0Aimport cn.updev.EventWeight.Weight.EventWeightManage;%0Aimport cn.updev.Events.Event.EventDAO;%0Aimport cn.updev.Events.Static.IEvent;%0Aimport com.opensymphony.xwork2.ActionSupport;%0A%0Aimport java.util.Collections;%0Aimport java.util.Comparator;%0Aimport java.util.List;%0A%0A/**%0A * Created by hypo on 15-11-25.%0A */%0Apublic class TodoListAction extends ActionSupport %7B%0A%0A    public String execute() throws Exception %7B%0A%0A        EventDAO eventDAO = new EventDAO();%0A%0A        // %E8%8E%B7%E5%BE%97%E7%99%BB%E5%BD%95%E7%94%A8%E6%88%B7%0A        Integer userId = 1;%0A        List%3CIEvent%3E events = eventDAO.getUnfinishEventByUserId(userId);%0A%0A%0A        Collections.sort(events, new Comparator%3CIEvent%3E() %7B%0A            @Override%0A            public int compare(IEvent o1, IEvent o2) %7B%0A                EventWeightManage eventWeight = new EventWeightManage();%0A                EventWeight weight1 = eventWeight.getEventWeight(o1.getEventId());%0A                EventWeight weight2 = eventWeight.getEventWeight(o2.getEventId());%0A                return (int)(weight1.getEventWeight() - weight2.getEventWeight());%0A            %7D%0A        %7D);%0A%0A        Collections.sort(events, new Comparator%3CIEvent%3E() %7B%0A            @Override%0A            public int compare(IEvent o1, IEvent o2) %7B%0A                EventWeightManage eventWeight = new EventWeightManage();%0A                EventWeight weight1 = eventWeight.getEventWeight(o1.getEventId());%0A                EventWeight weight2 = eventWeight.getEventWeight(o2.getEventId());%0A                Long time1 = weight1.getEventExpect().getTime() / 1000;%0A                Long time2 = weight2.getEventExpect().getTime() / 1000;%0A                return (int)(time2 - time1);%0A            %7D%0A        %7D);%0A%0A        Collections.sort(events, new Comparator%3CIEvent%3E() %7B%0A            @Override%0A            public int compare(IEvent o1, IEvent o2) %7B%0A                EventWeightManage eventWeight = new EventWeightManage();%0A                EventWeight weight1 = eventWeight.getEventWeight(o1.getEventId());%0A                EventWeight weight2 = eventWeight.getEventWeight(o2.getEventId());%0A                Long time1 = weight1.getEventReckon().getTime() / 1000;%0A                Long time2 = weight2.getEventReckon().getTime() / 1000;%0A                return (int)(time1 - time2);%0A            %7D%0A        %7D);%0A%0A        for(IEvent event : events)%7B%0A            EventWeightManage eventWeight = new EventWeightManage();%0A            EventWeight weight = eventWeight.getEventWeight(event.getEventId());%0A            System.out.println(event.getEventTitle() + %22 %22 + weight.getEventReckon());%0A        %7D%0A%0A        return SUCCESS;%0A    %7D
 %0A%7D%0A

add TodoListAction