|
@@ -1,19 +1,25 @@
|
|
package com.zhentao.service.impl;
|
|
package com.zhentao.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
-import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
|
+import com.baomidou.mybatisplus.extension.api.IErrorCode;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.zhentao.common.constant.BestConstants;
|
|
import com.zhentao.common.entity.R;
|
|
import com.zhentao.common.entity.R;
|
|
|
|
+import com.zhentao.common.exception.ApiException;
|
|
|
|
+import com.zhentao.common.exception.RRException;
|
|
import com.zhentao.dto.CouponDto;
|
|
import com.zhentao.dto.CouponDto;
|
|
import com.zhentao.pojo.Coupon;
|
|
import com.zhentao.pojo.Coupon;
|
|
import com.zhentao.service.CouponService;
|
|
import com.zhentao.service.CouponService;
|
|
import com.zhentao.mapper.CouponMapper;
|
|
import com.zhentao.mapper.CouponMapper;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.util.Date;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @author H
|
|
* @author H
|
|
* @description 针对表【coupon(营销优惠券)】的数据库操作Service实现
|
|
* @description 针对表【coupon(营销优惠券)】的数据库操作Service实现
|
|
-* @createDate 2025-05-08 10:51:35
|
|
|
|
|
|
+* @createDate 2025-05-08 16:51:42
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon>
|
|
public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon>
|
|
@@ -21,9 +27,22 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon>
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public R add(CouponDto couponDto) {
|
|
public R add(CouponDto couponDto) {
|
|
- Coupon coupon = new Coupon();
|
|
|
|
- BeanUtil.copyProperties(couponDto, coupon);
|
|
|
|
- return null;
|
|
|
|
|
|
+ if (couponDto==null || StringUtils.checkValNull(couponDto.getTacticsType())
|
|
|
|
+ || StringUtils.checkValNull(couponDto.getName())
|
|
|
|
+ || StringUtils.checkValNull(couponDto.getGetWay())
|
|
|
|
+ || StringUtils.checkValNull(couponDto.getProductType())
|
|
|
|
+ || StringUtils.checkValNull(couponDto.getLimitMinFlag())
|
|
|
|
+ || StringUtils.checkValNull(couponDto.getValidFlag())
|
|
|
|
+ || StringUtils.checkValNull(couponDto.getGetTimeLimit())
|
|
|
|
+ || StringUtils.checkValNull(couponDto.getTotalLimit())) {
|
|
|
|
+ throw new RRException(BestConstants.PARAMS_ERROR_MSG);
|
|
|
|
+ }else {
|
|
|
|
+ Coupon coupon=new Coupon();
|
|
|
|
+ BeanUtil.copyProperties(couponDto,coupon);
|
|
|
|
+ coupon.setCreateddTime(new Date());
|
|
|
|
+ boolean save = this.save(coupon);
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|