|
|
@@ -30,6 +30,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
|
|
import javax.persistence.criteria.CriteriaBuilder;
|
|
|
import javax.persistence.criteria.CriteriaQuery;
|
|
|
@@ -335,7 +336,10 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
// 查找非供应商的卖当前商品的企业UU
|
|
|
StringBuffer vendorRecommendUusSql = new StringBuffer();
|
|
|
// StringBuffer vendorRecommendUuNumSql = new StringBuffer();
|
|
|
- vendorRecommendUusSql.append("select en_uu,hitNums from (select t.*,rownum as r1 from (select en_uu,hitNums from (select en_uu,count(en_uu) as hitNums from sec$enterprises left join v$products on en_uu = pr_enuu " +
|
|
|
+ vendorRecommendUusSql.append("select en_uu,hitNums,(select wm_concat(pr_title || '(' || pr_brand || ')') from v$products where pr_enuu=en_uu and exists (" +
|
|
|
+ "select 1 from v$products B where B.pr_cmpcode = pr_cmpcode and B.pr_enuu = ").append(enUU).append(" and B.pr_ispurchase = 1 and nvl(B.pr_issale, 0) <> 1) and rownum<5 ) productInfo, (" +
|
|
|
+ "select 1 from purc$vendors where ve_vendenuu = en_uu and ve_myenuu = ").append(enUU).append(") isVendor from (select t.*,rownum as r1 from (" +
|
|
|
+ "select en_uu,hitNums from (select en_uu,count(en_uu) as hitNums from sec$enterprises left join v$products on en_uu = pr_enuu " +
|
|
|
" where 1=1 and pr_issale = 1 and pr_b2bdisabled <> 1 and pr_cmpcode in (").append(cmpCodesSql).append(") and en_uu <> ").append(enUU);
|
|
|
// vendorRecommendUuNumSql.append("select count(distinct(en_uu)) from sec$enterprises left join v$products on en_uu = pr_enuu " +
|
|
|
// " where 1=1 and pr_issale = 1 and pr_b2bdisabled <> 1 and pr_cmpcode in (").append(cmpCodesSql).append(") and en_uu <> ").append(enUU);
|
|
|
@@ -356,7 +360,6 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
.append(enUUSql).append(")");
|
|
|
if (null != enterpriseMatchCondition && !"".equals(enterpriseMatchCondition)) {
|
|
|
enterpriseProdSaleSql.append(" and ").append(enterpriseMatchCondition);
|
|
|
-// vendorRecommendUuNumSql.append(" and ").append(enterpriseMatchCondition);
|
|
|
}
|
|
|
enterpriseProdSaleSql.append(" group by en_uu order by count(pr_issale) desc) b");
|
|
|
vendorRecommendUusSql.append(" union all ").append(enterpriseProdSaleSql);
|
|
|
@@ -434,32 +437,32 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
Enterprise enterprise = enterPriseDao.findOne(vendorRecommend.getEn_uu());
|
|
|
if (null != enterprise) {
|
|
|
vendorRecommend = covert(enterprise, vendorRecommend);
|
|
|
- if (null != vendorRecommend.getHitNums() && vendorRecommend.getHitNums() > 0) {
|
|
|
- StringBuffer productInfosSql = new StringBuffer();
|
|
|
-// StringBuffer productNumSql = new StringBuffer();
|
|
|
- productInfosSql.append("select wm_concat(pr_title || '(' || pr_brand || ')') productInfo from (select pr_title,pr_brand from v$products pr where pr.pr_enuu = ")
|
|
|
- .append(vendUU).append(" and pr.pr_issale =1 and exists (select 1 from v$products p1 where p1.pr_cmpcode = pr.pr_cmpcode and p1.pr_ispurchase = 1 " +
|
|
|
- "and nvl(pr_issale, 0) <> 1 and p1.pr_b2bdisabled <> 1 and p1.pr_enuu = ").append(enUU).append(") order by pr_standard desc,pr_id desc) where rownum <= 5");
|
|
|
- System.out.println("wm_concat:" + productInfosSql.toString());
|
|
|
-// productNumSql.append("select count(1) from v$products pr where pr.pr_enuu = ").append(vendUU)
|
|
|
-// .append(" and pr.pr_issale =1 and exists (select 1 from v$products p1 " +
|
|
|
-// " where p1.pr_cmpcode = pr.pr_cmpcode and p1.pr_ispurchase = 1 and nvl(pr_issale, 0) <> 1 " +
|
|
|
-// " and p1.pr_b2bdisabled <> 1 and p1.pr_enuu = ")
|
|
|
-// .append(enUU).append(")");
|
|
|
-// System.out.println(productInfosSql.toString() + ";");
|
|
|
-// System.out.println(productNumSql.toString() + ";");
|
|
|
- // 获取前五条匹配物料
|
|
|
- String productInfo = commonDao.queryForObject(productInfosSql.toString(), String.class);
|
|
|
-// Integer hitNums = commonDao.queryForObject(productNumSql.toString(), Integer.class);
|
|
|
- vendorRecommend.setProductInfo(productInfo.replace("()", ""));
|
|
|
-// vendorRecommend.setHitNums(hitNums);
|
|
|
- }
|
|
|
- List<Vendor> vendors = vendorDao.findByMyEnUUAndVendUU(enUU, vendUU);
|
|
|
- if (!CollectionUtils.isEmpty(vendors)) {
|
|
|
- vendorRecommend.setIsVendor(Constant.YES);
|
|
|
- } else {
|
|
|
- vendorRecommend.setIsVendor(Constant.NO);
|
|
|
- }
|
|
|
+// if (null != vendorRecommend.getHitNums() && vendorRecommend.getHitNums() > 0) {
|
|
|
+// StringBuffer productInfosSql = new StringBuffer();
|
|
|
+//// StringBuffer productNumSql = new StringBuffer();
|
|
|
+// productInfosSql.append("select wm_concat(pr_title || '(' || pr_brand || ')') productInfo from (select pr_title,pr_brand from v$products pr where pr.pr_enuu = ")
|
|
|
+// .append(vendUU).append(" and pr.pr_issale =1 and exists (select 1 from v$products p1 where p1.pr_cmpcode = pr.pr_cmpcode and p1.pr_ispurchase = 1 " +
|
|
|
+// "and nvl(pr_issale, 0) <> 1 and p1.pr_b2bdisabled <> 1 and p1.pr_enuu = ").append(enUU).append(") order by pr_standard desc,pr_id desc) where rownum <= 5");
|
|
|
+// System.out.println(productInfosSql.toString() + ";");
|
|
|
+//// productNumSql.append("select count(1) from v$products pr where pr.pr_enuu = ").append(vendUU)
|
|
|
+//// .append(" and pr.pr_issale =1 and exists (select 1 from v$products p1 " +
|
|
|
+//// " where p1.pr_cmpcode = pr.pr_cmpcode and p1.pr_ispurchase = 1 and nvl(pr_issale, 0) <> 1 " +
|
|
|
+//// " and p1.pr_b2bdisabled <> 1 and p1.pr_enuu = ")
|
|
|
+//// .append(enUU).append(")");
|
|
|
+//// System.out.println(productInfosSql.toString() + ";");
|
|
|
+//// System.out.println(productNumSql.toString() + ";");
|
|
|
+// // 获取前五条匹配物料
|
|
|
+// String productInfo = commonDao.queryForObject(productInfosSql.toString(), String.class);
|
|
|
+//// Integer hitNums = commonDao.queryForObject(productNumSql.toString(), Integer.class);
|
|
|
+// vendorRecommend.setProductInfo(productInfo.replace("()", ""));
|
|
|
+//// vendorRecommend.setHitNums(hitNums);
|
|
|
+// }
|
|
|
+// List<Vendor> vendors = vendorDao.findByMyEnUUAndVendUU(enUU, vendUU);
|
|
|
+// if (!CollectionUtils.isEmpty(vendors)) {
|
|
|
+// vendorRecommend.setIsVendor(Constant.YES);
|
|
|
+// } else {
|
|
|
+// vendorRecommend.setIsVendor(Constant.NO);
|
|
|
+// }
|
|
|
content.add(vendorRecommend);
|
|
|
// System.out.println("处理完一条数据:" + (System.currentTimeMillis() - start1));
|
|
|
}
|
|
|
@@ -488,6 +491,9 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
vendorRecommend.setEn_tags(enterprise.getTags());
|
|
|
vendorRecommend.setEn_tel(enterprise.getEnTel());
|
|
|
vendorRecommend.setEn_uu(enterprise.getUu());
|
|
|
+ if (!StringUtils.isEmpty(vendorRecommend.getProductInfo())) {
|
|
|
+ vendorRecommend.setProductInfo(vendorRecommend.getProductInfo().replace("()", " "));
|
|
|
+ }
|
|
|
return vendorRecommend;
|
|
|
}
|
|
|
|