rocketmq,收益管理,资源管理模块代码
This commit is contained in:
@@ -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>
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user