示例#1
0
  public String addJson() {
    try {
      ActionContext ctx = ActionContext.getContext();
      HttpServletRequest request = (HttpServletRequest) ctx.get(ServletActionContext.HTTP_REQUEST);
      BufferedInputStream inputStream = new BufferedInputStream(request.getInputStream());

      FpageEvent fpageEvent = new FpageEvent();
      fpageEvent.setIssueId(issueId);
      // fpageEvent.setPublicationId(issueService.queryById(issueId).getPublicationId());
      fpageEvent.setPageNo(start);
      fpageEvent.setEndPageNo(end);
      fpageEvent.setDescription(description);
      fpageEvent.setTitle(title);
      if (description != null) {
        fpageEvent.setDescription(java.net.URLDecoder.decode(description));
      }
      if (title != null) {
        fpageEvent.setTitle(java.net.URLDecoder.decode(title));
      }
      fpageEvent.setWidth(width);
      fpageEvent.setHeight(height);
      fpageEvent.setAdId(adId);
      System.out.println("--->:" + tagStr);
      String[] arr = null;
      if (StringUtil.isNotBlank(tagStr)) { // 添加标签(事件)
        tagStr = java.net.URLDecoder.decode(tagStr);
        arr = tagStr.split(";");
      }

      this.jsonResult =
          fpageEventService.addJson(
              fpageEvent,
              inputStream,
              (Admin) ctx.getSession().get(WebConstant.SESSION.ADMIN),
              arr);

    } catch (Exception e) {
      e.printStackTrace();
      this.generateJsonResult(JsonResult.CODE.EXCEPTION, "服务器内部错误");
    }
    return JSON;
  }
 /**
  * 检测英文名称是否存在
  *
  * @return
  */
 public String checkEnglishName() {
   String tempEnglishName = publication.getEnglishname();
   this.jsonResult = new JsonResult();
   this.jsonResult.setCode(JsonResult.CODE.FAILURE);
   this.jsonResult.setMessage(JsonResult.MESSAGE.FAILURE);
   if (StringUtil.isNotBlank(tempEnglishName)) {
     long countNum = publicationService.queryByEnglishName(tempEnglishName);
     if (countNum == 0) {
       // 可以使用
       this.jsonResult.put("checkStatus", "1");
       this.jsonResult.setCode(JsonResult.CODE.SUCCESS);
       this.jsonResult.setMessage(JsonResult.MESSAGE.SUCCESS);
     } else {
       // 已经有重复名称
       this.jsonResult.put("checkStatus", "2");
     }
   } else {
     this.jsonResult.put("checkStatus", "3"); // 名称不能为空
   }
   return JSON;
 }