@RequestMapping(value = "/product/title/update", method = RequestMethod.POST) public void updateTitle( @RequestParam("productId") Integer productId, @RequestParam("productCode") String productCode, @RequestParam("name") String name, @RequestParam("description") String description, @RequestParam("tagType") String tagType, HttpServletResponse response) throws IOException { try { Product product = productService.getProductById(productId); product.setName(name); product.setDescription(description); product.setProductCode(productCode); product.setTagType(getTagType(tagType)); productService.updateProduct(product); productService.notifyProductUpdate(productId); } catch (Exception e) { logger.error("商品管理的更新商品信息异常:" + e); new JsonResult(false, "更新商品信息出错").toJson(response); return; } new JsonResult(true).toJson(response); }
/** * 根据订单Id查询Sku列表 * * @param orderId * @return */ @RequestMapping(value = "/order/sku/{orderId}") public void skuGrid(@PathVariable("orderId") int orderId, HttpServletResponse response) throws IOException { List<OrderItem> orderItems = tradeCenterBossClient.queryOrderItemWithoutBackingNumberByOrderId(orderId); List<ProductSku> list = new ArrayList<ProductSku>(); for (OrderItem orderItem : orderItems) { ProductSku sku = new ProductSku(); sku.setNumber(orderItem.getNumber()); sku.setSkuId(orderItem.getSkuId()); sku.setProductId(orderItem.getProductId()); sku.setSkuState(orderItem.getOrderState().serviceDesc()); sku.setShipmentNum(orderItem.getShipmentNum()); sku.setBackNumber(orderItem.getBackNum()); sku.setBarCode(orderItem.getBarCode()); StockKeepingUnit stockKeepingUnit = skuService.getStockKeepingUnit(orderItem.getSkuId()); if (stockKeepingUnit != null) { Product product = productService.getProductById(stockKeepingUnit.getProductId()); Money money = new Money(); money.setCent(stockKeepingUnit.getPrice()); sku.setSkuPrice(money.toString()); sku.setProductName(product.getName()); sku.setAttribute(skuService.getSkuPropertyToString(stockKeepingUnit)); sku.setProductCode(stockKeepingUnit.getSkuCode()); // product.getProductCode()); } else { sku.setProductName("没有此 SKU! 被删除或重新生成过."); } list.add(sku); } new JsonResult(true) .addData("totalCount", list.size()) .addData("result", list) .toJson(response); }
private List<ProductModel> createProductGrid(List<Product> productList) { List<ProductModel> productModelList = new ArrayList<ProductModel>(); for (Product product : productList) { ProductModel productModel = new ProductModel(); productModel.setId(product.getId()); productModel.setCategoryId(product.getCategoryId()); productModel.setDescription(product.getDescription()); productModel.setProductCode(product.getProductCode()); productModel.setName(product.getName()); productModel.setCategoryName( productCategoryService.getProductCategoryById(product.getCategoryId()).getName()); productModel.setBrandId(product.getBrandId()); productModel.setBrandName(supplierService.queryBrandById(product.getBrandId()).getName()); productModel.setCustomerId(product.getCustomerId()); productModel.setOnline(product.isOnline()); productModel.setTagType(product.getTagType() == null ? "" : product.getTagType().name()); productModelList.add(productModel); } return productModelList; }