Authored by zhaojun2

add stroage 相关接口

... ... @@ -22,5 +22,9 @@
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>com.yohoufo.fore</groupId>
<artifactId>yohoufo-fore-dal</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
... ...
... ... @@ -4,6 +4,8 @@ import com.yoho.tools.docs.ApiOperation;
import com.yohoufo.common.utils.UfoJsonUtil;
import com.yohoufo.product.response.ProductDetailResp;
import com.yohoufo.product.response.ProductSeriesTemplateResp;
import com.yohoufo.product.response.StorageDataResp;
import com.yohoufo.product.response.StorageLeastPriceResp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
... ... @@ -62,4 +64,42 @@ public class ProductController {
return resp;
}
@ApiOperation(name = "ufo.product.storage.leastprice", desc="sku的最低价")
@IgnoreSignature
@IgnoreSession
@RequestMapping(params = "method=ufo.product.storage.leastprice")
//@Cachable(expire=600)
public ApiResponse queryStorageLeastprice(
@RequestParam(value = "storage_id", required = false) String storageId) {
return new ApiResponse.ApiResponseBuilder().data(queryStorageLeastprice()).code(200).message("storage data").build();
}
private StorageLeastPriceResp queryStorageLeastprice(){
String mockJson = "{\"storage_least_price\":{\"storage_id\":2,\"least_price\":124.3}}";
StorageLeastPriceResp resp = UfoJsonUtil.safelyParseObject(mockJson, StorageLeastPriceResp.class);
return resp;
}
@ApiOperation(name = "ufo.product.storage.data", desc="sku信息")
@IgnoreSignature
@IgnoreSession
@RequestMapping(params = "method=ufo.product.storage.data")
//@Cachable(expire=600)
public ApiResponse queryStorageInfo(
@RequestParam(value = "storage_id", required = false) String storageId) {
return new ApiResponse.ApiResponseBuilder().data(queryStorageData()).code(200).message("product data").build();
}
private StorageDataResp queryStorageData(){
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\"}]}}";
StorageDataResp resp = UfoJsonUtil.safelyParseObject(mockJson, StorageDataResp.class);
return resp;
}
}
\ No newline at end of file
... ...
package com.yohoufo.product.response;
import com.alibaba.fastjson.annotation.JSONField;
import com.yohoufo.product.model.GoodsSize;
import java.util.List;
public class StorageDataResp {
private StorageData product_info;
public StorageData getProduct_info() {
return product_info;
}
public void setProduct_info(StorageData product_info) {
this.product_info = product_info;
}
public static class StorageData{
@JSONField(name = "product_id")
private Integer productId;
@JSONField(name = "product_name")
private String productName;
@JSONField(name = "color_id")
private String colorId;
@JSONField(name = "color_name")
private String colorName;
@JSONField(name = "image_url")
private String imageUrl;
@JSONField(name = "size_list")
List<GoodsSize> sizeList;
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getColorId() {
return colorId;
}
public void setColorId(String colorId) {
this.colorId = colorId;
}
public String getColorName() {
return colorName;
}
public void setColorName(String colorName) {
this.colorName = colorName;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public List<GoodsSize> getSizeList() {
return sizeList;
}
public void setSizeList(List<GoodsSize> sizeList) {
this.sizeList = sizeList;
}
}
}
... ...
package com.yohoufo.product.response;
import com.alibaba.fastjson.annotation.JSONField;
import java.math.BigDecimal;
public class StorageLeastPriceResp {
@JSONField(name = "storage_least_price")
private StorageLeastPrice storageLeastPrice;
public static class StorageLeastPrice{
@JSONField(name = "storage_id")
private Integer storageId;
@JSONField(name = "least_price")
private BigDecimal leastPrice;
public Integer getStorageId() {
return storageId;
}
public void setStorageId(Integer storageId) {
this.storageId = storageId;
}
public BigDecimal getLeastPrice() {
return leastPrice;
}
public void setLeastPrice(BigDecimal leastPrice) {
this.leastPrice = leastPrice;
}
}
}
... ...
package com.yohoufo.product.service;
import com.yohoufo.product.response.ProductDetailResp;
public interface ProductService {
ProductDetailResp queryProductDetailById(Integer productId);
}
... ...
package com.yohoufo.product.service.impl;
import com.yohoufo.dal.product.ProductMapper;
import com.yohoufo.product.response.ProductDetailResp;
import com.yohoufo.product.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class ProductServiceImpl implements ProductService{
@Autowired
private ProductMapper productMapper;
@Override
public ProductDetailResp queryProductDetailById(Integer productId) {
return null;
}
}
... ...