|
@@ -184,34 +184,6 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
|
|
|
public BilletHotsendDetails findBilletHotsendDetails(StorageBill storageBill) {
|
|
|
BilletHotsendDetails result = new BilletHotsendDetails();
|
|
|
|
|
|
- LambdaQueryWrapper<BilletAutoTmp> tmpQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- List<BilletAutoTmp> billetAutoTmpArrayList = billetAutoTmpService.list(tmpQueryWrapper);
|
|
|
-
|
|
|
- // 一次性查询所有 `BilletBasicInfo`,避免循环查询
|
|
|
- Set<String> allBilletNos = billetAutoTmpArrayList.stream()
|
|
|
- .map(BilletAutoTmp::getBilletNo)
|
|
|
- .filter(Objects::nonNull)
|
|
|
- .flatMap(billetNo -> Arrays.stream(billetNo.split(","))) // 按逗号分割
|
|
|
- .map(String::trim) // 去除可能的空格
|
|
|
- .filter(bn -> !bn.isEmpty()) // 过滤空字符串
|
|
|
- .collect(Collectors.toSet());
|
|
|
-
|
|
|
- Map<String, String> billetToAssemblyMap = new HashMap<>();
|
|
|
- if (CollectionUtils.isNotEmpty(allBilletNos)) {
|
|
|
- LambdaQueryWrapper<BilletBasicInfo> billetBasicQuery = new LambdaQueryWrapper<>();
|
|
|
- billetBasicQuery.in(BilletBasicInfo::getBilletNo, allBilletNos);
|
|
|
- List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(billetBasicQuery);
|
|
|
-
|
|
|
- // 构建 `billetNo -> assemblyNumber` 映射
|
|
|
- billetToAssemblyMap = billetBasicInfoList.stream()
|
|
|
- .collect(Collectors.toMap(
|
|
|
- BilletBasicInfo::getBilletNo,
|
|
|
- BilletBasicInfo::getAssemblyNumber,
|
|
|
- (existing, replacement) -> existing // 遇到重复 billetNo,保留第一个
|
|
|
- ));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
List<String> idList = Arrays.stream(storageBill.getId().split(","))
|
|
|
.collect(Collectors.toList());
|
|
|
if (oConvertUtils.listIsEmpty(idList)){
|
|
@@ -235,26 +207,6 @@ public class StorageBillServiceImpl extends ServiceImpl<StorageBillMapper, Stora
|
|
|
rollClubTwoDetailsList.add(rollClubTwoDetails);
|
|
|
});
|
|
|
|
|
|
- // 遍历 RollClubTwoDetails 并设置 assemblyNumber
|
|
|
- for (RollClubTwoDetails rollClubTwoDetails : rollClubTwoDetailsList) {
|
|
|
- String billetNo = rollClubTwoDetails.getBilletNo();
|
|
|
- if (StringUtils.isNotBlank(billetNo)) {
|
|
|
-
|
|
|
- String assemblyNumber = Arrays.stream(rollClubTwoDetails.getBilletNo().split(",")) // 按逗号分割
|
|
|
- .map(String::trim) // 去除前后空格
|
|
|
- .filter(bn -> !bn.isEmpty()) // 过滤空字符串
|
|
|
- .map(billetToAssemblyMap::get) // 映射到 AssemblyNumber
|
|
|
- .filter(Objects::nonNull) // 过滤 null
|
|
|
- .distinct() // 去重
|
|
|
- .collect(Collectors.joining(","));
|
|
|
-
|
|
|
- if (StringUtils.isNotBlank(assemblyNumber)) {
|
|
|
- rollClubTwoDetails.setAssemblyNumber(StringUtils.isNotBlank(rollClubTwoDetails.getAssemblyNumber())
|
|
|
- ? rollClubTwoDetails.getAssemblyNumber() + "," + assemblyNumber
|
|
|
- : assemblyNumber);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
result.setRollClubTwoDetailsList(rollClubTwoDetailsList);
|
|
|
return result;
|
|
|
}
|