| | |
| | | |
| | | 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; |
| | | |
| | |
| | | } |
| | | 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); |
| | | } |
| | | } |