Commit be630f9c authored by tianyiming's avatar tianyiming

初始化统计表修改异步

parent 313976ad
......@@ -108,6 +108,7 @@ import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Function;
......@@ -736,11 +737,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
s = s.replace("-","");
createNeedTime(P_STATIC_DAY,DB,P_STATIC_DAY+"_"+s);
List<StaticDay> staticDay = planTaskMapper.findStaticDay();
for (StaticDay st : staticDay
) {
planTaskMapper.insertAll( P_STATIC_DAY+"_"+s,st);
}
Iterable join = CompletableFuture.supplyAsync(() -> repositoryTs.batchSave(staticDay)).join();
if(!ValidationUtil.isEmpty(join)){
planTaskMapper.deleteDate(P_STATIC_DAY);
}
} catch (ParseException e) {
e.printStackTrace();
}
......@@ -750,11 +750,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
String s = DateUtils.dateFormat(oldDate, DateUtils.YEAR_PATTERN);
createNeedTime(P_STATIC_WEEK,DB,P_STATIC_WEEK+"_"+s);
List<StaticDay> staticWeeks = planTaskMapper.findStaticWeek();
for (StaticDay st : staticWeeks
) {
planTaskMapper.insertAll( P_STATIC_WEEK+"_"+s,st);
}
Iterable join = CompletableFuture.supplyAsync(() -> repositoryTs.batchSave(staticWeeks)).join();
if (!ValidationUtil.isEmpty(join)) {
planTaskMapper.deleteDate(P_STATIC_WEEK);
}
} catch (ParseException e) {
e.printStackTrace();
}
......
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