package com.uas.search.service; import com.uas.search.annotation.NotEmpty; import com.uas.search.constant.model.CollectField; import com.uas.search.constant.model.PageParams; import com.uas.search.constant.model.PageParams.FilterField; import com.uas.search.constant.model.SPage; import com.uas.search.model.*; import java.io.IOException; import java.util.List; import java.util.Map; import java.util.Set; /** * 搜索服务的接口 * * @author suntg * @since 2016年7月29日下午4:58:45 */ public interface SearchService { /** * 根据关键字搜索产品类目id * * @param keyword * 关键词 * @param page * 页码 * @param size * 页大小 * @return 符合条件的类目id */ public SPage getKindIds(String keyword, Integer page, Integer size) throws IOException; /** * 根据关键词搜索产品类目 * * @param keyword * 关键词 * @param page * 页码 * @param size * 页大小 * @return */ public SPage> getKinds(String keyword, Integer page, Integer size) throws IOException; /** * 根据关键词搜索产品品牌id * * @param keyword * 关键词 * @param page * 页码 * @param size * 页大小 * @return 符合条件的品牌id */ public SPage getBrandIds(String keyword, Integer page, Integer size) throws IOException; /** * 根据关键词搜索产品品牌 * * @param keyword * 关键词 * @param page * 页码 * @param size * 页大小 * @return 符合条件的品牌 */ public SPage> getBrands(String keyword, Integer page, Integer size) throws IOException; /** * 根据关键词搜索品牌(精确命中后,提供卖家信息) * @param keyword 关键词 * @param page 页码 * @param size 页数 * @return * @throws IOException */ SPage> getBrandsAndSellers(String keyword, Integer page, Integer size) throws IOException; /** * 根据关键词搜索品牌(精确命中后,提供卖家信息) * @param keyword 关键词 * @param page 页码 * @param size 页数 * @return * @throws IOException */ Map getSellersWithKind(String keyword, Integer page, Integer size) throws IOException; /** * 根据关键词搜索产品(关键词可能是器件、类目、品牌,甚至可能是类目、品牌的混合) * * @param keyword * 关键词 * @param params * 翻页、过滤等信息 *

* 关于过滤,通过键值对指定过滤条件,键为 * {@link com.uas.search.constant.model.PageParams.FilterField} * ,值的类型由键决定: *

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
FieldType
COMPONENT_KINDIDLong
COMPONENT_BRANDIDLong
COMPONENT_PROPERTIES键值对,键值分别为属性id、属性值
COMPONENT_HAS_RESERVEBoolean
COMPONENT_HAS_SAMPLEBoolean
COMPONENT_HAS_ORIGINALBoolean
COMPONENT_HAS_INACTION_STOCKBoolean
* * @return */ public Map getComponentIds(String keyword, PageParams params) ; /** * 根据产品搜索获取产品类目id的统计 * * @param keyword * @param brandId * (可选) * @return */ public Set getKindIdsBySearchComponent(String keyword, String brandId) ; /** * 根据产品搜索获取产品类目的统计 * * @param keyword * @param brandId * (可选) * @return */ public Set> getKindsBySearchComponent(String keyword, String brandId) ; /** * 根据产品搜索获取产品品牌id的统计 * * @param keyword * @param kindId * (可选) * @return */ public Set getBrandIdsBySearchComponent(String keyword, String kindId) ; /** * 根据产品搜索获取产品品牌的统计 * * @param keyword * @param kindId * (可选) * @return */ public Set> getBrandsBySearchComponent(String keyword, String kindId) ; /** * 根据输入获取联想词(包括器件、类目、品牌,按顺序获取,数量不足,才会获取下一个) * * @param keyword * @param size 指定的联想词数目 * @return */ public List getSimilarKeywords(String keyword, Integer size) ; /** * 根据输入的原厂型号获取联想词 * * @param componentCode * @param size 指定的联想词数目 * @return 包括id、uuid、code */ public List> getSimilarComponents(String componentCode, Integer size) ; /** * 根据输入的物料型号获取联想词 * * @param code * @param size 指定的联想词数目 * @return 包括id、uuid、code */ List> getSimilarProducts(String code, Integer size) ; /** * 根据输入的品牌获取联想词 * * @param brandName * @param size 指定的联想词数目 * @return 包括id、uuid、nameCn、nameEn */ public List> getSimilarBrands(String brandName, Integer size) throws IOException; /** * 根据输入的类目名获取联想词 * * @param kindName * @param size 指定的联想词数目 * @return 包括id、nameCn、level、isLeaf */ public List> getSimilarKinds(String kindName, Integer size) throws IOException; /** * 根据输入的类目名获取末级类目联想词 * * @param kindName * @param size 指定的联想词数目 * @return 包括id、nameCn、level、isLeaf */ public List> getSimilarLeafKinds(String kindName, Integer size) throws IOException; /** * 根据输入的类目名和指定的类目级别获取联想词 * * @param kindName * @param level * @param size 指定的联想词数目 * @return 包括id、nameCn、level、isLeaf */ public List> getSimilarKindsByLevel(String kindName, Short level, Integer size) throws IOException; /** * 根据类目id、属性id、属性值获取联想词 * * @param kindId * 类目id * @param propertyId * 属性id * @param keyword * (可选) 属性值(部分字符) * @param topNum * (可选) 获取的最大数目 * @return 相似的属性值,包括propertyValue */ public List> getSimilarPropertyValues(Long kindId, Long propertyId, String keyword, Long topNum); /** * 根据关键词搜索批次(关键词可能是器件、类目、品牌) * * @param keyword * 关键词 * @param pageParams * 翻页、过滤、排序等信息 *

* 关于过滤,通过键值对指定过滤条件,键为 * {@link com.uas.search.constant.model.PageParams.FilterField} * ,值的类型由键决定: *

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
FieldType
GOODS_KINDIDList(Long)
GOODS_BRANDIDList(Long)
GOODS_STORE_TYPEList(String)
GOODS_CRNAMEList(String)
GOODS_MINPRICERMBDouble
GOODS_MAXPRICERMBDouble
GOODS_MINPRICEUSDDouble
GOODS_MAXPRICEUSDDouble
* * @return 器件id、批次id和分页信息 */ public Map getGoodsIds(String keyword, PageParams pageParams) throws IOException; /** * 根据关键词搜索 PCB 批次 * * @param keyword * 关键词 * @param pageParams * 翻页、过滤、排序等信息 *

* 关于过滤,通过键值对指定过滤条件,键为 * {@link com.uas.search.constant.model.PageParams.FilterField} * ,值的类型由键决定: *

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
FieldType
GOODS_KINDIDList(Long)
GOODS_BRANDIDList(Long)
GOODS_CRNAMEList(String)
GOODS_MINPRICERMBDouble
GOODS_MAXPRICERMBDouble
GOODS_MINPRICEUSDDouble
GOODS_MAXPRICEUSDDouble
* * @return PCB id、批次 id 和分页信息 */ Map getPCBGoodsIds(String keyword, PageParams pageParams) throws IOException; /** * 搜索批次时,统计指定信息 * * @param keyword * 关键词 * @param collectedField * 需要统计的信息 * @param filters * 过滤条件,值的类型由键决定: * * * * * * * * * * * * * * * * * * * * * * *
FieldType
GOODS_KINDIDList(Long)
GOODS_BRANDIDList(Long)
GOODS_STORE_TYPEList(String)
GOODS_CRNAMEList(String)
* * @return 统计的信息(由collectedField决定) * * * * * * * * * * * * * * * * * * * * * * *
Collected fieldMessage
GOODS_KINDki_id、ki_name_cn
GOODS_BRANDbr_id、br_uuid、br_name_cn、br_name_en
GOODS_STORE_TYPEstore_type
GOODS_CRNAMEcr_name
*/ public List> collectBySearchGoods(String keyword, CollectField collectedField, Map filters) throws IOException; /** * 搜索 PCB 批次时,统计指定信息 * * @param keyword * 关键词 * @param collectedField * 需要统计的信息 * @param filters * 过滤条件,值的类型由键决定: * * * * * * * * * * * * * * * * * * *
FieldType
GOODS_KINDIDList(Long)
GOODS_BRANDIDList(Long)
GOODS_CRNAMEList(String)
* * @return 统计的信息(由collectedField决定) * * * * * * * * * * * * * * * * * * *
Collected fieldMessage
GOODS_KINDki_id、ki_name_cn
GOODS_BRANDbr_id、br_uuid、br_name_cn、br_name_en
GOODS_CRNAMEcr_name
*/ List> collectBySearchPCBGoods(String keyword, CollectField collectedField, Map filters) throws IOException; /** * 根据id获取类目 * * @param id * @return */ public Kind getKind(Long id) throws IOException; /** * 根据id获取品牌 * * @param id * @return */ public Brand getBrand(Long id) throws IOException; /** * 根据id获取器件 * * @param id * @return */ public Component getComponent(Long id) throws IOException; /** * 根据id获取批次 * * @param id * @return */ public Goods getGoods(String id) throws IOException; /** * 根据id获取 PCB 批次 * * @param id * @return */ public PCBGoods getPCBGoods(String id) throws IOException; /** * 分页获取本地指定表的索引中的数据 * * @param tableName * 表名 * @param keyword * 关键词,可为空,默认正则搜索空串 * @param field * 搜索字段,可为空,默认取各表索引中的id字段 * @param tokenized * 是否分词,可为空,默认不分词 * @param page * 页码 * @param size * 分页大小 * @return */ public SPage getObjects(String tableName, String keyword, String field, Boolean tokenized, @NotEmpty("page") Integer page, @NotEmpty("size") Integer size) throws IOException; /** * 查询物料 * @param enUU 企业UU * @param keyword 关键词 * @param page 页码 * @param size 尺寸 * @param type all 全部 standard 标准 nStandard 非标 * @return idPage * @throws IOException 输入异常 */ SPage getProductIds(Long enUU, String keyword, Integer page, Integer size, String type) throws IOException; /** * 根据id获取物料 * * @param id * @return */ V_Products getProduct(Long id) throws IOException; /** * 获取标准型号联想词 * @param keyword 关键词 * @param size 尺寸 * @return */ List> getSimilarPCmpCodes(String keyword, Integer size); /** * 获取类目联想词 * @param keyword 关键词 * @param size 尺寸 * @return */ List> getSimilarKind(String keyword, Integer size); }