Browse Source

洗浴设施及服务修改

zhangchen 2 weeks ago
parent
commit
d62cc919db

+ 1 - 1
alien-entity/src/main/java/shop/alien/entity/store/StoreImg.java

@@ -30,7 +30,7 @@ public class StoreImg extends Model<StoreImg> {
     @TableField("store_id")
     private Integer storeId;
 
-    @ApiModelProperty(value = "图片类型, 0:其他, 1:入口图, 2:相册, 3:菜品, 4:环境, 5:价目表, 6:推荐菜, 7:菜单, 8:用户评论, 9:商家申诉,10:商家头像,11:店铺轮播图,12:联名卡图片,13:动态折扣, 14:套餐图片,15:合同照片,17:打卡广场小人图片 18: 商品发布图片 19:二手商品与用户举报图片,20头图单图模式,21头图多图模式 , 22续签合同,23,二手商品记录图片类型, 24 食品经营许可证审核前状态 25.食品经营许可证审核后状态, 28:运动器材设施图片, 29:洗浴设施及服务图片")
+    @ApiModelProperty(value = "图片类型, 0:其他, 1:入口图, 2:相册, 3:菜品, 4:环境, 5:价目表, 6:推荐菜, 7:菜单, 8:用户评论, 9:商家申诉,10:商家头像,11:店铺轮播图,12:联名卡图片,13:动态折扣, 14:套餐图片,15:合同照片,17:打卡广场小人图片 18: 商品发布图片 19:二手商品与用户举报图片,20头图单图模式,21头图多图模式 , 22续签合同,23,二手商品记录图片类型, 24 食品经营许可证审核前状态 25.食品经营许可证审核后状态, 28:运动器材设施图片, 29:洗浴设施及服务图片 30 酒水")
     @TableField("img_type")
     private Integer imgType;
 

+ 8 - 3
alien-entity/src/main/java/shop/alien/mapper/StoreInfoMapper.java

@@ -135,6 +135,7 @@ public interface StoreInfoMapper extends BaseMapper<StoreInfo> {
      * 更多推荐(用户端)
      *
      * @param queryWrapper 查询条件
+     * @param position 经纬度位置(格式:经度,纬度)
      * @return List<StoreInfoVo>
      */
     @Select("select a.*, img.img_url entranceImage,img1.img_url foodLicenceImageUrl,b.name store_contact, b.phone store_phone, b.id_card idCard, b.password, c.dict_detail store_status_str, d.dict_detail business_status_str, e.dict_detail store_type_str,  " +
@@ -142,7 +143,8 @@ public interface StoreInfoMapper extends BaseMapper<StoreInfo> {
             " select ifnull(round(avg(score), 1), 0) " +
             " from store_evaluation eval " +
             " where eval.store_id = a.id and eval.delete_flag = 0 " +
-            ") score " +
+            ") score, " +
+            "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 a.delete_flag = 0 and b.delete_flag = 0 " +
             "left join store_img img on img.store_id = a.id and img.img_type = 1 and img.delete_flag = 0 " +
@@ -150,6 +152,9 @@ public interface StoreInfoMapper extends BaseMapper<StoreInfo> {
             "left join store_dictionary c on a.store_status = c.dict_id and c.type_name = 'storeState' and c.delete_flag = 0 " +
             "left join store_dictionary d on a.business_status = d.dict_id and d.type_name = 'businessStatus' and d.delete_flag = 0 " +
             "left join store_dictionary e on e.type_name = 'storeType' and e.dict_id = a.store_type and e.delete_flag = 0 " +
-            "${ew.customSqlSegment}")
-    List<StoreInfoVo> getMoreRecommendedStores(@Param(Constants.WRAPPER) QueryWrapper<StoreInfoVo> queryWrapper);
+            "${ew.customSqlSegment} " +
+            "and a.store_position is not null and a.store_position != '' " +
+            "and ROUND(ST_Distance_Sphere(ST_GeomFromText(CONCAT('POINT(', REPLACE(#{position}, ',', ' '), ')' )), ST_GeomFromText(CONCAT('POINT(', REPLACE(a.store_position, ',', ' '), ')' ))) / 1000, 2) <= 1 " +
+            "order by dist asc limit 20")
+    List<StoreInfoVo> getMoreRecommendedStores(@Param(Constants.WRAPPER) QueryWrapper<StoreInfoVo> queryWrapper, @Param("position") String position);
 }

+ 6 - 6
alien-store/src/main/java/shop/alien/store/controller/StoreInfoController.java

@@ -792,13 +792,13 @@ public class StoreInfoController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "lon", value = "经度", dataType = "double", paramType = "query", required = true),
             @ApiImplicitParam(name = "lat", value = "纬度", dataType = "double", paramType = "query", required = true),
-            @ApiImplicitParam(name = "category", value = "一级分类", dataType = "int", paramType = "query", required = true),
-            @ApiImplicitParam(name = "subCategory", value = "二级分类", dataType = "int", paramType = "query"),
-            @ApiImplicitParam(name = "threeCategory", value = "二级分类", dataType = "int", paramType = "query")
+            @ApiImplicitParam(name = "businessSection", value = "经营板块", dataType = "String", paramType = "query", required = true),
+            @ApiImplicitParam(name = "businessTypes", value = "经营分类", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "businessClassify", value = "分类", dataType = "String", paramType = "query")
     })
-    public R<List<StoreInfoVo>> getMoreRecommendedStores(Double lon , Double lat, int category, int subCategory, int threeCategory) {
-        log.info("StoreInfoController.getMoreRecommendedStores?lon={},lat={},category={},subCategory={}", lon,lat, subCategory, threeCategory);
-        return R.data(storeInfoService.getMoreRecommendedStores(lon,lat, category, subCategory, threeCategory));
+    public R<List<StoreInfoVo>> getMoreRecommendedStores(Double lon , Double lat, String businessSection, String businessTypes, String businessClassify) {
+        log.info("StoreInfoController.getMoreRecommendedStores?lon={},lat={},businessSection={},businessTypes={},businessClassify={}", lon,lat, businessSection, businessTypes, businessClassify);
+        return R.data(storeInfoService.getMoreRecommendedStores(lon,lat, businessSection, businessTypes, businessClassify));
 
     }
     /**

+ 1 - 1
alien-store/src/main/java/shop/alien/store/service/StoreInfoService.java

@@ -291,7 +291,7 @@ public interface StoreInfoService extends IService<StoreInfo> {
 
      * @return IPage<StoreInfoVo>
      */
-    List<StoreInfoVo> getMoreRecommendedStores(Double lon , Double lat, int category, int subcategory, int threeCategory);
+    List<StoreInfoVo> getMoreRecommendedStores(Double lon , Double lat, String businessSection, String businessTypes, String businessClassify);
 
 
     /**

+ 14 - 9
alien-store/src/main/java/shop/alien/store/service/impl/StoreInfoServiceImpl.java

@@ -2896,9 +2896,15 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
      * @return IPage<StoreInfoVo>
      */
     @Override
-    public List<StoreInfoVo> getMoreRecommendedStores(Double lon , Double lat, int category, int subcategory, int threeCategory) {
+    public List<StoreInfoVo> getMoreRecommendedStores(Double lon , Double lat, String businessSection, String businessTypes, String businessClassify) {
+        // 参数校验
+        if (lon == null || lat == null) {
+            log.warn("获取更多推荐店铺失败,经纬度为空");
+            return Collections.emptyList();
+        }
+        
         QueryWrapper<StoreInfoVo> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("a.delete_flag", 0).eq("b.delete_flag", 0).orderByDesc("a.created_time");
+        queryWrapper.eq("a.delete_flag", 0).eq("b.delete_flag", 0);
         //如果查询未过期
         // 获取当前时刻
         Date currentDate = new Date();
@@ -2912,7 +2918,9 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
         // 加上 30 天
         calendar.add(Calendar.DAY_OF_MONTH, 30);
 
-        List<StoreInfoVo> storeInfoVoList = storeInfoMapper.getMoreRecommendedStores(queryWrapper);
+        // 构建position参数(格式:经度,纬度)
+        String position = lon + "," + lat;
+        List<StoreInfoVo> storeInfoVoList = storeInfoMapper.getMoreRecommendedStores(queryWrapper, position);
         if (CollectionUtils.isEmpty(storeInfoVoList)) {
             return Collections.emptyList();
         }
@@ -2982,12 +2990,9 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
             }
 
         }
-        if (lon == null || lat == null) {
-            log.warn("获取更多推荐店铺失败,经纬度为空");
-            return Collections.emptyList();
-        }
-
-        return filterStoresWithinDistance(storeInfoVoList, lon, lat);
+        
+        // SQL已经实现了距离过滤和排序,直接返回结果
+        return storeInfoVoList;
     }
 
     /**