Authored by Lixiaodi

Merge branch 'test6.9.8' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.8

@@ -132,7 +132,7 @@ public class DepositController { @@ -132,7 +132,7 @@ public class DepositController {
132 return new ApiResponse(200, "缓存清除成功!", Boolean.TRUE); 132 return new ApiResponse(200, "缓存清除成功!", Boolean.TRUE);
133 } 133 }
134 134
135 - @RequestMapping("method=ufo.deposit.clearUserDeposit") 135 + @RequestMapping(params = "method=ufo.deposit.clearUserDeposit")
136 @IgnoreSignature 136 @IgnoreSignature
137 @IgnoreSession 137 @IgnoreSession
138 public ApiResponse clearUserDeposit(@RequestParam("uid") Integer uid, 138 public ApiResponse clearUserDeposit(@RequestParam("uid") Integer uid,
@@ -200,9 +200,13 @@ public class OrderDetailInfo { @@ -200,9 +200,13 @@ public class OrderDetailInfo {
200 * 实付金额 200 * 实付金额
201 */ 201 */
202 String realPayPrice; 202 String realPayPrice;
203 - 203 + /**
  204 + * 仓储费
  205 + */
204 String depositPrice; 206 String depositPrice;
205 - 207 + /**
  208 + * 闪购服务费
  209 + */
206 String quickDeliveServicePrice; 210 String quickDeliveServicePrice;
207 } 211 }
208 212
@@ -121,12 +121,15 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { @@ -121,12 +121,15 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
121 OrderStatus targetOrderStatus = OrderStatus.HAS_PAYED; 121 OrderStatus targetOrderStatus = OrderStatus.HAS_PAYED;
122 boolean isQuickDeliver = false; 122 boolean isQuickDeliver = false;
123 boolean isDepositWithQuickDeliverGoods = false; 123 boolean isDepositWithQuickDeliverGoods = false;
  124 + boolean isDerectPass = false;
  125 +
124 //门店订单支付后直接完成 126 //门店订单支付后直接完成
125 if(BuyerOrderUtils.isOffline(orderInfo) ) { 127 if(BuyerOrderUtils.isOffline(orderInfo) ) {
126 targetOrderStatus = OrderStatus.DONE; 128 targetOrderStatus = OrderStatus.DONE;
127 }else if((isQuickDeliver=BuyerOrderUtils.isQuickDeliver(orderInfo.getAttributes())) 129 }else if((isQuickDeliver=BuyerOrderUtils.isQuickDeliver(orderInfo.getAttributes()))
128 || (isDepositWithQuickDeliverGoods = isDepositWithQuickDeliverGoods(uid, orderCode, orderInfo.getAttributes()))){ 130 || (isDepositWithQuickDeliverGoods = isDepositWithQuickDeliverGoods(uid, orderCode, orderInfo.getAttributes()))){
129 targetOrderStatus = OrderStatus.WAITING_RECEIVE; 131 targetOrderStatus = OrderStatus.WAITING_RECEIVE;
  132 + isDerectPass = true;
130 } 133 }
131 logger.info("after paid updateOrderStatusPaid uid {} orderCode {} isQuickDeliver {} isDepositWithQuickDeliverGoods {} ", 134 logger.info("after paid updateOrderStatusPaid uid {} orderCode {} isQuickDeliver {} isDepositWithQuickDeliverGoods {} ",
132 uid, orderCode, isQuickDeliver, isDepositWithQuickDeliverGoods); 135 uid, orderCode, isQuickDeliver, isDepositWithQuickDeliverGoods);
@@ -144,8 +147,9 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { @@ -144,8 +147,9 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
144 logger.info("in updateOrderStatusPaid record status change, orderCode {}, status: {}", 147 logger.info("in updateOrderStatusPaid record status change, orderCode {}, status: {}",
145 orderCode, orderStatusCode); 148 orderCode, orderStatusCode);
146 orderStatusFlowService.addAsy(orderCode, orderStatusCode); 149 orderStatusFlowService.addAsy(orderCode, orderStatusCode);
147 - if (isQuickDeliver){  
148 - appraiseService.processQuickDeliverOrderAfterPaid(orderCode, uid); 150 + if (isDerectPass){
  151 + boolean isDepositRequired = isDepositWithQuickDeliverGoods;
  152 + appraiseService.processQuickDeliverOrderAfterPaid(orderCode, uid, isDepositRequired);
149 } 153 }
150 } 154 }
151 orderInfo.setStatus(orderStatusCode); 155 orderInfo.setStatus(orderStatusCode);
@@ -60,4 +60,11 @@ public interface DepositService { @@ -60,4 +60,11 @@ public interface DepositService {
60 * @param depositCode 60 * @param depositCode
61 */ 61 */
62 void clearCacheByDepositCode(Integer uid, String depositCode); 62 void clearCacheByDepositCode(Integer uid, String depositCode);
  63 +
  64 + /**
  65 + * 根据货号查询库存
  66 + * @param depositCode
  67 + * @return
  68 + */
  69 + StorageDeposit selectStorageDeposit(Integer uid, String depositCode);
63 } 70 }
@@ -1568,7 +1568,7 @@ public class AppraiseService { @@ -1568,7 +1568,7 @@ public class AppraiseService {
1568 } 1568 }
1569 @Autowired 1569 @Autowired
1570 private DepositService depositService; 1570 private DepositService depositService;
1571 - public void processQuickDeliverOrderAfterPaid(long orderCode,int uid){ 1571 + public void processQuickDeliverOrderAfterPaid(long orderCode,int uid, boolean isDeposit){
1572 BuyerOrderGoods pbog = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode); 1572 BuyerOrderGoods pbog = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode);
1573 BuyerOrder pbo = buyerOrderMapper.selectOnlyByOrderCode(orderCode); 1573 BuyerOrder pbo = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
1574 try { 1574 try {
@@ -1577,7 +1577,6 @@ public class AppraiseService { @@ -1577,7 +1577,6 @@ public class AppraiseService {
1577 LOGGER.warn("in processQuickDeliverOrderAfterPaid transferGoodsMoneyWhenPass fail orderCode {} uid {}", 1577 LOGGER.warn("in processQuickDeliverOrderAfterPaid transferGoodsMoneyWhenPass fail orderCode {} uid {}",
1578 orderCode, uid, ex); 1578 orderCode, uid, ex);
1579 } 1579 }
1580 - depositService.changeOwner(pbo.getSellerUid(), pbog.getSkup(), orderCode,uid, false);  
1581 - 1580 + depositService.changeOwner(pbo.getSellerUid(), pbog.getSkup(), orderCode,uid, isDeposit);
1582 } 1581 }
1583 } 1582 }
@@ -7,20 +7,25 @@ import com.yohobuy.ufo.model.order.bo.OrderInfo; @@ -7,20 +7,25 @@ import com.yohobuy.ufo.model.order.bo.OrderInfo;
7 import com.yohobuy.ufo.model.order.common.OrderCodeType; 7 import com.yohobuy.ufo.model.order.common.OrderCodeType;
8 import com.yohobuy.ufo.model.order.common.OrderStatus; 8 import com.yohobuy.ufo.model.order.common.OrderStatus;
9 import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum; 9 import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum;
  10 +import com.yohoufo.dal.order.SellerOrderGoodsMapper;
10 import com.yohoufo.dal.order.model.DepositOrder; 11 import com.yohoufo.dal.order.model.DepositOrder;
11 import com.yohoufo.dal.order.model.EntrySellerRechargeOrder; 12 import com.yohoufo.dal.order.model.EntrySellerRechargeOrder;
  13 +import com.yohoufo.dal.order.model.SellerOrderGoods;
12 import com.yohoufo.dal.order.model.StorageDeposit; 14 import com.yohoufo.dal.order.model.StorageDeposit;
13 import com.yohoufo.order.model.request.PaymentRequest; 15 import com.yohoufo.order.model.request.PaymentRequest;
14 import com.yohoufo.order.model.response.PrepayResponse; 16 import com.yohoufo.order.model.response.PrepayResponse;
15 import com.yohoufo.order.service.AbstractOrderPaymentService; 17 import com.yohoufo.order.service.AbstractOrderPaymentService;
16 import com.yohoufo.order.service.DepositService; 18 import com.yohoufo.order.service.DepositService;
17 import com.yohoufo.order.service.deposit.DepositOrderService; 19 import com.yohoufo.order.service.deposit.DepositOrderService;
  20 +import com.yohoufo.order.service.proxy.InBoxFacade;
18 import org.slf4j.Logger; 21 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory; 22 import org.slf4j.LoggerFactory;
20 import org.springframework.beans.factory.annotation.Autowired; 23 import org.springframework.beans.factory.annotation.Autowired;
21 import org.springframework.stereotype.Service; 24 import org.springframework.stereotype.Service;
22 25
  26 +import javax.swing.text.html.Option;
23 import java.util.Objects; 27 import java.util.Objects;
  28 +import java.util.Optional;
24 29
25 @Service 30 @Service
26 public class DepositOrderPaymentService extends AbstractOrderPaymentService { 31 public class DepositOrderPaymentService extends AbstractOrderPaymentService {
@@ -32,6 +37,12 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService { @@ -32,6 +37,12 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService {
32 @Autowired 37 @Autowired
33 private DepositService depositService; 38 private DepositService depositService;
34 39
  40 + @Autowired
  41 + protected InBoxFacade inBoxFacade;
  42 +
  43 + @Autowired
  44 + private SellerOrderGoodsMapper sellerOrderGoodsMapper;
  45 +
35 @Override 46 @Override
36 public boolean isTimeoutCancelStatus(OrderInfo orderInfo) { 47 public boolean isTimeoutCancelStatus(OrderInfo orderInfo) {
37 return false; 48 return false;
@@ -151,6 +162,13 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService { @@ -151,6 +162,13 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService {
151 if (result != 1) { 162 if (result != 1) {
152 logger.error("depositService.changeStorageStatus find wrong, depositCode is {}, result is {}", depositOrder.getDepositCode(), result); 163 logger.error("depositService.changeStorageStatus find wrong, depositCode is {}, result is {}", depositOrder.getDepositCode(), result);
153 return; 164 return;
  165 + } else {
  166 + StorageDeposit deposit = depositService.selectStorageDeposit(depositOrder.getUid(), depositOrder.getDepositCode());
  167 +
  168 + SellerOrderGoods psog = Optional.ofNullable(deposit).map(StorageDeposit::getSkup)
  169 + .map(sellerOrderGoodsMapper::selectByPrimaryKey).orElse(null);
  170 +
  171 + inBoxFacade.recallDepositnotify(deposit.getOwnerUid(), psog); // 更新待拣货状态成功后,发通知
154 } 172 }
155 } 173 }
156 174
@@ -378,6 +378,15 @@ public class DepositServiceImpl implements DepositService { @@ -378,6 +378,15 @@ public class DepositServiceImpl implements DepositService {
378 } 378 }
379 379
380 /** 380 /**
  381 + * 根据货号查询库存
  382 + * @param depositCode
  383 + * @return
  384 + */
  385 + public StorageDeposit selectStorageDeposit(Integer uid, String depositCode) {
  386 + return storageDepositMapper.queryByDepositCode(uid, depositCode);
  387 + }
  388 +
  389 + /**
381 * Do 转 Vo 390 * Do 转 Vo
382 * @param storageDeposit 391 * @param storageDeposit
383 * @return 392 * @return
@@ -283,7 +283,7 @@ public class ShoppingServiceImpl implements IShoppingService { @@ -283,7 +283,7 @@ public class ShoppingServiceImpl implements IShoppingService {
283 //急速商品 非寄存 283 //急速商品 非寄存
284 if (!depositChoose && SkupType.QUICK_DELIVER.equals(skupType)){ 284 if (!depositChoose && SkupType.QUICK_DELIVER.equals(skupType)){
285 FeeNRate feeNRate = feeNRateFunc.apply(skupType); 285 FeeNRate feeNRate = feeNRateFunc.apply(skupType);
286 - quickDeliverServiceFee = feeNRate.getStorageManagementFee(); 286 + quickDeliverServiceFee = feeNRate.getQuickDeliverServiceFee();
287 } 287 }
288 288
289 //现货 or 闪购 商品,且选择了寄存 289 //现货 or 闪购 商品,且选择了寄存
@@ -1789,6 +1789,41 @@ public class InBoxFacade { @@ -1789,6 +1789,41 @@ public class InBoxFacade {
1789 } 1789 }
1790 } 1790 }
1791 1791
  1792 + // 召回的
  1793 + public void recallDepositnotify(int uid, SellerOrderGoods sog) {
  1794 + if (null == sog) {
  1795 + logger.warn("InBoxFacade recallDepositnotify error SellerOrderGoods is null, uid {}", uid);
  1796 + return;
  1797 + }
  1798 + String prdName = sog.getProductName();
  1799 + String sizeName = sog.getSizeName();
  1800 + try {
  1801 + executorService.execute(()->{
  1802 + Product product = productMapper.selectByPrimaryKey(sog.getProductId());
  1803 + String productCode = product.getProductCode();
  1804 +
  1805 + InboxBusinessTypeEnum ibtOfSeller = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_RECALL;
  1806 + String paramsOfSeller = buildParams(prdName, sizeName,productCode);
  1807 + InboxReqVO reqOfSeller = buildInboxReqVO(uid, paramsOfSeller, ibtOfSeller);
  1808 + InBoxResponse respOfSeller = inBoxSDK.addInbox(reqOfSeller);
  1809 + logger.info("record recallDepositnotify to seller inbox msg, uid {}, sog {} resp {}",
  1810 + uid, sog, respOfSeller);
  1811 +
  1812 + String phone = userProxyService.getMobile(uid);
  1813 + if (StringUtils.isBlank(phone)){
  1814 + logger.warn("in recallDepositnotify sms fail, uid {} sog {}", uid, sog);
  1815 + return;
  1816 + }
  1817 + List<String> mobileList = Arrays.asList(phone);
  1818 + String content= getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFY_SELLER_DEPOSIT_RECALL.getContent(),prdName, sizeName, productCode);
  1819 + sendSmsService.smsSendByMobile(content,mobileList);
  1820 + logger.info("record recallDepositnotify inbox sms msg, uid {}, sog {}", uid, sog);
  1821 + });
  1822 + } catch (Exception e) {
  1823 + logger.warn("InBoxFacade recallDepositnotify error inbox msg, uid {}, sog {}", uid, sog, e);
  1824 + }
  1825 + }
  1826 +
1792 public InboxReqVO buildInboxReqVO(int uid, String params, InboxBusinessTypeEnum ibt) { 1827 public InboxReqVO buildInboxReqVO(int uid, String params, InboxBusinessTypeEnum ibt) {
1793 InboxReqVO req = new InboxReqVO(); 1828 InboxReqVO req = new InboxReqVO();
1794 req.setType(ibt.getType()); 1829 req.setType(ibt.getType());
@@ -787,7 +787,7 @@ public class ProductServiceImpl implements ProductService { @@ -787,7 +787,7 @@ public class ProductServiceImpl implements ProductService {
787 } 787 }
788 788
789 private void addStorageNum(Integer skup, Integer storageId, Integer num) { 789 private void addStorageNum(Integer skup, Integer storageId, Integer num) {
790 - LOGGER.info("修改库存:skup={}, storageId={}, num={}", skup, storageId, num); 790 + /* LOGGER.info("修改库存:skup={}, storageId={}, num={}", skup, storageId, num);
791 if (storageId == null) { 791 if (storageId == null) {
792 StoragePrice sp = storagePriceMapper.selectBySkup(skup); 792 StoragePrice sp = storagePriceMapper.selectBySkup(skup);
793 storageId = sp.getStorageId(); 793 storageId = sp.getStorageId();
@@ -801,7 +801,7 @@ public class ProductServiceImpl implements ProductService { @@ -801,7 +801,7 @@ public class ProductServiceImpl implements ProductService {
801 storageMapper.addStorageNum(storageId, num); 801 storageMapper.addStorageNum(storageId, num);
802 } catch (Exception e) { 802 } catch (Exception e) {
803 LOGGER.error("修改库存出错: skup=" + skup + ", storageId=" + storageId + ", num=" + num + ", find storageId is null", e); 803 LOGGER.error("修改库存出错: skup=" + skup + ", storageId=" + storageId + ", num=" + num + ", find storageId is null", e);
804 - } 804 + }*/
805 } 805 }
806 806
807 private StoragePrice checkSkupCanSale(Integer skup) { 807 private StoragePrice checkSkupCanSale(Integer skup) {