| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589 |
- 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<Long> getKindIds(String keyword, Integer page, Integer size) throws IOException;
- /**
- * 根据关键词搜索产品类目
- *
- * @param keyword
- * 关键词
- * @param page
- * 页码
- * @param size
- * 页大小
- * @return
- */
- public SPage<Map<String, Object>> getKinds(String keyword, Integer page, Integer size) throws IOException;
- /**
- * 根据关键词搜索产品品牌id
- *
- * @param keyword
- * 关键词
- * @param page
- * 页码
- * @param size
- * 页大小
- * @return 符合条件的品牌id
- */
- public SPage<Long> getBrandIds(String keyword, Integer page, Integer size) throws IOException;
- /**
- * 根据关键词搜索产品品牌
- *
- * @param keyword
- * 关键词
- * @param page
- * 页码
- * @param size
- * 页大小
- * @return 符合条件的品牌
- */
- public SPage<Map<String, Object>> getBrands(String keyword, Integer page, Integer size) throws IOException;
- /**
- * 根据关键词搜索品牌(精确命中后,提供卖家信息)
- * @param keyword 关键词
- * @param page 页码
- * @param size 页数
- * @return
- * @throws IOException
- */
- SPage<Map<String, Object>> getBrandsAndSellers(String keyword, Integer page, Integer size) throws IOException;
- /**
- * 根据关键词搜索品牌(精确命中后,提供卖家信息)
- * @param keyword 关键词
- * @param page 页码
- * @param size 页数
- * @return
- * @throws IOException
- */
- Map<String, Object> getSellersWithKind(String keyword, Integer page, Integer size) throws IOException;
- /**
- * 根据关键词搜索产品(关键词可能是器件、类目、品牌,甚至可能是类目、品牌的混合)
- *
- * @param keyword
- * 关键词
- * @param params
- * 翻页、过滤等信息
- * <p>
- * 关于过滤,通过键值对指定过滤条件,键为
- * {@link com.uas.search.constant.model.PageParams.FilterField}
- * ,值的类型由键决定:
- * </p>
- *
- * <table border=1 cellpadding=5 cellspacing=0 summary=
- * "Fields and types">
- * <tr>
- * <th>Field</th>
- * <th>Type</th>
- * </tr>
- * <tr>
- * <td>COMPONENT_KINDID</td>
- * <td>Long</td>
- * </tr>
- * <tr>
- * <td>COMPONENT_BRANDID</td>
- * <td>Long</td>
- * </tr>
- * <tr>
- * <td>COMPONENT_PROPERTIES</td>
- * <td>键值对,键值分别为属性id、属性值</td>
- * </tr>
- * <tr>
- * <td>COMPONENT_HAS_RESERVE</td>
- * <td>Boolean</td>
- * </tr>
- * <tr>
- * <td>COMPONENT_HAS_SAMPLE</td>
- * <td>Boolean</td>
- * </tr>
- * <tr>
- * <td>COMPONENT_HAS_ORIGINAL</td>
- * <td>Boolean</td>
- * </tr>
- * <tr>
- * <td>COMPONENT_HAS_INACTION_STOCK</td>
- * <td>Boolean</td>
- * </tr>
- * </table>
- *
- * @return
- */
- public Map<String, Object> getComponentIds(String keyword, PageParams params) ;
- /**
- * 根据产品搜索获取产品类目id的统计
- *
- * @param keyword
- * @param brandId
- * (可选)
- * @return
- */
- public Set<Long> getKindIdsBySearchComponent(String keyword, String brandId) ;
- /**
- * 根据产品搜索获取产品类目的统计
- *
- * @param keyword
- * @param brandId
- * (可选)
- * @return
- */
- public Set<Map<String, Object>> getKindsBySearchComponent(String keyword, String brandId) ;
- /**
- * 根据产品搜索获取产品品牌id的统计
- *
- * @param keyword
- * @param kindId
- * (可选)
- * @return
- */
- public Set<Long> getBrandIdsBySearchComponent(String keyword, String kindId) ;
- /**
- * 根据产品搜索获取产品品牌的统计
- *
- * @param keyword
- * @param kindId
- * (可选)
- * @return
- */
- public Set<Map<String, Object>> getBrandsBySearchComponent(String keyword, String kindId) ;
- /**
- * 根据输入获取联想词(包括器件、类目、品牌,按顺序获取,数量不足,才会获取下一个)
- *
- * @param keyword
- * @param size 指定的联想词数目
- * @return
- */
- public List<String> getSimilarKeywords(String keyword, Integer size) ;
- /**
- * 根据输入的原厂型号获取联想词
- *
- * @param componentCode
- * @param size 指定的联想词数目
- * @return 包括id、uuid、code
- */
- public List<Map<String, Object>> getSimilarComponents(String componentCode, Integer size) ;
- /**
- * 根据输入的物料型号获取联想词
- *
- * @param code
- * @param size 指定的联想词数目
- * @return 包括id、uuid、code
- */
- List<Map<String, Object>> getSimilarProducts(String code, Integer size) ;
- /**
- * 根据输入的品牌获取联想词
- *
- * @param brandName
- * @param size 指定的联想词数目
- * @return 包括id、uuid、nameCn、nameEn
- */
- public List<Map<String, Object>> getSimilarBrands(String brandName, Integer size) throws IOException;
- /**
- * 根据输入的类目名获取联想词
- *
- * @param kindName
- * @param size 指定的联想词数目
- * @return 包括id、nameCn、level、isLeaf
- */
- public List<Map<String, Object>> getSimilarKinds(String kindName, Integer size) throws IOException;
- /**
- * 根据输入的类目名获取末级类目联想词
- *
- * @param kindName
- * @param size 指定的联想词数目
- * @return 包括id、nameCn、level、isLeaf
- */
- public List<Map<String, Object>> getSimilarLeafKinds(String kindName, Integer size) throws IOException;
- /**
- * 根据输入的类目名和指定的类目级别获取联想词
- *
- * @param kindName
- * @param level
- * @param size 指定的联想词数目
- * @return 包括id、nameCn、level、isLeaf
- */
- public List<Map<String, Object>> 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<Map<String, String>> getSimilarPropertyValues(Long kindId, Long propertyId, String keyword, Long topNum);
- /**
- * 根据关键词搜索批次(关键词可能是器件、类目、品牌)
- *
- * @param keyword
- * 关键词
- * @param pageParams
- * 翻页、过滤、排序等信息
- * <p>
- * 关于过滤,通过键值对指定过滤条件,键为
- * {@link com.uas.search.constant.model.PageParams.FilterField}
- * ,值的类型由键决定:
- * </p>
- *
- * <table border=1 cellpadding=5 cellspacing=0 summary=
- * "Fields and types">
- * <tr>
- * <th>Field</th>
- * <th>Type</th>
- * </tr>
- * <tr>
- * <td>GOODS_KINDID</td>
- * <td>List(Long)</td>
- * </tr>
- * <tr>
- * <td>GOODS_BRANDID</td>
- * <td>List(Long)</td>
- * </tr>
- * <tr>
- * <td>GOODS_STORE_TYPE</td>
- * <td>List(String)</td>
- * </tr>
- * <tr>
- * <td>GOODS_CRNAME</td>
- * <td>List(String)</td>
- * </tr>
- * <tr>
- * <td>GOODS_MINPRICERMB</td>
- * <td>Double</td>
- * </tr>
- * <tr>
- * <td>GOODS_MAXPRICERMB</td>
- * <td>Double</td>
- * </tr>
- * <tr>
- * <td>GOODS_MINPRICEUSD</td>
- * <td>Double</td>
- * </tr>
- * <tr>
- * <td>GOODS_MAXPRICEUSD</td>
- * <td>Double</td>
- * </tr>
- * </table>
- *
- * @return 器件id、批次id和分页信息
- */
- public Map<String, Object> getGoodsIds(String keyword, PageParams pageParams) throws IOException;
- /**
- * 根据关键词搜索 PCB 批次
- *
- * @param keyword
- * 关键词
- * @param pageParams
- * 翻页、过滤、排序等信息
- * <p>
- * 关于过滤,通过键值对指定过滤条件,键为
- * {@link com.uas.search.constant.model.PageParams.FilterField}
- * ,值的类型由键决定:
- * </p>
- *
- * <table border=1 cellpadding=5 cellspacing=0 summary=
- * "Fields and types">
- * <tr>
- * <th>Field</th>
- * <th>Type</th>
- * </tr>
- * <tr>
- * <td>GOODS_KINDID</td>
- * <td>List(Long)</td>
- * </tr>
- * <tr>
- * <td>GOODS_BRANDID</td>
- * <td>List(Long)</td>
- * </tr>
- * <tr>
- * <td>GOODS_CRNAME</td>
- * <td>List(String)</td>
- * </tr>
- * <tr>
- * <td>GOODS_MINPRICERMB</td>
- * <td>Double</td>
- * </tr>
- * <tr>
- * <td>GOODS_MAXPRICERMB</td>
- * <td>Double</td>
- * </tr>
- * <tr>
- * <td>GOODS_MINPRICEUSD</td>
- * <td>Double</td>
- * </tr>
- * <tr>
- * <td>GOODS_MAXPRICEUSD</td>
- * <td>Double</td>
- * </tr>
- * </table>
- *
- * @return PCB id、批次 id 和分页信息
- */
- Map<String, Object> getPCBGoodsIds(String keyword, PageParams pageParams) throws IOException;
- /**
- * 搜索批次时,统计指定信息
- *
- * @param keyword
- * 关键词
- * @param collectedField
- * 需要统计的信息
- * @param filters
- * 过滤条件,值的类型由键决定:
- *
- * <table border=1 cellpadding=5 cellspacing=0 summary=
- * "Fields and types">
- * <tr>
- * <th>Field</th>
- * <th>Type</th>
- * </tr>
- * <tr>
- * <td>GOODS_KINDID</td>
- * <td>List(Long)</td>
- * </tr>
- * <tr>
- * <td>GOODS_BRANDID</td>
- * <td>List(Long)</td>
- * </tr>
- * <tr>
- * <td>GOODS_STORE_TYPE</td>
- * <td>List(String)</td>
- * </tr>
- * <tr>
- * <td>GOODS_CRNAME</td>
- * <td>List(String)</td>
- * </tr>
- * </table>
- *
- * @return 统计的信息(由collectedField决定)
- *
- * <table border=1 cellpadding=5 cellspacing=0 summary=
- * "Collected fields and messages">
- * <tr>
- * <th>Collected field</th>
- * <th>Message</th>
- * </tr>
- * <tr>
- * <td>GOODS_KIND</td>
- * <td>ki_id、ki_name_cn</td>
- * </tr>
- * <tr>
- * <td>GOODS_BRAND</td>
- * <td>br_id、br_uuid、br_name_cn、br_name_en</td>
- * </tr>
- * <tr>
- * <td>GOODS_STORE_TYPE</td>
- * <td>store_type</td>
- * </tr>
- * <tr>
- * <td>GOODS_CRNAME</td>
- * <td>cr_name</td>
- * </tr>
- * </table>
- */
- public List<Map<String, Object>> collectBySearchGoods(String keyword, CollectField collectedField,
- Map<FilterField, Object> filters) throws IOException;
- /**
- * 搜索 PCB 批次时,统计指定信息
- *
- * @param keyword
- * 关键词
- * @param collectedField
- * 需要统计的信息
- * @param filters
- * 过滤条件,值的类型由键决定:
- *
- * <table border=1 cellpadding=5 cellspacing=0 summary=
- * "Fields and types">
- * <tr>
- * <th>Field</th>
- * <th>Type</th>
- * </tr>
- * <tr>
- * <td>GOODS_KINDID</td>
- * <td>List(Long)</td>
- * </tr>
- * <tr>
- * <td>GOODS_BRANDID</td>
- * <td>List(Long)</td>
- * </tr>
- * <tr>
- * <td>GOODS_CRNAME</td>
- * <td>List(String)</td>
- * </tr>
- * </table>
- *
- * @return 统计的信息(由collectedField决定)
- *
- * <table border=1 cellpadding=5 cellspacing=0 summary=
- * "Collected fields and messages">
- * <tr>
- * <th>Collected field</th>
- * <th>Message</th>
- * </tr>
- * <tr>
- * <td>GOODS_KIND</td>
- * <td>ki_id、ki_name_cn</td>
- * </tr>
- * <tr>
- * <td>GOODS_BRAND</td>
- * <td>br_id、br_uuid、br_name_cn、br_name_en</td>
- * </tr>
- * <tr>
- * <td>GOODS_CRNAME</td>
- * <td>cr_name</td>
- * </tr>
- * </table>
- */
- List<Map<String, Object>> collectBySearchPCBGoods(String keyword, CollectField collectedField,
- Map<FilterField, Object> 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<Object> 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<Long> 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<Map<String,Object>> getSimilarPCmpCodes(String keyword, Integer size);
- /**
- * 获取类目联想词
- * @param keyword 关键词
- * @param size 尺寸
- * @return
- */
- List<Map<String,Object>> getSimilarKind(String keyword, Integer size);
- }
|