Esempio n. 1
0
  /**
   * Function: 得到发帖数最多的十个用户
   *
   * <p>Produce describe:
   *
   * @return
   * @author: wu3889 2008-4-8
   * @throws DBException
   */
  public List getQuestionTopTenUserVoList() throws DBException {

    List list = dataCountDao.getQuestionTopTenUserList();

    List tpTenUserVoList = new ArrayList();

    DataCount dataCountPo = null;

    // 用户对象
    User userPo = new User();

    QuestionTopTenUserVo questionTopTenUserVo = null;

    if (list != null && list.size() > 0) {

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

        dataCountPo = (DataCount) list.get(i);

        questionTopTenUserVo = new QuestionTopTenUserVo();

        userPo = new User();
        // 得到用户对象
        userPo = userDao.load(dataCountPo.getUserId());

        if (userPo != null) {

          // 昵称
          if (userPo.getNickName() != null) {
            questionTopTenUserVo.setNickName(userPo.getNickName());
            questionTopTenUserVo.setCutName(
                DoText.getInterceptString(userPo.getNickName(), 5, "..."));
          }

          // 用户头像
          if (userPo.getHeadPhotoLink() != null) {
            questionTopTenUserVo.setUserPhotoLink(userPo.getHeadPhotoLink());
          }

          // 发帖数
          if (dataCountPo.getQuestionTotal() != null)
            questionTopTenUserVo.setQuestionTotal(dataCountPo.getQuestionTotal());

          // Id
          questionTopTenUserVo.setId(userPo.getId());

          // 判断用户角色
          if (treUserRoleBo.checkUserIsRole(
                  userPo.getId(),
                  roleBo.getRoleId(
                      SystemConstant.ROLE_ROLE_KIND_1, SystemConstant.ROLE_ROLE_NO_GARDEN_USER_3))
              || treUserRoleBo.checkUserIsRole(
                  userPo.getId(),
                  roleBo.getRoleId(
                      SystemConstant.ROLE_ROLE_KIND_1,
                      SystemConstant.ROLE_ROLE_NO_GARDEN_USER_1))) {
            // 园长或者老师
            questionTopTenUserVo.setFlag("1");

          } else if (treUserRoleBo.checkUserIsRole(
                  userPo.getId(),
                  roleBo.getRoleId(
                      SystemConstant.ROLE_ROLE_KIND_2, SystemConstant.ROLE_ROLE_NO_MONEY_USER_1))
              || treUserRoleBo.checkUserIsRole(
                  userPo.getId(),
                  roleBo.getRoleId(
                      SystemConstant.ROLE_ROLE_KIND_2, SystemConstant.ROLE_ROLE_NO_MONEY_USER_2))) {
            // 注册会员或者收费会员
            questionTopTenUserVo.setFlag("2");
          }

          tpTenUserVoList.add(questionTopTenUserVo);
        }
      }
    }

    return tpTenUserVoList;
  }
Esempio n. 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;
  }