Authored by chenchao

filter in-stock of seller order goods num

... ... @@ -46,7 +46,9 @@ public interface SellerOrderGoodsMapper {
*/
int selectCntByUidStatusGBBNList(@Param("uid")int uid, @Param("statusList") List<Integer> statusList);
int selectCntByUidStatusList(@Param("uid")int uid, @Param("statusList") List<Integer> statusList);
int selectCntByUidStatusList(@Param("uid")int uid,
@Param("statusList") List<Integer> statusList,
@Param("orderTypes")List<Integer> orderTypes);
FastDeliveryGetShelfDetailResp selectMultiInfoBySkup(@Param("uid")int uid,
... ...
... ... @@ -144,10 +144,17 @@
#{status, jdbcType=TINYINT}
</foreach>
</if>
<if test="orderTypes != null">
and attributes in
<foreach collection="orderTypes" item="attributes" open="(" close=")" separator=",">
#{attributes}
</foreach>
</if>
</sql>
<select id="selectCntByUidStatusList" resultType="java.lang.Integer">
select count(*) from seller_order_goods where <include refid="sql_where_4_select_UidStatusList"/>
select count(*) from seller_order_goods where
<include refid="sql_where_4_select_UidStatusList"/>
</select>
<select id="selectCntByUid" resultType="java.lang.Integer">
... ...
... ... @@ -111,8 +111,9 @@ public class SellerOrderViewService {
Integer cnt = orderCacheService.getOrderSummary(uid, TabType.SELL, businessClient);
if (cnt == null) {
Integer num = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()));
final BusinessClientEnum bce = OrderAssist.findBusinessClient(businessClient);
List<Integer> orderTypes = OrderAssist.matchOrderTypesByBusinessClient(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());
Integer buyerOrderNum = buyerOrderMapper.selectCntBySellerUid(uid, statusList);
... ... @@ -140,9 +141,10 @@ public class SellerOrderViewService {
final String actor = TabType.SELL.getValue();
//not hit in cache
if (CollectionUtils.isEmpty(list)) {
List<Integer> orderTypes = OrderAssist.matchOrderTypesByBusinessClient(bce);
list = new ArrayList<>(8);
SellerOrderListType insale = SellerOrderListType.IN_SALE;
int num = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()));
int num = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()), orderTypes);
OrderSummaryResp sellerGoodsSummary = new OrderSummaryResp(actor, insale.getType(), num);
list.add(sellerGoodsSummary);
//
... ...
... ... @@ -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()));
Integer total = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()), null);
logger.info("in seller order getCanSellSkupBySellerUid count uid {}, total {} ", uid, total);
return total;
}
... ...