|
|
@@ -169,12 +169,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
Long orderInvoiceSize = createOrderInvoiceIndexes();
|
|
|
Long orderInvoiceTime = new Date().getTime();
|
|
|
- logger.info("创建销售单发货单索引: " + orderInvoiceSize + "条,耗时 " + (orderInvoiceTime - orderDetailTime) + " ms\n");
|
|
|
+ logger.info("创建销售发货单索引: " + orderInvoiceSize + "条,耗时 " + (orderInvoiceTime - orderDetailTime) + " ms\n");
|
|
|
|
|
|
Long orderInvoiceDetailSize = createOrderInvoiceDetailIndexes();
|
|
|
Long orderInvoiceDetailTime = new Date().getTime();
|
|
|
- logger.info("创建销售单发货单明细索引: " + orderInvoiceDetailSize + "条,耗时 "
|
|
|
- + (orderInvoiceDetailTime - orderInvoiceTime) + " ms\n");
|
|
|
+ logger.info("创建销售发货单明细索引: " + orderInvoiceDetailSize + "条,耗时 " + (orderInvoiceDetailTime - orderInvoiceTime)
|
|
|
+ + " ms\n");
|
|
|
|
|
|
Long purchaseSize = createPurchaseIndexes();
|
|
|
Long purchaseTime = new Date().getTime();
|
|
|
@@ -186,12 +186,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
Long purchaseInvoiceSize = createPurchaseInvoiceIndexes();
|
|
|
Long purchaseInvoiceTime = new Date().getTime();
|
|
|
- logger.info("创建采购单发货单索引: " + purchaseInvoiceSize + "条,耗时 " + (purchaseInvoiceTime - purchaseDetailTime)
|
|
|
+ logger.info("创建采购发货单索引: " + purchaseInvoiceSize + "条,耗时 " + (purchaseInvoiceTime - purchaseDetailTime)
|
|
|
+ " ms\n");
|
|
|
|
|
|
Long purchaseInvoiceDetailSize = createPurchaseInvoiceDetailIndexes();
|
|
|
Long purchaseInvoiceDetailTime = new Date().getTime();
|
|
|
- logger.info("创建采购单发货单明细索引: " + purchaseInvoiceDetailSize + "条,耗时 "
|
|
|
+ logger.info("创建采购发货单明细索引: " + purchaseInvoiceDetailSize + "条,耗时 "
|
|
|
+ (purchaseInvoiceDetailTime - purchaseInvoiceTime) + " ms\n");
|
|
|
|
|
|
logger.info("索引创建成功, 共用时间 " + (purchaseInvoiceDetailTime - startTime) + " ms");
|
|
|
@@ -218,17 +218,20 @@ public class IndexServiceImpl implements IndexService {
|
|
|
private Long createKindIndexs() throws IOException {
|
|
|
logger.info("正在创建类目索引...");
|
|
|
List<KindSimpleInfo> kinds = kindDao.findAll();
|
|
|
-
|
|
|
- if (CollectionUtils.isEmpty(kinds))
|
|
|
+ if (CollectionUtils.isEmpty(kinds)) {
|
|
|
return 0L;
|
|
|
-
|
|
|
+ }
|
|
|
+ logger.info("发现数据:" + kinds.size() + "条");
|
|
|
+ long count = 0;
|
|
|
for (KindSimpleInfo kind : kinds) {
|
|
|
Document document = toDocument(kind);
|
|
|
- if (document != null)
|
|
|
+ if (document != null) {
|
|
|
indexWriter.addDocument(document);
|
|
|
+ count++;
|
|
|
+ }
|
|
|
}
|
|
|
indexWriter.commit();
|
|
|
- return (long) kinds.size();
|
|
|
+ return count;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -240,17 +243,20 @@ public class IndexServiceImpl implements IndexService {
|
|
|
private Long createBrandIndexs() throws IOException {
|
|
|
logger.info("正在创建品牌索引...");
|
|
|
List<BrandSimpleInfo> brands = brandDao.findAll();
|
|
|
- if (CollectionUtils.isEmpty(brands))
|
|
|
+ if (CollectionUtils.isEmpty(brands)) {
|
|
|
return 0L;
|
|
|
-
|
|
|
+ }
|
|
|
+ logger.info("发现数据:" + brands.size() + "条");
|
|
|
+ long count = 0;
|
|
|
for (BrandSimpleInfo brand : brands) {
|
|
|
Document document = toDocument(brand);
|
|
|
if (document != null) {
|
|
|
indexWriter.addDocument(document);
|
|
|
+ count++;
|
|
|
}
|
|
|
}
|
|
|
indexWriter.commit();
|
|
|
- return (long) brands.size();
|
|
|
+ return count;
|
|
|
}
|
|
|
|
|
|
private Long createComponentIndexesWithFiles() {
|
|
|
@@ -345,48 +351,56 @@ public class IndexServiceImpl implements IndexService {
|
|
|
private Long createOrderIndexes() {
|
|
|
logger.info("正在创建销售单索引...");
|
|
|
List<OrderSimpleInfo> orders = orderDao.findAll();
|
|
|
+ logger.info("发现数据:" + orders.size() + "条");
|
|
|
return createIndexesWithObjects(orders.toArray());
|
|
|
}
|
|
|
|
|
|
private Long createOrderDetailIndexes() {
|
|
|
logger.info("正在创建销售单明细索引...");
|
|
|
List<OrderDetailSimpleInfo> orderDetails = orderDetailDao.findAll();
|
|
|
+ logger.info("发现数据:" + orderDetails.size() + "条");
|
|
|
return createIndexesWithObjects(orderDetails.toArray());
|
|
|
}
|
|
|
|
|
|
private Long createOrderInvoiceIndexes() {
|
|
|
- logger.info("正在创建销售单发货单索引...");
|
|
|
+ logger.info("正在创建销售发货单索引...");
|
|
|
List<OrderInvoiceSimpleInfo> orderInvoices = orderInvoiceDao.findAll();
|
|
|
+ logger.info("发现数据:" + orderInvoices.size() + "条");
|
|
|
return createIndexesWithObjects(orderInvoices.toArray());
|
|
|
}
|
|
|
|
|
|
private Long createOrderInvoiceDetailIndexes() {
|
|
|
- logger.info("正在创建销售单发货单明细索引...");
|
|
|
+ logger.info("正在创建销售发货单明细索引...");
|
|
|
List<OrderInvoiceDetailSimpleInfo> orderInvoiceDetails = orderInvoiceDetailDao.findAll();
|
|
|
+ logger.info("发现数据:" + orderInvoiceDetails.size() + "条");
|
|
|
return createIndexesWithObjects(orderInvoiceDetails.toArray());
|
|
|
}
|
|
|
|
|
|
private Long createPurchaseIndexes() {
|
|
|
logger.info("正在创建采购单索引...");
|
|
|
List<PurchaseSimpleInfo> purchases = purchaseDao.findAll();
|
|
|
+ logger.info("发现数据:" + purchases.size() + "条");
|
|
|
return createIndexesWithObjects(purchases.toArray());
|
|
|
}
|
|
|
|
|
|
private Long createPurchaseDetailIndexes() {
|
|
|
logger.info("正在创建采购单明细索引...");
|
|
|
List<PurchaseDetailSimpleInfo> purchaseDetails = purchaseDetailDao.findAll();
|
|
|
+ logger.info("发现数据:" + purchaseDetails.size() + "条");
|
|
|
return createIndexesWithObjects(purchaseDetails.toArray());
|
|
|
}
|
|
|
|
|
|
private Long createPurchaseInvoiceIndexes() {
|
|
|
- logger.info("正在创建采购单发货单索引...");
|
|
|
+ logger.info("正在创建采购发货单索引...");
|
|
|
List<PurchaseInvoiceSimpleInfo> purchaseInvoices = purchaseInvoiceDao.findAll();
|
|
|
+ logger.info("发现数据:" + purchaseInvoices.size() + "条");
|
|
|
return createIndexesWithObjects(purchaseInvoices.toArray());
|
|
|
}
|
|
|
|
|
|
private Long createPurchaseInvoiceDetailIndexes() {
|
|
|
- logger.info("正在创建采购单发货单明细索引...");
|
|
|
+ logger.info("正在创建采购发货单明细索引...");
|
|
|
List<PurchaseInvoiceDetailSimpleInfo> purchaseInvoiceDetails = purchaseInvoiceDetailDao.findAll();
|
|
|
+ logger.info("发现数据:" + purchaseInvoiceDetails.size() + "条");
|
|
|
return createIndexesWithObjects(purchaseInvoiceDetails.toArray());
|
|
|
}
|
|
|
|
|
|
@@ -404,18 +418,20 @@ public class IndexServiceImpl implements IndexService {
|
|
|
if (objects == null || objects.length < 1)
|
|
|
return 0L;
|
|
|
|
|
|
+ long count = 0;
|
|
|
try {
|
|
|
for (Object object : objects) {
|
|
|
Document document = ObjectToDocumentUtils.toDocument(object);
|
|
|
if (document != null) {
|
|
|
indexWriter.addDocument(document);
|
|
|
+ count++;
|
|
|
}
|
|
|
}
|
|
|
indexWriter.commit();
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- return (long) objects.length;
|
|
|
+ return count;
|
|
|
}
|
|
|
|
|
|
/**
|