Authored by chenchao

continue implement

  1 +package com.yohoufo.order.controller;
  2 +
  3 +import com.google.common.collect.Lists;
  4 +import com.yohoufo.common.ApiResponse;
  5 +import com.yohoufo.order.model.response.OrderSummaryResp;
  6 +import com.yohoufo.order.service.IBuyerOrderService;
  7 +import com.yohoufo.order.service.IShoppingService;
  8 +import com.yohoufo.order.service.impl.SellerOrderViewService;
  9 +import com.yohoufo.order.utils.LoggerUtils;
  10 +import org.slf4j.Logger;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.web.bind.annotation.RequestMapping;
  13 +import org.springframework.web.bind.annotation.RequestParam;
  14 +import org.springframework.web.bind.annotation.RestController;
  15 +
  16 +import java.util.List;
  17 +
  18 +@RestController
  19 +public class OrderStatisticController {
  20 +
  21 + private Logger logger = LoggerUtils.getBuyerOrderLogger();
  22 +
  23 +
  24 + @Autowired
  25 + private SellerOrderViewService sellerOrderViewService;
  26 +
  27 + @Autowired
  28 + private IBuyerOrderService ibuyerOrderService;
  29 + /**
  30 + * 我的出售记录数,买入记录数
  31 + * 准备逐步弃用 from version 6.9.12
  32 + * @return
  33 + */
  34 + @Deprecated
  35 + @RequestMapping(value = "/shopping", params = "method=ufo.order.summary")
  36 + public ApiResponse summary(@RequestParam(name = "uid") int uid,
  37 + @RequestParam(name = "client_type", required = false) String clientType){
  38 +
  39 + logger.info("in ufo.order.summary, uid {}, clientType is {}", uid, clientType);
  40 +
  41 + OrderSummaryResp orderSummaryResp1 = sellerOrderViewService.selectOrderNumByUid(uid);
  42 +
  43 + OrderSummaryResp orderSummaryResp2 = ibuyerOrderService.selectOrderNumByUid(uid);
  44 +
  45 + return new ApiResponse.ApiResponseBuilder().code(200).data(Lists.newArrayList(orderSummaryResp1, orderSummaryResp2)).message("查询成功").build();
  46 + }
  47 +
  48 + @RequestMapping(params = "method=ufo.seller.orderSummary")
  49 + public ApiResponse sellerOrderSummary(@RequestParam(name = "uid") int uid,
  50 + @RequestParam(name = "client_type", required = false) String clientType){
  51 + logger.info("in ufo.seller.orderSummary, uid {}, clientType is {}", uid, clientType);
  52 + List<OrderSummaryResp> orderSummaryResps = sellerOrderViewService.getOrderCntListByUid(uid);
  53 + return new ApiResponse.ApiResponseBuilder().code(200).data(orderSummaryResps).message("查询成功").build();
  54 + }
  55 +
  56 +}
1 package com.yohoufo.order.controller; 1 package com.yohoufo.order.controller;
2 2
3 -import com.google.common.collect.Lists;  
4 import com.yohobuy.ufo.model.order.constants.OrderConstant; 3 import com.yohobuy.ufo.model.order.constants.OrderConstant;
5 import com.yohoufo.common.ApiResponse; 4 import com.yohoufo.common.ApiResponse;
6 -import com.yohoufo.order.constants.ActivityTypeEnum;  
7 import com.yohoufo.order.annotation.BlackUserType; 5 import com.yohoufo.order.annotation.BlackUserType;
8 import com.yohoufo.order.common.BlackTypeEnum; 6 import com.yohoufo.order.common.BlackTypeEnum;
  7 +import com.yohoufo.order.constants.ActivityTypeEnum;
9 import com.yohoufo.order.constants.CouponConstants; 8 import com.yohoufo.order.constants.CouponConstants;
10 import com.yohoufo.order.model.request.ShoppingRequest; 9 import com.yohoufo.order.model.request.ShoppingRequest;
11 import com.yohoufo.order.model.response.*; 10 import com.yohoufo.order.model.response.*;
12 -import com.yohoufo.order.service.IBuyerOrderService;  
13 import com.yohoufo.order.service.IShoppingService; 11 import com.yohoufo.order.service.IShoppingService;
14 -import com.yohoufo.order.service.impl.SellerOrderViewService;  
15 import com.yohoufo.order.utils.CouponCodeUtils; 12 import com.yohoufo.order.utils.CouponCodeUtils;
16 import com.yohoufo.order.utils.LoggerUtils; 13 import com.yohoufo.order.utils.LoggerUtils;
17 import org.apache.commons.lang3.StringUtils; 14 import org.apache.commons.lang3.StringUtils;
18 import org.slf4j.Logger; 15 import org.slf4j.Logger;
19 import org.springframework.beans.factory.annotation.Autowired; 16 import org.springframework.beans.factory.annotation.Autowired;
20 -import org.springframework.web.bind.annotation.*; 17 +import org.springframework.web.bind.annotation.RequestMapping;
  18 +import org.springframework.web.bind.annotation.RequestParam;
  19 +import org.springframework.web.bind.annotation.RestController;
21 20
22 @RestController 21 @RestController
23 @RequestMapping(value = "/shopping") 22 @RequestMapping(value = "/shopping")
@@ -27,15 +26,7 @@ public class ShoppingController { @@ -27,15 +26,7 @@ public class ShoppingController {
27 private Logger logger = LoggerUtils.getBuyerOrderLogger(); 26 private Logger logger = LoggerUtils.getBuyerOrderLogger();
28 27
29 @Autowired 28 @Autowired
30 - IShoppingService buyerOrderService;  
31 -  
32 -  
33 - @Autowired  
34 - private SellerOrderViewService sellerOrderViewService;  
35 -  
36 - @Autowired  
37 - IBuyerOrderService ibuyerOrderService;  
38 - 29 + private IShoppingService buyerOrderService;
39 30
40 /** 31 /**
41 * 结算 32 * 结算
@@ -170,22 +161,7 @@ public class ShoppingController { @@ -170,22 +161,7 @@ public class ShoppingController {
170 return new ApiResponse.ApiResponseBuilder().code(200).data(submitResponse).message("提交订单SUCCESS").build(); 161 return new ApiResponse.ApiResponseBuilder().code(200).data(submitResponse).message("提交订单SUCCESS").build();
171 } 162 }
172 163
173 - /**  
174 - * 我的出售记录数,买入记录数  
175 - * @return  
176 - */  
177 - @RequestMapping(params = "method=ufo.order.summary")  
178 - public ApiResponse summary(@RequestParam(name = "uid") int uid,  
179 - @RequestParam(name = "client_type", required = false) String clientType){  
180 164
181 - logger.info("in ufo.order.summary, uid {}, clientType is {}", uid, clientType);  
182 -  
183 - OrderSummaryResp orderSummaryResp1 = sellerOrderViewService.selectOrderNumByUid(uid);  
184 -  
185 - OrderSummaryResp orderSummaryResp2 = ibuyerOrderService.selectOrderNumByUid(uid);  
186 -  
187 - return new ApiResponse.ApiResponseBuilder().code(200).data(Lists.newArrayList(orderSummaryResp1, orderSummaryResp2)).message("查询成功").build();  
188 - }  
189 165
190 166
191 /** 167 /**
1 package com.yohoufo.order.model.response; 1 package com.yohoufo.order.model.response;
2 2
3 import com.alibaba.fastjson.annotation.JSONField; 3 import com.alibaba.fastjson.annotation.JSONField;
  4 +import lombok.AllArgsConstructor;
  5 +import lombok.Data;
  6 +import lombok.NoArgsConstructor;
4 7
5 /** 8 /**
6 * Created by li.ma on 2018/9/27. 9 * Created by li.ma on 2018/9/27.
7 */ 10 */
  11 +@Data
  12 +@NoArgsConstructor
  13 +@AllArgsConstructor
8 public class OrderSummaryResp { 14 public class OrderSummaryResp {
9 @JSONField(name = "actor") 15 @JSONField(name = "actor")
10 private String actor; 16 private String actor;
11 17
  18 + private Integer listType;
  19 +
12 @JSONField(name = "sum") 20 @JSONField(name = "sum")
13 private Integer sum; 21 private Integer sum;
14 22
15 - public OrderSummaryResp() {  
16 - }  
17 -  
18 public OrderSummaryResp(String actor, Integer sum) { 23 public OrderSummaryResp(String actor, Integer sum) {
19 this.actor = actor; 24 this.actor = actor;
20 this.sum = sum; 25 this.sum = sum;
21 } 26 }
22 27
23 - public String getActor() {  
24 - return actor;  
25 - }  
26 -  
27 - public void setActor(String actor) {  
28 - this.actor = actor;  
29 - }  
30 -  
31 - public Integer getSum() {  
32 - return sum;  
33 - }  
34 -  
35 - public void setSum(Integer sum) {  
36 - this.sum = sum;  
37 - }  
38 } 28 }
@@ -43,6 +43,7 @@ public class BuyerOrderAssistant { @@ -43,6 +43,7 @@ public class BuyerOrderAssistant {
43 43
44 @Data 44 @Data
45 public static class DepositSkuCheckNode{ 45 public static class DepositSkuCheckNode{
  46 + private String depositCode;
46 private StorageDeposit psd; 47 private StorageDeposit psd;
47 private boolean existDepositGoods; 48 private boolean existDepositGoods;
48 } 49 }
@@ -77,6 +78,7 @@ public class BuyerOrderAssistant { @@ -77,6 +78,7 @@ public class BuyerOrderAssistant {
77 dsNode.setPsd(psd); 78 dsNode.setPsd(psd);
78 } 79 }
79 dsNode.setExistDepositGoods(existDepositGoods); 80 dsNode.setExistDepositGoods(existDepositGoods);
  81 + dsNode.setDepositCode(depositCode);
80 return dsNode; 82 return dsNode;
81 } 83 }
82 84
@@ -85,4 +87,7 @@ public class BuyerOrderAssistant { @@ -85,4 +87,7 @@ public class BuyerOrderAssistant {
85 Integer pboa = pbo.getAttributes(); 87 Integer pboa = pbo.getAttributes();
86 return BuyerOrderUtils.isInstockDeposit(skupType, pboa); 88 return BuyerOrderUtils.isInstockDeposit(skupType, pboa);
87 } 89 }
  90 +
  91 +
  92 +
88 } 93 }
@@ -3,6 +3,7 @@ package com.yohoufo.order.service.impl; @@ -3,6 +3,7 @@ package com.yohoufo.order.service.impl;
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONObject; 4 import com.alibaba.fastjson.JSONObject;
5 import com.google.common.base.Joiner; 5 import com.google.common.base.Joiner;
  6 +import com.google.common.base.Throwables;
6 import com.google.common.collect.Lists; 7 import com.google.common.collect.Lists;
7 import com.yoho.core.common.helpers.ImagesHelper; 8 import com.yoho.core.common.helpers.ImagesHelper;
8 import com.yoho.core.rabbitmq.YhProducer; 9 import com.yoho.core.rabbitmq.YhProducer;
@@ -31,7 +32,6 @@ import com.yohoufo.common.utils.UserInfoHiddenHelper; @@ -31,7 +32,6 @@ import com.yohoufo.common.utils.UserInfoHiddenHelper;
31 import com.yohoufo.dal.order.*; 32 import com.yohoufo.dal.order.*;
32 import com.yohoufo.dal.order.model.*; 33 import com.yohoufo.dal.order.model.*;
33 import com.yohoufo.order.common.ExpressForMqSend; 34 import com.yohoufo.order.common.ExpressForMqSend;
34 -import com.yohoufo.order.constants.MetaKey;  
35 import com.yohoufo.order.constants.SellerConfig; 35 import com.yohoufo.order.constants.SellerConfig;
36 import com.yohoufo.order.event.BuyerOrderSellerDeliveryCheckEvent; 36 import com.yohoufo.order.event.BuyerOrderSellerDeliveryCheckEvent;
37 import com.yohoufo.order.event.ErpBuyerOrderEvent; 37 import com.yohoufo.order.event.ErpBuyerOrderEvent;
@@ -171,6 +171,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -171,6 +171,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
171 @Autowired 171 @Autowired
172 private SkupService skupService; 172 private SkupService skupService;
173 173
  174 + @Autowired
  175 + private ProductProxyService productProxyService;
  176 +
174 177
175 /** 178 /**
176 * 这个方法请尽量保持单一原则 179 * 这个方法请尽量保持单一原则
@@ -303,22 +306,27 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -303,22 +306,27 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
303 if(existDepositGoods){ 306 if(existDepositGoods){
304 //set depot num 307 //set depot num
305 depotNum = DepotType.NJ.getCode(); 308 depotNum = DepotType.NJ.getCode();
306 - //bind deposit code 2 buyer order  
307 - buyerOrderMetaService.saveDepositCode(depositCode, buyerUid, orderCode); 309 +
308 //生成内部使用的物流单号 310 //生成内部使用的物流单号
309 wayBillCode = new StringBuilder() 311 wayBillCode = new StringBuilder()
310 .append(orderCode) 312 .append(orderCode)
311 .append("_") 313 .append("_")
312 .append(depositCode).toString(); 314 .append(depositCode).toString();
313 - //TODO skup 下架  
314 - StorageDeposit psd = dscNode.getPsd();  
315 - //TODO 寄存商品 出库准备 315 +
316 } 316 }
317 //香港卖家不能售卖现货 在业务规则上天然互斥 317 //香港卖家不能售卖现货 在业务规则上天然互斥
318 if (isHKLargeSettlementSuper(sellerUid)) { 318 if (isHKLargeSettlementSuper(sellerUid)) {
319 depotNum = DepotType.HK.getCode(); 319 depotNum = DepotType.HK.getCode();
320 } 320 }
321 updateOrderCnt = processBuyerOrder(preparedData, expressCompanyId, expressType, wayBillCode, depotNum); 321 updateOrderCnt = processBuyerOrder(preparedData, expressCompanyId, expressType, wayBillCode, depotNum);
  322 + if (updateOrderCnt>0){
  323 + try {
  324 + processOrderDeliverByDepositGoods(preparedData, dscNode);
  325 + }catch (Exception ex){
  326 + LOGGER.warn("deliverToDepot processOrderDeliverByDepositGoods fail ,req {} error {}",
  327 + req, Throwables.getStackTraceAsString(ex));
  328 + }
  329 + }
322 break; 330 break;
323 331
324 case GOODS_SERVICE: 332 case GOODS_SERVICE:
@@ -364,6 +372,31 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -364,6 +372,31 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
364 LOGGER.info("deliverToDepot update buyer order status, orderCode {} result {} ", orderCode, updateOrderCnt); 372 LOGGER.info("deliverToDepot update buyer order status, orderCode {} result {} ", orderCode, updateOrderCnt);
365 } 373 }
366 374
  375 + private void processOrderDeliverByDepositGoods(BuyerOrderAssistant.PreparedData preparedData,
  376 + BuyerOrderAssistant.DepositSkuCheckNode dscNode){
  377 + if (!dscNode.isExistDepositGoods()){
  378 + return;
  379 + }
  380 + BuyerOrder buyerOrder = preparedData.getBuyerOrder();
  381 + Integer buyerUid = buyerOrder.getUid();
  382 + Long orderCode = buyerOrder.getOrderCode();
  383 + String depositCode = dscNode.getDepositCode();
  384 + //bind deposit code 2 buyer order
  385 + buyerOrderMetaService.saveDepositCode(depositCode, buyerUid, orderCode);
  386 + //TODO skup 下架
  387 + StorageDeposit psd = dscNode.getPsd();
  388 + Integer skup;
  389 + Integer productId;
  390 + if (Objects.nonNull(skup = psd.getNewSkup())){
  391 + // 减库存
  392 + productProxyService.subtractStorage(productId=psd.getProductId(), skup);
  393 + //
  394 + skupService.saleOut(skup);
  395 + }
  396 + //TODO 寄存商品 出库准备
  397 + }
  398 +
  399 +
367 @Override 400 @Override
368 public void returnBackCauseOfBuyerCancelAfterSellerSendOut(Integer sellerUid, Integer expressCompanyId, Long orderCode, String wayBillCode, Integer depotNum, String sellerMobile, boolean unSureFlag) { 401 public void returnBackCauseOfBuyerCancelAfterSellerSendOut(Integer sellerUid, Integer expressCompanyId, Long orderCode, String wayBillCode, Integer depotNum, String sellerMobile, boolean unSureFlag) {
369 Integer expressType = EnumExpressType.EXPRESS_TYPE_REBACK.getCode(); 402 Integer expressType = EnumExpressType.EXPRESS_TYPE_REBACK.getCode();
@@ -26,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -26,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
26 import org.springframework.stereotype.Service; 26 import org.springframework.stereotype.Service;
27 27
28 import java.math.BigDecimal; 28 import java.math.BigDecimal;
  29 +import java.util.ArrayList;
29 import java.util.Arrays; 30 import java.util.Arrays;
30 import java.util.List; 31 import java.util.List;
31 import java.util.stream.Collectors; 32 import java.util.stream.Collectors;
@@ -108,7 +109,7 @@ public class SellerOrderViewService { @@ -108,7 +109,7 @@ public class SellerOrderViewService {
108 if (cnt == null) { 109 if (cnt == null) {
109 //todo add cache 110 //todo add cache
110 Integer num = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode())); 111 Integer num = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()));
111 - List<SellerOrderListType> types = Arrays.asList(SellerOrderListType.WAITING_SEND, SellerOrderListType.WAITING_PAY); 112 + List<SellerOrderListType> types = Arrays.asList(SellerOrderListType.SEND_OUT, SellerOrderListType.WAITING_PAY);
112 List<Integer> statusList = types.parallelStream().flatMap(solt -> solt.getStatus().parallelStream()).collect(Collectors.toList()); 113 List<Integer> statusList = types.parallelStream().flatMap(solt -> solt.getStatus().parallelStream()).collect(Collectors.toList());
113 Integer buyerOrderNum = buyerOrderMapper.selectCntBySellerUid(uid, statusList); 114 Integer buyerOrderNum = buyerOrderMapper.selectCntBySellerUid(uid, statusList);
114 logger.info("in seller order count uid {}, num {}, buyerOrderNum {}", uid, num, buyerOrderNum); 115 logger.info("in seller order count uid {}, num {}, buyerOrderNum {}", uid, num, buyerOrderNum);
@@ -129,6 +130,34 @@ public class SellerOrderViewService { @@ -129,6 +130,34 @@ public class SellerOrderViewService {
129 return new OrderSummaryResp("sell", cnt); 130 return new OrderSummaryResp("sell", cnt);
130 } 131 }
131 132
  133 + public List<OrderSummaryResp> getOrderCntListByUid(int uid) {
  134 + List<OrderSummaryResp> list = new ArrayList<>(8);
  135 + final String actor = TabType.SELL.getValue();
  136 + SellerOrderListType insale = SellerOrderListType.IN_SALE;
  137 + //TODO add cache
  138 + int num = sellerOrderGoodsMapper.selectCntByUidStatusList(uid, Arrays.asList(SkupStatus.CAN_SELL.getCode()));
  139 + OrderSummaryResp sellerGoodsSummary = new OrderSummaryResp(actor, insale.getType(), num);
  140 + list.add(sellerGoodsSummary);
  141 + //
  142 + List<SellerOrderListType> types = Arrays.asList(SellerOrderListType.WAITING_PAY,
  143 + SellerOrderListType.SEND_OUT,
  144 + SellerOrderListType.ORDER_SUCCESS,
  145 + SellerOrderListType.ORDER_FAILED);
  146 + for(SellerOrderListType solt : types) {
  147 + List<Integer> statusList = solt.getStatus();
  148 + int buyerOrderNum = buyerOrderMapper.selectCntBySellerUid(uid, statusList);
  149 + logger.info("in seller order count uid {}, num {}, buyerOrderNum {}", uid, num, buyerOrderNum);
  150 + //
  151 + OrderSummaryResp osResp = new OrderSummaryResp();
  152 + osResp.setActor(actor);
  153 + osResp.setSum(buyerOrderNum);
  154 + osResp.setListType(solt.getType());
  155 + list.add(osResp);
  156 + }
  157 + return list;
  158 + }
  159 +
  160 +
132 public OrderCntResp getOrderCnt(OrderRequest orderRequest, SellerOrderListType listType){ 161 public OrderCntResp getOrderCnt(OrderRequest orderRequest, SellerOrderListType listType){
133 logger.info("in seller getOrderCnt req {} listType {}", orderRequest, listType); 162 logger.info("in seller getOrderCnt req {} listType {}", orderRequest, listType);
134 int cnt ; 163 int cnt ;
@@ -22,6 +22,7 @@ import com.yohoufo.order.model.dto.BuyerOrderSubmitResult; @@ -22,6 +22,7 @@ import com.yohoufo.order.model.dto.BuyerOrderSubmitResult;
22 import com.yohoufo.order.model.dto.OrderBuilder; 22 import com.yohoufo.order.model.dto.OrderBuilder;
23 import com.yohoufo.order.service.ISubmitOrderService; 23 import com.yohoufo.order.service.ISubmitOrderService;
24 import com.yohoufo.order.service.proxy.*; 24 import com.yohoufo.order.service.proxy.*;
  25 +import com.yohoufo.order.service.seller.SkupService;
25 import com.yohoufo.order.utils.LoggerUtils; 26 import com.yohoufo.order.utils.LoggerUtils;
26 import org.apache.commons.collections.CollectionUtils; 27 import org.apache.commons.collections.CollectionUtils;
27 import org.slf4j.Logger; 28 import org.slf4j.Logger;
@@ -153,6 +154,9 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService { @@ -153,6 +154,9 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService {
153 @Autowired 154 @Autowired
154 private OrderStatusFlowService orderStatusFlowService; 155 private OrderStatusFlowService orderStatusFlowService;
155 156
  157 + @Autowired
  158 + private SkupService skupService;
  159 +
156 /** 160 /**
157 * 创建订单 161 * 创建订单
158 * @param orderBuilder 162 * @param orderBuilder
@@ -339,11 +343,7 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService { @@ -339,11 +343,7 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService {
339 private int updSellerOrderGoods(OrderBuilder orderBuilder) { 343 private int updSellerOrderGoods(OrderBuilder orderBuilder) {
340 int skup; 344 int skup;
341 int uid = orderBuilder.getUid(); 345 int uid = orderBuilder.getUid();
342 - SellerOrderGoods condition = new SellerOrderGoods();  
343 - condition.setId(skup = orderBuilder.getSkup());  
344 - condition.setExceptStatus(SkupStatus.CAN_SELL.getCode());  
345 - condition.setStatus(SkupStatus.SELL_OUT.getCode());  
346 - int num = sellerOrderGoodsMapper.updateStatusBySkpu(condition); 346 + int num = skupService.saleOut(skup= orderBuilder.getSkup());
347 if (num == 0 ){ 347 if (num == 0 ){
348 logger.warn("in buyer create order fail on update skup status , uid {} skup {}", uid, skup); 348 logger.warn("in buyer create order fail on update skup status , uid {} skup {}", uid, skup);
349 throw new ServiceException(ServiceError.ORDER_SKUP_CANNOT_SELL); 349 throw new ServiceException(ServiceError.ORDER_SKUP_CANNOT_SELL);
1 package com.yohoufo.order.service.seller; 1 package com.yohoufo.order.service.seller;
2 2
3 import com.yoho.core.dal.datasource.annotation.Database; 3 import com.yoho.core.dal.datasource.annotation.Database;
  4 +import com.yoho.error.ServiceError;
  5 +import com.yoho.error.exception.ServiceException;
4 import com.yohobuy.ufo.model.GoodsSize; 6 import com.yohobuy.ufo.model.GoodsSize;
5 import com.yohobuy.ufo.model.order.bo.GoodsInfo; 7 import com.yohobuy.ufo.model.order.bo.GoodsInfo;
6 import com.yohobuy.ufo.model.order.common.SkupStatus; 8 import com.yohobuy.ufo.model.order.common.SkupStatus;
@@ -9,6 +11,7 @@ import com.yohobuy.ufo.model.response.StorageDataResp; @@ -9,6 +11,7 @@ import com.yohobuy.ufo.model.response.StorageDataResp;
9 import com.yohoufo.dal.order.SellerOrderGoodsMapper; 11 import com.yohoufo.dal.order.SellerOrderGoodsMapper;
10 import com.yohoufo.dal.order.model.SellerOrderGoods; 12 import com.yohoufo.dal.order.model.SellerOrderGoods;
11 import com.yohoufo.order.convert.GoodsInfoConvertor; 13 import com.yohoufo.order.convert.GoodsInfoConvertor;
  14 +import com.yohoufo.order.model.dto.OrderBuilder;
12 import com.yohoufo.order.service.proxy.ProductProxyService; 15 import com.yohoufo.order.service.proxy.ProductProxyService;
13 import com.yohoufo.order.service.seller.support.SkupTypeCodeSupport; 16 import com.yohoufo.order.service.seller.support.SkupTypeCodeSupport;
14 import com.yohoufo.order.utils.LoggerUtils; 17 import com.yohoufo.order.utils.LoggerUtils;
@@ -139,4 +142,15 @@ public class SkupService { @@ -139,4 +142,15 @@ public class SkupService {
139 productProxyService.setDepotNum(skup,depotNum); 142 productProxyService.setDepotNum(skup,depotNum);
140 return result; 143 return result;
141 } 144 }
  145 +
  146 + @Transactional(propagation = Propagation.REQUIRED)
  147 + @Database(ForceMaster=true, DataSource="ufo_order")
  148 + public int saleOut(int skup) {
  149 + SellerOrderGoods condition = new SellerOrderGoods();
  150 + condition.setId(skup);
  151 + condition.setExceptStatus(SkupStatus.CAN_SELL.getCode());
  152 + condition.setStatus(SkupStatus.SELL_OUT.getCode());
  153 + int num = sellerOrderGoodsMapper.updateStatusBySkpu(condition);
  154 + return num;
  155 + }
142 } 156 }