Authored by Lixiaodi

物权转移

... ... @@ -9,6 +9,7 @@ import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum;
import com.yohobuy.ufo.model.order.resp.PageResp;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.cache.ControllerCacheAop;
import com.yohoufo.common.caller.UfoServiceCaller;
import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.common.helper.ImageUrlAssist;
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
... ... @@ -16,6 +17,7 @@ import com.yohoufo.dal.order.StorageDepositMapper;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.dal.order.model.StorageDeposit;
import com.yohoufo.dal.order.model.StorageDepositCount;
import com.yohoufo.dal.user.model.ZhiMaCert;
import com.yohoufo.order.controller.DepositController;
import com.yohoufo.order.service.DepositService;
import com.yohoufo.order.service.proxy.ProductProxyService;
... ... @@ -40,6 +42,9 @@ public class DepositServiceImpl implements DepositService {
private ControllerCacheAop cacheAop;
@Autowired
private UfoServiceCaller ufoServiceCaller;
@Autowired
private ProductProxyService productProxyService;
@Autowired
... ... @@ -264,6 +269,7 @@ public class DepositServiceImpl implements DepositService {
LOGGER.info("sale success! uid {}, skup is {}, buyOrderCode is {}, newUid is {}", uid, skup, buyOrderCode, newUid);
sd.setId(null);
sd.setOwnerUid(newUid);
long orderCode = sd.getOrderCode();
sd.setOrderCode(buyOrderCode);
sd.setSkup(sd.getNewSkup());
sd.setStatus(isDeposit ? 1 : 2);
... ... @@ -274,9 +280,12 @@ public class DepositServiceImpl implements DepositService {
sd.setCreateTime(now);
sd.setDepositStartTime(now);
sd.setDepositEndTime(now + DEPOSIT_MAX_TIME);
sd.setDelStatus(0);
sd.setNewOrderCode(0L);
sd.setNewSkup(0);
LOGGER.info("new owner record is sd", sd);
storageDepositMapper.insert(sd);
autoTransfer(orderCode, newUid);
clearCache(uid, sd.getProductId(), sd.getStorageId());
return true;
}
... ... @@ -352,6 +361,15 @@ public class DepositServiceImpl implements DepositService {
.build();
}
private void autoTransfer(Long orderCode, Integer toUid) {
try {
ApiResponse resp = ufoServiceCaller.call("ufo.product.autoTransfer", ApiResponse.class, orderCode, toUid);
LOGGER.info("物权转移接口调用结果:{}", resp);
} catch (Exception e) {
LOGGER.error("物权转移接口调用失败!", e);
}
}
private String getBackStatusName(Integer code) {
return StorageDepositStatusEnum.getAppStatusNameByCode(code);
}
... ...