| | |
| | | order -> String.valueOf(order.getPlanTime().toInstant() |
| | | .atZone(ZoneId.systemDefault()) |
| | | .toLocalDate().getMonthValue()), |
| | | // 按月份分组后,判断该月是否全部status=3 |
| | | Collectors.collectingAndThen( |
| | | Collectors.toList(), |
| | | orders -> orders.stream().allMatch(o -> o.getStatus().equals("3")) |
| | | ? "已完成" |
| | | : "未完成" |
| | | orders -> { |
| | | boolean allZero = orders.stream().allMatch(o -> o.getStatus().equals("0")); |
| | | if (allZero) { |
| | | return MAINT_0; // 待保养 |
| | | } |
| | | boolean allGtOne = orders.stream().allMatch(o -> Integer.parseInt(o.getStatus()) > 1); |
| | | if (allGtOne) { |
| | | return MAINT_2; // 待验证 |
| | | } |
| | | boolean allGtTwo = orders.stream().allMatch(o -> Integer.parseInt(o.getStatus()) > 2); |
| | | if (allGtTwo) { |
| | | return MAINT_3; // 已完成 |
| | | } |
| | | return "保养中"; |
| | | } |
| | | ) |
| | | )); |
| | | Map<String, EimsMaintPlan> planMap = equMaintPlanList.stream() |
| | |
| | | for (int month = 1; month <= monthInYear; month++) { |
| | | String monthKey = "month_" + month; |
| | | if (planMap.containsKey(String.valueOf(month))) { |
| | | item.put(monthKey, UNCHECKED); |
| | | item.put(monthKey, MAINT_0); |
| | | } else if (orderMap.containsKey(String.valueOf(month))) { |
| | | String result = orderMap.get(String.valueOf(month)); |
| | | item.put(monthKey, result); |