Authored by LING.TAN

极速

@@ -156,6 +156,9 @@ public class BuyerOrderCancelService { @@ -156,6 +156,9 @@ public class BuyerOrderCancelService {
156 @Autowired 156 @Autowired
157 private BuyerOrderAssistant buyerOrderAssistant; 157 private BuyerOrderAssistant buyerOrderAssistant;
158 158
  159 + @Autowired
  160 + FastDeliveryProxyService fastDeliveryProxyService;
  161 +
159 162
160 public int cancel(BeforeSellerDeliverEvent bsdEvent){ 163 public int cancel(BeforeSellerDeliverEvent bsdEvent){
161 int buyerUid = bsdEvent.getBuyerUid(); 164 int buyerUid = bsdEvent.getBuyerUid();
@@ -354,6 +357,11 @@ public class BuyerOrderCancelService { @@ -354,6 +357,11 @@ public class BuyerOrderCancelService {
354 }else { 357 }else {
355 inBoxFacade.buyerCancelBeforeDepotReceive(buyerOrder, penaltyAmount.toPlainString(), psog, useDepositGoods); 358 inBoxFacade.buyerCancelBeforeDepotReceive(buyerOrder, penaltyAmount.toPlainString(), psog, useDepositGoods);
356 } 359 }
  360 +
  361 + if (fastDeliveryProxyService.isFastDeliveryGoods(skup)){
  362 + fastDeliveryProxyService.cancel(psog.getUid(), skup, true);
  363 + }
  364 +
357 //整个过程异步去执行(考虑退费依赖订单状态) 365 //整个过程异步去执行(考虑退费依赖订单状态)
358 //(退费)退保证金给卖家 366 //(退费)退保证金给卖家
359 //(转账)瓜分指定赔偿款给卖家和平台 367 //(转账)瓜分指定赔偿款给卖家和平台
@@ -454,9 +454,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -454,9 +454,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
454 // 恢复product skup的库存 454 // 恢复product skup的库存
455 boolean isReturnSuccess = productProxyService.returnStorage(skup); 455 boolean isReturnSuccess = productProxyService.returnStorage(skup);
456 456
457 - // 急速发货的场合,释放库存 457 + // 急速发货的场合,取消订单
458 if (fastDeliveryProxyService.isFastDeliveryGoods(skup)){ 458 if (fastDeliveryProxyService.isFastDeliveryGoods(skup)){
459 - fastDeliveryProxyService.cancel(psog.getUid(), skup); 459 + fastDeliveryProxyService.cancel(psog.getUid(), skup, false);
460 } 460 }
461 461
462 //如有用券则退券 462 //如有用券则退券
1 package com.yohoufo.order.service.impl; 1 package com.yohoufo.order.service.impl;
2 2
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
  4 +import com.alibaba.fastjson.JSONObject;
4 import com.google.common.collect.Lists; 5 import com.google.common.collect.Lists;
5 import com.yohobuy.ufo.model.ProductInfo; 6 import com.yohobuy.ufo.model.ProductInfo;
6 import com.yohobuy.ufo.model.enums.StorageCheckEnum; 7 import com.yohobuy.ufo.model.enums.StorageCheckEnum;
@@ -11,6 +12,7 @@ import com.yohobuy.ufo.model.order.common.SkupStatus; @@ -11,6 +12,7 @@ import com.yohobuy.ufo.model.order.common.SkupStatus;
11 import com.yohobuy.ufo.model.order.constants.SkupType; 12 import com.yohobuy.ufo.model.order.constants.SkupType;
12 import com.yohobuy.ufo.model.order.req.*; 13 import com.yohobuy.ufo.model.order.req.*;
13 import com.yohobuy.ufo.model.order.resp.*; 14 import com.yohobuy.ufo.model.order.resp.*;
  15 +import com.yohobuy.ufo.model.order.vo.AddressInfo;
14 import com.yohobuy.ufo.model.request.product.ProductImportTranItemBo; 16 import com.yohobuy.ufo.model.request.product.ProductImportTranItemBo;
15 import com.yohobuy.ufo.model.request.product.ProductRequestBo; 17 import com.yohobuy.ufo.model.request.product.ProductRequestBo;
16 import com.yohobuy.ufo.model.response.ProductDetailResp; 18 import com.yohobuy.ufo.model.response.ProductDetailResp;
@@ -106,6 +108,10 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService { @@ -106,6 +108,10 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService {
106 @Autowired 108 @Autowired
107 private TradeBillsMapper tradeBillsMapper; 109 private TradeBillsMapper tradeBillsMapper;
108 110
  111 + private static final String ADDRESS_STR = "{\"address\":\"松金公路2758号sneakerburger仓储中心\",\"address_id\":17560803,\"area\":\"上海 金山区 张堰镇\",\"areaCode\":\"310116103\",\"consignee\":\"阿津\",\"isUpdate\":\"N\",\"mobile\":\"18121153590\",\"phone\":\"\",\"zipCode\":\"\"}";
  112 +
  113 + private static final String HIDDEN_ADDRESS_STR = "{\"address\":\"松金公路2758号sneakerbur****储中心\",\"address_id\":17560803,\"area\":\"上海 金山区 张堰镇\",\"areaCode\":\"310116103\",\"consignee\":\"*津\",\"isUpdate\":\"N\",\"mobile\":\"181****3590\",\"phone\":\"\",\"zipCode\":\"\"}";
  114 +
109 /** 115 /**
110 * 货款收入 116 * 货款收入
111 */ 117 */
@@ -384,6 +390,10 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService { @@ -384,6 +390,10 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService {
384 // 上架 390 // 上架
385 List<ProductImportTranItemBo> responseList = Lists.newArrayList(); 391 List<ProductImportTranItemBo> responseList = Lists.newArrayList();
386 392
  393 +
  394 + AddressInfo noHiddenBackAddress = JSONObject.parseObject(ADDRESS_STR, AddressInfo.class);
  395 + AddressInfo hiddenBackAddress = JSONObject.parseObject(HIDDEN_ADDRESS_STR, AddressInfo.class);
  396 +
387 // 上架的代码(和之前同) 397 // 上架的代码(和之前同)
388 List<FastDeliveryBatchOnShelfResp> shelfResps = Lists.newArrayList(); 398 List<FastDeliveryBatchOnShelfResp> shelfResps = Lists.newArrayList();
389 for(FastDeliveryBatchOnShelfReq.ProductInfo productInfo : req.getProductInfos()){ 399 for(FastDeliveryBatchOnShelfReq.ProductInfo productInfo : req.getProductInfos()){
@@ -406,6 +416,8 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService { @@ -406,6 +416,8 @@ public class ErpFastDeliveryServiceImpl implements IErpFastDeliveryService {
406 ImPrdNode node = ImPrdNode.builder().uid(req.getUid()) 416 ImPrdNode node = ImPrdNode.builder().uid(req.getUid())
407 .sellerWrapper(sellerWrapper) 417 .sellerWrapper(sellerWrapper)
408 .storageId(productInfo.getStorageId()) 418 .storageId(productInfo.getStorageId())
  419 + .noHiddenBackAddress(noHiddenBackAddress)
  420 + .hiddenBackAddress(hiddenBackAddress)
409 .salePrice(productInfo.getConvertedPrice()) 421 .salePrice(productInfo.getConvertedPrice())
410 .storageNum(productInfo.getNum()) 422 .storageNum(productInfo.getNum())
411 .productCode(productInfo.getProductCode()) 423 .productCode(productInfo.getProductCode())
@@ -136,7 +136,7 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService { @@ -136,7 +136,7 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService {
136 productProxyService.returnStorage(orderBuilder.getSkup()); 136 productProxyService.returnStorage(orderBuilder.getSkup());
137 137
138 if (fastDeliveryProxyService.isFastDeliveryGoods(orderBuilder.getSkup())){ 138 if (fastDeliveryProxyService.isFastDeliveryGoods(orderBuilder.getSkup())){
139 - fastDeliveryProxyService.cancel(orderBuilder.getSellerOrderGoods().getUid(), orderBuilder.getSkup()); 139 + fastDeliveryProxyService.cancel(orderBuilder.getSellerOrderGoods().getUid(), orderBuilder.getSkup(), false);
140 } 140 }
141 141
142 }catch (Exception ex0){ 142 }catch (Exception ex0){
@@ -109,9 +109,10 @@ public class FastDeliveryProxyService { @@ -109,9 +109,10 @@ public class FastDeliveryProxyService {
109 /** 109 /**
110 * 取消 110 * 取消
111 * @param skup 111 * @param skup
  112 + * @param needReShelves 是否需要重新上架
112 * @return 113 * @return
113 */ 114 */
114 - public ApiResponse cancel(int sellerUid, int skup){ 115 + public ApiResponse cancel(int sellerUid, int skup, boolean needReShelves){
115 if (!isOnToThird()){ 116 if (!isOnToThird()){
116 return new ApiResponse(); 117 return new ApiResponse();
117 } 118 }
@@ -123,8 +124,11 @@ public class FastDeliveryProxyService { @@ -123,8 +124,11 @@ public class FastDeliveryProxyService {
123 } 124 }
124 125
125 logger.info("fast delivery cancel, skup {}, url {}", skup, sellerAccessInfo.getUnlockSkupUrl()); 126 logger.info("fast delivery cancel, skup {}, url {}", skup, sellerAccessInfo.getUnlockSkupUrl());
  127 +
  128 + JSONObject param = getParam(skup, null, null, sellerAccessInfo.getYhSecret());
  129 + param.put("needReShelves", needReShelves);
126 ApiResponse result = baseServiceCaller.doPost("fast.delivery.cancel", sellerAccessInfo.getUnlockSkupUrl(), 130 ApiResponse result = baseServiceCaller.doPost("fast.delivery.cancel", sellerAccessInfo.getUnlockSkupUrl(),
127 - getParam(skup, null, null, sellerAccessInfo.getYhSecret())); 131 + param);
128 logger.info("fast delivery cancel, skup {}, result {}", skup, result); 132 logger.info("fast delivery cancel, skup {}, result {}", skup, result);
129 return result; 133 return result;
130 134