Showing
5 changed files
with
68 additions
and
4 deletions
@@ -3,6 +3,7 @@ package com.yohoufo.product.controller; | @@ -3,6 +3,7 @@ package com.yohoufo.product.controller; | ||
3 | import com.yoho.tools.docs.ApiOperation; | 3 | 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.SortTemplateResp; | ||
6 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
7 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
8 | import org.springframework.web.bind.annotation.RequestMapping; | 9 | import org.springframework.web.bind.annotation.RequestMapping; |
@@ -14,6 +15,7 @@ import com.yohoufo.common.annotation.IgnoreSignature; | @@ -14,6 +15,7 @@ import com.yohoufo.common.annotation.IgnoreSignature; | ||
14 | import com.yohoufo.common.cache.Cachable; | 15 | import com.yohoufo.common.cache.Cachable; |
15 | import org.springframework.web.bind.annotation.RestController; | 16 | import org.springframework.web.bind.annotation.RestController; |
16 | 17 | ||
18 | + | ||
17 | @RestController | 19 | @RestController |
18 | public class ProductController { | 20 | public class ProductController { |
19 | 21 | ||
@@ -41,4 +43,24 @@ public class ProductController { | @@ -41,4 +43,24 @@ public class ProductController { | ||
41 | return resp; | 43 | return resp; |
42 | } | 44 | } |
43 | 45 | ||
46 | + @ApiOperation(name = "ufo.product.sort.template", desc="商品列表") | ||
47 | + @IgnoreSignature | ||
48 | + @IgnoreSession | ||
49 | + @RequestMapping(params = "method=ufo.product.sort.template") | ||
50 | + //@Cachable(expire=600) | ||
51 | + public ApiResponse querySortTemplateData( | ||
52 | + @RequestParam(value = "skns", required = false) String skns) { | ||
53 | + | ||
54 | + if (null == skns) { | ||
55 | + return new ApiResponse(500, "skns Is Null", null); | ||
56 | + } | ||
57 | + return new ApiResponse.ApiResponseBuilder().data(querySortTemplateData()).code(200).message("product data").build(); | ||
58 | + } | ||
59 | + | ||
60 | + private SortTemplateResp querySortTemplateData(){ | ||
61 | + String mockJson = "{\"list\":[{\"src\":\"http://img13.static.yhbimg.com/goodsimg/2012/11/07/15/02c24ff8521007bad91dfa5d55e667d8f7.jpg?imageMogr2/thumbnail/{width}x{height}/background/d2hpdGU=/position/center/quality/80\",\"title\":\"鞋子\"},{\"src\":\"http://img13.static.yhbimg.com/goodsimg/2012/11/07/15/02c24ff8521007bad91dfa5d55e667d8f7.jpg?imageMogr2/thumbnail/{width}x{height}/background/d2hpdGU=/position/center/quality/80\",\"title\":\"袜子\"}]}"; | ||
62 | + SortTemplateResp resp = UfoJsonUtil.safelyParseObject(mockJson, SortTemplateResp.class); | ||
63 | + return resp; | ||
64 | + } | ||
65 | + | ||
44 | } | 66 | } |
@@ -20,7 +20,7 @@ public class ProductSearchController { | @@ -20,7 +20,7 @@ public class ProductSearchController { | ||
20 | 20 | ||
21 | private final Logger LOG = LoggerFactory.getLogger(ProductSearchController.class); | 21 | private final Logger LOG = LoggerFactory.getLogger(ProductSearchController.class); |
22 | 22 | ||
23 | - @ApiOperation(name = "ufo.product.list", desc="首页商品推荐") | 23 | + @ApiOperation(name = "ufo.product.search.list", desc="首页商品推荐") |
24 | @RequestMapping(params = "method=ufo.product.list") | 24 | @RequestMapping(params = "method=ufo.product.list") |
25 | @IgnoreSession | 25 | @IgnoreSession |
26 | @Cachable | 26 | @Cachable |
@@ -51,7 +51,7 @@ public class ProductSearchController { | @@ -51,7 +51,7 @@ public class ProductSearchController { | ||
51 | } | 51 | } |
52 | 52 | ||
53 | 53 | ||
54 | - @ApiOperation(name = "ufo.product.data.recommend", desc="商品详情页的相似商品推荐") | 54 | + @ApiOperation(name = "ufo.product.data.search.recommend", desc="商品详情页的相似商品推荐") |
55 | @RequestMapping(params = "method=ufo.product.data.recommend") | 55 | @RequestMapping(params = "method=ufo.product.data.recommend") |
56 | @IgnoreSession | 56 | @IgnoreSession |
57 | @Cachable | 57 | @Cachable |
1 | +package com.yohoufo.product.model; | ||
2 | + | ||
3 | + | ||
4 | +public class ImageTitleTemplate { | ||
5 | + | ||
6 | + private String src; | ||
7 | + private String title; | ||
8 | + | ||
9 | + public String getSrc() { | ||
10 | + return src; | ||
11 | + } | ||
12 | + | ||
13 | + public void setSrc(String src) { | ||
14 | + this.src = src; | ||
15 | + } | ||
16 | + | ||
17 | + public String getTitle() { | ||
18 | + return title; | ||
19 | + } | ||
20 | + | ||
21 | + public void setTitle(String title) { | ||
22 | + this.title = title; | ||
23 | + } | ||
24 | +} |
@@ -24,12 +24,12 @@ public class ProductSearchReq { | @@ -24,12 +24,12 @@ public class ProductSearchReq { | ||
24 | 24 | ||
25 | 25 | ||
26 | public ProductSearchReq setProductId(Integer productId) { | 26 | public ProductSearchReq setProductId(Integer productId) { |
27 | - this.limit = limit; | 27 | + this.productId = productId; |
28 | return this; | 28 | return this; |
29 | } | 29 | } |
30 | 30 | ||
31 | public ProductSearchReq setType(Integer type) { | 31 | public ProductSearchReq setType(Integer type) { |
32 | - this.productId = productId; | 32 | + this.type = type; |
33 | return this; | 33 | return this; |
34 | } | 34 | } |
35 | 35 |
1 | +package com.yohoufo.product.response; | ||
2 | + | ||
3 | +import com.yohoufo.product.model.ImageTitleTemplate; | ||
4 | + | ||
5 | +import java.util.List; | ||
6 | + | ||
7 | +public class SortTemplateResp { | ||
8 | + | ||
9 | + private List<ImageTitleTemplate> list; | ||
10 | + | ||
11 | + public List<ImageTitleTemplate> getList() { | ||
12 | + return list; | ||
13 | + } | ||
14 | + | ||
15 | + public void setList(List<ImageTitleTemplate> list) { | ||
16 | + this.list = list; | ||
17 | + } | ||
18 | +} |
-
Please register or login to post a comment