/**
   * Function: 评语搜索及分页
   *
   * <p>Produce describe:
   *
   * @param pageSize
   * @param pageNo
   * @param teacherId
   * @param search
   * @return
   * @author: Benjamin 2008-3-25
   */
  public PageObject searchComment(int pageSize, int pageNo, AppraiseSearchVo searchVo) {
    // 分页取数据
    PageObject po = kgTeacherAppraiseDao.getCommentList(pageSize, pageNo, searchVo);

    List lst = po.getItems();
    List list = new ArrayList();

    if (lst.size() > 0) {

      for (int i = 0; i < lst.size(); i++) {

        KgTeacherAppraise kgTeacherAppraisePo = (KgTeacherAppraise) lst.get(i);

        KgTeacherAppraiseVo kgTAVo = new KgTeacherAppraiseVo();

        // 得到评语Id
        kgTAVo.setId(kgTeacherAppraisePo.getId());
        // 得到学生Id
        kgTAVo.setStudentId(kgTeacherAppraisePo.getStudentId());
        // 得到教师Id
        kgTAVo.setTeacherId(searchVo.getTeacherId());
        // 得到评语标题
        kgTAVo.setAppraiseName(kgTeacherAppraisePo.getAppraiseName());
        // 得到评语内容
        kgTAVo.setAppraiseText(kgTeacherAppraisePo.getAppraiseText());
        // 得到评语添加时间
        kgTAVo.setCreateTime(
            DateUtil.getFormatDate(DateUtil.YYYY_MM_DD_HH_MI, kgTeacherAppraisePo.getCreateTime()));

        list.add(kgTAVo);
      }
    }
    po.setItems(list);
    return po;
  }
示例#2
0
  /**
   * Function: 固定�要实现的方法
   *
   * <p>Produce Describe: 获得Form Object
   *
   * @return
   * @throws SysException
   * @throws DBException
   * @throws LogicException
   */
  @Override
  protected String doExecute() throws SysException, DBException, LogicException {

    String methodName = "doExecute";
    logger.startMethod(methodName);

    // 设置Form Util
    AlbumFormUtil frUtil = new AlbumFormUtil(fr);

    // 从Session获得公共信息
    // ------- 画面的参数设置开始 -------
    // TODO

    // ------- 画面的参数设置结束 -------

    String doAction = fr.getDoAction();
    String pageId = fr.getPageID();
    String uId = fr.getUid();
    if (uId == null || uId.equals("")) {
      return "userNotExit";
    }
    User user = userBo.load(Long.valueOf(uId));
    if (!(user.getObjectTableName()).equals(SystemConstant.BABY_INFO_TABLE_NAME)) {
      return "userNotExit";
    }
    UserCommonInfo userCommon = super.getCommonInfo();
    // 判定pageID的值
    int pageSize = 3;
    int pageNo = 1;

    if (fr.getPn() > 0) {
      pageNo = fr.getPn();
    }
    if (fr.getPs() > 0) {
      pageSize = fr.getPs();
    }
    PageObject pageObject =
        babyAlbumBo.getBabyAlbumList(
            Long.valueOf(uId), SystemConstant.BABY_INFO_TABLE_NAME, pageSize, pageNo);
    fr.setPageObject(pageObject);
    // 得到好友
    List friendList = friendBo.getFriends(Long.valueOf(uId));
    if (friendList.size() > 0) {
      fr.setFriendList(friendList);
    }
    // 得到访客
    List visitList = familyVisitRecordBo.getUsersByOwnerId(Long.valueOf(uId));
    if (visitList.size() > 0) {
      fr.setVisiterVos(visitList);
    }
    fr.setUid(uId);
    // 得到用户信息
    fr.setUser(user);
    if (userCommon != null) {
      // 加一条记录为访客
      if (!user.getId().equals(userCommon.getId()) && user.getId() != userCommon.getId()) {
        familyVisitRecordBo.addVisitRecord(userCommon.getId(), user.getId());
      }
      // 取出是否为好友
      boolean isFriend = friendBo.getIsFriend(user.getId(), userCommon.getId());
      fr.setFriend(isFriend);
      // 把用户的访问记录里加1
      userBo.updateVisitCount(user.getId());
    }
    // 取出用户扩展表的信息
    FamilySpace familySpace = familySpaceBo.getFamilySpaceByUserId(user.getId());
    fr.setFamilySpace(familySpace);
    if (familySpace != null) {
      fr.setTempleteUrl((spaceThemeBo.load(familySpace.getTemplateId())).getThemePath());
    }
    // 得到岁数天数月数
    BabyInfo babyInfo = babyInfoBo.load(user.getObjectId());
    fr.setEge(DateUtil.getTimeDiff(babyInfo.getBabyBirthday(), DateUtil.getCurrentDateTimestamp()));
    // 得到生日和幼儿园地区
    fr.setArea(babyInfo.getCity() + "  " + babyInfo.getArea());
    fr.setKg(babyInfo.getKindergarten());
    fr.setBirthDay(babyInfo.getBabyBirthday());
    if ("album".equals(pageId)) {
      // ------- 本画面的Action处理开始 -------
      // 根据doAction的值、处理
      // TODO
      if ("delete".equals(doAction)) {
        // 删除相册
        String id = fr.getAlbumId();
        babyAlbumBo.deleteAlbum(Long.valueOf(id));
      }
      if ("create".equals(doAction)) {
        // 创建相册
        this.request.setAttribute("flags", "2");
        frUtil.createCheck();
        babyAlbumBo.insertAlbum(
            Long.valueOf(uId),
            "",
            fr.getName(),
            fr.getDescription(),
            fr.getPopedom(),
            SystemConstant.BABY_INFO_TABLE_NAME);
        return "addSuccess";
      }
      if ("update".equals(doAction)) {
        // 修改相册
        this.request.setAttribute("flags", "1");
        this.request.setAttribute("alId", fr.getAlbumId());
        this.request.setAttribute("alName", fr.getName());
        this.request.setAttribute("alDesc", fr.getDescription());
        frUtil.createCheck();
        babyAlbumBo.updateAlbum(
            Long.valueOf(uId),
            Long.valueOf(fr.getAlbumId()),
            fr.getName(),
            fr.getDescription(),
            fr.getPopedom(),
            SystemConstant.BABY_INFO_TABLE_NAME);
        return "updateSuccess";
      }
      // 加为好友
      if ("act_addFr".equals(doAction)) {
        if (user != null && userCommon != null) {
          friendBo.appFriend(userCommon.getId(), user.getId());
        }

      }
      // 打声招呼
      else if ("act_addSa".equals(doAction)) {
        if (user != null && userCommon != null) {
          salutationBo.addSalutation(userCommon.getId(), user.getId());
        }
      }
      // ------- 本画面的Action处理结束 -------
    }
    // ------- 从其他页面到本页面的Action处理开始 -------
    // TODO

    // ------- 从其他页面到本页面的Action处理结束 -------
    logger.endMethod(methodName);
    return SUCCESS;
  }