Exemplo n.º 1
0
 /**
  * 功能描述:为formBean赋初值
  *
  * @param dataCount
  * @param formBean
  */
 public void setFormBean(DataCount dataCount, DefaultForm formBean)
     throws DBException, LogicException {
   if (dataCount != null) {
     formBean.setNewFriend(dataCount.getNewFriend().toString());
     formBean.setNewSalutation(dataCount.getNewSalutation().toString());
     formBean.setNewShortMessage(dataCount.getNewShortMessage().toString());
     formBean.setNewTeacherAppraise(dataCount.getNewTeacherAppraise().toString());
   }
 }
Exemplo n.º 2
0
 /**
  * 功能描述:得到用户id为userId的数据统计对象,未找到时返回null
  *
  * @param userId
  * @return
  * @throws DBException
  */
 public DataCount findDataCountByUserId(Long userId) throws DBException {
   DataCount dataCount = dataCountDao.getDataCountByUserId(userId);
   if (dataCount == null) {
     DataCount newDataCount = new DataCount();
     newDataCount.setUserId(userId);
     this.save(newDataCount);
     dataCount = newDataCount;
   }
   return dataCount;
 }
Exemplo n.º 3
0
 /**
  * 功能描述:用户查操作评语时设置统计表的新评语字段值减1
  *
  * @param userId
  * @return
  * @throws DBException
  */
 public boolean minusNewTeacherAppraise(Long userId) throws DBException {
   DataCount dataCount = findDataCountByUserId(userId);
   // 判断是否存在这样的用户统计实体
   if (dataCount != null) {
     Long newTeacherAppraise = dataCount.getNewTeacherAppraise();
     if (newTeacherAppraise != null && newTeacherAppraise.longValue() > 0) {
       dataCount.setNewTeacherAppraise(new Long(newTeacherAppraise.longValue() - 1));
       dataCountDao.update(dataCount);
       return true;
     }
   }
   return false;
 }
Exemplo n.º 4
0
 /**
  * 功能描述:用户进入打招呼页面后,把统计表的新招呼字段清零
  *
  * @param userId
  * @return
  * @throws DBException
  */
 public boolean clearNewSalutation(Long userId) throws DBException {
   DataCount dataCount = findDataCountByUserId(userId);
   // 判断是否存在这样的用户统计实体
   if (dataCount != null) {
     Long newSalutation = dataCount.getNewSalutation();
     if (newSalutation != null) {
       dataCount.setNewSalutation(new Long(0));
       dataCountDao.update(dataCount);
       return true;
     }
   }
   return false;
 }
Exemplo n.º 5
0
 /**
  * 功能描述:有一个好友发送短消息时,为短消息的接收方的统计表的新短消息字段值加1
  *
  * @param userId
  * @return
  * @throws DBException
  */
 public boolean addNewShortMessage(Long userId) throws DBException {
   DataCount dataCount = findDataCountByUserId(userId);
   // 判断是否存在这样的用户统计实体
   if (dataCount != null) {
     Long newShortMessage = dataCount.getNewShortMessage();
     if (newShortMessage != null) {
       dataCount.setNewShortMessage(new Long(newShortMessage.longValue() + 1));
       dataCountDao.update(dataCount);
       return true;
     }
   }
   return false;
 }
Exemplo n.º 6
0
 /**
  * Function: 根据用户ID加回复数</br>
  *
  * <p>Produce describe:
  *
  * @param userId
  * @throws DBException
  * @author: You 2008-4-17
  */
 public void addCircleReplyTotalByUserId(long userId) throws DBException {
   // TODO Auto-generated method stub
   DataCount dc = this.findDataCountByUserId(userId);
   if (dc != null) {
     if (dc.getCircleReplyTotal() != null)
       // 加1
       dc.setCircleReplyTotal(dc.getCircleReplyTotal() + 1);
     else dc.setCircleReplyTotal(new Long(1));
   } else {
     DataCount tt = new DataCount();
     tt.setUserId(userId);
     dc.setCircleReplyTotal(new Long(1));
     this.save(tt);
   }
 }
Exemplo n.º 7
0
 /**
  * Function: 根据用户ID加发帖数</br>
  *
  * <p>Produce describe:
  *
  * @param userId
  * @throws DBException
  * @author: You 2008-4-17
  */
 public void addCircleTopicTotalByUserId(long userId) throws DBException {
   // TODO Auto-generated method stub
   DataCount dc = this.findDataCountByUserId(userId);
   if (dc != null) {
     // 加1
     if (dc.getCircleTopicTopTotal() == null) {
       dc.setCircleTopicTotal(new Long(1));
     } else {
       dc.setCircleTopicTotal(dc.getCircleTopicTotal() + 1);
     }
     this.update(dc);
   } else {
     DataCount tt = new DataCount();
     tt.setUserId(userId);
     tt.setCircleTopicTopTotal(new Long(1));
     this.save(tt);
   }
 }
Exemplo n.º 8
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;
  }