@ResponseBody
 @RequestMapping(value = "/delete", method = RequestMethod.POST)
 public ImmutableMap<String, String> linkDelete(Long[] linkIds, HttpSession session) {
   try {
     if (linkIds == null || linkIds.length == 0) {
       LOGGER.warn("要删除链接的ID为空!");
       return ImmutableMap.of("status", "0", "message", getMessage("link.deletefailed.message"));
     }
     List<Link> links = linkService.findAll(linkIds);
     String realPath = session.getServletContext().getRealPath("");
     List<File> deleteFiles = Lists.newArrayList();
     File deleteFile;
     for (Link link : links) {
       if (link.getLinkPic() == null || "".equals(link.getLinkPic())) continue;
       deleteFile = new File(realPath + link.getLinkPic());
       deleteFiles.add(deleteFile);
     }
     linkService.deleteInBatch(links);
     deleteLinkRes(deleteFiles);
   } catch (Exception e) {
     LOGGER.error("链接信息删除失败,失败原因:{}", e.getMessage());
     return ImmutableMap.of("status", "0", "message", getMessage("link.deletefailed.message"));
   }
   LOGGER.info("链接信息删除成功,ID为{}", StringUtils.join(linkIds, ","));
   return ImmutableMap.of("status", "1", "message", getMessage("link.deletesuccess.message"));
 }
  @ResponseBody
  @RequestMapping(value = "/edit", method = RequestMethod.POST)
  public ImmutableMap<String, Object> linkEdit(@Valid Link link, BindingResult bindingResult) {
    if (bindingResult.hasErrors()) {
      Map<String, Object> errorMessage = Maps.newHashMap();
      errorMessage.put("status", 0);
      List<FieldError> fes = bindingResult.getFieldErrors();
      for (FieldError fe : fes) {
        errorMessage.put(fe.getField(), fe.getDefaultMessage());
      }
      return ImmutableMap.<String, Object>builder().putAll(errorMessage).build();
    }

    if (link.getLinkId() == null || link.getLinkId() == 0) {
      Link result = linkService.save(link);
      if (result == null || result.getLinkId() == null || result.getLinkId() == 0) {
        LOGGER.warn("内容链接失败,链接{}", result);
        return ImmutableMap.<String, Object>of(
            "status", "0", "message", getMessage("link.addfailed.message"));
      }
      LOGGER.info("内容添加成功,链接ID{}", result.getLinkId());
      return ImmutableMap.<String, Object>of(
          "status", "1", "message", getMessage("link.addsuccess.message"));
    }
    try {
      linkService.save(link);
    } catch (Exception e) {
      LOGGER.error("链接修改失败,{}", e);
      return ImmutableMap.<String, Object>of(
          "status", "0", "message", getMessage("link.updatefailed.message"));
    }
    LOGGER.info("链接添加成功,{}", link);
    return ImmutableMap.<String, Object>of(
        "status", "1", "message", getMessage("link.updatesuccess.message"));
  }
  @RequestMapping(
      value = "/list/{p}",
      method = {RequestMethod.GET, RequestMethod.POST})
  public String linkList(
      Link link, @PathVariable Integer p, HttpServletRequest request, ModelMap modelMap) {
    Session session = SystemUtils.getShiroSession();
    if (StringUtils.isNotBlank(link.getLinkName())) {
      session.setAttribute("linkSearch", link);
      modelMap.addAttribute("searchLink", link);
    } else {
      session.setAttribute("linkSearch", null);
    }
    Object searchObj = session.getAttribute("linkSearch");

    Page<Link> result =
        linkService.findLinkPageable((searchObj == null ? (new Link()) : ((Link) searchObj)), p);

    modelMap.addAttribute("links", result.getContent());
    modelMap.addAttribute(
        "pagination",
        SystemUtils.pagination(result, HttpUtils.getContextPath(request) + "/manager/link/list"));
    return "link/link_list";
  }