Authored by mali

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

@@ -277,14 +277,14 @@ @@ -277,14 +277,14 @@
277 select count(distinct product_id) from storage_deposit 277 select count(distinct product_id) from storage_deposit
278 where owner_uid = #{uid} and status=1 and del_status=0 278 where owner_uid = #{uid} and status=1 and del_status=0
279 </select> 279 </select>
280 - <select id="queryUserDepositProductId" resultMap="BaseResultMap" parameterType="java.lang.Integer" > 280 + <select id="queryUserDepositProductId" resultType="java.lang.Integer">
281 select distinct product_id from storage_deposit 281 select distinct product_id from storage_deposit
282 where owner_uid = #{uid} and status=1 and del_status=0 limit #{start}, #{count} 282 where owner_uid = #{uid} and status=1 and del_status=0 limit #{start}, #{count}
283 </select> 283 </select>
284 284
285 <select id="queryUserDepositProduct" resultMap="CountResultMap"> 285 <select id="queryUserDepositProduct" resultMap="CountResultMap">
286 select product_id , count(distinct storage_id) as storage_id_count,count(*) as storage_count,sum( if( order_status = 0, 1, 0)) as un_shelf_storage_count,max(skup) as skup from storage_deposit 286 select product_id , count(distinct storage_id) as storage_id_count,count(*) as storage_count,sum( if( order_status = 0, 1, 0)) as un_shelf_storage_count,max(skup) as skup from storage_deposit
287 - where owner_uid = #{uid} and status=1 and del_status=0 limit #{start}, #{count} 287 + where owner_uid = #{uid} and status=1 and del_status=0
288 and product_id in 288 and product_id in
289 <foreach item="item" index="index" collection="productIdList" open="(" separator="," close=")"> 289 <foreach item="item" index="index" collection="productIdList" open="(" separator="," close=")">
290 #{item} 290 #{item}
1 package com.yohoufo.order.controller; 1 package com.yohoufo.order.controller;
2 2
  3 +import com.alibaba.fastjson.JSONObject;
3 import com.yohobuy.ufo.model.order.bo.DepositDetailBo; 4 import com.yohobuy.ufo.model.order.bo.DepositDetailBo;
4 import com.yohobuy.ufo.model.order.bo.DepositProductBo; 5 import com.yohobuy.ufo.model.order.bo.DepositProductBo;
5 import com.yohoufo.common.ApiResponse; 6 import com.yohoufo.common.ApiResponse;
@@ -67,7 +68,11 @@ public class DepositController { @@ -67,7 +68,11 @@ public class DepositController {
67 } 68 }
68 69
69 List<DepositDetailBo> depositDetailBoList = depositService.queryUserProductDopositingDetail(uid, productId, page, limit); 70 List<DepositDetailBo> depositDetailBoList = depositService.queryUserProductDopositingDetail(uid, productId, page, limit);
70 - LOG.info("queryUserDopositing result: {}", depositDetailBoList);  
71 - return new ApiResponse.ApiResponseBuilder().code(200).data(depositDetailBoList).build(); 71 + DepositProductBo countBo = depositService.queryUserDepositProductCountInfo(uid, productId);
  72 + JSONObject result = new JSONObject();
  73 + result.put("product", countBo);
  74 + result.put("items", depositDetailBoList);
  75 + LOG.info("queryUserDopositing result: {}", result);
  76 + return new ApiResponse.ApiResponseBuilder().code(200).data(result).build();
72 } 77 }
73 } 78 }
@@ -18,10 +18,17 @@ public interface DepositService { @@ -18,10 +18,17 @@ public interface DepositService {
18 18
19 List<DepositDetailBo> queryUserProductDopositingDetail(Integer uid, Integer productId, Integer page, Integer limit); 19 List<DepositDetailBo> queryUserProductDopositingDetail(Integer uid, Integer productId, Integer page, Integer limit);
20 20
  21 + DepositProductBo queryUserDepositProductCountInfo(Integer uid, Integer productId);
  22 +
  23 + // 上架
21 boolean changeSaleStatusOn(Integer uid, String depositCode, Integer skup); 24 boolean changeSaleStatusOn(Integer uid, String depositCode, Integer skup);
  25 + // 下架
22 boolean changeSaleStatusOff(Integer uid, Integer skup); 26 boolean changeSaleStatusOff(Integer uid, Integer skup);
  27 + // 转卖
23 boolean changeOwner(Integer uid, Integer skup, long buyOrderCode, Integer newUid); 28 boolean changeOwner(Integer uid, Integer skup, long buyOrderCode, Integer newUid);
  29 + // 可上架数量
24 int getDepositOffShelvesCount(Integer uid, Integer storageId); 30 int getDepositOffShelvesCount(Integer uid, Integer storageId);
  31 + // 剩余存储天数
25 int getRemainDay(Integer uid, String depositCode); 32 int getRemainDay(Integer uid, String depositCode);
26 33
27 int changeStorageStatus(String depositCode, int status); 34 int changeStorageStatus(String depositCode, int status);
@@ -73,7 +73,7 @@ public class DepositServiceImpl implements DepositService { @@ -73,7 +73,7 @@ public class DepositServiceImpl implements DepositService {
73 } 73 }
74 result.add(bo); 74 result.add(bo);
75 } 75 }
76 - return null; 76 + return result;
77 } 77 }
78 78
79 @Override 79 @Override
@@ -141,6 +141,25 @@ public class DepositServiceImpl implements DepositService { @@ -141,6 +141,25 @@ public class DepositServiceImpl implements DepositService {
141 return result; 141 return result;
142 } 142 }
143 143
  144 + public DepositProductBo queryUserDepositProductCountInfo(Integer uid, Integer productId) {
  145 + List<StorageDepositCount> countInfoList = storageDepositMapper.queryUserDepositProduct(uid, Arrays.asList(productId));
  146 + if (countInfoList.isEmpty()) {
  147 + return null;
  148 + }
  149 + StorageDepositCount countInfo = countInfoList.get(0);
  150 + DepositProductBo bo = new DepositProductBo();
  151 + SellerOrderGoods goods = sellerOrderGoodsMapper.selectByPrimaryKey(countInfo.getSkup());
  152 + bo.setProductId(productId);
  153 + if (goods != null) {
  154 + bo.setProductName(goods.getProductName());
  155 + bo.setColorName(goods.getColorName());
  156 + bo.setPic(goods.getImageUrl());
  157 + }
  158 + bo.setSizeCount(countInfo.getStorageIdCount());
  159 + bo.setStorageCount(countInfo.getStorageCount());
  160 + return bo;
  161 + }
  162 +
144 163
145 // 上架 164 // 上架
146 @Override 165 @Override
@@ -224,14 +243,7 @@ public class DepositServiceImpl implements DepositService { @@ -224,14 +243,7 @@ public class DepositServiceImpl implements DepositService {
224 243
225 private int getRemainDay(Integer endTime) { 244 private int getRemainDay(Integer endTime) {
226 int second = endTime - (int) (System.currentTimeMillis() / 1000); 245 int second = endTime - (int) (System.currentTimeMillis() / 1000);
227 - int day = second / (24 * 3600);  
228 - if (second % day != 0) {  
229 - if (day > 0) {  
230 - day += 1;  
231 - } else {  
232 - day -= 1;  
233 - }  
234 - } 246 + int day = (int) Math.ceil(second * 1.0 / (24 * 3600));
235 return day; 247 return day;
236 } 248 }
237 } 249 }