Authored by chenchao

seller see in-stock only in flea market client

... ... @@ -2,13 +2,12 @@ package com.yohoufo.order.controller;
import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo;
import com.yohobuy.ufo.model.order.common.SkupListType;
import com.yohobuy.ufo.model.order.req.SingleGoodsChangePriceReq;
import com.yohobuy.ufo.model.order.req.SellerGoodsRequest;
import com.yohobuy.ufo.model.order.req.SingleGoodsChangePriceReq;
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
import com.yohobuy.ufo.model.order.resp.PageResp;
import com.yohobuy.ufo.model.order.resp.SellerGoodsPageResp;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.exception.GatewayException;
import com.yohoufo.order.model.request.OrderListRequest;
import com.yohoufo.order.model.request.SellerGoodsListRequest;
import com.yohoufo.order.model.response.OrderSubmitResp;
... ...
... ... @@ -112,13 +112,15 @@ public class SellerOrderViewService {
Integer cnt = orderCacheService.getOrderSummary(uid, TabType.SELL, businessClient);
if (cnt == null) {
final BusinessClientEnum bce = OrderAssist.findBusinessClient(businessClient);
//set number of seller goods
int num = getSellerGoodsNumOfInSale(uid, bce);
//set number of buyer order related seller goods
List<Integer> orderTypes = OrderAssist.matchOrderTypesByBusinessClient4Seller(bce);
Integer num = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()), orderTypes);
List<SellerOrderListType> types = Arrays.asList(SellerOrderListType.SEND_OUT, SellerOrderListType.WAITING_PAY);
List<Integer> statusList = types.parallelStream().flatMap(solt -> solt.getStatus().parallelStream()).collect(Collectors.toList());
List<SellerOrderListType> orderListTypes = Arrays.asList(SellerOrderListType.SEND_OUT, SellerOrderListType.WAITING_PAY);
List<Integer> statusList = orderListTypes.parallelStream().flatMap(solt -> solt.getStatus().parallelStream()).collect(Collectors.toList());
Integer buyerOrderNum = buyerOrderMapper.selectCntBySellerUidStatus(uid, statusList, orderTypes);
logger.info("in seller order count uid {}, num {}, buyerOrderNum {}", uid, num, buyerOrderNum);
if (num == null) {
if (num == 0) {
cnt = 0;
} else {
if (buyerOrderNum != null) {
... ... @@ -135,19 +137,26 @@ public class SellerOrderViewService {
return new OrderSummaryResp("sell", cnt);
}
private int getSellerGoodsNumOfInSale(int uid, final BusinessClientEnum bce){
List<Integer> sellerGoodsTypes = OrderAssist.matchSellerGoodsTypes(bce);
int num = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()), sellerGoodsTypes);
return num;
}
public List<OrderSummaryResp> getOrderCntListByUid(int uid, String businessClient) {
final BusinessClientEnum bce = OrderAssist.findBusinessClient(businessClient);
//fetch from cache
List<OrderSummaryResp> list = orderCacheService.getSellerSaleGoodsTabSummary(uid, bce);
final String actor = TabType.SELL.getValue();
//not hit in cache
//not hit in cache, sourcing database
if (CollectionUtils.isEmpty(list)) {
List<Integer> orderTypes = OrderAssist.matchOrderTypesByBusinessClient4Seller(bce);
list = new ArrayList<>(8);
SellerOrderListType insale = SellerOrderListType.IN_SALE;
int num = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()), orderTypes);
int num = getSellerGoodsNumOfInSale(uid, bce);
OrderSummaryResp sellerGoodsSummary = new OrderSummaryResp(actor, insale.getType(), num);
list.add(sellerGoodsSummary);
//
List<Integer> orderTypes = OrderAssist.matchOrderTypesByBusinessClient4Seller(bce);
List<SellerOrderListType> types = Arrays.asList(SellerOrderListType.WAITING_PAY,
SellerOrderListType.SEND_OUT,
SellerOrderListType.ORDER_SUCCESS,
... ...
... ... @@ -64,7 +64,7 @@ public class SkupService {
*/
public int getCanSellSkupBySellerUid(Integer uid){
logger.info("in seller order getCanSellSkupBySellerUid count uid {} ", uid);
Integer total = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()), null);
int total = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()), null);
logger.info("in seller order getCanSellSkupBySellerUid count uid {}, total {} ", uid, total);
return total;
}
... ...
... ... @@ -129,6 +129,13 @@ public class OrderAssist {
}
return businessClientCode;
}
private static final List<Integer> FLEAMARKET_CLIENT_GOODSTYPES = new ArrayList<Integer>(){
{
add(SkupType.IN_STOCK.getCode());
}
};
private static final List<Integer> FLEAMARKET_CLIENT_ORDERTYPES = new ArrayList<Integer>(){
{
add(OrderAttributes.COMMON_IN_STOCK.getCode());
... ... @@ -150,6 +157,14 @@ public class OrderAssist {
return null;
}
public static List<Integer> matchSellerGoodsTypes(BusinessClientEnum businessClientEnum){
if (Objects.nonNull(businessClientEnum)
&& BusinessClientEnum.TAOBAO_FLEAMARKET_CLIENT.equals(businessClientEnum)){
return FLEAMARKET_CLIENT_GOODSTYPES;
}
return null;
}
public static String matchClientName(BusinessClientEnum businessClientEnum){
if (Objects.nonNull(businessClientEnum)
&& BusinessClientEnum.TAOBAO_FLEAMARKET_CLIENT.equals(businessClientEnum)){
... ...