|
|
@@ -1,6 +1,7 @@
|
|
|
package com.uas.platform.b2c.trade.vendor.service.impl;
|
|
|
|
|
|
import com.uas.platform.b2c.common.base.dao.CommonDao;
|
|
|
+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;
|
|
|
@@ -43,7 +44,7 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
|
|
|
if (null != SystemSession.getUser() && null != SystemSession.getUser().getEnterprise()) {
|
|
|
enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
}
|
|
|
- // 查询所有物料个数
|
|
|
+ // 查询所有企业个数
|
|
|
Integer total = getTotalCount(enUU, keyword);
|
|
|
// 查询企业
|
|
|
List<VendorIntroduction> vendorIntroductions = getEnterpriseWithCondition(enUU, keyword, page, size);
|
|
|
@@ -97,6 +98,17 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
|
|
|
return v_productPrivateDao.findOne(id);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取供应商产品数目
|
|
|
+ *
|
|
|
+ * @param vendUU 供应商UU
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Integer getVendorProductCount(Long vendUU) {
|
|
|
+ return v_productPrivateDao.getCountByEnuuAndEnabled(vendUU, IntegerConstant.YES_SHORT);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取供应商资源信息
|
|
|
* @param enUU 本企业UU
|
|
|
@@ -107,25 +119,26 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
|
|
|
*/
|
|
|
private List<VendorIntroduction> getEnterpriseWithCondition(Long enUU, String keyword, int page, int size) {
|
|
|
StringBuilder enterpriseSql = new StringBuilder();
|
|
|
- // 查询所有符合条件的enUU的语句,按待售物料数量排序
|
|
|
- String enUUSql = getEnUUGroupByEnUUOrderByCount(enUU, keyword);
|
|
|
+// // 查询所有符合条件的enUU的语句,按待售物料数量排序
|
|
|
+// String enUUSql = getEnUUGroupByEnUUOrderByCount(enUU, keyword);
|
|
|
// 获取企业sql
|
|
|
enterpriseSql.append("select en.en_uu enUU, en.en_name enName, en.en_shortname enShortname, 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 " +
|
|
|
- " 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");
|
|
|
+ ",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 en_uu <> ")
|
|
|
+ .append(enUU);
|
|
|
+ if (!StringUtils.isEmpty(keyword)) {
|
|
|
+ enterpriseSql.append(" and (en_name like '%").append(keyword).append("%' or en_address like '%").append(keyword).append("%' or en_industry like '%").append(keyword)
|
|
|
+ .append("%')");
|
|
|
+ }
|
|
|
// rownum 控制
|
|
|
- String rownumSql = ") s order by isStore desc,prodCounts desc,enUU asc limit " + (page - 1) * size + "," + size ;
|
|
|
+ String rownumSql = ") s order by isStore 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_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 ("
|
|
|
+ // (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
|
|
|
+ String vendorIntroductionUusSql = "select s.*, if( st_enuu is not null and st_status = 'OPENED', 1, 0) isStore from ("
|
|
|
+ enterpriseSql + rownumSql;
|
|
|
// String vendorIntroductionUusSql = "select s.*,( " + prodInfoSql + ") productInfo, (" + storeSql +
|
|
|
// ") isStore from (select t.*,rownum as r1 from (" + enterpriseSql + rownumSql;
|
|
|
@@ -146,10 +159,10 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
|
|
|
String keywordSql = getKeywordSql(enUU, keyword);
|
|
|
enCountSql.append("select count(1) from (").append(keywordSql);
|
|
|
} else {
|
|
|
- enCountSql.append("select count(1) from (select count(1) from (select * from sec$enterprises where en_name not like '%测试%' " +
|
|
|
- " and lower(en_name) not like '%test%') en left join products on en.en_uu = pr_enuu where en_uu <> ").append(enUU);
|
|
|
+ enCountSql.append("select count(1) from (select en_uu,count(1) from sec$enterprises where en_name not like '%测试%' " +
|
|
|
+ " and en_name not like '%test%'and en_uu <> ").append(enUU);
|
|
|
}
|
|
|
- enCountSql.append(" group by en_uu ) a");
|
|
|
+ enCountSql.append(" group by en_uu )a");
|
|
|
System.out.println("en_count:" + enCountSql.toString());
|
|
|
return commonDao.queryForObject(enCountSql.toString(), Integer.class);
|
|
|
}
|
|
|
@@ -161,11 +174,10 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
|
|
|
* @return
|
|
|
*/
|
|
|
private String getKeywordSql(Long enUU, String keyword) {
|
|
|
- return "select en_uu,count(1) as counts from sec$enterprises left join v$product$private on pr_enuu = en_uu where en_name not like '%测试%' " +
|
|
|
- "and lower(en_name) not like '%test%' and ((en_name like '%"
|
|
|
+ return "select en_uu,count(1) as counts from sec$enterprises where en_name not like '%测试%' " +
|
|
|
+ "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 pr_pbranden is not null and pr_pcmpcode is not null)) and en_uu <> " + enUU;
|
|
|
+ + "%') and en_uu <> " + enUU;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -181,7 +193,7 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
|
|
|
enUUSql.append(getKeywordSql(enUU, keyword));
|
|
|
} else {
|
|
|
enUUSql.append("select en_uu, count(1) as counts from (select * from sec$enterprises where en_name not like '%测试%' " +
|
|
|
- " and lower(en_name) not like '%test%') en left join products on en.en_uu = pr_enuu where en.en_uu <> ").append(enUU);
|
|
|
+ " and lower(en_name) not like '%test%') en where en.en_uu <> ").append(enUU);
|
|
|
}
|
|
|
enUUSql.append(" group by en_uu order by count(1) desc ");
|
|
|
return enUUSql.toString();
|