From b3845e6d34d3410909f466475c41d2aba7d90926 Mon Sep 17 00:00:00 2001 From: dzc <2388224167@qq.com> Date: Mon, 13 Jul 2026 19:52:56 +0800 Subject: [PATCH] 111 --- .../controller/MallAppController.java | 285 +++++++++--------- .../wallet/api/feign/RemoteMchService.java | 4 + .../controller/mch/MchManageController.java | 23 +- .../wallet/service/MchManageService.java | 4 +- .../impl/mch/MchManageServiceImpl.java | 4 +- 5 files changed, 166 insertions(+), 154 deletions(-) diff --git a/pjcloud-supermarket/pjcloud-supermarket-biz/src/main/java/com/bsd/pjcloud/supermarket/controller/MallAppController.java b/pjcloud-supermarket/pjcloud-supermarket-biz/src/main/java/com/bsd/pjcloud/supermarket/controller/MallAppController.java index 4c284ec01..d3ebcd1c4 100644 --- a/pjcloud-supermarket/pjcloud-supermarket-biz/src/main/java/com/bsd/pjcloud/supermarket/controller/MallAppController.java +++ b/pjcloud-supermarket/pjcloud-supermarket-biz/src/main/java/com/bsd/pjcloud/supermarket/controller/MallAppController.java @@ -1,4 +1,6 @@ package com.bsd.pjcloud.supermarket.controller; + +import cn.hutool.core.util.ObjectUtil; import com.bsd.pjcloud.common.api.encrypt.annotation.crypto.ApiCryptoAes; import cn.hutool.core.collection.CollUtil; @@ -11,8 +13,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.bsd.pjcloud.admin.api.entity.SysRole; import com.bsd.pjcloud.admin.api.feign.RemoteRoleService; import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum; +import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum; import com.bsd.pjcloud.common.core.util.BeanUtils; import com.bsd.pjcloud.common.core.util.R; +import com.bsd.pjcloud.common.security.service.PjcloudUser; import com.bsd.pjcloud.common.security.util.SecurityUtils; import com.bsd.pjcloud.supermarket.dto.MallProductCreateDTO; import com.bsd.pjcloud.supermarket.entity.MallCategoryEntity; @@ -110,6 +114,7 @@ public class MallAppController { @GetMapping("/merchant/list") @Operation(summary = "获取商户列表", description = "获取所有启用的商户列表,包含特色商品") public R> getMerchantList(@RequestParam(defaultValue = "3") Integer productLimit) { + PjcloudUser user = SecurityUtils.getUser(); // 查询所有启用的商户 // List merchants = mallMerchantService.list( // Wrappers.lambdaQuery() @@ -117,114 +122,119 @@ public class MallAppController { // .orderByAsc(MallMerchantEntity::getName) // ); MchManageDto mchManageDto = new MchManageDto(); + mchManageDto.setVisibleMobile(YesNoEnum.YES.getCode()); + List selfMchIdList = remoteMchService.getSelfMchIdList(user.getId(), List.of(MerchantTypeEnum.FARMER)).getData(); + if (ObjectUtil.isNotEmpty(selfMchIdList)) { + mchManageDto.setIds(selfMchIdList); + } mchManageDto.setTypes(MerchantTypeEnum.FARMER.getType()); R> listR = remoteMchService.list(mchManageDto); - if (!listR.isOk()){ + if (!listR.isOk()) { return R.failed("商户服务异常!"); } List merchants = listR.getData(); - if (CollectionUtils.isEmpty( merchants)) { + if (CollectionUtils.isEmpty(merchants)) { return R.ok(List.of()); } // 获取商户ID列表 List merchantIds = merchants.stream() - .map(MchManageVo::getId) - .collect(Collectors.toList()); + .map(MchManageVo::getId) + .collect(Collectors.toList()); // 查询每个商户的特色商品(按创建时间倒序,取前N个) LocalDateTime now = LocalDateTime.now(); List products = mallProductService.list( - Wrappers.lambdaQuery() - .in(MallProductEntity::getMerchantId, merchantIds) - .eq(MallProductEntity::getStatus, MallConstants.Status.ENABLED) // 只查上架商品 - .and(wrapper -> wrapper - .isNull(MallProductEntity::getSaleStartTime) - .or() - .le(MallProductEntity::getSaleStartTime, now) - ) - .and(wrapper -> wrapper - .isNull(MallProductEntity::getSaleEndTime) - .or() - .ge(MallProductEntity::getSaleEndTime, now) - ) - .orderByDesc(MallProductEntity::getCreateTime) + Wrappers.lambdaQuery() + .in(MallProductEntity::getMerchantId, merchantIds) + .eq(MallProductEntity::getStatus, MallConstants.Status.ENABLED) // 只查上架商品 + .and(wrapper -> wrapper + .isNull(MallProductEntity::getSaleStartTime) + .or() + .le(MallProductEntity::getSaleStartTime, now) + ) + .and(wrapper -> wrapper + .isNull(MallProductEntity::getSaleEndTime) + .or() + .ge(MallProductEntity::getSaleEndTime, now) + ) + .orderByDesc(MallProductEntity::getCreateTime) ); // 按商户ID分组商品 Map> productMap = products.stream() - .collect(Collectors.groupingBy(MallProductEntity::getMerchantId)); + .collect(Collectors.groupingBy(MallProductEntity::getMerchantId)); // 获取商品ID列表,查询SKU信息 List productIds = products.stream() - .map(MallProductEntity::getId) - .collect(Collectors.toList()); + .map(MallProductEntity::getId) + .collect(Collectors.toList()); - List skuList = productIds.isEmpty() ? List.of() : - mallProductSkuService.list( - Wrappers.lambdaQuery() - .in(MallProductSkuEntity::getProductId, productIds) - ); + List skuList = productIds.isEmpty() ? List.of() : + mallProductSkuService.list( + Wrappers.lambdaQuery() + .in(MallProductSkuEntity::getProductId, productIds) + ); // 按商品ID分组SKU - Map> skuMap = skuList.stream() - .collect(Collectors.groupingBy(MallProductSkuEntity::getProductId)); + Map> skuMap = skuList.stream() + .collect(Collectors.groupingBy(MallProductSkuEntity::getProductId)); // 转换为VO List result = merchants.stream().map(merchant -> { - MallMerchantListAppVo mallMerchantListAppVo = new MallMerchantListAppVo(); - mallMerchantListAppVo.setId(merchant.getId()); - mallMerchantListAppVo.setAddress(merchant.getAddressDes()); - mallMerchantListAppVo.setImages(merchant.getLogoPic()); - mallMerchantListAppVo.setName(merchant.getName()); - mallMerchantListAppVo.setContactPhone(merchant.getPhone()); + MallMerchantListAppVo mallMerchantListAppVo = new MallMerchantListAppVo(); + mallMerchantListAppVo.setId(merchant.getId()); + mallMerchantListAppVo.setAddress(merchant.getAddressDes()); + mallMerchantListAppVo.setImages(merchant.getLogoPic()); + mallMerchantListAppVo.setName(merchant.getName()); + mallMerchantListAppVo.setContactPhone(merchant.getPhone()); - // 获取该商户的商品列表 - List merchantProducts = productMap.getOrDefault(merchant.getId(), List.of()); - - // 设置商品总数 - mallMerchantListAppVo.setProductCount(merchantProducts.size()); - - // 获取特色商品(限制数量) - List featuredProducts = merchantProducts.stream() - .limit(productLimit) - .map(product -> { - MallProductListAppVo productVo = BeanUtils.toBean(product, MallProductListAppVo.class); - List skus = skuMap.getOrDefault(product.getId(), List.of()); - - // 计算最低价格 - productVo.setMinPrice(skus.stream() - .map(MallProductSkuEntity::getPrice) - .filter(Objects::nonNull) - .min(Integer::compareTo) - .orElse(0)); + // 获取该商户的商品列表 + List merchantProducts = productMap.getOrDefault(merchant.getId(), List.of()); - // 计算总库存 - productVo.setTotalStock(skus.stream() - .map(MallProductSkuEntity::getStock) - .filter(Objects::nonNull) - .mapToDouble(Double::doubleValue) - .sum()); + // 设置商品总数 + mallMerchantListAppVo.setProductCount(merchantProducts.size()); + + // 获取特色商品(限制数量) + List featuredProducts = merchantProducts.stream() + .limit(productLimit) + .map(product -> { + MallProductListAppVo productVo = BeanUtils.toBean(product, MallProductListAppVo.class); + List skus = skuMap.getOrDefault(product.getId(), List.of()); + + // 计算最低价格 + productVo.setMinPrice(skus.stream() + .map(MallProductSkuEntity::getPrice) + .filter(Objects::nonNull) + .min(Integer::compareTo) + .orElse(0)); + + // 计算总库存 + productVo.setTotalStock(skus.stream() + .map(MallProductSkuEntity::getStock) + .filter(Objects::nonNull) + .mapToDouble(Double::doubleValue) + .sum()); - return productVo; - }) - .collect(Collectors.toList()); - - mallMerchantListAppVo.setFeaturedProducts(featuredProducts); - - // 设置商户营业时间 + return productVo; + }) + .collect(Collectors.toList()); + + mallMerchantListAppVo.setFeaturedProducts(featuredProducts); + + // 设置商户营业时间 // if (merchant.getBusinessHours() != null && !merchant.getBusinessHours().trim().isEmpty()) { // vo.setBusinessHours(merchant.getBusinessHours()); // } else { // // 默认商户营业时间 // vo.setBusinessHours("10:00-22:00"); // } - - return mallMerchantListAppVo; - }) - .filter(vo -> vo.getProductCount() > 0) // 过滤掉没有商品的商户 - .collect(Collectors.toList()); + + return mallMerchantListAppVo; + }) + .filter(vo -> vo.getProductCount() > 0) // 过滤掉没有商品的商户 + .collect(Collectors.toList()); return R.ok(result); } @@ -236,7 +246,7 @@ public class MallAppController { @Operation(summary = "获取商户详情", description = "根据ID获取商户详情") public R getMerchantDetail(@PathVariable("id") Long id) { R mchManageVoR = remoteMchService.getById(id); - if (!mchManageVoR.isOk()){ + if (!mchManageVoR.isOk()) { return R.failed("商户服务异常!"); } MchManageVo mchManageVo = mchManageVoR.getData(); @@ -265,7 +275,7 @@ public class MallAppController { @ParameterObject Page page, @RequestParam(required = false) Long categoryId, @RequestParam(required = false) String keyword, - @RequestParam Long merchantId + @RequestParam Long merchantId ) { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); wrapper.eq(categoryId != null, MallProductEntity::getCategoryId, categoryId); @@ -274,41 +284,41 @@ public class MallAppController { wrapper.eq(MallProductEntity::getStatus, MallConstants.Status.ENABLED); // 只查上架商品 IPage productPage = mallProductService.page(page, wrapper); - + // 获取商品ID列表 List productIds = productPage.getRecords().stream() - .map(MallProductEntity::getId) - .collect(Collectors.toList()); + .map(MallProductEntity::getId) + .collect(Collectors.toList()); // 查询SKU信息 - List skuList = productIds.isEmpty() ? List.of() : - mallProductSkuService.list( - Wrappers.lambdaQuery() - .in(MallProductSkuEntity::getProductId, productIds) - ); + List skuList = productIds.isEmpty() ? List.of() : + mallProductSkuService.list( + Wrappers.lambdaQuery() + .in(MallProductSkuEntity::getProductId, productIds) + ); // 按商品ID分组SKU Map> skuMap = skuList.stream() - .collect(Collectors.groupingBy(MallProductSkuEntity::getProductId)); + .collect(Collectors.groupingBy(MallProductSkuEntity::getProductId)); // 转换为VO IPage voPage = productPage.convert(product -> { MallProductListAppVo vo = BeanUtils.toBean(product, MallProductListAppVo.class); List skus = skuMap.getOrDefault(product.getId(), List.of()); - + // 计算最低价格 vo.setMinPrice(skus.stream() - .map(MallProductSkuEntity::getPrice) - .filter(Objects::nonNull) - .min(Integer::compareTo) - .orElse(0)); + .map(MallProductSkuEntity::getPrice) + .filter(Objects::nonNull) + .min(Integer::compareTo) + .orElse(0)); // 计算总库存 vo.setTotalStock(skus.stream() - .map(MallProductSkuEntity::getStock) - .filter(Objects::nonNull) - .mapToDouble(Double::doubleValue) - .sum()); + .map(MallProductSkuEntity::getStock) + .filter(Objects::nonNull) + .mapToDouble(Double::doubleValue) + .sum()); return vo; }); @@ -328,16 +338,16 @@ public class MallAppController { } MallProductDetailAppVo vo = BeanUtils.toBean(product, MallProductDetailAppVo.class); - + // 查询SKU列表 List skuList = mallProductSkuService.list( - Wrappers.lambdaQuery() - .eq(MallProductSkuEntity::getProductId, id) + Wrappers.lambdaQuery() + .eq(MallProductSkuEntity::getProductId, id) ); - + vo.setSkuList(skuList.stream() - .map(sku -> BeanUtils.toBean(sku, MallProductSkuAppVo.class)) - .collect(Collectors.toList())); + .map(sku -> BeanUtils.toBean(sku, MallProductSkuAppVo.class)) + .collect(Collectors.toList())); return R.ok(vo); } @@ -350,23 +360,23 @@ public class MallAppController { public R> getProductBatch(@RequestParam List ids) { List products = mallProductService.listByIds(ids); List result = new java.util.ArrayList<>(); - + for (MallProductEntity product : products) { MallProductDetailAppVo vo = BeanUtils.toBean(product, MallProductDetailAppVo.class); - + // 查询SKU列表 List skuList = mallProductSkuService.list( - Wrappers.lambdaQuery() - .eq(MallProductSkuEntity::getProductId, product.getId()) + Wrappers.lambdaQuery() + .eq(MallProductSkuEntity::getProductId, product.getId()) ); - + vo.setSkuList(skuList.stream() - .map(sku -> BeanUtils.toBean(sku, MallProductSkuAppVo.class)) - .collect(Collectors.toList())); - + .map(sku -> BeanUtils.toBean(sku, MallProductSkuAppVo.class)) + .collect(Collectors.toList())); + result.add(vo); } - + return R.ok(result); } @@ -383,7 +393,7 @@ public class MallAppController { // 自动设置商户ID productCreateDTO.setMerchantId(userMerchantId); - + // 创建商品 boolean success = mallProductService.createProductWithSkus(productCreateDTO); if (success) { @@ -405,11 +415,11 @@ public class MallAppController { try { //验证商户 - Long merchantId = validateMerchant(); + Long merchantId = validateMerchant(); //验证商品数据 - validateProductPermission(productCreateDTO.getId(),merchantId); + validateProductPermission(productCreateDTO.getId(), merchantId); + - // 验证商品ID if (productCreateDTO.getId() == null) { return R.failed("商品ID不能为空"); @@ -428,12 +438,13 @@ public class MallAppController { /** * 验证商户权限和状态 + * * @return 商户id */ private Long validateMerchant() { // 获取当前用户ID Long deptId = SecurityUtils.getUser().getDeptId(); - if (deptId== null) { + if (deptId == null) { throw new BusinessException("用户未登录"); } @@ -445,7 +456,7 @@ public class MallAppController { MchManageVo mchManageVo = mchManageVoR.getData(); return mchManageVo.getId(); - }else { + } else { throw new BusinessException("该用户未分配共富商户"); } // R> mallMchUserLists = remoteRoleService.findRolesByCodes(Arrays.asList(MallConstants.RoleCode.MERCHANT_USER)); @@ -454,7 +465,7 @@ public class MallAppController { // if (CollectionUtils.isEmpty(list) || CollUtil.isEmpty(roleIds) || !roleIds.contains(list.get(0).getRoleId())) { // throw new BusinessException("请分配商户角色"); // } - //有商户角色,然后查询自己绑定的商户信息 + //有商户角色,然后查询自己绑定的商户信息 // merchantIdByUserId = mallMerchantUserService.getMerchantIdByUserId(currentUserId); // if (merchantIdByUserId == null){ // throw new BusinessException("当前用户未绑定商户"); @@ -473,7 +484,7 @@ public class MallAppController { */ private void validateProductPermission(Long productId, Long merchantId) { - MallProductEntity mallProduct = mallProductService.getById(productId); + MallProductEntity mallProduct = mallProductService.getById(productId); if (mallProduct == null) { throw new BusinessException("商品不存在"); } @@ -505,41 +516,41 @@ public class MallAppController { wrapper.eq(status != null, MallProductEntity::getStatus, status); IPage productPage = mallProductService.page(page, wrapper); - + // 获取商品ID列表 List productIds = productPage.getRecords().stream() - .map(MallProductEntity::getId) - .collect(Collectors.toList()); + .map(MallProductEntity::getId) + .collect(Collectors.toList()); // 查询SKU信息 - List skuList = productIds.isEmpty() ? List.of() : - mallProductSkuService.list( - Wrappers.lambdaQuery() - .in(MallProductSkuEntity::getProductId, productIds) - ); + List skuList = productIds.isEmpty() ? List.of() : + mallProductSkuService.list( + Wrappers.lambdaQuery() + .in(MallProductSkuEntity::getProductId, productIds) + ); // 按商品ID分组SKU Map> skuMap = skuList.stream() - .collect(Collectors.groupingBy(MallProductSkuEntity::getProductId)); + .collect(Collectors.groupingBy(MallProductSkuEntity::getProductId)); // 转换为VO IPage voPage = productPage.convert(product -> { MallProductListAppVo vo = BeanUtils.toBean(product, MallProductListAppVo.class); List skus = skuMap.getOrDefault(product.getId(), List.of()); - + // 计算最低价格 vo.setMinPrice(skus.stream() - .map(MallProductSkuEntity::getPrice) - .filter(Objects::nonNull) - .min(Integer::compareTo) - .orElse(0)); + .map(MallProductSkuEntity::getPrice) + .filter(Objects::nonNull) + .min(Integer::compareTo) + .orElse(0)); // 计算总库存 vo.setTotalStock(skus.stream() - .map(MallProductSkuEntity::getStock) - .filter(Objects::nonNull) - .mapToDouble(Double::doubleValue) - .sum()); + .map(MallProductSkuEntity::getStock) + .filter(Objects::nonNull) + .mapToDouble(Double::doubleValue) + .sum()); return vo; }); @@ -585,7 +596,7 @@ public class MallAppController { // 自动设置商户ID category.setMerchantId(merchantId); category.setDeptId(SecurityUtils.getUser().getDeptId()); - + // 创建分类 boolean success = mallCategoryService.save(category); if (success) { @@ -613,7 +624,7 @@ public class MallAppController { if (category.getId() == null) { return R.failed("分类ID不能为空"); } - + // 更新分类 boolean success = mallCategoryService.updateById(category); if (success) { @@ -635,7 +646,7 @@ public class MallAppController { try { Long merchantId = validateMerchant(); validateCategoryPermission(id, merchantId); - + // 删除分类(逻辑删除) boolean success = mallCategoryService.removeById(id); if (success) { @@ -656,12 +667,12 @@ public class MallAppController { public R> getMerchantCategoryList(@RequestParam(required = false) Long parentId) { try { Long merchantId = validateMerchant(); - + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); wrapper.eq(MallCategoryEntity::getMerchantId, merchantId); wrapper.eq(parentId != null, MallCategoryEntity::getParentId, parentId); wrapper.orderByAsc(MallCategoryEntity::getSort); - + List list = mallCategoryService.list(wrapper); return R.ok(list); } catch (Exception e) { diff --git a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/feign/RemoteMchService.java b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/feign/RemoteMchService.java index a31f5697d..56595767a 100644 --- a/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/feign/RemoteMchService.java +++ b/pjcloud-wallet/pjcloud-wallet-api/src/main/java/com/bsd/pjcloud/wallet/api/feign/RemoteMchService.java @@ -67,4 +67,8 @@ public interface RemoteMchService { @NoToken @GetMapping("/mch-manage/get-self-canteen-user-dept-id-list") R> getSelfCanteenUserDeptIdList(@RequestParam Long mchId); + + @NoToken + @GetMapping("/mch-manage/get-self-mch-id-list") + R> getSelfMchIdList(@RequestParam Long userId, @RequestParam List mchTypeList); } diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/mch/MchManageController.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/mch/MchManageController.java index 481b2c568..9a60bdbf2 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/mch/MchManageController.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/controller/mch/MchManageController.java @@ -67,17 +67,6 @@ public class MchManageController { @Inner @PostMapping("/list") public R> remoteList(@RequestBody MchManageDto body) { - if (ObjectUtil.isNotEmpty(body.getScopeUserDeptId())) { - MchManageVo targetMch = mchManageService.getViewsCanteenMchByDeptId(body.getScopeUserDeptId()); - if (ObjectUtil.isNotEmpty(targetMch)) { - body.setIds(List.of(targetMch.getId())); - } else { - List deptIdList = remoteDeptService.getInnerDescendantList(body.getScopeUserDeptId()).getData(); - if (ObjectUtil.isNotEmpty(deptIdList)) { - body.setDeptIds(deptIdList.stream().map(SysDept::getDeptId).toList()); - } - } - } List list = mchManageService.list(body); return R.ok(list); } @@ -172,6 +161,14 @@ public class MchManageController { return R.ok(userDeptIdList); } + @Inner + @GetMapping("/get-self-mch-id-list") + public R> getSelfMchIdList(@RequestParam Long userId, @RequestParam List mchTypeList) { + List userDeptIdList = mchManageService.getSelfMchIdList(userId, mchTypeList); + if (ObjectUtil.isEmpty(userDeptIdList)) return R.failed("商户不存在"); + return R.ok(userDeptIdList); + } + /* ************************************* end 远程调用 end ************************************* */ /* ************************************* start app start ************************************* */ @@ -193,7 +190,7 @@ public class MchManageController { public R> appPageJoin(@ParameterObject Page page, @ParameterObject MchManageDto dto) { PjcloudUser user = SecurityUtils.getUser(); dto.setVisibleMobile(YesNoEnum.YES.getCode()); - List selfMchIdList = mchManageService.getSelfCanteenMchIdList(user.getId(), List.of(MerchantTypeEnum.CANTEEN)); + List selfMchIdList = mchManageService.getSelfMchIdList(user.getId(), List.of(MerchantTypeEnum.CANTEEN)); if (ObjectUtil.isNotEmpty(selfMchIdList)) { List ids = dto.getIds(); if (ObjectUtil.isEmpty(ids)) ids = new ArrayList<>(); @@ -267,7 +264,7 @@ public class MchManageController { public R getSelect(@ParameterObject Page page, @ParameterObject MchManageDto dto) { DataScope dataScope = null; PjcloudUser user = SecurityUtils.getUser(); - List selfMchIdList = mchManageService.getSelfCanteenMchIdList(user.getId(), List.of(MerchantTypeEnum.CANTEEN)); + List selfMchIdList = mchManageService.getSelfMchIdList(user.getId(), List.of(MerchantTypeEnum.CANTEEN)); if (ObjectUtil.isNotEmpty(selfMchIdList)) { List ids = dto.getIds(); if (ObjectUtil.isEmpty(ids)) ids = new ArrayList<>(); diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/MchManageService.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/MchManageService.java index 5827ab378..e43b6e999 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/MchManageService.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/MchManageService.java @@ -63,9 +63,9 @@ public interface MchManageService extends IService { String lbLogin(PjcloudUser user); /** - * 获取用户的食堂商户列表 + * 获取用户的商户列表 */ - List getSelfCanteenMchIdList(Long userId, List mchTypeList); + List getSelfMchIdList(Long userId, List mchTypeList); /** * 获当前食堂商户列表对应的用户部门列表 diff --git a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/mch/MchManageServiceImpl.java b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/mch/MchManageServiceImpl.java index 8fdfdf590..5d95711aa 100644 --- a/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/mch/MchManageServiceImpl.java +++ b/pjcloud-wallet/pjcloud-wallet-biz/src/main/java/com/bsd/pjcloud/wallet/service/impl/mch/MchManageServiceImpl.java @@ -471,7 +471,7 @@ public class MchManageServiceImpl extends ServiceImpl getSelfCanteenMchIdList(Long userId, List mchTypeList) { + public List getSelfMchIdList(Long userId, List mchTypeList) { List mchIds = new ArrayList<>(); mchIds.add(-1L); List deptIdList = new ArrayList<>(); @@ -481,7 +481,7 @@ public class MchManageServiceImpl extends ServiceImpl descendantList = remoteDeptService.getDescendantList(userInfo.getSysUser().getDeptId()).getData(); + List descendantList = remoteDeptService.getInnerDescendantList(userInfo.getSysUser().getDeptId()).getData(); if (ObjectUtil.isNotEmpty(descendantList)) { List descendantIds = descendantList.stream().map(SysDept::getDeptId).toList(); if (ObjectUtil.isNotEmpty(descendantIds)) deptIdList.addAll(descendantIds);