Sfoglia il codice sorgente

【供应商资源】1、供应商列表页去掉登陆拦截;2、物料过滤时,不显示pr_pcmpcode或者pr_pbranden为空的物料

dongbw 7 anni fa
parent
commit
871c0b5b31

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

@@ -43,7 +43,6 @@ public class VendorIntroductionController {
      */
     @RequestMapping(value = "/vendor/list", method = RequestMethod.GET)
 	public Page<VendorIntroduction> getVendorIntroductionList(int page, int size, String keyword) {
-		logger.log("供应商资源", "获取供应商资源列表");
 		return vendorIntroductionService.getVendorIntroduction(page, size, keyword);
 	}
 

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

@@ -36,7 +36,13 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
 	@Override
 	public Page<VendorIntroduction> getVendorIntroduction(int page, int size, String keyword) {
 		long start = System.currentTimeMillis();
-		Long enUU = SystemSession.getUser().getEnterprise().getUu();
+		if (!StringUtils.isEmpty(keyword)) {
+            keyword = keyword.trim();
+        }
+        Long enUU = 0L;
+        if (null != SystemSession.getUser()) {
+            enUU = SystemSession.getUser().getEnterprise().getUu();
+        }
 		// 查询所有物料个数
 		Integer total = getTotalCount(enUU, keyword);
 		// 查询企业
@@ -58,6 +64,7 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
 	public Page<V_ProductPrivate> getVendorProductList(int page, int size, Long vendUU, String keyword) {
 		String whereCondition = " 1 = 1 ";
 		if (!StringUtils.isEmpty(keyword)) {
+		    keyword = keyword.trim();
 			// 物料名称、规格、品牌、原厂型号、单位
 			whereCondition = " (pr_title like '%" + keyword + "%' or pr_spec like '%" + keyword + "%' or pr_brand like '%"
 					+ keyword + "%' or pr_cmpcode like '%" + keyword + "%' or pr_unit like '%" + keyword + "%' or pr_kind like '%"
@@ -66,13 +73,13 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
 		long start = System.currentTimeMillis();
 		// and Pr_Title not like '%测试%' and lower(Pr_Title) not like '%test%' and Pr_code not like '%测试%' and lower(Pr_code) not like '%test%'
 		String prodSql = "select a.* from (select pr_id id, pr_code prodNum, pr_title prodName, pr_spec spec, pr_cmpcode cmpCode, pr_unit unit, pr_kind kind, "
-				+ " pr_brand brand, pr_standard standard from v$product$private where ifnull(pr_b2cenabled, 1) <> 0  and pr_enuu = "
-				+ vendUU + " and pr_issale = 1 and " + whereCondition
+				+ " pr_brand brand, pr_pbranden pbranden, pr_standard standard from v$product$private where ifnull(pr_b2cenabled, 1) <> 0  and pr_enuu = "
+				+ vendUU + " and pr_issale = 1 and pr_pbranden is not null and pr_pcmpcode is not null and " + whereCondition
                 + " order by pr_issale desc, pr_standard desc, pr_id desc) a limit " + (page - 1) * size + "," + size;
 		System.out.println("prod:" + prodSql);
 		// and Pr_Title not like '%测试%' and lower(Pr_Title) not like '%test%' and Pr_code not like '%测试%' and lower(Pr_code) not like '%test%'
 		String countSql = "select count(1) from v$product$private where pr_enuu = " + vendUU
-				+ " and pr_issale = 1 and ifnull(pr_b2cenabled, 1) <> 0 and " + whereCondition;
+				+ " and pr_issale = 1 and pr_pbranden is not null and pr_pcmpcode is not null and ifnull(pr_b2cenabled, 1) <> 0 and " + whereCondition;
 		Integer count = commonDao.queryForObject(countSql, Integer.class);
 		List<V_ProductPrivate> products = commonDao.query(prodSql, V_ProductPrivate.class);
 		System.out.println("耗时" + (System.currentTimeMillis() - start));
@@ -108,15 +115,17 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
 				" from sec$enterprises en right join (").append(enUUSql)
 				.append(" ) a on en.en_uu = a.en_uu order by en.en_weight desc, counts desc");
 		// rownum 控制
-		String rownumSql = ") s order by isStore desc,prodCounts desc limit " + (page - 1) * size + "," + size ;
+		String rownumSql = ") s order by isStore desc,prodCounts desc,enUU asc limit " + (page - 1) * size + "," + size ;
 //		// 查询企业简要物料信息语句
 //		String prodInfoSql = "select wm_concat(pr_title || (case when pr_brand is not null then '(' || pr_brand || ')' else ' ' end)) from v$product$private where pr_enuu=en_uu and "
 //				+ " and pr_issale = 1 and pr_b2cenabled = 1 and rownum<5 ";
 		// 查询企业是否开店语句
 		// 查找非供应商的卖当前商品的企业UU
 		String vendorIntroductionUusSql = "select s.*, ( select 1 from store$info where st_enuu = enUU and st_status = 'OPENED') isStore, "
-                + "(select 1 from v$product$private where ifnull(pr_b2cenabled, 1) = 1 and pr_issale = 1 and pr_enuu = enUU limit 0,1) hasProduct,"
-                + "(select count(1) from v$product$private where ifnull(pr_b2cenabled, 1) = 1 and pr_enuu = enUU and pr_issale = 1) prodCounts from ("
+                + "(select 1 from v$product$private where ifnull(pr_b2cenabled, 1) = 1 and pr_issale = 1 and pr_pbranden is not null " +
+                "and pr_pcmpcode is not null and pr_enuu = enUU limit 0,1) hasProduct,"
+                + "(select count(1) from v$product$private where ifnull(pr_b2cenabled, 1) = 1 " +
+                "and pr_pbranden is not null and pr_pcmpcode is not null and pr_enuu = enUU and pr_issale = 1) prodCounts from ("
 				+ enterpriseSql + rownumSql;
 //		String vendorIntroductionUusSql = "select s.*,( " + prodInfoSql + ") productInfo, (" + storeSql +
 //				") isStore from (select t.*,rownum as r1 from (" + enterpriseSql + rownumSql;
@@ -156,7 +165,7 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
 				"and lower(en_name) not like '%test%' and ((en_name like '%"
 				+ keyword + "%' or en_address like '%" + keyword + "%' or en_industry like '%" + keyword
 				+ "%') or ((pr_cmpcode like '%" + keyword + "%' or pr_brand like '%" + keyword
-				+ "%') and ifnull(pr_b2cenabled, 1) = 1 and pr_issale = 1 )) and en_uu <> " + enUU;
+				+ "%') and ifnull(pr_b2cenabled, 1) = 1 and pr_issale = 1 and pr_pbranden is not null and pr_pcmpcode is not null)) and en_uu <> " + enUU;
 	}
 
 	/**

+ 1 - 0
src/main/webapp/WEB-INF/spring/webmvc.xml

@@ -118,6 +118,7 @@
 			<mvc:exclude-mapping path="/seek/release/template"/>
 			<mvc:exclude-mapping path="/erp/productReplace/update"/>
 			<mvc:exclude-mapping path="/basic/enterprise/findByName/**"/>
+			<mvc:exclude-mapping path="/vendor/introduction/vendor/**" />
 			<bean class="com.uas.platform.b2c.core.filter.SSOInterceptor"></bean>
 		</mvc:interceptor>
 		<!-- 对所有的请求拦截,将Session中的User信息设置进SystemSession -->