Authored by caoyan

尺码集合

1 package com.yohoufo.product.controller; 1 package com.yohoufo.product.controller;
2 2
  3 +import java.lang.reflect.Method;
  4 +import java.math.BigDecimal;
  5 +import java.util.ArrayList;
  6 +import java.util.Collection;
  7 +import java.util.HashMap;
  8 +import java.util.List;
  9 +import java.util.Map;
  10 +import java.util.stream.Collectors;
  11 +
  12 +import org.apache.commons.collections.CollectionUtils;
  13 +import org.apache.commons.lang3.StringUtils;
  14 +import org.slf4j.Logger;
  15 +import org.slf4j.LoggerFactory;
  16 +import org.springframework.beans.factory.annotation.Autowired;
  17 +import org.springframework.web.bind.annotation.RequestBody;
  18 +import org.springframework.web.bind.annotation.RequestMapping;
  19 +import org.springframework.web.bind.annotation.RequestParam;
  20 +import org.springframework.web.bind.annotation.RestController;
  21 +import org.springframework.web.servlet.ModelAndView;
  22 +
3 import com.alibaba.fastjson.JSONObject; 23 import com.alibaba.fastjson.JSONObject;
4 import com.google.common.collect.Lists; 24 import com.google.common.collect.Lists;
5 import com.yoho.core.config.ConfigReader; 25 import com.yoho.core.config.ConfigReader;
@@ -14,10 +34,9 @@ import com.yohobuy.ufo.model.request.StoragePriceBo; @@ -14,10 +34,9 @@ import com.yohobuy.ufo.model.request.StoragePriceBo;
14 import com.yohobuy.ufo.model.request.product.ProductImportTranItemBo; 34 import com.yohobuy.ufo.model.request.product.ProductImportTranItemBo;
15 import com.yohobuy.ufo.model.request.product.ProductRequestBo; 35 import com.yohobuy.ufo.model.request.product.ProductRequestBo;
16 import com.yohobuy.ufo.model.response.ProductDetailResp; 36 import com.yohobuy.ufo.model.response.ProductDetailResp;
  37 +import com.yohobuy.ufo.model.response.StorageCheckResp;
17 import com.yohobuy.ufo.model.response.StorageDataResp; 38 import com.yohobuy.ufo.model.response.StorageDataResp;
18 import com.yohobuy.ufo.model.response.StorageInfoResp; 39 import com.yohobuy.ufo.model.response.StorageInfoResp;
19 -import com.yohobuy.ufo.model.response.StorageCheckResp;  
20 -  
21 import com.yohoufo.common.ApiResponse; 40 import com.yohoufo.common.ApiResponse;
22 import com.yohoufo.common.annotation.IgnoreSession; 41 import com.yohoufo.common.annotation.IgnoreSession;
23 import com.yohoufo.common.annotation.IgnoreSignature; 42 import com.yohoufo.common.annotation.IgnoreSignature;
@@ -27,27 +46,18 @@ import com.yohoufo.common.caller.UfoServiceCaller; @@ -27,27 +46,18 @@ import com.yohoufo.common.caller.UfoServiceCaller;
27 import com.yohoufo.dal.product.model.StoragePrice; 46 import com.yohoufo.dal.product.model.StoragePrice;
28 import com.yohoufo.product.constants.ProductConstants; 47 import com.yohoufo.product.constants.ProductConstants;
29 import com.yohoufo.product.model.SkupInfo; 48 import com.yohoufo.product.model.SkupInfo;
30 -import com.yohoufo.product.response.*; 49 +import com.yohoufo.product.response.ProductSeriesTemplateResp;
  50 +import com.yohoufo.product.response.ProductSimpleResp;
  51 +import com.yohoufo.product.response.ProductSortTemplateResp;
  52 +import com.yohoufo.product.response.SaleCategoryBo;
  53 +import com.yohoufo.product.response.SecondHandProductResp;
  54 +import com.yohoufo.product.response.SkupDetailForScreenResp;
  55 +import com.yohoufo.product.response.StorageLeastPriceResp;
31 import com.yohoufo.product.service.ProductService; 56 import com.yohoufo.product.service.ProductService;
32 import com.yohoufo.product.service.impl.ProductBatchService; 57 import com.yohoufo.product.service.impl.ProductBatchService;
33 import com.yohoufo.product.service.impl.ProductPoolService; 58 import com.yohoufo.product.service.impl.ProductPoolService;
34 import com.yohoufo.product.service.impl.SeekToBuyStorageService; 59 import com.yohoufo.product.service.impl.SeekToBuyStorageService;
35 import com.yohoufo.product.service.impl.StoragePriceService; 60 import com.yohoufo.product.service.impl.StoragePriceService;
36 -import org.apache.commons.collections.CollectionUtils;  
37 -import org.apache.commons.lang3.StringUtils;  
38 -import org.slf4j.Logger;  
39 -import org.slf4j.LoggerFactory;  
40 -import org.springframework.beans.factory.annotation.Autowired;  
41 -import org.springframework.web.bind.annotation.RequestBody;  
42 -import org.springframework.web.bind.annotation.RequestMapping;  
43 -import org.springframework.web.bind.annotation.RequestParam;  
44 -import org.springframework.web.bind.annotation.RestController;  
45 -import org.springframework.web.servlet.ModelAndView;  
46 -  
47 -import java.lang.reflect.Method;  
48 -import java.math.BigDecimal;  
49 -import java.util.*;  
50 -import java.util.stream.Collectors;  
51 61
52 @RestController 62 @RestController
53 public class ProductController { 63 public class ProductController {
@@ -1004,14 +1014,15 @@ public class ProductController { @@ -1004,14 +1014,15 @@ public class ProductController {
1004 1014
1005 @ApiOperation(name = "ufo.product.sizeImage", desc = "查询尺码图片") 1015 @ApiOperation(name = "ufo.product.sizeImage", desc = "查询尺码图片")
1006 @RequestMapping(params = "method=ufo.product.sizeImage") 1016 @RequestMapping(params = "method=ufo.product.sizeImage")
1007 - public ApiResponse getSizeImage(@RequestParam(value = "product_id") Integer productId) {  
1008 - if (null == productId) {  
1009 - LOG.info("in method=ufo.product.sizeImage product_id Is Null or empty");  
1010 - return new ApiResponse(400, "product_id Is Null or empty", null); 1017 + public ApiResponse getSizeImage(@RequestParam(value = "product_id") Integer productId,
  1018 + @RequestParam(value = "brand_id") Integer brandId) {
  1019 + if (null == productId || null == brandId) {
  1020 + LOG.info("in method=ufo.product.sizeImage product_id and brand_id is Null or empty");
  1021 + return new ApiResponse(400, "product_id and brand_id is Null or empty", null);
1011 } 1022 }
1012 LOG.info("in method=ufo.product.sizeImage product_id is {}", productId); 1023 LOG.info("in method=ufo.product.sizeImage product_id is {}", productId);
1013 1024
1014 - String result =productService.getSizeImage(productId); 1025 + String result =productService.getSizeImage(productId, brandId);
1015 return new ApiResponse.ApiResponseBuilder().code(200).data(result).message("getSizeImage success").build(); 1026 return new ApiResponse.ApiResponseBuilder().code(200).data(result).message("getSizeImage success").build();
1016 } 1027 }
1017 } 1028 }
@@ -155,5 +155,5 @@ public interface ProductService { @@ -155,5 +155,5 @@ public interface ProductService {
155 */ 155 */
156 ProductDetailResp queryProductDetail3ById(Integer productId); 156 ProductDetailResp queryProductDetail3ById(Integer productId);
157 157
158 - String getSizeImage(Integer productId); 158 + String getSizeImage(Integer productId, Integer brandId);
159 } 159 }
@@ -1957,14 +1957,10 @@ public class ProductServiceImpl implements ProductService { @@ -1957,14 +1957,10 @@ public class ProductServiceImpl implements ProductService {
1957 } 1957 }
1958 1958
1959 @Override 1959 @Override
1960 - public String getSizeImage(Integer productId) {  
1961 - Product product = productMapper.selectByPrimaryKey(productId);  
1962 - if(null == product) {  
1963 - return StringUtils.EMPTY;  
1964 - } 1960 + public String getSizeImage(Integer productId, Integer brandId) {
1965 List<SizePoolDetail> list = sizePoolDetailMapper.queryByProductId(productId); 1961 List<SizePoolDetail> list = sizePoolDetailMapper.queryByProductId(productId);
1966 if(CollectionUtils.isEmpty(list)) { 1962 if(CollectionUtils.isEmpty(list)) {
1967 - list = sizePoolDetailMapper.queryByBrandId(product.getBrandId()); 1963 + list = sizePoolDetailMapper.queryByBrandId(brandId);
1968 } 1964 }
1969 1965
1970 if(CollectionUtils.isEmpty(list)) { 1966 if(CollectionUtils.isEmpty(list)) {