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://");
    }
  }