Browse Source

增加推荐供应商接口

dongbw 7 years ago
parent
commit
01553a2653

+ 15 - 0
src/main/java/com/uas/platform/b2c/common/account/model/Enterprise.java

@@ -195,6 +195,12 @@ public class Enterprise implements Serializable {
 	@Column(name = "en_description", length = 2500)
 	private String description;
 
+	/**
+	 * 企业物料数量(数据库每日定时更新)
+	 */
+	@Column(name = "en_prodcount")
+	private Long prodCount;
+
 	public String getDescription() {
 		return description;
 	}
@@ -500,4 +506,13 @@ public class Enterprise implements Serializable {
 	public void setEnBusinessScope(String enBusinessScope) {
 		this.enBusinessScope = enBusinessScope;
 	}
+
+	public Long getProdCount() {
+		return prodCount;
+	}
+
+	public void setProdCount(Long prodCount) {
+		this.prodCount = prodCount;
+	}
+
 }

+ 13 - 0
src/main/java/com/uas/platform/b2c/trade/vendor/controller/VendorIntroductionController.java

@@ -1,5 +1,6 @@
 package com.uas.platform.b2c.trade.vendor.controller;
 
+import com.uas.platform.b2c.common.account.model.Enterprise;
 import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
 import com.uas.platform.b2c.prod.commodity.model.V_ProductPrivate;
 import com.uas.platform.b2c.trade.vendor.model.InviteVendorHistory;
@@ -9,6 +10,9 @@ import com.uas.platform.b2c.trade.vendor.service.VendorIntroductionService;
 import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.sso.support.Page;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.web.PageableDefault;
 import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -122,4 +126,13 @@ public class VendorIntroductionController {
 		return map;
 	}
 
+	/**
+	 * 获取推荐供应商数据
+	 * @return 企业信息
+	 */
+	@RequestMapping(value = "/recommend", method = RequestMethod.GET)
+	public org.springframework.data.domain.Page<Enterprise> getRecommendVendor(@PageableDefault(value = 20, sort = { "prodCount" }, direction = Sort.Direction.DESC) Pageable pageable) {
+		return vendorIntroductionService.getRecommendVendor(pageable);
+	}
+
 }

+ 9 - 0
src/main/java/com/uas/platform/b2c/trade/vendor/service/VendorIntroductionService.java

@@ -1,8 +1,10 @@
 package com.uas.platform.b2c.trade.vendor.service;
 
+import com.uas.platform.b2c.common.account.model.Enterprise;
 import com.uas.platform.b2c.prod.commodity.model.V_ProductPrivate;
 import com.uas.platform.b2c.trade.vendor.model.VendorIntroduction;
 import com.uas.sso.support.Page;
+import org.springframework.data.domain.Pageable;
 
 /**
  * The interface VendorIntroduction service.
@@ -45,4 +47,11 @@ public interface VendorIntroductionService {
      * @return
      */
     Integer getVendorProductCount(Long vendUU);
+
+    /**
+     * 获取推荐供应商
+     * @param pageable  默认参数
+     * @return
+     */
+    org.springframework.data.domain.Page<Enterprise> getRecommendVendor(Pageable pageable);
 }

+ 20 - 0
src/main/java/com/uas/platform/b2c/trade/vendor/service/impl/VendorIntroductionServiceImpl.java

@@ -1,5 +1,7 @@
 package com.uas.platform.b2c.trade.vendor.service.impl;
 
+import com.uas.platform.b2c.common.account.dao.EnterpriseDao;
+import com.uas.platform.b2c.common.account.model.Enterprise;
 import com.uas.platform.b2c.common.base.dao.CommonDao;
 import com.uas.platform.b2c.common.search.rpc.service.SearchService;
 import com.uas.platform.b2c.common.search.util.SPage;
@@ -12,6 +14,7 @@ import com.uas.platform.b2c.trade.vendor.service.VendorIntroductionService;
 import com.uas.ps.core.util.CollectionUtils;
 import com.uas.sso.support.Page;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Pageable;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
@@ -33,6 +36,9 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
 	@Autowired
 	private SearchService searchService;
 
+	@Autowired
+	private EnterpriseDao enterpriseDao;
+
 	/**
 	 * 类目
 	 */
@@ -142,6 +148,20 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
 		return v_productPrivateDao.getCountByEnuuAndEnabled(vendUU, IntegerConstant.YES_SHORT);
 	}
 
+	/**
+	 * 获取推荐供应商
+	 *
+	 * @param pageable 默认参数
+	 * @return
+	 */
+	@Override
+	public org.springframework.data.domain.Page<Enterprise> getRecommendVendor(Pageable pageable) {
+		if (pageable == null) {
+			return null;
+		}
+		return enterpriseDao.findAll(pageable);
+	}
+
 	/**
 	 * 获取供应商资源信息
 	 * @param enUU 本企业UU