Authored by hugufei

Merge branch 'dev_sdy' into wn_delete_productpool

... ... @@ -23,6 +23,7 @@ import com.yoho.search.dal.model.StorageSku;
import com.yoho.search.dal.service.StorageSkuService;
import com.yoho.search.index.model.ESBluk;
import com.yoho.search.index.service.IYohoIndexService;
import com.yoho.search.index.storagesku.IStorageSkuService;
import com.yoho.search.utils.EventReportEnum;
import com.yoho.search.utils.ISearchConstans;
import com.yoho.search.utils.IgnoreSomeException;
... ... @@ -39,8 +40,12 @@ public class StorageSkuIndexService implements ApplicationEventPublisherAware {
private StorageSkuService storageSkuService;
@Autowired
private IYohoIndexService indexService;
// @Autowired
// private Product15DaySalesNumService product15DaySalesNumService;
/**
* 代码构建storagesku服务 -- amos.shan add on 2016-10-28
*/
@Autowired
private IStorageSkuService storageSkuServiceImpl;
// 按Sku更新库存
private ArrayBlockingQueue<Integer> productSkuQueue = new ArrayBlockingQueue<Integer>(200);
... ... @@ -91,21 +96,33 @@ public class StorageSkuIndexService implements ApplicationEventPublisherAware {
// 1、根据sku去取数据库对象
List<Integer> productSkus = this.getElementsFromArrayBlockingQueue(productSkuQueue, 200);
if (!productSkus.isEmpty()) {
storageSkuList.addAll(storageSkuService.selectListProductSkus(productSkus));
if (ISearchConstans.BUILD_STORAGESKUINDEX_USE_CODE) {
storageSkuList.addAll(storageSkuServiceImpl.getStorageSkuIndexBySkus(productSkus));
} else {
storageSkuList.addAll(storageSkuService.selectListProductSkus(productSkus));
}
logger.info("doBulkUpdateStorageSkuIndex[getListBySku], storageSkuList size is [{}], cost [{}]ms", storageSkuList.size(), costStatistics.getCost());
}
// 2、根据skc去取数据库对象
List<Integer> goodsIds = this.getElementsFromArrayBlockingQueue(goodsIdQueue, 200);
if (!goodsIds.isEmpty()) {
storageSkuList.addAll(storageSkuService.selectListByGoodsIds(goodsIds));
if (ISearchConstans.BUILD_STORAGESKUINDEX_USE_CODE) {
storageSkuList.addAll(storageSkuServiceImpl.getStorageSkuIndexBySkcs(goodsIds));
} else {
storageSkuList.addAll(storageSkuService.selectListByGoodsIds(goodsIds));
}
logger.info("doBulkUpdateStorageSkuIndex[getListBySkc], storageSkuList size is [{}], cost [{}]ms", storageSkuList.size(), costStatistics.getCost());
}
// 3、根据skn去取数据库对象
List<Integer> productIds = this.getElementsFromArrayBlockingQueue(productIdQueue, 200);
if (!productIds.isEmpty()) {
storageSkuList.addAll(storageSkuService.selectListByProductIds(productIds));
if (ISearchConstans.BUILD_STORAGESKUINDEX_USE_CODE) {
storageSkuList.addAll(storageSkuServiceImpl.getStorageSkuIndexBySkns(productIds));
} else {
storageSkuList.addAll(storageSkuService.selectListByProductIds(productIds));
}
logger.info("doBulkUpdateStorageSkuIndex[getListBySkn], storageSkuList size is [{}], cost [{}]ms", storageSkuList.size(), costStatistics.getCost());
}
... ... @@ -228,7 +245,7 @@ public class StorageSkuIndexService implements ApplicationEventPublisherAware {
}
List<ESBluk> results = new ArrayList<ESBluk>();
for (StorageSku storageSku : storageSkuList) {
//特殊处理storageSku的某些字段
// 特殊处理storageSku的某些字段
SpecialDealForIndex.specialDealStorageSku(storageSku);
results.add(new ESBluk(JSONObject.toJSONString(this.beanToMap(storageSku)), storageSku.getProductSku().toString(), indexName, indexName, false));
}
... ...
... ... @@ -5,6 +5,11 @@ redis.proxy.auth=
redis.readonly.proxy.address=192.168.102.222
redis.readonly.proxy.port=6379
redis.readonly.proxy.auth=
bigDataRedis-search.proxy.address=192.168.102.222
bigDataRedis-search.proxy.port=6379
bigDataRedis-search.proxy.auth=
#mq
search.mq.server=192.168.102.224
... ... @@ -32,6 +37,9 @@ build.productindex.batch.max.thread.size=10
build.productindex.test=false
build.productindex.use.code=true
#build storageskuIndex
build.storageskuindex.use.code=true
#big data redis
bigDataRedis-search.proxy.address=test-bigdata-redis-1903805580.cn-north-1.elb.amazonaws.com.cn
bigDataRedis-search.proxy.port=6379
... ...
... ... @@ -40,6 +40,9 @@ build.productindex.batch.max.thread.size=10
build.productindex.test=false
build.productindex.use.code=${build.productindex.use.code}
#build storageskuIndex
build.storageskuindex.use.code=${build.storageskuindex.use.code}
#tbl
tbl.product.private.key=a85bb0674e08986c6b115d5e3a4884fa
tbl.product.url=${tbl.product.url}
... ...