|
|
@@ -349,12 +349,10 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
System.out.println("进入方法:" + System.currentTimeMillis());
|
|
|
final Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
String cmpCodesSql = concatProductCondition(enUU, productMatchCondition, productCondition);
|
|
|
- System.out.println("查找物料语句拼接完成:" + System.currentTimeMillis());
|
|
|
// // 根据标准料号找出对应的供应商UU
|
|
|
// String vendUUsSql = "select distinct(ve_vendenuu) from purc$vendors left join v$products on pr_enuu = ve_vendenuu" +
|
|
|
// " where ve_myenuu = " + enUU + " and pr_issale = 1 and pr_cmpcode in (" + cmpCodesSql + ")";
|
|
|
// 采购物料原厂型号
|
|
|
- System.out.println(cmpCodesSql);
|
|
|
// final List<String> cmpCodes = commonDao.queryForList(cmpCodesSql.toString(), String.class);
|
|
|
// rownum 控制
|
|
|
String rownumSql = ") t where rownum <= " + page * size + ") where r1 > " + (page - 1) * size;
|
|
|
@@ -382,16 +380,14 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
" select distinct(en_uu) from (").append(enUUSql).append(")) group by en_uu order by count(pr_issale) desc) b");
|
|
|
vendorRecommendUusSql.append(" union all ").append(enterpriseProdSaleSql);
|
|
|
vendorRecommendUusSql.append(rownumSql);
|
|
|
- System.out.println("SQL:" + vendorRecommendUusSql.toString());
|
|
|
- System.out.println("NUM_SQL:" + vendorRecommendUuNumSql.toString());
|
|
|
+// System.out.println("SQL:" + vendorRecommendUusSql.toString());
|
|
|
+// System.out.println("NUM_SQL:" + vendorRecommendUuNumSql.toString());
|
|
|
// 因为需求更改为所有有销售产品的企业都会被返回,所以total直接取除本企业外其他有销售产品的企业数即可,之前的匹配企业数不再返回
|
|
|
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 <> ")
|
|
|
.append(enUU).append(" group by en_uu)");
|
|
|
- System.out.println("所有语句拼接完成:" + System.currentTimeMillis());
|
|
|
Integer total = commonDao.queryForObject(totalSql.toString(), Integer.class);
|
|
|
List<Long> vendUUs = commonDao.queryForList(vendorRecommendUusSql.toString(), Long.class);
|
|
|
- System.out.println("查找出所有推荐企业UU:" + System.currentTimeMillis());
|
|
|
return getVendorRecommendByVendUUs(enUU, vendUUs, page, size, total);
|
|
|
}
|
|
|
|
|
|
@@ -449,10 +445,7 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
*/
|
|
|
private com.uas.account.support.Page<VendorRecommend> getVendorRecommendByVendUUs(Long enUU, List<Long> vendUUs, int page, int size, Integer total) {
|
|
|
List<VendorRecommend> content = new ArrayList<>();
|
|
|
- int i = 0;
|
|
|
for (final Long vendUU : vendUUs) {
|
|
|
- i = i+ 1;
|
|
|
- System.out.println("开始处理第" + i + "条数据:" + System.currentTimeMillis());
|
|
|
Enterprise vendor = enterPriseDao.findOne(vendUU);
|
|
|
if (null != vendor) {
|
|
|
// if (null != vendor.getEnAdminuu()) {
|
|
|
@@ -471,12 +464,8 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
" where p1.pr_ispurchase = 1 and (p1.pr_issale is null or p1.pr_issale = 0) " +
|
|
|
" and p1.pr_b2bdisabled <> 1 and p1.pr_enuu = ")
|
|
|
.append(enUU).append(")");
|
|
|
- System.out.println("第" + i + "条数据物料查找语句拼接完成:" + System.currentTimeMillis());
|
|
|
- System.out.println(productIdsSql.toString());
|
|
|
- System.out.println(productNumSql.toString());
|
|
|
List<Long> prodIds = commonDao.queryForList(productIdsSql.toString(), Long.class);
|
|
|
Integer hitNums = commonDao.queryForObject(productNumSql.toString(), Integer.class);
|
|
|
- System.out.println("第" + i + "条数据匹配物料id及数量查找完成:" + System.currentTimeMillis());
|
|
|
// 获取前五条匹配物料
|
|
|
List<Product> hitsProducts = productDao.findAll(prodIds);
|
|
|
VendorRecommend vendorRecommend = new VendorRecommend();
|
|
|
@@ -489,10 +478,11 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
} else {
|
|
|
vendorRecommend.setIsVendor(Constant.NO);
|
|
|
}
|
|
|
- System.out.println("第" + i + "条数据处理完毕,添加到content:" + System.currentTimeMillis());
|
|
|
content.add(vendorRecommend);
|
|
|
}
|
|
|
+ System.out.println("处理完一条数据:" + System.currentTimeMillis());
|
|
|
}
|
|
|
+ System.out.println("处理完所有数据:" + System.currentTimeMillis());
|
|
|
// 返回分页信息
|
|
|
return new com.uas.account.support.Page<VendorRecommend>(page, size, content, total);
|
|
|
}
|
|
|
@@ -509,6 +499,7 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
*/
|
|
|
@Override
|
|
|
public com.uas.account.support.Page<Product> getProductsByVendorRecommend(int page, int size, Long vendUU, String productMatchCondition, String whereCondition) {
|
|
|
+ System.out.println("进入方法:" + System.currentTimeMillis());
|
|
|
// UAS企业UU
|
|
|
Long enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
// 先查询当前企业的采购物料(待购&&不在售)的标准物料标准料号
|
|
|
@@ -537,7 +528,7 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
String rownumSql = " t where rownum <= " + page * size + ") where r1 > " + (page - 1) * size;
|
|
|
idSql.append("select pr_id from (select t.*,rownum as r1 from (").append(productsMatchSql).append(" union all ").append(notMatchProductsSql)
|
|
|
.append(")").append(rownumSql);
|
|
|
- System.out.println(idSql.toString());
|
|
|
+// System.out.println(idSql.toString());
|
|
|
Integer count = commonDao.queryForObject(countSql, Integer.class);
|
|
|
List<Long> ids = commonDao.queryForList(idSql.toString(), Long.class);
|
|
|
List<Product> products = new ArrayList<>();
|
|
|
@@ -545,6 +536,7 @@ public class VendorsServiceImpl implements VendorService {
|
|
|
Product product = productDao.findOne(id);
|
|
|
products.add(product);
|
|
|
}
|
|
|
+ System.out.println("返回数据:" + System.currentTimeMillis());
|
|
|
return new com.uas.account.support.Page<>(page, size, products, count);
|
|
|
}
|
|
|
|