Authored by chenchao

add build

@@ -155,9 +155,13 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -155,9 +155,13 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
155 155
156 @Autowired 156 @Autowired
157 private SellerService sellerService; 157 private SellerService sellerService;
  158 +
158 @Autowired 159 @Autowired
159 private SpecialTimeConfigReader specialTimeConfigReader; 160 private SpecialTimeConfigReader specialTimeConfigReader;
160 161
  162 + @Autowired
  163 + private SellerOrderService sellerOrderService;
  164 +
161 private static String EXPRESS_MQ_SEND = "third.logistics.logistics_data"; 165 private static String EXPRESS_MQ_SEND = "third.logistics.logistics_data";
162 166
163 //物流文案设置 167 //物流文案设置
@@ -394,6 +398,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -394,6 +398,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
394 //保存物流信息+更新订单状态; 398 //保存物流信息+更新订单状态;
395 //本阶段的物流类型和订单状态 399 //本阶段的物流类型和订单状态
396 //TODO 如果使用了卖家优惠券,处理券 400 //TODO 如果使用了卖家优惠券,处理券
  401 + String couponCode = req.getCouponCode();
  402 + boolean selectCoupon = StringUtils.isNoneBlank(couponCode);
  403 +
397 Integer expressType = expressTypeEnum.getCode(); 404 Integer expressType = expressTypeEnum.getCode();
398 int updateOrderCnt = 0; 405 int updateOrderCnt = 0;
399 Supplier<String> sellerMobileSupplier; 406 Supplier<String> sellerMobileSupplier;
@@ -414,7 +421,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -414,7 +421,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
414 //非(现货寄存订单+使用寄存商品发货) 421 //非(现货寄存订单+使用寄存商品发货)
415 updateOrderCnt = processBuyerOrderOfNotInstockDepositUsingDepositGoods(preparedData, dscNode, req4Log); 422 updateOrderCnt = processBuyerOrderOfNotInstockDepositUsingDepositGoods(preparedData, dscNode, req4Log);
416 } 423 }
417 - 424 + if(selectCoupon && updateOrderCnt>0){
  425 + sellerOrderService.submitWithCoupon(couponCode, req.getBusinessClient(), preparedData);
  426 + }
418 break; 427 break;
419 case GOODS_SERVICE: 428 case GOODS_SERVICE:
420 IGoodsService goodsService = serviceOrderProcessor.findGoodsServiceInstance(orderCode); 429 IGoodsService goodsService = serviceOrderProcessor.findGoodsServiceInstance(orderCode);
@@ -48,6 +48,7 @@ import com.yohoufo.order.service.impl.visitor.UserCancelCase; @@ -48,6 +48,7 @@ import com.yohoufo.order.service.impl.visitor.UserCancelCase;
48 import com.yohoufo.order.service.proxy.*; 48 import com.yohoufo.order.service.proxy.*;
49 import com.yohoufo.order.service.seller.SellerAuthCheckService; 49 import com.yohoufo.order.service.seller.SellerAuthCheckService;
50 import com.yohoufo.order.service.seller.SellerOrderCancelService; 50 import com.yohoufo.order.service.seller.SellerOrderCancelService;
  51 +import com.yohoufo.order.service.seller.support.SellerOrderContextFactory;
51 import com.yohoufo.order.service.seller.trade.SellerOrderComputeService; 52 import com.yohoufo.order.service.seller.trade.SellerOrderComputeService;
52 import com.yohoufo.order.service.seller.SkupBatchService; 53 import com.yohoufo.order.service.seller.SkupBatchService;
53 import com.yohoufo.order.service.seller.orderMeta.SellerFeeService; 54 import com.yohoufo.order.service.seller.orderMeta.SellerFeeService;
@@ -994,9 +995,24 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServic @@ -994,9 +995,24 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServic
994 995
995 996
996 997
997 - public void submitWithCoupon(SellerOrderRelatedBuyerOrderContext sorboc){  
998 - SellerOrderChargeParam chargeParam = sorboc.getChargeParam();  
999 - chargeParam.setChargeStage(SellerOrderChargeParam.SUBMIT); 998 + public void submitWithCoupon(String couponCode,
  999 + String businessClient,
  1000 + BuyerOrderAssistant.PreparedData preparedData){
  1001 + SellerOrderGoods psog = preparedData.getSellerOrderGoods();
  1002 + SellerOrderChargeParam chargeParam = SellerOrderChargeParam.builder()
  1003 + .chargeStage(SellerOrderChargeParam.SUBMIT).build();
  1004 +
  1005 + Supplier<SellerOrderComputeResult> computeResultSupplier = ()->sellerFeeService.getSellerOrderComputeResult(psog.getUid(), psog.getId());
  1006 + SellerOrderRelatedBuyerOrderContext sorboc = SellerOrderContextFactory.builder()
  1007 + .uid(psog.getUid())
  1008 + .couponCode(couponCode).businessClient(businessClient)
  1009 + .chargeParam(chargeParam)
  1010 + .computeResultSupplier(computeResultSupplier)
  1011 + .sellerOrderGoods(psog)
  1012 + .build().buildSellerOrderRelatedBuyerOrderContext();
  1013 +
  1014 +
  1015 +
1000 sellerOrderComputeService.compute(sorboc); 1016 sellerOrderComputeService.compute(sorboc);
1001 //TODO how to keep atomic,rollback when fail 1017 //TODO how to keep atomic,rollback when fail
1002 1018
@@ -1006,7 +1022,6 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServic @@ -1006,7 +1022,6 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServic
1006 1022
1007 CouponBoList couponBoList = CouponSupport.buildOrderCouponBoList(computeResult.getCouponPayResultList()); 1023 CouponBoList couponBoList = CouponSupport.buildOrderCouponBoList(computeResult.getCouponPayResultList());
1008 1024
1009 - SellerOrderGoods psog = sorboc.getSkupInfo();  
1010 1025
1011 SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(psog.getId()); 1026 SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(psog.getId());
1012 1027
  1 +package com.yohoufo.order.service.seller.support;
  2 +
  3 +import com.yohobuy.ufo.model.order.bo.SellerOrderChargeParam;
  4 +import com.yohoufo.dal.order.model.SellerOrderGoods;
  5 +import com.yohoufo.order.model.SellerOrderRelatedBuyerOrderContext;
  6 +import com.yohoufo.order.model.dto.SellerOrderComputeResult;
  7 +import lombok.Builder;
  8 +import lombok.Data;
  9 +
  10 +import java.util.function.Supplier;
  11 +@Data
  12 +@Builder
  13 +public class SellerOrderContextFactory {
  14 +
  15 + private Supplier<SellerOrderComputeResult> computeResultSupplier;
  16 +
  17 + private int uid;
  18 +
  19 + private String businessClient;
  20 +
  21 + private String couponCode;
  22 +
  23 +
  24 + private SellerOrderGoods sellerOrderGoods;
  25 +
  26 + private SellerOrderChargeParam chargeParam;
  27 +
  28 +
  29 + public SellerOrderRelatedBuyerOrderContext buildSellerOrderRelatedBuyerOrderContext(){
  30 +
  31 + SellerOrderRelatedBuyerOrderContext sorboc = new SellerOrderRelatedBuyerOrderContext();
  32 + sorboc.setUid(uid);
  33 + sorboc.setBusinessClient(businessClient);
  34 + sorboc.setCouponCode(couponCode);
  35 + sorboc.setSkupInfo(sellerOrderGoods);
  36 + //sorboc.setAutoRecommended(autoRecommended);
  37 + sorboc.setChargeParam(chargeParam);
  38 + sorboc.setSellerOrderComputeResult(computeResultSupplier.get());
  39 +
  40 + return sorboc;
  41 + }
  42 +}