库存预警数值不展示修复

This commit is contained in:
2024-07-11 13:51:20 +08:00
parent 98e49a8e30
commit bebe538e79

View File

@@ -106,7 +106,8 @@ public class StockController {
if (stockV2Vos.getContent().isEmpty()) { if (stockV2Vos.getContent().isEmpty()) {
dataMap.put("warnLine", 0); dataMap.put("warnLine", 0);
}else { }else {
dataMap.put("warnLine", stockV2Vos.getContent().get(0).getWarnLine()); StockV2Vo stockV2Vo = stockV2Vos.getContent().stream().filter(item -> item.getWarnLine() != null).findFirst().orElse(null);
dataMap.put("warnLine", stockV2Vo != null ? stockV2Vo.getWarnLine() : 0);
} }
return new ResponseEntity<>(dataMap, HttpStatus.OK); return new ResponseEntity<>(dataMap, HttpStatus.OK);
} }