Authored by zhaojun2

add stroage 相关接口

@@ -22,5 +22,9 @@ @@ -22,5 +22,9 @@
22 <groupId>javax.servlet</groupId> 22 <groupId>javax.servlet</groupId>
23 <artifactId>javax.servlet-api</artifactId> 23 <artifactId>javax.servlet-api</artifactId>
24 </dependency> 24 </dependency>
  25 + <dependency>
  26 + <groupId>com.yohoufo.fore</groupId>
  27 + <artifactId>yohoufo-fore-dal</artifactId>
  28 + </dependency>
25 </dependencies> 29 </dependencies>
26 </project> 30 </project>
@@ -4,6 +4,8 @@ import com.yoho.tools.docs.ApiOperation; @@ -4,6 +4,8 @@ import com.yoho.tools.docs.ApiOperation;
4 import com.yohoufo.common.utils.UfoJsonUtil; 4 import com.yohoufo.common.utils.UfoJsonUtil;
5 import com.yohoufo.product.response.ProductDetailResp; 5 import com.yohoufo.product.response.ProductDetailResp;
6 import com.yohoufo.product.response.ProductSeriesTemplateResp; 6 import com.yohoufo.product.response.ProductSeriesTemplateResp;
  7 +import com.yohoufo.product.response.StorageDataResp;
  8 +import com.yohoufo.product.response.StorageLeastPriceResp;
7 import org.slf4j.Logger; 9 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory; 10 import org.slf4j.LoggerFactory;
9 import org.springframework.web.bind.annotation.RequestMapping; 11 import org.springframework.web.bind.annotation.RequestMapping;
@@ -62,4 +64,42 @@ public class ProductController { @@ -62,4 +64,42 @@ public class ProductController {
62 return resp; 64 return resp;
63 } 65 }
64 66
  67 +
  68 + @ApiOperation(name = "ufo.product.storage.leastprice", desc="sku的最低价")
  69 + @IgnoreSignature
  70 + @IgnoreSession
  71 + @RequestMapping(params = "method=ufo.product.storage.leastprice")
  72 + //@Cachable(expire=600)
  73 + public ApiResponse queryStorageLeastprice(
  74 + @RequestParam(value = "storage_id", required = false) String storageId) {
  75 +
  76 + return new ApiResponse.ApiResponseBuilder().data(queryStorageLeastprice()).code(200).message("storage data").build();
  77 + }
  78 +
  79 +
  80 + private StorageLeastPriceResp queryStorageLeastprice(){
  81 + String mockJson = "{\"storage_least_price\":{\"storage_id\":2,\"least_price\":124.3}}";
  82 + StorageLeastPriceResp resp = UfoJsonUtil.safelyParseObject(mockJson, StorageLeastPriceResp.class);
  83 + return resp;
  84 + }
  85 +
  86 + @ApiOperation(name = "ufo.product.storage.data", desc="sku信息")
  87 + @IgnoreSignature
  88 + @IgnoreSession
  89 + @RequestMapping(params = "method=ufo.product.storage.data")
  90 + //@Cachable(expire=600)
  91 + public ApiResponse queryStorageInfo(
  92 + @RequestParam(value = "storage_id", required = false) String storageId) {
  93 +
  94 + return new ApiResponse.ApiResponseBuilder().data(queryStorageData()).code(200).message("product data").build();
  95 + }
  96 +
  97 +
  98 + private StorageDataResp queryStorageData(){
  99 + String mockJson = "{\"product_info\":{\"product_id\":50031387,\"product_name\":\"Carrots by Anwar X AKOP. X Champion  LOGO鞋\",\"color_id\":2,\"color_name\":\"黄\",\"image_url\":\"http://img13.static.yhbimg.com/goodsimg/2012/11/07/15/02c24ff8521007bad91dfa5d55e667d8f7.jpg?imageMogr2/thumbnail/{width}x{height}/background/d2hpdGU=/position/center/quality/80\",\"size_list\":[{\"size_id\":2,\"size_name\":\"S\"}]}}";
  100 + StorageDataResp resp = UfoJsonUtil.safelyParseObject(mockJson, StorageDataResp.class);
  101 + return resp;
  102 + }
  103 +
  104 +
65 } 105 }
  1 +package com.yohoufo.product.response;
  2 +
  3 +import com.alibaba.fastjson.annotation.JSONField;
  4 +import com.yohoufo.product.model.GoodsSize;
  5 +
  6 +import java.util.List;
  7 +
  8 +public class StorageDataResp {
  9 +
  10 + private StorageData product_info;
  11 +
  12 + public StorageData getProduct_info() {
  13 + return product_info;
  14 + }
  15 +
  16 + public void setProduct_info(StorageData product_info) {
  17 + this.product_info = product_info;
  18 + }
  19 +
  20 + public static class StorageData{
  21 +
  22 +
  23 + @JSONField(name = "product_id")
  24 + private Integer productId;
  25 +
  26 + @JSONField(name = "product_name")
  27 + private String productName;
  28 +
  29 + @JSONField(name = "color_id")
  30 + private String colorId;
  31 +
  32 + @JSONField(name = "color_name")
  33 + private String colorName;
  34 +
  35 + @JSONField(name = "image_url")
  36 + private String imageUrl;
  37 +
  38 + @JSONField(name = "size_list")
  39 + List<GoodsSize> sizeList;
  40 +
  41 +
  42 + public Integer getProductId() {
  43 + return productId;
  44 + }
  45 +
  46 + public void setProductId(Integer productId) {
  47 + this.productId = productId;
  48 + }
  49 +
  50 + public String getProductName() {
  51 + return productName;
  52 + }
  53 +
  54 + public void setProductName(String productName) {
  55 + this.productName = productName;
  56 + }
  57 +
  58 + public String getColorId() {
  59 + return colorId;
  60 + }
  61 +
  62 + public void setColorId(String colorId) {
  63 + this.colorId = colorId;
  64 + }
  65 +
  66 + public String getColorName() {
  67 + return colorName;
  68 + }
  69 +
  70 + public void setColorName(String colorName) {
  71 + this.colorName = colorName;
  72 + }
  73 +
  74 + public String getImageUrl() {
  75 + return imageUrl;
  76 + }
  77 +
  78 + public void setImageUrl(String imageUrl) {
  79 + this.imageUrl = imageUrl;
  80 + }
  81 +
  82 + public List<GoodsSize> getSizeList() {
  83 + return sizeList;
  84 + }
  85 +
  86 + public void setSizeList(List<GoodsSize> sizeList) {
  87 + this.sizeList = sizeList;
  88 + }
  89 + }
  90 +}
  1 +package com.yohoufo.product.response;
  2 +
  3 +import com.alibaba.fastjson.annotation.JSONField;
  4 +
  5 +import java.math.BigDecimal;
  6 +
  7 +public class StorageLeastPriceResp {
  8 +
  9 + @JSONField(name = "storage_least_price")
  10 + private StorageLeastPrice storageLeastPrice;
  11 +
  12 +
  13 + public static class StorageLeastPrice{
  14 + @JSONField(name = "storage_id")
  15 + private Integer storageId;
  16 +
  17 + @JSONField(name = "least_price")
  18 + private BigDecimal leastPrice;
  19 +
  20 +
  21 + public Integer getStorageId() {
  22 + return storageId;
  23 + }
  24 +
  25 + public void setStorageId(Integer storageId) {
  26 + this.storageId = storageId;
  27 + }
  28 +
  29 + public BigDecimal getLeastPrice() {
  30 + return leastPrice;
  31 + }
  32 +
  33 + public void setLeastPrice(BigDecimal leastPrice) {
  34 + this.leastPrice = leastPrice;
  35 + }
  36 + }
  37 +}
  1 +package com.yohoufo.product.service;
  2 +
  3 +import com.yohoufo.product.response.ProductDetailResp;
  4 +
  5 +public interface ProductService {
  6 +
  7 +
  8 +
  9 + ProductDetailResp queryProductDetailById(Integer productId);
  10 +
  11 +
  12 +}
  1 +package com.yohoufo.product.service.impl;
  2 +
  3 +import com.yohoufo.dal.product.ProductMapper;
  4 +import com.yohoufo.product.response.ProductDetailResp;
  5 +import com.yohoufo.product.service.ProductService;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Service;
  8 +
  9 +
  10 +
  11 +@Service
  12 +public class ProductServiceImpl implements ProductService{
  13 +
  14 +
  15 + @Autowired
  16 + private ProductMapper productMapper;
  17 +
  18 + @Override
  19 + public ProductDetailResp queryProductDetailById(Integer productId) {
  20 + return null;
  21 + }
  22 +}