Browse Source

474,772,502bug

jyc 1 tháng trước cách đây
mục cha
commit
a92129ec61

+ 13 - 0
alien-entity/src/main/java/shop/alien/mapper/StoreInfoMapper.java

@@ -53,6 +53,19 @@ public interface StoreInfoMapper extends BaseMapper<StoreInfo> {
             " ${ew.customSqlSegment}")
     List<StoreInfoVo> getStoreInfoVoList(@Param(Constants.WRAPPER) QueryWrapper<StoreInfoVo> queryWrapper);
 
+    @Select("with menu as (select store_id,GROUP_CONCAT(dish_name) dish_name from store_menu GROUP BY store_id) " +
+            "select a.*, b.name store_contact, b.phone store_phone, b.password, c.dish_name, a.store_type, img.img_url entranceImage, d.img_url, dict.dict_detail storeTypeStr, dict2.dict_detail businessStatusStr," +
+            "            ROUND(ST_Distance_Sphere(ST_GeomFromText(CONCAT('POINT(', REPLACE(#{position}, ',', ' '), ')' )), ST_GeomFromText(CONCAT('POINT(', REPLACE(a.store_position, ',', ' '), ')' ))) / 1000, 2) dist " +
+            "from store_info a " +
+            "left join store_user b on a.id = b.store_id  AND b.delete_flag = 0 " +
+            "left join menu c on a.id = c.store_id " +
+            "left join store_img img on img.store_id = a.id and img.img_type = 1 and img.delete_flag = 0 " +
+            "left join store_dictionary dict on dict.type_name = 'storeType' and dict.dict_id = a.store_type and dict.delete_flag = 0 " +
+            "left join store_dictionary dict2 on dict2.type_name = 'businessStatus' and a.business_status = dict2.dict_id and dict2.delete_flag = 0 " +
+            "left join store_img d on d.store_id = a.id and d.img_type = 10 and d.delete_flag = 0" +
+            " ${ew.customSqlSegment}")
+    List<StoreInfoVo> getStoreInfoVoListNew(@Param(Constants.WRAPPER) QueryWrapper<StoreInfoVo> queryWrapper,  @Param("position") String position);
+
     /**
      * web端-门店列表
      *

+ 4 - 3
alien-store/src/main/java/shop/alien/store/service/LifeUserStoreService.java

@@ -82,7 +82,7 @@ public class LifeUserStoreService {
             // 过滤掉永久关门的店铺
             wrapper.ne("a.business_status", 99);
             // 根据构建的条件查询门店信息
-            List<StoreInfoVo> storeInfoVoList = storeInfoMapper.getStoreInfoVoList(wrapper);
+            List<StoreInfoVo> storeInfoVoList = storeInfoMapper.getStoreInfoVoListNew(wrapper,weidu + "," + jingdu);
             // 如果查询结果为空,则直接返回空列表
             if (storeInfoVoList.isEmpty()) {
                 return returnMaps;
@@ -113,7 +113,7 @@ public class LifeUserStoreService {
 
                 Map<String, Object> storeMap = new HashMap<>();
                 // 如果用户提供了经纬度信息,则计算并添加门店到用户的距离
-                if ((jingdu != null && !jingdu.isEmpty()) && (weidu != null && !weidu.isEmpty())) {
+                /*if ((jingdu != null && !jingdu.isEmpty()) && (weidu != null && !weidu.isEmpty())) {
                     double storeJing = Double.parseDouble(store.getStorePosition().split(",")[0]);
                     double storeWei = Double.parseDouble(store.getStorePosition().split(",")[1]);
                     double storeDistance = DistanceUtil.haversineCalculateDistance(Double.parseDouble(jingdu), Double.parseDouble(weidu), storeJing, storeWei);
@@ -121,7 +121,8 @@ public class LifeUserStoreService {
                 } else {
                     // 否则,返回提示信息
                     storeMap.put("distance", "没有位置信息");
-                }
+                }*/
+                storeMap.put("distance", store.getDist());
                 // 添加门店的业务状态及其描述
                 storeMap.put("businessStatus", store.getBusinessStatus());
                 storeMap.put("businessStatusStr", store.getBusinessStatusStr());