Explorar el Código

Merge remote-tracking branch 'origin/sit' into sit

李亚非 hace 2 meses
padre
commit
5f1765b787

+ 13 - 2
alien-store/src/main/java/shop/alien/store/controller/AiSearchController.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import io.swagger.annotations.Api;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.cloud.context.config.annotation.RefreshScope;
 import org.springframework.http.HttpEntity;
@@ -21,9 +22,11 @@ import org.springframework.web.client.RestTemplate;
 import shop.alien.entity.result.R;
 import shop.alien.entity.store.LifeBlacklist;
 import shop.alien.entity.store.StoreImg;
+import shop.alien.entity.store.StoreUser;
 import shop.alien.entity.store.vo.StoreInfoVo;
 import shop.alien.mapper.LifeBlacklistMapper;
 import shop.alien.mapper.StoreImgMapper;
+import shop.alien.mapper.StoreUserMapper;
 import shop.alien.store.annotation.TrackEvent;
 import shop.alien.store.service.CommonRatingService;
 import shop.alien.store.service.StoreImgService;
@@ -42,7 +45,8 @@ import java.util.stream.Collectors;
 public class AiSearchController {
 
     private final StoreImgMapper storeImgMapper;
-    
+    private final StoreUserMapper storeUserMapper;
+
     @Value("${third-party-ai-search.exact.base-url:http://124.93.18.180:7870/api/v1/search}")
     private String aiSearchExactUrl;
     
@@ -162,7 +166,14 @@ public class AiSearchController {
         queryWrapper.eq("blocker_type",2);
         queryWrapper.eq("blocked_type",1);
         List<LifeBlacklist> lifeBlacklists = lifeBlacklistMapper.selectList(queryWrapper);
+        // 坑:查询出来的是拉黑的商户id,不是商铺id 😊彻底疯狂
         List<String> blockedIds = lifeBlacklists.stream().map(x -> x.getBlockedId()).collect(Collectors.toList());
+        List<Integer> collect = new ArrayList<>();
+        if(blockedIds.size()>0){
+            List<StoreUser> storeUsers = storeUserMapper.selectBatchIds(blockedIds);
+            collect = storeUsers.stream().filter(x -> StringUtils.isNotBlank(x.getStoreId().toString())).map(x -> x.getStoreId()).collect(Collectors.toList());
+        }
+
         List<StoreInfoVo> storeInfoList = new ArrayList<>();
 
         if (results != null) {
@@ -187,7 +198,7 @@ public class AiSearchController {
 
                 // 使用JSON.parseObject方法进行转换
                 StoreInfoVo storeInfo = JSON.parseObject(camelCaseItem.toJSONString(), StoreInfoVo.class);
-                if(blockedIds.contains(storeInfo.getId().toString())){
+                if(collect.contains(storeInfo.getId())){
                     continue;
                 }
                 Integer totalCount = 0;