|
@@ -104,7 +104,7 @@ public class DataCollectTask {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- @Scheduled(cron = "0 52 10 * * ?")
|
|
|
|
|
|
+ @Scheduled(cron = "0 0 1 * * ?")
|
|
@Async
|
|
@Async
|
|
public void sqlServerTask() {
|
|
public void sqlServerTask() {
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
@@ -223,27 +223,29 @@ public class DataCollectTask {
|
|
User tmp = userMap.get(userFvTime.getUserId());
|
|
User tmp = userMap.get(userFvTime.getUserId());
|
|
userFvTime.setUserId(null==tmp?null:tmp.getId());
|
|
userFvTime.setUserId(null==tmp?null:tmp.getId());
|
|
}
|
|
}
|
|
- List<String> collect = dataList.stream().map(UserFvTime::getProcinstId).distinct().collect(Collectors.toList());
|
|
|
|
- List<String> existIds = userFvTimeMapper.getExistIds(collect,specialCompanyId);
|
|
|
|
- if(!CollectionUtils.isEmpty(existIds)){
|
|
|
|
- toUpdateList.addAll(dataList.stream().filter(t -> existIds.contains(t.getProcinstId())).collect(Collectors.toList()));
|
|
|
|
- toAddList.addAll(dataList.stream().filter(t -> !existIds.contains(t.getProcinstId())).collect(Collectors.toList()));
|
|
|
|
- }else{
|
|
|
|
- toAddList.addAll(dataList);
|
|
|
|
- }
|
|
|
|
- if(!CollectionUtils.isEmpty(toAddList)){
|
|
|
|
- userFvTimeMapper.batchInsertCollect(toAddList);
|
|
|
|
- }
|
|
|
|
- if(!CollectionUtils.isEmpty(toUpdateList)){
|
|
|
|
- for (UserFvTime tmp : toUpdateList) {
|
|
|
|
- userFvTimeMapper.updateById(tmp);
|
|
|
|
|
|
+ List<UserFvTime> realDataList = dataList.stream().filter(t -> null != t.getUserId()).collect(Collectors.toList());
|
|
|
|
+ if(!CollectionUtils.isEmpty(realDataList)){
|
|
|
|
+ List<String> collect = dataList.stream().map(UserFvTime::getProcinstId).distinct().collect(Collectors.toList());
|
|
|
|
+ List<String> existIds = userFvTimeMapper.getExistIds(collect,specialCompanyId);
|
|
|
|
+ if(!CollectionUtils.isEmpty(existIds)){
|
|
|
|
+ toUpdateList.addAll(dataList.stream().filter(t -> existIds.contains(t.getProcinstId())).collect(Collectors.toList()));
|
|
|
|
+ toAddList.addAll(dataList.stream().filter(t -> !existIds.contains(t.getProcinstId())).collect(Collectors.toList()));
|
|
|
|
+ }else{
|
|
|
|
+ toAddList.addAll(dataList);
|
|
|
|
+ }
|
|
|
|
+ if(!CollectionUtils.isEmpty(toAddList)){
|
|
|
|
+ userFvTimeMapper.batchInsertCollect(toAddList);
|
|
|
|
+ }
|
|
|
|
+ if(!CollectionUtils.isEmpty(toUpdateList)){
|
|
|
|
+ for (UserFvTime tmp : toUpdateList) {
|
|
|
|
+ userFvTimeMapper.updateById(tmp);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- toUpdateList.clear();
|
|
|
|
- toAddList.clear();
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
+ toUpdateList.clear();
|
|
|
|
+ toAddList.clear();
|
|
offset += pageSize;
|
|
offset += pageSize;
|
|
}
|
|
}
|
|
}
|
|
}
|