Exemplo n.º 1
0
  @Override
  public String execute() throws Exception {

    // log.debug("==================surveyId:"+surveyId);
    surveyManager.deleteSurveyById(surveyId);
    return SUCCESS;
  }
Exemplo n.º 2
0
  @Override
  public String execute() throws Exception {

    Map map = ActionContext.getContext().getSession();
    user = (User) map.get("user");
    // 新闻
    ArrayList<News> arrayNews = (ArrayList<News>) newsManager.getTop(3);
    news = new ArrayList<News>();
    for (News n : arrayNews) {
      News newsi = new News();
      newsi.setId(n.getId());
      newsi.setPublishtime(n.getPublishtime());
      String Title = n.getTitle();
      Title = this.cutStr(Title, 33);
      newsi.setTitle(Title);
      news.add(newsi);
    }

    // 公告

    ArrayList<Notice> arrayNotice = (ArrayList<Notice>) noticeManager.getTop(3);
    notice = new ArrayList<Notice>();
    for (Notice n : arrayNotice) {
      Notice noticei = new Notice();
      noticei.setId(n.getId());
      noticei.setPublishtime(n.getPublishtime());
      String Title = n.getTitle();
      Title = this.cutStr(Title, 33);
      noticei.setTitle(Title);
      notice.add(noticei);
    }

    ArrayList<Essentialcourse> arrayEssentialCourses =
        (ArrayList<Essentialcourse>) essentialcourseManager.getTop(3);
    essentialcourses = new ArrayList<Essentialcourse>();
    for (Essentialcourse e : arrayEssentialCourses) {
      Essentialcourse essentialcoutsei = new Essentialcourse();
      essentialcoutsei.setId(e.getId());
      essentialcoutsei.setTeacher(e.getTeacher());
      String Title = e.getTitle();
      String teacherName = "[" + e.getTeacher() + "]";
      Title = this.cutStr(Title, 40 - teacherName.length());
      essentialcoutsei.setTitle(Title);
      essentialcourses.add(essentialcoutsei);
    }

    ArrayList<Leadingscholar> arrayLeadingscholars =
        (ArrayList<Leadingscholar>) leadingscholarManager.getTop(3);
    leadingscholars = new ArrayList<Leadingscholar>();
    for (Leadingscholar e : arrayLeadingscholars) {
      Leadingscholar ls = new Leadingscholar();
      ls.setId(e.getId());
      String name = e.getName();
      name = this.cutStr(name, 39);
      ls.setName(name);
      leadingscholars.add(ls);
    }

    listbase = baseManager.findAllOrderByUniversity();

    List<Picinflash> picinflash = picinflashManager.getTopObjectsOrderByCreateTime(4);
    flashData = picinflashManager.getJsonData(picinflash);

    // 去掉”教育部“
    for (int i = 0; i < listbase.size(); i++) {
      Base base = (Base) listbase.get(i);
      if (base.getUniversity().equals("教育部")) {
        listbase.remove(i);
        break;
      }
    }

    for (int i = 0; i < listbase.size(); i++) {
      Base base = (Base) listbase.get(i);
      int len = base.getUniversity().length();
      double b = len / 8.0;
      if (Math.ceil(b) > 1) {
        baseSpanWidth.add((int) (Math.ceil(b) * 102) + 1);
      } else {
        baseSpanWidth.add(102);
      }
      // log.debug("========"+base.getUniversity()+": len:"+len+" b:"+b+"
      // Math.round:"+Math.ceil(b)+" baseSpanWidth:"+((int)(Math.ceil(b)*102)+1));
    }

    // artList = artManager.getTopThree();

    // 学员专区
    ArrayList<StudyExperience> arrayStudyExperience =
        (ArrayList<StudyExperience>) experienceManager.getTop(3);
    studyExperiences = new ArrayList<StudyExperience>();
    for (StudyExperience e : arrayStudyExperience) {
      StudyExperience se = new StudyExperience();
      se.setId(e.getId());
      String name = e.getTitle();
      name = this.cutStr(name, 39);
      se.setTitle(name);
      studyExperiences.add(se);
    }

    ArrayList<Survey> arraySurvey = (ArrayList<Survey>) surveyManager.getTop(3);
    surveies = new ArrayList<Survey>();
    for (Survey e : arraySurvey) {
      Survey se = new Survey();
      se.setId(e.getId());
      String name = e.getTitle();
      name = this.cutStr(name, 39);
      se.setTitle(name);
      surveies.add(se);
    }
    //
    //       List<TraineeZoneArticle> listArt = artManager.getTopThree();
    //       artList = new ArrayList<TraineeZoneArticle>();
    //       for(TraineeZoneArticle t :  listArt)
    //        {
    //       	 TraineeZoneArticle traineeZoneArticlei = new TraineeZoneArticle();
    //       	 traineeZoneArticlei.setType(t.getType());
    //       	 if(t.getType() == 1 )
    //       	 {
    //       		int id = ((StudyExperience)t.getArticle()).getId();
    //       		String title = ((StudyExperience)t.getArticle()).getTitle();
    //       		title = this.cutStr(title, 34);
    //       		StudyExperience stu = new StudyExperience();
    //       		 stu.setId(id);
    //       		 stu.setTitle(title);
    //       		traineeZoneArticlei.setArticle(stu);
    //       	 }
    //       	 if(t.getType() == 3 )
    //       	 {
    //       		int id = ((Survey)t.getArticle()).getId();
    //       		String title = ((Survey)t.getArticle()).getTitle();
    //       		title = this.cutStr(title, 34);
    //       		Survey sur = new Survey();
    //       		 sur.setId(id);
    //      		 sur.setTitle(title);
    //      		traineeZoneArticlei.setArticle(sur);
    //       	 }
    //       	artList.add(traineeZoneArticlei);
    //        }
    return SUCCESS;
  }