| | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.wgcloud.entity.AccountInfo; |
| | | import com.wgcloud.entity.OspfInfo; |
| | | import com.wgcloud.entity.OspfMonitor; |
| | | import com.wgcloud.entity.SnmpInfo; |
| | | import com.wgcloud.service.LogInfoService; |
| | | import com.wgcloud.service.OspfInfoService; |
| | | import com.wgcloud.service.OspfMonitorService; |
| | | import com.wgcloud.util.HostUtil; |
| | | import com.wgcloud.util.PageUtil; |
| | | import com.wgcloud.util.ResDataUtils; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | |
| | | @Resource |
| | | private OspfInfoService OspfInfoService; |
| | | @Resource |
| | | private OspfMonitorService ospfMonitorService; |
| | | @Resource |
| | | private LogInfoService logInfoService; |
| | | @Autowired |
| | |
| | | String errorMsg = "保存ospf监测错误"; |
| | | try { |
| | | if (StringUtils.isEmpty(ospfInfo.getId())) { |
| | | |
| | | OspfMonitor ospfMonitor = ospfMonitorService.selectById(ospfInfo.getMonitorId()); |
| | | ospfInfo.setMonitorIp(ospfMonitor.getHostname()); |
| | | ospfInfo.setMonitorUsername(ospfMonitor.getUsername()); |
| | | ospfInfo.setMonitorPassword(ospfMonitor.getPassword()); |
| | | OspfInfoService.save(ospfInfo); |
| | | } else { |
| | | OspfMonitor ospfMonitor = ospfMonitorService.selectById(ospfInfo.getMonitorId()); |
| | | ospfInfo.setMonitorIp(ospfMonitor.getHostname()); |
| | | ospfInfo.setMonitorUsername(ospfMonitor.getUsername()); |
| | | ospfInfo.setMonitorPassword(ospfMonitor.getPassword()); |
| | | OspfInfoService.updateById(ospfInfo); |
| | | } |
| | | |
| | |
| | | OspfInfo ospfInfo = new OspfInfo(); |
| | | try { |
| | | if (StringUtils.isEmpty(id)) { |
| | | //添加页面默认值,snmp端口为161,团体名称为public |
| | | ospfInfo.setAreaNum("0"); |
| | | model.addAttribute("ospfInfo", ospfInfo); |
| | | |
| | | List<OspfMonitor> ospfMonitors = ospfMonitorService.selectAllByParams(null); |
| | | model.addAttribute("monitors",ospfMonitors); |
| | | return "ospfInfo/add"; |
| | | } |
| | | |
| | | ospfInfo = OspfInfoService.selectById(id); |
| | | List<OspfMonitor> ospfMonitors = ospfMonitorService.selectAllByParams(null); |
| | | model.addAttribute("monitors",ospfMonitors); |
| | | model.addAttribute("ospfInfo", ospfInfo); |
| | | } catch (Exception e) { |
| | | logger.error(errorMsg, e); |