|
|
@@ -229,8 +229,8 @@ public class ObjectToDocumentUtils {
|
|
|
public static Document toDocument(PurchaseAcceptSimpleInfo purcAccept) {
|
|
|
if (purcAccept == null || purcAccept.getId() == null || StringUtils.isEmpty(purcAccept.getCode())
|
|
|
|| purcAccept.getVend() == null || purcAccept.getVend().getUu() == null
|
|
|
- || StringUtils.isEmpty(purcAccept.getVend().getEnName()) || StringUtils.isEmpty(purcAccept.getDate())
|
|
|
- || purcAccept.getEnterprise() == null || purcAccept.getEnterprise().getUu() == null
|
|
|
+ || StringUtils.isEmpty(purcAccept.getVend().getEnName()) || purcAccept.getEnterprise() == null
|
|
|
+ || purcAccept.getEnterprise().getUu() == null
|
|
|
|| StringUtils.isEmpty(purcAccept.getEnterprise().getEnName())) {
|
|
|
return null;
|
|
|
}
|
|
|
@@ -242,8 +242,11 @@ public class ObjectToDocumentUtils {
|
|
|
String.valueOf(purcAccept.getId()), Store.YES));
|
|
|
document.add(new TextField(ClassAndTableNameUtils.combineField(tableName, PurchaseAcceptSimpleInfo.CODE_FIELD),
|
|
|
String.valueOf(purcAccept.getCode()), Store.YES));
|
|
|
- document.add(new LongField(ClassAndTableNameUtils.combineField(tableName, PurchaseAcceptSimpleInfo.DATE_FIELD),
|
|
|
- purcAccept.getDate().getTime(), Store.YES));
|
|
|
+ if (!StringUtils.isEmpty(purcAccept.getDate())) {
|
|
|
+ document.add(
|
|
|
+ new LongField(ClassAndTableNameUtils.combineField(tableName, PurchaseAcceptSimpleInfo.DATE_FIELD),
|
|
|
+ purcAccept.getDate().getTime(), Store.YES));
|
|
|
+ }
|
|
|
// vend和items以json的格式存储
|
|
|
document.add(new TextField(ClassAndTableNameUtils.combineField(tableName, PurchaseAcceptSimpleInfo.VEND_FIELD),
|
|
|
JSONObject.toJSONString(purcAccept.getVend()), Store.YES));
|
|
|
@@ -346,7 +349,6 @@ public class ObjectToDocumentUtils {
|
|
|
public static Document toDocument(PurchaseBadinSimpleInfo purchBadin) {
|
|
|
if (purchBadin == null || purchBadin.getId() == null || StringUtils.isEmpty(purchBadin.getCode())
|
|
|
|| purchBadin.getVend() == null || purchBadin.getVend().getUu() == null
|
|
|
- || StringUtils.isEmpty(purchBadin.getSendCode()) || StringUtils.isEmpty(purchBadin.getDate())
|
|
|
|| StringUtils.isEmpty(purchBadin.getVend().getEnName()) || purchBadin.getEnterprise() == null
|
|
|
|| purchBadin.getEnterprise().getUu() == null
|
|
|
|| StringUtils.isEmpty(purchBadin.getEnterprise().getEnName())) {
|
|
|
@@ -360,11 +362,17 @@ public class ObjectToDocumentUtils {
|
|
|
String.valueOf(purchBadin.getId()), Store.YES));
|
|
|
document.add(new TextField(ClassAndTableNameUtils.combineField(tableName, PurchaseBadinSimpleInfo.CODE_FIELD),
|
|
|
String.valueOf(purchBadin.getCode()), Store.YES));
|
|
|
- document.add(new LongField(ClassAndTableNameUtils.combineField(tableName, PurchaseBadinSimpleInfo.DATE_FIELD),
|
|
|
- purchBadin.getDate().getTime(), Store.YES));
|
|
|
- document.add(
|
|
|
- new StringField(ClassAndTableNameUtils.combineField(tableName, PurchaseBadinSimpleInfo.SENDCODE_FIELD),
|
|
|
- String.valueOf(purchBadin.getSendCode()), Store.YES));
|
|
|
+ if (!StringUtils.isEmpty(purchBadin.getDate())) {
|
|
|
+ document.add(
|
|
|
+ new LongField(ClassAndTableNameUtils.combineField(tableName, PurchaseBadinSimpleInfo.DATE_FIELD),
|
|
|
+ purchBadin.getDate().getTime(), Store.YES));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!StringUtils.isEmpty(purchBadin.getSendCode())) {
|
|
|
+ document.add(new StringField(
|
|
|
+ ClassAndTableNameUtils.combineField(tableName, PurchaseBadinSimpleInfo.SENDCODE_FIELD),
|
|
|
+ String.valueOf(purchBadin.getSendCode()), Store.YES));
|
|
|
+ }
|
|
|
// vend和items以json的格式存储
|
|
|
document.add(new TextField(ClassAndTableNameUtils.combineField(tableName, PurchaseBadinSimpleInfo.VEND_FIELD),
|
|
|
JSONObject.toJSONString(purchBadin.getVend()), Store.YES));
|