|
|
@@ -463,6 +463,13 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ // 获取模板中配置的最大天数,防止超出范围后循环发送
|
|
|
+ Integer maxDayNum = tempSettings.stream()
|
|
|
+ .map(QwSopTempRules::getDayNum)
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .max(Integer::compareTo)
|
|
|
+ .orElse(0);
|
|
|
+
|
|
|
int intervalDay = (int) (daysBetween / tempGap);
|
|
|
if (intervalDay < 0 || intervalDay >= tempSettings.size()) {
|
|
|
log.info("用户日志 {} 的 intervalDay {} 超出 TempSettings 范围,跳过处理。", logVo.getId(), intervalDay);
|
|
|
@@ -474,6 +481,13 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
}else{
|
|
|
day++;
|
|
|
}
|
|
|
+
|
|
|
+ // 如果当前天数超过模板配置的最大天数,则跳过处理
|
|
|
+ if (day > maxDayNum) {
|
|
|
+ log.info("用户日志 {} 的 day {} 超出模板最大天数 {},营期已结束,跳过处理。", logVo.getId(), day, maxDayNum);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
List<QwSopTempSetting.Content> contents = getDay(tempSettings, day);
|
|
|
if (contents == null || contents.isEmpty()) {
|
|
|
log.error("SOP ID {} 的 TempSetting 内容为空,跳过处理。天数 {}", logVo.getSopId(),day);
|
|
|
@@ -541,7 +555,13 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
// return;
|
|
|
// }
|
|
|
|
|
|
- // 重新拿新的 “天” 的 Setting
|
|
|
+ // 如果跨天后的天数超过模板配置的最大天数,则跳过处理
|
|
|
+ if (day > maxDayNum) {
|
|
|
+ log.info("跨天后,用户日志 {} 的 day {} 超出模板最大天数 {},营期已结束,跳过处理。", logVo.getId(), day, maxDayNum);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 重新拿新的 "天" 的 Setting
|
|
|
contents = getDay(tempSettings, day);
|
|
|
if (contents == null || contents.isEmpty()) {
|
|
|
log.error("跨天-SOP ID {} 的 TempSetting 内容为空,跳过处理。", logVo.getSopId());
|