|
|
@ -61,7 +61,7 @@ public class EasBillSchedule { |
|
|
|
List<EasOutInBillDetail> srmOutInBillDetails = easOutInBillDetailMapper.selectSrmPageWithInventory(); |
|
|
|
if (CollectionUtils.isNotEmpty(easOutInBillDetails) || CollectionUtils.isNotEmpty(srmOutInBillDetails)) { |
|
|
|
// 查询已存在的单据
|
|
|
|
Set<String> existingIds = new HashSet<>(easOutInBillService.queryExistBills()); |
|
|
|
Set<String> existingIds = easOutInBillService.queryExistBills(); |
|
|
|
// 过滤出需要插入的新单据,并根据来源设置 ID
|
|
|
|
List<EasOutInBillDetail> insertEasBills = easOutInBillDetails.stream() |
|
|
|
.filter(bill -> !existingIds.contains(bill.getDjid())) |
|
|
@ -117,6 +117,32 @@ public class EasBillSchedule { |
|
|
|
//System.out.println("1task-首页及头部信息推送-sendHomeInfoTask-花费时间----------------------------------------------------------------****************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 定时删除源头已删除单据 |
|
|
|
*/ |
|
|
|
@Async("taskExecutor") |
|
|
|
@Scheduled(cron = "0/180 * * * * *") |
|
|
|
public void autoDeleteBill() { |
|
|
|
// 获取eas视图查询未提交的单据
|
|
|
|
Set<String> easIds = easOutInBillDetailMapper.selectEasIds(); |
|
|
|
// 获取srm视图查询未提交的单据
|
|
|
|
Set<String> srmIds = easOutInBillDetailMapper.selectSrmIds(); |
|
|
|
if (CollectionUtils.isNotEmpty(easIds) || CollectionUtils.isNotEmpty(srmIds)) { |
|
|
|
// 查询已存在的单据
|
|
|
|
Set<String> existingIds = easOutInBillService.queryLocalBills(); |
|
|
|
easIds.addAll(srmIds); |
|
|
|
// 需要删除的ID集合
|
|
|
|
Set<String> idsToDelete = existingIds.stream() |
|
|
|
.filter(r -> !easIds.contains(r)) |
|
|
|
.collect(Collectors.toSet()); |
|
|
|
if (CollectionUtils.isNotEmpty(idsToDelete)) { |
|
|
|
LambdaQueryWrapper<EasOutInBillDetail> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
queryWrapper.in(EasOutInBillDetail::getFlid, idsToDelete); |
|
|
|
easOutInBillDetailMapper.delete(queryWrapper); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 定时清空单据 |
|
|
|
*/ |
|
|
|