Authored by caoyan

尺码集合

package com.yohoufo.product.controller;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.yoho.core.config.ConfigReader;
... ... @@ -14,10 +34,9 @@ import com.yohobuy.ufo.model.request.StoragePriceBo;
import com.yohobuy.ufo.model.request.product.ProductImportTranItemBo;
import com.yohobuy.ufo.model.request.product.ProductRequestBo;
import com.yohobuy.ufo.model.response.ProductDetailResp;
import com.yohobuy.ufo.model.response.StorageCheckResp;
import com.yohobuy.ufo.model.response.StorageDataResp;
import com.yohobuy.ufo.model.response.StorageInfoResp;
import com.yohobuy.ufo.model.response.StorageCheckResp;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
... ... @@ -27,27 +46,18 @@ import com.yohoufo.common.caller.UfoServiceCaller;
import com.yohoufo.dal.product.model.StoragePrice;
import com.yohoufo.product.constants.ProductConstants;
import com.yohoufo.product.model.SkupInfo;
import com.yohoufo.product.response.*;
import com.yohoufo.product.response.ProductSeriesTemplateResp;
import com.yohoufo.product.response.ProductSimpleResp;
import com.yohoufo.product.response.ProductSortTemplateResp;
import com.yohoufo.product.response.SaleCategoryBo;
import com.yohoufo.product.response.SecondHandProductResp;
import com.yohoufo.product.response.SkupDetailForScreenResp;
import com.yohoufo.product.response.StorageLeastPriceResp;
import com.yohoufo.product.service.ProductService;
import com.yohoufo.product.service.impl.ProductBatchService;
import com.yohoufo.product.service.impl.ProductPoolService;
import com.yohoufo.product.service.impl.SeekToBuyStorageService;
import com.yohoufo.product.service.impl.StoragePriceService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@RestController
public class ProductController {
... ... @@ -1004,14 +1014,15 @@ public class ProductController {
@ApiOperation(name = "ufo.product.sizeImage", desc = "查询尺码图片")
@RequestMapping(params = "method=ufo.product.sizeImage")
public ApiResponse getSizeImage(@RequestParam(value = "product_id") Integer productId) {
if (null == productId) {
LOG.info("in method=ufo.product.sizeImage product_id Is Null or empty");
return new ApiResponse(400, "product_id Is Null or empty", null);
public ApiResponse getSizeImage(@RequestParam(value = "product_id") Integer productId,
@RequestParam(value = "brand_id") Integer brandId) {
if (null == productId || null == brandId) {
LOG.info("in method=ufo.product.sizeImage product_id and brand_id is Null or empty");
return new ApiResponse(400, "product_id and brand_id is Null or empty", null);
}
LOG.info("in method=ufo.product.sizeImage product_id is {}", productId);
String result =productService.getSizeImage(productId);
String result =productService.getSizeImage(productId, brandId);
return new ApiResponse.ApiResponseBuilder().code(200).data(result).message("getSizeImage success").build();
}
}
\ No newline at end of file
... ...
... ... @@ -155,5 +155,5 @@ public interface ProductService {
*/
ProductDetailResp queryProductDetail3ById(Integer productId);
String getSizeImage(Integer productId);
String getSizeImage(Integer productId, Integer brandId);
}
... ...
... ... @@ -1957,14 +1957,10 @@ public class ProductServiceImpl implements ProductService {
}
@Override
public String getSizeImage(Integer productId) {
Product product = productMapper.selectByPrimaryKey(productId);
if(null == product) {
return StringUtils.EMPTY;
}
public String getSizeImage(Integer productId, Integer brandId) {
List<SizePoolDetail> list = sizePoolDetailMapper.queryByProductId(productId);
if(CollectionUtils.isEmpty(list)) {
list = sizePoolDetailMapper.queryByBrandId(product.getBrandId());
list = sizePoolDetailMapper.queryByBrandId(brandId);
}
if(CollectionUtils.isEmpty(list)) {
... ...