public String edit() {
    info.setEditUserNo(UserHelper.getEditUserNo());
    int id = 0;
    if (this.getOper().equalsIgnoreCase("add")) {
      info.setInUserNo(UserHelper.getEditUserNo());
      id = TempRecruitDetailModel.add(info);
      if (id > 0) {
        this.setErrDesc(String.valueOf(id));
      } else {
        this.setErrCode("add failed");
        this.setErrDesc("add failed");
      }

    } else {
      if (info.getId() == 0) {
        this.setErrCode("NoID");
        this.setErrDesc("NoID");
      } else {
        if (this.getOper().equalsIgnoreCase("edit")) {
          if (TempRecruitDetailModel.update(info) > 0) {
            this.setErrDesc(String.valueOf(info.getId()));
          } else {
            this.setErrCode("update failed");
            this.setErrDesc("update failed");
          }
        }
      }
    }

    return SUCCESS;
  }
  public PaymentRefundCondition getCondition() {
    PaymentRefundCondition paymentRefundCondition = new PaymentRefundCondition();
    paymentRefundCondition.setPageSize(this.getPageSize());
    paymentRefundCondition.setPageIndex(this.getPageIndex());
    if ("query".equals(this.showAllList)) {
      paymentRefundCondition.setSalesNos(null);
    } else {
      List<Integer> workmate = UserHelper.getUserCache().getWorkMate();
      String workMateString = "";
      if (workmate != null) {
        workmate.add(UserHelper.getUserCache().getUserId());
        workMateString = StringHelper.listToString(workmate);
      } else {
        workMateString = String.valueOf(UserHelper.getUserCache().getUserId());
      }
      List<Sales> salesList = SalesModel.getListByEmps(workMateString);
      List<Integer> salesNos = new ArrayList<Integer>();
      for (Sales sales : salesList) {
        salesNos.add(sales.getId());
      }
      paymentRefundCondition.setSalesNos(StringHelper.listToString(salesNos));
    }

    if (!StringHelper.isNullOrEmpty(this.getIsTest())) {
      paymentRefundCondition.setIsTest(Byte.valueOf(this.getIsTest()));
    } else {
      paymentRefundCondition.setIsTest((byte) 0);
    }
    if (!StringHelper.isNullOrEmpty(this.byP2pProduct)) {
      paymentRefundCondition.setP2pProductNo(Integer.valueOf(this.byP2pProduct));
    }
    if (!StringHelper.isNullOrEmpty(this.byStatus)) {
      paymentRefundCondition.setStatus(Byte.valueOf(this.byStatus));
    }
    if (!StringHelper.isNullOrEmpty(this.byStartRepayIssue)) {
      paymentRefundCondition.setByStartRepayIssue(this.byStartRepayIssue);
    }
    if (!StringHelper.isNullOrEmpty(this.byEndRepayIssue)) {
      paymentRefundCondition.setByEndRepayIssue(this.byEndRepayIssue);
    }
    if (!StringHelper.isNullOrEmpty(this.smsStatus)) {
      paymentRefundCondition.setSmsStatus(Integer.parseInt(this.smsStatus));
    } else {
      paymentRefundCondition.setSmsStatus(-1);
    }
    if (!StringHelper.isNullOrEmpty(this.byPayType)) {
      paymentRefundCondition.setPayType(Byte.valueOf(this.byPayType));
    }
    List<SortItem> sortItemList = new ArrayList<SortItem>();
    SortItem sortItem = new SortItem();
    sortItem.setSortFeild(this.getSidx());
    sortItem.setSortType(this.getSortType());
    sortItemList.add(sortItem);
    paymentRefundCondition.setSortItemList(sortItemList);
    return paymentRefundCondition;
  }
  public String edit() {
    info.setEditUserNo(UserHelper.getEditUserNo());
    int id = 0;
    if (this.getOper().equalsIgnoreCase("add")) {
      info.setInUserNo(UserHelper.getEditUserNo());
      id = PaymentRefundModel.add(info);
      if (id > 0) {
        this.setErrDesc(String.valueOf(id));
      } else {
        this.setErrCode("add failed");
        this.setErrDesc("add failed");
      }

    } else {
      if (info.getId() == 0) {
        this.setErrCode("NoID");
        this.setErrDesc("NoID");
      } else {
        if (this.getOper().equalsIgnoreCase("edit")) {
          PaymentRefund paymentRefund = PaymentRefundModel.getInfo(info.getId());
          info.setSalesNo(paymentRefund.getSalesNo());
          info.setP2pProductNo(paymentRefund.getP2pProductNo());
          // info.setP2pCustomerNo(paymentRefund.getP2pCustomerNo());
          info.setCustomerNo(paymentRefund.getCustomerNo());
          info.setPayerNo(paymentRefund.getPayerNo());
          if (PaymentRefundModel.update(info) > 0) {
            this.setErrDesc(String.valueOf(info.getId()));
          } else {
            this.setErrCode("update failed");
            this.setErrDesc("update failed");
          }
        }
      }
    }

    return SUCCESS;
  }
  private void initPageVar() {
    StringBuilder sb = new StringBuilder();

    sb.append("<script type=\"text/javascript\">");
    sb.append("var PageVar={");
    sb.append(String.format("%1$s:'%2$s',", "ID", this.id));
    sb.append(String.format("%1$s:'%2$s',", "UserId", UserHelper.getEditUserNo()));
    sb.append("};");

    sb.append("var ElementVar={");
    for (TagPermissionView tagPermissionView :
        this.getPagePermissionView().getTagPermissionViewList()) {
      sb.append(
          String.format(
              "%1$s:'%2$s',",
              tagPermissionView.getTagName(),
              String.valueOf(tagPermissionView.getTagPermissionType())));
    }
    sb.append("};");

    sb.append("</script>");

    this.pageVar = sb.toString();
  }