|
|
@@ -21,6 +21,7 @@ import com.uas.search.console.b2b.model.MakeOrderSimpleInfo;
|
|
|
import com.uas.search.console.b2b.model.MakeReturnSimpleInfo;
|
|
|
import com.uas.search.console.b2b.model.PagingReleaseDetailSimpleInfo;
|
|
|
import com.uas.search.console.b2b.model.ProdSimpleInfo;
|
|
|
+import com.uas.search.console.b2b.model.ProductBrandSimpleInfo;
|
|
|
import com.uas.search.console.b2b.model.ProductComponentSimpleInfo;
|
|
|
import com.uas.search.console.b2b.model.PurcProofingapprovalSimpleInfo;
|
|
|
import com.uas.search.console.b2b.model.PurcProofingsendSimpleInfo;
|
|
|
@@ -125,6 +126,8 @@ public class ObjectToDocumentUtils {
|
|
|
return toDocument((PagingReleaseDetailSimpleInfo) object);
|
|
|
} else if (object instanceof VendorSimpleInfo) {
|
|
|
return toDocument((VendorSimpleInfo) object);
|
|
|
+ } else if (object instanceof ProductBrandSimpleInfo) {
|
|
|
+ return toDocument((ProductBrandSimpleInfo) object);
|
|
|
}
|
|
|
// TODO 其他表
|
|
|
else {
|
|
|
@@ -185,10 +188,10 @@ public class ObjectToDocumentUtils {
|
|
|
document.add(new LongField(ClassAndTableNameUtils.combineField(tableName, PurchaseOrderSimpleInfo.DATE_FIELD),
|
|
|
purchaseOrder.getDate().getTime(), Store.YES));
|
|
|
// enterprise、vend和orderItems以json的格式存储
|
|
|
- document.add(new StringField(
|
|
|
+ document.add(new TextField(
|
|
|
ClassAndTableNameUtils.combineField(tableName, PurchaseOrderSimpleInfo.ENTERPRISE_FIELD),
|
|
|
JSONObject.toJSONString(purchaseOrder.getEnterprise()), Store.YES));
|
|
|
- document.add(new StringField(ClassAndTableNameUtils.combineField(tableName, PurchaseOrderSimpleInfo.VEND_FIELD),
|
|
|
+ document.add(new TextField(ClassAndTableNameUtils.combineField(tableName, PurchaseOrderSimpleInfo.VEND_FIELD),
|
|
|
JSONObject.toJSONString(purchaseOrder.getVend()), Store.YES));
|
|
|
if (!CollectionUtils.isEmpty(purchaseOrder.getOrderItems())) {
|
|
|
document.add(
|
|
|
@@ -245,9 +248,9 @@ public class ObjectToDocumentUtils {
|
|
|
makeOrder.getDate().getTime(), Store.YES));
|
|
|
// enterprise、vend和orderItems以json的格式存储
|
|
|
document.add(
|
|
|
- new StringField(ClassAndTableNameUtils.combineField(tableName, MakeOrderSimpleInfo.ENTERPRISE_FIELD),
|
|
|
+ new TextField(ClassAndTableNameUtils.combineField(tableName, MakeOrderSimpleInfo.ENTERPRISE_FIELD),
|
|
|
JSONObject.toJSONString(makeOrder.getEnterprise()), Store.YES));
|
|
|
- document.add(new StringField(ClassAndTableNameUtils.combineField(tableName, MakeOrderSimpleInfo.VEND_FIELD),
|
|
|
+ document.add(new TextField(ClassAndTableNameUtils.combineField(tableName, MakeOrderSimpleInfo.VEND_FIELD),
|
|
|
JSONObject.toJSONString(makeOrder.getVend()), Store.YES));
|
|
|
if (makeOrder.getProduct() != null) {
|
|
|
document.add(
|
|
|
@@ -297,9 +300,10 @@ public class ObjectToDocumentUtils {
|
|
|
}
|
|
|
// vend和items以json的格式存储
|
|
|
document.add(
|
|
|
- new StringField(ClassAndTableNameUtils.combineField(tableName, PurchaseAcceptSimpleInfo.VEND_FIELD),
|
|
|
+ new TextField(ClassAndTableNameUtils.combineField(tableName, PurchaseAcceptSimpleInfo.VEND_FIELD),
|
|
|
JSONObject.toJSONString(purcAccept.getVend()), Store.YES));
|
|
|
- document.add(new StringField(
|
|
|
+ document.add(
|
|
|
+ new TextField(
|
|
|
ClassAndTableNameUtils.combineField(tableName, PurchaseAcceptSimpleInfo.ENTERPRISE_FIELD),
|
|
|
JSONObject.toJSONString(purcAccept.getEnterprise()), Store.YES));
|
|
|
if (!CollectionUtils.isEmpty(purcAccept.getAcceptItems())) {
|
|
|
@@ -348,7 +352,7 @@ public class ObjectToDocumentUtils {
|
|
|
new StringField(ClassAndTableNameUtils.combineField(tableName, SaleQuotationSimpleInfo.STATUS_FIELD),
|
|
|
String.valueOf(saleQuotation.getStatus()), Store.YES));
|
|
|
// vend和items以json的格式存储
|
|
|
- document.add(new StringField(ClassAndTableNameUtils.combineField(tableName, SaleQuotationSimpleInfo.VEND_FIELD),
|
|
|
+ document.add(new TextField(ClassAndTableNameUtils.combineField(tableName, SaleQuotationSimpleInfo.VEND_FIELD),
|
|
|
JSONObject.toJSONString(saleQuotation.getVend()), Store.YES));
|
|
|
document.add(new StringField(
|
|
|
ClassAndTableNameUtils.combineField(tableName, SaleQuotationSimpleInfo.ENTERPRISE_FIELD),
|
|
|
@@ -1879,4 +1883,49 @@ public class ObjectToDocumentUtils {
|
|
|
|
|
|
return document;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 将ProductBrandSimpleInfo 转换成Document
|
|
|
+ *
|
|
|
+ * @param productBrandSimpleInfo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static Document toDocument(ProductBrandSimpleInfo productBrandSimpleInfo) {
|
|
|
+ if (productBrandSimpleInfo == null || productBrandSimpleInfo.getId() == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ Table_name tableName = ClassAndTableNameUtils.toTableName(ProductBrandSimpleInfo.class);
|
|
|
+ Document document = new Document();
|
|
|
+ // 不能用LongField,否则后续实时更新索引时,方法updateDocument(new Term("", ""),
|
|
|
+ // doc)无法根据id进行更新
|
|
|
+ document.add(new StringField(ClassAndTableNameUtils.combineField(tableName, ProductBrandSimpleInfo.ID_FIELD),
|
|
|
+ String.valueOf(productBrandSimpleInfo.getId()), Store.YES));
|
|
|
+ if (null != productBrandSimpleInfo.getUuid()) {
|
|
|
+ document.add(
|
|
|
+ new StringField(ClassAndTableNameUtils.combineField(tableName, ProductBrandSimpleInfo.UUID_FIELD),
|
|
|
+ String.valueOf(productBrandSimpleInfo.getUuid()), Store.YES));
|
|
|
+ }
|
|
|
+ if (null != productBrandSimpleInfo.getNameCn()) {
|
|
|
+ document.add(
|
|
|
+ new StringField(ClassAndTableNameUtils.combineField(tableName, ProductBrandSimpleInfo.NAMECN_FIELD),
|
|
|
+ JSON.toJSONString(productBrandSimpleInfo.getNameCn()), Store.YES));
|
|
|
+ }
|
|
|
+ if (null != productBrandSimpleInfo.getNameEn()) {
|
|
|
+ document.add(
|
|
|
+ new StringField(ClassAndTableNameUtils.combineField(tableName, ProductBrandSimpleInfo.NAMEEN_FIELD),
|
|
|
+ JSON.toJSONString(productBrandSimpleInfo.getNameEn()), Store.YES));
|
|
|
+ }
|
|
|
+ if (null != productBrandSimpleInfo.getVendor()) {
|
|
|
+ document.add(
|
|
|
+ new StringField(ClassAndTableNameUtils.combineField(tableName, ProductBrandSimpleInfo.VENDOR_FIELD),
|
|
|
+ JSON.toJSONString(productBrandSimpleInfo.getVendor()), Store.YES));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 排序字段
|
|
|
+ document.add(new NumericDocValuesField(
|
|
|
+ ClassAndTableNameUtils.combineField(tableName, ProductBrandSimpleInfo.ID_FIELD),
|
|
|
+ productBrandSimpleInfo.getId()));
|
|
|
+
|
|
|
+ return document;
|
|
|
+ }
|
|
|
}
|