/** * 过滤数据 * * @param list * @return * @throws Exception */ @SuppressWarnings("unchecked") public List<ScadaData> filteringData(List<ScadaData> list, String dataTime) throws Exception { try { ScadaDataId id = new ScadaDataId(); List list1 = new ArrayList(); DateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd"); /** 8点开始算 * */ Date today1 = dateFormat1.parse(dataTime); String strToday1 = dateFormat1.format(today1); today1 = dateFormat1.parse(strToday1); today1 = new Date(today1.getTime() + 1000 * 60 * 60 * 8); for (int i = 0; i < 288; i++) { Date today2 = new Date(today1.getTime() + 1000 * 60 * i * 5); // System.out.println(today2); ScadaData tmpData = null; for (Iterator it1 = list.iterator(); it1.hasNext(); ) { ScadaData b = (ScadaData) it1.next(); id = b.getId(); /** 如果有 * */ if (today2.equals(b.getId().getTime())) { tmpData = b; break; } else { /** 如果没有 * */ Date today3 = new Date(today2.getTime() - 1000 * 60 * 2 - 1000 * 30); if (b.getId().getTime().getTime() >= today3.getTime() && b.getId().getTime().getTime() < (today2.getTime() + 1000 * 60 * 2 + 1000 * 30)) { tmpData = b; tmpData.getId().setTime(today2); } if (b.getId().getTime().after(new Date(today2.getTime() + 1000 * 60 * 2))) { break; } } } if (tmpData != null) { list1.add(tmpData); } else { ScadaData c = new ScadaData(); ScadaDataId tmpId = new ScadaDataId(); tmpId.setPsId(id.getPsId()); tmpId.setTime(today2); c.setId(tmpId); list1.add(c); // 添加默认 } } return list1; } catch (Exception e) { e.printStackTrace(); throw e; } }
/** * 开机台数 * * @param list * @return * @throws AjClientException */ @SuppressWarnings("unchecked") public Integer startingUpCount(ScadaData scadaData) { Integer i = 0; if (scadaData.getPump1() != null) { if (scadaData.getPump1() == 1) { i++; } } if (scadaData.getPump2() != null) { if (scadaData.getPump2() == 1) { i++; } } if (scadaData.getPump3() != null) { if (scadaData.getPump3() == 1) { i++; } } if (scadaData.getPump4() != null) { if (scadaData.getPump4() == 1) { i++; } } if (scadaData.getPump5() != null) { if (scadaData.getPump5() == 1) { i++; } } if (scadaData.getPump6() != null) { if (scadaData.getPump6() == 1) { i++; } } if (scadaData.getPump7() != null) { if (scadaData.getPump7() == 1) { i++; } } if (scadaData.getPump8() != null) { if (scadaData.getPump8() == 1) { i++; } } if (scadaData.getPump9() != null) { if (scadaData.getPump9() == 1) { i++; } } if (scadaData.getPump10() != null) { if (scadaData.getPump10() == 1) { i++; } } if (scadaData.getPump11() != null) { if (scadaData.getPump11() == 1) { i++; } } if (scadaData.getPump12() != null) { if (scadaData.getPump12() == 1) { i++; } } if (scadaData.getPump13() != null) { if (scadaData.getPump13() == 1) { i++; } } if (scadaData.getPump14() != null) { if (scadaData.getPump14() == 1) { i++; } } if (scadaData.getPump15() != null) { if (scadaData.getPump15() == 1) { i++; } } if (scadaData.getPump16() != null) { if (scadaData.getPump16() == 1) { i++; } } return i; }