|
|
@@ -3,6 +3,7 @@ package com.iformall.service.impl; |
|
|
import com.iformall.common.ErrorCode; |
|
|
import com.iformall.common.ErrorCode; |
|
|
import com.iformall.common.IdWorker; |
|
|
import com.iformall.common.IdWorker; |
|
|
import com.iformall.domain.po.PushLimit; |
|
|
import com.iformall.domain.po.PushLimit; |
|
|
|
|
|
import com.iformall.enums.EnumEnableType; |
|
|
import com.iformall.exception.MallinkException; |
|
|
import com.iformall.exception.MallinkException; |
|
|
import com.iformall.mapper.PushLimitMapper; |
|
|
import com.iformall.mapper.PushLimitMapper; |
|
|
import com.iformall.mapper.WxCouponActionLogMapper; |
|
|
import com.iformall.mapper.WxCouponActionLogMapper; |
|
|
@@ -62,6 +63,7 @@ public class PushLimitServiceImpl implements PushLimitService { |
|
|
pushLimit.setCouponDay(10); |
|
|
pushLimit.setCouponDay(10); |
|
|
pushLimit.setTimeStart("8:00"); |
|
|
pushLimit.setTimeStart("8:00"); |
|
|
pushLimit.setTimeEnd("23:00"); |
|
|
pushLimit.setTimeEnd("23:00"); |
|
|
|
|
|
pushLimit.setEnable(EnumEnableType.Enable.getCode()); |
|
|
Date curDate = new Date(); |
|
|
Date curDate = new Date(); |
|
|
pushLimit.setCreateTime(curDate); |
|
|
pushLimit.setCreateTime(curDate); |
|
|
pushLimit.setUpdateTime(curDate); |
|
|
pushLimit.setUpdateTime(curDate); |
|
|
@@ -92,6 +94,10 @@ public class PushLimitServiceImpl implements PushLimitService { |
|
|
Date curDate = new Date(); |
|
|
Date curDate = new Date(); |
|
|
// 1. get tenant limit |
|
|
// 1. get tenant limit |
|
|
PushLimit pushLimit = getPushLimit(tenantId); |
|
|
PushLimit pushLimit = getPushLimit(tenantId); |
|
|
|
|
|
// 1.1 疲劳度是否启用 |
|
|
|
|
|
if(pushLimit.getEnable().equals(EnumEnableType.Disable.getCode())) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
// 2. check time |
|
|
// 2. check time |
|
|
boolean isInDate = DateUtils.isInDate(curDate, pushLimit.getTimeStart(), pushLimit.getTimeEnd()); |
|
|
boolean isInDate = DateUtils.isInDate(curDate, pushLimit.getTimeStart(), pushLimit.getTimeEnd()); |
|
|
if (!isInDate) { |
|
|
if (!isInDate) { |
|
|
@@ -106,6 +112,10 @@ public class PushLimitServiceImpl implements PushLimitService { |
|
|
Date curDate = new Date(); |
|
|
Date curDate = new Date(); |
|
|
// 1. get tenant limit |
|
|
// 1. get tenant limit |
|
|
PushLimit pushLimit = getPushLimit(tenantId); |
|
|
PushLimit pushLimit = getPushLimit(tenantId); |
|
|
|
|
|
// 1.1 疲劳度是否启用 |
|
|
|
|
|
if(pushLimit.getEnable().equals(EnumEnableType.Disable.getCode())) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
// 2. check time |
|
|
// 2. check time |
|
|
boolean isInDate = DateUtils.isInDate(curDate, pushLimit.getTimeStart(), pushLimit.getTimeEnd()); |
|
|
boolean isInDate = DateUtils.isInDate(curDate, pushLimit.getTimeStart(), pushLimit.getTimeEnd()); |
|
|
if (!isInDate) { |
|
|
if (!isInDate) { |
|
|
@@ -121,6 +131,10 @@ public class PushLimitServiceImpl implements PushLimitService { |
|
|
Date curDate = new Date(); |
|
|
Date curDate = new Date(); |
|
|
// 1. get tenant limit |
|
|
// 1. get tenant limit |
|
|
PushLimit pushLimit = getPushLimit(tenantId); |
|
|
PushLimit pushLimit = getPushLimit(tenantId); |
|
|
|
|
|
// 1.1 疲劳度是否启用 |
|
|
|
|
|
if(pushLimit.getEnable().equals(EnumEnableType.Disable.getCode())) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
// 2. check time 是否在给定的时间段内 |
|
|
// 2. check time 是否在给定的时间段内 |
|
|
boolean isInDate = DateUtils.isInDate(curDate, pushLimit.getTimeStart(), pushLimit.getTimeEnd()); |
|
|
boolean isInDate = DateUtils.isInDate(curDate, pushLimit.getTimeStart(), pushLimit.getTimeEnd()); |
|
|
if (!isInDate) { |
|
|
if (!isInDate) { |
|
|
|