1、适配cpu信息表、容器信息表、挂载点信息表分表。
2、agent增加采集磁盘健康状态。 3、优化磁盘上报数据处理。
This commit is contained in:
+98
@@ -0,0 +1,98 @@
|
||||
package com.tongran.rocketmq.controller;
|
||||
|
||||
import com.tongran.common.core.utils.poi.ExcelUtil;
|
||||
import com.tongran.common.core.web.controller.BaseController;
|
||||
import com.tongran.common.core.web.domain.AjaxResult;
|
||||
import com.tongran.common.core.web.page.TableDataInfo;
|
||||
import com.tongran.common.log.annotation.Log;
|
||||
import com.tongran.common.log.enums.BusinessType;
|
||||
import com.tongran.common.security.annotation.RequiresPermissions;
|
||||
import com.tongran.rocketmq.domain.AllDockerName;
|
||||
import com.tongran.rocketmq.service.IAllDockerNameService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 容器id存储Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/allDockerName")
|
||||
public class AllDockerNameController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAllDockerNameService allDockerNameService;
|
||||
|
||||
/**
|
||||
* 查询容器id存储列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:allDockerName:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AllDockerName allDockerName)
|
||||
{
|
||||
startPage();
|
||||
List<AllDockerName> list = allDockerNameService.selectAllDockerNameList(allDockerName);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出容器id存储列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:allDockerName:export")
|
||||
@Log(title = "容器id存储", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, AllDockerName allDockerName)
|
||||
{
|
||||
List<AllDockerName> list = allDockerNameService.selectAllDockerNameList(allDockerName);
|
||||
ExcelUtil<AllDockerName> util = new ExcelUtil<AllDockerName>(AllDockerName.class);
|
||||
util.exportExcel(response, list, "容器id存储数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取容器id存储详细信息
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:allDockerName:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(allDockerNameService.selectAllDockerNameById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增容器id存储
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:allDockerName:add")
|
||||
@Log(title = "容器id存储", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AllDockerName allDockerName)
|
||||
{
|
||||
return toAjax(allDockerNameService.insertAllDockerName(allDockerName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改容器id存储
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:allDockerName:edit")
|
||||
@Log(title = "容器id存储", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AllDockerName allDockerName)
|
||||
{
|
||||
return toAjax(allDockerNameService.updateAllDockerName(allDockerName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除容器id存储
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:allDockerName:remove")
|
||||
@Log(title = "容器id存储", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(allDockerNameService.deleteAllDockerNameByIds(ids));
|
||||
}
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
package com.tongran.rocketmq.controller;
|
||||
|
||||
import com.tongran.common.core.utils.poi.ExcelUtil;
|
||||
import com.tongran.common.core.web.controller.BaseController;
|
||||
import com.tongran.common.core.web.domain.AjaxResult;
|
||||
import com.tongran.common.core.web.page.TableDataInfo;
|
||||
import com.tongran.common.log.annotation.Log;
|
||||
import com.tongran.common.log.enums.BusinessType;
|
||||
import com.tongran.common.security.annotation.RequiresPermissions;
|
||||
import com.tongran.rocketmq.domain.AllMountName;
|
||||
import com.tongran.rocketmq.service.IAllMountNameService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 挂载点路径名称存储Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/allMountName")
|
||||
public class AllMountNameController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAllMountNameService allMountNameService;
|
||||
|
||||
/**
|
||||
* 查询挂载点路径名称存储列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:allMountName:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AllMountName allMountName)
|
||||
{
|
||||
startPage();
|
||||
List<AllMountName> list = allMountNameService.selectAllMountNameList(allMountName);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出挂载点路径名称存储列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:allMountName:export")
|
||||
@Log(title = "挂载点路径名称存储", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, AllMountName allMountName)
|
||||
{
|
||||
List<AllMountName> list = allMountNameService.selectAllMountNameList(allMountName);
|
||||
ExcelUtil<AllMountName> util = new ExcelUtil<AllMountName>(AllMountName.class);
|
||||
util.exportExcel(response, list, "挂载点路径名称存储数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取挂载点路径名称存储详细信息
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:allMountName:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(allMountNameService.selectAllMountNameById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增挂载点路径名称存储
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:allMountName:add")
|
||||
@Log(title = "挂载点路径名称存储", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AllMountName allMountName)
|
||||
{
|
||||
return toAjax(allMountNameService.insertAllMountName(allMountName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改挂载点路径名称存储
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:allMountName:edit")
|
||||
@Log(title = "挂载点路径名称存储", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AllMountName allMountName)
|
||||
{
|
||||
return toAjax(allMountNameService.updateAllMountName(allMountName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除挂载点路径名称存储
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:allMountName:remove")
|
||||
@Log(title = "挂载点路径名称存储", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(allMountNameService.deleteAllMountNameByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -63,5 +63,7 @@ public class AllDiskName extends BaseEntity
|
||||
private String type;
|
||||
/** 表名 */
|
||||
private String tableName;
|
||||
/** 健康状态 0 不健康,1健康 */
|
||||
private Long healthStatus;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.tongran.rocketmq.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.tongran.common.core.annotation.Excel;
|
||||
import com.tongran.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 容器id存储对象 all_docker_name
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public class AllDockerName extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 客户端ID */
|
||||
@Excel(name = "客户端ID")
|
||||
private String clientId;
|
||||
|
||||
/** 容器id */
|
||||
@Excel(name = "容器id")
|
||||
private String dockerId;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setClientId(String clientId)
|
||||
{
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public String getClientId()
|
||||
{
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setDockerId(String dockerId)
|
||||
{
|
||||
this.dockerId = dockerId;
|
||||
}
|
||||
|
||||
public String getDockerId()
|
||||
{
|
||||
return dockerId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("clientId", getClientId())
|
||||
.append("dockerId", getDockerId())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.tongran.rocketmq.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.tongran.common.core.annotation.Excel;
|
||||
import com.tongran.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 挂载点路径名称存储对象 all_mount_name
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public class AllMountName extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 客户端ID */
|
||||
@Excel(name = "客户端ID")
|
||||
private String clientId;
|
||||
|
||||
/** 挂载路径 */
|
||||
@Excel(name = "挂载路径")
|
||||
private String mount;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setClientId(String clientId)
|
||||
{
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public String getClientId()
|
||||
{
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setMount(String mount)
|
||||
{
|
||||
this.mount = mount;
|
||||
}
|
||||
|
||||
public String getMount()
|
||||
{
|
||||
return mount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("clientId", getClientId())
|
||||
.append("mount", getMount())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import com.tongran.common.core.annotation.Excel;
|
||||
import com.tongran.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* CPU监控信息对象 initial_cpu_info
|
||||
*
|
||||
@@ -78,4 +80,8 @@ public class InitialCpuInfo extends BaseEntity
|
||||
private String startTime;
|
||||
/** 结束时间 */
|
||||
private String endTime;
|
||||
/** 表名 */
|
||||
private String tableName;
|
||||
/** cpu信息列表 */
|
||||
private List<InitialCpuInfo> list;
|
||||
}
|
||||
|
||||
@@ -85,6 +85,8 @@ public class InitialDiskInfo extends BaseEntity
|
||||
private List<InitialDiskInfo> list;
|
||||
/** 单位 */
|
||||
private String unit;
|
||||
/** 健康状态 0-不健康 1-健康) */
|
||||
private Long healthStatus;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.tongran.common.core.annotation.Excel;
|
||||
import com.tongran.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 容器监控信息对象 initial_docker_info
|
||||
*
|
||||
@@ -51,4 +53,8 @@ public class InitialDockerInfo extends BaseEntity
|
||||
private String startTime;
|
||||
/** 结束时间 */
|
||||
private String endTime;
|
||||
/** 表名 */
|
||||
private String tableName;
|
||||
/** 容器信息列表 */
|
||||
private List<InitialDockerInfo> list;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.tongran.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 挂载点监控信息对象 initial_mount_point_info
|
||||
@@ -47,4 +48,8 @@ public class InitialMountPointInfo extends BaseEntity
|
||||
private String startTime;
|
||||
/** 结束时间 */
|
||||
private String endTime;
|
||||
/** 表名 */
|
||||
private String tableName;
|
||||
/** 挂载点信息列表 */
|
||||
private List<InitialMountPointInfo> list;
|
||||
}
|
||||
|
||||
+3
-3
@@ -223,7 +223,7 @@ public class DeviceMessageHandler {
|
||||
iface.setCreateTime(createTime);
|
||||
});
|
||||
// 初始容器数据入库
|
||||
initialDockerInfoService.batchInsertInitialDockerInfo(dockers);
|
||||
initialDockerInfoService.batchInsertInitialDockerInfo(dockers, createTime);
|
||||
}else{
|
||||
throw new RuntimeException("DOCKER容器data数据为空");
|
||||
}
|
||||
@@ -244,7 +244,7 @@ public class DeviceMessageHandler {
|
||||
iface.setCreateTime(createTime);
|
||||
});
|
||||
// 初始CPU数据入库
|
||||
initialCpuInfoService.batchInsertInitialCpuInfo(cpus);
|
||||
initialCpuInfoService.batchInsertInitialCpuInfo(cpus, createTime);
|
||||
}else{
|
||||
throw new RuntimeException("CPUdata数据为空");
|
||||
}
|
||||
@@ -307,7 +307,7 @@ public class DeviceMessageHandler {
|
||||
iface.setCreateTime(createTime);
|
||||
});
|
||||
// 初始挂载点数据入库
|
||||
initialMountPointInfoService.batchInsertInitialMountPointInfo(mountPointInfos);
|
||||
initialMountPointInfoService.batchInsertInitialMountPointInfo(mountPointInfos, createTime);
|
||||
}else{
|
||||
throw new RuntimeException("挂载点data数据为空");
|
||||
}
|
||||
|
||||
@@ -1067,7 +1067,7 @@ public class MessageHandler {
|
||||
iface.setCreateTime(createTime);
|
||||
});
|
||||
// 初始容器数据入库
|
||||
initialDockerInfoService.batchInsertInitialDockerInfo(dockers);
|
||||
initialDockerInfoService.batchInsertInitialDockerInfo(dockers, createTime);
|
||||
}else{
|
||||
throw new RuntimeException("DOCKER容器data数据为空");
|
||||
}
|
||||
@@ -1091,7 +1091,7 @@ public class MessageHandler {
|
||||
}
|
||||
});
|
||||
// 初始CPU数据入库
|
||||
initialCpuInfoService.batchInsertInitialCpuInfo(cpus);
|
||||
initialCpuInfoService.batchInsertInitialCpuInfo(cpus, createTime);
|
||||
}else{
|
||||
throw new RuntimeException("CPUdata数据为空");
|
||||
}
|
||||
@@ -1223,7 +1223,7 @@ public class MessageHandler {
|
||||
iface.setCreateTime(createTime);
|
||||
});
|
||||
// 初始挂载点数据入库
|
||||
initialMountPointInfoService.batchInsertInitialMountPointInfo(mountPointInfos);
|
||||
initialMountPointInfoService.batchInsertInitialMountPointInfo(mountPointInfos, createTime);
|
||||
}else{
|
||||
throw new RuntimeException("挂载点data数据为空");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.tongran.rocketmq.mapper;
|
||||
|
||||
import com.tongran.rocketmq.domain.AllDockerName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 容器id存储Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public interface AllDockerNameMapper
|
||||
{
|
||||
/**
|
||||
* 查询容器id存储
|
||||
*
|
||||
* @param id 容器id存储主键
|
||||
* @return 容器id存储
|
||||
*/
|
||||
public AllDockerName selectAllDockerNameById(Long id);
|
||||
|
||||
/**
|
||||
* 查询容器id存储列表
|
||||
*
|
||||
* @param allDockerName 容器id存储
|
||||
* @return 容器id存储集合
|
||||
*/
|
||||
public List<AllDockerName> selectAllDockerNameList(AllDockerName allDockerName);
|
||||
|
||||
/**
|
||||
* 新增容器id存储
|
||||
*
|
||||
* @param allDockerName 容器id存储
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAllDockerName(AllDockerName allDockerName);
|
||||
|
||||
/**
|
||||
* 修改容器id存储
|
||||
*
|
||||
* @param allDockerName 容器id存储
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAllDockerName(AllDockerName allDockerName);
|
||||
|
||||
/**
|
||||
* 删除容器id存储
|
||||
*
|
||||
* @param id 容器id存储主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAllDockerNameById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除容器id存储
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAllDockerNameByIds(Long[] ids);
|
||||
|
||||
void batchInsertAllDockerId(List<AllDockerName> list);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.tongran.rocketmq.mapper;
|
||||
|
||||
import com.tongran.rocketmq.domain.AllMountName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 挂载点路径名称存储Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public interface AllMountNameMapper
|
||||
{
|
||||
/**
|
||||
* 查询挂载点路径名称存储
|
||||
*
|
||||
* @param id 挂载点路径名称存储主键
|
||||
* @return 挂载点路径名称存储
|
||||
*/
|
||||
public AllMountName selectAllMountNameById(Long id);
|
||||
|
||||
/**
|
||||
* 查询挂载点路径名称存储列表
|
||||
*
|
||||
* @param allMountName 挂载点路径名称存储
|
||||
* @return 挂载点路径名称存储集合
|
||||
*/
|
||||
public List<AllMountName> selectAllMountNameList(AllMountName allMountName);
|
||||
|
||||
/**
|
||||
* 新增挂载点路径名称存储
|
||||
*
|
||||
* @param allMountName 挂载点路径名称存储
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAllMountName(AllMountName allMountName);
|
||||
|
||||
/**
|
||||
* 修改挂载点路径名称存储
|
||||
*
|
||||
* @param allMountName 挂载点路径名称存储
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAllMountName(AllMountName allMountName);
|
||||
|
||||
/**
|
||||
* 删除挂载点路径名称存储
|
||||
*
|
||||
* @param id 挂载点路径名称存储主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAllMountNameById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除挂载点路径名称存储
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAllMountNameByIds(Long[] ids);
|
||||
|
||||
void batchInsertAllMount(List<AllMountName> list);
|
||||
}
|
||||
+6
-4
@@ -1,7 +1,7 @@
|
||||
package com.tongran.rocketmq.mapper;
|
||||
|
||||
import com.tongran.rocketmq.domain.InitialCpuInfo;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -63,10 +63,12 @@ public interface InitialCpuInfoMapper
|
||||
/**
|
||||
* 批量新增CPU监控信息
|
||||
*
|
||||
* @param list CPU监控信息集合
|
||||
* @param initialCpuInfo CPU监控信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchInsertInitialCpuInfo(@Param("list") List<InitialCpuInfo> list);
|
||||
public int batchInsertInitialCpuInfo(InitialCpuInfo initialCpuInfo);
|
||||
|
||||
InitialCpuInfo getCpuInfoByClientId(String clientId);
|
||||
InitialCpuInfo getCpuInfoByClientId(@Param("clientId") String clientId, @Param("tableName") String tableName);
|
||||
|
||||
List<InitialCpuInfo> selectInitialCpuInfoListByCondition(InitialCpuInfo condition);
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,7 +1,6 @@
|
||||
package com.tongran.rocketmq.mapper;
|
||||
|
||||
import com.tongran.rocketmq.domain.InitialDockerInfo;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -62,7 +61,7 @@ public interface InitialDockerInfoMapper
|
||||
*/
|
||||
public int deleteInitialDockerInfoByIds(Long[] autoId);
|
||||
|
||||
int batchInsertInitialDockerInfo(@Param("list") List<InitialDockerInfo> list);
|
||||
int batchInsertInitialDockerInfo(InitialDockerInfo initialDockerInfo);
|
||||
|
||||
/**
|
||||
* 容器基础信息
|
||||
@@ -77,4 +76,6 @@ public interface InitialDockerInfoMapper
|
||||
* @return
|
||||
*/
|
||||
List<Map> getAllDockerId(InitialDockerInfo initialDockerInfo);
|
||||
|
||||
List<InitialDockerInfo> selectInitialDockerInfoListByCondition(InitialDockerInfo condition);
|
||||
}
|
||||
|
||||
+4
-3
@@ -1,7 +1,6 @@
|
||||
package com.tongran.rocketmq.mapper;
|
||||
|
||||
import com.tongran.rocketmq.domain.InitialMountPointInfo;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -64,10 +63,10 @@ public interface InitialMountPointInfoMapper
|
||||
/**
|
||||
* 批量新增挂载点监控信息
|
||||
*
|
||||
* @param list 挂载点监控信息集合
|
||||
* @param initialMountPointInfo 挂载点监控信息集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchInsertInitialMountPointInfo(@Param("list") List<InitialMountPointInfo> list);
|
||||
public int batchInsertInitialMountPointInfo(InitialMountPointInfo initialMountPointInfo);
|
||||
|
||||
/**
|
||||
* 挂载文件系统基础信息
|
||||
@@ -82,4 +81,6 @@ public interface InitialMountPointInfoMapper
|
||||
* @return
|
||||
*/
|
||||
List<Map> getAllMountName(InitialMountPointInfo initialMountPointInfo);
|
||||
|
||||
List<InitialMountPointInfo> selectInitialMountPointInfoListByCondition(InitialMountPointInfo condition);
|
||||
}
|
||||
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package com.tongran.rocketmq.service;
|
||||
|
||||
import com.tongran.rocketmq.domain.AllDockerName;
|
||||
import com.tongran.rocketmq.domain.InitialDockerInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 容器id存储Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public interface IAllDockerNameService
|
||||
{
|
||||
/**
|
||||
* 查询容器id存储
|
||||
*
|
||||
* @param id 容器id存储主键
|
||||
* @return 容器id存储
|
||||
*/
|
||||
public AllDockerName selectAllDockerNameById(Long id);
|
||||
|
||||
/**
|
||||
* 查询容器id存储列表
|
||||
*
|
||||
* @param allDockerName 容器id存储
|
||||
* @return 容器id存储集合
|
||||
*/
|
||||
public List<AllDockerName> selectAllDockerNameList(AllDockerName allDockerName);
|
||||
|
||||
/**
|
||||
* 新增容器id存储
|
||||
*
|
||||
* @param allDockerName 容器id存储
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAllDockerName(AllDockerName allDockerName);
|
||||
|
||||
/**
|
||||
* 修改容器id存储
|
||||
*
|
||||
* @param allDockerName 容器id存储
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAllDockerName(AllDockerName allDockerName);
|
||||
|
||||
/**
|
||||
* 批量删除容器id存储
|
||||
*
|
||||
* @param ids 需要删除的容器id存储主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAllDockerNameByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除容器id存储信息
|
||||
*
|
||||
* @param id 容器id存储主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAllDockerNameById(Long id);
|
||||
|
||||
void batchInsertAllDockerId(List<InitialDockerInfo> dataList);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.tongran.rocketmq.service;
|
||||
|
||||
import com.tongran.rocketmq.domain.AllMountName;
|
||||
import com.tongran.rocketmq.domain.InitialMountPointInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 挂载点路径名称存储Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
public interface IAllMountNameService
|
||||
{
|
||||
/**
|
||||
* 查询挂载点路径名称存储
|
||||
*
|
||||
* @param id 挂载点路径名称存储主键
|
||||
* @return 挂载点路径名称存储
|
||||
*/
|
||||
public AllMountName selectAllMountNameById(Long id);
|
||||
|
||||
/**
|
||||
* 查询挂载点路径名称存储列表
|
||||
*
|
||||
* @param allMountName 挂载点路径名称存储
|
||||
* @return 挂载点路径名称存储集合
|
||||
*/
|
||||
public List<AllMountName> selectAllMountNameList(AllMountName allMountName);
|
||||
|
||||
/**
|
||||
* 新增挂载点路径名称存储
|
||||
*
|
||||
* @param allMountName 挂载点路径名称存储
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAllMountName(AllMountName allMountName);
|
||||
|
||||
/**
|
||||
* 修改挂载点路径名称存储
|
||||
*
|
||||
* @param allMountName 挂载点路径名称存储
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAllMountName(AllMountName allMountName);
|
||||
|
||||
/**
|
||||
* 批量删除挂载点路径名称存储
|
||||
*
|
||||
* @param ids 需要删除的挂载点路径名称存储主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAllMountNameByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除挂载点路径名称存储信息
|
||||
*
|
||||
* @param id 挂载点路径名称存储主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAllMountNameById(Long id);
|
||||
|
||||
void batchInsertAllMount(List<InitialMountPointInfo> dataList);
|
||||
}
|
||||
+2
-1
@@ -2,6 +2,7 @@ package com.tongran.rocketmq.service;
|
||||
|
||||
import com.tongran.rocketmq.domain.InitialCpuInfo;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -66,7 +67,7 @@ public interface IInitialCpuInfoService
|
||||
* @param list CPU监控信息信息集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchInsertInitialCpuInfo(List<InitialCpuInfo> list);
|
||||
public int batchInsertInitialCpuInfo(List<InitialCpuInfo> list, Date createTime);
|
||||
|
||||
Map<String, Object> cupLoadEcharts(InitialCpuInfo initialCpuInfo);
|
||||
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@ package com.tongran.rocketmq.service;
|
||||
|
||||
import com.tongran.rocketmq.domain.InitialDockerInfo;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -67,7 +68,7 @@ public interface IInitialDockerInfoService
|
||||
* @param initialDockerInfo 容器监控信息集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchInsertInitialDockerInfo(List<InitialDockerInfo> initialDockerInfo);
|
||||
public int batchInsertInitialDockerInfo(List<InitialDockerInfo> initialDockerInfo, Date createTime);
|
||||
|
||||
/**
|
||||
* 容器基础信息
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package com.tongran.rocketmq.service;
|
||||
|
||||
import com.tongran.rocketmq.domain.InitialMountPointInfo;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -67,7 +67,7 @@ public interface IInitialMountPointInfoService
|
||||
* @param list 挂载点监控信息集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchInsertInitialMountPointInfo(@Param("list") List<InitialMountPointInfo> list);
|
||||
public int batchInsertInitialMountPointInfo(List<InitialMountPointInfo> list, Date createTime);
|
||||
/**
|
||||
* 获取挂载点监控信息详细信息
|
||||
*/
|
||||
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
package com.tongran.rocketmq.service.impl;
|
||||
|
||||
import com.tongran.common.core.utils.DateUtils;
|
||||
import com.tongran.rocketmq.domain.AllDockerName;
|
||||
import com.tongran.rocketmq.domain.InitialDockerInfo;
|
||||
import com.tongran.rocketmq.mapper.AllDockerNameMapper;
|
||||
import com.tongran.rocketmq.service.IAllDockerNameService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 容器id存储Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@Service
|
||||
public class AllDockerNameServiceImpl implements IAllDockerNameService
|
||||
{
|
||||
@Autowired
|
||||
private AllDockerNameMapper allDockerNameMapper;
|
||||
|
||||
/**
|
||||
* 查询容器id存储
|
||||
*
|
||||
* @param id 容器id存储主键
|
||||
* @return 容器id存储
|
||||
*/
|
||||
@Override
|
||||
public AllDockerName selectAllDockerNameById(Long id)
|
||||
{
|
||||
return allDockerNameMapper.selectAllDockerNameById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询容器id存储列表
|
||||
*
|
||||
* @param allDockerName 容器id存储
|
||||
* @return 容器id存储
|
||||
*/
|
||||
@Override
|
||||
public List<AllDockerName> selectAllDockerNameList(AllDockerName allDockerName)
|
||||
{
|
||||
return allDockerNameMapper.selectAllDockerNameList(allDockerName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增容器id存储
|
||||
*
|
||||
* @param allDockerName 容器id存储
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAllDockerName(AllDockerName allDockerName)
|
||||
{
|
||||
allDockerName.setCreateTime(DateUtils.getNowDate());
|
||||
return allDockerNameMapper.insertAllDockerName(allDockerName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改容器id存储
|
||||
*
|
||||
* @param allDockerName 容器id存储
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAllDockerName(AllDockerName allDockerName)
|
||||
{
|
||||
allDockerName.setUpdateTime(DateUtils.getNowDate());
|
||||
return allDockerNameMapper.updateAllDockerName(allDockerName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除容器id存储
|
||||
*
|
||||
* @param ids 需要删除的容器id存储主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAllDockerNameByIds(Long[] ids)
|
||||
{
|
||||
return allDockerNameMapper.deleteAllDockerNameByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除容器id存储信息
|
||||
*
|
||||
* @param id 容器id存储主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAllDockerNameById(Long id)
|
||||
{
|
||||
return allDockerNameMapper.deleteAllDockerNameById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchInsertAllDockerId(List<InitialDockerInfo> dataList) {
|
||||
List<AllDockerName> nameList = new ArrayList<>();
|
||||
for (InitialDockerInfo initialDockerInfo : dataList) {
|
||||
AllDockerName allDockerName = new AllDockerName();
|
||||
allDockerName.setClientId(initialDockerInfo.getClientId());
|
||||
allDockerName.setDockerId(initialDockerInfo.getId());
|
||||
allDockerName.setCreateTime(initialDockerInfo.getCreateTime());
|
||||
allDockerName.setUpdateTime(DateUtils.getNowDate());
|
||||
nameList.add(allDockerName);
|
||||
}
|
||||
allDockerNameMapper.batchInsertAllDockerId(nameList);
|
||||
}
|
||||
}
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
package com.tongran.rocketmq.service.impl;
|
||||
|
||||
import com.tongran.common.core.utils.DateUtils;
|
||||
import com.tongran.rocketmq.domain.AllMountName;
|
||||
import com.tongran.rocketmq.domain.InitialMountPointInfo;
|
||||
import com.tongran.rocketmq.mapper.AllMountNameMapper;
|
||||
import com.tongran.rocketmq.service.IAllMountNameService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 挂载点路径名称存储Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@Service
|
||||
public class AllMountNameServiceImpl implements IAllMountNameService
|
||||
{
|
||||
@Autowired
|
||||
private AllMountNameMapper allMountNameMapper;
|
||||
|
||||
/**
|
||||
* 查询挂载点路径名称存储
|
||||
*
|
||||
* @param id 挂载点路径名称存储主键
|
||||
* @return 挂载点路径名称存储
|
||||
*/
|
||||
@Override
|
||||
public AllMountName selectAllMountNameById(Long id)
|
||||
{
|
||||
return allMountNameMapper.selectAllMountNameById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询挂载点路径名称存储列表
|
||||
*
|
||||
* @param allMountName 挂载点路径名称存储
|
||||
* @return 挂载点路径名称存储
|
||||
*/
|
||||
@Override
|
||||
public List<AllMountName> selectAllMountNameList(AllMountName allMountName)
|
||||
{
|
||||
return allMountNameMapper.selectAllMountNameList(allMountName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增挂载点路径名称存储
|
||||
*
|
||||
* @param allMountName 挂载点路径名称存储
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAllMountName(AllMountName allMountName)
|
||||
{
|
||||
allMountName.setCreateTime(DateUtils.getNowDate());
|
||||
return allMountNameMapper.insertAllMountName(allMountName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改挂载点路径名称存储
|
||||
*
|
||||
* @param allMountName 挂载点路径名称存储
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAllMountName(AllMountName allMountName)
|
||||
{
|
||||
allMountName.setUpdateTime(DateUtils.getNowDate());
|
||||
return allMountNameMapper.updateAllMountName(allMountName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除挂载点路径名称存储
|
||||
*
|
||||
* @param ids 需要删除的挂载点路径名称存储主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAllMountNameByIds(Long[] ids)
|
||||
{
|
||||
return allMountNameMapper.deleteAllMountNameByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除挂载点路径名称存储信息
|
||||
*
|
||||
* @param id 挂载点路径名称存储主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAllMountNameById(Long id)
|
||||
{
|
||||
return allMountNameMapper.deleteAllMountNameById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchInsertAllMount(List<InitialMountPointInfo> dataList) {
|
||||
List<AllMountName> nameList = new ArrayList<>();
|
||||
for (InitialMountPointInfo initialMountPointInfo : dataList) {
|
||||
AllMountName allMountName = new AllMountName();
|
||||
allMountName.setClientId(initialMountPointInfo.getClientId());
|
||||
allMountName.setMount(initialMountPointInfo.getMount());
|
||||
allMountName.setCreateTime(initialMountPointInfo.getCreateTime());
|
||||
allMountName.setUpdateTime(DateUtils.getNowDate());
|
||||
nameList.add(allMountName);
|
||||
}
|
||||
allMountNameMapper.batchInsertAllMount(nameList);
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -683,7 +683,8 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf
|
||||
String memTotalSize = initialSystemOtherCollectDataMapper.getMemTotalSize(memQuery);
|
||||
resultMap.put("memTotalSize", memTotalSize);
|
||||
// 获取cpu数量
|
||||
InitialCpuInfo cpuInfo = initialCpuInfoMapper.getCpuInfoByClientId(initialBandwidthTraffic.getClientId());
|
||||
String cpuTbaleName = TableSubUtil.getTableName(DateUtils.getNowDate(), "initial_cpu_info");
|
||||
InitialCpuInfo cpuInfo = initialCpuInfoMapper.getCpuInfoByClientId(initialBandwidthTraffic.getClientId(), cpuTbaleName);
|
||||
if (cpuInfo == null) {
|
||||
cpuInfo = new InitialCpuInfo();
|
||||
}
|
||||
|
||||
+64
-8
@@ -2,6 +2,7 @@ package com.tongran.rocketmq.service.impl;
|
||||
|
||||
import com.tongran.common.core.utils.DateUtils;
|
||||
import com.tongran.common.core.utils.EchartsDataUtils;
|
||||
import com.tongran.common.core.utils.TableSubUtil;
|
||||
import com.tongran.rocketmq.domain.InitialCpuInfo;
|
||||
import com.tongran.rocketmq.domain.RmAlarmLog;
|
||||
import com.tongran.rocketmq.domain.RmAlarmThreshold;
|
||||
@@ -13,16 +14,16 @@ import com.tongran.rocketmq.mapper.RmAlarmThresholdMapper;
|
||||
import com.tongran.rocketmq.service.IInitialCpuInfoService;
|
||||
import com.tongran.rocketmq.utils.SendAlarmPushUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.tongran.common.core.utils.EchartsDataUtils.convertMicrosecondsToSeconds;
|
||||
|
||||
@@ -37,6 +38,7 @@ import static com.tongran.common.core.utils.EchartsDataUtils.convertMicroseconds
|
||||
@Slf4j
|
||||
public class InitialCpuInfoServiceImpl implements IInitialCpuInfoService
|
||||
{
|
||||
private static final String TABLE_PREFIX = "initial_cpu_info";
|
||||
@Autowired
|
||||
private InitialCpuInfoMapper initialCpuInfoMapper;
|
||||
@Autowired
|
||||
@@ -128,7 +130,10 @@ public class InitialCpuInfoServiceImpl implements IInitialCpuInfoService
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
||||
public int batchInsertInitialCpuInfo(List<InitialCpuInfo> list) {
|
||||
public int batchInsertInitialCpuInfo(List<InitialCpuInfo> list, Date createTime) {
|
||||
if (list == null || list.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
try {
|
||||
// 查询告警阈值
|
||||
RmAlarmThreshold thresholdQuery = new RmAlarmThreshold();
|
||||
@@ -172,13 +177,64 @@ public class InitialCpuInfoServiceImpl implements IInitialCpuInfoService
|
||||
}
|
||||
}
|
||||
}
|
||||
return initialCpuInfoMapper.batchInsertInitialCpuInfo(list);
|
||||
// 按表名分组批量插入
|
||||
Map<String, List<InitialCpuInfo>> groupedData = list.stream()
|
||||
.map(data -> {
|
||||
try {
|
||||
InitialCpuInfo processed = new InitialCpuInfo();
|
||||
BeanUtils.copyProperties(data,processed);
|
||||
if (data.getCreateTime() == null) {
|
||||
data.setCreateTime(DateUtils.getNowDate());
|
||||
}
|
||||
processed.setTableName(TableSubUtil.getTableName(createTime, TABLE_PREFIX));
|
||||
return processed;
|
||||
} catch (Exception e){
|
||||
log.error("数据处理失败",e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}).collect(Collectors.groupingBy(
|
||||
InitialCpuInfo::getTableName,
|
||||
LinkedHashMap::new, // 保持插入顺序
|
||||
Collectors.toList()));
|
||||
|
||||
groupedData.forEach((tableName, dataList) -> {
|
||||
try {
|
||||
InitialCpuInfo data = new InitialCpuInfo();
|
||||
data.setTableName(tableName);
|
||||
data.setList(dataList);
|
||||
initialCpuInfoMapper.batchInsertInitialCpuInfo(data);
|
||||
} catch (Exception e) {
|
||||
log.error("表{}插入失败", tableName, e);
|
||||
throw new RuntimeException("批量插入失败", e);
|
||||
}
|
||||
});
|
||||
return 1;
|
||||
}catch (Exception e){
|
||||
log.error("批量插入CPU信息失败,失败数量:{}", list.size(), e);
|
||||
throw new RuntimeException("批量保存失败",e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 分表查询硬盘信息
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
public List<InitialCpuInfo> getCpuInfoSharding(InitialCpuInfo queryParam) {
|
||||
// 获取涉及的表名
|
||||
Set<String> tableNames = TableSubUtil.getExistingTableNamesBetween(queryParam.getStartTime(), queryParam.getEndTime(), TABLE_PREFIX);
|
||||
|
||||
// 并行查询各表
|
||||
return tableNames.parallelStream()
|
||||
.flatMap(tableName -> {
|
||||
InitialCpuInfo condition = new InitialCpuInfo();
|
||||
condition.setTableName(tableName);
|
||||
condition.setClientId(queryParam.getClientId());
|
||||
condition.setStartTime(queryParam.getStartTime());
|
||||
condition.setEndTime(queryParam.getEndTime());
|
||||
return initialCpuInfoMapper.selectInitialCpuInfoListByCondition(condition).stream();
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
/**
|
||||
* cpu负载
|
||||
* @param initialCpuInfo
|
||||
@@ -187,7 +243,7 @@ public class InitialCpuInfoServiceImpl implements IInitialCpuInfoService
|
||||
@Override
|
||||
public Map<String, Object> cupLoadEcharts(InitialCpuInfo initialCpuInfo) {
|
||||
// 查询原始CPU监控数据并按时间排序
|
||||
List<InitialCpuInfo> list = initialCpuInfoMapper.selectInitialCpuInfoList(initialCpuInfo);
|
||||
List<InitialCpuInfo> list = getCpuInfoSharding(initialCpuInfo);
|
||||
|
||||
Map<String, Function<InitialCpuInfo, ?>> extractors = new LinkedHashMap<>();
|
||||
extractors.put("load1Data", InitialCpuInfo::getAvg1);
|
||||
@@ -204,7 +260,7 @@ public class InitialCpuInfoServiceImpl implements IInitialCpuInfoService
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> cpuTimeEcharts(InitialCpuInfo initialCpuInfo) {
|
||||
List<InitialCpuInfo> list = initialCpuInfoMapper.selectInitialCpuInfoList(initialCpuInfo);
|
||||
List<InitialCpuInfo> list = getCpuInfoSharding(initialCpuInfo);
|
||||
|
||||
Map<String, Function<InitialCpuInfo, ?>> extractors = new LinkedHashMap<>();
|
||||
extractors.put("normalData", info -> convertMicrosecondsToSeconds(info.getNormal()));
|
||||
@@ -224,7 +280,7 @@ public class InitialCpuInfoServiceImpl implements IInitialCpuInfoService
|
||||
@Override
|
||||
public Map<String, Object> cupTemperatureEcharts(InitialCpuInfo initialCpuInfo) {
|
||||
// 查询原始CPU监控数据并按时间排序
|
||||
List<InitialCpuInfo> list = initialCpuInfoMapper.selectInitialCpuInfoList(initialCpuInfo);
|
||||
List<InitialCpuInfo> list = getCpuInfoSharding(initialCpuInfo);
|
||||
|
||||
Map<String, Function<InitialCpuInfo, ?>> extractors = new LinkedHashMap<>();
|
||||
extractors.put("temperatureData", InitialCpuInfo::getTemperature);
|
||||
|
||||
+72
-11
@@ -2,19 +2,21 @@ package com.tongran.rocketmq.service.impl;
|
||||
|
||||
import com.tongran.common.core.utils.DateUtils;
|
||||
import com.tongran.common.core.utils.EchartsDataUtils;
|
||||
import com.tongran.common.core.utils.TableSubUtil;
|
||||
import com.tongran.rocketmq.domain.InitialDockerInfo;
|
||||
import com.tongran.rocketmq.mapper.InitialDockerInfoMapper;
|
||||
import com.tongran.rocketmq.service.IAllDockerNameService;
|
||||
import com.tongran.rocketmq.service.IInitialDockerInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 容器监控信息Service业务层处理
|
||||
@@ -26,8 +28,11 @@ import java.util.function.Function;
|
||||
@Slf4j
|
||||
public class InitialDockerInfoServiceImpl implements IInitialDockerInfoService
|
||||
{
|
||||
private static final String TABLE_PREFIX = "initial_docker_info";
|
||||
@Autowired
|
||||
private InitialDockerInfoMapper initialDockerInfoMapper;
|
||||
@Autowired
|
||||
private IAllDockerNameService allDockerNameService;
|
||||
|
||||
/**
|
||||
* 查询容器监控信息
|
||||
@@ -106,20 +111,74 @@ public class InitialDockerInfoServiceImpl implements IInitialDockerInfoService
|
||||
/**
|
||||
* 批量新增容器监控信息
|
||||
*
|
||||
* @param initialDockerInfo 容器监控信息集合
|
||||
* @param list 容器监控信息集合
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
||||
public int batchInsertInitialDockerInfo(List<InitialDockerInfo> initialDockerInfo){
|
||||
public int batchInsertInitialDockerInfo(List<InitialDockerInfo> list, Date createTime){
|
||||
try {
|
||||
return initialDockerInfoMapper.batchInsertInitialDockerInfo(initialDockerInfo);
|
||||
// 按表名分组批量插入
|
||||
Map<String, List<InitialDockerInfo>> groupedData = list.stream()
|
||||
.map(data -> {
|
||||
try {
|
||||
InitialDockerInfo processed = new InitialDockerInfo();
|
||||
BeanUtils.copyProperties(data,processed);
|
||||
if (data.getCreateTime() == null) {
|
||||
data.setCreateTime(DateUtils.getNowDate());
|
||||
}
|
||||
processed.setTableName(TableSubUtil.getTableName(createTime, TABLE_PREFIX));
|
||||
return processed;
|
||||
} catch (Exception e){
|
||||
log.error("数据处理失败",e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}).collect(Collectors.groupingBy(
|
||||
InitialDockerInfo::getTableName,
|
||||
LinkedHashMap::new, // 保持插入顺序
|
||||
Collectors.toList()));
|
||||
|
||||
groupedData.forEach((tableName, dataList) -> {
|
||||
try {
|
||||
InitialDockerInfo data = new InitialDockerInfo();
|
||||
data.setTableName(tableName);
|
||||
data.setList(dataList);
|
||||
initialDockerInfoMapper.batchInsertInitialDockerInfo(data);
|
||||
// 记录挂载点路径名称
|
||||
allDockerNameService.batchInsertAllDockerId(dataList);
|
||||
} catch (Exception e) {
|
||||
log.error("表{}插入失败", tableName, e);
|
||||
throw new RuntimeException("批量插入失败", e);
|
||||
}
|
||||
});
|
||||
return 1;
|
||||
}catch (Exception e){
|
||||
log.error("批量插入Docker信息失败,失败数量:{}", initialDockerInfo.size(), e);
|
||||
log.error("批量插入Docker信息失败,失败数量:{}", list.size(), e);
|
||||
throw new RuntimeException("批量保存失败",e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 分表查询硬盘信息
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
public List<InitialDockerInfo> getDockerInfoSharding(InitialDockerInfo queryParam) {
|
||||
// 获取涉及的表名
|
||||
Set<String> tableNames = TableSubUtil.getExistingTableNamesBetween(queryParam.getStartTime(), queryParam.getEndTime(), TABLE_PREFIX);
|
||||
|
||||
// 并行查询各表
|
||||
return tableNames.parallelStream()
|
||||
.flatMap(tableName -> {
|
||||
InitialDockerInfo condition = new InitialDockerInfo();
|
||||
condition.setTableName(tableName);
|
||||
condition.setClientId(queryParam.getClientId());
|
||||
condition.setId(queryParam.getId());
|
||||
condition.setStartTime(queryParam.getStartTime());
|
||||
condition.setEndTime(queryParam.getEndTime());
|
||||
return initialDockerInfoMapper.selectInitialDockerInfoListByCondition(condition).stream();
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
/**
|
||||
* 容器基础信息
|
||||
* @param initialDockerInfo
|
||||
@@ -127,17 +186,19 @@ public class InitialDockerInfoServiceImpl implements IInitialDockerInfoService
|
||||
*/
|
||||
@Override
|
||||
public InitialDockerInfo getDockerDetailsMsg(InitialDockerInfo initialDockerInfo) {
|
||||
String tableName = TableSubUtil.getTableName(DateUtils.getNowDate(), TABLE_PREFIX);
|
||||
initialDockerInfo.setTableName(tableName);
|
||||
return initialDockerInfoMapper.getDockerDetailsMsg(initialDockerInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* cou利用率
|
||||
* cpu利用率
|
||||
* @param initialDockerInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> cpuUtilEcharts(InitialDockerInfo initialDockerInfo) {
|
||||
List<InitialDockerInfo> list = initialDockerInfoMapper.selectInitialDockerInfoList(initialDockerInfo);
|
||||
List<InitialDockerInfo> list = getDockerInfoSharding(initialDockerInfo);
|
||||
Map<String, Function<InitialDockerInfo, ?>> extractors = new LinkedHashMap<>();
|
||||
extractors.put("cpuUtilData", info -> info.getCpuUtil());
|
||||
return EchartsDataUtils.buildEchartsData(list, InitialDockerInfo::getCreateTime, extractors);
|
||||
@@ -149,7 +210,7 @@ public class InitialDockerInfoServiceImpl implements IInitialDockerInfoService
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> memUtilEcharts(InitialDockerInfo initialDockerInfo) {
|
||||
List<InitialDockerInfo> list = initialDockerInfoMapper.selectInitialDockerInfoList(initialDockerInfo);
|
||||
List<InitialDockerInfo> list = getDockerInfoSharding(initialDockerInfo);
|
||||
Map<String, Function<InitialDockerInfo, ?>> extractors = new LinkedHashMap<>();
|
||||
extractors.put("memUtilData", info -> info.getMemUtil());
|
||||
return EchartsDataUtils.buildEchartsData(list, InitialDockerInfo::getCreateTime, extractors);
|
||||
@@ -161,7 +222,7 @@ public class InitialDockerInfoServiceImpl implements IInitialDockerInfoService
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> netSpeedEcharts(InitialDockerInfo initialDockerInfo) {
|
||||
List<InitialDockerInfo> list = initialDockerInfoMapper.selectInitialDockerInfoList(initialDockerInfo);
|
||||
List<InitialDockerInfo> list = getDockerInfoSharding(initialDockerInfo);
|
||||
Map<String, Function<InitialDockerInfo, ?>> extractors = new LinkedHashMap<>();
|
||||
extractors.put("netInSpeedData", info -> info.getNetInSpeed());
|
||||
extractors.put("netOutSpeedData", info -> info.getNetOutSpeed());
|
||||
|
||||
+69
-7
@@ -2,20 +2,22 @@ package com.tongran.rocketmq.service.impl;
|
||||
|
||||
import com.tongran.common.core.utils.DateUtils;
|
||||
import com.tongran.common.core.utils.EchartsDataUtils;
|
||||
import com.tongran.common.core.utils.TableSubUtil;
|
||||
import com.tongran.common.core.utils.UnitChangeUtil;
|
||||
import com.tongran.rocketmq.domain.InitialMountPointInfo;
|
||||
import com.tongran.rocketmq.mapper.InitialMountPointInfoMapper;
|
||||
import com.tongran.rocketmq.service.IAllMountNameService;
|
||||
import com.tongran.rocketmq.service.IInitialMountPointInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 挂载点监控信息Service业务层处理
|
||||
@@ -27,8 +29,12 @@ import java.util.function.Function;
|
||||
@Slf4j
|
||||
public class InitialMountPointInfoServiceImpl implements IInitialMountPointInfoService
|
||||
{
|
||||
|
||||
private static final String TABLE_PREFIX = "initial_mount_point_info";
|
||||
@Autowired
|
||||
private InitialMountPointInfoMapper initialMountPointInfoMapper;
|
||||
@Autowired
|
||||
private IAllMountNameService allMountNameService;
|
||||
|
||||
/**
|
||||
* 查询挂载点监控信息
|
||||
@@ -111,17 +117,73 @@ public class InitialMountPointInfoServiceImpl implements IInitialMountPointInfoS
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
||||
public int batchInsertInitialMountPointInfo(List<InitialMountPointInfo> list) {
|
||||
public int batchInsertInitialMountPointInfo(List<InitialMountPointInfo> list, Date createTime) {
|
||||
try {
|
||||
return initialMountPointInfoMapper.batchInsertInitialMountPointInfo(list);
|
||||
// 按表名分组批量插入
|
||||
Map<String, List<InitialMountPointInfo>> groupedData = list.stream()
|
||||
.map(data -> {
|
||||
try {
|
||||
InitialMountPointInfo processed = new InitialMountPointInfo();
|
||||
BeanUtils.copyProperties(data,processed);
|
||||
if (data.getCreateTime() == null) {
|
||||
data.setCreateTime(DateUtils.getNowDate());
|
||||
}
|
||||
processed.setTableName(TableSubUtil.getTableName(createTime, TABLE_PREFIX));
|
||||
return processed;
|
||||
} catch (Exception e){
|
||||
log.error("数据处理失败",e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}).collect(Collectors.groupingBy(
|
||||
InitialMountPointInfo::getTableName,
|
||||
LinkedHashMap::new, // 保持插入顺序
|
||||
Collectors.toList()));
|
||||
|
||||
groupedData.forEach((tableName, dataList) -> {
|
||||
try {
|
||||
InitialMountPointInfo data = new InitialMountPointInfo();
|
||||
data.setTableName(tableName);
|
||||
data.setList(dataList);
|
||||
initialMountPointInfoMapper.batchInsertInitialMountPointInfo(data);
|
||||
// 记录挂载点路径名称
|
||||
allMountNameService.batchInsertAllMount(dataList);
|
||||
} catch (Exception e) {
|
||||
log.error("表{}插入失败", tableName, e);
|
||||
throw new RuntimeException("批量插入失败", e);
|
||||
}
|
||||
});
|
||||
return 1;
|
||||
}catch (Exception e){
|
||||
log.error("批量插入挂载点信息失败,失败数量:{}", list.size(), e);
|
||||
throw new RuntimeException("批量保存失败",e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 分表查询硬盘信息
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
public List<InitialMountPointInfo> getMountPointInfoSharding(InitialMountPointInfo queryParam) {
|
||||
// 获取涉及的表名
|
||||
Set<String> tableNames = TableSubUtil.getExistingTableNamesBetween(queryParam.getStartTime(), queryParam.getEndTime(), TABLE_PREFIX);
|
||||
|
||||
// 并行查询各表
|
||||
return tableNames.parallelStream()
|
||||
.flatMap(tableName -> {
|
||||
InitialMountPointInfo condition = new InitialMountPointInfo();
|
||||
condition.setTableName(tableName);
|
||||
condition.setClientId(queryParam.getClientId());
|
||||
condition.setMount(queryParam.getMount());
|
||||
condition.setStartTime(queryParam.getStartTime());
|
||||
condition.setEndTime(queryParam.getEndTime());
|
||||
return initialMountPointInfoMapper.selectInitialMountPointInfoListByCondition(condition).stream();
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
@Override
|
||||
public InitialMountPointInfo pointDetailsMsg(InitialMountPointInfo initialMountPointInfo) {
|
||||
String tableName = TableSubUtil.getTableName(DateUtils.getNowDate(), TABLE_PREFIX);
|
||||
initialMountPointInfo.setTableName(tableName);
|
||||
return initialMountPointInfoMapper.pointDetailsMsg(initialMountPointInfo);
|
||||
}
|
||||
|
||||
@@ -132,7 +194,7 @@ public class InitialMountPointInfoServiceImpl implements IInitialMountPointInfoS
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> spaceEcharts(InitialMountPointInfo initialMountPointInfo) {
|
||||
List<InitialMountPointInfo> list = initialMountPointInfoMapper.selectInitialMountPointInfoList(initialMountPointInfo);
|
||||
List<InitialMountPointInfo> list = getMountPointInfoSharding(initialMountPointInfo);
|
||||
Map<String, Function<InitialMountPointInfo, ?>> extractors = new LinkedHashMap<>();
|
||||
extractors.put("vfsFreeData", info -> UnitChangeUtil.bytesToGb(info.getVfsFree()));
|
||||
extractors.put("vfsTotalData", info -> UnitChangeUtil.bytesToGb(info.getVfsTotal()));
|
||||
@@ -146,7 +208,7 @@ public class InitialMountPointInfoServiceImpl implements IInitialMountPointInfoS
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> spaceRateEcharts(InitialMountPointInfo initialMountPointInfo) {
|
||||
List<InitialMountPointInfo> list = initialMountPointInfoMapper.selectInitialMountPointInfoList(initialMountPointInfo);
|
||||
List<InitialMountPointInfo> list = getMountPointInfoSharding(initialMountPointInfo);
|
||||
Map<String, Function<InitialMountPointInfo, ?>> extractors = new LinkedHashMap<>();
|
||||
extractors.put("vfsUtilData", InitialMountPointInfo::getVfsUtil);
|
||||
extractors.put("usedData", info -> {
|
||||
|
||||
+3
-1
@@ -2,6 +2,7 @@ package com.tongran.rocketmq.service.impl;
|
||||
|
||||
import com.tongran.common.core.utils.DateUtils;
|
||||
import com.tongran.common.core.utils.EchartsDataUtils;
|
||||
import com.tongran.common.core.utils.TableSubUtil;
|
||||
import com.tongran.rocketmq.domain.InitialCpuInfo;
|
||||
import com.tongran.rocketmq.domain.InitialMemoryInfo;
|
||||
import com.tongran.rocketmq.domain.InitialSystemInfo;
|
||||
@@ -168,7 +169,8 @@ public class InitialSystemInfoServiceImpl implements IInitialSystemInfoService
|
||||
// 获取总内存信息
|
||||
InitialMemoryInfo memoryInfo = initialMemoryInfoMapper.getMemoryInfoByClientId(initialSystemInfo.getClientId());
|
||||
// 获取cpu数量
|
||||
InitialCpuInfo cpuInfo = initialCpuInfoMapper.getCpuInfoByClientId(initialSystemInfo.getClientId());
|
||||
String cpuTbaleName = TableSubUtil.getTableName(DateUtils.getNowDate(), "initial_cpu_info");
|
||||
InitialCpuInfo cpuInfo = initialCpuInfoMapper.getCpuInfoByClientId(initialSystemInfo.getClientId(), cpuTbaleName);
|
||||
// 获取系统信息
|
||||
SystemMsgVo systemMsgVo = initialSystemInfoMapper.getSystemMsgByClientId(initialSystemInfo.getClientId());
|
||||
systemMsgVo.setNum(cpuInfo.getNum());
|
||||
|
||||
+2
-1
@@ -136,7 +136,8 @@ public class InitialSystemOtherCollectDataServiceImpl implements IInitialSystemO
|
||||
"0".equals(uptime) ? null : UnitChangeUtil.formatUptimeSeconds(Long.parseLong(uptime)));
|
||||
}
|
||||
// 获取cpu数量
|
||||
InitialCpuInfo cpuInfo = initialCpuInfoMapper.getCpuInfoByClientId(initialSystemOtherCollectData.getClientId());
|
||||
String cpuTbaleName = TableSubUtil.getTableName(DateUtils.getNowDate(), "initial_cpu_info");
|
||||
InitialCpuInfo cpuInfo = initialCpuInfoMapper.getCpuInfoByClientId(initialSystemOtherCollectData.getClientId(), cpuTbaleName);
|
||||
if (cpuInfo == null) {
|
||||
cpuInfo = new InitialCpuInfo();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user