|
|
@@ -6,10 +6,10 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.Sort.Direction;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
@@ -21,6 +21,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.uas.platform.b2b.model.Distribute;
|
|
|
+import com.uas.platform.b2b.model.SearchFilter;
|
|
|
import com.uas.platform.b2b.model.User;
|
|
|
import com.uas.platform.b2b.model.Vendor;
|
|
|
import com.uas.platform.b2b.model.VendorContact;
|
|
|
@@ -31,6 +32,7 @@ import com.uas.platform.b2b.support.JxlsExcelView;
|
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
|
import com.uas.platform.core.model.PageInfo;
|
|
|
import com.uas.platform.core.model.PageParams;
|
|
|
+import com.uas.search.b2b.model.MultiValue;
|
|
|
import com.uas.search.b2b.model.SPage;
|
|
|
import com.uas.search.b2b.model.Sort;
|
|
|
import com.uas.search.b2b.model.Sort.Type;
|
|
|
@@ -61,7 +63,6 @@ public class VendorController {
|
|
|
@RequestMapping(method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
public SPage<Vendor> getVendors(PageParams params, String keyword) {
|
|
|
- PageInfo info = new PageInfo(params);
|
|
|
com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, null);
|
|
|
pageParams.getFilters().put("ve_myenuu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
|
@@ -87,10 +88,24 @@ public class VendorController {
|
|
|
*/
|
|
|
@RequestMapping(value = "/customer", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
- public Page<Vendor> getCustomers(PageParams params){
|
|
|
- PageInfo info = new PageInfo(params);
|
|
|
- info.filter("vendEnUU", SystemSession.getUser().getEnterprise().getUu());
|
|
|
- return vendorService.findAllByPageInfo(info);
|
|
|
+ public SPage<Vendor> getCustomers(PageParams params, String keyword) {
|
|
|
+ com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, null);
|
|
|
+ pageParams.getFilters().put("ve_vendenuu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ SearchFilter filter = userService.distribute();
|
|
|
+ if (filter != null && filter.getDistribute() == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
|
|
|
+ List<Object> list = new ArrayList<>();
|
|
|
+ for (Object object : filter.getDistribute()) {
|
|
|
+ list.add(object);
|
|
|
+ }
|
|
|
+ pageParams.getFilters().put("ve_myenuu", new MultiValue(list, true));
|
|
|
+ }
|
|
|
+ sortList.add(new Sort("ve_id", false, Type.LONG, new Long(1)));
|
|
|
+ pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
|
|
|
+ return searchService.searchVendorCheckIds(keyword, pageParams);
|
|
|
}
|
|
|
|
|
|
/**
|