Procházet zdrojové kódy

订单状态写入索引

sunyj před 9 roky
rodič
revize
4506a6c9e1

+ 25 - 8
search-console/src/main/java/com/uas/search/console/util/ObjectToDocumentUtils.java

@@ -168,7 +168,8 @@ public class ObjectToDocumentUtils {
 				|| order.getBuyerEnterprise().getUu() == null
 				|| StringUtils.isEmpty(order.getBuyerEnterprise().getEnName()) || order.getSellerEnterprise() == null
 				|| order.getSellerEnterprise().getUu() == null
-				|| StringUtils.isEmpty(order.getSellerEnterprise().getEnName()) || order.getCreatetime() == null) {
+				|| StringUtils.isEmpty(order.getSellerEnterprise().getEnName()) || order.getCreatetime() == null
+				|| order.getStatus() == null) {
 			return null;
 		}
 		Document document = new Document();
@@ -186,6 +187,7 @@ public class ObjectToDocumentUtils {
 		document.add(new TextField(SearchConstants.ORDER_SELLERENNAME_FIELD, order.getSellerEnterprise().getEnName(),
 				Store.YES));
 		document.add(new LongField(SearchConstants.ORDER_CREATETIME_FIELD, order.getCreatetime().getTime(), Store.YES));
+		document.add(new StringField(SearchConstants.ORDER_STATUS_FIELD, String.valueOf(order.getStatus()), Store.YES));
 		return document;
 	}
 
@@ -200,7 +202,7 @@ public class ObjectToDocumentUtils {
 		if (orderDetail == null || orderDetail.getId() == null || StringUtils.isEmpty(orderDetail.getCode())
 				|| orderDetail.getOrderid() == null || orderDetail.getDetno() == null
 				|| StringUtils.isEmpty(orderDetail.getCmpCode()) || StringUtils.isEmpty(orderDetail.getKiName())
-				|| StringUtils.isEmpty(orderDetail.getBrName())) {
+				|| StringUtils.isEmpty(orderDetail.getBrName()) || orderDetail.getStatus() == null) {
 			return null;
 		}
 		Document document = new Document();
@@ -215,6 +217,8 @@ public class ObjectToDocumentUtils {
 				new TextField(SearchConstants.ORDER_DETAIL_COMPONENTCODE_FIELD, orderDetail.getCmpCode(), Store.YES));
 		document.add(new TextField(SearchConstants.ORDER_DETAIL_KINDNAME_FIELD, orderDetail.getKiName(), Store.YES));
 		document.add(new TextField(SearchConstants.ORDER_DETAIL_BRANDNAME_FIELD, orderDetail.getBrName(), Store.YES));
+		document.add(new StringField(SearchConstants.ORDER_DETAIL_STATUS_FIELD, String.valueOf(orderDetail.getStatus()),
+				Store.YES));
 		return document;
 	}
 
@@ -230,7 +234,7 @@ public class ObjectToDocumentUtils {
 				|| orderInvoice.getBuyeruu() == null || StringUtils.isEmpty(orderInvoice.getBuyername())
 				|| orderInvoice.getBuyerEnterprise() == null || orderInvoice.getBuyerEnterprise().getUu() == null
 				|| StringUtils.isEmpty(orderInvoice.getBuyerEnterprise().getEnName())
-				|| orderInvoice.getCreatetime() == null) {
+				|| orderInvoice.getCreatetime() == null || orderInvoice.getStatus() == null) {
 			return null;
 		}
 		Document document = new Document();
@@ -247,6 +251,8 @@ public class ObjectToDocumentUtils {
 				orderInvoice.getBuyerEnterprise().getEnName(), Store.YES));
 		document.add(new LongField(SearchConstants.ORDER_INVOICE_CREATETIME_FIELD,
 				orderInvoice.getCreatetime().getTime(), Store.YES));
+		document.add(new StringField(SearchConstants.ORDER_INVOICE_STATUS_FIELD,
+				String.valueOf(orderInvoice.getStatus()), Store.YES));
 		return document;
 	}
 
@@ -262,7 +268,7 @@ public class ObjectToDocumentUtils {
 				|| StringUtils.isEmpty(orderInvoiceDetail.getCode()) || orderInvoiceDetail.getInvoiceid() == null
 				|| orderInvoiceDetail.getDetno() == null || StringUtils.isEmpty(orderInvoiceDetail.getCmpCode())
 				|| StringUtils.isEmpty(orderInvoiceDetail.getKiName())
-				|| StringUtils.isEmpty(orderInvoiceDetail.getBrName())) {
+				|| StringUtils.isEmpty(orderInvoiceDetail.getBrName()) || orderInvoiceDetail.getStatus() == null) {
 			return null;
 		}
 		Document document = new Document();
@@ -280,6 +286,8 @@ public class ObjectToDocumentUtils {
 				Store.YES));
 		document.add(new TextField(SearchConstants.ORDER_INVOICE_DETAIL_BRANDNAME_FIELD, orderInvoiceDetail.getBrName(),
 				Store.YES));
+		document.add(new StringField(SearchConstants.ORDER_INVOICE_DETAIL_STATUS_FIELD,
+				String.valueOf(orderInvoiceDetail.getStatus()), Store.YES));
 		return document;
 	}
 
@@ -293,7 +301,7 @@ public class ObjectToDocumentUtils {
 	public static Document toDocument(PurchaseSimpleInfo purchase) {
 		if (purchase == null || purchase.getId() == null || StringUtils.isEmpty(purchase.getCode())
 				|| purchase.getSellerenuu() == null || StringUtils.isEmpty(purchase.getSellerenname())
-				|| purchase.getCreatetime() == null) {
+				|| purchase.getCreatetime() == null || purchase.getStatus() == null) {
 			return null;
 		}
 		Document document = new Document();
@@ -304,6 +312,8 @@ public class ObjectToDocumentUtils {
 		document.add(new TextField(SearchConstants.PURCHASE_SELLERENNAME_FIELD, purchase.getSellerenname(), Store.YES));
 		document.add(new LongField(SearchConstants.PURCHASE_CREATETIME_FIELD, purchase.getCreatetime().getTime(),
 				Store.YES));
+		document.add(new StringField(SearchConstants.PURCHASE_STATUS_FIELD, String.valueOf(purchase.getStatus()),
+				Store.YES));
 		return document;
 	}
 
@@ -318,7 +328,7 @@ public class ObjectToDocumentUtils {
 		if (purchaseDetail == null || purchaseDetail.getId() == null || StringUtils.isEmpty(purchaseDetail.getCode())
 				|| purchaseDetail.getPurchaseid() == null || purchaseDetail.getDetno() == null
 				|| StringUtils.isEmpty(purchaseDetail.getCmpCode()) || StringUtils.isEmpty(purchaseDetail.getKiName())
-				|| StringUtils.isEmpty(purchaseDetail.getBrName())) {
+				|| StringUtils.isEmpty(purchaseDetail.getBrName()) || purchaseDetail.getStatus() == null) {
 			return null;
 		}
 		Document document = new Document();
@@ -335,6 +345,8 @@ public class ObjectToDocumentUtils {
 				new TextField(SearchConstants.PURCHASE_DETAIL_KINDNAME_FIELD, purchaseDetail.getKiName(), Store.YES));
 		document.add(
 				new TextField(SearchConstants.PURCHASE_DETAIL_BRANDNAME_FIELD, purchaseDetail.getBrName(), Store.YES));
+		document.add(new StringField(SearchConstants.PURCHASE_DETAIL_STATUS_FIELD,
+				String.valueOf(purchaseDetail.getStatus()), Store.YES));
 		return document;
 	}
 
@@ -348,7 +360,7 @@ public class ObjectToDocumentUtils {
 	public static Document toDocument(PurchaseInvoiceSimpleInfo purchaseInvoice) {
 		if (purchaseInvoice == null || purchaseInvoice.getId() == null || StringUtils.isEmpty(purchaseInvoice.getCode())
 				|| purchaseInvoice.getSellerenuu() == null || StringUtils.isEmpty(purchaseInvoice.getSellerenname())
-				|| purchaseInvoice.getCreatetime() == null) {
+				|| purchaseInvoice.getCreatetime() == null || purchaseInvoice.getStatus() == null) {
 			return null;
 		}
 		Document document = new Document();
@@ -361,6 +373,8 @@ public class ObjectToDocumentUtils {
 				purchaseInvoice.getSellerenname(), Store.YES));
 		document.add(new LongField(SearchConstants.PURCHASE_INVOICE_CREATETIME_FIELD,
 				purchaseInvoice.getCreatetime().getTime(), Store.YES));
+		document.add(new StringField(SearchConstants.PURCHASE_INVOICE_STATUS_FIELD,
+				String.valueOf(purchaseInvoice.getStatus()), Store.YES));
 		return document;
 	}
 
@@ -376,7 +390,8 @@ public class ObjectToDocumentUtils {
 				|| StringUtils.isEmpty(purchaseInvoiceDetail.getCode()) || purchaseInvoiceDetail.getInvoiceid() == null
 				|| purchaseInvoiceDetail.getDetno() == null || StringUtils.isEmpty(purchaseInvoiceDetail.getCmpCode())
 				|| StringUtils.isEmpty(purchaseInvoiceDetail.getKiName())
-				|| StringUtils.isEmpty(purchaseInvoiceDetail.getBrName())) {
+				|| StringUtils.isEmpty(purchaseInvoiceDetail.getBrName())
+				|| purchaseInvoiceDetail.getStatus() == null) {
 			return null;
 		}
 		Document document = new Document();
@@ -394,6 +409,8 @@ public class ObjectToDocumentUtils {
 				purchaseInvoiceDetail.getKiName(), Store.YES));
 		document.add(new TextField(SearchConstants.PURCHASE_INVOICE_DETAIL_BRANDNAME_FIELD,
 				purchaseInvoiceDetail.getBrName(), Store.YES));
+		document.add(new StringField(SearchConstants.PURCHASE_INVOICE_DETAIL_STATUS_FIELD,
+				String.valueOf(purchaseInvoiceDetail.getStatus()), Store.YES));
 		return document;
 	}
 }