|
@@ -1837,7 +1837,8 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
|
|
|
|
|
|
@ApiOperation(value="当班炉次浇筑信息查询", notes="当班炉次浇筑信息查询")
|
|
|
@GetMapping(value = "/queryHeatsActualsByCcmNo")
|
|
|
- public Result<List<HeatsActualsInfo>> queryHeatsActualsByCcmNo(@RequestParam(name="ccmNo") String ccmNo) {
|
|
|
+ public Result<List<HeatsActualsInfo>> queryHeatsActualsByCcmNo(@RequestParam(name="ccmNo", required = true) String ccmNo) {
|
|
|
+
|
|
|
List<HeatsActualsInfo> heatsActualsInfoList = new ArrayList<>();
|
|
|
|
|
|
String classShiftGroup = String.format("class:shift:group:%s", ccmNo); // 班组
|
|
@@ -1870,12 +1871,170 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
|
|
|
billetHotsendList.forEach(x -> {
|
|
|
HeatsActualsInfo heatsActualsInfo = new HeatsActualsInfo();
|
|
|
heatsActualsInfo.setHeatNo(x.getHeatNo());
|
|
|
+ heatsActualsInfo.setBrandNum(x.getBrandNum());
|
|
|
+ // 根据铸机号、炉号查询钢坯实绩信息BilletBasicInfo
|
|
|
+ LambdaQueryWrapper<BilletBasicInfo> queryWrapper2 = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper2.eq(BilletBasicInfo::getCcmNo, x.getCcmNo())
|
|
|
+ .eq(BilletBasicInfo::getHeatNo, x.getHeatNo())
|
|
|
+ .eq(BilletBasicInfo::getShift, x.getShift())
|
|
|
+ .eq(BilletBasicInfo::getShiftGroup, x.getShiftGroup());
|
|
|
+ List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapper2);
|
|
|
+ if (oConvertUtils.listIsEmpty(billetBasicInfoList)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 统计各流号的数量
|
|
|
+ Map<Integer, Long> strandCountMap = billetBasicInfoList.stream()
|
|
|
+ .filter(info -> info.getStrandNo() != null && info.getStrandNo() >= 1 && info.getStrandNo() <= 8)
|
|
|
+ .collect(Collectors.groupingBy(BilletBasicInfo::getStrandNo, Collectors.counting()));
|
|
|
+
|
|
|
+ // 将统计结果赋值到对应的属性
|
|
|
+ heatsActualsInfo.setOneStrandNo(Math.toIntExact(strandCountMap.getOrDefault(1, 0L)));
|
|
|
+ heatsActualsInfo.setTwoStrandNo(Math.toIntExact(strandCountMap.getOrDefault(2, 0L)));
|
|
|
+ heatsActualsInfo.setThreeStrandNo(Math.toIntExact(strandCountMap.getOrDefault(3, 0L)));
|
|
|
+ heatsActualsInfo.setFourStrandNo(Math.toIntExact(strandCountMap.getOrDefault(4, 0L)));
|
|
|
+ heatsActualsInfo.setFiveStrandNo(Math.toIntExact(strandCountMap.getOrDefault(5, 0L)));
|
|
|
+ heatsActualsInfo.setSixStrandNo(Math.toIntExact(strandCountMap.getOrDefault(6, 0L)));
|
|
|
+ heatsActualsInfo.setSevenStrandNo(Math.toIntExact(strandCountMap.getOrDefault(7, 0L)));
|
|
|
+ heatsActualsInfo.setEightStrandNo(Math.toIntExact(strandCountMap.getOrDefault(8, 0L)));
|
|
|
+
|
|
|
+ // 直轧过滤并计算
|
|
|
+ List<BilletBasicInfo> filterDirectRollingList = billetBasicInfoList.stream()
|
|
|
+ .filter(info -> "roll_club_one".equals(info.getBelongTable()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (oConvertUtils.listIsNotEmpty(filterDirectRollingList)){
|
|
|
+ // 计算总重(保留4位小数)
|
|
|
+ double totalWeight = filterDirectRollingList.stream()
|
|
|
+ .mapToDouble(BilletBasicInfo::getBilletWeight)
|
|
|
+ .sum();
|
|
|
+ totalWeight = Math.round(totalWeight * 10000) / 10000.0;
|
|
|
+
|
|
|
+ // 统计总数
|
|
|
+ int totalCount = filterDirectRollingList.size();
|
|
|
+
|
|
|
+ // 转为JSON字符串
|
|
|
+ Map<String, Object> directRollingMap = new HashMap<>();
|
|
|
+ directRollingMap.put("directRollingTotalWeight", totalWeight);
|
|
|
+ directRollingMap.put("directRollingTotalCount", totalCount);
|
|
|
+ String jsonResult = JSON.toJSONString(directRollingMap); // 使用FastJSON转换.
|
|
|
+ heatsActualsInfo.setDirectRolling(jsonResult);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 热送高线过滤并计算
|
|
|
+ List<BilletBasicInfo> filterHotSendList = billetBasicInfoList.stream()
|
|
|
+ .filter(info -> "roll_height".equals(info.getBelongTable()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (oConvertUtils.listIsNotEmpty(filterHotSendList)){
|
|
|
+ // 计算总重(保留4位小数)
|
|
|
+ double totalWeight = filterHotSendList.stream()
|
|
|
+ .mapToDouble(BilletBasicInfo::getBilletWeight)
|
|
|
+ .sum();
|
|
|
+ totalWeight = Math.round(totalWeight * 10000) / 10000.0;
|
|
|
+
|
|
|
+ // 统计总数
|
|
|
+ int totalCount = filterHotSendList.size();
|
|
|
+
|
|
|
+ // 转为JSON字符串
|
|
|
+ Map<String, Object> hotSendMap = new HashMap<>();
|
|
|
+ hotSendMap.put("hotSendTotalWeight", totalWeight);
|
|
|
+ hotSendMap.put("hotSendTotalCount", totalCount);
|
|
|
+ String jsonResult = JSON.toJSONString(hotSendMap); // 使用FastJSON转换.
|
|
|
+ heatsActualsInfo.setHotSend(jsonResult);
|
|
|
+ }
|
|
|
|
|
|
+ // 堆垛过滤并计算
|
|
|
+ List<BilletBasicInfo> filterStackList = billetBasicInfoList.stream()
|
|
|
+ .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转换.
|
|
|
+ heatsActualsInfo.setStacking(jsonResult);
|
|
|
+ }
|
|
|
|
|
|
+ // 定义需要筛选的belongTable列表
|
|
|
+ List<String> targetTables = Arrays.asList("roll_club_two", "roll_club_three", "roll_out_shipp");
|
|
|
+
|
|
|
+ // 热装过滤并计算
|
|
|
+ List<BilletBasicInfo> filterHotChargeList = billetBasicInfoList.stream()
|
|
|
+ .filter(info -> targetTables.contains(info.getBelongTable()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (oConvertUtils.listIsNotEmpty(filterHotChargeList)){
|
|
|
+ // 计算总重(保留4位小数)
|
|
|
+ double totalWeight = filterHotChargeList.stream()
|
|
|
+ .mapToDouble(BilletBasicInfo::getBilletWeight)
|
|
|
+ .sum();
|
|
|
+ totalWeight = Math.round(totalWeight * 10000) / 10000.0;
|
|
|
+
|
|
|
+ // 统计总数
|
|
|
+ int totalCount = filterHotChargeList.size();
|
|
|
+
|
|
|
+ // 转为JSON字符串
|
|
|
+ Map<String, Object> hotChargeMap = new HashMap<>();
|
|
|
+ hotChargeMap.put("hotChargeTotalWeight", totalWeight);
|
|
|
+ hotChargeMap.put("hotChargeTotalCount", totalCount);
|
|
|
+ String jsonResult = JSON.toJSONString(hotChargeMap); // 使用FastJSON转换
|
|
|
+ heatsActualsInfo.setHotCharge(jsonResult);
|
|
|
+ }
|
|
|
|
|
|
- });
|
|
|
+ // 按length字段分组,并统计每组的总数和总重
|
|
|
+ Map<Integer, Map<String, Object>> lengthResultMap = billetBasicInfoList.stream()
|
|
|
+ .filter(info -> info.getLength() != null) // 过滤掉length为null的记录
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
+ BilletBasicInfo::getLength, // 按length分组
|
|
|
+ Collectors.collectingAndThen(
|
|
|
+ Collectors.toList(),
|
|
|
+ list -> {
|
|
|
+ // 计算每组的总重(保留4位小数)
|
|
|
+ double totalWeight = list.stream()
|
|
|
+ .mapToDouble(BilletBasicInfo::getBilletWeight)
|
|
|
+ .sum();
|
|
|
+ totalWeight = Math.round(totalWeight * 10000) / 10000.0;
|
|
|
+
|
|
|
+ // 统计每组的总数
|
|
|
+ int totalCount = list.size();
|
|
|
+
|
|
|
+ // 创建每组的结果Map
|
|
|
+ Map<String, Object> groupResult = new HashMap<>();
|
|
|
+ groupResult.put("lengthTotalWeight", totalWeight);
|
|
|
+ groupResult.put("lengthTotalCount", totalCount);
|
|
|
+ return groupResult;
|
|
|
+ }
|
|
|
+ )
|
|
|
+ ));
|
|
|
+
|
|
|
+ // 将结果转换为JSON字符串
|
|
|
+ String jsonResult = JSON.toJSONString(lengthResultMap); // 使用FastJSON转换
|
|
|
+ heatsActualsInfo.setLength(jsonResult);
|
|
|
|
|
|
+ // 统计总数
|
|
|
+ long totalCount = billetBasicInfoList.size();
|
|
|
|
|
|
+ // 计算总重(保留4位小数)
|
|
|
+ double totalWeight = billetBasicInfoList.stream()
|
|
|
+ .mapToDouble(BilletBasicInfo::getBilletWeight)
|
|
|
+ .sum();
|
|
|
+ totalWeight = Math.round(totalWeight * 10000) / 10000.0;
|
|
|
+
|
|
|
+ // 转为JSON字符串
|
|
|
+ Map<String, Object> resultMap = new HashMap<>();
|
|
|
+ resultMap.put("totalCount", totalCount);
|
|
|
+ resultMap.put("totalWeight", totalWeight);
|
|
|
+ String sumJsonResult = JSON.toJSONString(resultMap); // 使用FastJSON转换
|
|
|
+ heatsActualsInfo.setTotalInfo(sumJsonResult);
|
|
|
+ heatsActualsInfoList.add(heatsActualsInfo);
|
|
|
+ });
|
|
|
return Result.OK(heatsActualsInfoList);
|
|
|
}
|
|
|
|