Browse Source

供应商推荐,调整为返回已开店企业。

dongbw 7 years ago
parent
commit
b628c7fe99

+ 2 - 1
src/main/java/com/uas/platform/b2c/trade/vendor/controller/VendorIntroductionController.java

@@ -131,10 +131,11 @@ public class VendorIntroductionController {
 
 	/**
 	 * 获取推荐供应商数据
+	 * 			物料最多的开店企业
 	 * @return 企业信息
 	 */
 	@RequestMapping(value = "/vendor/recommend", method = RequestMethod.GET)
-	public org.springframework.data.domain.Page<Enterprise> getRecommendVendor(@PageableDefault(value = 20, sort = { "prodCount" }, direction = Sort.Direction.DESC) Pageable pageable) {
+	public Page<Enterprise> getRecommendVendor(@PageableDefault(value = 20, sort = { "prodCount" }, direction = Sort.Direction.DESC) Pageable pageable) {
 		return vendorIntroductionService.getRecommendVendor(pageable);
 	}
 

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

@@ -53,5 +53,5 @@ public interface VendorIntroductionService {
      * @param pageable  默认参数
      * @return
      */
-    org.springframework.data.domain.Page<Enterprise> getRecommendVendor(Pageable pageable);
+    Page<Enterprise> getRecommendVendor(Pageable pageable);
 }

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

@@ -9,7 +9,6 @@ import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.prod.commodity.dao.V_ProductPrivateDao;
 import com.uas.platform.b2c.prod.commodity.model.V_ProductPrivate;
 import com.uas.platform.b2c.prod.store.dao.StoreInDao;
-import com.uas.platform.b2c.prod.store.model.StoreIn;
 import com.uas.platform.b2c.trade.vendor.model.VendorIntroduction;
 import com.uas.platform.b2c.trade.vendor.service.VendorIntroductionService;
 import com.uas.ps.core.util.CollectionUtils;
@@ -160,19 +159,14 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
 	 * @return
 	 */
 	@Override
-	public org.springframework.data.domain.Page<Enterprise> getRecommendVendor(Pageable pageable) {
+	public Page<Enterprise> getRecommendVendor(Pageable pageable) {
 		if (pageable == null) {
 			return null;
 		}
-		org.springframework.data.domain.Page<Enterprise> enterprisePage = enterpriseDao.findAll(pageable);
-		for (Enterprise enterprise : enterprisePage.getContent()) {
-			List<StoreIn> stores = storeInDao.findByEnUU(enterprise.getUu());
-			if (!CollectionUtils.isEmpty(stores) && !StringUtils.isEmpty(stores.get(0).getLogoUrl())) {
-				// 此处仅方便前端展示
-				enterprise.setEnLogoUrl(stores.get(0).getLogoUrl());
-			}
-		}
-		return enterprisePage;
+		String sql = "select en_uu uu,en_name enName,st_logo_url enLogoUrl,en_prodcount prodCount, en_mallvendorstatus enMallVendorStatus, en_saasstatus enSaasStatus from sec$enterprises right join store$info on st_enuu = en_uu " +
+				"where st_uuid is not null and st_status = 'OPENED' order by en_prodcount desc limit " + pageable.getPageNumber() * pageable.getPageSize() +  "," + pageable.getPageSize();
+		List<Enterprise> enterprises = commonDao.query(sql, Enterprise.class);
+		return new Page<>(pageable.getPageNumber(), pageable.getPageSize(), enterprises, enterprises.size() * pageable.getPageNumber());
 	}
 
 	/**