...
|
...
|
@@ -2,13 +2,21 @@ package com.yohoufo.order.service.impl; |
|
|
|
|
|
import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
|
|
|
import com.yohobuy.ufo.model.order.bo.PrdPrice;
|
|
|
import com.yohobuy.ufo.model.order.common.ButtonShow;
|
|
|
import com.yohobuy.ufo.model.order.common.SellerType;
|
|
|
import com.yohobuy.ufo.model.order.common.SkupStatus;
|
|
|
import com.yohobuy.ufo.model.order.common.*;
|
|
|
import com.yohobuy.ufo.model.order.resp.OrderCntResp;
|
|
|
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
|
|
|
import com.yohobuy.ufo.model.order.resp.PageResp;
|
|
|
import com.yohobuy.ufo.model.response.StorageDataResp;
|
|
|
import com.yohoufo.common.utils.BigDecimalHelper;
|
|
|
import com.yohoufo.dal.order.BuyerOrderMapper;
|
|
|
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
|
|
|
import com.yohoufo.order.common.ActionStatusHold;
|
|
|
import com.yohoufo.order.common.Payment;
|
|
|
import com.yohoufo.order.constants.ViewType;
|
|
|
import com.yohoufo.order.model.request.OrderListRequest;
|
|
|
import com.yohoufo.order.model.request.OrderRequest;
|
|
|
import com.yohoufo.order.model.response.OrderSummaryResp;
|
|
|
import com.yohoufo.order.service.cache.OrderCacheService;
|
|
|
import com.yohoufo.order.service.proxy.ProductProxyService;
|
|
|
import com.yohoufo.order.utils.LoggerUtils;
|
|
|
import com.yohoufo.order.utils.MsgHelper;
|
...
|
...
|
@@ -21,6 +29,7 @@ import java.math.BigDecimal; |
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* Created by chao.chen on 2018/11/26.
|
...
|
...
|
@@ -32,6 +41,15 @@ public class SellerOrderViewService { |
|
|
@Autowired
|
|
|
ProductProxyService productProxyService;
|
|
|
|
|
|
@Autowired
|
|
|
private BuyerOrderMapper buyerOrderMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private OrderCacheService orderCacheService;
|
|
|
|
|
|
@Autowired
|
|
|
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
|
|
|
|
|
|
List<Integer> SHOW_OVER_FLOW_PRICE_STATUS = Arrays.asList(SkupStatus.CAN_SELL.getCode());
|
|
|
|
|
|
public boolean showOverFlowPrice(int skupStatus){
|
...
|
...
|
@@ -94,6 +112,65 @@ public class SellerOrderViewService { |
|
|
return prdPrice;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 商家未完成订单数量
|
|
|
*/
|
|
|
public int getUnfinishedOrderBySellerUid(Integer uid){
|
|
|
logger.info("in seller order getUnfinishedOrderBySellerUid count uid {} ", uid);
|
|
|
List<Integer> statusList = ActionStatusHold.getUnfinishedOrderStatusCode();
|
|
|
Integer total = buyerOrderMapper.selectCntBySellerUidStatus(uid, statusList);
|
|
|
logger.info("in seller order getUnfinishedOrderBySellerUid count uid {}, total {} ", uid, total);
|
|
|
return total;
|
|
|
}
|
|
|
/**
|
|
|
* 根据用户id查询卖的单数
|
|
|
* 出售栏目显示的数量=出售tab下商品“出售中”状态的数量+待发货tab下所有的订单数+已发货tab下所有订单数
|
|
|
* @param uid
|
|
|
* @return
|
|
|
*/
|
|
|
public OrderSummaryResp selectOrderNumByUid(int uid) {
|
|
|
|
|
|
Integer cnt = orderCacheService.getOrderSummary(uid, TabType.SELL);
|
|
|
if (cnt == null) {
|
|
|
//todo add cache
|
|
|
Integer num = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()));
|
|
|
List<SellerOrderListType> types = Arrays.asList(SellerOrderListType.WAITING_SEND, SellerOrderListType.WAITING_PAY);
|
|
|
List<Integer> statusList = types.parallelStream().flatMap(solt -> solt.getStatus().parallelStream()).collect(Collectors.toList());
|
|
|
Integer buyerOrderNum = buyerOrderMapper.selectCntBySellerUid(uid, statusList);
|
|
|
logger.info("in seller order count uid {}, num {}, buyerOrderNum {}", uid, num, buyerOrderNum);
|
|
|
if (num == null) {
|
|
|
cnt = 0;
|
|
|
} else {
|
|
|
if (buyerOrderNum != null) {
|
|
|
cnt = num + buyerOrderNum;
|
|
|
} else {
|
|
|
cnt = num;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (cnt != null){
|
|
|
orderCacheService.cacheOrderSummary(uid, TabType.SELL, cnt);
|
|
|
}
|
|
|
return new OrderSummaryResp("sell", cnt);
|
|
|
}
|
|
|
|
|
|
public OrderCntResp getOrderCnt(OrderRequest orderRequest, SellerOrderListType listType){
|
|
|
logger.info("in seller getOrderCnt req {} listType {}", orderRequest, listType);
|
|
|
int cnt ;
|
|
|
switch (listType){
|
|
|
case ALL:
|
|
|
cnt = sellerOrderGoodsMapper.selectCntByUid(orderRequest.getUid());
|
|
|
break;
|
|
|
default:
|
|
|
cnt = 0;
|
|
|
break;
|
|
|
}
|
|
|
return OrderCntResp.builder().cnt(cnt).uid(orderRequest.getUid())
|
|
|
.actor(orderRequest.getTabType()).build();
|
|
|
}
|
|
|
|
|
|
String buildLeastPriceTips(BigDecimal leastPrice){
|
|
|
return "该尺码最低售价¥" + BigDecimalHelper.formatNumber(leastPrice, BigDecimalHelper.FORMAT_NOPOINT);
|
|
|
}
|
...
|
...
|
|