| | |
| | | if (mallGoodsByGoodsNo > 0) { |
| | | return new FebsResponse().fail().message("商品编号不能重复"); |
| | | } |
| | | Integer carriageType = addMallGoodsDto.getCarriageType(); |
| | | if(1 == carriageType){ |
| | | if(ObjectUtil.isEmpty(addMallGoodsDto.getCarriageAmount()) |
| | | || BigDecimal.ZERO.compareTo(addMallGoodsDto.getCarriageAmount()) >= 0){ |
| | | return new FebsResponse().fail().message("固定邮费不能小于零"); |
| | | } |
| | | }else{ |
| | | Long carriageRuleId = addMallGoodsDto.getCarriageRuleId(); |
| | | MallCarriageRule mallCarriageRule = mallCarriageRuleMapper.selectById(carriageRuleId); |
| | | if(ObjectUtil.isEmpty(mallCarriageRule)){ |
| | | return new FebsResponse().fail().message("邮费模板不能为空"); |
| | | } |
| | | } |
| | | |
| | | |
| | | // 付费商品 |
| | | if (addMallGoodsDto.getGoodsType() != 2) { |
| | |
| | | if (StrUtil.isEmpty(presentPrice)) { |
| | | return new FebsResponse().fail().message("商品规格现价不能为空"); |
| | | } |
| | | BigDecimal goodsWeight = addSku.getGoodsWeight(); |
| | | if(BigDecimal.ZERO.compareTo(goodsWeight) > 0){ |
| | | return new FebsResponse().fail().message("重量不能小于零"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | MallGoods mallGoods = MallGoodsConversion.INSTANCE.dtoToEntity(addMallGoodsDto); |
| | | mallGoods.setIsSale(MallGoods.ISSALE_STATUS_DISABLED); |
| | | |
| | | if (mallGoods.getHasCarriage() == 2) { |
| | | mallGoods.setCarriage(BigDecimal.ZERO); |
| | | } |
| | | // if (mallGoods.getHasCarriage() == 2) { |
| | | // mallGoods.setCarriage(BigDecimal.ZERO); |
| | | // } |
| | | mallGoodsMapper.insert(mallGoods); |
| | | |
| | | String thumbs = addMallGoodsDto.getThumbs(); |
| | |
| | | sku.setSkuVolume(mallGoods.getVolume()); |
| | | sku.setStock(mallGoods.getStock()); |
| | | sku.setStyleId(style.getId()); |
| | | sku.setGoodsWeight(mallGoods.getGoodsWeight()); |
| | | mallGoodsSkuMapper.insert(sku); |
| | | return new FebsResponse().success().message("添加成功"); |
| | | } |
| | |
| | | mallGoodsSku.setStyleId(mallGoodsStyleSku.getId()); |
| | | mallGoodsSku.setCostPrice(addMallGoodsSkuDto.getCostPrice()); |
| | | mallGoodsSku.setGoodsId(mallGoods.getId()); |
| | | mallGoodsSku.setGoodsWeight(addMallGoodsSkuDto.getGoodsWeight()); |
| | | mallGoodsSku.setSample(addMallGoodsSkuDto.getSample()); |
| | | mallGoodsSkuMapper.insert(mallGoodsSku); |
| | | } |
| | | } |
| | |
| | | if (mallGoodsByGoodsNo > 0) { |
| | | return new FebsResponse().fail().message("商品编号不能重复"); |
| | | } |
| | | Integer carriageType = mallGoodsUpdateDto.getCarriageType(); |
| | | if(1 == carriageType){ |
| | | if(ObjectUtil.isEmpty(mallGoodsUpdateDto.getCarriageAmount()) |
| | | || BigDecimal.ZERO.compareTo(mallGoodsUpdateDto.getCarriageAmount()) > 0){ |
| | | return new FebsResponse().fail().message("固定邮费不能小于零"); |
| | | } |
| | | }else{ |
| | | Long carriageRuleId = mallGoodsUpdateDto.getCarriageRuleId(); |
| | | MallCarriageRule mallCarriageRule = mallCarriageRuleMapper.selectById(carriageRuleId); |
| | | if(ObjectUtil.isEmpty(mallCarriageRule)){ |
| | | return new FebsResponse().fail().message("邮费模板不能为空"); |
| | | } |
| | | } |
| | | |
| | | if (mallGoodsUpdateDto.getGoodsType() != 2) { |
| | | Long categoryId = mallGoodsUpdateDto.getCategoryId(); |
| | |
| | | if (presentPrice.compareTo(BigDecimal.ZERO) < 0) { |
| | | return new FebsResponse().fail().message("商品规格现价不能小于0"); |
| | | } |
| | | BigDecimal goodsWeight = addSku.getGoodsWeight(); |
| | | if(BigDecimal.ZERO.compareTo(goodsWeight) > 0){ |
| | | return new FebsResponse().fail().message("重量不能小于零"); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | BeanUtil.copyProperties(mallGoodsUpdateDto, mallGoods); |
| | | if (mallGoods.getHasCarriage() == 2) { |
| | | mallGoods.setCarriage(BigDecimal.ZERO); |
| | | } |
| | | // if (mallGoods.getHasCarriage() == 2) { |
| | | // mallGoods.setCarriage(BigDecimal.ZERO); |
| | | // } |
| | | |
| | | mallGoodsMapper.updateById(mallGoods); |
| | | |
| | |
| | | sku.setSkuVolume(mallGoods.getVolume()); |
| | | sku.setStock(mallGoods.getStock()); |
| | | sku.setStyleId(style.getId()); |
| | | sku.setGoodsWeight(mallGoods.getGoodsWeight()); |
| | | mallGoodsSkuMapper.insert(sku); |
| | | return new FebsResponse().success().message("添加成功"); |
| | | } |
| | |
| | | mallGoodsSku.setStyleId(addMallGoodsSkuDto.getStyleId()); |
| | | mallGoodsSku.setGoodsId(mallGoods.getId()); |
| | | mallGoodsSku.setCostPrice(addMallGoodsSkuDto.getCostPrice()); |
| | | mallGoodsSku.setGoodsWeight(addMallGoodsSkuDto.getGoodsWeight()); |
| | | mallGoodsSku.setSample(addMallGoodsSkuDto.getSample()); |
| | | mallGoodsSkuMapper.updateById(mallGoodsSku); |
| | | } else { |
| | | //新增商品规格 |
| | |
| | | mallGoodsSku.setStyleId(mallGoodsStyleSku.getId()); |
| | | mallGoodsSku.setCostPrice(addMallGoodsSkuDto.getCostPrice()); |
| | | mallGoodsSku.setGoodsId(mallGoods.getId()); |
| | | mallGoodsSku.setGoodsWeight(addMallGoodsSkuDto.getGoodsWeight()); |
| | | mallGoodsSku.setSample(addMallGoodsSkuDto.getSample()); |
| | | mallGoodsSkuMapper.insert(mallGoodsSku); |
| | | } |
| | | } |
| | |
| | | |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public List<MallCarriageRule> findAllCarriageRuleTree() { |
| | | List<MallCarriageRule> mallCarriageRules = mallCarriageRuleMapper.selectList(new QueryWrapper<>()); |
| | | return mallCarriageRules; |
| | | } |
| | | } |