@RequestMapping("editSeller")
  @ResponseBody
  public Object editSeller(
      HttpServletRequest request,
      HttpServletResponse response,
      @RequestParam long sellerId,
      @RequestParam String sellerName)
      throws SQLException, IOException {

    if (sellerId == 0) {
      return buildJson(1, "卖家名称不能为空");
    }

    if (sellerName == null) {
      return buildJson(1, "卖家名称不能为空");
    }

    Seller seller = new Seller();
    seller.sellerId = sellerId;
    seller.sellerName = sellerName.trim();
    try {
      sellerService.updateSeller(seller);
      sellerConstant.refresh();
      return buildJson(0, "编辑商家成功");
    } catch (Exception e) {
      LogConstant.mallLog.error(
          "code:{},msg:{},params:{}",
          1,
          "编辑供应商失败",
          "sellerId:" + sellerId + "&sellerName:" + sellerName);
      return buildJson(1, "编辑供应商失败");
    }
  }
 @RequestMapping("querySeller")
 @ResponseBody
 public Object querySeller(
     HttpServletRequest request,
     HttpServletResponse response,
     @RequestParam int draw,
     @RequestParam(value = "start", required = false) Integer start,
     @RequestParam(value = "length", required = false) Integer numPerPage,
     @RequestParam(value = "searchStr", required = false) String searchStr)
     throws SQLException, IOException {
   PaginationInfo paginationInfo = new PaginationInfo();
   paginationInfo.setRecordPerPage(numPerPage);
   paginationInfo.setCurrentPageByStartNum(start, numPerPage);
   List<Seller> sellerList;
   Map param = new HashMap();
   param.put("seller_id_like", searchStr);
   param.put("seller_name_like", searchStr);
   try {
     Pair<Long, PaginationList<Seller>> p = sellerService.getPageSeller(paginationInfo, param);
     sellerList = p.getRight();
     long filteredTotal = p.getLeft();
     long total = 0;
     return gson.toJson(buildDataTableResult(draw, total, filteredTotal, sellerList));
   } catch (Exception e) {
     LogConstant.mallLog.error("code:{},msg:{},params:{}", 1, "添加供应商失败", "searchStr" + searchStr);
     return buildJson(1, "获取供应商失败");
   }
 }
  @RequestMapping("deleteseller")
  @ResponseBody
  public Object deleteseller(
      HttpServletRequest request, HttpServletResponse response, @RequestParam Long sellerId)
      throws SQLException, IOException {

    if (sellerId == null) {
      return buildJson(1, "供应商编码不能为空");
    }
    try {
      sellerService.deleteSeller(sellerId);
      sellerConstant.refresh();
      return buildJson(0, "删除供应商成功");
    } catch (Exception e) {
      LogConstant.mallLog.error("code:{},msg:{},params:{}", 1, "编辑供应商失败", "sellerId:" + sellerId);
      return buildJson(1, "编辑供应商失败");
    }
  }
  @RequestMapping("addSeller")
  @ResponseBody
  public Object addSeller(
      HttpServletRequest request, HttpServletResponse response, @RequestParam String sellerName)
      throws SQLException, IOException {

    Seller seller = new Seller();
    seller.sellerName = sellerName.trim();
    Map<String, Seller> sellerNameMap = sellerConstant.getSellerNameMap();
    if (sellerNameMap.get(sellerName.trim()) != null) {
      return buildJson(1, "供应商名字重复");
    }

    try {
      sellerService.addSeller(seller);
      sellerConstant.refresh();
      return buildJson(0, "添加商家成功");
    } catch (Exception e) {
      e.printStackTrace();
      LogConstant.mallLog.error(
          "code:{},msg:{},params:{}", 1, "添加供应商失败", "&sellerName:" + sellerName);
      return buildJson(1, "添加供应商失败");
    }
  }