|
|
@@ -1,12 +1,15 @@
|
|
|
package com.uas.platform.b2c.trade.vendor.service.impl;
|
|
|
|
|
|
import com.uas.platform.b2c.common.base.dao.CommonDao;
|
|
|
+import com.uas.platform.b2c.common.search.rpc.service.SearchService;
|
|
|
+import com.uas.platform.b2c.common.search.util.SPage;
|
|
|
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;
|
|
|
import com.uas.platform.b2c.trade.vendor.model.VendorIntroduction;
|
|
|
import com.uas.platform.b2c.trade.vendor.service.VendorIntroductionService;
|
|
|
+import com.uas.ps.core.util.CollectionUtils;
|
|
|
import com.uas.sso.support.Page;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -27,6 +30,9 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
|
|
|
@Autowired
|
|
|
private V_ProductPrivateDao v_productPrivateDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SearchService searchService;
|
|
|
+
|
|
|
/**
|
|
|
* 获取供应商资源列表
|
|
|
* @param page 页码
|
|
|
@@ -64,28 +70,12 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
|
|
|
*/
|
|
|
@Override
|
|
|
public Page<V_ProductPrivate> getVendorProductList(int page, int size, Long vendUU, String keyword) {
|
|
|
- String whereCondition = " 1 = 1 ";
|
|
|
- if (!StringUtils.isEmpty(keyword)) {
|
|
|
- keyword = keyword.trim();
|
|
|
- // 物料名称、规格、品牌、原厂型号、单位
|
|
|
- whereCondition = " (pr_title like '%" + keyword + "%' or pr_spec like '%" + keyword + "%' or pr_brand like '%"
|
|
|
- + keyword + "%' or pr_cmpcode like '%" + keyword + "%' or pr_unit like '%" + keyword + "%' or pr_kind like '%"
|
|
|
- + keyword + "%') ";
|
|
|
+ SPage<Long> ids = searchService.getProducts(vendUU, keyword, page, size, "all");
|
|
|
+ if (CollectionUtils.isEmpty(ids.getContent())) {
|
|
|
+ return null;
|
|
|
}
|
|
|
- long start = System.currentTimeMillis();
|
|
|
- // and Pr_Title not like '%测试%' and lower(Pr_Title) not like '%test%' and Pr_code not like '%测试%' and lower(Pr_code) not like '%test%'
|
|
|
- String prodSql = "select a.* from (select pr_id id, pr_code prodNum, pr_title prodName, pr_spec spec, pr_cmpcode cmpCode, pr_unit unit, pr_kind kind, "
|
|
|
- + " pr_brand brand, pr_pbranden pbranden, pr_standard standard from v$product$private where pr_enuu = "
|
|
|
- + vendUU + " and " + whereCondition + " and pr_pbranden is not null and pr_pcmpcode is not null and ifnull(pr_b2cenabled, 1) <> 0 order by pr_standard desc, pr_id desc) a limit " + (page - 1) * size + "," + size;
|
|
|
-// System.out.println("prod:" + prodSql);
|
|
|
- // and Pr_Title not like '%测试%' and lower(Pr_Title) not like '%test%' and Pr_code not like '%测试%' and lower(Pr_code) not like '%test%'
|
|
|
- String countSql = "select count(1) from v$product$private where pr_enuu = " + vendUU + " and " + whereCondition
|
|
|
- + " and pr_pbranden is not null and pr_pcmpcode is not null and ifnull(pr_b2cenabled, 1) <> 0";
|
|
|
- Integer count = commonDao.queryForObject(countSql, Integer.class);
|
|
|
-// System.out.println("count:" + countSql);
|
|
|
- List<V_ProductPrivate> products = commonDao.query(prodSql, V_ProductPrivate.class);
|
|
|
-// System.out.println("耗时" + (System.currentTimeMillis() - start));
|
|
|
- return new Page<>(page, size, products, count);
|
|
|
+ List<V_ProductPrivate> productPrivateList = v_productPrivateDao.findAll(ids.getContent());
|
|
|
+ return new Page<>(page, size, productPrivateList, (int) ids.getTotalElement());
|
|
|
}
|
|
|
|
|
|
/**
|