| | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | return new FebsResponse().fail().message("商品规格原价不能小于0"); |
| | | } |
| | | BigDecimal presentPrice = addSku.getPresentPrice(); |
| | | if (presentPrice.compareTo(BigDecimal.ZERO) <= 0) { |
| | | if (presentPrice.compareTo(BigDecimal.ZERO) < 0) { |
| | | return new FebsResponse().fail().message("商品规格现价不能小于0"); |
| | | } |
| | | |
| | |
| | | return mallGoodsMapper.getAllGoodsTree(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse goodsHot(Long id) { |
| | | MallGoods mallGoods = mallGoodsMapper.selectById(id); |
| | | if (ObjectUtil.isEmpty(mallGoods)) { |
| | | return new FebsResponse().fail().message("商品不存在,请刷新当前页面"); |
| | | } |
| | | mallGoods.setIsHot(MallGoods.ISHOT_STATE_YES); |
| | | mallGoodsMapper.updateById(mallGoods); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse goodsNotHot(Long id) { |
| | | MallGoods mallGoods = mallGoodsMapper.selectById(id); |
| | | if (ObjectUtil.isEmpty(mallGoods)) { |
| | | return new FebsResponse().fail().message("商品不存在,请刷新当前页面"); |
| | | } |
| | | mallGoods.setIsHot(MallGoods.ISHOT_STATE_NO); |
| | | mallGoodsMapper.updateById(mallGoods); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<AdminHomeDeliverySettingVo> getDeliveryHomeListInPage(AdminHomeDeliverySettingVo adminHomeDeliverySetting, QueryRequest request) { |
| | | Page<DataDictionaryCustom> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | IPage<DataDictionaryCustom> dataDictionaryCustomIPage = this.baseMapper.getDeliveryHomeListInPage(page, adminHomeDeliverySetting); |
| | | List<DataDictionaryCustom> records = dataDictionaryCustomIPage.getRecords(); |
| | | List<AdminHomeDeliverySettingVo> adminHomeDeliverySettingVos = new ArrayList<>(); |
| | | if(CollUtil.isNotEmpty(records)){ |
| | | for(DataDictionaryCustom dataDictionaryCustom : records){ |
| | | AdminHomeDeliverySettingVo adminHomeDeliverySettingVo = JSONUtil.toBean(dataDictionaryCustom.getValue(), AdminHomeDeliverySettingVo.class); |
| | | adminHomeDeliverySettingVo.setId(dataDictionaryCustom.getId()); |
| | | adminHomeDeliverySettingVos.add(adminHomeDeliverySettingVo); |
| | | } |
| | | } |
| | | IPage<AdminHomeDeliverySettingVo> adminHomeDeliverySettingVoIPage = new Page<>(); |
| | | adminHomeDeliverySettingVoIPage.setRecords(adminHomeDeliverySettingVos); |
| | | adminHomeDeliverySettingVoIPage.setTotal(dataDictionaryCustomIPage.getTotal()); |
| | | return adminHomeDeliverySettingVoIPage; |
| | | } |
| | | |
| | | |
| | | private final DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | @Override |
| | | public FebsResponse deliveryHomeUpdate(AdminHomeDeliverySettingVo adminHomeDeliverySettingVo) { |
| | | DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectById(adminHomeDeliverySettingVo.getId()); |
| | | adminHomeDeliverySettingVo.setId(null); |
| | | dataDictionaryCustom.setValue(JSONUtil.toJsonStr(adminHomeDeliverySettingVo)); |
| | | dataDictionaryCustomMapper.updateById(dataDictionaryCustom); |
| | | return new FebsResponse().success(); |
| | | } |
| | | } |