Merge branch 'master' of http://git.yoho.cn/ufo/yohoufo-fore
Showing
7 changed files
with
27 additions
and
25 deletions
@@ -45,7 +45,7 @@ | @@ -45,7 +45,7 @@ | ||
45 | select id, product_id, color_name, goods_name | 45 | select id, product_id, color_name, goods_name |
46 | from goods where product_id = #{productId,jdbcType=INTEGER} | 46 | from goods where product_id = #{productId,jdbcType=INTEGER} |
47 | </select> | 47 | </select> |
48 | - <select id="selectByProductIds" resultType="com.yohoufo.dal.product.model.Goods"> | 48 | + <select id="selectByProductIds" resultMap="BaseResultMap"> |
49 | select id, product_id, color_image | 49 | select id, product_id, color_image |
50 | from goods where product_id IN | 50 | from goods where product_id IN |
51 | <foreach item="item" index="index" collection="list" | 51 | <foreach item="item" index="index" collection="list" |
@@ -59,7 +59,7 @@ | @@ -59,7 +59,7 @@ | ||
59 | </select> | 59 | </select> |
60 | <update id="addStorageNum"> | 60 | <update id="addStorageNum"> |
61 | update storage set storage_num = storage_num + #{storageNum,jdbcType=INTEGER}, | 61 | update storage set storage_num = storage_num + #{storageNum,jdbcType=INTEGER}, |
62 | - update_time = #{updateTime,jdbcType=INTEGER}, | 62 | + update_time = unix_timestamp() |
63 | where id = #{storageId,jdbcType=INTEGER} | 63 | where id = #{storageId,jdbcType=INTEGER} |
64 | </update> | 64 | </update> |
65 | 65 |
@@ -61,12 +61,12 @@ | @@ -61,12 +61,12 @@ | ||
61 | </select> | 61 | </select> |
62 | <update id="saleSkup" parameterType="java.lang.Integer"> | 62 | <update id="saleSkup" parameterType="java.lang.Integer"> |
63 | update storage_price set status = 2, | 63 | update storage_price set status = 2, |
64 | - update_time = unix_timestamp(), | 64 | + update_time = unix_timestamp() |
65 | where skup = #{skup,jdbcType=INTEGER} and status = 1 | 65 | where skup = #{skup,jdbcType=INTEGER} and status = 1 |
66 | </update> | 66 | </update> |
67 | <update id="cancelSaleSkup" parameterType="java.lang.Integer"> | 67 | <update id="cancelSaleSkup" parameterType="java.lang.Integer"> |
68 | update storage_price set status = 1, | 68 | update storage_price set status = 1, |
69 | - update_time = unix_timestamp(), | 69 | + update_time = unix_timestamp() |
70 | where skup = #{skup,jdbcType=INTEGER} and status = 2 | 70 | where skup = #{skup,jdbcType=INTEGER} and status = 2 |
71 | </update> | 71 | </update> |
72 | <select id="selectLeastPrice" resultMap="BaseResultMap"> | 72 | <select id="selectLeastPrice" resultMap="BaseResultMap"> |
@@ -6,6 +6,7 @@ import com.yohobuy.ufo.model.order.req.SellerOrderListReq; | @@ -6,6 +6,7 @@ import com.yohobuy.ufo.model.order.req.SellerOrderListReq; | ||
6 | import com.yohobuy.ufo.model.order.req.SellerOrderSubmitReq; | 6 | import com.yohobuy.ufo.model.order.req.SellerOrderSubmitReq; |
7 | import com.yohoufo.common.ApiResponse; | 7 | import com.yohoufo.common.ApiResponse; |
8 | import com.yohoufo.common.exception.GatewayException; | 8 | import com.yohoufo.common.exception.GatewayException; |
9 | +import com.yohoufo.order.response.OrderListInfo; | ||
9 | import com.yohoufo.order.response.OrderListInfoRsp; | 10 | import com.yohoufo.order.response.OrderListInfoRsp; |
10 | import com.yohoufo.order.service.SellerOrderService; | 11 | import com.yohoufo.order.service.SellerOrderService; |
11 | import org.slf4j.Logger; | 12 | import org.slf4j.Logger; |
1 | package com.yohoufo.order.service; | 1 | package com.yohoufo.order.service; |
2 | 2 | ||
3 | -import com.yoho.core.dal.datasource.annotation.Database; | ||
4 | import com.yoho.service.model.response.UserAddressRspBO; | 3 | import com.yoho.service.model.response.UserAddressRspBO; |
5 | import com.yohobuy.ufo.model.order.bo.PlatformFee; | 4 | import com.yohobuy.ufo.model.order.bo.PlatformFee; |
6 | import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo; | 5 | import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo; |
@@ -18,6 +17,7 @@ import com.yohoufo.order.model.GoodsInfo; | @@ -18,6 +17,7 @@ import com.yohoufo.order.model.GoodsInfo; | ||
18 | import com.yohoufo.order.model.SellerOrderContext; | 17 | import com.yohoufo.order.model.SellerOrderContext; |
19 | import com.yohoufo.order.model.dto.PlatformFeeDto; | 18 | import com.yohoufo.order.model.dto.PlatformFeeDto; |
20 | import com.yohoufo.order.model.dto.SellerOrderComputeResult; | 19 | import com.yohoufo.order.model.dto.SellerOrderComputeResult; |
20 | +import com.yohoufo.order.response.OrderListInfo; | ||
21 | import com.yohoufo.order.response.OrderListInfoRsp; | 21 | import com.yohoufo.order.response.OrderListInfoRsp; |
22 | import com.yohoufo.order.service.handler.SellerOrderComputeHandler; | 22 | import com.yohoufo.order.service.handler.SellerOrderComputeHandler; |
23 | import com.yohoufo.order.service.handler.SellerOrderSubmitHandler; | 23 | import com.yohoufo.order.service.handler.SellerOrderSubmitHandler; |
@@ -68,16 +68,11 @@ public class ProductController { | @@ -68,16 +68,11 @@ public class ProductController { | ||
68 | if (StringUtils.isBlank(skns)) { | 68 | if (StringUtils.isBlank(skns)) { |
69 | return new ApiResponse(500, "skns Is Null", null); | 69 | return new ApiResponse(500, "skns Is Null", null); |
70 | } | 70 | } |
71 | - return new ApiResponse.ApiResponseBuilder().data(querySortTemplateData()).code(200).message("product data").build(); | ||
72 | - } | ||
73 | 71 | ||
74 | - private ProductSeriesTemplateResp querySortTemplateData(){ | ||
75 | - 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\":\"阿迪系列\"}]}"; | ||
76 | - ProductSeriesTemplateResp resp = UfoJsonUtil.safelyParseObject(mockJson, ProductSeriesTemplateResp.class); | ||
77 | - return resp; | 72 | + ProductSeriesTemplateResp resp = productService.querySortTemplateData(skns); |
73 | + return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("product data").build(); | ||
78 | } | 74 | } |
79 | 75 | ||
80 | - | ||
81 | @ApiOperation(name = "ufo.product.storage.leastprice", desc="sku的最低价") | 76 | @ApiOperation(name = "ufo.product.storage.leastprice", desc="sku的最低价") |
82 | @RequestMapping(params = "method=ufo.product.storage.leastprice") | 77 | @RequestMapping(params = "method=ufo.product.storage.leastprice") |
83 | //@Cachable(expire=600) | 78 | //@Cachable(expire=600) |
@@ -10,10 +10,7 @@ import com.yoho.core.common.helpers.ImagesHelper; | @@ -10,10 +10,7 @@ import com.yoho.core.common.helpers.ImagesHelper; | ||
10 | import com.yohoufo.common.utils.UfoStringUtils; | 10 | import com.yohoufo.common.utils.UfoStringUtils; |
11 | import com.yohoufo.dal.product.*; | 11 | import com.yohoufo.dal.product.*; |
12 | import com.yohoufo.dal.product.model.*; | 12 | import com.yohoufo.dal.product.model.*; |
13 | -import com.yohoufo.product.model.GoodsImageBO; | ||
14 | -import com.yohoufo.product.model.GoodsSize; | ||
15 | -import com.yohoufo.product.model.GoodsBO; | ||
16 | -import com.yohoufo.product.model.ProductInfo; | 13 | +import com.yohoufo.product.model.*; |
17 | import com.yohoufo.product.response.ProductSeriesTemplateResp; | 14 | import com.yohoufo.product.response.ProductSeriesTemplateResp; |
18 | import com.yohoufo.product.response.StorageDataResp; | 15 | import com.yohoufo.product.response.StorageDataResp; |
19 | import com.yohoufo.product.response.StorageLeastPriceResp; | 16 | import com.yohoufo.product.response.StorageLeastPriceResp; |
@@ -141,24 +138,33 @@ public class ProductServiceImpl implements ProductService{ | @@ -141,24 +138,33 @@ public class ProductServiceImpl implements ProductService{ | ||
141 | @Override | 138 | @Override |
142 | public ProductSeriesTemplateResp querySortTemplateData(String skns) { | 139 | public ProductSeriesTemplateResp querySortTemplateData(String skns) { |
143 | ProductSeriesTemplateResp resp = new ProductSeriesTemplateResp(); | 140 | ProductSeriesTemplateResp resp = new ProductSeriesTemplateResp(); |
144 | - | ||
145 | List<Integer> sknlist = UfoStringUtils.string2IntegerList(skns); | 141 | List<Integer> sknlist = UfoStringUtils.string2IntegerList(skns); |
146 | - | ||
147 | if (!CollectionUtils.isEmpty(sknlist)) { | 142 | if (!CollectionUtils.isEmpty(sknlist)) { |
148 | List<Product> products = productMapper.selectByIds(sknlist); | 143 | List<Product> products = productMapper.selectByIds(sknlist); |
149 | if (!CollectionUtils.isEmpty(products)) { | 144 | if (!CollectionUtils.isEmpty(products)) { |
145 | + List<Goods> goodsList = goodsMapper.selectByProductIds(sknlist); | ||
146 | + Map<Integer, List<Goods>> productGoodsMap = goodsList.stream().collect(Collectors.groupingBy(Goods::getProductId)); | ||
147 | + Map<Integer, String> seriesMap = new HashMap<>(); | ||
150 | List<Integer> seriesIds = products.stream().map(Product::getSeriesId).filter(Objects::nonNull).collect(Collectors.toList()); | 148 | List<Integer> seriesIds = products.stream().map(Product::getSeriesId).filter(Objects::nonNull).collect(Collectors.toList()); |
151 | if (!CollectionUtils.isEmpty(seriesIds)) { | 149 | if (!CollectionUtils.isEmpty(seriesIds)) { |
152 | List<BrandSeries> seriesList = brandSeriesMapper.selectByIds(seriesIds); | 150 | List<BrandSeries> seriesList = brandSeriesMapper.selectByIds(seriesIds); |
151 | + seriesMap = seriesList.stream().collect(Collectors.toMap(BrandSeries::getId, BrandSeries::getSeriesName)); | ||
152 | + } | ||
153 | + List<ProductSeriesTemplate> list = new ArrayList<>(); | ||
154 | + resp.setList(list); | ||
155 | + for (Product product : products) { | ||
156 | + List<Goods> pgList = productGoodsMap.get(product.getId()); | ||
157 | + if (StringUtils.isNotBlank(seriesMap.get(product.getSeriesId())) && !CollectionUtils.isEmpty(pgList) && pgList.get(0) != null && StringUtils.isNotBlank(pgList.get(0).getColorImage())) { | ||
158 | + ProductSeriesTemplate productSeriesTemplate = new ProductSeriesTemplate(); | ||
159 | + productSeriesTemplate.setImageUrl(pgList.get(0).getColorImage()); | ||
160 | + productSeriesTemplate.setSeriesId(product.getSeriesId().toString()); | ||
161 | + productSeriesTemplate.setSeriesName(seriesMap.get(product.getSeriesId())); | ||
162 | + list.add(productSeriesTemplate); | ||
163 | + } | ||
153 | } | 164 | } |
154 | - | ||
155 | - | ||
156 | - List<Goods> goodsList = goodsMapper.selectByProductIds(sknlist); | ||
157 | - | ||
158 | } | 165 | } |
159 | } | 166 | } |
160 | - | ||
161 | - return null; | 167 | + return resp; |
162 | } | 168 | } |
163 | 169 | ||
164 | @Override | 170 | @Override |
@@ -210,7 +216,7 @@ public class ProductServiceImpl implements ProductService{ | @@ -210,7 +216,7 @@ public class ProductServiceImpl implements ProductService{ | ||
210 | if (storageId == null) { | 216 | if (storageId == null) { |
211 | StoragePrice sp = storagePriceMapper.selectBySkup(skup); | 217 | StoragePrice sp = storagePriceMapper.selectBySkup(skup); |
212 | storageId = sp.getStorageId(); | 218 | storageId = sp.getStorageId(); |
213 | - if (storageId == null) { | 219 | + if (sp == null || (storageId = sp.getStorageId()) == null) { |
214 | LOGGER.error("addStorageNum skup={}, storageId={}, num={}, find storageId is null", skup, storageId, | 220 | LOGGER.error("addStorageNum skup={}, storageId={}, num={}, find storageId is null", skup, storageId, |
215 | num); | 221 | num); |
216 | } | 222 | } |
-
Please register or login to post a comment