package cn.gov.customs.data.entity.wxjy.bus;

import org.springframework.format.annotation.DateTimeFormat;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;


/**
 * 1、危险货物：
 * 匹配字段：进口（经营单位）或出口（生产单位）、CIQ编码、UN编码
 * 提取维度：申报日期（进一年内、只提取命中查检的数据，ungid不为空）
 * 2、危化品：
 * 匹配字段：进口（经营单位）或出口（生产单位）、CIQ编码、规格型号提取CAS号（有就提取）
 * 提取维度：申报日期（进一年内、只提取命中查检的数据）、货物属性（31或32）
 * 新申报商品
 *
 * @author wq
 * @Oct 21, 2025
 */
@Entity
@Data
@Table(name = "WXJY_NEW_DECLARED_GOODS")
public class NewDeclaredGoods implements Serializable {
	private static final long serialVersionUID = 6122282857637625069L;

	@Id
	@Column(name = "ID", length = 100)
	private String id;

	// 报关单号，18位，4位关区代码+4位年份+入境(1)/出境(0)+9位序列号
	@Column(name = "ENTRY_ID", length = 20)
	private String entryId;

	// 商品序号
	@Column(name = "G_NO", precision = 19)
	private BigDecimal gNo;

	// 出入境标志 I：入境 E：出境
	@Column(name = "IE_FLAG", length = 1, nullable = false)
	private String ieFlag;

	// 进出境口岸：4位
	@Column(name = "IE_PORT", length = 10)
	private String iePort;

	// 申报口岸：业务现场关区代码：4位
	@Column(name = "DECL_PORT", length = 10)
	private String declPort;

	// 所属海关：业务现场关区代码：4位
	@Column(name = "CUSTOMS_CODE", length = 10)
	private String customsCode;

	// 申报时间
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "DECL_DATE")
	private Date declDate;

	// ========2019.11.11起 增加字段
	// 境内收发货人代码（统一社会信用代码）
	@Column(name = "CONSIGN_SCC", length = 18)
	private String consignScc;

	// 境内收发货人代码
	@Column(name = "CONSIGN_CODE", length = 10)
	private String consignCode;

	// 境内收发货人名称
	@Column(name = "CONSIGN_NAME", length = 256)
	private String consignName;

	/**
	 * 商品编号
	 */
	@Column(name = "CODE_TS", length = 10)
	private String codeTs;
	/**
	 * 检验检疫编码
	 */
	@Column(name = "IQ_CODE", length = 13)
	private String iqCode;
	/**
	 * 商品名称
	 */
	@Column(name = "G_NAME", length = 256)
	private String gName;
	/**
	 * 报检名称
	 */
	@Column(name = "IQ_G_NAME", length = 256)
	private String iqGName;
	/**
	 * 商品英文名称
	 */
	@Column(name = "G_NAME_FN", length = 256)
	private String gNameFn;
	/**
	 * 规格型号,h2018中该字段为小写
	 */
	@Column(name = "G_MODEL", length = 2048)
	private String gModel;
	/**
	 * 检验检疫货物规格
	 */
	@Column(name = "IQ_G_MODEL", length = 256)
	private String iqGModel;
	/**
	 * 成份/原料/组分
	 */
	@Column(name = "G_COMPOSITION", length = 600)
	private String gComposition;
	/**
	 * 产品保质期
	 */
	@Column(name = "PROD_WARRANTY", precision = 19)
	private BigDecimal prodWarranty;

	/**
	 * 产品有效期
	 */
	@Column(name = "PROD_VALIDATY", length = 20)
	private String prodValidaty;

	/**
	 * 征免方式
	 */
	@Column(name = "DUTY_MODE", length = 1)
	private String dutyMode;

	/**
	 * 条形码
	 */
	@Column(name = "GTIN", length = 13)
	private String gtin;
	/**
	 * 申报数量
	 */
	@Column(name = "G_QTY", precision = 19, scale = 5)
	private BigDecimal gQty;
	/**
	 * 申报计量单位
	 */
	@Column(name = "G_UNIT", length = 3)
	private String gUnit;
	/**
	 * 法定第一数量
	 */
	@Column(name = "QTY_1", precision = 19, scale = 5)
	private BigDecimal qty1;
	/**
	 * 法定第一计量单位
	 */
	@Column(name = "UNIT_1", length = 3)
	private String unit1;
	/**
	 * 第二数量
	 */
	@Column(name = "QTY_2", precision = 19, scale = 5)
	private BigDecimal qty2;
	/**
	 * 第二计量单位
	 */
	@Column(name = "UNIT_2", length = 3)
	private String unit2;
	/**
	 * 申报单价
	 */
	@Column(name = "DECL_PRICE", precision = 19, scale = 5)
	private BigDecimal declPrice;
	/**
	 * 申报总价
	 */
	@Column(name = "DECL_TOTAL", precision = 19, scale = 5)
	private BigDecimal declTotal;
	/**
	 * 成交币制
	 */
	@Column(name = "TRADE_CURR", length = 3)
	private String tradeCurr;
	/**
	 * 成交总价
	 */
	@Column(name = "TRADE_TOTAL", precision = 19, scale = 4)
	private BigDecimal tradeTotal;
	/**
	 * 完税价格
	 */
	@Column(name = "DUTY_VALUE", precision = 19, scale = 4)
	private BigDecimal dutyValue;
	/**
	 * 统计人民币价
	 */
	@Column(name = "RMB_PRICE", precision = 19, scale = 4)
	private BigDecimal rmbPrice;
	/**
	 * 统计美元价
	 */
	@Column(name = "USD_PRICE", precision = 19, scale = 4)
	private BigDecimal usdPrice;
	/**
	 * 成交汇率
	 */
	@Column(name = "EXCHANGE_RATE", precision = 19, scale = 7)
	private BigDecimal exchangeRate;
	/**
	 * 原产国（地区）
	 */
	@Column(name = "ORIGIN_COUNTRY", length = 10)
	private String originCountry;
	/**
	 * 原产地区代码
	 */
	@Column(name = "ORIGIN_REGION_CODE", length = 50)
	private String originRegionCode;
	/**
	 * 最终目的国（地区）
	 */
	@Column(name = "DEST_COUNTRY", length = 10)
	private String destCountry;
	/**
	 * 境内目的地/境内货源地
	 */
	@Column(name = "IE_DISTRICT_CODE", length = 5)
	private String ieDistrictCode;
	/**
	 * 目的地/货源地
	 */
	@Column(name = "IQ_IE_DISTRICT_CODE", length = 6)
	private String iqIeDistrictCode;
	/**
	 * 境外生产企业名称
	 */
	@Column(name = "FRN_PRODUCER_NAME", length = 256)
	private String frnProducerName;

	/**
	 * 货物型号
	 */
	@Column(name = "PRODUCT_MODEL", length = 150)
	private String productModel;

	/**
	 * 货物品牌
	 */
	@Column(name = "PRODUCT_BRAND", length = 150)
	private String productBrand;
	/**
	 * 生产日期
	 */
	@Column(name = "PRODUCT_DATE", length = 256)
	private String productDate;
	/**
	 * 生产批次
	 */
	@Column(name = "PRODUCT_BATCH", length = 2000)
	private String productBatch;
	/**
	 * UN编码
	 */
	@Column(name = "UNGID", length = 20)
	private String ungid;
	/**
	 * 非危险化学品
	 */
	@Column(name = "UNG_FLAG", length = 1)
	private String ungFlag;
	/**
	 * 危包规格
	 */
	@Column(name = "UNG_MODEL", length = 256)
	private String ungModel;
	/**
	 * 危包类别
	 */
	@Column(name = "UNG_CLASSIFY", length = 4)
	private String ungClassify;

	/**
	 * 危险货物名称
	 */
	@Column(name = "UNG_G_NAME", length = 120)
	private String ungGName;

	/**
	 * 货物属性代码
	 */
	@Column(name = "PRODUCT_CHAR_CODE", length = 20)
	private String productCharCode;

	/**
	 * 货号
	 */
	@Column(name = "GOODS_ID", length = 256)
	private String goodsId;
	/**
	 * 用途代码
	 */
	@Column(name = "USE_TO", length = 4)
	private String useTo;

	//每项商品需要监管证件
	@Column(name = "G_CERT_FLAG", length = 32)
	private String gCertFlag;

	/**
	 * 生产单位注册号
	 */
	@Column(name = "MNUFCTR_REG_NO", length = 64)
	private String mnufctrRegNo;

	/**
	 * 创建时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "CREATE_TIME")
	private Date createTime;

	/**
	 * 危化品目录的CAS号
	 */
	@Column(name = "CAS", length = 64)
	private String cas;

	/**
	 * 危险品类型（1、危化品；2、危险货物；3、危化品兼危险货物）
	 */
	@Column(name = "GOODS_TYPE", length = 6)
	private String goodsType;
}