|
|
|
@@ -4,6 +4,8 @@ import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.WxCouponChannel; |
|
|
|
import com.iformall.domain.vo.WxCouponCVo; |
|
|
|
import com.iformall.enums.EnumCouponChannelActivityStatus; |
|
|
|
import com.iformall.enums.EnumCouponChannelType; |
|
|
|
import com.iformall.service.WxCouponChannelService; |
|
|
|
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
@@ -18,6 +20,8 @@ import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
@RestController |
|
|
|
@RequestMapping("/api/wxCoupon") |
|
|
|
@Api(description = "券类型相关接口") |
|
|
|
@@ -48,6 +52,19 @@ public class WxCouponController extends BaseController { |
|
|
|
if (wxCouponCVo == null) |
|
|
|
return new ResultData(ErrorCode.COUPON_IS_EMPTY); |
|
|
|
|
|
|
|
if (wxCouponCVo.getTargetAd()!= null && |
|
|
|
wxCouponCVo.getTargetAd().equals(EnumCouponChannelType.COUPON_CHANNEL_ID_TIMED.getCode())) { |
|
|
|
Date now = new Date(); |
|
|
|
|
|
|
|
if (wxCouponCVo.getBeginTime().getTime() > now.getTime()) { |
|
|
|
wxCouponCVo.setActivityStatus(EnumCouponChannelActivityStatus.PREPARED.getCode()); |
|
|
|
} else if (wxCouponCVo.getEndTime().getTime() < now.getTime()) { |
|
|
|
wxCouponCVo.setActivityStatus(EnumCouponChannelActivityStatus.ENDED.getCode()); |
|
|
|
} else { |
|
|
|
wxCouponCVo.setActivityStatus(EnumCouponChannelActivityStatus.STARTED.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return new ResultData(wxCouponCVo); |
|
|
|
|
|
|
|
} |
|
|
|
|