|
|
@@ -200,23 +200,63 @@ public class SearcherServiceImpl implements SearcherService {
|
|
|
@Override
|
|
|
public ModelMap searchComponent(String keyword, PageParams page) {
|
|
|
ModelMap map = new ModelMap();
|
|
|
- Map<String, Object> results = new HashMap<>();
|
|
|
+ String results = "";
|
|
|
try {
|
|
|
results = searchService.getComponentIds(keyword, convertPageParams(page));
|
|
|
} catch (SearchException e) {
|
|
|
throwSystemException(e);
|
|
|
}
|
|
|
- List<Long> componentIds = (List<Long>) results.get("componentIds");
|
|
|
- if (!CollectionUtils.isEmpty(componentIds)) {
|
|
|
- List<ComponentInfo> components = componentInfoDao
|
|
|
- .findByIdsInOrder(componentIds.toArray(new Long[componentIds.size()]));
|
|
|
+
|
|
|
+ ComponentIdsResult componentIdsResult = FastjsonUtils.fromJson(results, ComponentIdsResult.class);
|
|
|
+ Long[] componentIds = componentIdsResult.getComponentIds();
|
|
|
+
|
|
|
+ if (componentIds.length > 0) {
|
|
|
+ List<ComponentInfo> components = componentInfoDao.findByIdsInOrder(componentIds);
|
|
|
map.put("components", components);// 当前页器件内容
|
|
|
}
|
|
|
- map.put("total", results.get("total"));// 搜索结果总数
|
|
|
- map.put("page", results.get("page"));// 当前页面
|
|
|
- map.put("size", results.get("size"));// 每页个数
|
|
|
+ map.put("total", componentIdsResult.getTotal());// 搜索结果总数
|
|
|
+ map.put("page", componentIdsResult.getPage());// 当前页面
|
|
|
+ map.put("size", componentIdsResult.getSize());// 每页个数
|
|
|
return map;
|
|
|
}
|
|
|
+ public static class ComponentIdsResult{
|
|
|
+ private int total;
|
|
|
+ private int size;
|
|
|
+ private int page;
|
|
|
+ private Long[] componentIds;
|
|
|
+
|
|
|
+ public int getTotal() {
|
|
|
+ return total;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setTotal(int total) {
|
|
|
+ this.total = total;
|
|
|
+ }
|
|
|
+
|
|
|
+ public int getSize() {
|
|
|
+ return size;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setSize(int size) {
|
|
|
+ this.size = size;
|
|
|
+ }
|
|
|
+
|
|
|
+ public int getPage() {
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setPage(int page) {
|
|
|
+ this.page = page;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Long[] getComponentIds() {
|
|
|
+ return componentIds;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setComponentIds(Long[] componentIds) {
|
|
|
+ this.componentIds = componentIds;
|
|
|
+ }
|
|
|
+ }
|
|
|
/**
|
|
|
* 智能搜索批次
|
|
|
*
|
|
|
@@ -327,7 +367,7 @@ public class SearcherServiceImpl implements SearcherService {
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(enUUs)) {
|
|
|
for (Object enuu : enUUs) {
|
|
|
- vendorIntroductionsFutures.add(VendorIntroduction.convertFromEnterprise(enterpriseDao.findByUu(Long.valueOf(enuu.toString()))));
|
|
|
+ vendorIntroductionsFutures.add(VendorIntroduction.convertFromEnterprise(enterpriseDao.findEnterpriseAndIsStoreByUu(Long.valueOf(enuu.toString()))));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -458,7 +498,7 @@ public class SearcherServiceImpl implements SearcherService {
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(enUUs)) {
|
|
|
for (Object enuu : enUUs) {
|
|
|
- vendorIntroductionsFutures.add(VendorIntroduction.convertFromEnterprise(enterpriseDao.findByUu(Long.valueOf(enuu.toString()))));
|
|
|
+ vendorIntroductionsFutures.add(VendorIntroduction.convertFromEnterprise(enterpriseDao.findEnterpriseAndIsStoreByUu(Long.valueOf(enuu.toString()))));
|
|
|
}
|
|
|
}
|
|
|
|