package com.yeshi.fanli.service.impl.taobao;
|
|
import javax.annotation.Resource;
|
|
import org.springframework.stereotype.Service;
|
|
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
import com.yeshi.fanli.entity.taobao.TaoBaoShopInfo;
|
import com.yeshi.fanli.log.LogHelper;
|
import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
|
import com.yeshi.fanli.util.db.MongoDBManager;
|
import com.yeshi.fanli.util.taobao.TaoBaoShopUtil;
|
|
@Service
|
public class TaoBaoShopServiceImpl implements TaoBaoShopService {
|
|
@Resource
|
private MongoDBManager mongoDBManager;
|
|
@Override
|
public TaoBaoShopInfo getTaoBaoShopInfo(TaoBaoGoodsBrief goodsInfo) {
|
if (goodsInfo == null)
|
return null;
|
long startTime = System.currentTimeMillis();
|
TaoBaoShopInfo shopInfo = null;
|
try {
|
shopInfo = mongoDBManager.getTBShopInfo(goodsInfo.getSellerId());
|
} catch (Exception e) {
|
LogHelper.error(e);
|
}
|
|
if (shopInfo == null) {
|
shopInfo = TaoBaoShopUtil.getTaoBaoShopInfo(goodsInfo.getShopTitle(), goodsInfo.getSellerId(),
|
goodsInfo.getAuctionId());
|
if (shopInfo != null)
|
try {
|
mongoDBManager.saveTBShopInfo(shopInfo);
|
} catch (Exception e) {
|
}
|
}
|
|
LogHelper.test("获取店铺信息耗时:" + (System.currentTimeMillis() - startTime));
|
return shopInfo;
|
}
|
|
|
|
|
|
}
|