kongdeqiang
2025-12-01 f3b27e042c7eac349bfef6d0dcf89b397164a599
fix:ospf主监测表提交
9个文件已修改
8个文件已添加
1145 ■■■■■ 已修改文件
src/main/java/com/wgcloud/controller/OspfInfoController.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/wgcloud/controller/OspfMonitorController.java 166 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/wgcloud/entity/OspfInfo.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/wgcloud/entity/OspfMonitor.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/wgcloud/filter/AuthRestFilter.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/wgcloud/mapper/OspfMonitorMapper.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/wgcloud/service/OspfMonitorService.java 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mybatis/mapper/OspfInfoMapper.xml 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mybatis/mapper/OspfMonitorMapper.xml 192 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/static/js/ospfInfo.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/static/js/ospfMonitor.js 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/templates/common/aside.html 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/templates/ospfInfo/add.html 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/templates/ospfInfo/list.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/templates/ospfMonitor/add.html 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/templates/ospfMonitor/list.html 122 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/templates/ospfMonitor/view.html 279 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/wgcloud/controller/OspfInfoController.java
@@ -5,9 +5,11 @@
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;
@@ -28,6 +30,7 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@@ -47,6 +50,8 @@
    @Resource
    private OspfInfoService OspfInfoService;
    @Resource
    private OspfMonitorService ospfMonitorService;
    @Resource
    private LogInfoService logInfoService;
    @Autowired
@@ -124,9 +129,16 @@
        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);
            }
@@ -143,14 +155,16 @@
        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);
src/main/java/com/wgcloud/controller/OspfMonitorController.java
New file
@@ -0,0 +1,166 @@
package com.wgcloud.controller;
import com.github.pagehelper.PageInfo;
import com.wgcloud.entity.OspfInfo;
import com.wgcloud.entity.OspfMonitor;
import com.wgcloud.service.LogInfoService;
import com.wgcloud.service.OspfInfoService;
import com.wgcloud.service.OspfMonitorService;
import com.wgcloud.util.PageUtil;
import com.wgcloud.util.TokenUtils;
import com.wgcloud.util.staticvar.StaticKeys;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
/**
 * @version v3.3
 * @ClassName:OspfInfoController.java
 * @author: http://www.wgstart.com
 * @date: 2021年1月16日
 * @Description: 系统生成的日志管理
 * @Copyright: 2019-2021 wgcloud. All rights reserved.
 */
@Controller
@RequestMapping("/ospfMonitor")
public class OspfMonitorController {
    private static final Logger logger = LoggerFactory.getLogger(OspfMonitorController.class);
    @Resource
    private OspfMonitorService monitorService;
    @Resource
    private LogInfoService logInfoService;
    /**
     * 根据条件查询日志信息列表
     *
     * @param model
     * @param request
     * @return
     */
    @RequestMapping(value = "list")
    public String OspfInfoList(OspfMonitor OspfInfo, Model model, HttpServletRequest request) {
        Map<String, Object> params = new HashMap<String, Object>();
        try {
            StringBuffer url = new StringBuffer();
            String hostname = null;
            if (!StringUtils.isEmpty(OspfInfo.getHostname())) {
                hostname = OspfInfo.getHostname();
                params.put("hostname", hostname.trim());
                url.append("&hostname=").append(hostname);
            }
            if (!StringUtils.isEmpty(OspfInfo.getState())) {
                params.put("state", OspfInfo.getState());
                url.append("&state=").append(OspfInfo.getState());
            }
            PageInfo pageInfo = monitorService.selectByParams(params, OspfInfo.getPage(), OspfInfo.getPageSize());
            PageUtil.initPageNumber(pageInfo, model);
            model.addAttribute("pageUrl", "/ospfMonitor/list?1=1" + url.toString());
            model.addAttribute("page", pageInfo);
            model.addAttribute("ospfInfo", OspfInfo);
        } catch (Exception e) {
            logger.error("查询日志列表错误", e);
        }
        return "ospfMonitor/list";
    }
    /**
     * 查看日志信息
     *
     * @param model
     * @param request
     * @return
     */
    @RequestMapping(value = "view")
    public String viewOspfInfo(Model model, HttpServletRequest request) {
        String id = request.getParameter("id");
        OspfMonitor OspfInfo;
        try {
            OspfInfo = monitorService.selectById(id);
            model.addAttribute("ospfMonitor", OspfInfo);
        } catch (Exception e) {
            logger.error("查看日志信息错误", e);
        }
        return "ospfMonitor/view";
    }
    /**
     * 保存ospf
     *
     * @param ospfInfo
     * @param model
     * @param request
     * @return
     */
    @RequestMapping(value = "save")
    public String saveOspfInfo(OspfMonitor ospfInfo, Model model, HttpServletRequest request) {
        String errorMsg = "保存ospf监测错误";
        try {
            if (StringUtils.isEmpty(ospfInfo.getId())) {
                monitorService.save(ospfInfo);
            } else {
                monitorService.updateById(ospfInfo);
            }
        } catch (Exception e) {
            logger.error(errorMsg, e);
        }
        return "redirect:/ospfMonitor/list";
    }
    @RequestMapping(value = "edit")
    public String edit(Model model, HttpServletRequest request) {
        String errorMsg = "编辑ospf监测设备";
        String id = request.getParameter("id");
        OspfMonitor ospfInfo = new OspfMonitor();
        try {
            if (StringUtils.isEmpty(id)) {
                //添加页面默认值,snmp端口为161,团体名称为public
                model.addAttribute("ospfMonitor", ospfInfo);
                return "ospfMonitor/add";
            }
            ospfInfo = monitorService.selectById(id);
            model.addAttribute("ospfMonitor", ospfInfo);
        } catch (Exception e) {
            logger.error(errorMsg, e);
            logInfoService.save(errorMsg, e.toString(), StaticKeys.LOG_XTCZ);
        }
        return "ospfMonitor/add";
    }
    @RequestMapping(value = "del")
    public String delete(Model model, HttpServletRequest request, RedirectAttributes redirectAttributes) {
        String errorMsg = "删除ospf监测设备错误";
        OspfMonitor ospfMonitor = new OspfMonitor();
        try {
            if (!StringUtils.isEmpty(request.getParameter("id"))) {
                String[] ids = request.getParameter("id").split(",");
                for (String id : ids) {
                    ospfMonitor = monitorService.selectById(id);
                }
                monitorService.deleteById(ids);
            }
        } catch (Exception e) {
            logger.error(errorMsg, e);
            logInfoService.save(errorMsg, e.toString(), StaticKeys.LOG_XTCZ);
        }
        return "redirect:/ospfMonitor/list";
    }
}
src/main/java/com/wgcloud/entity/OspfInfo.java
@@ -49,7 +49,7 @@
    private String monitorUserName;
    private String monitorUsername;
    private String monitorPassword;
@@ -116,16 +116,16 @@
        this.monitorIp = monitorIp;
    }
    public void setMonitorUserName(String monitorUserName) {
        this.monitorUserName = monitorUserName;
    public void setMonitorUsername(String monitorUsername) {
        this.monitorUsername = monitorUsername;
    }
    public void setMonitorPassword(String monitorPassword) {
        this.monitorPassword = monitorPassword;
    }
    public String getMonitorUserName() {
        return monitorUserName;
    public String getMonitorUsername() {
        return monitorUsername;
    }
    public String getMonitorPassword() {
src/main/java/com/wgcloud/entity/OspfMonitor.java
@@ -37,7 +37,25 @@
     */
    private Date createTime;
    private String username;
    private String password;
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getHostname() {
        return hostname;
src/main/java/com/wgcloud/filter/AuthRestFilter.java
@@ -33,7 +33,7 @@
            "/systemInfoOpen/", "/systemInfo/agentList", "/agentLogGo/minTask", "/agentGo/minTask", "/agentDiskGo/minTask", "/dceInfo/agentList",
            "/login/toLogin", "/login/login", "/appInfo/agentList", "/dockerInfo/agentList", "/portInfo/agentList", "/license/",
            "/static/", "/resources/", "/log/agentList", "/customInfo/agentList", "/agentCustomGo/minTask", "/dbInfo/agentList", "/agentDbTableGo/minTask",
            "/agentHeathMonitorGo/minTask", "/agentDceInfoGo/minTask", "/agentSnmpInfoGo/minTask", "/snmpInfo/agentList","/api/","/dp/getTop","/dp/getWb","/dp/getError","/dp/getCount"};
            "/agentHeathMonitorGo/minTask", "/agentDceInfoGo/minTask", "/agentSnmpInfoGo/minTask", "/snmpInfo/agentList","/api/","/dp/getTop","/dp/getWb","/dp/getError","/dp/getCount","/dp/getInfo"};
    //公众看板URL
@@ -201,6 +201,10 @@
            session.setAttribute("menuActive", "63");
            return;
        }
        if (uri.indexOf("/ospfMonitor") > -1) {
            session.setAttribute("menuActive", "64");
            return;
        }
        if (uri.indexOf("/tuopu/tuopuListHost") > -1) {
            session.setAttribute("menuActive", "71");
            return;
src/main/java/com/wgcloud/mapper/OspfMonitorMapper.java
New file
@@ -0,0 +1,39 @@
package com.wgcloud.mapper;
import com.wgcloud.entity.OspfInfo;
import com.wgcloud.entity.OspfMonitor;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
 * @version v3.3
 * @ClassName:LogInfoDao.java
 * @author: http://www.wgstart.com
 * @date: 2021年1月16日
 * @Description: 查看日志信息
 * @Copyright: 2019-2021 wgcloud. All rights reserved.
 */
@Repository
public interface OspfMonitorMapper {
    public List<OspfMonitor> selectAllByParams(Map<String, Object> map);
    public int countByParams(Map<String, Object> params) throws Exception;
    public List<OspfMonitor> selectByParams(Map<String, Object> params) throws Exception;
    public OspfMonitor selectById(String id) throws Exception;
    public void save(OspfMonitor LogInfo) throws Exception;
    public int deleteById(String[] id) throws Exception;
    public void insertList(List<OspfMonitor> recordList) throws Exception;
    public int deleteByDate(Map<String, Object> map) throws Exception;
    public void updateById(OspfMonitor ospfInfo);
}
src/main/java/com/wgcloud/service/OspfMonitorService.java
New file
@@ -0,0 +1,98 @@
package com.wgcloud.service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wgcloud.entity.OspfInfo;
import com.wgcloud.entity.OspfMonitor;
import com.wgcloud.mapper.OspfInfoMapper;
import com.wgcloud.mapper.OspfMonitorMapper;
import com.wgcloud.util.DateUtil;
import com.wgcloud.util.UUIDUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * @version v3.3
 * @ClassName:OspfMonitorService.java
 * @author: http://www.wgstart.com
 * @date: 2021年1月16日
 * @Description: OspfMonitorService.java
 * @Copyright: 2019-2021 wgcloud. All rights reserved.
 */
@Service
public class OspfMonitorService {
    @Autowired
    private RouterConnectionService routerConnectionService;
    private static final Logger logger = LoggerFactory.getLogger(OspfMonitorService.class);
    public PageInfo selectByParams(Map<String, Object> params, int currPage, int pageSize) throws Exception {
        PageHelper.startPage(currPage, pageSize);
        List<OspfMonitor> list = ospfMonitorMapper.selectByParams(params);
        PageInfo<OspfMonitor> pageInfo = new PageInfo<OspfMonitor>(list);
        return pageInfo;
    }
    public void saveRecord(List<OspfMonitor> recordList) throws Exception {
        if (recordList.size() < 1) {
            return;
        }
        Map<String, Object> map = new HashMap<String, Object>();
        for (OspfMonitor as : recordList) {
            as.setId(UUIDUtil.getUUID());
            as.setCreateTime(DateUtil.getNowTime());
        }
        ospfMonitorMapper.insertList(recordList);
    }
    public void save(OspfMonitor ospfMonitor) {
        ospfMonitor.setId(UUIDUtil.getUUID());
        ospfMonitor.setCreateTime(DateUtil.getNowTime());
        try {
            ospfMonitorMapper.save(ospfMonitor);
        } catch (Exception e) {
            logger.error("保存日志信息异常:", e);
        }
    }
    public void updateById(OspfMonitor ospfMonitor)
            throws Exception {
        if (StringUtils.isEmpty(ospfMonitor.getHostname())) {
            ospfMonitor.setHostname(ospfMonitor.getHostname().trim());
        }
        ospfMonitorMapper.updateById(ospfMonitor);
    }
    public int countByParams(Map<String, Object> params) throws Exception {
        return ospfMonitorMapper.countByParams(params);
    }
    public int deleteById(String[] id) throws Exception {
        return ospfMonitorMapper.deleteById(id);
    }
    public OspfMonitor selectById(String id) throws Exception {
        return ospfMonitorMapper.selectById(id);
    }
    public List<OspfMonitor> selectAllByParams(Map<String, Object> params) throws Exception {
        return ospfMonitorMapper.selectAllByParams(params);
    }
    public int deleteByDate(Map<String, Object> map) throws Exception{
        return ospfMonitorMapper.deleteByDate(map);
    }
    @Autowired
    private OspfMonitorMapper ospfMonitorMapper;
}
src/main/resources/mybatis/mapper/OspfInfoMapper.xml
@@ -7,11 +7,15 @@
        <result column="INFO_CONTENT" property="infoContent" jdbcType="CHAR" />
        <result column="AREA_NUM" property="areaNum" jdbcType="CHAR" />
        <result column="STATE" property="state" jdbcType="CHAR" />
        <result column="MONITOR_ID" property="monitorId" jdbcType="CHAR" />
        <result column="MONITOR_IP" property="monitorIp" jdbcType="CHAR" />
        <result column="MONITOR_USERNAME" property="monitorUsername" jdbcType="CHAR" />
        <result column="MONITOR_PASSWORD" property="monitorPassword" jdbcType="CHAR" />
        <result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP" />
    </resultMap>
    
    <sql id="tableColumnList">
        ID,HOST_NAME, INFO_CONTENT, STATE,AREA_NUM,CREATE_TIME
        ID,HOST_NAME, INFO_CONTENT, STATE,AREA_NUM,CREATE_TIME,MONITOR_ID,MONITOR_IP,MONITOR_USERNAME,MONITOR_PASSWORD
    </sql>
    
    <sql id="queryByParams">
@@ -96,15 +100,15 @@
            <when test="_databaseId == 'oracle'">
                begin
                <foreach collection="list" item="item" index="index">
                    INSERT INTO OSPF_INFO (ID,HOST_NAME,INFO_CONTENT,STATE,AREA_NUM,CREATE_TIME)  VALUES
                    (#{item.id},#{item.hostname},#{item.infoContent},#{item.state},#{item.areaNum},#{item.createTime});
                    INSERT INTO OSPF_INFO (ID,HOST_NAME,INFO_CONTENT,STATE,AREA_NUM,CREATE_TIME,MONITOR_IP,MONITOR_ID,MONITOR_USERNAME,MONITOR_PASSWORD)  VALUES
                    (#{item.id},#{item.hostname},#{item.infoContent},#{item.state},#{item.areaNum},#{item.createTime},#{item.monitorIp},#{item.monitorId},#{item.monitorUsername},#{item.monitorPassword});
                </foreach>
                end;
            </when>
            <otherwise>
                INSERT INTO OSPF_INFO (ID,HOST_NAME,INFO_CONTENT,STATE,AREA_NUM,CREATE_TIME)  VALUES
                INSERT INTO OSPF_INFO (ID,HOST_NAME,INFO_CONTENT,STATE,AREA_NUM,CREATE_TIME,MONITOR_IP,MONITOR_ID,MONITOR_USERNAME,MONITOR_PASSWORD)  VALUES
                <foreach collection="list" item="item" index="index" separator="," >
                    (#{item.id},#{item.hostname},#{item.infoContent},#{item.state},#{item.areaNum},#{item.createTime})
                    (#{item.id},#{item.hostname},#{item.infoContent},#{item.state},#{item.areaNum},#{item.createTime},#{item.monitorIp},#{item.monitorId},#{item.monitorUsername},#{item.monitorPassword})
                </foreach>
            </otherwise>
        </choose>
@@ -118,6 +122,10 @@
              <if test="infoContent != null">INFO_CONTENT,</if>
              <if test="state != null" >STATE,</if>
              <if test="areaNum != null" >AREA_NUM,</if>
              <if test="monitorIp != null" >MONITOR_IP,</if>
              <if test="monitorId != null" >MONITOR_ID,</if>
              <if test="monitorUsername != null" >MONITOR_USERNAME,</if>
              <if test="monitorPassword != null" >MONITOR_PASSWORD,</if>
              <if test="createTime != null" >CREATE_TIME</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides="," >
@@ -126,6 +134,10 @@
              <if test="infoContent != null" >#{infoContent},</if>
              <if test="state != null" >#{state},</if>
            <if test="areaNum != null" >#{areaNum},</if>
            <if test="monitorIp != null" >#{monitorIp},</if>
            <if test="monitorId != null" >#{monitorId},</if>
            <if test="monitorUsername != null" >#{monitorUsername},</if>
            <if test="monitorPassword != null" >#{monitorPassword},</if>
              <if test="createTime != null" >#{createTime}</if>
        </trim>
    </insert>
@@ -178,6 +190,18 @@
            <if test="createTime != null">
                CREATE_TIME = #{createTime},
            </if>
            <if test="monitorIp != null">
                MONITOR_IP = #{monitorIp},
            </if>
            <if test="monitorId != null">
                MONITOR_ID = #{monitorId},
            </if>
            <if test="monitorUsername != null">
                MONITOR_USERNAME = #{monitorUsername},
            </if>
            <if test="monitorPassword != null">
                MONITOR_PASSWORD = #{monitorPassword},
            </if>
        </set>
        WHERE ID = #{id}
    </update>
src/main/resources/mybatis/mapper/OspfMonitorMapper.xml
New file
@@ -0,0 +1,192 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.wgcloud.mapper.OspfMonitorMapper">
    <resultMap id="resultMap" type="com.wgcloud.entity.OspfMonitor">
        <id column="ID" property="id" jdbcType="CHAR" />
        <result column="HOST_NAME" property="hostname" jdbcType="CHAR" />
        <result column="INFO_CONTENT" property="infoContent" jdbcType="CHAR" />
        <result column="STATE" property="state" jdbcType="CHAR" />
        <result column="USERNAME" property="username" jdbcType="CHAR" />
        <result column="PASSWORD" property="password" jdbcType="CHAR" />
        <result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP" />
    </resultMap>
    <sql id="tableColumnList">
        ID,HOST_NAME, INFO_CONTENT, STATE,USERNAME,PASSWORD,CREATE_TIME
    </sql>
    <sql id="queryByParams">
        <if test="hostname != null">
            <choose>
                <when test="_databaseId == 'oracle'">
                    <![CDATA[ AND HOST_NAME LIKE  CONCAT(CONCAT('%',#{hostname}),'%') ]]>
                </when>
                <otherwise>
                    <![CDATA[ AND HOST_NAME LIKE  CONCAT('%',#{hostname},'%') ]]>
                </otherwise>
            </choose>
        </if>
        <if test="hostnameNe != null">
            <choose>
                <when test="_databaseId == 'oracle'">
                    <![CDATA[ AND HOST_NAME NOT LIKE  CONCAT(CONCAT('%',#{hostnameNe}),'%') ]]>
                </when>
                <otherwise>
                    <![CDATA[ AND HOST_NAME NOT LIKE  CONCAT('%',#{hostnameNe},'%') ]]>
                </otherwise>
            </choose>
        </if>
        <if test="startTime != null and endTime !=null and startTime !='' and endTime != '' ">
            <if test="_databaseId == 'mysql'">
                <![CDATA[ AND CREATE_TIME >= #{startTime} and CREATE_TIME <=#{endTime}]]>
            </if>
            <if test="_databaseId == 'postgresql'">
                <![CDATA[ AND CREATE_TIME >= cast(#{startTime} as timestamp) and CREATE_TIME <= cast(#{endTime} as timestamp)]]>
            </if>
            <if test="_databaseId == 'oracle'">
                <![CDATA[ AND CREATE_TIME >= to_date(#{startTime},'yyyy-MM-dd hh24:mi:ss') and CREATE_TIME <= to_date(#{endTime},'yyyy-MM-dd hh24:mi:ss')]]>
            </if>
        </if>
        <if test="state != null">
            <![CDATA[ AND STATE = #{state} ]]>
        </if>
        <if test="areaNum != null">
            <![CDATA[ AND AREA_NUM = #{areaNum} ]]>
        </if>
    </sql>
    <select id="selectById" resultMap="resultMap" parameterType="java.lang.String">
        SELECT
        <include refid="tableColumnList" />
        FROM OSPF_MONITOR WHERE ID=#{id}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
        DELETE FROM OSPF_MONITOR WHERE ID = #{id}
    </delete>
    <delete id="deleteByDate"  parameterType="map">
        DELETE FROM OSPF_MONITOR WHERE
        <if test="_databaseId == 'mysql'">
            <![CDATA[  CREATE_TIME <=#{endTime}]]>
        </if>
        <if test="_databaseId == 'postgresql'">
            <![CDATA[  CREATE_TIME <= cast(#{endTime} as timestamp)]]>
        </if>
        <if test="_databaseId == 'oracle'">
            <![CDATA[  CREATE_TIME <=  to_date(#{endTime},'yyyy-MM-dd hh24:mi:ss')]]>
        </if>
    </delete>
    <delete id="deleteByAccHname"  parameterType="map">
        DELETE FROM OSPF_MONITOR WHERE ACCOUNT = #{account} AND HOST_NAME = #{hostname}
    </delete>
    <delete id="deleteById" parameterType="java.lang.String">
        DELETE FROM OSPF_MONITOR WHERE ID IN
        <foreach item="item" index="index" collection="array" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>
    <insert id="insertList" parameterType="java.util.List" >
        <choose>
            <when test="_databaseId == 'oracle'">
                begin
                <foreach collection="list" item="item" index="index">
                    INSERT INTO OSPF_MONITOR (ID,HOST_NAME,INFO_CONTENT,STATE,USERNAME,PASSWORD,CREATE_TIME)  VALUES
                    (#{item.id},#{item.hostname},#{item.infoContent},#{item.state},#{item.username},#{item.password},#{item.createTime});
                </foreach>
                end;
            </when>
            <otherwise>
                INSERT INTO OSPF_MONITOR (ID,HOST_NAME,INFO_CONTENT,STATE,USERNAME,PASSWORD,CREATE_TIME)  VALUES
                <foreach collection="list" item="item" index="index" separator="," >
                    (#{item.id},#{item.hostname},#{item.infoContent},#{item.state},#{item.username},#{item.password},#{item.createTime})
                </foreach>
            </otherwise>
        </choose>
    </insert>
    <insert id="save" parameterType="com.wgcloud.entity.OspfMonitor">
        INSERT INTO OSPF_MONITOR
        <trim prefix="(" suffix=")" suffixOverrides="," >
              <if test="id != null" >ID,</if>
              <if test="hostname != null" > HOST_NAME,</if>
              <if test="infoContent != null">INFO_CONTENT,</if>
              <if test="state != null" >STATE,</if>
              <if test="username != null" >USERNAME,</if>
              <if test="password != null" >PASSWORD,</if>
              <if test="createTime != null" >CREATE_TIME</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides="," >
              <if test="id != null" >#{id},</if>
              <if test="hostname != null" >#{hostname},</if>
              <if test="infoContent != null" >#{infoContent},</if>
              <if test="state != null" >#{state},</if>
            <if test="username != null" >#{username},</if>
            <if test="password != null" >#{password},</if>
              <if test="createTime != null" >#{createTime}</if>
        </trim>
    </insert>
    <select id="countByParams" parameterType="map" resultType="java.lang.Integer">
        SELECT count(*)  FROM OSPF_MONITOR t
        <where>
            <include refid="queryByParams" />
        </where>
    </select>
      <select id="selectAllByParams" parameterType="map" resultMap="resultMap">
        SELECT
        <include refid="tableColumnList" />
        FROM OSPF_MONITOR t
        <where>
            <include refid="queryByParams" />
        </where>
         ORDER BY CREATE_TIME DESC
    </select>
    <select id="selectByParams" parameterType="map" resultMap="resultMap">
        SELECT
        <include refid="tableColumnList" />
        FROM OSPF_MONITOR
        <where>
            <include refid="queryByParams" />
        </where>
         ORDER BY CREATE_TIME DESC
    </select>
    <update id="updateById" parameterType="com.wgcloud.entity.OspfMonitor">
        UPDATE OSPF_MONITOR
        <set>
            <if test="hostname != null">
                HOST_NAME = #{hostname},
            </if>
            <if test="infoContent != null">
                INFO_CONTENT = #{infoContent},
            </if>
            <if test="state != null">
                STATE = #{state},
            </if>
            <if test="username != null">
                USERNAME = #{username},
            </if>
            <if test="password != null">
                PASSWORD = #{password},
            </if>
            <if test="createTime != null">
                CREATE_TIME = #{createTime},
            </if>
        </set>
        WHERE ID = #{id}
    </update>
</mapper>
src/main/resources/static/js/ospfInfo.js
@@ -10,6 +10,9 @@
function add() {
    window.location.href = "/tssw/ospfInfo/edit";
}
function edit(id){
    window.location.href = "/tssw/ospfInfo/edit?id="+id;
}
function del(id) {
    if(confirm('你确定要删除吗?同时也将删除对应的ospf数据')) {
src/main/resources/static/js/ospfMonitor.js
New file
@@ -0,0 +1,26 @@
function view(id) {
    window.location.href = "/tssw/ospfMonitor/edit?id="+id;
}
function searchByAccount() {
    window.location.href = "/tssw/ospfMonitor/list?account="+$("#account").val();
}
function add() {
    window.location.href = "/tssw/ospfMonitor/edit";
}
function edit(id){
    window.location.href = "/tssw/ospfMonitor/edit?id="+id;
}
function del(id) {
    if(confirm('你确定要删除吗?同时也将删除对应的ospf数据')) {
        window.location.href = "/tssw/ospfMonitor/del?id=" + id;
    }
}
function cancel(){
    history.back();
}
src/main/resources/templates/common/aside.html
@@ -273,6 +273,17 @@
                        </a>
                    </li>
                    <li class="nav-item">
                        <th:block th:if="${session.menuActive eq '64'}">
                            <a th:href="@{'/ospfMonitor/list'}" class="nav-link active">
                        </th:block>
                        <th:block th:unless="${session.menuActive eq '64'}">
                            <a th:href="@{'/ospfMonitor/list'}" class="nav-link">
                        </th:block>
                        <i class="far fa-circle nav-icon"></i>
                        <p>OSPF主监测</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <th:block th:if="${session.menuActive eq '63'}">
                            <a th:href="@{'/ospfInfo/list'}" class="nav-link active">
                        </th:block>
@@ -280,9 +291,10 @@
                            <a th:href="@{'/ospfInfo/list'}" class="nav-link">
                        </th:block>
                        <i class="far fa-circle nav-icon"></i>
                        <p>OSPF监测</p>
                        <p>OSPF被监测</p>
                        </a>
                    </li>
                </ul>
                </li>
src/main/resources/templates/ospfInfo/add.html
@@ -56,12 +56,19 @@
                </div>
                <div class="form-group">
                    <label><font color="red">*</font>OSPF区域号</label>
                    <input type="text" autocomplete="off"  th:value="${ospfInfo.areaNum}" class="validate[required,maxSize[50]] form-control" name="areaNum" id="areaNum" placeholder="如0">
                    <input type="text" autocomplete="off"  th:value="${ospfInfo.areaNum}" class="validate[maxSize[50]] form-control" name="areaNum" id="areaNum" placeholder="如0">
                </div>
                <div class="form-group">
                    <label>描述</label>
                    <input type="text" autocomplete="off"  th:value="${ospfInfo.infoContent}" class="validate[maxSize[50]] form-control" name="infoContent" id="infoContent" placeholder="如交换机01">
                </div>
                <div class="form-group">
                    <label><font color="red">*</font>监测主设备</label>
                    <select class="validate[required] form-control"  name="monitorId" id="monitorId">
                        <option value="" label="请选择"></option>
                      <option th:each="item: ${monitors}" th:value="${item.id}" th:text="${item.infoContent}" th:selected="${ospfInfo !=null}?${item.id eq ospfInfo.monitorId}">
                    </select>
                </div>
            </div>
            <!-- /.card-body -->
src/main/resources/templates/ospfInfo/list.html
@@ -38,7 +38,7 @@
  <div class="col-md-12">
    <div class="card">
      <div class="card-header">
        <h3 class="card-title"><i class="nav-icon fa fa-cloud"></i>&nbsp;OSPF设备监测列表</h3>
        <h3 class="card-title"><i class="nav-icon fa fa-cloud"></i>&nbsp;OSPF被设备监测列表</h3>
        <div class=" float-sm-right">
          <!-- SEARCH FORM -->
          <form class="form-inline ml-3" th:action="@{'/ospfInfo/list'}">
src/main/resources/templates/ospfMonitor/add.html
New file
@@ -0,0 +1,107 @@
<!DOCTYPE html>
<html>
<head>
  <div  th:replace="common/header.html"></div>
</head>
<body th:class="${application.sidebarCollapse}">
<div th:replace="common/chart.html"></div>
<div class="wrapper">
  <div th:replace="common/navbar.html"></div>
  <div th:replace="common/aside.html"></div>
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper"  style="font-size:0.90rem">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1></h1>
          </div>
            <div class="col-sm-6">
                <ol class="breadcrumb float-sm-right">
                    <li class="breadcrumb-item active"></li>
                </ol>
            </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>
    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="row">
  <div class="col-md-10">
    <div class="card card-primary">
      <div class="card-header">
        <h3 class="card-title">添加OSPF主监测设备信息</h3>
          <div class=" float-sm-right">
              <a href="javascript:history.back()">返回</a>
          </div>
      </div>
      <!-- /.card-header -->
      <!-- form start -->
        <form role="form" id="form1" th:action="@{'/ospfMonitor/save'}">
            <input type="hidden" name="id" th:value="${ospfMonitor.id}"/>
            <div class="card-body">
                <div class="form-group">
                    <label><font color="red">*</font>设备IP</label>
                    <input type="text" autocomplete="off"  th:value="${ospfMonitor.hostname}" class="validate[required,maxSize[50]] form-control" name="hostname" id="hostname" placeholder="输入IP">
                </div>
                <div class="form-group">
                    <label>描述</label>
                    <input type="text" autocomplete="off"  th:value="${ospfMonitor.infoContent}" class="validate[required,maxSize[50]] form-control" name="infoContent" id="infoContent" placeholder="如交换机01">
                </div>
                <div class="form-group">
                    <label>用户名</label>
                    <input type="text" autocomplete="off"  th:value="${ospfMonitor.username}" class="validate[required,maxSize[50]] form-control" name="username" id="username" placeholder="">
                </div>
                <div class="form-group">
                    <label>密码</label>
                    <input type="text" autocomplete="off"  th:value="${ospfMonitor.password}" class="validate[required,maxSize[50]] form-control" name="password" id="password" placeholder="">
                </div>
            </div>
            <!-- /.card-body -->
            <div class="card-footer">
                <button type="submit" class="btn btn-primary btn-sm" style="margin-right:10px;">保 存</button>
                <button type="button"  th:onclick="goback()"  class="btn bg-gradient-danger btn-sm">返 回</button>
            </div>
        </form>
      <!-- /.card-body -->
    </div>
    <!-- /.card -->
  </div>
        </div>
      </div>
    </section>
  </div>
  <div th:replace="common/footer.html"></div>
</div>
<!-- ./wrapper -->
<link rel="stylesheet" th:href="@{'/static/js/jQuery/validationEngine.jquery.css'}" type="text/css"/>
<script th:src="@{'/static/js/jQuery/jquery.validationEngine-zh_CN.js'}" type="text/javascript" charset="utf-8"></script>
<script th:src="@{'/static/js/jQuery/jquery.validationEngine.js'}" type="text/javascript" charset="utf-8"></script>
<script th:inline="javascript">
    $(document).ready(function(){
        $("#form1").validationEngine();
    });
    function goback() {
        history.back();
    }
</script>
</body>
</html>
src/main/resources/templates/ospfMonitor/list.html
New file
@@ -0,0 +1,122 @@
<!DOCTYPE html>
<html>
<head>
  <div  th:replace="common/header.html"></div>
</head>
<body th:class="${application.sidebarCollapse}">
<div th:replace="common/chart.html"></div>
<div class="wrapper">
  <div th:replace="common/navbar.html"></div>
  <div th:replace="common/aside.html"></div>
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper"  style="font-size:0.90rem">
    <!-- Content Header (Page header) -->
    <section class="content-header" style="height:38px">
      <div class="container-fluid">
        <div class="row mb-2" style="margin-top: -7px;">
          <div class="col-sm-6"></div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="javascript:history.back()">返回上级</a></li>
            </ol>
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>
    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="row">
  <div class="col-md-12">
    <div class="card">
      <div class="card-header">
        <h3 class="card-title"><i class="nav-icon fa fa-cloud"></i>&nbsp;OSPF主监测设备列表</h3>
        <div class=" float-sm-right">
          <!-- SEARCH FORM -->
          <form class="form-inline ml-3" th:action="@{'/ospfMonitor/list'}">
            <th:block th:if="${session.LOGIN_KEY.role != 'guest'}">
              <button type="button" onclick="add()" class="btn btn-primary btn-sm" style="margin-right:5px;">添加</button>
            </th:block>
            <div class="input-group input-group-sm">
              <input class="form-control"  id="hostname" name="hostname" autocomplete="off" th:value="${ospfMonitor.hostname}" type="text" placeholder="输入设备IP">
              <div class="input-group-append">
                <button class="btn btn-primary" type="submit">
                  <i class="fas fa-search"></i>
                </button>
              </div>
            </div>
          </form>
        </div>
      </div>
      <!-- /.card-header -->
      <div class="card-body">
        <table class="table table-bordered table-hover">
          <thead>
          <tr>
            <th style="width: 20px"> <input type="checkbox" value="" name="checkall" id="checkall"></th>
            <th style="width: 60px">序号</th>
            <th title="描述">描述</th>
            <th title="设备IP">设备IP</th>
            <th title="用户名">用户名</th>
            <th title="密码">密码</th>
            </tr>
          </th:block>
          </thead>
          <tbody>
          <th:block th:each="item,iterStat : ${page.list}">
            <tr>
              <td><input type="checkbox" th:value="${item.id}" name="todo2" th:id="${item.id}+'_check'"/></td>
              <td th:text="${iterStat.index+1}">1</td>
              <td th:text="${item.infoContent}"><span   th:text="${#strings.abbreviate(item.infoContent,20)}"></span></td>
              <td th:text="${item.hostname}"></td>
              <td th:text="${item.username}"></td>
              <td th:text="${item.password}"></td>
              <td>
                <th:block th:if="${session.LOGIN_KEY.role != 'guest'}">
                    <button type="button"  th:onclick="del([[${item.id}]])"  class="btn bg-gradient-danger btn-sm">删除</button>
                    <button type="button"  th:onclick="edit([[${item.id}]])"  class="btn bg-gradient-primary btn-sm">编辑</button>
                </th:block>
              </td>
          </th:block>
          </tbody>
        </table>
      </div>
      <!-- /.card-body -->
      <div th:replace="common/page.html"></div>
    </div>
    <!-- /.card -->
  </div>
        </div>
      </div>
    </section>
  </div>
  <div th:replace="common/footer.html"></div>
  <script th:src="@{'/static/js/jQuery/jquery.form.min.js'}" type="text/javascript" charset="utf-8"></script>
</div>
<!-- ./wrapper -->
<script th:src="@{'/static/js/ospfMonitor.js?v=3.3.9'}"></script>
<script th:inline="javascript">
  var msg = [[${msg}]];
  if(msg!='' && msg!=null){
    toastr.info(msg);
  }
</script>
</body>
</html>
src/main/resources/templates/ospfMonitor/view.html
New file
@@ -0,0 +1,279 @@
<!DOCTYPE html>
<html>
<head>
  <div  th:replace="common/header.html"></div>
</head>
<body th:class="${application.sidebarCollapse}">
<div th:replace="common/chart.html"></div>
<div class="wrapper">
  <div th:replace="common/navbar.html"></div>
  <div th:replace="common/aside.html"></div>
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper"  style="font-size:0.90rem">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1></h1>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item active"></li>
            </ol>
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>
    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="row">
  <div class="col-md-12">
    <div class="card card-primary">
      <div class="card-header">
        <h3 class="card-title">OSPF主设备监测信息</h3>
        <div class=" float-sm-right">
          <a href="javascript:history.back()">返回</a>
        </div>
      </div>
      <!-- /.card-header -->
      <!-- form start -->
      <form role="form">
        <div class="card-body">
          <div class="form-group">
            <label>设备IP</label>
              <div><span th:text="${snmpMonitor.hostname}"></span></div>
          </div>
        </div>
        <!-- /.card-body -->
      </form>
      <!-- /.card-body -->
      <div class="row">
        <div class="col-12 table-responsive">
          <table class="table table-striped"><tbody><tr>
            <th:block th:each="item : ${amList}">
              <th:block th:if="${item.code eq  am}">
                <td width="2%" style="vertical-align:bottom;"> <button type="button" title="当前已显示该时间段图表" class="btn btn-block btn-outline-danger btn-sm disabled" th:text="${item.msg}">Primary</button></td>
              </th:block>
              <th:block th:unless="${item.code eq  am}">
                <td width="2%" style="vertical-align:bottom;"> <button type="button"  th:onclick="viewDate([[${snmpInfo.id}]],[[${item.code}]])" class="btn btn-block btn-outline-primary btn-sm" th:text="${item.msg}">Primary</button></td>
              </th:block>
            </th:block>
            <td width="10%">
              <form class="form-inline ml-3   float-sm-right" action="/tssw/snmpInfo/view">
                <input type="hidden" name="id" th:value="${snmpMonitor.id}"/>
                <div class="input-group input-group-sm">
                  <input type="text" autocomplete="off" value="" class="validate[maxSize[50]] form-control"  th:value="${startTime}" name="startTime" id="startTime" placeholder="开始时间" style="margin-right:5px;">
                  <label style="margin-right:5px;">至</label>
                  <input type="text" autocomplete="off" value="" class="validate[maxSize[50]] form-control"  th:value="${endTime}" name="endTime" id="endTime" placeholder="结束时间" style="margin-right:5px;">
                  <button type="submit" class="btn btn-primary btn-sm" style="margin-right:5px;">查询</button>
                  <button type="button" onclick="resetParam()" class="btn bg-danger btn-sm" style="margin-right:5px;">重置</button>
                </div>
              </form>
            </td>
            <td width="2%" style="vertical-align:bottom;text-align: right"><button type="button" th:onclick="excelExport([[${snmpMonitor.id}]],[[${am}]])" class="btn btn-primary btn-sm">导出Excel</button></td>
          </tr></tbody></table>
        </div>
        <!-- /.col -->
      </div>
    </div>
    <!-- /.card -->
  </div>
        </div>
      </div>
    </section>
  </div>
  <div th:replace="common/footer.html"></div>
</div>
<!-- ./wrapper -->
<script th:src="@{'/static/js/snmp.js?v=3.4.1'}"></script>
<script th:inline="javascript">
  var startTimeResponse =[[${startTime}]];
  var endTimeResponse =[[${endTime}]];
  $(document).ready(function(){
    var startTime = $('#startTime');
    if(startTime!=null && startTime != undefined){
      startTime.daterangepicker({
        singleDatePicker: true,
        timePicker: true,
        timePicker24Hour : true,
        "opens": "center",
        "locale": {
          format: 'YYYY-MM-DD HH:mm',
          applyLabel: "应用",
          cancelLabel: "取消",
          daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
          monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
        }
      });
      if(startTimeResponse=='' || startTimeResponse==null){
        startTime.val("");
      }
    }
    var endTime = $('#endTime');
    if(endTime!=null && endTime != undefined){
      endTime.daterangepicker({
        singleDatePicker: true,
        timePicker: true,
        timePicker24Hour : true,
        "opens": "center",
        "locale": {
          format: 'YYYY-MM-DD HH:mm',
          applyLabel: "应用",
          cancelLabel: "取消",
          daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
          monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
        }
      });
      if(endTimeResponse=='' || endTimeResponse==null){
        endTime.val("");
      }
    }
  });
  function resetParam(){
    $("#startTime").val("");
    $("#endTime").val("");
  }
    var snmpStateJson =[[${snmpStateList}]];
    $(function() {
      var chart = new G2.Chart({
        container: 'snmpStateJson',
        forceFit: true,
        height: 400,
        padding: [30, 40, 70, 48]
      });
      chart.axis('dateStr', {
        label: {
          textStyle: {
            fill: '#aaaaaa'
          }
        }
      });
      chart.axis('sentAvgDouble', false);
      chart.tooltip({
        crosshairs: false
      });
      chart.legend({
        position: 'top-center'
      });
      chart.source(snmpStateJson, {
        recvAvgDouble: {
          alias: '入口MB/秒',
          min: 0,
          max: [[${snmpAvgMax}]]
        },
        sentAvgDouble: {
          alias: '出口MB/秒',
          min: 0,
          max: [[${snmpAvgMax}]]
        }
      });
      chart.scale('dateStr',{tickCount: 12,alias: '时间'});
      chart.line().position('dateStr*recvAvgDouble').color('#1890ff');
      chart.line().position('dateStr*sentAvgDouble').color('#2fc25b');
      chart.render();
      var chartCpuPer = new G2.Chart({
        container: 'cpuStateJson',
        forceFit: true,
        height: 400,
        padding: [30, 40, 70, 40]
      });
      chartCpuPer.axis('dateStr', {
        label: {
          textStyle: {
            fill: '#aaaaaa'
          }
        }
      });
      chartCpuPer.axis('cpuPerDouble', {
        label: {
          textStyle: {
            fill: '#aaaaaa'
          }
        }
      });
      chartCpuPer.tooltip({
        crosshairs: false
      });
      chartCpuPer.legend({
        position: 'top-center'
      });
      chartCpuPer.source(snmpStateJson, {
        cpuPerDouble: {
          alias: 'cpu使用率%'
        }
      });
      chartCpuPer.scale('dateStr',{tickCount: 12,alias: '时间'});
      chartCpuPer.line().position('dateStr*cpuPerDouble').color('#1890ff');
      chartCpuPer.render();
      var chartMem = new G2.Chart({
        container: 'memStateJson',
        forceFit: true,
        height: 400,
        padding: [30, 40, 70, 40]
      });
      chartMem.axis('dateStr', {
        label: {
          textStyle: {
            fill: '#aaaaaa'
          }
        }
      });
      chartMem.axis('memPerDouble', {
        label: {
          textStyle: {
            fill: '#aaaaaa'
          }
        }
      });
      chartMem.tooltip({
        crosshairs: false
      });
      chartMem.legend({
        position: 'top-center'
      });
      chartMem.source(snmpStateJson, {
        memPerDouble: {
          alias: '使用率%'
        }
      });
      chartMem.scale('dateStr', {tickCount: 12, alias: '时间'});
      chartMem.line().position('dateStr*memPerDouble').color('#8B78F6');
      chartMem.render();
    })
  var msg = [[${msg}]];
  if(msg!='' && msg!=null){
    toastr.info(msg);
  }
</script>
</body>
</html>