/**
   * 填充明细控件。
   *
   * @param 明细结构体
   * @return 没有
   */
  protected void rptList_PopulateItem(Item<Map<String, Object>> item) {
    Map<String, Object> dataRow = item.getModelObject();

    // ID
    FWLabel index = new FWLabel("index");
    index.setRenderBodyOnly(true);
    index.setValue(ConvUtils.convToString(rptList.getFirstItemOffset() + item.getIndex() + 1));
    item.add(index);

    // 投资人
    FWLabel tender = new FWLabel("tender");
    tender.setRenderBodyOnly(true);
    item.add(tender);
    String mobile = ConvUtils.convToString(dataRow.get("MOBILE"));
    String email = ConvUtils.convToString(dataRow.get("EMAIL"));
    String connectChar = "/";
    if (StringUtils.isEmpty(mobile) || StringUtils.isEmpty(email)) {
      connectChar = "";
    }
    tender.setValue(mobile + connectChar + email);

    // 产品标题
    FWModalPopupLink titleLink = new FWModalPopupLink("title");
    titleLink.setLabel(ConvUtils.convToString(dataRow.get("FINANCE_PROD_TITLE")));

    titleLink.add(
        AttributeModifier.replace(
            "onclick",
            "layer_show('450','','宝宝产品明细','"
                + fwContext.getContextRoot()
                + TransitionUrlConst.PROD_FINANCE_OPERATION_PAGE
                + "?"
                + PageParamConstant.VIEW_DETAIL
                + "=0&"
                + PageParamConstant.OBJECT_ID
                + "="
                + dataRow.get("OID_FINANCE_PROD_ID")
                + "')"));
    item.add(titleLink);

    // 理财金额
    FWLabel financeProdAmount = new FWLabel("financeProdAmount");
    financeProdAmount.setRenderBodyOnly(true);
    financeProdAmount.setValue(ConvUtils.convToMoney(dataRow.get("FINANCE_PROD_AMOUNT")));
    item.add(financeProdAmount);

    // 理财天数
    FWLabel financeProdaDays = new FWLabel("financeProdaDays");
    financeProdaDays.setRenderBodyOnly(true);
    financeProdaDays.setValue(ConvUtils.convToString(dataRow.get("FINANCE_PROD_DAYS")));
    item.add(financeProdaDays);

    // 收益总额
    FWLabel operationAmount = new FWLabel("operationAmount");
    operationAmount.setRenderBodyOnly(true);
    operationAmount.setValue(ConvUtils.convToMoney(dataRow.get("OPERATION_AMOUNT")));
    item.add(operationAmount);
  }
  @Override
  protected void initComponent() {

    // 用户损益表页面跳转至本页面时user的取得
    if (!StringUtils.isEmpty(getParameter(EncryptUtil.encryptMD5("oidUserId")))) {
      oidUserId = new DesEncryptUtil().decrypt(getParameter(EncryptUtil.encryptMD5("oidUserId")));
    }
    // 用户账户资金查询页面跳转至本页面时currentPage保存
    if (!StringUtils.isEmpty(getParameter("currentPage"))) {
      currentPage = getParameter("currentPage");
    }
    // 用户账户资金查询页面跳转至本页面时userType保存
    if (!StringUtils.isEmpty(getParameter("userType"))) {
      userType = getParameter("userType");
    }
    // 用户账户资金查询页面跳转至本页面时find保存
    if (!StringUtils.isEmpty(getParameter("find"))) {
      find = getParameter("find");
    }

    form = new FWForm("form", this);
    body.add(form);

    ddlYear = new FWDropDownChoice("ddlYear", year, true, this);
    form.add(ddlYear);

    ddlMonth = new FWDropDownChoice("ddlMonth", month, true, this);
    form.add(ddlMonth);

    cnt = new FWLabel("cnt");
    cnt.setRenderBodyOnly(true);
    form.add(cnt);

    // 数据容器生成
    recoverDetailDP = new GridDataProvider();
    // 明细容器生成
    rptList = new FWDataView("rptList", recoverDetailDP, this);
    // 每页件数设定
    rptList.setItemsPerPage(getItemsPerPage());
    // 控件追加
    form.add(rptList);

    // 分页处理
    paging = new ILoanCustomPaging("paging", rptList, form, this);
    form.add(paging);

    lnkRtn = new FWLink("lnkRtn", this);
    form.add(lnkRtn);
  }
 /**
  * 检索条件DTO作成。
  *
  * @param 没有
  * @return 条件DTO
  */
 private UserRecoverDto createCondition() {
   UserRecoverDto dto = new UserRecoverDto();
   dto.setOidUserId(oidUserId);
   dto.setRecoverYear(ddlYear.getSelectedValue());
   dto.setRecoverMonth(ddlMonth.getSelectedValue());
   if (StringUtils.isEmpty(ddlYear.getSelectedValue())
       && !StringUtils.isEmpty(ddlMonth.getSelectedValue())) {
     dto.setRecoverYear(ConvUtils.convToString(DateUtils.getYear(DateUtils.getDate())));
   }
   // 每页起始位置
   dto.setPageIndex(ConvUtils.convToInt(rptList.getFirstItemOffset()));
   // 每页最大件数
   dto.setPageSize(ConvUtils.convToInt(rptList.getItemsPerPage()));
   // 条件BEAN返回
   return dto;
 }
  /** 审核未通过事件 */
  protected void reviewNoBtn_OnSubmit() {

    if (StringUtils.isEmpty(reviewDescription.getValue())) {
      alertError(MessageUtils.getMessage("ERR0013", "审核未通过时,请在备注中输入未通过的原因"));
      return;
    }

    PlatformProductsReviewDto reviewDto = new PlatformProductsReviewDto();
    reviewDto.setPlatformProductsId(
        ConvUtils.convToString(
            getPageParameters().get(PageParamConstant.OID_PLATFORM_PRODUCTS_ID)));
    reviewDto.setReviewType("02");
    reviewDto.setReviewFlg("2");
    reviewDto.setReviewDate(DateUtils.getDate());
    reviewDto.setReviewRemark(reviewDescription.getValue());
    reviewDto.setReviewUserId(getAdminUser().getOidAdminUserId());
    reviewDto.setUpdUserIid(getAdminUser().getOidAdminUserId());

    boolean flg = fundService.review(reviewDto);
    if (!flg) {
      alertError(MessageUtils.getMessage("ERR0013", "请重新审核或与系统管理员联系。"));
    } else {
      removeLockReview();
      alertSucc(3);
    }
  }
 private boolean checkInput() {
   if (StringUtils.isEmpty(advertizeShowPageChoice.getValue())) {
     alertError(MessageUtils.getMessage("ERR0001", "广告显示页面"));
     return false;
   } else if (StringUtils.isEmpty(showType.getValue())) {
     alertError(MessageUtils.getMessage("ERR0001", "广告类型"));
     return false;
   } else if (StringUtils.isEmpty(sort.getValue())) {
     alertError(MessageUtils.getMessage("ERR0001", "排序"));
     return false;
   } else if (StringUtils.isEmpty(validFlg.getValue())) {
     alertError(MessageUtils.getMessage("ERR0001", "有效"));
     return false;
   } else if (opType.equals("I") && upLinksIcon.getFileUploads().size() == 0) {
     alertError(MessageUtils.getMessage("ERR0017", "图片"));
     return false;
   } else if (opType.equals("I") && upLinksBakIcon.getFileUploads().size() == 0) {
     alertError(MessageUtils.getMessage("ERR0017", "背景图片"));
     return false;
   } else if (StringUtils.isEmpty(linkUrl.getValue())) {
     alertError(MessageUtils.getMessage("ERR0001", "公司网址"));
     return false;
   } else if (!StringUtils.isUrl(linkUrl.getValue())) {
     alertError(MessageUtils.getMessage("ERR0019", "公司网址"));
     return false;
   }
   clearAlert();
   return true;
 }
 private void initParams() {
   id = FWUrlUtil.decode(getParameter("ID"));
   if (!StringUtils.isEmpty(id)) {
     opType = "U";
   }
 }
  protected void form_OnSubmit() {
    if (!checkInput()) {
      return;
    }
    // 业务鉴证
    AdvertizeDto dto = new AdvertizeDto();
    dto.setId(id);
    Map<String, Object> advertizeMap = operationsManageService.getAdvertizeById(dto);
    if (opType.equals("U") && advertizeMap.isEmpty()) {
      alertError(MessageUtils.getMessage("ERR0013", "数据已被删除。"));
      submitBtn.setDisabled(true);
      return;
    }

    // 文件上传
    String linksImgPath = "";
    String linksBakImgPath = "";
    try {
      if (upLinksIcon.getFileUploads().size() > 0) {
        linksImgPath =
            imageDataStoreManager.put(upLinksIcon.getFileName(), upLinksIcon.getInputStream());
      }
      if (upLinksBakIcon.getFileUploads().size() > 0) {
        linksBakImgPath =
            imageDataStoreManager.put(
                upLinksBakIcon.getFileName(), upLinksBakIcon.getInputStream());
      }
    } catch (FWImageDataStoreException e) {
      if (e.getErrorCode().equals("FW004005E")) {
        alertError(e.getMessage());
      } else {
        logger.error("图片上传失败。", e);
        if ("U".equals(opType)) {
          saveOperatorLog(
              Constants.OPERATOR_LOG_U, Constants.OPERATOR_LOG_FAILURE, "广告【" + id + "】编辑失败。");
        } else {
          saveOperatorLog(Constants.OPERATOR_LOG_I, Constants.OPERATOR_LOG_FAILURE, "广告添加失败。");
        }
        alertError(MessageUtils.getMessage("ERR0013", "图片上传失败。"));
      }
      return;
    }
    // 数据登陆
    dto.setAdvertizeShowPageId(advertizeShowPageChoice.getValue());
    dto.setShowType(showType.getValue());
    dto.setSort(sort.getValue());
    dto.setValidFlg(validFlg.getValue());
    dto.setImgPath(linksImgPath);
    dto.setBackgroundImgPath(linksBakImgPath);
    if (linkUrl.getValue().startsWith("http://")) {
      dto.setLinkUrl(linkUrl.getValue());
    } else {
      dto.setLinkUrl("http://" + linkUrl.getValue());
    }
    dto.setUpdUserId(getAdminUser().getOidAdminUserId());
    if (opType.equals("U")) {
      dto.setId(id);
      boolean upd = operationsManageService.updAdvertize(dto);
      if (upd) {
        try {
          if (!StringUtils.isEmpty(linksImgPath)) {
            imageDataStoreManager.delete(ConvUtils.convToString(advertizeMap.get("IMG_PATH")));
            linksIcon.setSrc(imageDataStoreManager.getURL(linksImgPath).replace("\\", "/"));
          }
          if (!StringUtils.isEmpty(linksBakImgPath)) {
            imageDataStoreManager.delete(
                ConvUtils.convToString(advertizeMap.get("BACKGROUND_IMG_PATH")));
            linksBakIcon.setSrc(imageDataStoreManager.getURL(linksBakImgPath).replace("\\", "/"));
          }
        } catch (FWImageDataStoreException e) {
          logger.error("图片删除失败。", e);
        }
        saveOperatorLog(
            Constants.OPERATOR_LOG_U,
            Constants.OPERATOR_LOG_SUCCESS,
            "广告【" + dto.getId() + "】更新成功。");

        submitBtn.setDisabled(true);
        alertSucc(2);
      } else {
        saveOperatorLog(
            Constants.OPERATOR_LOG_U,
            Constants.OPERATOR_LOG_FAILURE,
            "广告【" + dto.getId() + "】更新失败。");
        alertError(MessageUtils.getMessage("ERR0013", "数据可能已被删除。"));
      }
    } else {
      boolean add = operationsManageService.insAdvertize(dto);
      if (add) {
        saveOperatorLog(
            Constants.OPERATOR_LOG_I,
            Constants.OPERATOR_LOG_SUCCESS,
            "广告【"
                + advertizeShowPageChoice.getValue()
                + ','
                + showType.getValue()
                + ','
                + sort.getValue()
                + "】添加成功。");
        linksIcon.setVisible(true);
        linksIcon.setSrc(imageDataStoreManager.getURL(linksImgPath).replace("\\", "/"));
        linksBakIcon.setVisible(true);
        linksBakIcon.setSrc(imageDataStoreManager.getURL(linksBakImgPath).replace("\\", "/"));
        submitBtn.setDisabled(true);
        alertSucc(2);
      } else {
        saveOperatorLog(
            Constants.OPERATOR_LOG_I,
            Constants.OPERATOR_LOG_FAILURE,
            "广告【"
                + advertizeShowPageChoice.getValue()
                + ','
                + showType.getValue()
                + ','
                + sort.getValue()
                + "】添加失败。");
        alertError(MessageUtils.getMessage("ERR0012"));
      }
    }
  }
  @Override
  public void initPage() {
    advertizeShowPageChoice.setChoiceList(operationsManageService.getAdvertizeShowPageChoices());
    if ("U".equals(opType)) {
      txtLinksIcon.setVisible(false);
      txtLinksBakIcon.setVisible(false);
      // 检索数据
      AdvertizeDto dto = new AdvertizeDto();
      dto.setId(id);
      Map<String, Object> resultMap = operationsManageService.getAdvertizeById(dto);
      if (resultMap.isEmpty()) {
        alertError(MessageUtils.getMessage("ERR0013", "数据已被删除。"));
        submitBtn.setDisabled(true);
        return;
      }
      // 广告显示页面
      advertizeShowPageChoice.setSelectedValue(
          ConvUtils.convToString(resultMap.get("ADVERTIZE_SHOW_PAGE_ID")));
      // 广告类型
      showType.setSelectedValue(ConvUtils.convToString(resultMap.get("SHOW_TYPE")));
      // 排序
      sort.setValue(ConvUtils.convToString(resultMap.get("SORT")));
      if ("1".equals(showType.getValue())) {
        sort.setDisabled(false);
      } else {
        sort.setDisabled(true);
      }
      // 有效Flag
      validFlg.setSelectedValue(ConvUtils.convToString(resultMap.get("VALID_FLG")));
      // 图片
      linksIcon.setSrc(
          imageDataStoreManager
              .getURL(ConvUtils.convToString(resultMap.get("IMG_PATH")))
              .replace("\\", "/"));
      if (StringUtils.isEmpty(ConvUtils.convToString(resultMap.get("IMG_PATH")))) {
        linksIcon.setVisible(false);
      } else {
        linksIcon.setVisible(true);
      }
      // 背景图片
      linksBakIcon.setSrc(
          imageDataStoreManager
              .getURL(ConvUtils.convToString(resultMap.get("BACKGROUND_IMG_PATH")))
              .replace("\\", "/"));
      if (StringUtils.isEmpty(ConvUtils.convToString(resultMap.get("BACKGROUND_IMG_PATH")))) {
        linksBakIcon.setVisible(false);
      } else {
        linksBakIcon.setVisible(true);
      }
      // 链接地址
      linkUrl.setValue(ConvUtils.convToString(resultMap.get("LINK_URL")));

    } else {
      txtLinksIcon.setVisible(true);
      txtLinksBakIcon.setVisible(true);
      advertizeShowPageChoice.setSelectedIndex(0);
      showType.setSelectedValue("1");
      validFlg.setSelectedValue("1");
      linksIcon.setVisible(false);
      linksBakIcon.setVisible(false);
      linkUrl.setValue("http://");
    }
  }