Authored by chenchao

all get cnt

... ... @@ -50,7 +50,7 @@ public interface BuyerOrderMapper {
BuyerOrder selectAllByOrderCode(@Param("orderCode") Long orderCode);
int selectCntByUid(@Param("uid")int uid);
int selectCntBySellerUid(@Param("sellerUid")int sellerUid, @Param("statusList")Collection<Integer> statusList);
}
\ No newline at end of file
... ...
... ... @@ -29,6 +29,7 @@ public interface SellerOrderGoodsMapper {
@Param("offset")Integer offset,
@Param("limit")Integer limit);
int selectCntByUid(@Param("uid")int uid);
int updateStatusBySkpu(SellerOrderGoods record);
... ...
... ... @@ -32,7 +32,9 @@
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectCntByUid" resultType="java.lang.Integer">
select count(*) from buyer_order where uid = #{uid,jdbcType=INTEGER}
</select>
<select id="selectCntByUidStatus" resultType="java.lang.Integer">
select count(*) from buyer_order
... ...
... ... @@ -70,6 +70,11 @@
select count(*) from seller_order_goods where <include refid="sql_where_4_select_UidStatusList"/>
</select>
<select id="selectCntByUid" resultType="java.lang.Integer">
select count(*) from seller_order_goods where uid = #{uid,jdbcType=INTEGER}
</select>
<select id="selectByUidStatusList" resultMap="BaseResultMap">
select <include refid="Base_Column_List" /> from seller_order_goods
where <include refid="sql_where_4_select_UidStatusList"/>
... ...
package com.yohoufo.order.controller;
import com.google.common.collect.Lists;
import com.yohobuy.ufo.model.order.common.OrderListType;
import com.yohobuy.ufo.model.order.common.SellerOrderListType;
import com.yohobuy.ufo.model.order.resp.OrderCntResp;
import com.yohobuy.ufo.model.order.resp.PageResp;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
... ... @@ -9,6 +13,7 @@ import com.yohoufo.order.model.request.OrderListRequest;
import com.yohoufo.order.model.request.OrderRequest;
import com.yohoufo.order.model.response.OrderDetailInfo;
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
import com.yohoufo.order.model.response.OrderSummaryResp;
import com.yohoufo.order.service.IBuyerOrderService;
import com.yohoufo.order.service.impl.SellerFeeService;
import com.yohoufo.order.service.impl.SellerOrderService;
... ... @@ -205,4 +210,33 @@ public class BuyerOrderController {
return new ApiResponse.ApiResponseBuilder().data(data).code(200).message("成功").build();
}
@RequestMapping(params = "method=ufo.order.getAllCnt")
public ApiResponse submit(@RequestParam(name = "uid") int uid,
@RequestParam("tabType") String tabType,
@RequestParam(name = "client_type", required = false) String clientType){
LOG.info("in ufo.order.getAllCnt, uid {}, clientType is {}", uid, clientType);
TabType actor = TabType.getTabType(tabType);
if (Objects.isNull(actor)){
return new ApiResponse.ApiResponseBuilder().code(400).message("非法的tab").build();
}
OrderRequest orderRequest = OrderRequest.builder()
.uid(uid)
.tabType(tabType)
.actor(actor)
.build();
OrderCntResp orderCntResp;
switch (actor){
case BUY:
orderCntResp = buyerOrderService.getOrderCnt(orderRequest, OrderListType.ALL);
break;
case SELL:
orderCntResp = sellerOrderService.getOrderCnt(orderRequest, SellerOrderListType.ALL);
break;
default:
orderCntResp = OrderCntResp.builder().uid(uid).cnt(0L).actor(tabType).build();
}
return new ApiResponse.ApiResponseBuilder().code(200).data(orderCntResp).message("查询订单数量").build();
}
}
... ...
package com.yohoufo.order.service;
import com.yohobuy.ufo.model.order.common.OrderListType;
import com.yohobuy.ufo.model.order.resp.OrderCntResp;
import com.yohoufo.order.model.request.OrderRequest;
import com.yohoufo.order.model.response.OrderSummaryResp;
... ... @@ -35,4 +37,6 @@ public interface IBuyerOrderService extends IOrderListService, IOrderDetailServi
void confirmReceive(long orderCode);
OrderCntResp getOrderCnt(OrderRequest req, OrderListType listType);
}
... ...
... ... @@ -2,16 +2,17 @@ package com.yohoufo.order.service.impl;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.common.OrderListType;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.common.SkupStatus;
import com.yohobuy.ufo.model.order.common.TabType;
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.order.vo.OrderListVo;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
import com.yohoufo.dal.order.BuyerOrderMapper;
import com.yohoufo.dal.order.BuyerOrderMetaMapper;
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohoufo.dal.order.model.BuyerOrderGoods;
... ... @@ -45,7 +46,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
@Autowired
BuyerOrderMapper buyerOrderMapper;
@Autowired
BuyerOrderGoodsMapper buyerOrderGoodsMapper;
... ... @@ -53,9 +53,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
SellerOrderGoodsMapper sellerOrderGoodsMapper;
@Autowired
BuyerOrderMetaMapper buyerOrderMetaMapper;
@Autowired
private BuyerOrderListServiceImpl buyerOrderListService;
@Autowired
... ... @@ -321,7 +318,22 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode),
CacheKeyBuilder.orderDetailKey(uid, TabType.BUY.getValue(), orderCode)));
}
}
@Override
public OrderCntResp getOrderCnt(OrderRequest req, OrderListType listType) {
logger.info("in buyer getOrderCnt req {} listType {}", req, listType);
OrderCntResp resp;
int cnt ;
switch (listType){
case ALL:
cnt = buyerOrderMapper.selectCntByUid(req.getUid());
break;
default:
cnt = 0;
break;
}
resp = OrderCntResp.builder().uid(req.getUid()).cnt(cnt).actor(req.getTabType()).build();
return resp;
}
}
... ...
... ... @@ -7,6 +7,7 @@ import com.yohobuy.ufo.model.order.common.*;
import com.yohobuy.ufo.model.order.req.SellerOrderCancelReq;
import com.yohobuy.ufo.model.order.req.SellerOrderComputeReq;
import com.yohobuy.ufo.model.order.req.SellerOrderSubmitReq;
import com.yohobuy.ufo.model.order.resp.OrderCntResp;
import com.yohobuy.ufo.model.order.resp.PageResp;
import com.yohoufo.common.alarm.EventBusPublisher;
import com.yohoufo.common.alarm.SmsAlarmEvent;
... ... @@ -531,5 +532,19 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
return new OrderSummaryResp("sell", cnt);
}
public OrderCntResp getOrderCnt(OrderRequest orderRequest, SellerOrderListType listType){
log.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();
}
}
... ...