| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.order.domain.dto.AppGoodsInfoGetDto; |
| | | import com.ruoyi.order.domain.dto.AppSearchGoodsPageDto; |
| | | import com.ruoyi.order.domain.dto.AppShopGoodsPageDto; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.order.domain.dto.*; |
| | | import com.ruoyi.order.domain.pojo.goods.Goods; |
| | | import com.ruoyi.order.domain.pojo.goods.GoodsFile; |
| | | import com.ruoyi.order.domain.pojo.goods.ShopGoods; |
| | | import com.ruoyi.order.domain.vo.AppGoodsInfoVo; |
| | | import com.ruoyi.order.domain.vo.AppSimpleActivityGoodsVo; |
| | | import com.ruoyi.order.domain.vo.AppSimpleGoodsVo; |
| | | import com.ruoyi.order.domain.vo.MerGoodsPageVo; |
| | | import com.ruoyi.order.mapper.goods.GoodsMapper; |
| | | import com.ruoyi.order.service.activity.ActivityGoodsService; |
| | | import com.ruoyi.order.service.goods.GoodsFileService; |
| | | import com.ruoyi.order.service.goods.GoodsService; |
| | | import com.ruoyi.order.service.goods.ShopGoodsService; |
| | | import com.ruoyi.system.api.RemoteActivityService; |
| | | import com.ruoyi.system.api.constant.AppErrorConstant; |
| | | import com.ruoyi.system.api.domain.poji.activity.ActivityGoods; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.StringJoiner; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Resource |
| | | private ShopGoodsService shopGoodsService; |
| | | |
| | | @Resource |
| | | private GoodsFileService goodsFileService; |
| | | |
| | | /** |
| | | * 获取推荐商品列表 |
| | |
| | | }else{ |
| | | appGoodsInfoVo.setActivityFlag(0); |
| | | } |
| | | //商品图片 |
| | | List<GoodsFile> goodsFileList = goodsFileService.listByGoodsId(goods.getGoodsId()); |
| | | StringJoiner bannerSJ = new StringJoiner(","); |
| | | if(goodsFileList!=null&&!goodsFileList.isEmpty()){ |
| | | for(GoodsFile goodsFile : goodsFileList){ |
| | | if(goodsFile.getFileType()==2){ |
| | | appGoodsInfoVo.setGoodsVideo(goodsFile.getFileUrl()); |
| | | }else if(goodsFile.getFileType()==3){ |
| | | bannerSJ.add(goodsFile.getFileUrl()); |
| | | } |
| | | } |
| | | if(bannerSJ!=null&&bannerSJ.length()>0){ |
| | | appGoodsInfoVo.setGoodsBanners(bannerSJ.toString()); |
| | | } |
| | | } |
| | | return appGoodsInfoVo; |
| | | } |
| | | |
| | | /** |
| | | * 分页商户商品列表 |
| | | * @param merGoodsPageDto |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MerGoodsPageVo> pageMerShopGoods(Page page,MerGoodsPageDto merGoodsPageDto){ |
| | | List<MerGoodsPageVo> merGoodsPageVoList = goodsMapper.pageMerShopGoods(page,merGoodsPageDto); |
| | | return merGoodsPageVoList; |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改商户商品 |
| | | * @param merShopGoodsEditDto |
| | | */ |
| | | @Override |
| | | public void editMerShopGoods(MerShopGoodsEditDto merShopGoodsEditDto){ |
| | | Goods goods = this.getById(merShopGoodsEditDto.getGoodsId()); |
| | | if(merShopGoodsEditDto.getSalePrice().compareTo(goods.getMininumPrice())<0){ |
| | | throw new ServiceException(AppErrorConstant.SALESPRICE_MIN+goods.getMininumPrice().toString()+"元"); |
| | | } |
| | | //商户定制价格 |
| | | ShopGoods shopGoods = shopGoodsService.getByShopIdAndGoodsId(merShopGoodsEditDto.getShopId(),goods.getGoodsId()); |
| | | if(shopGoods!=null){ |
| | | shopGoods.setSalesPrice(merShopGoodsEditDto.getSalePrice()); |
| | | shopGoods.setServiceNum(merShopGoodsEditDto.getServiceNum()); |
| | | shopGoods.setUpdateTime(new Date()); |
| | | shopGoods.setUpdateUserId(merShopGoodsEditDto.getUserId()); |
| | | }else{ |
| | | shopGoods = new ShopGoods(); |
| | | shopGoods.setDelFlag(0); |
| | | shopGoods.setShopId(merShopGoodsEditDto.getShopId()); |
| | | shopGoods.setGoodsId(merShopGoodsEditDto.getGoodsId()); |
| | | shopGoods.setSalesPrice(merShopGoodsEditDto.getSalePrice()); |
| | | shopGoods.setServiceNum(merShopGoodsEditDto.getServiceNum()); |
| | | shopGoods.setUpdateTime(new Date()); |
| | | shopGoods.setUpdateUserId(merShopGoodsEditDto.getUserId()); |
| | | } |
| | | shopGoodsService.saveOrUpdate(shopGoods); |
| | | } |
| | | } |