|
@@ -190,6 +190,7 @@ public class DataCollectTask {
|
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 0 1 * * ?")
|
|
|
+// @Scheduled(cron = "0 05 16 * * ?")
|
|
|
@Async
|
|
|
public void sqlServerTask() {
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
@@ -262,6 +263,7 @@ public class DataCollectTask {
|
|
|
}
|
|
|
|
|
|
@Scheduled(cron = "0 30 1 * * ?")
|
|
|
+//@Scheduled(cron = "0 33 16 * * ?")
|
|
|
public void workDayTask(){
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
String sumUrl = PREFIX_URL+"/dataCollect/getWorkDayDataSum";
|
|
@@ -305,18 +307,24 @@ public class DataCollectTask {
|
|
|
List<UserFvTime> dataList = listResponse.getBody();
|
|
|
if(org.apache.commons.collections.CollectionUtils.isNotEmpty(dataList)){
|
|
|
for (UserFvTime userFvTime : dataList) {
|
|
|
+ if(StringUtils.isBlank(userFvTime.getProcinstId())){
|
|
|
+ System.out.println(userFvTime);
|
|
|
+ }
|
|
|
User tmp = userMap.get(userFvTime.getUserId());
|
|
|
+ if(null == tmp){
|
|
|
+ System.out.println("缺失id=== "+userFvTime.getUserId()+",缺失名字=== "+userFvTime.getName());
|
|
|
+ }
|
|
|
userFvTime.setUserId(null==tmp?null:tmp.getId());
|
|
|
}
|
|
|
- List<UserFvTime> realDataList = dataList.stream().filter(t -> null != t.getUserId()).collect(Collectors.toList());
|
|
|
+ List<UserFvTime> realDataList = dataList.stream().filter(t -> StringUtils.isNotBlank(t.getUserId())).collect(Collectors.toList());
|
|
|
if(!CollectionUtils.isEmpty(realDataList)){
|
|
|
- List<String> collect = dataList.stream().map(UserFvTime::getProcinstId).distinct().collect(Collectors.toList());
|
|
|
+ List<String> collect = realDataList.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()));
|
|
|
+ toUpdateList.addAll(realDataList.stream().filter(t -> existIds.contains(t.getProcinstId())).collect(Collectors.toList()));
|
|
|
+ toAddList.addAll(realDataList.stream().filter(t -> !existIds.contains(t.getProcinstId())).collect(Collectors.toList()));
|
|
|
}else{
|
|
|
- toAddList.addAll(dataList);
|
|
|
+ toAddList.addAll(realDataList);
|
|
|
}
|
|
|
if(!CollectionUtils.isEmpty(toAddList)){
|
|
|
userFvTimeMapper.batchInsertCollect(toAddList);
|
|
@@ -342,6 +350,7 @@ public class DataCollectTask {
|
|
|
}
|
|
|
|
|
|
@Scheduled(cron = "0 0 2 * * ?")
|
|
|
+//@Scheduled(cron = "0 43 16 * * ?")
|
|
|
@Async
|
|
|
public void leaveSheetTask(){
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
@@ -390,23 +399,31 @@ public class DataCollectTask {
|
|
|
User opTmp = userMap.get(leaveSheet.getOperatorId());
|
|
|
leaveSheet.setOwnerId(null==ownerTmp?null:ownerTmp.getId());
|
|
|
leaveSheet.setOperatorId(null==opTmp?null:opTmp.getId());
|
|
|
+ if(null != ownerTmp && null == opTmp){
|
|
|
+ leaveSheet.setOperatorId(ownerTmp.getId());
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
- List<String> collect = dataList.stream().map(LeaveSheet::getProcinstId).distinct().collect(Collectors.toList());
|
|
|
- List<String> existIds = leaveSheetMapper.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)){
|
|
|
- leaveSheetMapper.batchInsert(toAddList);
|
|
|
- }
|
|
|
- if(!CollectionUtils.isEmpty(toUpdateList)){
|
|
|
- for (LeaveSheet tmp : toUpdateList) {
|
|
|
- leaveSheetMapper.updateById(tmp);
|
|
|
+ List<LeaveSheet> realDataList = dataList.stream().filter(t -> StringUtils.isNotBlank(t.getOwnerId())).collect(Collectors.toList());
|
|
|
+ if(!CollectionUtils.isEmpty(realDataList)){
|
|
|
+ List<String> collect = realDataList.stream().map(LeaveSheet::getProcinstId).distinct().collect(Collectors.toList());
|
|
|
+ List<String> existIds = leaveSheetMapper.getExistIds(collect,specialCompanyId);
|
|
|
+ if(!CollectionUtils.isEmpty(existIds)){
|
|
|
+ toUpdateList.addAll(realDataList.stream().filter(t -> existIds.contains(t.getProcinstId())).collect(Collectors.toList()));
|
|
|
+ toAddList.addAll(realDataList.stream().filter(t -> !existIds.contains(t.getProcinstId())).collect(Collectors.toList()));
|
|
|
+ }else{
|
|
|
+ toAddList.addAll(realDataList);
|
|
|
+ }
|
|
|
+ if(!CollectionUtils.isEmpty(toAddList)){
|
|
|
+ leaveSheetMapper.batchInsert(toAddList);
|
|
|
+ }
|
|
|
+ if(!CollectionUtils.isEmpty(toUpdateList)){
|
|
|
+ for (LeaveSheet tmp : toUpdateList) {
|
|
|
+ leaveSheetMapper.updateById(tmp);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
toUpdateList.clear();
|
|
|
toAddList.clear();
|
|
|
}
|
|
@@ -422,6 +439,7 @@ public class DataCollectTask {
|
|
|
}
|
|
|
|
|
|
@Scheduled(cron = "0 30 2 * * ?")
|
|
|
+//@Scheduled(cron = "0 46 16 * * ?")
|
|
|
@Async
|
|
|
public void sqlServerProjectTypeTask() {
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
@@ -505,6 +523,7 @@ public class DataCollectTask {
|
|
|
}
|
|
|
|
|
|
@Scheduled(cron = "0 0 3 * * ?")
|
|
|
+//@Scheduled(cron = "0 48 16 * * ?")
|
|
|
@Async
|
|
|
public void sqlServerProjectTask() {
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
@@ -655,6 +674,7 @@ public class DataCollectTask {
|
|
|
}
|
|
|
|
|
|
@Scheduled(cron = "0 30 3 * * ?")
|
|
|
+//@Scheduled(cron = "0 20 17 * * ?")
|
|
|
@Async
|
|
|
public void businessTripTask(){
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
@@ -704,32 +724,36 @@ public class DataCollectTask {
|
|
|
User ownerTmp = userMap.get(businessTrip.getOwnerId());
|
|
|
businessTrip.setOwnerId(null==ownerTmp?null:ownerTmp.getId());
|
|
|
}
|
|
|
- List<String> collect = dataList.stream().map(BusinessTrip::getProcinstId).distinct().collect(Collectors.toList());
|
|
|
- List<String> existIds = businessTripMapper.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)){
|
|
|
+ List<BusinessTrip> realDataList = dataList.stream().filter(t -> StringUtils.isNotBlank(t.getOwnerId())).collect(Collectors.toList());
|
|
|
+ if(!CollectionUtils.isEmpty(realDataList)){
|
|
|
+ List<String> collect = realDataList.stream().map(BusinessTrip::getProcinstId).distinct().collect(Collectors.toList());
|
|
|
+ List<String> existIds = businessTripMapper.getExistIds(collect,specialCompanyId);
|
|
|
+ if(!CollectionUtils.isEmpty(existIds)){
|
|
|
+ toUpdateList.addAll(realDataList.stream().filter(t -> existIds.contains(t.getProcinstId())).collect(Collectors.toList()));
|
|
|
+ toAddList.addAll(realDataList.stream().filter(t -> !existIds.contains(t.getProcinstId())).collect(Collectors.toList()));
|
|
|
+ }else{
|
|
|
+ toAddList.addAll(realDataList);
|
|
|
+ }
|
|
|
+ if(!CollectionUtils.isEmpty(toAddList)){
|
|
|
// businessTripMapper.batchInsert(toAddList);
|
|
|
- for (BusinessTrip businessTrip : toAddList) {
|
|
|
- businessTripMapper.insert(businessTrip);
|
|
|
- BustripProject bustripProject = new BustripProject();
|
|
|
- bustripProject.setBustripId(businessTrip.getId());
|
|
|
- Project project = projectCodeMap.get(businessTrip.getCCcxmNo());
|
|
|
- bustripProject.setProjectId(null == project?null:project.getId());
|
|
|
- bustripProject.setStartDate(businessTrip.getStartDate());
|
|
|
- bustripProject.setEndDate(businessTrip.getEndDate());
|
|
|
- bustripProjectMapper.insert(bustripProject);
|
|
|
+ for (BusinessTrip businessTrip : toAddList) {
|
|
|
+ businessTripMapper.insert(businessTrip);
|
|
|
+ BustripProject bustripProject = new BustripProject();
|
|
|
+ bustripProject.setBustripId(businessTrip.getId());
|
|
|
+ Project project = projectCodeMap.get(businessTrip.getCCcxmNo());
|
|
|
+ bustripProject.setProjectId(null == project?null:project.getId());
|
|
|
+ bustripProject.setStartDate(businessTrip.getStartDate());
|
|
|
+ bustripProject.setEndDate(businessTrip.getEndDate());
|
|
|
+ bustripProjectMapper.insert(bustripProject);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if(!CollectionUtils.isEmpty(toUpdateList)){
|
|
|
- for (BusinessTrip tmp : toUpdateList) {
|
|
|
- businessTripMapper.updateById(tmp);
|
|
|
+ if(!CollectionUtils.isEmpty(toUpdateList)){
|
|
|
+ for (BusinessTrip tmp : toUpdateList) {
|
|
|
+ businessTripMapper.updateById(tmp);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
toUpdateList.clear();
|
|
|
toAddList.clear();
|
|
|
}
|