Commit 889c002c authored by tianyiming's avatar tianyiming

更新索引--涉及任务下发、定时器修改、任务执行

parent bd4b5234
......@@ -9,6 +9,7 @@ public interface RepositoryTs {
// 批量更新的方法
<S> Iterable<S> batchUpdate(Iterable<S> var1);
<S> Iterable<S> batchSaveNoAsync(Iterable<S> var1);
}
......@@ -966,7 +966,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
log.error("计划重做开始添加定时任务监控========");
jobService.planTaskAddJob(planTask);
Iterable<PlanTaskDetail> planTaskDetails = repositoryTs.batchSave(planTaskDetailListSync);
Iterable<PlanTaskDetail> planTaskDetails = repositoryTs.batchSaveNoAsync(planTaskDetailListSync);
// 3.如果为自动任务调用,则更新id,如果重做或且下次时间大于等于明天,则更新planTaskId到plan表
Date genDate = DateUtil.str2Date(list.get(list.size() - 1).get("NEXT_GEN_DATE").toString(), "yyyy-MM-dd");//下次生成日期
......
......@@ -23,7 +23,7 @@ public class RepositoryTImpl implements RepositoryTs {
@Override
@Transactional
// @Async("asyncServiceExecutor")
@Async("asyncServiceExecutor")
public <S> Iterable<S> batchSave(Iterable<S> var1) {
Iterator<S> iterator = var1.iterator();
int index = 0;
......@@ -60,4 +60,23 @@ public class RepositoryTImpl implements RepositoryTs {
}
return var1;
}
@Override
public <S> Iterable<S> batchSaveNoAsync(Iterable<S> var1) {
Iterator<S> iterator = var1.iterator();
int index = 0;
while (iterator.hasNext()){
em.persist(iterator.next());
index++;
if (index % BATCH_SIZE == 0){
em.flush();
em.clear();
}
}
if (index % BATCH_SIZE != 0){
em.flush();
em.clear();
}
return var1;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment