|
@@ -484,20 +484,37 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
|
.filter(info -> "stacking_and_loading_vehicles".equals(info.getBelongTable()))
|
|
|
.collect(Collectors.toList());
|
|
|
if (oConvertUtils.listIsNotEmpty(filterStackList)){
|
|
|
- // 计算总重(保留4位小数)
|
|
|
- double totalWeight = filterStackList.stream()
|
|
|
- .mapToDouble(BilletBasicInfo::getBilletWeight)
|
|
|
- .sum();
|
|
|
- totalWeight = Math.round(totalWeight * 10000) / 10000.0;
|
|
|
-
|
|
|
- // 统计总数
|
|
|
- int totalCount = filterStackList.size();
|
|
|
-
|
|
|
- // 转为JSON字符串
|
|
|
- Map<String, Object> stackingMap = new HashMap<>();
|
|
|
- stackingMap.put("stackingTotalWeight", totalWeight);
|
|
|
- stackingMap.put("stackingTotalCount", totalCount);
|
|
|
- String jsonResult = JSON.toJSONString(stackingMap); // 使用FastJSON转换.
|
|
|
+ // 按定尺长度分组
|
|
|
+ Map<Integer, List<BilletBasicInfo>> lengthGroupMap = filterStackList.stream()
|
|
|
+ .filter(info -> info.getLength() != null)
|
|
|
+ .collect(Collectors.groupingBy(BilletBasicInfo::getLength));
|
|
|
+
|
|
|
+ // 构建分组统计结果列表
|
|
|
+ List<Map<String, Object>> lengthGroupList = new ArrayList<>();
|
|
|
+
|
|
|
+ for (Map.Entry<Integer, List<BilletBasicInfo>> entry : lengthGroupMap.entrySet()) {
|
|
|
+ Integer length = entry.getKey();
|
|
|
+ List<BilletBasicInfo> billets = entry.getValue();
|
|
|
+
|
|
|
+ // 计算该定尺长度的总重(保留4位小数)
|
|
|
+ double lengthWeight = billets.stream()
|
|
|
+ .mapToDouble(BilletBasicInfo::getBilletWeight)
|
|
|
+ .sum();
|
|
|
+ lengthWeight = Math.round(lengthWeight * 10000) / 10000.0;
|
|
|
+
|
|
|
+ // 统计该定尺长度的数量
|
|
|
+ int lengthCount = billets.size();
|
|
|
+
|
|
|
+ // 构建该定尺长度的统计结果
|
|
|
+ Map<String, Object> lengthStat = new HashMap<>();
|
|
|
+ lengthStat.put("stackingWeight", lengthWeight);
|
|
|
+ lengthStat.put("stackingCount", lengthCount);
|
|
|
+ lengthStat.put("stackingLength", length);
|
|
|
+ // 添加到结果列表
|
|
|
+ lengthGroupList.add(lengthStat);
|
|
|
+ }
|
|
|
+ // 直接将列表转换为JSON
|
|
|
+ String jsonResult = JSON.toJSONString(lengthGroupList);
|
|
|
heatsActualsInfo.setStacking(jsonResult);
|
|
|
}
|
|
|
|