Authored by Lixiaodi

物权转移

@@ -9,6 +9,7 @@ import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum; @@ -9,6 +9,7 @@ import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum;
9 import com.yohobuy.ufo.model.order.resp.PageResp; 9 import com.yohobuy.ufo.model.order.resp.PageResp;
10 import com.yohoufo.common.ApiResponse; 10 import com.yohoufo.common.ApiResponse;
11 import com.yohoufo.common.cache.ControllerCacheAop; 11 import com.yohoufo.common.cache.ControllerCacheAop;
  12 +import com.yohoufo.common.caller.UfoServiceCaller;
12 import com.yohoufo.common.exception.UfoServiceException; 13 import com.yohoufo.common.exception.UfoServiceException;
13 import com.yohoufo.common.helper.ImageUrlAssist; 14 import com.yohoufo.common.helper.ImageUrlAssist;
14 import com.yohoufo.dal.order.SellerOrderGoodsMapper; 15 import com.yohoufo.dal.order.SellerOrderGoodsMapper;
@@ -16,6 +17,7 @@ import com.yohoufo.dal.order.StorageDepositMapper; @@ -16,6 +17,7 @@ import com.yohoufo.dal.order.StorageDepositMapper;
16 import com.yohoufo.dal.order.model.SellerOrderGoods; 17 import com.yohoufo.dal.order.model.SellerOrderGoods;
17 import com.yohoufo.dal.order.model.StorageDeposit; 18 import com.yohoufo.dal.order.model.StorageDeposit;
18 import com.yohoufo.dal.order.model.StorageDepositCount; 19 import com.yohoufo.dal.order.model.StorageDepositCount;
  20 +import com.yohoufo.dal.user.model.ZhiMaCert;
19 import com.yohoufo.order.controller.DepositController; 21 import com.yohoufo.order.controller.DepositController;
20 import com.yohoufo.order.service.DepositService; 22 import com.yohoufo.order.service.DepositService;
21 import com.yohoufo.order.service.proxy.ProductProxyService; 23 import com.yohoufo.order.service.proxy.ProductProxyService;
@@ -40,6 +42,9 @@ public class DepositServiceImpl implements DepositService { @@ -40,6 +42,9 @@ public class DepositServiceImpl implements DepositService {
40 private ControllerCacheAop cacheAop; 42 private ControllerCacheAop cacheAop;
41 43
42 @Autowired 44 @Autowired
  45 + private UfoServiceCaller ufoServiceCaller;
  46 +
  47 + @Autowired
43 private ProductProxyService productProxyService; 48 private ProductProxyService productProxyService;
44 49
45 @Autowired 50 @Autowired
@@ -264,6 +269,7 @@ public class DepositServiceImpl implements DepositService { @@ -264,6 +269,7 @@ public class DepositServiceImpl implements DepositService {
264 LOGGER.info("sale success! uid {}, skup is {}, buyOrderCode is {}, newUid is {}", uid, skup, buyOrderCode, newUid); 269 LOGGER.info("sale success! uid {}, skup is {}, buyOrderCode is {}, newUid is {}", uid, skup, buyOrderCode, newUid);
265 sd.setId(null); 270 sd.setId(null);
266 sd.setOwnerUid(newUid); 271 sd.setOwnerUid(newUid);
  272 + long orderCode = sd.getOrderCode();
267 sd.setOrderCode(buyOrderCode); 273 sd.setOrderCode(buyOrderCode);
268 sd.setSkup(sd.getNewSkup()); 274 sd.setSkup(sd.getNewSkup());
269 sd.setStatus(isDeposit ? 1 : 2); 275 sd.setStatus(isDeposit ? 1 : 2);
@@ -274,9 +280,12 @@ public class DepositServiceImpl implements DepositService { @@ -274,9 +280,12 @@ public class DepositServiceImpl implements DepositService {
274 sd.setCreateTime(now); 280 sd.setCreateTime(now);
275 sd.setDepositStartTime(now); 281 sd.setDepositStartTime(now);
276 sd.setDepositEndTime(now + DEPOSIT_MAX_TIME); 282 sd.setDepositEndTime(now + DEPOSIT_MAX_TIME);
  283 + sd.setDelStatus(0);
  284 + sd.setNewOrderCode(0L);
  285 + sd.setNewSkup(0);
277 LOGGER.info("new owner record is sd", sd); 286 LOGGER.info("new owner record is sd", sd);
278 storageDepositMapper.insert(sd); 287 storageDepositMapper.insert(sd);
279 - 288 + autoTransfer(orderCode, newUid);
280 clearCache(uid, sd.getProductId(), sd.getStorageId()); 289 clearCache(uid, sd.getProductId(), sd.getStorageId());
281 return true; 290 return true;
282 } 291 }
@@ -352,6 +361,15 @@ public class DepositServiceImpl implements DepositService { @@ -352,6 +361,15 @@ public class DepositServiceImpl implements DepositService {
352 .build(); 361 .build();
353 } 362 }
354 363
  364 + private void autoTransfer(Long orderCode, Integer toUid) {
  365 + try {
  366 + ApiResponse resp = ufoServiceCaller.call("ufo.product.autoTransfer", ApiResponse.class, orderCode, toUid);
  367 + LOGGER.info("物权转移接口调用结果:{}", resp);
  368 + } catch (Exception e) {
  369 + LOGGER.error("物权转移接口调用失败!", e);
  370 + }
  371 + }
  372 +
355 private String getBackStatusName(Integer code) { 373 private String getBackStatusName(Integer code) {
356 return StorageDepositStatusEnum.getAppStatusNameByCode(code); 374 return StorageDepositStatusEnum.getAppStatusNameByCode(code);
357 } 375 }