Procházet zdrojové kódy

Revert "用户端酒水菜单列表接口新增"

This reverts commit a2bfeb58db6e4e285a731305c62a3814c7ca3008.
zhangchen před 1 týdnem
rodič
revize
a1c7389319

+ 0 - 34
alien-entity/src/main/java/shop/alien/mapper/StoreMenuMapper.java

@@ -37,38 +37,4 @@ public interface StoreMenuMapper extends BaseMapper<StoreMenu> {
             "left join store_img b on a.img_id = b.id where a.delete_flag = 0 and b.delete_flag = 0 " +
             "and a.id = #{id}")
     StoreMenuVo getMenuInfo(@Param("id") Integer id);
-
-    /**
-     * 获取菜单(客户端)
-     * <p>
-     * 根据门店ID查询菜单列表,支持按菜品类型和菜单类型筛选。
-     * 查询未删除的菜单及其关联的图片信息。
-     * </p>
-     *
-     * @param storeId      门店ID,必填
-     * @param dishType     菜品类型,可选,0:非推荐, 1:推荐。当为null时,不限制菜品类型
-     * @param dishMenuType 菜单类型,可选,1-菜单,2-酒水。当为null时,不限制菜单类型
-     * @return 菜单列表,包含菜单信息和关联的图片信息
-     */
-    @Select("<script>" +
-            "SELECT " +
-            "    a.*, " +
-            "    b.img_url, " +
-            "    b.img_sort, " +
-            "    b.img_description " +
-            "FROM store_menu a " +
-            "LEFT JOIN store_img b ON a.img_id = b.id " +
-            "WHERE a.delete_flag = 0 " +
-            "    AND (b.delete_flag = 0 OR b.delete_flag IS NULL) " +
-            "    AND a.store_id = #{storeId} " +
-            "<if test='dishType != null'>" +
-            "    AND a.dish_type = #{dishType} " +
-            "</if>" +
-            "<if test='dishMenuType != null'>" +
-            "    AND a.dish_menu_type = #{dishMenuType} " +
-            "</if>" +
-            "</script>")
-    List<StoreMenuVo> getClientMenuByStoreId(@Param("storeId") Integer storeId, 
-                                             @Param("dishType") Integer dishType, 
-                                             @Param("dishMenuType") Integer dishMenuType);
 }

+ 0 - 53
alien-store/src/main/java/shop/alien/store/controller/StoreMenuController.java

@@ -122,57 +122,4 @@ public class StoreMenuController {
         log.info("StoreRecommendController.getMenuLikeStatus?userId={}&menuId={}", userId, menuId);
         return R.data(storeMenuService.getMenuLikeStatus(userId, menuId));
     }
-
-    /**
-     * 获取菜单(用户端)
-     * <p>
-     * 根据门店ID获取菜单列表,支持按菜品类型、菜单类型筛选,并可查询用户点赞状态
-     * </p>
-     *
-     * @param storeId      门店ID,必填,必须大于0
-     * @param dishType     菜品类型,可选,0:非推荐, 1:推荐
-     * @param phoneId      用户手机号,可选,用于查询点赞状态
-     * @param dishMenuType 菜单类型,可选,1-菜单,2-酒水
-     * @return 统一返回结果,包含菜单列表
-     * @throws IllegalArgumentException 当门店ID为空或小于等于0时抛出
-     */
-    @ApiOperation("获取菜单(用户端)")
-    @ApiOperationSupport(order = 9)
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "storeId", value = "门店id", dataType = "Integer", paramType = "query", required = true),
-            @ApiImplicitParam(name = "dishType", value = "菜品类型, 0:(推荐+非推荐), 1:推荐", dataType = "Integer", paramType = "query"),
-            @ApiImplicitParam(name = "phoneId", value = "用户手机号", dataType = "String", paramType = "query"),
-            @ApiImplicitParam(name = "dishMenuType", value = "菜单类型:1-菜单,2-酒水", dataType = "Integer", paramType = "query")
-    })
-    @GetMapping("/getClientMenuByStoreId")
-    public R<List<StoreMenuVo>> getClientMenuByStoreId(
-            @RequestParam(value = "storeId", required = true) Integer storeId,
-            @RequestParam(value = "dishType", required = false) Integer dishType,
-            @RequestParam(value = "phoneId", required = false) String phoneId,
-            @RequestParam(value = "dishMenuType", required = false) Integer dishMenuType) {
-        // 记录请求入参
-        log.info("获取用户端菜单,入参:storeId={}, dishType={}, phoneId={}, dishMenuType={}", 
-                storeId, dishType, phoneId, dishMenuType);
-        
-        // 参数校验
-        if (storeId == null || storeId <= 0) {
-            log.warn("获取用户端菜单失败,门店ID无效:storeId={}", storeId);
-            return R.fail("门店ID不能为空且必须大于0");
-        }
-        
-        try {
-            // 调用服务层获取菜单列表
-            List<StoreMenuVo> menuList = storeMenuService.getClientMenuByStoreId(
-                    storeId, dishType, phoneId, dishMenuType);
-            
-            // 记录返回结果
-            log.info("获取用户端菜单成功,门店ID:{},返回菜单数量:{}", 
-                    storeId, menuList != null ? menuList.size() : 0);
-            
-            return R.data(menuList);
-        } catch (Exception e) {
-            log.error("获取用户端菜单异常,门店ID:{},异常信息:{}", storeId, e.getMessage(), e);
-            return R.fail("获取菜单失败:" + e.getMessage());
-        }
-    }
 }

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

@@ -79,22 +79,5 @@ public interface StoreMenuService extends IService<StoreMenu> {
      * @return boolean
      */
     boolean getMenuLikeStatus(String userId, Integer menuId);
-
-    /**
-     * 获取门店菜单(客户端)
-     * <p>
-     * 根据门店ID查询菜单列表,支持按菜品类型和菜单类型筛选。
-     * 当查询推荐菜且提供用户手机号时,会批量查询并设置用户的点赞状态。
-     * 最终结果按排序字段升序排列。
-     * </p>
-     *
-     * @param storeId      门店ID,必填,必须大于0
-     * @param dishType     菜品类型,可选,0:非推荐, 1:推荐。当为0时,查询条件中不包含菜品类型限制
-     * @param phoneId      用户手机号,可选,用于查询用户对推荐菜的点赞状态
-     * @param dishMenuType 菜单类型,可选,1-菜单,2-酒水
-     * @return 菜单列表,按排序字段升序排列,如果查询结果为空则返回空列表
-     * @throws IllegalArgumentException 当门店ID为空或小于等于0时抛出
-     */
-    List<StoreMenuVo> getClientMenuByStoreId(Integer storeId, Integer dishType, String phoneId, Integer dishMenuType);
 }
 

+ 1 - 138
alien-store/src/main/java/shop/alien/store/service/impl/StoreMenuServiceImpl.java

@@ -49,27 +49,6 @@ public class StoreMenuServiceImpl extends ServiceImpl<StoreMenuMapper, StoreMenu
     private final LifeGroupBuyThaliMapper lifeGroupBuyThaliMapper;
 
     /**
-     * 菜品类型:非推荐
-     */
-    private static final Integer DISH_TYPE_NON_RECOMMEND = 0;
-
-    /**
-     * 菜品类型:推荐
-     */
-    private static final Integer DISH_TYPE_RECOMMEND = 1;
-
-    /**
-     * 点赞状态:未点赞
-     */
-    private static final Integer LIKE_STATUS_NO = 0;
-
-    /**
-     * 点赞状态:已点赞
-     */
-    private static final Integer LIKE_STATUS_YES = 1;
-
-
-    /**
      * 获取门店菜单
      *
      * @param storeId      门店id
@@ -270,7 +249,7 @@ public class StoreMenuServiceImpl extends ServiceImpl<StoreMenuMapper, StoreMenu
         if (dishType == 0) {
             List<LifeGroupBuyThali> lifeGroupBuyThaliList = lifeGroupBuyThaliMapper.selectList(new LambdaQueryWrapper<LifeGroupBuyThali>().in(LifeGroupBuyThali::getDetailId, ids));
             if (CollectionUtil.isNotEmpty(lifeGroupBuyThaliList)) {
-                return R.fail("该菜品已被团购套餐引用,不能删除");
+                return R.fail("当前菜品存在于团购中,不可删除");
             }
             flag = this.removeByIds(ids);
         } else {
@@ -323,120 +302,4 @@ public class StoreMenuServiceImpl extends ServiceImpl<StoreMenuMapper, StoreMenu
     public boolean getMenuLikeStatus(String userId, Integer menuId) {
         return lifeLikeRecordMapper.selectCount(new QueryWrapper<LifeLikeRecord>().eq("dianzan_id", userId).eq("huifu_id", menuId).eq("delete_flag", 0)) > 0;
     }
-
-    /**
-     * 获取门店菜单(客户端)
-     * <p>
-     * 根据门店ID查询菜单列表,支持按菜品类型和菜单类型筛选。
-     * 当查询推荐菜且提供用户手机号时,会批量查询并设置用户的点赞状态。
-     * 最终结果按排序字段升序排列。
-     * </p>
-     *
-     * @param storeId      门店ID,必填,必须大于0
-     * @param dishType     菜品类型,可选,0:全部, 1:推荐
-     * @param phoneId      用户手机号,可选,用于查询用户对推荐菜的点赞状态
-     * @param dishMenuType 菜单类型,可选,1-菜单,2-酒水
-     * @return 菜单列表,按排序字段升序排列,如果查询结果为空则返回空列表
-     */
-    @Override
-    public List<StoreMenuVo> getClientMenuByStoreId(Integer storeId, Integer dishType, String phoneId, Integer dishMenuType) {
-        log.info("开始获取用户端菜单,门店ID:{},菜品类型:{},用户手机号:{},菜单类型:{}",
-                storeId, dishType, phoneId, dishMenuType);
-
-        // 参数校验
-        if (storeId == null || storeId <= 0) {
-            log.warn("获取用户端菜单失败,门店ID无效:{}", storeId);
-            throw new IllegalArgumentException("门店ID不能为空且必须大于0");
-        }
-
-        // 处理菜品类型参数:当dishType为0时,转换为null以查询所有类型
-        Integer queryDishType = (DISH_TYPE_NON_RECOMMEND.equals(dishType)) ? null : dishType;
-
-        // 查询菜单列表
-        List<StoreMenuVo> menuList = storeMenuMapper.getClientMenuByStoreId(storeId, queryDishType, dishMenuType);
-
-        // 如果查询结果为空,直接返回空列表
-        if (CollectionUtils.isEmpty(menuList)) {
-            log.info("获取用户端菜单完成,门店ID:{},未查询到菜单数据", storeId);
-            return menuList;
-        }
-
-        log.info("获取用户端菜单,门店ID:{},查询到菜单数量:{}", storeId, menuList.size());
-
-        // 如果是推荐菜且有用户标识,批量查询并设置点赞状态
-        if (DISH_TYPE_RECOMMEND.equals(dishType) && StringUtils.isNotEmpty(phoneId)) {
-            setLikeStatusForMenuList(menuList, phoneId);
-        } else {
-            // 非推荐菜或未提供用户手机号时,设置默认未点赞状态
-            menuList.forEach(item -> item.setIsLike(LIKE_STATUS_NO));
-        }
-
-        // 按排序字段升序排序
-        List<StoreMenuVo> sortedMenuList = menuList.stream()
-                .sorted(Comparator.comparing(StoreMenuVo::getSort, Comparator.nullsLast(Integer::compareTo)))
-                .collect(Collectors.toList());
-
-        log.info("获取用户端菜单完成,门店ID:{},返回菜单数量:{}", storeId, sortedMenuList.size());
-
-        return sortedMenuList;
-    }
-
-    /**
-     * 批量设置菜单的点赞状态
-     * <p>
-     * 根据用户手机号和菜单ID列表,批量查询点赞记录,并设置每个菜单的点赞状态
-     * </p>
-     *
-     * @param menuList 菜单列表
-     * @param phoneId  用户手机号
-     */
-    private void setLikeStatusForMenuList(List<StoreMenuVo> menuList, String phoneId) {
-        if (CollectionUtils.isEmpty(menuList) || StringUtils.isEmpty(phoneId)) {
-            return;
-        }
-
-        log.debug("开始批量查询点赞状态,用户手机号:{},菜单数量:{}", phoneId, menuList.size());
-
-        // 将菜单ID转换为String集合,用于查询点赞记录
-        Set<String> menuIdStrSet = menuList.stream()
-                .map(item -> String.valueOf(item.getId()))
-                .filter(id -> id != null && !"null".equals(id))
-                .collect(Collectors.toSet());
-
-        if (menuIdStrSet.isEmpty()) {
-            log.warn("菜单ID集合为空,无法查询点赞状态");
-            menuList.forEach(item -> item.setIsLike(LIKE_STATUS_NO));
-            return;
-        }
-
-        // 批量查询点赞记录
-        LambdaQueryWrapper<LifeLikeRecord> likeQuery = new LambdaQueryWrapper<>();
-        likeQuery.eq(LifeLikeRecord::getDianzanId, phoneId)
-                .in(LifeLikeRecord::getHuifuId, menuIdStrSet);
-        List<LifeLikeRecord> likeRecordList = lifeLikeRecordMapper.selectList(likeQuery);
-
-        // 构建已点赞的菜单ID集合
-        Set<String> likedMenuIdSet = likeRecordList.stream()
-                .map(LifeLikeRecord::getHuifuId)
-                .filter(id -> id != null)
-                .collect(Collectors.toSet());
-
-        log.debug("查询到点赞记录数量:{},已点赞菜单数量:{}",
-                likeRecordList.size(), likedMenuIdSet.size());
-
-        // 设置点赞状态
-        menuList.forEach(item -> {
-            if (item.getId() == null) {
-                item.setIsLike(LIKE_STATUS_NO);
-                return;
-            }
-
-            String menuIdStr = String.valueOf(item.getId());
-            if (likedMenuIdSet.contains(menuIdStr)) {
-                item.setIsLike(LIKE_STATUS_YES);
-            } else {
-                item.setIsLike(LIKE_STATUS_NO);
-            }
-        });
-    }
 }

+ 2 - 2
alien-store/src/main/java/shop/alien/store/strategy/payment/impl/WeChatPaymentStrategyImpl.java

@@ -140,8 +140,8 @@ public class WeChatPaymentStrategyImpl implements PaymentStrategy {
             privateKeyPath = privateLinuxKeyPath;
             wechatPayPublicKeyFilePath = wechatLinuxPayPublicKeyFilePath;
         }
-       // this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyPath);
-        //this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath);
+        this.privateKey = WXPayUtility.loadPrivateKeyFromPath(privateKeyPath);
+        this.wechatPayPublicKey = WXPayUtility.loadPublicKeyFromPath(wechatPayPublicKeyFilePath);
     }
 
     @Override