package com.uas.search.console.b2b.util;

import com.uas.search.util.StringUtils;
import com.alibaba.fastjson.JSONObject;
import com.uas.search.b2b.exception.SearchException;
import com.uas.search.b2b.service.SearchService.Table_name;
import com.uas.search.console.b2b.model.*;
import com.uas.search.console.b2b.platformmanager.model.UserSpaceDetailSimpleInfo;
import org.apache.lucene.document.Document;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

/**
 * 将Document转换为对象的工具类
 * 
 * @author sunyj
 * @since 2016年11月9日 下午3:31:06
 */

public class DocumentToObjectUtils {

	/**
	 * 将Document转换为对象
	 * 
	 * @param <T>
	 * 
	 * @param document
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public static <T> T toObject(Document document, Class<T> clazz) {
		if (clazz == null) {
			return null;
		}
		if (clazz == PurchaseOrderSimpleInfo.class) {
			return (T) toPurchaseOrder(document);
		} else if (clazz == MakeOrderSimpleInfo.class) {
			return (T) toMakeOrder(document);
		} else if (clazz == PurchaseAcceptSimpleInfo.class) {
			return (T) toPurchaseAccept(document);
		} else if (clazz == SaleQuotationSimpleInfo.class) {
			return (T) toSaleQuotation(document);
		} else if (clazz == PurchaseApbillSimpleInfo.class) {
			return (T) toPurchaseApbill(document);
		} else if (clazz == PurchaseBadinSimpleInfo.class) {
			return (T) toPurchaseBadin(document);
		} else if (clazz == PurchaseBadoutSimpleInfo.class) {
			return (T) toPurchaseBadout(document);
		} else if (clazz == PurchaseForecastSimpleInfo.class) {
			return (T) toPurchaseForecast(document);
		} else if (clazz == PurchaseMrbSimpleInfo.class) {
			return (T) toPurchaseMrb(document);
		} else if (clazz == PurchaseChangesSimpleInfo.class) {
			return (T) toPurchaseChanges(document);
		} else if (clazz == PurchaseReturnSimpleInfo.class) {
			return (T) toPurchaseReturn(document);
		} else if (clazz == MakeAcceptSimpleInfo.class) {
			return (T) toMakeAccept(document);
		} else if (clazz == MakeOrderChangeItemSimpleInfo.class) {
			return (T) toMakeChangeItem(document);
		} else if (clazz == MakeReturnSimpleInfo.class) {
			return (T) toMakeReturn(document);
		} else if (clazz == SaleSendSimpleInfo.class) {
			return (T) toSaleSend(document);
		} else if (clazz == PurchaseNoticeSimpleInfo.class) {
			return (T) toPurchaseNotice(document);
		} else if (clazz == PurcProofingapprovalSimpleInfo.class) {
			return (T) toPurcProofingapproval(document);
		} else if (clazz == PurcProofingsendSimpleInfo.class) {
			return (T) toPurcProofingsend(document);
		} else if (clazz == SaleArcheckSimpleInfo.class) {
			return (T) toSaleArcheck(document);
		} else if (clazz == PurchaseApCheckSimpleInfo.class) {
			return (T) toPurcApcheck(document);
		} else if (clazz == PurchaseInquiryItemSimpleInfo.class) {
			return (T) toInquiryItem(document);
		} else if (clazz == PurchaseProofingItemSimpleInfo.class) {
			return (T) toPurchaseProofingItem(document);
		} else if (clazz == PurchaseInquiryMouldSimpleInfo.class) {
			return (T) toPurchaseInquiryMould(document);
		} else if (clazz == ProdSimpleInfo.class) {
			return (T) toProd(document);
		} else if (clazz == EnterpriseSearchSimpleInfo.class) {
			return (T) toEnterprise(document);
		} else if (clazz == ProductComponentSimpleInfo.class) {
			return (T) toProdComponent(document);
		} else if (clazz == DeputyOrderSimpleInfo.class) {
			return (T) toDeputyOrder(document);
		} else if (clazz == PurchaseTenderSimpleInfo.class) {
			return (T) toPurchaseTenderSimpleInfo(document);
		} else if (clazz == PagingReleaseDetailSimpleInfo.class) {
			return (T) toPagingReleaseDetailSimpleInfo(document);
		} else if (clazz == VendorSimpleInfo.class) {
			return (T) toVendorSimpleInfo(document);
		} else if (clazz == CustmerSimpleInfo.class) {
			return (T) toCustmerSimpleInfo(document);
		} else if (clazz == ProductBrandSimpleInfo.class) {
			return (T) toProductBrandSimpleInfo(document);
		} else if (clazz == UserSpaceDetailSimpleInfo.class) {
			return (T) toUserSpaceDetail(document);
		} else if (clazz == PurcInquirySimpleInfo.class) {
			return (T) toPurcInquiry(document);
		} else if (clazz == PurcInquiryItemSimpleInfo2.class) {
			return (T) toPurcInquirySimpleInfo(document);
		} else if (clazz == InvitationRecordSimpleInfo.class) {
			return (T) toInvitationRecordSimpleInfo(document);
		} else if (clazz == ErpSaleTenderSimpleInfo.class) {
			return (T) toErpSaleTenderSimpleInfo(document);
		} else if (clazz == CartSimpleInfo.class) {
			return (T) toCartSimpleInfo(document);
		} else if (clazz == ProdStandardSimpleInfo.class) {
			return (T) toProdStandardSimpleInfo(document);
		} else if (clazz == ProdNonStandardSimpleInfo.class) {
			return (T) toProdNonStandardSimpleInfo(document);
		} else if (clazz == KindSimpleInfo.class) {
			return (T) toKindSimpleInfo(document);
		} else if (clazz == B2BSaleTenderSimpleInfo.class) {
			return (T) toB2BSaleTenderSimpleInfo(document);
		} else if (clazz == PurchaseApBillOutSimpleInfo.class) {
			return (T) toPurchaseApBillOutSimpleInfo(document);
		} else if (clazz == SaleTenderQuestionSimpleInfo.class) {
			return (T) toSaleTenderQuestionSimpleInfo(document);
		} else if (clazz == VendorPerformanceAssessSimpleInfo.class) {
			return (T) toVendorPerformanceAssessSimpleInfo(document);
		} else if (clazz == ProductUsersSimpleInfo.class) {
            return (T) toProductUsersSimpleInfo(document);
        }

		// TODO 其他表
		else {
			throw new SearchException("不支持将Document转为类型：" + clazz.getName());
		}
	}

    /**
     * 用户个人产品表
     *
     * @author hejq
     * @param document
     * @return
     */
    private static ProductUsersSimpleInfo toProductUsersSimpleInfo(Document document) {
	    if(document == null) {
	        return null;
        }
        Table_name tableName = ClassAndTableNameUtils.toTableName(ProductUsersSimpleInfo.class);
        ProductUsersSimpleInfo productUsersSimpleInfo = new ProductUsersSimpleInfo();
        productUsersSimpleInfo.setId(
                Long.valueOf(document.get(ClassAndTableNameUtils.combineField(tableName, ProductUsersSimpleInfo.ID_FIELD))));
        productUsersSimpleInfo.setEnuu(
                Long.valueOf(document.get(ClassAndTableNameUtils.combineField(tableName, ProductUsersSimpleInfo.ENUU_FIELD))));
        productUsersSimpleInfo.setUseruu(
                Long.valueOf(document.get(ClassAndTableNameUtils.combineField(tableName, ProductUsersSimpleInfo.USERUU_FIELD))));
        productUsersSimpleInfo.setDate(new Date(Long.valueOf(document
                .get(ClassAndTableNameUtils.combineField(tableName, ProductUsersSimpleInfo.DATE_FIELD)))));
        productUsersSimpleInfo.setProduct(JSONObject.parseObject(
                document.get( ClassAndTableNameUtils.combineField(tableName, ProductUsersSimpleInfo.PRODUCT_FIELD)),
		        ProdSimpleInfo.class));
        return productUsersSimpleInfo;
    }

    private static KindSimpleInfo toKindSimpleInfo(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(KindSimpleInfo.class);
		KindSimpleInfo kindSimpleInfo = new KindSimpleInfo();
		kindSimpleInfo.setId(
				Long.valueOf(document.get(ClassAndTableNameUtils.combineField(tableName, KindSimpleInfo.ID_FIELD))));
		String nameCn = document.get(ClassAndTableNameUtils.combineField(tableName, KindSimpleInfo.NAMECN_FIELD));
		if (nameCn != null) {
			kindSimpleInfo.setNameCn(nameCn);
		}
		String nameEn = document.get(ClassAndTableNameUtils.combineField(tableName, KindSimpleInfo.NAMEEN_FIELD));
		if (nameEn != null) {
			kindSimpleInfo.setNameEn(nameEn);
		}
		return kindSimpleInfo;
	}

	private static ProdNonStandardSimpleInfo toProdNonStandardSimpleInfo(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(ProdNonStandardSimpleInfo.class);
		ProdNonStandardSimpleInfo prodSimpleInfo = new ProdNonStandardSimpleInfo();
		prodSimpleInfo.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, ProdNonStandardSimpleInfo.ID_FIELD))));
		prodSimpleInfo.setProdCode(
				document.get(ClassAndTableNameUtils.combineField(tableName, ProdNonStandardSimpleInfo.CODE_FIELD)));
		String title = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdNonStandardSimpleInfo.TITLE_FIELD));
		String issale = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdNonStandardSimpleInfo.ISSALE_FIELD));
		if (null != issale) {
			prodSimpleInfo.setIssale(Short.valueOf(issale));
		}
		String ispurc = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdNonStandardSimpleInfo.ISPURC_FIELD));
		if (null != ispurc) {
			prodSimpleInfo.setIsPurchase(Short.valueOf(ispurc));
		}
		String isshow = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdNonStandardSimpleInfo.ISSHOW_FIELD));
		if (null != isshow) {
			prodSimpleInfo.setIsShow(Short.valueOf(isshow));
		}
		String ispubsale = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdNonStandardSimpleInfo.ISPUBSALE_FIELD));
		if (null != ispubsale) {
			prodSimpleInfo.setIsPubsale(Short.valueOf(ispubsale));
		}
		String uuid = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdNonStandardSimpleInfo.UUID_FIELD));
		if (null != uuid) {
			prodSimpleInfo.setUuid(uuid);
		}
		String cmpCode = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdNonStandardSimpleInfo.CMPCODE_FIELD));
		if (null != cmpCode) {
			prodSimpleInfo.setCmpCode(cmpCode);
		}
		String standard = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdNonStandardSimpleInfo.STANDARD_FIELD));
		if (null != standard) {
			prodSimpleInfo.setStandard(Short.valueOf(standard));
		}
		String matchstatus = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdNonStandardSimpleInfo.MATCHESTAUTS_FIELD));
		if (null != matchstatus) {
			prodSimpleInfo.setMatchstatus(Short.valueOf(matchstatus));
		}
		if (null != title) {
			prodSimpleInfo.setProdTitle(title);
		}
		String spec = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdNonStandardSimpleInfo.SPEC_FIELD));
		if (null != spec) {
			prodSimpleInfo.setProdSpec(spec);
		}
		String brand = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdNonStandardSimpleInfo.BRAND_FIELD));
		if (null != brand) {
			prodSimpleInfo.setBrand(brand);
		}
		prodSimpleInfo.setEnterprise(JSONObject.parseObject(
				document.get(
						ClassAndTableNameUtils.combineField(tableName, ProdNonStandardSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		String matchsize = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdNonStandardSimpleInfo.MATCHESIZE_FIELD));
		if (null != matchsize) {
			prodSimpleInfo.setMatchsize(Integer.valueOf(matchsize));
		} else {
			prodSimpleInfo.setMatchsize((int) 0);
		}
		return prodSimpleInfo;
	}

	private static ProdStandardSimpleInfo toProdStandardSimpleInfo(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(ProdStandardSimpleInfo.class);
		ProdStandardSimpleInfo prodSimpleInfo = new ProdStandardSimpleInfo();
		prodSimpleInfo.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, ProdStandardSimpleInfo.ID_FIELD))));
		prodSimpleInfo.setProdCode(
				document.get(ClassAndTableNameUtils.combineField(tableName, ProdStandardSimpleInfo.CODE_FIELD)));
		String issale = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdStandardSimpleInfo.ISSALE_FIELD));
		if (null != issale) {
			prodSimpleInfo.setIssale(Short.valueOf(issale));
		}
		String ispurc = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdStandardSimpleInfo.ISPURC_FIELD));
		if (null != ispurc) {
			prodSimpleInfo.setIsPurchase(Short.valueOf(ispurc));
		}
		String isshow = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdStandardSimpleInfo.ISSHOW_FIELD));
		if (null != isshow) {
			prodSimpleInfo.setIsShow(Short.valueOf(isshow));
		}
		String ispubsale = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdStandardSimpleInfo.ISPUBSALE_FIELD));
		if (null != ispubsale) {
			prodSimpleInfo.setIsPubsale(Short.valueOf(ispubsale));
		}
		String uuid = document.get(ClassAndTableNameUtils.combineField(tableName, ProdStandardSimpleInfo.UUID_FIELD));
		if (null != uuid) {
			prodSimpleInfo.setUuid(uuid);
		}
		String standard = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdStandardSimpleInfo.STANDARD_FIELD));
		if (null != standard) {
			prodSimpleInfo.setStandard(Short.valueOf(standard));
		}
		String matchstatus = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdStandardSimpleInfo.MATCHESTAUTS_FIELD));
		if (null != matchstatus) {
			prodSimpleInfo.setMatchstatus(Short.valueOf(matchstatus));
		}
		prodSimpleInfo.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, ProdStandardSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		String matchsize = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdStandardSimpleInfo.MATCHESIZE_FIELD));
		if (null != matchsize) {
			prodSimpleInfo.setMatchsize(Integer.valueOf(matchsize));
		} else {
			prodSimpleInfo.setMatchsize((int) 0);
		}
		String kind = document.get(ClassAndTableNameUtils.combineField(tableName, ProdStandardSimpleInfo.KIND_FIELD));
		if (null != kind) {
			prodSimpleInfo.setKind(kind);
		}
		String kinden = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdStandardSimpleInfo.KINDEN_FIELD));
		if (null != kinden) {
			prodSimpleInfo.setKinden(kinden);
		}
		String pbranden = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdStandardSimpleInfo.PBRANDEN_FIELD));
		if (null != pbranden) {
			prodSimpleInfo.setPbranden(pbranden);
		}
		String pbrand = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdStandardSimpleInfo.PBRAND_FIELD));
		if (null != pbrand) {
			prodSimpleInfo.setPbrand(pbrand);
		}
		String pcmpCode = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdStandardSimpleInfo.PCMPCODE_FIELD));
		if (null != pcmpCode) {
			prodSimpleInfo.setPcmpcode(pcmpCode);
		}
		return prodSimpleInfo;
	}

	private static InvitationRecordSimpleInfo toInvitationRecordSimpleInfo(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(InvitationRecordSimpleInfo.class);
		InvitationRecordSimpleInfo invitation = new InvitationRecordSimpleInfo();
		invitation.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, InvitationRecordSimpleInfo.ID_FIELD))));
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, InvitationRecordSimpleInfo.ENUU_FIELD))) {
			invitation.setEnuu(Long.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, InvitationRecordSimpleInfo.ENUU_FIELD))));
		}
		String active = document
				.get(ClassAndTableNameUtils.combineField(tableName, InvitationRecordSimpleInfo.ACTIVE_FIELD));
		if (null != active) {
			invitation.setActive(Short.valueOf(active));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, InvitationRecordSimpleInfo.VENDNAME_FIELD))) {
			invitation.setVendname(document
					.get(ClassAndTableNameUtils.combineField(tableName, InvitationRecordSimpleInfo.VENDNAME_FIELD)));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, InvitationRecordSimpleInfo.USERUU_FIELD))) {
			invitation.setUser(JSONObject.parseObject(
					document.get(
							ClassAndTableNameUtils.combineField(tableName, InvitationRecordSimpleInfo.USERUU_FIELD)),
					UserSimpleInfo.class));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, InvitationRecordSimpleInfo.VENDUSEREMAIL_FIELD))) {
			invitation.setVenduseremail(document.get(
					ClassAndTableNameUtils.combineField(tableName, InvitationRecordSimpleInfo.VENDUSEREMAIL_FIELD)));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, InvitationRecordSimpleInfo.VENDUSERNAME_FIELD))) {
			invitation.setVendusername(document.get(
					ClassAndTableNameUtils.combineField(tableName, InvitationRecordSimpleInfo.VENDUSERNAME_FIELD)));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, InvitationRecordSimpleInfo.VENDUSERTEL_FIELD))) {
			invitation.setVendusertel(document
					.get(ClassAndTableNameUtils.combineField(tableName, InvitationRecordSimpleInfo.VENDUSERTEL_FIELD)));
		}
		return invitation;
	}

	private static PurcInquiryItemSimpleInfo2 toPurcInquirySimpleInfo(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PurcInquiryItemSimpleInfo2.class);
		PurcInquiryItemSimpleInfo2 purcInquiryItem = new PurcInquiryItemSimpleInfo2();
		purcInquiryItem.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurcInquiryItemSimpleInfo2.ID_FIELD))));
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcInquiryItemSimpleInfo2.PRODUCT_FIELD))) {
			purcInquiryItem.setProduct(JSONObject.parseObject(
					document.get(
							ClassAndTableNameUtils.combineField(tableName, PurcInquiryItemSimpleInfo2.PRODUCT_FIELD)),
					ProductSimpleInfo.class));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcInquiryItemSimpleInfo2.OVERDUE_FIELD))) {
			purcInquiryItem.setOverdue(Short.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurcInquiryItemSimpleInfo2.OVERDUE_FIELD))));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcInquiryItemSimpleInfo2.INQUIRY_FIELD))) {
			purcInquiryItem.setInquiry(JSONObject.parseObject(
					document.get(
							ClassAndTableNameUtils.combineField(tableName, PurcInquiryItemSimpleInfo2.INQUIRY_FIELD)),
					PurcInquirySimpleInfo2.class));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcInquiryItemSimpleInfo2.ISOPEN_FIELD))) {
			purcInquiryItem.setIsOpen(Short.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurcInquiryItemSimpleInfo2.ISOPEN_FIELD))));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcInquiryItemSimpleInfo2.STATUS_FIELD))) {
			purcInquiryItem.setStatus(Short.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurcInquiryItemSimpleInfo2.STATUS_FIELD))));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcInquiryItemSimpleInfo2.AGREED_FIELD))) {
			purcInquiryItem.setAgreed(Short.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurcInquiryItemSimpleInfo2.AGREED_FIELD))));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcInquiryItemSimpleInfo2.DATE_FIELD))) {
			purcInquiryItem.setDate(new Date(Long.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName,PurcInquiryItemSimpleInfo2.DATE_FIELD)))));
		}
		return purcInquiryItem;
	}

	private static PurcInquirySimpleInfo toPurcInquiry(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PurcInquirySimpleInfo.class);
		PurcInquirySimpleInfo inquiry = new PurcInquirySimpleInfo();
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, PurcInquirySimpleInfo.ID_FIELD))) {
			inquiry.setId(Long.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, PurcInquirySimpleInfo.ID_FIELD))));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, PurcInquirySimpleInfo.CODE_FIELD))) {
			inquiry.setCode(
					document.get(ClassAndTableNameUtils.combineField(tableName, PurcInquirySimpleInfo.CODE_FIELD)));
		}

		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcInquirySimpleInfo.ENTERYSTATUS_FIELD))) {
			inquiry.setEnteryStatus(Integer.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurcInquirySimpleInfo.ENTERYSTATUS_FIELD))));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, PurcInquirySimpleInfo.ISOPEN_FIELD))) {
			inquiry.setIsOpen(Short.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, PurcInquirySimpleInfo.ISOPEN_FIELD))));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcInquirySimpleInfo.RECORDERUU_FIELD))) {
			inquiry.setRecorderUU(Long.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurcInquirySimpleInfo.RECORDERUU_FIELD))));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcInquirySimpleInfo.RECORDER_FIELD))) {
			inquiry.setCode(
					document.get(ClassAndTableNameUtils.combineField(tableName, PurcInquirySimpleInfo.RECORDER_FIELD)));
		}

		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, PurcInquirySimpleInfo.ITEMS_FIELD))) {
			inquiry.setInquiryItems(toSet(
					document.get(ClassAndTableNameUtils.combineField(tableName, PurcInquirySimpleInfo.ITEMS_FIELD)),
					PurcInquiryItemSimpleInfo.class));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcInquirySimpleInfo.ENTERPRISE_FIELD))) {
			inquiry.setEnterprise(JSONObject.parseObject(
					document.get(
							ClassAndTableNameUtils.combineField(tableName, PurcInquirySimpleInfo.ENTERPRISE_FIELD)),
					EnterpriseSimpleInfo.class));
		}
		return inquiry;
	}

	private static UserSpaceDetailSimpleInfo toUserSpaceDetail(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(UserSpaceDetailSimpleInfo.class);
		UserSpaceDetailSimpleInfo userSpaceDetail = new UserSpaceDetailSimpleInfo();
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.ID_FIELD))) {
			userSpaceDetail.setId(Long.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.ID_FIELD))));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.NAME_FIELD))) {
			userSpaceDetail.setName(
					document.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.NAME_FIELD)));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.SHORTNAME_FIELD))) {
			userSpaceDetail.setShortname(document
					.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.SHORTNAME_FIELD)));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.INDUSTRY_FIELD))) {
			userSpaceDetail.setIndustry(document
					.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.INDUSTRY_FIELD)));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.ADMINNAME_FIELD))) {
			userSpaceDetail.setAdminname(document
					.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.ADMINNAME_FIELD)));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.SEARCHSTATUS_FIELD))) {
			userSpaceDetail.setSearchstatus(Short.valueOf(document.get(
					ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.SEARCHSTATUS_FIELD))));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.BUSINESSCODE_FIELD))) {
			userSpaceDetail.setBusinesscode(document
					.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.BUSINESSCODE_FIELD)));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.STATUS_FIELD))) {
			userSpaceDetail.setStatus(Short.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.STATUS_FIELD))));
		} else {
			userSpaceDetail.setStatus((short) 1);// 方便进行状态排序，前面展示的为优软认证的企业资料
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.PROFESSION_FIELD))) {
			userSpaceDetail.setProfession(document
					.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.PROFESSION_FIELD)));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.TAGS_FIELD))) {
			userSpaceDetail.setTags(
					document.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.TAGS_FIELD)));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.UU_FIELD))) {
			userSpaceDetail.setUu(Long.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, UserSpaceDetailSimpleInfo.UU_FIELD))));
		}
		return userSpaceDetail;
	}

	private static DeputyOrderSimpleInfo toDeputyOrder(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(DeputyOrderSimpleInfo.class);
		DeputyOrderSimpleInfo depOrder = new DeputyOrderSimpleInfo();
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.ID_FIELD))) {
			depOrder.setId(Long.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.ID_FIELD))));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.ENUU_FIELD))) {
			depOrder.setEnuu(Long.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.ENUU_FIELD))));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.TERVENDUU_FEILD))) {
			depOrder.setTervenduu(Long.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.TERVENDUU_FEILD))));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.VENDUSERUU_FIELD))) {
			depOrder.setVenduseruu(Long.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.VENDUSERUU_FIELD))));
		}
		if (!StringUtils.isEmpty(
				document.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.CODE_FIELD)))) {
			depOrder.setCode(
					document.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.CODE_FIELD)));
		}
		if (!StringUtils.isEmpty(
				document.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.SALECODE_FIELD)))) {
			depOrder.setSalecode(
					document.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.SALECODE_FIELD)));
		}
		if (!StringUtils.isEmpty(
				document.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.SALEPCODE_FIELD)))) {
			depOrder.setSalepocode(document
					.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.SALEPCODE_FIELD)));
		}
		if (!StringUtils.isEmpty(document
				.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.COMPANYNAME_FIELD)))) {
			depOrder.setCompanyname(document
					.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.COMPANYNAME_FIELD)));
		}
		if (!StringUtils.isEmpty(
				document.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.CUSTOMER_FIELD)))) {
			depOrder.setCustomer(
					document.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.CUSTOMER_FIELD)));
		}
		if (!StringUtils.isEmpty(document
				.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.LEGALREPRESENT_FIELD)))) {
			depOrder.setLegalrepresent(document
					.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.LEGALREPRESENT_FIELD)));
		}
		if (!StringUtils.isEmpty(
				document.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.TERVENDOR_FIELD)))) {
			depOrder.setTervendor(document
					.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.TERVENDOR_FIELD)));
		}
		if (!StringUtils.isEmpty(
				document.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.VENDUSER_FIELD)))) {
			depOrder.setVenduser(
					document.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.VENDUSER_FIELD)));
		}
		if (!StringUtils.isEmpty(
				document.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.STATUSCOE_FIELD)))) {
			depOrder.setStatuscode(Integer.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.STATUSCOE_FIELD))));
		}
		if (!StringUtils.isEmpty(document
				.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.ENTRYSTATUS_FIELD)))) {
			depOrder.setEntrystatus(document
					.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.ENTRYSTATUS_FIELD)));
		}
		if (!StringUtils.isEmpty(document
				.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.DATE_FIELD)))) {
			depOrder.setDate(new Date(Long.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.DATE_FIELD)))));
		}
		if (!StringUtils.isEmpty(document
				.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.DOWNLOADSTATUS_FIELD)))) {
			depOrder.setDownloadstatus(document
					.get(ClassAndTableNameUtils.combineField(tableName, DeputyOrderSimpleInfo.DOWNLOADSTATUS_FIELD)));
		}
		return depOrder;
	}

	private static ProductComponentSimpleInfo toProdComponent(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(ProductComponentSimpleInfo.class);
		ProductComponentSimpleInfo prodComp = new ProductComponentSimpleInfo();
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, ProductComponentSimpleInfo.ID_FIELD))) {
			prodComp.setId(Long.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, ProductComponentSimpleInfo.ID_FIELD))));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, ProductComponentSimpleInfo.KINDID_FIELD))) {
			prodComp.setKindid(Long.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, ProductComponentSimpleInfo.KINDID_FIELD))));
		}
		if (!StringUtils.isEmpty(
				document.get(ClassAndTableNameUtils.combineField(tableName, ProductComponentSimpleInfo.CODE_FIELD)))) {
			prodComp.setCode(document
					.get(ClassAndTableNameUtils.combineField(tableName, ProductComponentSimpleInfo.CODE_FIELD)));
		}
		if (!StringUtils.isEmpty(
				document.get(ClassAndTableNameUtils.combineField(tableName, ProductComponentSimpleInfo.UUID_FIELD)))) {
			prodComp.setUuid(document
					.get(ClassAndTableNameUtils.combineField(tableName, ProductComponentSimpleInfo.UUID_FIELD)));
		}
		if (!StringUtils.isEmpty(
				document.get(ClassAndTableNameUtils.combineField(tableName, ProductComponentSimpleInfo.BRAND_FIELD)))) {
			prodComp.setBrand(JSONObject.parseObject(
					document.get(
							ClassAndTableNameUtils.combineField(tableName, ProductComponentSimpleInfo.BRAND_FIELD)),
					BrandSimpleInfo.class));
		}
		return prodComp;
	}

	private static PurchaseProofingItemSimpleInfo toPurchaseProofingItem(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PurchaseProofingItemSimpleInfo.class);
		PurchaseProofingItemSimpleInfo purcProofingItem = new PurchaseProofingItemSimpleInfo();
		purcProofingItem.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseProofingItemSimpleInfo.ID_FIELD))));
		purcProofingItem.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseProofingItemSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		purcProofingItem.setStatus(Short.valueOf(document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseProofingItemSimpleInfo.STATUS_FIELD))));
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseProofingItemSimpleInfo.PROOFING_FIELD))) {
			purcProofingItem
					.setProofing(
							JSONObject.parseObject(
									document.get(ClassAndTableNameUtils.combineField(tableName,
											PurchaseProofingItemSimpleInfo.PROOFING_FIELD)),
					PurchaseProofingSimpleInfo.class));
		}
		String dateString = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseProofingItemSimpleInfo.DATE_FIELD));
		if (!StringUtils.isEmpty(dateString)) {
			purcProofingItem.setDate(new Date(Long.valueOf(dateString)));
		}
		return purcProofingItem;
	}

	/**
	 * 将Document转换成PurchaseInquiryItemSimpleInfo
	 * 
	 * @param document
	 * @return
	 */
	private static PurchaseInquiryItemSimpleInfo toInquiryItem(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PurchaseInquiryItemSimpleInfo.class);
		PurchaseInquiryItemSimpleInfo purcInquiryItem = new PurchaseInquiryItemSimpleInfo();
		purcInquiryItem.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryItemSimpleInfo.ID_FIELD))));
		purcInquiryItem.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryItemSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryItemSimpleInfo.PRODUCT_FIELD))) {
			purcInquiryItem
					.setProduct(
							JSONObject
									.parseObject(
											document.get(ClassAndTableNameUtils.combineField(tableName,
													PurchaseInquiryItemSimpleInfo.PRODUCT_FIELD)),
							ProductSimpleInfo.class));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryItemSimpleInfo.SENDSTATUS_FIELD))) {
			purcInquiryItem.setSendStatus(Short.valueOf(document.get(
					ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryItemSimpleInfo.SENDSTATUS_FIELD))));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryItemSimpleInfo.VENDTODATE_FIELD))) {
			purcInquiryItem.setVendToDate(new Date(Long.valueOf(document.get(
					ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryItemSimpleInfo.VENDTODATE_FIELD)))));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryItemSimpleInfo.STATUS_FIELD))) {
			purcInquiryItem.setStatus(Short.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryItemSimpleInfo.STATUS_FIELD))));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryItemSimpleInfo.OVERDUE_FIELD))) {
			purcInquiryItem.setOverdue(Short.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryItemSimpleInfo.OVERDUE_FIELD))));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryItemSimpleInfo.INVALID_FIELD))) {
			purcInquiryItem.setInvalid(Short.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryItemSimpleInfo.INVALID_FIELD))));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryItemSimpleInfo.SOURCEAPP_FIELD))) {
			purcInquiryItem.setSourceapp(String.valueOf(document.get(
					ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryItemSimpleInfo.SOURCEAPP_FIELD))));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryItemSimpleInfo.AGREED_FIELD))) {
			purcInquiryItem.setAgreed(Short.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryItemSimpleInfo.AGREED_FIELD))));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryItemSimpleInfo.INQUIRY_FIELD))) {
			purcInquiryItem
					.setInquiry(
							JSONObject.parseObject(
									document.get(ClassAndTableNameUtils.combineField(tableName,
											PurchaseInquiryItemSimpleInfo.INQUIRY_FIELD)),
					PurchaseInquirySimpleInfo.class));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryItemSimpleInfo.DATE_FIELD))) {
			purcInquiryItem.setDate(new Date(Long.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryItemSimpleInfo.DATE_FIELD)))));
		}
		return purcInquiryItem;
	}

	/**
	 * 将Document转换成SaleQuotation
	 * 
	 * @param document
	 * @return
	 */
	private static SaleQuotationSimpleInfo toSaleQuotation(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(SaleQuotationSimpleInfo.class);
		SaleQuotationSimpleInfo saleQuotation = new SaleQuotationSimpleInfo();
		saleQuotation.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, SaleQuotationSimpleInfo.ID_FIELD))));
		saleQuotation.setCode(
				document.get(ClassAndTableNameUtils.combineField(tableName, SaleQuotationSimpleInfo.CODE_FIELD)));
		saleQuotation.setStatus(Short.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, SaleQuotationSimpleInfo.STATUS_FIELD))));
		saleQuotation.setDate(new Date(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, SaleQuotationSimpleInfo.DATE_FIELD)))));
		String endDate = document
				.get(ClassAndTableNameUtils.combineField(tableName, SaleQuotationSimpleInfo.ENDDATE_FIELD));
		if (null != endDate) {
			saleQuotation.setEndDate(new Date(Long.valueOf(endDate)));
		}
		String overdue = document
				.get(ClassAndTableNameUtils.combineField(tableName, SaleQuotationSimpleInfo.OVERDUE_FIELD));
		if (null != overdue) {
			saleQuotation.setOverdue(Short.valueOf(overdue));
		}
		String agreed = document
				.get(ClassAndTableNameUtils.combineField(tableName, SaleQuotationSimpleInfo.AGREED_FIELD));
		if (null != agreed) {
			saleQuotation.setAgreed(Short.valueOf(agreed));
		}
		saleQuotation.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, SaleQuotationSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		saleQuotation.setVend(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, SaleQuotationSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, SaleQuotationSimpleInfo.ITEMS_FIELD))) {
			saleQuotation.setSaleQuotationItems(toSet(
					document.get(ClassAndTableNameUtils.combineField(tableName, SaleQuotationSimpleInfo.ITEMS_FIELD)),
					SaleQuotationItemSimpleInfo.class));
		}
		return saleQuotation;
	}

	/**
	 * 将Document转换成PurcApcheck
	 * 
	 * @param document
	 * @return
	 */
	private static PurchaseApCheckSimpleInfo toPurcApcheck(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PurchaseApCheckSimpleInfo.class);
		PurchaseApCheckSimpleInfo purcApcheck = new PurchaseApCheckSimpleInfo();
		purcApcheck.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApCheckSimpleInfo.ID_FIELD))));
		purcApcheck.setCode(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApCheckSimpleInfo.CODE_FIELD)));
		String statusString = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApCheckSimpleInfo.STATUS_FIELD));
		if (!StringUtils.isEmpty(statusString)) {
			purcApcheck.setStatus(Short.valueOf(statusString));
		}
		String checkstatus = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApCheckSimpleInfo.CHECKSTATUS_FIELD));
		if (!StringUtils.isEmpty(checkstatus)) {
			purcApcheck.setCheckstatus(checkstatus);
		}
		purcApcheck.setDate(new Date(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApCheckSimpleInfo.DATE_FIELD)))));
		purcApcheck.setEnterprise(JSONObject.parseObject(
				document.get(
						ClassAndTableNameUtils.combineField(tableName, PurchaseApCheckSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		purcApcheck.setVendor(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApCheckSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApCheckSimpleInfo.ITEMS_FIELD))) {
			purcApcheck.setItems(toSet(
					document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApCheckSimpleInfo.ITEMS_FIELD)),
					PurchaseApCheckItemSimpleInfo.class));
		}
		return purcApcheck;
	}

	/**
	 * 将Document转换成SaleArcheck
	 * 
	 * @param document
	 * @return
	 */
	private static SaleArcheckSimpleInfo toSaleArcheck(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(SaleArcheckSimpleInfo.class);
		SaleArcheckSimpleInfo saleArcheck = new SaleArcheckSimpleInfo();
		saleArcheck.setId(Long
				.valueOf(document.get(ClassAndTableNameUtils.combineField(tableName, SaleArcheckSimpleInfo.ID_FIELD))));
		saleArcheck.setCode(
				document.get(ClassAndTableNameUtils.combineField(tableName, SaleArcheckSimpleInfo.CODE_FIELD)));
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, SaleArcheckSimpleInfo.STATUS_FIELD))) {
			saleArcheck.setStatus(Short.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, SaleArcheckSimpleInfo.STATUS_FIELD))));
		}
		saleArcheck.setDate(new Date(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, SaleArcheckSimpleInfo.DATE_FIELD)))));
		saleArcheck.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, SaleArcheckSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		saleArcheck.setVendor(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, SaleArcheckSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, SaleArcheckSimpleInfo.ITEMS_FIELD))) {
			saleArcheck.setItems(toSet(
					document.get(ClassAndTableNameUtils.combineField(tableName, SaleArcheckSimpleInfo.ITEMS_FIELD)),
					SaleARCheckItemSimpleInfo.class));
		}
		return saleArcheck;
	}

	/**
	 * 将Document转换成PurcProofingsend
	 * 
	 * @param document
	 * @return
	 */
	private static PurcProofingsendSimpleInfo toPurcProofingsend(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PurcProofingsendSimpleInfo.class);
		PurcProofingsendSimpleInfo purcProofingsend = new PurcProofingsendSimpleInfo();
		purcProofingsend.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurcProofingsendSimpleInfo.ID_FIELD))));
		String code = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcProofingsendSimpleInfo.CODE_FIELD));
		if (!StringUtils.isEmpty(code)) {
			purcProofingsend.setCode(code);
		}
		String brand = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcProofingsendSimpleInfo.BRAND_FIELD));
		if (!StringUtils.isEmpty(brand)) {
			purcProofingsend.setBrand(brand);
		}
		String dateString = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcProofingsendSimpleInfo.DATE_FIELD));
		if (!StringUtils.isEmpty(dateString)) {
			purcProofingsend.setDate(new Date(Long.valueOf(dateString)));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcProofingsendSimpleInfo.ITEMS_FIELD))) {
			purcProofingsend.setProofingItem(JSONObject.parseObject(
					document.get(
							ClassAndTableNameUtils.combineField(tableName, PurcProofingsendSimpleInfo.ITEMS_FIELD)),
					PurchaseProofingItemSimpleInfo.class));
		}
		return purcProofingsend;
	}

	/**
	 * 将Document转换成PurcProofingapproval
	 * 
	 * @param document
	 * @return
	 */
	private static PurcProofingapprovalSimpleInfo toPurcProofingapproval(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PurcProofingapprovalSimpleInfo.class);
		PurcProofingapprovalSimpleInfo purcProofingapproval = new PurcProofingapprovalSimpleInfo();
		purcProofingapproval.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurcProofingapprovalSimpleInfo.ID_FIELD))));
		purcProofingapproval.setCode(document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcProofingapprovalSimpleInfo.CODE_FIELD)));
		String prodcode = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcProofingapprovalSimpleInfo.PRODCODE_FIELD));
		if (!StringUtils.isEmpty(prodcode)) {
			purcProofingapproval.setProdCode(prodcode);
		}
		String proddetail = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcProofingapprovalSimpleInfo.PRODDETAIL_FIELD));
		if (!StringUtils.isEmpty(proddetail)) {
			purcProofingapproval.setProdDetail(proddetail);
		}
		String pscode = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcProofingapprovalSimpleInfo.PSCODE_FIELD));
		if (!StringUtils.isEmpty(pscode)) {
			purcProofingapproval.setPscode(pscode);
		}
		String sscode = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcProofingapprovalSimpleInfo.SSCODE_FIELD));
		if (!StringUtils.isEmpty(sscode)) {
			purcProofingapproval.setSscode(sscode);
		}
		String prodspec = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcProofingapprovalSimpleInfo.PRODSPEC_FIELD));
		if (!StringUtils.isEmpty(prodspec)) {
			purcProofingapproval.setProdSpec(prodspec);
		}
		String result = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcProofingapprovalSimpleInfo.RESULT_FIELD));
		if (!StringUtils.isEmpty(result)) {
			purcProofingapproval.setResult(result);
		}
		String dateString = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcProofingapprovalSimpleInfo.DATE_FIELD));
		if (!StringUtils.isEmpty(dateString)) {
			purcProofingapproval.setDate(new Date(Long.valueOf(dateString)));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcProofingapprovalSimpleInfo.VEND_FIELD))) {
			purcProofingapproval.setVend(JSONObject.parseObject(
					document.get(
							ClassAndTableNameUtils.combineField(tableName, PurcProofingapprovalSimpleInfo.VEND_FIELD)),
					EnterpriseSimpleInfo.class));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurcProofingapprovalSimpleInfo.ENTERPRISE_FIELD))) {
			purcProofingapproval
					.setEnterprise(
							JSONObject.parseObject(
									document.get(ClassAndTableNameUtils.combineField(tableName,
											PurcProofingapprovalSimpleInfo.ENTERPRISE_FIELD)),
					EnterpriseSimpleInfo.class));
		}
		return purcProofingapproval;
	}

	/**
	 * 将Document转换成PurchaseNotice
	 * 
	 * @param document
	 * @return
	 */
	private static PurchaseNoticeSimpleInfo toPurchaseNotice(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PurchaseNoticeSimpleInfo.class);
		PurchaseNoticeSimpleInfo purchaseNotice = new PurchaseNoticeSimpleInfo();
		purchaseNotice.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseNoticeSimpleInfo.ID_FIELD))));
		purchaseNotice.setDate(new Date(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseNoticeSimpleInfo.DATE_FIELD)))));
		purchaseNotice.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseNoticeSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		purchaseNotice.setWaiting(Short.valueOf(document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseNoticeSimpleInfo.ISWAITING_FIELD))));
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseNoticeSimpleInfo.END_FIELD))) {
			purchaseNotice.setEnd(Short.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseNoticeSimpleInfo.END_FIELD))));
		}
		purchaseNotice.setStatus(Short.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseNoticeSimpleInfo.STATUS_FIELD))));
		purchaseNotice.setVend(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseNoticeSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseNoticeSimpleInfo.ORDERITEMS_FIELD))) {
			purchaseNotice.setOrderItem(JSONObject.parseObject(
					document.get(
							ClassAndTableNameUtils.combineField(tableName, PurchaseNoticeSimpleInfo.ORDERITEMS_FIELD)),
					PurchaseOrderItemSimpleInfo.class));
		}
		return purchaseNotice;
	}

	/**
	 * 将Document转换成SaleSend
	 * 
	 * @param document
	 * @return
	 */
	private static SaleSendSimpleInfo toSaleSend(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(SaleSendSimpleInfo.class);
		SaleSendSimpleInfo saleSend = new SaleSendSimpleInfo();
		saleSend.setId(Long
				.valueOf(document.get(ClassAndTableNameUtils.combineField(tableName, SaleSendSimpleInfo.ID_FIELD))));
		saleSend.setCode(document.get(ClassAndTableNameUtils.combineField(tableName, SaleSendSimpleInfo.CODE_FIELD)));
		String dateString = document.get(ClassAndTableNameUtils.combineField(tableName, SaleSendSimpleInfo.DATE_FIELD));
		if (!StringUtils.isEmpty(dateString)) {
			saleSend.setDate(new Date(Long.valueOf(dateString)));
		}
		saleSend.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, SaleSendSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		if (document.get(SaleSendSimpleInfo.STATUS_FIELD) != null) {
			saleSend.setVerifystatus(Short.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, SaleSendSimpleInfo.STATUS_FIELD))));
		}
		saleSend.setVend(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, SaleSendSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, SaleSendSimpleInfo.ITEMS_FIELD))) {
			saleSend.setSendItems(
					toSet(document.get(ClassAndTableNameUtils.combineField(tableName, SaleSendSimpleInfo.ITEMS_FIELD)),
							SaleSendItemSimpleInfo.class));
		}
		return saleSend;
	}

	/**
	 * 将Document转换成MakeReturn
	 * 
	 * @param document
	 * @return
	 */
	private static MakeReturnSimpleInfo toMakeReturn(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(MakeReturnSimpleInfo.class);
		MakeReturnSimpleInfo makeReturn = new MakeReturnSimpleInfo();
		makeReturn.setId(Long
				.valueOf(document.get(ClassAndTableNameUtils.combineField(tableName, MakeReturnSimpleInfo.ID_FIELD))));
		makeReturn
				.setCode(document.get(ClassAndTableNameUtils.combineField(tableName, MakeReturnSimpleInfo.CODE_FIELD)));
		makeReturn.setSendCode(
				document.get(ClassAndTableNameUtils.combineField(tableName, MakeReturnSimpleInfo.SENDCODE_FIELD)));
		makeReturn.setDate(new Date(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, (MakeReturnSimpleInfo.DATE_FIELD))))));
		makeReturn.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, MakeReturnSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		makeReturn.setVend(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, MakeReturnSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, MakeReturnSimpleInfo.ITEMS_FIELD))) {
			makeReturn.setReturnItems(toSet(
					document.get(ClassAndTableNameUtils.combineField(tableName, MakeReturnSimpleInfo.ITEMS_FIELD)),
					MakeReturnItemSimpleInfo.class));

		}
		return makeReturn;
	}

	/**
	 * 将Document转换成makeOrderChangeItem
	 * 
	 * @param document
	 * @return
	 */
	private static MakeOrderChangeItemSimpleInfo toMakeChangeItem(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(MakeOrderChangeItemSimpleInfo.class);
		MakeOrderChangeItemSimpleInfo makeChangeItem = new MakeOrderChangeItemSimpleInfo();
		makeChangeItem.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, MakeOrderChangeItemSimpleInfo.ID_FIELD))));
		makeChangeItem.setOrderCode(
				document.get(ClassAndTableNameUtils.combineField(tableName, MakeOrderChangeItemSimpleInfo.CODE_FIELD)));
		makeChangeItem.setVend(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, MakeOrderChangeItemSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, MakeOrderChangeItemSimpleInfo.PRODUCT_FIELD))) {
			makeChangeItem
					.setProduct(
							JSONObject
									.parseObject(
											document.get(ClassAndTableNameUtils.combineField(tableName,
													MakeOrderChangeItemSimpleInfo.PRODUCT_FIELD)),
							ProductSimpleInfo.class));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, MakeOrderChangeItemSimpleInfo.MAKE_FIELD))) {
			makeChangeItem.setMakeChanges(JSONObject.parseObject(
					document.get(
							ClassAndTableNameUtils.combineField(tableName, MakeOrderChangeItemSimpleInfo.MAKE_FIELD)),
					MakeChangesSimpleInfo.class));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, MakeOrderChangeItemSimpleInfo.DATE_FIELD))) {
			makeChangeItem.setDate(new Date(Long.valueOf(
					document.get(
							ClassAndTableNameUtils.combineField(tableName,MakeOrderChangeItemSimpleInfo.DATE_FIELD)))));

		}
		return makeChangeItem;
	}

	/**
	 * 将Document转换成MakeAccept
	 * 
	 * @param document
	 * @return
	 */
	private static MakeAcceptSimpleInfo toMakeAccept(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(MakeAcceptSimpleInfo.class);
		MakeAcceptSimpleInfo makeAccept = new MakeAcceptSimpleInfo();
		makeAccept.setId(Long
				.valueOf(document.get(ClassAndTableNameUtils.combineField(tableName, MakeAcceptSimpleInfo.ID_FIELD))));
		makeAccept
				.setCode(document.get(ClassAndTableNameUtils.combineField(tableName, MakeAcceptSimpleInfo.CODE_FIELD)));
		makeAccept.setSendCode(
				document.get(ClassAndTableNameUtils.combineField(tableName, MakeAcceptSimpleInfo.SENDCODE_FIELD)));
		makeAccept.setDate(new Date(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, MakeAcceptSimpleInfo.DATE_FIELD)))));
		makeAccept.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, MakeAcceptSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		makeAccept.setVend(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, MakeAcceptSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, MakeAcceptSimpleInfo.ITEMS_FIELD))) {
			makeAccept.setAcceptItems(toSet(
					document.get(ClassAndTableNameUtils.combineField(tableName, MakeAcceptSimpleInfo.ITEMS_FIELD)),
					MakeAcceptItemSimpleInfo.class));
		}
		return makeAccept;
	}

	/**
	 * 将Document转换成PurchaseReturn
	 * 
	 * @param document
	 * @return
	 */
	private static PurchaseReturnSimpleInfo toPurchaseReturn(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PurchaseReturnSimpleInfo.class);
		PurchaseReturnSimpleInfo purcReturn = new PurchaseReturnSimpleInfo();
		purcReturn.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseReturnSimpleInfo.ID_FIELD))));
		purcReturn.setCode(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseReturnSimpleInfo.CODE_FIELD)));
		String sendcode = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseReturnSimpleInfo.SENDCODE_FIELD));
		if (!StringUtils.isEmpty(sendcode)) {
			purcReturn.setSendCode(sendcode);
		}
		String dateString = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseReturnSimpleInfo.DATE_FIELD));
		if (!StringUtils.isEmpty(dateString)) {
			purcReturn.setDate(new Date(Long.valueOf(dateString)));
		}
		purcReturn.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseReturnSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		purcReturn.setVend(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseReturnSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseReturnSimpleInfo.ITEMS_FIELD))) {
			purcReturn.setReturnItems(toSet(
					document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseReturnSimpleInfo.ITEMS_FIELD)),
					PurchaseReturnItemSimpleInfo.class));
		}
		return purcReturn;
	}

	/**
	 * 将Document转换成PurchaseChanges
	 * 
	 * @param document
	 * @return
	 */
	private static PurchaseChangesSimpleInfo toPurchaseChanges(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PurchaseChangesSimpleInfo.class);
		PurchaseChangesSimpleInfo purcChanges = new PurchaseChangesSimpleInfo();
		purcChanges.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseChangesSimpleInfo.ID_FIELD))));
		purcChanges.setCode(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseChangesSimpleInfo.CODE_FIELD)));
		purcChanges.setOrderCode(document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseChangesSimpleInfo.ORDERCODE_FIELD)));
		purcChanges.setStatus(Short.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseChangesSimpleInfo.STATUS_FIELD))));
		purcChanges.setDate(new Date(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseChangesSimpleInfo.DATE_FIELD)))));
		purcChanges.setEnterprise(JSONObject.parseObject(
				document.get(
						ClassAndTableNameUtils.combineField(tableName, PurchaseChangesSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		purcChanges.setVend(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseChangesSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseChangesSimpleInfo.ITEMS_FIELD))) {
			purcChanges.setOrderChangeItems(toSet(
					document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseChangesSimpleInfo.ITEMS_FIELD)),
					PurchaseOrderChangeItemSimpleInfo.class));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseChangesSimpleInfo.UNNEEDREPLY_FIELD))) {
			purcChanges.setUnNeedReply(Short.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseChangesSimpleInfo.UNNEEDREPLY_FIELD))));
		}
		return purcChanges;
	}

	/**
	 * 将Document转换成PurchaseMrb
	 * 
	 * @param document
	 * @return
	 */
	private static PurchaseMrbSimpleInfo toPurchaseMrb(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PurchaseMrbSimpleInfo.class);
		PurchaseMrbSimpleInfo purcMrb = new PurchaseMrbSimpleInfo();
		purcMrb.setId(Long
				.valueOf(document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseMrbSimpleInfo.ID_FIELD))));
		purcMrb.setCode(document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseMrbSimpleInfo.CODE_FIELD)));
		purcMrb.setDate(new Date(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseMrbSimpleInfo.DATE_FIELD)))));
		purcMrb.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseMrbSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		purcMrb.setVend(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseMrbSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseMrbSimpleInfo.ITEMS_FIELD))) {
			purcMrb.setOrderItem(JSONObject.parseObject(
					document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseMrbSimpleInfo.ITEMS_FIELD)),
					PurchaseOrderItemSimpleInfo.class));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseMrbSimpleInfo.BADITEMS_FIELD))) {
			purcMrb.setBadIn(JSONObject.parseObject(
					document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseMrbSimpleInfo.BADITEMS_FIELD)),
					PurchaseBadinSimpleInfo.class));
		}
		return purcMrb;
	}

	/**
	 * 将Document转换为PurchaseOrder对象
	 * 
	 * @param document
	 * @return
	 */
	private static PurchaseOrderSimpleInfo toPurchaseOrder(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PurchaseOrderSimpleInfo.class);
		PurchaseOrderSimpleInfo purchaseOrder = new PurchaseOrderSimpleInfo();
		purchaseOrder.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseOrderSimpleInfo.ID_FIELD))));
		purchaseOrder.setCode(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseOrderSimpleInfo.CODE_FIELD)));
		if (!StringUtils.isEmpty(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseOrderSimpleInfo.REPLY_FIELD)))) {
			purchaseOrder.setReply(Short.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseOrderSimpleInfo.REPLY_FIELD))));
		}
		if (!StringUtils.isEmpty(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseOrderSimpleInfo.END_FIELD)))) {
			purchaseOrder.setEnd(Short.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseOrderSimpleInfo.END_FIELD))));
		}
		purchaseOrder.setUserUU(Long.valueOf(document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseOrderSimpleInfo.USERUU_FIELD))));
		purchaseOrder.setStatus(Short.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseOrderSimpleInfo.STATUS_FIELD))));
		purchaseOrder.setDate(new Date(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseOrderSimpleInfo.DATE_FIELD)))));
		purchaseOrder.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseOrderSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		purchaseOrder.setVend(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseOrderSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseOrderSimpleInfo.ITEMS_FIELD))) {
			purchaseOrder.setOrderItems(toSet(
					document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseOrderSimpleInfo.ITEMS_FIELD)),
					PurchaseOrderItemSimpleInfo.class));
		}
		return purchaseOrder;
	}

	/**
	 * 将Document转换为MakeOrder对象
	 * 
	 * @param document
	 * @return
	 */
	private static MakeOrderSimpleInfo toMakeOrder(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(MakeOrderSimpleInfo.class);
		MakeOrderSimpleInfo makeOrder = new MakeOrderSimpleInfo();
		makeOrder.setId(Long
				.valueOf(document.get(ClassAndTableNameUtils.combineField(tableName, MakeOrderSimpleInfo.ID_FIELD))));
		makeOrder.setCode(document.get(ClassAndTableNameUtils.combineField(tableName, MakeOrderSimpleInfo.CODE_FIELD)));
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, MakeOrderSimpleInfo.END_FIELD))) {
			makeOrder.setEnd(Short.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, MakeOrderSimpleInfo.END_FIELD))));
		}
		makeOrder.setStatus(Short.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, MakeOrderSimpleInfo.STATUS_FIELD))));
		makeOrder.setDate(new Date(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, MakeOrderSimpleInfo.DATE_FIELD)))));
		makeOrder.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, MakeOrderSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		makeOrder.setVend(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, MakeOrderSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, MakeOrderSimpleInfo.PRODUCT_FIELD))) {
			makeOrder.setProduct(JSONObject.parseObject(
					document.get(ClassAndTableNameUtils.combineField(tableName, MakeOrderSimpleInfo.PRODUCT_FIELD)),
					ProductSimpleInfo.class));
		}
		return makeOrder;
	}

	/**
	 * 将Document转换为PurchaseAccept对象
	 * 
	 * @param document
	 * @return
	 */
	private static PurchaseAcceptSimpleInfo toPurchaseAccept(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PurchaseAcceptSimpleInfo.class);
		PurchaseAcceptSimpleInfo purchaseAccept = new PurchaseAcceptSimpleInfo();
		purchaseAccept.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseAcceptSimpleInfo.ID_FIELD))));
		purchaseAccept.setCode(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseAcceptSimpleInfo.CODE_FIELD)));
		String sendCode = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseAcceptSimpleInfo.SENDCODE_FIELD));
		if (!StringUtils.isEmpty(sendCode)) {
			purchaseAccept.setSendCode(sendCode);
		}
		String dateString = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseAcceptSimpleInfo.DATE_FIELD));
		if (!StringUtils.isEmpty(dateString)) {
			purchaseAccept.setDate(new Date(Long.valueOf(dateString)));
		}
		purchaseAccept.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseAcceptSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		purchaseAccept.setVend(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseAcceptSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseAcceptSimpleInfo.ITEMS_FIELD))) {
			purchaseAccept.setAcceptItems(toSet(
					document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseAcceptSimpleInfo.ITEMS_FIELD)),
					PurchaseAcceptItemSimpleInfo.class));
		}
		return purchaseAccept;
	}

	/**
	 * 将Document转换为PurchaseApbill对象
	 * 
	 * @param document
	 * @return
	 */
	private static PurchaseApbillSimpleInfo toPurchaseApbill(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PurchaseApbillSimpleInfo.class);
		PurchaseApbillSimpleInfo purchApbill = new PurchaseApbillSimpleInfo();
		purchApbill.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApbillSimpleInfo.ID_FIELD))));
		purchApbill.setCode(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApbillSimpleInfo.CODE_FIELD)));
		purchApbill.setDate(new Date(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApbillSimpleInfo.DATE_FIELD)))));
		purchApbill.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApbillSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		purchApbill.setVend(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApbillSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApbillSimpleInfo.ITEMS_FIELD))) {
			purchApbill.setItems(toSet(
					document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApbillSimpleInfo.ITEMS_FIELD)),
					PurchaseApBillItemSimpleInfo.class));
		}
		return purchApbill;
	}

	/**
	 * 将Document转换成PurchaseBadin对象
	 * 
	 * @param document
	 * @return
	 */
	private static PurchaseBadinSimpleInfo toPurchaseBadin(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PurchaseBadinSimpleInfo.class);
		PurchaseBadinSimpleInfo purchBadin = new PurchaseBadinSimpleInfo();
		purchBadin.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseBadinSimpleInfo.ID_FIELD))));
		purchBadin.setCode(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseBadinSimpleInfo.CODE_FIELD)));
		String sendcode = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseBadinSimpleInfo.SENDCODE_FIELD));
		if (!StringUtils.isEmpty(sendcode)) {
			purchBadin.setSendCode(sendcode);
		}
		String dateString = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseBadinSimpleInfo.DATE_FIELD));
		if (!StringUtils.isEmpty(dateString)) {
			purchBadin.setDate(new Date(Long.valueOf(dateString)));
		}
		purchBadin.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseBadinSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		purchBadin.setVend(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseBadinSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseBadinSimpleInfo.ITEMS_FIELD))) {
			purchBadin.setBadInItems(toSet(
					document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseBadinSimpleInfo.ITEMS_FIELD)),
					PurchaseBadInItemSimpleInfo.class));
		}
		return purchBadin;
	}

	/**
	 * 将Document转换成PurchaseBadout对象
	 * 
	 * @param document
	 * @return
	 */
	private static PurchaseBadoutSimpleInfo toPurchaseBadout(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PurchaseBadoutSimpleInfo.class);
		PurchaseBadoutSimpleInfo purchaseBadout = new PurchaseBadoutSimpleInfo();
		purchaseBadout.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseBadoutSimpleInfo.ID_FIELD))));
		purchaseBadout.setCode(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseBadoutSimpleInfo.CODE_FIELD)));
		String sendcode = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseBadoutSimpleInfo.SENDCODE_FIELD));
		if (!StringUtils.isEmpty(sendcode)) {
			purchaseBadout.setSendCode(sendcode);

		}
		String dateString = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseBadoutSimpleInfo.DATE_FIELD));
		if (!StringUtils.isEmpty(dateString)) {
			purchaseBadout.setDate(new Date(Long.valueOf(dateString)));
		}
		purchaseBadout.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseBadoutSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		purchaseBadout.setVend(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseBadoutSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseBadoutSimpleInfo.ITEMS_FIELD))) {
			purchaseBadout.setBadOutItems(toSet(
					document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseBadoutSimpleInfo.ITEMS_FIELD)),
					PurchaseBadoutItemSimpleInfo.class));
		}
		return purchaseBadout;
	}

	/**
	 * 将Document转换成PurchaseForecastSimpleInfo对象
	 * 
	 * @param document
	 * @return
	 */
	private static PurchaseForecastSimpleInfo toPurchaseForecast(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PurchaseForecastSimpleInfo.class);
		PurchaseForecastSimpleInfo purchaseForecast = new PurchaseForecastSimpleInfo();
		purchaseForecast.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseForecastSimpleInfo.ID_FIELD))));
		purchaseForecast.setCode(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseForecastSimpleInfo.CODE_FIELD)));
		purchaseForecast.setDate(new Date(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseForecastSimpleInfo.DATE_FIELD)))));
		purchaseForecast.setVend(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseForecastSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseForecastSimpleInfo.ITEMS_FIELD))) {
			purchaseForecast.setForecastItems(toSet(
					document.get(
							ClassAndTableNameUtils.combineField(tableName, PurchaseForecastSimpleInfo.ITEMS_FIELD)),
					PurchaseForecastItemSimpleInfo.class));
		}
		return purchaseForecast;
	}

	/**
	 * 将Document转换成PurchaseInquiryMouldSimpleInfo对象
	 * 
	 * @param document
	 * @return
	 */
	private static PurchaseInquiryMouldSimpleInfo toPurchaseInquiryMould(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PurchaseInquiryMouldSimpleInfo.class);
		PurchaseInquiryMouldSimpleInfo purchaseInquiryMould = new PurchaseInquiryMouldSimpleInfo();
		purchaseInquiryMould.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryMouldSimpleInfo.ID_FIELD))));
		purchaseInquiryMould.setCode(document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryMouldSimpleInfo.CODE_FIELD)));
		if (document.get(
				ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryMouldSimpleInfo.STATUS_FIELD)) != null) {
			purchaseInquiryMould.setStatus(Short.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryMouldSimpleInfo.STATUS_FIELD))));
		}
		if (document.get(ClassAndTableNameUtils.combineField(tableName,
				PurchaseInquiryMouldSimpleInfo.ADOPTSTATUS_FIELD)) != null) {
			purchaseInquiryMould.setAdoptstatus(Short.valueOf(document.get(
					ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryMouldSimpleInfo.ADOPTSTATUS_FIELD))));
		}
		if (document.get(ClassAndTableNameUtils.combineField(tableName,
				PurchaseInquiryMouldSimpleInfo.SENDSTATUS_FIELD)) != null) {
			purchaseInquiryMould.setSendstatus(Short.valueOf(document.get(
					ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryMouldSimpleInfo.SENDSTATUS_FIELD))));
		}
		if (document.get(
				ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryMouldSimpleInfo.OVERDUE_FIELD)) != null) {
			purchaseInquiryMould.setOverdue(Short.valueOf(document.get(
					ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryMouldSimpleInfo.OVERDUE_FIELD))));
		}
		if (document.get(
				ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryMouldSimpleInfo.VALID_FIELD)) != null) {
			purchaseInquiryMould.setValid(Short.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryMouldSimpleInfo.VALID_FIELD))));
		}
		String dateString = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryMouldSimpleInfo.DATE_FIELD));
		if (!StringUtils.isEmpty(dateString)) {
			purchaseInquiryMould.setDate(new Date(Long.valueOf(dateString)));
		}
		String endDate = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryMouldSimpleInfo.ENDDATE_FIELD));
		if (!StringUtils.isEmpty(endDate)) {
			purchaseInquiryMould.setEndDate(new Date(Long.valueOf(endDate)));
		}
		purchaseInquiryMould
				.setEnterprise(
						JSONObject
								.parseObject(
										document.get(ClassAndTableNameUtils.combineField(tableName,
												PurchaseInquiryMouldSimpleInfo.ENTERPRISE_FIELD)),
						EnterpriseSimpleInfo.class));
		purchaseInquiryMould.setVend(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryMouldSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryMouldSimpleInfo.ITEMS_FIELD))) {
			purchaseInquiryMould.setMouldItems(toSet(
					document.get(
							ClassAndTableNameUtils.combineField(tableName, PurchaseInquiryMouldSimpleInfo.ITEMS_FIELD)),
					PurchaseInquiryMouldItemSimpleInfo.class));
		}
		return purchaseInquiryMould;
	}

	/**
	 * 将Document转换成ProdSimpleInfo对象
	 * 
	 * @param document
	 * @return
	 */
	private static ProdSimpleInfo toProd(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(ProdSimpleInfo.class);
		ProdSimpleInfo prodSimpleInfo = new ProdSimpleInfo();
		prodSimpleInfo.setId(
				Long.valueOf(document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.ID_FIELD))));
		prodSimpleInfo
				.setProdCode(document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.CODE_FIELD)));
		String title = document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.TITLE_FIELD));
		if (null != title) {
			prodSimpleInfo.setProdTitle(title);
		}
		String issale = document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.ISSALE_FIELD));
		if (null != issale) {
			prodSimpleInfo.setIssale(Short.valueOf(issale));
		}
		String ispurc = document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.ISPURC_FIELD));
		if (null != ispurc) {
			prodSimpleInfo.setIsPurchase(Short.valueOf(ispurc));
		}
		String isshow = document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.ISSHOW_FIELD));
		if (null != isshow) {
			prodSimpleInfo.setIsShow(Short.valueOf(isshow));
		}
		String ispubsale = document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.ISPUBSALE_FIELD));
		if (null != ispubsale) {
			prodSimpleInfo.setIsPubsale(Short.valueOf(ispubsale));
		}
		String uuid = document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.UUID_FIELD));
		if (null != uuid) {
			prodSimpleInfo.setUuid(uuid);
		}
		String cmpCode = document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.CMPCODE_FIELD));
		if (null != cmpCode) {
			prodSimpleInfo.setCmpCode(cmpCode);
		}
		String standard = document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.STANDARD_FIELD));
		if (null != standard) {
			prodSimpleInfo.setStandard(Short.valueOf(standard));
		}
		String matchstatus = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.MATCHESTAUTS_FIELD));
		if (null != matchstatus) {
			prodSimpleInfo.setMatchstatus(Short.valueOf(matchstatus));
		}
		String spec = document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.SPEC_FIELD));
		if (null != spec) {
			prodSimpleInfo.setProdSpec(spec);
		}
		String brand = document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.BRAND_FIELD));
		if (null != brand) {
			prodSimpleInfo.setBrand(brand);
		}
		prodSimpleInfo.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		String matchsize = document
				.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.MATCHESIZE_FIELD));
		if (null != matchsize) {
			prodSimpleInfo.setMatchsize(Integer.valueOf(matchsize));
		} else {
			prodSimpleInfo.setMatchsize((int) 0);
		}
		String kind = document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.KIND_FIELD));
		if (null != kind) {
			prodSimpleInfo.setKind(kind);
		}
		String kinden = document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.KINDEN_FIELD));
		if (null != kinden) {
			prodSimpleInfo.setKinden(kinden);
		}
		String pbranden = document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.PBRANDEN_FIELD));
		if (null != pbranden) {
			prodSimpleInfo.setPbranden(pbranden);
		}
		String pbrand = document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.PBRAND_FIELD));
		if (null != pbrand) {
			prodSimpleInfo.setPbrand(pbrand);
		}
		String pcmpCode = document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.PCMPCODE_FIELD));
		if (null != pcmpCode) {
			prodSimpleInfo.setPcmpcode(pcmpCode);
		}

		//开票参数
		String goodsnover = document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.NOVER_FIELD));
		if (null != goodsnover) {
			prodSimpleInfo.setPcmpcode(goodsnover);
		}
		String goodstaxno = document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.TAXNO_FIELD));
		if (null != goodstaxno) {
			prodSimpleInfo.setPcmpcode(goodstaxno);
		}
		String taxpre = document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.TAXPRE_FIELD));
		if (null != taxpre) {
			prodSimpleInfo.setPcmpcode(taxpre);
		}
		String taxprecon = document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.TAXPRECON_FIELD));
		if (null != taxprecon) {
			prodSimpleInfo.setPcmpcode(taxprecon);
		}

		//禁用物料参数
		String b2benabled = document.get(ClassAndTableNameUtils.combineField(tableName, ProdSimpleInfo.B2BENABLED_FIELD));
		if (null != b2benabled) {
			prodSimpleInfo.setB2benabled(Short.valueOf(b2benabled));
		}

		return prodSimpleInfo;
	}

	/**
	 * 将Document转换成EnterpriseSearchSimpleInfo对象
	 * 
	 * @param document
	 * @return
	 */
	private static EnterpriseSearchSimpleInfo toEnterprise(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(EnterpriseSearchSimpleInfo.class);
		EnterpriseSearchSimpleInfo enterprise = new EnterpriseSearchSimpleInfo();
		enterprise.setEnuu(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.ID_FIELD))));
		enterprise.setEnName(
				document.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.NAME_FIELD)));
		String shortName = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.SHORTNAME_FIELD));
		if (null != shortName) {
			enterprise.setEnShortname(shortName);
		}
		String address = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.ADDRESS_FIELD));
		if (null != address) {
			enterprise.setEnAddress(address);
		}
		String adminuu = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.ADMINUU_FIELD));
		if (null != adminuu) {
			enterprise.setEnAdminuu(Long.valueOf(adminuu));
		}
		String area = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.AREA_FIELD));
		if (null != area) {
			enterprise.setEnArea(area);
		}
		String enCorporation = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.CORPORATION_FIELD));
		if (null != enCorporation) {
			enterprise.setEnCorporation(enCorporation);
		}
		String enDate = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.DATE_FIELD));
		if (null != enDate) {
			enterprise.setEnDate(new Date(Long.valueOf(enDate)));
		}
		String enDeliverAddr = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.DELIVERYADDR_FIELD));
		if (null != enDeliverAddr) {
			enterprise.setEnDeliverAddr(enDeliverAddr);
		}
		String enEmail = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.EMAIL_FIELD));
		if (null != enEmail) {
			enterprise.setEnEmail(enEmail);
		}
		String enFax = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.FAX_FIELD));
		if (null != enFax) {
			enterprise.setEnFax(enFax);
		}
		String enRegistercapital = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.REGISTERCAPITAL_FIELD));
		if (null != enRegistercapital) {
			enterprise.setEnRegistercapital(enRegistercapital);
		}
		String enSaasSendStatus = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.SAASSENDSTATUS_FIELD));
		if (null != enSaasSendStatus) {
			enterprise.setEnSaasSendStatus(Short.valueOf(enSaasSendStatus));
		}
		String enSaasStatus = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.SAASSTATUS_FIELD));
		if (null != enSaasStatus) {
			enterprise.setEnSaasStatus(Short.valueOf(enSaasStatus));
		}
		String enSaasUrl = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.SAASURL_FIELD));
		if (null != enSaasUrl) {
			enterprise.setEnSaasUrl(enSaasUrl);
		}
		String enStatus = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.STATUS_FIELD));
		if (null != enStatus) {
			enterprise.setEnStatus(Short.valueOf(enStatus));
		}
		String enSendStatus = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.SENDSTATUS_FIELD));
		if (null != enSendStatus) {
			enterprise.setEnSendStatus(Short.valueOf(enSendStatus));
		}
		String enTaxcode = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.TAXCODE_FIELD));
		if (null != enTaxcode) {
			enterprise.setEnTaxcode(enTaxcode);
		}
		String enBussinessCode = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.BUSSINESSCODE_FIELD));
		if (null != enBussinessCode) {
			enterprise.setEnBussinessCode(enBussinessCode);
		}
		String enIndustry = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.INDUSTRY_FIELD));
		if (null != enIndustry) {
			enterprise.setEnIndustry(enIndustry);
		}
		String enIsErp = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.ISERP_FIELD));
		if (null != enIsErp) {
			enterprise.setEnIsErp(Short.valueOf(enIsErp));
		}
		String enUrl = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.URL_FIELD));
		if (null != enUrl) {
			enterprise.setEnUrl(enUrl);
		}
		String enType = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.TYPE_FIELD));
		if (null != enType) {
			enterprise.setEnType(enType);
		}
		String enTel = document
				.get(ClassAndTableNameUtils.combineField(tableName, EnterpriseSearchSimpleInfo.TEL_FIELD));
		if (null != enTel) {
			enterprise.setEnTel(enTel);
		}
		return enterprise;
	}

	/**
	 * 将Document转换成PurchaseTenderSimpleInfo对象
	 * 
	 * @param document
	 * @return
	 */
	private static PurchaseTenderSimpleInfo toPurchaseTenderSimpleInfo(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PurchaseTenderSimpleInfo.class);
		PurchaseTenderSimpleInfo purchasetender = new PurchaseTenderSimpleInfo();
		purchasetender.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.ID_FIELD))));
		purchasetender.setCode(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.CODE_FIELD)));
		String title = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.TITLE_FIELD));
		if (title != null) {
			purchasetender.setTitle(title);
		}
		String status = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.STATUS_FIELD));
		if (status != null) {
			purchasetender.setStatus(status);
		}
		String date = document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.DATE_FIELD));
		if (date != null) {
			purchasetender.setDate(new Date(Long.valueOf(date)));
		}
		String endDate = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.ENDDATE_FIELD));
		if (endDate != null) {
			purchasetender.setEndDate(new Date(Long.valueOf(endDate)));
		}
		String publishDate = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.PUBLISHDATE_FIELD));
		if (publishDate != null) {
			purchasetender.setPublishDate(new Date(Long.valueOf(publishDate)));
		}
		String payment = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.PAYMENT_FIELD));
		if (payment != null) {
			purchasetender.setPayment(payment);
		}
		String shipAddress = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.SHIPADDRESS_FIELD));
		if (shipAddress != null) {
			purchasetender.setShipAddress(shipAddress);
		}
		String user = document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.USER_FIELD));
		if (user != null) {
			purchasetender.setUser(user);
		}
		String userTel = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.USERTEL_FIELD));
		if (userTel != null) {
			purchasetender.setUserTel(userTel);
		}
		String currency = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.CURRENCY_FIELD));
		if (currency != null) {
			purchasetender.setCurrency(currency);
		}
		String certificate = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.CERTIFICATE_FIELD));
		if (certificate != null) {
			purchasetender.setCertificate(certificate);
		}
		String isPublish = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.ISPUBLISH_FIELD));
		if (isPublish != null) {
			purchasetender.setIsPublish(Short.valueOf(isPublish));
		}
		String auditStatus = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.AUDITSTATUS_FIELD));
		if (auditStatus != null) {
			purchasetender.setAuditStatus(Short.valueOf(auditStatus));
		}
		String ifOpen = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.IFOPEN_FIELD));
		if (ifOpen != null) {
			purchasetender.setIfOpen(Short.valueOf(ifOpen));
		}
		purchasetender.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.TENDERPROD_FIELD))) {
			purchasetender.setTenderProds(toSet(
					document.get(
							ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.TENDERPROD_FIELD)),
					PurchaseTenderProdSimpleInfo.class));
		}
		String overdue = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.OVERDUE_FIELD));
		if (overdue != null) {
			purchasetender.setOverdue(Short.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.OVERDUE_FIELD))));
		}
		String result = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.RESULT_FIELD));
		if (result != null) {
			purchasetender.setResult(Short.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.RESULT_FIELD))));
		}
		return purchasetender;
	}

	/**
	 * 将Document转换成ErpSaleTenderSimpleInfo对象
	 * 
	 * @param document
	 * @return
	 */
	private static ErpSaleTenderSimpleInfo toErpSaleTenderSimpleInfo(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(ErpSaleTenderSimpleInfo.class);
		ErpSaleTenderSimpleInfo saleTenderSimpleInfo = new ErpSaleTenderSimpleInfo();
		saleTenderSimpleInfo.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, ErpSaleTenderSimpleInfo.ID_FIELD))));
		saleTenderSimpleInfo.setCode(
				document.get(ClassAndTableNameUtils.combineField(tableName, ErpSaleTenderSimpleInfo.CODE_FIELD)));
		String title = document
				.get(ClassAndTableNameUtils.combineField(tableName, ErpSaleTenderSimpleInfo.TITLE_FIELD));
		if (title != null) {
			saleTenderSimpleInfo.setTitle(title);
		}
		String status = document
				.get(ClassAndTableNameUtils.combineField(tableName, ErpSaleTenderSimpleInfo.STATUS_FIELD));
		if (status != null) {
			saleTenderSimpleInfo.setStatus(status);
		}
		String date = document.get(ClassAndTableNameUtils.combineField(tableName, ErpSaleTenderSimpleInfo.DATE_FIELD));
		if (date != null) {
			saleTenderSimpleInfo.setDate(new Date(Long.valueOf(date)));
		}
		String endDate = document
				.get(ClassAndTableNameUtils.combineField(tableName, ErpSaleTenderSimpleInfo.ENDDATE_FIELD));
		if (endDate != null) {
			saleTenderSimpleInfo.setEndDate(new Date(Long.valueOf(endDate)));
		}
		String publishDate = document
				.get(ClassAndTableNameUtils.combineField(tableName, ErpSaleTenderSimpleInfo.PUBLISHDATE_FIELD));
		if (publishDate != null) {
			saleTenderSimpleInfo.setPublishDate(new Date(Long.valueOf(publishDate)));
		}
		String payment = document
				.get(ClassAndTableNameUtils.combineField(tableName, ErpSaleTenderSimpleInfo.PAYMENT_FIELD));
		if (payment != null) {
			saleTenderSimpleInfo.setPayment(payment);
		}
		String shipAddress = document
				.get(ClassAndTableNameUtils.combineField(tableName, ErpSaleTenderSimpleInfo.SHIPADDRESS_FIELD));
		if (shipAddress != null) {
			saleTenderSimpleInfo.setShipAddress(shipAddress);
		}
		String user = document.get(ClassAndTableNameUtils.combineField(tableName, ErpSaleTenderSimpleInfo.USER_FIELD));
		if (user != null) {
			saleTenderSimpleInfo.setUser(user);
		}
		String userTel = document
				.get(ClassAndTableNameUtils.combineField(tableName, ErpSaleTenderSimpleInfo.USERTEL_FIELD));
		if (userTel != null) {
			saleTenderSimpleInfo.setUserTel(userTel);
		}
		String ifOpen = document
				.get(ClassAndTableNameUtils.combineField(tableName, ErpSaleTenderSimpleInfo.IFOPEN_FIELD));
		if (ifOpen != null) {
			saleTenderSimpleInfo.setIfOpen(Short.valueOf(ifOpen));
		}
		String isPublish = document
				.get(ClassAndTableNameUtils.combineField(tableName, ErpSaleTenderSimpleInfo.ISPUBLISH_FIELD));
		if (isPublish != null) {
			saleTenderSimpleInfo.setIsPublish(Short.valueOf(isPublish));
		}
		String auditStatus = document
				.get(ClassAndTableNameUtils.combineField(tableName, PurchaseTenderSimpleInfo.AUDITSTATUS_FIELD));
		if (auditStatus != null) {
			saleTenderSimpleInfo.setAuditStatus(Short.valueOf(auditStatus));
		}
		saleTenderSimpleInfo.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, ErpSaleTenderSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		saleTenderSimpleInfo.setVendor(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, ErpSaleTenderSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		String overdue = document
				.get(ClassAndTableNameUtils.combineField(tableName, ErpSaleTenderSimpleInfo.OVERDUE_FIELD));
		if (overdue != null) {
			saleTenderSimpleInfo.setOverdue(Short.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, ErpSaleTenderSimpleInfo.OVERDUE_FIELD))));
		}
		String result = document
				.get(ClassAndTableNameUtils.combineField(tableName, ErpSaleTenderSimpleInfo.RESULT_FIELD));
		if (result != null) {
			saleTenderSimpleInfo.setResult(Short.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, ErpSaleTenderSimpleInfo.RESULT_FIELD))));
		}
		return saleTenderSimpleInfo;
	}

	/**
	 * 将Document转换成B2BSaleTenderSimpleInfo对象
	 *
	 * @param document
	 * @return
	 */
	private static B2BSaleTenderSimpleInfo toB2BSaleTenderSimpleInfo(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(B2BSaleTenderSimpleInfo.class);
		B2BSaleTenderSimpleInfo saleTenderSimpleInfo = new B2BSaleTenderSimpleInfo();
		saleTenderSimpleInfo.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.ID_FIELD))));
		saleTenderSimpleInfo.setCode(
				document.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.CODE_FIELD)));
		String title = document
				.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.TITLE_FIELD));
		if (title != null) {
			saleTenderSimpleInfo.setTitle(title);
		}
		String status = document
				.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.STATUS_FIELD));
		if (status != null) {
			saleTenderSimpleInfo.setStatus(status);
		}
		String date = document.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.DATE_FIELD));
		if (date != null) {
			saleTenderSimpleInfo.setDate(new Date(Long.valueOf(date)));
		}
		String endDate = document
				.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.ENDDATE_FIELD));
		if (endDate != null) {
			saleTenderSimpleInfo.setEndDate(new Date(Long.valueOf(endDate)));
		}
		String publishDate = document
				.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.PUBLISHDATE_FIELD));
		if (publishDate != null) {
			saleTenderSimpleInfo.setPublishDate(new Date(Long.valueOf(publishDate)));
		}
		String payment = document
				.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.PAYMENT_FIELD));
		if (payment != null) {
			saleTenderSimpleInfo.setPayment(payment);
		}
		String shipAddress = document
				.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.SHIPADDRESS_FIELD));
		if (shipAddress != null) {
			saleTenderSimpleInfo.setShipAddress(shipAddress);
		}
		String userName = document
				.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.USERNAME_FIELD));
		if (userName != null) {
			saleTenderSimpleInfo.setUser(userName);
		}
		String userTel = document
				.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.USERTEL_FIELD));
		if (userTel != null) {
			saleTenderSimpleInfo.setUserTel(userTel);
		}
		String ifOpen = document
				.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.IFOPEN_FIELD));
		if (ifOpen != null) {
			saleTenderSimpleInfo.setIfOpen(Short.valueOf(ifOpen));
		}
		String isPublish = document
				.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.ISPUBLISH_FIELD));
		if (isPublish != null) {
			saleTenderSimpleInfo.setIsPublish(Short.valueOf(isPublish));
		}
		String auditStatus = document
				.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.AUDITSTATUS_FIELD));
		if (auditStatus != null) {
			saleTenderSimpleInfo.setAuditStatus(Short.valueOf(auditStatus));
		}
		String user = document.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.USER_FIELD));
		if (!StringUtils.isEmpty(user)) {
			saleTenderSimpleInfo.setVendUser(JSONObject.parseObject(user, UserSimpleInfo.class));
		}
		String recorder = document
				.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.RECORDER_FIELD));
		if (!StringUtils.isEmpty(recorder)) {
			saleTenderSimpleInfo.setRecorder(JSONObject.parseObject(recorder, UserSimpleInfo.class));
		}
		String saleTenderItem = document
				.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.ITEM_FIELD));
		if (null != saleTenderItem) {
			saleTenderSimpleInfo.setSaleTenderItems(toSet(saleTenderItem, B2BSaleTenderItemSimpleInfo.class));
		}
		saleTenderSimpleInfo.setEnterprise(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.ENTERPRISE_FIELD)),
				EnterpriseSimpleInfo.class));
		saleTenderSimpleInfo.setVendor(JSONObject.parseObject(
				document.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.VEND_FIELD)),
				EnterpriseSimpleInfo.class));
		String overdue = document
				.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.OVERDUE_FIELD));
		if (overdue != null) {
			saleTenderSimpleInfo.setOverdue(Short.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.OVERDUE_FIELD))));
		}
		String result = document
				.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.RESULT_FIELD));
		if (result != null) {
			saleTenderSimpleInfo.setResult(Short.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, B2BSaleTenderSimpleInfo.RESULT_FIELD))));
		}
		return saleTenderSimpleInfo;
	}

	/**
	 * 将Document转换成SaleTenderQuestionSimpleInfo对象
	 * 
	 * @param document
	 * @return
	 */
	private static SaleTenderQuestionSimpleInfo toSaleTenderQuestionSimpleInfo(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(SaleTenderQuestionSimpleInfo.class);
		SaleTenderQuestionSimpleInfo saleTenderQuestionSimpleInfo = new SaleTenderQuestionSimpleInfo();
		saleTenderQuestionSimpleInfo.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, SaleTenderQuestionSimpleInfo.ID_FIELD))));
		String code = document
				.get(ClassAndTableNameUtils.combineField(tableName, SaleTenderQuestionSimpleInfo.CODE_FIELD));
		if (code != null) {
			saleTenderQuestionSimpleInfo.setCode(code);
		}
		String date = document
				.get(ClassAndTableNameUtils.combineField(tableName, SaleTenderQuestionSimpleInfo.DATE_FIELD));
		if (date != null) {
			saleTenderQuestionSimpleInfo.setInDate(new Date(Long.valueOf(date)));
		}
		String replyDate = document
				.get(ClassAndTableNameUtils.combineField(tableName, SaleTenderQuestionSimpleInfo.REPLYDATE_FIELD));
		if (replyDate != null) {
			saleTenderQuestionSimpleInfo.setReplyDate(new Date(Long.valueOf(replyDate)));
		}
		String status = document
				.get(ClassAndTableNameUtils.combineField(tableName, SaleTenderQuestionSimpleInfo.STATUS_FIELD));
		if (status != null) {
			saleTenderQuestionSimpleInfo.setStatus(Short.valueOf(status));
		}
		String topic = document
				.get(ClassAndTableNameUtils.combineField(tableName, SaleTenderQuestionSimpleInfo.TOPIC_FIELD));
		if (topic != null) {
			saleTenderQuestionSimpleInfo.setTopic(topic);
		}
		String content = document
				.get(ClassAndTableNameUtils.combineField(tableName, SaleTenderQuestionSimpleInfo.CONTENT_FIELD));
		if (content != null) {
			saleTenderQuestionSimpleInfo.setContent(content);
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, SaleTenderQuestionSimpleInfo.VEND_FIELD))) {
			saleTenderQuestionSimpleInfo.setVendor(JSONObject.parseObject(
					document.get(
							ClassAndTableNameUtils.combineField(tableName, SaleTenderQuestionSimpleInfo.VEND_FIELD)),
					EnterpriseSimpleInfo.class));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, SaleTenderQuestionSimpleInfo.ANSWER_FIELD))) {
			saleTenderQuestionSimpleInfo.setAnwser(JSONObject.parseObject(
					document.get(
							ClassAndTableNameUtils.combineField(tableName, SaleTenderQuestionSimpleInfo.ANSWER_FIELD)),
					PurchaseTenderAnswer.class));
		}
		return saleTenderQuestionSimpleInfo;
	}

	/**
	 * 将Document转换成PagingReleaseDetailSimpleInfo对象
	 * 
	 * @param document
	 * @return
	 */
	private static PagingReleaseDetailSimpleInfo toPagingReleaseDetailSimpleInfo(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PagingReleaseDetailSimpleInfo.class);
		PagingReleaseDetailSimpleInfo pagingReleaseDetail = new PagingReleaseDetailSimpleInfo();
		pagingReleaseDetail.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, PagingReleaseDetailSimpleInfo.ID_FIELD))));
		String userName = document
				.get(ClassAndTableNameUtils.combineField(tableName, PagingReleaseDetailSimpleInfo.USERNAME_FIELD));
		if (userName != null) {
			pagingReleaseDetail.setUserName(userName);
		}
		String userUU = document
				.get(ClassAndTableNameUtils.combineField(tableName, PagingReleaseDetailSimpleInfo.USERUU_FIELD));
		if (userUU != null) {
			pagingReleaseDetail.setUserUU(userUU);
		}
		String status = document
				.get(ClassAndTableNameUtils.combineField(tableName, PagingReleaseDetailSimpleInfo.STATUS_FIELD));
		if (status != null) {
			pagingReleaseDetail.setStatus(Short.valueOf(status));
		}
		String readStatus = document
				.get(ClassAndTableNameUtils.combineField(tableName, PagingReleaseDetailSimpleInfo.READSTATUS_FIELD));
		if (readStatus != null) {
			pagingReleaseDetail.setReadStatus(Short.valueOf(readStatus));
		}
		String pushStatus = document
				.get(ClassAndTableNameUtils.combineField(tableName, PagingReleaseDetailSimpleInfo.PUSHSTATUS_FIELD));
		if (pushStatus != null) {
			pagingReleaseDetail.setPushStatus(Short.valueOf(pushStatus));
		}
		String totalStatus = document
				.get(ClassAndTableNameUtils.combineField(tableName, PagingReleaseDetailSimpleInfo.TOTALSTATUS_FIELD));
		if (totalStatus != null) {
			pagingReleaseDetail.setTotalStatus(Short.valueOf(totalStatus));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PagingReleaseDetailSimpleInfo.VEND_FIELD))) {
			pagingReleaseDetail.setEnterprise(JSONObject.parseObject(
					document.get(
							ClassAndTableNameUtils.combineField(tableName, PagingReleaseDetailSimpleInfo.VEND_FIELD)),
					EnterpriseSimpleInfo.class));
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, PagingReleaseDetailSimpleInfo.MAIN_FIELD))) {
			pagingReleaseDetail.setPagingRelease(JSONObject.parseObject(
					document.get(
							ClassAndTableNameUtils.combineField(tableName, PagingReleaseDetailSimpleInfo.MAIN_FIELD)),
					PagingReleaseSimpleInfo.class));
		}
		return pagingReleaseDetail;
	}

	/**
	 * 将Document转换成VendorSimpleInfo对象
	 * 
	 * @param document
	 * @return
	 */
	private static VendorSimpleInfo toVendorSimpleInfo(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(VendorSimpleInfo.class);
		VendorSimpleInfo vendorSimpleInfo = new VendorSimpleInfo();
		vendorSimpleInfo.setId(
				Long.valueOf(document.get(ClassAndTableNameUtils.combineField(tableName, VendorSimpleInfo.ID_FIELD))));
		String status = document.get(ClassAndTableNameUtils.combineField(tableName, VendorSimpleInfo.STATUS_FIELD));
		if (status != null) {
			vendorSimpleInfo.setStatus(status);
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, VendorSimpleInfo.ENTERPRISE_FIELD))) {
			vendorSimpleInfo.setEnterprise(JSONObject.parseObject(
					document.get(ClassAndTableNameUtils.combineField(tableName, VendorSimpleInfo.ENTERPRISE_FIELD)),
					EnterpriseSimpleInfo.class));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, VendorSimpleInfo.VEND_FIELD))) {
			vendorSimpleInfo.setVend(JSONObject.parseObject(
					document.get(ClassAndTableNameUtils.combineField(tableName, VendorSimpleInfo.VEND_FIELD)),
					EnterpriseSimpleInfo.class));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, VendorSimpleInfo.MYUSER_FIELD))) {
			vendorSimpleInfo.setMyUser(JSONObject.parseObject(
					document.get(ClassAndTableNameUtils.combineField(tableName, VendorSimpleInfo.MYUSER_FIELD)),
					UserSimpleInfo.class));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, VendorSimpleInfo.VENDUSER_FIELD))) {
			vendorSimpleInfo.setVendUser(JSONObject.parseObject(
					document.get(ClassAndTableNameUtils.combineField(tableName, VendorSimpleInfo.VENDUSER_FIELD)),
					UserSimpleInfo.class));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, VendorSimpleInfo.CUSTSWITCH_FIELD))) {
			vendorSimpleInfo.setCustswitch(Short.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, VendorSimpleInfo.CUSTSWITCH_FIELD))));
		} else {
			vendorSimpleInfo.setCustswitch((short) 1);
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, VendorSimpleInfo.VENDSWITCH_FIELD))) {
			vendorSimpleInfo.setVendswitch(Short.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, VendorSimpleInfo.VENDSWITCH_FIELD))));
		} else {
			vendorSimpleInfo.setVendswitch((short) 1);
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, VendorSimpleInfo.SERVICERSWITCH_FIELD))) {
			vendorSimpleInfo.setServicerswitch(Short.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, VendorSimpleInfo.SERVICERSWITCH_FIELD))));
		} else {
			vendorSimpleInfo.setServicerswitch((short) 1);
		}
		return vendorSimpleInfo;
	}

	/**
	 * 将Document转换成CustmerSimpleInfo对象
	 * 
	 * @param document
	 * @return
	 */
	private static CustmerSimpleInfo toCustmerSimpleInfo(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(CustmerSimpleInfo.class);
		CustmerSimpleInfo custmerSimpleInfo = new CustmerSimpleInfo();
		custmerSimpleInfo.setId(
				Long.valueOf(document.get(ClassAndTableNameUtils.combineField(tableName, CustmerSimpleInfo.ID_FIELD))));
		String status = document.get(ClassAndTableNameUtils.combineField(tableName, CustmerSimpleInfo.STATUS_FIELD));
		if (status != null) {
			custmerSimpleInfo.setStatus(status);
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CustmerSimpleInfo.ENTERPRISE_FIELD))) {
			custmerSimpleInfo.setEnterprise(JSONObject.parseObject(
					document.get(ClassAndTableNameUtils.combineField(tableName, CustmerSimpleInfo.ENTERPRISE_FIELD)),
					EnterpriseSimpleInfo.class));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CustmerSimpleInfo.VEND_FIELD))) {
			custmerSimpleInfo.setVend(JSONObject.parseObject(
					document.get(ClassAndTableNameUtils.combineField(tableName, CustmerSimpleInfo.VEND_FIELD)),
					EnterpriseSimpleInfo.class));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CustmerSimpleInfo.MYUSER_FIELD))) {
			custmerSimpleInfo.setMyUser(JSONObject.parseObject(
					document.get(ClassAndTableNameUtils.combineField(tableName, CustmerSimpleInfo.MYUSER_FIELD)),
					UserSimpleInfo.class));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CustmerSimpleInfo.VENDUSER_FIELD))) {
			custmerSimpleInfo.setVendUser(JSONObject.parseObject(
					document.get(ClassAndTableNameUtils.combineField(tableName, CustmerSimpleInfo.VENDUSER_FIELD)),
					UserSimpleInfo.class));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CustmerSimpleInfo.CUSTSWITCH_FIELD))) {
			custmerSimpleInfo.setCustswitch(Short.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, CustmerSimpleInfo.CUSTSWITCH_FIELD))));
		} else {
			custmerSimpleInfo.setCustswitch((short) 1);
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CustmerSimpleInfo.VENDSWITCH_FIELD))) {
			custmerSimpleInfo.setVendswitch(Short.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, CustmerSimpleInfo.VENDSWITCH_FIELD))));
		} else {
			custmerSimpleInfo.setVendswitch((short) 1);
		}
		if (null != document
				.get(ClassAndTableNameUtils.combineField(tableName, CustmerSimpleInfo.SERVICERSWITCH_FIELD))) {
			custmerSimpleInfo.setServicerswitch(Short.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, CustmerSimpleInfo.SERVICERSWITCH_FIELD))));
		} else {
			custmerSimpleInfo.setServicerswitch((short) 1);
		}
		return custmerSimpleInfo;
	}

	/**
	 * 将Document转换成ProdctBrandSimpleInfo对象
	 * 
	 * @param document
	 * @return
	 */
	private static ProductBrandSimpleInfo toProductBrandSimpleInfo(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(ProductBrandSimpleInfo.class);
		ProductBrandSimpleInfo productBrandSimpleInfo = new ProductBrandSimpleInfo();
		productBrandSimpleInfo.setId(Long.valueOf(
				document.get(ClassAndTableNameUtils.combineField(tableName, ProductBrandSimpleInfo.ID_FIELD))));
		String uuid = document.get(ClassAndTableNameUtils.combineField(tableName, ProductBrandSimpleInfo.UUID_FIELD));
		if (uuid != null) {
			productBrandSimpleInfo.setUuid(uuid);
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, ProductBrandSimpleInfo.NAMECN_FIELD))) {
			productBrandSimpleInfo.setNameCn(
					document.get(ClassAndTableNameUtils.combineField(tableName, ProductBrandSimpleInfo.NAMECN_FIELD)));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, ProductBrandSimpleInfo.NAMEEN_FIELD))) {
			productBrandSimpleInfo.setNameEn(
					document.get(ClassAndTableNameUtils.combineField(tableName, ProductBrandSimpleInfo.NAMEEN_FIELD)));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, ProductBrandSimpleInfo.VENDOR_FIELD))) {
			productBrandSimpleInfo.setVendor(
					document.get(ClassAndTableNameUtils.combineField(tableName, ProductBrandSimpleInfo.VENDOR_FIELD)));
		}

		return productBrandSimpleInfo;
	}

	/**
	 * 将Document转换成CartSimpleInfo对象
	 *
	 * @param document
	 * @return
	 */
	private static CartSimpleInfo toCartSimpleInfo(Document document) {
		if (document == null){
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(CartSimpleInfo.class);
		CartSimpleInfo cartSimpleInfo = new CartSimpleInfo();
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.DATE_FIELD))) {
			cartSimpleInfo.setDate(new Date(Long.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.DATE_FIELD)))));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.AUDITOR_FIELD))) {
			cartSimpleInfo.setAuditor(document
					.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.AUDITOR_FIELD)));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.CODE_FIELD))) {
			cartSimpleInfo.setCode(document
					.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.CODE_FIELD)));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.CURRENCY_FIELD))){
			cartSimpleInfo.setCurrency(document
					.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.CURRENCY_FIELD)));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.ENUU_FIELD))){
			cartSimpleInfo.setEnUU(Long.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.ENUU_FIELD))));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.ID_FIELD))){
			cartSimpleInfo.setId(Long.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.ID_FIELD))));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.PAYMENTS_FIELD))){
			cartSimpleInfo.setPayments(document
					.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.PAYMENTS_FIELD)));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.RATE_FIELD))){
			cartSimpleInfo.setRate(Float.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.RATE_FIELD))));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.RECEIVECODE_FIELD))){
			cartSimpleInfo.setReceiveCode(document
					.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.RECEIVECODE_FIELD)));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.RECEIVENAME_FIELD))){
			cartSimpleInfo.setReceiveName(document
					.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.RECEIVENAME_FIELD)));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.RECORDER_FIELD))){
			cartSimpleInfo.setRecorder(document
					.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.RECORDER_FIELD)));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.REMARK_FIELD))){
			cartSimpleInfo.setRemark(document
					.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.REMARK_FIELD)));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.SHIPADDRESS_FIELD))){
			cartSimpleInfo.setShipAddress(document
					.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.SHIPADDRESS_FIELD)));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.STATUS_FIELD))){
			cartSimpleInfo.setStatus(Integer.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.STATUS_FIELD))));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.USERUU_FIELD))){
			cartSimpleInfo.setUser(JSONObject.parseObject(document
					.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.USERUU_FIELD)), UserSimpleInfo.class));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.VENDUSER_FIELD))){
			cartSimpleInfo.setVenduser(document
					.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.VENDUSER_FIELD)));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.VENDUSERTEL_FIELD))){
			cartSimpleInfo.setVendusertel(document
					.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.VENDUSERTEL_FIELD)));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.VENDUSERUU_FIELD))){
			cartSimpleInfo.setVendUserUU(Long.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.VENDUSERUU_FIELD))));
		}
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.ENTERPRISE_FIELD))) {
			cartSimpleInfo.setEnterprise(JSONObject.parseObject(
					document.get(ClassAndTableNameUtils.combineField(tableName, CartSimpleInfo.ENTERPRISE_FIELD)),
					EnterpriseSimpleInfo.class));
		}
		return cartSimpleInfo;
	}


	private static PurchaseApBillOutSimpleInfo toPurchaseApBillOutSimpleInfo(Document document) {
		if (document == null){
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(PurchaseApBillOutSimpleInfo.class);
		PurchaseApBillOutSimpleInfo purchaseApBillOutSimpleInfo = new PurchaseApBillOutSimpleInfo();
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.ID_FIELD))){
			purchaseApBillOutSimpleInfo.setId(Long.parseLong(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.ID_FIELD))));
		}
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.AMOUNT_FIELD))){
			purchaseApBillOutSimpleInfo.setAmount(Double.parseDouble(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.AMOUNT_FIELD))));
		}
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.AUDITDATE_FIELD))){
			purchaseApBillOutSimpleInfo.setAuditDate(new Date(Long.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.AUDITDATE_FIELD)))));
		}
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.CHECKSTATUS_FIELD))){
			purchaseApBillOutSimpleInfo.setCheckStatus(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.CHECKSTATUS_FIELD)));
		}
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.CODE_FIELD))){
			purchaseApBillOutSimpleInfo.setCode(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.CODE_FIELD)));
		}
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.TAXSUM_FIELD))){
			purchaseApBillOutSimpleInfo.setTaxSum(Double.parseDouble(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.TAXSUM_FIELD))));
		}
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.CURRENCY_FIELD))){
			purchaseApBillOutSimpleInfo.setCurrency(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.CURRENCY_FIELD)));
		}
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.CUSTNAME_FIELD))){
			purchaseApBillOutSimpleInfo.setCustName(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.CUSTNAME_FIELD)));
		}
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.PAYAMOUNT_FIELD))){
			purchaseApBillOutSimpleInfo.setPayAmount(Double.parseDouble(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.PAYAMOUNT_FIELD))));
		}
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.CUSTUU_FIELD))){
			purchaseApBillOutSimpleInfo.setCustUu(Long.parseLong(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.CUSTUU_FIELD))));
		}
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.ENUU_FIELD))){
			purchaseApBillOutSimpleInfo.setEnUu(Long.parseLong(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.ENUU_FIELD))));
		}
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.DIFFER_FIELD))){
			purchaseApBillOutSimpleInfo.setDiffer(Double.parseDouble(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.DIFFER_FIELD))));
		}
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.ITEMS_FIELD))){
			purchaseApBillOutSimpleInfo.setItems(toSet(
					document.get(
							ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.ITEMS_FIELD)),PurchaseApBillOutItemSimpleInfo.class));
		}
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.PRINT_FIELD))){
			purchaseApBillOutSimpleInfo.setPrint(Short.parseShort(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.PRINT_FIELD))));
		}
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.RATE_FIELD))){
			purchaseApBillOutSimpleInfo.setRate(Double.parseDouble(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.RATE_FIELD))));
		}
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.DATE_FIELD))){
			purchaseApBillOutSimpleInfo.setRecordDate(new Date(Long.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.DATE_FIELD)))));
		}
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.REMARK_FIELD))){
			purchaseApBillOutSimpleInfo.setRemark(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.REMARK_FIELD)));
		}
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.RECORDER_FIELD))){
			purchaseApBillOutSimpleInfo.setRecorder(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.RECORDER_FIELD)));
		}
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.RESDATE_FIELD))){
			purchaseApBillOutSimpleInfo.setResDate(new Date(Long.valueOf(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.RESDATE_FIELD)))));
		}
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.RESMAN_FIELD))){
			purchaseApBillOutSimpleInfo.setResMan(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.RESMAN_FIELD)));
		}
		if(null != document.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.STATUS_FIELD))){
			purchaseApBillOutSimpleInfo.setStatus(Short.parseShort(document
					.get(ClassAndTableNameUtils.combineField(tableName, PurchaseApBillOutSimpleInfo.STATUS_FIELD))));
		}

		return purchaseApBillOutSimpleInfo;
	}

	/**
	 * 将Document转换成VendorPerformanceAssessSimpleInfo对象
	 *
	 * @param document
	 * @return
	 */
	private static VendorPerformanceAssessSimpleInfo toVendorPerformanceAssessSimpleInfo(Document document) {
		if (document == null) {
			return null;
		}
		Table_name tableName = ClassAndTableNameUtils.toTableName(VendorPerformanceAssessSimpleInfo.class);
		VendorPerformanceAssessSimpleInfo vpaSimpleInfo = new VendorPerformanceAssessSimpleInfo();
		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, VendorPerformanceAssessSimpleInfo.ID_FIELD))) {
			vpaSimpleInfo.setId(Long.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, VendorPerformanceAssessSimpleInfo.ID_FIELD))));
		}

		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, VendorPerformanceAssessSimpleInfo.VPAID_FIELD))) {
			vpaSimpleInfo.setVpaId(Long.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, VendorPerformanceAssessSimpleInfo.VPAID_FIELD))));
		}

		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, VendorPerformanceAssessSimpleInfo.CODE_FIELD))) {
			vpaSimpleInfo.setVpaCode(
					document.get(ClassAndTableNameUtils.combineField(tableName, VendorPerformanceAssessSimpleInfo.CODE_FIELD)));
		}

		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, VendorPerformanceAssessSimpleInfo.ENTERPRISE_FIELD))) {
			vpaSimpleInfo.setEnUU(Long.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, VendorPerformanceAssessSimpleInfo.ENTERPRISE_FIELD))));
		}

		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, VendorPerformanceAssessSimpleInfo.DATE_FIELD))) {
			vpaSimpleInfo.setVpaApplydate(new Date(Long.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, VendorPerformanceAssessSimpleInfo.DATE_FIELD)))));
		}

		if (null != document.get(ClassAndTableNameUtils.combineField(tableName, VendorPerformanceAssessSimpleInfo.VPAENUU_FIELD))) {
			vpaSimpleInfo.setVpaVeuu(Long.valueOf(
					document.get(ClassAndTableNameUtils.combineField(tableName, VendorPerformanceAssessSimpleInfo.VPAENUU_FIELD))));
		}

		return vpaSimpleInfo;
	}

	/**
	 * 将json字符串转为Set<T>对象
	 * 
	 * @param <T>
	 * 
	 * @param jsonString
	 *            索引中存储的json数据
	 * @return Set<T>对象
	 */
	private static <T> Set<T> toSet(String jsonString, Class<T> clazz) {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		Set<T> set = new HashSet<>();
		set.addAll(JSONObject.parseArray(jsonString, clazz));
		return set;
	}

}
