fix:需求单下推提示未勾选工单号
This commit is contained in:
@@ -321,10 +321,23 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
||||
.distinct()
|
||||
.collect(Collectors.toList()))
|
||||
.ne(PmDemand::getIs_deleted, 1));
|
||||
if (pmDemandDtos.size() < allWorkDemand.size()){
|
||||
String collect = allWorkDemand.stream().map(PmDemand::getWork_order)
|
||||
.filter(workOrder -> pmDemandDtos.stream().noneMatch(i -> !Objects.equals(i.getWorkOrder(), workOrder)))
|
||||
.collect(Collectors.joining(","));
|
||||
if (pmDemandDtos.size() < allWorkDemand.size()) {
|
||||
// 统计 allWorkDemand 中每个工单的数量
|
||||
Map<String, Long> sourceCountMap = allWorkDemand.stream()
|
||||
.collect(Collectors.groupingBy(PmDemand::getWork_order, Collectors.counting()));
|
||||
|
||||
// 统计 pmDemandDtos 中每个工单的数量
|
||||
Map<String, Long> targetCountMap = pmDemandDtos.stream()
|
||||
.collect(Collectors.groupingBy(PmDemandDto::getWorkOrder, Collectors.counting()));
|
||||
|
||||
// 找出数量不一致的工单
|
||||
String collect = sourceCountMap.entrySet().stream()
|
||||
.filter(entry -> {
|
||||
Long targetCount = targetCountMap.getOrDefault(entry.getKey(), 0L);
|
||||
return !entry.getValue().equals(targetCount);
|
||||
})
|
||||
.map(Map.Entry::getKey)
|
||||
.collect(Collectors.joining(",\n"));
|
||||
throw new BadRequestException("存在未勾选完全的工单" + collect);
|
||||
}
|
||||
// 一次性分成两组
|
||||
|
||||
Reference in New Issue
Block a user