|
|
@@ -0,0 +1,127 @@
|
|
|
+package com.uas.search.console.b2b.model;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Calendar;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import javax.persistence.CascadeType;
|
|
|
+import javax.persistence.Column;
|
|
|
+import javax.persistence.Entity;
|
|
|
+import javax.persistence.Id;
|
|
|
+import javax.persistence.JoinColumn;
|
|
|
+import javax.persistence.ManyToOne;
|
|
|
+import javax.persistence.OneToOne;
|
|
|
+import javax.persistence.Table;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 平台里面,以供应商的角度来查看采购询价单明细
|
|
|
+ *
|
|
|
+ * @author yingp
|
|
|
+ *
|
|
|
+ */
|
|
|
+@Table(name = PurcInquiryItemSimpleInfo2.TABLE_NAME)
|
|
|
+@Entity
|
|
|
+public class PurcInquiryItemSimpleInfo2 {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 表名
|
|
|
+ */
|
|
|
+ public static final String TABLE_NAME = "PURC$PUINQUIRYITEMS";
|
|
|
+
|
|
|
+ public static final String ID_FIELD = "id_id";
|
|
|
+
|
|
|
+ public static final String PRODUCT_FIELD = "id_prid";
|
|
|
+
|
|
|
+ public static final String INQUIRY_FIELD = "id_inid";
|
|
|
+
|
|
|
+ public static final String OVERDUE_FIELD = "id_overdue";
|
|
|
+
|
|
|
+ @Id
|
|
|
+ @Column(name = ID_FIELD)
|
|
|
+ private Long id;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 产品
|
|
|
+ */
|
|
|
+ @OneToOne(cascade = { CascadeType.REFRESH })
|
|
|
+ @JoinColumn(name = PRODUCT_FIELD, insertable = false, updatable = false)
|
|
|
+ private ProductSimpleInfo product;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 询价单
|
|
|
+ */
|
|
|
+ @ManyToOne(cascade = CascadeType.ALL, optional = true)
|
|
|
+ @JoinColumn(name = INQUIRY_FIELD, nullable = false)
|
|
|
+ private PurcInquirySimpleInfo2 inquiry;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 是否过期
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Short id_overdue;
|
|
|
+
|
|
|
+ public Long getId() {
|
|
|
+ return id;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setId(Long id) {
|
|
|
+ this.id = id;
|
|
|
+ }
|
|
|
+
|
|
|
+ public ProductSimpleInfo getProduct() {
|
|
|
+ return product;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setProduct(ProductSimpleInfo product) {
|
|
|
+ this.product = product;
|
|
|
+ }
|
|
|
+
|
|
|
+ public PurcInquirySimpleInfo2 getInquiry() {
|
|
|
+ return inquiry;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setInquiry(PurcInquirySimpleInfo2 inquiry) {
|
|
|
+ this.inquiry = inquiry;
|
|
|
+ }
|
|
|
+
|
|
|
+ @SuppressWarnings("deprecation")
|
|
|
+ public Short getOverdue() {
|
|
|
+ if (this.getInquiry().getEndDate() == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ Date date = new Date();
|
|
|
+ Calendar now = Calendar.getInstance();
|
|
|
+ now.set(Calendar.YEAR, date.getYear());
|
|
|
+ now.set(Calendar.MONTH, date.getMonth());
|
|
|
+ now.set(Calendar.DAY_OF_MONTH, date.getDate());
|
|
|
+ Calendar end = Calendar.getInstance();
|
|
|
+ end.set(Calendar.YEAR, this.getInquiry().getEndDate().getYear());
|
|
|
+ end.set(Calendar.MONTH, this.getInquiry().getEndDate().getMonth());
|
|
|
+ end.set(Calendar.DAY_OF_MONTH, this.getInquiry().getEndDate().getDate());
|
|
|
+ if (now.compareTo(end) > 0) {
|
|
|
+ return 1;
|
|
|
+ } else {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setOverdue(Short overdue) {
|
|
|
+ this.id_overdue = overdue;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static List<String> getKeywordFields() {
|
|
|
+ List<String> fields = new ArrayList<>();
|
|
|
+ fields.add(PRODUCT_FIELD);
|
|
|
+ fields.add(INQUIRY_FIELD);
|
|
|
+ return fields;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String toString() {
|
|
|
+ return "PurcInquiryItemSimpleInfo2 [id=" + id + ", product=" + product + ", inquiry=" + inquiry
|
|
|
+ + ", id_overdue=" + id_overdue + "]";
|
|
|
+ }
|
|
|
+
|
|
|
+}
|