Ejemplo n.º 1
0
  @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, "编辑供应商失败");
    }
  }
Ejemplo n.º 2
0
  @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, "添加供应商失败");
    }
  }
Ejemplo n.º 3
0
  @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, "编辑供应商失败");
    }
  }