コード例 #1
0
ファイル: DefaultAction.java プロジェクト: huiping192/sample
 /**
  * Function: Form 共同初始化
  *
  * <p>Produce Describe:
  *
  * @throws SysException
  * @throws DBException
  * @throws LogicException
  */
 @Override
 protected void formInit() throws SysException, DBException, LogicException {
   String methodName = "formInit";
   logger.startMethod(methodName);
   // ------- 共同初始化开始 -------
   // TODO
   UserCommonInfo cinfo = getCommonInfo();
   if (cinfo != null && cinfo.getId() != null) {
     DataCount dataCount = dataCountBo.findDataCountByUserId(cinfo.getId());
     dataCountBo.setFormBean(dataCount, fr);
   }
   // ------- 共同初始化结束 -------
   logger.endMethod(methodName);
 }
コード例 #2
0
ファイル: DefaultAction.java プロジェクト: huiping192/sample
  /**
   * 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
    DefaultFormUtil frUtil = new DefaultFormUtil(fr);

    // 从Session获得公共信息
    UserCommonInfo cinfo = getCommonInfo();

    // ------- 画面的参数设置开始 -------
    // TODO

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

    String doAction = fr.getDoAction();
    String pageId = fr.getPageID();
    UserCommonInfo userInfo = super.getCommonInfo();
    if (userInfo == null) {
      return "login";
    }
    if (!(userInfo.getObjectTableName()).equals(SystemConstant.BABY_INFO_TABLE_NAME)) {
      return "userNotExit";
    }
    // 判定pageID的值
    if ("Default".equals(pageId)) {
      // ------- 本画面的Action处理开始 -------
      // 根据doAction的值、处理
      // TODO

      // ------- 本画面的Action处理结束 -------
    } else {
      // ------- 从其他页面到本页面的Action处理开始 -------
      // TODO

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

    logger.endMethod(methodName);
    return SUCCESS;
  }
コード例 #3
0
ファイル: AlbumAction.java プロジェクト: huiping192/sample
  /**
   * 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;
  }