| | |
| | | package com.ruoyi.shop.controller.console; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.ruoyi.common.core.constant.CacheConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | |
| | | import com.ruoyi.system.api.constant.AppErrorConstant; |
| | | import com.ruoyi.system.api.domain.dto.*; |
| | | import com.ruoyi.system.api.domain.poji.shop.Shop; |
| | | import com.ruoyi.system.api.domain.vo.ShopProportionVo; |
| | | import com.ruoyi.system.api.domain.poji.sys.SysUser; |
| | | import com.ruoyi.system.api.domain.vo.*; |
| | | import com.ruoyi.system.api.model.QwH5LoginVo; |
| | |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | /** |
| | | * @author jqs34 |
| | |
| | | @PostMapping("/getShopByUserId") |
| | | public R<ShopRelUserVo> getShopByUserId(@RequestBody Long userId) |
| | | { |
| | | ShopRelUser shopRelUser = shopRelUserService.getByUserId(userId); |
| | | List<ShopRelUser> shopRelUser = shopRelUserService.getByUserId(userId); |
| | | Optional.ofNullable(shopRelUser).orElseThrow(() -> new ServiceException("未查询到用户关联商户")); |
| | | ShopRelUserVo shopRelUserVo = new ShopRelUserVo(); |
| | | shopRelUserVo.setShopId(shopRelUser.getShopId()); |
| | | shopRelUserVo.setUserName(shopRelUser.getUserName()); |
| | | ShopRelUser shopRelUser1 = shopRelUser.stream().filter(s -> s.getIsDefault() == 1).collect(Collectors.toList()).get(0); |
| | | shopRelUserVo.setShopId(shopRelUser1.getShopId()); |
| | | shopRelUserVo.setUserName(shopRelUser1.getUserName()); |
| | | Shop shop = shopService.getById(shopRelUser1.getShopId()); |
| | | shopRelUserVo.setShopName(shop.getShopName()); |
| | | shopRelUserVo.setShopNum(shopRelUser.size()); |
| | | return R.ok(shopRelUserVo); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/getShopByBelongUserId") |
| | | public R<ShopRelUserVo> getShopByBelongUserId(@RequestBody Long userId) |
| | | { |
| | | public R<ShopRelUserVo> getShopByBelongUserId(@RequestBody Long userId) { |
| | | List<Shop> shopList = shopService.getShopByBelongUserId(userId); |
| | | Optional.ofNullable(shopList.get(0)).orElseThrow(() -> new ServiceException("未查询到商户信息")); |
| | | ShopRelUserVo shopRelUserVo = new ShopRelUserVo(); |