|
|
@@ -1,16 +1,22 @@
|
|
|
package com.uas.platform.b2b.controller;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.data.domain.Page;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import com.uas.platform.b2b.model.Product;
|
|
|
+import com.uas.platform.b2b.search.SearchService;
|
|
|
import com.uas.platform.b2b.service.ProductService;
|
|
|
-import com.uas.platform.core.model.PageInfo;
|
|
|
import com.uas.platform.core.model.PageParams;
|
|
|
+import com.uas.search.b2b.model.SPage;
|
|
|
+import com.uas.search.b2b.model.Sort;
|
|
|
+import com.uas.search.b2b.model.Sort.Type;
|
|
|
+import com.uas.search.b2b.util.SearchConstants;
|
|
|
|
|
|
/**
|
|
|
* 物料
|
|
|
@@ -25,6 +31,9 @@ public class ProductController {
|
|
|
@Autowired
|
|
|
private ProductService productService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SearchService searchService;
|
|
|
+
|
|
|
/**
|
|
|
* 供应商角度 - 获取所有客户的物料信息
|
|
|
*
|
|
|
@@ -32,12 +41,17 @@ public class ProductController {
|
|
|
*/
|
|
|
@RequestMapping(method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
- public Page<Product> getMessages(PageParams params, Long custUU, String keyword) {
|
|
|
- PageInfo info = new PageInfo(params);
|
|
|
- if(custUU != null && custUU != 0) {
|
|
|
- info.filter("enUU", custUU);
|
|
|
+ public SPage<Product> getMessages(PageParams params, Long custUU, String keyword) {
|
|
|
+ com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, null);
|
|
|
+ if (custUU != null && custUU != 0) {
|
|
|
+ pageParams.getFilters().put("pr_enuu", custUU);
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("pr_id", false, Type.LONG, new Long(1)));
|
|
|
+ pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
+ return searchService.searchProductsCheckIds(keyword, pageParams);
|
|
|
+ } else {
|
|
|
+ return null;
|
|
|
}
|
|
|
- return productService.findAllByPageInfo(info, keyword);
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
}
|