| | |
| | | return Collections.emptyList(); |
| | | } |
| | | List<Shop> shops = new ArrayList<>(); |
| | | List<PageShopMgtGoodsVO> list = new ArrayList<>(); |
| | | //2.判断门店是否经销商 |
| | | if (shop.getShopType()==1){ |
| | | //经销商 获取下级-加盟商ids |
| | | shops = remoteShopService.getFranchiseeIdsBYDealerId(shop.getShopId()); |
| | | //将该门店加入 |
| | | shops.add(shop); |
| | | List<Long> shopIds = shops.stream().map(Shop::getShopId).collect(Collectors.toList()); |
| | | //查询信息 |
| | | pageShopMgtGoodsDTO.setShopIds(shopIds); |
| | | //3.根据shopId查询商品信息 |
| | | list= goodsMapper.pageShopMgtGoods(page,pageShopMgtGoodsDTO); |
| | | }else { |
| | | //将该门店加入 |
| | | shops.add(shop); |
| | | //3.根据shopId查询商品信息 |
| | | list= goodsMapper.pageShopMgtGoodsBySingle(page,pageShopMgtGoodsDTO); |
| | | } |
| | | //将该门店加入 |
| | | shops.add(shop); |
| | | List<Long> shopIds = shops.stream().map(Shop::getShopId).collect(Collectors.toList()); |
| | | //查询信息 |
| | | pageShopMgtGoodsDTO.setShopIds(shopIds); |
| | | //3.根据shopId查询商品信息 |
| | | List<PageShopMgtGoodsVO> list= goodsMapper.pageShopMgtGoods(page,pageShopMgtGoodsDTO); |
| | | |
| | | |
| | | if (list != null && !list.isEmpty()) { |
| | | //4.商品分类 |
| | |
| | | )); |
| | | //5.门店信息 |
| | | list.forEach(mgtGoodsPageVo -> { |
| | | if(mgtGoodsPageVo.getBindShopId()==null){ |
| | | mgtGoodsPageVo.setBindShopId(String.valueOf(pageShopMgtGoodsDTO.getShopId())); |
| | | } |
| | | // 获取门店信息 |
| | | Shop shopInfo = shopMap.get(Long.valueOf(mgtGoodsPageVo.getBindShopId())); |
| | | // 如果门店信息不为空,则设置门店信息 |
| | | if (shopInfo != null) { |
| | | mgtGoodsPageVo.setShopName(shopInfo.getShopName()); |
| | | mgtGoodsPageVo.setModifyPricePermission(shop.getModifyPricePermission()); |
| | | // mgtGoodsPageVo.setModifyPricePermission(shop.getModifyPricePermission()); |
| | | } |
| | | }); |
| | | |
| | |
| | | //修改门店内商品价格 |
| | | ShopGoods shopGoods = shopGoodsService.getByShopIdAndGoodsId(updateGoodsPriceDTO.getBindShopId(), String.valueOf(updateGoodsPriceDTO.getGoodsId())); |
| | | if (null == shopGoods || shopGoods.getDelFlag() != 0){ |
| | | return R.fail("该门店不存在该商品"); |
| | | shopGoods = new ShopGoods(); |
| | | shopGoods.setGoodsId(String.valueOf(updateGoodsPriceDTO.getGoodsId())); |
| | | shopGoods.setShopId(updateGoodsPriceDTO.getShopId()); |
| | | shopGoods.setDelFlag(0); |
| | | shopGoods.setServiceNum(0); |
| | | } |
| | | shopGoods.setUpdateUserId(sysUser.getUserId()); |
| | | shopGoods.setSalesPrice(updateGoodsPriceDTO.getGoodsPrice()); |
| | | shopGoodsService.updateById(shopGoods); |
| | | shopGoodsService.saveOrUpdate(shopGoods); |
| | | return R.ok(); |
| | | } |
| | | } |