开发监控看板组管理CRUD
设计告警阈值配置功能
This commit is contained in:
+77
@@ -0,0 +1,77 @@
|
||||
package com.tongran.system.controller;
|
||||
|
||||
import com.tongran.common.core.web.controller.BaseController;
|
||||
import com.tongran.common.core.web.domain.AjaxResult;
|
||||
import com.tongran.common.log.annotation.Log;
|
||||
import com.tongran.common.log.enums.BusinessType;
|
||||
import com.tongran.common.security.annotation.RequiresPermissions;
|
||||
import com.tongran.system.domain.RmMonitorGroup;
|
||||
import com.tongran.system.service.IRmMonitorGroupService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 监控看板分组Controller
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2026-01-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/rmMonitorGroup")
|
||||
@RequiresPermissions("system:monitorConfig")
|
||||
public class RmMonitorGroupController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRmMonitorGroupService rmMonitorGroupService;
|
||||
|
||||
/**
|
||||
* 查询监控看板分组列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list()
|
||||
{
|
||||
List<RmMonitorGroup> list = rmMonitorGroupService.selectRmMonitorGroupList(new RmMonitorGroup());
|
||||
return success(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增监控看板分组
|
||||
*/
|
||||
@Log(title = "监控看板分组", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RmMonitorGroup rmMonitorGroup)
|
||||
{
|
||||
return toAjax(rmMonitorGroupService.insertRmMonitorGroup(rmMonitorGroup));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改监控看板分组
|
||||
*/
|
||||
@Log(title = "监控看板分组", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RmMonitorGroup rmMonitorGroup)
|
||||
{
|
||||
return toAjax(rmMonitorGroupService.updateRmMonitorGroup(rmMonitorGroup));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除监控看板分组
|
||||
*/
|
||||
@Log(title = "监控看板分组", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
int rows = rmMonitorGroupService.deleteRmMonitorGroupByIds(ids);
|
||||
if(rows == -1){
|
||||
AjaxResult ajaxResult = new AjaxResult();
|
||||
ajaxResult.put(AjaxResult.CODE_TAG, 500);
|
||||
ajaxResult.put(AjaxResult.MSG_TAG, "该分组内存在配置,不可删除");
|
||||
return ajaxResult;
|
||||
}
|
||||
return toAjax(rows);
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -17,7 +17,8 @@ public class RmMonitorConfig extends BaseEntity
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 分组id */
|
||||
private Long groupId;
|
||||
/** 配置名称 */
|
||||
@Excel(name = "配置名称")
|
||||
private String configName;
|
||||
|
||||
+2
@@ -49,5 +49,7 @@ public class RmMonitorConfigDetails extends BaseEntity
|
||||
private String endTime;
|
||||
/** 单位 */
|
||||
private String unit;
|
||||
/** 分组id */
|
||||
private Long groupId;
|
||||
|
||||
}
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.tongran.system.domain;
|
||||
|
||||
import com.tongran.common.core.annotation.Excel;
|
||||
import com.tongran.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 监控看板分组对象 rm_monitor_group
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2026-01-23
|
||||
*/
|
||||
@Data
|
||||
public class RmMonitorGroup extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 分组名称 */
|
||||
@Excel(name = "分组名称")
|
||||
private String name;
|
||||
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.tongran.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.tongran.system.domain.RmMonitorGroup;
|
||||
|
||||
/**
|
||||
* 监控看板分组Mapper接口
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2026-01-23
|
||||
*/
|
||||
public interface RmMonitorGroupMapper
|
||||
{
|
||||
/**
|
||||
* 查询监控看板分组
|
||||
*
|
||||
* @param id 监控看板分组主键
|
||||
* @return 监控看板分组
|
||||
*/
|
||||
public RmMonitorGroup selectRmMonitorGroupById(Long id);
|
||||
|
||||
/**
|
||||
* 查询监控看板分组列表
|
||||
*
|
||||
* @param rmMonitorGroup 监控看板分组
|
||||
* @return 监控看板分组集合
|
||||
*/
|
||||
public List<RmMonitorGroup> selectRmMonitorGroupList(RmMonitorGroup rmMonitorGroup);
|
||||
|
||||
/**
|
||||
* 新增监控看板分组
|
||||
*
|
||||
* @param rmMonitorGroup 监控看板分组
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmMonitorGroup(RmMonitorGroup rmMonitorGroup);
|
||||
|
||||
/**
|
||||
* 修改监控看板分组
|
||||
*
|
||||
* @param rmMonitorGroup 监控看板分组
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmMonitorGroup(RmMonitorGroup rmMonitorGroup);
|
||||
|
||||
/**
|
||||
* 删除监控看板分组
|
||||
*
|
||||
* @param id 监控看板分组主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmMonitorGroupById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除监控看板分组
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmMonitorGroupByIds(Long[] ids);
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.tongran.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.tongran.system.domain.RmMonitorGroup;
|
||||
|
||||
/**
|
||||
* 监控看板分组Service接口
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2026-01-23
|
||||
*/
|
||||
public interface IRmMonitorGroupService
|
||||
{
|
||||
/**
|
||||
* 查询监控看板分组
|
||||
*
|
||||
* @param id 监控看板分组主键
|
||||
* @return 监控看板分组
|
||||
*/
|
||||
public RmMonitorGroup selectRmMonitorGroupById(Long id);
|
||||
|
||||
/**
|
||||
* 查询监控看板分组列表
|
||||
*
|
||||
* @param rmMonitorGroup 监控看板分组
|
||||
* @return 监控看板分组集合
|
||||
*/
|
||||
public List<RmMonitorGroup> selectRmMonitorGroupList(RmMonitorGroup rmMonitorGroup);
|
||||
|
||||
/**
|
||||
* 新增监控看板分组
|
||||
*
|
||||
* @param rmMonitorGroup 监控看板分组
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmMonitorGroup(RmMonitorGroup rmMonitorGroup);
|
||||
|
||||
/**
|
||||
* 修改监控看板分组
|
||||
*
|
||||
* @param rmMonitorGroup 监控看板分组
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmMonitorGroup(RmMonitorGroup rmMonitorGroup);
|
||||
|
||||
/**
|
||||
* 批量删除监控看板分组
|
||||
*
|
||||
* @param ids 需要删除的监控看板分组主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmMonitorGroupByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除监控看板分组信息
|
||||
*
|
||||
* @param id 监控看板分组主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmMonitorGroupById(Long id);
|
||||
}
|
||||
+3
-1
@@ -120,8 +120,10 @@ public class RmMonitorConfigDetailsServiceImpl implements IRmMonitorConfigDetail
|
||||
map.put("rmMonitorConfig", rmMonitorConfig);
|
||||
resultMapList.add(map);
|
||||
}else{
|
||||
RmMonitorConfig configQuery = new RmMonitorConfig();
|
||||
configQuery.setGroupId(queryParam.getGroupId());
|
||||
// 查询所有配置
|
||||
List<RmMonitorConfig> rmMonitorConfigs = rmMonitorConfigMapper.selectRmMonitorConfigList(new RmMonitorConfig());
|
||||
List<RmMonitorConfig> rmMonitorConfigs = rmMonitorConfigMapper.selectRmMonitorConfigList(configQuery);
|
||||
if (rmMonitorConfigs != null && !rmMonitorConfigs.isEmpty()) {
|
||||
for (RmMonitorConfig rmMonitorConfig : rmMonitorConfigs) {
|
||||
RmMonitorConfigDetails rmMonitorConfigDetails = new RmMonitorConfigDetails();
|
||||
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
package com.tongran.system.service.impl;
|
||||
|
||||
import com.tongran.common.core.utils.DateUtils;
|
||||
import com.tongran.system.domain.RmMonitorConfig;
|
||||
import com.tongran.system.domain.RmMonitorGroup;
|
||||
import com.tongran.system.mapper.RmMonitorConfigMapper;
|
||||
import com.tongran.system.mapper.RmMonitorGroupMapper;
|
||||
import com.tongran.system.service.IRmMonitorGroupService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 监控看板分组Service业务层处理
|
||||
*
|
||||
* @author tongran
|
||||
* @date 2026-01-23
|
||||
*/
|
||||
@Service
|
||||
public class RmMonitorGroupServiceImpl implements IRmMonitorGroupService
|
||||
{
|
||||
@Autowired
|
||||
private RmMonitorGroupMapper rmMonitorGroupMapper;
|
||||
@Autowired
|
||||
private RmMonitorConfigMapper rmMonitorConfigMapper;
|
||||
|
||||
/**
|
||||
* 查询监控看板分组
|
||||
*
|
||||
* @param id 监控看板分组主键
|
||||
* @return 监控看板分组
|
||||
*/
|
||||
@Override
|
||||
public RmMonitorGroup selectRmMonitorGroupById(Long id)
|
||||
{
|
||||
return rmMonitorGroupMapper.selectRmMonitorGroupById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询监控看板分组列表
|
||||
*
|
||||
* @param rmMonitorGroup 监控看板分组
|
||||
* @return 监控看板分组
|
||||
*/
|
||||
@Override
|
||||
public List<RmMonitorGroup> selectRmMonitorGroupList(RmMonitorGroup rmMonitorGroup)
|
||||
{
|
||||
return rmMonitorGroupMapper.selectRmMonitorGroupList(rmMonitorGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增监控看板分组
|
||||
*
|
||||
* @param rmMonitorGroup 监控看板分组
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRmMonitorGroup(RmMonitorGroup rmMonitorGroup)
|
||||
{
|
||||
rmMonitorGroup.setCreateTime(DateUtils.getNowDate());
|
||||
return rmMonitorGroupMapper.insertRmMonitorGroup(rmMonitorGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改监控看板分组
|
||||
*
|
||||
* @param rmMonitorGroup 监控看板分组
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRmMonitorGroup(RmMonitorGroup rmMonitorGroup)
|
||||
{
|
||||
rmMonitorGroup.setUpdateTime(DateUtils.getNowDate());
|
||||
return rmMonitorGroupMapper.updateRmMonitorGroup(rmMonitorGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除监控看板分组
|
||||
*
|
||||
* @param ids 需要删除的监控看板分组主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmMonitorGroupByIds(Long[] ids)
|
||||
{
|
||||
for (Long id : ids) {
|
||||
RmMonitorConfig configQuery = new RmMonitorConfig();
|
||||
configQuery.setGroupId(id);
|
||||
List<RmMonitorConfig> rmMonitorConfigList = rmMonitorConfigMapper.selectRmMonitorConfigList(configQuery);
|
||||
if(rmMonitorConfigList == null || rmMonitorConfigList.isEmpty()){
|
||||
rmMonitorGroupMapper.deleteRmMonitorGroupById(id);
|
||||
}else{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除监控看板分组信息
|
||||
*
|
||||
* @param id 监控看板分组主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmMonitorGroupById(Long id)
|
||||
{
|
||||
return rmMonitorGroupMapper.deleteRmMonitorGroupById(id);
|
||||
}
|
||||
}
|
||||
+20
@@ -498,6 +498,16 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
||||
businessIpCount++;
|
||||
}
|
||||
if ("2".equals(network.getBindIp()) || "3".equals(network.getBindIp())) {
|
||||
// ip提前
|
||||
if(registration.getIp1PublicIp() == null){
|
||||
registration.setIp1PublicIp(network.getPublicIp());
|
||||
}
|
||||
if(registration.getIp1Isp() == null){
|
||||
registration.setIp1Isp(network.getIsp());
|
||||
}
|
||||
if(registration.getIp1Province() == null){
|
||||
registration.setIp1Province(network.getProvince());
|
||||
}
|
||||
// 管理网IP处理
|
||||
registration.setMgmtIsp(network.getIsp());
|
||||
registration.setMgmtProvince(network.getProvince());
|
||||
@@ -622,6 +632,16 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
||||
if(count > 0){
|
||||
isVirth = true;
|
||||
}
|
||||
// ip提前
|
||||
if(registration.getIp1PublicIp() == null){
|
||||
registration.setIp1PublicIp(network.getPublicIp());
|
||||
}
|
||||
if(registration.getIp1Isp() == null){
|
||||
registration.setIp1Isp(network.getIsp());
|
||||
}
|
||||
if(registration.getIp1Province() == null){
|
||||
registration.setIp1Province(network.getProvince());
|
||||
}
|
||||
// 管理网IP处理
|
||||
registration.setMgmtIsp(network.getIsp());
|
||||
registration.setMgmtProvince(network.getProvince());
|
||||
|
||||
+6
-1
@@ -12,6 +12,7 @@
|
||||
<result property="businessCode" column="business_code" />
|
||||
<result property="businessName" column="business_name" />
|
||||
<result property="deployDevice" column="deploy_device" />
|
||||
<result property="groupId" column="group_id" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
@@ -19,7 +20,7 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRmMonitorConfigVo">
|
||||
select id, config_name, monitor_start_time, resource_type, business_code, business_name, deploy_device, create_time, update_time, create_by, update_by from rm_monitor_config
|
||||
select id, config_name, monitor_start_time, resource_type, business_code, business_name, deploy_device, group_id, create_time, update_time, create_by, update_by from rm_monitor_config
|
||||
</sql>
|
||||
|
||||
<select id="selectRmMonitorConfigList" parameterType="RmMonitorConfig" resultMap="RmMonitorConfigResult">
|
||||
@@ -31,6 +32,7 @@
|
||||
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
|
||||
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
|
||||
<if test="deployDevice != null and deployDevice != ''"> and deploy_device = #{deployDevice}</if>
|
||||
<if test="groupId != null"> and group_id = #{groupId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -48,6 +50,7 @@
|
||||
<if test="businessCode != null">business_code,</if>
|
||||
<if test="businessName != null">business_name,</if>
|
||||
<if test="deployDevice != null and deployDevice != ''">deploy_device,</if>
|
||||
<if test="groupId != null">group_id,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
@@ -60,6 +63,7 @@
|
||||
<if test="businessCode != null">#{businessCode},</if>
|
||||
<if test="businessName != null">#{businessName},</if>
|
||||
<if test="deployDevice != null and deployDevice != ''">#{deployDevice},</if>
|
||||
<if test="groupId != null">#{groupId},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
@@ -76,6 +80,7 @@
|
||||
<if test="businessCode != null">business_code = #{businessCode},</if>
|
||||
<if test="businessName != null">business_name = #{businessName},</if>
|
||||
<if test="deployDevice != null and deployDevice != ''">deploy_device = #{deployDevice},</if>
|
||||
<if test="groupId != null">group_id = #{groupId},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
<?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.tongran.system.mapper.RmMonitorGroupMapper">
|
||||
|
||||
<resultMap type="RmMonitorGroup" id="RmMonitorGroupResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRmMonitorGroupVo">
|
||||
select id, name, create_time, update_time, create_by, update_by from rm_monitor_group
|
||||
</sql>
|
||||
|
||||
<select id="selectRmMonitorGroupList" parameterType="RmMonitorGroup" resultMap="RmMonitorGroupResult">
|
||||
<include refid="selectRmMonitorGroupVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRmMonitorGroupById" parameterType="Long" resultMap="RmMonitorGroupResult">
|
||||
<include refid="selectRmMonitorGroupVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRmMonitorGroup" parameterType="RmMonitorGroup" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into rm_monitor_group
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRmMonitorGroup" parameterType="RmMonitorGroup">
|
||||
update rm_monitor_group
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRmMonitorGroupById" parameterType="Long">
|
||||
delete from rm_monitor_group where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRmMonitorGroupByIds" parameterType="String">
|
||||
delete from rm_monitor_group where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user