|
@@ -1,8 +1,5 @@
|
|
|
package com.uas.platform.b2b.service.impl;
|
|
package com.uas.platform.b2b.service.impl;
|
|
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
-import com.uas.sso.util.AccountUtils;
|
|
|
|
|
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;
|
|
@@ -21,7 +18,6 @@ import com.uas.platform.b2b.model.Vendor;
|
|
|
import com.uas.platform.b2b.model.VendorContact;
|
|
import com.uas.platform.b2b.model.VendorContact;
|
|
|
import com.uas.platform.b2b.service.VendorService;
|
|
import com.uas.platform.b2b.service.VendorService;
|
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
|
-import com.uas.platform.b2b.temporary.model.PartnershipRecord;
|
|
|
|
|
import com.uas.platform.core.model.Constant;
|
|
import com.uas.platform.core.model.Constant;
|
|
|
import com.uas.platform.core.model.PageInfo;
|
|
import com.uas.platform.core.model.PageInfo;
|
|
|
import com.uas.platform.core.model.Status;
|
|
import com.uas.platform.core.model.Status;
|
|
@@ -334,13 +330,13 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
long start = System.currentTimeMillis();
|
|
long start = System.currentTimeMillis();
|
|
|
// final Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
// final Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
if (null == enUU) {
|
|
if (null == enUU) {
|
|
|
- // 设置测试企业 - 优软测试二
|
|
|
|
|
- enUU = 10030994L;
|
|
|
|
|
|
|
+ // 设置不存在的企业
|
|
|
|
|
+ enUU = 100411660L;
|
|
|
}
|
|
}
|
|
|
if (StringUtils.isEmpty(productMatchCondition) || productMatchCondition.contains("1=1")) {
|
|
if (StringUtils.isEmpty(productMatchCondition) || productMatchCondition.contains("1=1")) {
|
|
|
productMatchCondition = " 1=1 ";
|
|
productMatchCondition = " 1=1 ";
|
|
|
} else {
|
|
} else {
|
|
|
- productMatchCondition = productMatchCondition + " and pr_issale = 1 and pr_b2bdisabled <> 1";
|
|
|
|
|
|
|
+ productMatchCondition = productMatchCondition + " and pr_issale = 1";
|
|
|
}
|
|
}
|
|
|
if (StringUtils.isEmpty(enterpriseMatchCondition)) {
|
|
if (StringUtils.isEmpty(enterpriseMatchCondition)) {
|
|
|
enterpriseMatchCondition = " 1=1 ";
|
|
enterpriseMatchCondition = " 1=1 ";
|
|
@@ -348,20 +344,21 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
// 查询所有的企业信息
|
|
// 查询所有的企业信息
|
|
|
StringBuffer enterpriseSql = new StringBuffer();
|
|
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 (" +
|
|
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, count(1) as counts from sec$enterprises left join v$products on en_uu = pr_enuu where ").append(productMatchCondition).append(" and en_uu <> ")
|
|
|
|
|
|
|
+ " select en_uu, count(1) as counts from sec$enterprises left join products on en_uu = pr_enuu where ").append(productMatchCondition).append(" and en_uu <> ")
|
|
|
.append(enUU).append(" and en_name not like '%测试%' and lower(en_name) not like '%test%' and ").append(enterpriseMatchCondition).append(" group by en_uu order by count(1) desc" +
|
|
.append(enUU).append(" and en_name not like '%测试%' and lower(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, counts desc");
|
|
" ) a on en.en_uu = a.en_uu order by en.en_weight desc, counts desc");
|
|
|
// rownum 控制
|
|
// rownum 控制
|
|
|
String rownumSql = ") t where rownum <= " + page * size + ") s 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();
|
|
|
|
|
+ // and instr(Pr_Title,'测试')<1 and instr(lower(Pr_Title),'test')<1
|
|
|
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 ")
|
|
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 pr_issale = 1 and pr_b2bdisabled <> 1 and instr(Pr_Title,'测试')<1 and instr(lower(Pr_Title),'test')<1 " +
|
|
|
|
|
|
|
+ .append(productMatchCondition).append(" and pr_issale = 1 and pr_b2bdisabled <> 1 " +
|
|
|
" and rownum<5 ) productInfo, (select 1 from purc$vendors where ve_vendenuu = en_uu and ve_myenuu = ").append(enUU)
|
|
" 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);
|
|
.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 en_name not like '%测试%' and lower(en_name) not like '%test%' and en_uu <> ")
|
|
|
|
|
|
|
+ " products on en_uu = pr_enuu where en_name not like '%测试%' and lower(en_name) not like '%test%' and en_uu <> ")
|
|
|
.append(enUU).append(" and ").append(productMatchCondition).append(" and ").append(enterpriseMatchCondition).append(" group by en_uu)");
|
|
.append(enUU).append(" and ").append(productMatchCondition).append(" and ").append(enterpriseMatchCondition).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());
|
|
@@ -378,7 +375,7 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
* @param page 页数
|
|
* @param page 页数
|
|
|
* @param size 每页条数
|
|
* @param size 每页条数
|
|
|
* @param vendUU 推荐供应商企业UU
|
|
* @param vendUU 推荐供应商企业UU
|
|
|
- * @param productMatchCondition 列表的物料匹配搜索条件
|
|
|
|
|
|
|
+ * @param productMatchCondition 列表的物料匹配搜索条件 -- 需求变更中,此条件已弃用
|
|
|
* @param whereCondition where条件(product的筛选条件拼接)
|
|
* @param whereCondition where条件(product的筛选条件拼接)
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
@@ -462,7 +459,7 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
}
|
|
}
|
|
|
String value = field.replace("pr_", "");
|
|
String value = field.replace("pr_", "");
|
|
|
String productSql = "select " + field + " as " + value +" from (" +
|
|
String productSql = "select " + field + " as " + value +" from (" +
|
|
|
- " select " + field + " from v$products where " + condition + " group by " + field + " order by count(1) desc" +
|
|
|
|
|
|
|
+ " select " + field + " from v$products where " + condition + " group by " + field +
|
|
|
") where rownum <= 10";
|
|
") where rownum <= 10";
|
|
|
return commonDao.query(productSql, Product.class);
|
|
return commonDao.query(productSql, Product.class);
|
|
|
}
|
|
}
|