private void changePortServiceManage() { boolean result = false; PSTypeVo pstyVo = new PSTypeVo(); PSTypeDao pstypedao = null; try { String id = getParaValue("id"); int monflag = getParaIntValue("value"); pstypedao = new PSTypeDao(); pstyVo = (PSTypeVo) pstypedao.findByID(id); pstyVo.setMonflag(monflag); result = pstypedao.update(pstyVo); } catch (Exception e) { e.printStackTrace(); result = false; } finally { pstypedao.close(); } }
/** * 根据 psTypeVo 来组装 中间件 * * @param psTypeVo * @return */ public MonitorServiceDTO getMonitorServiceDTOByPSTypeVo(PSTypeVo psTypeVo) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); String date = simpleDateFormat.format(new Date()); String starttime = date + " 00:00:00"; String totime = date + " 23:59:59"; int id = psTypeVo.getId(); String alias = psTypeVo.getPort(); String ipAddress = psTypeVo.getIpaddress(); String category = "portService"; Node psTypeVoNode = PollingEngine.getInstance().getSocketByID(id); int status = 0; try { status = psTypeVoNode.getStatus(); } catch (RuntimeException e) { // TODO Auto-generated catch block e.printStackTrace(); } Hashtable eventListSummary = new Hashtable(); String generalAlarm = "0"; // 普通告警数 默认为 0 String urgentAlarm = "0"; // 严重告警数 默认为 0 String seriousAlarm = "0"; // 紧急告警数 默认为 0 EventListDao eventListDao = new EventListDao(); try { generalAlarm = eventListDao.getCountByWhere( " where nodeid='" + id + "'" + " and level1='1' and recordtime>='" + starttime + "' and recordtime<='" + totime + "'"); urgentAlarm = eventListDao.getCountByWhere( " where nodeid='" + id + "'" + " and level1='2' and recordtime>='" + starttime + "' and recordtime<='" + totime + "'"); seriousAlarm = eventListDao.getCountByWhere( " where nodeid='" + id + "'" + " and level1='3' and recordtime>='" + starttime + "' and recordtime<='" + totime + "'"); } catch (RuntimeException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { eventListDao.close(); } eventListSummary.put("generalAlarm", generalAlarm); eventListSummary.put("urgentAlarm", urgentAlarm); eventListSummary.put("seriousAlarm", seriousAlarm); String monflag = "否"; if (psTypeVo.getMonflag() == 1) { monflag = "是"; } MonitorServiceDTO monitorServiceDTO = new MonitorServiceDTO(); monitorServiceDTO.setId(id); monitorServiceDTO.setStatus(String.valueOf(status)); monitorServiceDTO.setAlias(alias); monitorServiceDTO.setIpAddress(ipAddress); monitorServiceDTO.setPingValue(""); monitorServiceDTO.setCategory(category); monitorServiceDTO.setEventListSummary(eventListSummary); monitorServiceDTO.setMonflag(monflag); return monitorServiceDTO; }