Authored by tanling

Merge branch 'master' of http://git.yoho.cn/ufo/yohoufo-fore

... ... @@ -45,7 +45,7 @@
select id, product_id, color_name, goods_name
from goods where product_id = #{productId,jdbcType=INTEGER}
</select>
<select id="selectByProductIds" resultType="com.yohoufo.dal.product.model.Goods">
<select id="selectByProductIds" resultMap="BaseResultMap">
select id, product_id, color_image
from goods where product_id IN
<foreach item="item" index="index" collection="list"
... ...
... ... @@ -59,7 +59,7 @@
</select>
<update id="addStorageNum">
update storage set storage_num = storage_num + #{storageNum,jdbcType=INTEGER},
update_time = #{updateTime,jdbcType=INTEGER},
update_time = unix_timestamp()
where id = #{storageId,jdbcType=INTEGER}
</update>
... ...
... ... @@ -61,12 +61,12 @@
</select>
<update id="saleSkup" parameterType="java.lang.Integer">
update storage_price set status = 2,
update_time = unix_timestamp(),
update_time = unix_timestamp()
where skup = #{skup,jdbcType=INTEGER} and status = 1
</update>
<update id="cancelSaleSkup" parameterType="java.lang.Integer">
update storage_price set status = 1,
update_time = unix_timestamp(),
update_time = unix_timestamp()
where skup = #{skup,jdbcType=INTEGER} and status = 2
</update>
<select id="selectLeastPrice" resultMap="BaseResultMap">
... ...
... ... @@ -6,6 +6,7 @@ import com.yohobuy.ufo.model.order.req.SellerOrderListReq;
import com.yohobuy.ufo.model.order.req.SellerOrderSubmitReq;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.exception.GatewayException;
import com.yohoufo.order.response.OrderListInfo;
import com.yohoufo.order.response.OrderListInfoRsp;
import com.yohoufo.order.service.SellerOrderService;
import org.slf4j.Logger;
... ...
package com.yohoufo.order.service;
import com.yoho.core.dal.datasource.annotation.Database;
import com.yoho.service.model.response.UserAddressRspBO;
import com.yohobuy.ufo.model.order.bo.PlatformFee;
import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo;
... ... @@ -18,6 +17,7 @@ import com.yohoufo.order.model.GoodsInfo;
import com.yohoufo.order.model.SellerOrderContext;
import com.yohoufo.order.model.dto.PlatformFeeDto;
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
import com.yohoufo.order.response.OrderListInfo;
import com.yohoufo.order.response.OrderListInfoRsp;
import com.yohoufo.order.service.handler.SellerOrderComputeHandler;
import com.yohoufo.order.service.handler.SellerOrderSubmitHandler;
... ...
... ... @@ -68,16 +68,11 @@ public class ProductController {
if (StringUtils.isBlank(skns)) {
return new ApiResponse(500, "skns Is Null", null);
}
return new ApiResponse.ApiResponseBuilder().data(querySortTemplateData()).code(200).message("product data").build();
}
private ProductSeriesTemplateResp querySortTemplateData(){
String mockJson = "{\"list\":[{\"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\",\"series_id\":2,\"series_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\",\"series_id\":4,\"series_name\":\"阿迪系列\"}]}";
ProductSeriesTemplateResp resp = UfoJsonUtil.safelyParseObject(mockJson, ProductSeriesTemplateResp.class);
return resp;
ProductSeriesTemplateResp resp = productService.querySortTemplateData(skns);
return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("product data").build();
}
@ApiOperation(name = "ufo.product.storage.leastprice", desc="sku的最低价")
@RequestMapping(params = "method=ufo.product.storage.leastprice")
//@Cachable(expire=600)
... ...
... ... @@ -10,10 +10,7 @@ import com.yoho.core.common.helpers.ImagesHelper;
import com.yohoufo.common.utils.UfoStringUtils;
import com.yohoufo.dal.product.*;
import com.yohoufo.dal.product.model.*;
import com.yohoufo.product.model.GoodsImageBO;
import com.yohoufo.product.model.GoodsSize;
import com.yohoufo.product.model.GoodsBO;
import com.yohoufo.product.model.ProductInfo;
import com.yohoufo.product.model.*;
import com.yohoufo.product.response.ProductSeriesTemplateResp;
import com.yohoufo.product.response.StorageDataResp;
import com.yohoufo.product.response.StorageLeastPriceResp;
... ... @@ -141,24 +138,33 @@ public class ProductServiceImpl implements ProductService{
@Override
public ProductSeriesTemplateResp querySortTemplateData(String skns) {
ProductSeriesTemplateResp resp = new ProductSeriesTemplateResp();
List<Integer> sknlist = UfoStringUtils.string2IntegerList(skns);
if (!CollectionUtils.isEmpty(sknlist)) {
List<Product> products = productMapper.selectByIds(sknlist);
if (!CollectionUtils.isEmpty(products)) {
List<Goods> goodsList = goodsMapper.selectByProductIds(sknlist);
Map<Integer, List<Goods>> productGoodsMap = goodsList.stream().collect(Collectors.groupingBy(Goods::getProductId));
Map<Integer, String> seriesMap = new HashMap<>();
List<Integer> seriesIds = products.stream().map(Product::getSeriesId).filter(Objects::nonNull).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(seriesIds)) {
List<BrandSeries> seriesList = brandSeriesMapper.selectByIds(seriesIds);
seriesMap = seriesList.stream().collect(Collectors.toMap(BrandSeries::getId, BrandSeries::getSeriesName));
}
List<ProductSeriesTemplate> list = new ArrayList<>();
resp.setList(list);
for (Product product : products) {
List<Goods> pgList = productGoodsMap.get(product.getId());
if (StringUtils.isNotBlank(seriesMap.get(product.getSeriesId())) && !CollectionUtils.isEmpty(pgList) && pgList.get(0) != null && StringUtils.isNotBlank(pgList.get(0).getColorImage())) {
ProductSeriesTemplate productSeriesTemplate = new ProductSeriesTemplate();
productSeriesTemplate.setImageUrl(pgList.get(0).getColorImage());
productSeriesTemplate.setSeriesId(product.getSeriesId().toString());
productSeriesTemplate.setSeriesName(seriesMap.get(product.getSeriesId()));
list.add(productSeriesTemplate);
}
}
List<Goods> goodsList = goodsMapper.selectByProductIds(sknlist);
}
}
return null;
return resp;
}
@Override
... ... @@ -210,7 +216,7 @@ public class ProductServiceImpl implements ProductService{
if (storageId == null) {
StoragePrice sp = storagePriceMapper.selectBySkup(skup);
storageId = sp.getStorageId();
if (storageId == null) {
if (sp == null || (storageId = sp.getStorageId()) == null) {
LOGGER.error("addStorageNum skup={}, storageId={}, num={}, find storageId is null", skup, storageId,
num);
}
... ...