Эх сурвалжийг харах

公共询价针对商城增加相关的字段

hejq 7 жил өмнө
parent
commit
330d49f40c

+ 32 - 0
src/main/java/com/uas/ps/inquiry/controller/InquiryForBuyerController.java

@@ -4,8 +4,13 @@ import com.alibaba.fastjson.JSONObject;
 import com.uas.ps.inquiry.entity.InquiryDetailInfo;
 import com.uas.ps.inquiry.model.PublicInquiryItem;
 import com.uas.ps.inquiry.model.PurcInquiry;
+import com.uas.ps.inquiry.model.PurcInquiryItemInfo;
+import com.uas.ps.inquiry.page.PageInfo;
+import com.uas.ps.inquiry.page.SearchFilter;
 import com.uas.ps.inquiry.service.InquiryService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Sort;
 import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -64,4 +69,31 @@ public class InquiryForBuyerController {
     public InquiryDetailInfo findById(Long id, Long enuu) {
         return inquiryService.findById(id, enuu);
     }
+
+    /**
+     * 通过企业UU和分页参数获取已发布的询价信息
+     *
+     * @param pageInfo 分页参数
+     * @param searchFilter 过滤条件
+     * @return
+     */
+    @RequestMapping(value = "/inquiryList", method = RequestMethod.GET)
+    public Page<PurcInquiry> getInquiry(PageInfo pageInfo, SearchFilter searchFilter) {
+        Sort sort = new Sort(Sort.Direction.DESC, "date");
+        if (pageInfo.getPageNumber() == 0) {
+            pageInfo.setPageNumber(1);
+        }
+        if (pageInfo.getPageSize() == 0) {
+            pageInfo.setPageSize(5);
+        }
+        pageInfo.setSort(sort);
+        if (null != searchFilter.getUserUU()) {
+            pageInfo.filter("userUU", searchFilter.getUserUU());
+        } else if (null != searchFilter.getEnUU()) {
+            pageInfo.filter("inquiry.enUU", searchFilter.getEnUU());
+        } else {
+            throw new IllegalAccessError("非法访问");
+        }
+        return inquiryService.findByPageInfo(pageInfo, searchFilter);
+    }
 }

+ 14 - 0
src/main/java/com/uas/ps/inquiry/controller/PublicInquiryController.java

@@ -157,6 +157,20 @@ public class PublicInquiryController {
      */
     @RequestMapping(method = RequestMethod.GET)
     public Page<PurcInquiryItemInfo> getInquiry(PageInfo pageInfo, SearchFilter searchFilter) {
+        Sort sort = new Sort(Sort.Direction.DESC, "date");
+        pageInfo.setSort(sort);
+        return publicInquiryService.findTodoByPageInfo(pageInfo, searchFilter);
+    }
+
+    /**
+     * 针对商城,查询已发布的公共询价信息
+     *
+     * @param pageInfo 分页信息
+     * @param searchFilter 过滤条件
+     * @return
+     */
+    @RequestMapping(value = "/inquiryList", method = RequestMethod.GET)
+    public Page<PurcInquiryItemInfo> getInquiryList(PageInfo pageInfo, SearchFilter searchFilter) {
         Sort sort = new Sort(Sort.Direction.DESC, "date");
         pageInfo.setSort(sort);
         if (null != searchFilter.getUserUU()) {

+ 128 - 25
src/main/java/com/uas/ps/inquiry/model/PublicInquiryItem.java

@@ -90,12 +90,6 @@ public class PublicInquiryItem implements Serializable {
 	@JoinColumn(name = "id_prid", insertable = false, updatable = false)
 	private Product product;
 
-    /**
-     * 物料编号,物料表加载不出来,这里用code去处理
-     */
-    @Column(name = "id_prcode")
-    private String prodCode;
-
 	/**
 	 * 币种
 	 */
@@ -349,11 +343,11 @@ public class PublicInquiryItem implements Serializable {
 	@Column(name = "id_offertime")
 	private Date offerTime;
 
-	/**
-	 * 封装
-	 */
-	@Column(name = "id_sort")
-	private String sort;
+    /**
+     * 单价预算
+     */
+    @Column(name = "id_unitprice")
+    private Double unitPrice;
 
 	/**
 	 * 产品生产日期
@@ -367,6 +361,54 @@ public class PublicInquiryItem implements Serializable {
     @Column(name = "id_encapsulation")
     private String encapsulation;
 
+    /**
+     * 报价截止日期
+     */
+    @Column(name = "id_enddate")
+    private Date endDate;
+
+    /**
+     * ************* 上传的物料信息,物料冗余字段 *************
+     */
+    /**
+     * 物料编号
+     */
+    @Column(name = "id_prodcode")
+    private String prodCode;
+
+    /**
+     * 名称
+     */
+    @Column(name = "id_prodtitle")
+    private String prodTitle;
+
+    /**
+     * 规格
+     */
+    @Column(name = "id_prodspec")
+    private String spec;
+
+    /**
+     * 单位
+     */
+    @Column(name = "id_unit")
+    private String unit;
+
+    /**
+     * 型号
+     */
+    @Column(name = "id_cmpcode")
+    private String cmpCode;
+
+    /**
+     * 品牌
+     */
+    @Column(name = "id_inbrand")
+    private String inbrand;
+    /**
+     * ******end*******
+     */
+
 	public Long getId() {
 		return id;
 	}
@@ -397,14 +439,14 @@ public class PublicInquiryItem implements Serializable {
 		return inquiry;
 	}
 
-	public void setInquiry(PublicInquiry inquiry) {
-		this.inquiry = inquiry;
-	}
-
 	public Long getProductId() {
 		return productId;
 	}
 
+    public void setInquiry(PublicInquiry inquiry) {
+        this.inquiry = inquiry;
+    }
+
 	public void setProductId(Long productId) {
 		this.productId = productId;
 	}
@@ -762,15 +804,15 @@ public class PublicInquiryItem implements Serializable {
 		this.offerTime = offerTime;
 	}
 
-	public String getSort() {
-		return sort;
-	}
+    public Double getUnitPrice() {
+        return unitPrice;
+    }
 
-	public void setSort(String sort) {
-		this.sort = sort;
-	}
+    public void setUnitPrice(Double unitPrice) {
+        this.unitPrice = unitPrice;
+    }
 
-	public String getProduceDate() {
+    public String getProduceDate() {
 		return produceDate;
 	}
 
@@ -786,6 +828,54 @@ public class PublicInquiryItem implements Serializable {
         this.encapsulation = encapsulation;
     }
 
+    public Date getEndDate() {
+        return endDate;
+    }
+
+    public void setEndDate(Date endDate) {
+        this.endDate = endDate;
+    }
+
+    public String getProdTitle() {
+        return prodTitle;
+    }
+
+    public void setProdTitle(String prodTitle) {
+        this.prodTitle = prodTitle;
+    }
+
+    public String getSpec() {
+        return spec;
+    }
+
+    public void setSpec(String spec) {
+        this.spec = spec;
+    }
+
+    public String getUnit() {
+        return unit;
+    }
+
+    public void setUnit(String unit) {
+        this.unit = unit;
+    }
+
+    public String getCmpCode() {
+        return cmpCode;
+    }
+
+    public void setCmpCode(String cmpCode) {
+        this.cmpCode = cmpCode;
+    }
+
+    public String getInbrand() {
+        return inbrand;
+    }
+
+    public void setInbrand(String inbrand) {
+        this.inbrand = inbrand;
+    }
+
     /**
 	 * 将公共询价单转成报价单
 	 *
@@ -811,8 +901,15 @@ public class PublicInquiryItem implements Serializable {
 		this.userTel = item.getUserTel();
 		this.prodCode = item.getProdCode();
 		this.source = item.getSource();
-		this.sort = item.getSort();
+		this.unitPrice = item.getUnitPrice();
 		this.produceDate = item.getProduceDate();
+		this.endDate = item.getEndDate();
+		this.encapsulation = item.getEncapsulation();
+		this.prodTitle = item.getProdTitle();
+		this.spec = item.getSpec();
+		this.inbrand = item.getInbrand();
+		this.unit = item.getUnit();
+		this.cmpCode = item.getCmpCode();
 	}
 
 	public PublicInquiryItem() {
@@ -887,7 +984,6 @@ public class PublicInquiryItem implements Serializable {
                 ", userCode='" + userCode + '\'' +
                 ", productId=" + productId +
                 ", product=" + product +
-                ", prodCode='" + prodCode + '\'' +
                 ", currency='" + currency + '\'' +
                 ", taxrate=" + taxrate +
                 ", remark='" + remark + '\'' +
@@ -926,9 +1022,16 @@ public class PublicInquiryItem implements Serializable {
                 ", vendName='" + vendName + '\'' +
                 ", businessCode='" + businessCode + '\'' +
                 ", offerTime=" + offerTime +
-                ", sort='" + sort + '\'' +
+                ", unitPrice=" + unitPrice +
                 ", produceDate='" + produceDate + '\'' +
                 ", encapsulation='" + encapsulation + '\'' +
+                ", endDate=" + endDate +
+                ", prodCode='" + prodCode + '\'' +
+                ", prodTitle='" + prodTitle + '\'' +
+                ", spec='" + spec + '\'' +
+                ", unit='" + unit + '\'' +
+                ", cmpCode='" + cmpCode + '\'' +
+                ", inbrand='" + inbrand + '\'' +
                 '}';
     }
 }

+ 89 - 37
src/main/java/com/uas/ps/inquiry/model/PublicInquiryItemInfo.java

@@ -66,12 +66,6 @@ public class PublicInquiryItemInfo implements Serializable {
 	@JoinColumn(name = "id_prid", insertable = false, updatable = false)
 	private Product product;
 
-    /**
-     * 物料编号,物料表加载不出来,这里用code去处理
-     */
-    @Column(name = "id_prcode")
-    private String prodCode;
-
 	/**
 	 * 币种
 	 */
@@ -323,30 +317,61 @@ public class PublicInquiryItemInfo implements Serializable {
     @Column(name = "id_unitprice")
     private Double unitPrice;
 
-    /**
-     * 封装
-     */
-    @Column(name = "id_sort")
-    private String sort;
-
     /**
      * 产品生产日期
      */
     @Column(name = "id_producedate")
     private String produceDate;
 
-    /**
-     * 物料报价数量(记录多少人或企业对该物料进行报价)
-     */
-    @Column(name = "id_offeramount")
-    private Integer offerAmount;
-
     /**
      * 截止日期
      */
     @Column(name = "id_enddate")
     private Date endDate;
 
+
+    /**
+     * ************* 上传的物料信息,物料冗余字段 *************
+     */
+    /**
+     * 物料编号
+     */
+    @Column(name = "id_prodcode")
+    private String prodCode;
+
+    /**
+     * 名称
+     */
+    @Column(name = "id_prodtitle")
+    private String prodTitle;
+
+    /**
+     * 规格
+     */
+    @Column(name = "id_prodspec")
+    private String spec;
+
+    /**
+     * 单位
+     */
+    @Column(name = "id_unit")
+    private String unit;
+
+    /**
+     * 型号
+     */
+    @Column(name = "id_cmpcode")
+    private String cmpCode;
+
+    /**
+     * 品牌
+     */
+    @Column(name = "id_inbrand")
+    private String inbrand;
+    /**
+     * ******end*******
+     */
+
 	public Long getId() {
 		return id;
 	}
@@ -716,14 +741,6 @@ public class PublicInquiryItemInfo implements Serializable {
         this.unitPrice = unitPrice;
     }
 
-    public String getSort() {
-        return sort;
-    }
-
-    public void setSort(String sort) {
-        this.sort = sort;
-    }
-
     public String getProduceDate() {
         return produceDate;
     }
@@ -732,14 +749,6 @@ public class PublicInquiryItemInfo implements Serializable {
         this.produceDate = produceDate;
     }
 
-    public Integer getOfferAmount() {
-        return offerAmount;
-    }
-
-    public void setOfferAmount(Integer offerAmount) {
-        this.offerAmount = offerAmount;
-    }
-
     public Date getEndDate() {
         return endDate;
     }
@@ -748,6 +757,46 @@ public class PublicInquiryItemInfo implements Serializable {
         this.endDate = endDate;
     }
 
+    public String getProdTitle() {
+        return prodTitle;
+    }
+
+    public void setProdTitle(String prodTitle) {
+        this.prodTitle = prodTitle;
+    }
+
+    public String getSpec() {
+        return spec;
+    }
+
+    public void setSpec(String spec) {
+        this.spec = spec;
+    }
+
+    public String getUnit() {
+        return unit;
+    }
+
+    public void setUnit(String unit) {
+        this.unit = unit;
+    }
+
+    public String getCmpCode() {
+        return cmpCode;
+    }
+
+    public void setCmpCode(String cmpCode) {
+        this.cmpCode = cmpCode;
+    }
+
+    public String getInbrand() {
+        return inbrand;
+    }
+
+    public void setInbrand(String inbrand) {
+        this.inbrand = inbrand;
+    }
+
     @Override
     public String toString() {
         return "PublicInquiryItemInfo{" +
@@ -758,7 +807,6 @@ public class PublicInquiryItemInfo implements Serializable {
                 ", userUU=" + userUU +
                 ", productId=" + productId +
                 ", product=" + product +
-                ", prodCode='" + prodCode + '\'' +
                 ", currency='" + currency + '\'' +
                 ", taxrate=" + taxrate +
                 ", remark='" + remark + '\'' +
@@ -797,10 +845,14 @@ public class PublicInquiryItemInfo implements Serializable {
                 ", replies=" + replies +
                 ", encapsulation='" + encapsulation + '\'' +
                 ", unitPrice=" + unitPrice +
-                ", sort='" + sort + '\'' +
                 ", produceDate='" + produceDate + '\'' +
-                ", offerAmount=" + offerAmount +
                 ", endDate=" + endDate +
+                ", prodCode='" + prodCode + '\'' +
+                ", prodTitle='" + prodTitle + '\'' +
+                ", spec='" + spec + '\'' +
+                ", unit='" + unit + '\'' +
+                ", cmpCode='" + cmpCode + '\'' +
+                ", inbrand='" + inbrand + '\'' +
                 '}';
     }
 }

+ 9 - 0
src/main/java/com/uas/ps/inquiry/service/InquiryService.java

@@ -44,4 +44,13 @@ public interface InquiryService {
      * @return
      */
     InquiryDetailInfo findById(Long id, Long enuu);
+
+    /**
+     * 通过企业UU和分页信息等查询已发布信息
+     *
+     * @param pageInfo 分页信息
+     * @param searchFilter 过滤条件
+     * @return
+     */
+    Page<PurcInquiry> findByPageInfo(PageInfo pageInfo, SearchFilter searchFilter);
 }

+ 31 - 0
src/main/java/com/uas/ps/inquiry/service/impl/InquiryServiceImpl.java

@@ -196,4 +196,35 @@ public class InquiryServiceImpl implements InquiryService {
         }
         return inquiryInfo;
     }
+
+    /**
+     * 通过企业UU和分页信息等查询已发布信息
+     *
+     * @param info     分页信息
+     * @param filter 过滤条件
+     * @return
+     */
+    @Override
+    public Page<PurcInquiry> findByPageInfo(final PageInfo info, SearchFilter filter) {
+        if (null != filter) {
+            if (!StringUtils.isEmpty(filter.getKeyword())) {
+                SimpleExpression code = new SimpleExpression("remark", filter.getKeyword(), CriterionExpression.Operator.LIKE);
+                SimpleExpression[] simpleExpressions = new SimpleExpression[]{code};
+                LogicalExpression logicalExpression = PredicateUtils.or(simpleExpressions);
+                info.expression(logicalExpression);
+            }
+            if (filter.getFromDate() != null) {
+                info.expression(PredicateUtils.gte("date", new Date(filter.getFromDate()), false));
+            }
+            if (filter.getEndDate() != null) {
+                info.expression(PredicateUtils.lte("date", new Date(filter.getEndDate()), false));
+            }
+        }
+        return purcInquiryDao.findAll(new Specification<PurcInquiry>() {
+            public Predicate toPredicate(Root<PurcInquiry> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
+                query.where(info.getPredicates(root, query, builder));
+                return null;
+            }
+        }, info);
+    }
 }