Sfoglia il codice sorgente

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

panzhilin 1 settimana fa
parent
commit
0e341dcc88

+ 4 - 0
alien-entity/src/main/java/shop/alien/entity/store/SportsEquipmentFacility.java

@@ -78,5 +78,9 @@ public class SportsEquipmentFacility implements Serializable {
     @ApiModelProperty(value = "修改人ID")
     @TableField(value = "updated_user_id", fill = FieldFill.INSERT_UPDATE)
     private Integer updatedUserId;
+
+    @ApiModelProperty(value = "收费类型0-免费,1-收费")
+    @TableField("billing_type")
+    private Integer billingType;
 }
 

+ 4 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/SportsEquipmentFacilityVo.java

@@ -1,5 +1,6 @@
 package shop.alien.entity.store.vo;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -51,6 +52,9 @@ public class SportsEquipmentFacilityVo implements Serializable {
     @ApiModelProperty(value = "是否显示在店铺详情文本")
     private String displayInStoreDetailText;
 
+    @ApiModelProperty(value = "收费类型0-免费,1-收费")
+    private Integer billingType;
+
     @ApiModelProperty(value = "图片列表")
     private List<String> imageList;
 }

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

@@ -915,11 +915,13 @@ public class StoreInfoController {
     @ApiOperation("获取所有经营板块以及子类")
     @ApiOperationSupport(order = 18)
     @GetMapping("/getAllBusinessSection")
-    public R<List<StoreDictionary>> queryBusinessSectionTree() {
-        log.info("platformBusinessSection.queryBusinessSectionTree");
+    public R<List<StoreDictionary>> queryBusinessSectionTree(
+            @ApiParam(value = "一级分类dictId,可选,如果传入则只返回该一级分类下的二级和三级分类", required = false)
+            @RequestParam(required = false) String businessSection) {
+        log.info("platformBusinessSection.queryBusinessSectionTree, businessSection={}", businessSection);
 
         try {
-            List<StoreDictionary> result = storeInfoService.getAllBusinessSection();
+            List<StoreDictionary> result = storeInfoService.getAllBusinessSection(businessSection);
             return R.data(result);
         }catch (Exception e){
             log.error("获取休闲娱乐分类数据异常", e);
@@ -986,7 +988,28 @@ public class StoreInfoController {
             return R.fail("获取推荐店铺失败,请稍后重试");
         }
     }
-
+    /**
+     * 根据business_classify字段获取字典表数据实现UI图中的功能
+     * RESTful风格:GET /store/info/business-classifies
+     * 返回扁平化的分类列表,用于多选分类功能
+     *
+     * @param parentId 父分类ID(可选),如果提供则只返回该父分类下的子分类
+     * @return R<List<StoreDictionaryVo>> 分类列表(扁平化,仅子分类)
+     */
+    @ApiOperation("获取店铺分类信息)")
+    @ApiOperationSupport(order = 19)
+    @GetMapping("/business-classifies")
+    public R<List<StoreDictionaryVo>> getBusinessClassifyData(
+            @RequestParam(value = "parentId", required = false) Integer parentId) {
+        log.info("StoreInfoController.getBusinessClassifyData?parentId={}", parentId);
+        try {
+            List<StoreDictionaryVo> result = storeInfoService.getBusinessClassifyData(parentId);
+            return R.data(result);
+        } catch (Exception e) {
+            log.error("获取business_classify分类数据异常", e);
+            return R.fail("获取分类数据失败,请稍后重试");
+        }
+    }
 
 
 }

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

@@ -332,6 +332,14 @@ public interface StoreInfoService extends IService<StoreInfo> {
     List<StoreDictionary> getAllBusinessSection();
 
     /**
+     * 根据一级分类获取该分类下的二级和三级分类
+     *
+     * @param businessSection 一级分类的dictId(可选,如果为空则返回所有分类)
+     * @return List<StoreDictionary> 分类树形结构
+     */
+    List<StoreDictionary> getAllBusinessSection(String businessSection);
+
+    /**
      * 获取门店下三级分类结构
      * 根据门店ID查询该门店的经营板块、经营种类和分类的三级结构
      *
@@ -353,4 +361,13 @@ public interface StoreInfoService extends IService<StoreInfo> {
      * @return List<StoreInfoVo> 店铺信息列表
      */
     List<StoreInfoVo> getRecommendedStores(String businessSection, String businessTypes, String businessClassify, Double lon, Double lat);
+
+    /**
+     * 获取三级分类数据
+     * 根据二级分类ID获取该分类下的三级分类
+     *
+     * @param parentId 二级分类ID
+     * @return List<StoreDictionaryVo> 三级分类列表
+     */
+    List<StoreDictionaryVo> getBusinessClassifyData(Integer parentId);
 }

+ 92 - 0
alien-store/src/main/java/shop/alien/store/service/impl/StoreInfoServiceImpl.java

@@ -3221,6 +3221,38 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
     }
 
     @Override
+    public List<StoreDictionaryVo> getBusinessClassifyData(Integer parentId) {
+        // 构建查询条件
+        LambdaQueryWrapper<StoreDictionary> queryWrapper = new LambdaQueryWrapper<StoreDictionary>()
+                .eq(StoreDictionary::getTypeName, "business_classify")
+                .eq(StoreDictionary::getDeleteFlag, 0)
+                .orderByAsc(StoreDictionary::getDictId);
+
+        // 如果指定了parentId,则只查询该父分类下的子分类
+        if (parentId != null) {
+            queryWrapper.eq(StoreDictionary::getParentId, parentId);
+        } else {
+            // 如果没有指定parentId,则查询所有子分类(parentId不为0或null的分类)
+            queryWrapper.isNotNull(StoreDictionary::getParentId)
+                    .ne(StoreDictionary::getParentId, 0);
+        }
+
+        // 查询字典数据
+        List<StoreDictionary> allClassifies = storeDictionaryMapper.selectList(queryWrapper);
+
+        // 构建扁平化的结果列表(仅返回子分类,用于多选功能)
+        List<StoreDictionaryVo> result = new ArrayList<>();
+
+        for (StoreDictionary classify : allClassifies) {
+            StoreDictionaryVo vo = new StoreDictionaryVo();
+            BeanUtils.copyProperties(classify, vo);
+            // 不设置subDataList,返回扁平化列表
+            result.add(vo);
+        }
+        return result;
+    }
+
+    @Override
     public Map<String, Object> getStoreOcrData(String storeId, String imageUrl) {
         Map<String, Object> map = new HashMap<>();
         LambdaQueryWrapper<OcrImageUpload> queryWrapper = new LambdaQueryWrapper<>();
@@ -3616,6 +3648,66 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
         return buildTreeOptimized(storeDictionaryList);
     }
 
+    @Override
+    public List<StoreDictionary> getAllBusinessSection(String businessSection) {
+        // 如果没有传入一级分类参数,返回所有分类
+        if (businessSection == null || businessSection.trim().isEmpty()) {
+            return getAllBusinessSection();
+        }
+
+        // 1. 根据dictId查询一级分类
+        StoreDictionary firstLevelDict = storeDictionaryMapper.selectOne(
+                new LambdaQueryWrapper<StoreDictionary>()
+                        .eq(StoreDictionary::getDictId, businessSection.trim())
+                        .eq(StoreDictionary::getTypeName, "business_section")
+                        .eq(StoreDictionary::getDeleteFlag, 0)
+        );
+
+        if (firstLevelDict == null) {
+            log.warn("未找到一级分类,businessSection={}", businessSection);
+            return new ArrayList<>();
+        }
+
+        // 2. 查询该一级分类下的所有二级分类(business_type)
+        List<StoreDictionary> secondLevelDicts = storeDictionaryMapper.selectList(
+                new LambdaQueryWrapper<StoreDictionary>()
+                        .eq(StoreDictionary::getTypeName, "business_type")
+                        .eq(StoreDictionary::getParentId, firstLevelDict.getId())
+                        .eq(StoreDictionary::getDeleteFlag, 0)
+                        .orderByAsc(StoreDictionary::getSortId)
+        );
+
+        if (secondLevelDicts.isEmpty()) {
+            // 如果没有二级分类,只返回一级分类
+            firstLevelDict.setStoreDictionaryList(new ArrayList<>());
+            return Collections.singletonList(firstLevelDict);
+        }
+
+        // 3. 获取所有二级分类的ID
+        List<Integer> secondLevelIds = secondLevelDicts.stream()
+                .map(StoreDictionary::getId)
+                .collect(Collectors.toList());
+
+        // 4. 查询这些二级分类下的所有三级分类(business_classify)
+        List<StoreDictionary> thirdLevelDicts = storeDictionaryMapper.selectList(
+                new LambdaQueryWrapper<StoreDictionary>()
+                        .eq(StoreDictionary::getTypeName, "business_classify")
+                        .in(StoreDictionary::getParentId, secondLevelIds)
+                        .eq(StoreDictionary::getDeleteFlag, 0)
+                        .orderByAsc(StoreDictionary::getSortId)
+        );
+
+        // 5. 构建树形结构
+        // 将一级分类、二级分类、三级分类合并
+        List<StoreDictionary> allDicts = new ArrayList<>();
+        allDicts.add(firstLevelDict);
+        allDicts.addAll(secondLevelDicts);
+        allDicts.addAll(thirdLevelDicts);
+
+        // 构建树形结构
+        return buildTreeOptimized(allDicts);
+    }
+
     /**
      * 构建树形结构(优化版)
      *