Browse Source

推荐供应商接口logo图片调整

dongbw 7 years ago
parent
commit
d557e7639b

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

@@ -131,7 +131,7 @@ public class VendorIntroductionController {
 	 * @return 企业信息
 	 */
 	@RequestMapping(value = "/vendor/recommend", method = RequestMethod.GET)
-	public org.springframework.data.domain.Page<Enterprise> getRecommendVendor(@PageableDefault(value = 10, sort = { "prodCount" }, direction = Sort.Direction.DESC) Pageable pageable) {
+	public org.springframework.data.domain.Page<Enterprise> getRecommendVendor(@PageableDefault(value = 20, sort = { "prodCount" }, direction = Sort.Direction.DESC) Pageable pageable) {
 		return vendorIntroductionService.getRecommendVendor(pageable);
 	}
 

+ 19 - 6
src/main/java/com/uas/platform/b2c/trade/vendor/model/VendorIntroduction.java

@@ -78,9 +78,14 @@ public class VendorIntroduction {
     private Short isStore;
 
     /**
-     * 是否有有效物料
+     * 店铺logo Url
      */
-    private Short hasProduct;
+    private String storeLogoUrl;
+
+    /**
+     * 企业 logo Url
+     */
+    private String enLogoUrl;
 
     public String getProductInfo() {
         return productInfo;
@@ -194,11 +199,19 @@ public class VendorIntroduction {
         this.isStore = isStore;
     }
 
-    public Short getHasProduct() {
-        return hasProduct;
+    public String getStoreLogoUrl() {
+        return storeLogoUrl;
+    }
+
+    public void setStoreLogoUrl(String storeLogoUrl) {
+        this.storeLogoUrl = storeLogoUrl;
+    }
+
+    public String getEnLogoUrl() {
+        return enLogoUrl;
     }
 
-    public void setHasProduct(Short hasProduct) {
-        this.hasProduct = hasProduct;
+    public void setEnLogoUrl(String enLogoUrl) {
+        this.enLogoUrl = enLogoUrl;
     }
 }

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

@@ -9,6 +9,8 @@ import com.uas.platform.b2c.core.constant.IntegerConstant;
 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;
@@ -39,6 +41,9 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
 	@Autowired
 	private EnterpriseDao enterpriseDao;
 
+	@Autowired
+	private StoreInDao storeInDao;
+
 	/**
 	 * 类目
 	 */
@@ -159,7 +164,15 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
 		if (pageable == null) {
 			return null;
 		}
-		return enterpriseDao.findAll(pageable);
+		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;
 	}
 
 	/**
@@ -176,7 +189,7 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
 		// 查询所有符合条件的enUU的语句,按待售物料数量排序
 		String enUUSql = getEnUUGroupByEnUUOrderByCount(enUU, enterpriseCondition, productCondition);
 		// 获取企业sql
-		enterpriseSql.append("select en.en_uu enUU, en.en_name enName, en.en_shortname enShortname, en.en_address enAddress, en.en_tel enTel, " +
+		enterpriseSql.append("select en.en_uu enUU, en.en_name enName, en.en_shortname enShortname, st.st_logo_url storeLogoUrl, en.en_logurl enLogoUrl, en.en_address enAddress, en.en_tel enTel, " +
 				" en.en_email enEmail, en.en_corporation enCorporation, en.en_businesscode enBusinesscode, en.en_industry enIndustry, en.en_Businessscope enBusinessScope " +
 				",st.st_uuid,st.st_status from sec$enterprises en left join store$info st on st.st_enuu = en.en_uu right join (").append(enUUSql)
 				.append(" ) a on en.en_uu = a.en_uu order by en.en_weight desc, counts desc");
@@ -202,7 +215,7 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
 	private List<VendorIntroduction> getEnterpriseWithoutProductCondition(Long enUU, String enterpriseCondition, int page, int size) {
 		StringBuilder enterpriseSql = new StringBuilder();
 		// 获取企业sql
-		enterpriseSql.append("select en.en_uu enUU, en.en_name enName, en.en_shortname enShortname, en.en_address enAddress, en.en_tel enTel, " +
+		enterpriseSql.append("select en.en_uu enUU, en.en_name enName, en.en_shortname enShortname, st.st_logo_url storeLogoUrl, en.en_logurl enLogoUrl, en.en_address enAddress, en.en_tel enTel, " +
 				"en.en_email enEmail, en.en_corporation enCorporation, en.en_businesscode enBusinesscode, en.en_industry enIndustry, en.en_Businessscope enBusinessScope " +
 				",st.st_enuu,st.st_status from sec$enterprises en left join store$info st on st.st_enuu = en.en_uu where en_name not like '%测试%' and en_name not like '%test%' " +
 				"and (length(en_businesscode) > 12 or en_name like '%香港%' or en_name like '%HONG KONG%' or en_area like '%香港%') and " +