| | |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; |
| | | import cc.mrbird.febs.common.enumerates.StarRatingEnum; |
| | | import cc.mrbird.febs.mall.conversion.MallGoodsConversion; |
| | | import cc.mrbird.febs.mall.dto.*; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | |
| | | private final MallGoodsStyleMapper mallGoodsStyleMapper; |
| | | private final MallGoodsImagesMapper mallGoodsImagesMapper; |
| | | private final MallShoppingCartMapper mallShoppingCartMapper; |
| | | private final DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | |
| | | @Override |
| | | public IPage<AdminMallGoodsVo> getCategoryListInPage(MallGoods mallGoods, QueryRequest request) { |
| | |
| | | //新增商品 |
| | | MallGoods mallGoods = MallGoodsConversion.INSTANCE.dtoToEntity(addMallGoodsDto); |
| | | mallGoods.setIsSale(MallGoods.ISSALE_STATUS_DISABLED); |
| | | |
| | | //根据商品原价获取商品星级 |
| | | String originalPrice = mallGoods.getOriginalPrice(); |
| | | String starRating = StarRatingEnum.NORMAL.belongStarRating(originalPrice); |
| | | mallGoods.setStarRating(starRating); |
| | | //根据商品原价获取商品补贴金额 |
| | | DataDictionaryCustom subsidyPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.SUBSIDY_PERCENT.getType() |
| | | , DataDictionaryEnum.SUBSIDY_PERCENT.getCode()); |
| | | BigDecimal subsidyPercent = new BigDecimal(subsidyPercentDic.getValue()).multiply(new BigDecimal(0.01)).setScale(BigDecimal.ROUND_DOWN,2); |
| | | BigDecimal subsidyAmount = subsidyPercent.multiply(new BigDecimal(originalPrice)).setScale(BigDecimal.ROUND_DOWN, 2); |
| | | mallGoods.setSubsidyAmount(subsidyAmount); |
| | | if (mallGoods.getHasCarriage() == 2) { |
| | | mallGoods.setCarriage(BigDecimal.ZERO); |
| | | } |
| | |
| | | if (mallGoods.getHasCarriage() == 2) { |
| | | mallGoods.setCarriage(BigDecimal.ZERO); |
| | | } |
| | | //根据商品原价获取商品星级 |
| | | String originalPrice = mallGoods.getOriginalPrice(); |
| | | String starRating = StarRatingEnum.NORMAL.belongStarRating(originalPrice); |
| | | mallGoods.setStarRating(starRating); |
| | | //根据商品原价获取商品补贴金额 |
| | | DataDictionaryCustom subsidyPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.SUBSIDY_PERCENT.getType() |
| | | , DataDictionaryEnum.SUBSIDY_PERCENT.getCode()); |
| | | BigDecimal subsidyPercent = new BigDecimal(subsidyPercentDic.getValue()).multiply(new BigDecimal(0.01)).setScale(BigDecimal.ROUND_DOWN,2); |
| | | BigDecimal subsidyAmount = subsidyPercent.multiply(new BigDecimal(originalPrice)).setScale(BigDecimal.ROUND_DOWN, 2); |
| | | mallGoods.setSubsidyAmount(subsidyAmount); |
| | | |
| | | mallGoodsMapper.updateById(mallGoods); |
| | | |