| | |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.core.utils.uuid.IdUtils; |
| | | import com.ruoyi.common.security.utils.CodeFactoryUtil; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.goods.domain.dto.*; |
| | | import com.ruoyi.goods.domain.pojo.goods.GoodsTotal; |
| | | import com.ruoyi.goods.domain.vo.*; |
| | |
| | | import com.ruoyi.system.api.domain.poji.goods.GoodsFile; |
| | | import com.ruoyi.system.api.domain.poji.goods.ShopGoods; |
| | | import com.ruoyi.system.api.domain.poji.shop.Shop; |
| | | import com.ruoyi.system.api.domain.poji.sys.SysUser; |
| | | import com.ruoyi.system.api.domain.vo.MerGoodsPriceListVo; |
| | | import com.ruoyi.system.api.domain.vo.MgtSelectGoodsPageVo; |
| | | import com.ruoyi.system.api.domain.vo.ShopRelUserVo; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | public List<PageShopMgtGoodsVO> pageShopMgtGoods(Page<PageShopMgtGoodsVO> page,PageShopMgtGoodsDTO pageShopMgtGoodsDTO) { |
| | | //1.查找门店 |
| | | Shop shop = remoteShopService.getShop(pageShopMgtGoodsDTO.getShopId()).getData(); |
| | | if (null == shop || shop.getDelFlag() != 0) { |
| | | if (null == shop || shop.getDelFlag() != 0 || shop.getShopStatus() == -1) { |
| | | return Collections.emptyList(); |
| | | } |
| | | List<Shop> shops = new ArrayList<>(); |
| | |
| | | //5.门店信息 |
| | | list.forEach(mgtGoodsPageVo -> { |
| | | // 获取门店信息 |
| | | Shop shopInfo = shopMap.get(Long.valueOf(mgtGoodsPageVo.getShopId())); |
| | | Shop shopInfo = shopMap.get(Long.valueOf(mgtGoodsPageVo.getBindShopId())); |
| | | // 如果门店信息不为空,则设置门店信息 |
| | | if (shopInfo != null) { |
| | | mgtGoodsPageVo.setShopName(shopInfo.getShopName()); |
| | |
| | | |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public R<Void> updateGoodsPrice(UpdateGoodsPriceDTO updateGoodsPriceDTO) { |
| | | //判断当前登录人员类型 |
| | | SysUser sysUser = SecurityUtils.getSysUser(); |
| | | if ("01".equals(sysUser.getUserType())){ |
| | | //B端 |
| | | Shop shop = remoteShopService.getShop(updateGoodsPriceDTO.getShopId()).getData(); |
| | | if (null == shop || shop.getDelFlag() != 0 || shop.getShopStatus() == -1) { |
| | | return R.fail("该门店不存在"); |
| | | } |
| | | //判断是否经销商 是否开启价格修改权限 |
| | | int modifyPricePermission = shop.getModifyPricePermission()==null?0:shop.getModifyPricePermission(); |
| | | if (1 != shop.getShopType() || 1 != modifyPricePermission){ |
| | | return R.fail("权限不足"); |
| | | } |
| | | }else if (!"00".equals(sysUser.getUserType())){ |
| | | //也不是平台 |
| | | return R.fail("用户类型错误"); |
| | | } |
| | | //修改门店内商品价格 |
| | | ShopGoods shopGoods = shopGoodsService.getByShopIdAndGoodsId(updateGoodsPriceDTO.getBindShopId(), String.valueOf(updateGoodsPriceDTO.getGoodsId())); |
| | | if (null == shopGoods || shopGoods.getDelFlag() != 0){ |
| | | return R.fail("该门店不存在该商品"); |
| | | } |
| | | shopGoods.setUpdateUserId(sysUser.getUserId()); |
| | | shopGoods.setSalesPrice(updateGoodsPriceDTO.getGoodsPrice()); |
| | | shopGoodsService.updateById(shopGoods); |
| | | return R.ok(); |
| | | } |
| | | } |