|
@@ -42,6 +42,7 @@ import com.fs.sop.vo.SopUserLogsVo;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
import com.fs.voice.utils.StringUtil;
|
|
import com.fs.voice.utils.StringUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.retry.annotation.Backoff;
|
|
import org.springframework.retry.annotation.Backoff;
|
|
@@ -63,6 +64,7 @@ import java.util.*;
|
|
|
import java.util.concurrent.*;
|
|
import java.util.concurrent.*;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
|
|
import static com.fs.course.utils.LinkUtil.generateRandomStringWithLock;
|
|
import static com.fs.course.utils.LinkUtil.generateRandomStringWithLock;
|
|
|
|
|
|
|
@@ -573,8 +575,19 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ List<SopParam> paramList = ruleTimeVO.getSkipSopJson() == null ? new ArrayList<>() : JSON.parseArray(ruleTimeVO.getSkipSopJson(), SopParam.class);
|
|
|
|
|
+ List<SopParam> dayList = paramList.stream().filter(e -> e.getDayNum() != null && e.getStartDate() == null && e.getEndDate() == null).collect(Collectors.toList());
|
|
|
|
|
+ List<SopParam> timeList = paramList.stream().filter(e -> e.getDayNum() != null && e.getStartDate() != null && e.getEndDate() != null).collect(Collectors.toList());
|
|
|
|
|
+ Map<String, List<SopParam>> timeMap = PubFun.listToMapByGroupList(timeList, e -> e.getDayNum());
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(dayList)) {
|
|
|
|
|
+ for (SopParam sopParam : dayList) {
|
|
|
|
|
+ String dayNum = sopParam.getDayNum();
|
|
|
|
|
+ if (day == Long.valueOf(dayNum)) {
|
|
|
|
|
+ log.info("跳过当前sop任务,任务id:{},跳过第:{}天", ruleTimeVO.getId(), dayNum);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
// 只有整倍数才做事
|
|
// 只有整倍数才做事
|
|
|
if (daysBetween % tempGap != 0) {
|
|
if (daysBetween % tempGap != 0) {
|
|
|
log.error("天数差 {} 不是 tempGap {} 的整数倍,跳过操作,SopId {} ", daysBetween, tempGap,logVo.getSopId());
|
|
log.error("天数差 {} 不是 tempGap {} 的整数倍,跳过操作,SopId {} ", daysBetween, tempGap,logVo.getSopId());
|
|
@@ -588,6 +601,18 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
|
|
|
LocalTime elementLocalTime = LocalTime.parse(content.getTime());
|
|
LocalTime elementLocalTime = LocalTime.parse(content.getTime());
|
|
|
LocalDateTime elementDateTime = LocalDateTime.of(currentTime.toLocalDate(), elementLocalTime);
|
|
LocalDateTime elementDateTime = LocalDateTime.of(currentTime.toLocalDate(), elementLocalTime);
|
|
|
|
|
|
|
|
|
|
+ List<SopParam> dayTimeList = timeMap.get(day + "");
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(dayTimeList)) {
|
|
|
|
|
+ for (SopParam sopParam : dayTimeList) {
|
|
|
|
|
+ LocalTime start = LocalTime.parse(sopParam.getStartDate());
|
|
|
|
|
+ LocalTime end = LocalTime.parse(sopParam.getEndDate());
|
|
|
|
|
+ if (elementLocalTime.isAfter(start) && elementLocalTime.isBefore(end)) {
|
|
|
|
|
+ log.info("跳过当前sop任务,任务id:{},跳过时间段:{}-{}", ruleTimeVO.getId(), start, end);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 动态调整 elementDateTime 的日期
|
|
// 动态调整 elementDateTime 的日期
|
|
|
if (elementLocalTime.isBefore(currentTime.toLocalTime())) {
|
|
if (elementLocalTime.isBefore(currentTime.toLocalTime())) {
|
|
|
elementDateTime = elementDateTime.plusDays(1);
|
|
elementDateTime = elementDateTime.plusDays(1);
|