|
@@ -2,6 +2,7 @@ package com.uas.platform.b2b.service.impl;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import com.uas.platform.b2b.core.util.StringUtil;
|
|
|
import com.uas.platform.b2b.dao.CommonDao;
|
|
import com.uas.platform.b2b.dao.CommonDao;
|
|
|
import com.uas.platform.b2b.dao.DistributeDao;
|
|
import com.uas.platform.b2b.dao.DistributeDao;
|
|
|
import com.uas.platform.b2b.dao.EnterpriseDao;
|
|
import com.uas.platform.b2b.dao.EnterpriseDao;
|
|
@@ -327,179 +328,132 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public com.uas.account.support.Page<VendorRecommend> getVendorRecommend(String productMatchCondition, String enterpriseMatchCondition, String productCondition, int page, int size) {
|
|
|
|
|
|
|
+ public com.uas.account.support.Page<VendorRecommend> getVendorRecommend(String productMatchCondition, String enterpriseMatchCondition, int page, int size) {
|
|
|
long start = System.currentTimeMillis();
|
|
long start = System.currentTimeMillis();
|
|
|
final Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
final Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
- String cmpCodesSql = concatProductCondition(enUU, productMatchCondition, productCondition);
|
|
|
|
|
|
|
+ if (StringUtils.isEmpty(productMatchCondition)) {
|
|
|
|
|
+ productMatchCondition = " 1=1 ";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isEmpty(enterpriseMatchCondition)) {
|
|
|
|
|
+ enterpriseMatchCondition = " 1=1 ";
|
|
|
|
|
+ }
|
|
|
|
|
+ // 查询所有的企业信息
|
|
|
|
|
+ StringBuffer enterpriseSql = new StringBuffer();
|
|
|
|
|
+ enterpriseSql.append("select en.en_uu, en.en_name, en.en_shortname, en.en_address, en.en_tel, en.en_email, en.en_corporation, en.en_businesscode, en.en_profession, en.en_tags, en.en_contactman, en.en_contacttel from sec$enterprises en right join (" +
|
|
|
|
|
+ " select en_uu from sec$enterprises left join v$products on en_uu = pr_enuu where ").append(productMatchCondition).append(" and pr_issale = 1 and pr_b2bdisabled <> 1 " +
|
|
|
|
|
+ " and en_uu <> ").append(enUU).append(" and en_name not like '%测试%' and en_name not like '%test%' and ").append(enterpriseMatchCondition).append(" group by en_uu order by count(1) desc" +
|
|
|
|
|
+ " ) a on en.en_uu = a.en_uu order by en.en_weight desc");
|
|
|
// rownum 控制
|
|
// rownum 控制
|
|
|
- String rownumSql = ") t where rownum <= " + page * size + ") where r1 > " + (page - 1) * size;
|
|
|
|
|
|
|
+ String rownumSql = ") t where rownum <= " + page * size + ") s where r1 > " + (page - 1) * size;
|
|
|
// 查找非供应商的卖当前商品的企业UU
|
|
// 查找非供应商的卖当前商品的企业UU
|
|
|
StringBuffer vendorRecommendUusSql = new StringBuffer();
|
|
StringBuffer vendorRecommendUusSql = new StringBuffer();
|
|
|
-// StringBuffer vendorRecommendUuNumSql = new StringBuffer();
|
|
|
|
|
- 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);
|
|
|
|
|
- if (null != enterpriseMatchCondition && !"".equals(enterpriseMatchCondition)) {
|
|
|
|
|
- vendorRecommendUusSql.append(" and ").append(enterpriseMatchCondition);
|
|
|
|
|
-// vendorRecommendUuNumSql.append(" and ").append(enterpriseMatchCondition);
|
|
|
|
|
- }
|
|
|
|
|
- // 去掉测试企业
|
|
|
|
|
- vendorRecommendUusSql.append("and en_name not like '%测试%'");
|
|
|
|
|
- vendorRecommendUusSql.append(" group by en_uu order by count(en_uu) desc) a");
|
|
|
|
|
- // 拼接未匹配到物料的有可售产品的供应商
|
|
|
|
|
- StringBuffer enterpriseProdSaleSql = new StringBuffer();
|
|
|
|
|
- // 匹配到的企业UU(包含自己企业UU)
|
|
|
|
|
- String enUUSql = "select distinct(en_uu) from sec$enterprises left join v$products p on en_uu = p.pr_enuu where p.pr_issale = 1 and p.pr_b2bdisabled <> 1 and exists (" +
|
|
|
|
|
- " select 1 from v$products pr where pr.pr_ispurchase = 1 and nvl(pr.pr_issale, 0) <> 1 and pr.pr_cmpcode = p.pr_cmpcode and pr.pr_enuu = " + enUU + ") " +
|
|
|
|
|
- " and en_uu <> " + enUU;
|
|
|
|
|
- enterpriseProdSaleSql.append(
|
|
|
|
|
- " select en_uu,0 as hitNums from (select en_uu from sec$enterprises left join v$products on en_uu = pr_enuu " +
|
|
|
|
|
- " where pr_issale = 1 and pr_b2bdisabled <> 1 and en_uu <> ").append(enUU).append(" and en_uu not in (")
|
|
|
|
|
- .append(enUUSql).append(")");
|
|
|
|
|
- if (null != enterpriseMatchCondition && !"".equals(enterpriseMatchCondition)) {
|
|
|
|
|
- enterpriseProdSaleSql.append(" and ").append(enterpriseMatchCondition);
|
|
|
|
|
- }
|
|
|
|
|
- // 去掉测试企业
|
|
|
|
|
- enterpriseProdSaleSql.append("and en_name not like '%测试%'");
|
|
|
|
|
- enterpriseProdSaleSql.append(" group by en_uu order by count(pr_issale) desc) b");
|
|
|
|
|
- vendorRecommendUusSql.append(" union all ").append(enterpriseProdSaleSql);
|
|
|
|
|
- vendorRecommendUusSql.append(rownumSql);
|
|
|
|
|
|
|
+ vendorRecommendUusSql.append("select s.*,( select wm_concat(pr_title || (case when pr_brand is not null then '(' || pr_brand || ')' else ' ' end)) from v$products where pr_enuu=en_uu and ").append(productMatchCondition)
|
|
|
|
|
+ .append(" 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 (").append(enterpriseSql).append(rownumSql);
|
|
|
// 因为需求更改为所有有销售产品的企业都会被返回,所以total直接取除本企业外其他有销售产品的企业数即可,之前的匹配企业数不再返回
|
|
// 因为需求更改为所有有销售产品的企业都会被返回,所以total直接取除本企业外其他有销售产品的企业数即可,之前的匹配企业数不再返回
|
|
|
StringBuffer totalSql = new StringBuffer().append(" select count(1) from (select en_uu from sec$enterprises left join " +
|
|
StringBuffer totalSql = new StringBuffer().append(" select count(1) from (select en_uu from sec$enterprises left join " +
|
|
|
" v$products on en_uu = pr_enuu where pr_issale = 1 and pr_b2bdisabled <> 1 and en_uu <> ")
|
|
" v$products on en_uu = pr_enuu where pr_issale = 1 and pr_b2bdisabled <> 1 and en_uu <> ")
|
|
|
.append(enUU).append(" group by en_uu)");
|
|
.append(enUU).append(" group by en_uu)");
|
|
|
System.out.println("SQL:" + vendorRecommendUusSql.toString());
|
|
System.out.println("SQL:" + vendorRecommendUusSql.toString());
|
|
|
-// System.out.println("NUM_SQL:" + totalSql.toString());
|
|
|
|
|
|
|
+ System.out.println("NUM_SQL:" + totalSql.toString());
|
|
|
Integer total = commonDao.queryForObject(totalSql.toString(), Integer.class);
|
|
Integer total = commonDao.queryForObject(totalSql.toString(), Integer.class);
|
|
|
List<VendorRecommend> vendorRecommends = commonDao.query(vendorRecommendUusSql.toString(), VendorRecommend.class);
|
|
List<VendorRecommend> vendorRecommends = commonDao.query(vendorRecommendUusSql.toString(), VendorRecommend.class);
|
|
|
System.out.println("查找完企业UU" + (System.currentTimeMillis() - start));
|
|
System.out.println("查找完企业UU" + (System.currentTimeMillis() - start));
|
|
|
- return getVendorRecommendByVendUUs(enUU, vendorRecommends, page, size, total);
|
|
|
|
|
|
|
+ return new com.uas.account.support.Page<VendorRecommend>(page, size, vendorRecommends, total);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 组装物料匹配条件
|
|
|
|
|
- * @param enUU 企业UU
|
|
|
|
|
- * @param productMatchCondition 物料模糊匹配条件
|
|
|
|
|
- * @param productCondition 物料精确匹配条件
|
|
|
|
|
- * @return
|
|
|
|
|
- */
|
|
|
|
|
- private String concatProductCondition(Long enUU, String productMatchCondition, String productCondition) {
|
|
|
|
|
- // 先查询当前企业的采购物料(待购&&不在售)的标准物料标准料号
|
|
|
|
|
- StringBuffer cmpCodesSql = new StringBuffer().append("select distinct(pr.pr_cmpcode) from v$products pr " +
|
|
|
|
|
- " where pr.pr_ispurchase = 1 and nvl(pr_issale, 0) <> 1 and pr.pr_enuu = ").append(enUU);
|
|
|
|
|
- if (null != productMatchCondition && !"".equals(productMatchCondition)) {
|
|
|
|
|
- cmpCodesSql.append(" and ").append(productMatchCondition);
|
|
|
|
|
- }
|
|
|
|
|
- // productCondition 不为空时,使用其中条件进行精确匹配
|
|
|
|
|
- if (null != productCondition && !"".equals(productCondition)) {
|
|
|
|
|
- JSONObject prodCondition = JSON.parseObject(productCondition);
|
|
|
|
|
- String code = (String) prodCondition.get("pr_code");
|
|
|
|
|
- String title = (String) prodCondition.get("pr_title");
|
|
|
|
|
- String spec = (String) prodCondition.get("pr_spec");
|
|
|
|
|
- if (null != code && !"".equals(code)) {
|
|
|
|
|
- List<Product> products = productDao.findByEnUUAndCode(enUU, code);
|
|
|
|
|
- // 已上传的,标准物料使用原厂型号精确匹配,并根据物料名称模糊搜索, 非标物料使用物料名称模糊搜索
|
|
|
|
|
- if (!CollectionUtils.isEmpty(products)) {
|
|
|
|
|
- Product product = products.get(0);
|
|
|
|
|
- cmpCodesSql.append(" and pr.pr_title like '%").append(product.getTitle()).append("%' ");
|
|
|
|
|
- if (product.getStandard() == 1) {
|
|
|
|
|
- cmpCodesSql.append(" and pr.pr_cmpcode = ").append(product.getCmpCode());
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- if (null != title && !"".equals(title)) {
|
|
|
|
|
- cmpCodesSql.append(" and pr.pr_title like '%").append(title).append("%' ");
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- } else if (null != title && !"".equals(title)) {
|
|
|
|
|
- cmpCodesSql.append(" and pr.pr_title like '%").append(title).append("%' ");
|
|
|
|
|
- } else if (null != spec && !"".equals(spec)) {
|
|
|
|
|
- cmpCodesSql.append(" and pr.pr_spec like '%").append(spec).append("%' ");
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return cmpCodesSql.toString();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 根据供应商UU返回供应商推荐信息列表
|
|
|
|
|
- * @param enUU 本企业UU
|
|
|
|
|
- * @param vendorRecommends 供应商推荐实体 ,仅包含enuu和hitNums
|
|
|
|
|
- * @param page 页数
|
|
|
|
|
- * @param size 每页条数
|
|
|
|
|
- * @param total 总条数
|
|
|
|
|
- * @return 供应商推荐page
|
|
|
|
|
- */
|
|
|
|
|
- private com.uas.account.support.Page<VendorRecommend> getVendorRecommendByVendUUs(Long enUU, List<VendorRecommend> vendorRecommends, int page, int size, Integer total) {
|
|
|
|
|
- long start = System.currentTimeMillis();
|
|
|
|
|
- List<VendorRecommend> content = new ArrayList<>();
|
|
|
|
|
- for (VendorRecommend vendorRecommend : vendorRecommends) {
|
|
|
|
|
-// long start1 = System.currentTimeMillis();
|
|
|
|
|
- Long vendUU = vendorRecommend.getEn_uu();
|
|
|
|
|
- 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(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));
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- System.out.println("处理完所有数据:" + (System.currentTimeMillis() - start));
|
|
|
|
|
- // 返回分页信息
|
|
|
|
|
- return new com.uas.account.support.Page<VendorRecommend>(page, size, content, total);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 企业信息转换为推荐供应商信息
|
|
|
|
|
- * @param enterprise 企业信息
|
|
|
|
|
- * @param vendorRecommend 包含enuu 和hitNums 的供应商推荐信息
|
|
|
|
|
- * @return
|
|
|
|
|
- */
|
|
|
|
|
- private VendorRecommend covert(Enterprise enterprise, VendorRecommend vendorRecommend) {
|
|
|
|
|
- vendorRecommend.setEn_address(enterprise.getEnAddress());
|
|
|
|
|
- vendorRecommend.setEn_businesscode(enterprise.getEnBussinessCode());
|
|
|
|
|
- vendorRecommend.setEn_contactman(enterprise.getContactMan());
|
|
|
|
|
- vendorRecommend.setEn_contacttel(enterprise.getContactTel());
|
|
|
|
|
- vendorRecommend.setEn_corporation(enterprise.getEnCorporation());
|
|
|
|
|
- vendorRecommend.setEn_email(enterprise.getEnEmail());
|
|
|
|
|
- vendorRecommend.setEn_name(enterprise.getEnName());
|
|
|
|
|
- vendorRecommend.setEn_profession(enterprise.getProfession());
|
|
|
|
|
- vendorRecommend.setEn_shortname(enterprise.getEnShortname());
|
|
|
|
|
- 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;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// /**
|
|
|
|
|
+// * 组装物料匹配条件
|
|
|
|
|
+// * @param enUU 企业UU
|
|
|
|
|
+// * @param productMatchCondition 物料模糊匹配条件
|
|
|
|
|
+// * @param productCondition 物料精确匹配条件
|
|
|
|
|
+// * @return
|
|
|
|
|
+// */
|
|
|
|
|
+// private String concatProductCondition(Long enUU, String productMatchCondition, String productCondition) {
|
|
|
|
|
+// // 先查询当前企业的采购物料(待购&&不在售)的标准物料标准料号
|
|
|
|
|
+// StringBuffer productMatchSql = new StringBuffer();
|
|
|
|
|
+// if (null != productMatchCondition && !"".equals(productMatchCondition)) {
|
|
|
|
|
+// productMatchSql.append(" and ").append(productMatchCondition);
|
|
|
|
|
+// }
|
|
|
|
|
+// // productCondition 不为空时,使用其中条件进行精确匹配
|
|
|
|
|
+// if (null != productCondition && !"".equals(productCondition)) {
|
|
|
|
|
+// JSONObject prodCondition = JSON.parseObject(productCondition);
|
|
|
|
|
+// String code = (String) prodCondition.get("pr_code");
|
|
|
|
|
+// String title = (String) prodCondition.get("pr_title");
|
|
|
|
|
+// String spec = (String) prodCondition.get("pr_spec");
|
|
|
|
|
+// if (null != code && !"".equals(code)) {
|
|
|
|
|
+// List<Product> products = productDao.findByEnUUAndCode(enUU, code);
|
|
|
|
|
+// // 已上传的,标准物料使用原厂型号精确匹配,并根据物料名称模糊搜索, 非标物料使用物料名称模糊搜索
|
|
|
|
|
+// if (!CollectionUtils.isEmpty(products)) {
|
|
|
|
|
+// Product product = products.get(0);
|
|
|
|
|
+// productMatchSql.append(" and pr.pr_title like '%").append(product.getTitle()).append("%' ");
|
|
|
|
|
+// if (product.getStandard() == 1) {
|
|
|
|
|
+// productMatchSql.append(" and pr.pr_cmpcode = ").append(product.getCmpCode());
|
|
|
|
|
+// }
|
|
|
|
|
+// } else {
|
|
|
|
|
+// if (null != title && !"".equals(title)) {
|
|
|
|
|
+// productMatchSql.append(" and pr.pr_title like '%").append(title).append("%' ");
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// } else if (null != title && !"".equals(title)) {
|
|
|
|
|
+// productMatchSql.append(" and pr.pr_title like '%").append(title).append("%' ");
|
|
|
|
|
+// } else if (null != spec && !"".equals(spec)) {
|
|
|
|
|
+// productMatchSql.append(" and pr.pr_spec like '%").append(spec).append("%' ");
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// return productMatchSql.toString();
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
|
|
+// /**
|
|
|
|
|
+// * 根据供应商UU返回供应商推荐信息列表
|
|
|
|
|
+// * @param enUU 本企业UU
|
|
|
|
|
+// * @param vendorRecommends 供应商推荐实体 ,仅包含enuu和hitNums
|
|
|
|
|
+// * @param page 页数
|
|
|
|
|
+// * @param size 每页条数
|
|
|
|
|
+// * @param total 总条数
|
|
|
|
|
+// * @return 供应商推荐page
|
|
|
|
|
+// */
|
|
|
|
|
+// private com.uas.account.support.Page<VendorRecommend> getVendorRecommendByVendUUs(Long enUU, List<VendorRecommend> vendorRecommends, int page, int size, Integer total) {
|
|
|
|
|
+// long start = System.currentTimeMillis();
|
|
|
|
|
+// List<VendorRecommend> content = new ArrayList<>();
|
|
|
|
|
+// for (VendorRecommend vendorRecommend : vendorRecommends) {
|
|
|
|
|
+// Long vendUU = vendorRecommend.getEn_uu();
|
|
|
|
|
+// Enterprise enterprise = enterPriseDao.findOne(vendorRecommend.getEn_uu());
|
|
|
|
|
+// if (null != enterprise) {
|
|
|
|
|
+// vendorRecommend = covert(enterprise, vendorRecommend);
|
|
|
|
|
+// content.add(vendorRecommend);
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// System.out.println("处理完所有数据:" + (System.currentTimeMillis() - start));
|
|
|
|
|
+// // 返回分页信息
|
|
|
|
|
+// return new com.uas.account.support.Page<VendorRecommend>(page, size, content, total);
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// /**
|
|
|
|
|
+// * 企业信息转换为推荐供应商信息
|
|
|
|
|
+// * @param enterprise 企业信息
|
|
|
|
|
+// * @param vendorRecommend 包含enuu 和hitNums 的供应商推荐信息
|
|
|
|
|
+// * @return
|
|
|
|
|
+// */
|
|
|
|
|
+// private VendorRecommend covert(Enterprise enterprise, VendorRecommend vendorRecommend) {
|
|
|
|
|
+// vendorRecommend.setEn_address(enterprise.getEnAddress());
|
|
|
|
|
+// vendorRecommend.setEn_businesscode(enterprise.getEnBussinessCode());
|
|
|
|
|
+// vendorRecommend.setEn_contactman(enterprise.getContactMan());
|
|
|
|
|
+// vendorRecommend.setEn_contacttel(enterprise.getContactTel());
|
|
|
|
|
+// vendorRecommend.setEn_corporation(enterprise.getEnCorporation());
|
|
|
|
|
+// vendorRecommend.setEn_email(enterprise.getEnEmail());
|
|
|
|
|
+// vendorRecommend.setEn_name(enterprise.getEnName());
|
|
|
|
|
+// vendorRecommend.setEn_profession(enterprise.getProfession());
|
|
|
|
|
+// vendorRecommend.setEn_shortname(enterprise.getEnShortname());
|
|
|
|
|
+// 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;
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取推荐企业物料列表(匹配到的排前面)
|
|
* 获取推荐企业物料列表(匹配到的排前面)
|
|
@@ -564,4 +518,23 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
return new com.uas.account.support.Page<>(page, size, products, count);
|
|
return new com.uas.account.support.Page<>(page, size, products, count);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据条件获取物料型号和品牌值对
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param field 需要的字段名
|
|
|
|
|
+ * @param condition 物料模糊匹配条件
|
|
|
|
|
+ * @return 物料型号和品牌值对List
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<Product> getProductAssociate(String field, String condition) {
|
|
|
|
|
+ if (StringUtils.isEmpty(condition) || StringUtils.isEmpty(field)) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ String value = field.replace("pr_", "");
|
|
|
|
|
+ String productSql = "select " + field + " as " + value +" from (" +
|
|
|
|
|
+ " select " + field + " from v$products where " + condition + " group by " + field + " order by count(1) desc" +
|
|
|
|
|
+ ") where rownum <= 10";
|
|
|
|
|
+ return commonDao.query(productSql, Product.class);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|