mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-01-31 09:30:05 +08:00
【功能】完成满减送关闭的功能
This commit is contained in:
parent
9805f9f512
commit
e47b3f0aab
@ -0,0 +1,33 @@
|
|||||||
|
package cn.iocoder.yudao.module.promotion.convert.reward;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.promotion.api.reward.dto.RewardActivityMatchRespDTO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.controller.admin.reward.vo.RewardActivityCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.controller.admin.reward.vo.RewardActivityRespVO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.controller.admin.reward.vo.RewardActivityUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.reward.RewardActivityDO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 满减送活动 Convert
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface RewardActivityConvert {
|
||||||
|
|
||||||
|
RewardActivityConvert INSTANCE = Mappers.getMapper(RewardActivityConvert.class);
|
||||||
|
|
||||||
|
RewardActivityDO convert(RewardActivityCreateReqVO bean);
|
||||||
|
|
||||||
|
RewardActivityDO convert(RewardActivityUpdateReqVO bean);
|
||||||
|
|
||||||
|
RewardActivityRespVO convert(RewardActivityDO bean);
|
||||||
|
|
||||||
|
PageResult<RewardActivityRespVO> convertPage(PageResult<RewardActivityDO> page);
|
||||||
|
|
||||||
|
List<RewardActivityMatchRespDTO> convertList(List<RewardActivityDO> rewardActivityBySpuIdsAndStatusAndDateTimeLt);
|
||||||
|
}
|
@ -11,8 +11,10 @@ import cn.iocoder.yudao.module.promotion.controller.admin.reward.vo.RewardActivi
|
|||||||
import cn.iocoder.yudao.module.promotion.controller.admin.reward.vo.RewardActivityCreateReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.reward.vo.RewardActivityCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.reward.vo.RewardActivityPageReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.reward.vo.RewardActivityPageReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.reward.vo.RewardActivityUpdateReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.reward.vo.RewardActivityUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.convert.reward.RewardActivityConvert;
|
||||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.reward.RewardActivityDO;
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.reward.RewardActivityDO;
|
||||||
import cn.iocoder.yudao.module.promotion.dal.mysql.reward.RewardActivityMapper;
|
import cn.iocoder.yudao.module.promotion.dal.mysql.reward.RewardActivityMapper;
|
||||||
|
import cn.iocoder.yudao.module.promotion.enums.common.PromotionActivityStatusEnum;
|
||||||
import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum;
|
import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum;
|
||||||
import cn.iocoder.yudao.module.promotion.util.PromotionUtils;
|
import cn.iocoder.yudao.module.promotion.util.PromotionUtils;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
@ -52,9 +54,13 @@ public class RewardActivityServiceImpl implements RewardActivityService {
|
|||||||
// 1.2 校验商品是否冲突
|
// 1.2 校验商品是否冲突
|
||||||
validateRewardActivitySpuConflicts(null, createReqVO);
|
validateRewardActivitySpuConflicts(null, createReqVO);
|
||||||
|
|
||||||
// 2. 插入
|
// 插入
|
||||||
RewardActivityDO rewardActivity = BeanUtils.toBean(createReqVO, RewardActivityDO.class)
|
RewardActivityDO rewardActivity = RewardActivityConvert.INSTANCE.convert(createReqVO)
|
||||||
.setStatus(PromotionUtils.calculateActivityStatus(createReqVO.getEndTime()));
|
.setStatus(
|
||||||
|
PromotionUtils.calculateActivityStatus(createReqVO.getEndTime()).equals(CommonStatusEnum.DISABLE.getStatus())?
|
||||||
|
PromotionActivityStatusEnum.WAIT.getStatus():
|
||||||
|
PromotionActivityStatusEnum.RUN.getStatus()
|
||||||
|
);
|
||||||
rewardActivityMapper.insert(rewardActivity);
|
rewardActivityMapper.insert(rewardActivity);
|
||||||
// 返回
|
// 返回
|
||||||
return rewardActivity.getId();
|
return rewardActivity.getId();
|
||||||
|
Loading…
Reference in New Issue
Block a user