Authored by mali

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

... ... @@ -277,14 +277,14 @@
select count(distinct product_id) from storage_deposit
where owner_uid = #{uid} and status=1 and del_status=0
</select>
<select id="queryUserDepositProductId" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
<select id="queryUserDepositProductId" resultType="java.lang.Integer">
select distinct product_id from storage_deposit
where owner_uid = #{uid} and status=1 and del_status=0 limit #{start}, #{count}
</select>
<select id="queryUserDepositProduct" resultMap="CountResultMap">
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
where owner_uid = #{uid} and status=1 and del_status=0 limit #{start}, #{count}
where owner_uid = #{uid} and status=1 and del_status=0
and product_id in
<foreach item="item" index="index" collection="productIdList" open="(" separator="," close=")">
#{item}
... ...
package com.yohoufo.order.controller;
import com.alibaba.fastjson.JSONObject;
import com.yohobuy.ufo.model.order.bo.DepositDetailBo;
import com.yohobuy.ufo.model.order.bo.DepositProductBo;
import com.yohoufo.common.ApiResponse;
... ... @@ -67,7 +68,11 @@ public class DepositController {
}
List<DepositDetailBo> depositDetailBoList = depositService.queryUserProductDopositingDetail(uid, productId, page, limit);
LOG.info("queryUserDopositing result: {}", depositDetailBoList);
return new ApiResponse.ApiResponseBuilder().code(200).data(depositDetailBoList).build();
DepositProductBo countBo = depositService.queryUserDepositProductCountInfo(uid, productId);
JSONObject result = new JSONObject();
result.put("product", countBo);
result.put("items", depositDetailBoList);
LOG.info("queryUserDopositing result: {}", result);
return new ApiResponse.ApiResponseBuilder().code(200).data(result).build();
}
}
... ...
... ... @@ -18,10 +18,17 @@ public interface DepositService {
List<DepositDetailBo> queryUserProductDopositingDetail(Integer uid, Integer productId, Integer page, Integer limit);
DepositProductBo queryUserDepositProductCountInfo(Integer uid, Integer productId);
// 上架
boolean changeSaleStatusOn(Integer uid, String depositCode, Integer skup);
// 下架
boolean changeSaleStatusOff(Integer uid, Integer skup);
// 转卖
boolean changeOwner(Integer uid, Integer skup, long buyOrderCode, Integer newUid);
// 可上架数量
int getDepositOffShelvesCount(Integer uid, Integer storageId);
// 剩余存储天数
int getRemainDay(Integer uid, String depositCode);
int changeStorageStatus(String depositCode, int status);
... ...
... ... @@ -73,7 +73,7 @@ public class DepositServiceImpl implements DepositService {
}
result.add(bo);
}
return null;
return result;
}
@Override
... ... @@ -141,6 +141,25 @@ public class DepositServiceImpl implements DepositService {
return result;
}
public DepositProductBo queryUserDepositProductCountInfo(Integer uid, Integer productId) {
List<StorageDepositCount> countInfoList = storageDepositMapper.queryUserDepositProduct(uid, Arrays.asList(productId));
if (countInfoList.isEmpty()) {
return null;
}
StorageDepositCount countInfo = countInfoList.get(0);
DepositProductBo bo = new DepositProductBo();
SellerOrderGoods goods = sellerOrderGoodsMapper.selectByPrimaryKey(countInfo.getSkup());
bo.setProductId(productId);
if (goods != null) {
bo.setProductName(goods.getProductName());
bo.setColorName(goods.getColorName());
bo.setPic(goods.getImageUrl());
}
bo.setSizeCount(countInfo.getStorageIdCount());
bo.setStorageCount(countInfo.getStorageCount());
return bo;
}
// 上架
@Override
... ... @@ -224,14 +243,7 @@ public class DepositServiceImpl implements DepositService {
private int getRemainDay(Integer endTime) {
int second = endTime - (int) (System.currentTimeMillis() / 1000);
int day = second / (24 * 3600);
if (second % day != 0) {
if (day > 0) {
day += 1;
} else {
day -= 1;
}
}
int day = (int) Math.ceil(second * 1.0 / (24 * 3600));
return day;
}
}
... ...