Authored by TANLING

极速

@@ -71,6 +71,14 @@ public interface SellerOrderGoodsMapper { @@ -71,6 +71,14 @@ public interface SellerOrderGoodsMapper {
71 71
72 int selectCntByUid(@Param("uid")int uid); 72 int selectCntByUid(@Param("uid")int uid);
73 73
  74 +
  75 + int selectCntByUidAndAttr(@Param("uid")int uid, @Param("attributes") int attributes);
  76 +
  77 + List<SellerOrderGoods> selectByUidAndAttr(@Param("uid")int uid,
  78 + @Param("attributes") int attributes,
  79 + @Param("offset")Integer offset,
  80 + @Param("limit")Integer limit);
  81 +
74 int updateStatusBySkpu(SellerOrderGoods record); 82 int updateStatusBySkpu(SellerOrderGoods record);
75 83
76 int updateStatusAndUidBySkpu(SellerOrderGoods record); 84 int updateStatusAndUidBySkpu(SellerOrderGoods record);
@@ -162,6 +162,18 @@ @@ -162,6 +162,18 @@
162 </select> 162 </select>
163 163
164 164
  165 + <select id="selectCntByUidAndAttr" resultType="java.lang.Integer">
  166 + select count(*) from seller_order_goods where uid = #{uid,jdbcType=INTEGER} and attributes = #{attributes,jdbcType=INTEGER}
  167 + </select>
  168 +
  169 +
  170 + <select id="selectByUidAndAttr" resultMap="BaseResultMap">
  171 + select <include refid="Base_Column_List" /> from seller_order_goods
  172 + where uid = #{uid,jdbcType=INTEGER} and attributes = #{attributes,jdbcType=INTEGER}
  173 + order by id desc
  174 + limit #{offset, jdbcType=INTEGER}, #{limit, jdbcType=INTEGER}
  175 + </select>
  176 +
165 177
166 <select id="selectMultiInfoBySkup" resultType="com.yohobuy.ufo.model.order.resp.FastDeliveryGetShelfDetailResp"> 178 <select id="selectMultiInfoBySkup" resultType="com.yohobuy.ufo.model.order.resp.FastDeliveryGetShelfDetailResp">
167 select 179 select
@@ -4,6 +4,7 @@ import com.google.common.base.Throwables; @@ -4,6 +4,7 @@ import com.google.common.base.Throwables;
4 import com.yohobuy.ufo.model.order.req.*; 4 import com.yohobuy.ufo.model.order.req.*;
5 import com.yohobuy.ufo.model.order.resp.FastDeliveryBatchOnShelfResp; 5 import com.yohobuy.ufo.model.order.resp.FastDeliveryBatchOnShelfResp;
6 import com.yohobuy.ufo.model.order.resp.FastDeliveryGetShelfDetailResp; 6 import com.yohobuy.ufo.model.order.resp.FastDeliveryGetShelfDetailResp;
  7 +import com.yohobuy.ufo.model.order.vo.OrderGoodsListVo;
7 import com.yohobuy.ufo.model.response.StorageCheckResp; 8 import com.yohobuy.ufo.model.response.StorageCheckResp;
8 import com.yohobuy.ufo.model.response.StorageInfoResp; 9 import com.yohobuy.ufo.model.response.StorageInfoResp;
9 import com.yohoufo.common.ApiResponse; 10 import com.yohoufo.common.ApiResponse;
@@ -156,4 +157,23 @@ public class ErpFastDeliveryController { @@ -156,4 +157,23 @@ public class ErpFastDeliveryController {
156 return new ApiResponse.ApiResponseBuilder().data(data).code(200).build(); 157 return new ApiResponse.ApiResponseBuilder().data(data).code(200).build();
157 158
158 } 159 }
  160 +
  161 +
  162 + /**
  163 + * 查询极速商品
  164 + * @param req
  165 + * @return
  166 + */
  167 + @IgnoreSignature
  168 + @IgnoreSession
  169 + @RequestMapping("/getOrderGoodsList")
  170 + public ApiResponse getOrderGoodsList(@RequestBody FastDeliveryGetShelfReq req){
  171 +
  172 + logger.info("getOrderGoodsList param {}", req);
  173 +
  174 + OrderGoodsListVo data = erpFastDeliveryService.getOrderGoodsList(req);
  175 +
  176 + return new ApiResponse.ApiResponseBuilder().data(data).code(200).build();
  177 +
  178 + }
159 } 179 }
@@ -3,6 +3,7 @@ package com.yohoufo.order.service; @@ -3,6 +3,7 @@ package com.yohoufo.order.service;
3 import com.yohobuy.ufo.model.order.req.*; 3 import com.yohobuy.ufo.model.order.req.*;
4 import com.yohobuy.ufo.model.order.resp.FastDeliveryBatchOnShelfResp; 4 import com.yohobuy.ufo.model.order.resp.FastDeliveryBatchOnShelfResp;
5 import com.yohobuy.ufo.model.order.resp.FastDeliveryGetShelfDetailResp; 5 import com.yohobuy.ufo.model.order.resp.FastDeliveryGetShelfDetailResp;
  6 +import com.yohobuy.ufo.model.order.vo.OrderGoodsListVo;
6 import com.yohobuy.ufo.model.response.StorageCheckResp; 7 import com.yohobuy.ufo.model.response.StorageCheckResp;
7 import com.yohobuy.ufo.model.response.StorageInfoResp; 8 import com.yohobuy.ufo.model.response.StorageInfoResp;
8 9
@@ -50,4 +51,7 @@ public interface IErpFastDeliveryService { @@ -50,4 +51,7 @@ public interface IErpFastDeliveryService {
50 * @return 51 * @return
51 */ 52 */
52 public List<StorageCheckResp> getStorageInfo(FastDeliveryBatchOnShelfReq req); 53 public List<StorageCheckResp> getStorageInfo(FastDeliveryBatchOnShelfReq req);
  54 +
  55 +
  56 + public OrderGoodsListVo getOrderGoodsList(FastDeliveryGetShelfReq request);
53 } 57 }
@@ -6,6 +6,7 @@ import com.google.common.collect.Lists; @@ -6,6 +6,7 @@ import com.google.common.collect.Lists;
6 import com.yohobuy.ufo.model.ProductInfo; 6 import com.yohobuy.ufo.model.ProductInfo;
7 import com.yohobuy.ufo.model.enums.StorageCheckEnum; 7 import com.yohobuy.ufo.model.enums.StorageCheckEnum;
8 import com.yohobuy.ufo.model.order.bo.SellerBo; 8 import com.yohobuy.ufo.model.order.bo.SellerBo;
  9 +import com.yohobuy.ufo.model.order.common.OrderAttributes;
9 import com.yohobuy.ufo.model.order.common.OrderStatus; 10 import com.yohobuy.ufo.model.order.common.OrderStatus;
10 import com.yohobuy.ufo.model.order.common.SellerFuncEnum; 11 import com.yohobuy.ufo.model.order.common.SellerFuncEnum;
11 import com.yohobuy.ufo.model.order.common.SkupStatus; 12 import com.yohobuy.ufo.model.order.common.SkupStatus;
@@ -13,6 +14,8 @@ import com.yohobuy.ufo.model.order.constants.SkupType; @@ -13,6 +14,8 @@ import com.yohobuy.ufo.model.order.constants.SkupType;
13 import com.yohobuy.ufo.model.order.req.*; 14 import com.yohobuy.ufo.model.order.req.*;
14 import com.yohobuy.ufo.model.order.resp.*; 15 import com.yohobuy.ufo.model.order.resp.*;
15 import com.yohobuy.ufo.model.order.vo.AddressInfo; 16 import com.yohobuy.ufo.model.order.vo.AddressInfo;
  17 +import com.yohobuy.ufo.model.order.vo.OrderGoodsInfo;
  18 +import com.yohobuy.ufo.model.order.vo.OrderGoodsListVo;
16 import com.yohobuy.ufo.model.request.product.ProductImportTranItemBo; 19 import com.yohobuy.ufo.model.request.product.ProductImportTranItemBo;
17 import com.yohobuy.ufo.model.request.product.ProductRequestBo; 20 import com.yohobuy.ufo.model.request.product.ProductRequestBo;
18 import com.yohobuy.ufo.model.response.ProductDetailResp; 21 import com.yohobuy.ufo.model.response.ProductDetailResp;
@@ -25,6 +28,7 @@ import com.yohoufo.dal.order.model.*; @@ -25,6 +28,7 @@ import com.yohoufo.dal.order.model.*;
25 import com.yohoufo.order.common.BillTradeStatus; 28 import com.yohoufo.order.common.BillTradeStatus;
26 import com.yohoufo.order.common.TradeType; 29 import com.yohoufo.order.common.TradeType;
27 import com.yohoufo.order.model.dto.*; 30 import com.yohoufo.order.model.dto.*;
  31 +import com.yohoufo.order.model.request.OrderListRequest;
28 import com.yohoufo.order.service.IErpFastDeliveryService; 32 import com.yohoufo.order.service.IErpFastDeliveryService;
29 import com.yohoufo.order.service.handler.SellerDecrPriceTaskHandler; 33 import com.yohoufo.order.service.handler.SellerDecrPriceTaskHandler;
30 import com.yohoufo.order.service.handler.SellerDownShelfTaskHandler; 34 import com.yohoufo.order.service.handler.SellerDownShelfTaskHandler;
@@ -44,6 +48,7 @@ import org.apache.commons.collections.CollectionUtils; @@ -44,6 +48,7 @@ import org.apache.commons.collections.CollectionUtils;
44 import org.apache.commons.lang.StringUtils; 48 import org.apache.commons.lang.StringUtils;
45 import org.slf4j.Logger; 49 import org.slf4j.Logger;
46 import org.slf4j.LoggerFactory; 50 import org.slf4j.LoggerFactory;
  51 +import org.springframework.beans.BeanUtils;
47 import org.springframework.beans.factory.annotation.Autowired; 52 import org.springframework.beans.factory.annotation.Autowired;
48 import org.springframework.stereotype.Service; 53 import org.springframework.stereotype.Service;
49 54
@@ -93,8 +98,6 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService { @@ -93,8 +98,6 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService {
93 @Autowired 98 @Autowired
94 PriceComputePrepareProcessor priceComputePrepareProcessor; 99 PriceComputePrepareProcessor priceComputePrepareProcessor;
95 100
96 - @Autowired  
97 - private SellerOrderGoodsMapper sellerOrderGoodsMapper;  
98 101
99 @Autowired 102 @Autowired
100 private BuyerOrderMapper buyerOrderMapper; 103 private BuyerOrderMapper buyerOrderMapper;
@@ -106,6 +109,9 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService { @@ -106,6 +109,9 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService {
106 private OrdersPayTransferMapper ordersPayTransferMapper; 109 private OrdersPayTransferMapper ordersPayTransferMapper;
107 110
108 @Autowired 111 @Autowired
  112 + SellerOrderGoodsMapper sellerOrderGoodsMapper;
  113 +
  114 + @Autowired
109 private TradeBillsMapper tradeBillsMapper; 115 private TradeBillsMapper tradeBillsMapper;
110 116
111 private static final String ADDRESS_STR = "{\"address\":\"松金公路2758号sneakerburger仓储中心\",\"address_id\":17560803,\"area\":\"上海 金山区 张堰镇\",\"areaCode\":\"310116103\",\"consignee\":\"阿津\",\"isUpdate\":\"N\",\"mobile\":\"18121153590\",\"phone\":\"\",\"zipCode\":\"\"}"; 117 private static final String ADDRESS_STR = "{\"address\":\"松金公路2758号sneakerburger仓储中心\",\"address_id\":17560803,\"area\":\"上海 金山区 张堰镇\",\"areaCode\":\"310116103\",\"consignee\":\"阿津\",\"isUpdate\":\"N\",\"mobile\":\"18121153590\",\"phone\":\"\",\"zipCode\":\"\"}";
@@ -136,6 +142,51 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService { @@ -136,6 +142,51 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService {
136 142
137 143
138 /** 144 /**
  145 + * 查询极速商品
  146 + * @param request
  147 + * @return
  148 + */
  149 + public OrderGoodsListVo getOrderGoodsList(FastDeliveryGetShelfReq request){
  150 +
  151 + if (request.getUid() < 0){
  152 + logger.warn("uid is empty");
  153 + throw new UfoServiceException(400, "参数[uid]不合法");
  154 + }
  155 +
  156 + checkFastDeliveryAuth(request.getUid());
  157 +
  158 + request.setPage(request.getPage()<=0?1:request.getPage());
  159 + request.setLimit(request.getLimit()<=0?10:request.getLimit());
  160 +
  161 + int attr = OrderAttributes.FAST_DELIVERY.getCode();
  162 + int total = sellerOrderGoodsMapper.selectCntByUidAndAttr(request.getUid(), attr);
  163 +
  164 + if (total == 0){
  165 + return null;
  166 + }
  167 +
  168 + int offset = (request.getPage() - 1) * request.getLimit();
  169 + List<SellerOrderGoods> sellerOrderGoods = sellerOrderGoodsMapper.selectByUidAndAttr(request.getUid(), attr, offset, request.getLimit());
  170 +
  171 + List<OrderGoodsInfo> goodsInfoList = sellerOrderGoods.stream().map(this::covertTo).collect(Collectors.toList());
  172 +
  173 + return OrderGoodsListVo.builder()
  174 + .page(request.getPage())
  175 + .pageSize(request.getLimit())
  176 + .pagetotal(total)
  177 + .goodsInfoList(goodsInfoList)
  178 + .build();
  179 +
  180 + }
  181 +
  182 + public OrderGoodsInfo covertTo(SellerOrderGoods sellerOrderGoods){
  183 +
  184 + OrderGoodsInfo orderGoodsInfo = new OrderGoodsInfo();
  185 + BeanUtils.copyProperties(sellerOrderGoods, orderGoodsInfo);
  186 + orderGoodsInfo.setStatusDesc(SkupStatus.getSkupStatus(orderGoodsInfo.getStatus()).getDesc());
  187 + return orderGoodsInfo;
  188 + }
  189 + /**
139 * 查询上架商品的信息 190 * 查询上架商品的信息
140 * @param req 191 * @param req
141 */ 192 */