Authored by mali

Merge branch 'test6.9.17' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.17

Conflicts:
	product/src/main/java/com/yohoufo/product/service/impl/ProductServiceImpl.java
package com.yohoufo.dal.product;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yohoufo.dal.product.model.SizePoolDetail;
/**
* Created by caoyan.
*/
public interface SizePoolDetailMapper {
List<SizePoolDetail> queryByProductId(@Param("productId") Integer productId);
List<SizePoolDetail> queryByBrandId(@Param("brandId") Integer brandId);
}
... ...
package com.yohoufo.dal.product;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yohoufo.dal.product.model.SizePool;
/**
* Created by caoyan.
*/
public interface SizePoolMapper {
SizePool querySizePoolByIds(@Param("sizePoolIds") List<Integer> sizePoolIds);
}
... ...
package com.yohoufo.dal.product.model;
import com.alibaba.fastjson.JSONObject;
public class SizePool {
private Integer id;
private Integer status;
private Integer rangeType;
private String imageUrl;
private Integer updateTime;
private Integer updateUid;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getRangeType() {
return rangeType;
}
public void setRangeType(Integer rangeType) {
this.rangeType = rangeType;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public Integer getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Integer updateTime) {
this.updateTime = updateTime;
}
public Integer getUpdateUid() {
return updateUid;
}
public void setUpdateUid(Integer updateUid) {
this.updateUid = updateUid;
}
@Override
public String toString() {
return JSONObject.toJSONString(this);
}
}
\ No newline at end of file
... ...
package com.yohoufo.dal.product.model;
import com.alibaba.fastjson.JSONObject;
public class SizePoolDetail {
private Integer id;
private Integer sizePoolId;
private Integer isInclude;
private Integer itemId;
private Integer itemType;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getSizePoolId() {
return sizePoolId;
}
public void setSizePoolId(Integer sizePoolId) {
this.sizePoolId = sizePoolId;
}
public Integer getIsInclude() {
return isInclude;
}
public void setIsInclude(Integer isInclude) {
this.isInclude = isInclude;
}
public Integer getItemId() {
return itemId;
}
public void setItemId(Integer itemId) {
this.itemId = itemId;
}
public Integer getItemType() {
return itemType;
}
public void setItemType(Integer itemType) {
this.itemType = itemType;
}
@Override
public String toString() {
return JSONObject.toJSONString(this);
}
}
\ No newline at end of file
... ...
... ... @@ -200,6 +200,7 @@
<delete id="clearUserHistoryData">
update seller_wallet_detail set del = 1
where uid = #{uid,jdbcType=INTEGER}
and del=0
</delete>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yohoufo.dal.product.SizePoolDetailMapper">
<resultMap id="BaseResultMap" type="com.yohoufo.dal.product.model.SizePoolDetail">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="size_pool_id" property="sizePoolId" jdbcType="INTEGER" />
<result column="is_include" property="isInclude" jdbcType="INTEGER" />
<result column="item_id" property="itemId" jdbcType="INTEGER" />
<result column="item_type" property="itemType" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
id, size_pool_id, is_include, item_id, item_type
</sql>
<select id="queryByProductId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from size_pool_detail
where is_include=1 and item_type=2 and item_id=#{productId}
</select>
<select id="queryByBrandId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from size_pool_detail
where is_include=1 and item_type=1 and item_id=#{brandId}
</select>
</mapper>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yohoufo.dal.product.SizePoolMapper">
<resultMap id="BaseResultMap" type="com.yohoufo.dal.product.model.SizePool">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="range_type" property="rangeType" jdbcType="INTEGER" />
<result column="image_url" property="imageUrl" jdbcType="VARCHAR" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
<result column="update_uid" property="updateUid" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
id, status, range_type, image_url, update_time, update_uid
</sql>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from size_pool
where id = #{id,jdbcType=INTEGER}
</delete>
<select id="querySizePoolByIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from size_pool
where status=1 and id in
<foreach collection="sizePoolIds" item="sizePoolId" open="(" close=")" separator=",">
#{sizePoolId}
</foreach>
limit 1
</select>
</mapper>
\ No newline at end of file
... ...
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 {
... ... @@ -1001,4 +1011,18 @@ public class ProductController {
ProductDetailResp resp = productService.queryProductDetail3ById(productId);
return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("product data").build();
}
@ApiOperation(name = "ufo.product.sizeImage", desc = "查询尺码图片")
@RequestMapping(params = "method=ufo.product.sizeImage")
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, brandId);
return new ApiResponse.ApiResponseBuilder().code(200).data(result).message("getSizeImage success").build();
}
}
\ No newline at end of file
... ...
... ... @@ -363,9 +363,10 @@ public class ProductSearchController {
@RequestParam(value = "brand", required = false) String brand,
@RequestParam(value = "size", required = false) String size,
@RequestParam(value = "price", required = false) String price,
@RequestParam(value = "maxSot", required = false) String maxSort) {
@RequestParam(value = "maxSot", required = false) String maxSort,
@RequestParam(value = "order", required = false) String order) {
ProductSearchReq req = new ProductSearchReq().setViewNum(limit).setPage(page).setPreSaleFlag(preSaleFlag).setBusinessClient(businessClient)
.setPool(productPool).setGender(gender).setBrand(brand).setSize(size).setPrice(price).setMaxSort(maxSort);
.setPool(productPool).setGender(gender).setBrand(brand).setSize(size).setPrice(price).setMaxSort(maxSort).setOrder(order);
LOG.info("in method=ufo.product.search.secondhand.skupList req={}", req);
JSONObject resp = productSearchService.searchSecondhandSkupList(req);
return new ApiResponse.ApiResponseBuilder().code(200).message("secondhand skupList.").data(resp).build();
... ...
... ... @@ -154,4 +154,6 @@ public interface ProductService {
* @return
*/
ProductDetailResp queryProductDetail3ById(Integer productId);
String getSizeImage(Integer productId, Integer brandId);
}
... ...
package com.yohoufo.product.service.impl;
import java.math.BigDecimal;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.stream.Collectors;
... ... @@ -30,14 +41,14 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.util.CollectionUtils;
import org.springframework.web.servlet.ModelAndView;
import com.yohobuy.ufo.model.enums.StorageCheckEnum;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.google.common.collect.Lists;
import com.yoho.core.common.helpers.ImagesHelper;
import com.yoho.core.config.ConfigReader;
... ... @@ -47,15 +58,65 @@ import com.yohobuy.ufo.model.GoodsBO;
import com.yohobuy.ufo.model.GoodsImageBO;
import com.yohobuy.ufo.model.GoodsSize;
import com.yohobuy.ufo.model.ProductInfo;
import com.yohobuy.ufo.model.enums.StorageCheckEnum;
import com.yohobuy.ufo.model.request.StoragePriceBo;
import com.yohobuy.ufo.model.request.product.PriceTrendBO;
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.store.StoreInfoBo;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.caller.UfoServiceCaller;
import com.yohoufo.common.constant.BusinessClientEnum;
import com.yohoufo.common.helper.ImageUrlAssist;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.common.utils.OrikaUtils;
import com.yohoufo.common.utils.UfoStringUtils;
import com.yohobuy.ufo.model.request.product.PriceTrendBO;
import com.yohoufo.dal.product.BrandMapper;
import com.yohoufo.dal.product.BrandSeriesMapper;
import com.yohoufo.dal.product.GoodsImagesMapper;
import com.yohoufo.dal.product.GoodsMapper;
import com.yohoufo.dal.product.PriceTrendDayMapper;
import com.yohoufo.dal.product.PriceTrendMonthMapper;
import com.yohoufo.dal.product.ProductLimitSaleMapper;
import com.yohoufo.dal.product.ProductMapper;
import com.yohoufo.dal.product.ProductProfitMapper;
import com.yohoufo.dal.product.ProductSalesMapper;
import com.yohoufo.dal.product.ProductSortMapper;
import com.yohoufo.dal.product.SaleCategoryMapper;
import com.yohoufo.dal.product.SecondhandFlawMapper;
import com.yohoufo.dal.product.SecondhandImagesMapper;
import com.yohoufo.dal.product.SecondhandInfoMapper;
import com.yohoufo.dal.product.SelfSizeMapper;
import com.yohoufo.dal.product.SelfSizeUidMapper;
import com.yohoufo.dal.product.SizeMapper;
import com.yohoufo.dal.product.SizePoolDetailMapper;
import com.yohoufo.dal.product.SizePoolMapper;
import com.yohoufo.dal.product.StorageMapper;
import com.yohoufo.dal.product.StoragePriceMapper;
import com.yohoufo.dal.product.model.Brand;
import com.yohoufo.dal.product.model.BrandSeries;
import com.yohoufo.dal.product.model.Goods;
import com.yohoufo.dal.product.model.GoodsImages;
import com.yohoufo.dal.product.model.PriceTrendModel;
import com.yohoufo.dal.product.model.Product;
import com.yohoufo.dal.product.model.ProductLimitSale;
import com.yohoufo.dal.product.model.ProductProfit;
import com.yohoufo.dal.product.model.ProductSales;
import com.yohoufo.dal.product.model.ProductSort;
import com.yohoufo.dal.product.model.SaleCategory;
import com.yohoufo.dal.product.model.SecondhandFlaw;
import com.yohoufo.dal.product.model.SecondhandImages;
import com.yohoufo.dal.product.model.SecondhandInfo;
import com.yohoufo.dal.product.model.SelfSize;
import com.yohoufo.dal.product.model.SelfSizeUid;
import com.yohoufo.dal.product.model.Size;
import com.yohoufo.dal.product.model.SizePool;
import com.yohoufo.dal.product.model.SizePoolDetail;
import com.yohoufo.dal.product.model.Storage;
import com.yohoufo.dal.product.model.StoragePrice;
import com.yohoufo.product.model.ProductSeriesTemplate;
import com.yohoufo.product.model.ProductSortTemplate;
import com.yohoufo.product.model.SkupDetailForScreenInfo;
... ... @@ -70,7 +131,6 @@ import com.yohoufo.product.response.SkupDetailForScreenResp;
import com.yohoufo.product.response.StorageLeastPriceResp;
import com.yohoufo.product.service.ProductSearchService;
import com.yohoufo.product.service.ProductService;
import com.yohoufo.dal.product.model.Size;
@Service
... ... @@ -174,6 +234,12 @@ public class ProductServiceImpl implements ProductService {
@Autowired
private SizeCacheService sizeCacheService;
@Autowired
private SizePoolMapper sizePoolMapper;
@Autowired
private SizePoolDetailMapper sizePoolDetailMapper;
@Override
public ProductDetailResp queryProductDetailById(Integer productId) {
ProductDetailResp productDetailResp = new ProductDetailResp();
... ... @@ -1914,6 +1980,26 @@ public class ProductServiceImpl implements ProductService {
}
@Override
public String getSizeImage(Integer productId, Integer brandId) {
List<SizePoolDetail> list = sizePoolDetailMapper.queryByProductId(productId);
if(CollectionUtils.isEmpty(list)) {
list = sizePoolDetailMapper.queryByBrandId(brandId);
}
if(CollectionUtils.isEmpty(list)) {
return StringUtils.EMPTY;
}
List<Integer> poolIdList = list.stream().map(SizePoolDetail::getSizePoolId).collect(Collectors.toList());
SizePool pool = sizePoolMapper.querySizePoolByIds(poolIdList);
if(null == pool) {
return StringUtils.EMPTY;
}
return pool.getImageUrl();
}
private List<Integer> buildSizeIdList(String[] sizeIdArr){
List<Integer> sizeIdList = Lists.newArrayList();
for(int i=0; i<sizeIdArr.length; i++) {
... ...
... ... @@ -51,6 +51,8 @@ datasources:
- com.yohoufo.dal.product.ProductProfitMapper
- com.yohoufo.dal.product.ProductPoolDetailMapper
- com.yohoufo.dal.product.BidStoragePriceMapper
- com.yohoufo.dal.product.SizePoolMapper
- com.yohoufo.dal.product.SizePoolDetailMapper
ufo_order:
... ...
... ... @@ -53,6 +53,8 @@ datasources:
- com.yohoufo.dal.product.ProductProfitMapper
- com.yohoufo.dal.product.ProductPoolDetailMapper
- com.yohoufo.dal.product.BidStoragePriceMapper
- com.yohoufo.dal.product.SizePoolMapper
- com.yohoufo.dal.product.SizePoolDetailMapper
ufo_order:
username: ${jdbc.mysql.cobar.username}
... ...