rocketmq,收益管理,资源管理模块代码

This commit is contained in:
gaoyutao
2025-08-21 09:28:46 +08:00
parent 499e93b68a
commit 80dbba70fe
110 changed files with 9430 additions and 68 deletions

View File

@@ -260,6 +260,7 @@
<module>ruoyi-gateway</module>
<module>ruoyi-visual</module>
<module>ruoyi-modules</module>
<module>ruoyi-rocketmq</module>
<module>ruoyi-api</module>
<module>ruoyi-common</module>
</modules>

View File

@@ -22,7 +22,11 @@
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-core</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -1,18 +1,15 @@
package com.ruoyi.system.api;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.EpsInitialTrafficDataRemote;
import com.ruoyi.system.api.domain.NodeBandwidth;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.factory.RemoteUserFallbackFactory;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
/**
* 用户服务
@@ -51,4 +48,35 @@ public interface RemoteUserService
*/
@PutMapping("/user/recordlogin")
public R<Boolean> recordUserLogin(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* @param nodeBandwidth 服务器带宽收益
* @param source 请求来源
* @return 结果
*/
@PostMapping("/bandwidth/list")
public R<NodeBandwidth> getBandwidth(@RequestBody NodeBandwidth nodeBandwidth, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* @param nodeBandwidth 服务器带宽收益
* @param source 请求来源
* @return 结果
*/
@PostMapping("/bandwidth")
public R<Boolean> saveBandwidth(@RequestBody NodeBandwidth nodeBandwidth, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 查询流量数据POST方式
* @param queryParam 查询参数实体
* source 请求来源
* @return 流量数据列表
*/
@PostMapping("/query")
public R<EpsInitialTrafficDataRemote> query(@RequestBody EpsInitialTrafficDataRemote queryParam, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 批量保存流量数据
* @param queryParam 流量数据列表
* @return 操作结果
*/
@PostMapping("/batch")
public R<Boolean> batchInitialTraffic(@RequestBody EpsInitialTrafficDataRemote queryParam, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}

View File

@@ -0,0 +1,109 @@
package com.ruoyi.system.api.domain;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.LinkedHashSet;
import java.util.Set;
/**
* EPS初始流量数据实体类
* 用于存储设备的接收和发送流量数据
* 支持按时间自动分表存储每月分成3个表
*/
@Data
public class EpsInitialTrafficDataRemote {
/** 主键ID */
private Long id;
/**
* 动态表名
* 格式eps_traffic_[年]_[月]_[日期范围]
* 示例eps_traffic_2023_08_1_10
*/
private String tableName;
/** 流量统计开始时间 */
private LocalDateTime startTime;
/** 流量统计结束时间 */
private LocalDateTime endTime;
/** 接收流量单位MB */
private Double receiveTraffic;
/** 发送流量单位MB */
private Double sendTraffic;
/** 设备序列号 */
private String deviceSn;
/** 数据创建时间 */
private LocalDateTime createTime;
/** 备用字段1 */
private String remark1;
/** 备用字段2 */
private String remark2;
/** 备用字段3 */
private String remark3;
/** 备用字段4 */
private String remark4;
/**
* 根据createTime自动计算表名
* 分表规则每月分成3个表1-10日、11-20日、21-31日
*/
public void calculateTableName() {
if (this.createTime != null) {
int year = createTime.getYear();
int month = createTime.getMonthValue();
int day = createTime.getDayOfMonth();
String range;
if (day <= 10) {
range = "1_10";
} else if (day <= 20) {
range = "11_20";
} else {
range = "21_31";
}
this.tableName = String.format("eps_traffic_%d_%02d_%s", year, month, range);
}
}
/**
* 获取时间范围内涉及的所有表名
* @param start 开始时间
* @param end 结束时间
* @return 涉及的动态表名集合
*/
public static Set<String> getAffectedTables(LocalDateTime start, LocalDateTime end) {
Set<String> tables = new LinkedHashSet<>();
LocalDateTime current = start;
while (!current.isAfter(end)) {
int year = current.getYear();
int month = current.getMonthValue();
int day = current.getDayOfMonth();
String range;
if (day <= 10) {
range = "1_10";
} else if (day <= 20) {
range = "11_20";
} else {
range = "21_31";
}
tables.add(String.format("eps_traffic_%d_%02d_%s", year, month, range));
current = current.plusDays(1);
}
return tables;
}
}

View File

@@ -0,0 +1,236 @@
package com.ruoyi.system.api.domain;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
/**
* 节点带宽信息对象 eps_node_bandwidth
*
* @author gyt
* @date 2025-08-12
*/
public class NodeBandwidth extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 节点名称 */
@Excel(name = "节点名称")
private String nodeName;
/** 硬件SN */
@Excel(name = "硬件SN")
private String hardwareSn;
/** 95带宽值Mbps/日 */
@Excel(name = "95带宽值Mbps/日")
private BigDecimal bandwidth95Daily;
/** 95带宽值Mbps/月 */
@Excel(name = "95带宽值Mbps/月")
private BigDecimal bandwidth95Monthly;
/** 包端带宽值Mbps/日 */
@Excel(name = "包端带宽值Mbps/日")
private BigDecimal packageBandwidthDaily;
/** 设备业务客户id */
@Excel(name = "设备业务客户id")
private String customerId;
/** 设备业务客户名称 */
@Excel(name = "设备业务客户名称")
private String customerName;
/** 业务号 */
@Excel(name = "业务号")
private String serviceNumber;
/** 上联交换机 */
@Excel(name = "上联交换机")
private String uplinkSwitch;
/** 创建人id */
@Excel(name = "创建人id")
private Long creatorId;
/** 创建人名称 */
@Excel(name = "创建人名称")
private String creatorName;
/** remark1 */
@Excel(name = "remark1")
private String remark1;
/** remark2 */
@Excel(name = "remark2")
private String remark2;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setNodeName(String nodeName)
{
this.nodeName = nodeName;
}
public String getNodeName()
{
return nodeName;
}
public void setHardwareSn(String hardwareSn)
{
this.hardwareSn = hardwareSn;
}
public String getHardwareSn()
{
return hardwareSn;
}
public void setBandwidth95Daily(BigDecimal bandwidth95Daily)
{
this.bandwidth95Daily = bandwidth95Daily;
}
public BigDecimal getBandwidth95Daily()
{
return bandwidth95Daily;
}
public void setBandwidth95Monthly(BigDecimal bandwidth95Monthly)
{
this.bandwidth95Monthly = bandwidth95Monthly;
}
public BigDecimal getBandwidth95Monthly()
{
return bandwidth95Monthly;
}
public void setPackageBandwidthDaily(BigDecimal packageBandwidthDaily)
{
this.packageBandwidthDaily = packageBandwidthDaily;
}
public BigDecimal getPackageBandwidthDaily()
{
return packageBandwidthDaily;
}
public void setCustomerId(String customerId)
{
this.customerId = customerId;
}
public String getCustomerId()
{
return customerId;
}
public void setCustomerName(String customerName)
{
this.customerName = customerName;
}
public String getCustomerName()
{
return customerName;
}
public void setServiceNumber(String serviceNumber)
{
this.serviceNumber = serviceNumber;
}
public String getServiceNumber()
{
return serviceNumber;
}
public void setUplinkSwitch(String uplinkSwitch)
{
this.uplinkSwitch = uplinkSwitch;
}
public String getUplinkSwitch()
{
return uplinkSwitch;
}
public void setCreatorId(Long creatorId)
{
this.creatorId = creatorId;
}
public Long getCreatorId()
{
return creatorId;
}
public void setCreatorName(String creatorName)
{
this.creatorName = creatorName;
}
public String getCreatorName()
{
return creatorName;
}
public void setRemark1(String remark1)
{
this.remark1 = remark1;
}
public String getRemark1()
{
return remark1;
}
public void setRemark2(String remark2)
{
this.remark2 = remark2;
}
public String getRemark2()
{
return remark2;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("nodeName", getNodeName())
.append("hardwareSn", getHardwareSn())
.append("bandwidth95Daily", getBandwidth95Daily())
.append("bandwidth95Monthly", getBandwidth95Monthly())
.append("packageBandwidthDaily", getPackageBandwidthDaily())
.append("customerId", getCustomerId())
.append("customerName", getCustomerName())
.append("serviceNumber", getServiceNumber())
.append("uplinkSwitch", getUplinkSwitch())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("creatorId", getCreatorId())
.append("creatorName", getCreatorName())
.append("remark1", getRemark1())
.append("remark2", getRemark2())
.toString();
}
}

View File

@@ -1,13 +1,15 @@
package com.ruoyi.system.api.factory;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.RemoteUserService;
import com.ruoyi.system.api.domain.EpsInitialTrafficDataRemote;
import com.ruoyi.system.api.domain.NodeBandwidth;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.model.LoginUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.RemoteUserService;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.model.LoginUser;
/**
* 用户服务降级处理
@@ -42,6 +44,25 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
{
return R.fail("记录用户登录信息失败:" + throwable.getMessage());
}
@Override
public R<NodeBandwidth> getBandwidth(NodeBandwidth nodeBandwidth, String source) {
return R.fail("获取服务器带宽失败:" + throwable.getMessage());
}
@Override
public R<Boolean> saveBandwidth(NodeBandwidth nodeBandwidth, String source) {
return R.fail("新增服务器带宽失败:" + throwable.getMessage());
}
@Override
public R<EpsInitialTrafficDataRemote> query(EpsInitialTrafficDataRemote queryParam, String source) {
return R.fail("获取初始流量数据失败:" + throwable.getMessage());
}
@Override
public R<Boolean> batchInitialTraffic(EpsInitialTrafficDataRemote queryParam, String source) {
return R.fail("新增初始流量数据失败:" + throwable.getMessage());
}
};
}
}

View File

@@ -32,4 +32,23 @@ public class PageUtils extends PageHelper
{
PageHelper.clearPage();
}
/**
* post传参分页
* @param pageDomain
*/
public static void startPage(PageDomain pageDomain)
{
if(pageDomain.getPageNum() == null) {
pageDomain.setPageNum(1);
}
if(pageDomain.getPageSize() == null) {
pageDomain.setPageSize(10);
}
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
Boolean reasonable = pageDomain.getReasonable();
PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
}
}

View File

@@ -1,12 +1,5 @@
package com.ruoyi.common.core.web.controller;
import java.beans.PropertyEditorSupport;
import java.util.Date;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.constant.HttpStatus;
@@ -18,6 +11,14 @@ import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageDomain;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.core.web.page.TableSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import java.beans.PropertyEditorSupport;
import java.util.Date;
import java.util.List;
/**
* web层通用数据处理
@@ -52,6 +53,14 @@ public class BaseController
{
PageUtils.startPage();
}
/**
* 设置请求分页数据
* @param pageDomain
*/
protected void startPage(PageDomain pageDomain)
{
PageUtils.startPage(pageDomain);
}
/**
* 设置请求排序数据

View File

@@ -1,12 +1,13 @@
package com.ruoyi.common.core.web.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
/**
* Entity基类
@@ -38,10 +39,28 @@ public class BaseEntity implements Serializable
/** 备注 */
private String remark;
/** 当前记录起始索引 */
private Integer pageNum;
/** 每页显示记录数 */
private Integer pageSize;
/**
* 选中的属性名称
*/
private String[] properties;
/** 请求参数 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Map<String, Object> params;
public String[] getProperties() {
return properties;
}
public void setProperties(String[] properties) {
this.properties = properties;
}
public String getSearchValue()
{
return searchValue;
@@ -102,6 +121,22 @@ public class BaseEntity implements Serializable
this.remark = remark;
}
public Integer getPageNum() {
return pageNum;
}
public void setPageNum(Integer pageNum) {
this.pageNum = pageNum;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public Map<String, Object> getParams()
{
if (params == null)

View File

@@ -70,6 +70,10 @@
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>

View File

@@ -0,0 +1,25 @@
package com.ruoyi.system.config;
import com.ruoyi.system.service.EpsInitialTrafficDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
/**
* 自动生成数据表
*/
@Configuration
@EnableScheduling
public class TableScheduleConfig {
@Autowired
private EpsInitialTrafficDataService epsInitialTrafficDataService;
// 每月25号创建下月表
@Scheduled(cron = "0 0 0 25 * ?")
// @Scheduled(initialDelay = 5000, fixedDelay = Long.MAX_VALUE)
public void createNextMonthTables() {
epsInitialTrafficDataService.createNextMonthTables();
}
}

View File

@@ -0,0 +1,142 @@
package com.ruoyi.system.controller;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageDomain;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.EpsBusiness;
import com.ruoyi.system.service.IEpsBusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Random;
/**
* 业务信息Controller
*
* @author gyt
* @date 2025-08-18
*/
@RestController
@RequestMapping("/business")
public class EpsBusinessController extends BaseController
{
@Autowired
private IEpsBusinessService epsBusinessService;
/**
* 查询业务信息列表
*/
@RequiresPermissions("system:business:list")
@PostMapping("/list")
public TableDataInfo list(@RequestBody EpsBusiness epsBusiness)
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(epsBusiness.getPageNum());
pageDomain.setPageSize(epsBusiness.getPageSize());
startPage(pageDomain);
List<EpsBusiness> list = epsBusinessService.selectEpsBusinessList(epsBusiness);
return getDataTable(list);
}
/**
* 查询业务信息列表
*/
@RequiresPermissions("system:business:list")
@PostMapping("/getAllBusinessMsg")
public AjaxResult getAllBusinessMsg(@RequestBody EpsBusiness epsBusiness)
{
List<EpsBusiness> list = epsBusinessService.selectEpsBusinessList(epsBusiness);
return success(list);
}
/**
* 导出业务信息列表
*/
@RequiresPermissions("system:business:export")
@Log(title = "业务信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EpsBusiness epsBusiness)
{
List<EpsBusiness> list = epsBusinessService.selectEpsBusinessList(epsBusiness);
ExcelUtil<EpsBusiness> util = new ExcelUtil<EpsBusiness>(EpsBusiness.class);
util.showColumn(epsBusiness.getProperties());
util.exportExcel(response, list, "业务信息数据");
}
/**
* 获取业务信息详细信息
*/
@RequiresPermissions("system:business:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(epsBusinessService.selectEpsBusinessById(id));
}
/**
* 新增业务信息
*/
@RequiresPermissions("system:business:add")
@Log(title = "业务信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EpsBusiness epsBusiness)
{
int rows = epsBusinessService.insertEpsBusiness(epsBusiness);
if(-1==rows){
return AjaxResult.error(500,"业务名称不可重复");
}
return toAjax(rows);
}
/**
* 修改业务信息
*/
@RequiresPermissions("system:business:edit")
@Log(title = "业务信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EpsBusiness epsBusiness)
{
int rows = epsBusinessService.updateEpsBusiness(epsBusiness);
if(-1==rows){
return AjaxResult.error(500,"业务名称不可重复");
}
return toAjax(rows);
}
/**
* 生成12位唯一标识
*/
@RequiresPermissions("system:business:list")
@GetMapping("/getBusinessCode")
public String getBusinessCode()
{
long timestamp = System.currentTimeMillis() / 100; // 取前10位精确到0.1秒)
int random = new Random().nextInt(100); // 2位随机数00~99
return String.format("%010d%02d", timestamp, random);
}
/**
* 验证业务名称是否存在
* @param epsBusiness
* @return
*/
@RequiresPermissions("system:business:list")
@PostMapping("/countByBusinessName")
public AjaxResult countByBusinessName(@RequestBody EpsBusiness epsBusiness)
{
int rows = epsBusinessService.countByBusinessName(epsBusiness);
if(rows>0){
return AjaxResult.error(500,"业务名称不可重复");
}else {
return AjaxResult.success("添加成功");
}
}
}

View File

@@ -0,0 +1,56 @@
package com.ruoyi.system.controller;
import com.ruoyi.system.domain.EpsInitialTrafficData;
import com.ruoyi.system.service.EpsInitialTrafficDataService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* EPS初始流量数据控制器
* 提供流量数据的REST接口
*/
@RestController
@RequestMapping("/eps-traffic-data")
@RequiredArgsConstructor
public class EpsInitialTrafficDataController {
private final EpsInitialTrafficDataService epsInitialTrafficDataService;
/**
* 保存单条流量数据
* @param data 流量数据实体
* @return 操作结果
*/
@PostMapping
public ResponseEntity<Void> save(@RequestBody EpsInitialTrafficData data) {
epsInitialTrafficDataService.save(data);
return ResponseEntity.ok().build();
}
/**
* 批量保存流量数据
* @param dataList 流量数据表
* @return 操作结果
*/
@PostMapping("/batch")
public ResponseEntity<Void> saveBatch(@RequestBody EpsInitialTrafficData dataList) {
epsInitialTrafficDataService.saveBatch(dataList);
return ResponseEntity.ok().build();
}
/**
* 查询流量数据POST方式
* @param queryParam 查询参数实体
* @return 流量数据列表
*/
@PostMapping("/query")
public ResponseEntity<List<EpsInitialTrafficData>> query(@RequestBody EpsInitialTrafficData queryParam) {
List<EpsInitialTrafficData> result = epsInitialTrafficDataService.query(queryParam);
return ResponseEntity.ok(result);
}
}

View File

@@ -0,0 +1,63 @@
package com.ruoyi.system.controller;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.page.PageDomain;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.EpsMethodChangeRecord;
import com.ruoyi.system.service.IEpsMethodChangeRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 收益方式修改记录Controller
*
* @author gyt
* @date 2025-08-19
*/
@RestController
@RequestMapping("/record")
public class EpsMethodChangeRecordController extends BaseController
{
@Autowired
private IEpsMethodChangeRecordService epsMethodChangeRecordService;
/**
* 查询收益方式修改记录列表
*/
@RequiresPermissions("system:record:list")
@PostMapping("/list")
public TableDataInfo list(@RequestBody EpsMethodChangeRecord epsMethodChangeRecord)
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(epsMethodChangeRecord.getPageNum());
pageDomain.setPageSize(epsMethodChangeRecord.getPageSize());
startPage(pageDomain);
List<EpsMethodChangeRecord> list = epsMethodChangeRecordService.selectEpsMethodChangeRecordList(epsMethodChangeRecord);
return getDataTable(list);
}
/**
* 导出收益方式修改记录列表
*/
@RequiresPermissions("system:record:export")
@Log(title = "收益方式修改记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EpsMethodChangeRecord epsMethodChangeRecord)
{
List<EpsMethodChangeRecord> list = epsMethodChangeRecordService.selectEpsMethodChangeRecordList(epsMethodChangeRecord);
ExcelUtil<EpsMethodChangeRecord> util = new ExcelUtil<EpsMethodChangeRecord>(EpsMethodChangeRecord.class);
util.showColumn(epsMethodChangeRecord.getProperties());
util.exportExcel(response, list, "收益方式修改记录数据");
}
}

View File

@@ -0,0 +1,131 @@
package com.ruoyi.system.controller;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageDomain;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.EpsNodeBandwidth;
import com.ruoyi.system.service.IEpsNodeBandwidthService;
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 2025-08-12
*/
@RestController
@RequestMapping("/bandwidth")
public class EpsNodeBandwidthController extends BaseController
{
@Autowired
private IEpsNodeBandwidthService epsNodeBandwidthService;
/**
* 查询节点带宽信息列表
*/
@RequiresPermissions("system:bandwidth:list")
@PostMapping("/list")
public TableDataInfo list(@RequestBody EpsNodeBandwidth epsNodeBandwidth)
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(epsNodeBandwidth.getPageNum());
pageDomain.setPageSize(epsNodeBandwidth.getPageSize());
startPage(pageDomain);
List<EpsNodeBandwidth> list = epsNodeBandwidthService.selectEpsNodeBandwidthList(epsNodeBandwidth);
return getDataTable(list);
}
/**
* 导出节点带宽信息列表
*/
@RequiresPermissions("system:bandwidth:export")
@Log(title = "节点带宽信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EpsNodeBandwidth epsNodeBandwidth)
{
List<EpsNodeBandwidth> list = epsNodeBandwidthService.selectEpsNodeBandwidthList(epsNodeBandwidth);
ExcelUtil<EpsNodeBandwidth> util = new ExcelUtil<EpsNodeBandwidth>(EpsNodeBandwidth.class);
util.showColumn(epsNodeBandwidth.getProperties());
util.exportExcel(response, list, "节点带宽信息数据");
}
/**
* 获取节点带宽信息详细信息
*/
@RequiresPermissions("system:bandwidth:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(epsNodeBandwidthService.selectEpsNodeBandwidthById(id));
}
/**
* 新增节点带宽信息
*/
@RequiresPermissions("system:bandwidth:add")
@Log(title = "节点带宽信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EpsNodeBandwidth epsNodeBandwidth)
{
return toAjax(epsNodeBandwidthService.insertEpsNodeBandwidth(epsNodeBandwidth));
}
/**
* 修改节点带宽信息
*/
@RequiresPermissions("system:bandwidth:edit")
@Log(title = "节点带宽信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EpsNodeBandwidth epsNodeBandwidth)
{
return toAjax(epsNodeBandwidthService.updateEpsNodeBandwidth(epsNodeBandwidth));
}
/**
* 重新计算
*/
@RequiresPermissions("system:bandwidth:query")
@GetMapping(value = "recalculate/{id}")
public AjaxResult recalculate(@PathVariable("id") Long id)
{
return success(epsNodeBandwidthService.selectEpsNodeBandwidthById(id));//TODO 待逻辑处理
}
/**
* 相关数据
*/
@RequiresPermissions("system:bandwidth:query")
@GetMapping(value = "relatedData/{id}")
public AjaxResult relatedData(@PathVariable("id") Long id)
{
return success(epsNodeBandwidthService.relatedData(id));
}
/**
* 相关数据-月均日95值
*/
@RequiresPermissions("system:bandwidth:query")
@GetMapping(value = "getAvgDetailMsg/{id}")
public AjaxResult getAvgDetailMsg(@PathVariable("id") Long id)
{
return success(epsNodeBandwidthService.getAvgDetailMsg(id));
}
/**
* 生成月均日95值
*/
@RequiresPermissions("system:bandwidth:add")
@Log(title = "节点带宽信息", businessType = BusinessType.INSERT)
@PostMapping("/calculateAvg")
public AjaxResult calculateAvg(@RequestBody EpsNodeBandwidth epsNodeBandwidth)
{
return toAjax(epsNodeBandwidthService.insertEpsNodeBandwidth(epsNodeBandwidth));
}
}

View File

@@ -0,0 +1,73 @@
package com.ruoyi.system.controller;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageDomain;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.EpsServerRevenueConfig;
import com.ruoyi.system.service.IEpsServerRevenueConfigService;
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 2025-08-19
*/
@RestController
@RequestMapping("/revenueConfig")
public class EpsServerRevenueConfigController extends BaseController
{
@Autowired
private IEpsServerRevenueConfigService epsServerRevenueConfigService;
/**
* 查询服务器收益方式配置列表
*/
@RequiresPermissions("system:config:list")
@PostMapping("/list")
public TableDataInfo list(EpsServerRevenueConfig epsServerRevenueConfig)
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(epsServerRevenueConfig.getPageNum());
pageDomain.setPageSize(epsServerRevenueConfig.getPageSize());
startPage(pageDomain);
List<EpsServerRevenueConfig> list = epsServerRevenueConfigService.selectEpsServerRevenueConfigList(epsServerRevenueConfig);
return getDataTable(list);
}
/**
* 导出服务器收益方式配置列表
*/
@RequiresPermissions("system:config:export")
@Log(title = "服务器收益方式配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EpsServerRevenueConfig epsServerRevenueConfig)
{
List<EpsServerRevenueConfig> list = epsServerRevenueConfigService.selectEpsServerRevenueConfigList(epsServerRevenueConfig);
ExcelUtil<EpsServerRevenueConfig> util = new ExcelUtil<EpsServerRevenueConfig>(EpsServerRevenueConfig.class);
util.showColumn(epsServerRevenueConfig.getProperties());
util.exportExcel(response, list, "服务器收益方式配置数据");
}
/**
* 修改服务器收益方式配置
*/
@RequiresPermissions("system:config:edit")
@Log(title = "服务器收益方式配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EpsServerRevenueConfig epsServerRevenueConfig)
{
return toAjax(epsServerRevenueConfigService.updateEpsServerRevenueConfig(epsServerRevenueConfig));
}
}

View File

@@ -0,0 +1,105 @@
package com.ruoyi.system.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.EpsTrafficData;
import com.ruoyi.system.service.IEpsTrafficDataService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* 流量相关数据Controller
*
* @author gyt
* @date 2025-08-12
*/
@RestController
@RequestMapping("/data")
public class EpsTrafficDataController extends BaseController
{
@Autowired
private IEpsTrafficDataService epsTrafficDataService;
/**
* 查询流量相关数据列表
*/
@RequiresPermissions("system:data:list")
@GetMapping("/list")
public TableDataInfo list(EpsTrafficData epsTrafficData)
{
startPage();
List<EpsTrafficData> list = epsTrafficDataService.selectEpsTrafficDataList(epsTrafficData);
return getDataTable(list);
}
/**
* 导出流量相关数据列表
*/
@RequiresPermissions("system:data:export")
@Log(title = "流量相关数据", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EpsTrafficData epsTrafficData)
{
List<EpsTrafficData> list = epsTrafficDataService.selectEpsTrafficDataList(epsTrafficData);
ExcelUtil<EpsTrafficData> util = new ExcelUtil<EpsTrafficData>(EpsTrafficData.class);
util.exportExcel(response, list, "流量相关数据数据");
}
/**
* 获取流量相关数据详细信息
*/
@RequiresPermissions("system:data:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(epsTrafficDataService.selectEpsTrafficDataById(id));
}
/**
* 新增流量相关数据
*/
@RequiresPermissions("system:data:add")
@Log(title = "流量相关数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EpsTrafficData epsTrafficData)
{
return toAjax(epsTrafficDataService.insertEpsTrafficData(epsTrafficData));
}
/**
* 修改流量相关数据
*/
@RequiresPermissions("system:data:edit")
@Log(title = "流量相关数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EpsTrafficData epsTrafficData)
{
return toAjax(epsTrafficDataService.updateEpsTrafficData(epsTrafficData));
}
/**
* 删除流量相关数据
*/
@RequiresPermissions("system:data:remove")
@Log(title = "流量相关数据", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(epsTrafficDataService.deleteEpsTrafficDataByIds(ids));
}
}

View File

@@ -0,0 +1,102 @@
package com.ruoyi.system.controller;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageDomain;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.KnowledgeBase;
import com.ruoyi.system.service.IKnowledgeBaseService;
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 2025-08-15
*/
@RestController
@RequestMapping("/knowledgebase")
public class KnowledgeBaseController extends BaseController
{
@Autowired
private IKnowledgeBaseService knowledgeBaseService;
/**
* 查询知识库列表
*/
@RequiresPermissions("system:knowledgebase:list")
@PostMapping("/list")
public TableDataInfo list(@RequestBody KnowledgeBase knowledgeBase)
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(knowledgeBase.getPageNum());
pageDomain.setPageSize(knowledgeBase.getPageSize());
startPage(pageDomain);
List<KnowledgeBase> list = knowledgeBaseService.selectKnowledgeBaseList(knowledgeBase);
return getDataTable(list);
}
/**
* 导出知识库列表
*/
@RequiresPermissions("system:knowledgebase:export")
@Log(title = "知识库", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, KnowledgeBase knowledgeBase)
{
List<KnowledgeBase> list = knowledgeBaseService.selectKnowledgeBaseList(knowledgeBase);
ExcelUtil<KnowledgeBase> util = new ExcelUtil<KnowledgeBase>(KnowledgeBase.class);
util.exportExcel(response, list, "知识库数据");
}
/**
* 获取知识库详细信息
*/
@RequiresPermissions("system:knowledgebase:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(knowledgeBaseService.selectKnowledgeBaseById(id));
}
/**
* 新增知识库
*/
@RequiresPermissions("system:knowledgebase:add")
@Log(title = "知识库", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody KnowledgeBase knowledgeBase)
{
return toAjax(knowledgeBaseService.insertKnowledgeBase(knowledgeBase));
}
/**
* 修改知识库
*/
@RequiresPermissions("system:knowledgebase:edit")
@Log(title = "知识库", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody KnowledgeBase knowledgeBase)
{
return toAjax(knowledgeBaseService.updateKnowledgeBase(knowledgeBase));
}
/**
* 删除知识库
*/
@RequiresPermissions("system:knowledgebase:remove")
@Log(title = "知识库", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(knowledgeBaseService.deleteKnowledgeBaseByIds(ids));
}
}

View File

@@ -0,0 +1,105 @@
package com.ruoyi.system.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.MtmMonitoringTemplate;
import com.ruoyi.system.service.IMtmMonitoringTemplateService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* 监控模板管理Controller
*
* @author gyt
* @date 2025-08-12
*/
@RestController
@RequestMapping("/template")
public class MtmMonitoringTemplateController extends BaseController
{
@Autowired
private IMtmMonitoringTemplateService mtmMonitoringTemplateService;
/**
* 查询监控模板管理列表
*/
@RequiresPermissions("system:template:list")
@GetMapping("/list")
public TableDataInfo list(MtmMonitoringTemplate mtmMonitoringTemplate)
{
startPage();
List<MtmMonitoringTemplate> list = mtmMonitoringTemplateService.selectMtmMonitoringTemplateList(mtmMonitoringTemplate);
return getDataTable(list);
}
/**
* 导出监控模板管理列表
*/
@RequiresPermissions("system:template:export")
@Log(title = "监控模板管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MtmMonitoringTemplate mtmMonitoringTemplate)
{
List<MtmMonitoringTemplate> list = mtmMonitoringTemplateService.selectMtmMonitoringTemplateList(mtmMonitoringTemplate);
ExcelUtil<MtmMonitoringTemplate> util = new ExcelUtil<MtmMonitoringTemplate>(MtmMonitoringTemplate.class);
util.exportExcel(response, list, "监控模板管理数据");
}
/**
* 获取监控模板管理详细信息
*/
@RequiresPermissions("system:template:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(mtmMonitoringTemplateService.selectMtmMonitoringTemplateById(id));
}
/**
* 新增监控模板管理
*/
@RequiresPermissions("system:template:add")
@Log(title = "监控模板管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MtmMonitoringTemplate mtmMonitoringTemplate)
{
return toAjax(mtmMonitoringTemplateService.insertMtmMonitoringTemplate(mtmMonitoringTemplate));
}
/**
* 修改监控模板管理
*/
@RequiresPermissions("system:template:edit")
@Log(title = "监控模板管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MtmMonitoringTemplate mtmMonitoringTemplate)
{
return toAjax(mtmMonitoringTemplateService.updateMtmMonitoringTemplate(mtmMonitoringTemplate));
}
/**
* 删除监控模板管理
*/
@RequiresPermissions("system:template:remove")
@Log(title = "监控模板管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(mtmMonitoringTemplateService.deleteMtmMonitoringTemplateByIds(ids));
}
}

View File

@@ -0,0 +1,113 @@
package com.ruoyi.system.controller;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageDomain;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.RmEpsTopologyManagement;
import com.ruoyi.system.service.IRmEpsTopologyManagementService;
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 2025-08-12
*/
@RestController
@RequestMapping("/management")
public class RmEpsTopologyManagementController extends BaseController
{
@Autowired
private IRmEpsTopologyManagementService rmEpsTopologyManagementService;
/**
* 查询交换机/服务器名称
*/
@RequiresPermissions("system:management:list")
@PostMapping ("/getNamesByResoureType")
public List<RmEpsTopologyManagement> getNamesByResoureType(@RequestBody RmEpsTopologyManagement rmEpsTopologyManagement)
{
List<RmEpsTopologyManagement> list = rmEpsTopologyManagementService.selectRmEpsTopologyManagementList(rmEpsTopologyManagement);
return list;
}
/**
* 查询拓扑管理列表
*/
@RequiresPermissions("system:management:list")
@PostMapping("/list")
public TableDataInfo list(@RequestBody RmEpsTopologyManagement rmEpsTopologyManagement)
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(rmEpsTopologyManagement.getPageNum());
pageDomain.setPageSize(rmEpsTopologyManagement.getPageSize());
startPage(pageDomain);
List<RmEpsTopologyManagement> list = rmEpsTopologyManagementService.selectRmEpsTopologyManagementList(rmEpsTopologyManagement);
return getDataTable(list);
}
/**
* 导出拓扑管理列表
*/
@RequiresPermissions("system:management:export")
@Log(title = "拓扑管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RmEpsTopologyManagement rmEpsTopologyManagement)
{
List<RmEpsTopologyManagement> list = rmEpsTopologyManagementService.selectRmEpsTopologyManagementList(rmEpsTopologyManagement);
ExcelUtil<RmEpsTopologyManagement> util = new ExcelUtil<RmEpsTopologyManagement>(RmEpsTopologyManagement.class);
util.showColumn(rmEpsTopologyManagement.getProperties());
util.exportExcel(response, list, "拓扑管理数据");
}
/**
* 获取拓扑管理详细信息
*/
@RequiresPermissions("system:management:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(rmEpsTopologyManagementService.selectRmEpsTopologyManagementById(id));
}
/**
* 新增拓扑管理
*/
@RequiresPermissions("system:management:add")
@Log(title = "拓扑管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RmEpsTopologyManagement rmEpsTopologyManagement)
{
return toAjax(rmEpsTopologyManagementService.insertRmEpsTopologyManagement(rmEpsTopologyManagement));
}
/**
* 修改拓扑管理
*/
@RequiresPermissions("system:management:edit")
@Log(title = "拓扑管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RmEpsTopologyManagement rmEpsTopologyManagement)
{
return toAjax(rmEpsTopologyManagementService.updateRmEpsTopologyManagement(rmEpsTopologyManagement));
}
/**
* 删除拓扑管理
*/
@RequiresPermissions("system:management:remove")
@Log(title = "拓扑管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(rmEpsTopologyManagementService.deleteRmEpsTopologyManagementByIds(ids));
}
}

View File

@@ -0,0 +1,103 @@
package com.ruoyi.system.controller;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageDomain;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.RmResourceGroup;
import com.ruoyi.system.service.IRmResourceGroupService;
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 2025-08-12
*/
@RestController
@RequestMapping("/group")
public class RmResourceGroupController extends BaseController
{
@Autowired
private IRmResourceGroupService rmResourceGroupService;
/**
* 查询资源分组列表
*/
@RequiresPermissions("system:group:list")
@PostMapping("/list")
public TableDataInfo list(@RequestBody RmResourceGroup rmResourceGroup)
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(rmResourceGroup.getPageNum());
pageDomain.setPageSize(rmResourceGroup.getPageSize());
startPage(pageDomain);
List<RmResourceGroup> list = rmResourceGroupService.selectRmResourceGroupList(rmResourceGroup);
return getDataTable(list);
}
/**
* 导出资源分组列表
*/
@RequiresPermissions("system:group:export")
@Log(title = "资源分组", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RmResourceGroup rmResourceGroup)
{
List<RmResourceGroup> list = rmResourceGroupService.selectRmResourceGroupList(rmResourceGroup);
ExcelUtil<RmResourceGroup> util = new ExcelUtil<RmResourceGroup>(RmResourceGroup.class);
util.showColumn(rmResourceGroup.getProperties());
util.exportExcel(response, list, "资源分组数据");
}
/**
* 获取资源分组详细信息
*/
@RequiresPermissions("system:group:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(rmResourceGroupService.selectRmResourceGroupById(id));
}
/**
* 新增资源分组
*/
@RequiresPermissions("system:group:add")
@Log(title = "资源分组", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RmResourceGroup rmResourceGroup)
{
return toAjax(rmResourceGroupService.insertRmResourceGroup(rmResourceGroup));
}
/**
* 修改资源分组
*/
@RequiresPermissions("system:group:edit")
@Log(title = "资源分组", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RmResourceGroup rmResourceGroup)
{
return toAjax(rmResourceGroupService.updateRmResourceGroup(rmResourceGroup));
}
/**
* 删除资源分组
*/
@RequiresPermissions("system:group:remove")
@Log(title = "资源分组", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(rmResourceGroupService.deleteRmResourceGroupByIds(ids));
}
}

View File

@@ -1,25 +1,21 @@
package com.ruoyi.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageDomain;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.RmResourceRegistration;
import com.ruoyi.system.service.IRmResourceRegistrationService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 资源注册Controller
@@ -38,10 +34,13 @@ public class RmResourceRegistrationController extends BaseController
* 查询资源注册列表
*/
@RequiresPermissions("system:registration:list")
@GetMapping("/list")
public TableDataInfo list(RmResourceRegistration rmResourceRegistration)
@PostMapping("/list")
public TableDataInfo list(@RequestBody RmResourceRegistration rmResourceRegistration)
{
startPage();
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(rmResourceRegistration.getPageNum());
pageDomain.setPageSize(rmResourceRegistration.getPageSize());
startPage(pageDomain);
List<RmResourceRegistration> list = rmResourceRegistrationService.selectRmResourceRegistrationList(rmResourceRegistration);
return getDataTable(list);
}
@@ -55,7 +54,16 @@ public class RmResourceRegistrationController extends BaseController
public void export(HttpServletResponse response, RmResourceRegistration rmResourceRegistration)
{
List<RmResourceRegistration> list = rmResourceRegistrationService.selectRmResourceRegistrationList(rmResourceRegistration);
for (RmResourceRegistration resourceRegistration : list) {
// 根据端口类型导出端口名称
if("1".equals(resourceRegistration.getResourcePort())){
resourceRegistration.setResourcePort("162(SNMP)");
}else{
resourceRegistration.setResourcePort(resourceRegistration.getOtherPortName());
}
}
ExcelUtil<RmResourceRegistration> util = new ExcelUtil<RmResourceRegistration>(RmResourceRegistration.class);
util.showColumn(rmResourceRegistration.getProperties());
util.exportExcel(response, list, "资源注册数据");
}
@@ -77,7 +85,11 @@ public class RmResourceRegistrationController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody RmResourceRegistration rmResourceRegistration)
{
return toAjax(rmResourceRegistrationService.insertRmResourceRegistration(rmResourceRegistration));
int rows = rmResourceRegistrationService.insertRmResourceRegistration(rmResourceRegistration);
if(-1==rows){
return AjaxResult.error(500,"硬件SN不可重复");
}
return toAjax(rows);
}
/**
@@ -92,13 +104,37 @@ public class RmResourceRegistrationController extends BaseController
}
/**
* 删除资源注册
* 资源注册-注册
*/
@RequiresPermissions("system:registration:remove")
@Log(title = "资源注册", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
@RequiresPermissions("system:registration:edit")
@Log(title = "资源注册-注册", businessType = BusinessType.UPDATE)
@PostMapping("/register")
public AjaxResult register(@RequestBody RmResourceRegistration rmResourceRegistration)
{
return toAjax(rmResourceRegistrationService.deleteRmResourceRegistrationByIds(ids));
return toAjax(rmResourceRegistrationService.register(rmResourceRegistration));
}
/**
* 查询所有资源名称(包含设备使用)
* @return 资源注册集合
*/
@RequiresPermissions("system:group:list")
@GetMapping("/selectAllResourceName")
public List<Map> selectAllResourceName()
{
List<Map> list = rmResourceRegistrationService.selectAllResourceName();
return list;
}
/**
* 查询所有资源名称
* @return 资源注册集合
*/
@RequiresPermissions("system:group:list")
@PostMapping("/selectAllResourceNameByType")
public List<Map> selectAllResourceNameByType(@RequestBody RmResourceRegistration rmResourceRegistration)
{
List<Map> list = rmResourceRegistrationService.selectAllResourceNameByType(rmResourceRegistration);
return list;
}
}

View File

@@ -0,0 +1,70 @@
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* 业务信息对象 eps_business
*
* @author gyt
* @date 2025-08-18
*/
public class EpsBusiness extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 业务代码(12位唯一标识) */
private String id;
/** 业务名称 */
@Excel(name = "业务名称")
private String businessName;
/** 业务描述 */
private String description;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setBusinessName(String businessName)
{
this.businessName = businessName;
}
public String getBusinessName()
{
return businessName;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return description;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("businessName", getBusinessName())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.append("description", getDescription())
.toString();
}
}

View File

@@ -0,0 +1,66 @@
package com.ruoyi.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
/**
* EPS初始流量数据实体类
* 用于存储设备的接收和发送流量数据
* 支持按时间自动分表存储每月分成3个表
*/
@Data
public class EpsInitialTrafficData {
/** 主键ID */
private Long id;
/**
* 动态表名
* 格式eps_traffic_[年]_[月]_[日期范围]
* 示例eps_traffic_2023_08_1_10
*/
private String tableName;
/** 流量统计开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime startTime;
/** 流量统计结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime endTime;
/** 接收流量单位MB */
private Double receiveTraffic;
/** 发送流量单位MB */
private Double sendTraffic;
/** 设备序列号 */
private String deviceSn;
/** 流量端口 */
private String trafficPort;
/** 业务代码 */
private String businesId;
/** 数据创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
/** 备用字段1 */
private String remark1;
/** 备用字段2 */
private String remark2;
/** 备用字段3 */
private String remark3;
/** 备用字段4 */
private String remark4;
/** 批量插入集合 **/
private List<EpsInitialTrafficData> dataList;
}

View File

@@ -0,0 +1,100 @@
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* 收益方式修改记录对象 eps_method_change_record
*
* @author gyt
* @date 2025-08-15
*/
public class EpsMethodChangeRecord extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 记录ID */
private Long id;
/** 节点名称 */
@Excel(name = "节点名称")
private String nodeName;
/** 修改内容 */
@Excel(name = "修改内容")
private String changeContent;
/** 硬件SN */
@Excel(name = "硬件SN")
private String hardwareSn;
/** 创建人 */
@Excel(name = "修改人")
private String creatBy;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setNodeName(String nodeName)
{
this.nodeName = nodeName;
}
public String getNodeName()
{
return nodeName;
}
public void setChangeContent(String changeContent)
{
this.changeContent = changeContent;
}
public String getChangeContent()
{
return changeContent;
}
public void setHardwareSn(String hardwareSn)
{
this.hardwareSn = hardwareSn;
}
public String getHardwareSn()
{
return hardwareSn;
}
public void setCreatBy(String creatBy)
{
this.creatBy = creatBy;
}
public String getCreatBy()
{
return creatBy;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("nodeName", getNodeName())
.append("changeContent", getChangeContent())
.append("hardwareSn", getHardwareSn())
.append("createTime", getCreateTime())
.append("creatBy", getCreatBy())
.append("updateTime", getUpdateTime())
.append("updateBy", getUpdateBy())
.toString();
}
}

View File

@@ -0,0 +1,405 @@
package com.ruoyi.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
/**
* 节点带宽信息对象 eps_node_bandwidth
*
* @author gyt
* @date 2025-08-12
*/
public class EpsNodeBandwidth extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 节点名称 */
@Excel(name = "节点名称")
private String nodeName;
/** 硬件SN */
@Excel(name = "硬件SN")
private String hardwareSn;
/** 带宽值类型
* 1-95带宽值Mbps/日
* 2-95带宽值Mbps/月
* 3-包端带宽值Mbps/日
* 4-月均日95值Mbps
* 5-有效-95带宽值Mbps/日
* 6-有效-95带宽值Mbps/月
* 7-有效-月均日95值
* */
private String bandwidthType;
/** 带宽值结果 */
private BigDecimal bandwidthResult;
/** 95带宽值Mbps/日 */
@Excel(name = "95带宽值Mbps/日")
private BigDecimal bandwidth95Daily;
/** 95带宽值Mbps/月 */
@Excel(name = "95带宽值Mbps/月")
private BigDecimal bandwidth95Monthly;
/** 月均日95值 */
@Excel(name = "月均日95值")
private BigDecimal avgMonthlyBandwidth95;
/** 包端带宽值Mbps/日 */
@Excel(name = "包端带宽值Mbps/日")
private BigDecimal packageBandwidthDaily;
/** 有效-95带宽值Mbps/日 */
@Excel(name = "有效-95带宽值Mbps/日")
private BigDecimal effectiveBandwidth95Daily;
/** 有效-95带宽值Mbps/月 */
@Excel(name = "有效-95带宽值Mbps/月")
private BigDecimal effectiveBandwidth95Monthly;
/** 有效-月均95值 */
@Excel(name = "有效-月均95值")
private BigDecimal effectiveAvgMonthlyBandwidth95;
/** 设备业务客户id */
@Excel(name = "设备业务客户id")
private String customerId;
/** 设备业务客户名称 */
@Excel(name = "设备业务客户名称")
private String customerName;
/** 业务号 */
@Excel(name = "业务号")
private String serviceNumber;
/** 上联交换机 */
@Excel(name = "上联交换机")
private String uplinkSwitch;
/** 创建人id */
@Excel(name = "创建人id")
private Long creatorId;
/** 创建人名称 */
@Excel(name = "创建人名称")
private String creatorName;
/** remark1 */
@Excel(name = "remark1")
private String remark1;
/** 接口名称 */
@Excel(name = "接口名称")
private String interfaceName;
/** 资源类型(1服务器,2交换机) */
@Excel(name = "资源类型")
private String resourceType;
/** 接口连接设备类型(1服务器2机房出口) */
@Excel(name = "接口连接设备类型")
private String interfaceLinkDeviceType;
/** 业务名称 */
@Excel(name = "业务名称")
private String businessName;
/** 业务代码 */
@Excel(name = "业务代码")
private String businessId;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date createTime;
/** 开始时间 */
private String startTime;
/** 结束时间 */
private String endTime;
/** 月份 */
@JsonFormat(pattern = "yyyy-MM")
private LocalDate monthTime;
@Override
public Date getCreateTime() {
return createTime;
}
@Override
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public LocalDate getMonthTime() {
return monthTime;
}
public void setMonthTime(LocalDate monthTime) {
this.monthTime = monthTime;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getBusinessName() {
return businessName;
}
public void setBusinessName(String businessName) {
this.businessName = businessName;
}
public String getBusinessId() {
return businessId;
}
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
public String getResourceType() {
return resourceType;
}
public void setResourceType(String resourceType) {
this.resourceType = resourceType;
}
public String getInterfaceLinkDeviceType() {
return interfaceLinkDeviceType;
}
public void setInterfaceLinkDeviceType(String interfaceLinkDeviceType) {
this.interfaceLinkDeviceType = interfaceLinkDeviceType;
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setNodeName(String nodeName)
{
this.nodeName = nodeName;
}
public String getNodeName()
{
return nodeName;
}
public void setHardwareSn(String hardwareSn)
{
this.hardwareSn = hardwareSn;
}
public String getHardwareSn()
{
return hardwareSn;
}
public void setBandwidth95Daily(BigDecimal bandwidth95Daily)
{
this.bandwidth95Daily = bandwidth95Daily;
}
public BigDecimal getBandwidth95Daily()
{
return bandwidth95Daily;
}
public void setBandwidth95Monthly(BigDecimal bandwidth95Monthly)
{
this.bandwidth95Monthly = bandwidth95Monthly;
}
public BigDecimal getBandwidth95Monthly()
{
return bandwidth95Monthly;
}
public void setPackageBandwidthDaily(BigDecimal packageBandwidthDaily)
{
this.packageBandwidthDaily = packageBandwidthDaily;
}
public BigDecimal getPackageBandwidthDaily()
{
return packageBandwidthDaily;
}
public void setCustomerId(String customerId)
{
this.customerId = customerId;
}
public String getCustomerId()
{
return customerId;
}
public void setCustomerName(String customerName)
{
this.customerName = customerName;
}
public String getCustomerName()
{
return customerName;
}
public void setServiceNumber(String serviceNumber)
{
this.serviceNumber = serviceNumber;
}
public String getServiceNumber()
{
return serviceNumber;
}
public void setUplinkSwitch(String uplinkSwitch)
{
this.uplinkSwitch = uplinkSwitch;
}
public String getUplinkSwitch()
{
return uplinkSwitch;
}
public void setCreatorId(Long creatorId)
{
this.creatorId = creatorId;
}
public Long getCreatorId()
{
return creatorId;
}
public void setCreatorName(String creatorName)
{
this.creatorName = creatorName;
}
public String getCreatorName()
{
return creatorName;
}
public void setRemark1(String remark1)
{
this.remark1 = remark1;
}
public String getRemark1()
{
return remark1;
}
public String getInterfaceName() {
return interfaceName;
}
public void setInterfaceName(String interfaceName) {
this.interfaceName = interfaceName;
}
public String getBandwidthType() {
return bandwidthType;
}
public void setBandwidthType(String bandwidthType) {
this.bandwidthType = bandwidthType;
}
public BigDecimal getBandwidthResult() {
return bandwidthResult;
}
public void setBandwidthResult(BigDecimal bandwidthResult) {
this.bandwidthResult = bandwidthResult;
}
public BigDecimal getAvgMonthlyBandwidth95() {
return avgMonthlyBandwidth95;
}
public void setAvgMonthlyBandwidth95(BigDecimal avgMonthlyBandwidth95) {
this.avgMonthlyBandwidth95 = avgMonthlyBandwidth95;
}
public BigDecimal getEffectiveBandwidth95Daily() {
return effectiveBandwidth95Daily;
}
public void setEffectiveBandwidth95Daily(BigDecimal effectiveBandwidth95Daily) {
this.effectiveBandwidth95Daily = effectiveBandwidth95Daily;
}
public BigDecimal getEffectiveBandwidth95Monthly() {
return effectiveBandwidth95Monthly;
}
public void setEffectiveBandwidth95Monthly(BigDecimal effectiveBandwidth95Monthly) {
this.effectiveBandwidth95Monthly = effectiveBandwidth95Monthly;
}
public BigDecimal getEffectiveAvgMonthlyBandwidth95() {
return effectiveAvgMonthlyBandwidth95;
}
public void setEffectiveAvgMonthlyBandwidth95(BigDecimal effectiveAvgMonthlyBandwidth95) {
this.effectiveAvgMonthlyBandwidth95 = effectiveAvgMonthlyBandwidth95;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("nodeName", getNodeName())
.append("hardwareSn", getHardwareSn())
.append("bandwidth95Daily", getBandwidth95Daily())
.append("bandwidth95Monthly", getBandwidth95Monthly())
.append("packageBandwidthDaily", getPackageBandwidthDaily())
.append("customerId", getCustomerId())
.append("customerName", getCustomerName())
.append("serviceNumber", getServiceNumber())
.append("uplinkSwitch", getUplinkSwitch())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("creatorId", getCreatorId())
.append("creatorName", getCreatorName())
.append("remark1", getRemark1())
.append("interfaceName", getInterfaceName())
.toString();
}
}

View File

@@ -0,0 +1,177 @@
package com.ruoyi.system.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* 服务器收益方式配置对象 eps_server_revenue_config
*
* @author gyt
* @date 2025-08-19
*/
public class EpsServerRevenueConfig extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 唯一标识ID */
private Long id;
/** 节点名称 */
@Excel(name = "节点名称")
private String nodeName;
/** 收益方式(1.流量,2包端) */
@Excel(name = "收益方式(1.流量,2包端)")
private String revenueMethod;
/** 硬件SN */
@Excel(name = "硬件SN")
private String hardwareSn;
/** 流量网口 */
@Excel(name = "流量网口")
private String trafficPort;
/** 95带宽值(Mbps) */
@Excel(name = "95带宽值(Mbps)")
private BigDecimal bandwidth95;
/** 包端带宽值 */
@Excel(name = "包端带宽值")
private BigDecimal packageBandwidth;
/** 业务名称 */
@Excel(name = "业务名称")
private String businessName;
/** 业务代码(12位) */
@Excel(name = "业务代码(12位)")
private String businessCode;
/** 注册状态 */
@Excel(name = "注册状态")
private String registrationStatus;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setNodeName(String nodeName)
{
this.nodeName = nodeName;
}
public String getNodeName()
{
return nodeName;
}
public void setRevenueMethod(String revenueMethod)
{
this.revenueMethod = revenueMethod;
}
public String getRevenueMethod()
{
return revenueMethod;
}
public void setHardwareSn(String hardwareSn)
{
this.hardwareSn = hardwareSn;
}
public String getHardwareSn()
{
return hardwareSn;
}
public void setTrafficPort(String trafficPort)
{
this.trafficPort = trafficPort;
}
public String getTrafficPort()
{
return trafficPort;
}
public void setBandwidth95(BigDecimal bandwidth95)
{
this.bandwidth95 = bandwidth95;
}
public BigDecimal getBandwidth95()
{
return bandwidth95;
}
public void setPackageBandwidth(BigDecimal packageBandwidth)
{
this.packageBandwidth = packageBandwidth;
}
public BigDecimal getPackageBandwidth()
{
return packageBandwidth;
}
public void setBusinessName(String businessName)
{
this.businessName = businessName;
}
public String getBusinessName()
{
return businessName;
}
public void setBusinessCode(String businessCode)
{
this.businessCode = businessCode;
}
public String getBusinessCode()
{
return businessCode;
}
public void setRegistrationStatus(String registrationStatus)
{
this.registrationStatus = registrationStatus;
}
public String getRegistrationStatus()
{
return registrationStatus;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("nodeName", getNodeName())
.append("revenueMethod", getRevenueMethod())
.append("hardwareSn", getHardwareSn())
.append("trafficPort", getTrafficPort())
.append("bandwidth95", getBandwidth95())
.append("packageBandwidth", getPackageBandwidth())
.append("updateTime", getUpdateTime())
.append("businessName", getBusinessName())
.append("businessCode", getBusinessCode())
.append("registrationStatus", getRegistrationStatus())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@@ -0,0 +1,216 @@
package com.ruoyi.system.domain;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
/**
* 流量相关数据对象 eps_traffic_data
*
* @author gyt
* @date 2025-08-12
*/
public class EpsTrafficData extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 硬件SN */
@Excel(name = "硬件SN")
private String hardwareSn;
/** 节点名称 */
@Excel(name = "节点名称")
private String nodeName;
/** 收益方式 */
@Excel(name = "收益方式")
private String revenueMethod;
/** 流量端口 */
@Excel(name = "流量端口")
private String trafficPort;
/** 发送流量值bytes */
@Excel(name = "发送流量值", readConverterExp = "b=ytes")
private Long txBytes;
/** 接收流量值bytes */
@Excel(name = "接收流量值", readConverterExp = "b=ytes")
private Long rxBytes;
/** 包端带宽值Mbps */
@Excel(name = "包端带宽值", readConverterExp = "M=bps")
private BigDecimal packageBandwidth;
/** 创建人id */
@Excel(name = "创建人id")
private Long creatorId;
/** 创建人名称 */
@Excel(name = "创建人名称")
private String creatorName;
/** 修改人id */
@Excel(name = "修改人id")
private Long updaterId;
/** 修改人名称 */
@Excel(name = "修改人名称")
private String updaterName;
/** 业务名称 */
private String businessName;
public String getBusinessName() {
return businessName;
}
public void setBusinessName(String businessName) {
this.businessName = businessName;
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setHardwareSn(String hardwareSn)
{
this.hardwareSn = hardwareSn;
}
public String getHardwareSn()
{
return hardwareSn;
}
public void setNodeName(String nodeName)
{
this.nodeName = nodeName;
}
public String getNodeName()
{
return nodeName;
}
public void setRevenueMethod(String revenueMethod)
{
this.revenueMethod = revenueMethod;
}
public String getRevenueMethod()
{
return revenueMethod;
}
public void setTrafficPort(String trafficPort)
{
this.trafficPort = trafficPort;
}
public String getTrafficPort()
{
return trafficPort;
}
public void setTxBytes(Long txBytes)
{
this.txBytes = txBytes;
}
public Long getTxBytes()
{
return txBytes;
}
public void setRxBytes(Long rxBytes)
{
this.rxBytes = rxBytes;
}
public Long getRxBytes()
{
return rxBytes;
}
public void setPackageBandwidth(BigDecimal packageBandwidth)
{
this.packageBandwidth = packageBandwidth;
}
public BigDecimal getPackageBandwidth()
{
return packageBandwidth;
}
public void setCreatorId(Long creatorId)
{
this.creatorId = creatorId;
}
public Long getCreatorId()
{
return creatorId;
}
public void setCreatorName(String creatorName)
{
this.creatorName = creatorName;
}
public String getCreatorName()
{
return creatorName;
}
public void setUpdaterId(Long updaterId)
{
this.updaterId = updaterId;
}
public Long getUpdaterId()
{
return updaterId;
}
public void setUpdaterName(String updaterName)
{
this.updaterName = updaterName;
}
public String getUpdaterName()
{
return updaterName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("hardwareSn", getHardwareSn())
.append("nodeName", getNodeName())
.append("revenueMethod", getRevenueMethod())
.append("trafficPort", getTrafficPort())
.append("txBytes", getTxBytes())
.append("rxBytes", getRxBytes())
.append("packageBandwidth", getPackageBandwidth())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("creatorId", getCreatorId())
.append("creatorName", getCreatorName())
.append("updaterId", getUpdaterId())
.append("updaterName", getUpdaterName())
.toString();
}
}

View File

@@ -0,0 +1,99 @@
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* 知识库对象 knowledge_base
*
* @author gyt
* @date 2025-08-15
*/
public class KnowledgeBase extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 标题 */
@Excel(name = "标题")
private String title;
/** 问题类型 */
@Excel(name = "问题类型")
private String issueType;
/** 解决方案 */
@Excel(name = "解决方案")
private String solution;
/** 创建人 */
private String creatBy;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTitle(String title)
{
this.title = title;
}
public String getTitle()
{
return title;
}
public void setIssueType(String issueType)
{
this.issueType = issueType;
}
public String getIssueType()
{
return issueType;
}
public void setSolution(String solution)
{
this.solution = solution;
}
public String getSolution()
{
return solution;
}
public void setCreatBy(String creatBy)
{
this.creatBy = creatBy;
}
public String getCreatBy()
{
return creatBy;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("title", getTitle())
.append("issueType", getIssueType())
.append("solution", getSolution())
.append("createTime", getCreateTime())
.append("creatBy", getCreatBy())
.append("updateTime", getUpdateTime())
.append("updateBy", getUpdateBy())
.toString();
}
}

View File

@@ -0,0 +1,204 @@
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* 监控模板管理对象 mtm_monitoring_template
*
* @author gyt
* @date 2025-08-12
*/
public class MtmMonitoringTemplate extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 模板名称 */
@Excel(name = "模板名称")
private String templateName;
/** 描述 */
@Excel(name = "描述")
private String description;
/** 项类型 */
@Excel(name = "项类型")
private String itemType;
/** 包含资源 */
@Excel(name = "包含资源")
private String includedResources;
/** 发现项类型 */
@Excel(name = "发现项类型")
private String discoveryItemType;
/** 项名 */
@Excel(name = "项名")
private String itemName;
/** 项描述 */
@Excel(name = "项描述")
private String itemDescription;
/** 创建人id */
@Excel(name = "创建人id")
private Long creatorId;
/** 创建人名称 */
@Excel(name = "创建人名称")
private String creatorName;
/** 修改人id */
@Excel(name = "修改人id")
private Long updaterId;
/** 修改人名称 */
@Excel(name = "修改人名称")
private String updaterName;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTemplateName(String templateName)
{
this.templateName = templateName;
}
public String getTemplateName()
{
return templateName;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return description;
}
public void setItemType(String itemType)
{
this.itemType = itemType;
}
public String getItemType()
{
return itemType;
}
public void setIncludedResources(String includedResources)
{
this.includedResources = includedResources;
}
public String getIncludedResources()
{
return includedResources;
}
public void setDiscoveryItemType(String discoveryItemType)
{
this.discoveryItemType = discoveryItemType;
}
public String getDiscoveryItemType()
{
return discoveryItemType;
}
public void setItemName(String itemName)
{
this.itemName = itemName;
}
public String getItemName()
{
return itemName;
}
public void setItemDescription(String itemDescription)
{
this.itemDescription = itemDescription;
}
public String getItemDescription()
{
return itemDescription;
}
public void setCreatorId(Long creatorId)
{
this.creatorId = creatorId;
}
public Long getCreatorId()
{
return creatorId;
}
public void setCreatorName(String creatorName)
{
this.creatorName = creatorName;
}
public String getCreatorName()
{
return creatorName;
}
public void setUpdaterId(Long updaterId)
{
this.updaterId = updaterId;
}
public Long getUpdaterId()
{
return updaterId;
}
public void setUpdaterName(String updaterName)
{
this.updaterName = updaterName;
}
public String getUpdaterName()
{
return updaterName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("templateName", getTemplateName())
.append("description", getDescription())
.append("itemType", getItemType())
.append("includedResources", getIncludedResources())
.append("discoveryItemType", getDiscoveryItemType())
.append("itemName", getItemName())
.append("itemDescription", getItemDescription())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("creatorId", getCreatorId())
.append("creatorName", getCreatorName())
.append("updaterId", getUpdaterId())
.append("updaterName", getUpdaterName())
.toString();
}
}

View File

@@ -0,0 +1,236 @@
package com.ruoyi.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 拓扑管理对象 rm_eps_topology_management
*
* @author gyt
* @date 2025-08-12
*/
public class RmEpsTopologyManagement extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 交换机名称 */
@Excel(name = "交换机名称")
private String switchName;
/** 交换机硬件SN */
@Excel(name = "交换机硬件SN")
private String switchSn;
/** 接口名称 */
@Excel(name = "接口名称")
private String interfaceName;
/** 接口连接设备类型 */
@Excel(name = "接口连接设备类型",readConverterExp = "1=服务器,2=机房出口")
private String connectedDeviceType;
/** 服务器名称 */
@Excel(name = "服务器名称")
private String serverName;
/** 服务器硬件SN */
@Excel(name = "服务器硬件SN")
private String serverSn;
/** 服务器网口 */
@Excel(name = "服务器网口")
private String serverPort;
/** 创建时间 */
@Excel(name = "创建时间",dateFormat = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 修改时间 */
@Excel(name = "修改时间",dateFormat = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/** 创建人id */
private Long creatorId;
/** 创建人名称 */
private String creatorName;
/** 修改人id */
private Long updaterId;
/** 修改人名称 */
private String updaterName;
@Override
public Date getCreateTime() {
return createTime;
}
@Override
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public Date getUpdateTime() {
return updateTime;
}
@Override
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setSwitchName(String switchName)
{
this.switchName = switchName;
}
public String getSwitchName()
{
return switchName;
}
public void setSwitchSn(String switchSn)
{
this.switchSn = switchSn;
}
public String getSwitchSn()
{
return switchSn;
}
public void setInterfaceName(String interfaceName)
{
this.interfaceName = interfaceName;
}
public String getInterfaceName()
{
return interfaceName;
}
public void setConnectedDeviceType(String connectedDeviceType)
{
this.connectedDeviceType = connectedDeviceType;
}
public String getConnectedDeviceType()
{
return connectedDeviceType;
}
public void setServerName(String serverName)
{
this.serverName = serverName;
}
public String getServerName()
{
return serverName;
}
public void setServerSn(String serverSn)
{
this.serverSn = serverSn;
}
public String getServerSn()
{
return serverSn;
}
public void setServerPort(String serverPort)
{
this.serverPort = serverPort;
}
public String getServerPort()
{
return serverPort;
}
public void setCreatorId(Long creatorId)
{
this.creatorId = creatorId;
}
public Long getCreatorId()
{
return creatorId;
}
public void setCreatorName(String creatorName)
{
this.creatorName = creatorName;
}
public String getCreatorName()
{
return creatorName;
}
public void setUpdaterId(Long updaterId)
{
this.updaterId = updaterId;
}
public Long getUpdaterId()
{
return updaterId;
}
public void setUpdaterName(String updaterName)
{
this.updaterName = updaterName;
}
public String getUpdaterName()
{
return updaterName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("switchName", getSwitchName())
.append("switchSn", getSwitchSn())
.append("interfaceName", getInterfaceName())
.append("connectedDeviceType", getConnectedDeviceType())
.append("serverName", getServerName())
.append("serverSn", getServerSn())
.append("serverPort", getServerPort())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("creatorId", getCreatorId())
.append("creatorName", getCreatorName())
.append("updaterId", getUpdaterId())
.append("updaterName", getUpdaterName())
.toString();
}
}

View File

@@ -0,0 +1,173 @@
package com.ruoyi.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 资源分组对象 rm_resource_group
*
* @author gyt
* @date 2025-08-12
*/
public class RmResourceGroup extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 组名 */
@Excel(name = "组名")
private String groupName;
/** 描述 */
@Excel(name = "描述")
private String description;
/** 包含设备 */
@Excel(name = "包含设备")
private String includedDevices;
/** 创建时间 */
@Excel(name = "创建时间",dateFormat = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 修改时间 */
@Excel(name = "修改时间",dateFormat = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/** 创建人id */
private Long creatorId;
/** 创建人名称 */
private String creatorName;
/** 修改人id */
private Long updaterId;
/** 修改人名称 */
private String updaterName;
@Override
public Date getCreateTime() {
return createTime;
}
@Override
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public Date getUpdateTime() {
return updateTime;
}
@Override
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setGroupName(String groupName)
{
this.groupName = groupName;
}
public String getGroupName()
{
return groupName;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return description;
}
public void setIncludedDevices(String includedDevices)
{
this.includedDevices = includedDevices;
}
public String getIncludedDevices()
{
return includedDevices;
}
public void setCreatorId(Long creatorId)
{
this.creatorId = creatorId;
}
public Long getCreatorId()
{
return creatorId;
}
public void setCreatorName(String creatorName)
{
this.creatorName = creatorName;
}
public String getCreatorName()
{
return creatorName;
}
public void setUpdaterId(Long updaterId)
{
this.updaterId = updaterId;
}
public Long getUpdaterId()
{
return updaterId;
}
public void setUpdaterName(String updaterName)
{
this.updaterName = updaterName;
}
public String getUpdaterName()
{
return updaterName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("groupName", getGroupName())
.append("description", getDescription())
.append("includedDevices", getIncludedDevices())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("creatorId", getCreatorId())
.append("creatorName", getCreatorName())
.append("updaterId", getUpdaterId())
.append("updaterName", getUpdaterName())
.toString();
}
}

View File

@@ -24,7 +24,7 @@ public class RmResourceRegistration extends BaseEntity
/** 资源类型
* 1 服务器2 交换机*/
@Excel(name = "资源类型")
@Excel(name = "资源类型",readConverterExp = "1=服务器,2=交换机")
private String resourceType;
/** 资源名称 */
@@ -39,38 +39,44 @@ public class RmResourceRegistration extends BaseEntity
@Excel(name = "端口")
private String resourcePort;
/**其他端口名称 */
private String otherPortName;
/** 协议 1.TCP,2.UDP */
@Excel(name = "协议")
@Excel(name = "协议",readConverterExp = "1=TCP,2=UDP")
private String protocol;
/** 版本(1.SNMPv2,2.SNMPv3) */
@Excel(name = "版本")
@Excel(name = "版本",readConverterExp = "1=SNMPv2,2=SNMPv3")
private String resourceVersion;
/** 读写权限(1.RW,2.ReadOnly) */
@Excel(name = "读写权限")
@Excel(name = "读写权限",readConverterExp = "1=RW,2=ReadOnly")
private String rwPermission;
/** 安全级别(1.authPriv、2.authNoPriv3.noAuthNoPriv) */
@Excel(name = "安全级别")
@Excel(name = "安全级别",readConverterExp = "1=authPriv,2=authNoPriv,3=noAuthNoPriv")
private String securityLevel;
/** 加密方式 1.md5,2.SHA */
@Excel(name = "加密方式")
@Excel(name = "加密方式",readConverterExp = "1=MD5,2=SHA")
private String encryption;
/** 密码 */
/** 用户名 */
@Excel(name = "用户名")
private String resourceUserName;
/** 密码 */
@Excel(name = "密码")
private String resourcePwd;
/** 注册状态 0-未注册1-注册 */
@Excel(name = "注册状态")
/** 注册状态 0-未注册1-注册 */
@Excel(name = "注册状态",readConverterExp = "0=未注册,1=已注册")
private String registrationStatus;
/** 在线状态 0-离线1-在线 */
@Excel(name = "在线状态")
@Excel(name = "在线状态",readConverterExp = "0=离线,1=在线")
private String onlineStatus;
/** 描述 */
@@ -100,7 +106,15 @@ public class RmResourceRegistration extends BaseEntity
/** 修改人名称 */
private String updaterName;
public void setId(Long id)
public String getOtherPortName() {
return otherPortName;
}
public void setOtherPortName(String otherPortName) {
this.otherPortName = otherPortName;
}
public void setId(Long id)
{
this.id = id;
}
@@ -320,9 +334,15 @@ public class RmResourceRegistration extends BaseEntity
return updaterName;
}
public String getResourceUserName() {
return resourceUserName;
}
public void setResourceUserName(String resourceUserName) {
this.resourceUserName = resourceUserName;
}
@Override
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
@@ -331,12 +351,14 @@ public class RmResourceRegistration extends BaseEntity
.append("resourceName", getResourceName())
.append("ipAddress", getIpAddress())
.append("resourcePort", getResourcePort())
.append("otherPortName", getOtherPortName())
.append("protocol", getProtocol())
.append("resourceVersion", getResourceVersion())
.append("rwPermission", getRwPermission())
.append("securityLevel", getSecurityLevel())
.append("encryption", getEncryption())
.append("resourcePwd", getResourcePwd())
.append("resourceUserName", getResourceName())
.append("registrationStatus", getRegistrationStatus())
.append("onlineStatus", getOnlineStatus())
.append("description", getDescription())

View File

@@ -0,0 +1,69 @@
package com.ruoyi.system.mapper;
import com.ruoyi.system.domain.EpsBusiness;
import java.util.List;
/**
* 业务信息Mapper接口
*
* @author gyt
* @date 2025-08-18
*/
public interface EpsBusinessMapper
{
/**
* 查询业务信息
*
* @param id 业务信息主键
* @return 业务信息
*/
public EpsBusiness selectEpsBusinessById(String id);
/**
* 查询业务信息列表
*
* @param epsBusiness 业务信息
* @return 业务信息集合
*/
public List<EpsBusiness> selectEpsBusinessList(EpsBusiness epsBusiness);
/**
* 新增业务信息
*
* @param epsBusiness 业务信息
* @return 结果
*/
public int insertEpsBusiness(EpsBusiness epsBusiness);
/**
* 修改业务信息
*
* @param epsBusiness 业务信息
* @return 结果
*/
public int updateEpsBusiness(EpsBusiness epsBusiness);
/**
* 删除业务信息
*
* @param id 业务信息主键
* @return 结果
*/
public int deleteEpsBusinessById(String id);
/**
* 批量删除业务信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteEpsBusinessByIds(String[] ids);
/**
* 验证业务名称是否存在
* @param epsBusiness
* @return
*/
Integer countByBusinessName(EpsBusiness epsBusiness);
}

View File

@@ -0,0 +1,37 @@
package com.ruoyi.system.mapper;
import com.ruoyi.system.domain.EpsInitialTrafficData;
import org.springframework.data.repository.query.Param;
import java.util.List;
public interface EpsInitialTrafficDataMapper {
/**
* 创建指定名称的EPS流量表
* @param tableName 表名
*/
void createEpsTrafficTable(@Param("tableName") String tableName);
/**
* 创建指定名称的EPS流量初始表
* @param tableName 表名
*/
void createEpsInitialTrafficTable(@Param("tableName") String tableName);
/**
* 单条插入数据
* @param data 流量数据
*/
void insert(EpsInitialTrafficData data);
/**
* 批量插入数据
* @param epsInitialTrafficData 流量数据实体类
*/
void batchInsert(EpsInitialTrafficData epsInitialTrafficData);
/**
* 条件查询
* @param condition 查询条件实体
* @return 流量数据列表
*/
List<EpsInitialTrafficData> selectByCondition(EpsInitialTrafficData condition);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.EpsMethodChangeRecord;
/**
* 收益方式修改记录Mapper接口
*
* @author gyt
* @date 2025-08-15
*/
public interface EpsMethodChangeRecordMapper
{
/**
* 查询收益方式修改记录
*
* @param id 收益方式修改记录主键
* @return 收益方式修改记录
*/
public EpsMethodChangeRecord selectEpsMethodChangeRecordById(Long id);
/**
* 查询收益方式修改记录列表
*
* @param epsMethodChangeRecord 收益方式修改记录
* @return 收益方式修改记录集合
*/
public List<EpsMethodChangeRecord> selectEpsMethodChangeRecordList(EpsMethodChangeRecord epsMethodChangeRecord);
/**
* 新增收益方式修改记录
*
* @param epsMethodChangeRecord 收益方式修改记录
* @return 结果
*/
public int insertEpsMethodChangeRecord(EpsMethodChangeRecord epsMethodChangeRecord);
/**
* 修改收益方式修改记录
*
* @param epsMethodChangeRecord 收益方式修改记录
* @return 结果
*/
public int updateEpsMethodChangeRecord(EpsMethodChangeRecord epsMethodChangeRecord);
/**
* 删除收益方式修改记录
*
* @param id 收益方式修改记录主键
* @return 结果
*/
public int deleteEpsMethodChangeRecordById(Long id);
/**
* 批量删除收益方式修改记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteEpsMethodChangeRecordByIds(Long[] ids);
}

View File

@@ -0,0 +1,84 @@
package com.ruoyi.system.mapper;
import com.ruoyi.system.domain.EpsNodeBandwidth;
import java.util.List;
/**
* 节点带宽信息Mapper接口
*
* @author gyt
* @date 2025-08-12
*/
public interface EpsNodeBandwidthMapper
{
/**
* 查询节点带宽信息
*
* @param id 节点带宽信息主键
* @return 节点带宽信息
*/
public EpsNodeBandwidth selectEpsNodeBandwidthById(Long id);
/**
* 查询节点带宽信息列表
*
* @param epsNodeBandwidth 节点带宽信息
* @return 节点带宽信息集合
*/
public List<EpsNodeBandwidth> selectEpsNodeBandwidthList(EpsNodeBandwidth epsNodeBandwidth);
/**
* 新增节点带宽信息
*
* @param epsNodeBandwidth 节点带宽信息
* @return 结果
*/
public int insertEpsNodeBandwidth(EpsNodeBandwidth epsNodeBandwidth);
/**
* 修改节点带宽信息
*
* @param epsNodeBandwidth 节点带宽信息
* @return 结果
*/
public int updateEpsNodeBandwidth(EpsNodeBandwidth epsNodeBandwidth);
/**
* 删除节点带宽信息
*
* @param id 节点带宽信息主键
* @return 结果
*/
public int deleteEpsNodeBandwidthById(Long id);
/**
* 批量删除节点带宽信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteEpsNodeBandwidthByIds(Long[] ids);
/**
* 计算月均日95值
*
* @param epsNodeBandwidth 节点带宽信息
* @return 节点带宽信息
*/
public EpsNodeBandwidth calculateAvg(EpsNodeBandwidth epsNodeBandwidth);
/**
* 月均日95值-相关数据
*
* @param epsNodeBandwidth 节点带宽信息
* @return 节点带宽信息
*/
public List<EpsNodeBandwidth> getAvgDetailMsg(EpsNodeBandwidth epsNodeBandwidth);
/**
* 查询月均日95值是否存在
*
* @param epsNodeBandwidth 节点带宽信息
* @return 节点带宽信息
*/
public int countByAvgMsg(EpsNodeBandwidth epsNodeBandwidth);
}

View File

@@ -0,0 +1,71 @@
package com.ruoyi.system.mapper;
import com.ruoyi.system.domain.EpsServerRevenueConfig;
import org.springframework.data.repository.query.Param;
import java.util.List;
/**
* 服务器收益方式配置Mapper接口
*
* @author gyt
* @date 2025-08-19
*/
public interface EpsServerRevenueConfigMapper
{
/**
* 查询服务器收益方式配置
*
* @param id 服务器收益方式配置主键
* @return 服务器收益方式配置
*/
public EpsServerRevenueConfig selectEpsServerRevenueConfigById(Long id);
/**
* 查询服务器收益方式配置列表
*
* @param epsServerRevenueConfig 服务器收益方式配置
* @return 服务器收益方式配置集合
*/
public List<EpsServerRevenueConfig> selectEpsServerRevenueConfigList(EpsServerRevenueConfig epsServerRevenueConfig);
/**
* 新增服务器收益方式配置
*
* @param epsServerRevenueConfig 服务器收益方式配置
* @return 结果
*/
public int insertEpsServerRevenueConfig(EpsServerRevenueConfig epsServerRevenueConfig);
/**
* 修改服务器收益方式配置
*
* @param epsServerRevenueConfig 服务器收益方式配置
* @return 结果
*/
public int updateEpsServerRevenueConfig(EpsServerRevenueConfig epsServerRevenueConfig);
/**
* 删除服务器收益方式配置
*
* @param id 服务器收益方式配置主键
* @return 结果
*/
public int deleteEpsServerRevenueConfigById(Long id);
/**
* 批量删除服务器收益方式配置
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteEpsServerRevenueConfigByIds(Long[] ids);
/**
* 查询该数据是否存在
*
* @param hardwareSn 服务器sn
* @return 数据条数
*/
public int countBySn(@Param("hardwareSn") String hardwareSn);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.EpsTrafficData;
/**
* 流量相关数据Mapper接口
*
* @author gyt
* @date 2025-08-12
*/
public interface EpsTrafficDataMapper
{
/**
* 查询流量相关数据
*
* @param id 流量相关数据主键
* @return 流量相关数据
*/
public EpsTrafficData selectEpsTrafficDataById(Long id);
/**
* 查询流量相关数据列表
*
* @param epsTrafficData 流量相关数据
* @return 流量相关数据集合
*/
public List<EpsTrafficData> selectEpsTrafficDataList(EpsTrafficData epsTrafficData);
/**
* 新增流量相关数据
*
* @param epsTrafficData 流量相关数据
* @return 结果
*/
public int insertEpsTrafficData(EpsTrafficData epsTrafficData);
/**
* 修改流量相关数据
*
* @param epsTrafficData 流量相关数据
* @return 结果
*/
public int updateEpsTrafficData(EpsTrafficData epsTrafficData);
/**
* 删除流量相关数据
*
* @param id 流量相关数据主键
* @return 结果
*/
public int deleteEpsTrafficDataById(Long id);
/**
* 批量删除流量相关数据
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteEpsTrafficDataByIds(Long[] ids);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.KnowledgeBase;
/**
* 知识库Mapper接口
*
* @author gyt
* @date 2025-08-15
*/
public interface KnowledgeBaseMapper
{
/**
* 查询知识库
*
* @param id 知识库主键
* @return 知识库
*/
public KnowledgeBase selectKnowledgeBaseById(Long id);
/**
* 查询知识库列表
*
* @param knowledgeBase 知识库
* @return 知识库集合
*/
public List<KnowledgeBase> selectKnowledgeBaseList(KnowledgeBase knowledgeBase);
/**
* 新增知识库
*
* @param knowledgeBase 知识库
* @return 结果
*/
public int insertKnowledgeBase(KnowledgeBase knowledgeBase);
/**
* 修改知识库
*
* @param knowledgeBase 知识库
* @return 结果
*/
public int updateKnowledgeBase(KnowledgeBase knowledgeBase);
/**
* 删除知识库
*
* @param id 知识库主键
* @return 结果
*/
public int deleteKnowledgeBaseById(Long id);
/**
* 批量删除知识库
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteKnowledgeBaseByIds(Long[] ids);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.MtmMonitoringTemplate;
/**
* 监控模板管理Mapper接口
*
* @author gyt
* @date 2025-08-12
*/
public interface MtmMonitoringTemplateMapper
{
/**
* 查询监控模板管理
*
* @param id 监控模板管理主键
* @return 监控模板管理
*/
public MtmMonitoringTemplate selectMtmMonitoringTemplateById(Long id);
/**
* 查询监控模板管理列表
*
* @param mtmMonitoringTemplate 监控模板管理
* @return 监控模板管理集合
*/
public List<MtmMonitoringTemplate> selectMtmMonitoringTemplateList(MtmMonitoringTemplate mtmMonitoringTemplate);
/**
* 新增监控模板管理
*
* @param mtmMonitoringTemplate 监控模板管理
* @return 结果
*/
public int insertMtmMonitoringTemplate(MtmMonitoringTemplate mtmMonitoringTemplate);
/**
* 修改监控模板管理
*
* @param mtmMonitoringTemplate 监控模板管理
* @return 结果
*/
public int updateMtmMonitoringTemplate(MtmMonitoringTemplate mtmMonitoringTemplate);
/**
* 删除监控模板管理
*
* @param id 监控模板管理主键
* @return 结果
*/
public int deleteMtmMonitoringTemplateById(Long id);
/**
* 批量删除监控模板管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteMtmMonitoringTemplateByIds(Long[] ids);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.RmEpsTopologyManagement;
/**
* 拓扑管理Mapper接口
*
* @author gyt
* @date 2025-08-12
*/
public interface RmEpsTopologyManagementMapper
{
/**
* 查询拓扑管理
*
* @param id 拓扑管理主键
* @return 拓扑管理
*/
public RmEpsTopologyManagement selectRmEpsTopologyManagementById(Long id);
/**
* 查询拓扑管理列表
*
* @param rmEpsTopologyManagement 拓扑管理
* @return 拓扑管理集合
*/
public List<RmEpsTopologyManagement> selectRmEpsTopologyManagementList(RmEpsTopologyManagement rmEpsTopologyManagement);
/**
* 新增拓扑管理
*
* @param rmEpsTopologyManagement 拓扑管理
* @return 结果
*/
public int insertRmEpsTopologyManagement(RmEpsTopologyManagement rmEpsTopologyManagement);
/**
* 修改拓扑管理
*
* @param rmEpsTopologyManagement 拓扑管理
* @return 结果
*/
public int updateRmEpsTopologyManagement(RmEpsTopologyManagement rmEpsTopologyManagement);
/**
* 删除拓扑管理
*
* @param id 拓扑管理主键
* @return 结果
*/
public int deleteRmEpsTopologyManagementById(Long id);
/**
* 批量删除拓扑管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteRmEpsTopologyManagementByIds(Long[] ids);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.RmResourceGroup;
/**
* 资源分组Mapper接口
*
* @author gyt
* @date 2025-08-12
*/
public interface RmResourceGroupMapper
{
/**
* 查询资源分组
*
* @param id 资源分组主键
* @return 资源分组
*/
public RmResourceGroup selectRmResourceGroupById(Long id);
/**
* 查询资源分组列表
*
* @param rmResourceGroup 资源分组
* @return 资源分组集合
*/
public List<RmResourceGroup> selectRmResourceGroupList(RmResourceGroup rmResourceGroup);
/**
* 新增资源分组
*
* @param rmResourceGroup 资源分组
* @return 结果
*/
public int insertRmResourceGroup(RmResourceGroup rmResourceGroup);
/**
* 修改资源分组
*
* @param rmResourceGroup 资源分组
* @return 结果
*/
public int updateRmResourceGroup(RmResourceGroup rmResourceGroup);
/**
* 删除资源分组
*
* @param id 资源分组主键
* @return 结果
*/
public int deleteRmResourceGroupById(Long id);
/**
* 批量删除资源分组
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteRmResourceGroupByIds(Long[] ids);
}

View File

@@ -1,8 +1,10 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.RmResourceRegistration;
import java.util.List;
import java.util.Map;
/**
* 资源注册Mapper接口
*
@@ -58,4 +60,21 @@ public interface RmResourceRegistrationMapper
* @return 结果
*/
public int deleteRmResourceRegistrationByIds(Long[] ids);
/**
* 查询所有资源名称([包含设备]功能使用)
* @return 资源注册集合
*/
public List<Map> selectAllResourceName();
/**
* 查询是否有此设备
* @param hardwareSn 资源sn
* @return 结果
*/
public int countBySn(String hardwareSn);
/**
* 查询所有资源名称
* @return 资源注册集合
*/
public List<Map> selectAllResourceNameByType(RmResourceRegistration resourceRegistration);
}

View File

@@ -0,0 +1,37 @@
package com.ruoyi.system.service;
import com.ruoyi.system.domain.EpsInitialTrafficData;
import java.util.List;
/**
* EPS表创建服务接口
* 定义定时创建分表的契约
*/
public interface EpsInitialTrafficDataService {
/**
* 创建下个月的三张分表
* 每月25日0点自动执行
*/
void createNextMonthTables();
/**
* 保存单条流量数据
* @param data 流量数据
*/
void save(EpsInitialTrafficData data);
/**
* 批量保存流量数据
* @param dataList 流量数据列表
*/
void saveBatch(EpsInitialTrafficData dataList);
/**
* 查询流量数据
* @param queryParam 查询参数实体
* @return 流量数据列表
*/
List<EpsInitialTrafficData> query(EpsInitialTrafficData queryParam);
}

View File

@@ -0,0 +1,69 @@
package com.ruoyi.system.service;
import com.ruoyi.system.domain.EpsBusiness;
import java.util.List;
/**
* 业务信息Service接口
*
* @author gyt
* @date 2025-08-18
*/
public interface IEpsBusinessService
{
/**
* 查询业务信息
*
* @param id 业务信息主键
* @return 业务信息
*/
public EpsBusiness selectEpsBusinessById(String id);
/**
* 查询业务信息列表
*
* @param epsBusiness 业务信息
* @return 业务信息集合
*/
public List<EpsBusiness> selectEpsBusinessList(EpsBusiness epsBusiness);
/**
* 新增业务信息
*
* @param epsBusiness 业务信息
* @return 结果
*/
public int insertEpsBusiness(EpsBusiness epsBusiness);
/**
* 修改业务信息
*
* @param epsBusiness 业务信息
* @return 结果
*/
public int updateEpsBusiness(EpsBusiness epsBusiness);
/**
* 批量删除业务信息
*
* @param ids 需要删除的业务信息主键集合
* @return 结果
*/
public int deleteEpsBusinessByIds(String[] ids);
/**
* 删除业务信息信息
*
* @param id 业务信息主键
* @return 结果
*/
public int deleteEpsBusinessById(String id);
/**
* 验证 业务名称是否存在
* @param epsBusiness
* @return
*/
Integer countByBusinessName(EpsBusiness epsBusiness);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.EpsMethodChangeRecord;
/**
* 收益方式修改记录Service接口
*
* @author gyt
* @date 2025-08-15
*/
public interface IEpsMethodChangeRecordService
{
/**
* 查询收益方式修改记录
*
* @param id 收益方式修改记录主键
* @return 收益方式修改记录
*/
public EpsMethodChangeRecord selectEpsMethodChangeRecordById(Long id);
/**
* 查询收益方式修改记录列表
*
* @param epsMethodChangeRecord 收益方式修改记录
* @return 收益方式修改记录集合
*/
public List<EpsMethodChangeRecord> selectEpsMethodChangeRecordList(EpsMethodChangeRecord epsMethodChangeRecord);
/**
* 新增收益方式修改记录
*
* @param epsMethodChangeRecord 收益方式修改记录
* @return 结果
*/
public int insertEpsMethodChangeRecord(EpsMethodChangeRecord epsMethodChangeRecord);
/**
* 修改收益方式修改记录
*
* @param epsMethodChangeRecord 收益方式修改记录
* @return 结果
*/
public int updateEpsMethodChangeRecord(EpsMethodChangeRecord epsMethodChangeRecord);
/**
* 批量删除收益方式修改记录
*
* @param ids 需要删除的收益方式修改记录主键集合
* @return 结果
*/
public int deleteEpsMethodChangeRecordByIds(Long[] ids);
/**
* 删除收益方式修改记录信息
*
* @param id 收益方式修改记录主键
* @return 结果
*/
public int deleteEpsMethodChangeRecordById(Long id);
}

View File

@@ -0,0 +1,80 @@
package com.ruoyi.system.service;
import com.ruoyi.system.domain.EpsInitialTrafficData;
import com.ruoyi.system.domain.EpsNodeBandwidth;
import java.util.List;
/**
* 节点带宽信息Service接口
*
* @author gyt
* @date 2025-08-12
*/
public interface IEpsNodeBandwidthService
{
/**
* 查询节点带宽信息
*
* @param id 节点带宽信息主键
* @return 节点带宽信息
*/
public EpsNodeBandwidth selectEpsNodeBandwidthById(Long id);
/**
* 相关数据
* @param id
* @return
*/
public List<EpsInitialTrafficData> relatedData(Long id);
/**
* 查询节点带宽信息列表
*
* @param epsNodeBandwidth 节点带宽信息
* @return 节点带宽信息集合
*/
public List<EpsNodeBandwidth> selectEpsNodeBandwidthList(EpsNodeBandwidth epsNodeBandwidth);
/**
* 新增节点带宽信息
*
* @param epsNodeBandwidth 节点带宽信息
* @return 结果
*/
public int insertEpsNodeBandwidth(EpsNodeBandwidth epsNodeBandwidth);
/**
* 修改节点带宽信息
*
* @param epsNodeBandwidth 节点带宽信息
* @return 结果
*/
public int updateEpsNodeBandwidth(EpsNodeBandwidth epsNodeBandwidth);
/**
* 批量删除节点带宽信息
*
* @param ids 需要删除的节点带宽信息主键集合
* @return 结果
*/
public int deleteEpsNodeBandwidthByIds(Long[] ids);
/**
* 删除节点带宽信息信息
*
* @param id 节点带宽信息主键
* @return 结果
*/
public int deleteEpsNodeBandwidthById(Long id);
/**
* 计算月均日95值
*
* @param epsNodeBandwidth 节点带宽信息
* @return 结果
*/
public int calculateAvg(EpsNodeBandwidth epsNodeBandwidth);
List<EpsNodeBandwidth> getAvgDetailMsg(Long id);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.EpsServerRevenueConfig;
/**
* 服务器收益方式配置Service接口
*
* @author gyt
* @date 2025-08-19
*/
public interface IEpsServerRevenueConfigService
{
/**
* 查询服务器收益方式配置
*
* @param id 服务器收益方式配置主键
* @return 服务器收益方式配置
*/
public EpsServerRevenueConfig selectEpsServerRevenueConfigById(Long id);
/**
* 查询服务器收益方式配置列表
*
* @param epsServerRevenueConfig 服务器收益方式配置
* @return 服务器收益方式配置集合
*/
public List<EpsServerRevenueConfig> selectEpsServerRevenueConfigList(EpsServerRevenueConfig epsServerRevenueConfig);
/**
* 新增服务器收益方式配置
*
* @param epsServerRevenueConfig 服务器收益方式配置
* @return 结果
*/
public int insertEpsServerRevenueConfig(EpsServerRevenueConfig epsServerRevenueConfig);
/**
* 修改服务器收益方式配置
*
* @param epsServerRevenueConfig 服务器收益方式配置
* @return 结果
*/
public int updateEpsServerRevenueConfig(EpsServerRevenueConfig epsServerRevenueConfig);
/**
* 批量删除服务器收益方式配置
*
* @param ids 需要删除的服务器收益方式配置主键集合
* @return 结果
*/
public int deleteEpsServerRevenueConfigByIds(Long[] ids);
/**
* 删除服务器收益方式配置信息
*
* @param id 服务器收益方式配置主键
* @return 结果
*/
public int deleteEpsServerRevenueConfigById(Long id);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.EpsTrafficData;
/**
* 流量相关数据Service接口
*
* @author gyt
* @date 2025-08-12
*/
public interface IEpsTrafficDataService
{
/**
* 查询流量相关数据
*
* @param id 流量相关数据主键
* @return 流量相关数据
*/
public EpsTrafficData selectEpsTrafficDataById(Long id);
/**
* 查询流量相关数据列表
*
* @param epsTrafficData 流量相关数据
* @return 流量相关数据集合
*/
public List<EpsTrafficData> selectEpsTrafficDataList(EpsTrafficData epsTrafficData);
/**
* 新增流量相关数据
*
* @param epsTrafficData 流量相关数据
* @return 结果
*/
public int insertEpsTrafficData(EpsTrafficData epsTrafficData);
/**
* 修改流量相关数据
*
* @param epsTrafficData 流量相关数据
* @return 结果
*/
public int updateEpsTrafficData(EpsTrafficData epsTrafficData);
/**
* 批量删除流量相关数据
*
* @param ids 需要删除的流量相关数据主键集合
* @return 结果
*/
public int deleteEpsTrafficDataByIds(Long[] ids);
/**
* 删除流量相关数据信息
*
* @param id 流量相关数据主键
* @return 结果
*/
public int deleteEpsTrafficDataById(Long id);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.KnowledgeBase;
/**
* 知识库Service接口
*
* @author gyt
* @date 2025-08-15
*/
public interface IKnowledgeBaseService
{
/**
* 查询知识库
*
* @param id 知识库主键
* @return 知识库
*/
public KnowledgeBase selectKnowledgeBaseById(Long id);
/**
* 查询知识库列表
*
* @param knowledgeBase 知识库
* @return 知识库集合
*/
public List<KnowledgeBase> selectKnowledgeBaseList(KnowledgeBase knowledgeBase);
/**
* 新增知识库
*
* @param knowledgeBase 知识库
* @return 结果
*/
public int insertKnowledgeBase(KnowledgeBase knowledgeBase);
/**
* 修改知识库
*
* @param knowledgeBase 知识库
* @return 结果
*/
public int updateKnowledgeBase(KnowledgeBase knowledgeBase);
/**
* 批量删除知识库
*
* @param ids 需要删除的知识库主键集合
* @return 结果
*/
public int deleteKnowledgeBaseByIds(Long[] ids);
/**
* 删除知识库信息
*
* @param id 知识库主键
* @return 结果
*/
public int deleteKnowledgeBaseById(Long id);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.MtmMonitoringTemplate;
/**
* 监控模板管理Service接口
*
* @author gyt
* @date 2025-08-12
*/
public interface IMtmMonitoringTemplateService
{
/**
* 查询监控模板管理
*
* @param id 监控模板管理主键
* @return 监控模板管理
*/
public MtmMonitoringTemplate selectMtmMonitoringTemplateById(Long id);
/**
* 查询监控模板管理列表
*
* @param mtmMonitoringTemplate 监控模板管理
* @return 监控模板管理集合
*/
public List<MtmMonitoringTemplate> selectMtmMonitoringTemplateList(MtmMonitoringTemplate mtmMonitoringTemplate);
/**
* 新增监控模板管理
*
* @param mtmMonitoringTemplate 监控模板管理
* @return 结果
*/
public int insertMtmMonitoringTemplate(MtmMonitoringTemplate mtmMonitoringTemplate);
/**
* 修改监控模板管理
*
* @param mtmMonitoringTemplate 监控模板管理
* @return 结果
*/
public int updateMtmMonitoringTemplate(MtmMonitoringTemplate mtmMonitoringTemplate);
/**
* 批量删除监控模板管理
*
* @param ids 需要删除的监控模板管理主键集合
* @return 结果
*/
public int deleteMtmMonitoringTemplateByIds(Long[] ids);
/**
* 删除监控模板管理信息
*
* @param id 监控模板管理主键
* @return 结果
*/
public int deleteMtmMonitoringTemplateById(Long id);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.RmEpsTopologyManagement;
/**
* 拓扑管理Service接口
*
* @author gyt
* @date 2025-08-12
*/
public interface IRmEpsTopologyManagementService
{
/**
* 查询拓扑管理
*
* @param id 拓扑管理主键
* @return 拓扑管理
*/
public RmEpsTopologyManagement selectRmEpsTopologyManagementById(Long id);
/**
* 查询拓扑管理列表
*
* @param rmEpsTopologyManagement 拓扑管理
* @return 拓扑管理集合
*/
public List<RmEpsTopologyManagement> selectRmEpsTopologyManagementList(RmEpsTopologyManagement rmEpsTopologyManagement);
/**
* 新增拓扑管理
*
* @param rmEpsTopologyManagement 拓扑管理
* @return 结果
*/
public int insertRmEpsTopologyManagement(RmEpsTopologyManagement rmEpsTopologyManagement);
/**
* 修改拓扑管理
*
* @param rmEpsTopologyManagement 拓扑管理
* @return 结果
*/
public int updateRmEpsTopologyManagement(RmEpsTopologyManagement rmEpsTopologyManagement);
/**
* 批量删除拓扑管理
*
* @param ids 需要删除的拓扑管理主键集合
* @return 结果
*/
public int deleteRmEpsTopologyManagementByIds(Long[] ids);
/**
* 删除拓扑管理信息
*
* @param id 拓扑管理主键
* @return 结果
*/
public int deleteRmEpsTopologyManagementById(Long id);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.RmResourceGroup;
/**
* 资源分组Service接口
*
* @author gyt
* @date 2025-08-12
*/
public interface IRmResourceGroupService
{
/**
* 查询资源分组
*
* @param id 资源分组主键
* @return 资源分组
*/
public RmResourceGroup selectRmResourceGroupById(Long id);
/**
* 查询资源分组列表
*
* @param rmResourceGroup 资源分组
* @return 资源分组集合
*/
public List<RmResourceGroup> selectRmResourceGroupList(RmResourceGroup rmResourceGroup);
/**
* 新增资源分组
*
* @param rmResourceGroup 资源分组
* @return 结果
*/
public int insertRmResourceGroup(RmResourceGroup rmResourceGroup);
/**
* 修改资源分组
*
* @param rmResourceGroup 资源分组
* @return 结果
*/
public int updateRmResourceGroup(RmResourceGroup rmResourceGroup);
/**
* 批量删除资源分组
*
* @param ids 需要删除的资源分组主键集合
* @return 结果
*/
public int deleteRmResourceGroupByIds(Long[] ids);
/**
* 删除资源分组信息
*
* @param id 资源分组主键
* @return 结果
*/
public int deleteRmResourceGroupById(Long id);
}

View File

@@ -1,8 +1,10 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.RmResourceRegistration;
import java.util.List;
import java.util.Map;
/**
* 资源注册Service接口
*
@@ -43,6 +45,13 @@ public interface IRmResourceRegistrationService
*/
public int updateRmResourceRegistration(RmResourceRegistration rmResourceRegistration);
/**
* 资源注册-注册
* @param rmResourceRegistration
* @return
*/
public int register(RmResourceRegistration rmResourceRegistration);
/**
* 批量删除资源注册
*
@@ -58,4 +67,16 @@ public interface IRmResourceRegistrationService
* @return 结果
*/
public int deleteRmResourceRegistrationById(Long id);
/**
* 查询所有资源名称(包含设备使用)
* @return 资源注册集合
*/
public List<Map> selectAllResourceName();
/**
* 查询所有资源名称
* @return 资源注册集合
*/
public List<Map> selectAllResourceNameByType(RmResourceRegistration resourceRegistration);
}

View File

@@ -0,0 +1,119 @@
package com.ruoyi.system.service.impl;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.system.domain.EpsBusiness;
import com.ruoyi.system.mapper.EpsBusinessMapper;
import com.ruoyi.system.service.IEpsBusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 业务信息Service业务层处理
*
* @author gyt
* @date 2025-08-18
*/
@Service
public class EpsBusinessServiceImpl implements IEpsBusinessService
{
@Autowired
private EpsBusinessMapper epsBusinessMapper;
/**
* 查询业务信息
*
* @param id 业务信息主键
* @return 业务信息
*/
@Override
public EpsBusiness selectEpsBusinessById(String id)
{
return epsBusinessMapper.selectEpsBusinessById(id);
}
/**
* 查询业务信息列表
*
* @param epsBusiness 业务信息
* @return 业务信息
*/
@Override
public List<EpsBusiness> selectEpsBusinessList(EpsBusiness epsBusiness)
{
return epsBusinessMapper.selectEpsBusinessList(epsBusiness);
}
/**
* 新增业务信息
*
* @param epsBusiness 业务信息
* @return 结果
*/
@Override
public int insertEpsBusiness(EpsBusiness epsBusiness)
{
epsBusiness.setCreateTime(DateUtils.getNowDate());
// 查询业务名称是否存在
Integer exits = epsBusinessMapper.countByBusinessName(epsBusiness);
if(exits>0){
return -1;
}
return epsBusinessMapper.insertEpsBusiness(epsBusiness);
}
/**
* 修改业务信息
*
* @param epsBusiness 业务信息
* @return 结果
*/
@Override
public int updateEpsBusiness(EpsBusiness epsBusiness)
{
epsBusiness.setUpdateTime(DateUtils.getNowDate());
// 查询业务名称是否存在
Integer exits = epsBusinessMapper.countByBusinessName(epsBusiness);
if(exits>0){
return -1;
}
return epsBusinessMapper.updateEpsBusiness(epsBusiness);
}
/**
* 批量删除业务信息
*
* @param ids 需要删除的业务信息主键
* @return 结果
*/
@Override
public int deleteEpsBusinessByIds(String[] ids)
{
return epsBusinessMapper.deleteEpsBusinessByIds(ids);
}
/**
* 删除业务信息信息
*
* @param id 业务信息主键
* @return 结果
*/
@Override
public int deleteEpsBusinessById(String id)
{
return epsBusinessMapper.deleteEpsBusinessById(id);
}
/**
* 验证业务名称是否存在
* @param epsBusiness
* @return
*/
@Override
public Integer countByBusinessName(EpsBusiness epsBusiness) {
// 查询业务名称是否存在
Integer rows = epsBusinessMapper.countByBusinessName(epsBusiness);
return rows;
}
}

View File

@@ -0,0 +1,164 @@
package com.ruoyi.system.service.impl;
import com.ruoyi.system.domain.EpsInitialTrafficData;
import com.ruoyi.system.mapper.EpsInitialTrafficDataMapper;
import com.ruoyi.system.service.EpsInitialTrafficDataService;
import com.ruoyi.system.util.TableRouterUtil;
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.Transactional;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
import java.util.stream.Collectors;
@Service
@Slf4j
public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataService {
@Autowired
private EpsInitialTrafficDataMapper epsInitialTrafficDataMapper;
@Override
public void createNextMonthTables() {
LocalDate nextMonth = LocalDate.now().plusMonths(1);
// LocalDate nextMonth = LocalDate.now();
int year = nextMonth.getYear();
int month = nextMonth.getMonthValue();
// 创建流量详情表
createTrafficDetailsTable(year, month);
// 创建流量初始表
createTrafficStatsTable(year, month);
}
private void createTrafficDetailsTable(int year, int month) {
createRangeTables(year, month, "eps_traffic_details", (tableName) -> {
epsInitialTrafficDataMapper.createEpsTrafficTable(tableName);
});
}
private void createTrafficStatsTable(int year, int month) {
createRangeTables(year, month, "initial_bandwidth_traffic", (tableName) -> {
epsInitialTrafficDataMapper.createEpsInitialTrafficTable(tableName);
});
}
/**
* 通用创建表方法
* @param year 年份
* @param month 月份
* @param tablePrefix 表前缀
* @param creator 表创建函数
*/
private void createRangeTables(int year, int month, String tablePrefix, Consumer<String> creator) {
String[] ranges = {"1_10", "11_20", "21_31"};
for (String range : ranges) {
String tableName = String.format("%s_%d_%02d_%s", tablePrefix, year, month, range);
try {
creator.accept(tableName);
log.info("成功创建表: {}", tableName);
} catch (Exception e) {
log.error("创建表失败: {}", tableName, e);
}
}
}
/**
* 保存单条数据到对应分表
* @param data 流量数据
*/
@Override
@Transactional
public void save(EpsInitialTrafficData data) {
if (data.getCreateTime() == null) {
data.setCreateTime(LocalDateTime.now());
}
data.setTableName(TableRouterUtil.getTableName(data.getCreateTime()));
epsInitialTrafficDataMapper.insert(data);
}
/**
* 批量保存数据到对应分表
* @param epsInitialTrafficData 流量数据表
*/
@Override
@Transactional
public void saveBatch(EpsInitialTrafficData epsInitialTrafficData) {
if (epsInitialTrafficData == null) {
return;
}
List<EpsInitialTrafficData> dataList = epsInitialTrafficData.getDataList();
if (dataList.isEmpty()){
return;
}
// 按表名分组批量插入
Map<String, List<EpsInitialTrafficData>> groupedData = dataList.stream()
.map(data -> {
try {
EpsInitialTrafficData processed = new EpsInitialTrafficData();
BeanUtils.copyProperties(data,processed);
if (data.getCreateTime() == null) {
data.setCreateTime(LocalDateTime.now());
}
processed.setTableName(TableRouterUtil.getTableName(data.getCreateTime()));
return processed;
} catch (Exception e){
log.error("数据处理失败",e.getMessage());
return null;
}
}).collect(Collectors.groupingBy(
EpsInitialTrafficData::getTableName,
LinkedHashMap::new, // 保持插入顺序
Collectors.toList()));
groupedData.forEach((tableName, list) -> {
try {
EpsInitialTrafficData data = new EpsInitialTrafficData();
BeanUtils.copyProperties(epsInitialTrafficData,data);
data.setTableName(tableName);
data.setDataList(list);
epsInitialTrafficDataMapper.batchInsert(data);
} catch (Exception e) {
log.error("表{}插入失败", tableName, e);
throw new RuntimeException("批量插入失败", e);
}
});
}
/**
* 查询流量数据
*/
@Override
public List<EpsInitialTrafficData> query(EpsInitialTrafficData queryParam) {
// 参数校验
// if (StringUtils.isBlank(queryParam.getDeviceSn())) {
// throw new IllegalArgumentException("设备序列号不能为空");
// }
// 获取涉及的表名
Set<String> tableNames = TableRouterUtil.getTableNamesBetween(queryParam.getStartTime(), queryParam.getEndTime());
// 并行查询各表
return tableNames.parallelStream()
.flatMap(tableName -> {
EpsInitialTrafficData condition = new EpsInitialTrafficData();
condition.setTableName(tableName);
condition.setDeviceSn(queryParam.getDeviceSn());
condition.setStartTime(queryParam.getStartTime());
condition.setEndTime(queryParam.getEndTime());
condition.setReceiveTraffic(queryParam.getReceiveTraffic());
condition.setSendTraffic(queryParam.getSendTraffic());
return epsInitialTrafficDataMapper.selectByCondition(condition).stream();
})
.collect(Collectors.toList());
}
}

View File

@@ -0,0 +1,96 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.EpsMethodChangeRecordMapper;
import com.ruoyi.system.domain.EpsMethodChangeRecord;
import com.ruoyi.system.service.IEpsMethodChangeRecordService;
/**
* 收益方式修改记录Service业务层处理
*
* @author gyt
* @date 2025-08-15
*/
@Service
public class EpsMethodChangeRecordServiceImpl implements IEpsMethodChangeRecordService
{
@Autowired
private EpsMethodChangeRecordMapper epsMethodChangeRecordMapper;
/**
* 查询收益方式修改记录
*
* @param id 收益方式修改记录主键
* @return 收益方式修改记录
*/
@Override
public EpsMethodChangeRecord selectEpsMethodChangeRecordById(Long id)
{
return epsMethodChangeRecordMapper.selectEpsMethodChangeRecordById(id);
}
/**
* 查询收益方式修改记录列表
*
* @param epsMethodChangeRecord 收益方式修改记录
* @return 收益方式修改记录
*/
@Override
public List<EpsMethodChangeRecord> selectEpsMethodChangeRecordList(EpsMethodChangeRecord epsMethodChangeRecord)
{
return epsMethodChangeRecordMapper.selectEpsMethodChangeRecordList(epsMethodChangeRecord);
}
/**
* 新增收益方式修改记录
*
* @param epsMethodChangeRecord 收益方式修改记录
* @return 结果
*/
@Override
public int insertEpsMethodChangeRecord(EpsMethodChangeRecord epsMethodChangeRecord)
{
epsMethodChangeRecord.setCreateTime(DateUtils.getNowDate());
return epsMethodChangeRecordMapper.insertEpsMethodChangeRecord(epsMethodChangeRecord);
}
/**
* 修改收益方式修改记录
*
* @param epsMethodChangeRecord 收益方式修改记录
* @return 结果
*/
@Override
public int updateEpsMethodChangeRecord(EpsMethodChangeRecord epsMethodChangeRecord)
{
epsMethodChangeRecord.setUpdateTime(DateUtils.getNowDate());
return epsMethodChangeRecordMapper.updateEpsMethodChangeRecord(epsMethodChangeRecord);
}
/**
* 批量删除收益方式修改记录
*
* @param ids 需要删除的收益方式修改记录主键
* @return 结果
*/
@Override
public int deleteEpsMethodChangeRecordByIds(Long[] ids)
{
return epsMethodChangeRecordMapper.deleteEpsMethodChangeRecordByIds(ids);
}
/**
* 删除收益方式修改记录信息
*
* @param id 收益方式修改记录主键
* @return 结果
*/
@Override
public int deleteEpsMethodChangeRecordById(Long id)
{
return epsMethodChangeRecordMapper.deleteEpsMethodChangeRecordById(id);
}
}

View File

@@ -0,0 +1,212 @@
package com.ruoyi.system.service.impl;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.system.domain.EpsInitialTrafficData;
import com.ruoyi.system.domain.EpsNodeBandwidth;
import com.ruoyi.system.mapper.EpsNodeBandwidthMapper;
import com.ruoyi.system.service.EpsInitialTrafficDataService;
import com.ruoyi.system.service.IEpsNodeBandwidthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.webjars.NotFoundException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.*;
import java.util.Date;
import java.util.List;
/**
* 节点带宽信息Service业务层处理
*
* @author gyt
* @date 2025-08-12
*/
@Service
public class EpsNodeBandwidthServiceImpl implements IEpsNodeBandwidthService
{
@Autowired
private EpsNodeBandwidthMapper epsNodeBandwidthMapper;
@Autowired
private EpsInitialTrafficDataService epsInitialTrafficDataService;
/**
* 查询节点带宽信息
*
* @param id 节点带宽信息主键
* @return 节点带宽信息
*/
@Override
public EpsNodeBandwidth selectEpsNodeBandwidthById(Long id)
{
return epsNodeBandwidthMapper.selectEpsNodeBandwidthById(id);
}
/**
* 查询节点带宽信息
*
* @param id 节点带宽信息主键
* @return 节点带宽信息
*/
@Override
public List<EpsInitialTrafficData> relatedData(Long id)
{
// 1. 根据ID查询服务器信息
EpsNodeBandwidth epsNodeBandwidth = epsNodeBandwidthMapper.selectEpsNodeBandwidthById(id);
if (epsNodeBandwidth == null) {
throw new NotFoundException("未找到ID为" + id + "的服务器信息");
}
// 2. 设置查询条件
EpsInitialTrafficData queryParams = new EpsInitialTrafficData();
queryParams.setDeviceSn(epsNodeBandwidth.getHardwareSn());
// 3. 根据带宽类型设置时间范围
LocalDateTime createTime = dateToLocalDateTime(epsNodeBandwidth.getCreateTime());
setTimeRangeByBandwidthType(queryParams, epsNodeBandwidth.getBandwidthType(), createTime);
// 4. 查询并返回数据
return epsInitialTrafficDataService.query(queryParams);
}
/**
* 查询节点带宽信息列表
*
* @param epsNodeBandwidth 节点带宽信息
* @return 节点带宽信息
*/
@Override
public List<EpsNodeBandwidth> selectEpsNodeBandwidthList(EpsNodeBandwidth epsNodeBandwidth)
{
return epsNodeBandwidthMapper.selectEpsNodeBandwidthList(epsNodeBandwidth);
}
/**
* 新增节点带宽信息
*
* @param epsNodeBandwidth 节点带宽信息
* @return 结果
*/
@Override
public int insertEpsNodeBandwidth(EpsNodeBandwidth epsNodeBandwidth)
{
epsNodeBandwidth.setCreateTime(DateUtils.getNowDate());
return epsNodeBandwidthMapper.insertEpsNodeBandwidth(epsNodeBandwidth);
}
/**
* 修改节点带宽信息
*
* @param epsNodeBandwidth 节点带宽信息
* @return 结果
*/
@Override
public int updateEpsNodeBandwidth(EpsNodeBandwidth epsNodeBandwidth)
{
epsNodeBandwidth.setUpdateTime(DateUtils.getNowDate());
return epsNodeBandwidthMapper.updateEpsNodeBandwidth(epsNodeBandwidth);
}
/**
* 批量删除节点带宽信息
*
* @param ids 需要删除的节点带宽信息主键
* @return 结果
*/
@Override
public int deleteEpsNodeBandwidthByIds(Long[] ids)
{
return epsNodeBandwidthMapper.deleteEpsNodeBandwidthByIds(ids);
}
/**
* 删除节点带宽信息信息
*
* @param id 节点带宽信息主键
* @return 结果
*/
@Override
public int deleteEpsNodeBandwidthById(Long id)
{
return epsNodeBandwidthMapper.deleteEpsNodeBandwidthById(id);
}
/**
* 计算月均日95值
*
* @param epsNodeBandwidth 节点带宽信息
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int calculateAvg(EpsNodeBandwidth epsNodeBandwidth) {
// 验证是否已经存在记录
List<EpsNodeBandwidth> existingRecords = epsNodeBandwidthMapper.selectEpsNodeBandwidthList(epsNodeBandwidth);
EpsNodeBandwidth calculatedData = epsNodeBandwidthMapper.calculateAvg(epsNodeBandwidth);
// 日95值总和
BigDecimal sum95Daily = calculatedData.getBandwidth95Daily();
// 日有效95值总和
BigDecimal sumEffectiveBandwidth95Daily = calculatedData.getEffectiveBandwidth95Daily();
// 计算当月天数并求平均值
LocalDate monthTime = epsNodeBandwidth.getMonthTime();
int daysInMonth = YearMonth.from(monthTime).lengthOfMonth();
// 月均日95值
BigDecimal avgMonthlyBandwidth95 = daysInMonth == 0 ? BigDecimal.ZERO :
sum95Daily.divide(BigDecimal.valueOf(daysInMonth), 2, RoundingMode.HALF_UP);
epsNodeBandwidth.setAvgMonthlyBandwidth95(avgMonthlyBandwidth95);
// 有效-月均日95值
BigDecimal effectiveAvgMonthlyBandwidth95 = daysInMonth == 0 ? BigDecimal.ZERO :
sumEffectiveBandwidth95Daily.divide(BigDecimal.valueOf(daysInMonth), 2, RoundingMode.HALF_UP);
epsNodeBandwidth.setEffectiveAvgMonthlyBandwidth95(effectiveAvgMonthlyBandwidth95);
// 根据是否存在记录执行更新或插入操作
return existingRecords.isEmpty() ?
epsNodeBandwidthMapper.insertEpsNodeBandwidth(epsNodeBandwidth) :
epsNodeBandwidthMapper.updateEpsNodeBandwidth(epsNodeBandwidth);
}
@Override
public List<EpsNodeBandwidth> getAvgDetailMsg(Long id) {
// 1. 根据ID查询服务器信息
EpsNodeBandwidth epsNodeBandwidth = epsNodeBandwidthMapper.selectEpsNodeBandwidthById(id);
if (epsNodeBandwidth == null) {
throw new NotFoundException("未找到ID为" + id + "的服务器信息");
}
return epsNodeBandwidthMapper.getAvgDetailMsg(epsNodeBandwidth);
}
/**
* Date 类型 转为 LocalDateTime 类型
* @param date
* @return
*/
public static LocalDateTime dateToLocalDateTime(Date date) {
return date.toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDateTime();
}
/**
* 根据带宽类型设置时间范围
*/
private void setTimeRangeByBandwidthType(EpsInitialTrafficData data, String bandwidthType, LocalDateTime baseTime) {
switch (bandwidthType) {
case "1":
case "3":
case "5": // 日带宽
data.setStartTime(baseTime.with(LocalTime.MIN)); // 00:00:00
data.setEndTime(baseTime.with(LocalTime.MAX).withNano(0)); // 23:59:59
break;
case "2":
case "4":
case "6":
case "7": // 月带宽
YearMonth month = YearMonth.from(baseTime);
data.setStartTime(month.atDay(1).atStartOfDay()); // 当月第一天 00:00:00
data.setEndTime(month.atEndOfMonth().atTime(23, 59, 59)); // 当月最后一天 23:59:59
break;
default:
throw new IllegalArgumentException("不支持的带宽类型: " + bandwidthType);
}
}
}

View File

@@ -0,0 +1,147 @@
package com.ruoyi.system.service.impl;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.domain.EpsMethodChangeRecord;
import com.ruoyi.system.domain.EpsServerRevenueConfig;
import com.ruoyi.system.mapper.EpsServerRevenueConfigMapper;
import com.ruoyi.system.service.IEpsServerRevenueConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 服务器收益方式配置Service业务层处理
*
* @author gyt
* @date 2025-08-19
*/
@Service
public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfigService
{
@Autowired
private EpsServerRevenueConfigMapper epsServerRevenueConfigMapper;
/**
* 查询服务器收益方式配置
*
* @param id 服务器收益方式配置主键
* @return 服务器收益方式配置
*/
@Override
public EpsServerRevenueConfig selectEpsServerRevenueConfigById(Long id)
{
return epsServerRevenueConfigMapper.selectEpsServerRevenueConfigById(id);
}
/**
* 查询服务器收益方式配置列表
*
* @param epsServerRevenueConfig 服务器收益方式配置
* @return 服务器收益方式配置
*/
@Override
public List<EpsServerRevenueConfig> selectEpsServerRevenueConfigList(EpsServerRevenueConfig epsServerRevenueConfig)
{
return epsServerRevenueConfigMapper.selectEpsServerRevenueConfigList(epsServerRevenueConfig);
}
/**
* 新增服务器收益方式配置
*
* @param epsServerRevenueConfig 服务器收益方式配置
* @return 结果
*/
@Override
public int insertEpsServerRevenueConfig(EpsServerRevenueConfig epsServerRevenueConfig)
{
epsServerRevenueConfig.setCreateTime(DateUtils.getNowDate());
return epsServerRevenueConfigMapper.insertEpsServerRevenueConfig(epsServerRevenueConfig);
}
/**
* 修改服务器收益方式配置
*
* @param epsServerRevenueConfig 服务器收益方式配置
* @return 结果
*/
@Override
public int updateEpsServerRevenueConfig(EpsServerRevenueConfig epsServerRevenueConfig)
{
epsServerRevenueConfig.setUpdateTime(DateUtils.getNowDate());
//原来的收益方式
EpsServerRevenueConfig serverRevenueConfig = epsServerRevenueConfigMapper.selectEpsServerRevenueConfigById(epsServerRevenueConfig.getId());
String revenueMethod = getMethodName(serverRevenueConfig.getRevenueMethod());
//现在的收益方式
String nowRevenueMethod = getMethodName(epsServerRevenueConfig.getRevenueMethod());
// 修改条数
int rows = epsServerRevenueConfigMapper.updateEpsServerRevenueConfig(epsServerRevenueConfig);
if(rows>=0){
EpsMethodChangeRecord epsMethodChangeRecord = new EpsMethodChangeRecord();
// 节点名称
epsMethodChangeRecord.setNodeName(epsServerRevenueConfig.getNodeName());
// 硬件sn
epsMethodChangeRecord.setHardwareSn(epsServerRevenueConfig.getHardwareSn());
// 修改时间
epsMethodChangeRecord.setCreateTime(DateUtils.getNowDate());
// 修改人
epsMethodChangeRecord.setCreatBy(SecurityUtils.getUsername());
// 修改内容
String content = "";
if("流量".equals(nowRevenueMethod)){
// 修改内容
content = "收益方式变为【"+nowRevenueMethod+"】,流量网口设置为"+epsServerRevenueConfig.getTrafficPort()+
",业务为"+epsServerRevenueConfig.getBusinessName();
}
if("包端".equals(nowRevenueMethod)){
// 修改内容
content = "收益方式变为【"+nowRevenueMethod+"】,流量网口设置为"+epsServerRevenueConfig.getTrafficPort()+
",带宽值设置为"+epsServerRevenueConfig.getPackageBandwidth()+"Mbps,"+"业务为"+epsServerRevenueConfig.getBusinessName();
}
epsMethodChangeRecord.setChangeContent(content);
// 添加操作记录
epsServerRevenueConfigMapper.insertEpsServerRevenueConfig(epsServerRevenueConfig);
}
return rows;
}
/**
* 批量删除服务器收益方式配置
*
* @param ids 需要删除的服务器收益方式配置主键
* @return 结果
*/
@Override
public int deleteEpsServerRevenueConfigByIds(Long[] ids)
{
return epsServerRevenueConfigMapper.deleteEpsServerRevenueConfigByIds(ids);
}
/**
* 删除服务器收益方式配置信息
*
* @param id 服务器收益方式配置主键
* @return 结果
*/
@Override
public int deleteEpsServerRevenueConfigById(Long id)
{
return epsServerRevenueConfigMapper.deleteEpsServerRevenueConfigById(id);
}
/**
* 把收益方式转化为文字
* @param method
* @return
*/
public String getMethodName(String method){
String revenueMethod = "";
if("1".equals(method)){
revenueMethod = "流量";
}
if("2".equals(method)){
revenueMethod = "包端";
}
return revenueMethod;
}
}

View File

@@ -0,0 +1,118 @@
package com.ruoyi.system.service.impl;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.system.domain.EpsTrafficData;
import com.ruoyi.system.mapper.EpsMethodChangeRecordMapper;
import com.ruoyi.system.mapper.EpsTrafficDataMapper;
import com.ruoyi.system.service.IEpsTrafficDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 流量相关数据Service业务层处理
*
* @author gyt
* @date 2025-08-12
*/
@Service
public class EpsTrafficDataServiceImpl implements IEpsTrafficDataService
{
@Autowired
private EpsTrafficDataMapper epsTrafficDataMapper;
@Autowired
private EpsMethodChangeRecordMapper epsMethodChangeRecordMapper;
/**
* 查询流量相关数据
*
* @param id 流量相关数据主键
* @return 流量相关数据
*/
@Override
public EpsTrafficData selectEpsTrafficDataById(Long id)
{
return epsTrafficDataMapper.selectEpsTrafficDataById(id);
}
/**
* 查询流量相关数据列表
*
* @param epsTrafficData 流量相关数据
* @return 流量相关数据
*/
@Override
public List<EpsTrafficData> selectEpsTrafficDataList(EpsTrafficData epsTrafficData)
{
return epsTrafficDataMapper.selectEpsTrafficDataList(epsTrafficData);
}
/**
* 新增流量相关数据
*
* @param epsTrafficData 流量相关数据
* @return 结果
*/
@Override
public int insertEpsTrafficData(EpsTrafficData epsTrafficData)
{
epsTrafficData.setCreateTime(DateUtils.getNowDate());
return epsTrafficDataMapper.insertEpsTrafficData(epsTrafficData);
}
/**
* 修改流量相关数据
*
* @param epsTrafficData 流量相关数据
* @return 结果
*/
@Override
public int updateEpsTrafficData(EpsTrafficData epsTrafficData)
{
epsTrafficData.setUpdateTime(DateUtils.getNowDate());
// 修改条数
int rows = epsTrafficDataMapper.updateEpsTrafficData(epsTrafficData);
return rows;
}
/**
* 批量删除流量相关数据
*
* @param ids 需要删除的流量相关数据主键
* @return 结果
*/
@Override
public int deleteEpsTrafficDataByIds(Long[] ids)
{
return epsTrafficDataMapper.deleteEpsTrafficDataByIds(ids);
}
/**
* 删除流量相关数据信息
*
* @param id 流量相关数据主键
* @return 结果
*/
@Override
public int deleteEpsTrafficDataById(Long id)
{
return epsTrafficDataMapper.deleteEpsTrafficDataById(id);
}
/**
* 把收益方式转化为文字
* @param method
* @return
*/
public String getMethodName(String method){
String revenueMethod = "";
if("1".equals(method)){
revenueMethod = "流量";
}
if("2".equals(method)){
revenueMethod = "包端";
}
return revenueMethod;
}
}

View File

@@ -0,0 +1,96 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.KnowledgeBaseMapper;
import com.ruoyi.system.domain.KnowledgeBase;
import com.ruoyi.system.service.IKnowledgeBaseService;
/**
* 知识库Service业务层处理
*
* @author gyt
* @date 2025-08-15
*/
@Service
public class KnowledgeBaseServiceImpl implements IKnowledgeBaseService
{
@Autowired
private KnowledgeBaseMapper knowledgeBaseMapper;
/**
* 查询知识库
*
* @param id 知识库主键
* @return 知识库
*/
@Override
public KnowledgeBase selectKnowledgeBaseById(Long id)
{
return knowledgeBaseMapper.selectKnowledgeBaseById(id);
}
/**
* 查询知识库列表
*
* @param knowledgeBase 知识库
* @return 知识库
*/
@Override
public List<KnowledgeBase> selectKnowledgeBaseList(KnowledgeBase knowledgeBase)
{
return knowledgeBaseMapper.selectKnowledgeBaseList(knowledgeBase);
}
/**
* 新增知识库
*
* @param knowledgeBase 知识库
* @return 结果
*/
@Override
public int insertKnowledgeBase(KnowledgeBase knowledgeBase)
{
knowledgeBase.setCreateTime(DateUtils.getNowDate());
return knowledgeBaseMapper.insertKnowledgeBase(knowledgeBase);
}
/**
* 修改知识库
*
* @param knowledgeBase 知识库
* @return 结果
*/
@Override
public int updateKnowledgeBase(KnowledgeBase knowledgeBase)
{
knowledgeBase.setUpdateTime(DateUtils.getNowDate());
return knowledgeBaseMapper.updateKnowledgeBase(knowledgeBase);
}
/**
* 批量删除知识库
*
* @param ids 需要删除的知识库主键
* @return 结果
*/
@Override
public int deleteKnowledgeBaseByIds(Long[] ids)
{
return knowledgeBaseMapper.deleteKnowledgeBaseByIds(ids);
}
/**
* 删除知识库信息
*
* @param id 知识库主键
* @return 结果
*/
@Override
public int deleteKnowledgeBaseById(Long id)
{
return knowledgeBaseMapper.deleteKnowledgeBaseById(id);
}
}

View File

@@ -0,0 +1,96 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.MtmMonitoringTemplateMapper;
import com.ruoyi.system.domain.MtmMonitoringTemplate;
import com.ruoyi.system.service.IMtmMonitoringTemplateService;
/**
* 监控模板管理Service业务层处理
*
* @author gyt
* @date 2025-08-12
*/
@Service
public class MtmMonitoringTemplateServiceImpl implements IMtmMonitoringTemplateService
{
@Autowired
private MtmMonitoringTemplateMapper mtmMonitoringTemplateMapper;
/**
* 查询监控模板管理
*
* @param id 监控模板管理主键
* @return 监控模板管理
*/
@Override
public MtmMonitoringTemplate selectMtmMonitoringTemplateById(Long id)
{
return mtmMonitoringTemplateMapper.selectMtmMonitoringTemplateById(id);
}
/**
* 查询监控模板管理列表
*
* @param mtmMonitoringTemplate 监控模板管理
* @return 监控模板管理
*/
@Override
public List<MtmMonitoringTemplate> selectMtmMonitoringTemplateList(MtmMonitoringTemplate mtmMonitoringTemplate)
{
return mtmMonitoringTemplateMapper.selectMtmMonitoringTemplateList(mtmMonitoringTemplate);
}
/**
* 新增监控模板管理
*
* @param mtmMonitoringTemplate 监控模板管理
* @return 结果
*/
@Override
public int insertMtmMonitoringTemplate(MtmMonitoringTemplate mtmMonitoringTemplate)
{
mtmMonitoringTemplate.setCreateTime(DateUtils.getNowDate());
return mtmMonitoringTemplateMapper.insertMtmMonitoringTemplate(mtmMonitoringTemplate);
}
/**
* 修改监控模板管理
*
* @param mtmMonitoringTemplate 监控模板管理
* @return 结果
*/
@Override
public int updateMtmMonitoringTemplate(MtmMonitoringTemplate mtmMonitoringTemplate)
{
mtmMonitoringTemplate.setUpdateTime(DateUtils.getNowDate());
return mtmMonitoringTemplateMapper.updateMtmMonitoringTemplate(mtmMonitoringTemplate);
}
/**
* 批量删除监控模板管理
*
* @param ids 需要删除的监控模板管理主键
* @return 结果
*/
@Override
public int deleteMtmMonitoringTemplateByIds(Long[] ids)
{
return mtmMonitoringTemplateMapper.deleteMtmMonitoringTemplateByIds(ids);
}
/**
* 删除监控模板管理信息
*
* @param id 监控模板管理主键
* @return 结果
*/
@Override
public int deleteMtmMonitoringTemplateById(Long id)
{
return mtmMonitoringTemplateMapper.deleteMtmMonitoringTemplateById(id);
}
}

View File

@@ -0,0 +1,96 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.RmEpsTopologyManagementMapper;
import com.ruoyi.system.domain.RmEpsTopologyManagement;
import com.ruoyi.system.service.IRmEpsTopologyManagementService;
/**
* 拓扑管理Service业务层处理
*
* @author gyt
* @date 2025-08-12
*/
@Service
public class RmEpsTopologyManagementServiceImpl implements IRmEpsTopologyManagementService
{
@Autowired
private RmEpsTopologyManagementMapper rmEpsTopologyManagementMapper;
/**
* 查询拓扑管理
*
* @param id 拓扑管理主键
* @return 拓扑管理
*/
@Override
public RmEpsTopologyManagement selectRmEpsTopologyManagementById(Long id)
{
return rmEpsTopologyManagementMapper.selectRmEpsTopologyManagementById(id);
}
/**
* 查询拓扑管理列表
*
* @param rmEpsTopologyManagement 拓扑管理
* @return 拓扑管理
*/
@Override
public List<RmEpsTopologyManagement> selectRmEpsTopologyManagementList(RmEpsTopologyManagement rmEpsTopologyManagement)
{
return rmEpsTopologyManagementMapper.selectRmEpsTopologyManagementList(rmEpsTopologyManagement);
}
/**
* 新增拓扑管理
*
* @param rmEpsTopologyManagement 拓扑管理
* @return 结果
*/
@Override
public int insertRmEpsTopologyManagement(RmEpsTopologyManagement rmEpsTopologyManagement)
{
rmEpsTopologyManagement.setCreateTime(DateUtils.getNowDate());
return rmEpsTopologyManagementMapper.insertRmEpsTopologyManagement(rmEpsTopologyManagement);
}
/**
* 修改拓扑管理
*
* @param rmEpsTopologyManagement 拓扑管理
* @return 结果
*/
@Override
public int updateRmEpsTopologyManagement(RmEpsTopologyManagement rmEpsTopologyManagement)
{
rmEpsTopologyManagement.setUpdateTime(DateUtils.getNowDate());
return rmEpsTopologyManagementMapper.updateRmEpsTopologyManagement(rmEpsTopologyManagement);
}
/**
* 批量删除拓扑管理
*
* @param ids 需要删除的拓扑管理主键
* @return 结果
*/
@Override
public int deleteRmEpsTopologyManagementByIds(Long[] ids)
{
return rmEpsTopologyManagementMapper.deleteRmEpsTopologyManagementByIds(ids);
}
/**
* 删除拓扑管理信息
*
* @param id 拓扑管理主键
* @return 结果
*/
@Override
public int deleteRmEpsTopologyManagementById(Long id)
{
return rmEpsTopologyManagementMapper.deleteRmEpsTopologyManagementById(id);
}
}

View File

@@ -0,0 +1,96 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.RmResourceGroupMapper;
import com.ruoyi.system.domain.RmResourceGroup;
import com.ruoyi.system.service.IRmResourceGroupService;
/**
* 资源分组Service业务层处理
*
* @author gyt
* @date 2025-08-12
*/
@Service
public class RmResourceGroupServiceImpl implements IRmResourceGroupService
{
@Autowired
private RmResourceGroupMapper rmResourceGroupMapper;
/**
* 查询资源分组
*
* @param id 资源分组主键
* @return 资源分组
*/
@Override
public RmResourceGroup selectRmResourceGroupById(Long id)
{
return rmResourceGroupMapper.selectRmResourceGroupById(id);
}
/**
* 查询资源分组列表
*
* @param rmResourceGroup 资源分组
* @return 资源分组
*/
@Override
public List<RmResourceGroup> selectRmResourceGroupList(RmResourceGroup rmResourceGroup)
{
return rmResourceGroupMapper.selectRmResourceGroupList(rmResourceGroup);
}
/**
* 新增资源分组
*
* @param rmResourceGroup 资源分组
* @return 结果
*/
@Override
public int insertRmResourceGroup(RmResourceGroup rmResourceGroup)
{
rmResourceGroup.setCreateTime(DateUtils.getNowDate());
return rmResourceGroupMapper.insertRmResourceGroup(rmResourceGroup);
}
/**
* 修改资源分组
*
* @param rmResourceGroup 资源分组
* @return 结果
*/
@Override
public int updateRmResourceGroup(RmResourceGroup rmResourceGroup)
{
rmResourceGroup.setUpdateTime(DateUtils.getNowDate());
return rmResourceGroupMapper.updateRmResourceGroup(rmResourceGroup);
}
/**
* 批量删除资源分组
*
* @param ids 需要删除的资源分组主键
* @return 结果
*/
@Override
public int deleteRmResourceGroupByIds(Long[] ids)
{
return rmResourceGroupMapper.deleteRmResourceGroupByIds(ids);
}
/**
* 删除资源分组信息
*
* @param id 资源分组主键
* @return 结果
*/
@Override
public int deleteRmResourceGroupById(Long id)
{
return rmResourceGroupMapper.deleteRmResourceGroupById(id);
}
}

View File

@@ -1,14 +1,17 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.mapper.SysDictDataMapper;
import com.ruoyi.system.domain.EpsServerRevenueConfig;
import com.ruoyi.system.domain.RmResourceRegistration;
import com.ruoyi.system.mapper.EpsServerRevenueConfigMapper;
import com.ruoyi.system.mapper.RmResourceRegistrationMapper;
import com.ruoyi.system.service.IRmResourceRegistrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.RmResourceRegistrationMapper;
import com.ruoyi.system.domain.RmResourceRegistration;
import com.ruoyi.system.service.IRmResourceRegistrationService;
import java.util.List;
import java.util.Map;
/**
* 资源注册Service业务层处理
@@ -22,7 +25,7 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
@Autowired
private RmResourceRegistrationMapper rmResourceRegistrationMapper;
@Autowired
private SysDictDataMapper sysDictDataMapper;
private EpsServerRevenueConfigMapper epsServerRevenueConfigMapper;
/**
* 查询资源注册
@@ -61,6 +64,11 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
rmResourceRegistration.setCreatorId(SecurityUtils.getUserId());
rmResourceRegistration.setCreatorName(SecurityUtils.getUsername());
rmResourceRegistration.setCreateTime(DateUtils.getNowDate());
// 查询此硬件sn是否已存在
int exits = rmResourceRegistrationMapper.countBySn(rmResourceRegistration.getHardwareSn());
if(exits>0){
return -1;
}
return rmResourceRegistrationMapper.insertRmResourceRegistration(rmResourceRegistration);
}
@@ -76,9 +84,63 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
rmResourceRegistration.setUpdateTime(DateUtils.getNowDate());
rmResourceRegistration.setUpdaterId(SecurityUtils.getUserId());
rmResourceRegistration.setUpdaterName(SecurityUtils.getUsername());
// 禁止修改sn序列号
rmResourceRegistration.setHardwareSn(null);
// 已注册状态修改--仅可修改资源名称,描述
if ("1".equals(rmResourceRegistration.getRegistrationStatus())){
// 拿到需要修改的id
Long id = rmResourceRegistration.getId();
// 拿到需要修改的资源名称
String resourceName = rmResourceRegistration.getResourceName();
// 拿到需要修改的描述
String description = rmResourceRegistration.getDescription();
// 初始化
rmResourceRegistration = new RmResourceRegistration();
// id赋值
rmResourceRegistration.setId(id);
// 可修改资源名称
rmResourceRegistration.setResourceName(resourceName);
// 可修改描述
rmResourceRegistration.setDescription(description);
}
return rmResourceRegistrationMapper.updateRmResourceRegistration(rmResourceRegistration);
}
/**
* 资源注册-注册
*
* @param rmResourceRegistration 资源注册
* @return 结果
*/
@Override
public int register(RmResourceRegistration rmResourceRegistration)
{
rmResourceRegistration.setUpdateTime(DateUtils.getNowDate());
rmResourceRegistration.setUpdaterId(SecurityUtils.getUserId());
rmResourceRegistration.setUpdaterName(SecurityUtils.getUsername());
if("1".equals(rmResourceRegistration.getResourceType())){
// 注册服务器 添加到服务器收益配置表
EpsServerRevenueConfig epsServerRevenueConfig = new EpsServerRevenueConfig();
epsServerRevenueConfig.setHardwareSn(rmResourceRegistration.getHardwareSn());
epsServerRevenueConfig.setNodeName(rmResourceRegistration.getResourceName());
epsServerRevenueConfig.setCreateTime(DateUtils.getNowDate());
// 新增前判断是否存在
int exits = epsServerRevenueConfigMapper.countBySn(epsServerRevenueConfig.getHardwareSn());
if(exits>0){
// 存在 修改
epsServerRevenueConfigMapper.updateEpsServerRevenueConfig(epsServerRevenueConfig);
}else{
// 不存在 新增
epsServerRevenueConfigMapper.insertEpsServerRevenueConfig(epsServerRevenueConfig);
}
}
// 仅注册
RmResourceRegistration resourceRegistration = new RmResourceRegistration();
resourceRegistration.setId(rmResourceRegistration.getId());
resourceRegistration.setRegistrationStatus(rmResourceRegistration.getRegistrationStatus());
return rmResourceRegistrationMapper.updateRmResourceRegistration(resourceRegistration);
}
/**
* 批量删除资源注册
*
@@ -102,4 +164,15 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
{
return rmResourceRegistrationMapper.deleteRmResourceRegistrationById(id);
}
@Override
public List<Map> selectAllResourceName()
{
return rmResourceRegistrationMapper.selectAllResourceName();
}
@Override
public List<Map> selectAllResourceNameByType(RmResourceRegistration resourceRegistration)
{
return rmResourceRegistrationMapper.selectAllResourceNameByType(resourceRegistration);
}
}

View File

@@ -0,0 +1,87 @@
package com.ruoyi.system.util;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.LinkedHashSet;
import java.util.Set;
/**
* 获取表明util
*/
public class TableRouterUtil {
// 表名前缀
private static final String TABLE_PREFIX = "eps_initial_traffic";
// 日期格式
private static final DateTimeFormatter YEAR_MONTH_FORMAT =
DateTimeFormatter.ofPattern("yyyy_MM");
/**
* 根据创建时间获取表名
* @param createTime 记录创建时间
* @return 对应的分表名称
* @throws IllegalArgumentException 如果createTime为null
*
* 示例:
* 2023-08-05 14:30:00 → eps_initial_traffic_2023_08_1_10
* 2023-08-15 09:15:00 → eps_initial_traffic_2023_08_11_20
* 2023-08-25 18:45:00 → eps_initial_traffic_2023_08_21_31
*/
public static String getTableName(LocalDateTime createTime) {
if (createTime == null) {
throw new IllegalArgumentException("创建时间不能为null");
}
String yearMonth = createTime.format(YEAR_MONTH_FORMAT);
int day = createTime.getDayOfMonth();
return String.format("%s_%s_%s",
TABLE_PREFIX,
yearMonth,
getDayRange(day));
}
/**
* 获取时间范围内涉及的所有表名
* @param startTime 开始时间(包含)
* @param endTime 结束时间(包含)
* @return 按时间顺序排列的表名集合
*/
public static Set<String> getTableNamesBetween(LocalDateTime startTime, LocalDateTime endTime) {
validateTimeRange(startTime, endTime);
Set<String> tableNames = new LinkedHashSet<>();
LocalDateTime current = startTime.withHour(0).withMinute(0).withSecond(0);
while (!current.isAfter(endTime)) {
tableNames.add(getTableName(current));
current = current.plusDays(1);
}
return tableNames;
}
// 获取日期区间
private static String getDayRange(int day) {
if (day < 1 || day > 31) {
throw new IllegalArgumentException("日期必须在1-31之间");
}
if (day <= 10) return "1_10";
if (day <= 20) return "11_20";
return "21_31";
}
// 验证时间范围
private static void validateTimeRange(LocalDateTime start, LocalDateTime end) {
if (start == null || end == null) {
throw new IllegalArgumentException("时间范围参数不能为null");
}
if (start.isAfter(end)) {
throw new IllegalArgumentException("开始时间不能晚于结束时间");
}
}
}

View File

@@ -0,0 +1,87 @@
<?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.ruoyi.system.mapper.EpsBusinessMapper">
<resultMap type="EpsBusiness" id="EpsBusinessResult">
<result property="id" column="id" />
<result property="businessName" column="business_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" />
<result property="description" column="description" />
</resultMap>
<sql id="selectEpsBusinessVo">
select id, business_name, create_time, update_time, create_by, update_by, description from eps_business
</sql>
<select id="selectEpsBusinessList" parameterType="EpsBusiness" resultMap="EpsBusinessResult">
<include refid="selectEpsBusinessVo"/>
<where>
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
<if test="description != null and description != ''"> and description = #{description}</if>
</where>
</select>
<select id="selectEpsBusinessById" parameterType="String" resultMap="EpsBusinessResult">
<include refid="selectEpsBusinessVo"/>
where id = #{id}
</select>
<insert id="insertEpsBusiness" parameterType="EpsBusiness">
insert into eps_business
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="businessName != null and businessName != ''">business_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>
<if test="description != null">description,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="businessName != null and businessName != ''">#{businessName},</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>
<if test="description != null">#{description},</if>
</trim>
</insert>
<update id="updateEpsBusiness" parameterType="EpsBusiness">
update eps_business
<trim prefix="SET" suffixOverrides=",">
<if test="businessName != null and businessName != ''">business_name = #{businessName},</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>
<if test="description != null">description = #{description},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEpsBusinessById" parameterType="String">
delete from eps_business where id = #{id}
</delete>
<delete id="deleteEpsBusinessByIds" parameterType="String">
delete from eps_business where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="countByBusinessName" parameterType="EpsBusiness" resultType="java.lang.Integer">
select count(1) from eps_business
<where>
<if test="businessName != '' and businessName != null">
and business_name = #{businessName}
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,128 @@
<?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.ruoyi.system.mapper.EpsInitialTrafficDataMapper">
<update id="createEpsTrafficTable">
CREATE TABLE IF NOT EXISTS ${tableName} (
id BIGINT(20) COMMENT '唯一标识ID',
interface_name VARCHAR(50) COMMENT '接口名称',
mac_address VARCHAR(17) COMMENT 'MAC地址',
operation_status VARCHAR(20) COMMENT '运行状态',
interface_type VARCHAR(30) COMMENT '接口类型',
ipv4_address VARCHAR(15) COMMENT 'IPv4地址',
inbound_packet_loss DECIMAL(5,2) COMMENT '入站丢包率(%)',
outbound_packet_loss DECIMAL(5,2) COMMENT '出站丢包率(%)',
receive_bandwidth DECIMAL(10,2) COMMENT '接收带宽(Mbps)',
send_bandwidth DECIMAL(10,2) COMMENT '发送带宽(Mbps)',
business_id varchar(12) COMMENT '业务代码',
business_name varchar(50) COMMENT '业务名称',
service_sn varchar(50) COMMENT '服务器SN',
node_name varchar(50) COMMENT '服务器名称',
revenue_method varchar(50) COMMENT '收益方式(1.流量,2包端)',
package_bandwidth DECIMAL(10,2) COMMENT '包端带宽值',
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
create_by VARCHAR(50) COMMENT '创建人',
update_by VARCHAR(50) COMMENT '修改人',
PRIMARY KEY (id),
INDEX idx_name_time (interface_name,create_time),
INDEX idx_revenue_method (revenue_method),
INDEX idx_service_sn (service_sn)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='EPS设备流量初始数据表';
</update>
<update id="createEpsInitialTrafficTable">
CREATE TABLE IF NOT EXISTS ${tableName} (
id BIGINT(20) COMMENT '唯一标识ID',
interface_name VARCHAR(50) COMMENT '接口名称',
mac_address VARCHAR(17) COMMENT 'MAC地址',
operation_status VARCHAR(20) COMMENT '运行状态',
interface_type VARCHAR(30) COMMENT '接口类型',
ipv4_address VARCHAR(15) COMMENT 'IPv4地址',
inbound_packet_loss DECIMAL(5,2) COMMENT '入站丢包率(%)',
outbound_packet_loss DECIMAL(5,2) COMMENT '出站丢包率(%)',
receive_bandwidth DECIMAL(10,2) COMMENT '接收带宽(Mbps)',
send_bandwidth DECIMAL(10,2) COMMENT '发送带宽(Mbps)',
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
create_by VARCHAR(50) COMMENT '创建人',
update_by VARCHAR(50) COMMENT '修改人',
PRIMARY KEY (id),
INDEX idx_name_time (interface_name,create_time)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='初始带宽流量表';
</update>
<!-- 单条插入 -->
<insert id="insert">
INSERT INTO ${tableName} (
receive_traffic,
send_traffic,
device_sn,
business_id,
traffic_port,
create_time,
remark1, remark2, remark3, remark4
) VALUES (
#{receiveTraffic},
#{sendTraffic},
#{deviceSn},
#{businessId},
#{trafficPort},
#{createTime},
#{remark1}, #{remark2},
#{remark3}, #{remark4}
)
</insert>
<!-- 批量插入 -->
<insert id="batchInsert">
INSERT INTO ${tableName} (
receive_traffic,
send_traffic,
device_sn,
business_id,
traffic_port,
create_time,
remark1, remark2, remark3, remark4
) VALUES
<foreach collection="dataList" item="data" separator=",">
(
#{data.receiveTraffic},
#{data.sendTraffic},
#{data.deviceSn},
#{data.businessId},
#{data.trafficPort},
#{data.createTime},
#{data.remark1}, #{data.remark2},
#{data.remark3}, #{data.remark4}
)
</foreach>
</insert>
<!-- 条件查询 -->
<select id="selectByCondition" resultType="EpsInitialTrafficData">
SELECT
id,
receive_traffic as receiveTraffic,
send_traffic as sendTraffic,
device_sn as deviceSn,
business_id as businessId,
traffic_port as trafficPort,
create_time as createTime,
remark1, remark2, remark3, remark4
FROM ${tableName}
<where>
<if test="deviceSn != '' and deviceSn != null">
and device_sn = #{deviceSn}
</if>
<if test="startTime != null">
and create_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and create_time &lt;= #{endTime}
</if>
</where>
ORDER BY create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,85 @@
<?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.ruoyi.system.mapper.EpsMethodChangeRecordMapper">
<resultMap type="EpsMethodChangeRecord" id="EpsMethodChangeRecordResult">
<result property="id" column="id" />
<result property="nodeName" column="node_name" />
<result property="changeContent" column="change_content" />
<result property="hardwareSn" column="hardware_sn" />
<result property="createTime" column="create_time" />
<result property="creatBy" column="creat_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectEpsMethodChangeRecordVo">
select id, node_name, change_content, hardware_sn, create_time, creat_by, update_time, update_by from eps_method_change_record
</sql>
<select id="selectEpsMethodChangeRecordList" parameterType="EpsMethodChangeRecord" resultMap="EpsMethodChangeRecordResult">
<include refid="selectEpsMethodChangeRecordVo"/>
<where>
<if test="nodeName != null and nodeName != ''"> and node_name like concat('%', #{nodeName}, '%')</if>
<if test="changeContent != null and changeContent != ''"> and change_content like concat('%', #{changeContent}, '%')</if>
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
<if test="creatBy != null and creatBy != ''"> and creat_by = #{creatBy}</if>
</where>
</select>
<select id="selectEpsMethodChangeRecordById" parameterType="Long" resultMap="EpsMethodChangeRecordResult">
<include refid="selectEpsMethodChangeRecordVo"/>
where id = #{id}
</select>
<insert id="insertEpsMethodChangeRecord" parameterType="EpsMethodChangeRecord">
insert into eps_method_change_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="nodeName != null">node_name,</if>
<if test="changeContent != null">change_content,</if>
<if test="hardwareSn != null">hardware_sn,</if>
<if test="createTime != null">create_time,</if>
<if test="creatBy != null">creat_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="nodeName != null">#{nodeName},</if>
<if test="changeContent != null">#{changeContent},</if>
<if test="hardwareSn != null">#{hardwareSn},</if>
<if test="createTime != null">#{createTime},</if>
<if test="creatBy != null">#{creatBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
</insert>
<update id="updateEpsMethodChangeRecord" parameterType="EpsMethodChangeRecord">
update eps_method_change_record
<trim prefix="SET" suffixOverrides=",">
<if test="nodeName != null">node_name = #{nodeName},</if>
<if test="changeContent != null">change_content = #{changeContent},</if>
<if test="hardwareSn != null">hardware_sn = #{hardwareSn},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="creatBy != null">creat_by = #{creatBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEpsMethodChangeRecordById" parameterType="Long">
delete from eps_method_change_record where id = #{id}
</delete>
<delete id="deleteEpsMethodChangeRecordByIds" parameterType="String">
delete from eps_method_change_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,232 @@
<?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.ruoyi.system.mapper.EpsNodeBandwidthMapper">
<resultMap type="EpsNodeBandwidth" id="EpsNodeBandwidthResult">
<result property="id" column="id" />
<result property="nodeName" column="node_name" />
<result property="hardwareSn" column="hardware_sn" />
<result property="bandwidthType" column="bandwidth_type" />
<result property="bandwidthResult" column="bandwidth_result" />
<result property="bandwidth95Daily" column="bandwidth_95_daily" />
<result property="bandwidth95Monthly" column="bandwidth_95_monthly" />
<result property="avgMonthlyBandwidth95" column="avg_monthly_bandwidth_95" />
<result property="packageBandwidthDaily" column="package_bandwidth_daily" />
<result property="customerId" column="customer_id" />
<result property="customerName" column="customer_name" />
<result property="serviceNumber" column="service_number" />
<result property="uplinkSwitch" column="uplink_switch" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="creatorId" column="creator_id" />
<result property="creatorName" column="creator_name" />
<result property="remark1" column="remark1" />
<result property="interfaceName" column="interface_name" />
<result property="resourceType" column="resource_type" />
<result property="interfaceLinkDeviceType" column="interface_link_device_type" />
<result property="effectiveBandwidth95Daily" column="effective_bandwidth_95_daily" />
<result property="effectiveBandwidth95Monthly" column="effective_bandwidth_95_monthly" />
<result property="effectiveAvgMonthlyBandwidth95" column="effective_avg_monthly_bandwidth_95" />
<result property="businessName" column="business_name" />
<result property="businessId" column="business_id" />
</resultMap>
<sql id="selectEpsNodeBandwidthVo">
select id, node_name, hardware_sn, bandwidth_type, bandwidth_result, bandwidth_95_daily, bandwidth_95_monthly, avg_monthly_bandwidth_95, package_bandwidth_daily, customer_id, customer_name, service_number, uplink_switch, create_time, update_time, creator_id, creator_name, remark1, interface_name, resource_type, interface_link_device_type, effective_bandwidth_95_daily, effective_bandwidth_95_monthly, effective_avg_monthly_bandwidth_95, business_name, business_id from eps_node_bandwidth
</sql>
<select id="selectEpsNodeBandwidthList" parameterType="EpsNodeBandwidth" resultMap="EpsNodeBandwidthResult">
<include refid="selectEpsNodeBandwidthVo"/>
<where>
<if test="nodeName != null and nodeName != ''"> and node_name like concat('%', #{nodeName}, '%')</if>
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
<if test="bandwidthType != null and bandwidthType != ''"> and bandwidth_type = #{bandwidthType}</if>
<if test="bandwidthResult != null "> and bandwidth_result = #{bandwidthResult}</if>
<if test="bandwidth95Daily != null "> and bandwidth_95_daily = #{bandwidth95Daily}</if>
<if test="bandwidth95Monthly != null "> and bandwidth_95_monthly = #{bandwidth95Monthly}</if>
<if test="avgMonthlyBandwidth95 != null "> and avg_monthly_bandwidth_95 = #{avgMonthlyBandwidth95}</if>
<if test="packageBandwidthDaily != null "> and package_bandwidth_daily = #{packageBandwidthDaily}</if>
<if test="customerId != null and customerId != ''"> and customer_id = #{customerId}</if>
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
<if test="serviceNumber != null and serviceNumber != ''"> and service_number = #{serviceNumber}</if>
<if test="uplinkSwitch != null and uplinkSwitch != ''"> and uplink_switch like concat('%', #{uplinkSwitch}, '%')</if>
<if test="creatorId != null "> and creator_id = #{creatorId}</if>
<if test="creatorName != null and creatorName != ''"> and creator_name like concat('%', #{creatorName}, '%')</if>
<if test="remark1 != null and remark1 != ''"> and remark1 = #{remark1}</if>
<if test="interfaceName != null and interfaceName != ''"> and interface_name = #{interfaceName}</if>
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</if>
<if test="interfaceLinkDeviceType != null and interfaceLinkDeviceType != ''"> and interface_link_device_type = #{interfaceLinkDeviceType}</if>
<if test="effectiveBandwidth95Daily != null "> and effective_bandwidth_95_daily = #{effectiveBandwidth95Daily}</if>
<if test="effectiveBandwidth95Monthly != null "> and effective_bandwidth_95_monthly = #{effectiveBandwidth95Monthly}</if>
<if test="effectiveAvgMonthlyBandwidth95 != null "> and effective_avg_monthly_bandwidth_95 = #{effectiveAvgMonthlyBandwidth95}</if>
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
<if test="businessId != null and businessId != ''"> and business_id = #{businessId}</if>
<if test="startTime != null and startTime != ''"> and create_time &gt;= #{startTime}</if>
<if test="endTime != null and endTime != ''"> and create_time &lt;= #{endTime}</if>
</where>
</select>
<select id="selectEpsNodeBandwidthById" parameterType="Long" resultMap="EpsNodeBandwidthResult">
<include refid="selectEpsNodeBandwidthVo"/>
where id = #{id}
</select>
<insert id="insertEpsNodeBandwidth" parameterType="EpsNodeBandwidth" useGeneratedKeys="true" keyProperty="id">
insert into eps_node_bandwidth
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="nodeName != null">node_name,</if>
<if test="hardwareSn != null">hardware_sn,</if>
<if test="bandwidthType != null">bandwidth_type,</if>
<if test="bandwidthResult != null">bandwidth_result,</if>
<if test="bandwidth95Daily != null">bandwidth_95_daily,</if>
<if test="bandwidth95Monthly != null">bandwidth_95_monthly,</if>
<if test="avgMonthlyBandwidth95 != null">avg_monthly_bandwidth_95,</if>
<if test="packageBandwidthDaily != null">package_bandwidth_daily,</if>
<if test="customerId != null">customer_id,</if>
<if test="customerName != null">customer_name,</if>
<if test="serviceNumber != null">service_number,</if>
<if test="uplinkSwitch != null">uplink_switch,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="creatorId != null">creator_id,</if>
<if test="creatorName != null">creator_name,</if>
<if test="remark1 != null">remark1,</if>
<if test="interfaceName != null">interface_name,</if>
<if test="resourceType != null">resource_type,</if>
<if test="interfaceLinkDeviceType != null">interface_link_device_type,</if>
<if test="effectiveBandwidth95Daily != null">effective_bandwidth_95_daily,</if>
<if test="effectiveBandwidth95Monthly != null">effective_bandwidth_95_monthly,</if>
<if test="effectiveAvgMonthlyBandwidth95 != null">effective_avg_monthly_bandwidth_95,</if>
<if test="businessName != null">business_name,</if>
<if test="businessId != null">business_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="nodeName != null">#{nodeName},</if>
<if test="hardwareSn != null">#{hardwareSn},</if>
<if test="bandwidthType != null">#{bandwidthType},</if>
<if test="bandwidthResult != null">#{bandwidthResult},</if>
<if test="bandwidth95Daily != null">#{bandwidth95Daily},</if>
<if test="bandwidth95Monthly != null">#{bandwidth95Monthly},</if>
<if test="avgMonthlyBandwidth95 != null">#{avgMonthlyBandwidth95},</if>
<if test="packageBandwidthDaily != null">#{packageBandwidthDaily},</if>
<if test="customerId != null">#{customerId},</if>
<if test="customerName != null">#{customerName},</if>
<if test="serviceNumber != null">#{serviceNumber},</if>
<if test="uplinkSwitch != null">#{uplinkSwitch},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="creatorId != null">#{creatorId},</if>
<if test="creatorName != null">#{creatorName},</if>
<if test="remark1 != null">#{remark1},</if>
<if test="interfaceName != null">#{interfaceName},</if>
<if test="resourceType != null">#{resourceType},</if>
<if test="interfaceLinkDeviceType != null">#{interfaceLinkDeviceType},</if>
<if test="effectiveBandwidth95Daily != null">#{effectiveBandwidth95Daily},</if>
<if test="effectiveBandwidth95Monthly != null">#{effectiveBandwidth95Monthly},</if>
<if test="effectiveAvgMonthlyBandwidth95 != null">#{effectiveAvgMonthlyBandwidth95},</if>
<if test="businessName != null">#{businessName},</if>
<if test="businessId != null">#{businessId},</if>
</trim>
</insert>
<update id="updateEpsNodeBandwidth" parameterType="EpsNodeBandwidth">
update eps_node_bandwidth
<trim prefix="SET" suffixOverrides=",">
<if test="nodeName != null">node_name = #{nodeName},</if>
<if test="hardwareSn != null">hardware_sn = #{hardwareSn},</if>
<if test="bandwidthType != null">bandwidth_type = #{bandwidthType},</if>
<if test="bandwidthResult != null">bandwidth_result = #{bandwidthResult},</if>
<if test="bandwidth95Daily != null">bandwidth_95_daily = #{bandwidth95Daily},</if>
<if test="bandwidth95Monthly != null">bandwidth_95_monthly = #{bandwidth95Monthly},</if>
<if test="avgMonthlyBandwidth95 != null">avg_monthly_bandwidth_95 = #{avgMonthlyBandwidth95},</if>
<if test="packageBandwidthDaily != null">package_bandwidth_daily = #{packageBandwidthDaily},</if>
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="customerName != null">customer_name = #{customerName},</if>
<if test="serviceNumber != null">service_number = #{serviceNumber},</if>
<if test="uplinkSwitch != null">uplink_switch = #{uplinkSwitch},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="creatorId != null">creator_id = #{creatorId},</if>
<if test="creatorName != null">creator_name = #{creatorName},</if>
<if test="remark1 != null">remark1 = #{remark1},</if>
<if test="interfaceName != null">interface_name = #{interfaceName},</if>
<if test="resourceType != null">resource_type = #{resourceType},</if>
<if test="interfaceLinkDeviceType != null">interface_link_device_type = #{interfaceLinkDeviceType},</if>
<if test="effectiveBandwidth95Daily != null">effective_bandwidth_95_daily = #{effectiveBandwidth95Daily},</if>
<if test="effectiveBandwidth95Monthly != null">effective_bandwidth_95_monthly = #{effectiveBandwidth95Monthly},</if>
<if test="effectiveAvgMonthlyBandwidth95 != null">effective_avg_monthly_bandwidth_95 = #{effectiveAvgMonthlyBandwidth95},</if>
<if test="businessName != null">business_name = #{businessName},</if>
<if test="businessId != null">business_id = #{businessId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEpsNodeBandwidthById" parameterType="Long">
delete from eps_node_bandwidth where id = #{id}
</delete>
<delete id="deleteEpsNodeBandwidthByIds" parameterType="String">
delete from eps_node_bandwidth where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="calculateAvg" parameterType="EpsNodeBandwidth" resultMap="EpsNodeBandwidthResult">
select sum(ifnull(bandwidth_95_daily,0)) bandwidth95Daily,
sum(ifnull(effective_bandwidth_95_daily,0)) effectiveBandwidth95Daily
from eps_node_bandwidth
<where>
<if test="createTime != null">
and left(create_time,7) = #{createTime}
</if>
<if test="nodeName != '' and nodeName != null">
and node_name = #{nodeName}
</if>
<if test="businessName != '' and businessName != null">
and business_name = #{businessName}
</if>
<if test="businessId != '' and businessId != null">
and business_id = #{businessId}
</if>
</where>
</select>
<select id="getAvgDetailMsg" parameterType="EpsNodeBandwidth" resultMap="EpsNodeBandwidthResult">
<include refid="selectEpsNodeBandwidthVo"/>
<where>
<if test="createTime != null">
and left(create_time,7) = left(#{createTime},7)
</if>
<if test="nodeName != '' and nodeName != null">
and node_name = #{nodeName}
</if>
<if test="businessName != '' and businessName != null">
and business_name = #{businessName}
</if>
<if test="businessId != '' and businessId != null">
and business_id = #{businessId}
</if>
</where>
</select>
<select id="countByAvgMsg" parameterType="EpsNodeBandwidth">
select count(1) from from eps_node_bandwidth
<where>
<if test="createTime != null">
and left(create_time,7) = #{createTime}
</if>
<if test="nodeName != '' and nodeName != null">
and node_name = #{nodeName}
</if>
<if test="businessName != '' and businessName != null">
and business_name = #{businessName}
</if>
<if test="businessId != '' and businessId != null">
and business_id = #{businessId}
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,119 @@
<?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.ruoyi.system.mapper.EpsServerRevenueConfigMapper">
<resultMap type="EpsServerRevenueConfig" id="EpsServerRevenueConfigResult">
<result property="id" column="id" />
<result property="nodeName" column="node_name" />
<result property="revenueMethod" column="revenue_method" />
<result property="hardwareSn" column="hardware_sn" />
<result property="trafficPort" column="traffic_port" />
<result property="bandwidth95" column="bandwidth_95" />
<result property="packageBandwidth" column="package_bandwidth" />
<result property="updateTime" column="update_time" />
<result property="businessName" column="business_name" />
<result property="businessCode" column="business_code" />
<result property="registrationStatus" column="registration_status" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectEpsServerRevenueConfigVo">
select id, node_name, revenue_method, hardware_sn, traffic_port, bandwidth_95, package_bandwidth, update_time, business_name, business_code, registration_status, create_by, update_by, create_time from eps_server_revenue_config
</sql>
<select id="selectEpsServerRevenueConfigList" parameterType="EpsServerRevenueConfig" resultMap="EpsServerRevenueConfigResult">
<include refid="selectEpsServerRevenueConfigVo"/>
<where>
and registration_status = '1'
<if test="nodeName != null and nodeName != ''"> and node_name like concat('%', #{nodeName}, '%')</if>
<if test="revenueMethod != null and revenueMethod != ''"> and revenue_method = #{revenueMethod}</if>
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
<if test="trafficPort != null and trafficPort != ''"> and traffic_port = #{trafficPort}</if>
<if test="bandwidth95 != null "> and bandwidth_95 = #{bandwidth95}</if>
<if test="packageBandwidth != null "> and package_bandwidth = #{packageBandwidth}</if>
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
</where>
</select>
<select id="selectEpsServerRevenueConfigById" parameterType="Long" resultMap="EpsServerRevenueConfigResult">
<include refid="selectEpsServerRevenueConfigVo"/>
where id = #{id}
</select>
<select id="countBySn" parameterType="String">
select count(1) from eps_server_revenue_config
where hardware_sn = #{hardwareSn}
</select>
<insert id="insertEpsServerRevenueConfig" parameterType="EpsServerRevenueConfig">
insert into eps_server_revenue_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="nodeName != null">node_name,</if>
<if test="revenueMethod != null">revenue_method,</if>
<if test="hardwareSn != null">hardware_sn,</if>
<if test="trafficPort != null">traffic_port,</if>
<if test="bandwidth95 != null">bandwidth_95,</if>
<if test="packageBandwidth != null">package_bandwidth,</if>
<if test="updateTime != null">update_time,</if>
<if test="businessName != null">business_name,</if>
<if test="businessCode != null">business_code,</if>
<if test="registrationStatus != null">registration_status,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="nodeName != null">#{nodeName},</if>
<if test="revenueMethod != null">#{revenueMethod},</if>
<if test="hardwareSn != null">#{hardwareSn},</if>
<if test="trafficPort != null">#{trafficPort},</if>
<if test="bandwidth95 != null">#{bandwidth95},</if>
<if test="packageBandwidth != null">#{packageBandwidth},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="businessName != null">#{businessName},</if>
<if test="businessCode != null">#{businessCode},</if>
<if test="registrationStatus != null">#{registrationStatus},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateEpsServerRevenueConfig" parameterType="EpsServerRevenueConfig">
update eps_server_revenue_config
<trim prefix="SET" suffixOverrides=",">
<if test="nodeName != null">node_name = #{nodeName},</if>
<if test="revenueMethod != null">revenue_method = #{revenueMethod},</if>
<if test="hardwareSn != null">hardware_sn = #{hardwareSn},</if>
<if test="trafficPort != null">traffic_port = #{trafficPort},</if>
<if test="bandwidth95 != null">bandwidth_95 = #{bandwidth95},</if>
<if test="packageBandwidth != null">package_bandwidth = #{packageBandwidth},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="businessName != null">business_name = #{businessName},</if>
<if test="businessCode != null">business_code = #{businessCode},</if>
<if test="registrationStatus != null">registration_status = #{registrationStatus},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEpsServerRevenueConfigById" parameterType="Long">
delete from eps_server_revenue_config where id = #{id}
</delete>
<delete id="deleteEpsServerRevenueConfigByIds" parameterType="String">
delete from eps_server_revenue_config where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,114 @@
<?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.ruoyi.system.mapper.EpsTrafficDataMapper">
<resultMap type="EpsTrafficData" id="EpsTrafficDataResult">
<result property="id" column="id" />
<result property="hardwareSn" column="hardware_sn" />
<result property="nodeName" column="node_name" />
<result property="revenueMethod" column="revenue_method" />
<result property="trafficPort" column="traffic_port" />
<result property="txBytes" column="tx_bytes" />
<result property="rxBytes" column="rx_bytes" />
<result property="packageBandwidth" column="package_bandwidth" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="creatorId" column="creator_id" />
<result property="creatorName" column="creator_name" />
<result property="updaterId" column="updater_id" />
<result property="updaterName" column="updater_name" />
</resultMap>
<sql id="selectEpsTrafficDataVo">
select id, hardware_sn, node_name, revenue_method, traffic_port, tx_bytes, rx_bytes, package_bandwidth, create_time, update_time, creator_id, creator_name, updater_id, updater_name from eps_traffic_data
</sql>
<select id="selectEpsTrafficDataList" parameterType="EpsTrafficData" resultMap="EpsTrafficDataResult">
<include refid="selectEpsTrafficDataVo"/>
<where>
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
<if test="nodeName != null and nodeName != ''"> and node_name like concat('%', #{nodeName}, '%')</if>
<if test="revenueMethod != null and revenueMethod != ''"> and revenue_method = #{revenueMethod}</if>
<if test="trafficPort != null and trafficPort != ''"> and traffic_port = #{trafficPort}</if>
<if test="txBytes != null "> and tx_bytes = #{txBytes}</if>
<if test="rxBytes != null "> and rx_bytes = #{rxBytes}</if>
<if test="packageBandwidth != null "> and package_bandwidth = #{packageBandwidth}</if>
<if test="creatorId != null "> and creator_id = #{creatorId}</if>
<if test="creatorName != null and creatorName != ''"> and creator_name like concat('%', #{creatorName}, '%')</if>
<if test="updaterId != null "> and updater_id = #{updaterId}</if>
<if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if>
</where>
</select>
<select id="selectEpsTrafficDataById" parameterType="Long" resultMap="EpsTrafficDataResult">
<include refid="selectEpsTrafficDataVo"/>
where id = #{id}
</select>
<insert id="insertEpsTrafficData" parameterType="EpsTrafficData" useGeneratedKeys="true" keyProperty="id">
insert into eps_traffic_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="hardwareSn != null">hardware_sn,</if>
<if test="nodeName != null">node_name,</if>
<if test="revenueMethod != null">revenue_method,</if>
<if test="trafficPort != null">traffic_port,</if>
<if test="txBytes != null">tx_bytes,</if>
<if test="rxBytes != null">rx_bytes,</if>
<if test="packageBandwidth != null">package_bandwidth,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="creatorId != null">creator_id,</if>
<if test="creatorName != null">creator_name,</if>
<if test="updaterId != null">updater_id,</if>
<if test="updaterName != null">updater_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="hardwareSn != null">#{hardwareSn},</if>
<if test="nodeName != null">#{nodeName},</if>
<if test="revenueMethod != null">#{revenueMethod},</if>
<if test="trafficPort != null">#{trafficPort},</if>
<if test="txBytes != null">#{txBytes},</if>
<if test="rxBytes != null">#{rxBytes},</if>
<if test="packageBandwidth != null">#{packageBandwidth},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="creatorId != null">#{creatorId},</if>
<if test="creatorName != null">#{creatorName},</if>
<if test="updaterId != null">#{updaterId},</if>
<if test="updaterName != null">#{updaterName},</if>
</trim>
</insert>
<update id="updateEpsTrafficData" parameterType="EpsTrafficData">
update eps_traffic_data
<trim prefix="SET" suffixOverrides=",">
<if test="hardwareSn != null">hardware_sn = #{hardwareSn},</if>
<if test="nodeName != null">node_name = #{nodeName},</if>
<if test="revenueMethod != null">revenue_method = #{revenueMethod},</if>
<if test="trafficPort != null">traffic_port = #{trafficPort},</if>
<if test="txBytes != null">tx_bytes = #{txBytes},</if>
<if test="rxBytes != null">rx_bytes = #{rxBytes},</if>
<if test="packageBandwidth != null">package_bandwidth = #{packageBandwidth},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="creatorId != null">creator_id = #{creatorId},</if>
<if test="creatorName != null">creator_name = #{creatorName},</if>
<if test="updaterId != null">updater_id = #{updaterId},</if>
<if test="updaterName != null">updater_name = #{updaterName},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEpsTrafficDataById" parameterType="Long">
delete from eps_traffic_data where id = #{id}
</delete>
<delete id="deleteEpsTrafficDataByIds" parameterType="String">
delete from eps_traffic_data where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,83 @@
<?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.ruoyi.system.mapper.KnowledgeBaseMapper">
<resultMap type="KnowledgeBase" id="KnowledgeBaseResult">
<result property="id" column="id" />
<result property="title" column="title" />
<result property="issueType" column="issue_type" />
<result property="solution" column="solution" />
<result property="createTime" column="create_time" />
<result property="creatBy" column="creat_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectKnowledgeBaseVo">
select id, title, issue_type, solution, create_time, creat_by, update_time, update_by from knowledge_base
</sql>
<select id="selectKnowledgeBaseList" parameterType="KnowledgeBase" resultMap="KnowledgeBaseResult">
<include refid="selectKnowledgeBaseVo"/>
<where>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="issueType != null and issueType != ''"> and issue_type = #{issueType}</if>
<if test="solution != null and solution != ''"> and solution like concat('%', #{solution}, '%')</if>
<if test="creatBy != null and creatBy != ''"> and creat_by = #{creatBy}</if>
</where>
</select>
<select id="selectKnowledgeBaseById" parameterType="Long" resultMap="KnowledgeBaseResult">
<include refid="selectKnowledgeBaseVo"/>
where id = #{id}
</select>
<insert id="insertKnowledgeBase" parameterType="KnowledgeBase" useGeneratedKeys="true" keyProperty="id">
insert into knowledge_base
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null">title,</if>
<if test="issueType != null">issue_type,</if>
<if test="solution != null">solution,</if>
<if test="createTime != null">create_time,</if>
<if test="creatBy != null">creat_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null">#{title},</if>
<if test="issueType != null">#{issueType},</if>
<if test="solution != null">#{solution},</if>
<if test="createTime != null">#{createTime},</if>
<if test="creatBy != null">#{creatBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
</insert>
<update id="updateKnowledgeBase" parameterType="KnowledgeBase">
update knowledge_base
<trim prefix="SET" suffixOverrides=",">
<if test="title != null">title = #{title},</if>
<if test="issueType != null">issue_type = #{issueType},</if>
<if test="solution != null">solution = #{solution},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="creatBy != null">creat_by = #{creatBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteKnowledgeBaseById" parameterType="Long">
delete from knowledge_base where id = #{id}
</delete>
<delete id="deleteKnowledgeBaseByIds" parameterType="String">
delete from knowledge_base where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,114 @@
<?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.ruoyi.system.mapper.MtmMonitoringTemplateMapper">
<resultMap type="MtmMonitoringTemplate" id="MtmMonitoringTemplateResult">
<result property="id" column="id" />
<result property="templateName" column="template_name" />
<result property="description" column="description" />
<result property="itemType" column="item_type" />
<result property="includedResources" column="included_resources" />
<result property="discoveryItemType" column="discovery_item_type" />
<result property="itemName" column="item_name" />
<result property="itemDescription" column="item_description" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="creatorId" column="creator_id" />
<result property="creatorName" column="creator_name" />
<result property="updaterId" column="updater_id" />
<result property="updaterName" column="updater_name" />
</resultMap>
<sql id="selectMtmMonitoringTemplateVo">
select id, template_name, description, item_type, included_resources, discovery_item_type, item_name, item_description, create_time, update_time, creator_id, creator_name, updater_id, updater_name from mtm_monitoring_template
</sql>
<select id="selectMtmMonitoringTemplateList" parameterType="MtmMonitoringTemplate" resultMap="MtmMonitoringTemplateResult">
<include refid="selectMtmMonitoringTemplateVo"/>
<where>
<if test="templateName != null and templateName != ''"> and template_name like concat('%', #{templateName}, '%')</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="itemType != null and itemType != ''"> and item_type = #{itemType}</if>
<if test="includedResources != null and includedResources != ''"> and included_resources = #{includedResources}</if>
<if test="discoveryItemType != null and discoveryItemType != ''"> and discovery_item_type = #{discoveryItemType}</if>
<if test="itemName != null and itemName != ''"> and item_name like concat('%', #{itemName}, '%')</if>
<if test="itemDescription != null and itemDescription != ''"> and item_description = #{itemDescription}</if>
<if test="creatorId != null "> and creator_id = #{creatorId}</if>
<if test="creatorName != null and creatorName != ''"> and creator_name like concat('%', #{creatorName}, '%')</if>
<if test="updaterId != null "> and updater_id = #{updaterId}</if>
<if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if>
</where>
</select>
<select id="selectMtmMonitoringTemplateById" parameterType="Long" resultMap="MtmMonitoringTemplateResult">
<include refid="selectMtmMonitoringTemplateVo"/>
where id = #{id}
</select>
<insert id="insertMtmMonitoringTemplate" parameterType="MtmMonitoringTemplate" useGeneratedKeys="true" keyProperty="id">
insert into mtm_monitoring_template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="templateName != null">template_name,</if>
<if test="description != null">description,</if>
<if test="itemType != null">item_type,</if>
<if test="includedResources != null">included_resources,</if>
<if test="discoveryItemType != null">discovery_item_type,</if>
<if test="itemName != null">item_name,</if>
<if test="itemDescription != null">item_description,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="creatorId != null">creator_id,</if>
<if test="creatorName != null">creator_name,</if>
<if test="updaterId != null">updater_id,</if>
<if test="updaterName != null">updater_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="templateName != null">#{templateName},</if>
<if test="description != null">#{description},</if>
<if test="itemType != null">#{itemType},</if>
<if test="includedResources != null">#{includedResources},</if>
<if test="discoveryItemType != null">#{discoveryItemType},</if>
<if test="itemName != null">#{itemName},</if>
<if test="itemDescription != null">#{itemDescription},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="creatorId != null">#{creatorId},</if>
<if test="creatorName != null">#{creatorName},</if>
<if test="updaterId != null">#{updaterId},</if>
<if test="updaterName != null">#{updaterName},</if>
</trim>
</insert>
<update id="updateMtmMonitoringTemplate" parameterType="MtmMonitoringTemplate">
update mtm_monitoring_template
<trim prefix="SET" suffixOverrides=",">
<if test="templateName != null">template_name = #{templateName},</if>
<if test="description != null">description = #{description},</if>
<if test="itemType != null">item_type = #{itemType},</if>
<if test="includedResources != null">included_resources = #{includedResources},</if>
<if test="discoveryItemType != null">discovery_item_type = #{discoveryItemType},</if>
<if test="itemName != null">item_name = #{itemName},</if>
<if test="itemDescription != null">item_description = #{itemDescription},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="creatorId != null">creator_id = #{creatorId},</if>
<if test="creatorName != null">creator_name = #{creatorName},</if>
<if test="updaterId != null">updater_id = #{updaterId},</if>
<if test="updaterName != null">updater_name = #{updaterName},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteMtmMonitoringTemplateById" parameterType="Long">
delete from mtm_monitoring_template where id = #{id}
</delete>
<delete id="deleteMtmMonitoringTemplateByIds" parameterType="String">
delete from mtm_monitoring_template where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,114 @@
<?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.ruoyi.system.mapper.RmEpsTopologyManagementMapper">
<resultMap type="RmEpsTopologyManagement" id="RmEpsTopologyManagementResult">
<result property="id" column="id" />
<result property="switchName" column="switch_name" />
<result property="switchSn" column="switch_sn" />
<result property="interfaceName" column="interface_name" />
<result property="connectedDeviceType" column="connected_device_type" />
<result property="serverName" column="server_name" />
<result property="serverSn" column="server_sn" />
<result property="serverPort" column="server_port" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="creatorId" column="creator_id" />
<result property="creatorName" column="creator_name" />
<result property="updaterId" column="updater_id" />
<result property="updaterName" column="updater_name" />
</resultMap>
<sql id="selectRmEpsTopologyManagementVo">
select id, switch_name, switch_sn, interface_name, connected_device_type, server_name, server_sn, server_port, create_time, update_time, creator_id, creator_name, updater_id, updater_name from rm_eps_topology_management
</sql>
<select id="selectRmEpsTopologyManagementList" parameterType="RmEpsTopologyManagement" resultMap="RmEpsTopologyManagementResult">
<include refid="selectRmEpsTopologyManagementVo"/>
<where>
<if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</if>
<if test="switchSn != null and switchSn != ''"> and switch_sn = #{switchSn}</if>
<if test="interfaceName != null and interfaceName != ''"> and interface_name like concat('%', #{interfaceName}, '%')</if>
<if test="connectedDeviceType != null and connectedDeviceType != ''"> and connected_device_type = #{connectedDeviceType}</if>
<if test="serverName != null and serverName != ''"> and server_name like concat('%', #{serverName}, '%')</if>
<if test="serverSn != null and serverSn != ''"> and server_sn = #{serverSn}</if>
<if test="serverPort != null and serverPort != ''"> and server_port = #{serverPort}</if>
<if test="creatorId != null "> and creator_id = #{creatorId}</if>
<if test="creatorName != null and creatorName != ''"> and creator_name like concat('%', #{creatorName}, '%')</if>
<if test="updaterId != null "> and updater_id = #{updaterId}</if>
<if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if>
</where>
</select>
<select id="selectRmEpsTopologyManagementById" parameterType="Long" resultMap="RmEpsTopologyManagementResult">
<include refid="selectRmEpsTopologyManagementVo"/>
where id = #{id}
</select>
<insert id="insertRmEpsTopologyManagement" parameterType="RmEpsTopologyManagement" useGeneratedKeys="true" keyProperty="id">
insert into rm_eps_topology_management
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="switchName != null">switch_name,</if>
<if test="switchSn != null">switch_sn,</if>
<if test="interfaceName != null">interface_name,</if>
<if test="connectedDeviceType != null">connected_device_type,</if>
<if test="serverName != null">server_name,</if>
<if test="serverSn != null">server_sn,</if>
<if test="serverPort != null">server_port,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="creatorId != null">creator_id,</if>
<if test="creatorName != null">creator_name,</if>
<if test="updaterId != null">updater_id,</if>
<if test="updaterName != null">updater_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="switchName != null">#{switchName},</if>
<if test="switchSn != null">#{switchSn},</if>
<if test="interfaceName != null">#{interfaceName},</if>
<if test="connectedDeviceType != null">#{connectedDeviceType},</if>
<if test="serverName != null">#{serverName},</if>
<if test="serverSn != null">#{serverSn},</if>
<if test="serverPort != null">#{serverPort},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="creatorId != null">#{creatorId},</if>
<if test="creatorName != null">#{creatorName},</if>
<if test="updaterId != null">#{updaterId},</if>
<if test="updaterName != null">#{updaterName},</if>
</trim>
</insert>
<update id="updateRmEpsTopologyManagement" parameterType="RmEpsTopologyManagement">
update rm_eps_topology_management
<trim prefix="SET" suffixOverrides=",">
<if test="switchName != null">switch_name = #{switchName},</if>
<if test="switchSn != null">switch_sn = #{switchSn},</if>
<if test="interfaceName != null">interface_name = #{interfaceName},</if>
<if test="connectedDeviceType != null">connected_device_type = #{connectedDeviceType},</if>
<if test="serverName != null">server_name = #{serverName},</if>
<if test="serverSn != null">server_sn = #{serverSn},</if>
<if test="serverPort != null">server_port = #{serverPort},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="creatorId != null">creator_id = #{creatorId},</if>
<if test="creatorName != null">creator_name = #{creatorName},</if>
<if test="updaterId != null">updater_id = #{updaterId},</if>
<if test="updaterName != null">updater_name = #{updaterName},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteRmEpsTopologyManagementById" parameterType="Long">
delete from rm_eps_topology_management where id = #{id}
</delete>
<delete id="deleteRmEpsTopologyManagementByIds" parameterType="String">
delete from rm_eps_topology_management where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,94 @@
<?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.ruoyi.system.mapper.RmResourceGroupMapper">
<resultMap type="RmResourceGroup" id="RmResourceGroupResult">
<result property="id" column="id" />
<result property="groupName" column="group_name" />
<result property="description" column="description" />
<result property="includedDevices" column="included_devices" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="creatorId" column="creator_id" />
<result property="creatorName" column="creator_name" />
<result property="updaterId" column="updater_id" />
<result property="updaterName" column="updater_name" />
</resultMap>
<sql id="selectRmResourceGroupVo">
select id, group_name, description, included_devices, create_time, update_time, creator_id, creator_name, updater_id, updater_name from rm_resource_group
</sql>
<select id="selectRmResourceGroupList" parameterType="RmResourceGroup" resultMap="RmResourceGroupResult">
<include refid="selectRmResourceGroupVo"/>
<where>
<if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="includedDevices != null and includedDevices != ''"> and included_devices = #{includedDevices}</if>
<if test="creatorId != null "> and creator_id = #{creatorId}</if>
<if test="creatorName != null and creatorName != ''"> and creator_name like concat('%', #{creatorName}, '%')</if>
<if test="updaterId != null "> and updater_id = #{updaterId}</if>
<if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if>
</where>
</select>
<select id="selectRmResourceGroupById" parameterType="Long" resultMap="RmResourceGroupResult">
<include refid="selectRmResourceGroupVo"/>
where id = #{id}
</select>
<insert id="insertRmResourceGroup" parameterType="RmResourceGroup" useGeneratedKeys="true" keyProperty="id">
insert into rm_resource_group
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="groupName != null">group_name,</if>
<if test="description != null">description,</if>
<if test="includedDevices != null">included_devices,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="creatorId != null">creator_id,</if>
<if test="creatorName != null">creator_name,</if>
<if test="updaterId != null">updater_id,</if>
<if test="updaterName != null">updater_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="groupName != null">#{groupName},</if>
<if test="description != null">#{description},</if>
<if test="includedDevices != null">#{includedDevices},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="creatorId != null">#{creatorId},</if>
<if test="creatorName != null">#{creatorName},</if>
<if test="updaterId != null">#{updaterId},</if>
<if test="updaterName != null">#{updaterName},</if>
</trim>
</insert>
<update id="updateRmResourceGroup" parameterType="RmResourceGroup">
update rm_resource_group
<trim prefix="SET" suffixOverrides=",">
<if test="groupName != null">group_name = #{groupName},</if>
<if test="description != null">description = #{description},</if>
<if test="includedDevices != null">included_devices = #{includedDevices},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="creatorId != null">creator_id = #{creatorId},</if>
<if test="creatorName != null">creator_name = #{creatorName},</if>
<if test="updaterId != null">updater_id = #{updaterId},</if>
<if test="updaterName != null">updater_name = #{updaterName},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteRmResourceGroupById" parameterType="Long">
delete from rm_resource_group where id = #{id}
</delete>
<delete id="deleteRmResourceGroupByIds" parameterType="String">
delete from rm_resource_group where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -11,11 +11,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="resourceName" column="resource_name" />
<result property="ipAddress" column="ip_address" />
<result property="resourcePort" column="resource_port" />
<result property="otherPortName" column="other_port_name" />
<result property="protocol" column="protocol" />
<result property="resourceVersion" column="resource_version" />
<result property="rwPermission" column="rw_permission" />
<result property="securityLevel" column="security_level" />
<result property="encryption" column="encryption" />
<result property="resourceUserName" column="resource_user_name" />
<result property="resourcePwd" column="resource_pwd" />
<result property="registrationStatus" column="registration_status" />
<result property="onlineStatus" column="online_status" />
@@ -32,7 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectRmResourceRegistrationVo">
select id, hardware_sn, resource_type, resource_name, ip_address, resource_port, protocol, resource_version, rw_permission, security_level, encryption, resource_pwd, registration_status, online_status, description, customer_id, customer_name, service_number, create_time, update_time, creator_id, creator_name, updater_id, updater_name from rm_resource_registration
select id, hardware_sn, resource_type, resource_name, ip_address, resource_port, other_port_name, protocol, resource_version, rw_permission, security_level, encryption, resource_user_name,resource_pwd, registration_status, online_status, description, customer_id, customer_name, service_number, create_time, update_time, creator_id, creator_name, updater_id, updater_name from rm_resource_registration
</sql>
<select id="selectRmResourceRegistrationList" parameterType="RmResourceRegistration" resultMap="RmResourceRegistrationResult">
@@ -43,11 +45,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="resourceName != null and resourceName != ''"> and resource_name like concat('%', #{resourceName}, '%')</if>
<if test="ipAddress != null and ipAddress != ''"> and ip_address = #{ipAddress}</if>
<if test="resourcePort != null and resourcePort != ''"> and resource_port = #{resourcePort}</if>
<if test="otherPortName != null and otherPortName != ''"> and other_port_name = #{otherPortName}</if>
<if test="protocol != null and protocol != ''"> and protocol = #{protocol}</if>
<if test="resourceVersion != null and resourceVersion != ''"> and resource_version = #{resourceVersion}</if>
<if test="rwPermission != null and rwPermission != ''"> and rw_permission = #{rwPermission}</if>
<if test="securityLevel != null and securityLevel != ''"> and security_level = #{securityLevel}</if>
<if test="encryption != null and encryption != ''"> and encryption = #{encryption}</if>
<if test="resourceUserName != null and resourceUserName != ''"> and resource_user_name = #{resourceUserName}</if>
<if test="resourcePwd != null and resourcePwd != ''"> and resource_pwd = #{resourcePwd}</if>
<if test="registrationStatus != null and registrationStatus != ''"> and registration_status = #{registrationStatus}</if>
<if test="onlineStatus != null and onlineStatus != ''"> and online_status = #{onlineStatus}</if>
@@ -66,6 +70,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectRmResourceRegistrationVo"/>
where id = #{id}
</select>
<select id="countBySn" parameterType="String">
select count(1) from rm_resource_registration
where hardware_sn = #{hardwareSn}
</select>
<insert id="insertRmResourceRegistration" parameterType="RmResourceRegistration" useGeneratedKeys="true" keyProperty="id">
insert into rm_resource_registration
@@ -75,11 +83,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="resourceName != null">resource_name,</if>
<if test="ipAddress != null">ip_address,</if>
<if test="resourcePort != null">resource_port,</if>
<if test="otherPortName != null">other_port_name,</if>
<if test="protocol != null">protocol,</if>
<if test="resourceVersion != null">resource_version,</if>
<if test="rwPermission != null">rw_permission,</if>
<if test="securityLevel != null">security_level,</if>
<if test="encryption != null">encryption,</if>
<if test="resourceUserName != null">resource_user_name,</if>
<if test="resourcePwd != null">resource_pwd,</if>
<if test="registrationStatus != null">registration_status,</if>
<if test="onlineStatus != null">online_status,</if>
@@ -100,11 +110,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="resourceName != null">#{resourceName},</if>
<if test="ipAddress != null">#{ipAddress},</if>
<if test="resourcePort != null">#{resourcePort},</if>
<if test="otherPortName != null">#{otherPortName},</if>
<if test="protocol != null">#{protocol},</if>
<if test="resourceVersion != null">#{resourceVersion},</if>
<if test="rwPermission != null">#{rwPermission},</if>
<if test="securityLevel != null">#{securityLevel},</if>
<if test="encryption != null">#{encryption},</if>
<if test="resourceUserName != null">#{resourceUserName},</if>
<if test="resourcePwd != null">#{resourcePwd},</if>
<if test="registrationStatus != null">#{registrationStatus},</if>
<if test="onlineStatus != null">#{onlineStatus},</if>
@@ -129,11 +141,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="resourceName != null">resource_name = #{resourceName},</if>
<if test="ipAddress != null">ip_address = #{ipAddress},</if>
<if test="resourcePort != null">resource_port = #{resourcePort},</if>
<if test="otherPortName != null">other_port_name = #{otherPortName},</if>
<if test="protocol != null">protocol = #{protocol},</if>
<if test="resourceVersion != null">resource_version = #{resourceVersion},</if>
<if test="rwPermission != null">rw_permission = #{rwPermission},</if>
<if test="securityLevel != null">security_level = #{securityLevel},</if>
<if test="encryption != null">encryption = #{encryption},</if>
<if test="resourceUserName != null">resource_user_name = #{resourceUserName},</if>
<if test="resourcePwd != null">resource_pwd = #{resourcePwd},</if>
<if test="registrationStatus != null">registration_status = #{registrationStatus},</if>
<if test="onlineStatus != null">online_status = #{onlineStatus},</if>
@@ -161,4 +175,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<!-- 查询所有资源名称(包含设备使用)-->
<select id="selectAllResourceName" resultType="java.util.Map">
select resource_name resourceName from rm_resource_registration
<where>
and registration_status = 1
</where>
group by resource_name
</select>
<!-- 查询所有资源名称-->
<select id="selectAllResourceNameByType" parameterType="RmResourceRegistration" resultType="java.util.Map">
select resource_name resourceName from rm_resource_registration
<where>
and registration_status = 1
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</if>
<if test="resourceName != null and resourceName != ''"> and resource_name like concat('%', #{resourceName}, '%')</if>
<if test="ipAddress != null and ipAddress != ''"> and ip_address = #{ipAddress}</if>
<if test="resourcePort != null and resourcePort != ''"> and resource_port = #{resourcePort}</if>
<if test="otherPortName != null and otherPortName != ''"> and other_port_name = #{otherPortName}</if>
<if test="protocol != null and protocol != ''"> and protocol = #{protocol}</if>
<if test="resourceVersion != null and resourceVersion != ''"> and resource_version = #{resourceVersion}</if>
<if test="rwPermission != null and rwPermission != ''"> and rw_permission = #{rwPermission}</if>
<if test="securityLevel != null and securityLevel != ''"> and security_level = #{securityLevel}</if>
<if test="encryption != null and encryption != ''"> and encryption = #{encryption}</if>
<if test="resourceUserName != null and resourceUserName != ''"> and resource_user_name = #{resourceUserName}</if>
<if test="resourcePwd != null and resourcePwd != ''"> and resource_pwd = #{resourcePwd}</if>
<if test="registrationStatus != null and registrationStatus != ''"> and registration_status = #{registrationStatus}</if>
<if test="onlineStatus != null and onlineStatus != ''"> and online_status = #{onlineStatus}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="customerId != null "> and customer_id = #{customerId}</if>
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
<if test="serviceNumber != null and serviceNumber != ''"> and service_number = #{serviceNumber}</if>
<if test="creatorId != null "> and creator_id = #{creatorId}</if>
<if test="creatorName != null and creatorName != ''"> and creator_name like concat('%', #{creatorName}, '%')</if>
<if test="updaterId != null "> and updater_id = #{updaterId}</if>
<if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if>
</where>
group by resource_name
</select>
</mapper>

152
ruoyi-rocketmq/pom.xml Normal file
View File

@@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.6.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-rocketmq</artifactId>
<dependencies>
<!--rocketmq消息队列-->
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version> 4.9.0</version>
</dependency>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-client</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Mysql驱动包 -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!-- RuoYi Common Log -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
<!-- RuoYi Common Swagger-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-security</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- yml调用pom变量 -->
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.28</version>
</dependency>
<!-- SpringBoot Web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- docker-maven-plugin插件(不带Dockerfile文件) -->
<!-- <plugin>-->
<!-- <groupId>com.spotify</groupId>-->
<!-- <artifactId>docker-maven-plugin</artifactId>-->
<!-- <version>1.2.0</version>-->
<!-- <configuration>-->
<!-- &lt;!&ndash;用于指定镜像名称&ndash;&gt;-->
<!-- <imageName>${project.build.finalName}</imageName>-->
<!-- <imageTags>latest</imageTags>-->
<!-- &lt;!&ndash;用于指定基础镜像相当于Dockerfile中的FROM指令&ndash;&gt;-->
<!-- <baseImage>openjdk:latest</baseImage>-->
<!-- &lt;!&ndash;相当于Dockerfile的ENTRYPOINT指令&ndash;&gt;-->
<!-- <entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint>-->
<!-- &lt;!&ndash;是否跳过docker build&ndash;&gt;-->
<!-- &lt;!&ndash;<skipDockerBuild>true</skipDockerBuild>&ndash;&gt;-->
<!-- <dockerHost>${configuration.docker-one-Host}</dockerHost>-->
<!-- <resources>-->
<!-- <resource>-->
<!-- <targetPath>/</targetPath>-->
<!-- &lt;!&ndash;用于指定需要复制的根目录,${project.build.directory}表示target目录&ndash;&gt;-->
<!-- <directory>${project.build.directory}</directory>-->
<!-- &lt;!&ndash;用于指定需要复制的文件。${project.build.finalName}.jar指的是打包后的jar包文件。&ndash;&gt;-->
<!-- <include>${project.build.finalName}.jar</include>-->
<!-- </resource>-->
<!-- </resources>-->
<!-- </configuration>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>build-image</id>-->
<!-- <phase>package</phase>-->
<!-- <goals>-->
<!-- <goal>build</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
</plugins>
<!--如果不设置resource 会导致application.yml中的@@找不到pom文件中的配置-->
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>

View File

@@ -0,0 +1,25 @@
package com.ruoyi.rocketmq;
import com.ruoyi.common.security.annotation.EnableCustomConfig;
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableAsync;
/**
* 平台管理模块
*
* @author ruoyi
*/
@EnableCustomConfig
@EnableRyFeignClients
@SpringBootApplication
@EnableAsync
public class RocketMQApplication
{
public static void main(String[] args)
{
SpringApplication.run(RocketMQApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ RocketMQ模块启动成功 ლ(´ڡ`ლ)゙");
}
}

View File

@@ -0,0 +1,75 @@
package com.ruoyi.rocketmq.config;
import com.ruoyi.rocketmq.enums.MessageCodeEnum;
import com.ruoyi.rocketmq.enums.MessageTopic;
import com.ruoyi.rocketmq.model.ConsumerMode;
import com.ruoyi.rocketmq.consumer.RocketMsgListener;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.common.consumer.ConsumeFromWhere;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.List;
/**
* 消费者配置
*/
@RefreshScope
@Configuration
@Slf4j
public class ConsumerConfig {
@Autowired
private ConsumerMode consumerMode;
@Bean
public DefaultMQPushConsumer getRocketMQConsumer() {
//构建客户端连接
DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(consumerMode.getGroupName());
//
consumer.setNamesrvAddr(consumerMode.getNamesrvAddr());
consumer.setConsumeThreadMin(consumerMode.getConsumeThreadMin());
consumer.setConsumeThreadMax(consumerMode.getConsumeThreadMax());
consumer.registerMessageListener(new RocketMsgListener());
/**
* 1. CONSUME_FROM_LAST_OFFSET第一次启动从队列最后位置消费后续再启动接着上次消费的进度开始消费
* 2. CONSUME_FROM_FIRST_OFFSET第一次启动从队列初始位置消费后续再启动接着上次消费的进度开始消费
* 3. CONSUME_FROM_TIMESTAMP第一次启动从指定时间点位置消费后续再启动接着上次消费的进度开始消费
* 以上所说的第一次启动是指从来没有消费过的消费者如果该消费者消费过那么会在broker端记录该消费者的消费位置如果该消费者挂了再启动那么自动从上次消费的进度开始
*/
consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_LAST_OFFSET);
/**
* CLUSTERING (集群模式) 默认模式同一个ConsumerGroup(groupName相同)每个consumer只消费所订阅消息的一部分内容同一个ConsumerGroup里所有的Consumer消息加起来才是所
* 订阅topic整体从而达到负载均衡的目的
* BROADCASTING (广播模式) 同一个ConsumerGroup每个consumer都消费到所订阅topic所有消息也就是一个消费会被多次分发被多个consumer消费。
* 需要注意的是在广播模式下每个Consumer都会独立地处理相同的消息副本。这可能会导致一些潜在的问题例如消息重复处理或者资源浪费。因此在使用广播模式时请确保消息的处理逻辑是幂等的并仔细考虑系统资源的消耗。
*/
// consumer.setMessageModel(MessageModel.BROADCASTING);
consumer.setVipChannelEnabled(false);
consumer.setConsumeMessageBatchMaxSize(consumerMode.getConsumeMessageBatchMaxSize());
try {
/**
* 订阅topic可以对指定消息进行过滤例如"TopicTest","tagl||tag2||tag3",*或null表示topic所有消息
* 由于官方并没有给直接订阅全部消息示例 所以使用list列表循环订阅所有topic
*/
// 获取所有topic列表
MessageTopic messageTopic = new MessageTopic();
List<String> allTopics = messageTopic.RocketMQTopicList();
//订阅所有topic
for (String topic : allTopics) {
consumer.subscribe(topic,"*");
}
consumer.start();
log.info("消费者初始化成功:{}", consumer);
} catch (MQClientException e) {
e.printStackTrace();
log.error("消费者初始化失败:{}",e.getMessage());
}
return consumer;
}
}

View File

@@ -0,0 +1,56 @@
package com.ruoyi.rocketmq.config;
import com.ruoyi.rocketmq.model.ProducerMode;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* mq搭建地址连接
* 生产者初者连接信息 具体看nacos配置
*/
@Configuration
@Slf4j
public class ProducerConfig {
/**
* 远程调用连接信息
*/
public static DefaultMQProducer producer;
/**
* 连接客户端信息配置 具体看nacos配置
*/
@Autowired
private ProducerMode producerMode;
@Bean
public DefaultMQProducer getRocketMQProducer() {
producer = new DefaultMQProducer(producerMode.getGroupName());
producer.setNamesrvAddr(producerMode.getNamesrvAddr());
//如果需要同一个jvm中不同的producer往不同的mq集群发送消息需要设置不同的instanceName
if(producerMode.getMaxMessageSize()!=null){
producer.setMaxMessageSize(producerMode.getMaxMessageSize());
}
if(producerMode.getSendMsgTimeout()!=null){
producer.setSendMsgTimeout(producerMode.getSendMsgTimeout());
}
//如果发送消息失败设置重试次数默认为2次
if(producerMode.getRetryTimesWhenSendFailed()!=null){
producer.setRetryTimesWhenSendFailed(producerMode.getRetryTimesWhenSendFailed());
}
producer.setVipChannelEnabled(false);
try {
producer.start();
log.info("生产者初始化成功:{}",producer.toString());
} catch (MQClientException e) {
log.error("生产者初始化失败:{}",e.getMessage());
}
return producer;
}
}

View File

@@ -0,0 +1,87 @@
package com.ruoyi.rocketmq.consumer;
import com.ruoyi.rocketmq.enums.MessageCodeEnum;
import com.ruoyi.rocketmq.producer.ConsumeException;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
import org.apache.rocketmq.common.message.MessageExt;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.io.UnsupportedEncodingException;
import java.util.List;
/**
* 消息监听
*/
@Slf4j
@Component
public class RocketMsgListener implements MessageListenerConcurrently {
/**
* 消费消息
* @param list msgs.size() >= 1
* DefaultMQPushConsumer.consumeMessageBatchMaxSize=1you can modify here
* 这里只设置为1当设置为多个时list中只要有一条消息消费失败就会整体重试
* @param consumeConcurrentlyContext 上下文信息
* @return 消费状态 成功CONSUME_SUCCESS或者 重试 (RECONSUME_LATER)
*/
@Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> list, ConsumeConcurrentlyContext consumeConcurrentlyContext) {
try{
//消息不等于空情况
if (!CollectionUtils.isEmpty(list)) {
//获取topic
for (MessageExt messageExt : list) {
// 解析消息内容
String body = new String(messageExt.getBody());
log.info("接受到的消息为:{}", body);
String tags = messageExt.getTags();
String topic = messageExt.getTopic();
String msgId = messageExt.getMsgId();
String keys = messageExt.getKeys();
int reConsume = messageExt.getReconsumeTimes();
// 消息已经重试了3次如果不需要再次消费则返回成功
if (reConsume == 3) {
// TODO 补偿信息
log.error("消息消费三次失败,消息内容:{}", body);
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;//根据业务返回是否正常
}
// 根据不同的topic处理不同的业务 这里以订单消息为例子
if (MessageCodeEnum.ORDER_MESSAGE_TOPIC.getCode().equals(topic)) {
if (MessageCodeEnum.ORDER_TIMEOUT_TAG.getCode().equals(tags)) {
//处理你的业务
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;//业务处理成功
} else {
log.info("未匹配到Tag【{}】" + tags);
}
}
}
}
// 消息消费失败
//broker会根据设置的messageDelayLevel发起重试默认16次
return ConsumeConcurrentlyStatus.RECONSUME_LATER;
} catch (Exception e) {
// 调用 handleException 方法处理异常并返回处理结果
return handleException(e);
}
}
/**
* 异常处理
*
* @param e 捕获的异常
* @return 消息消费结果
*/
private static ConsumeConcurrentlyStatus handleException(final Exception e) {
Class exceptionClass = e.getClass();
if (exceptionClass.equals(UnsupportedEncodingException.class)) {
log.error(e.getMessage());
} else if (exceptionClass.equals(ConsumeException.class)) {
log.error(e.getMessage());
}
return ConsumeConcurrentlyStatus.RECONSUME_LATER;
}
}

View File

@@ -0,0 +1,30 @@
package com.ruoyi.rocketmq.consumer;
import org.apache.rocketmq.client.producer.LocalTransactionState;
import org.apache.rocketmq.client.producer.TransactionListener;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.common.message.MessageExt;
/**
* 事物消息监听
*/
public class RocketMsgTransactionListenerImpl implements TransactionListener {
@Override
public LocalTransactionState executeLocalTransaction(Message msg, Object arg) {
// 在这里执行本地事务,比如数据库操作等
// 如果本地事务执行成功,返回 COMMIT_MESSAGE
// 如果本地事务执行失败,返回 ROLLBACK_MESSAGE
// 如果本地事务执行中,可以返回 UNKNOWRocketMQ 将会检查事务状态,并根据状态处理消息
return LocalTransactionState.COMMIT_MESSAGE; // 根据实际情况返回对应的状态
}
@Override
public LocalTransactionState checkLocalTransaction(MessageExt msg) {
// 检查本地事务状态,如果本地事务执行成功,返回 COMMIT_MESSAGE
// 如果本地事务执行失败,返回 ROLLBACK_MESSAGE
// 如果本地事务仍在执行中,返回 UNKNOWRocketMQ 将会继续检查事务状态
return LocalTransactionState.COMMIT_MESSAGE; // 根据实际情况返回对应的状态
}
}

View File

@@ -0,0 +1,105 @@
package com.ruoyi.rocketmq.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.rocketmq.domain.InitialBandwidthTraffic;
import com.ruoyi.rocketmq.service.IInitialBandwidthTrafficService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* 初始带宽流量Controller
*
* @author gyt
* @date 2025-08-20
*/
@RestController
@RequestMapping("/traffic")
public class InitialBandwidthTrafficController extends BaseController
{
@Autowired
private IInitialBandwidthTrafficService initialBandwidthTrafficService;
/**
* 查询初始带宽流量列表
*/
@RequiresPermissions("rocketmq:traffic:list")
@GetMapping("/list")
public TableDataInfo list(InitialBandwidthTraffic initialBandwidthTraffic)
{
startPage();
List<InitialBandwidthTraffic> list = initialBandwidthTrafficService.selectInitialBandwidthTrafficList(initialBandwidthTraffic);
return getDataTable(list);
}
/**
* 导出初始带宽流量列表
*/
@RequiresPermissions("rocketmq:traffic:export")
@Log(title = "初始带宽流量", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, InitialBandwidthTraffic initialBandwidthTraffic)
{
List<InitialBandwidthTraffic> list = initialBandwidthTrafficService.selectInitialBandwidthTrafficList(initialBandwidthTraffic);
ExcelUtil<InitialBandwidthTraffic> util = new ExcelUtil<InitialBandwidthTraffic>(InitialBandwidthTraffic.class);
util.exportExcel(response, list, "初始带宽流量数据");
}
/**
* 获取初始带宽流量详细信息
*/
@RequiresPermissions("rocketmq:traffic:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(initialBandwidthTrafficService.selectInitialBandwidthTrafficById(id));
}
/**
* 新增初始带宽流量
*/
@RequiresPermissions("rocketmq:traffic:add")
@Log(title = "初始带宽流量", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody InitialBandwidthTraffic initialBandwidthTraffic)
{
return toAjax(initialBandwidthTrafficService.insertInitialBandwidthTraffic(initialBandwidthTraffic));
}
/**
* 修改初始带宽流量
*/
@RequiresPermissions("rocketmq:traffic:edit")
@Log(title = "初始带宽流量", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody InitialBandwidthTraffic initialBandwidthTraffic)
{
return toAjax(initialBandwidthTrafficService.updateInitialBandwidthTraffic(initialBandwidthTraffic));
}
/**
* 删除初始带宽流量
*/
@RequiresPermissions("rocketmq:traffic:remove")
@Log(title = "初始带宽流量", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(initialBandwidthTrafficService.deleteInitialBandwidthTrafficByIds(ids));
}
}

View File

@@ -0,0 +1,137 @@
package com.ruoyi.rocketmq.controller;
import com.ruoyi.rocketmq.producer.MessageProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 消息测试类Controller
*/
@RestController
@RequestMapping("/api/rocketMessage")
public class RocketMqController {
/**
* 发送同步消息
*/
@PostMapping("/sendSynchronizeMessage")
private Map sendSynchronizeMessage(){
MessageProducer messageProducer = new MessageProducer();
//调用MessageProducer配置好的消息方法
SendResult sendResult = messageProducer.sendSynchronizeMessage("order-message","order_message_tag","title","content");
Map<String,Object> result = new HashMap<>();
result.put("data",sendResult);
return result;
}
/**
* 发送单向消息
*/
@PostMapping("/sendOnewayMessage")
private Map sendOnewayMessage(@RequestParam("topic") String topic,@RequestParam("tag") String tag,@RequestParam("key") String key,@RequestParam("value") String value){
MessageProducer messageProducer = new MessageProducer();
//调用MessageProducer配置好的消息方法 topic需要你根据你们业务定制相应的
messageProducer.sendOnewayMessage("order-message","order_timeout_tag","title","content");
Map<String,Object> result = new HashMap<>();
result.put("msg","发送成功");
result.put("code",200);
return result;
}
/**
* 批量发送消息
*/
@PostMapping("/sendBatchMessage")
private Map sendBatchMessage(){
// 根据实际需求创建消息列表并返回
List<Message> messages = new ArrayList<>();
// 添加消息到列表
messages.add(new Message("order-message", "order_timeout_tag", "Message 1".getBytes()));
messages.add(new Message("order-message", "order_timeout_tag", "Message 2".getBytes()));
messages.add(new Message("order-message", "order_timeout_tag", "Message 3".getBytes()));
MessageProducer messageProducer = new MessageProducer();
//调用MessageProducer配置好的消息方法 topic需要你根据你们业务定制相应的
SendResult sendResult = messageProducer.sendBatchMessage(messages);
Map<String,Object> result = new HashMap<>();
result.put("data",sendResult);
return result;
}
/**
* 发送事物消息
*/
@PostMapping("/sendThingMessage")
private Map sendThingMessage(@RequestParam("topic") String topic,@RequestParam("tag") String tag,@RequestParam("key") String key,@RequestParam("value") String value){
MessageProducer messageProducer = new MessageProducer();
//调用MessageProducer配置好的消息方法 topic需要你根据你们业务定制相应的
SendResult sendResult = messageProducer.sendThingMessage("order-message","order_timeout_tag","title","content");
Map<String,Object> result = new HashMap<>();
result.put("data",sendResult);
return result;
}
/**
* 发送有序的消息
*/
@PostMapping("/sendOrderlyMessage")
private Map sendOrderlyMessage(){
// 根据实际需求创建消息列表并返回
List<Message> messages = new ArrayList<>();
// 添加消息到列表
messages.add(new Message("order-message", "order_timeout_tag", "Message 1".getBytes()));
messages.add(new Message("order-message", "order_timeout_tag", "Message 2".getBytes()));
messages.add(new Message("order-message", "order_timeout_tag", "Message 3".getBytes()));
Integer messageQueueNumber = 3;
MessageProducer messageProducer = new MessageProducer();
//调用MessageProducer配置好的消息方法 topic需要你根据你们业务定制相应的
SendResult sendResult = messageProducer.sendOrderlyMessage(messages,messageQueueNumber);
Map<String,Object> result = new HashMap<>();
result.put("data",sendResult);
return result;
}
/**
* 发送延迟消息
*/
@PostMapping("/sendDelayMessage")
private Map sendDelayMessage(@RequestParam("topic") String topic,@RequestParam("tag") String tag,@RequestParam("key") String key,@RequestParam("value") String value){
MessageProducer messageProducer = new MessageProducer();
//调用MessageProducer配置好的消息方法 topic需要你根据你们业务定制相应的
SendResult sendResult = messageProducer.sendDelayMessage("order-message","order_timeout_tag","title","content");
Map<String,Object> result = new HashMap<>();
result.put("data",sendResult);
return result;
}
/**
* 发送异步的消息
*/
@PostMapping("/sendAsyncProducerMessage")
private Map sendAsyncProducerMessage(@RequestParam("topic") String topic,@RequestParam("tag") String tag,@RequestParam("key") String key,@RequestParam("value") String value){
MessageProducer messageProducer = new MessageProducer();
//调用MessageProducer配置好的消息方法 topic需要你根据你们业务定制相应的
SendResult sendResult = messageProducer.sendAsyncProducerMessage("order-message","order_timeout_tag","title","content");
Map<String,Object> result = new HashMap<>();
result.put("data",sendResult);
return result;
}
}

View File

@@ -0,0 +1,177 @@
package com.ruoyi.rocketmq.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* 初始带宽流量对象 initial_bandwidth_traffic
*
* @author gyt
* @date 2025-08-20
*/
public class InitialBandwidthTraffic extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 唯一标识ID */
private Long id;
/** 接口名称 */
@Excel(name = "接口名称")
private String interfaceName;
/** MAC地址 */
@Excel(name = "MAC地址")
private String macAddress;
/** 运行状态 */
@Excel(name = "运行状态")
private String operationStatus;
/** 接口类型 */
@Excel(name = "接口类型")
private String interfaceType;
/** IPv4地址 */
@Excel(name = "IPv4地址")
private String ipv4Address;
/** 入站丢包率(%) */
@Excel(name = "入站丢包率(%)")
private BigDecimal inboundPacketLoss;
/** 出站丢包率(%) */
@Excel(name = "出站丢包率(%)")
private BigDecimal outboundPacketLoss;
/** 接收带宽(Mbps) */
@Excel(name = "接收带宽(Mbps)")
private BigDecimal receiveBandwidth;
/** 发送带宽(Mbps) */
@Excel(name = "发送带宽(Mbps)")
private BigDecimal sendBandwidth;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setInterfaceName(String interfaceName)
{
this.interfaceName = interfaceName;
}
public String getInterfaceName()
{
return interfaceName;
}
public void setMacAddress(String macAddress)
{
this.macAddress = macAddress;
}
public String getMacAddress()
{
return macAddress;
}
public void setOperationStatus(String operationStatus)
{
this.operationStatus = operationStatus;
}
public String getOperationStatus()
{
return operationStatus;
}
public void setInterfaceType(String interfaceType)
{
this.interfaceType = interfaceType;
}
public String getInterfaceType()
{
return interfaceType;
}
public void setIpv4Address(String ipv4Address)
{
this.ipv4Address = ipv4Address;
}
public String getIpv4Address()
{
return ipv4Address;
}
public void setInboundPacketLoss(BigDecimal inboundPacketLoss)
{
this.inboundPacketLoss = inboundPacketLoss;
}
public BigDecimal getInboundPacketLoss()
{
return inboundPacketLoss;
}
public void setOutboundPacketLoss(BigDecimal outboundPacketLoss)
{
this.outboundPacketLoss = outboundPacketLoss;
}
public BigDecimal getOutboundPacketLoss()
{
return outboundPacketLoss;
}
public void setReceiveBandwidth(BigDecimal receiveBandwidth)
{
this.receiveBandwidth = receiveBandwidth;
}
public BigDecimal getReceiveBandwidth()
{
return receiveBandwidth;
}
public void setSendBandwidth(BigDecimal sendBandwidth)
{
this.sendBandwidth = sendBandwidth;
}
public BigDecimal getSendBandwidth()
{
return sendBandwidth;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("interfaceName", getInterfaceName())
.append("macAddress", getMacAddress())
.append("operationStatus", getOperationStatus())
.append("interfaceType", getInterfaceType())
.append("ipv4Address", getIpv4Address())
.append("inboundPacketLoss", getInboundPacketLoss())
.append("outboundPacketLoss", getOutboundPacketLoss())
.append("receiveBandwidth", getReceiveBandwidth())
.append("sendBandwidth", getSendBandwidth())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.toString();
}
}

View File

@@ -0,0 +1,55 @@
package com.ruoyi.rocketmq.enums;
import lombok.Getter;
/**
* 用于传递topic和 tag
* 也用于接收消息后判断不同的消息处理不同的业务
*/
@Getter
public enum MessageCodeEnum {
/**
* 系统消息
*/
NOTE_MESSAGE_TOPIC("system-message","系统消息服务模块topic名称"),
/**
* 用户消息
*/
USER_MESSAGE_TOPIC("user-message","用户消息服务模块topic名称"),
/**
* 订单消息
*/
ORDER_MESSAGE_TOPIC("order-message","订单消息服务模块topic名称"),
/**
* 用户消息tag
*/
USER_MESSAGE_TAG("user_message_tag","用户消息推送"),
/**
* 系统消息tag
*/
NOTE_MESSAGE_TAG("system_message_tag","系统消息推送"),
/**
* 订单消息
*/
ORDER_MESSAGE_TAG("order_message_tag","订单消息推送"),
/**
* 订单处理编号
*/
ORDER_TIMEOUT_TAG("order_timeout_tag","订单超时处理");
private final String code;
private final String msg;
MessageCodeEnum(String code, String msg){
this.code = code;
this.msg = msg;
}
}

View File

@@ -0,0 +1,24 @@
package com.ruoyi.rocketmq.enums;
import java.util.ArrayList;
import java.util.List;
/**
* 定义topic列表
*/
public class MessageTopic {
//在这里添加topic 用于批量订阅
public List<String> RocketMQTopicList(){
List<String> getTopicLists=new ArrayList<>();
//系统消息
getTopicLists.add("system-message");
//用户消息
getTopicLists.add("user-message");
//订单消息
getTopicLists.add("order-message");
return getTopicLists;
}
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.rocketmq.mapper;
import java.util.List;
import com.ruoyi.rocketmq.domain.InitialBandwidthTraffic;
/**
* 初始带宽流量Mapper接口
*
* @author gyt
* @date 2025-08-20
*/
public interface InitialBandwidthTrafficMapper
{
/**
* 查询初始带宽流量
*
* @param id 初始带宽流量主键
* @return 初始带宽流量
*/
public InitialBandwidthTraffic selectInitialBandwidthTrafficById(Long id);
/**
* 查询初始带宽流量列表
*
* @param initialBandwidthTraffic 初始带宽流量
* @return 初始带宽流量集合
*/
public List<InitialBandwidthTraffic> selectInitialBandwidthTrafficList(InitialBandwidthTraffic initialBandwidthTraffic);
/**
* 新增初始带宽流量
*
* @param initialBandwidthTraffic 初始带宽流量
* @return 结果
*/
public int insertInitialBandwidthTraffic(InitialBandwidthTraffic initialBandwidthTraffic);
/**
* 修改初始带宽流量
*
* @param initialBandwidthTraffic 初始带宽流量
* @return 结果
*/
public int updateInitialBandwidthTraffic(InitialBandwidthTraffic initialBandwidthTraffic);
/**
* 删除初始带宽流量
*
* @param id 初始带宽流量主键
* @return 结果
*/
public int deleteInitialBandwidthTrafficById(Long id);
/**
* 批量删除初始带宽流量
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteInitialBandwidthTrafficByIds(Long[] ids);
}

View File

@@ -0,0 +1,26 @@
package com.ruoyi.rocketmq.model;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
/**
* 消费者初始化
* 消费者连接信息 具体看nacos配置
*/
@Data
@Configuration
@Component
public class ConsumerMode {
@Value("${suning.rocketmq.namesrvAddr}")
private String namesrvAddr;
@Value("${suning.rocketmq.conumer.groupName}")
private String groupName ;
@Value("${suning.rocketmq.conumer.consumeThreadMin}")
private int consumeThreadMin;
@Value("${suning.rocketmq.conumer.consumeThreadMax}")
private int consumeThreadMax;
@Value("${suning.rocketmq.conumer.consumeMessageBatchMaxSize}")
private int consumeMessageBatchMaxSize;
}

View File

@@ -0,0 +1,25 @@
package com.ruoyi.rocketmq.model;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;
/**
* 生产者初始化
*/
@RefreshScope
@Data
@Configuration
public class ProducerMode {
@Value("${suning.rocketmq.producer.groupName}")
private String groupName;
@Value("${suning.rocketmq.namesrvAddr}")
private String namesrvAddr;
@Value("${suning.rocketmq.producer.maxMessageSize}")
private Integer maxMessageSize;
@Value("${suning.rocketmq.producer.sendMsgTimeout}")
private Integer sendMsgTimeout;
@Value("${suning.rocketmq.producer.retryTimesWhenSendFailed}")
private Integer retryTimesWhenSendFailed;
}

View File

@@ -0,0 +1,23 @@
package com.ruoyi.rocketmq.producer;
/**
* @author 影子
* 用于捕捉异常非受检异常unchecked exception
* RuntimeException 和其子类的异常在编译时不需要进行强制性的异常处理,可以选择在运行时进行捕获和处理
* 可选择使用
*/
public class ConsumeException extends RuntimeException{
private static final long serialVersionUID = 4093867789628938836L;
public ConsumeException(String message) {
super(message);
}
public ConsumeException(Throwable cause) {
super(cause);
}
public ConsumeException(String message, Throwable cause) {
super(message, cause);
}
}

View File

@@ -0,0 +1,224 @@
package com.ruoyi.rocketmq.producer;
import com.alibaba.fastjson.JSON;
import com.ruoyi.rocketmq.consumer.RocketMsgTransactionListenerImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.exception.MQBrokerException;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.SendCallback;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.client.producer.TransactionMQProducer;
import org.apache.rocketmq.client.producer.TransactionSendResult;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.remoting.common.RemotingHelper;
import org.apache.rocketmq.remoting.exception.RemotingException;
import java.io.UnsupportedEncodingException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import static com.ruoyi.rocketmq.config.ProducerConfig.producer;
/**
* 消息发送
*/
@Slf4j
public class MessageProducer {
/**
* 同步发送消息
* @param topic 主题
* @param tag 标签
* @param key 自定义的key根据业务来定
* @param value 消息的内容
* 通过调用 send() 方法发送消息,阻塞等待服务器响应。
*/
public SendResult sendSynchronizeMessage(String topic, String tag, String key, String value){
String body = "topic"+topic+"】, tag"+tag+"】, key"+key+"】, value"+value+"";
try {
Message msg = new Message(topic,tag,key, value.getBytes(RemotingHelper.DEFAULT_CHARSET));
System.out.println("生产者发送消息:"+ JSON.toJSONString(value));
SendResult result = producer.send(msg);
return result;
} catch (UnsupportedEncodingException e) {
log.error("消息初始化失败body{}",body);
} catch (MQClientException | InterruptedException | RemotingException | MQBrokerException e) {
log.error("消息发送失败! body{}",body);
}
return null;
}
/**
* 单向发送消息
* @param topic 主题
* @param tag 标签
* @param key 自定义的key根据业务来定
* @param value 消息的内容
* 单向发送:通过调用 sendOneway() 方法发送消息,不关心发送结果,适用于对可靠性要求不高的场景。
*/
public void sendOnewayMessage(String topic, String tag, String key, String value){
String body = "topic"+topic+"】, tag"+tag+"】, key"+key+"】, value"+value+"";
try {
Message msg = new Message(topic,tag,key, value.getBytes(RemotingHelper.DEFAULT_CHARSET));
System.out.println("生产者发送消息:"+ JSON.toJSONString(value));
producer.sendOneway(msg);
} catch (UnsupportedEncodingException e) {
log.error("消息初始化失败body{}",body);
} catch (MQClientException | InterruptedException | RemotingException e) {
log.error("消息发送失败! body{}",body);
}
}
/**
* 批量发送消息
* @param messages 消息列表
* 批量发送:通过调用 send() 方法并传入多条消息,实现批量发送消息。
*/
public SendResult sendBatchMessage(List<Message> messages){
String body = messages.toString();
try {
System.out.println("生产者发送消息:"+ messages);
// 发送批量消息
SendResult sendResult = producer.send(messages);
return sendResult;
} catch (MQClientException | InterruptedException | RemotingException e) {
log.error("消息发送失败! body{}",body);
} catch (MQBrokerException e) {
throw new RuntimeException(e);
}
return null;
}
/**
* 事务消息发送
* @param topic 主题
* @param tag 标签
* @param key 自定义的key根据业务来定
* @param value 消息的内容
* 事务消息发送:通过使用事务监听器实现本地事务执行和消息发送的一致性。
*/
public SendResult sendThingMessage(String topic, String tag, String key, String value){
String body = "topic"+topic+"】, tag"+tag+"】, key"+key+"】, value"+value+"";
try {
// 实例化事务生产者
TransactionMQProducer transactionMQProducer = new TransactionMQProducer(producer.getProducerGroup());
transactionMQProducer.setNamesrvAddr(producer.getNamesrvAddr());
// 设置事务监听器
transactionMQProducer.setTransactionListener(new RocketMsgTransactionListenerImpl());
Message msg = new Message(topic,tag,key, value.getBytes(RemotingHelper.DEFAULT_CHARSET));
System.out.println("生产者发送消息:"+ JSON.toJSONString(value));
// 发送事务消息
TransactionSendResult sendResult = transactionMQProducer.sendMessageInTransaction(msg, null);
return sendResult;
} catch (UnsupportedEncodingException e) {
log.error("消息初始化失败body{}",body);
} catch (MQClientException e) {
log.error("消息发送失败! body{}",body);
}
return null;
}
/**
* 发送有序的消息
* @param messagesList Message集合
* @param messageQueueNumber 消息队列数量,根据实际情况设定
* 顺序发送: messageQueueNumber 表示消息的业务标识,可以根据具体需求进行设置来保证消息按顺序发送。
*/
public SendResult sendOrderlyMessage(List<Message> messagesList, Integer messageQueueNumber) {
SendResult result = null;
for (Message message : messagesList) {
try {
result = producer.send(message, (list, msg, arg) -> {
Integer queueNumber = (Integer) arg;
//int queueIndex = queueNumber % list.size();
return list.get(queueNumber);
}, messageQueueNumber);//根据编号取模,选择消息队列
} catch (MQClientException | RemotingException | MQBrokerException | InterruptedException e) {
log.error("发送有序消息失败");
return result;
}
}
return result;
}
/**
* 发送延迟消息
* @param topic 主题
* @param tag 标签
* @param key 自定义的key根据业务来定
* @param value 消息的内容
* 延迟发送:通过设置延迟级别来实现延迟发送消息。
*/
public SendResult sendDelayMessage(String topic, String tag, String key, String value)
{
SendResult result = null;
try
{
Message msg = new Message(topic,tag,key, value.getBytes(RemotingHelper.DEFAULT_CHARSET));
//设置消息延迟级别我这里设置5对应就是延时一分钟
// "1s 5s 10s 30s 1m 2m 3m 4m 5m 6m 7m 8m 9m 10m 20m 30m 1h 2h"
msg.setDelayTimeLevel(4);
// 发送消息到一个Broker
result = producer.send(msg);
// 通过sendResult返回消息是否成功送达
log.info("发送延迟消息结果:======sendResult{}", result);
DateFormat format =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
log.info("发送时间:{}", format.format(new Date()));
return result;
}
catch (Exception e)
{
e.printStackTrace();
log.error("延迟消息队列推送消息异常:{},推送内容:{}", e.getMessage(), result);
}
return result;
}
/**
* 发送异步的消息
* @param topic 主题
* @param tag 标签
* @param key 自定义的key根据业务来定
* @param value 消息的内容
* 通过调用 send() 方法,并传入一个 SendCallback 对象,在发送消息的同时可以继续处理其他逻辑,消息发送结果通过回调函数通知。
*/
public SendResult sendAsyncProducerMessage(String topic, String tag, String key, String value){
try {
//创建一个消息实例,指定主题、标签和消息体。
Message msg = new Message(topic,tag,key, value.getBytes(RemotingHelper.DEFAULT_CHARSET));
System.out.println("生产者发送消息:"+ JSON.toJSONString(value));
producer.send(msg,new SendCallback() {
// 异步回调的处理
@Override
public void onSuccess(SendResult sendResult) {
System.out.printf("%-10d 异步发送消息成功 %s %n", msg, sendResult.getMsgId());
}
@Override
public void onException(Throwable e) {
System.out.printf("%-10d 异步发送消息失败 %s %n", msg, e);
e.printStackTrace();
}
});
} catch (MQClientException e) {
e.printStackTrace();
} catch (RemotingException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
return null;
}
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.rocketmq.service;
import java.util.List;
import com.ruoyi.rocketmq.domain.InitialBandwidthTraffic;
/**
* 初始带宽流量Service接口
*
* @author gyt
* @date 2025-08-20
*/
public interface IInitialBandwidthTrafficService
{
/**
* 查询初始带宽流量
*
* @param id 初始带宽流量主键
* @return 初始带宽流量
*/
public InitialBandwidthTraffic selectInitialBandwidthTrafficById(Long id);
/**
* 查询初始带宽流量列表
*
* @param initialBandwidthTraffic 初始带宽流量
* @return 初始带宽流量集合
*/
public List<InitialBandwidthTraffic> selectInitialBandwidthTrafficList(InitialBandwidthTraffic initialBandwidthTraffic);
/**
* 新增初始带宽流量
*
* @param initialBandwidthTraffic 初始带宽流量
* @return 结果
*/
public int insertInitialBandwidthTraffic(InitialBandwidthTraffic initialBandwidthTraffic);
/**
* 修改初始带宽流量
*
* @param initialBandwidthTraffic 初始带宽流量
* @return 结果
*/
public int updateInitialBandwidthTraffic(InitialBandwidthTraffic initialBandwidthTraffic);
/**
* 批量删除初始带宽流量
*
* @param ids 需要删除的初始带宽流量主键集合
* @return 结果
*/
public int deleteInitialBandwidthTrafficByIds(Long[] ids);
/**
* 删除初始带宽流量信息
*
* @param id 初始带宽流量主键
* @return 结果
*/
public int deleteInitialBandwidthTrafficById(Long id);
}

View File

@@ -0,0 +1,96 @@
package com.ruoyi.rocketmq.service.impl;
import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.rocketmq.mapper.InitialBandwidthTrafficMapper;
import com.ruoyi.rocketmq.domain.InitialBandwidthTraffic;
import com.ruoyi.rocketmq.service.IInitialBandwidthTrafficService;
/**
* 初始带宽流量Service业务层处理
*
* @author gyt
* @date 2025-08-20
*/
@Service
public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTrafficService
{
@Autowired
private InitialBandwidthTrafficMapper initialBandwidthTrafficMapper;
/**
* 查询初始带宽流量
*
* @param id 初始带宽流量主键
* @return 初始带宽流量
*/
@Override
public InitialBandwidthTraffic selectInitialBandwidthTrafficById(Long id)
{
return initialBandwidthTrafficMapper.selectInitialBandwidthTrafficById(id);
}
/**
* 查询初始带宽流量列表
*
* @param initialBandwidthTraffic 初始带宽流量
* @return 初始带宽流量
*/
@Override
public List<InitialBandwidthTraffic> selectInitialBandwidthTrafficList(InitialBandwidthTraffic initialBandwidthTraffic)
{
return initialBandwidthTrafficMapper.selectInitialBandwidthTrafficList(initialBandwidthTraffic);
}
/**
* 新增初始带宽流量
*
* @param initialBandwidthTraffic 初始带宽流量
* @return 结果
*/
@Override
public int insertInitialBandwidthTraffic(InitialBandwidthTraffic initialBandwidthTraffic)
{
initialBandwidthTraffic.setCreateTime(DateUtils.getNowDate());
return initialBandwidthTrafficMapper.insertInitialBandwidthTraffic(initialBandwidthTraffic);
}
/**
* 修改初始带宽流量
*
* @param initialBandwidthTraffic 初始带宽流量
* @return 结果
*/
@Override
public int updateInitialBandwidthTraffic(InitialBandwidthTraffic initialBandwidthTraffic)
{
initialBandwidthTraffic.setUpdateTime(DateUtils.getNowDate());
return initialBandwidthTrafficMapper.updateInitialBandwidthTraffic(initialBandwidthTraffic);
}
/**
* 批量删除初始带宽流量
*
* @param ids 需要删除的初始带宽流量主键
* @return 结果
*/
@Override
public int deleteInitialBandwidthTrafficByIds(Long[] ids)
{
return initialBandwidthTrafficMapper.deleteInitialBandwidthTrafficByIds(ids);
}
/**
* 删除初始带宽流量信息
*
* @param id 初始带宽流量主键
* @return 结果
*/
@Override
public int deleteInitialBandwidthTrafficById(Long id)
{
return initialBandwidthTrafficMapper.deleteInitialBandwidthTrafficById(id);
}
}

View File

@@ -0,0 +1,35 @@
# Tomcat
server:
port: 9207
# Spring
spring:
application:
# 应用名称
name: ruoyi-rocketmq
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
redisson:
singleServerConfig:
address: redis://localhost:6379
logging:
level:
com.ruoyi.app.mapper: DEBUG

View File

@@ -0,0 +1,115 @@
<?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.ruoyi.rocketmq.mapper.InitialBandwidthTrafficMapper">
<resultMap type="InitialBandwidthTraffic" id="InitialBandwidthTrafficResult">
<result property="id" column="id" />
<result property="interfaceName" column="interface_name" />
<result property="macAddress" column="mac_address" />
<result property="operationStatus" column="operation_status" />
<result property="interfaceType" column="interface_type" />
<result property="ipv4Address" column="ipv4_address" />
<result property="inboundPacketLoss" column="inbound_packet_loss" />
<result property="outboundPacketLoss" column="outbound_packet_loss" />
<result property="receiveBandwidth" column="receive_bandwidth" />
<result property="sendBandwidth" column="send_bandwidth" />
<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="selectInitialBandwidthTrafficVo">
select id, interface_name, mac_address, operation_status, interface_type, ipv4_address, inbound_packet_loss, outbound_packet_loss, receive_bandwidth, send_bandwidth, create_time, update_time, create_by, update_by from initial_bandwidth_traffic
</sql>
<select id="selectInitialBandwidthTrafficList" parameterType="InitialBandwidthTraffic" resultMap="InitialBandwidthTrafficResult">
<include refid="selectInitialBandwidthTrafficVo"/>
<where>
<if test="interfaceName != null and interfaceName != ''"> and interface_name = #{interfaceName}</if>
<if test="macAddress != null and macAddress != ''"> and mac_address = #{macAddress}</if>
<if test="operationStatus != null and operationStatus != ''"> and operation_status = #{operationStatus}</if>
<if test="interfaceType != null and interfaceType != ''"> and interface_type = #{interfaceType}</if>
<if test="ipv4Address != null and ipv4Address != ''"> and ipv4_address = #{ipv4Address}</if>
<if test="inboundPacketLoss != null "> and inbound_packet_loss = #{inboundPacketLoss}</if>
<if test="outboundPacketLoss != null "> and outbound_packet_loss = #{outboundPacketLoss}</if>
<if test="receiveBandwidth != null "> and receive_bandwidth = #{receiveBandwidth}</if>
<if test="sendBandwidth != null "> and send_bandwidth = #{sendBandwidth}</if>
</where>
</select>
<select id="selectInitialBandwidthTrafficById" parameterType="Long" resultMap="InitialBandwidthTrafficResult">
<include refid="selectInitialBandwidthTrafficVo"/>
where id = #{id}
</select>
<insert id="insertInitialBandwidthTraffic" parameterType="InitialBandwidthTraffic">
insert into initial_bandwidth_traffic
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="interfaceName != null">interface_name,</if>
<if test="macAddress != null">mac_address,</if>
<if test="operationStatus != null">operation_status,</if>
<if test="interfaceType != null">interface_type,</if>
<if test="ipv4Address != null">ipv4_address,</if>
<if test="inboundPacketLoss != null">inbound_packet_loss,</if>
<if test="outboundPacketLoss != null">outbound_packet_loss,</if>
<if test="receiveBandwidth != null">receive_bandwidth,</if>
<if test="sendBandwidth != null">send_bandwidth,</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="id != null">#{id},</if>
<if test="interfaceName != null">#{interfaceName},</if>
<if test="macAddress != null">#{macAddress},</if>
<if test="operationStatus != null">#{operationStatus},</if>
<if test="interfaceType != null">#{interfaceType},</if>
<if test="ipv4Address != null">#{ipv4Address},</if>
<if test="inboundPacketLoss != null">#{inboundPacketLoss},</if>
<if test="outboundPacketLoss != null">#{outboundPacketLoss},</if>
<if test="receiveBandwidth != null">#{receiveBandwidth},</if>
<if test="sendBandwidth != null">#{sendBandwidth},</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="updateInitialBandwidthTraffic" parameterType="InitialBandwidthTraffic">
update initial_bandwidth_traffic
<trim prefix="SET" suffixOverrides=",">
<if test="interfaceName != null">interface_name = #{interfaceName},</if>
<if test="macAddress != null">mac_address = #{macAddress},</if>
<if test="operationStatus != null">operation_status = #{operationStatus},</if>
<if test="interfaceType != null">interface_type = #{interfaceType},</if>
<if test="ipv4Address != null">ipv4_address = #{ipv4Address},</if>
<if test="inboundPacketLoss != null">inbound_packet_loss = #{inboundPacketLoss},</if>
<if test="outboundPacketLoss != null">outbound_packet_loss = #{outboundPacketLoss},</if>
<if test="receiveBandwidth != null">receive_bandwidth = #{receiveBandwidth},</if>
<if test="sendBandwidth != null">send_bandwidth = #{sendBandwidth},</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="deleteInitialBandwidthTrafficById" parameterType="Long">
delete from initial_bandwidth_traffic where id = #{id}
</delete>
<delete id="deleteInitialBandwidthTrafficByIds" parameterType="String">
delete from initial_bandwidth_traffic where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,25 @@
package com.ruoyi.testrocketmq;
import com.ruoyi.common.security.annotation.EnableCustomConfig;
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableAsync;
/**
* 平台管理模块
*
* @author ruoyi
*/
@EnableCustomConfig
@EnableRyFeignClients
@SpringBootApplication
@EnableAsync
public class RocketMQApplication
{
public static void main(String[] args)
{
SpringApplication.run(RocketMQApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ RocketMQ模块启动成功 ლ(´ڡ`ლ)゙");
}
}

View File

@@ -0,0 +1,64 @@
package com.ruoyi.testrocketmq.config;
import com.ruoyi.testrocketmq.consumer.RocketMsgListener;
import com.ruoyi.testrocketmq.enums.MessageCodeEnum;
import com.ruoyi.testrocketmq.model.ConsumerMode;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.common.consumer.ConsumeFromWhere;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 消费者配置
*/
@RefreshScope
@Configuration
@Slf4j
public class ConsumerConfig {
@Autowired
private ConsumerMode consumerMode;
@Bean
public DefaultMQPushConsumer getRocketMQConsumer() throws MQClientException {
// ConsumerMode consumerMode = new ConsumerMode();
DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(consumerMode.getGroupName());
consumer.setNamesrvAddr(consumerMode.getNamesrvAddr());
consumer.setConsumeThreadMin(consumerMode.getConsumeThreadMin());
consumer.setConsumeThreadMax(consumerMode.getConsumeThreadMax());
consumer.registerMessageListener(new RocketMsgListener());
/**
* 1. CONSUME_FROM_LAST_OFFSET第一次启动从队列最后位置消费后续再启动接着上次消费的进度开始消费
* 2. CONSUME_FROM_FIRST_OFFSET第一次启动从队列初始位置消费后续再启动接着上次消费的进度开始消费
* 3. CONSUME_FROM_TIMESTAMP第一次启动从指定时间点位置消费后续再启动接着上次消费的进度开始消费
* 以上所说的第一次启动是指从来没有消费过的消费者如果该消费者消费过那么会在broker端记录该消费者的消费位置如果该消费者挂了再启动那么自动从上次消费的进度开始
*/
consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_LAST_OFFSET);
/**
* CLUSTERING (集群模式) 默认模式同一个ConsumerGroup(groupName相同)每个consumer只消费所订阅消息的一部分内容同一个ConsumerGroup里所有的Consumer消息加起来才是所
* 订阅topic整体从而达到负载均衡的目的
* BROADCASTING (广播模式) 同一个ConsumerGroup每个consumer都消费到所订阅topic所有消息也就是一个消费会被多次分发被多个consumer消费。
*
*/
// consumer.setMessageModel(MessageModel.BROADCASTING);
consumer.setVipChannelEnabled(false);
consumer.setConsumeMessageBatchMaxSize(consumerMode.getConsumeMessageBatchMaxSize());
try {
/**
* 订阅topic可以对指定消息进行过滤例如"TopicTest","tagl||tag2||tag3",*或null表示topic所有消息
*/
consumer.subscribe(MessageCodeEnum.ORDER_MESSAGE.getCode(),"*");
consumer.subscribe(MessageCodeEnum.USER_MESSAGE.getCode(),"*");
consumer.start();
log.info("消费者初始化成功:{}", consumer.toString());
} catch (MQClientException e) {
e.printStackTrace();
log.error("消费者初始化失败:{}",e.getMessage());
}
return consumer;
}
}

Some files were not shown because too many files have changed in this diff Show More