|
@@ -29,6 +29,7 @@ import com.uas.search.console.model.BrandSimpleInfo;
|
|
|
import com.uas.search.console.model.ComponentSimpleInfo;
|
|
import com.uas.search.console.model.ComponentSimpleInfo;
|
|
|
import com.uas.search.console.model.KindSimpleInfo;
|
|
import com.uas.search.console.model.KindSimpleInfo;
|
|
|
import com.uas.search.console.service.InnerSearchService;
|
|
import com.uas.search.console.service.InnerSearchService;
|
|
|
|
|
+import com.uas.search.console.util.DocumentToObjectUtils;
|
|
|
import com.uas.search.console.util.SearchConstants;
|
|
import com.uas.search.console.util.SearchConstants;
|
|
|
import com.uas.search.console.util.SearchUtils;
|
|
import com.uas.search.console.util.SearchUtils;
|
|
|
import com.uas.search.exception.SearchException;
|
|
import com.uas.search.exception.SearchException;
|
|
@@ -674,46 +675,18 @@ public class SearchServiceImpl implements SearchService, InnerSearchService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public KindSimpleInfo getKind(Long kindId) {
|
|
|
|
|
- KindSimpleInfo kind = null;
|
|
|
|
|
- Document document = SearchUtils.getDocumentById(SearchConstants.KIND_ID_FIELD, kindId);
|
|
|
|
|
- if (document != null) {
|
|
|
|
|
- kind = new KindSimpleInfo();
|
|
|
|
|
- kind.setId(kindId);
|
|
|
|
|
- kind.setNameCn(document.get(SearchConstants.KIND_NAMECN_FIELD));
|
|
|
|
|
- kind.setIsLeaf(Short.valueOf(document.get(SearchConstants.KIND_ISLEAF_FIELD)));
|
|
|
|
|
- kind.setLevel(Short.valueOf(document.get(SearchConstants.KIND_LEVEL_FIELD)));
|
|
|
|
|
- }
|
|
|
|
|
- return kind;
|
|
|
|
|
|
|
+ public KindSimpleInfo getKind(Long id) {
|
|
|
|
|
+ return DocumentToObjectUtils.toKind(SearchUtils.getDocumentById(SearchConstants.KIND_ID_FIELD, id));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public BrandSimpleInfo getBrand(Long brandId) {
|
|
|
|
|
- BrandSimpleInfo brand = null;
|
|
|
|
|
- Document document = SearchUtils.getDocumentById(SearchConstants.BRAND_ID_FIELD, brandId);
|
|
|
|
|
- if (document != null) {
|
|
|
|
|
- brand = new BrandSimpleInfo();
|
|
|
|
|
- brand.setId(brandId);
|
|
|
|
|
- brand.setNameCn(document.get(SearchConstants.BRAND_NAMECN_FIELD));
|
|
|
|
|
- brand.setNameEn(document.get(SearchConstants.BRAND_NAMEEN_FIELD));
|
|
|
|
|
- brand.setUuid(document.get(SearchConstants.BRAND_UUID_FIELD));
|
|
|
|
|
- }
|
|
|
|
|
- return brand;
|
|
|
|
|
|
|
+ public BrandSimpleInfo getBrand(Long id) {
|
|
|
|
|
+ return DocumentToObjectUtils.toBrand(SearchUtils.getDocumentById(SearchConstants.BRAND_ID_FIELD, id));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public ComponentSimpleInfo getComponent(Long componentId) {
|
|
|
|
|
- ComponentSimpleInfo component = null;
|
|
|
|
|
- Document document = SearchUtils.getDocumentById(SearchConstants.COMPONENT_ID_FIELD, componentId);
|
|
|
|
|
- if (document != null) {
|
|
|
|
|
- component = new ComponentSimpleInfo();
|
|
|
|
|
- component.setId(componentId);
|
|
|
|
|
- component.setCode(document.get(SearchConstants.COMPONENT_CODE_FIELD));
|
|
|
|
|
- component.setUuid(document.get(SearchConstants.COMPONENT_UUID_FIELD));
|
|
|
|
|
- component.setKindid(Long.valueOf(document.get(SearchConstants.COMPONENT_KINDID_FIELD)));
|
|
|
|
|
- component.setBrandid(Long.valueOf(document.get(SearchConstants.COMPONENT_BRANDID_FIELD)));
|
|
|
|
|
- }
|
|
|
|
|
- return component;
|
|
|
|
|
|
|
+ public ComponentSimpleInfo getComponent(Long id) {
|
|
|
|
|
+ return DocumentToObjectUtils.toComponent(SearchUtils.getDocumentById(SearchConstants.COMPONENT_ID_FIELD, id));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|