|
|
@@ -18,9 +18,9 @@ import com.uas.platform.b2c.core.utils.JacksonUtils;
|
|
|
import com.uas.platform.b2c.core.utils.UuidUtils;
|
|
|
import com.uas.platform.b2c.prod.commodity.dao.GoodsDao;
|
|
|
import com.uas.platform.b2c.prod.commodity.dao.PCBDao;
|
|
|
+import com.uas.platform.b2c.prod.commodity.model.Goods;
|
|
|
import com.uas.platform.b2c.prod.product.component.dao.ComponentDao;
|
|
|
import com.uas.platform.b2c.prod.product.component.modal.Component;
|
|
|
-import com.uas.platform.b2c.prod.product.component.modal.ComponentGoods;
|
|
|
import com.uas.platform.b2c.prod.store.dao.QualificationDao;
|
|
|
import com.uas.platform.b2c.prod.store.dao.StoreApplyDao;
|
|
|
import com.uas.platform.b2c.prod.store.dao.StoreBrandInfoDao;
|
|
|
@@ -36,6 +36,7 @@ import com.uas.platform.b2c.prod.store.model.StoreType;
|
|
|
import com.uas.platform.b2c.prod.store.service.StoreInService;
|
|
|
import com.uas.platform.b2c.trade.order.dao.PurchaseDao;
|
|
|
import com.uas.platform.b2c.trade.support.ResultMap;
|
|
|
+import com.uas.platform.b2c.trade.vendor.model.VendorIntroduction;
|
|
|
import com.uas.platform.core.exception.IllegalOperatorException;
|
|
|
import com.uas.platform.core.exception.IllegalStatusException;
|
|
|
import com.uas.platform.core.model.PageInfo;
|
|
|
@@ -112,6 +113,12 @@ public class StoreInServiceImpl implements StoreInService {
|
|
|
|
|
|
private final PCBDao pcbDao;
|
|
|
|
|
|
+ private static final String CODE_FIELD = "code";
|
|
|
+
|
|
|
+ private static final String KIND_FIELD = "kind";
|
|
|
+
|
|
|
+ private static final String BRAND_FIELD = "brand";
|
|
|
+
|
|
|
@Autowired
|
|
|
public StoreInServiceImpl(StoreInDao storeDao, QualificationDao qualificationDao, GoodsDao goodsDao, ComponentDao componentDao, PurchaseDao purchaseDao, StoreBrandInfoDao brandInfoDao, StoreAdsService adsService, SysConf sysConf, EnterpriseService enterpriseService, SearchHistoryDao searchHistoryDao, SearcherService searcherService, PCBDao pcbDao) {
|
|
|
this.storeDao = storeDao;
|
|
|
@@ -722,27 +729,56 @@ public class StoreInServiceImpl implements StoreInService {
|
|
|
}
|
|
|
// 搜索店铺名称
|
|
|
if (!StringUtils.isEmpty(keyword)) {
|
|
|
- if ("similar".equals(field)) {
|
|
|
- // 搜索器件、品牌、类目
|
|
|
- PageParams pageParams = new PageParams();
|
|
|
- pageParams.setCount(20);
|
|
|
- pageParams.setPage(1);
|
|
|
-
|
|
|
- ModelMap map = searcherService.searchComponentGoods(keyword, pageParams, request);
|
|
|
- List<ComponentGoods> components = (List<ComponentGoods>) map.get("components");
|
|
|
- Set<String> storeIds = new HashSet<>();
|
|
|
- for (ComponentGoods componentGood : components) {
|
|
|
- if (componentGood.getStoreId() != null) {
|
|
|
- storeIds.add(componentGood.getStoreId());
|
|
|
+ PageParams pageParams = new PageParams();
|
|
|
+ pageParams.setCount(20);
|
|
|
+ pageParams.setPage(1);
|
|
|
+ Set<String> storeIds = new HashSet<>();
|
|
|
+ ModelMap map = new ModelMap();
|
|
|
+ switch (field) {
|
|
|
+ // 搜索型号
|
|
|
+ case CODE_FIELD :
|
|
|
+ map = searcherService.searchComponentGoods(keyword, pageParams, request);
|
|
|
+ List<Goods> goodsList = (List<Goods>) ((Map) map.get("stock")).get("content");
|
|
|
+ if (CollectionUtils.isNotEmpty(goodsList)) {
|
|
|
+ for (Goods goods : goodsList) {
|
|
|
+ if (goods.getStoreid() != null) {
|
|
|
+ storeIds.add(goods.getStoreid());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ break;
|
|
|
+ case KIND_FIELD :
|
|
|
+ map = searcherService.getEnterpriseBySearchKind(keyword, pageParams);
|
|
|
+ List<VendorIntroduction> vendorIntroductions = (List<VendorIntroduction>) ((HashMap) map.get("stock")).get("content");
|
|
|
+ if (CollectionUtils.isNotEmpty(vendorIntroductions)) {
|
|
|
+ for (VendorIntroduction vendorIntroduction : vendorIntroductions) {
|
|
|
+ if (vendorIntroduction.getStoreUuid() != null) {
|
|
|
+ storeIds.add(vendorIntroduction.getStoreUuid());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case BRAND_FIELD :
|
|
|
+ map = searcherService.getEnterpriseBySearchBrand(keyword, pageParams);
|
|
|
+ List<VendorIntroduction> vendorIntroductionsByBrand = (List<VendorIntroduction>) ((HashMap) map.get("stock")).get("content");
|
|
|
+ if (CollectionUtils.isNotEmpty(vendorIntroductionsByBrand)) {
|
|
|
+ for (VendorIntroduction vendorIntroduction : vendorIntroductionsByBrand) {
|
|
|
+ if (vendorIntroduction.getStoreUuid() != null) {
|
|
|
+ storeIds.add(vendorIntroduction.getStoreUuid());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ nameSimpleEx = PredicateUtils.like("storeName", keyword, true);
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- if (CollectionUtils.isEmpty(storeIds)) {
|
|
|
- storeIds.add("");
|
|
|
- }
|
|
|
- keywordLogicalEx = PredicateUtils.in("uuid", storeIds, true);
|
|
|
+ if (CollectionUtils.isNotEmpty(storeIds)) {
|
|
|
+ keywordLogicalEx = PredicateUtils.in("uuid", storeIds, true);
|
|
|
} else {
|
|
|
- nameSimpleEx = PredicateUtils.like("storeName", keyword, true);
|
|
|
+ storeIds.add("");
|
|
|
+ keywordLogicalEx = PredicateUtils.in("uuid", storeIds, true);
|
|
|
}
|
|
|
|
|
|
if (nameSimpleEx != null) {
|