liukangdong
2024-07-26 296fc0dbd38fb9528c9d1f91ec9bc3758e27e994
server/service/src/main/java/com/doumee/service/business/impl/ShopServiceImpl.java
@@ -1032,4 +1032,44 @@
        );
    }
    @Override
    public List<Shop> getUserShopList(Long userId) {
        Users users = usersMapper.selectById(userId);
        if(Objects.isNull(users)){
            return new ArrayList<>();
        }
        Shop userShop = shopMapper.selectById(users.getDepartmentId());
        if(Objects.isNull(userShop)){
            return new ArrayList<>();
        }
        List<Shop> shopList = shopMapper.selectList(new QueryWrapper<Shop>()
                .lambda()
                .eq(Shop::getScode,userShop.getScode())
                .eq(Shop::getType,Constants.TWO)
                .eq(Shop::getSecondType,Constants.THREE)
        );
        //查询经营范围信息
        List<CategorySeg> categorySegAllList = categorySegMapper.selectList(new QueryWrapper<CategorySeg>().lambda()
                .isNotNull(CategorySeg::getOrgId)
                .eq(CategorySeg::getIsdeleted,Constants.ZERO));
        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(categorySegAllList)){
            for (Shop shop:shopList) {
                if(StringUtils.isBlank(shop.getOrgId())){
                    continue;
                }
                List<CategorySeg> categorySegList = categorySegAllList.stream().filter(i->i.getOrgId().equals(shop.getOrgId())).collect(Collectors.toList());
                List<UnitCodeVo> unitCodeVoList =systemDictDataBiz.getUnitList();
                List<String> seqNameList = new ArrayList<>();
                for(CategorySeg model : categorySegList){
                    String seqName = systemDictDataBiz.getUnitName(model.getUnitCode(),unitCodeVoList);
                    if(Objects.nonNull(seqName)){
                        seqNameList.add(seqName);
                    }
                }
                shop.setSeqNameList(seqNameList);
            }
        }
        return shopList;
    }
}