| | |
| | | public AppGoodsInfoVo getGoodsInfo(AppGoodsInfoGetDto appGoodsInfoGetDto){ |
| | | AppGoodsInfoVo appGoodsInfoVo = new AppGoodsInfoVo(); |
| | | Goods goods = this.getById(appGoodsInfoGetDto.getId()); |
| | | if(goods.getGoodsStatus()==-1){ |
| | | throw new ServiceException(AppErrorConstant.GOODS_DELETED); |
| | | } |
| | | BeanUtils.copyProperties(goods, appGoodsInfoVo); |
| | | //商户定制价格 |
| | | ShopGoods shopGoods = shopGoodsService.getByShopIdAndGoodsId(appGoodsInfoGetDto.getShopId(),goods.getGoodsId()); |
| | |
| | | // 判断是否有商品ID 没有则新建 |
| | | if (goodsId != null) { |
| | | goods = this.getById(goodsId); |
| | | if(goods.getGoodsStatus()==-1){ |
| | | throw new ServiceException(AppErrorConstant.GOODS_DELETED); |
| | | } |
| | | } else { |
| | | goods = new Goods(); |
| | | goodsId = IdUtils.simpleUUID(); |
| | |
| | | goodsFileService.saveBatch(files); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description: 上下架 |
| | | * @author jqs |
| | | * @date 2023/6/5 17:21 |
| | | * @version 1.0 |
| | | */ |
| | | @Override |
| | | public void upDownMgtGoods(MgtGoodsUpDownDto mgtGoodsUpDownDto){ |
| | | Goods goods = this.getById(mgtGoodsUpDownDto.getGoodsId()); |
| | | if(goods.getGoodsStatus()==-1){ |
| | | throw new ServiceException(AppErrorConstant.GOODS_DELETED); |
| | | } |
| | | goods.setGoodsStatus(mgtGoodsUpDownDto.getGoodsStatus()); |
| | | goods.setUpdateTime(DateUtils.getNowDate()); |
| | | goods.setUpdateUserId(mgtGoodsUpDownDto.getUserId()); |
| | | this.saveOrUpdate(goods); |
| | | } |
| | | |
| | | /** |
| | | * @description 推荐商品 |
| | | * @author jqs |
| | | * @date 2023/6/5 17:32 |
| | | * @param mgtGoodsRecommendDto |
| | | * @return void |
| | | */ |
| | | @Override |
| | | public void recommendMgtGoods(MgtGoodsRecommendDto mgtGoodsRecommendDto){ |
| | | Goods goods = this.getById(mgtGoodsRecommendDto.getGoodsId()); |
| | | if(goods.getGoodsStatus()==-1){ |
| | | throw new ServiceException(AppErrorConstant.GOODS_DELETED); |
| | | } |
| | | goods.setRecommendFlag(mgtGoodsRecommendDto.getRecommendFlag()); |
| | | goods.setUpdateTime(DateUtils.getNowDate()); |
| | | goods.setUpdateUserId(mgtGoodsRecommendDto.getUserId()); |
| | | this.saveOrUpdate(goods); |
| | | } |
| | | |
| | | /** |
| | | * @description 删除商品 |
| | | * @author jqs |
| | | * @date 2023/6/5 17:36 |
| | | * @param goodsId |
| | | * @return void |
| | | */ |
| | | @Override |
| | | public void deleteMgtGoods(String goodsId,Long userId){ |
| | | Goods goods = this.getById(goodsId); |
| | | goods.setDelFlag(1); |
| | | goods.setGoodsStatus(-1); |
| | | goods.setUpdateTime(DateUtils.getNowDate()); |
| | | goods.setUpdateUserId(userId); |
| | | this.saveOrUpdate(goods); |
| | | } |
| | | |
| | | |
| | | } |