|
|
@@ -20,9 +20,11 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.io.IOException; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalTime; |
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
import java.time.temporal.TemporalAdjusters; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
@@ -137,13 +139,27 @@ public class AflSmsSendImpl implements AflSmsSendManager { |
|
|
|
} |
|
|
|
if (byAgentId.getIsEnabled() == 1&&isWithinTimeRange(byAgentId.getSendTimeStart(), byAgentId.getSendTimeEnd())) { |
|
|
|
if (byAgentId.getType() == 1) { |
|
|
|
List<AflSmsRecord> byCountDay = aflSmsRecordRepo.findByCountDay(paccountPay.getVehicleId()); |
|
|
|
// 获取当天开始时间 |
|
|
|
LocalDateTime startOfDay = LocalDate.now().atStartOfDay(); |
|
|
|
System.out.println("当天开始时间:" + startOfDay); |
|
|
|
|
|
|
|
// 获取当天结束时间 |
|
|
|
LocalDateTime endOfDay = LocalDate.now().atTime(LocalTime.MAX); |
|
|
|
System.out.println("当天结束时间:" + endOfDay); |
|
|
|
List<AflSmsRecord> byCountDay = aflSmsRecordRepo.findByCountDay(paccountPay.getVehicleId(),startOfDay,endOfDay); |
|
|
|
if (byCountDay.size() >= byAgentId.getMaxCountPerDay()) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (byAgentId.getType() == 2) { |
|
|
|
List<AflSmsRecord> byCountMonth = aflSmsRecordRepo.findByCountMonth(paccountPay.getVehicleId()); |
|
|
|
// 获取当月的第一天 |
|
|
|
LocalDateTime firstDayOfMonth = LocalDate.now().with(TemporalAdjusters.firstDayOfMonth()).atStartOfDay(); |
|
|
|
System.out.println("当月的第一天:" + firstDayOfMonth); |
|
|
|
|
|
|
|
// 获取当月的最后一天 |
|
|
|
LocalDateTime lastDayOfMonth = LocalDate.now().with(TemporalAdjusters.lastDayOfMonth()).atTime(LocalTime.MAX); |
|
|
|
System.out.println("当月的最后一天:" + lastDayOfMonth); |
|
|
|
List<AflSmsRecord> byCountMonth = aflSmsRecordRepo.findByCountMonth(paccountPay.getVehicleId(),firstDayOfMonth,lastDayOfMonth); |
|
|
|
if (byCountMonth.size() >= byAgentId.getMaxCountPerMonth()) { |
|
|
|
return false; |
|
|
|
} |