...
|
...
|
@@ -5,6 +5,7 @@ import com.yohobuy.ufo.model.order.bo.ButtonShowBo; |
|
|
import com.yohobuy.ufo.model.order.bo.DepositDetailBo;
|
|
|
import com.yohobuy.ufo.model.order.bo.DepositProductBo;
|
|
|
import com.yohobuy.ufo.model.order.constants.DepositOrderStatusEnum;
|
|
|
import com.yohobuy.ufo.model.order.constants.DepositOutTypeEnum;
|
|
|
import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum;
|
|
|
import com.yohobuy.ufo.model.order.resp.PageResp;
|
|
|
import com.yohoufo.common.ApiResponse;
|
...
|
...
|
@@ -12,8 +13,10 @@ import com.yohoufo.common.cache.ControllerCacheAop; |
|
|
import com.yohoufo.common.caller.UfoServiceCaller;
|
|
|
import com.yohoufo.common.exception.UfoServiceException;
|
|
|
import com.yohoufo.common.helper.ImageUrlAssist;
|
|
|
import com.yohoufo.dal.order.BuyerOrderMapper;
|
|
|
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
|
|
|
import com.yohoufo.dal.order.StorageDepositMapper;
|
|
|
import com.yohoufo.dal.order.model.BuyerOrder;
|
|
|
import com.yohoufo.dal.order.model.SellerOrderGoods;
|
|
|
import com.yohoufo.dal.order.model.StorageDeposit;
|
|
|
import com.yohoufo.dal.order.model.StorageDepositCount;
|
...
|
...
|
@@ -51,6 +54,9 @@ public class DepositServiceImpl implements DepositService { |
|
|
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private BuyerOrderMapper buyerOrderMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private UfoServiceCaller ufoServiceCaller;
|
|
|
|
|
|
private static final int DEPOSIT_MAX_TIME = 45 * 24 * 60 * 60;
|
...
|
...
|
@@ -85,7 +91,7 @@ public class DepositServiceImpl implements DepositService { |
|
|
if (countInfo != null) {
|
|
|
bo.setSizeCount(countInfo.getStorageIdCount());
|
|
|
bo.setStorageCount(countInfo.getStorageCount());
|
|
|
bo.setShelfStatus(countInfo.getStorageIdCount() == 0 ? "全部已上架" : ("有" + countInfo.getStorageIdCount() + "件未上架"));
|
|
|
bo.setShelfStatus(countInfo.getUnShelfStorageCount() == 0 ? "全部已上架" : ("有" + countInfo.getUnShelfStorageCount() + "件未上架"));
|
|
|
}
|
|
|
result.add(bo);
|
|
|
}
|
...
|
...
|
@@ -106,6 +112,8 @@ public class DepositServiceImpl implements DepositService { |
|
|
}
|
|
|
// 召回或者到期退回的
|
|
|
List<StorageDeposit> depositList = storageDepositMapper.queryUserDopositBack(uid, (page - 1) * limit, limit);
|
|
|
List<BuyerOrder> buyerGoodsList = buyerOrderMapper.selectByOrderCodes(depositList.stream().map(StorageDeposit::getOrderCode).collect(Collectors.toList()), null);
|
|
|
Map<Long, BuyerOrder> buyerGoodsMap = buyerGoodsList.stream().map(Function.identity()).collect(Collectors.toMap(BuyerOrder::getOrderCode, Function.identity()));
|
|
|
List<Integer> skupList = depositList.stream().map(StorageDeposit::getSkup).collect(Collectors.toList());
|
|
|
List<SellerOrderGoods> goodsList = sellerOrderGoodsMapper.selectBySkups(skupList);
|
|
|
Map<Integer, SellerOrderGoods> goodsMap = goodsList.stream().map(Function.identity()).collect(Collectors.toMap(SellerOrderGoods::getId, Function.identity()));
|
...
|
...
|
@@ -119,7 +127,10 @@ public class DepositServiceImpl implements DepositService { |
|
|
bo.setColorName(goods.getColorName());
|
|
|
bo.setSizeName(goods.getSizeName());
|
|
|
bo.setPic(ImageUrlAssist.getAllProductPicUrl(goods.getImageUrl(), "goodsimg", "center", "d2hpdGU="));
|
|
|
bo.setPrice(goods.getGoodsPrice().toString());
|
|
|
BuyerOrder buyerOrder = buyerGoodsMap.get(buyerGoodsMap.get(depo.getOrderCode()));
|
|
|
if (buyerOrder != null) {
|
|
|
bo.setPrice(buyerOrder.getAmount().toString());
|
|
|
}
|
|
|
bo.setDepositStatusName(getBackStatusName(depo.getStatus()));
|
|
|
bo.setDepositCode(depo.getDepositCode());
|
|
|
}
|
...
|
...
|
@@ -166,7 +177,11 @@ public class DepositServiceImpl implements DepositService { |
|
|
bo.setFlashMinPrice(least == null ? "" : least.toString());
|
|
|
bo.setDepositCode(depo.getDepositCode());
|
|
|
}
|
|
|
bo.setButtons(Arrays.asList(ButtonShowBo.back(), /*ButtonShowBo.addDepositDays(),*/ depo.getOrderStatus() == 0 ? ButtonShowBo.grounding() : ButtonShowBo.detail("详情")));
|
|
|
if(depo.getOrderStatus() == 0) {
|
|
|
bo.setButtons(Arrays.asList(ButtonShowBo.back(), /*ButtonShowBo.addDepositDays(),*/ depo.getOrderStatus() == 0 ? ButtonShowBo.grounding() : ButtonShowBo.detail("详情")));
|
|
|
} else {
|
|
|
bo.setButtons(Arrays.asList(/*ButtonShowBo.addDepositDays(),*/ depo.getOrderStatus() == 0 ? ButtonShowBo.grounding() : ButtonShowBo.detail("详情")));
|
|
|
}
|
|
|
result.add(bo);
|
|
|
}
|
|
|
PageResp resp = new PageResp();
|
...
|
...
|
@@ -312,11 +327,13 @@ public class DepositServiceImpl implements DepositService { |
|
|
public int changeStorageStatus(String depositCode, int status, int orderStatus, int uid) {
|
|
|
try {
|
|
|
ufoServiceCaller.call("ufo.deposit.clearOrderCache", uid, depositCode); // 清理库存详情缓存
|
|
|
|
|
|
ufoServiceCaller.call("ufo.deposit.clearUserDeposit", uid, depositCode); // 清理库存列表缓存
|
|
|
} catch (Exception e) {
|
|
|
LOGGER.warn("clearOrderCache execute wrong, depositCode is {}", depositCode);
|
|
|
}
|
|
|
|
|
|
return storageDepositMapper.updateStorageStatus(depositCode, status, orderStatus);
|
|
|
return storageDepositMapper.updateStorageStatus(depositCode, status, orderStatus, DepositOutTypeEnum.OUTTYPE_FLASH_PURCHASE.getCode());
|
|
|
}
|
|
|
|
|
|
public void clearCache(Integer uid, Integer productId, Integer storageId) {
|
...
|
...
|
@@ -347,6 +364,28 @@ public class DepositServiceImpl implements DepositService { |
|
|
}
|
|
|
}
|
|
|
|
|
|
public void clearCacheByDepositCode(Integer uid, String depositCode) {
|
|
|
if (uid == null) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
StorageDeposit storageDeposit = storageDepositMapper.queryByDepositCode(uid, depositCode);
|
|
|
if (null == storageDeposit) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
clearCache(uid, storageDeposit.getProductId(), storageDeposit.getStorageId());
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据货号查询库存
|
|
|
* @param depositCode
|
|
|
* @return
|
|
|
*/
|
|
|
public StorageDeposit selectStorageDeposit(Integer uid, String depositCode) {
|
|
|
return storageDepositMapper.queryByDepositCode(uid, depositCode);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Do 转 Vo
|
|
|
* @param storageDeposit
|
...
|
...
|
|