|
@@ -1892,21 +1892,36 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
|
|
|
|
|
|
// 获取StrandNo等于1的所有定尺length,并去重后用逗号连接
|
|
|
heatsActualsInfo.setOneStrandNo(Math.toIntExact(strandCountMap.getOrDefault(1, 0L)));
|
|
|
- heatsActualsInfo.setOneLength(getUniqueLengthsByStrandNo(billetBasicInfoList, 1));
|
|
|
+ List<BilletBasicInfo> strandOneData =filterByStrandNo(billetBasicInfoList,1);
|
|
|
+ heatsActualsInfo.setOneLength(JSON.toJSONString(groupByLength(strandOneData)));
|
|
|
+
|
|
|
heatsActualsInfo.setTwoStrandNo(Math.toIntExact(strandCountMap.getOrDefault(2, 0L)));
|
|
|
- heatsActualsInfo.setTwoLength(getUniqueLengthsByStrandNo(billetBasicInfoList, 2));
|
|
|
+ List<BilletBasicInfo> strandTwoData =filterByStrandNo(billetBasicInfoList,2);
|
|
|
+ heatsActualsInfo.setTwoLength(JSON.toJSONString(groupByLength(strandTwoData)));
|
|
|
+
|
|
|
heatsActualsInfo.setThreeStrandNo(Math.toIntExact(strandCountMap.getOrDefault(3, 0L)));
|
|
|
- heatsActualsInfo.setThreeLength(getUniqueLengthsByStrandNo(billetBasicInfoList, 3));
|
|
|
+ List<BilletBasicInfo> strandThreeData =filterByStrandNo(billetBasicInfoList,3);
|
|
|
+ heatsActualsInfo.setThreeLength(JSON.toJSONString(groupByLength(strandThreeData)));
|
|
|
+
|
|
|
heatsActualsInfo.setFourStrandNo(Math.toIntExact(strandCountMap.getOrDefault(4, 0L)));
|
|
|
- heatsActualsInfo.setFourLength(getUniqueLengthsByStrandNo(billetBasicInfoList, 4));
|
|
|
+ List<BilletBasicInfo> strandFourData =filterByStrandNo(billetBasicInfoList,4);
|
|
|
+ heatsActualsInfo.setFourLength(JSON.toJSONString(groupByLength(strandFourData)));
|
|
|
+
|
|
|
heatsActualsInfo.setFiveStrandNo(Math.toIntExact(strandCountMap.getOrDefault(5, 0L)));
|
|
|
- heatsActualsInfo.setFiveLength(getUniqueLengthsByStrandNo(billetBasicInfoList, 5));
|
|
|
+ List<BilletBasicInfo> strandFiveData =filterByStrandNo(billetBasicInfoList,5);
|
|
|
+ heatsActualsInfo.setFiveLength(JSON.toJSONString(groupByLength(strandFiveData)));
|
|
|
+
|
|
|
heatsActualsInfo.setSixStrandNo(Math.toIntExact(strandCountMap.getOrDefault(6, 0L)));
|
|
|
- heatsActualsInfo.setSixLength(getUniqueLengthsByStrandNo(billetBasicInfoList, 6));
|
|
|
+ List<BilletBasicInfo> strandSixData =filterByStrandNo(billetBasicInfoList,6);
|
|
|
+ heatsActualsInfo.setSixLength(JSON.toJSONString(groupByLength(strandSixData)));
|
|
|
+
|
|
|
heatsActualsInfo.setSevenStrandNo(Math.toIntExact(strandCountMap.getOrDefault(7, 0L)));
|
|
|
- heatsActualsInfo.setSevenLength(getUniqueLengthsByStrandNo(billetBasicInfoList, 7));
|
|
|
+ List<BilletBasicInfo> strandSevenData =filterByStrandNo(billetBasicInfoList,7);
|
|
|
+ heatsActualsInfo.setSevenLength(JSON.toJSONString(groupByLength(strandSevenData)));
|
|
|
+
|
|
|
heatsActualsInfo.setEightStrandNo(Math.toIntExact(strandCountMap.getOrDefault(8, 0L)));
|
|
|
- heatsActualsInfo.setEightLength(getUniqueLengthsByStrandNo(billetBasicInfoList, 8));
|
|
|
+ List<BilletBasicInfo> strandEightData =filterByStrandNo(billetBasicInfoList,8);
|
|
|
+ heatsActualsInfo.setEightLength(JSON.toJSONString(groupByLength(strandEightData)));
|
|
|
|
|
|
// 直轧过滤并计算
|
|
|
List<BilletBasicInfo> filterDirectRollingList = billetBasicInfoList.stream()
|
|
@@ -2073,22 +2088,37 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 从钢坯信息列表中筛选指定流号的定尺长度,去重后用逗号连接
|
|
|
+ * 筛选指定流号的数据
|
|
|
* @param billetList 钢坯信息列表
|
|
|
* @param strandNo 流号
|
|
|
- * @return 去重后的定尺长度字符串,用逗号分隔
|
|
|
+ * @return 指定流号的钢坯信息列表
|
|
|
*/
|
|
|
- private String getUniqueLengthsByStrandNo(List<BilletBasicInfo> billetList, Integer strandNo) {
|
|
|
+ private List<BilletBasicInfo> filterByStrandNo(List<BilletBasicInfo> billetList, Integer strandNo) {
|
|
|
if (CollectionUtils.isEmpty(billetList) || strandNo == null) {
|
|
|
- return "";
|
|
|
+ return Collections.emptyList();
|
|
|
}
|
|
|
+
|
|
|
return billetList.stream()
|
|
|
.filter(info -> info.getStrandNo() != null && info.getStrandNo().equals(strandNo))
|
|
|
- .map(BilletBasicInfo::getLength)
|
|
|
- .filter(Objects::nonNull)
|
|
|
- .distinct()
|
|
|
- .map(String::valueOf)
|
|
|
- .collect(Collectors.joining(","));
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 按定尺长度分组并统计数量
|
|
|
+ * @param billetList 钢坯信息列表
|
|
|
+ * @return 定尺长度到数量的映射
|
|
|
+ */
|
|
|
+ private Map<String, Long> groupByLength(List<BilletBasicInfo> billetList) {
|
|
|
+ if (CollectionUtils.isEmpty(billetList)) {
|
|
|
+ return Collections.emptyMap();
|
|
|
+ }
|
|
|
+
|
|
|
+ return billetList.stream()
|
|
|
+ .filter(info -> info.getLength() != null)
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
+ info -> String.valueOf(info.getLength()),
|
|
|
+ Collectors.counting()
|
|
|
+ ));
|
|
|
}
|
|
|
|
|
|
/**
|