Compare commits
19 Commits
master
...
saas_houdu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01c51b39fe | ||
|
|
c0f057d7ed | ||
|
|
15ecd5caaf | ||
|
|
8c439013e1 | ||
|
|
46bf4c4114 | ||
|
|
36362e2236 | ||
|
|
37eff51e48 | ||
|
|
31d8114c05 | ||
|
|
4fdaadee65 | ||
|
|
52728eba49 | ||
|
|
b0e63880fc | ||
|
|
b3f16d2c8f | ||
|
|
c6937eb44b | ||
|
|
3019f65515 | ||
|
|
87824abb77 | ||
|
|
7da5e19cfa | ||
|
|
054b0f1272 | ||
|
|
6ffdf8d355 | ||
|
|
7b5c782079 |
@@ -89,4 +89,40 @@ public interface RemoteRevenueConfigService
|
||||
@PostMapping("/registration/getListByHardwareSn")
|
||||
public R<RmResourceRegistrationRemote> getListByHardwareSn(@RequestBody RmResourceRegistrationRemote rmResourceRegistrationRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 根据clientId获取交换机名称信息
|
||||
* @param rmSwitchManagementRemote
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/switchManagement/getSwitchNameByClientId")
|
||||
public R<List<RmSwitchManagementRemote>> getSwitchNameByClientId(@RequestBody RmSwitchManagementRemote rmSwitchManagementRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 自动注册
|
||||
* @param rmRegisterMsgRemote
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/registration/innerAddRegist")
|
||||
public R<Integer> innerAddRegist(@RequestBody RmRegisterMsgRemote rmRegisterMsgRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
/**
|
||||
* 添加节点标识
|
||||
* @param rmResourceRegistrationRemote
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/registration/innerUpdateRegist")
|
||||
public R<Integer> innerUpdateRegist(@RequestBody RmResourceRegistrationRemote rmResourceRegistrationRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 获取95值列表
|
||||
* @param epsNodeBandwidthRemote
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/bandwidth/getEpsNodeBandWidthList")
|
||||
public R<List<EpsNodeBandwidthRemote>> getEpsNodeBandWidthList(@RequestBody EpsNodeBandwidthRemote epsNodeBandwidthRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ 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.RmAlarmRecordRemote;
|
||||
import com.ruoyi.system.api.domain.RmDeployScriptRemote;
|
||||
import com.ruoyi.system.api.domain.RmMonitorPolicyRemote;
|
||||
import com.ruoyi.system.api.domain.RmNetworkInterfaceRemote;
|
||||
import com.ruoyi.system.api.factory.RemoteRocketMqFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -42,4 +45,57 @@ public interface RemoteRocketMqService {
|
||||
*/
|
||||
@GetMapping("/alarmRecord/alarmHandlingStatus")
|
||||
public R<Map> alarmHandlingStatus(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 获取网卡接口列表
|
||||
* @param rmNetworkInterfaceRemote
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/networkInterface/getNetworkInterfaceList")
|
||||
public R<List<RmNetworkInterfaceRemote>> getNetworkInterfaceList(@RequestBody RmNetworkInterfaceRemote rmNetworkInterfaceRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 获取网卡接口列表
|
||||
* @param rmNetworkInterfaceRemote
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/networkInterface/bindPublicIp")
|
||||
public R<Integer> bindPublicIp(@RequestBody RmNetworkInterfaceRemote rmNetworkInterfaceRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
/**
|
||||
* 下发策略
|
||||
* @param id
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/monitorPolicy/innerIssueSwitchPolicy")
|
||||
public R<String> innerIssueSwitchPolicy(Long id, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
/**
|
||||
* 查询策略信息
|
||||
* @param rmMonitorPolicyRemote
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/monitorPolicy/getPolicyMsgInner")
|
||||
public R<List<RmMonitorPolicyRemote>> getPolicyMsgInner(@RequestBody RmMonitorPolicyRemote rmMonitorPolicyRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
/**
|
||||
* 策略添加新设备
|
||||
* @param rmMonitorPolicyRemote
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/monitorPolicy/updatePolicyMsgInner")
|
||||
public R<Integer> updatePolicyMsgInner(@RequestBody RmMonitorPolicyRemote rmMonitorPolicyRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 下发优先级为0的策略
|
||||
* @param clientId
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/monitorPolicy/issueDefaultPolicyByClientId")
|
||||
public R<Integer> issueDefaultPolicyByClientId(String clientId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
@PostMapping("policy/addDeployScript")
|
||||
R<Integer> addDeployScript(@RequestBody RmDeployScriptRemote addData, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
package com.ruoyi.system.api.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class EpsNodeBandwidthRemote extends BaseEntity {
|
||||
/** 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;
|
||||
/** 金山流量Mbps/日 */
|
||||
private BigDecimal machineFlow;
|
||||
|
||||
/** 设备业务客户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;
|
||||
|
||||
/** 交换机sn */
|
||||
@Excel(name = "交换机sn")
|
||||
private String switchSn;
|
||||
|
||||
/** 接口名称 */
|
||||
@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;
|
||||
/** 月份 */
|
||||
private String monthTime;
|
||||
/** 备注 */
|
||||
private String remark1;
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createDatetime;
|
||||
|
||||
private List<String> nodeNames;
|
||||
|
||||
private List<String> switchNames;
|
||||
/** 计算方式 */
|
||||
private String calculationMode;
|
||||
/** 客户端id */
|
||||
private String clientId;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.ruoyi.system.api.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class NetworkInfo {
|
||||
// 运营商
|
||||
@JsonProperty("carrier")
|
||||
private String carrier;
|
||||
// 市
|
||||
@JsonProperty("city")
|
||||
private String city;
|
||||
// 网关
|
||||
@JsonProperty("gateway")
|
||||
private String gateway;
|
||||
// IPv4 地址
|
||||
@JsonProperty("ipv4")
|
||||
private String ipv4;
|
||||
// MAC 地址
|
||||
@JsonProperty("mac")
|
||||
private String mac;
|
||||
// 接口名称:eth0, enp3s0
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
// 省
|
||||
@JsonProperty("province")
|
||||
private String province;
|
||||
// 公网 IP
|
||||
@JsonProperty("publicIp")
|
||||
private String publicIp;
|
||||
@JsonProperty("type")
|
||||
private String type;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.ruoyi.system.api.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class RmDeployScriptRemote {
|
||||
/** 策略ID */
|
||||
private Long id;
|
||||
|
||||
/** 策略名称 */
|
||||
@Excel(name = "策略名称")
|
||||
private String policyName;
|
||||
|
||||
/** 策略描述 */
|
||||
@Excel(name = "策略描述")
|
||||
private String description;
|
||||
|
||||
/** 关联资源组ID */
|
||||
@Excel(name = "关联资源组ID")
|
||||
private Long resourceGroupId;
|
||||
|
||||
/** 包含的设备ID列表(逗号分隔) */
|
||||
private String includedDevicesId;
|
||||
/** 包含设备 */
|
||||
@Excel(name = "包含设备")
|
||||
private String includedDevicesName;
|
||||
|
||||
/** 源文件地址格式 */
|
||||
@Excel(name = "源文件地址格式")
|
||||
private String sourceFilePathType;
|
||||
/** 源文件路径 */
|
||||
@Excel(name = "源文件路径")
|
||||
private String sourceFilePath;
|
||||
|
||||
/** 目标目录 */
|
||||
@Excel(name = "目标目录")
|
||||
private String targetDirectory;
|
||||
|
||||
/** 命令执行内容 */
|
||||
@Excel(name = "命令执行内容")
|
||||
private String commandContent;
|
||||
|
||||
/** 0=立即执行,1=定时执行 */
|
||||
@Excel(name = "执行方式", readConverterExp = "0=立即执行,1=定时执行")
|
||||
private Integer executionMethod;
|
||||
|
||||
/** 定时执行时间 */
|
||||
@Excel(name = "定时执行时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date scheduledTime;
|
||||
/** 定时执行时间(时间戳秒) */
|
||||
private Long policyTime;
|
||||
|
||||
/** 策略状态:0-未下发,1-已下发 */
|
||||
@Excel(name = "策略状态:0-未下发,1-已下发")
|
||||
private String policyStatus;
|
||||
|
||||
/** 策略下发时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "策略下发时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date deployTime;
|
||||
|
||||
/** 脚本类型 */
|
||||
@Excel(name = "脚本类型")
|
||||
private String scriptType;
|
||||
/** 资源组名称 */
|
||||
private String resourceGroupName;
|
||||
/** 资源组置空 */
|
||||
private Boolean resourceGroupIdNull;
|
||||
/** 部署设备 */
|
||||
private String deployDevice;
|
||||
/** 业务脚本名称 */
|
||||
private String scriptName;
|
||||
/** 业务脚本文件地址 */
|
||||
private String scriptPath;
|
||||
/** 业务脚本参数 */
|
||||
private String defaultParams;
|
||||
/** 业务下发名称 */
|
||||
private String taskName;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.api.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@Data
|
||||
public class RmMonitorPolicyRemote extends BaseEntity {
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
|
||||
/** 策略名称 */
|
||||
@Excel(name = "策略名称")
|
||||
private String policyName;
|
||||
|
||||
/** 描述 */
|
||||
@Excel(name = "描述")
|
||||
private String description;
|
||||
|
||||
/** 资源组ID */
|
||||
private Long resourceGroupId;
|
||||
/** 资源组名称 */
|
||||
@Excel(name = "关联资源组")
|
||||
private String resourceGroupName;
|
||||
/** 模板ID */
|
||||
private Long templateId;
|
||||
/** 模板名称 */
|
||||
@Excel(name = "关联监控模板")
|
||||
private String templateName;
|
||||
|
||||
/** 状态:0-待下发,1-已下发 */
|
||||
@Excel(name = "策略状态", readConverterExp = "0=待下发,1=已下发")
|
||||
private String status;
|
||||
|
||||
/** 下发策略时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "下发策略时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date deployTime;
|
||||
/** 资源类型,linux switch */
|
||||
private String resourceType;
|
||||
/** 查询条件名称 */
|
||||
private String queryName;
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "创建时间")
|
||||
private Date createTime;
|
||||
/** 修改时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "修改时间")
|
||||
private Date updateTime;
|
||||
/** 交换机类型 */
|
||||
private String switchType;
|
||||
/** 部署设备 */
|
||||
private String deployDevice;
|
||||
/** 优先级 */
|
||||
private String priority;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.ruoyi.system.api.domain;
|
||||
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RmNetworkInterfaceRemote extends BaseEntity {
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 客户端ID */
|
||||
@Excel(name = "客户端ID")
|
||||
private String clientId;
|
||||
|
||||
/** 运营商 */
|
||||
@Excel(name = "运营商")
|
||||
private String isp;
|
||||
|
||||
/** 省 */
|
||||
@Excel(name = "省")
|
||||
private String province;
|
||||
|
||||
/** 市 */
|
||||
@Excel(name = "市")
|
||||
private String city;
|
||||
|
||||
/** 公网IP */
|
||||
@Excel(name = "公网IP")
|
||||
private String publicIp;
|
||||
|
||||
/** 接口名称 */
|
||||
@Excel(name = "接口名称")
|
||||
private String interfaceName;
|
||||
|
||||
/** MAC地址 */
|
||||
@Excel(name = "MAC地址")
|
||||
private String macAddress;
|
||||
|
||||
/** 接口类型 */
|
||||
@Excel(name = "接口类型")
|
||||
private String interfaceType;
|
||||
|
||||
/** IPv4地址 */
|
||||
@Excel(name = "IPv4地址")
|
||||
private String ipv4Address;
|
||||
|
||||
/** 网关 */
|
||||
@Excel(name = "网关")
|
||||
private String gateway;
|
||||
/** 绑定ip 1业务IP,2管理ip */
|
||||
private String bindIp;
|
||||
/** 新旧标识 */
|
||||
private Integer newFlag;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.ruoyi.system.api.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class RmRegisterMsgRemote {
|
||||
@JsonProperty("clientId")
|
||||
private String clientId;
|
||||
|
||||
@JsonProperty("sn")
|
||||
private String sn;
|
||||
|
||||
@JsonProperty("networkInfo")
|
||||
private List<NetworkInfo> networkInfo;
|
||||
|
||||
@JsonProperty("timestamp")
|
||||
private long timestamp;
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.ruoyi.system.api.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 资源注册对象 rm_resource_registration
|
||||
*
|
||||
@@ -127,5 +130,53 @@ public class RmResourceRegistrationRemote extends BaseEntity
|
||||
private String monitorItems;
|
||||
/** 自动发现项 */
|
||||
private String discoveryRules;
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 运营商
|
||||
*/
|
||||
private String operator;
|
||||
|
||||
/**
|
||||
* 省
|
||||
*/
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 公网IP
|
||||
*/
|
||||
private String publicIp;
|
||||
|
||||
/**
|
||||
* 业务名称
|
||||
*/
|
||||
private String businessName;
|
||||
|
||||
/**
|
||||
* 逻辑节点标识
|
||||
*/
|
||||
private String logicalNodeId;
|
||||
|
||||
/**
|
||||
* 多公网IP状态
|
||||
*/
|
||||
private String multiPublicIpStatus;
|
||||
|
||||
/**
|
||||
* 心跳次数
|
||||
*/
|
||||
private Integer heartbeatCount;
|
||||
|
||||
/**
|
||||
* 心跳周期(单位:秒)
|
||||
*/
|
||||
private Integer heartbeatInterval;
|
||||
/** 上机时间 */
|
||||
@Excel(name = "上机时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date onboardTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.ruoyi.system.api.domain;
|
||||
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@Data
|
||||
public class RmSwitchManagementRemote {
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 交换机名称 */
|
||||
@Excel(name = "交换机名称")
|
||||
private String switchName;
|
||||
|
||||
/** 硬件SN序列号 */
|
||||
@Excel(name = "硬件SN序列号")
|
||||
private String hardwareSn;
|
||||
|
||||
/** SNMP采集地址 */
|
||||
@Excel(name = "SNMP采集地址")
|
||||
private String snmpAddress;
|
||||
|
||||
/** SNMP采集端口 */
|
||||
@Excel(name = "SNMP采集端口")
|
||||
private Long snmpPort;
|
||||
|
||||
/** 在线状态(0-离线,1-在线) */
|
||||
@Excel(name = "在线状态(0-离线,1-在线)")
|
||||
private String onlineStatus;
|
||||
/** 上机时间 */
|
||||
private Date upTime;
|
||||
/** 心跳监测次数 */
|
||||
@Excel(name = "心跳监测次数")
|
||||
private String heartbeatCount;
|
||||
|
||||
/** 心跳监测周期(秒) */
|
||||
@Excel(name = "心跳监测周期(秒)")
|
||||
private String heartbeatInterval;
|
||||
|
||||
/** 心跳检测OID */
|
||||
@Excel(name = "心跳检测OID")
|
||||
private String heartbeatOid;
|
||||
|
||||
/** SNMP版本(v1/v2c/v3) */
|
||||
@Excel(name = "SNMP版本(v1/v2c/v3)")
|
||||
private String snmpVersion;
|
||||
|
||||
/** 读写权限 */
|
||||
@Excel(name = "读写权限")
|
||||
private String readWritePermission;
|
||||
|
||||
/** 安全级别 */
|
||||
@Excel(name = "安全级别")
|
||||
private String securityLevel;
|
||||
|
||||
/** 加密方式 */
|
||||
@Excel(name = "加密方式")
|
||||
private String encryptionMethod;
|
||||
|
||||
/** 团体名称 */
|
||||
@Excel(name = "团体名称")
|
||||
private String communityName;
|
||||
|
||||
/** 密码 */
|
||||
@Excel(name = "密码")
|
||||
private String switchPassword;
|
||||
/** 交换机类型 */
|
||||
private String switchType;
|
||||
/** 用户名 */
|
||||
private String switchUser;
|
||||
/** 自动生成客户端id(uuid) */
|
||||
private String clientId;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.ruoyi.system.api.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RouteMsg {
|
||||
/** 网卡名称 */
|
||||
private String name;
|
||||
/** 网关地址 */
|
||||
private String gateway;
|
||||
|
||||
}
|
||||
@@ -59,12 +59,32 @@ public class RemoteRevenueConfigFallbackFactory implements FallbackFactory<Remot
|
||||
|
||||
@Override
|
||||
public R<TableDataInfo> getRegistrationList(RmResourceRegistrationRemote rmResourceRegistrationRemote, String source) {
|
||||
return R.fail("获取资源注册列表信息失败" + throwable.getMessage());
|
||||
return R.fail("获取资源注册列表信息失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<RmResourceRegistrationRemote> getListByHardwareSn(RmResourceRegistrationRemote rmResourceRegistrationRemote, String source) {
|
||||
return R.fail("根据SN获取资源注册列表信息失败" + throwable.getMessage());
|
||||
return R.fail("根据SN获取资源注册列表信息失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<List<RmSwitchManagementRemote>> getSwitchNameByClientId(RmSwitchManagementRemote rmSwitchManagementRemote, String source) {
|
||||
return R.fail("根据clientId获取交换机信息失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Integer> innerAddRegist(RmRegisterMsgRemote rmRegisterMsgRemote, String source) {
|
||||
return R.fail("自动注册失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Integer> innerUpdateRegist(RmResourceRegistrationRemote rmResourceRegistrationRemote, String source) {
|
||||
return R.fail("修改服务器注册信息失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<List<EpsNodeBandwidthRemote>> getEpsNodeBandWidthList(EpsNodeBandwidthRemote epsNodeBandwidthRemote, String source) {
|
||||
return R.fail("获取95值列表失败:" + throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ package com.ruoyi.system.api.factory;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.system.api.RemoteRocketMqService;
|
||||
import com.ruoyi.system.api.domain.RmAlarmRecordRemote;
|
||||
import com.ruoyi.system.api.domain.RmDeployScriptRemote;
|
||||
import com.ruoyi.system.api.domain.RmMonitorPolicyRemote;
|
||||
import com.ruoyi.system.api.domain.RmNetworkInterfaceRemote;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
@@ -45,6 +48,41 @@ public class RemoteRocketMqFallbackFactory implements FallbackFactory<RemoteRock
|
||||
public R<Map> alarmHandlingStatus(String source) {
|
||||
return R.fail(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<List<RmNetworkInterfaceRemote>> getNetworkInterfaceList(RmNetworkInterfaceRemote rmNetworkInterfaceRemote, String source) {
|
||||
return R.fail(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Integer> bindPublicIp(RmNetworkInterfaceRemote rmNetworkInterfaceRemote, String source) {
|
||||
return R.fail(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<String> innerIssueSwitchPolicy(Long id, String source) {
|
||||
return R.fail(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<List<RmMonitorPolicyRemote>> getPolicyMsgInner(RmMonitorPolicyRemote rmMonitorPolicyRemote, String source) {
|
||||
return R.fail(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Integer> updatePolicyMsgInner(RmMonitorPolicyRemote rmMonitorPolicyRemote, String source) {
|
||||
return R.fail(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Integer> issueDefaultPolicyByClientId(String clientId, String source) {
|
||||
return R.fail(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Integer> addDeployScript(RmDeployScriptRemote addData, String source) {
|
||||
return R.fail(throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,12 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor
|
||||
public enum MsgEnum {
|
||||
|
||||
多公网IP探测("NETWORK_DETECT"),
|
||||
|
||||
获取最新策略("GET_POLICY"),
|
||||
|
||||
获取最新策略应答("GET_POLICY_RSP"),
|
||||
|
||||
注册("REGISTER"),
|
||||
|
||||
注册应答("REGISTER_RSP"),
|
||||
|
||||
@@ -0,0 +1,240 @@
|
||||
package com.ruoyi.common.core.utils;
|
||||
|
||||
public class ConvertOtherTypeUtil {
|
||||
/**
|
||||
* 根据接口类型代码获取对应的类型名称
|
||||
* @param typeCode 接口类型代码 (1, 2, 3...)
|
||||
* @return 接口类型名称,如果未找到返回 "unknown"
|
||||
*/
|
||||
public static String getInterfaceTypeName(int typeCode) {
|
||||
switch (typeCode) {
|
||||
case 1: return "other";
|
||||
case 2: return "regular1822";
|
||||
case 3: return "hdh1822";
|
||||
case 4: return "ddnX25";
|
||||
case 5: return "rfc877x25";
|
||||
case 6: return "ethernetCsmacd";
|
||||
case 7: return "iso88023Csmacd";
|
||||
case 8: return "iso88024TokenBus";
|
||||
case 9: return "iso88025TokenRing";
|
||||
case 10: return "iso88026Man";
|
||||
case 11: return "starLan";
|
||||
case 12: return "proteon10Mbit";
|
||||
case 13: return "proteon80Mbit";
|
||||
case 14: return "hyperchannel";
|
||||
case 15: return "fddi";
|
||||
case 16: return "lapb";
|
||||
case 17: return "sdlc";
|
||||
case 18: return "ds1";
|
||||
case 19: return "e1";
|
||||
case 20: return "basicISDN";
|
||||
case 21: return "primaryISDN";
|
||||
case 22: return "propPointToPointSerial";
|
||||
case 23: return "ppp";
|
||||
case 24: return "softwareLoopback";
|
||||
case 25: return "eon";
|
||||
case 26: return "ethernet3Mbit";
|
||||
case 27: return "nsip";
|
||||
case 28: return "slip";
|
||||
case 29: return "ultra";
|
||||
case 30: return "ds3";
|
||||
case 31: return "sip";
|
||||
case 32: return "frameRelay";
|
||||
case 33: return "rs232";
|
||||
case 34: return "para";
|
||||
case 35: return "arcnet";
|
||||
case 36: return "arcnetPlus";
|
||||
case 37: return "atm";
|
||||
case 38: return "miox25";
|
||||
case 39: return "sonet";
|
||||
case 40: return "x25ple";
|
||||
case 41: return "iso88022llc";
|
||||
case 42: return "localTalk";
|
||||
case 43: return "smdsDxi";
|
||||
case 44: return "frameRelayService";
|
||||
case 45: return "v35";
|
||||
case 46: return "hssi";
|
||||
case 47: return "hippi";
|
||||
case 48: return "modem";
|
||||
case 49: return "aal5";
|
||||
case 50: return "sonetPath";
|
||||
case 51: return "sonetVT";
|
||||
case 52: return "smdsIcip";
|
||||
case 53: return "propVirtual";
|
||||
case 54: return "propMultiplexor";
|
||||
case 55: return "ieee80212";
|
||||
case 56: return "fibreChannel";
|
||||
case 57: return "hippiInterface";
|
||||
case 58: return "frameRelayInterconnect";
|
||||
case 59: return "aflane8023";
|
||||
case 60: return "aflane8025";
|
||||
case 61: return "cctEmul";
|
||||
case 62: return "fastEther";
|
||||
case 63: return "isdn";
|
||||
case 64: return "v11";
|
||||
case 65: return "v36";
|
||||
case 66: return "g703at64k";
|
||||
case 67: return "g703at2mb";
|
||||
case 68: return "qllc";
|
||||
case 69: return "fastEtherFX";
|
||||
case 70: return "channel";
|
||||
case 71: return "ieee80211";
|
||||
case 72: return "ibm370parChan";
|
||||
case 73: return "escon";
|
||||
case 74: return "dlsw";
|
||||
case 75: return "isdns";
|
||||
case 76: return "isdnu";
|
||||
case 77: return "lapd";
|
||||
case 78: return "ipSwitch";
|
||||
case 79: return "rsrb";
|
||||
case 80: return "atmLogical";
|
||||
case 81: return "ds0";
|
||||
case 82: return "ds0Bundle";
|
||||
case 83: return "bsc";
|
||||
case 84: return "async";
|
||||
case 85: return "cnr";
|
||||
case 86: return "iso88025Dtr";
|
||||
case 87: return "eplrs";
|
||||
case 88: return "arap";
|
||||
case 89: return "propCnls";
|
||||
case 90: return "hostPad";
|
||||
case 91: return "termPad";
|
||||
case 92: return "frameRelayMPI";
|
||||
case 93: return "x213";
|
||||
case 94: return "adsl";
|
||||
case 95: return "radsl";
|
||||
case 96: return "sdsl";
|
||||
case 97: return "vdsl";
|
||||
case 98: return "iso88025CRFPInt";
|
||||
case 99: return "myrinet";
|
||||
case 100: return "voiceEM";
|
||||
case 101: return "voiceFXO";
|
||||
case 102: return "voiceFXS";
|
||||
case 103: return "voiceEncap";
|
||||
case 104: return "voiceOverIp";
|
||||
case 105: return "atmDxi";
|
||||
case 106: return "atmFuni";
|
||||
case 107: return "atmIma";
|
||||
case 108: return "pppMultilinkBundle";
|
||||
case 109: return "ipOverCdlc";
|
||||
case 110: return "ipOverClaw";
|
||||
case 111: return "stackToStack";
|
||||
case 112: return "virtualIpAddress";
|
||||
case 113: return "mpc";
|
||||
case 114: return "ipOverAtm";
|
||||
case 115: return "iso88025Fiber";
|
||||
case 116: return "tdlc";
|
||||
case 117: return "gigabitEthernet";
|
||||
case 118: return "hdlc";
|
||||
case 119: return "lapf";
|
||||
case 120: return "v37";
|
||||
case 121: return "x25mlp";
|
||||
case 122: return "x25huntGroup";
|
||||
case 123: return "trasnpHdlc";
|
||||
case 124: return "interleave";
|
||||
case 125: return "fast";
|
||||
case 126: return "ip";
|
||||
case 127: return "docsCableMaclayer";
|
||||
case 128: return "docsCableDownstream";
|
||||
case 129: return "docsCableUpstream";
|
||||
case 130: return "a12MppSwitch";
|
||||
case 131: return "tunnel";
|
||||
case 132: return "coffee";
|
||||
case 133: return "ces";
|
||||
case 134: return "atmSubInterface";
|
||||
case 135: return "l2vlan";
|
||||
case 136: return "l3ipvlan";
|
||||
case 137: return "l3ipxvlan";
|
||||
case 138: return "digitalPowerline";
|
||||
case 139: return "mediaMailOverIp";
|
||||
case 140: return "dtm";
|
||||
case 141: return "dcn";
|
||||
case 142: return "ipForward";
|
||||
case 143: return "msdsl";
|
||||
case 144: return "ieee1394";
|
||||
case 145: return "if-gsn";
|
||||
case 146: return "dvbRccMacLayer";
|
||||
case 147: return "dvbRccDownstream";
|
||||
case 148: return "dvbRccUpstream";
|
||||
case 149: return "atmVirtual";
|
||||
case 150: return "mplsTunnel";
|
||||
case 151: return "srp";
|
||||
case 152: return "voiceOverAtm";
|
||||
case 153: return "voiceOverFrameRelay";
|
||||
case 154: return "idsl";
|
||||
case 155: return "compositeLink";
|
||||
case 156: return "ss7SigLink";
|
||||
case 157: return "propWirelessP2P";
|
||||
case 158: return "frForward";
|
||||
case 159: return "rfc1483";
|
||||
case 160: return "usb";
|
||||
case 161: return "ieee8023adLag";
|
||||
case 162: return "bgppolicyaccounting";
|
||||
case 163: return "frf16MfrBundle";
|
||||
case 164: return "h323Gatekeeper";
|
||||
case 165: return "h323Proxy";
|
||||
case 166: return "mpls";
|
||||
case 167: return "mfSigLink";
|
||||
case 168: return "hdsl2";
|
||||
case 169: return "shdsl";
|
||||
case 170: return "ds1FDL";
|
||||
case 171: return "pos";
|
||||
case 172: return "dvbAsiIn";
|
||||
case 173: return "dvbAsiOut";
|
||||
case 174: return "plc";
|
||||
case 175: return "nfas";
|
||||
case 176: return "tr008";
|
||||
case 177: return "gr303RDT";
|
||||
case 178: return "gr303IDT";
|
||||
case 179: return "isup";
|
||||
case 180: return "propDocsWirelessMaclayer";
|
||||
case 181: return "propDocsWirelessDownstream";
|
||||
case 182: return "propDocsWirelessUpstream";
|
||||
case 183: return "hiperlan2";
|
||||
case 184: return "propBWAp2Mp";
|
||||
case 185: return "sonetOverheadChannel";
|
||||
case 186: return "digitalWrapperOverheadChannel";
|
||||
case 187: return "aal2";
|
||||
case 188: return "radioMAC";
|
||||
case 189: return "atmRadio";
|
||||
case 190: return "imt";
|
||||
case 191: return "mvl";
|
||||
case 192: return "reachDSL";
|
||||
case 193: return "frDlciEndPt";
|
||||
case 194: return "atmVciEndPt";
|
||||
case 195: return "opticalChannel";
|
||||
case 196: return "opticalTransport";
|
||||
case 197: return "propAtm";
|
||||
case 198: return "voiceOverCable";
|
||||
case 199: return "infiniband";
|
||||
case 200: return "teLink";
|
||||
case 201: return "q2931";
|
||||
case 202: return "virtualTg";
|
||||
case 203: return "sipTg";
|
||||
case 204: return "sipSig";
|
||||
case 205: return "docsCableUpstreamChannel";
|
||||
case 206: return "econet";
|
||||
case 207: return "pon155";
|
||||
case 208: return "pon622";
|
||||
case 209: return "bridge";
|
||||
case 210: return "linegroup";
|
||||
case 211: return "voiceEMFGD";
|
||||
case 212: return "voiceFGDEANA";
|
||||
case 213: return "voiceDID";
|
||||
case 214: return "mpegTransport";
|
||||
case 215: return "sixToFour";
|
||||
case 216: return "gtp";
|
||||
case 217: return "pdnEtherLoop1";
|
||||
case 218: return "pdnEtherLoop2";
|
||||
case 219: return "opticalChannelGroup";
|
||||
case 220: return "homepna";
|
||||
case 221: return "gfp";
|
||||
case 222: return "ciscoISLvlan";
|
||||
case 223: return "actelisMetaLOOP";
|
||||
case 224: return "fcipLink";
|
||||
case 225: return "rpr";
|
||||
case 226: return "qam";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
package com.ruoyi.rocketmq.utils;
|
||||
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
package com.ruoyi.common.core.utils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
@@ -0,0 +1,383 @@
|
||||
package com.ruoyi.common.core.utils;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.List;
|
||||
|
||||
public class SpeedUtils {
|
||||
|
||||
public static class SpeedResult {
|
||||
private BigDecimal avgInSpeedGb; // 平均输入速度 (Gb)
|
||||
private BigDecimal avgOutSpeedGb; // 平均输出速度 (Gb)
|
||||
private BigDecimal maxInSpeedGb; // 最大输入速度 (Gb)
|
||||
private BigDecimal maxOutSpeedGb; // 最大输出速度 (Gb)
|
||||
private BigDecimal lastInSpeedGb; // 最后一个输入速度 (Gb)
|
||||
private BigDecimal lastOutSpeedGb;// 最后一个输出速度 (Gb)
|
||||
private String recommendedUnit; // 基于平均值推荐的单位
|
||||
|
||||
public SpeedResult(BigDecimal avgInSpeedGb, BigDecimal avgOutSpeedGb,
|
||||
BigDecimal maxInSpeedGb, BigDecimal maxOutSpeedGb,
|
||||
BigDecimal lastInSpeedGb, BigDecimal lastOutSpeedGb,
|
||||
String recommendedUnit) {
|
||||
this.avgInSpeedGb = avgInSpeedGb;
|
||||
this.avgOutSpeedGb = avgOutSpeedGb;
|
||||
this.maxInSpeedGb = maxInSpeedGb;
|
||||
this.maxOutSpeedGb = maxOutSpeedGb;
|
||||
this.lastInSpeedGb = lastInSpeedGb;
|
||||
this.lastOutSpeedGb = lastOutSpeedGb;
|
||||
this.recommendedUnit = recommendedUnit;
|
||||
}
|
||||
|
||||
// Getters
|
||||
public BigDecimal getAvgInSpeedGb() { return avgInSpeedGb; }
|
||||
public BigDecimal getAvgOutSpeedGb() { return avgOutSpeedGb; }
|
||||
public BigDecimal getMaxInSpeedGb() { return maxInSpeedGb; }
|
||||
public BigDecimal getMaxOutSpeedGb() { return maxOutSpeedGb; }
|
||||
public BigDecimal getLastInSpeedGb() { return lastInSpeedGb; }
|
||||
public BigDecimal getLastOutSpeedGb() { return lastOutSpeedGb; }
|
||||
public String getRecommendedUnit() { return recommendedUnit; }
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format(
|
||||
"平均输入速度: %s Gb, 平均输出速度: %s Gb\n" +
|
||||
"最大输入速度: %s Gb, 最大输出速度: %s Gb\n" +
|
||||
"最后输入速度: %s Gb, 最后输出速度: %s Gb\n" +
|
||||
"推荐单位(基于平均值): %s",
|
||||
avgInSpeedGb.setScale(2, RoundingMode.HALF_UP),
|
||||
avgOutSpeedGb.setScale(2, RoundingMode.HALF_UP),
|
||||
maxInSpeedGb.setScale(2, RoundingMode.HALF_UP),
|
||||
maxOutSpeedGb.setScale(2, RoundingMode.HALF_UP),
|
||||
lastInSpeedGb.setScale(2, RoundingMode.HALF_UP),
|
||||
lastOutSpeedGb.setScale(2, RoundingMode.HALF_UP),
|
||||
recommendedUnit
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static SpeedResult calculateWithAverageBasedUnit(List<?> list,
|
||||
String inSpeedField, String outSpeedField)
|
||||
throws NoSuchFieldException, IllegalAccessException {
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
return new SpeedResult(
|
||||
BigDecimal.ZERO, BigDecimal.ZERO,
|
||||
BigDecimal.ZERO, BigDecimal.ZERO,
|
||||
BigDecimal.ZERO, BigDecimal.ZERO,
|
||||
"bit"
|
||||
);
|
||||
}
|
||||
|
||||
BigDecimal totalInSpeedBit = BigDecimal.ZERO;
|
||||
BigDecimal totalOutSpeedBit = BigDecimal.ZERO;
|
||||
BigDecimal maxInSpeedGb = BigDecimal.ZERO;
|
||||
BigDecimal maxOutSpeedGb = BigDecimal.ZERO;
|
||||
BigDecimal lastInSpeedGb = BigDecimal.ZERO;
|
||||
BigDecimal lastOutSpeedGb = BigDecimal.ZERO;
|
||||
|
||||
final BigDecimal GB_DIVISOR = new BigDecimal("1000000000");
|
||||
|
||||
// 计算总和(bit)和Gb值
|
||||
for (Object obj : list) {
|
||||
try {
|
||||
java.lang.reflect.Field inField = obj.getClass().getDeclaredField(inSpeedField);
|
||||
java.lang.reflect.Field outField = obj.getClass().getDeclaredField(outSpeedField);
|
||||
|
||||
inField.setAccessible(true);
|
||||
outField.setAccessible(true);
|
||||
|
||||
BigDecimal inSpeedBit = (BigDecimal) inField.get(obj) == null ? BigDecimal.ZERO : (BigDecimal) inField.get(obj);
|
||||
BigDecimal outSpeedBit = (BigDecimal) outField.get(obj) == null ? BigDecimal.ZERO : (BigDecimal) outField.get(obj);
|
||||
|
||||
// 累加bit值(用于计算平均值)
|
||||
totalInSpeedBit = totalInSpeedBit.add(inSpeedBit);
|
||||
totalOutSpeedBit = totalOutSpeedBit.add(outSpeedBit);
|
||||
|
||||
// 转换为Gb并更新最大值
|
||||
BigDecimal inSpeedGb = inSpeedBit.divide(GB_DIVISOR, 0, RoundingMode.HALF_UP);
|
||||
BigDecimal outSpeedGb = outSpeedBit.divide(GB_DIVISOR, 0, RoundingMode.HALF_UP);
|
||||
|
||||
maxInSpeedGb = maxInSpeedGb.max(inSpeedGb);
|
||||
maxOutSpeedGb = maxOutSpeedGb.max(outSpeedGb);
|
||||
|
||||
// 记录最后一个值
|
||||
lastInSpeedGb = inSpeedGb;
|
||||
lastOutSpeedGb = outSpeedGb;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("无法获取速度字段值", e);
|
||||
}
|
||||
}
|
||||
|
||||
// 计算Gb平均值
|
||||
BigDecimal size = new BigDecimal(list.size());
|
||||
BigDecimal avgInSpeedGb = totalInSpeedBit.divide(GB_DIVISOR, 0, RoundingMode.HALF_UP)
|
||||
.divide(size, 2, RoundingMode.HALF_UP);
|
||||
BigDecimal avgOutSpeedGb = totalOutSpeedBit.divide(GB_DIVISOR, 0, RoundingMode.HALF_UP)
|
||||
.divide(size, 2, RoundingMode.HALF_UP);
|
||||
|
||||
// 基于平均值的较大值确定推荐单位
|
||||
BigDecimal maxAvgBit = avgInSpeedGb.compareTo(avgOutSpeedGb) > 0 ?
|
||||
avgInSpeedGb.multiply(GB_DIVISOR) :
|
||||
avgOutSpeedGb.multiply(GB_DIVISOR);
|
||||
|
||||
String recommendedUnit;
|
||||
if (maxAvgBit.compareTo(new BigDecimal("1000000000")) >= 0) {
|
||||
recommendedUnit = "Gb";
|
||||
} else if (maxAvgBit.compareTo(new BigDecimal("1000000")) >= 0) {
|
||||
recommendedUnit = "Mb";
|
||||
} else{
|
||||
recommendedUnit = "Kb";
|
||||
}
|
||||
|
||||
return new SpeedResult(
|
||||
avgInSpeedGb, avgOutSpeedGb,
|
||||
maxInSpeedGb, maxOutSpeedGb,
|
||||
lastInSpeedGb, lastOutSpeedGb,
|
||||
recommendedUnit
|
||||
);
|
||||
}
|
||||
// 工具方法:获取单位换算除数
|
||||
public static BigDecimal getDivisor(String unit) {
|
||||
switch (unit) {
|
||||
case "Gb": return new BigDecimal("1000000000");
|
||||
case "Mb": return new BigDecimal("1000000");
|
||||
case "Kb": return new BigDecimal("1000");
|
||||
default: return BigDecimal.ONE; // bit
|
||||
}
|
||||
}
|
||||
public static String calculateUnit(List<?> list,
|
||||
String inSpeedField, String outSpeedField)
|
||||
throws NoSuchFieldException, IllegalAccessException {
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
BigDecimal totalInSpeedBit = BigDecimal.ZERO;
|
||||
BigDecimal totalOutSpeedBit = BigDecimal.ZERO;
|
||||
BigDecimal maxInSpeedGb = BigDecimal.ZERO;
|
||||
BigDecimal maxOutSpeedGb = BigDecimal.ZERO;
|
||||
BigDecimal lastInSpeedGb = BigDecimal.ZERO;
|
||||
BigDecimal lastOutSpeedGb = BigDecimal.ZERO;
|
||||
|
||||
final BigDecimal GB_DIVISOR = new BigDecimal("1000000000");
|
||||
|
||||
// 计算总和(bit)和Gb值
|
||||
for (Object obj : list) {
|
||||
try {
|
||||
java.lang.reflect.Field inField = obj.getClass().getDeclaredField(inSpeedField);
|
||||
java.lang.reflect.Field outField = obj.getClass().getDeclaredField(outSpeedField);
|
||||
|
||||
inField.setAccessible(true);
|
||||
outField.setAccessible(true);
|
||||
|
||||
BigDecimal inSpeedBit = (BigDecimal) inField.get(obj) == null ? BigDecimal.ZERO : (BigDecimal) inField.get(obj);
|
||||
BigDecimal outSpeedBit = (BigDecimal) outField.get(obj) == null ? BigDecimal.ZERO : (BigDecimal) outField.get(obj);
|
||||
|
||||
// 累加bit值(用于计算平均值)
|
||||
totalInSpeedBit = totalInSpeedBit.add(inSpeedBit);
|
||||
totalOutSpeedBit = totalOutSpeedBit.add(outSpeedBit);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("无法获取速度字段值", e);
|
||||
}
|
||||
}
|
||||
|
||||
// 计算Gb平均值
|
||||
BigDecimal size = new BigDecimal(list.size());
|
||||
BigDecimal avgInSpeedGb = totalInSpeedBit.divide(size, 2, RoundingMode.HALF_UP);
|
||||
BigDecimal avgOutSpeedGb = totalOutSpeedBit.divide(size, 2, RoundingMode.HALF_UP);
|
||||
|
||||
// 基于平均值的较大值确定推荐单位
|
||||
BigDecimal maxAvgBit = avgInSpeedGb.compareTo(avgOutSpeedGb) > 0 ?
|
||||
avgInSpeedGb : avgOutSpeedGb;
|
||||
|
||||
String recommendedUnit;
|
||||
if (maxAvgBit.compareTo(new BigDecimal("1000000000")) >= 0) {
|
||||
recommendedUnit = "Gb";
|
||||
} else if (maxAvgBit.compareTo(new BigDecimal("1000000")) >= 0) {
|
||||
recommendedUnit = "Mb";
|
||||
} else{
|
||||
recommendedUnit = "Kb";
|
||||
}
|
||||
|
||||
return recommendedUnit;
|
||||
}
|
||||
/**
|
||||
* 计算String类型(存储数字)的速度统计结果
|
||||
* @param list 数据列表
|
||||
* @param inSpeedField 输入速度字段名
|
||||
* @param outSpeedField 输出速度字段名
|
||||
* @return SpeedResult 速度统计结果
|
||||
*/
|
||||
public static SpeedResult calculateWithStringTraffic(List<?> list,
|
||||
String inSpeedField, String outSpeedField)
|
||||
throws NoSuchFieldException, IllegalAccessException {
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
return new SpeedResult(
|
||||
BigDecimal.ZERO, BigDecimal.ZERO,
|
||||
BigDecimal.ZERO, BigDecimal.ZERO,
|
||||
BigDecimal.ZERO, BigDecimal.ZERO,
|
||||
"bit"
|
||||
);
|
||||
}
|
||||
|
||||
BigDecimal totalInSpeedBit = BigDecimal.ZERO;
|
||||
BigDecimal totalOutSpeedBit = BigDecimal.ZERO;
|
||||
BigDecimal maxInSpeedGb = BigDecimal.ZERO;
|
||||
BigDecimal maxOutSpeedGb = BigDecimal.ZERO;
|
||||
BigDecimal lastInSpeedGb = BigDecimal.ZERO;
|
||||
BigDecimal lastOutSpeedGb = BigDecimal.ZERO;
|
||||
|
||||
final BigDecimal GB_DIVISOR = new BigDecimal("1000000000");
|
||||
|
||||
// 计算总和(bit)和Gb值
|
||||
for (Object obj : list) {
|
||||
try {
|
||||
java.lang.reflect.Field inField = obj.getClass().getDeclaredField(inSpeedField);
|
||||
java.lang.reflect.Field outField = obj.getClass().getDeclaredField(outSpeedField);
|
||||
|
||||
inField.setAccessible(true);
|
||||
outField.setAccessible(true);
|
||||
|
||||
// 处理String类型的数字值
|
||||
String inSpeedStr = (String) inField.get(obj);
|
||||
String outSpeedStr = (String) outField.get(obj);
|
||||
|
||||
BigDecimal inSpeedBit = convertStringToBigDecimal(inSpeedStr);
|
||||
BigDecimal outSpeedBit = convertStringToBigDecimal(outSpeedStr);
|
||||
|
||||
// 累加bit值(用于计算平均值)
|
||||
totalInSpeedBit = totalInSpeedBit.add(inSpeedBit);
|
||||
totalOutSpeedBit = totalOutSpeedBit.add(outSpeedBit);
|
||||
|
||||
// 转换为Gb并更新最大值
|
||||
BigDecimal inSpeedGb = inSpeedBit.divide(GB_DIVISOR, 2, RoundingMode.HALF_UP);
|
||||
BigDecimal outSpeedGb = outSpeedBit.divide(GB_DIVISOR, 2, RoundingMode.HALF_UP);
|
||||
|
||||
maxInSpeedGb = maxInSpeedGb.max(inSpeedGb);
|
||||
maxOutSpeedGb = maxOutSpeedGb.max(outSpeedGb);
|
||||
|
||||
// 记录最后一个值
|
||||
lastInSpeedGb = inSpeedGb;
|
||||
lastOutSpeedGb = outSpeedGb;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("无法获取或转换速度字段值", e);
|
||||
}
|
||||
}
|
||||
|
||||
// 计算Gb平均值
|
||||
BigDecimal size = new BigDecimal(list.size());
|
||||
BigDecimal avgInSpeedGb = totalInSpeedBit.divide(GB_DIVISOR, 2, RoundingMode.HALF_UP)
|
||||
.divide(size, 2, RoundingMode.HALF_UP);
|
||||
BigDecimal avgOutSpeedGb = totalOutSpeedBit.divide(GB_DIVISOR, 2, RoundingMode.HALF_UP)
|
||||
.divide(size, 2, RoundingMode.HALF_UP);
|
||||
|
||||
// 基于平均值的较大值确定推荐单位
|
||||
BigDecimal maxAvgBit = avgInSpeedGb.compareTo(avgOutSpeedGb) > 0 ?
|
||||
avgInSpeedGb.multiply(GB_DIVISOR) :
|
||||
avgOutSpeedGb.multiply(GB_DIVISOR);
|
||||
|
||||
String recommendedUnit;
|
||||
if (maxAvgBit.compareTo(new BigDecimal("1000000000")) >= 0) {
|
||||
recommendedUnit = "Gb";
|
||||
} else if (maxAvgBit.compareTo(new BigDecimal("1000000")) >= 0) {
|
||||
recommendedUnit = "Mb";
|
||||
} else {
|
||||
recommendedUnit = "Kb";
|
||||
}
|
||||
|
||||
return new SpeedResult(
|
||||
avgInSpeedGb, avgOutSpeedGb,
|
||||
maxInSpeedGb, maxOutSpeedGb,
|
||||
lastInSpeedGb, lastOutSpeedGb,
|
||||
recommendedUnit
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将String类型的数字转换为BigDecimal
|
||||
* @param numberStr 数字字符串
|
||||
* @return BigDecimal值,转换失败返回0
|
||||
*/
|
||||
private static BigDecimal convertStringToBigDecimal(String numberStr) {
|
||||
if (numberStr == null || numberStr.trim().isEmpty()) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
try {
|
||||
return new BigDecimal(numberStr.trim());
|
||||
} catch (Exception e) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 仅计算String类型(存储数字)的推荐单位
|
||||
* @param list 数据列表
|
||||
* @param inSpeedField 输入速度字段名
|
||||
* @param outSpeedField 输出速度字段名
|
||||
* @return 推荐单位
|
||||
*/
|
||||
public static String calculateUnitWithStringTraffic(List<?> list,
|
||||
String inSpeedField, String outSpeedField)
|
||||
throws NoSuchFieldException, IllegalAccessException {
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
BigDecimal totalInSpeedBit = BigDecimal.ZERO;
|
||||
BigDecimal totalOutSpeedBit = BigDecimal.ZERO;
|
||||
|
||||
// 计算总和(bit)
|
||||
for (Object obj : list) {
|
||||
try {
|
||||
java.lang.reflect.Field inField = obj.getClass().getDeclaredField(inSpeedField);
|
||||
java.lang.reflect.Field outField = obj.getClass().getDeclaredField(outSpeedField);
|
||||
|
||||
inField.setAccessible(true);
|
||||
outField.setAccessible(true);
|
||||
|
||||
// 处理String类型的数字值
|
||||
String inSpeedStr = (String) inField.get(obj);
|
||||
String outSpeedStr = (String) outField.get(obj);
|
||||
|
||||
BigDecimal inSpeedBit = convertStringToBigDecimal(inSpeedStr);
|
||||
BigDecimal outSpeedBit = convertStringToBigDecimal(outSpeedStr);
|
||||
|
||||
totalInSpeedBit = totalInSpeedBit.add(inSpeedBit);
|
||||
totalOutSpeedBit = totalOutSpeedBit.add(outSpeedBit);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("无法获取或转换速度字段值", e);
|
||||
}
|
||||
}
|
||||
|
||||
// 计算平均值
|
||||
BigDecimal size = new BigDecimal(list.size());
|
||||
BigDecimal avgInSpeedBit = totalInSpeedBit.divide(size, 2, RoundingMode.HALF_UP);
|
||||
BigDecimal avgOutSpeedBit = totalOutSpeedBit.divide(size, 2, RoundingMode.HALF_UP);
|
||||
|
||||
// 基于平均值的较大值确定推荐单位
|
||||
BigDecimal maxAvgBit = avgInSpeedBit.compareTo(avgOutSpeedBit) > 0 ?
|
||||
avgInSpeedBit : avgOutSpeedBit;
|
||||
|
||||
String recommendedUnit;
|
||||
if (maxAvgBit.compareTo(new BigDecimal("1000000000")) >= 0) {
|
||||
recommendedUnit = "Gb";
|
||||
} else if (maxAvgBit.compareTo(new BigDecimal("1000000")) >= 0) {
|
||||
recommendedUnit = "Mb";
|
||||
} else {
|
||||
recommendedUnit = "Kb";
|
||||
}
|
||||
|
||||
return recommendedUnit;
|
||||
}
|
||||
|
||||
// Mbit 转 Bit 换算:1 Mbit = 1,000,000 Bit
|
||||
public static BigDecimal mbitToBit(BigDecimal mbitValue) {
|
||||
if (mbitValue == null) return BigDecimal.ZERO;
|
||||
return mbitValue.multiply(new BigDecimal("1000000"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
package com.ruoyi.system.config;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.system.domain.EpsInitialTrafficData;
|
||||
import com.ruoyi.system.domain.RmRegistrationMachine;
|
||||
import com.ruoyi.system.service.EpsInitialTrafficDataService;
|
||||
import com.ruoyi.system.service.IRmRegistrationMachineService;
|
||||
import com.ruoyi.system.util.TableRouterUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URI;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@Component
|
||||
public class HmacScheduledTask {
|
||||
|
||||
private static final String MAC_NAME = "HmacSHA1";
|
||||
private static final String ENCODING = "UTF-8";
|
||||
|
||||
@Autowired
|
||||
private IRmRegistrationMachineService rmRegistrationMachineService;
|
||||
@Autowired
|
||||
private EpsInitialTrafficDataService epsInitialTrafficDataService;
|
||||
|
||||
|
||||
/**
|
||||
* 每小时执行一次,查询4小时前的数据
|
||||
* 例如:9:39执行时查询4:00-5:00的数据
|
||||
*/
|
||||
@Scheduled(cron = "0 0 * * * ?") // 每小时整点执行
|
||||
// 或者每5分钟执行一次:@Scheduled(cron = "0 */5 * * * ?")
|
||||
// @Scheduled(initialDelay = 5000, fixedDelay = Long.MAX_VALUE)
|
||||
public void executeHourlyTask() {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
try {
|
||||
System.out.println("开始执行定时任务,时间:" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
|
||||
// 计算时间范围:当前时间往前推4小时的整点时间段
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
// 计算查询的时间段(4小时前的整点小时)
|
||||
LocalDateTime queryBaseTime = now.minusHours(4);
|
||||
LocalDateTime startTime = queryBaseTime.withMinute(0).withSecond(0).withNano(0);
|
||||
LocalDateTime endTime = startTime.plusHours(1);
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
String startTimeStr = startTime.format(formatter);
|
||||
String endTimeStr = endTime.format(formatter);
|
||||
|
||||
System.out.println("查询时间范围:" + startTimeStr + " 至 " + endTimeStr);
|
||||
|
||||
long timestamp = System.currentTimeMillis();
|
||||
String plainText = "efea5f0218c84a24b9fdab3264de3da5" + timestamp + "/supplier/outer/dev/getFlow";
|
||||
String secretKey = getHmac(plainText, "91a73fd806ab2c005c13b4dc19130a884e909dea3f72d46e30266fe1a1f588d8");
|
||||
|
||||
// 设置请求头
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.set("Content-Type", "application/json");
|
||||
headers.set("TOKEN", "efea5f0218c84a24b9fdab3264de3da5");
|
||||
headers.set("secret-key", secretKey);
|
||||
headers.set("timestamps", String.valueOf(timestamp));
|
||||
// 查询绑定的machinecode
|
||||
List<RmRegistrationMachine> machineList = rmRegistrationMachineService.selectRmRegistrationMachineList(new RmRegistrationMachine());
|
||||
for (RmRegistrationMachine rmRegistrationMachine : machineList) {
|
||||
// 构建URL
|
||||
URI uri = UriComponentsBuilder
|
||||
.fromHttpUrl("https://ecscm-openapi.ksyun.com/supplier/outer/dev/getFlow")
|
||||
.queryParam("srmChannel", "1000121954")
|
||||
.queryParam("startTime", startTimeStr)
|
||||
.queryParam("endTime", endTimeStr)
|
||||
.queryParam("machineCode", rmRegistrationMachine.getMachineCode())
|
||||
.build()
|
||||
.toUri();
|
||||
|
||||
HttpEntity<String> entity = new HttpEntity<>(headers);
|
||||
|
||||
// GET 请求
|
||||
ResponseEntity<String> response = restTemplate.exchange(
|
||||
uri,
|
||||
HttpMethod.GET,
|
||||
entity,
|
||||
String.class
|
||||
);
|
||||
String result = response.getBody();
|
||||
// 保存流量数据
|
||||
parseAndProcessResponse(result, rmRegistrationMachine.getClientId());
|
||||
}
|
||||
System.out.println("定时任务执行完成");
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("定时任务执行失败:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 解析和处理API响应
|
||||
*/
|
||||
private void parseAndProcessResponse(String responseBody, String clientId) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
try {
|
||||
Map<String, Object> responseMap = objectMapper.readValue(responseBody, Map.class);
|
||||
|
||||
if (responseMap.get("code").equals(200)) {
|
||||
Map<String, Object> dataMap = (Map<String, Object>) responseMap.get("data");
|
||||
Integer total = (Integer) dataMap.get("total");
|
||||
List<Map<String, Object>> dataList = (List<Map<String, Object>>) dataMap.get("data");
|
||||
|
||||
System.out.println("成功获取数据,总记录数:" + total);
|
||||
|
||||
// 处理每条数据
|
||||
for (Map<String, Object> item : dataList) {
|
||||
processFlowData(item, clientId);
|
||||
}
|
||||
|
||||
} else {
|
||||
System.out.println("API返回错误:" + responseMap.get("msg"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("JSON解析失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理单条流量数据
|
||||
*/
|
||||
private void processFlowData(Map<String, Object> flowData, String clientId) {
|
||||
String time = (String) flowData.get("time");
|
||||
// 科学计数法转换为BigDecimal
|
||||
BigDecimal flow = Optional.ofNullable(flowData.get("flow"))
|
||||
.map(Object::toString)
|
||||
.map(str -> {
|
||||
try {
|
||||
return new BigDecimal(str);
|
||||
} catch (NumberFormatException e) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
})
|
||||
.orElse(BigDecimal.ZERO);
|
||||
// 字节转bit
|
||||
flow = flow.multiply(new BigDecimal(8));
|
||||
String flowPlain = flow.toPlainString();
|
||||
String deviceid = (String) flowData.get("deviceid");
|
||||
String ip = (String) flowData.get("ip");
|
||||
String province = (String) flowData.get("province");
|
||||
|
||||
System.out.println(String.format("时间:%s, 流量:%.2f, 设备:%s, IP:%s, 省份:%s",
|
||||
time, flow, deviceid, ip, province));
|
||||
|
||||
String tableName = TableRouterUtil.getTableName(TableRouterUtil.parseDateTime(time));
|
||||
EpsInitialTrafficData epsInitialTrafficData = new EpsInitialTrafficData();
|
||||
epsInitialTrafficData.setTableName(tableName);
|
||||
epsInitialTrafficData.setCreateTime(DateUtils.parseDate(time));
|
||||
epsInitialTrafficData.setClientId(clientId);
|
||||
epsInitialTrafficData.setMachineFlow(flowPlain);
|
||||
epsInitialTrafficDataService.updateMachineTraffic(epsInitialTrafficData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试方法:手动执行查询指定时间段
|
||||
*/
|
||||
public void manualExecuteForTimeRange(LocalDateTime start, LocalDateTime end) {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
try {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
String startTimeStr = start.format(formatter);
|
||||
String endTimeStr = end.format(formatter);
|
||||
|
||||
System.out.println("手动执行查询,时间范围:" + startTimeStr + " 至 " + endTimeStr);
|
||||
|
||||
long timestamp = System.currentTimeMillis();
|
||||
String plainText = "efea5f0218c84a24b9fdab3264de3da5" + timestamp + "/supplier/outer/dev/getFlow";
|
||||
String secretKey = getHmac(plainText, "91a73fd806ab2c005c13b4dc19130a884e909dea3f72d46e30266fe1a1f588d8");
|
||||
|
||||
// 设置请求头
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.set("Content-Type", "application/json");
|
||||
headers.set("TOKEN", "efea5f0218c84a24b9fdab3264de3da5");
|
||||
headers.set("secret-key", secretKey);
|
||||
headers.set("timestamps", String.valueOf(timestamp));
|
||||
|
||||
// 构建URL
|
||||
URI uri = UriComponentsBuilder
|
||||
.fromHttpUrl("https://ecscm-openapi.ksyun.com/supplier/outer/dev/getFlow")
|
||||
.queryParam("srmChannel", "1000121954")
|
||||
.queryParam("startTime", startTimeStr)
|
||||
.queryParam("endTime", endTimeStr)
|
||||
.build()
|
||||
.toUri();
|
||||
|
||||
HttpEntity<String> entity = new HttpEntity<>(headers);
|
||||
|
||||
// GET 请求
|
||||
ResponseEntity<String> response = restTemplate.exchange(
|
||||
uri,
|
||||
HttpMethod.GET,
|
||||
entity,
|
||||
String.class
|
||||
);
|
||||
|
||||
System.out.println("手动执行API响应结果:" + response.getBody());
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("手动执行失败:" + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* HMAC加密方法
|
||||
*/
|
||||
public static String getHmac(String plainText, String encryptKey) {
|
||||
try{
|
||||
byte[] dataKey = encryptKey.getBytes(ENCODING);
|
||||
byte[] dataValue = plainText.getBytes(ENCODING);
|
||||
SecretKey secretKey = new SecretKeySpec(dataKey, MAC_NAME);
|
||||
Mac mac = Mac.getInstance(MAC_NAME);
|
||||
mac.init(secretKey);
|
||||
byte[] bytes = mac.doFinal(dataValue);
|
||||
String rs = encodeHex(bytes, false);
|
||||
return rs;
|
||||
} catch (Exception e){
|
||||
throw new IllegalArgumentException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据转16进制编码
|
||||
*/
|
||||
public static String encodeHex(final byte[] data, final boolean toLowerCase) {
|
||||
final char[] DIGITS_LOWER = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
|
||||
final char[] DIGITS_UPPER = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
|
||||
final char[] toDigits = toLowerCase ? DIGITS_LOWER : DIGITS_UPPER;
|
||||
final int l = data.length;
|
||||
final char[] out = new char[l << 1];
|
||||
for (int i = 0, j = 0; i < l; i++) {
|
||||
out[j++] = toDigits[(0xF0 & data[i]) >>> 4];
|
||||
out[j++] = toDigits[0x0F & data[i]];
|
||||
}
|
||||
return new String(out);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.ruoyi.system.config;
|
||||
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.service.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -72,6 +71,26 @@ public class TableScheduleConfig {
|
||||
.thenRun(() -> executeWithLog("交换机带宽1024",
|
||||
() -> initialSwitchInfoDetailsService.calculateSwitch95BandwidthDaily(initialSwitchInfoDetails, dailyStartTime, dailyEndTime, "1024")));
|
||||
}
|
||||
// 每天5点04执行 计算金山95带宽值/日
|
||||
// @Scheduled(cron = "0 4 5 * * ?", zone = "Asia/Shanghai")
|
||||
public void calculateJinShan95() {
|
||||
// 获取昨天的日期范围(北京时间)
|
||||
LocalDate yesterday = LocalDate.now(ZoneId.of("Asia/Shanghai")).minusDays(1);
|
||||
String dailyStartTime = yesterday.atStartOfDay().format(TIME_FORMAT); // 00:00:00
|
||||
String dailyEndTime = yesterday.atTime(23, 59, 59).format(TIME_FORMAT); // 23:59:59
|
||||
// 日
|
||||
String dayOrMonth = "1";
|
||||
// 95带宽值/日
|
||||
EpsInitialTrafficData queryParam = new EpsInitialTrafficData();
|
||||
queryParam.setDayOrMonth(dayOrMonth);
|
||||
InitialSwitchInfoDetails initialSwitchInfoDetails = new InitialSwitchInfoDetails();
|
||||
initialSwitchInfoDetails.setDayOrMonth(dayOrMonth);
|
||||
// 顺序执行链
|
||||
CompletableFuture.runAsync(() -> executeWithLog("金山业务带宽1000",
|
||||
() -> epsInitialTrafficDataService.calculate95ByJinShan(queryParam, dailyStartTime, dailyEndTime, "1000")))
|
||||
.thenRun(() -> executeWithLog("金山业务带宽1024",
|
||||
() -> epsInitialTrafficDataService.calculate95ByJinShan(queryParam, dailyStartTime, dailyEndTime, "1024")));
|
||||
}
|
||||
|
||||
// 每月1号0点执行 计算95带宽值/月
|
||||
@Scheduled(cron = "0 3 0 1 * ?", zone = "Asia/Shanghai")
|
||||
@@ -168,96 +187,87 @@ public class TableScheduleConfig {
|
||||
* 处理单个服务器的平均带宽计算
|
||||
*/
|
||||
private void processServerAvgBandwidth(EpsNodeBandwidth epsNodeBandwidth, AllInterfaceName allInterfaceName, String calculationMode) {
|
||||
final String deviceSn = allInterfaceName.getDeviceSn();
|
||||
final String clientId = allInterfaceName.getClientId();
|
||||
|
||||
try {
|
||||
// 1. 设置基础设备信息
|
||||
epsNodeBandwidth.setHardwareSn(deviceSn);
|
||||
epsNodeBandwidth.setClientId(clientId);
|
||||
// 查询业务变更记录
|
||||
EpsMethodChangeRecord changeQuery = new EpsMethodChangeRecord();
|
||||
changeQuery.setClientId(clientId);
|
||||
changeQuery.setStartTime(epsNodeBandwidth.getStartTime());
|
||||
changeQuery.setEndTime(epsNodeBandwidth.getEndTime());
|
||||
|
||||
// 2. 查询服务器配置
|
||||
EpsServerRevenueConfig queryConfig = new EpsServerRevenueConfig();
|
||||
queryConfig.setHardwareSn(deviceSn);
|
||||
List<EpsServerRevenueConfig> configList = epsServerRevenueConfigService.selectEpsServerRevenueConfigList(queryConfig);
|
||||
EpsServerRevenueConfig serverConfig = configList.isEmpty() ? new EpsServerRevenueConfig() : configList.get(0);
|
||||
epsNodeBandwidth.setNodeName(serverConfig.getNodeName());
|
||||
List<EpsMethodChangeRecord> records = epsMethodChangeRecordService.selectEpsMethodChangeRecordList(changeQuery);
|
||||
|
||||
// 3. 检查是否需要处理业务变更
|
||||
boolean shouldProcessChange = serverConfig.getUpdateTime() != null
|
||||
&& epsNodeBandwidth.getStartTime() != null
|
||||
&& epsNodeBandwidth.getStartTime().length() >= 10
|
||||
&& "1".equals(serverConfig.getChanged())
|
||||
&& DateUtils.parseDateToStr("yyyy-MM", serverConfig.getUpdateTime())
|
||||
.equals(epsNodeBandwidth.getStartTime().substring(0, 7));
|
||||
// 按businessCode分组处理(修复null key问题)
|
||||
if (!records.isEmpty()) {
|
||||
Map<String, List<EpsMethodChangeRecord>> groupedRecords = records.stream()
|
||||
.filter(record -> record.getBusinessCode() != null) // 过滤掉businessCode为null的记录
|
||||
.collect(Collectors.groupingBy(EpsMethodChangeRecord::getBusinessCode));
|
||||
|
||||
// 4. 处理业务变更情况
|
||||
if (shouldProcessChange) {
|
||||
// 查询业务变更记录
|
||||
EpsMethodChangeRecord changeQuery = new EpsMethodChangeRecord();
|
||||
changeQuery.setHardwareSn(deviceSn);
|
||||
changeQuery.setStartTime(epsNodeBandwidth.getStartTime());
|
||||
changeQuery.setEndTime(epsNodeBandwidth.getEndTime());
|
||||
// 处理每个业务分组
|
||||
for (Map.Entry<String, List<EpsMethodChangeRecord>> entry : groupedRecords.entrySet()) {
|
||||
String businessCode = entry.getKey();
|
||||
// 取第一个有效业务名称(同businessCode的业务名称应该相同)
|
||||
String businessName = entry.getValue().stream()
|
||||
.filter(r -> r.getBusinessName() != null)
|
||||
.findFirst()
|
||||
.map(EpsMethodChangeRecord::getBusinessName)
|
||||
.orElse("未知业务");
|
||||
|
||||
List<EpsMethodChangeRecord> records = epsMethodChangeRecordService.selectEpsMethodChangeRecordList(changeQuery);
|
||||
// 创建业务带宽对象
|
||||
EpsNodeBandwidth bandwidthWithBiz = new EpsNodeBandwidth();
|
||||
bandwidthWithBiz.setClientId(clientId);
|
||||
bandwidthWithBiz.setCalculationMode(calculationMode);
|
||||
bandwidthWithBiz.setStartTime(epsNodeBandwidth.getStartTime());
|
||||
bandwidthWithBiz.setEndTime(epsNodeBandwidth.getEndTime());
|
||||
bandwidthWithBiz.setBusinessId(businessCode);
|
||||
bandwidthWithBiz.setBusinessName(businessName);
|
||||
bandwidthWithBiz.setResourceType("1");
|
||||
|
||||
// 按businessCode分组处理(修复null key问题)
|
||||
if (!records.isEmpty()) {
|
||||
Map<String, List<EpsMethodChangeRecord>> groupedRecords = records.stream()
|
||||
.filter(record -> record.getBusinessCode() != null) // 过滤掉businessCode为null的记录
|
||||
.collect(Collectors.groupingBy(EpsMethodChangeRecord::getBusinessCode));
|
||||
|
||||
// 处理每个业务分组
|
||||
for (Map.Entry<String, List<EpsMethodChangeRecord>> entry : groupedRecords.entrySet()) {
|
||||
String businessCode = entry.getKey();
|
||||
// 取第一个有效业务名称(同businessCode的业务名称应该相同)
|
||||
String businessName = entry.getValue().stream()
|
||||
.filter(r -> r.getBusinessName() != null)
|
||||
.findFirst()
|
||||
.map(EpsMethodChangeRecord::getBusinessName)
|
||||
.orElse("未知业务");
|
||||
|
||||
// 创建业务带宽对象
|
||||
EpsNodeBandwidth bandwidthWithBiz = new EpsNodeBandwidth();
|
||||
bandwidthWithBiz.setHardwareSn(deviceSn);
|
||||
bandwidthWithBiz.setCalculationMode(calculationMode);
|
||||
bandwidthWithBiz.setNodeName(serverConfig.getNodeName());
|
||||
bandwidthWithBiz.setStartTime(epsNodeBandwidth.getStartTime());
|
||||
bandwidthWithBiz.setEndTime(epsNodeBandwidth.getEndTime());
|
||||
bandwidthWithBiz.setBusinessId(businessCode);
|
||||
bandwidthWithBiz.setBusinessName(businessName);
|
||||
bandwidthWithBiz.setResourceType("1");
|
||||
|
||||
// 执行计算
|
||||
epsNodeBandwidthService.calculateAvg(bandwidthWithBiz);
|
||||
}
|
||||
|
||||
// 处理businessCode为null的记录(如果有)
|
||||
List<EpsMethodChangeRecord> nullBusinessRecords = records.stream()
|
||||
.filter(record -> record.getBusinessCode() == null)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!nullBusinessRecords.isEmpty()) {
|
||||
log.warn("服务器 {} 有 {} 条记录的businessCode为null", deviceSn, nullBusinessRecords.size());
|
||||
// 可以选择记录日志或进行其他处理
|
||||
}
|
||||
|
||||
return; // 业务变更处理完成后直接返回
|
||||
// 执行计算
|
||||
epsNodeBandwidthService.calculateAvg(bandwidthWithBiz);
|
||||
}
|
||||
}
|
||||
|
||||
// 处理businessCode为null的记录(如果有)
|
||||
List<EpsMethodChangeRecord> nullBusinessRecords = records.stream()
|
||||
.filter(record -> record.getBusinessCode() == null)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!nullBusinessRecords.isEmpty()) {
|
||||
log.warn("服务器 {} 有 {} 条记录的businessCode为null", clientId, nullBusinessRecords.size());
|
||||
// 可以选择记录日志或进行其他处理
|
||||
}
|
||||
|
||||
return; // 业务变更处理完成后直接返回
|
||||
}
|
||||
String businessCode = null;
|
||||
String businessName = null;
|
||||
// 查询绑定的业务
|
||||
EpsMethodChangeRecord queryParam = new EpsMethodChangeRecord();
|
||||
queryParam.setClientId(clientId);
|
||||
List<EpsMethodChangeRecord> recordList = epsMethodChangeRecordService.selectEpsMethodChangeRecordList(queryParam);
|
||||
if(!recordList.isEmpty()){
|
||||
EpsMethodChangeRecord record = recordList.stream()
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
businessCode = record.getBusinessCode();
|
||||
businessName = record.getBusinessName();
|
||||
}
|
||||
// 5. 处理正常情况(无业务变更或无需处理变更)
|
||||
EpsNodeBandwidth normalBandwidth = new EpsNodeBandwidth();
|
||||
normalBandwidth.setHardwareSn(deviceSn);
|
||||
normalBandwidth.setClientId(clientId);
|
||||
normalBandwidth.setCalculationMode(calculationMode);
|
||||
normalBandwidth.setNodeName(serverConfig.getNodeName());
|
||||
normalBandwidth.setStartTime(epsNodeBandwidth.getStartTime());
|
||||
normalBandwidth.setEndTime(epsNodeBandwidth.getEndTime());
|
||||
normalBandwidth.setBusinessId(serverConfig.getBusinessCode());
|
||||
normalBandwidth.setBusinessName(serverConfig.getBusinessName());
|
||||
normalBandwidth.setBusinessId(businessCode);
|
||||
normalBandwidth.setBusinessName(businessName);
|
||||
normalBandwidth.setResourceType("1");
|
||||
epsNodeBandwidthService.calculateAvg(normalBandwidth);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("处理服务器 {} 平均带宽失败", deviceSn, e);
|
||||
log.error("处理服务器 {} 平均带宽失败", clientId, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,131 +295,128 @@ public class TableScheduleConfig {
|
||||
* 处理单个交换机的平均带宽计算
|
||||
*/
|
||||
private void processSwitchAvgBandwidth(EpsNodeBandwidth epsNodeBandwidth, AllInterfaceName switchSnMsg, String calculationMode) {
|
||||
final String switchSn = switchSnMsg.getSwitchSn();
|
||||
final String clientId = switchSnMsg.getClientId();
|
||||
|
||||
try {
|
||||
// 1. 查询交换机拓扑信息
|
||||
RmEpsTopologyManagement managementQuery = new RmEpsTopologyManagement();
|
||||
managementQuery.setSwitchSn(switchSn);
|
||||
managementQuery.setClientId(clientId);
|
||||
List<RmEpsTopologyManagement> topologyList = rmEpsTopologyManagementService.selectRmEpsTopologyManagementList(managementQuery);
|
||||
if(!topologyList.isEmpty()){
|
||||
for (RmEpsTopologyManagement topology : topologyList) {
|
||||
epsNodeBandwidth.setClientId(clientId);
|
||||
epsNodeBandwidth.setInterfaceName(topology.getInterfaceName());
|
||||
|
||||
// 2. 设置基础信息
|
||||
RmEpsTopologyManagement topology = topologyList.isEmpty() ? new RmEpsTopologyManagement() : topologyList.get(0);
|
||||
epsNodeBandwidth.setSwitchSn(switchSn);
|
||||
epsNodeBandwidth.setInterfaceName(topology.getInterfaceName());
|
||||
// 3. 判断连接设备类型
|
||||
boolean isServerConnected = "1".equals(topology.getConnectedDeviceType());
|
||||
|
||||
// 3. 判断连接设备类型
|
||||
boolean isServerConnected = "1".equals(topology.getConnectedDeviceType());
|
||||
// 4. 处理服务器连接的情况
|
||||
if (isServerConnected && topology.getServerClientId() != null) {
|
||||
String serverClientId = topology.getServerClientId();
|
||||
String serverSn = topology.getServerSn();
|
||||
// 查询业务变更记录
|
||||
EpsMethodChangeRecord changeQuery = new EpsMethodChangeRecord();
|
||||
changeQuery.setClientId(serverClientId);
|
||||
changeQuery.setStartTime(epsNodeBandwidth.getStartTime());
|
||||
changeQuery.setEndTime(epsNodeBandwidth.getEndTime());
|
||||
List<EpsMethodChangeRecord> records = epsMethodChangeRecordService.selectEpsMethodChangeRecordList(changeQuery);
|
||||
|
||||
// 4. 处理服务器连接的情况
|
||||
if (isServerConnected && topology.getServerSn() != null) {
|
||||
String serverSn = topology.getServerSn();
|
||||
epsNodeBandwidth.setHardwareSn(serverSn);
|
||||
// 查询服务器配置
|
||||
EpsServerRevenueConfig queryConfig = new EpsServerRevenueConfig();
|
||||
queryConfig.setHardwareSn(serverSn);
|
||||
List<EpsServerRevenueConfig> configList = epsServerRevenueConfigService.selectEpsServerRevenueConfigList(queryConfig);
|
||||
EpsServerRevenueConfig serverConfig = configList.isEmpty() ? new EpsServerRevenueConfig() : configList.get(0);
|
||||
epsNodeBandwidth.setNodeName(serverConfig.getNodeName());
|
||||
// 按businessCode分组处理
|
||||
if (!records.isEmpty()) {
|
||||
Map<String, List<EpsMethodChangeRecord>> groupedRecords = records.stream()
|
||||
.filter(record -> record.getBusinessCode() != null) // 过滤掉businessCode为null的记录
|
||||
.collect(Collectors.groupingBy(EpsMethodChangeRecord::getBusinessCode));
|
||||
|
||||
// 检查是否需要处理业务变更
|
||||
boolean shouldProcessChange = serverConfig.getUpdateTime() != null
|
||||
&& epsNodeBandwidth.getStartTime() != null
|
||||
&& epsNodeBandwidth.getStartTime().length() >= 10
|
||||
&& "1".equals(serverConfig.getChanged())
|
||||
&& DateUtils.parseDateToStr("yyyy-MM", serverConfig.getUpdateTime())
|
||||
.equals(epsNodeBandwidth.getStartTime().substring(0, 7));
|
||||
// 处理每个业务分组
|
||||
for (Map.Entry<String, List<EpsMethodChangeRecord>> entry : groupedRecords.entrySet()) {
|
||||
String businessCode = entry.getKey();
|
||||
List<EpsMethodChangeRecord> businessRecords = entry.getValue();
|
||||
|
||||
if(shouldProcessChange){
|
||||
// 查询业务变更记录
|
||||
EpsMethodChangeRecord changeQuery = new EpsMethodChangeRecord();
|
||||
changeQuery.setHardwareSn(serverSn);
|
||||
changeQuery.setStartTime(epsNodeBandwidth.getStartTime());
|
||||
changeQuery.setEndTime(epsNodeBandwidth.getEndTime());
|
||||
// 取第一个有效业务名称
|
||||
String businessName = businessRecords.stream()
|
||||
.filter(r -> r.getBusinessName() != null)
|
||||
.findFirst()
|
||||
.map(EpsMethodChangeRecord::getBusinessName)
|
||||
.orElse("未知业务");
|
||||
|
||||
List<EpsMethodChangeRecord> records = epsMethodChangeRecordService.selectEpsMethodChangeRecordList(changeQuery);
|
||||
// 创建业务带宽对象
|
||||
EpsNodeBandwidth bandwidthWithBiz = new EpsNodeBandwidth();
|
||||
bandwidthWithBiz.setClientId(clientId);
|
||||
bandwidthWithBiz.setCalculationMode(calculationMode);
|
||||
bandwidthWithBiz.setInterfaceName(topology.getInterfaceName());
|
||||
bandwidthWithBiz.setHardwareSn(serverSn);
|
||||
bandwidthWithBiz.setUplinkSwitch(topology.getSwitchName());
|
||||
bandwidthWithBiz.setInterfaceLinkDeviceType(topology.getConnectedDeviceType());
|
||||
bandwidthWithBiz.setStartTime(epsNodeBandwidth.getStartTime());
|
||||
bandwidthWithBiz.setEndTime(epsNodeBandwidth.getEndTime());
|
||||
bandwidthWithBiz.setBusinessId(businessCode);
|
||||
bandwidthWithBiz.setBusinessName(businessName);
|
||||
bandwidthWithBiz.setResourceType("2");
|
||||
bandwidthWithBiz.setServerClientId(serverClientId);
|
||||
// 执行计算
|
||||
epsNodeBandwidthService.calculateAvg(bandwidthWithBiz);
|
||||
}
|
||||
|
||||
// 按businessCode分组处理
|
||||
if (!records.isEmpty()) {
|
||||
Map<String, List<EpsMethodChangeRecord>> groupedRecords = records.stream()
|
||||
.filter(record -> record.getBusinessCode() != null) // 过滤掉businessCode为null的记录
|
||||
.collect(Collectors.groupingBy(EpsMethodChangeRecord::getBusinessCode));
|
||||
// 处理businessCode为null的记录(如果有)
|
||||
List<EpsMethodChangeRecord> nullBusinessRecords = records.stream()
|
||||
.filter(record -> record.getBusinessCode() == null)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 处理每个业务分组
|
||||
for (Map.Entry<String, List<EpsMethodChangeRecord>> entry : groupedRecords.entrySet()) {
|
||||
String businessCode = entry.getKey();
|
||||
List<EpsMethodChangeRecord> businessRecords = entry.getValue();
|
||||
if (!nullBusinessRecords.isEmpty()) {
|
||||
log.warn("交换机 {} 有 {} 条记录的businessCode为null", clientId, nullBusinessRecords.size());
|
||||
// 可以选择记录日志或进行其他处理
|
||||
}
|
||||
|
||||
// 取第一个有效业务名称
|
||||
String businessName = businessRecords.stream()
|
||||
.filter(r -> r.getBusinessName() != null)
|
||||
.findFirst()
|
||||
.map(EpsMethodChangeRecord::getBusinessName)
|
||||
.orElse("未知业务");
|
||||
|
||||
// 创建业务带宽对象
|
||||
EpsNodeBandwidth bandwidthWithBiz = new EpsNodeBandwidth();
|
||||
bandwidthWithBiz.setSwitchSn(switchSn);
|
||||
bandwidthWithBiz.setCalculationMode(calculationMode);
|
||||
bandwidthWithBiz.setInterfaceName(topology.getInterfaceName());
|
||||
bandwidthWithBiz.setHardwareSn(serverSn);
|
||||
bandwidthWithBiz.setNodeName(topology.getServerName());
|
||||
bandwidthWithBiz.setUplinkSwitch(topology.getSwitchName());
|
||||
bandwidthWithBiz.setInterfaceLinkDeviceType(topology.getConnectedDeviceType());
|
||||
bandwidthWithBiz.setStartTime(epsNodeBandwidth.getStartTime());
|
||||
bandwidthWithBiz.setEndTime(epsNodeBandwidth.getEndTime());
|
||||
bandwidthWithBiz.setBusinessId(businessCode);
|
||||
bandwidthWithBiz.setBusinessName(businessName);
|
||||
bandwidthWithBiz.setResourceType("2");
|
||||
|
||||
// 执行计算
|
||||
epsNodeBandwidthService.calculateAvg(bandwidthWithBiz);
|
||||
return; // 业务变更处理完成后直接返回
|
||||
}else{
|
||||
String businessCode = null;
|
||||
String businessName = null;
|
||||
// 查询绑定的业务
|
||||
EpsMethodChangeRecord queryParam = new EpsMethodChangeRecord();
|
||||
queryParam.setClientId(clientId);
|
||||
queryParam.setTrafficPort(topology.getServerPort());
|
||||
List<EpsMethodChangeRecord> recordList = epsMethodChangeRecordService.selectEpsMethodChangeRecordList(queryParam);
|
||||
if(!recordList.isEmpty()){
|
||||
EpsMethodChangeRecord record = recordList.stream()
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
businessCode = record.getBusinessCode();
|
||||
businessName = record.getBusinessName();
|
||||
}
|
||||
// 5. 处理普通情况(无变更记录)
|
||||
EpsNodeBandwidth normalBandwidth = new EpsNodeBandwidth();
|
||||
normalBandwidth.setClientId(clientId);
|
||||
normalBandwidth.setBusinessId(businessCode);
|
||||
normalBandwidth.setBusinessName(businessName);
|
||||
normalBandwidth.setCalculationMode(calculationMode);
|
||||
normalBandwidth.setInterfaceName(topology.getInterfaceName());
|
||||
normalBandwidth.setHardwareSn(topology.getServerSn());
|
||||
normalBandwidth.setUplinkSwitch(topology.getSwitchName());
|
||||
normalBandwidth.setInterfaceLinkDeviceType(topology.getConnectedDeviceType());
|
||||
normalBandwidth.setStartTime(epsNodeBandwidth.getStartTime());
|
||||
normalBandwidth.setEndTime(epsNodeBandwidth.getEndTime());
|
||||
normalBandwidth.setResourceType("2");
|
||||
normalBandwidth.setServerClientId(serverClientId);
|
||||
epsNodeBandwidthService.calculateAvg(normalBandwidth);
|
||||
return;
|
||||
}
|
||||
|
||||
// 处理businessCode为null的记录(如果有)
|
||||
List<EpsMethodChangeRecord> nullBusinessRecords = records.stream()
|
||||
.filter(record -> record.getBusinessCode() == null)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!nullBusinessRecords.isEmpty()) {
|
||||
log.warn("交换机 {} 有 {} 条记录的businessCode为null", switchSn, nullBusinessRecords.size());
|
||||
// 可以选择记录日志或进行其他处理
|
||||
}
|
||||
|
||||
return; // 业务变更处理完成后直接返回
|
||||
}
|
||||
}else{
|
||||
// 5. 处理普通情况(无变更记录)
|
||||
// 5. 处理机房出口情况
|
||||
EpsNodeBandwidth normalBandwidth = new EpsNodeBandwidth();
|
||||
normalBandwidth.setSwitchSn(switchSn);
|
||||
normalBandwidth.setClientId(clientId);
|
||||
normalBandwidth.setCalculationMode(calculationMode);
|
||||
normalBandwidth.setInterfaceName(topology.getInterfaceName());
|
||||
normalBandwidth.setHardwareSn(topology.getServerSn());
|
||||
normalBandwidth.setNodeName(topology.getServerName());
|
||||
normalBandwidth.setUplinkSwitch(topology.getSwitchName());
|
||||
normalBandwidth.setInterfaceLinkDeviceType(topology.getConnectedDeviceType());
|
||||
normalBandwidth.setStartTime(epsNodeBandwidth.getStartTime());
|
||||
normalBandwidth.setEndTime(epsNodeBandwidth.getEndTime());
|
||||
normalBandwidth.setBusinessId(serverConfig.getBusinessCode());
|
||||
normalBandwidth.setBusinessName(serverConfig.getBusinessName());
|
||||
normalBandwidth.setResourceType("2");
|
||||
epsNodeBandwidthService.calculateAvg(normalBandwidth);
|
||||
}
|
||||
}else{
|
||||
log.warn("未检测到拓扑配置,交换机clientId:{}", clientId);
|
||||
}
|
||||
|
||||
// 5. 处理机房出口情况
|
||||
EpsNodeBandwidth normalBandwidth = new EpsNodeBandwidth();
|
||||
normalBandwidth.setSwitchSn(switchSn);
|
||||
normalBandwidth.setCalculationMode(calculationMode);
|
||||
normalBandwidth.setInterfaceName(topology.getInterfaceName());
|
||||
normalBandwidth.setInterfaceLinkDeviceType(topology.getConnectedDeviceType());
|
||||
normalBandwidth.setStartTime(epsNodeBandwidth.getStartTime());
|
||||
normalBandwidth.setEndTime(epsNodeBandwidth.getEndTime());
|
||||
normalBandwidth.setResourceType("2");
|
||||
epsNodeBandwidthService.calculateAvg(normalBandwidth);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("处理交换机 {} 平均带宽失败", switchSn, e);
|
||||
log.error("处理交换机 {} 平均带宽失败", clientId, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
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.EpsBusinessDeploy;
|
||||
import com.ruoyi.system.service.IEpsBusinessDeployService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 业务下发管理Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/businessDeploy")
|
||||
public class EpsBusinessDeployController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IEpsBusinessDeployService epsBusinessDeployService;
|
||||
|
||||
/**
|
||||
* 查询业务下发管理列表
|
||||
*/
|
||||
@RequiresPermissions("system:businessDeploy:list")
|
||||
@PostMapping("/list")
|
||||
public TableDataInfo list(@RequestBody EpsBusinessDeploy epsBusinessDeploy)
|
||||
{
|
||||
PageDomain pageDomain = new PageDomain();
|
||||
pageDomain.setPageNum(epsBusinessDeploy.getPageNum());
|
||||
pageDomain.setPageSize(epsBusinessDeploy.getPageSize());
|
||||
startPage(pageDomain);
|
||||
List<EpsBusinessDeploy> list = epsBusinessDeployService.selectEpsBusinessDeployList(epsBusinessDeploy);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取业务下发管理详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:businessDeploy:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(epsBusinessDeployService.selectEpsBusinessDeployById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增业务下发管理
|
||||
*/
|
||||
@RequiresPermissions("system:businessDeploy:add")
|
||||
@Log(title = "业务下发管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EpsBusinessDeploy epsBusinessDeploy)
|
||||
{
|
||||
return toAjax(epsBusinessDeployService.insertEpsBusinessDeploy(epsBusinessDeploy));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改业务下发管理
|
||||
*/
|
||||
@RequiresPermissions("system:businessDeploy:edit")
|
||||
@Log(title = "业务下发管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EpsBusinessDeploy epsBusinessDeploy)
|
||||
{
|
||||
return toAjax(epsBusinessDeployService.updateEpsBusinessDeploy(epsBusinessDeploy));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除业务下发管理
|
||||
*/
|
||||
@RequiresPermissions("system:businessDeploy:remove")
|
||||
@Log(title = "业务下发管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(epsBusinessDeployService.deleteEpsBusinessDeployByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核
|
||||
* @param epsBusinessDeploy
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:businessDeploy:review")
|
||||
@PostMapping("/reviewBusiness")
|
||||
public AjaxResult reviewBusiness(@RequestBody EpsBusinessDeploy epsBusinessDeploy){
|
||||
return toAjax(epsBusinessDeployService.reviewBusiness(epsBusinessDeploy));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
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.EpsBusinessScript;
|
||||
import com.ruoyi.system.service.IEpsBusinessScriptService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 业务脚本管理Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/businessScript")
|
||||
public class EpsBusinessScriptController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IEpsBusinessScriptService epsBusinessScriptService;
|
||||
|
||||
/**
|
||||
* 查询业务脚本管理列表
|
||||
*/
|
||||
@RequiresPermissions("system:businessScript:list")
|
||||
@PostMapping("/list")
|
||||
public TableDataInfo list(@RequestBody EpsBusinessScript epsBusinessScript)
|
||||
{
|
||||
PageDomain pageDomain = new PageDomain();
|
||||
pageDomain.setPageNum(epsBusinessScript.getPageNum());
|
||||
pageDomain.setPageSize(epsBusinessScript.getPageSize());
|
||||
startPage(pageDomain);
|
||||
List<EpsBusinessScript> list = epsBusinessScriptService.selectEpsBusinessScriptList(epsBusinessScript);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取业务脚本管理详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:businessScript:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(epsBusinessScriptService.selectEpsBusinessScriptById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增业务脚本管理
|
||||
*/
|
||||
@RequiresPermissions("system:businessScript:add")
|
||||
@Log(title = "业务脚本管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EpsBusinessScript epsBusinessScript)
|
||||
{
|
||||
return toAjax(epsBusinessScriptService.insertEpsBusinessScript(epsBusinessScript));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改业务脚本管理
|
||||
*/
|
||||
@RequiresPermissions("system:businessScript:edit")
|
||||
@Log(title = "业务脚本管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EpsBusinessScript epsBusinessScript)
|
||||
{
|
||||
return toAjax(epsBusinessScriptService.updateEpsBusinessScript(epsBusinessScript));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除业务脚本管理
|
||||
*/
|
||||
@RequiresPermissions("system:businessScript:remove")
|
||||
@Log(title = "业务脚本管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(epsBusinessScriptService.deleteEpsBusinessScriptByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有业务脚本名称
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:businessScript:list")
|
||||
@GetMapping("/getAllScriptName")
|
||||
public AjaxResult getAllScriptName(){
|
||||
List<EpsBusinessScript> list = epsBusinessScriptService.selectEpsBusinessScriptList(new EpsBusinessScript());
|
||||
return success(list);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.system.domain.EpsInitialTrafficData;
|
||||
import com.ruoyi.system.service.EpsInitialTrafficDataService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -10,13 +12,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* EPS初始流量数据控制器
|
||||
* 提供流量数据的REST接口
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/eps-traffic-data")
|
||||
@RequestMapping("/epsTrafficData")
|
||||
@RequiredArgsConstructor
|
||||
public class EpsInitialTrafficDataController {
|
||||
|
||||
@@ -53,4 +56,25 @@ public class EpsInitialTrafficDataController {
|
||||
List<EpsInitialTrafficData> result = epsInitialTrafficDataService.query(queryParam);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 图形分析 - 95值/日
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:bandwidth:list")
|
||||
@PostMapping("/getServerGraphicalAnalysisDaily")
|
||||
public AjaxResult getServerGraphicalAnalysisDaily(@RequestBody EpsInitialTrafficData queryParam){
|
||||
List<Map<String, Object>> echartsData = epsInitialTrafficDataService.getServerGraphicalAnalysisDaily(queryParam);
|
||||
return AjaxResult.success(echartsData);
|
||||
}
|
||||
/**
|
||||
* 图形分析 - 95值/日
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:bandwidth:list")
|
||||
@PostMapping("/getServerGraphicalAnalysisMonthy")
|
||||
public AjaxResult getServerGraphicalAnalysisMonthy(@RequestBody EpsInitialTrafficData queryParam){
|
||||
List<Map<String, Object>> echartsData = epsInitialTrafficDataService.getServerGraphicalAnalysisMonthy(queryParam);
|
||||
return AjaxResult.success(echartsData);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
@@ -10,6 +11,7 @@ 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.InnerAuth;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.system.domain.EpsInitialTrafficData;
|
||||
import com.ruoyi.system.domain.EpsNodeBandwidth;
|
||||
@@ -154,16 +156,13 @@ public class EpsNodeBandwidthController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 相关数据
|
||||
*/
|
||||
@RequiresPermissions("system:bandwidth:query")
|
||||
@GetMapping(value = "relatedData/traffic")
|
||||
/**
|
||||
* 根据ID获取相关数据
|
||||
* @param id 资源ID
|
||||
* @return 表格数据信息
|
||||
*/
|
||||
@RequiresPermissions("system:bandwidth:query")
|
||||
@GetMapping(value = "relatedData/traffic")
|
||||
public TableDataInfo relatedData(Long id,Integer pageNum,Integer pageSize) {
|
||||
// 1. 参数校验
|
||||
if (id == null || id <= 0) {
|
||||
@@ -319,4 +318,15 @@ public class EpsNodeBandwidthController extends BaseController
|
||||
List<Map> list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "7", ChronoUnit.MONTHS);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询节点带宽信息列表
|
||||
*/
|
||||
@PostMapping("/getEpsNodeBandWidthList")
|
||||
@InnerAuth
|
||||
public R<List<EpsNodeBandwidth>> getEpsNodeBandWidthList(@RequestBody EpsNodeBandwidth epsNodeBandwidth)
|
||||
{
|
||||
List<EpsNodeBandwidth> list = epsNodeBandwidthService.selectEpsNodeBandwidthList(epsNodeBandwidth);
|
||||
return R.ok(list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
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.EpsTaskStatistics;
|
||||
import com.ruoyi.system.service.IEpsTaskStatisticsService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 业务95值计算任务Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/taskStatistics")
|
||||
public class EpsTaskStatisticsController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IEpsTaskStatisticsService epsTaskStatisticsService;
|
||||
|
||||
/**
|
||||
* 查询业务95值计算任务列表
|
||||
*/
|
||||
@RequiresPermissions("system:taskStatistics:list")
|
||||
@PostMapping("/list")
|
||||
public TableDataInfo list(@RequestBody EpsTaskStatistics epsTaskStatistics)
|
||||
{
|
||||
PageDomain pageDomain = new PageDomain();
|
||||
pageDomain.setPageNum(epsTaskStatistics.getPageNum());
|
||||
pageDomain.setPageSize(epsTaskStatistics.getPageSize());
|
||||
startPage(pageDomain);
|
||||
List<EpsTaskStatistics> list = epsTaskStatisticsService.selectEpsTaskStatisticsList(epsTaskStatistics);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出业务95值计算任务列表
|
||||
*/
|
||||
@RequiresPermissions("system:taskStatistics:export")
|
||||
@Log(title = "业务95值计算任务", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, EpsTaskStatistics epsTaskStatistics)
|
||||
{
|
||||
List<EpsTaskStatistics> list = epsTaskStatisticsService.selectEpsTaskStatisticsList(epsTaskStatistics);
|
||||
ExcelUtil<EpsTaskStatistics> util = new ExcelUtil<EpsTaskStatistics>(EpsTaskStatistics.class);
|
||||
util.showColumn(epsTaskStatistics.getProperties());
|
||||
util.exportExcel(response, list, "业务95值计算任务数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务95值计算任务详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:taskStatistics:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(epsTaskStatisticsService.selectEpsTaskStatisticsById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增业务95值计算任务
|
||||
*/
|
||||
@RequiresPermissions("system:taskStatistics:add")
|
||||
@Log(title = "业务95值计算任务", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EpsTaskStatistics epsTaskStatistics)
|
||||
{
|
||||
return toAjax(epsTaskStatisticsService.insertEpsTaskStatistics(epsTaskStatistics));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改业务95值计算任务
|
||||
*/
|
||||
@RequiresPermissions("system:taskStatistics:edit")
|
||||
@Log(title = "业务95值计算任务", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EpsTaskStatistics epsTaskStatistics)
|
||||
{
|
||||
return toAjax(epsTaskStatisticsService.updateEpsTaskStatistics(epsTaskStatistics));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除业务95值计算任务
|
||||
*/
|
||||
@RequiresPermissions("system:taskStatistics:remove")
|
||||
@Log(title = "业务95值计算任务", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(epsTaskStatisticsService.deleteEpsTaskStatisticsByIds(ids));
|
||||
}
|
||||
/**
|
||||
* 相关数据查询
|
||||
*/
|
||||
@RequiresPermissions("system:taskStatistics:list")
|
||||
@PostMapping("/getRelateData")
|
||||
public TableDataInfo getRelateData(@RequestBody EpsTaskStatistics epsTaskStatistics)
|
||||
{
|
||||
PageInfo<?> list = epsTaskStatisticsService.getRelateData(epsTaskStatistics);
|
||||
return getDataTable(list.getList(), list.getTotal());
|
||||
}
|
||||
/**
|
||||
* 修改相关数据
|
||||
* @param epsTaskStatistics
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:taskStatistics:edit")
|
||||
@PostMapping("/updateRelateData")
|
||||
public AjaxResult updateRelateData(@RequestBody EpsTaskStatistics epsTaskStatistics)
|
||||
{
|
||||
int rows = epsTaskStatisticsService.updateRelateData(epsTaskStatistics);
|
||||
return toAjax(rows);
|
||||
}
|
||||
/**
|
||||
* 重新计算
|
||||
*/
|
||||
@RequiresPermissions("system:taskStatistics:list")
|
||||
@PostMapping("/recaculate")
|
||||
public AjaxResult recaculate(@RequestBody EpsTaskStatistics epsTaskStatistics)
|
||||
{
|
||||
int rows = epsTaskStatisticsService.recaculate(epsTaskStatistics);
|
||||
return toAjax(rows);
|
||||
}
|
||||
/**
|
||||
* 图形查看
|
||||
*/
|
||||
@RequiresPermissions("system:taskStatistics:list")
|
||||
@PostMapping("/getRraphicalMsg")
|
||||
public AjaxResult getRraphicalMsg(@RequestBody EpsTaskStatistics epsTaskStatistics)
|
||||
{
|
||||
Map echartsMap = epsTaskStatisticsService.getRraphicalMsg(epsTaskStatistics);
|
||||
return success(echartsMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取月均日95值的日列表
|
||||
* @param epsTaskStatistics
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:taskStatistics:list")
|
||||
@PostMapping("/getAvgTimeList")
|
||||
public AjaxResult getAvgTimeList(@RequestBody EpsTaskStatistics epsTaskStatistics)
|
||||
{
|
||||
List<String> avgTimeList = epsTaskStatisticsService.getAvgTimeList(epsTaskStatistics);
|
||||
return success(avgTimeList);
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 交换机监控信息Controller
|
||||
@@ -105,4 +106,24 @@ public class InitialSwitchInfoDetailsController extends BaseController
|
||||
{
|
||||
return initialSwitchInfoDetailsService.autoSaveSwitchTraffic(initialSwitchInfoDetails);
|
||||
}
|
||||
/**
|
||||
* 图形分析-95带宽值mbps/日 v1.1
|
||||
*/
|
||||
@RequiresPermissions("system:bandwidth:list")
|
||||
@PostMapping("/getGraphicalAnalysisDaily")
|
||||
public AjaxResult getGraphicalAnalysisDaily(@RequestBody InitialSwitchInfoDetails initialSwitchInfoDetails)
|
||||
{
|
||||
List<Map<String, Object>> echartsData = initialSwitchInfoDetailsService.getGraphicalAnalysisDaily(initialSwitchInfoDetails);
|
||||
return success(echartsData);
|
||||
}
|
||||
/**
|
||||
* 图形分析-95带宽值mbps/月 v1.1
|
||||
*/
|
||||
@RequiresPermissions("system:bandwidth:list")
|
||||
@PostMapping("/getGraphicalAnalysisMonthy")
|
||||
public AjaxResult getGraphicalAnalysisMonthy(@RequestBody InitialSwitchInfoDetails initialSwitchInfoDetails)
|
||||
{
|
||||
List<Map<String, Object>> echartsData = initialSwitchInfoDetailsService.getGraphicalAnalysisMonthy(initialSwitchInfoDetails);
|
||||
return success(echartsData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.RmRegistrationMachine;
|
||||
import com.ruoyi.system.service.IRmRegistrationMachineService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 绑定金山machinecodeController
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/machine")
|
||||
public class RmRegistrationMachineController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRmRegistrationMachineService rmRegistrationMachineService;
|
||||
|
||||
/**
|
||||
* 查询绑定金山machinecode列表
|
||||
*/
|
||||
@RequiresPermissions("system:machine:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RmRegistrationMachine rmRegistrationMachine)
|
||||
{
|
||||
startPage();
|
||||
List<RmRegistrationMachine> list = rmRegistrationMachineService.selectRmRegistrationMachineList(rmRegistrationMachine);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出绑定金山machinecode列表
|
||||
*/
|
||||
@RequiresPermissions("system:machine:export")
|
||||
@Log(title = "绑定金山machinecode", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RmRegistrationMachine rmRegistrationMachine)
|
||||
{
|
||||
List<RmRegistrationMachine> list = rmRegistrationMachineService.selectRmRegistrationMachineList(rmRegistrationMachine);
|
||||
ExcelUtil<RmRegistrationMachine> util = new ExcelUtil<RmRegistrationMachine>(RmRegistrationMachine.class);
|
||||
util.exportExcel(response, list, "绑定金山machinecode数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取绑定金山machinecode详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:machine:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rmRegistrationMachineService.selectRmRegistrationMachineById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增绑定金山machinecode
|
||||
*/
|
||||
@RequiresPermissions("system:machine:add")
|
||||
@Log(title = "绑定金山machinecode", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RmRegistrationMachine rmRegistrationMachine)
|
||||
{
|
||||
return toAjax(rmRegistrationMachineService.insertRmRegistrationMachine(rmRegistrationMachine));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改绑定金山machinecode
|
||||
*/
|
||||
@RequiresPermissions("system:machine:edit")
|
||||
@Log(title = "绑定金山machinecode", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RmRegistrationMachine rmRegistrationMachine)
|
||||
{
|
||||
return toAjax(rmRegistrationMachineService.updateRmRegistrationMachine(rmRegistrationMachine));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除绑定金山machinecode
|
||||
*/
|
||||
@RequiresPermissions("system:machine:remove")
|
||||
@Log(title = "绑定金山machinecode", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(rmRegistrationMachineService.deleteRmRegistrationMachineByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@ import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.InnerAuth;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.system.api.domain.RmRegisterMsgRemote;
|
||||
import com.ruoyi.system.api.domain.RmResourceRegistrationRemote;
|
||||
import com.ruoyi.system.domain.RmResourceRegistration;
|
||||
import com.ruoyi.system.service.IRmResourceRegistrationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -165,5 +167,72 @@ public class RmResourceRegistrationController extends BaseController
|
||||
List<RmResourceRegistration> list = rmResourceRegistrationService.selectRmResourceRegistrationList(rmResourceRegistration);
|
||||
return R.ok(list.get(0));
|
||||
}
|
||||
/**
|
||||
* 查询资源注册列表
|
||||
*/
|
||||
@RequiresPermissions("system:registration:list")
|
||||
@PostMapping("/getRegistList")
|
||||
public AjaxResult getRegistList(@RequestBody RmResourceRegistration rmResourceRegistration)
|
||||
{
|
||||
List<RmResourceRegistration> list = rmResourceRegistrationService.selectRmResourceRegistrationList(rmResourceRegistration);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动注册服务器
|
||||
* @param rmResourceRegistration mq接收的消息
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/innerAddRegist")
|
||||
@InnerAuth
|
||||
public R<Integer> innerAddRegist(@RequestBody RmRegisterMsgRemote rmResourceRegistration)
|
||||
{
|
||||
int rows = rmResourceRegistrationService.innerAddRegist(rmResourceRegistration);
|
||||
return R.ok(rows);
|
||||
}
|
||||
/**
|
||||
* 添加节点标识
|
||||
* @param rmResourceRegistration mq接收的消息
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/innerUpdateRegist")
|
||||
@InnerAuth
|
||||
public R<Integer> innerUpdateRegist(@RequestBody RmResourceRegistrationRemote rmResourceRegistration)
|
||||
{
|
||||
int rows = rmResourceRegistrationService.innerUpdateRegist(rmResourceRegistration);
|
||||
return R.ok(rows);
|
||||
}
|
||||
/**
|
||||
* 选择公网业务IP
|
||||
*/
|
||||
@RequiresPermissions("system:registration:update")
|
||||
@PostMapping("/bindBusinessPubulicIp")
|
||||
public AjaxResult bindBusinessPubulicIp(@RequestBody RmResourceRegistration rmResourceRegistration)
|
||||
{
|
||||
int rows = rmResourceRegistrationService.bindBusinessPublicIp(rmResourceRegistration);
|
||||
return toAjax(rows);
|
||||
}
|
||||
/**
|
||||
* 查询所有逻辑标识节点
|
||||
* @return 资源注册集合
|
||||
*/
|
||||
@RequiresPermissions("system:registration:list")
|
||||
@GetMapping("/getAllLogicalNodeId")
|
||||
public List<Map> getAllLogicalNodeId()
|
||||
{
|
||||
List<Map> list = rmResourceRegistrationService.getAllLogicalNodeId();
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 绑定业务名称
|
||||
* @return 资源注册集合
|
||||
*/
|
||||
@RequiresPermissions("system:registration:list")
|
||||
@PostMapping("/bindBusinessByClientIds")
|
||||
public AjaxResult bindBusinessByClientIds(@RequestBody RmResourceRegistration rmResourceRegistration)
|
||||
{
|
||||
int rows = rmResourceRegistrationService.bindBusinessByClientIds(rmResourceRegistration);
|
||||
return toAjax(rows);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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.RmSwitchInterfaceInfo;
|
||||
import com.ruoyi.system.service.IRmSwitchInterfaceInfoService;
|
||||
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-10-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/switchInterfaceInfo")
|
||||
public class RmSwitchInterfaceInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRmSwitchInterfaceInfoService rmSwitchInterfaceInfoService;
|
||||
|
||||
/**
|
||||
* 查询交换机接口信息列表
|
||||
*/
|
||||
@RequiresPermissions("system:switchInterfaceInfo:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RmSwitchInterfaceInfo rmSwitchInterfaceInfo)
|
||||
{
|
||||
startPage();
|
||||
List<RmSwitchInterfaceInfo> list = rmSwitchInterfaceInfoService.selectRmSwitchInterfaceInfoList(rmSwitchInterfaceInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出交换机接口信息列表
|
||||
*/
|
||||
@RequiresPermissions("system:switchInterfaceInfo:export")
|
||||
@Log(title = "交换机接口信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RmSwitchInterfaceInfo rmSwitchInterfaceInfo)
|
||||
{
|
||||
List<RmSwitchInterfaceInfo> list = rmSwitchInterfaceInfoService.selectRmSwitchInterfaceInfoList(rmSwitchInterfaceInfo);
|
||||
ExcelUtil<RmSwitchInterfaceInfo> util = new ExcelUtil<RmSwitchInterfaceInfo>(RmSwitchInterfaceInfo.class);
|
||||
util.exportExcel(response, list, "交换机接口信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取交换机接口信息详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:switchInterfaceInfo:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rmSwitchInterfaceInfoService.selectRmSwitchInterfaceInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增交换机接口信息
|
||||
*/
|
||||
@RequiresPermissions("system:switchInterfaceInfo:add")
|
||||
@Log(title = "交换机接口信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RmSwitchInterfaceInfo rmSwitchInterfaceInfo)
|
||||
{
|
||||
return toAjax(rmSwitchInterfaceInfoService.insertRmSwitchInterfaceInfo(rmSwitchInterfaceInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改交换机接口信息
|
||||
*/
|
||||
@RequiresPermissions("system:switchInterfaceInfo:edit")
|
||||
@Log(title = "交换机接口信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RmSwitchInterfaceInfo rmSwitchInterfaceInfo)
|
||||
{
|
||||
return toAjax(rmSwitchInterfaceInfoService.updateRmSwitchInterfaceInfo(rmSwitchInterfaceInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除交换机接口信息
|
||||
*/
|
||||
@RequiresPermissions("system:switchInterfaceInfo:remove")
|
||||
@Log(title = "交换机接口信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(rmSwitchInterfaceInfoService.deleteRmSwitchInterfaceInfoByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
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.InnerAuth;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.system.domain.RmSwitchManagement;
|
||||
import com.ruoyi.system.service.IRmSwitchManagementService;
|
||||
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-10-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/switchManagement")
|
||||
public class RmSwitchManagementController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRmSwitchManagementService rmSwitchManagementService;
|
||||
|
||||
/**
|
||||
* 查询交换机管理列表
|
||||
*/
|
||||
@RequiresPermissions("system:switchManagement:list")
|
||||
@PostMapping("/list")
|
||||
public TableDataInfo list(RmSwitchManagement rmSwitchManagement)
|
||||
{
|
||||
PageDomain pageDomain = new PageDomain();
|
||||
pageDomain.setPageNum(rmSwitchManagement.getPageNum());
|
||||
pageDomain.setPageSize(rmSwitchManagement.getPageSize());
|
||||
startPage(pageDomain);
|
||||
List<RmSwitchManagement> list = rmSwitchManagementService.selectRmSwitchManagementList(rmSwitchManagement);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出交换机管理列表
|
||||
*/
|
||||
@RequiresPermissions("system:switchManagement:export")
|
||||
@Log(title = "交换机管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RmSwitchManagement rmSwitchManagement)
|
||||
{
|
||||
List<RmSwitchManagement> list = rmSwitchManagementService.selectRmSwitchManagementList(rmSwitchManagement);
|
||||
ExcelUtil<RmSwitchManagement> util = new ExcelUtil<RmSwitchManagement>(RmSwitchManagement.class);
|
||||
util.showColumn(rmSwitchManagement.getProperties());
|
||||
util.exportExcel(response, list, "交换机管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取交换机管理详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:switchManagement:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(rmSwitchManagementService.selectRmSwitchManagementById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增交换机管理
|
||||
*/
|
||||
@RequiresPermissions("system:switchManagement:add")
|
||||
@Log(title = "交换机管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RmSwitchManagement rmSwitchManagement)
|
||||
{
|
||||
return toAjax(rmSwitchManagementService.insertRmSwitchManagement(rmSwitchManagement));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改交换机管理
|
||||
*/
|
||||
@RequiresPermissions("system:switchManagement:edit")
|
||||
@Log(title = "交换机管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RmSwitchManagement rmSwitchManagement)
|
||||
{
|
||||
return toAjax(rmSwitchManagementService.updateRmSwitchManagement(rmSwitchManagement));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除交换机管理
|
||||
*/
|
||||
@RequiresPermissions("system:switchManagement:remove")
|
||||
@Log(title = "交换机管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(rmSwitchManagementService.deleteRmSwitchManagementByIds(ids));
|
||||
}
|
||||
/**
|
||||
* 查询交换机管理列表
|
||||
*/
|
||||
@RequiresPermissions("system:switchManagement:list")
|
||||
@PostMapping("/getAllSwitchName")
|
||||
public AjaxResult getAllSwitchName(@RequestBody RmSwitchManagement rmSwitchManagement)
|
||||
{
|
||||
List<RmSwitchManagement> list = rmSwitchManagementService.selectRmSwitchManagementList(rmSwitchManagement);
|
||||
return success(list);
|
||||
}
|
||||
/**
|
||||
* 查询交换机管理列表
|
||||
*/
|
||||
@InnerAuth
|
||||
@PostMapping("/getSwitchNameByClientId")
|
||||
public R<List<RmSwitchManagement>> getSwitchNameByClientId(@RequestBody RmSwitchManagement rmSwitchManagement)
|
||||
{
|
||||
List<RmSwitchManagement> list = rmSwitchManagementService.selectRmSwitchManagementList(rmSwitchManagement);
|
||||
return R.ok(list);
|
||||
}
|
||||
/**
|
||||
* 查询交换机信息树形接口
|
||||
*/
|
||||
@RequiresPermissions("system:switchManagement:list")
|
||||
@GetMapping("/getAllSwitchNameTree")
|
||||
public AjaxResult getAllSwitchNameTree()
|
||||
{
|
||||
List<RmSwitchManagement> list = rmSwitchManagementService.getAllSwitchNameTree();
|
||||
return success(list);
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,11 @@ public class ScreenController extends BaseController
|
||||
public AjaxResult countDeviceNumTop5()
|
||||
{
|
||||
List<Map> maps = epsServerRevenueConfigService.countDeviceNumTop5();
|
||||
return success(maps);
|
||||
if(maps.isEmpty()){
|
||||
return success();
|
||||
}else{
|
||||
return success(maps);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
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.UserTableColumnConfig;
|
||||
import com.ruoyi.system.service.IUserTableColumnConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 用户自定义列配置Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/columnConfig")
|
||||
public class UserTableColumnConfigController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IUserTableColumnConfigService userTableColumnConfigService;
|
||||
|
||||
|
||||
/**
|
||||
* 根据获取用户id获取自定义列配置详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:columnConfig:query")
|
||||
@PostMapping(value = "/getColumnConfigByUserId")
|
||||
public AjaxResult getColumnConfigByUserId(@RequestBody UserTableColumnConfig userTableColumnConfig)
|
||||
{
|
||||
UserTableColumnConfig columnConfig = userTableColumnConfigService.getColumnConfigByUserId(userTableColumnConfig);
|
||||
return success(columnConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户自定义列配置
|
||||
*/
|
||||
@RequiresPermissions("system:columnConfig:add")
|
||||
@Log(title = "用户自定义列配置", businessType = BusinessType.INSERT)
|
||||
@PostMapping("addColumnConfig")
|
||||
public AjaxResult add(@RequestBody UserTableColumnConfig userTableColumnConfig)
|
||||
{
|
||||
return toAjax(userTableColumnConfigService.insertUserTableColumnConfig(userTableColumnConfig));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -73,5 +73,11 @@ public class AllInterfaceName extends BaseEntity
|
||||
/** 服务器ip */
|
||||
@Excel(name = "服务器ip")
|
||||
private String serverIp;
|
||||
/** 交换机接口别名 */
|
||||
private String otherName;
|
||||
/** 业务需要 拼接id 交换机clientId,交换机接口名称值 别名 */
|
||||
private String value;
|
||||
/** 前端需要 name 别名 */
|
||||
private String label;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
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 lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 业务下发管理对象 eps_business_deploy
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-13
|
||||
*/
|
||||
@Data
|
||||
public class EpsBusinessDeploy extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 任务名称 */
|
||||
@Excel(name = "任务名称")
|
||||
private String taskName;
|
||||
|
||||
/** 业务code */
|
||||
@Excel(name = "业务code")
|
||||
private String businessCode;
|
||||
|
||||
/** 业务名称 */
|
||||
@Excel(name = "业务名称")
|
||||
private String businessName;
|
||||
|
||||
/** 脚本名称 */
|
||||
@Excel(name = "脚本名称")
|
||||
private String scriptName;
|
||||
|
||||
/** 脚本文件地址 */
|
||||
@Excel(name = "脚本文件地址")
|
||||
private String scriptPath;
|
||||
|
||||
/** 脚本参数 */
|
||||
@Excel(name = "脚本参数")
|
||||
private String scriptParams;
|
||||
|
||||
/** 部署设备 */
|
||||
@Excel(name = "部署设备")
|
||||
private String deployDevice;
|
||||
|
||||
/** 提交人 */
|
||||
@Excel(name = "提交人")
|
||||
private String submitBy;
|
||||
|
||||
/** 审核人 */
|
||||
@Excel(name = "审核人")
|
||||
private String reviewBy;
|
||||
|
||||
/** 审核状态(0-未提交,1-待审核,2-审核通过,3-审核驳回) */
|
||||
@Excel(name = "审核状态")
|
||||
private String reviewStatus;
|
||||
|
||||
/** 审核时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date reviewTime;
|
||||
|
||||
/** 审核意见 */
|
||||
@Excel(name = "审核意见")
|
||||
private String reviewComment;
|
||||
/** 服务器clientId */
|
||||
private String clientId;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 业务脚本管理对象 eps_business_script
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-13
|
||||
*/
|
||||
@Data
|
||||
public class EpsBusinessScript extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 脚本名称 */
|
||||
@Excel(name = "脚本名称")
|
||||
private String scriptName;
|
||||
|
||||
/** 脚本文件地址 */
|
||||
@Excel(name = "脚本文件地址")
|
||||
private String scriptPath;
|
||||
|
||||
/** 脚本默认参数 */
|
||||
@Excel(name = "脚本默认参数")
|
||||
private String defaultParams;
|
||||
}
|
||||
@@ -110,6 +110,16 @@ public class EpsInitialTrafficData extends BaseEntity {
|
||||
private String bandwidthType;
|
||||
/** 日或月 */
|
||||
private String dayOrMonth;
|
||||
/** 金山流量 */
|
||||
private String machineFlow;
|
||||
/** 包含设备 */
|
||||
private String clientIds;
|
||||
/** 是否95值 */
|
||||
private boolean flag95 = false;
|
||||
/** 计算方式 */
|
||||
private String calculationMode;
|
||||
/** 95值 */
|
||||
private BigDecimal percentile95;
|
||||
|
||||
|
||||
}
|
||||
@@ -49,6 +49,8 @@ public class EpsMethodChangeRecord extends BaseEntity
|
||||
|
||||
/** 业务代码(12位) */
|
||||
private String businessCode;
|
||||
/** 客户端id */
|
||||
private String clientId;
|
||||
/** 开始时间 */
|
||||
private String startTime;
|
||||
/** 结束时间 */
|
||||
|
||||
@@ -71,30 +71,13 @@ public class EpsNodeBandwidth extends BaseEntity
|
||||
/** 有效-月均95值 */
|
||||
@Excel(name = "有效-月均95值")
|
||||
private BigDecimal effectiveAvgMonthlyBandwidth95;
|
||||
|
||||
/** 设备业务客户id */
|
||||
@Excel(name = "设备业务客户id")
|
||||
private String customerId;
|
||||
|
||||
/** 设备业务客户名称 */
|
||||
@Excel(name = "设备业务客户名称")
|
||||
private String customerName;
|
||||
|
||||
/** 业务号 */
|
||||
@Excel(name = "业务号")
|
||||
private String serviceNumber;
|
||||
/** 金山流量Mbps/日 */
|
||||
private BigDecimal machineFlow;
|
||||
|
||||
/** 上联交换机 */
|
||||
@Excel(name = "上联交换机")
|
||||
private String uplinkSwitch;
|
||||
|
||||
/** 创建人id */
|
||||
@Excel(name = "创建人id")
|
||||
private Long creatorId;
|
||||
|
||||
/** 创建人名称 */
|
||||
@Excel(name = "创建人名称")
|
||||
private String creatorName;
|
||||
|
||||
/** 交换机sn */
|
||||
@Excel(name = "交换机sn")
|
||||
@@ -127,16 +110,22 @@ public class EpsNodeBandwidth extends BaseEntity
|
||||
private String endTime;
|
||||
/** 月份 */
|
||||
private String monthTime;
|
||||
/** 备注 */
|
||||
/** 交换机接口名称别名 */
|
||||
private String remark1;
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createDatetime;
|
||||
|
||||
/** 节点名称集合 */
|
||||
private List<String> nodeNames;
|
||||
|
||||
/** 交换机名称集合 */
|
||||
private List<String> switchNames;
|
||||
/** 计算方式 */
|
||||
private String calculationMode;
|
||||
/** 客户端id */
|
||||
private String clientId;
|
||||
/** 交换机连接的服务器客户端id */
|
||||
private String serverClientId;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 业务95值计算任务对象 eps_task_statistics
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-29
|
||||
*/
|
||||
@Data
|
||||
public class EpsTaskStatistics extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 任务名称 */
|
||||
@Excel(name = "任务名称")
|
||||
private String taskName;
|
||||
|
||||
/** 业务名称 */
|
||||
@Excel(name = "业务名称")
|
||||
private String businessName;
|
||||
/** 业务代码 */
|
||||
private String businessCode;
|
||||
|
||||
/** 开始时间 */
|
||||
@Excel(name = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
/** 结束时间 */
|
||||
@Excel(name = "结束时间")
|
||||
private String endTime;
|
||||
|
||||
/** 95值 */
|
||||
@Excel(name = "95值")
|
||||
private BigDecimal percentile95;
|
||||
|
||||
/** 月均日95值 */
|
||||
@Excel(name = "月均日95值")
|
||||
private BigDecimal monthlyAvgPercentile95;
|
||||
|
||||
/** 资源类型 */
|
||||
@Excel(name = "资源类型")
|
||||
private String resourceType;
|
||||
|
||||
/** 包含资源 */
|
||||
@Excel(name = "包含资源")
|
||||
private String includedResources;
|
||||
|
||||
/** 计算类型 */
|
||||
@Excel(name = "计算类型")
|
||||
private String calculationType;
|
||||
|
||||
/** 计算模式 */
|
||||
@Excel(name = "计算模式")
|
||||
private String calculationMode;
|
||||
|
||||
/** 任务状态(1-计算中,2-计算完成) */
|
||||
@Excel(name = "任务状态(1-计算中,2-计算完成)")
|
||||
private String taskStatus;
|
||||
/** 需要修改的流量值 */
|
||||
private BigDecimal needSpeed;
|
||||
/** 需要修改的值对应的时间 */
|
||||
private String needTime;
|
||||
/** 月均日相关数据时间 */
|
||||
private String avgTime;
|
||||
/** 接口名称s */
|
||||
private String interfaceNames;
|
||||
/** 时间段 */
|
||||
private String timeRange;
|
||||
|
||||
}
|
||||
@@ -52,6 +52,8 @@ public class InitialSwitchInfoDetails extends BaseEntity
|
||||
/** 发送流量(bytes/s) */
|
||||
@Excel(name = "发送流量", readConverterExp = "b=ytes/s")
|
||||
private BigDecimal outSpeed;
|
||||
/** 发送或接收流量的最大值 */
|
||||
private BigDecimal maxSpeed;
|
||||
|
||||
/** 交换机名称 */
|
||||
@Excel(name = "交换机名称")
|
||||
@@ -108,4 +110,18 @@ public class InitialSwitchInfoDetails extends BaseEntity
|
||||
private String ifOutErrors;
|
||||
/** 端口索引 */
|
||||
private String ifIndex;
|
||||
/** 计算方式 */
|
||||
public String calculationMode;
|
||||
/** 包含资源 */
|
||||
public String clientIds;
|
||||
/** 包含资源-接口名称 */
|
||||
public String interfaceNames;
|
||||
/** 是否95值 */
|
||||
private boolean flag95 = false;
|
||||
/** 服务器客户端id */
|
||||
private String serverClientId;
|
||||
/** 交换机接口别名 */
|
||||
private String interfaceNameRemark;
|
||||
/** 95值 */
|
||||
private BigDecimal percentile95;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ public class RmEpsTopologyManagement extends BaseEntity
|
||||
/** 交换机硬件SN */
|
||||
@Excel(name = "交换机硬件SN")
|
||||
private String switchSn;
|
||||
/** 交换机clientId */
|
||||
private String clientId;
|
||||
|
||||
/** 接口名称 */
|
||||
@Excel(name = "接口名称")
|
||||
@@ -75,4 +77,19 @@ public class RmEpsTopologyManagement extends BaseEntity
|
||||
private String switchIpAddress;
|
||||
/** 资源名称 */
|
||||
private String resourceName;
|
||||
|
||||
/**
|
||||
* 对端交换机名称
|
||||
*/
|
||||
private String peerSwitchName;
|
||||
|
||||
/**
|
||||
* 对端交换机接口
|
||||
*/
|
||||
private String peerSwitchInterface;
|
||||
|
||||
/**
|
||||
* 服务器clientId
|
||||
*/
|
||||
private String serverClientId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 绑定金山machinecode对象 rm_registration_machine
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
public class RmRegistrationMachine extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 客户端ID */
|
||||
@Excel(name = "客户端ID")
|
||||
private String clientId;
|
||||
|
||||
/** 机器码 */
|
||||
@Excel(name = "机器码")
|
||||
private String machineCode;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setClientId(String clientId)
|
||||
{
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public String getClientId()
|
||||
{
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setMachineCode(String machineCode)
|
||||
{
|
||||
this.machineCode = machineCode;
|
||||
}
|
||||
|
||||
public String getMachineCode()
|
||||
{
|
||||
return machineCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("clientId", getClientId())
|
||||
.append("machineCode", getMachineCode())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,17 @@
|
||||
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 lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 资源注册对象 rm_resource_registration
|
||||
*
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-08-12
|
||||
*/
|
||||
@@ -18,25 +23,25 @@ public class RmResourceRegistration extends BaseEntity
|
||||
/** id */
|
||||
private Long id;
|
||||
|
||||
/** clientID */
|
||||
@Excel(name = "clientID")
|
||||
private String clientId;
|
||||
|
||||
/** 硬件SN */
|
||||
@Excel(name = "硬件SN")
|
||||
@Excel(name = "设备SN")
|
||||
private String hardwareSn;
|
||||
|
||||
/** 资源类型
|
||||
* 1 服务器,2 交换机*/
|
||||
@Excel(name = "资源类型",readConverterExp = "1=服务器,2=交换机")
|
||||
private String resourceType;
|
||||
|
||||
/** 资源名称 */
|
||||
@Excel(name = "资源名称")
|
||||
private String resourceName;
|
||||
|
||||
/** IP地址 */
|
||||
@Excel(name = "IP地址")
|
||||
private String ipAddress;
|
||||
|
||||
/** 端口1.162(SNMP),2.其他 */
|
||||
@Excel(name = "端口")
|
||||
private String resourcePort;
|
||||
|
||||
/**其他端口名称 */
|
||||
@@ -46,70 +51,58 @@ public class RmResourceRegistration extends BaseEntity
|
||||
@Excel(name = "agent版本")
|
||||
private String agentVersion;
|
||||
|
||||
|
||||
/** 协议 1.TCP,2.UDP */
|
||||
@Excel(name = "协议",readConverterExp = "1=TCP,2=UDP")
|
||||
private String protocol;
|
||||
|
||||
/** SNMP探测 0=否,1=是 */
|
||||
@Excel(name = "",readConverterExp = "0=否,1=是")
|
||||
private String snmpDetect;
|
||||
|
||||
/** 版本(1.SNMPv2,2.SNMPv3) */
|
||||
@Excel(name = "SNMP版本",readConverterExp = "1=华为SNMPv2c,2=华为SNMPv3")
|
||||
private String resourceVersion;
|
||||
|
||||
/** 读写权限(1.RW,2.ReadOnly) */
|
||||
@Excel(name = "读写权限",readConverterExp = "1=只读,2=可读可写")
|
||||
private String rwPermission;
|
||||
|
||||
/** 团体名称 */
|
||||
@Excel(name = "团体名称")
|
||||
private String teamName;
|
||||
|
||||
/** SNMP采集地址 */
|
||||
@Excel(name = "SNMP采集地址")
|
||||
private String snmpCollectAddr;
|
||||
|
||||
/** SNMP采集端口 */
|
||||
@Excel(name = "SNMP采集端口")
|
||||
private String snmpCollectPort;
|
||||
|
||||
/** 安全级别(1.authPriv、2.authNoPriv,3.noAuthNoPriv) */
|
||||
@Excel(name = "安全级别",readConverterExp = "1=authPriv,2=authNoPriv,3=noAuthNoPriv")
|
||||
private String securityLevel;
|
||||
|
||||
/** 加密方式 1.md5,2.SHA */
|
||||
@Excel(name = "加密方式",readConverterExp = "1=MD5,2=SHA")
|
||||
private String encryption;
|
||||
|
||||
/** 用户名 */
|
||||
@Excel(name = "用户名")
|
||||
private String resourceUserName;
|
||||
/** 密码 */
|
||||
@Excel(name = "密码")
|
||||
|
||||
/** 密码 */
|
||||
private String resourcePwd;
|
||||
|
||||
/** 注册状态 0-未注册,1-已注册 */
|
||||
@Excel(name = "注册状态",readConverterExp = "0=未注册,1=已注册")
|
||||
private String registrationStatus;
|
||||
|
||||
/** 在线状态 0-离线,1-在线 */
|
||||
@Excel(name = "在线状态",readConverterExp = "0=离线,1=在线")
|
||||
@Excel(name = "在线状态")
|
||||
private String onlineStatus;
|
||||
@Excel(name = "交换机在线状态",readConverterExp = "0=离线,1=在线")
|
||||
|
||||
private String switchOnlineStatus;
|
||||
|
||||
/** 描述 */
|
||||
@Excel(name = "描述")
|
||||
private String description;
|
||||
|
||||
/** 设备业务客户id */
|
||||
private Long customerId;
|
||||
|
||||
/** 设备业务客户名称 */
|
||||
@Excel(name = "设备业务客户")
|
||||
private String customerName;
|
||||
|
||||
/** 业务号 */
|
||||
@Excel(name = "业务号")
|
||||
private String serviceNumber;
|
||||
|
||||
/** 创建人id */
|
||||
@@ -123,11 +116,192 @@ public class RmResourceRegistration extends BaseEntity
|
||||
|
||||
/** 修改人名称 */
|
||||
private String updaterName;
|
||||
|
||||
/** 监控项 */
|
||||
private String monitorItems;
|
||||
|
||||
/** 自动发现项 */
|
||||
private String discoveryRules;
|
||||
|
||||
/** 查询名称 */
|
||||
private String queryName;
|
||||
|
||||
}
|
||||
/**
|
||||
* 运营商
|
||||
*/
|
||||
private String operator;
|
||||
|
||||
/**
|
||||
* 省
|
||||
*/
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 公网IP
|
||||
*/
|
||||
private String publicIp;
|
||||
|
||||
/**
|
||||
* 业务名称
|
||||
*/
|
||||
@Excel(name = "业务名称")
|
||||
private String businessName;
|
||||
/** 业务代码 */
|
||||
private String businessCode;
|
||||
|
||||
/**
|
||||
* 逻辑节点标识
|
||||
*/
|
||||
@Excel(name = "逻辑节点标识")
|
||||
private String logicalNodeId;
|
||||
|
||||
/**
|
||||
* 多公网IP状态
|
||||
*/
|
||||
private String multiPublicIpStatus;
|
||||
|
||||
/**
|
||||
* 心跳次数
|
||||
*/
|
||||
@Excel(name = "心跳次数")
|
||||
private Integer heartbeatCount;
|
||||
|
||||
/**
|
||||
* 心跳周期(单位:秒)
|
||||
*/
|
||||
@Excel(name = "心跳时间间隔")
|
||||
private Integer heartbeatInterval;
|
||||
|
||||
/** 需要绑定的网卡信息 */
|
||||
private List<Map> bindNetworkMsg;
|
||||
|
||||
// IP1 相关字段
|
||||
@Excel(name = "IP1-运营商")
|
||||
private String ip1Isp; // IP1-运营商
|
||||
|
||||
@Excel(name = "IP1-省")
|
||||
private String ip1Province; // IP1-省
|
||||
|
||||
@Excel(name = "IP1-市")
|
||||
private String ip1City; // IP1-市
|
||||
|
||||
@Excel(name = "IP1-业务公网")
|
||||
private String ip1PublicIp; // IP1-业务公网
|
||||
|
||||
@Excel(name = "IP1-接口名称")
|
||||
private String ip1InterfaceName; // IP1-接口名称
|
||||
|
||||
@Excel(name = "IP1-mac地址")
|
||||
private String ip1MacAddress; // IP1-mac地址
|
||||
|
||||
@Excel(name = "IP1-接口类型")
|
||||
private String ip1InterfaceType; // IP1-接口类型
|
||||
|
||||
@Excel(name = "IP1-IPv4地址")
|
||||
private String ip1Ipv4Address; // IP1-IPv4地址
|
||||
|
||||
@Excel(name = "IP1-网关")
|
||||
private String ip1Gateway; // IP1-网关
|
||||
|
||||
// IP2 相关字段
|
||||
@Excel(name = "IP2-运营商")
|
||||
private String ip2Isp;
|
||||
|
||||
@Excel(name = "IP2-省")
|
||||
private String ip2Province;
|
||||
|
||||
@Excel(name = "IP2-市")
|
||||
private String ip2City;
|
||||
|
||||
@Excel(name = "IP2-业务公网")
|
||||
private String ip2PublicIp;
|
||||
|
||||
@Excel(name = "IP2-接口名称")
|
||||
private String ip2InterfaceName;
|
||||
|
||||
@Excel(name = "IP2-mac地址")
|
||||
private String ip2MacAddress;
|
||||
|
||||
@Excel(name = "IP2-接口类型")
|
||||
private String ip2InterfaceType;
|
||||
|
||||
@Excel(name = "IP2-IPv4地址")
|
||||
private String ip2Ipv4Address;
|
||||
|
||||
@Excel(name = "IP2-网关")
|
||||
private String ip2Gateway;
|
||||
|
||||
// IP3 相关字段
|
||||
@Excel(name = "IP3-运营商")
|
||||
private String ip3Isp;
|
||||
|
||||
@Excel(name = "IP3-省")
|
||||
private String ip3Province;
|
||||
|
||||
@Excel(name = "IP3-市")
|
||||
private String ip3City;
|
||||
|
||||
@Excel(name = "IP3-业务公网")
|
||||
private String ip3PublicIp;
|
||||
|
||||
@Excel(name = "IP3-接口名称")
|
||||
private String ip3InterfaceName;
|
||||
|
||||
@Excel(name = "IP3-mac地址")
|
||||
private String ip3MacAddress;
|
||||
|
||||
@Excel(name = "IP3-接口类型")
|
||||
private String ip3InterfaceType;
|
||||
|
||||
@Excel(name = "IP3-IPv4地址")
|
||||
private String ip3Ipv4Address;
|
||||
|
||||
@Excel(name = "IP3-网关")
|
||||
private String ip3Gateway;
|
||||
|
||||
// 管理网相关字段
|
||||
@Excel(name = "管理网-运营商")
|
||||
private String mgmtIsp; // 管理网-运营商
|
||||
|
||||
@Excel(name = "管理网-省")
|
||||
private String mgmtProvince; // 管理网-省
|
||||
|
||||
@Excel(name = "管理网-市")
|
||||
private String mgmtCity; // 管理网-市
|
||||
|
||||
@Excel(name = "管理网-公网IP")
|
||||
private String mgmtPublicIp; // 管理网-公网IP
|
||||
|
||||
@Excel(name = "管理网-接口名称")
|
||||
private String mgmtInterfaceName; // 管理网-接口名称
|
||||
|
||||
@Excel(name = "管理网-mac地址")
|
||||
private String mgmtMacAddress; // 管理网-mac地址
|
||||
|
||||
@Excel(name = "管理网-接口类型")
|
||||
private String mgmtInterfaceType; // 管理网-接口类型
|
||||
|
||||
@Excel(name = "管理网-IPv4地址")
|
||||
private String mgmtIpv4Address; // 管理网-IPv4地址
|
||||
@Excel(name = "管理网-网关")
|
||||
private String mgmtGateway; // 管理网-IPv4地址
|
||||
|
||||
/** 多条件查询 */
|
||||
private String queryParam;
|
||||
|
||||
/** 金山machineCode */
|
||||
@Excel(name = "金山machineCode")
|
||||
private String machineCode;
|
||||
|
||||
/** 注册时间 */
|
||||
@Excel(name = "注册时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/** 上机时间 */
|
||||
@Excel(name = "上机时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date onboardTime;
|
||||
/** 服务器列表 */
|
||||
private String deployDevice;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 交换机接口信息对象 rm_switch_interface_info
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
@Data
|
||||
public class RmSwitchInterfaceInfo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 硬件SN序列号 */
|
||||
@Excel(name = "硬件SN序列号")
|
||||
private String hardwareSn;
|
||||
|
||||
/** 交换机名称 */
|
||||
@Excel(name = "交换机名称")
|
||||
private String switchName;
|
||||
|
||||
/** 交换机接口名称 */
|
||||
@Excel(name = "交换机接口名称")
|
||||
private String interfaceName;
|
||||
|
||||
/** 接口备注 */
|
||||
@Excel(name = "接口备注")
|
||||
private String interfaceRemark;
|
||||
/** 客户端id */
|
||||
private String clientId;
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 交换机管理对象 rm_switch_management
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
@Data
|
||||
public class RmSwitchManagement extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 交换机名称 */
|
||||
@Excel(name = "交换机名称")
|
||||
private String switchName;
|
||||
|
||||
/** 硬件SN序列号 */
|
||||
@Excel(name = "硬件SN序列号")
|
||||
private String hardwareSn;
|
||||
|
||||
/** SNMP采集地址 */
|
||||
@Excel(name = "SNMP采集地址")
|
||||
private String snmpAddress;
|
||||
|
||||
/** SNMP采集端口 */
|
||||
@Excel(name = "SNMP采集端口")
|
||||
private Long snmpPort;
|
||||
|
||||
/** 在线状态(0-离线,1-在线) */
|
||||
@Excel(name = "在线状态(0-离线,1-在线)")
|
||||
private String onlineStatus;
|
||||
/** 上机时间 */
|
||||
private Date upTime;
|
||||
/** 心跳监测次数 */
|
||||
@Excel(name = "心跳监测次数")
|
||||
private String heartbeatCount;
|
||||
|
||||
/** 心跳监测周期(秒) */
|
||||
@Excel(name = "心跳监测周期(秒)")
|
||||
private String heartbeatInterval;
|
||||
|
||||
/** 心跳检测OID */
|
||||
@Excel(name = "心跳检测OID")
|
||||
private String heartbeatOid;
|
||||
|
||||
/** SNMP版本(v1/v2c/v3) */
|
||||
@Excel(name = "SNMP版本(v1/v2c/v3)")
|
||||
private String snmpVersion;
|
||||
|
||||
/** 读写权限 */
|
||||
@Excel(name = "读写权限")
|
||||
private String readWritePermission;
|
||||
|
||||
/** 安全级别 */
|
||||
@Excel(name = "安全级别")
|
||||
private String securityLevel;
|
||||
|
||||
/** 加密方式 */
|
||||
@Excel(name = "加密方式")
|
||||
private String encryptionMethod;
|
||||
|
||||
/** 团体名称 */
|
||||
@Excel(name = "团体名称")
|
||||
private String communityName;
|
||||
|
||||
/** 密码 */
|
||||
@Excel(name = "密码")
|
||||
private String switchPassword;
|
||||
/** 交换机类型 */
|
||||
private String switchType;
|
||||
/** 用户名 */
|
||||
private String switchUser;
|
||||
/** 端口备注列表 */
|
||||
private List<RmSwitchInterfaceInfo> switchInterfaceInfoList;
|
||||
/** 自动生成客户端id(uuid) */
|
||||
private String clientId;
|
||||
/** 查询条件 */
|
||||
private String queryName;
|
||||
/** 接口信息 */
|
||||
private List<AllInterfaceName> children;
|
||||
/** 前端需要 id 别名 */
|
||||
private Long value;
|
||||
/** 前端需要 name 别名 */
|
||||
private String label;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户自定义列配置对象 user_table_column_config
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-30
|
||||
*/
|
||||
@Data
|
||||
public class UserTableColumnConfig extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/** 页面路由标识(例如:system:user:list, business:order:manage) */
|
||||
private String pageRoute;
|
||||
|
||||
/** 列配置(JSON数组格式) */
|
||||
private String columnConfig;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.system.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
@Data
|
||||
public class RspVo {
|
||||
/** 状态码,0、失败;1、成功*/
|
||||
private Integer resCode;
|
||||
/** 描述 */
|
||||
private String resMag;
|
||||
/** 路由 */
|
||||
private String addRoute;
|
||||
/** 时间戳 */
|
||||
private long timestamp = Instant.now().getEpochSecond();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.ruoyi.system.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum ReviewEnum {
|
||||
未提交("0"),
|
||||
待审核("1"),
|
||||
通过("2"),
|
||||
驳回("3");
|
||||
private String code;
|
||||
ReviewEnum(String code){
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.EpsBusinessDeploy;
|
||||
|
||||
/**
|
||||
* 业务下发管理Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-13
|
||||
*/
|
||||
public interface EpsBusinessDeployMapper
|
||||
{
|
||||
/**
|
||||
* 查询业务下发管理
|
||||
*
|
||||
* @param id 业务下发管理主键
|
||||
* @return 业务下发管理
|
||||
*/
|
||||
public EpsBusinessDeploy selectEpsBusinessDeployById(Long id);
|
||||
|
||||
/**
|
||||
* 查询业务下发管理列表
|
||||
*
|
||||
* @param epsBusinessDeploy 业务下发管理
|
||||
* @return 业务下发管理集合
|
||||
*/
|
||||
public List<EpsBusinessDeploy> selectEpsBusinessDeployList(EpsBusinessDeploy epsBusinessDeploy);
|
||||
|
||||
/**
|
||||
* 新增业务下发管理
|
||||
*
|
||||
* @param epsBusinessDeploy 业务下发管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEpsBusinessDeploy(EpsBusinessDeploy epsBusinessDeploy);
|
||||
|
||||
/**
|
||||
* 修改业务下发管理
|
||||
*
|
||||
* @param epsBusinessDeploy 业务下发管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEpsBusinessDeploy(EpsBusinessDeploy epsBusinessDeploy);
|
||||
|
||||
/**
|
||||
* 删除业务下发管理
|
||||
*
|
||||
* @param id 业务下发管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEpsBusinessDeployById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除业务下发管理
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEpsBusinessDeployByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.EpsBusinessScript;
|
||||
|
||||
/**
|
||||
* 业务脚本管理Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-13
|
||||
*/
|
||||
public interface EpsBusinessScriptMapper
|
||||
{
|
||||
/**
|
||||
* 查询业务脚本管理
|
||||
*
|
||||
* @param id 业务脚本管理主键
|
||||
* @return 业务脚本管理
|
||||
*/
|
||||
public EpsBusinessScript selectEpsBusinessScriptById(Long id);
|
||||
|
||||
/**
|
||||
* 查询业务脚本管理列表
|
||||
*
|
||||
* @param epsBusinessScript 业务脚本管理
|
||||
* @return 业务脚本管理集合
|
||||
*/
|
||||
public List<EpsBusinessScript> selectEpsBusinessScriptList(EpsBusinessScript epsBusinessScript);
|
||||
|
||||
/**
|
||||
* 新增业务脚本管理
|
||||
*
|
||||
* @param epsBusinessScript 业务脚本管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEpsBusinessScript(EpsBusinessScript epsBusinessScript);
|
||||
|
||||
/**
|
||||
* 修改业务脚本管理
|
||||
*
|
||||
* @param epsBusinessScript 业务脚本管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEpsBusinessScript(EpsBusinessScript epsBusinessScript);
|
||||
|
||||
/**
|
||||
* 删除业务脚本管理
|
||||
*
|
||||
* @param id 业务脚本管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEpsBusinessScriptById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除业务脚本管理
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEpsBusinessScriptByIds(Long[] ids);
|
||||
}
|
||||
@@ -41,4 +41,12 @@ public interface EpsInitialTrafficDataMapper {
|
||||
*/
|
||||
List<EpsInitialTrafficData> getAllTraficMsg(EpsInitialTrafficData condition);
|
||||
|
||||
/**
|
||||
* 保存金山流量信息
|
||||
* @param epsInitialTrafficData
|
||||
* @return
|
||||
*/
|
||||
int updateMachineTraffic(EpsInitialTrafficData epsInitialTrafficData);
|
||||
|
||||
List<EpsInitialTrafficData> getTrafficListByClientIds(EpsInitialTrafficData condition);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.EpsTaskStatistics;
|
||||
|
||||
/**
|
||||
* 业务95值计算任务Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-29
|
||||
*/
|
||||
public interface EpsTaskStatisticsMapper
|
||||
{
|
||||
/**
|
||||
* 查询业务95值计算任务
|
||||
*
|
||||
* @param id 业务95值计算任务主键
|
||||
* @return 业务95值计算任务
|
||||
*/
|
||||
public EpsTaskStatistics selectEpsTaskStatisticsById(Long id);
|
||||
|
||||
/**
|
||||
* 查询业务95值计算任务列表
|
||||
*
|
||||
* @param epsTaskStatistics 业务95值计算任务
|
||||
* @return 业务95值计算任务集合
|
||||
*/
|
||||
public List<EpsTaskStatistics> selectEpsTaskStatisticsList(EpsTaskStatistics epsTaskStatistics);
|
||||
|
||||
/**
|
||||
* 新增业务95值计算任务
|
||||
*
|
||||
* @param epsTaskStatistics 业务95值计算任务
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEpsTaskStatistics(EpsTaskStatistics epsTaskStatistics);
|
||||
|
||||
/**
|
||||
* 修改业务95值计算任务
|
||||
*
|
||||
* @param epsTaskStatistics 业务95值计算任务
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEpsTaskStatistics(EpsTaskStatistics epsTaskStatistics);
|
||||
|
||||
/**
|
||||
* 删除业务95值计算任务
|
||||
*
|
||||
* @param id 业务95值计算任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEpsTaskStatisticsById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除业务95值计算任务
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEpsTaskStatisticsByIds(Long[] ids);
|
||||
}
|
||||
@@ -28,6 +28,8 @@ public interface InitialSwitchInfoDetailsMapper
|
||||
*/
|
||||
public List<InitialSwitchInfoDetails> selectInitialSwitchInfoDetailsList(InitialSwitchInfoDetails initialSwitchInfoDetails);
|
||||
|
||||
public List<InitialSwitchInfoDetails> getswitchDetailList(InitialSwitchInfoDetails initialSwitchInfoDetails);
|
||||
|
||||
/**
|
||||
* 新增交换机监控信息
|
||||
*
|
||||
@@ -73,4 +75,11 @@ public interface InitialSwitchInfoDetailsMapper
|
||||
* @return
|
||||
*/
|
||||
List<InitialSwitchInfoDetails> getAllSwitchInfoMsg(InitialSwitchInfoDetails initialSwitchInfoDetails);
|
||||
|
||||
/**
|
||||
* 计算业务95值
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
List<InitialSwitchInfoDetails> sumSwitchTrafficByclientIds(InitialSwitchInfoDetails queryParam);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.RmRegistrationMachine;
|
||||
|
||||
/**
|
||||
* 绑定金山machinecodeMapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
public interface RmRegistrationMachineMapper
|
||||
{
|
||||
/**
|
||||
* 查询绑定金山machinecode
|
||||
*
|
||||
* @param id 绑定金山machinecode主键
|
||||
* @return 绑定金山machinecode
|
||||
*/
|
||||
public RmRegistrationMachine selectRmRegistrationMachineById(Long id);
|
||||
|
||||
/**
|
||||
* 查询绑定金山machinecode列表
|
||||
*
|
||||
* @param rmRegistrationMachine 绑定金山machinecode
|
||||
* @return 绑定金山machinecode集合
|
||||
*/
|
||||
public List<RmRegistrationMachine> selectRmRegistrationMachineList(RmRegistrationMachine rmRegistrationMachine);
|
||||
|
||||
/**
|
||||
* 新增绑定金山machinecode
|
||||
*
|
||||
* @param rmRegistrationMachine 绑定金山machinecode
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmRegistrationMachine(RmRegistrationMachine rmRegistrationMachine);
|
||||
|
||||
/**
|
||||
* 修改绑定金山machinecode
|
||||
*
|
||||
* @param rmRegistrationMachine 绑定金山machinecode
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmRegistrationMachine(RmRegistrationMachine rmRegistrationMachine);
|
||||
|
||||
/**
|
||||
* 删除绑定金山machinecode
|
||||
*
|
||||
* @param id 绑定金山machinecode主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmRegistrationMachineById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除绑定金山machinecode
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmRegistrationMachineByIds(Long[] ids);
|
||||
}
|
||||
@@ -86,4 +86,17 @@ public interface RmResourceRegistrationMapper
|
||||
Integer updateStatusByResource(RmResourceRegistration rmResourceRegistration);
|
||||
|
||||
List<RmResourceRegistration> getRegistrationByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 根据clientId获取注册信息
|
||||
* @param rmResourceRegistration
|
||||
* @return
|
||||
*/
|
||||
RmResourceRegistration selectRegistMsgByClientId(RmResourceRegistration rmResourceRegistration);
|
||||
|
||||
/**
|
||||
* 获取所有逻辑节点标识
|
||||
* @return
|
||||
*/
|
||||
List<Map> getAllLogicalNodeId();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.RmSwitchInterfaceInfo;
|
||||
|
||||
/**
|
||||
* 交换机接口信息Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
public interface RmSwitchInterfaceInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询交换机接口信息
|
||||
*
|
||||
* @param id 交换机接口信息主键
|
||||
* @return 交换机接口信息
|
||||
*/
|
||||
public RmSwitchInterfaceInfo selectRmSwitchInterfaceInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询交换机接口信息列表
|
||||
*
|
||||
* @param rmSwitchInterfaceInfo 交换机接口信息
|
||||
* @return 交换机接口信息集合
|
||||
*/
|
||||
public List<RmSwitchInterfaceInfo> selectRmSwitchInterfaceInfoList(RmSwitchInterfaceInfo rmSwitchInterfaceInfo);
|
||||
|
||||
/**
|
||||
* 新增交换机接口信息
|
||||
*
|
||||
* @param rmSwitchInterfaceInfo 交换机接口信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmSwitchInterfaceInfo(RmSwitchInterfaceInfo rmSwitchInterfaceInfo);
|
||||
|
||||
/**
|
||||
* 修改交换机接口信息
|
||||
*
|
||||
* @param rmSwitchInterfaceInfo 交换机接口信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmSwitchInterfaceInfo(RmSwitchInterfaceInfo rmSwitchInterfaceInfo);
|
||||
|
||||
/**
|
||||
* 删除交换机接口信息
|
||||
*
|
||||
* @param id 交换机接口信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmSwitchInterfaceInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除交换机接口信息
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmSwitchInterfaceInfoByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.RmSwitchManagement;
|
||||
|
||||
/**
|
||||
* 交换机管理Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
public interface RmSwitchManagementMapper
|
||||
{
|
||||
/**
|
||||
* 查询交换机管理
|
||||
*
|
||||
* @param id 交换机管理主键
|
||||
* @return 交换机管理
|
||||
*/
|
||||
public RmSwitchManagement selectRmSwitchManagementById(Long id);
|
||||
|
||||
/**
|
||||
* 查询交换机管理列表
|
||||
*
|
||||
* @param rmSwitchManagement 交换机管理
|
||||
* @return 交换机管理集合
|
||||
*/
|
||||
public List<RmSwitchManagement> selectRmSwitchManagementList(RmSwitchManagement rmSwitchManagement);
|
||||
|
||||
/**
|
||||
* 新增交换机管理
|
||||
*
|
||||
* @param rmSwitchManagement 交换机管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmSwitchManagement(RmSwitchManagement rmSwitchManagement);
|
||||
|
||||
/**
|
||||
* 修改交换机管理
|
||||
*
|
||||
* @param rmSwitchManagement 交换机管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmSwitchManagement(RmSwitchManagement rmSwitchManagement);
|
||||
|
||||
/**
|
||||
* 删除交换机管理
|
||||
*
|
||||
* @param id 交换机管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmSwitchManagementById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除交换机管理
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmSwitchManagementByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.UserTableColumnConfig;
|
||||
|
||||
/**
|
||||
* 用户自定义列配置Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-30
|
||||
*/
|
||||
public interface UserTableColumnConfigMapper
|
||||
{
|
||||
/**
|
||||
* 查询用户自定义列配置
|
||||
*
|
||||
* @param id 用户自定义列配置主键
|
||||
* @return 用户自定义列配置
|
||||
*/
|
||||
public UserTableColumnConfig selectUserTableColumnConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 查询用户自定义列配置列表
|
||||
*
|
||||
* @param userTableColumnConfig 用户自定义列配置
|
||||
* @return 用户自定义列配置集合
|
||||
*/
|
||||
public List<UserTableColumnConfig> selectUserTableColumnConfigList(UserTableColumnConfig userTableColumnConfig);
|
||||
|
||||
/**
|
||||
* 新增用户自定义列配置
|
||||
*
|
||||
* @param userTableColumnConfig 用户自定义列配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUserTableColumnConfig(UserTableColumnConfig userTableColumnConfig);
|
||||
|
||||
/**
|
||||
* 修改用户自定义列配置
|
||||
*
|
||||
* @param userTableColumnConfig 用户自定义列配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserTableColumnConfig(UserTableColumnConfig userTableColumnConfig);
|
||||
|
||||
/**
|
||||
* 删除用户自定义列配置
|
||||
*
|
||||
* @param id 用户自定义列配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserTableColumnConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除用户自定义列配置
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserTableColumnConfigByIds(Long[] ids);
|
||||
}
|
||||
@@ -36,7 +36,15 @@ public interface EpsInitialTrafficDataService {
|
||||
* @return 流量数据列表
|
||||
*/
|
||||
List<EpsInitialTrafficData> query(EpsInitialTrafficData queryParam);
|
||||
/**
|
||||
|
||||
/**
|
||||
* 查询多台设备的流量数据
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
List<EpsInitialTrafficData> getTrafficListByClientIds(EpsInitialTrafficData queryParam);
|
||||
|
||||
/**
|
||||
* 查询初始流量信息
|
||||
* @param queryParam 查询参数实体
|
||||
* @return 初始流量数据列表
|
||||
@@ -48,6 +56,12 @@ public interface EpsInitialTrafficDataService {
|
||||
* @return 流量数据列表
|
||||
*/
|
||||
void calculateBusiness95BandwidthDaily(EpsInitialTrafficData queryParam, String dailyStartTime, String dailyEndTime, String calculationMode);
|
||||
/**
|
||||
* 计算95带宽值-金山带宽/日
|
||||
* @param queryParam 查询参数实体
|
||||
* @return 流量数据列表
|
||||
*/
|
||||
void calculate95ByJinShan(EpsInitialTrafficData queryParam, String dailyStartTime, String dailyEndTime, String calculationMode);
|
||||
|
||||
/**
|
||||
* 重新计算服务器95带宽值
|
||||
@@ -67,4 +81,10 @@ public interface EpsInitialTrafficDataService {
|
||||
* @return
|
||||
*/
|
||||
BigDecimal sumTrafficByServer();
|
||||
|
||||
int updateMachineTraffic(EpsInitialTrafficData epsInitialTrafficData);
|
||||
|
||||
List<Map<String, Object>> getServerGraphicalAnalysisDaily(EpsInitialTrafficData queryParam);
|
||||
|
||||
List<Map<String, Object>> getServerGraphicalAnalysisMonthy(EpsInitialTrafficData queryParam);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.system.domain.EpsBusinessDeploy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 业务下发管理Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-13
|
||||
*/
|
||||
public interface IEpsBusinessDeployService
|
||||
{
|
||||
/**
|
||||
* 查询业务下发管理
|
||||
*
|
||||
* @param id 业务下发管理主键
|
||||
* @return 业务下发管理
|
||||
*/
|
||||
public EpsBusinessDeploy selectEpsBusinessDeployById(Long id);
|
||||
|
||||
/**
|
||||
* 查询业务下发管理列表
|
||||
*
|
||||
* @param epsBusinessDeploy 业务下发管理
|
||||
* @return 业务下发管理集合
|
||||
*/
|
||||
public List<EpsBusinessDeploy> selectEpsBusinessDeployList(EpsBusinessDeploy epsBusinessDeploy);
|
||||
|
||||
/**
|
||||
* 新增业务下发管理
|
||||
*
|
||||
* @param epsBusinessDeploy 业务下发管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEpsBusinessDeploy(EpsBusinessDeploy epsBusinessDeploy);
|
||||
|
||||
/**
|
||||
* 修改业务下发管理
|
||||
*
|
||||
* @param epsBusinessDeploy 业务下发管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEpsBusinessDeploy(EpsBusinessDeploy epsBusinessDeploy);
|
||||
|
||||
/**
|
||||
* 批量删除业务下发管理
|
||||
*
|
||||
* @param ids 需要删除的业务下发管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEpsBusinessDeployByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除业务下发管理信息
|
||||
*
|
||||
* @param id 业务下发管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEpsBusinessDeployById(Long id);
|
||||
|
||||
/**
|
||||
* 审核
|
||||
* @param epsBusinessDeploy
|
||||
* @return
|
||||
*/
|
||||
int reviewBusiness(EpsBusinessDeploy epsBusinessDeploy);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.system.domain.EpsBusinessScript;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 业务脚本管理Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-13
|
||||
*/
|
||||
public interface IEpsBusinessScriptService
|
||||
{
|
||||
/**
|
||||
* 查询业务脚本管理
|
||||
*
|
||||
* @param id 业务脚本管理主键
|
||||
* @return 业务脚本管理
|
||||
*/
|
||||
public EpsBusinessScript selectEpsBusinessScriptById(Long id);
|
||||
|
||||
/**
|
||||
* 查询业务脚本管理列表
|
||||
*
|
||||
* @param epsBusinessScript 业务脚本管理
|
||||
* @return 业务脚本管理集合
|
||||
*/
|
||||
public List<EpsBusinessScript> selectEpsBusinessScriptList(EpsBusinessScript epsBusinessScript);
|
||||
|
||||
/**
|
||||
* 新增业务脚本管理
|
||||
*
|
||||
* @param epsBusinessScript 业务脚本管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEpsBusinessScript(EpsBusinessScript epsBusinessScript);
|
||||
|
||||
/**
|
||||
* 修改业务脚本管理
|
||||
*
|
||||
* @param epsBusinessScript 业务脚本管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEpsBusinessScript(EpsBusinessScript epsBusinessScript);
|
||||
|
||||
/**
|
||||
* 批量删除业务脚本管理
|
||||
*
|
||||
* @param ids 需要删除的业务脚本管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEpsBusinessScriptByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除业务脚本管理信息
|
||||
*
|
||||
* @param id 业务脚本管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEpsBusinessScriptById(Long id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ruoyi.system.domain.EpsTaskStatistics;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 业务95值计算任务Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-29
|
||||
*/
|
||||
public interface IEpsTaskStatisticsService
|
||||
{
|
||||
/**
|
||||
* 查询业务95值计算任务
|
||||
*
|
||||
* @param id 业务95值计算任务主键
|
||||
* @return 业务95值计算任务
|
||||
*/
|
||||
public EpsTaskStatistics selectEpsTaskStatisticsById(Long id);
|
||||
|
||||
/**
|
||||
* 查询业务95值计算任务列表
|
||||
*
|
||||
* @param epsTaskStatistics 业务95值计算任务
|
||||
* @return 业务95值计算任务集合
|
||||
*/
|
||||
public List<EpsTaskStatistics> selectEpsTaskStatisticsList(EpsTaskStatistics epsTaskStatistics);
|
||||
|
||||
/**
|
||||
* 新增业务95值计算任务
|
||||
*
|
||||
* @param epsTaskStatistics 业务95值计算任务
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEpsTaskStatistics(EpsTaskStatistics epsTaskStatistics);
|
||||
|
||||
/**
|
||||
* 修改业务95值计算任务
|
||||
*
|
||||
* @param epsTaskStatistics 业务95值计算任务
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEpsTaskStatistics(EpsTaskStatistics epsTaskStatistics);
|
||||
|
||||
/**
|
||||
* 批量删除业务95值计算任务
|
||||
*
|
||||
* @param ids 需要删除的业务95值计算任务主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEpsTaskStatisticsByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除业务95值计算任务信息
|
||||
*
|
||||
* @param id 业务95值计算任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEpsTaskStatisticsById(Long id);
|
||||
|
||||
/**
|
||||
* 获取相关数据
|
||||
* @param epsTaskStatistics
|
||||
* @return
|
||||
*/
|
||||
PageInfo<?> getRelateData(EpsTaskStatistics epsTaskStatistics);
|
||||
|
||||
/**
|
||||
* 修改相关数据
|
||||
* @param epsTaskStatistics
|
||||
* @return
|
||||
*/
|
||||
int updateRelateData(EpsTaskStatistics epsTaskStatistics);
|
||||
|
||||
/**
|
||||
* 重新计算
|
||||
* @param epsTaskStatistics
|
||||
* @return
|
||||
*/
|
||||
int recaculate(EpsTaskStatistics epsTaskStatistics);
|
||||
|
||||
/**
|
||||
* 图形分析
|
||||
* @param epsTaskStatistics
|
||||
* @return
|
||||
*/
|
||||
Map getRraphicalMsg(EpsTaskStatistics epsTaskStatistics);
|
||||
|
||||
/**
|
||||
* 获取月均日95值的日期
|
||||
* @param epsTaskStatistics
|
||||
* @return
|
||||
*/
|
||||
List<String> getAvgTimeList(EpsTaskStatistics epsTaskStatistics);
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.ruoyi.system.domain.InitialSwitchInfoDetails;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 交换机监控信息Service接口
|
||||
@@ -94,4 +95,18 @@ public interface IInitialSwitchInfoDetailsService
|
||||
* @return
|
||||
*/
|
||||
BigDecimal sumTrafficBySwitch();
|
||||
|
||||
/**
|
||||
* 图形分析-95带宽值mbps/日 v1.1
|
||||
* @param initialSwitchInfoDetails
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getGraphicalAnalysisDaily(InitialSwitchInfoDetails initialSwitchInfoDetails);
|
||||
|
||||
/**
|
||||
* 图形分析-95带宽值mbps/月 v1.1
|
||||
* @param initialSwitchInfoDetails
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getGraphicalAnalysisMonthy(InitialSwitchInfoDetails initialSwitchInfoDetails);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.RmRegistrationMachine;
|
||||
|
||||
/**
|
||||
* 绑定金山machinecodeService接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
public interface IRmRegistrationMachineService
|
||||
{
|
||||
/**
|
||||
* 查询绑定金山machinecode
|
||||
*
|
||||
* @param id 绑定金山machinecode主键
|
||||
* @return 绑定金山machinecode
|
||||
*/
|
||||
public RmRegistrationMachine selectRmRegistrationMachineById(Long id);
|
||||
|
||||
/**
|
||||
* 查询绑定金山machinecode列表
|
||||
*
|
||||
* @param rmRegistrationMachine 绑定金山machinecode
|
||||
* @return 绑定金山machinecode集合
|
||||
*/
|
||||
public List<RmRegistrationMachine> selectRmRegistrationMachineList(RmRegistrationMachine rmRegistrationMachine);
|
||||
|
||||
/**
|
||||
* 新增绑定金山machinecode
|
||||
*
|
||||
* @param rmRegistrationMachine 绑定金山machinecode
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmRegistrationMachine(RmRegistrationMachine rmRegistrationMachine);
|
||||
|
||||
/**
|
||||
* 修改绑定金山machinecode
|
||||
*
|
||||
* @param rmRegistrationMachine 绑定金山machinecode
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmRegistrationMachine(RmRegistrationMachine rmRegistrationMachine);
|
||||
|
||||
/**
|
||||
* 批量删除绑定金山machinecode
|
||||
*
|
||||
* @param ids 需要删除的绑定金山machinecode主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmRegistrationMachineByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除绑定金山machinecode信息
|
||||
*
|
||||
* @param id 绑定金山machinecode主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmRegistrationMachineById(Long id);
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.system.api.domain.RmRegisterMsgRemote;
|
||||
import com.ruoyi.system.api.domain.RmResourceRegistrationRemote;
|
||||
import com.ruoyi.system.domain.RmResourceRegistration;
|
||||
|
||||
import java.util.List;
|
||||
@@ -90,4 +92,38 @@ public interface IRmResourceRegistrationService
|
||||
AjaxResult getServerOnlineRate();
|
||||
|
||||
List<RmResourceRegistration> getRegistrationByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 自动注册
|
||||
* @param rmResourceRegistration
|
||||
* @return
|
||||
*/
|
||||
int innerAddRegist(RmRegisterMsgRemote rmResourceRegistration);
|
||||
|
||||
/**
|
||||
* 添加节点标识
|
||||
* @param rmResourceRegistration
|
||||
* @return
|
||||
*/
|
||||
int innerUpdateRegist(RmResourceRegistrationRemote rmResourceRegistration);
|
||||
|
||||
/**
|
||||
* 选择公网业务IP
|
||||
* @param rmResourceRegistration
|
||||
* @return
|
||||
*/
|
||||
int bindBusinessPublicIp(RmResourceRegistration rmResourceRegistration);
|
||||
|
||||
/**
|
||||
* 查询所有逻辑节点标识
|
||||
* @return
|
||||
*/
|
||||
List<Map> getAllLogicalNodeId();
|
||||
|
||||
/**
|
||||
* 绑定业务名称
|
||||
* @param rmResourceRegistration
|
||||
* @return
|
||||
*/
|
||||
int bindBusinessByClientIds(RmResourceRegistration rmResourceRegistration);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.RmSwitchInterfaceInfo;
|
||||
|
||||
/**
|
||||
* 交换机接口信息Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
public interface IRmSwitchInterfaceInfoService
|
||||
{
|
||||
/**
|
||||
* 查询交换机接口信息
|
||||
*
|
||||
* @param id 交换机接口信息主键
|
||||
* @return 交换机接口信息
|
||||
*/
|
||||
public RmSwitchInterfaceInfo selectRmSwitchInterfaceInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询交换机接口信息列表
|
||||
*
|
||||
* @param rmSwitchInterfaceInfo 交换机接口信息
|
||||
* @return 交换机接口信息集合
|
||||
*/
|
||||
public List<RmSwitchInterfaceInfo> selectRmSwitchInterfaceInfoList(RmSwitchInterfaceInfo rmSwitchInterfaceInfo);
|
||||
|
||||
/**
|
||||
* 新增交换机接口信息
|
||||
*
|
||||
* @param rmSwitchInterfaceInfo 交换机接口信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmSwitchInterfaceInfo(RmSwitchInterfaceInfo rmSwitchInterfaceInfo);
|
||||
|
||||
/**
|
||||
* 修改交换机接口信息
|
||||
*
|
||||
* @param rmSwitchInterfaceInfo 交换机接口信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmSwitchInterfaceInfo(RmSwitchInterfaceInfo rmSwitchInterfaceInfo);
|
||||
|
||||
/**
|
||||
* 批量删除交换机接口信息
|
||||
*
|
||||
* @param ids 需要删除的交换机接口信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmSwitchInterfaceInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除交换机接口信息信息
|
||||
*
|
||||
* @param id 交换机接口信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmSwitchInterfaceInfoById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.system.domain.RmSwitchManagement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 交换机管理Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
public interface IRmSwitchManagementService
|
||||
{
|
||||
/**
|
||||
* 查询交换机管理
|
||||
*
|
||||
* @param id 交换机管理主键
|
||||
* @return 交换机管理
|
||||
*/
|
||||
public RmSwitchManagement selectRmSwitchManagementById(Long id);
|
||||
|
||||
/**
|
||||
* 查询交换机管理列表
|
||||
*
|
||||
* @param rmSwitchManagement 交换机管理
|
||||
* @return 交换机管理集合
|
||||
*/
|
||||
public List<RmSwitchManagement> selectRmSwitchManagementList(RmSwitchManagement rmSwitchManagement);
|
||||
|
||||
/**
|
||||
* 新增交换机管理
|
||||
*
|
||||
* @param rmSwitchManagement 交换机管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmSwitchManagement(RmSwitchManagement rmSwitchManagement);
|
||||
|
||||
/**
|
||||
* 修改交换机管理
|
||||
*
|
||||
* @param rmSwitchManagement 交换机管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmSwitchManagement(RmSwitchManagement rmSwitchManagement);
|
||||
|
||||
/**
|
||||
* 批量删除交换机管理
|
||||
*
|
||||
* @param ids 需要删除的交换机管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmSwitchManagementByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除交换机管理信息
|
||||
*
|
||||
* @param id 交换机管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmSwitchManagementById(Long id);
|
||||
|
||||
/**
|
||||
* 交换机信息树形结构
|
||||
* @return
|
||||
*/
|
||||
List<RmSwitchManagement> getAllSwitchNameTree();
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.system.domain.UserTableColumnConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户自定义列配置Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-30
|
||||
*/
|
||||
public interface IUserTableColumnConfigService
|
||||
{
|
||||
/**
|
||||
* 查询用户自定义列配置
|
||||
*
|
||||
* @param id 用户自定义列配置主键
|
||||
* @return 用户自定义列配置
|
||||
*/
|
||||
public UserTableColumnConfig selectUserTableColumnConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 查询用户自定义列配置列表
|
||||
*
|
||||
* @param userTableColumnConfig 用户自定义列配置
|
||||
* @return 用户自定义列配置集合
|
||||
*/
|
||||
public List<UserTableColumnConfig> selectUserTableColumnConfigList(UserTableColumnConfig userTableColumnConfig);
|
||||
|
||||
/**
|
||||
* 新增用户自定义列配置
|
||||
*
|
||||
* @param userTableColumnConfig 用户自定义列配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUserTableColumnConfig(UserTableColumnConfig userTableColumnConfig);
|
||||
|
||||
/**
|
||||
* 修改用户自定义列配置
|
||||
*
|
||||
* @param userTableColumnConfig 用户自定义列配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserTableColumnConfig(UserTableColumnConfig userTableColumnConfig);
|
||||
|
||||
/**
|
||||
* 批量删除用户自定义列配置
|
||||
*
|
||||
* @param ids 需要删除的用户自定义列配置主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserTableColumnConfigByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除用户自定义列配置信息
|
||||
*
|
||||
* @param id 用户自定义列配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserTableColumnConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 根据用户id获取自定义列详情
|
||||
* @return
|
||||
*/
|
||||
UserTableColumnConfig getColumnConfigByUserId(UserTableColumnConfig userTableColumnConfig);
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.system.api.RemoteRocketMqService;
|
||||
import com.ruoyi.system.api.domain.RmDeployScriptRemote;
|
||||
import com.ruoyi.system.api.domain.RmNetworkInterfaceRemote;
|
||||
import com.ruoyi.system.domain.EpsBusinessDeploy;
|
||||
import com.ruoyi.system.domain.EpsMethodChangeRecord;
|
||||
import com.ruoyi.system.domain.RmResourceRegistration;
|
||||
import com.ruoyi.system.enums.ReviewEnum;
|
||||
import com.ruoyi.system.mapper.EpsBusinessDeployMapper;
|
||||
import com.ruoyi.system.mapper.EpsMethodChangeRecordMapper;
|
||||
import com.ruoyi.system.mapper.RmResourceRegistrationMapper;
|
||||
import com.ruoyi.system.service.IEpsBusinessDeployService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 业务下发管理Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-13
|
||||
*/
|
||||
@Service
|
||||
public class EpsBusinessDeployServiceImpl implements IEpsBusinessDeployService
|
||||
{
|
||||
@Autowired
|
||||
private EpsBusinessDeployMapper epsBusinessDeployMapper;
|
||||
@Autowired
|
||||
private RmResourceRegistrationMapper rmResourceRegistrationMapper;
|
||||
@Autowired
|
||||
private RemoteRocketMqService remoteRocketMqService;
|
||||
@Autowired
|
||||
private EpsMethodChangeRecordMapper epsMethodChangeRecordMapper;
|
||||
|
||||
/**
|
||||
* 查询业务下发管理
|
||||
*
|
||||
* @param id 业务下发管理主键
|
||||
* @return 业务下发管理
|
||||
*/
|
||||
@Override
|
||||
public EpsBusinessDeploy selectEpsBusinessDeployById(Long id)
|
||||
{
|
||||
EpsBusinessDeploy detailMsg = epsBusinessDeployMapper.selectEpsBusinessDeployById(id);
|
||||
String[] clientIds = detailMsg.getDeployDevice().split("\n");
|
||||
|
||||
// 创建一个列表来存储处理后的clientId信息
|
||||
List<String> processedClientIds = new ArrayList<>();
|
||||
|
||||
// 根据clientId获取服务器公网ip
|
||||
for (String clientId : clientIds) {
|
||||
if (StringUtils.isNotBlank(clientId)) {
|
||||
RmResourceRegistration rmResourceRegistration = new RmResourceRegistration();
|
||||
rmResourceRegistration.setClientId(clientId.trim()); // 使用clientId字段查询
|
||||
|
||||
// 根据clientId查询注册信息
|
||||
RmResourceRegistration publicIpVo = rmResourceRegistrationMapper.selectRegistMsgByClientId(rmResourceRegistration);
|
||||
|
||||
String processedClientId;
|
||||
if (publicIpVo != null && StringUtils.isNotBlank(publicIpVo.getIp1PublicIp())) {
|
||||
// 如果有公网IP,格式为:公网IP + 空格 + 原clientId
|
||||
processedClientId = publicIpVo.getIp1PublicIp() + " " + clientId.trim();
|
||||
} else {
|
||||
// 如果没有公网IP,保持原样
|
||||
processedClientId = clientId.trim();
|
||||
}
|
||||
processedClientIds.add(processedClientId);
|
||||
}
|
||||
}
|
||||
|
||||
// 将处理后的结果重新设置回detailMsg
|
||||
if (detailMsg != null) {
|
||||
// 如果需要修改原对象的deployDevice字段
|
||||
String processedDeployDevice = String.join("\n", processedClientIds);
|
||||
detailMsg.setDeployDevice(processedDeployDevice);
|
||||
}
|
||||
|
||||
return detailMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询业务下发管理列表
|
||||
*
|
||||
* @param epsBusinessDeploy 业务下发管理
|
||||
* @return 业务下发管理
|
||||
*/
|
||||
@Override
|
||||
public List<EpsBusinessDeploy> selectEpsBusinessDeployList(EpsBusinessDeploy epsBusinessDeploy)
|
||||
{
|
||||
return epsBusinessDeployMapper.selectEpsBusinessDeployList(epsBusinessDeploy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增业务下发管理
|
||||
*
|
||||
* @param epsBusinessDeploy 业务下发管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEpsBusinessDeploy(EpsBusinessDeploy epsBusinessDeploy)
|
||||
{
|
||||
epsBusinessDeploy.setCreateTime(DateUtils.getNowDate());
|
||||
epsBusinessDeploy.setSubmitBy(SecurityUtils.getUsername());
|
||||
return epsBusinessDeployMapper.insertEpsBusinessDeploy(epsBusinessDeploy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改业务下发管理
|
||||
*
|
||||
* @param epsBusinessDeploy 业务下发管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateEpsBusinessDeploy(EpsBusinessDeploy epsBusinessDeploy)
|
||||
{
|
||||
epsBusinessDeploy.setUpdateTime(DateUtils.getNowDate());
|
||||
return epsBusinessDeployMapper.updateEpsBusinessDeploy(epsBusinessDeploy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除业务下发管理
|
||||
*
|
||||
* @param ids 需要删除的业务下发管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEpsBusinessDeployByIds(Long[] ids)
|
||||
{
|
||||
return epsBusinessDeployMapper.deleteEpsBusinessDeployByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除业务下发管理信息
|
||||
*
|
||||
* @param id 业务下发管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEpsBusinessDeployById(Long id)
|
||||
{
|
||||
return epsBusinessDeployMapper.deleteEpsBusinessDeployById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核
|
||||
* @param epsBusinessDeploy
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int reviewBusiness(EpsBusinessDeploy epsBusinessDeploy) {
|
||||
// 设置审核信息
|
||||
epsBusinessDeploy.setReviewBy(SecurityUtils.getUsername());
|
||||
epsBusinessDeploy.setReviewTime(DateUtils.getNowDate());
|
||||
int rows = epsBusinessDeployMapper.updateEpsBusinessDeploy(epsBusinessDeploy);
|
||||
if(StringUtils.equals(ReviewEnum.通过.getCode(), epsBusinessDeploy.getReviewStatus())){
|
||||
// 根据id查询业务信息
|
||||
EpsBusinessDeploy businessMsg = epsBusinessDeployMapper.selectEpsBusinessDeployById(epsBusinessDeploy.getId());
|
||||
String businessCode = businessMsg.getBusinessCode();
|
||||
String businessName = businessMsg.getBusinessName();
|
||||
String clientIdStr = businessMsg.getDeployDevice();
|
||||
// 添加服务器脚本执行策略
|
||||
RmDeployScriptRemote addData = new RmDeployScriptRemote();
|
||||
addData.setDeployDevice(clientIdStr);
|
||||
addData.setExecutionMethod(0);
|
||||
addData.setPolicyStatus("0");
|
||||
addData.setTaskName(businessMsg.getTaskName());
|
||||
addData.setScriptName(businessMsg.getScriptName());
|
||||
addData.setScriptPath(businessMsg.getScriptPath());
|
||||
addData.setDefaultParams(businessMsg.getScriptParams());
|
||||
addData.setPolicyName("策略"+ DateUtils.dateTimeNow());
|
||||
remoteRocketMqService.addDeployScript(addData, SecurityConstants.INNER);
|
||||
String[] clientIds = clientIdStr.split("\n");
|
||||
// 保存业务修改记录
|
||||
for (String clientId : clientIds) {
|
||||
// 根据clientId查询网卡接口名称
|
||||
RmNetworkInterfaceRemote queryParam = new RmNetworkInterfaceRemote();
|
||||
queryParam.setClientId(clientId);
|
||||
List<RmNetworkInterfaceRemote> interfaceList = remoteRocketMqService.getNetworkInterfaceList(queryParam, SecurityConstants.INNER).getData();
|
||||
String interfaceName = "";
|
||||
if (interfaceList != null && !interfaceList.isEmpty()) {
|
||||
interfaceName = interfaceList.stream()
|
||||
.filter(interfaceRemote -> "1".equals(interfaceRemote.getBindIp()))
|
||||
.map(RmNetworkInterfaceRemote::getInterfaceName)
|
||||
.filter(name -> name != null && !name.trim().isEmpty())
|
||||
.collect(Collectors.joining(","));
|
||||
}
|
||||
EpsMethodChangeRecord changeRecord = new EpsMethodChangeRecord();
|
||||
// 设置基本信息
|
||||
changeRecord.setClientId(clientId);
|
||||
changeRecord.setTrafficPort(interfaceName);
|
||||
changeRecord.setBusinessCode(businessCode);
|
||||
changeRecord.setBusinessName(businessName);
|
||||
changeRecord.setCreateTime(DateUtils.getNowDate());
|
||||
changeRecord.setUpdateTime(DateUtils.getNowDate());
|
||||
changeRecord.setCreatBy(SecurityUtils.getUsername());
|
||||
changeRecord.setUpdateBy(SecurityUtils.getUsername());
|
||||
// 修改内容
|
||||
String content = "流量网口设置为" + interfaceName + ",业务为" + businessName;
|
||||
changeRecord.setChangeContent(content);
|
||||
// 保存数据
|
||||
epsMethodChangeRecordMapper.insertEpsMethodChangeRecord(changeRecord);
|
||||
// 绑定业务名称
|
||||
RmResourceRegistration updateData = new RmResourceRegistration();
|
||||
updateData.setBusinessName(businessName);
|
||||
updateData.setClientId(clientId);
|
||||
rmResourceRegistrationMapper.updateStatusByResource(updateData);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
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.EpsBusinessScript;
|
||||
import com.ruoyi.system.mapper.EpsBusinessScriptMapper;
|
||||
import com.ruoyi.system.service.IEpsBusinessScriptService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 业务脚本管理Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-13
|
||||
*/
|
||||
@Service
|
||||
public class EpsBusinessScriptServiceImpl implements IEpsBusinessScriptService
|
||||
{
|
||||
@Autowired
|
||||
private EpsBusinessScriptMapper epsBusinessScriptMapper;
|
||||
|
||||
/**
|
||||
* 查询业务脚本管理
|
||||
*
|
||||
* @param id 业务脚本管理主键
|
||||
* @return 业务脚本管理
|
||||
*/
|
||||
@Override
|
||||
public EpsBusinessScript selectEpsBusinessScriptById(Long id)
|
||||
{
|
||||
return epsBusinessScriptMapper.selectEpsBusinessScriptById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询业务脚本管理列表
|
||||
*
|
||||
* @param epsBusinessScript 业务脚本管理
|
||||
* @return 业务脚本管理
|
||||
*/
|
||||
@Override
|
||||
public List<EpsBusinessScript> selectEpsBusinessScriptList(EpsBusinessScript epsBusinessScript)
|
||||
{
|
||||
return epsBusinessScriptMapper.selectEpsBusinessScriptList(epsBusinessScript);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增业务脚本管理
|
||||
*
|
||||
* @param epsBusinessScript 业务脚本管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEpsBusinessScript(EpsBusinessScript epsBusinessScript)
|
||||
{
|
||||
epsBusinessScript.setCreateTime(DateUtils.getNowDate());
|
||||
epsBusinessScript.setCreateBy(SecurityUtils.getUsername());
|
||||
return epsBusinessScriptMapper.insertEpsBusinessScript(epsBusinessScript);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改业务脚本管理
|
||||
*
|
||||
* @param epsBusinessScript 业务脚本管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateEpsBusinessScript(EpsBusinessScript epsBusinessScript)
|
||||
{
|
||||
epsBusinessScript.setUpdateTime(DateUtils.getNowDate());
|
||||
return epsBusinessScriptMapper.updateEpsBusinessScript(epsBusinessScript);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除业务脚本管理
|
||||
*
|
||||
* @param ids 需要删除的业务脚本管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEpsBusinessScriptByIds(Long[] ids)
|
||||
{
|
||||
return epsBusinessScriptMapper.deleteEpsBusinessScriptByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除业务脚本管理信息
|
||||
*
|
||||
* @param id 业务脚本管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEpsBusinessScriptById(Long id)
|
||||
{
|
||||
return epsBusinessScriptMapper.deleteEpsBusinessScriptById(id);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.utils.EchartsDataUtils;
|
||||
import com.ruoyi.common.core.utils.SpeedUtils;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.enums.ReviewEnum;
|
||||
import com.ruoyi.system.mapper.*;
|
||||
import com.ruoyi.system.service.EpsInitialTrafficDataService;
|
||||
import com.ruoyi.system.util.CalculateUtil;
|
||||
@@ -19,16 +22,19 @@ import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.YearMonth;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataService {
|
||||
|
||||
private static final String DATE_TIME_FORMATTER = "yyyy-MM-dd HH:mm:ss";
|
||||
@Autowired
|
||||
private EpsInitialTrafficDataMapper epsInitialTrafficDataMapper;
|
||||
@Autowired
|
||||
@@ -39,6 +45,10 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
private EpsServerRevenueConfigMapper epsServerRevenueConfigMapper;
|
||||
@Autowired
|
||||
private EpsMethodChangeRecordMapper epsMethodChangeRecordMapper;
|
||||
@Autowired
|
||||
private EpsBusinessDeployMapper epsBusinessDeployMapper;
|
||||
@Autowired
|
||||
private RmEpsTopologyManagementMapper rmEpsTopologyManagementMapper;
|
||||
@Override
|
||||
public void createNextMonthTables() {
|
||||
LocalDate nextMonth = LocalDate.now().plusMonths(1);
|
||||
@@ -184,6 +194,7 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
.flatMap(tableName -> {
|
||||
EpsInitialTrafficData condition = new EpsInitialTrafficData();
|
||||
condition.setTableName(tableName);
|
||||
condition.setClientId(queryParam.getClientId());
|
||||
condition.setServiceSn(queryParam.getServiceSn());
|
||||
condition.setStartTime(queryParam.getStartTime());
|
||||
condition.setEndTime(queryParam.getEndTime());
|
||||
@@ -193,6 +204,33 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询多台设备的流量数据
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<EpsInitialTrafficData> getTrafficListByClientIds(EpsInitialTrafficData queryParam) {
|
||||
|
||||
// 获取涉及的表名
|
||||
Set<String> tableNames = TableRouterUtil.getTableNamesBetween(queryParam.getStartTime(), queryParam.getEndTime());
|
||||
|
||||
// 并行查询各表
|
||||
return tableNames.parallelStream()
|
||||
.flatMap(tableName -> {
|
||||
EpsInitialTrafficData condition = new EpsInitialTrafficData();
|
||||
condition.setTableName(tableName);
|
||||
condition.setStartTime(queryParam.getStartTime());
|
||||
condition.setEndTime(queryParam.getEndTime());
|
||||
condition.setBusinessId(queryParam.getBusinessId());
|
||||
condition.setBusinessName(queryParam.getBusinessName());
|
||||
condition.setClientIds(queryParam.getClientIds());
|
||||
return epsInitialTrafficDataMapper.getTrafficListByClientIds(condition).stream();
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EpsInitialTrafficData> getAllTraficMsg(EpsInitialTrafficData queryParam) {
|
||||
|
||||
@@ -221,9 +259,43 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
// 获取所有设备SN列表
|
||||
List<AllInterfaceName> snList = allInterfaceNameMapper.getAllDeviceSn(new AllInterfaceName());
|
||||
// 遍历处理每个设备
|
||||
snList.forEach(interfaceName -> {
|
||||
queryParam.setClientId(interfaceName.getClientId());
|
||||
calculateChangedDeviceBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 计算金山95带宽值/日
|
||||
* @param queryParam
|
||||
*/
|
||||
@Override
|
||||
public void calculate95ByJinShan(EpsInitialTrafficData queryParam,
|
||||
String dailyStartTime, String dailyEndTime, String calculationMode) {
|
||||
// 获取所有设备SN列表
|
||||
List<AllInterfaceName> snList = allInterfaceNameMapper.getAllDeviceSn(new AllInterfaceName());
|
||||
// 遍历处理每个设备
|
||||
snList.forEach(interfaceName -> {
|
||||
queryParam.setServiceSn(interfaceName.getDeviceSn());
|
||||
processDeviceBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode);
|
||||
queryParam.setStartTime(dailyStartTime);
|
||||
queryParam.setEndTime(dailyEndTime);
|
||||
List<EpsInitialTrafficData> dataList = query(queryParam);
|
||||
|
||||
if (!dataList.isEmpty()) {
|
||||
// 1. 提取并转换带宽值
|
||||
List<BigDecimal> speedsInMbps = dataList.stream()
|
||||
.map(data -> CalculateUtil.parseSpeedToMbps(data.getMachineFlow(), calculationMode))
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 2. 计算95百分位
|
||||
BigDecimal percentile95 = CalculateUtil.calculatePercentile(speedsInMbps, 0.95);
|
||||
|
||||
// 3. 保存结果
|
||||
EpsInitialTrafficData epsInitialTrafficData = dataList.get(0);
|
||||
epsInitialTrafficData.setResourceType("1");
|
||||
epsInitialTrafficData.setBandwidthType("8");
|
||||
saveBandwidthResult(epsInitialTrafficData, percentile95, dailyStartTime, calculationMode);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -343,6 +415,208 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
return total.setScale(0, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
/**
|
||||
* 金山流量插入数据
|
||||
* @param epsInitialTrafficData
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int updateMachineTraffic(EpsInitialTrafficData epsInitialTrafficData) {
|
||||
int rows = epsInitialTrafficDataMapper.updateMachineTraffic(epsInitialTrafficData);
|
||||
return rows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getServerGraphicalAnalysisDaily(EpsInitialTrafficData queryParam) {
|
||||
|
||||
// 拿到时间范围
|
||||
String startTime = queryParam.getStartTime();
|
||||
String endTime = queryParam.getEndTime();
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
|
||||
// 2. 解析日期范围
|
||||
LocalDate startDate = LocalDate.parse(startTime);
|
||||
LocalDate endDate = LocalDate.parse(endTime);
|
||||
|
||||
// 3. 循环处理每一天
|
||||
for (LocalDate date = startDate; !date.isAfter(endDate); date = date.plusDays(1)) {
|
||||
// 构造当天的开始和结束时间(精确到秒)
|
||||
String dayStart = date.atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
String dayEnd = date.atTime(23, 59, 59).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
|
||||
// 创建当天的查询条件
|
||||
EpsInitialTrafficData dailyQuery = new EpsInitialTrafficData();
|
||||
BeanUtils.copyProperties(queryParam, dailyQuery); // 复制原有属性
|
||||
dailyQuery.setStartTime(dayStart);
|
||||
dailyQuery.setEndTime(dayEnd);
|
||||
// 时间范围
|
||||
String timeRange = "从" + dayStart + "到" + dayEnd;
|
||||
|
||||
// 根据clientId查询已经配置的接口
|
||||
String clientIds = queryParam.getClientIds();
|
||||
String[] clientIdArr = clientIds.split(",");
|
||||
if(clientIdArr != null){
|
||||
for (String clientId : clientIdArr) {
|
||||
try {
|
||||
// 查询95值
|
||||
BigDecimal percentile95 = BigDecimal.ZERO;
|
||||
EpsNodeBandwidth bandwidthQuery = new EpsNodeBandwidth();
|
||||
bandwidthQuery.setBandwidthType("1");
|
||||
bandwidthQuery.setCreateTime(DateUtils.parseDate(date));
|
||||
bandwidthQuery.setCalculationMode(queryParam.getCalculationMode());
|
||||
bandwidthQuery.setClientId(clientId);
|
||||
List<EpsNodeBandwidth> epsNodeBandwidthList = epsNodeBandwidthMapper.selectEpsNodeBandwidthList(bandwidthQuery);
|
||||
|
||||
if(!epsNodeBandwidthList.isEmpty()){
|
||||
EpsNodeBandwidth nodeBandwidth = epsNodeBandwidthList.get(0);
|
||||
percentile95 = nodeBandwidth.getBandwidthResult();
|
||||
}
|
||||
dailyQuery.setClientIds(clientId);
|
||||
Map<String, Object> resultMap = serverNetSpeedEcharts(dailyQuery, percentile95);
|
||||
// 查询业务信息
|
||||
String businessName = null;
|
||||
EpsBusinessDeploy businessQuery = new EpsBusinessDeploy();
|
||||
businessQuery.setClientId(clientId);
|
||||
businessQuery.setReviewStatus(ReviewEnum.通过.getCode());
|
||||
List<EpsBusinessDeploy> businessDeploys = epsBusinessDeployMapper.selectEpsBusinessDeployList(businessQuery);
|
||||
|
||||
if(!businessDeploys.isEmpty()){
|
||||
businessName = businessDeploys.get(0).getBusinessName();
|
||||
}
|
||||
|
||||
StringJoiner joiner = new StringJoiner("");
|
||||
if (clientId != null) {
|
||||
joiner.add("【" + clientId + "】");
|
||||
}
|
||||
if (businessName != null) {
|
||||
joiner.add("【" + businessName + "】");
|
||||
}
|
||||
String name = joiner.toString();
|
||||
resultMap.put("name", name);
|
||||
resultMap.put("timeRange", timeRange);
|
||||
resultList.add(resultMap);
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultList.isEmpty() ? new ArrayList<>() : resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 图形分析-95带宽值/月
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getServerGraphicalAnalysisMonthy(EpsInitialTrafficData queryParam) {
|
||||
// 拿到时间范围
|
||||
String startTime = queryParam.getStartTime();
|
||||
String endTime = queryParam.getEndTime();
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
// 2. 解析月份范围
|
||||
YearMonth start = YearMonth.parse(startTime);
|
||||
YearMonth end = YearMonth.parse(endTime);
|
||||
// 3. 循环处理每个月
|
||||
for (YearMonth month = start; !month.isAfter(end); month = month.plusMonths(1)) {
|
||||
// 获取当月的第一天和最后一天(精确到秒)
|
||||
String monthStart = month.atDay(1).atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
String monthEnd = month.atEndOfMonth().atTime(23, 59, 59)
|
||||
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
// 创建当天的查询条件
|
||||
EpsInitialTrafficData dailyQuery = new EpsInitialTrafficData();
|
||||
BeanUtils.copyProperties(queryParam, dailyQuery); // 复制原有属性
|
||||
dailyQuery.setStartTime(monthStart);
|
||||
dailyQuery.setEndTime(monthEnd);
|
||||
String timeRange = "从" + monthStart + "到" + monthEnd;
|
||||
// 根据clientId查询已经配置的接口
|
||||
String clientIds = queryParam.getClientIds();
|
||||
String[] clientIdArr = clientIds.split(",");
|
||||
if(clientIdArr != null){
|
||||
for (String clientId : clientIdArr) {
|
||||
try {
|
||||
// 查询95值
|
||||
BigDecimal percentile95 = BigDecimal.ZERO;
|
||||
EpsNodeBandwidth bandwidthQuery = new EpsNodeBandwidth();
|
||||
bandwidthQuery.setBandwidthType("1");
|
||||
bandwidthQuery.setCreateTime(DateUtils.parseDate(monthStart));
|
||||
bandwidthQuery.setCalculationMode(queryParam.getCalculationMode());
|
||||
bandwidthQuery.setClientId(clientId);
|
||||
List<EpsNodeBandwidth> epsNodeBandwidthList = epsNodeBandwidthMapper.selectEpsNodeBandwidthList(bandwidthQuery);
|
||||
|
||||
if(!epsNodeBandwidthList.isEmpty()){
|
||||
EpsNodeBandwidth nodeBandwidth = epsNodeBandwidthList.get(0);
|
||||
percentile95 = nodeBandwidth.getBandwidthResult();
|
||||
}
|
||||
dailyQuery.setClientIds(clientId);
|
||||
Map<String, Object> resultMap = serverNetSpeedEcharts(dailyQuery, percentile95);
|
||||
// 查询业务信息
|
||||
String businessName = null;
|
||||
EpsBusinessDeploy businessQuery = new EpsBusinessDeploy();
|
||||
businessQuery.setClientId(clientId);
|
||||
businessQuery.setReviewStatus(ReviewEnum.通过.getCode());
|
||||
List<EpsBusinessDeploy> businessDeploys = epsBusinessDeployMapper.selectEpsBusinessDeployList(businessQuery);
|
||||
|
||||
if(!businessDeploys.isEmpty()){
|
||||
businessName = businessDeploys.get(0).getBusinessName();
|
||||
}
|
||||
|
||||
StringJoiner joiner = new StringJoiner("");
|
||||
if (clientId != null) {
|
||||
joiner.add("【" + clientId + "】");
|
||||
}
|
||||
if (businessName != null) {
|
||||
joiner.add("【" + businessName + "】");
|
||||
}
|
||||
String name = joiner.toString();
|
||||
resultMap.put("name", name);
|
||||
resultMap.put("timeRange", timeRange);
|
||||
resultList.add(resultMap);
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultList.isEmpty() ? new ArrayList<>() : resultList;
|
||||
}
|
||||
/**
|
||||
* 获取服务器网口网络速率
|
||||
* @param epsInitialTrafficData
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> serverNetSpeedEcharts(EpsInitialTrafficData epsInitialTrafficData, BigDecimal percentile95) {
|
||||
List<EpsInitialTrafficData> list = getTrafficListByClientIds(epsInitialTrafficData);
|
||||
if(!list.isEmpty()){
|
||||
try {
|
||||
list.forEach(data -> data.setPercentile95(SpeedUtils.mbitToBit(percentile95)));
|
||||
SpeedUtils.SpeedResult result = SpeedUtils.calculateWithStringTraffic(list, "inSpeed", "outSpeed");
|
||||
BigDecimal divisor = SpeedUtils.getDivisor(result.getRecommendedUnit());
|
||||
Map<String, Function<EpsInitialTrafficData, ?>> extractors = new LinkedHashMap<>();
|
||||
|
||||
extractors.put("netOutSpeedData", info ->
|
||||
info != null && info.getOutSpeed() != null ?
|
||||
new BigDecimal(info.getOutSpeed()).divide(divisor, 0, RoundingMode.HALF_UP) :
|
||||
0);
|
||||
extractors.put("netMachineFlowData", info ->
|
||||
info != null && info.getMachineFlow() != null ?
|
||||
new BigDecimal(info.getMachineFlow()).divide(divisor, 0, RoundingMode.HALF_UP) :
|
||||
0);
|
||||
extractors.put("percentile95", info ->
|
||||
info != null && info.getPercentile95() != null ?
|
||||
info.getPercentile95().divide(divisor, 2, RoundingMode.HALF_UP) :
|
||||
0);
|
||||
Map<String, Object> resultMap = EchartsDataUtils.buildEchartsData(list, EpsInitialTrafficData::getCreateTime, extractors);
|
||||
resultMap.put("other", result);
|
||||
resultMap.put("95value", percentile95);
|
||||
return resultMap;
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return new HashMap<>();
|
||||
}
|
||||
/**
|
||||
* 提取公共方法
|
||||
* @return
|
||||
@@ -366,33 +640,6 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
return dataList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理单个设备的带宽计算
|
||||
*/
|
||||
private void processDeviceBandwidth(EpsInitialTrafficData queryParam,
|
||||
String dailyStartTime,
|
||||
String dailyEndTime, String calculationMode) {
|
||||
// 1. 检查设备是否有业务变更
|
||||
EpsServerRevenueConfig revenueConfig = new EpsServerRevenueConfig();
|
||||
revenueConfig.setHardwareSn(queryParam.getServiceSn());
|
||||
List<EpsServerRevenueConfig> changedList = epsServerRevenueConfigMapper
|
||||
.selectEpsServerRevenueConfigList(revenueConfig);
|
||||
|
||||
// 2. 根据业务变更情况选择计算方式
|
||||
if (hasTrafficMethodChanged(changedList)) {
|
||||
calculateChangedDeviceBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode);
|
||||
} else {
|
||||
calculateNormalDeviceBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 判断是否为流量型业务变更
|
||||
*/
|
||||
private boolean hasTrafficMethodChanged(List<EpsServerRevenueConfig> changedList) {
|
||||
return !changedList.isEmpty() &&
|
||||
"1".equals(changedList.get(0).getChanged()) &&
|
||||
"1".equals(changedList.get(0).getRevenueMethod());
|
||||
}
|
||||
/**
|
||||
* 计算有业务变更设备的带宽
|
||||
*/
|
||||
@@ -401,7 +648,7 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
String dailyEndTime, String calculationMode) {
|
||||
// 1. 获取业务变更记录(按时间降序)
|
||||
EpsMethodChangeRecord changeQuery = new EpsMethodChangeRecord();
|
||||
changeQuery.setHardwareSn(queryParam.getServiceSn());
|
||||
changeQuery.setClientId(queryParam.getClientId());
|
||||
changeQuery.setStartTime(dailyStartTime);
|
||||
changeQuery.setEndTime(dailyEndTime);
|
||||
List<EpsMethodChangeRecord> records = epsMethodChangeRecordMapper
|
||||
@@ -435,11 +682,7 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
* 计算并保存95带宽值
|
||||
*/
|
||||
private void calculateAndSave95Bandwidth(List<EpsInitialTrafficData> dataList, String dateTime, String dayOrMonth, String calculationMode) {
|
||||
boolean eff = false;
|
||||
if(!dataList.isEmpty()){
|
||||
if(dataList.size()<288){
|
||||
eff = true;
|
||||
}
|
||||
// 1. 提取并转换带宽值
|
||||
List<BigDecimal> speedsInMbps = dataList.stream()
|
||||
.map(data -> CalculateUtil.parseSpeedToMbps(data.getOutSpeed(), calculationMode))
|
||||
@@ -452,24 +695,11 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
// 3. 保存结果
|
||||
EpsInitialTrafficData epsInitialTrafficData = dataList.get(0);
|
||||
epsInitialTrafficData.setResourceType("1");
|
||||
if("2".equals(epsInitialTrafficData.getRevenueMethod())){
|
||||
percentile95 = epsInitialTrafficData.getPackageBandwidth();
|
||||
epsInitialTrafficData.setBandwidthType("3");
|
||||
}else {
|
||||
if("1".equals(dayOrMonth)){
|
||||
if(eff){
|
||||
epsInitialTrafficData.setBandwidthType("5");
|
||||
}else {
|
||||
epsInitialTrafficData.setBandwidthType("1");
|
||||
}
|
||||
}
|
||||
if("2".equals(dayOrMonth)){
|
||||
if(eff){
|
||||
epsInitialTrafficData.setBandwidthType("6");
|
||||
}else {
|
||||
epsInitialTrafficData.setBandwidthType("2");
|
||||
}
|
||||
}
|
||||
if("1".equals(dayOrMonth)){
|
||||
epsInitialTrafficData.setBandwidthType("1");
|
||||
}
|
||||
if("2".equals(dayOrMonth)){
|
||||
epsInitialTrafficData.setBandwidthType("2");
|
||||
}
|
||||
saveBandwidthResult(epsInitialTrafficData, percentile95, dateTime, calculationMode);
|
||||
}
|
||||
@@ -483,15 +713,15 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
String dailyStartTime,
|
||||
String dailyEndTime, String calculationMode) {
|
||||
// 1. 处理变更时间段(从最新到最早)
|
||||
String endTime = records.get(0).getCreateTime() + "";
|
||||
String endTime = DateUtils.parseDateToStr(DATE_TIME_FORMATTER, records.get(0).getCreateTime());
|
||||
for (int i = 1; i < records.size(); i++) {
|
||||
String startTime = records.get(i).getCreateTime() + "";
|
||||
String startTime = DateUtils.parseDateToStr(DATE_TIME_FORMATTER, records.get(i).getCreateTime());
|
||||
calculateSegment95(queryParam, startTime, endTime, calculationMode);
|
||||
endTime = startTime; // 移动时间窗口
|
||||
}
|
||||
|
||||
// 2. 处理最早变更前的时间段(昨天00:00:00 ~ 最早变更时间)
|
||||
String earliestChangeTime = records.get(records.size()-1).getCreateTime() + "";
|
||||
String earliestChangeTime = DateUtils.parseDateToStr(DATE_TIME_FORMATTER, records.get(records.size()-1).getCreateTime());
|
||||
calculateSegment95(queryParam, dailyStartTime, earliestChangeTime, calculationMode);
|
||||
|
||||
// 3. 处理最后变更后的时间段(最新变更时间 ~ 昨天23:59:59)
|
||||
@@ -537,25 +767,11 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
// 服务器信息
|
||||
EpsInitialTrafficData epsInitialTrafficData = dataList.get(0);
|
||||
epsInitialTrafficData.setResourceType("1");
|
||||
if("2".equals(epsInitialTrafficData.getRevenueMethod())){
|
||||
dailyResult = epsInitialTrafficData.getPackageBandwidth();
|
||||
epsInitialTrafficData.setBandwidthType("3");
|
||||
}else{
|
||||
if(CalculateUtil.isEff(dataList)){
|
||||
if("1".equals(dayOrMonth)){
|
||||
epsInitialTrafficData.setBandwidthType("5");
|
||||
}
|
||||
if("2".equals(dayOrMonth)){
|
||||
epsInitialTrafficData.setBandwidthType("6");
|
||||
}
|
||||
}else {
|
||||
if("1".equals(dayOrMonth)){
|
||||
epsInitialTrafficData.setBandwidthType("1");
|
||||
}
|
||||
if("2".equals(dayOrMonth)){
|
||||
epsInitialTrafficData.setBandwidthType("2");
|
||||
}
|
||||
}
|
||||
if("1".equals(dayOrMonth)){
|
||||
epsInitialTrafficData.setBandwidthType("1");
|
||||
}
|
||||
if("2".equals(dayOrMonth)){
|
||||
epsInitialTrafficData.setBandwidthType("2");
|
||||
}
|
||||
saveBandwidthResult(epsInitialTrafficData, dailyResult, startTime, calculationMode);
|
||||
}
|
||||
@@ -566,9 +782,9 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
BigDecimal result,
|
||||
String dateTime, String calculationMode) {
|
||||
EpsNodeBandwidth bandwidth = new EpsNodeBandwidth();
|
||||
bandwidth.setClientId(data.getClientId());
|
||||
bandwidth.setHardwareSn(data.getServiceSn());
|
||||
bandwidth.setCalculationMode(calculationMode);
|
||||
bandwidth.setNodeName(data.getNodeName());
|
||||
bandwidth.setBusinessId(data.getBusinessId());
|
||||
bandwidth.setBusinessName(data.getBusinessName());
|
||||
bandwidth.setResourceType(data.getResourceType());
|
||||
@@ -599,9 +815,21 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
case "7":
|
||||
bandwidth.setEffectiveAvgMonthlyBandwidth95(result);
|
||||
break;
|
||||
case "8":
|
||||
bandwidth.setMachineFlow(result);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown bandwidthType: " + data.getBandwidthType());
|
||||
}
|
||||
// 根据clientId查询交换机上联
|
||||
RmEpsTopologyManagement topologQuery = new RmEpsTopologyManagement();
|
||||
topologQuery.setServerClientId(data.getClientId());
|
||||
List<RmEpsTopologyManagement> topologyList = rmEpsTopologyManagementMapper.selectRmEpsTopologyManagementList(topologQuery);
|
||||
if(!topologyList.isEmpty()){
|
||||
RmEpsTopologyManagement rmEpsTopologyManagement = topologyList.get(0);
|
||||
bandwidth.setUplinkSwitch(rmEpsTopologyManagement.getSwitchName());
|
||||
bandwidth.setInterfaceName(rmEpsTopologyManagement.getInterfaceName());
|
||||
}
|
||||
if(!exitsList.isEmpty()){
|
||||
bandwidth.setUpdateTime(DateUtils.getNowDate());
|
||||
bandwidth.setId(exitsList.get(0).getId());
|
||||
|
||||
@@ -5,9 +5,11 @@ import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.web.page.PageDomain;
|
||||
import com.ruoyi.system.domain.EpsInitialTrafficData;
|
||||
import com.ruoyi.system.domain.EpsNodeBandwidth;
|
||||
import com.ruoyi.system.domain.EpsServerRevenueConfig;
|
||||
import com.ruoyi.system.domain.RmSwitchManagement;
|
||||
import com.ruoyi.system.mapper.EpsMethodChangeRecordMapper;
|
||||
import com.ruoyi.system.mapper.EpsNodeBandwidthMapper;
|
||||
import com.ruoyi.system.mapper.EpsServerRevenueConfigMapper;
|
||||
import com.ruoyi.system.mapper.RmSwitchManagementMapper;
|
||||
import com.ruoyi.system.service.EpsInitialTrafficDataService;
|
||||
import com.ruoyi.system.service.IEpsNodeBandwidthService;
|
||||
import com.ruoyi.system.util.EchartsDataConverter;
|
||||
@@ -43,6 +45,10 @@ public class EpsNodeBandwidthServiceImpl implements IEpsNodeBandwidthService
|
||||
private EpsInitialTrafficDataService epsInitialTrafficDataService;
|
||||
@Autowired
|
||||
private EpsServerRevenueConfigMapper epsServerRevenueConfigMapper;
|
||||
@Autowired
|
||||
private EpsMethodChangeRecordMapper epsMethodChangeRecordMapper;
|
||||
@Autowired
|
||||
private RmSwitchManagementMapper rmSwitchManagementMapper;
|
||||
|
||||
/**
|
||||
* 查询节点带宽信息
|
||||
@@ -71,19 +77,31 @@ public class EpsNodeBandwidthServiceImpl implements IEpsNodeBandwidthService
|
||||
queryParams.setStartTime(dailyStartTime);
|
||||
queryParams.setEndTime(dailyEndTime);
|
||||
// 获取总数
|
||||
List<EpsInitialTrafficData> totalList = epsInitialTrafficDataService.query(queryParams);
|
||||
// List<EpsInitialTrafficData> totalList = epsInitialTrafficDataService.query(queryParams);
|
||||
// 4. 设置分页参数
|
||||
PageDomain pageDomain = new PageDomain();
|
||||
pageDomain.setPageNum(epsNodeBandwidth.getPageNum());
|
||||
pageDomain.setPageSize(epsNodeBandwidth.getPageSize());
|
||||
startPage(pageDomain);
|
||||
// PageDomain pageDomain = new PageDomain();
|
||||
// pageDomain.setPageNum(epsNodeBandwidth.getPageNum());
|
||||
// pageDomain.setPageSize(epsNodeBandwidth.getPageSize());
|
||||
// startPage(pageDomain);
|
||||
List<EpsInitialTrafficData> resultList = epsInitialTrafficDataService.query(queryParams);
|
||||
int pageNum = epsNodeBandwidth.getPageNum();
|
||||
int pageSize = epsNodeBandwidth.getPageSize();
|
||||
int startIndex = (pageNum - 1) * pageSize;
|
||||
int endIndex = Math.min(startIndex + pageSize, resultList.size());
|
||||
List<EpsInitialTrafficData> pageData;
|
||||
// 如果startIndex超出范围,返回空列表
|
||||
if (startIndex >= resultList.size()) {
|
||||
pageData = new ArrayList<>();
|
||||
} else {
|
||||
// 截取当前分页的数据
|
||||
pageData = resultList.subList(startIndex, endIndex);
|
||||
}
|
||||
PageInfo<EpsInitialTrafficData> pageInfo = new PageInfo<>();
|
||||
pageInfo.setList(resultList);
|
||||
pageInfo.setTotal(totalList.size());
|
||||
pageInfo.setPageNum(pageDomain.getPageNum());
|
||||
pageInfo.setPageSize(pageDomain.getPageSize());
|
||||
pageInfo.setPages((int) Math.ceil((double) totalList.size() / pageDomain.getPageSize()));
|
||||
pageInfo.setList(pageData);
|
||||
pageInfo.setTotal(resultList.size());
|
||||
pageInfo.setPageNum(epsNodeBandwidth.getPageNum());
|
||||
pageInfo.setPageSize(epsNodeBandwidth.getPageSize());
|
||||
pageInfo.setPages((int) Math.ceil((double) resultList.size() / epsNodeBandwidth.getPageSize()));
|
||||
return pageInfo;
|
||||
}
|
||||
/**
|
||||
@@ -166,11 +184,10 @@ public class EpsNodeBandwidthServiceImpl implements IEpsNodeBandwidthService
|
||||
log.warn("参数为空,无法计算月均日95值");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 3. 获取计算数据(防止空指针)
|
||||
EpsNodeBandwidth calculatedData = epsNodeBandwidthMapper.calculateAvg(epsNodeBandwidth);
|
||||
if (calculatedData == null) {
|
||||
log.warn("未找到计算数据,硬件SN: {}", epsNodeBandwidth.getHardwareSn());
|
||||
log.warn("未找到计算数据,clientId: {}", epsNodeBandwidth.getClientId());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -200,70 +217,32 @@ public class EpsNodeBandwidthServiceImpl implements IEpsNodeBandwidthService
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 6. 检查业务变动
|
||||
boolean hasBusinessChange = false;
|
||||
if (epsNodeBandwidth.getHardwareSn() != null) {
|
||||
EpsServerRevenueConfig revenueConfig = new EpsServerRevenueConfig();
|
||||
revenueConfig.setHardwareSn(epsNodeBandwidth.getHardwareSn());
|
||||
List<EpsServerRevenueConfig> changedList = epsServerRevenueConfigMapper.selectEpsServerRevenueConfigList(revenueConfig);
|
||||
|
||||
if (!changedList.isEmpty() && changedList.size() == 1) {
|
||||
EpsServerRevenueConfig epsServerRevenueConfig = changedList.get(0);
|
||||
if (epsServerRevenueConfig.getUpdateTime() != null &&
|
||||
epsNodeBandwidth.getStartTime() != null &&
|
||||
"1".equals(epsServerRevenueConfig.getChanged())) {
|
||||
|
||||
String configTime = DateUtils.parseDateToStr("yyyy-MM", epsServerRevenueConfig.getUpdateTime());
|
||||
hasBusinessChange = epsNodeBandwidth.getStartTime().equals(configTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 7. 计算平均值
|
||||
if (hasBusinessChange) {
|
||||
epsNodeBandwidth.setBandwidthType("7");
|
||||
// 2. 验证是否已经存在记录
|
||||
List<EpsNodeBandwidth> existingRecords = epsNodeBandwidthMapper.selectEpsNodeBandwidthList(epsNodeBandwidth);
|
||||
if(!existingRecords.isEmpty()){
|
||||
epsNodeBandwidth.setId(existingRecords.get(0).getId());
|
||||
epsNodeBandwidth.setUpdateTime(DateUtils.getNowDate());
|
||||
}else{
|
||||
if(epsNodeBandwidth.getStartTime() == null){
|
||||
epsNodeBandwidth.setCreateTime(DateUtils.parseDate(monthTime));
|
||||
}else{
|
||||
epsNodeBandwidth.setCreateTime(DateUtils.parseDate(epsNodeBandwidth.getStartTime()));
|
||||
}
|
||||
}
|
||||
// 有效-月均日95值
|
||||
BigDecimal effectiveAvg = sumEffectiveBandwidth95Daily.divide(BigDecimal.valueOf(daysInMonth), 2, RoundingMode.HALF_UP);
|
||||
epsNodeBandwidth.setEffectiveAvgMonthlyBandwidth95(effectiveAvg);
|
||||
epsNodeBandwidth.setBandwidthResult(effectiveAvg);
|
||||
// 8. 执行插入或更新操作
|
||||
return existingRecords.isEmpty() ?
|
||||
epsNodeBandwidthMapper.insertEpsNodeBandwidth(epsNodeBandwidth) :
|
||||
epsNodeBandwidthMapper.updateEpsNodeBandwidth(epsNodeBandwidth);
|
||||
} else {
|
||||
epsNodeBandwidth.setBandwidthType("4");
|
||||
// 2. 验证是否已经存在记录
|
||||
List<EpsNodeBandwidth> existingRecords = epsNodeBandwidthMapper.selectEpsNodeBandwidthList(epsNodeBandwidth);
|
||||
if(!existingRecords.isEmpty()){
|
||||
epsNodeBandwidth.setId(existingRecords.get(0).getId());
|
||||
epsNodeBandwidth.setUpdateTime(DateUtils.getNowDate());
|
||||
}else{
|
||||
if(epsNodeBandwidth.getStartTime() == null){
|
||||
epsNodeBandwidth.setCreateTime(DateUtils.parseDate(monthTime));
|
||||
}else{
|
||||
epsNodeBandwidth.setCreateTime(DateUtils.parseDate(epsNodeBandwidth.getStartTime()));
|
||||
}
|
||||
}
|
||||
// 月均日95值
|
||||
BigDecimal avgMonthly = sum95Daily.divide(BigDecimal.valueOf(daysInMonth), 2, RoundingMode.HALF_UP);
|
||||
epsNodeBandwidth.setAvgMonthlyBandwidth95(avgMonthly);
|
||||
epsNodeBandwidth.setBandwidthResult(avgMonthly);
|
||||
// 8. 执行插入或更新操作
|
||||
return existingRecords.isEmpty() ?
|
||||
epsNodeBandwidthMapper.insertEpsNodeBandwidth(epsNodeBandwidth) :
|
||||
epsNodeBandwidthMapper.updateEpsNodeBandwidth(epsNodeBandwidth);
|
||||
epsNodeBandwidth.setBandwidthType("4");
|
||||
// 2. 验证是否已经存在记录
|
||||
List<EpsNodeBandwidth> existingRecords = epsNodeBandwidthMapper.selectEpsNodeBandwidthList(epsNodeBandwidth);
|
||||
if(!existingRecords.isEmpty()){
|
||||
epsNodeBandwidth.setId(existingRecords.get(0).getId());
|
||||
epsNodeBandwidth.setUpdateTime(DateUtils.getNowDate());
|
||||
}else{
|
||||
epsNodeBandwidth.setCreateTime(DateUtils.parseDate(monthTime));
|
||||
}
|
||||
// 月均日95值
|
||||
BigDecimal avgMonthly = sum95Daily.divide(BigDecimal.valueOf(daysInMonth), 2, RoundingMode.HALF_UP);
|
||||
epsNodeBandwidth.setAvgMonthlyBandwidth95(avgMonthly);
|
||||
epsNodeBandwidth.setBandwidthResult(avgMonthly);
|
||||
// 根据clientId查询交换机名称
|
||||
RmSwitchManagement query = new RmSwitchManagement();
|
||||
query.setClientId(epsNodeBandwidth.getClientId());
|
||||
List<RmSwitchManagement> switchMsgList = rmSwitchManagementMapper.selectRmSwitchManagementList(query);
|
||||
if(!switchMsgList.isEmpty()){
|
||||
RmSwitchManagement switchManagement = switchMsgList.get(0);
|
||||
epsNodeBandwidth.setUplinkSwitch(switchManagement.getSwitchName());
|
||||
}
|
||||
// 8. 执行插入或更新操作
|
||||
return existingRecords.isEmpty() ?
|
||||
epsNodeBandwidthMapper.insertEpsNodeBandwidth(epsNodeBandwidth) :
|
||||
epsNodeBandwidthMapper.updateEpsNodeBandwidth(epsNodeBandwidth);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("计算月均日95值失败", e);
|
||||
|
||||
@@ -0,0 +1,564 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.utils.EchartsDataUtils;
|
||||
import com.ruoyi.common.core.utils.SpeedUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.EpsInitialTrafficData;
|
||||
import com.ruoyi.system.domain.EpsNodeBandwidth;
|
||||
import com.ruoyi.system.domain.EpsTaskStatistics;
|
||||
import com.ruoyi.system.domain.InitialSwitchInfoDetails;
|
||||
import com.ruoyi.system.mapper.EpsNodeBandwidthMapper;
|
||||
import com.ruoyi.system.mapper.EpsTaskStatisticsMapper;
|
||||
import com.ruoyi.system.mapper.InitialSwitchInfoDetailsMapper;
|
||||
import com.ruoyi.system.service.EpsInitialTrafficDataService;
|
||||
import com.ruoyi.system.service.IEpsTaskStatisticsService;
|
||||
import com.ruoyi.system.service.IInitialSwitchInfoDetailsService;
|
||||
import com.ruoyi.system.util.CalculateUtil;
|
||||
import com.ruoyi.system.util.DateUtil;
|
||||
import com.ruoyi.system.util.PaginationUtil;
|
||||
import com.ruoyi.system.util.TrafficRedisHashUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.YearMonth;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 业务95值计算任务Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-29
|
||||
*/
|
||||
@Service
|
||||
public class EpsTaskStatisticsServiceImpl implements IEpsTaskStatisticsService
|
||||
{
|
||||
@Autowired
|
||||
private EpsTaskStatisticsMapper epsTaskStatisticsMapper;
|
||||
@Autowired
|
||||
private EpsInitialTrafficDataService epsInitialTrafficDataService;
|
||||
@Autowired
|
||||
private EpsNodeBandwidthMapper epsNodeBandwidthMapper;
|
||||
@Autowired
|
||||
private IInitialSwitchInfoDetailsService initialSwitchInfoDetailsService;
|
||||
@Autowired
|
||||
private InitialSwitchInfoDetailsMapper initialSwitchInfoDetailsMapper;
|
||||
@Autowired
|
||||
private TrafficRedisHashUtil trafficRedisHashUtil;
|
||||
|
||||
/**
|
||||
* 查询业务95值计算任务
|
||||
*
|
||||
* @param id 业务95值计算任务主键
|
||||
* @return 业务95值计算任务
|
||||
*/
|
||||
@Override
|
||||
public EpsTaskStatistics selectEpsTaskStatisticsById(Long id)
|
||||
{
|
||||
return epsTaskStatisticsMapper.selectEpsTaskStatisticsById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询业务95值计算任务列表
|
||||
*
|
||||
* @param epsTaskStatistics 业务95值计算任务
|
||||
* @return 业务95值计算任务
|
||||
*/
|
||||
@Override
|
||||
public List<EpsTaskStatistics> selectEpsTaskStatisticsList(EpsTaskStatistics epsTaskStatistics)
|
||||
{
|
||||
List<EpsTaskStatistics> epsTaskStatisticsList = epsTaskStatisticsMapper.selectEpsTaskStatisticsList(epsTaskStatistics);
|
||||
for (EpsTaskStatistics taskStatistics : epsTaskStatisticsList) {
|
||||
String startTime = taskStatistics.getStartTime();
|
||||
String endTime = taskStatistics.getEndTime();
|
||||
String timeRange = "";
|
||||
if(endTime == null){
|
||||
timeRange = startTime;
|
||||
}else{
|
||||
timeRange = startTime + "~" + endTime;
|
||||
}
|
||||
taskStatistics.setTimeRange(timeRange);
|
||||
}
|
||||
return epsTaskStatisticsList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增业务95值计算任务
|
||||
*
|
||||
* @param epsTaskStatistics 业务95值计算任务
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEpsTaskStatistics(EpsTaskStatistics epsTaskStatistics)
|
||||
{
|
||||
epsTaskStatistics.setCreateTime(DateUtils.getNowDate());
|
||||
epsTaskStatisticsMapper.insertEpsTaskStatistics(epsTaskStatistics);
|
||||
// 开始计算
|
||||
if(StringUtils.equals(epsTaskStatistics.getResourceType(), "1")){
|
||||
if(StringUtils.equals(epsTaskStatistics.getCalculationType(), "1")){
|
||||
EpsInitialTrafficData queryParam = new EpsInitialTrafficData();
|
||||
queryParam.setStartTime(epsTaskStatistics.getStartTime());
|
||||
queryParam.setEndTime(epsTaskStatistics.getEndTime());
|
||||
queryParam.setBusinessId(epsTaskStatistics.getBusinessCode());
|
||||
queryParam.setClientIds(epsTaskStatistics.getIncludedResources());
|
||||
List<EpsInitialTrafficData> dataList = epsInitialTrafficDataService.getTrafficListByClientIds(queryParam);
|
||||
if(!dataList.isEmpty()){
|
||||
// 存储数据到redis缓存
|
||||
trafficRedisHashUtil.saveListToHash(epsTaskStatistics.getId().toString(), dataList);
|
||||
// 计算95数据
|
||||
processServer95Data(dataList, epsTaskStatistics);
|
||||
}else{
|
||||
EpsTaskStatistics updataData = new EpsTaskStatistics();
|
||||
updataData.setId(epsTaskStatistics.getId());
|
||||
updataData.setTaskStatus("2");
|
||||
updataData.setPercentile95(BigDecimal.ZERO);
|
||||
epsTaskStatisticsMapper.updateEpsTaskStatistics(updataData);
|
||||
}
|
||||
}else{
|
||||
// 查询当月的流量 存到redis缓存
|
||||
// 处理时间
|
||||
DateUtil.TimeRange timeRange = DateUtil.getTimeRange(DateUtils.parseDate(epsTaskStatistics.getStartTime()), "2");
|
||||
EpsInitialTrafficData queryParam = new EpsInitialTrafficData();
|
||||
queryParam.setStartTime(timeRange.getStart());
|
||||
queryParam.setEndTime(timeRange.getEnd());
|
||||
queryParam.setBusinessId(epsTaskStatistics.getBusinessCode());
|
||||
queryParam.setClientIds(epsTaskStatistics.getIncludedResources());
|
||||
List<EpsInitialTrafficData> dataList = epsInitialTrafficDataService.getTrafficListByClientIds(queryParam);
|
||||
if(!dataList.isEmpty()){
|
||||
trafficRedisHashUtil.saveListToHash(epsTaskStatistics.getId().toString(), dataList);
|
||||
}
|
||||
processAvg95Data(epsTaskStatistics);
|
||||
}
|
||||
}else{
|
||||
String resources = epsTaskStatistics.getIncludedResources();
|
||||
String clientIds = Arrays.stream(resources.split(","))
|
||||
.map(msg -> msg.split(";"))
|
||||
.filter(resource -> resource.length >= 3)
|
||||
.map(resource -> resource[1])
|
||||
.collect(Collectors.joining(","));
|
||||
String interfaceNames = Arrays.stream(resources.split(","))
|
||||
.map(msg -> msg.split(";"))
|
||||
.filter(resource -> resource.length >= 3)
|
||||
.map(resource -> resource[2])
|
||||
.collect(Collectors.joining(","));
|
||||
if(StringUtils.equals(epsTaskStatistics.getCalculationType(), "1")){
|
||||
InitialSwitchInfoDetails queryParam = new InitialSwitchInfoDetails();
|
||||
queryParam.setStartTime(epsTaskStatistics.getStartTime());
|
||||
queryParam.setEndTime(epsTaskStatistics.getEndTime());
|
||||
queryParam.setBusinessCode(epsTaskStatistics.getBusinessCode());
|
||||
queryParam.setClientIds(clientIds);
|
||||
queryParam.setInterfaceNames(interfaceNames);
|
||||
List<InitialSwitchInfoDetails> dataList = initialSwitchInfoDetailsMapper
|
||||
.sumSwitchTrafficByclientIds(queryParam);
|
||||
if(!dataList.isEmpty()){
|
||||
trafficRedisHashUtil.saveListToHash(epsTaskStatistics.getId().toString(), dataList);
|
||||
processSwitch95Data(dataList, epsTaskStatistics);
|
||||
}else{
|
||||
// 保存计算结果
|
||||
EpsTaskStatistics updateData = new EpsTaskStatistics();
|
||||
updateData.setId(epsTaskStatistics.getId());
|
||||
updateData.setTaskStatus("2");
|
||||
updateData.setPercentile95(BigDecimal.ZERO);
|
||||
updateData.setUpdateTime(DateUtils.getNowDate());
|
||||
epsTaskStatisticsMapper.updateEpsTaskStatistics(updateData);
|
||||
}
|
||||
}else{
|
||||
// 查询当月的流量 存到redis缓存
|
||||
// 处理时间
|
||||
DateUtil.TimeRange timeRange = DateUtil.getTimeRange(DateUtils.parseDate(epsTaskStatistics.getStartTime()), "2");
|
||||
InitialSwitchInfoDetails queryParam = new InitialSwitchInfoDetails();
|
||||
queryParam.setStartTime(timeRange.getStart());
|
||||
queryParam.setEndTime(timeRange.getEnd());
|
||||
queryParam.setBusinessCode(epsTaskStatistics.getBusinessCode());
|
||||
queryParam.setClientIds(clientIds);
|
||||
queryParam.setInterfaceNames(interfaceNames);
|
||||
List<InitialSwitchInfoDetails> dataList = initialSwitchInfoDetailsMapper
|
||||
.sumSwitchTrafficByclientIds(queryParam);
|
||||
if(!dataList.isEmpty()){
|
||||
trafficRedisHashUtil.saveListToHash(epsTaskStatistics.getId().toString(), dataList);
|
||||
}
|
||||
processAvg95Data(epsTaskStatistics);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void processServer95Data(List<EpsInitialTrafficData> dataList, EpsTaskStatistics epsTaskStatistics){
|
||||
if(!dataList.isEmpty()){
|
||||
// 1. 提取并转换带宽值
|
||||
List<BigDecimal> speedsInMbps = dataList.stream()
|
||||
.map(data -> CalculateUtil.parseSpeedToMbps(data.getOutSpeed(), epsTaskStatistics.getCalculationMode()))
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
// 计算95百分位
|
||||
BigDecimal percentile95 = CalculateUtil.calculatePercentile(speedsInMbps, 0.95);
|
||||
|
||||
// 保存计算结果
|
||||
EpsTaskStatistics updateData = new EpsTaskStatistics();
|
||||
updateData.setId(epsTaskStatistics.getId());
|
||||
updateData.setTaskStatus("2");
|
||||
updateData.setPercentile95(percentile95.setScale(0, RoundingMode.HALF_UP));
|
||||
updateData.setUpdateTime(DateUtils.getNowDate());
|
||||
epsTaskStatisticsMapper.updateEpsTaskStatistics(updateData);
|
||||
}
|
||||
}
|
||||
public void processSwitch95Data(List<InitialSwitchInfoDetails> dataList, EpsTaskStatistics epsTaskStatistics){
|
||||
if(!dataList.isEmpty()){
|
||||
// 1. 提取并转换带宽值
|
||||
List<BigDecimal> speedsInMbps = dataList.stream()
|
||||
.map(data -> {
|
||||
// 根据 interfaceDeviceType 选择 inSpeed 或 outSpeed
|
||||
String speed = data.getMaxSpeed() != null ? data.getMaxSpeed().toString() : BigDecimal.ZERO.toString();
|
||||
// 如果 speed 是纯数字,补充单位 "B/S"(Bytes/s)
|
||||
if (speed.matches("^\\d+(\\.\\d+)?$")) {
|
||||
speed += " B/S";
|
||||
}
|
||||
return CalculateUtil.parseSpeedToMbps(speed, epsTaskStatistics.getCalculationMode());
|
||||
})
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 2. 计算95百分位
|
||||
BigDecimal percentile95 = CalculateUtil.calculatePercentile(speedsInMbps, 0.95);
|
||||
|
||||
// 保存计算结果
|
||||
EpsTaskStatistics updateData = new EpsTaskStatistics();
|
||||
updateData.setId(epsTaskStatistics.getId());
|
||||
updateData.setTaskStatus("2");
|
||||
updateData.setPercentile95(percentile95.setScale(0, RoundingMode.HALF_UP));
|
||||
updateData.setUpdateTime(DateUtils.getNowDate());
|
||||
epsTaskStatisticsMapper.updateEpsTaskStatistics(updateData);
|
||||
}
|
||||
}
|
||||
|
||||
public void processAvg95Data(EpsTaskStatistics epsTaskStatistics) {
|
||||
EpsNodeBandwidth epsNodeBandwidth = new EpsNodeBandwidth();
|
||||
epsNodeBandwidth.setMonthTime(epsTaskStatistics.getStartTime());
|
||||
epsNodeBandwidth.setBusinessId(epsTaskStatistics.getBusinessCode());
|
||||
EpsNodeBandwidth calculatedData = epsNodeBandwidthMapper.calculateAvg(epsNodeBandwidth);
|
||||
if (calculatedData != null) {
|
||||
BigDecimal sum95Daily = Optional.ofNullable(calculatedData.getBandwidth95Daily()).orElse(BigDecimal.ZERO);
|
||||
LocalDate monthTime = null;
|
||||
try {
|
||||
String monthStr = epsNodeBandwidth.getMonthTime() == null
|
||||
? epsNodeBandwidth.getStartTime().substring(0, 7)
|
||||
: epsNodeBandwidth.getMonthTime();
|
||||
|
||||
YearMonth yearMonth = YearMonth.parse(monthStr);
|
||||
monthTime = yearMonth.atDay(1); // 转换为当月第一天
|
||||
} catch (Exception e) {
|
||||
System.err.println("月份格式错误:" + e.getMessage());
|
||||
}
|
||||
int daysInMonth = YearMonth.from(monthTime).lengthOfMonth();
|
||||
if (daysInMonth == 0) {
|
||||
System.err.println("当月天数为0,月份: " + epsNodeBandwidth.getMonthTime() == null
|
||||
? epsNodeBandwidth.getStartTime() : epsNodeBandwidth.getMonthTime());
|
||||
}
|
||||
// 月均日95值
|
||||
BigDecimal avgMonthly = sum95Daily.divide(BigDecimal.valueOf(daysInMonth), 0, RoundingMode.HALF_UP);
|
||||
// 保存计算结果
|
||||
EpsTaskStatistics updateData = new EpsTaskStatistics();
|
||||
updateData.setId(epsTaskStatistics.getId());
|
||||
updateData.setTaskStatus("2");
|
||||
updateData.setMonthlyAvgPercentile95(avgMonthly);
|
||||
updateData.setUpdateTime(DateUtils.getNowDate());
|
||||
epsTaskStatisticsMapper.updateEpsTaskStatistics(updateData);
|
||||
}else{
|
||||
EpsTaskStatistics updataData = new EpsTaskStatistics();
|
||||
updataData.setId(epsTaskStatistics.getId());
|
||||
updataData.setTaskStatus("2");
|
||||
updataData.setMonthlyAvgPercentile95(BigDecimal.ZERO);
|
||||
updataData.setUpdateTime(DateUtils.getNowDate());
|
||||
epsTaskStatisticsMapper.updateEpsTaskStatistics(updataData);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 修改业务95值计算任务
|
||||
*
|
||||
* @param epsTaskStatistics 业务95值计算任务
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateEpsTaskStatistics(EpsTaskStatistics epsTaskStatistics)
|
||||
{
|
||||
epsTaskStatistics.setUpdateTime(DateUtils.getNowDate());
|
||||
return epsTaskStatisticsMapper.updateEpsTaskStatistics(epsTaskStatistics);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除业务95值计算任务
|
||||
*
|
||||
* @param ids 需要删除的业务95值计算任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEpsTaskStatisticsByIds(Long[] ids)
|
||||
{
|
||||
return epsTaskStatisticsMapper.deleteEpsTaskStatisticsByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除业务95值计算任务信息
|
||||
*
|
||||
* @param id 业务95值计算任务主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEpsTaskStatisticsById(Long id)
|
||||
{
|
||||
return epsTaskStatisticsMapper.deleteEpsTaskStatisticsById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<?> getRelateData(EpsTaskStatistics epsTaskStatistics) {
|
||||
// 分页参数
|
||||
Integer pageNum = epsTaskStatistics.getPageNum();
|
||||
Integer pageSize = epsTaskStatistics.getPageSize();
|
||||
// 查询任务详情
|
||||
Long taskId = epsTaskStatistics.getId();
|
||||
EpsTaskStatistics taskMsg = epsTaskStatisticsMapper.selectEpsTaskStatisticsById(taskId);
|
||||
if(StringUtils.equals("1", taskMsg.getResourceType())){
|
||||
List<EpsInitialTrafficData> list = trafficRedisHashUtil.getListFromHash(taskId.toString(), EpsInitialTrafficData.class);
|
||||
if(!list.isEmpty()){
|
||||
if(StringUtils.equals("1", taskMsg.getCalculationType())){
|
||||
int index = CalculateUtil.calculate95Index(list, 0.05);
|
||||
list.get(index).setFlag95(true);
|
||||
List<EpsInitialTrafficData> pageList = list.stream()
|
||||
.skip((long) (pageNum - 1) * pageSize)
|
||||
.limit(pageSize)
|
||||
.collect(Collectors.toList());
|
||||
for (EpsInitialTrafficData epsInitialTrafficData : pageList) {
|
||||
epsInitialTrafficData.setBusinessId(taskMsg.getBusinessCode());
|
||||
epsInitialTrafficData.setClientId(taskMsg.getIncludedResources());
|
||||
}
|
||||
PageInfo<EpsInitialTrafficData> pageInfo = new PageInfo<>();
|
||||
pageInfo.setPageNum(pageNum);
|
||||
pageInfo.setPageSize(pageSize);
|
||||
pageInfo.setTotal(list.size());
|
||||
pageInfo.setList(pageList);
|
||||
return pageInfo;
|
||||
}else{
|
||||
// 2. 按天分组
|
||||
Map<String, List<EpsInitialTrafficData>> groupedData = list.stream()
|
||||
.collect(Collectors.groupingBy(data -> {
|
||||
// 使用 SimpleDateFormat 格式化日期部分
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
return sdf.format(data.getCreateTime());
|
||||
}));
|
||||
// 获取指定日期的数据
|
||||
List<EpsInitialTrafficData> dailyData = groupedData.getOrDefault(epsTaskStatistics.getAvgTime(), new ArrayList<>());
|
||||
int index = CalculateUtil.calculate95Index(dailyData, 0.05);
|
||||
dailyData.get(index).setFlag95(true);
|
||||
PageInfo<EpsInitialTrafficData> resultData = PaginationUtil.paginate(dailyData, pageNum, pageSize);
|
||||
return resultData;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
String resources = taskMsg.getIncludedResources();
|
||||
String result = Arrays.stream(resources.split(","))
|
||||
.map(msg -> msg.split(";"))
|
||||
.filter(resource -> resource.length >= 4)
|
||||
.map(resource -> "[" + resource[3] + "].[" + resource[2] + "]")
|
||||
.collect(Collectors.joining(";"));
|
||||
List<InitialSwitchInfoDetails> list = trafficRedisHashUtil.getListFromHash(taskId.toString(), InitialSwitchInfoDetails.class);
|
||||
if(!list.isEmpty()){
|
||||
if(StringUtils.equals("1", taskMsg.getCalculationType())){
|
||||
|
||||
int index = CalculateUtil.calculate95Index(list, 0.05);
|
||||
list.get(index).setFlag95(true);
|
||||
List<InitialSwitchInfoDetails> pageList = list.stream()
|
||||
.skip((long) (pageNum - 1) * pageSize)
|
||||
.limit(pageSize)
|
||||
.collect(Collectors.toList());
|
||||
for (InitialSwitchInfoDetails initialSwitchInfoDetails : pageList) {
|
||||
initialSwitchInfoDetails.setName(result);
|
||||
}
|
||||
PageInfo<InitialSwitchInfoDetails> pageInfo = new PageInfo<>();
|
||||
pageInfo.setPageNum(pageNum);
|
||||
pageInfo.setPageSize(pageSize);
|
||||
pageInfo.setTotal(list.size());
|
||||
pageInfo.setList(pageList);
|
||||
return pageInfo;
|
||||
}else{
|
||||
// 2. 按天分组
|
||||
Map<String, List<InitialSwitchInfoDetails>> groupedData = list.stream()
|
||||
.collect(Collectors.groupingBy(data -> {
|
||||
// 使用 SimpleDateFormat 格式化日期部分
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
return sdf.format(data.getCreateTime());
|
||||
}));
|
||||
// 获取指定日期的数据
|
||||
List<InitialSwitchInfoDetails> dailyData = groupedData.getOrDefault(epsTaskStatistics.getAvgTime(), new ArrayList<>());
|
||||
int index = CalculateUtil.calculate95Index(dailyData, 0.05);
|
||||
dailyData.get(index).setFlag95(true);
|
||||
PageInfo<InitialSwitchInfoDetails> resultData = PaginationUtil.paginate(dailyData, pageNum, pageSize);
|
||||
return resultData;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new PageInfo<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取月均日数据的日期
|
||||
* @param epsTaskStatistics
|
||||
* @return
|
||||
*/
|
||||
public List<String> getAvgTimeList(EpsTaskStatistics epsTaskStatistics){
|
||||
List<String> resultList = new ArrayList<>();
|
||||
Long taskId = epsTaskStatistics.getId();
|
||||
EpsTaskStatistics taskMsg = epsTaskStatisticsMapper.selectEpsTaskStatisticsById(taskId);
|
||||
|
||||
if(StringUtils.equals(taskMsg.getCalculationType(), "2")){
|
||||
List<EpsInitialTrafficData> list = trafficRedisHashUtil.getListFromHash(taskId.toString(), EpsInitialTrafficData.class);
|
||||
if(!list.isEmpty()){
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
resultList = list.stream()
|
||||
.map(data -> sdf.format(data.getCreateTime()))
|
||||
.distinct()
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateRelateData(EpsTaskStatistics epsTaskStatistics) {
|
||||
// 查询任务详情
|
||||
Long taskId = epsTaskStatistics.getId();
|
||||
EpsTaskStatistics taskMsg = epsTaskStatisticsMapper.selectEpsTaskStatisticsById(taskId);
|
||||
if(StringUtils.equals("1", taskMsg.getResourceType())){
|
||||
EpsInitialTrafficData epsInitialTrafficData = new EpsInitialTrafficData();
|
||||
epsInitialTrafficData.setOutSpeed(epsTaskStatistics.getNeedSpeed().toString());
|
||||
epsInitialTrafficData.setCreateTime(DateUtils.parseDate(epsTaskStatistics.getNeedTime()));
|
||||
trafficRedisHashUtil.updateItemInHash(taskId.toString(), epsInitialTrafficData, epsTaskStatistics.getNeedTime());
|
||||
}else{
|
||||
InitialSwitchInfoDetails initialSwitchInfoDetails = new InitialSwitchInfoDetails();
|
||||
initialSwitchInfoDetails.setMaxSpeed(epsTaskStatistics.getNeedSpeed());
|
||||
initialSwitchInfoDetails.setCreateTime(DateUtils.parseDate(epsTaskStatistics.getNeedTime()));
|
||||
trafficRedisHashUtil.updateItemInHash(taskId.toString(), initialSwitchInfoDetails, epsTaskStatistics.getNeedTime());
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int recaculate(EpsTaskStatistics epsTaskStatistics) {
|
||||
// 查询任务详情
|
||||
Long taskId = epsTaskStatistics.getId();
|
||||
EpsTaskStatistics taskMsg = epsTaskStatisticsMapper.selectEpsTaskStatisticsById(taskId);
|
||||
// 任务状态改为计算中
|
||||
EpsTaskStatistics updateParam = new EpsTaskStatistics();
|
||||
updateParam.setId(taskId);
|
||||
updateParam.setTaskStatus("1");
|
||||
epsTaskStatisticsMapper.updateEpsTaskStatistics(updateParam);
|
||||
// 开始计算
|
||||
if(StringUtils.equals("1", taskMsg.getResourceType())){
|
||||
List<EpsInitialTrafficData> dataList = trafficRedisHashUtil.getListFromHash(taskId.toString(), EpsInitialTrafficData.class);
|
||||
if(StringUtils.equals(taskMsg.getCalculationType(), "1")){
|
||||
processServer95Data(dataList, taskMsg);
|
||||
}else{
|
||||
processAvg95Data(taskMsg);
|
||||
}
|
||||
}else{
|
||||
List<InitialSwitchInfoDetails> dataList = trafficRedisHashUtil.getListFromHash(taskId.toString(), InitialSwitchInfoDetails.class);
|
||||
if(StringUtils.equals(taskMsg.getCalculationType(), "1")){
|
||||
processSwitch95Data(dataList, taskMsg);
|
||||
}else{
|
||||
processAvg95Data(taskMsg);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getRraphicalMsg(EpsTaskStatistics epsTaskStatistics) {
|
||||
// 查询任务详情
|
||||
Long taskId = epsTaskStatistics.getId();
|
||||
EpsTaskStatistics taskMsg = epsTaskStatisticsMapper.selectEpsTaskStatisticsById(taskId);
|
||||
String startTime = taskMsg.getStartTime();
|
||||
String endTime = taskMsg.getEndTime();
|
||||
String timeRange = "";
|
||||
if(endTime == null){
|
||||
timeRange = startTime;
|
||||
}else{
|
||||
timeRange = startTime + "~" + endTime;
|
||||
}
|
||||
if(StringUtils.equals("1", taskMsg.getResourceType())){
|
||||
List<EpsInitialTrafficData> list = trafficRedisHashUtil.getListFromHash(taskId.toString(), EpsInitialTrafficData.class);
|
||||
if(!list.isEmpty()){
|
||||
try{
|
||||
BigDecimal percentile95 = "1".equals(taskMsg.getCalculationType())
|
||||
? taskMsg.getPercentile95()
|
||||
: taskMsg.getMonthlyAvgPercentile95();
|
||||
list.forEach(data -> data.setPercentile95(SpeedUtils.mbitToBit(percentile95)));
|
||||
SpeedUtils.SpeedResult result = SpeedUtils.calculateWithStringTraffic(list, "inSpeed", "outSpeed");
|
||||
BigDecimal divisor = SpeedUtils.getDivisor(result.getRecommendedUnit());
|
||||
Map<String, Function<EpsInitialTrafficData, ?>> extractors = new LinkedHashMap<>();
|
||||
|
||||
extractors.put("netOutSpeedData", info ->
|
||||
info != null && info.getOutSpeed() != null ?
|
||||
new BigDecimal(info.getOutSpeed()).divide(divisor, 0, RoundingMode.HALF_UP) :
|
||||
0);
|
||||
extractors.put("percentile95", info ->
|
||||
info != null && info.getPercentile95() != null ?
|
||||
info.getPercentile95().divide(divisor, 2, RoundingMode.HALF_UP) :
|
||||
0);
|
||||
Map<String, Object> resultMap = EchartsDataUtils.buildEchartsData(list, EpsInitialTrafficData::getCreateTime, extractors);
|
||||
resultMap.put("other", result);
|
||||
resultMap.put("percentile95", percentile95);
|
||||
resultMap.put("timeRange", timeRange);
|
||||
return resultMap;
|
||||
}catch (Exception e){
|
||||
System.err.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
}else{
|
||||
List<InitialSwitchInfoDetails> list = trafficRedisHashUtil.getListFromHash(taskId.toString(), InitialSwitchInfoDetails.class);
|
||||
if(!list.isEmpty()){
|
||||
try{
|
||||
BigDecimal percentile95 = "1".equals(taskMsg.getCalculationType())
|
||||
? taskMsg.getPercentile95()
|
||||
: taskMsg.getMonthlyAvgPercentile95();
|
||||
list.forEach(data -> data.setPercentile95(SpeedUtils.mbitToBit(percentile95)));
|
||||
SpeedUtils.SpeedResult result = SpeedUtils.calculateWithAverageBasedUnit(list, "inSpeed", "outSpeed");
|
||||
BigDecimal divisor = SpeedUtils.getDivisor(result.getRecommendedUnit());
|
||||
Map<String, Function<InitialSwitchInfoDetails, ?>> extractors = new LinkedHashMap<>();
|
||||
extractors.put("netInSpeedData", info ->
|
||||
info != null && info.getInSpeed() != null ?
|
||||
info.getInSpeed().divide(divisor, 0, RoundingMode.HALF_UP) :
|
||||
0);
|
||||
|
||||
extractors.put("netOutSpeedData", info ->
|
||||
info != null && info.getOutSpeed() != null ?
|
||||
info.getOutSpeed().divide(divisor, 0, RoundingMode.HALF_UP) :
|
||||
0);
|
||||
extractors.put("percentile95", info ->
|
||||
info != null && info.getPercentile95() != null ?
|
||||
info.getPercentile95().divide(divisor, 2, RoundingMode.HALF_UP) :
|
||||
0);
|
||||
Map<String, Object> resultMap = EchartsDataUtils.buildEchartsData(list, InitialSwitchInfoDetails::getCreateTime, extractors);
|
||||
resultMap.put("other", result);
|
||||
if(StringUtils.equals("1", taskMsg.getCalculationType())){
|
||||
resultMap.put("percentile95", taskMsg.getPercentile95());
|
||||
}else{
|
||||
resultMap.put("percentile95", taskMsg.getMonthlyAvgPercentile95());
|
||||
}
|
||||
resultMap.put("timeRange", timeRange);
|
||||
return resultMap;
|
||||
}catch (Exception e){
|
||||
System.err.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return new HashMap();
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,16 @@ package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.utils.EchartsDataUtils;
|
||||
import com.ruoyi.common.core.utils.SpeedUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.enums.ReviewEnum;
|
||||
import com.ruoyi.system.mapper.*;
|
||||
import com.ruoyi.system.service.IInitialSwitchInfoDetailsService;
|
||||
import com.ruoyi.system.util.CalculateUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -16,11 +20,12 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.YearMonth;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -38,6 +43,8 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
@Autowired
|
||||
private RmEpsTopologyManagementMapper rmEpsTopologyManagementMapper;
|
||||
@Autowired
|
||||
private RmSwitchManagementMapper rmSwitchManagementMapper;
|
||||
@Autowired
|
||||
private AllInterfaceNameMapper allInterfaceNameMapper;
|
||||
@Autowired
|
||||
private EpsServerRevenueConfigMapper epsServerRevenueConfigMapper;
|
||||
@@ -45,6 +52,12 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
private EpsMethodChangeRecordMapper epsMethodChangeRecordMapper;
|
||||
@Autowired
|
||||
private EpsNodeBandwidthMapper epsNodeBandwidthMapper;
|
||||
@Autowired
|
||||
private RmSwitchInterfaceInfoMapper rmSwitchInterfaceInfoMapper;
|
||||
@Autowired
|
||||
private EpsBusinessDeployMapper epsBusinessDeployMapper;
|
||||
|
||||
private static final String DATE_TIME_FORMATTER = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
/**
|
||||
* 查询交换机监控信息
|
||||
@@ -130,38 +143,45 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
List<InitialSwitchInfoDetails> batchList = new ArrayList<>();
|
||||
if(!dataList.isEmpty()){
|
||||
for (InitialSwitchInfoDetails details : dataList) {
|
||||
// 取发送或接收流量最大值赋值到maxSpeed
|
||||
calculateMaxSpeed(details);
|
||||
// id自增
|
||||
details.setId(null);
|
||||
// 根据接口名称查询交换机信息
|
||||
String interfaceName = details.getName();
|
||||
String switchSn = details.getSwitchSn();
|
||||
RmEpsTopologyManagement rmEpsTopologyManagement = new RmEpsTopologyManagement();
|
||||
rmEpsTopologyManagement.setInterfaceName(interfaceName);
|
||||
rmEpsTopologyManagement.setSwitchSn(switchSn);
|
||||
rmEpsTopologyManagement.setClientId(details.getClientId());
|
||||
List<RmEpsTopologyManagement> managements = rmEpsTopologyManagementMapper.selectRmEpsTopologyManagementList(rmEpsTopologyManagement);
|
||||
// 赋值
|
||||
if(!managements.isEmpty()){
|
||||
for (RmEpsTopologyManagement management : managements) {
|
||||
if("1".equals(management.getConnectedDeviceType())){
|
||||
details.setOutSpeed(null);
|
||||
}else{
|
||||
details.setInSpeed(null);
|
||||
}
|
||||
details.setSwitchSn(management.getSwitchSn());
|
||||
details.setSwitchName(management.getSwitchName());
|
||||
details.setInterfaceDeviceType(management.getConnectedDeviceType());
|
||||
details.setServerName(management.getServerName());
|
||||
details.setServerPort(management.getServerPort());
|
||||
details.setServerSn(management.getServerSn());
|
||||
details.setServerClientId(management.getServerClientId());
|
||||
// 查询端口备注信息
|
||||
RmSwitchInterfaceInfo queryOtheName = new RmSwitchInterfaceInfo();
|
||||
queryOtheName.setClientId(details.getClientId());
|
||||
queryOtheName.setInterfaceName(management.getInterfaceName());
|
||||
List<RmSwitchInterfaceInfo> interfaceInfos = rmSwitchInterfaceInfoMapper.selectRmSwitchInterfaceInfoList(queryOtheName);
|
||||
if(!interfaceInfos.isEmpty()){
|
||||
// 接口别名
|
||||
details.setInterfaceNameRemark(interfaceInfos.get(0).getInterfaceRemark());
|
||||
}
|
||||
// 根据服务器sn查询业务
|
||||
if(management.getServerSn() != null){
|
||||
EpsServerRevenueConfig epsServerRevenueConfig = new EpsServerRevenueConfig();
|
||||
epsServerRevenueConfig.setHardwareSn(management.getServerSn());
|
||||
List<EpsServerRevenueConfig> businessList = epsServerRevenueConfigMapper.selectEpsServerRevenueConfigList(epsServerRevenueConfig);
|
||||
if(!businessList.isEmpty()){
|
||||
EpsServerRevenueConfig revenueConfig = businessList.get(0);
|
||||
details.setBusinessName(revenueConfig.getBusinessName());
|
||||
details.setBusinessCode(revenueConfig.getBusinessCode());
|
||||
if(management.getServerClientId() != null){
|
||||
String serverClientId = management.getServerClientId();
|
||||
// 查询业务信息
|
||||
EpsBusinessDeploy queryBD = new EpsBusinessDeploy();
|
||||
queryBD.setClientId(serverClientId);
|
||||
queryBD.setReviewStatus(ReviewEnum.通过.getCode());
|
||||
List<EpsBusinessDeploy> businessDeploys = epsBusinessDeployMapper.selectEpsBusinessDeployList(queryBD);
|
||||
if(!businessDeploys.isEmpty()){
|
||||
details.setBusinessCode(businessDeploys.get(0).getBusinessCode());
|
||||
details.setBusinessName(businessDeploys.get(0).getBusinessName());
|
||||
}
|
||||
}else {
|
||||
details.setBusinessCode(null);
|
||||
@@ -192,6 +212,34 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 辅助方法
|
||||
* 获取 inSpeed 和 outSpeed 的最大值并设置到 maxSpeed
|
||||
* @param switchInfo 包含速度信息的实体类
|
||||
*/
|
||||
public static void calculateMaxSpeed(InitialSwitchInfoDetails switchInfo) {
|
||||
if (switchInfo == null) {
|
||||
return;
|
||||
}
|
||||
// 获取 inSpeed 和 outSpeed
|
||||
BigDecimal inSpeed = switchInfo.getInSpeed();
|
||||
BigDecimal outSpeed = switchInfo.getOutSpeed();
|
||||
// 处理可能为null的情况
|
||||
if (inSpeed == null && outSpeed == null) {
|
||||
switchInfo.setMaxSpeed(null);
|
||||
return;
|
||||
}
|
||||
if (inSpeed == null) {
|
||||
switchInfo.setMaxSpeed(outSpeed);
|
||||
return;
|
||||
}
|
||||
if (outSpeed == null) {
|
||||
switchInfo.setMaxSpeed(inSpeed);
|
||||
return;
|
||||
}
|
||||
// 比较并设置最大值
|
||||
switchInfo.setMaxSpeed(inSpeed.compareTo(outSpeed) > 0 ? inSpeed : outSpeed);
|
||||
}
|
||||
/**
|
||||
* 批量处理接口名称
|
||||
*/
|
||||
@@ -314,8 +362,7 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
|
||||
// 遍历处理每个交换机
|
||||
switchSnList.forEach(interfaceName -> {
|
||||
queryParam.setSwitchSn(interfaceName.getSwitchSn());
|
||||
queryParam.setSwitchIp(interfaceName.getSwitchIp());
|
||||
queryParam.setClientId(interfaceName.getClientId());
|
||||
processSwitchBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode);
|
||||
});
|
||||
}
|
||||
@@ -330,6 +377,7 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
public void recalculateSwitch95Bandwidth(EpsNodeBandwidth epsNodeBandwidth, String dailyStartTime,
|
||||
String dailyEndTime, String calculationMode) {
|
||||
InitialSwitchInfoDetails switchInfoDetails = new InitialSwitchInfoDetails();
|
||||
switchInfoDetails.setClientId(epsNodeBandwidth.getClientId());
|
||||
switchInfoDetails.setStartTime(dailyStartTime);
|
||||
switchInfoDetails.setEndTime(dailyEndTime);
|
||||
switchInfoDetails.setSwitchSn(epsNodeBandwidth.getSwitchSn());
|
||||
@@ -346,9 +394,7 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
List<BigDecimal> speedsInMbps = dataList.stream()
|
||||
.map(data -> {
|
||||
// 根据 interfaceDeviceType 选择 inSpeed 或 outSpeed
|
||||
String speed = "1".equals(data.getInterfaceDeviceType())
|
||||
? (data.getInSpeed() != null ? data.getInSpeed().toString() : BigDecimal.ZERO.toString())
|
||||
: (data.getOutSpeed() != null ? data.getOutSpeed().toString() : BigDecimal.ZERO.toString());
|
||||
String speed = data.getMaxSpeed() != null ? data.getMaxSpeed().toString() : BigDecimal.ZERO.toString();
|
||||
// 如果 speed 是纯数字,补充单位 "B/S"(Bytes/s)
|
||||
if (speed.matches("^\\d+(\\.\\d+)?$")) {
|
||||
speed += " B/S";
|
||||
@@ -382,12 +428,12 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
switchInfoDetails.setStartTime(dailyStartTime);
|
||||
switchInfoDetails.setEndTime(dailyEndTime);
|
||||
switchInfoDetails.setSwitchSn(epsNodeBandwidth.getSwitchSn());
|
||||
switchInfoDetails.setSwitchName(epsNodeBandwidth.getUplinkSwitch());
|
||||
// switchInfoDetails.setSwitchName(epsNodeBandwidth.getUplinkSwitch());
|
||||
switchInfoDetails.setServerSn(epsNodeBandwidth.getHardwareSn());
|
||||
switchInfoDetails.setInterfaceDeviceType(epsNodeBandwidth.getInterfaceLinkDeviceType());
|
||||
switchInfoDetails.setName(epsNodeBandwidth.getInterfaceName());
|
||||
switchInfoDetails.setBusinessCode(epsNodeBandwidth.getBusinessId());
|
||||
switchInfoDetails.setBusinessName(epsNodeBandwidth.getBusinessName());
|
||||
// switchInfoDetails.setBusinessName(epsNodeBandwidth.getBusinessName());
|
||||
List<InitialSwitchInfoDetails> dataList = initialSwitchInfoDetailsMapper
|
||||
.selectInitialSwitchInfoDetailsList(switchInfoDetails);
|
||||
return dataList;
|
||||
@@ -436,28 +482,17 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
String dailyEndTime, String calculationMode) {
|
||||
// 根据交换机sn查询连接的服务器sn
|
||||
RmEpsTopologyManagement management = new RmEpsTopologyManagement();
|
||||
management.setSwitchSn(queryParam.getSwitchSn());
|
||||
management.setSwitchIpAddress(queryParam.getSwitchIp());
|
||||
management.setClientId(queryParam.getClientId());
|
||||
List<RmEpsTopologyManagement> serverSnList = rmEpsTopologyManagementMapper.selectRmEpsTopologyManagementList(management);
|
||||
if(!serverSnList.isEmpty()){
|
||||
for (RmEpsTopologyManagement rmEpsTopologyManagement : serverSnList) {
|
||||
queryParam.setName(rmEpsTopologyManagement.getInterfaceName());
|
||||
if("1".equals(rmEpsTopologyManagement.getConnectedDeviceType())){
|
||||
queryParam.setServerSn(rmEpsTopologyManagement.getServerSn());
|
||||
// 检查交换机连接的服务器是否有业务变更(如果有相关配置)
|
||||
EpsServerRevenueConfig revenueConfig = new EpsServerRevenueConfig();
|
||||
revenueConfig.setHardwareSn(rmEpsTopologyManagement.getServerSn());
|
||||
List<EpsServerRevenueConfig> changedList = epsServerRevenueConfigMapper
|
||||
.selectEpsServerRevenueConfigList(revenueConfig);
|
||||
queryParam.setServerClientId(rmEpsTopologyManagement.getServerClientId());
|
||||
// 根据业务变更情况选择计算方式
|
||||
if (hasTrafficMethodChanged(changedList)) {
|
||||
calculateChangedSwitchBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode);
|
||||
} else {
|
||||
calculateNormalSwitchBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode);
|
||||
}
|
||||
}
|
||||
if("2".equals(rmEpsTopologyManagement.getConnectedDeviceType())){
|
||||
queryParam.setServerSn(null);
|
||||
calculateChangedSwitchBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode);
|
||||
}else{
|
||||
queryParam.setServerClientId(null);
|
||||
calculateNormalSwitchBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode);
|
||||
}
|
||||
}
|
||||
@@ -480,7 +515,7 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
String dailyEndTime, String calculationMode) {
|
||||
// 获取业务变更记录(按时间降序)
|
||||
EpsMethodChangeRecord changeQuery = new EpsMethodChangeRecord();
|
||||
changeQuery.setHardwareSn(queryParam.getServerSn());
|
||||
changeQuery.setClientId(queryParam.getServerClientId());
|
||||
changeQuery.setStartTime(dailyStartTime);
|
||||
changeQuery.setEndTime(dailyEndTime);
|
||||
List<EpsMethodChangeRecord> records = epsMethodChangeRecordMapper
|
||||
@@ -518,18 +553,12 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
*/
|
||||
private void calculateAndSaveSwitch95Bandwidth(List<InitialSwitchInfoDetails> dataList, String dateTime,
|
||||
String dayOrMonth, String calculationMode) {
|
||||
boolean eff = false;
|
||||
if(!dataList.isEmpty()){
|
||||
if(dataList.size()<288){
|
||||
eff = true;
|
||||
}
|
||||
// 1. 提取并转换带宽值
|
||||
List<BigDecimal> speedsInMbps = dataList.stream()
|
||||
.map(data -> {
|
||||
// 根据 interfaceDeviceType 选择 inSpeed 或 outSpeed
|
||||
String speed = "1".equals(data.getInterfaceDeviceType())
|
||||
? (data.getInSpeed() != null ? data.getInSpeed().toString() : BigDecimal.ZERO.toString())
|
||||
: (data.getOutSpeed() != null ? data.getOutSpeed().toString() : BigDecimal.ZERO.toString());
|
||||
String speed = data.getMaxSpeed() != null ? data.getMaxSpeed().toString() : BigDecimal.ZERO.toString();
|
||||
// 如果 speed 是纯数字,补充单位 "B/S"(Bytes/s)
|
||||
if (speed.matches("^\\d+(\\.\\d+)?$")) {
|
||||
speed += " B/S";
|
||||
@@ -546,18 +575,10 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
InitialSwitchInfoDetails switchInfo = dataList.get(0);
|
||||
switchInfo.setResourceType("2");
|
||||
if("1".equals(dayOrMonth)){
|
||||
if(eff){
|
||||
switchInfo.setBandwidthType("5");
|
||||
}else{
|
||||
switchInfo.setBandwidthType("1");
|
||||
}
|
||||
switchInfo.setBandwidthType("1");
|
||||
}
|
||||
if("2".equals(dayOrMonth)){
|
||||
if(eff){
|
||||
switchInfo.setBandwidthType("6");
|
||||
}else{
|
||||
switchInfo.setBandwidthType("2");
|
||||
}
|
||||
switchInfo.setBandwidthType("2");
|
||||
}
|
||||
saveSwitchBandwidthResult(switchInfo, percentile95, dateTime, calculationMode);
|
||||
}
|
||||
@@ -571,15 +592,15 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
String dailyStartTime,
|
||||
String dailyEndTime, String calculationMode) {
|
||||
// 1. 处理变更时间段(从最新到最早)
|
||||
String endTime = records.get(0).getCreateTime() + "";
|
||||
String endTime = DateUtils.parseDateToStr(DATE_TIME_FORMATTER, records.get(0).getCreateTime());
|
||||
for (int i = 1; i < records.size(); i++) {
|
||||
String startTime = records.get(i).getCreateTime() + "";
|
||||
String startTime = DateUtils.parseDateToStr(DATE_TIME_FORMATTER, records.get(i).getCreateTime());
|
||||
calculateSwitchSegment95(queryParam, startTime, endTime, calculationMode);
|
||||
endTime = startTime; // 移动时间窗口
|
||||
}
|
||||
|
||||
// 2. 处理最早变更前的时间段(昨天00:00:00 ~ 最早变更时间)
|
||||
String earliestChangeTime = records.get(records.size()-1).getCreateTime() + "";
|
||||
String earliestChangeTime = DateUtils.parseDateToStr(DATE_TIME_FORMATTER, records.get(records.size()-1).getCreateTime());
|
||||
calculateSwitchSegment95(queryParam, dailyStartTime, earliestChangeTime, calculationMode);
|
||||
|
||||
// 3. 处理最后变更后的时间段(最新变更时间 ~ 昨天23:59:59)
|
||||
@@ -608,9 +629,7 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
List<BigDecimal> speedsInMbps = dataList.stream()
|
||||
.map(data -> {
|
||||
// 根据 interfaceDeviceType 选择 inSpeed 或 outSpeed
|
||||
String speed = "1".equals(data.getInterfaceDeviceType())
|
||||
? (data.getInSpeed() != null ? data.getInSpeed().toString() : BigDecimal.ZERO.toString())
|
||||
: (data.getOutSpeed() != null ? data.getOutSpeed().toString() : BigDecimal.ZERO.toString());
|
||||
String speed = data.getMaxSpeed() != null ? data.getMaxSpeed().toString() : BigDecimal.ZERO.toString();
|
||||
if (speed.matches("^\\d+(\\.\\d+)?$")) {
|
||||
speed += " B/S";
|
||||
}
|
||||
@@ -626,20 +645,11 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
// 3. 保存结果
|
||||
InitialSwitchInfoDetails switchInfo = dataList.get(0);
|
||||
switchInfo.setResourceType("2");
|
||||
if(CalculateUtil.isEff(dataList)){
|
||||
if("1".equals(dayOrMonth)){
|
||||
switchInfo.setBandwidthType("5");
|
||||
}
|
||||
if("2".equals(dayOrMonth)){
|
||||
switchInfo.setBandwidthType("6");
|
||||
}
|
||||
}else {
|
||||
if("1".equals(dayOrMonth)){
|
||||
switchInfo.setBandwidthType("1");
|
||||
}
|
||||
if("2".equals(dayOrMonth)){
|
||||
switchInfo.setBandwidthType("2");
|
||||
}
|
||||
if("1".equals(dayOrMonth)){
|
||||
switchInfo.setBandwidthType("1");
|
||||
}
|
||||
if("2".equals(dayOrMonth)){
|
||||
switchInfo.setBandwidthType("2");
|
||||
}
|
||||
saveSwitchBandwidthResult(switchInfo, dailyResult, startTime, calculationMode);
|
||||
}
|
||||
@@ -651,14 +661,23 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
BigDecimal result,
|
||||
String dateTime, String calculationMode) {
|
||||
EpsNodeBandwidth bandwidth = new EpsNodeBandwidth();
|
||||
// 根据clientId查询交换机名称
|
||||
RmSwitchManagement query = new RmSwitchManagement();
|
||||
query.setClientId(data.getClientId());
|
||||
List<RmSwitchManagement> switchMsgList = rmSwitchManagementMapper.selectRmSwitchManagementList(query);
|
||||
if(!switchMsgList.isEmpty()){
|
||||
RmSwitchManagement switchManagement = switchMsgList.get(0);
|
||||
bandwidth.setUplinkSwitch(switchManagement.getSwitchName());
|
||||
}
|
||||
bandwidth.setBusinessName(data.getBusinessName());
|
||||
bandwidth.setBusinessId(data.getBusinessCode());
|
||||
bandwidth.setClientId(data.getClientId());
|
||||
bandwidth.setHardwareSn(data.getServerSn());
|
||||
bandwidth.setCalculationMode(calculationMode);
|
||||
bandwidth.setSwitchSn(data.getSwitchSn());
|
||||
bandwidth.setNodeName(data.getServerName());
|
||||
bandwidth.setUplinkSwitch(data.getSwitchName());
|
||||
bandwidth.setInterfaceName(data.getName());
|
||||
bandwidth.setRemark1(data.getInterfaceNameRemark());
|
||||
bandwidth.setServerClientId(data.getServerClientId());
|
||||
bandwidth.setResourceType(data.getResourceType());
|
||||
bandwidth.setBandwidthType(data.getBandwidthType());
|
||||
bandwidth.setInterfaceLinkDeviceType(data.getInterfaceDeviceType());
|
||||
@@ -700,4 +719,231 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
epsNodeBandwidthMapper.insertEpsNodeBandwidth(bandwidth);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 图形分析 - 日95
|
||||
* @param initialSwitchInfoDetails
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getGraphicalAnalysisDaily(InitialSwitchInfoDetails initialSwitchInfoDetails) {
|
||||
// 拿到时间范围
|
||||
String startTime = initialSwitchInfoDetails.getStartTime();
|
||||
String endTime = initialSwitchInfoDetails.getEndTime();
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
// 2. 解析日期范围
|
||||
LocalDate startDate = LocalDate.parse(startTime);
|
||||
LocalDate endDate = LocalDate.parse(endTime);
|
||||
// 3. 循环处理每一天
|
||||
for (LocalDate date = startDate; !date.isAfter(endDate); date = date.plusDays(1)) {
|
||||
// 构造当天的开始和结束时间(精确到秒)
|
||||
String dayStart = date.atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
String dayEnd = date.atTime(23, 59, 59).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
// 时间范围
|
||||
String timeRange = "从" + dayStart + "到" + dayEnd;
|
||||
// 创建当天的查询条件
|
||||
InitialSwitchInfoDetails dailyQuery = new InitialSwitchInfoDetails();
|
||||
BeanUtils.copyProperties(initialSwitchInfoDetails, dailyQuery); // 复制原有属性
|
||||
dailyQuery.setStartTime(dayStart);
|
||||
dailyQuery.setEndTime(dayEnd);
|
||||
// 根据交换机名称查询clientId
|
||||
String clientIds = initialSwitchInfoDetails.getClientIds();
|
||||
String[] clientIdArr = clientIds.split(",");
|
||||
for (String clientId : clientIdArr) {
|
||||
// 根据clientId查询已经配置的接口
|
||||
RmEpsTopologyManagement queryParam = new RmEpsTopologyManagement();
|
||||
queryParam.setClientId(clientId);
|
||||
List<RmEpsTopologyManagement> rmEpsTopologyManagements = rmEpsTopologyManagementMapper.selectRmEpsTopologyManagementList(queryParam);
|
||||
if(!rmEpsTopologyManagements.isEmpty()){
|
||||
for (RmEpsTopologyManagement rmEpsTopologyManagement : rmEpsTopologyManagements) {
|
||||
try {
|
||||
// 查询95值
|
||||
BigDecimal percentile95 = BigDecimal.ZERO;
|
||||
EpsNodeBandwidth query = new EpsNodeBandwidth();
|
||||
query.setBandwidthType("1");
|
||||
query.setCreateTime(DateUtils.parseDate(date));
|
||||
query.setCalculationMode(initialSwitchInfoDetails.getCalculationMode());
|
||||
query.setClientId(clientId);
|
||||
query.setInterfaceName(rmEpsTopologyManagement.getInterfaceName());
|
||||
List<EpsNodeBandwidth> epsNodeBandwidthList = epsNodeBandwidthMapper.selectEpsNodeBandwidthList(query);
|
||||
if(!epsNodeBandwidthList.isEmpty()){
|
||||
EpsNodeBandwidth nodeBandwidth = epsNodeBandwidthList.get(0);
|
||||
percentile95 = nodeBandwidth.getBandwidthResult();
|
||||
}
|
||||
dailyQuery.setName(rmEpsTopologyManagement.getInterfaceName());
|
||||
Map<String, Object> resultMap = switchNetSpeedEcharts(dailyQuery, percentile95);
|
||||
// 查询端口备注信息
|
||||
RmSwitchInterfaceInfo queryOtheName = new RmSwitchInterfaceInfo();
|
||||
queryOtheName.setClientId(clientId);
|
||||
queryOtheName.setInterfaceName(rmEpsTopologyManagement.getInterfaceName());
|
||||
List<RmSwitchInterfaceInfo> interfaceInfos = rmSwitchInterfaceInfoMapper.selectRmSwitchInterfaceInfoList(queryOtheName);
|
||||
String otherName = null;
|
||||
if(!interfaceInfos.isEmpty()){
|
||||
otherName = interfaceInfos.get(0).getInterfaceRemark();
|
||||
}
|
||||
// 查询业务信息
|
||||
String businessName = null;
|
||||
EpsBusinessDeploy queryBD = new EpsBusinessDeploy();
|
||||
queryBD.setClientId(clientId);
|
||||
queryBD.setReviewStatus(ReviewEnum.通过.getCode());
|
||||
List<EpsBusinessDeploy> businessDeploys = epsBusinessDeployMapper.selectEpsBusinessDeployList(queryBD);
|
||||
if(!businessDeploys.isEmpty()){
|
||||
businessName = businessDeploys.get(0).getBusinessName();
|
||||
}
|
||||
StringJoiner joiner = new StringJoiner("");
|
||||
if (rmEpsTopologyManagement.getSwitchName() != null) {
|
||||
joiner.add("【" + rmEpsTopologyManagement.getSwitchName() + "】");
|
||||
}
|
||||
if (rmEpsTopologyManagement.getInterfaceName() != null) {
|
||||
joiner.add("【" + rmEpsTopologyManagement.getInterfaceName() + "】");
|
||||
}
|
||||
if (otherName != null) {
|
||||
joiner.add("【" + otherName + "】");
|
||||
}
|
||||
if (businessName != null) {
|
||||
joiner.add("【" + businessName + "】");
|
||||
}
|
||||
String name = joiner.toString();
|
||||
resultMap.put("name", name);
|
||||
resultMap.put("timeRange", timeRange);
|
||||
resultList.add(resultMap);
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultList.isEmpty() ? new ArrayList<>() : resultList;
|
||||
}
|
||||
/**
|
||||
* 图形分析 - 月95
|
||||
* @param initialSwitchInfoDetails
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getGraphicalAnalysisMonthy(InitialSwitchInfoDetails initialSwitchInfoDetails) {
|
||||
// 拿到时间范围
|
||||
String startTime = initialSwitchInfoDetails.getStartTime();
|
||||
String endTime = initialSwitchInfoDetails.getEndTime();
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
// 2. 解析月份范围
|
||||
YearMonth start = YearMonth.parse(startTime);
|
||||
YearMonth end = YearMonth.parse(endTime);
|
||||
// 3. 循环处理每个月
|
||||
for (YearMonth month = start; !month.isAfter(end); month = month.plusMonths(1)) {
|
||||
// 获取当月的第一天和最后一天(精确到秒)
|
||||
String monthStart = month.atDay(1).atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
String monthEnd = month.atEndOfMonth().atTime(23, 59, 59)
|
||||
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
|
||||
// 创建当天的查询条件
|
||||
InitialSwitchInfoDetails dailyQuery = new InitialSwitchInfoDetails();
|
||||
BeanUtils.copyProperties(initialSwitchInfoDetails, dailyQuery); // 复制原有属性
|
||||
dailyQuery.setStartTime(monthStart);
|
||||
dailyQuery.setEndTime(monthEnd);
|
||||
// 时间范围
|
||||
String timeRange = "从" + monthStart + "到" + monthEnd;
|
||||
// 根据交换机名称查询clientId
|
||||
String clientIds = initialSwitchInfoDetails.getClientIds();
|
||||
String[] clientIdArr = clientIds.split(",");
|
||||
for (String clientId : clientIdArr) {
|
||||
// 根据clientId查询已经配置的接口
|
||||
RmEpsTopologyManagement queryParam = new RmEpsTopologyManagement();
|
||||
queryParam.setClientId(clientId);
|
||||
List<RmEpsTopologyManagement> rmEpsTopologyManagements = rmEpsTopologyManagementMapper.selectRmEpsTopologyManagementList(queryParam);
|
||||
if(!rmEpsTopologyManagements.isEmpty()){
|
||||
for (RmEpsTopologyManagement rmEpsTopologyManagement : rmEpsTopologyManagements) {
|
||||
try {
|
||||
// 查询95值
|
||||
BigDecimal percentile95 = BigDecimal.ZERO;
|
||||
EpsNodeBandwidth query = new EpsNodeBandwidth();
|
||||
query.setBandwidthType("1");
|
||||
query.setCreateTime(DateUtils.parseDate(monthStart));
|
||||
query.setCalculationMode(initialSwitchInfoDetails.getCalculationMode());
|
||||
query.setClientId(clientId);
|
||||
List<EpsNodeBandwidth> epsNodeBandwidthList = epsNodeBandwidthMapper.selectEpsNodeBandwidthList(query);
|
||||
if(!epsNodeBandwidthList.isEmpty()){
|
||||
EpsNodeBandwidth nodeBandwidth = epsNodeBandwidthList.get(0);
|
||||
percentile95 = nodeBandwidth.getBandwidthResult();
|
||||
}
|
||||
dailyQuery.setName(rmEpsTopologyManagement.getInterfaceName());
|
||||
Map<String, Object> resultMap = switchNetSpeedEcharts(dailyQuery, percentile95);
|
||||
// 查询端口备注信息
|
||||
RmSwitchInterfaceInfo queryOtheName = new RmSwitchInterfaceInfo();
|
||||
queryOtheName.setClientId(clientId);
|
||||
queryOtheName.setInterfaceName(rmEpsTopologyManagement.getInterfaceName());
|
||||
List<RmSwitchInterfaceInfo> interfaceInfos = rmSwitchInterfaceInfoMapper.selectRmSwitchInterfaceInfoList(queryOtheName);
|
||||
String otherName = null;
|
||||
if(!interfaceInfos.isEmpty()){
|
||||
otherName = interfaceInfos.get(0).getInterfaceRemark();
|
||||
}
|
||||
// 查询业务信息
|
||||
String businessName = null;
|
||||
EpsBusinessDeploy queryBD = new EpsBusinessDeploy();
|
||||
queryBD.setClientId(clientId);
|
||||
queryBD.setReviewStatus(ReviewEnum.通过.getCode());
|
||||
List<EpsBusinessDeploy> businessDeploys = epsBusinessDeployMapper.selectEpsBusinessDeployList(queryBD);
|
||||
if(!businessDeploys.isEmpty()){
|
||||
businessName = businessDeploys.get(0).getBusinessName();
|
||||
}
|
||||
StringJoiner joiner = new StringJoiner("");
|
||||
if (rmEpsTopologyManagement.getSwitchName() != null) {
|
||||
joiner.add("【" + rmEpsTopologyManagement.getSwitchName() + "】");
|
||||
}
|
||||
if (rmEpsTopologyManagement.getInterfaceName() != null) {
|
||||
joiner.add("【" + rmEpsTopologyManagement.getInterfaceName() + "】");
|
||||
}
|
||||
if (otherName != null) {
|
||||
joiner.add("【" + otherName + "】");
|
||||
}
|
||||
if (businessName != null) {
|
||||
joiner.add("【" + businessName + "】");
|
||||
}
|
||||
String name = joiner.toString();
|
||||
resultMap.put("name", name);
|
||||
resultMap.put("timeRange", timeRange);
|
||||
resultList.add(resultMap);
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultList.isEmpty() ? new ArrayList<>() : resultList;
|
||||
}
|
||||
/**
|
||||
* 获取交换机网口网络速率
|
||||
* @param initialSwitchInfoDetails
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> switchNetSpeedEcharts(InitialSwitchInfoDetails initialSwitchInfoDetails, BigDecimal percentile95) {
|
||||
List<InitialSwitchInfoDetails> list = initialSwitchInfoDetailsMapper.getswitchDetailList(initialSwitchInfoDetails);
|
||||
try {
|
||||
list.forEach(data -> data.setPercentile95(SpeedUtils.mbitToBit(percentile95)));
|
||||
SpeedUtils.SpeedResult result = SpeedUtils.calculateWithAverageBasedUnit(list, "inSpeed", "outSpeed");
|
||||
BigDecimal divisor = SpeedUtils.getDivisor(result.getRecommendedUnit());
|
||||
Map<String, Function<InitialSwitchInfoDetails, ?>> extractors = new LinkedHashMap<>();
|
||||
extractors.put("netInSpeedData", info ->
|
||||
info != null && info.getInSpeed() != null ?
|
||||
info.getInSpeed().divide(divisor, 0, RoundingMode.HALF_UP) :
|
||||
0);
|
||||
|
||||
extractors.put("netOutSpeedData", info ->
|
||||
info != null && info.getOutSpeed() != null ?
|
||||
info.getOutSpeed().divide(divisor, 0, RoundingMode.HALF_UP) :
|
||||
0);
|
||||
extractors.put("percentile95", info ->
|
||||
info != null && info.getPercentile95() != null ?
|
||||
info.getPercentile95().divide(divisor, 2, RoundingMode.HALF_UP) :
|
||||
0);
|
||||
Map<String, Object> resultMap = EchartsDataUtils.buildEchartsData(list, InitialSwitchInfoDetails::getCreateTime, extractors);
|
||||
resultMap.put("other", result);
|
||||
resultMap.put("95value", percentile95);
|
||||
return resultMap;
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new HashMap<>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.RmRegistrationMachineMapper;
|
||||
import com.ruoyi.system.domain.RmRegistrationMachine;
|
||||
import com.ruoyi.system.service.IRmRegistrationMachineService;
|
||||
|
||||
/**
|
||||
* 绑定金山machinecodeService业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
@Service
|
||||
public class RmRegistrationMachineServiceImpl implements IRmRegistrationMachineService
|
||||
{
|
||||
@Autowired
|
||||
private RmRegistrationMachineMapper rmRegistrationMachineMapper;
|
||||
|
||||
/**
|
||||
* 查询绑定金山machinecode
|
||||
*
|
||||
* @param id 绑定金山machinecode主键
|
||||
* @return 绑定金山machinecode
|
||||
*/
|
||||
@Override
|
||||
public RmRegistrationMachine selectRmRegistrationMachineById(Long id)
|
||||
{
|
||||
return rmRegistrationMachineMapper.selectRmRegistrationMachineById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询绑定金山machinecode列表
|
||||
*
|
||||
* @param rmRegistrationMachine 绑定金山machinecode
|
||||
* @return 绑定金山machinecode
|
||||
*/
|
||||
@Override
|
||||
public List<RmRegistrationMachine> selectRmRegistrationMachineList(RmRegistrationMachine rmRegistrationMachine)
|
||||
{
|
||||
return rmRegistrationMachineMapper.selectRmRegistrationMachineList(rmRegistrationMachine);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增绑定金山machinecode
|
||||
*
|
||||
* @param rmRegistrationMachine 绑定金山machinecode
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRmRegistrationMachine(RmRegistrationMachine rmRegistrationMachine)
|
||||
{
|
||||
rmRegistrationMachine.setCreateTime(DateUtils.getNowDate());
|
||||
return rmRegistrationMachineMapper.insertRmRegistrationMachine(rmRegistrationMachine);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改绑定金山machinecode
|
||||
*
|
||||
* @param rmRegistrationMachine 绑定金山machinecode
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRmRegistrationMachine(RmRegistrationMachine rmRegistrationMachine)
|
||||
{
|
||||
rmRegistrationMachine.setUpdateTime(DateUtils.getNowDate());
|
||||
return rmRegistrationMachineMapper.updateRmRegistrationMachine(rmRegistrationMachine);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除绑定金山machinecode
|
||||
*
|
||||
* @param ids 需要删除的绑定金山machinecode主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmRegistrationMachineByIds(Long[] ids)
|
||||
{
|
||||
return rmRegistrationMachineMapper.deleteRmRegistrationMachineByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除绑定金山machinecode信息
|
||||
*
|
||||
* @param id 绑定金山machinecode主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmRegistrationMachineById(Long id)
|
||||
{
|
||||
return rmRegistrationMachineMapper.deleteRmRegistrationMachineById(id);
|
||||
}
|
||||
}
|
||||
@@ -5,28 +5,25 @@ import com.ruoyi.common.core.constant.SecurityConstants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.enums.MsgEnum;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.system.api.RemoteRocketMqService;
|
||||
import com.ruoyi.system.domain.EpsNodeBandwidth;
|
||||
import com.ruoyi.system.domain.EpsServerRevenueConfig;
|
||||
import com.ruoyi.system.domain.RmEpsTopologyManagement;
|
||||
import com.ruoyi.system.domain.RmResourceRegistration;
|
||||
import com.ruoyi.system.api.domain.*;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.domain.vo.MessageVo;
|
||||
import com.ruoyi.system.domain.vo.ResourceVo;
|
||||
import com.ruoyi.system.mapper.EpsNodeBandwidthMapper;
|
||||
import com.ruoyi.system.mapper.EpsServerRevenueConfigMapper;
|
||||
import com.ruoyi.system.mapper.RmEpsTopologyManagementMapper;
|
||||
import com.ruoyi.system.mapper.RmResourceRegistrationMapper;
|
||||
import com.ruoyi.system.domain.vo.RspVo;
|
||||
import com.ruoyi.system.mapper.*;
|
||||
import com.ruoyi.system.service.IRmResourceRegistrationService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 资源注册Service业务层处理
|
||||
@@ -35,6 +32,7 @@ import java.util.Map;
|
||||
* @date 2025-08-12
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class RmResourceRegistrationServiceImpl implements IRmResourceRegistrationService
|
||||
{
|
||||
@Autowired
|
||||
@@ -47,6 +45,10 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
||||
private EpsNodeBandwidthMapper epsNodeBandwidthMapper;
|
||||
@Autowired
|
||||
private RemoteRocketMqService remoteRocketMqService;
|
||||
@Autowired
|
||||
private EpsMethodChangeRecordMapper epsMethodChangeRecordMapper;
|
||||
@Autowired
|
||||
private RmRegistrationMachineMapper rmRegistrationMachineMapper;
|
||||
|
||||
/**
|
||||
* 查询资源注册
|
||||
@@ -57,7 +59,12 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
||||
@Override
|
||||
public RmResourceRegistration selectRmResourceRegistrationById(Long id)
|
||||
{
|
||||
return rmResourceRegistrationMapper.selectRmResourceRegistrationById(id);
|
||||
RmResourceRegistration rmResourceRegistration = rmResourceRegistrationMapper.selectRmResourceRegistrationById(id);
|
||||
if(rmResourceRegistration.getClientId()!= null){
|
||||
// set网卡信息
|
||||
setNetWorkMsg(rmResourceRegistration);
|
||||
}
|
||||
return rmResourceRegistration;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,9 +77,135 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
||||
public List<RmResourceRegistration> selectRmResourceRegistrationList(RmResourceRegistration rmResourceRegistration)
|
||||
{
|
||||
List<RmResourceRegistration> rmResourceRegistrationList = rmResourceRegistrationMapper.selectRmResourceRegistrationList(rmResourceRegistration);
|
||||
for (RmResourceRegistration resourceRegistration : rmResourceRegistrationList) {
|
||||
if(resourceRegistration.getClientId() != null){
|
||||
// 网卡信息
|
||||
setNetWorkMsg(resourceRegistration);
|
||||
}
|
||||
}
|
||||
if(rmResourceRegistration.getQueryParam() != null){
|
||||
String queryValue = rmResourceRegistration.getQueryParam().trim();
|
||||
// 筛选公网IP私网IP设备SN相等的数据
|
||||
// 从rmResourceRegistrationList列表中筛选符合条件的数据
|
||||
List<RmResourceRegistration> filteredList = rmResourceRegistrationList.stream()
|
||||
.filter(item -> item != null)
|
||||
.filter(item ->
|
||||
// 检查公网IP (IP1-3和管理网)
|
||||
queryValue.equals(item.getIp1PublicIp()) ||
|
||||
queryValue.equals(item.getIp2PublicIp()) ||
|
||||
queryValue.equals(item.getIp3PublicIp()) ||
|
||||
queryValue.equals(item.getMgmtPublicIp()) ||
|
||||
|
||||
// 检查私网IP (IP1-3和管理网)
|
||||
queryValue.equals(item.getIp1Ipv4Address()) ||
|
||||
queryValue.equals(item.getIp2Ipv4Address()) ||
|
||||
queryValue.equals(item.getIp3Ipv4Address()) ||
|
||||
queryValue.equals(item.getMgmtIpv4Address()) ||
|
||||
|
||||
// 检查设备SN
|
||||
queryValue.equals(item.getHardwareSn()))
|
||||
.collect(Collectors.toList());
|
||||
return filteredList;
|
||||
}
|
||||
return rmResourceRegistrationList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 网卡信息赋值
|
||||
* @param registration
|
||||
*/
|
||||
public void setNetWorkMsg(RmResourceRegistration registration) {
|
||||
String clientId = registration.getClientId();
|
||||
// 根据clientId查询网卡信息
|
||||
RmNetworkInterfaceRemote queryParam = new RmNetworkInterfaceRemote();
|
||||
queryParam.setClientId(clientId);
|
||||
queryParam.setNewFlag(1);
|
||||
// 安全获取网络接口列表
|
||||
R<List<RmNetworkInterfaceRemote>> result = remoteRocketMqService.getNetworkInterfaceList(queryParam, SecurityConstants.INNER);
|
||||
// 多层安全判断
|
||||
if (result == null || result.getData() == null) {
|
||||
log.warn("获取网络接口列表为空,clientId: {}", clientId);
|
||||
return;
|
||||
}
|
||||
|
||||
List<RmNetworkInterfaceRemote> networkList = result.getData();
|
||||
|
||||
if (networkList == null || networkList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 初始化业务IP计数器
|
||||
int businessIpCount = 1;
|
||||
|
||||
for (RmNetworkInterfaceRemote network : networkList) {
|
||||
if ("1".equals(network.getBindIp()) || "3".equals(network.getBindIp())) {
|
||||
// 业务IP处理
|
||||
if (businessIpCount > 3) {
|
||||
continue; // 最多只处理3个业务IP
|
||||
}
|
||||
|
||||
// 设置业务IP字段
|
||||
switch (businessIpCount) {
|
||||
case 1:
|
||||
registration.setIp1Isp(network.getIsp());
|
||||
registration.setIp1Province(network.getProvince());
|
||||
registration.setIp1City(network.getCity());
|
||||
registration.setIp1PublicIp(network.getPublicIp());
|
||||
registration.setIp1InterfaceName(network.getInterfaceName());
|
||||
registration.setIp1MacAddress(network.getMacAddress());
|
||||
registration.setIp1InterfaceType(network.getInterfaceType());
|
||||
registration.setIp1Ipv4Address(network.getIpv4Address());
|
||||
registration.setIp1Gateway(network.getGateway());
|
||||
break;
|
||||
case 2:
|
||||
registration.setIp2Isp(network.getIsp());
|
||||
registration.setIp2Province(network.getProvince());
|
||||
registration.setIp2City(network.getCity());
|
||||
registration.setIp2PublicIp(network.getPublicIp());
|
||||
registration.setIp2InterfaceName(network.getInterfaceName());
|
||||
registration.setIp2MacAddress(network.getMacAddress());
|
||||
registration.setIp2InterfaceType(network.getInterfaceType());
|
||||
registration.setIp2Ipv4Address(network.getIpv4Address());
|
||||
registration.setIp2Gateway(network.getGateway());
|
||||
break;
|
||||
case 3:
|
||||
registration.setIp3Isp(network.getIsp());
|
||||
registration.setIp3Province(network.getProvince());
|
||||
registration.setIp3City(network.getCity());
|
||||
registration.setIp3PublicIp(network.getPublicIp());
|
||||
registration.setIp3InterfaceName(network.getInterfaceName());
|
||||
registration.setIp3MacAddress(network.getMacAddress());
|
||||
registration.setIp3InterfaceType(network.getInterfaceType());
|
||||
registration.setIp3Ipv4Address(network.getIpv4Address());
|
||||
registration.setIp3Gateway(network.getGateway());
|
||||
break;
|
||||
}
|
||||
|
||||
businessIpCount++;
|
||||
}
|
||||
if ("2".equals(network.getBindIp()) || "3".equals(network.getBindIp())) {
|
||||
// 管理网IP处理
|
||||
registration.setMgmtIsp(network.getIsp());
|
||||
registration.setMgmtProvince(network.getProvince());
|
||||
registration.setMgmtCity(network.getCity());
|
||||
registration.setMgmtPublicIp(network.getPublicIp());
|
||||
registration.setMgmtInterfaceName(network.getInterfaceName());
|
||||
registration.setMgmtMacAddress(network.getMacAddress());
|
||||
registration.setMgmtInterfaceType(network.getInterfaceType());
|
||||
registration.setMgmtIpv4Address(network.getIpv4Address());
|
||||
registration.setMgmtGateway(network.getGateway());
|
||||
}
|
||||
}
|
||||
// 设置金山machineCode
|
||||
RmRegistrationMachine rmRegistrationMachine = new RmRegistrationMachine();
|
||||
rmRegistrationMachine.setClientId(clientId);
|
||||
List<RmRegistrationMachine> machineList = rmRegistrationMachineMapper.selectRmRegistrationMachineList(rmRegistrationMachine);
|
||||
if(!machineList.isEmpty()){
|
||||
RmRegistrationMachine machineMsg = machineList.get(0);
|
||||
registration.setMachineCode(machineMsg.getMachineCode());
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 新增资源注册
|
||||
*
|
||||
@@ -350,5 +483,256 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
||||
return rmResourceRegistrationMapper.getRegistrationByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动注册
|
||||
* @param registerMsg
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int innerAddRegist(RmRegisterMsgRemote registerMsg) {
|
||||
if(registerMsg.getClientId() == null) {
|
||||
log.error("注册失败:clientId为null");
|
||||
return 0;
|
||||
}
|
||||
// 解析mq接收的消息
|
||||
// 时间戳转换
|
||||
long timestamp = registerMsg.getTimestamp();
|
||||
long millis = timestamp * 1000;
|
||||
Date createTime = new Date(millis / 1000 * 1000); // 去除毫秒
|
||||
String timeStr = DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", createTime);
|
||||
List<NetworkInfo> networkInfoList = registerMsg.getNetworkInfo();
|
||||
if(!networkInfoList.isEmpty()){
|
||||
// 查询此数据是否存在
|
||||
RmResourceRegistration queryParam = new RmResourceRegistration();
|
||||
queryParam.setClientId(registerMsg.getClientId());
|
||||
RmResourceRegistration exits = rmResourceRegistrationMapper.selectRegistMsgByClientId(queryParam);
|
||||
if(exits == null){
|
||||
// 构建服务器信息
|
||||
RmResourceRegistration insertData = new RmResourceRegistration();
|
||||
try {
|
||||
// 如果网卡信息只有1条,自动绑定多公网IP
|
||||
if(networkInfoList.size()==1){
|
||||
NetworkInfo networkInfo = networkInfoList.get(0);
|
||||
insertData.setClientId(registerMsg.getClientId());
|
||||
insertData.setHardwareSn(registerMsg.getSn());
|
||||
insertData.setRegistrationStatus("1");
|
||||
insertData.setMultiPublicIpStatus("1");
|
||||
insertData.setHeartbeatCount(3);
|
||||
insertData.setHeartbeatInterval(30);
|
||||
insertData.setResourceType("1");
|
||||
insertData.setCreateTime(createTime);
|
||||
rmResourceRegistrationMapper.insertRmResourceRegistration(insertData);
|
||||
// 添加业务变更记录
|
||||
EpsMethodChangeRecord recordAddData = new EpsMethodChangeRecord();
|
||||
recordAddData.setClientId(registerMsg.getClientId());
|
||||
recordAddData.setTrafficPort(networkInfo.getName());
|
||||
recordAddData.setUpdateTime(DateUtils.getNowDate());
|
||||
recordAddData.setCreateTime(DateUtils.getNowDate());
|
||||
recordAddData.setUpdateBy(SecurityUtils.getUsername());
|
||||
recordAddData.setCreatBy(SecurityUtils.getUsername());
|
||||
StringBuilder content = new StringBuilder();
|
||||
content.append("流量网口设置为").append(networkInfo.getName());
|
||||
recordAddData.setChangeContent(content.toString());
|
||||
epsMethodChangeRecordMapper.insertEpsMethodChangeRecord(recordAddData);
|
||||
// 设置路由信息
|
||||
RouteMsg routeMsg = new RouteMsg();
|
||||
routeMsg.setName(networkInfo.getName());
|
||||
routeMsg.setGateway(networkInfo.getGateway());
|
||||
// 构建注册应答信息
|
||||
MessageVo messageVo = new MessageVo();
|
||||
messageVo.setClientId(registerMsg.getClientId());
|
||||
messageVo.setDataType(MsgEnum.注册应答.getValue());
|
||||
RspVo rspVo = new RspVo();
|
||||
rspVo.setResCode(1);
|
||||
rspVo.setResMag("注册成功");
|
||||
rspVo.setAddRoute(JSONObject.toJSONString(routeMsg));
|
||||
messageVo.setData(JSONObject.toJSONString(rspVo));
|
||||
remoteRocketMqService.sendAsyncProducerMessage(
|
||||
"tr_agent_down", "", "regist_rsp", JSONObject.toJSONString(messageVo), SecurityConstants.INNER
|
||||
);
|
||||
// 第一次注册
|
||||
return 2;
|
||||
}else{
|
||||
insertData.setClientId(registerMsg.getClientId());
|
||||
insertData.setHardwareSn(registerMsg.getSn());
|
||||
insertData.setRegistrationStatus("0");
|
||||
insertData.setMultiPublicIpStatus("0");
|
||||
insertData.setResourceType("1");
|
||||
insertData.setCreateTime(createTime);
|
||||
insertData.setHeartbeatCount(3);
|
||||
insertData.setHeartbeatInterval(30);
|
||||
rmResourceRegistrationMapper.insertRmResourceRegistration(insertData);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("注册服务器失败:{}",e.getMessage());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加节点标识
|
||||
* @param rmResourceRegistration
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int innerUpdateRegist(RmResourceRegistrationRemote rmResourceRegistration) {
|
||||
// 查询此数据是否存在
|
||||
RmResourceRegistration queryParam = new RmResourceRegistration();
|
||||
queryParam.setClientId(rmResourceRegistration.getClientId());
|
||||
RmResourceRegistration exits = rmResourceRegistrationMapper.selectRegistMsgByClientId(queryParam);
|
||||
if(exits != null){
|
||||
RmResourceRegistration updateData = new RmResourceRegistration();
|
||||
boolean needUpdate = false;
|
||||
// 如果上机时间为空 设置上机时间
|
||||
if(exits.getOnboardTime() == null){
|
||||
// 如果服务器已注册 增加节点标识
|
||||
updateData.setOnboardTime(DateUtils.getNowDate());
|
||||
needUpdate = true;
|
||||
}
|
||||
if(exits.getLogicalNodeId() == null ||
|
||||
!StringUtils.equals(rmResourceRegistration.getLogicalNodeId(),exits.getLogicalNodeId())){
|
||||
// 如果服务器已注册 增加节点标识
|
||||
updateData.setLogicalNodeId(rmResourceRegistration.getLogicalNodeId());
|
||||
needUpdate = true;
|
||||
}
|
||||
if(exits.getAgentVersion() == null ||
|
||||
!StringUtils.equals(rmResourceRegistration.getAgentVersion(),exits.getAgentVersion())){
|
||||
// 如果服务器已注册 增加版本信息
|
||||
updateData.setAgentVersion(rmResourceRegistration.getAgentVersion());
|
||||
needUpdate = true;
|
||||
}
|
||||
if(needUpdate){
|
||||
updateData.setId(exits.getId());
|
||||
rmResourceRegistrationMapper.updateRmResourceRegistration(updateData);
|
||||
log.info("设备:{},更新成功",rmResourceRegistration.getClientId());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bindBusinessPublicIp(RmResourceRegistration rmResourceRegistration) {
|
||||
// 参数校验
|
||||
if (rmResourceRegistration == null || StringUtils.isEmpty(rmResourceRegistration.getClientId())) {
|
||||
throw new IllegalArgumentException("参数不合法");
|
||||
}
|
||||
|
||||
String clientId = rmResourceRegistration.getClientId();
|
||||
String username = SecurityUtils.getUsername();
|
||||
Date now = DateUtils.getNowDate();
|
||||
|
||||
// 1. 处理IP绑定和记录
|
||||
rmResourceRegistration.getBindNetworkMsg().forEach(map -> {
|
||||
// 绑定IP
|
||||
RmNetworkInterfaceRemote network = new RmNetworkInterfaceRemote();
|
||||
network.setId((Long) map.get("id"));
|
||||
network.setBindIp(map.get("status").toString());
|
||||
remoteRocketMqService.bindPublicIp(network, SecurityConstants.INNER);
|
||||
|
||||
// 添加变更记录
|
||||
EpsMethodChangeRecord record = new EpsMethodChangeRecord();
|
||||
record.setClientId(clientId);
|
||||
record.setTrafficPort(map.get("interfaceName").toString());
|
||||
record.setCreateTime(now);
|
||||
record.setUpdateTime(now);
|
||||
record.setUpdateBy(username);
|
||||
record.setCreatBy(username);
|
||||
record.setChangeContent("流量网口设置为" + map.get("interfaceName"));
|
||||
epsMethodChangeRecordMapper.insertEpsMethodChangeRecord(record);
|
||||
});
|
||||
|
||||
// 2. 更新注册状态
|
||||
RmResourceRegistration updateData = new RmResourceRegistration();
|
||||
updateData.setId(rmResourceRegistration.getId());
|
||||
updateData.setMultiPublicIpStatus("1");
|
||||
|
||||
// 处理未注册情况
|
||||
RmResourceRegistration isRegist = rmResourceRegistrationMapper.selectRmResourceRegistrationById(rmResourceRegistration.getId());
|
||||
if (isRegist != null && "0".equals(isRegist.getRegistrationStatus())) {
|
||||
RmNetworkInterfaceRemote queryParam = new RmNetworkInterfaceRemote();
|
||||
queryParam.setClientId(clientId);
|
||||
|
||||
Optional.ofNullable(remoteRocketMqService.getNetworkInterfaceList(queryParam, SecurityConstants.INNER))
|
||||
.map(R::getData)
|
||||
.flatMap(list -> list.stream()
|
||||
.filter(ni -> "1".equals(ni.getBindIp()) || "3".equals(ni.getBindIp()))
|
||||
.findFirst())
|
||||
.ifPresent(network -> {
|
||||
updateData.setRegistrationStatus("1");
|
||||
|
||||
// 发送注册响应
|
||||
RouteMsg routeMsg = new RouteMsg();
|
||||
routeMsg.setName(network.getInterfaceName());
|
||||
routeMsg.setGateway(network.getGateway());
|
||||
|
||||
MessageVo messageVo = new MessageVo();
|
||||
messageVo.setClientId(clientId);
|
||||
messageVo.setDataType(MsgEnum.注册应答.getValue());
|
||||
|
||||
RspVo rspVo = new RspVo();
|
||||
rspVo.setResCode(1);
|
||||
rspVo.setResMag("注册成功");
|
||||
rspVo.setAddRoute(JSONObject.toJSONString(routeMsg));
|
||||
|
||||
messageVo.setData(JSONObject.toJSONString(rspVo));
|
||||
|
||||
remoteRocketMqService.sendAsyncProducerMessage(
|
||||
"tr_agent_down", "", "regist_rsp", JSONObject.toJSONString(messageVo), SecurityConstants.INNER
|
||||
);
|
||||
// 注册成功,下发优先级为0的策略
|
||||
remoteRocketMqService.issueDefaultPolicyByClientId(clientId, SecurityConstants.INNER);
|
||||
});
|
||||
}
|
||||
|
||||
rmResourceRegistrationMapper.updateRmResourceRegistration(updateData);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有逻辑节点标识
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map> getAllLogicalNodeId() {
|
||||
return rmResourceRegistrationMapper.getAllLogicalNodeId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定业务
|
||||
* @param rmResourceRegistration
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int bindBusinessByClientIds(RmResourceRegistration rmResourceRegistration) {
|
||||
String clientIds = rmResourceRegistration.getDeployDevice();
|
||||
String[] clientIdArr = clientIds.split("\n");
|
||||
for (String clientId : clientIdArr) {
|
||||
RmResourceRegistration updateData = new RmResourceRegistration();
|
||||
updateData.setClientId(clientId);
|
||||
updateData.setBusinessName(rmResourceRegistration.getBusinessName());
|
||||
rmResourceRegistrationMapper.updateStatusByResource(updateData);
|
||||
// 增加业务变更记录
|
||||
EpsMethodChangeRecord changeRecord = new EpsMethodChangeRecord();
|
||||
// 设置基本信息
|
||||
changeRecord.setClientId(clientId);
|
||||
changeRecord.setBusinessCode(rmResourceRegistration.getBusinessCode());
|
||||
changeRecord.setBusinessName(rmResourceRegistration.getBusinessName());
|
||||
changeRecord.setCreateTime(DateUtils.getNowDate());
|
||||
changeRecord.setUpdateTime(DateUtils.getNowDate());
|
||||
changeRecord.setCreatBy(SecurityUtils.getUsername());
|
||||
changeRecord.setUpdateBy(SecurityUtils.getUsername());
|
||||
// 修改内容
|
||||
String content = "业务为" + rmResourceRegistration.getBusinessName();
|
||||
changeRecord.setChangeContent(content);
|
||||
// 保存数据
|
||||
epsMethodChangeRecordMapper.insertEpsMethodChangeRecord(changeRecord);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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.RmSwitchInterfaceInfoMapper;
|
||||
import com.ruoyi.system.domain.RmSwitchInterfaceInfo;
|
||||
import com.ruoyi.system.service.IRmSwitchInterfaceInfoService;
|
||||
|
||||
/**
|
||||
* 交换机接口信息Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
@Service
|
||||
public class RmSwitchInterfaceInfoServiceImpl implements IRmSwitchInterfaceInfoService
|
||||
{
|
||||
@Autowired
|
||||
private RmSwitchInterfaceInfoMapper rmSwitchInterfaceInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询交换机接口信息
|
||||
*
|
||||
* @param id 交换机接口信息主键
|
||||
* @return 交换机接口信息
|
||||
*/
|
||||
@Override
|
||||
public RmSwitchInterfaceInfo selectRmSwitchInterfaceInfoById(Long id)
|
||||
{
|
||||
return rmSwitchInterfaceInfoMapper.selectRmSwitchInterfaceInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询交换机接口信息列表
|
||||
*
|
||||
* @param rmSwitchInterfaceInfo 交换机接口信息
|
||||
* @return 交换机接口信息
|
||||
*/
|
||||
@Override
|
||||
public List<RmSwitchInterfaceInfo> selectRmSwitchInterfaceInfoList(RmSwitchInterfaceInfo rmSwitchInterfaceInfo)
|
||||
{
|
||||
return rmSwitchInterfaceInfoMapper.selectRmSwitchInterfaceInfoList(rmSwitchInterfaceInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增交换机接口信息
|
||||
*
|
||||
* @param rmSwitchInterfaceInfo 交换机接口信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRmSwitchInterfaceInfo(RmSwitchInterfaceInfo rmSwitchInterfaceInfo)
|
||||
{
|
||||
rmSwitchInterfaceInfo.setCreateTime(DateUtils.getNowDate());
|
||||
return rmSwitchInterfaceInfoMapper.insertRmSwitchInterfaceInfo(rmSwitchInterfaceInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改交换机接口信息
|
||||
*
|
||||
* @param rmSwitchInterfaceInfo 交换机接口信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRmSwitchInterfaceInfo(RmSwitchInterfaceInfo rmSwitchInterfaceInfo)
|
||||
{
|
||||
rmSwitchInterfaceInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return rmSwitchInterfaceInfoMapper.updateRmSwitchInterfaceInfo(rmSwitchInterfaceInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除交换机接口信息
|
||||
*
|
||||
* @param ids 需要删除的交换机接口信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmSwitchInterfaceInfoByIds(Long[] ids)
|
||||
{
|
||||
return rmSwitchInterfaceInfoMapper.deleteRmSwitchInterfaceInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除交换机接口信息信息
|
||||
*
|
||||
* @param id 交换机接口信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmSwitchInterfaceInfoById(Long id)
|
||||
{
|
||||
return rmSwitchInterfaceInfoMapper.deleteRmSwitchInterfaceInfoById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.core.utils.uuid.IdUtils;
|
||||
import com.ruoyi.system.api.RemoteRocketMqService;
|
||||
import com.ruoyi.system.api.domain.RmMonitorPolicyRemote;
|
||||
import com.ruoyi.system.domain.AllInterfaceName;
|
||||
import com.ruoyi.system.domain.RmSwitchInterfaceInfo;
|
||||
import com.ruoyi.system.domain.RmSwitchManagement;
|
||||
import com.ruoyi.system.mapper.AllInterfaceNameMapper;
|
||||
import com.ruoyi.system.mapper.RmSwitchInterfaceInfoMapper;
|
||||
import com.ruoyi.system.mapper.RmSwitchManagementMapper;
|
||||
import com.ruoyi.system.service.IRmSwitchManagementService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 交换机管理Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
@Service
|
||||
public class RmSwitchManagementServiceImpl implements IRmSwitchManagementService
|
||||
{
|
||||
@Autowired
|
||||
private RmSwitchManagementMapper rmSwitchManagementMapper;
|
||||
@Autowired
|
||||
private RmSwitchInterfaceInfoMapper rmSwitchInterfaceInfoMapper;
|
||||
@Autowired
|
||||
private RemoteRocketMqService remoteRocketMqService;
|
||||
@Autowired
|
||||
private AllInterfaceNameMapper allInterfaceNameMapper;
|
||||
|
||||
/**
|
||||
* 查询交换机管理
|
||||
*
|
||||
* @param id 交换机管理主键
|
||||
* @return 交换机管理
|
||||
*/
|
||||
@Override
|
||||
public RmSwitchManagement selectRmSwitchManagementById(Long id)
|
||||
{
|
||||
RmSwitchManagement rmSwitchManagement = rmSwitchManagementMapper.selectRmSwitchManagementById(id);
|
||||
if(rmSwitchManagement != null){
|
||||
// 查询端口备注信息
|
||||
RmSwitchInterfaceInfo queryParam = new RmSwitchInterfaceInfo();
|
||||
queryParam.setClientId(rmSwitchManagement.getClientId());
|
||||
List<RmSwitchInterfaceInfo> interfaceInfos = rmSwitchInterfaceInfoMapper.selectRmSwitchInterfaceInfoList(queryParam);
|
||||
rmSwitchManagement.setSwitchInterfaceInfoList(interfaceInfos);
|
||||
}
|
||||
return rmSwitchManagement;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询交换机管理列表
|
||||
*
|
||||
* @param rmSwitchManagement 交换机管理
|
||||
* @return 交换机管理
|
||||
*/
|
||||
@Override
|
||||
public List<RmSwitchManagement> selectRmSwitchManagementList(RmSwitchManagement rmSwitchManagement)
|
||||
{
|
||||
return rmSwitchManagementMapper.selectRmSwitchManagementList(rmSwitchManagement);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增交换机管理
|
||||
*
|
||||
* @param rmSwitchManagement 交换机管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRmSwitchManagement(RmSwitchManagement rmSwitchManagement) {
|
||||
// 初始化交换机信息
|
||||
rmSwitchManagement.setCreateTime(DateUtils.getNowDate());
|
||||
String clientId= IdUtils.simpleUUID();
|
||||
rmSwitchManagement.setClientId(clientId);
|
||||
rmSwitchManagementMapper.insertRmSwitchManagement(rmSwitchManagement);
|
||||
|
||||
// 查询并更新优先级为0的交换机策略
|
||||
R<List<RmMonitorPolicyRemote>> policyMsgR = remoteRocketMqService.getPolicyMsgInner(
|
||||
new RmMonitorPolicyRemote() {{
|
||||
setPriority("0");
|
||||
setResourceType("switch");
|
||||
}},
|
||||
SecurityConstants.INNER
|
||||
);
|
||||
|
||||
if (policyMsgR.getData() != null && !policyMsgR.getData().isEmpty()) {
|
||||
RmMonitorPolicyRemote policyMsg = policyMsgR.getData().get(0);
|
||||
|
||||
// 构建设备信息字符串
|
||||
String newDeviceList = StringUtils.isBlank(policyMsg.getDeployDevice())
|
||||
? clientId
|
||||
: policyMsg.getDeployDevice() + "\n" + clientId;
|
||||
|
||||
// 更新策略设备列表
|
||||
remoteRocketMqService.updatePolicyMsgInner(
|
||||
new RmMonitorPolicyRemote() {{
|
||||
setId(policyMsg.getId());
|
||||
setDeployDevice(newDeviceList);
|
||||
setUpdateTime(DateUtils.getNowDate());
|
||||
}},
|
||||
SecurityConstants.INNER
|
||||
);
|
||||
|
||||
// 下发更新后的策略
|
||||
remoteRocketMqService.innerIssueSwitchPolicy(policyMsg.getId(), SecurityConstants.INNER);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改交换机管理
|
||||
*
|
||||
* @param rmSwitchManagement 交换机管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRmSwitchManagement(RmSwitchManagement rmSwitchManagement)
|
||||
{
|
||||
rmSwitchManagement.setUpdateTime(DateUtils.getNowDate());
|
||||
return rmSwitchManagementMapper.updateRmSwitchManagement(rmSwitchManagement);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除交换机管理
|
||||
*
|
||||
* @param ids 需要删除的交换机管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmSwitchManagementByIds(Long[] ids)
|
||||
{
|
||||
return rmSwitchManagementMapper.deleteRmSwitchManagementByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除交换机管理信息
|
||||
*
|
||||
* @param id 交换机管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmSwitchManagementById(Long id)
|
||||
{
|
||||
return rmSwitchManagementMapper.deleteRmSwitchManagementById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 交换机信息树形结构
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<RmSwitchManagement> getAllSwitchNameTree() {
|
||||
List<RmSwitchManagement> list = rmSwitchManagementMapper.selectRmSwitchManagementList(new RmSwitchManagement());
|
||||
// 构建树形结构结果
|
||||
for (RmSwitchManagement switchManagement : list) {
|
||||
switchManagement.setValue(switchManagement.getId());
|
||||
switchManagement.setLabel(switchManagement.getSwitchName());
|
||||
// 该交换机的所有接口信息
|
||||
String clientId = switchManagement.getClientId();
|
||||
String switchName = switchManagement.getSwitchName();
|
||||
AllInterfaceName allInterfaceName = new AllInterfaceName();
|
||||
allInterfaceName.setClientId(clientId);
|
||||
List<AllInterfaceName> interfaceNameList = allInterfaceNameMapper.selectAllInterfaceNameList(allInterfaceName);
|
||||
for (AllInterfaceName interfaceName : interfaceNameList) {
|
||||
String valueStr = String.join(";",
|
||||
interfaceName.getId().toString(),
|
||||
clientId,
|
||||
interfaceName.getInterfaceName(),
|
||||
switchName
|
||||
);
|
||||
interfaceName.setValue(valueStr);
|
||||
interfaceName.setLabel(interfaceName.getInterfaceName());
|
||||
// 查询别名
|
||||
RmSwitchInterfaceInfo query = new RmSwitchInterfaceInfo();
|
||||
query.setInterfaceName(interfaceName.getInterfaceName());
|
||||
query.setClientId(clientId);
|
||||
List<RmSwitchInterfaceInfo> interfaceInfos = rmSwitchInterfaceInfoMapper.selectRmSwitchInterfaceInfoList(query);
|
||||
String otherName = "";
|
||||
if(!interfaceInfos.isEmpty()){
|
||||
otherName = interfaceInfos.get(0).getInterfaceRemark();
|
||||
interfaceName.setOtherName(otherName);
|
||||
}
|
||||
String labelStr = String.join(" ",interfaceName.getInterfaceName(), otherName);
|
||||
interfaceName.setLabel(labelStr);
|
||||
}
|
||||
switchManagement.setChildren(interfaceNameList);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
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.UserTableColumnConfig;
|
||||
import com.ruoyi.system.mapper.UserTableColumnConfigMapper;
|
||||
import com.ruoyi.system.service.IUserTableColumnConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户自定义列配置Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-30
|
||||
*/
|
||||
@Service
|
||||
public class UserTableColumnConfigServiceImpl implements IUserTableColumnConfigService
|
||||
{
|
||||
@Autowired
|
||||
private UserTableColumnConfigMapper userTableColumnConfigMapper;
|
||||
|
||||
/**
|
||||
* 查询用户自定义列配置
|
||||
*
|
||||
* @param id 用户自定义列配置主键
|
||||
* @return 用户自定义列配置
|
||||
*/
|
||||
@Override
|
||||
public UserTableColumnConfig selectUserTableColumnConfigById(Long id)
|
||||
{
|
||||
return userTableColumnConfigMapper.selectUserTableColumnConfigById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户自定义列配置列表
|
||||
*
|
||||
* @param userTableColumnConfig 用户自定义列配置
|
||||
* @return 用户自定义列配置
|
||||
*/
|
||||
@Override
|
||||
public List<UserTableColumnConfig> selectUserTableColumnConfigList(UserTableColumnConfig userTableColumnConfig)
|
||||
{
|
||||
return userTableColumnConfigMapper.selectUserTableColumnConfigList(userTableColumnConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户自定义列配置
|
||||
*
|
||||
* @param userTableColumnConfig 用户自定义列配置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertUserTableColumnConfig(UserTableColumnConfig userTableColumnConfig)
|
||||
{
|
||||
Long userId = userTableColumnConfig.getUserId();
|
||||
if(userId == null){
|
||||
System.err.println("用户不存在");
|
||||
return 0;
|
||||
}
|
||||
if(userTableColumnConfig.getPageRoute() == null){
|
||||
System.err.println("路由不存在");
|
||||
return 0;
|
||||
}
|
||||
userTableColumnConfig.setCreateTime(DateUtils.getNowDate());
|
||||
userTableColumnConfig.setUserId(userId);
|
||||
// 查询该用户是否已存在配置
|
||||
UserTableColumnConfig configQuery = new UserTableColumnConfig();
|
||||
configQuery.setUserId(userId);
|
||||
configQuery.setPageRoute(userTableColumnConfig.getPageRoute());
|
||||
List<UserTableColumnConfig> exits = userTableColumnConfigMapper.selectUserTableColumnConfigList(configQuery);
|
||||
if(exits.isEmpty()){
|
||||
userTableColumnConfigMapper.insertUserTableColumnConfig(userTableColumnConfig);
|
||||
}else{
|
||||
userTableColumnConfigMapper.updateUserTableColumnConfig(userTableColumnConfig);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户自定义列配置
|
||||
*
|
||||
* @param userTableColumnConfig 用户自定义列配置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUserTableColumnConfig(UserTableColumnConfig userTableColumnConfig)
|
||||
{
|
||||
userTableColumnConfig.setUpdateTime(DateUtils.getNowDate());
|
||||
return userTableColumnConfigMapper.updateUserTableColumnConfig(userTableColumnConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户自定义列配置
|
||||
*
|
||||
* @param ids 需要删除的用户自定义列配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUserTableColumnConfigByIds(Long[] ids)
|
||||
{
|
||||
return userTableColumnConfigMapper.deleteUserTableColumnConfigByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户自定义列配置信息
|
||||
*
|
||||
* @param id 用户自定义列配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUserTableColumnConfigById(Long id)
|
||||
{
|
||||
return userTableColumnConfigMapper.deleteUserTableColumnConfigById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserTableColumnConfig getColumnConfigByUserId(UserTableColumnConfig userTableColumnConfig) {
|
||||
UserTableColumnConfig configQuery = new UserTableColumnConfig();
|
||||
configQuery.setUserId(SecurityUtils.getUserId());
|
||||
configQuery.setPageRoute(userTableColumnConfig.getPageRoute());
|
||||
List<UserTableColumnConfig> userTableColumnConfigList = userTableColumnConfigMapper.selectUserTableColumnConfigList(configQuery);
|
||||
if(!userTableColumnConfigList.isEmpty()){
|
||||
return userTableColumnConfigList.get(0);
|
||||
}
|
||||
return new UserTableColumnConfig();
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ public class CalculateUtil {
|
||||
|
||||
// 处理纯数字(单位为空)
|
||||
if (unit.isEmpty()) {
|
||||
unit = "B/S"; // 默认单位: Bytes/s
|
||||
unit = "B/S"; // 默认单位: Bit/s
|
||||
}
|
||||
switch (mode) {
|
||||
case "1000":
|
||||
@@ -41,88 +41,88 @@ public class CalculateUtil {
|
||||
}
|
||||
}
|
||||
// 1000进制换算(最小单位为bit)
|
||||
// private static BigDecimal convertWithDecimalCoefficients(BigDecimal value, String unit) {
|
||||
// switch (unit) {
|
||||
// case "B/S": // bit per second
|
||||
// return value.divide(new BigDecimal("1000000000"), 2, RoundingMode.HALF_UP); // 10^9
|
||||
// case "KB/S": // Kilobit per second
|
||||
// return value.divide(new BigDecimal("1000000"), 2, RoundingMode.HALF_UP); // 10^6
|
||||
// case "MB/S": // Megabit per second
|
||||
// return value.divide(new BigDecimal("1000"), 2, RoundingMode.HALF_UP); // 10^3
|
||||
// case "GB/S": // Gigabit per second
|
||||
// return value.setScale(2, RoundingMode.HALF_UP); // 10^0
|
||||
// case "TB/S": // Terabit per second
|
||||
// return value.multiply(new BigDecimal("1000")) // 10^3
|
||||
// .setScale(2, RoundingMode.HALF_UP);
|
||||
// default:
|
||||
// throw new IllegalArgumentException("Unsupported DECIMAL unit: " + unit);
|
||||
// }
|
||||
// }
|
||||
// // 1024进制换算(最小单位为bit)
|
||||
// private static BigDecimal convertWithBinaryCoefficients(BigDecimal value, String unit) {
|
||||
// BigDecimal base1024 = new BigDecimal(1024);
|
||||
// BigDecimal base1048576 = base1024.multiply(base1024); // 1024^2 = 1048576
|
||||
// BigDecimal base1073741824 = base1048576.multiply(base1024); // 1024^3 = 1073741824
|
||||
//
|
||||
// switch (unit) {
|
||||
// case "B/S": // bit per second
|
||||
// return value.divide(base1073741824, 2, RoundingMode.HALF_UP); // 1024^3
|
||||
// case "KB/S": // Kilobit per second
|
||||
// return value.divide(base1048576, 2, RoundingMode.HALF_UP); // 1024^2
|
||||
// case "MB/S": // Megabit per second
|
||||
// return value.divide(base1024, 2, RoundingMode.HALF_UP); // 1024^1
|
||||
// case "GB/S": // Gigabit per second
|
||||
// return value.setScale(2, RoundingMode.HALF_UP); // 1024^0
|
||||
// case "TB/S": // Terabit per second
|
||||
// return value.multiply(base1024) // 1024^1
|
||||
// .setScale(2, RoundingMode.HALF_UP);
|
||||
// default:
|
||||
// throw new IllegalArgumentException("Unsupported BINARY unit: " + unit);
|
||||
// }
|
||||
// }
|
||||
// 字节1000进制换算
|
||||
private static BigDecimal convertWithDecimalCoefficients(BigDecimal value, String unit) {
|
||||
switch (unit.toUpperCase()) {
|
||||
case "B/S":
|
||||
return value.multiply(new BigDecimal("0.000008")) // 8/1000000
|
||||
.setScale(2, RoundingMode.HALF_UP);
|
||||
case "KB/S":
|
||||
return value.multiply(new BigDecimal("0.008")) // 8/1000
|
||||
.setScale(2, RoundingMode.HALF_UP);
|
||||
case "MB/S":
|
||||
return value.setScale(2, RoundingMode.HALF_UP);
|
||||
case "GB/S":
|
||||
return value.multiply(new BigDecimal("8000")) // 1000 * 8
|
||||
.setScale(2, RoundingMode.HALF_UP);
|
||||
case "TB/S":
|
||||
return value.multiply(new BigDecimal("8000000")) // 1000 * 1000 * 8
|
||||
switch (unit) {
|
||||
case "B/S": // bit per second
|
||||
return value.divide(new BigDecimal("1000000000"), 2, RoundingMode.HALF_UP); // 10^9
|
||||
case "KB/S": // Kilobit per second
|
||||
return value.divide(new BigDecimal("1000000"), 2, RoundingMode.HALF_UP); // 10^6
|
||||
case "MB/S": // Megabit per second
|
||||
return value.divide(new BigDecimal("1000"), 2, RoundingMode.HALF_UP); // 10^3
|
||||
case "GB/S": // Gigabit per second
|
||||
return value.setScale(2, RoundingMode.HALF_UP); // 10^0
|
||||
case "TB/S": // Terabit per second
|
||||
return value.multiply(new BigDecimal("1000")) // 10^3
|
||||
.setScale(2, RoundingMode.HALF_UP);
|
||||
default:
|
||||
throw new IllegalArgumentException("Unsupported DECIMAL unit: " + unit);
|
||||
}
|
||||
}
|
||||
|
||||
// 字节1024进制换算
|
||||
// 1024进制换算(最小单位为bit)
|
||||
private static BigDecimal convertWithBinaryCoefficients(BigDecimal value, String unit) {
|
||||
switch (unit.toUpperCase()) {
|
||||
case "B/S":
|
||||
return value.multiply(new BigDecimal("0.00000762939")) // 8/1048576
|
||||
.setScale(2, RoundingMode.HALF_UP);
|
||||
case "KB/S":
|
||||
return value.multiply(new BigDecimal("0.0078125")) // 8/1024
|
||||
.setScale(2, RoundingMode.HALF_UP);
|
||||
case "MB/S":
|
||||
return value.setScale(2, RoundingMode.HALF_UP);
|
||||
case "GB/S":
|
||||
return value.multiply(new BigDecimal("8192")) // 1024 * 8
|
||||
.setScale(2, RoundingMode.HALF_UP);
|
||||
case "TB/S":
|
||||
return value.multiply(new BigDecimal("8388608")) // 1024 * 1024 * 8
|
||||
BigDecimal base1024 = new BigDecimal(1024);
|
||||
BigDecimal base1048576 = base1024.multiply(base1024); // 1024^2 = 1048576
|
||||
BigDecimal base1073741824 = base1048576.multiply(base1024); // 1024^3 = 1073741824
|
||||
|
||||
switch (unit) {
|
||||
case "B/S": // bit per second
|
||||
return value.divide(base1073741824, 2, RoundingMode.HALF_UP); // 1024^3
|
||||
case "KB/S": // Kilobit per second
|
||||
return value.divide(base1048576, 2, RoundingMode.HALF_UP); // 1024^2
|
||||
case "MB/S": // Megabit per second
|
||||
return value.divide(base1024, 2, RoundingMode.HALF_UP); // 1024^1
|
||||
case "GB/S": // Gigabit per second
|
||||
return value.setScale(2, RoundingMode.HALF_UP); // 1024^0
|
||||
case "TB/S": // Terabit per second
|
||||
return value.multiply(base1024) // 1024^1
|
||||
.setScale(2, RoundingMode.HALF_UP);
|
||||
default:
|
||||
throw new IllegalArgumentException("Unsupported BINARY unit: " + unit);
|
||||
}
|
||||
}
|
||||
// 字节1000进制换算
|
||||
// private static BigDecimal convertWithDecimalCoefficients(BigDecimal value, String unit) {
|
||||
// switch (unit.toUpperCase()) {
|
||||
// case "B/S":
|
||||
// return value.multiply(new BigDecimal("0.000008")) // 8/1000000
|
||||
// .setScale(2, RoundingMode.HALF_UP);
|
||||
// case "KB/S":
|
||||
// return value.multiply(new BigDecimal("0.008")) // 8/1000
|
||||
// .setScale(2, RoundingMode.HALF_UP);
|
||||
// case "MB/S":
|
||||
// return value.setScale(2, RoundingMode.HALF_UP);
|
||||
// case "GB/S":
|
||||
// return value.multiply(new BigDecimal("8000")) // 1000 * 8
|
||||
// .setScale(2, RoundingMode.HALF_UP);
|
||||
// case "TB/S":
|
||||
// return value.multiply(new BigDecimal("8000000")) // 1000 * 1000 * 8
|
||||
// .setScale(2, RoundingMode.HALF_UP);
|
||||
// default:
|
||||
// throw new IllegalArgumentException("Unsupported DECIMAL unit: " + unit);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 字节1024进制换算
|
||||
// private static BigDecimal convertWithBinaryCoefficients(BigDecimal value, String unit) {
|
||||
// switch (unit.toUpperCase()) {
|
||||
// case "B/S":
|
||||
// return value.multiply(new BigDecimal("0.00000762939")) // 8/1048576
|
||||
// .setScale(2, RoundingMode.HALF_UP);
|
||||
// case "KB/S":
|
||||
// return value.multiply(new BigDecimal("0.0078125")) // 8/1024
|
||||
// .setScale(2, RoundingMode.HALF_UP);
|
||||
// case "MB/S":
|
||||
// return value.setScale(2, RoundingMode.HALF_UP);
|
||||
// case "GB/S":
|
||||
// return value.multiply(new BigDecimal("8192")) // 1024 * 8
|
||||
// .setScale(2, RoundingMode.HALF_UP);
|
||||
// case "TB/S":
|
||||
// return value.multiply(new BigDecimal("8388608")) // 1024 * 1024 * 8
|
||||
// .setScale(2, RoundingMode.HALF_UP);
|
||||
// default:
|
||||
// throw new IllegalArgumentException("Unsupported BINARY unit: " + unit);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 计算百分位值
|
||||
@@ -134,6 +134,19 @@ public class CalculateUtil {
|
||||
return sortedValues.get(position).setScale(2, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算95值位置 从大到小
|
||||
* @param sortedValues
|
||||
* @param percentile
|
||||
* @return
|
||||
*/
|
||||
public static int calculate95Index(List<?> sortedValues, double percentile) {
|
||||
int total = sortedValues.size();
|
||||
int position = (int) Math.ceil(percentile * total) - 1;
|
||||
position = Math.max(0, Math.min(position, total - 1));
|
||||
return position;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据带宽类型设置时间范围(修复T分隔符问题)
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
//package com.ruoyi.system.util;
|
||||
//
|
||||
//import org.springframework.http.HttpEntity;
|
||||
//import org.springframework.http.HttpHeaders;
|
||||
//import org.springframework.http.HttpMethod;
|
||||
//import org.springframework.http.ResponseEntity;
|
||||
//import org.springframework.web.client.RestTemplate;
|
||||
//import org.springframework.web.util.UriComponentsBuilder;
|
||||
//
|
||||
//import javax.crypto.Mac;
|
||||
//import javax.crypto.SecretKey;
|
||||
//import javax.crypto.spec.SecretKeySpec;
|
||||
//import java.net.URI;
|
||||
//import java.time.LocalDateTime;
|
||||
//import java.time.format.DateTimeFormatter;
|
||||
//
|
||||
//public class HmacUtils {
|
||||
// private static final String MAC_NAME = "HmacSHA1";
|
||||
// private static final String ENCODING = "UTF-8";
|
||||
// /**
|
||||
// *@param encryptKey 秘钥由中控系统分配
|
||||
// *@param plainText 加密内容:token + 时间戳 + URI
|
||||
// */
|
||||
// public static String getHmac(String plainText,String encryptKey) {
|
||||
// try{
|
||||
// byte[] dataKey=encryptKey.getBytes(ENCODING);
|
||||
// byte[] dataValue=plainText.getBytes(ENCODING);
|
||||
// //根据给定的字节数组构造一个密钥,第二参数指定一个密钥算法的名称
|
||||
// SecretKey secretKey = new SecretKeySpec(dataKey, MAC_NAME);
|
||||
// // 2、创建MAC对象
|
||||
// Mac mac = Mac.getInstance(MAC_NAME);
|
||||
// // 3、设置密钥
|
||||
// mac.init(secretKey);
|
||||
// // 4、数据加密
|
||||
// byte[] bytes = mac.doFinal(dataValue);
|
||||
// // 5、生成数据
|
||||
// String rs = encodeHex(bytes,false);
|
||||
// return rs;
|
||||
// }catch (Exception e){
|
||||
// throw new IllegalArgumentException(e.getMessage());
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// // 数据转16进制编码
|
||||
// public static String encodeHex(final byte[] data, final boolean toLowerCase) {
|
||||
// final char[] DIGITS_LOWER = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
|
||||
// final char[] DIGITS_UPPER = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
|
||||
// final char[] toDigits = toLowerCase ? DIGITS_LOWER : DIGITS_UPPER;
|
||||
// final int l = data.length;
|
||||
// final char[] out = new char[l << 1];
|
||||
// // two characters form the hex value.
|
||||
// for (int i = 0, j = 0; i < l; i++) {
|
||||
// out[j++] = toDigits[(0xF0 & data[i]) >>> 4];
|
||||
// out[j++] = toDigits[0x0F & data[i]];
|
||||
// }
|
||||
// return new String(out);
|
||||
// }
|
||||
// public static void main(String[] args) {
|
||||
// RestTemplate restTemplate = new RestTemplate();
|
||||
// try {
|
||||
// System.out.println("开始执行定时任务,时间:" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
//
|
||||
// // 计算时间范围:当前时间往前推3小时的整点时间段
|
||||
// LocalDateTime now = LocalDateTime.now();
|
||||
//
|
||||
// // 计算查询的时间段(4小时前的整点小时)
|
||||
// LocalDateTime queryBaseTime = now.minusHours(4);
|
||||
// LocalDateTime startTime = queryBaseTime.withMinute(0).withSecond(0).withNano(0);
|
||||
// LocalDateTime endTime = startTime.plusHours(1);
|
||||
//
|
||||
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
// String startTimeStr = startTime.format(formatter);
|
||||
// String endTimeStr = endTime.format(formatter);
|
||||
//
|
||||
// System.out.println("查询时间范围:" + startTimeStr + " 至 " + endTimeStr);
|
||||
//
|
||||
// long timestamp = System.currentTimeMillis();
|
||||
// String plainText = "efea5f0218c84a24b9fdab3264de3da5" + timestamp + "/supplier/outer/dev/getFlow";
|
||||
// String secretKey = getHmac(plainText, "91a73fd806ab2c005c13b4dc19130a884e909dea3f72d46e30266fe1a1f588d8");
|
||||
//
|
||||
// // 设置请求头
|
||||
// HttpHeaders headers = new HttpHeaders();
|
||||
// headers.set("Content-Type", "application/json");
|
||||
// headers.set("TOKEN", "efea5f0218c84a24b9fdab3264de3da5");
|
||||
// headers.set("secret-key", secretKey);
|
||||
// headers.set("timestamps", String.valueOf(timestamp));
|
||||
//
|
||||
// // 构建URL
|
||||
// URI uri = UriComponentsBuilder
|
||||
// .fromHttpUrl("https://ecscm-openapi.ksyun.com/supplier/outer/dev/getFlow")
|
||||
// .queryParam("srmChannel", "1000121954")
|
||||
// .queryParam("startTime", startTimeStr)
|
||||
// .queryParam("endTime", endTimeStr)
|
||||
// .build()
|
||||
// .toUri();
|
||||
//
|
||||
// HttpEntity<String> entity = new HttpEntity<>(headers);
|
||||
//
|
||||
// // GET 请求
|
||||
// ResponseEntity<String> response = restTemplate.exchange(
|
||||
// uri,
|
||||
// HttpMethod.GET,
|
||||
// entity,
|
||||
// String.class
|
||||
// );
|
||||
//
|
||||
// System.out.println("secretKey:" + secretKey);
|
||||
// System.out.println("API响应结果:" + response.getBody());
|
||||
// System.out.println("定时任务执行完成");
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// System.err.println("定时任务执行失败:" + e.getMessage());
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.ruoyi.system.util;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class PaginationUtil {
|
||||
|
||||
/**
|
||||
* 通用分页方法
|
||||
*/
|
||||
public static <T> PageInfo<T> paginate(List<T> dataList, int pageNum, int pageSize) {
|
||||
if (dataList == null) {
|
||||
dataList = new ArrayList<>();
|
||||
}
|
||||
|
||||
int total = dataList.size();
|
||||
|
||||
// 计算分页参数
|
||||
int totalPages = calculateTotalPages(total, pageSize);
|
||||
pageNum = validatePageNum(pageNum, totalPages);
|
||||
|
||||
// 分页数据
|
||||
List<T> pageData = getPageData(dataList, pageNum, pageSize);
|
||||
|
||||
return buildPageInfo(pageData, pageNum, pageSize, total, totalPages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 带排序的分页
|
||||
*/
|
||||
public static <T> PageInfo<T> paginateWithSort(
|
||||
List<T> dataList,
|
||||
int pageNum,
|
||||
int pageSize,
|
||||
Comparator<T> comparator) {
|
||||
|
||||
if (dataList == null) {
|
||||
dataList = new ArrayList<>();
|
||||
}
|
||||
|
||||
// 先排序
|
||||
List<T> sortedList = dataList.stream()
|
||||
.sorted(comparator)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return paginate(sortedList, pageNum, pageSize);
|
||||
}
|
||||
|
||||
private static int calculateTotalPages(int total, int pageSize) {
|
||||
if (pageSize <= 0) {
|
||||
return 0;
|
||||
}
|
||||
return (int) Math.ceil((double) total / pageSize);
|
||||
}
|
||||
|
||||
private static int validatePageNum(int pageNum, int totalPages) {
|
||||
if (pageNum < 1) {
|
||||
return 1;
|
||||
}
|
||||
if (totalPages > 0 && pageNum > totalPages) {
|
||||
return totalPages;
|
||||
}
|
||||
return pageNum;
|
||||
}
|
||||
|
||||
private static <T> List<T> getPageData(List<T> dataList, int pageNum, int pageSize) {
|
||||
int fromIndex = (pageNum - 1) * pageSize;
|
||||
if (fromIndex >= dataList.size()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
int toIndex = Math.min(fromIndex + pageSize, dataList.size());
|
||||
return dataList.subList(fromIndex, toIndex);
|
||||
}
|
||||
|
||||
private static <T> PageInfo<T> buildPageInfo(List<T> data, int pageNum, int pageSize,
|
||||
int total, int totalPages) {
|
||||
PageInfo<T> pageInfo = new PageInfo<>();
|
||||
pageInfo.setList(data);
|
||||
pageInfo.setPageNum(pageNum);
|
||||
pageInfo.setPageSize(pageSize);
|
||||
pageInfo.setTotal((long) total);
|
||||
pageInfo.setPages(totalPages);
|
||||
pageInfo.setHasNextPage(pageNum < totalPages);
|
||||
pageInfo.setHasPreviousPage(pageNum > 1);
|
||||
pageInfo.setIsFirstPage(pageNum == 1);
|
||||
pageInfo.setIsLastPage(pageNum == totalPages || totalPages == 0);
|
||||
|
||||
return pageInfo;
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public class TableRouterUtil {
|
||||
return tableNames;
|
||||
}
|
||||
// 解析字符串为LocalDateTime
|
||||
private static LocalDateTime parseDateTime(String dateTimeStr) {
|
||||
public static LocalDateTime parseDateTime(String dateTimeStr) {
|
||||
if (dateTimeStr == null || dateTimeStr.trim().isEmpty()) {
|
||||
throw new IllegalArgumentException("时间字符串不能为空");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,390 @@
|
||||
package com.ruoyi.system.util;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@Component
|
||||
@SuppressWarnings("unchecked")
|
||||
public class TrafficRedisHashUtil {
|
||||
private static final String TRAFFIC_DATA_HASH_KEY = "eps:traffic:hash";
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate<Object, Object> redisTemplate;
|
||||
|
||||
/**
|
||||
* 使用Hash结构存储,每个taskId对应一个列表(支持泛型)
|
||||
*/
|
||||
public <T> void saveListToHash(String taskId, List<T> dataList) {
|
||||
if (dataList == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String hashKey = generateHashKey(taskId);
|
||||
redisTemplate.opsForHash().put(TRAFFIC_DATA_HASH_KEY, hashKey, dataList);
|
||||
|
||||
// 可选:设置过期时间
|
||||
// redisTemplate.expire(TRAFFIC_DATA_HASH_KEY, 1, TimeUnit.HOURS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从Hash获取数据(支持泛型)
|
||||
*/
|
||||
public <T> List<T> getListFromHash(String taskId, Class<T> clazz) {
|
||||
String hashKey = generateHashKey(taskId);
|
||||
Object result = redisTemplate.opsForHash().get(TRAFFIC_DATA_HASH_KEY, hashKey);
|
||||
|
||||
if (result instanceof List) {
|
||||
return (List<T>) result;
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 从Hash获取数据(不指定类型,返回原始List)
|
||||
*/
|
||||
public List<?> getListFromHash(String taskId) {
|
||||
String hashKey = generateHashKey(taskId);
|
||||
Object result = redisTemplate.opsForHash().get(TRAFFIC_DATA_HASH_KEY, hashKey);
|
||||
|
||||
if (result instanceof List) {
|
||||
return (List<?>) result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新Hash中的特定项(通过createTime匹配)
|
||||
*/
|
||||
public <T> void updateItemInHash(String taskId, T updatedItem, String createTime) {
|
||||
List<T> dataList = (List<T>) getListFromHash(taskId);
|
||||
|
||||
if (dataList != null) {
|
||||
for (int i = 0; i < dataList.size(); i++) {
|
||||
T item = dataList.get(i);
|
||||
String itemCreateTime = getCreateTimeFromObject(item);
|
||||
if (itemCreateTime != null && itemCreateTime.equals(createTime)) {
|
||||
dataList.set(i, updatedItem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
saveListToHash(taskId, dataList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新Hash中的特定项(使用自定义匹配器)
|
||||
*/
|
||||
public <T> void updateItemInHash(String taskId, T updatedItem, Predicate<T> matcher) {
|
||||
List<T> dataList = (List<T>) getListFromHash(taskId);
|
||||
|
||||
if (dataList != null) {
|
||||
for (int i = 0; i < dataList.size(); i++) {
|
||||
if (matcher.test(dataList.get(i))) {
|
||||
dataList.set(i, updatedItem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
saveListToHash(taskId, dataList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加新数据项到指定taskId的列表
|
||||
*/
|
||||
public <T> void addItemToHash(String taskId, T newItem) {
|
||||
List<T> dataList = (List<T>) getListFromHash(taskId);
|
||||
|
||||
if (dataList == null) {
|
||||
dataList = new ArrayList<>();
|
||||
}
|
||||
dataList.add(newItem);
|
||||
saveListToHash(taskId, dataList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从指定taskId的列表中删除数据项(通过createTime匹配)
|
||||
*/
|
||||
public <T> void deleteItemFromHash(String taskId, Object createTime) {
|
||||
List<T> dataList = (List<T>) getListFromHash(taskId);
|
||||
|
||||
if (dataList != null) {
|
||||
dataList.removeIf(item -> {
|
||||
Object itemCreateTime = getCreateTimeFromObject(item);
|
||||
return itemCreateTime != null && itemCreateTime.equals(createTime);
|
||||
});
|
||||
saveListToHash(taskId, dataList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从指定taskId的列表中删除数据项(使用自定义匹配器)
|
||||
*/
|
||||
public <T> void deleteItemFromHash(String taskId, Predicate<T> matcher) {
|
||||
List<T> dataList = (List<T>) getListFromHash(taskId);
|
||||
|
||||
if (dataList != null) {
|
||||
dataList.removeIf(matcher);
|
||||
saveListToHash(taskId, dataList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据createTime范围删除数据项
|
||||
*/
|
||||
public <T> void deleteItemsByCreateTimeRange(String taskId, Object startTime, Object endTime) {
|
||||
List<T> dataList = (List<T>) getListFromHash(taskId);
|
||||
|
||||
if (dataList != null) {
|
||||
dataList.removeIf(item -> {
|
||||
Object itemCreateTime = getCreateTimeFromObject(item);
|
||||
if (itemCreateTime == null) return false;
|
||||
|
||||
// 假设createTime是可比较的类型(如Date、Long、LocalDateTime等)
|
||||
if (itemCreateTime instanceof Comparable) {
|
||||
Comparable<Object> time = (Comparable<Object>) itemCreateTime;
|
||||
return time.compareTo(startTime) >= 0 && time.compareTo(endTime) <= 0;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
saveListToHash(taskId, dataList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据createTime查找数据项
|
||||
*/
|
||||
public <T> T findItemByCreateTime(String taskId, Object createTime) {
|
||||
List<T> dataList = (List<T>) getListFromHash(taskId);
|
||||
|
||||
if (dataList != null) {
|
||||
for (T item : dataList) {
|
||||
Object itemCreateTime = getCreateTimeFromObject(item);
|
||||
if (itemCreateTime != null && itemCreateTime.equals(createTime)) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据createTime范围查找数据项
|
||||
*/
|
||||
public <T> List<T> findItemsByCreateTimeRange(String taskId, Object startTime, Object endTime) {
|
||||
List<T> dataList = (List<T>) getListFromHash(taskId);
|
||||
List<T> result = new ArrayList<>();
|
||||
|
||||
if (dataList != null) {
|
||||
for (T item : dataList) {
|
||||
Object itemCreateTime = getCreateTimeFromObject(item);
|
||||
if (itemCreateTime != null && itemCreateTime instanceof Comparable) {
|
||||
Comparable<Object> time = (Comparable<Object>) itemCreateTime;
|
||||
if (time.compareTo(startTime) >= 0 && time.compareTo(endTime) <= 0) {
|
||||
result.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最早的createTime数据项
|
||||
*/
|
||||
public <T> T getEarliestItem(String taskId) {
|
||||
List<T> dataList = (List<T>) getListFromHash(taskId);
|
||||
|
||||
if (dataList == null || dataList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
T earliestItem = dataList.get(0);
|
||||
Object earliestTime = getCreateTimeFromObject(earliestItem);
|
||||
|
||||
for (int i = 1; i < dataList.size(); i++) {
|
||||
T currentItem = dataList.get(i);
|
||||
Object currentTime = getCreateTimeFromObject(currentItem);
|
||||
|
||||
if (currentTime instanceof Comparable && earliestTime instanceof Comparable) {
|
||||
Comparable<Object> currentComparable = (Comparable<Object>) currentTime;
|
||||
Comparable<Object> earliestComparable = (Comparable<Object>) earliestTime;
|
||||
|
||||
if (currentComparable.compareTo(earliestComparable) < 0) {
|
||||
earliestItem = currentItem;
|
||||
earliestTime = currentTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
return earliestItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最晚的createTime数据项
|
||||
*/
|
||||
public <T> T getLatestItem(String taskId) {
|
||||
List<T> dataList = (List<T>) getListFromHash(taskId);
|
||||
|
||||
if (dataList == null || dataList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
T latestItem = dataList.get(0);
|
||||
Object latestTime = getCreateTimeFromObject(latestItem);
|
||||
|
||||
for (int i = 1; i < dataList.size(); i++) {
|
||||
T currentItem = dataList.get(i);
|
||||
Object currentTime = getCreateTimeFromObject(currentItem);
|
||||
|
||||
if (currentTime instanceof Comparable && latestTime instanceof Comparable) {
|
||||
Comparable<Object> currentComparable = (Comparable<Object>) currentTime;
|
||||
Comparable<Object> latestComparable = (Comparable<Object>) latestTime;
|
||||
|
||||
if (currentComparable.compareTo(latestComparable) > 0) {
|
||||
latestItem = currentItem;
|
||||
latestTime = currentTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
return latestItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除整个taskId对应的缓存
|
||||
*/
|
||||
public void deleteTaskData(String taskId) {
|
||||
String hashKey = generateHashKey(taskId);
|
||||
redisTemplate.opsForHash().delete(TRAFFIC_DATA_HASH_KEY, hashKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查taskId是否存在缓存
|
||||
*/
|
||||
public boolean hasTaskData(String taskId) {
|
||||
String hashKey = generateHashKey(taskId);
|
||||
return redisTemplate.opsForHash().hasKey(TRAFFIC_DATA_HASH_KEY, hashKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有已缓存的taskId列表
|
||||
*/
|
||||
public Set<Object> getAllCachedTaskIds() {
|
||||
return redisTemplate.opsForHash().keys(TRAFFIC_DATA_HASH_KEY);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置整个Hash的过期时间
|
||||
*/
|
||||
public void setExpire(long timeout, TimeUnit unit) {
|
||||
redisTemplate.expire(TRAFFIC_DATA_HASH_KEY, timeout, unit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Hash中所有数据的总数
|
||||
*/
|
||||
public long getTotalSize() {
|
||||
return redisTemplate.opsForHash().size(TRAFFIC_DATA_HASH_KEY);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从对象中提取createTime字段值(支持继承链查找),并转换为字符串格式
|
||||
*/
|
||||
public <T> String getCreateTimeFromObject(T item) {
|
||||
if (item == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
System.out.println("开始查找createTime字段,对象类型: " + item.getClass().getName());
|
||||
|
||||
// 在类的继承链中查找createTime字段
|
||||
Class<?> clazz = item.getClass();
|
||||
while (clazz != null && clazz != Object.class) {
|
||||
try {
|
||||
System.out.println("在当前类中查找: " + clazz.getName());
|
||||
java.lang.reflect.Field createTimeField = clazz.getDeclaredField("createTime");
|
||||
createTimeField.setAccessible(true);
|
||||
Object value = createTimeField.get(item);
|
||||
|
||||
if (value != null) {
|
||||
System.out.println("成功在 " + clazz.getName() + " 中找到createTime字段,值: " + value + ", 类型: " + value.getClass().getName());
|
||||
|
||||
// 将Date类型转换为字符串
|
||||
return convertDateToString(value);
|
||||
}
|
||||
return null;
|
||||
|
||||
} catch (NoSuchFieldException e) {
|
||||
// 当前类没有该字段,继续在父类中查找
|
||||
System.out.println(clazz.getName() + " 中没有createTime字段,继续查找父类");
|
||||
clazz = clazz.getSuperclass();
|
||||
} catch (Exception e) {
|
||||
System.out.println("获取字段值时发生异常: " + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("在整个继承链中都未找到createTime字段");
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Date对象转换为 yyyy-MM-dd HH:mm:ss 格式的字符串
|
||||
*/
|
||||
private String convertDateToString(Object dateObj) {
|
||||
if (dateObj == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
// 如果是java.util.Date类型
|
||||
if (dateObj instanceof java.util.Date) {
|
||||
java.util.Date date = (java.util.Date) dateObj;
|
||||
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return sdf.format(date);
|
||||
}
|
||||
// 如果是java.sql.Date类型
|
||||
else if (dateObj instanceof java.sql.Date) {
|
||||
java.sql.Date sqlDate = (java.sql.Date) dateObj;
|
||||
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return sdf.format(new java.util.Date(sqlDate.getTime()));
|
||||
}
|
||||
// 如果是java.sql.Timestamp类型
|
||||
else if (dateObj instanceof java.sql.Timestamp) {
|
||||
java.sql.Timestamp timestamp = (java.sql.Timestamp) dateObj;
|
||||
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return sdf.format(new java.util.Date(timestamp.getTime()));
|
||||
}
|
||||
// 如果是LocalDateTime类型(Java 8+)
|
||||
else if (dateObj instanceof java.time.LocalDateTime) {
|
||||
java.time.LocalDateTime localDateTime = (java.time.LocalDateTime) dateObj;
|
||||
return localDateTime.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
// 如果是LocalDate类型(Java 8+)
|
||||
else if (dateObj instanceof java.time.LocalDate) {
|
||||
java.time.LocalDate localDate = (java.time.LocalDate) dateObj;
|
||||
return localDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd")) + " 00:00:00";
|
||||
}
|
||||
// 如果是字符串类型,直接返回
|
||||
else if (dateObj instanceof String) {
|
||||
return (String) dateObj;
|
||||
}
|
||||
// 其他类型,尝试转换为字符串
|
||||
else {
|
||||
return dateObj.toString();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("日期转换异常: " + e.getMessage());
|
||||
return dateObj.toString(); // 转换失败时返回原始字符串
|
||||
}
|
||||
}
|
||||
|
||||
private String generateHashKey(String taskId) {
|
||||
return "task:" + taskId;
|
||||
}
|
||||
}
|
||||
@@ -196,29 +196,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 检查接口名称是否存在 -->
|
||||
<select id="getAllDeviceSn" parameterType="AllInterfaceName" resultType="AllInterfaceName">
|
||||
SELECT
|
||||
device_sn AS deviceSn
|
||||
client_id AS clientId
|
||||
FROM
|
||||
all_interface_name
|
||||
<where>
|
||||
and resource_type = '1' and device_sn != ''
|
||||
and resource_type = '1' and client_id != ''
|
||||
</where>
|
||||
group by device_sn
|
||||
group by client_id
|
||||
</select>
|
||||
<!-- 检查交换机接口名称是否存在 -->
|
||||
<select id="getAllSwitchSn" parameterType="AllInterfaceName" resultType="AllInterfaceName">
|
||||
SELECT
|
||||
switch_sn AS switchSn, switch_ip switchIp
|
||||
client_id AS clientId, switch_ip switchIp
|
||||
FROM
|
||||
all_interface_name
|
||||
<where>
|
||||
and resource_type = '2' and switch_sn != ''
|
||||
and resource_type = '2' and client_id != ''
|
||||
</where>
|
||||
group by switch_sn
|
||||
group by client_id
|
||||
</select>
|
||||
<!-- MyBatis Mapper XML配置 -->
|
||||
<update id="batchUpdate" parameterType="java.util.List">
|
||||
<foreach collection="list" item="item" index="index" open="" separator=";" close="">
|
||||
UPDATE all_interface_name
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
<?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.EpsBusinessDeployMapper">
|
||||
|
||||
<resultMap type="EpsBusinessDeploy" id="EpsBusinessDeployResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="taskName" column="task_name" />
|
||||
<result property="businessCode" column="business_code" />
|
||||
<result property="businessName" column="business_name" />
|
||||
<result property="scriptName" column="script_name" />
|
||||
<result property="scriptPath" column="script_path" />
|
||||
<result property="scriptParams" column="script_params" />
|
||||
<result property="deployDevice" column="deploy_device" />
|
||||
<result property="submitBy" column="submit_by" />
|
||||
<result property="reviewBy" column="review_by" />
|
||||
<result property="reviewStatus" column="review_status" />
|
||||
<result property="reviewTime" column="review_time" />
|
||||
<result property="reviewComment" column="review_comment" />
|
||||
<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="selectEpsBusinessDeployVo">
|
||||
select id, task_name, business_code, business_name, script_name, script_path, script_params, deploy_device, submit_by, review_by, review_status, review_time, review_comment, create_time, update_time, create_by, update_by from eps_business_deploy
|
||||
</sql>
|
||||
|
||||
<select id="selectEpsBusinessDeployList" parameterType="EpsBusinessDeploy" resultMap="EpsBusinessDeployResult">
|
||||
<include refid="selectEpsBusinessDeployVo"/>
|
||||
<where>
|
||||
<if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
|
||||
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
|
||||
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
|
||||
<if test="scriptName != null and scriptName != ''"> and script_name like concat('%', #{scriptName}, '%')</if>
|
||||
<if test="scriptPath != null and scriptPath != ''"> and script_path = #{scriptPath}</if>
|
||||
<if test="scriptParams != null and scriptParams != ''"> and script_params = #{scriptParams}</if>
|
||||
<if test="deployDevice != null and deployDevice != ''"> and deploy_device = #{deployDevice}</if>
|
||||
<if test="submitBy != null and submitBy != ''"> and submit_by = #{submitBy}</if>
|
||||
<if test="reviewBy != null and reviewBy != ''"> and review_by = #{reviewBy}</if>
|
||||
<if test="reviewStatus != null and reviewStatus != ''"> and review_status = #{reviewStatus}</if>
|
||||
<if test="reviewTime != null "> and review_time = #{reviewTime}</if>
|
||||
<if test="reviewComment != null and reviewComment != ''"> and review_comment = #{reviewComment}</if>
|
||||
<if test="clientId != null and clientId != ''">
|
||||
and FIND_IN_SET(#{clientId}, REPLACE(deploy_device, '\n', ',')) > 0
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectEpsBusinessDeployById" parameterType="Long" resultMap="EpsBusinessDeployResult">
|
||||
<include refid="selectEpsBusinessDeployVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertEpsBusinessDeploy" parameterType="EpsBusinessDeploy" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into eps_business_deploy
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="taskName != null">task_name,</if>
|
||||
<if test="businessCode != null">business_code,</if>
|
||||
<if test="businessName != null">business_name,</if>
|
||||
<if test="scriptName != null">script_name,</if>
|
||||
<if test="scriptPath != null">script_path,</if>
|
||||
<if test="scriptParams != null">script_params,</if>
|
||||
<if test="deployDevice != null">deploy_device,</if>
|
||||
<if test="submitBy != null">submit_by,</if>
|
||||
<if test="reviewBy != null">review_by,</if>
|
||||
<if test="reviewStatus != null">review_status,</if>
|
||||
<if test="reviewTime != null">review_time,</if>
|
||||
<if test="reviewComment != null">review_comment,</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="taskName != null">#{taskName},</if>
|
||||
<if test="businessCode != null">#{businessCode},</if>
|
||||
<if test="businessName != null">#{businessName},</if>
|
||||
<if test="scriptName != null">#{scriptName},</if>
|
||||
<if test="scriptPath != null">#{scriptPath},</if>
|
||||
<if test="scriptParams != null">#{scriptParams},</if>
|
||||
<if test="deployDevice != null">#{deployDevice},</if>
|
||||
<if test="submitBy != null">#{submitBy},</if>
|
||||
<if test="reviewBy != null">#{reviewBy},</if>
|
||||
<if test="reviewStatus != null">#{reviewStatus},</if>
|
||||
<if test="reviewTime != null">#{reviewTime},</if>
|
||||
<if test="reviewComment != null">#{reviewComment},</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="updateEpsBusinessDeploy" parameterType="EpsBusinessDeploy">
|
||||
update eps_business_deploy
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="taskName != null">task_name = #{taskName},</if>
|
||||
<if test="businessCode != null">business_code = #{businessCode},</if>
|
||||
<if test="businessName != null">business_name = #{businessName},</if>
|
||||
<if test="scriptName != null">script_name = #{scriptName},</if>
|
||||
<if test="scriptPath != null">script_path = #{scriptPath},</if>
|
||||
<if test="scriptParams != null">script_params = #{scriptParams},</if>
|
||||
<if test="deployDevice != null">deploy_device = #{deployDevice},</if>
|
||||
<if test="submitBy != null">submit_by = #{submitBy},</if>
|
||||
<if test="reviewBy != null">review_by = #{reviewBy},</if>
|
||||
<if test="reviewStatus != null">review_status = #{reviewStatus},</if>
|
||||
<if test="reviewTime != null">review_time = #{reviewTime},</if>
|
||||
<if test="reviewComment != null">review_comment = #{reviewComment},</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="deleteEpsBusinessDeployById" parameterType="Long">
|
||||
delete from eps_business_deploy where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEpsBusinessDeployByIds" parameterType="String">
|
||||
delete from eps_business_deploy where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,82 @@
|
||||
<?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.EpsBusinessScriptMapper">
|
||||
|
||||
<resultMap type="EpsBusinessScript" id="EpsBusinessScriptResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="scriptName" column="script_name" />
|
||||
<result property="scriptPath" column="script_path" />
|
||||
<result property="defaultParams" column="default_params" />
|
||||
<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="selectEpsBusinessScriptVo">
|
||||
select id, script_name, script_path, default_params, create_time, update_time, create_by, update_by from eps_business_script
|
||||
</sql>
|
||||
|
||||
<select id="selectEpsBusinessScriptList" parameterType="EpsBusinessScript" resultMap="EpsBusinessScriptResult">
|
||||
<include refid="selectEpsBusinessScriptVo"/>
|
||||
<where>
|
||||
<if test="scriptName != null and scriptName != ''"> and script_name like concat('%', #{scriptName}, '%')</if>
|
||||
<if test="scriptPath != null and scriptPath != ''"> and script_path = #{scriptPath}</if>
|
||||
<if test="defaultParams != null and defaultParams != ''"> and default_params = #{defaultParams}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectEpsBusinessScriptById" parameterType="Long" resultMap="EpsBusinessScriptResult">
|
||||
<include refid="selectEpsBusinessScriptVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertEpsBusinessScript" parameterType="EpsBusinessScript" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into eps_business_script
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="scriptName != null">script_name,</if>
|
||||
<if test="scriptPath != null">script_path,</if>
|
||||
<if test="defaultParams != null">default_params,</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="scriptName != null">#{scriptName},</if>
|
||||
<if test="scriptPath != null">#{scriptPath},</if>
|
||||
<if test="defaultParams != null">#{defaultParams},</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="updateEpsBusinessScript" parameterType="EpsBusinessScript">
|
||||
update eps_business_script
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="scriptName != null">script_name = #{scriptName},</if>
|
||||
<if test="scriptPath != null">script_path = #{scriptPath},</if>
|
||||
default_params = #{defaultParams},
|
||||
<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="deleteEpsBusinessScriptById" parameterType="Long">
|
||||
delete from eps_business_script where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEpsBusinessScriptByIds" parameterType="String">
|
||||
delete from eps_business_script where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -14,8 +14,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
ipV4 VARCHAR(20) COMMENT 'IPv4地址',
|
||||
`in_dropped` DECIMAL(20,2) COMMENT '入站丢包率(%)',
|
||||
`out_dropped` DECIMAL(20,2) COMMENT '出站丢包率(%)',
|
||||
`in_speed` varchar(50) COMMENT '接收带宽(Mbps)',
|
||||
`out_speed` varchar(50) COMMENT '发送带宽(Mbps)',
|
||||
`in_speed` varchar(50) COMMENT '接收带宽(bit)',
|
||||
`out_speed` varchar(50) COMMENT '发送带宽(bit)',
|
||||
`machine_flow` varchar(50) COMMENT '金山带宽(bit)',
|
||||
`speed` varchar(100) COMMENT '协商速度',
|
||||
`duplex` varchar(100) COMMENT '工作模式',
|
||||
business_id varchar(50) COMMENT '业务代码',
|
||||
@@ -174,8 +175,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
`ipV4` AS ipV4,
|
||||
`in_dropped` AS inDropped,
|
||||
`out_dropped` AS outDropped,
|
||||
`in_speed` AS inSpeed,
|
||||
`out_speed` AS outSpeed,
|
||||
sum(ifnull(`in_speed`,0)) AS inSpeed,
|
||||
sum(ifnull(`out_speed`,0)) AS outSpeed,
|
||||
`machine_flow` AS machineFlow,
|
||||
`speed` AS speed,
|
||||
`duplex` AS duplex,
|
||||
business_id AS businessId,
|
||||
@@ -197,6 +199,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="businessId != '' and businessId != null">
|
||||
and business_id = #{businessId}
|
||||
</if>
|
||||
<if test="clientId != '' and clientId != null">
|
||||
and client_id = #{clientId}
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
and create_time >= #{startTime}
|
||||
</if>
|
||||
@@ -208,7 +213,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
|
||||
</where>
|
||||
ORDER BY create_time desc
|
||||
group BY create_time desc
|
||||
</select>
|
||||
|
||||
<!-- 条件查询 -->
|
||||
@@ -243,4 +248,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</where>
|
||||
ORDER BY create_time desc
|
||||
</select>
|
||||
<update id="updateMachineTraffic" parameterType="EpsInitialTrafficData">
|
||||
update ${tableName} set machine_flow=#{machineFlow} where client_id=#{clientId} and create_time=#{createTime}
|
||||
</update>
|
||||
|
||||
<select id="getTrafficListByClientIds" resultType="EpsInitialTrafficData">
|
||||
SELECT
|
||||
sum(ifnull(out_speed,0)) AS outSpeed,
|
||||
create_time AS createTime
|
||||
FROM ${tableName}
|
||||
<where>
|
||||
<if test="businessId != '' and businessId != null">
|
||||
and business_id = #{businessId}
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
and create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and create_time <= #{endTime}
|
||||
</if>
|
||||
<if test="clientIds != '' and clientIds != null">
|
||||
and client_id in
|
||||
<foreach collection="clientIds.split(',')" item="clientId" open="(" separator="," close=")">
|
||||
#{clientId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
group by create_time
|
||||
ORDER BY out_speed desc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -18,10 +18,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="packageBandwidth" column="package_bandwidth" />
|
||||
<result property="businessName" column="business_name" />
|
||||
<result property="businessCode" column="business_code" />
|
||||
<result property="clientId" column="client_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEpsMethodChangeRecordVo">
|
||||
select id, node_name, change_content, hardware_sn, create_time, creat_by, update_time, update_by, revenue_method, traffic_port, package_bandwidth, business_name, business_code from eps_method_change_record
|
||||
select id, node_name, change_content, hardware_sn, create_time, creat_by, update_time, update_by, revenue_method, traffic_port, package_bandwidth, business_name, business_code, client_id from eps_method_change_record
|
||||
</sql>
|
||||
|
||||
<select id="selectEpsMethodChangeRecordList" parameterType="EpsMethodChangeRecord" resultMap="EpsMethodChangeRecordResult">
|
||||
@@ -36,6 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<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>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
<if test="startTime != null and startTime != ''"> and create_time >= #{startTime}</if>
|
||||
<if test="endTime != null and endTime != ''"> and create_time <= #{endTime}</if>
|
||||
</where>
|
||||
@@ -63,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="packageBandwidth != null">package_bandwidth,</if>
|
||||
<if test="businessName != null">business_name,</if>
|
||||
<if test="businessCode != null">business_code,</if>
|
||||
<if test="clientId != null">client_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
@@ -78,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="packageBandwidth != null">#{packageBandwidth},</if>
|
||||
<if test="businessName != null">#{businessName},</if>
|
||||
<if test="businessCode != null">#{businessCode},</if>
|
||||
<if test="clientId != null">#{clientId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -96,6 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="packageBandwidth != null">package_bandwidth = #{packageBandwidth},</if>
|
||||
<if test="businessName != null">business_name = #{businessName},</if>
|
||||
<if test="businessCode != null">business_code = #{businessCode},</if>
|
||||
<if test="clientId != null">client_id = #{clientId},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
@@ -15,14 +15,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<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="machineFlow" column="machine_flow" />
|
||||
<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="switchSn" column="switch_sn" />
|
||||
<result property="interfaceName" column="interface_name" />
|
||||
<result property="resourceType" column="resource_type" />
|
||||
@@ -34,10 +30,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="businessId" column="business_id" />
|
||||
<result property="remark1" column="remark1" />
|
||||
<result property="createDatetime" column="create_datetime" />
|
||||
<result property="clientId" column="client_id" />
|
||||
<result property="serverClientId" column="server_client_id" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEpsNodeBandwidthVo">
|
||||
select id, node_name, hardware_sn, calculation_mode, 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, switch_sn, 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, remark1, create_datetime from eps_node_bandwidth
|
||||
select id, node_name, hardware_sn, calculation_mode, bandwidth_type, bandwidth_result, bandwidth_95_daily, bandwidth_95_monthly, avg_monthly_bandwidth_95, package_bandwidth_daily, machine_flow, uplink_switch, create_time, update_time, switch_sn, 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, remark1, create_datetime, client_id, server_client_id, create_by, update_by from eps_node_bandwidth
|
||||
</sql>
|
||||
|
||||
<select id="selectEpsNodeBandwidthList" parameterType="EpsNodeBandwidth" resultMap="EpsNodeBandwidthResult">
|
||||
@@ -52,12 +52,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<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="machineFlow != null "> and machine_flow = #{machineFlow}</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="switchSn != null and switchSn != ''"> and switch_sn = #{switchSn}</if>
|
||||
<if test="interfaceName != null and interfaceName != ''"> and interface_name like concat('%', #{interfaceName}, '%')</if>
|
||||
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</if>
|
||||
@@ -68,6 +64,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<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="remark1 != null and remark1 != ''"> and remark1 = #{remark1}</if>
|
||||
<if test="createDatetime != null "> and create_datetime = #{createDatetime}</if>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
<if test="serverClientId != null and serverClientId != ''"> and server_client_id = #{serverClientId}</if>
|
||||
<if test="startTime != null and startTime != ''"> and create_time >= #{startTime}</if>
|
||||
<if test="endTime != null and endTime != ''"> and create_time <= #{endTime}</if>
|
||||
<if test="createTime != null"> and create_time = #{createTime}</if>
|
||||
@@ -104,14 +103,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<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="machineFlow != null">machine_flow,</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="switchSn != null">switch_sn,</if>
|
||||
<if test="interfaceName != null">interface_name,</if>
|
||||
<if test="resourceType != null">resource_type,</if>
|
||||
@@ -122,7 +115,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="businessName != null">business_name,</if>
|
||||
<if test="businessId != null">business_id,</if>
|
||||
<if test="remark1 != null">remark1,</if>
|
||||
create_datetime,
|
||||
<if test="createDatetime != null">create_datetime,</if>
|
||||
<if test="clientId != null">client_id,</if>
|
||||
<if test="serverClientId != null">server_client_id,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
create_time,
|
||||
update_time,
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="nodeName != null">#{nodeName},</if>
|
||||
@@ -134,14 +133,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<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="machineFlow != null">#{machineFlow},</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="switchSn != null">#{switchSn},</if>
|
||||
<if test="interfaceName != null">#{interfaceName},</if>
|
||||
<if test="resourceType != null">#{resourceType},</if>
|
||||
@@ -152,7 +145,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="businessName != null">#{businessName},</if>
|
||||
<if test="businessId != null">#{businessId},</if>
|
||||
<if test="remark1 != null">#{remark1},</if>
|
||||
NOW(),
|
||||
<if test="createDatetime != null">#{createDatetime},</if>
|
||||
<if test="clientId != null">#{clientId},</if>
|
||||
<if test="serverClientId != null">#{serverClientId},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<choose>
|
||||
<when test="createTime != null">
|
||||
#{createTime},
|
||||
</when>
|
||||
<otherwise>
|
||||
NOW(),
|
||||
</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<when test="updateTime != null">
|
||||
#{updateTime},
|
||||
</when>
|
||||
<otherwise>
|
||||
NOW(),
|
||||
</otherwise>
|
||||
</choose>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -168,14 +181,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<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="machineFlow != null">machine_flow = #{machineFlow},</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="switchSn != null">switch_sn = #{switchSn},</if>
|
||||
<if test="interfaceName != null">interface_name = #{interfaceName},</if>
|
||||
<if test="resourceType != null">resource_type = #{resourceType},</if>
|
||||
@@ -187,6 +196,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="businessId != null">business_id = #{businessId},</if>
|
||||
<if test="remark1 != null">remark1 = #{remark1},</if>
|
||||
<if test="createDatetime != null">create_datetime = #{createDatetime},</if>
|
||||
<if test="clientId != null">client_id = #{clientId},</if>
|
||||
<if test="serverClientId != null">server_client_id = #{serverClientId},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
@@ -251,6 +264,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="calculationMode != '' and calculationMode != null">
|
||||
and calculation_mode = #{calculationMode}
|
||||
</if>
|
||||
<if test="clientId != '' and clientId != null">
|
||||
and client_id = #{clientId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -272,6 +288,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="businessId != '' and businessId != null">
|
||||
and business_id = #{businessId}
|
||||
</if>
|
||||
<if test="clientId != '' and clientId != null">
|
||||
and client_id = #{clientId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -290,6 +309,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="businessId != '' and businessId != null">
|
||||
and business_id = #{businessId}
|
||||
</if>
|
||||
<if test="clientId != '' and clientId != null">
|
||||
and client_id = #{clientId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,127 @@
|
||||
<?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.EpsTaskStatisticsMapper">
|
||||
|
||||
<resultMap type="EpsTaskStatistics" id="EpsTaskStatisticsResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="taskName" column="task_name" />
|
||||
<result property="businessCode" column="business_code" />
|
||||
<result property="businessName" column="business_name" />
|
||||
<result property="startTime" column="start_time" />
|
||||
<result property="endTime" column="end_time" />
|
||||
<result property="percentile95" column="percentile_95" />
|
||||
<result property="monthlyAvgPercentile95" column="monthly_avg_percentile_95" />
|
||||
<result property="resourceType" column="resource_type" />
|
||||
<result property="includedResources" column="included_resources" />
|
||||
<result property="calculationType" column="calculation_type" />
|
||||
<result property="calculationMode" column="calculation_mode" />
|
||||
<result property="taskStatus" column="task_status" />
|
||||
<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="selectEpsTaskStatisticsVo">
|
||||
select id, task_name, business_code, business_name, start_time, end_time, percentile_95, monthly_avg_percentile_95, resource_type, included_resources, calculation_type, calculation_mode, task_status, create_time, update_time, create_by, update_by from eps_task_statistics
|
||||
</sql>
|
||||
|
||||
<select id="selectEpsTaskStatisticsList" parameterType="EpsTaskStatistics" resultMap="EpsTaskStatisticsResult">
|
||||
<include refid="selectEpsTaskStatisticsVo"/>
|
||||
<where>
|
||||
<if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
|
||||
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
|
||||
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
|
||||
<if test="startTime != null and startTime != ''"> and start_time = #{startTime}</if>
|
||||
<if test="endTime != null and endTime != ''"> and end_time = #{endTime}</if>
|
||||
<if test="percentile95 != null "> and percentile_95 = #{percentile95}</if>
|
||||
<if test="monthlyAvgPercentile95 != null "> and monthly_avg_percentile_95 = #{monthlyAvgPercentile95}</if>
|
||||
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</if>
|
||||
<if test="includedResources != null and includedResources != ''"> and included_resources = #{includedResources}</if>
|
||||
<if test="calculationType != null and calculationType != ''"> and calculation_type = #{calculationType}</if>
|
||||
<if test="calculationMode != null and calculationMode != ''"> and calculation_mode = #{calculationMode}</if>
|
||||
<if test="taskStatus != null and taskStatus != ''"> and task_status = #{taskStatus}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectEpsTaskStatisticsById" parameterType="Long" resultMap="EpsTaskStatisticsResult">
|
||||
<include refid="selectEpsTaskStatisticsVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertEpsTaskStatistics" parameterType="EpsTaskStatistics" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into eps_task_statistics
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="taskName != null and taskName != ''">task_name,</if>
|
||||
<if test="businessCode != null">business_code,</if>
|
||||
<if test="businessName != null and businessName != ''">business_name,</if>
|
||||
<if test="startTime != null">start_time,</if>
|
||||
<if test="endTime != null">end_time,</if>
|
||||
<if test="percentile95 != null">percentile_95,</if>
|
||||
<if test="monthlyAvgPercentile95 != null">monthly_avg_percentile_95,</if>
|
||||
<if test="resourceType != null">resource_type,</if>
|
||||
<if test="includedResources != null">included_resources,</if>
|
||||
<if test="calculationType != null">calculation_type,</if>
|
||||
<if test="calculationMode != null">calculation_mode,</if>
|
||||
<if test="taskStatus != null and taskStatus != ''">task_status,</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="taskName != null and taskName != ''">#{taskName},</if>
|
||||
<if test="businessCode != null">#{businessCode},</if>
|
||||
<if test="businessName != null and businessName != ''">#{businessName},</if>
|
||||
<if test="startTime != null">#{startTime},</if>
|
||||
<if test="endTime != null">#{endTime},</if>
|
||||
<if test="percentile95 != null">#{percentile95},</if>
|
||||
<if test="monthlyAvgPercentile95 != null">#{monthlyAvgPercentile95},</if>
|
||||
<if test="resourceType != null">#{resourceType},</if>
|
||||
<if test="includedResources != null">#{includedResources},</if>
|
||||
<if test="calculationType != null">#{calculationType},</if>
|
||||
<if test="calculationMode != null">#{calculationMode},</if>
|
||||
<if test="taskStatus != null and taskStatus != ''">#{taskStatus},</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="updateEpsTaskStatistics" parameterType="EpsTaskStatistics">
|
||||
update eps_task_statistics
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="taskName != null and taskName != ''">task_name = #{taskName},</if>
|
||||
<if test="businessCode != null">business_code = #{businessCode},</if>
|
||||
<if test="businessName != null and businessName != ''">business_name = #{businessName},</if>
|
||||
<if test="startTime != null">start_time = #{startTime},</if>
|
||||
<if test="endTime != null">end_time = #{endTime},</if>
|
||||
<if test="percentile95 != null">percentile_95 = #{percentile95},</if>
|
||||
<if test="monthlyAvgPercentile95 != null">monthly_avg_percentile_95 = #{monthlyAvgPercentile95},</if>
|
||||
<if test="resourceType != null">resource_type = #{resourceType},</if>
|
||||
<if test="includedResources != null">included_resources = #{includedResources},</if>
|
||||
<if test="calculationType != null">calculation_type = #{calculationType},</if>
|
||||
<if test="calculationMode != null">calculation_mode = #{calculationMode},</if>
|
||||
<if test="taskStatus != null and taskStatus != ''">task_status = #{taskStatus},</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="deleteEpsTaskStatisticsById" parameterType="Long">
|
||||
delete from eps_task_statistics where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEpsTaskStatisticsByIds" parameterType="String">
|
||||
delete from eps_task_statistics where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -33,10 +33,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="ifInErrors" column="if_in_errors" />
|
||||
<result property="ifOutErrors" column="if_out_errors" />
|
||||
<result property="ifIndex" column="if_index" />
|
||||
<result property="maxSpeed" column="max_speed" />
|
||||
<result property="interfaceNameRemark" column="interface_name_remark" />
|
||||
<result property="serverClientId" column="server_client_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectInitialSwitchInfoDetailsVo">
|
||||
select id, client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed, switch_ip, create_by, update_by, create_time, update_time, switch_name, interface_device_type, server_name, server_port, server_sn, switch_sn, business_code, business_name, if_speed, if_in_discards, if_out_discards, if_in_errors, if_out_errors, if_index from initial_switch_info_details
|
||||
select id, client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed, switch_ip, create_by, update_by, create_time, update_time, switch_name, interface_device_type, server_name, server_port, server_sn, switch_sn, business_code, business_name, if_speed, if_in_discards, if_out_discards, if_in_errors, if_out_errors, if_index, max_speed, interface_name_remark, server_client_id from initial_switch_info_details
|
||||
</sql>
|
||||
|
||||
<select id="selectInitialSwitchInfoDetailsList" parameterType="InitialSwitchInfoDetails" resultMap="InitialSwitchInfoDetailsResult">
|
||||
@@ -59,6 +62,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="switchSn != null and switchSn != ''"> and switch_sn = #{switchSn}</if>
|
||||
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
|
||||
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
|
||||
<if test="interfaceNameRemark != null and interfaceNameRemark != ''"> and interface_name_remark = #{interfaceNameRemark}</if>
|
||||
<if test="serverClientId != null and serverClientId != ''"> and server_client_id = #{serverClientId}</if>
|
||||
<if test="startTime != null">
|
||||
and create_time >= #{startTime}
|
||||
</if>
|
||||
@@ -103,7 +108,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="ifOutDiscards != null">if_out_discards,</if>
|
||||
<if test="ifInErrors != null">if_in_errors,</if>
|
||||
<if test="ifOutErrors != null">if_out_errors,</if>
|
||||
<if test="ifIndex != null and ifIndex != ''">if_index,</if>
|
||||
<if test="ifIndex != null">if_index,</if>
|
||||
<if test="maxSpeed != null">max_speed,</if>
|
||||
<if test="interfaceNameRemark != null">interface_name_remark,</if>
|
||||
<if test="serverClientId != null">server_client_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="clientId != null and clientId != ''">#{clientId},</if>
|
||||
@@ -132,7 +140,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="ifOutDiscards != null">#{ifOutDiscards},</if>
|
||||
<if test="ifInErrors != null">#{ifInErrors},</if>
|
||||
<if test="ifOutErrors != null">#{ifOutErrors},</if>
|
||||
<if test="ifIndex != null and ifIndex != ''">#{ifIndex},</if>
|
||||
<if test="ifIndex != null">#{ifIndex},</if>
|
||||
<if test="maxSpeed != null">#{maxSpeed},</if>
|
||||
<if test="interfaceNameRemark != null">#{interfaceNameRemark},</if>
|
||||
<if test="serverClientId != null">#{serverClientId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -165,7 +176,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="ifOutDiscards != null">if_out_discards = #{ifOutDiscards},</if>
|
||||
<if test="ifInErrors != null">if_in_errors = #{ifInErrors},</if>
|
||||
<if test="ifOutErrors != null">if_out_errors = #{ifOutErrors},</if>
|
||||
<if test="ifIndex != null and ifIndex != ''">if_index = #{ifIndex},</if>
|
||||
<if test="ifIndex != null">if_index = #{ifIndex},</if>
|
||||
<if test="maxSpeed != null">max_speed = #{maxSpeed},</if>
|
||||
<if test="interfaceNameRemark != null">interface_name_remark = #{interfaceNameRemark},</if>
|
||||
<if test="serverClientId != null">server_client_id = #{serverClientId},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
@@ -224,6 +238,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
`type`,
|
||||
in_speed,
|
||||
out_speed,
|
||||
max_speed,
|
||||
switch_ip,
|
||||
if_index,
|
||||
if_speed,
|
||||
@@ -242,7 +257,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
create_by,
|
||||
update_by,
|
||||
create_time,
|
||||
update_time
|
||||
update_time,
|
||||
interface_name_remark,
|
||||
server_client_id
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="dataList" item="item" separator=",">
|
||||
@@ -255,6 +272,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{item.type},
|
||||
#{item.inSpeed},
|
||||
#{item.outSpeed},
|
||||
#{item.maxSpeed},
|
||||
#{item.switchIp},
|
||||
#{item.ifIndex},
|
||||
#{item.ifSpeed},
|
||||
@@ -287,8 +305,68 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<otherwise>
|
||||
NOW()
|
||||
</otherwise>
|
||||
</choose>
|
||||
</choose>,
|
||||
#{item.interfaceNameRemark},
|
||||
#{item.serverClientId}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<select id="getswitchDetailList" parameterType="InitialSwitchInfoDetails" resultType="InitialSwitchInfoDetails">
|
||||
select in_speed inSpeed, out_speed outSpeed, create_time createTime from initial_switch_info_details
|
||||
<where>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
<if test="name != null and name != ''"> and name = #{name}</if>
|
||||
<if test="inBytes != null "> and in_bytes = #{inBytes}</if>
|
||||
<if test="outBytes != null "> and out_bytes = #{outBytes}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="inSpeed != null "> and in_speed = #{inSpeed}</if>
|
||||
<if test="outSpeed != null "> and out_speed = #{outSpeed}</if>
|
||||
<if test="switchIp != null and switchIp != ''"> and switch_ip = #{switchIp}</if>
|
||||
<if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</if>
|
||||
<if test="interfaceDeviceType != null and interfaceDeviceType != ''"> and interface_device_type = #{interfaceDeviceType}</if>
|
||||
<if test="serverName != null and serverName != ''"> and server_name like concat('%', #{serverName}, '%')</if>
|
||||
<if test="serverPort != null and serverPort != ''"> and server_port = #{serverPort}</if>
|
||||
<if test="serverSn != null and serverSn != ''"> and server_sn = #{serverSn}</if>
|
||||
<if test="switchSn != null and switchSn != ''"> and switch_sn = #{switchSn}</if>
|
||||
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
|
||||
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
|
||||
<if test="startTime != null">
|
||||
and create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and create_time <= #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="sumSwitchTrafficByclientIds" parameterType="InitialSwitchInfoDetails" resultType="InitialSwitchInfoDetails">
|
||||
select sum(ifnull(in_speed,0)) AS inSpeed,
|
||||
sum(ifnull(out_speed,0)) AS outSpeed,
|
||||
sum(ifnull(max_speed,0)) AS maxSpeed,
|
||||
create_time createTime from initial_switch_info_details
|
||||
<where>
|
||||
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
|
||||
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
|
||||
<if test="startTime != null">
|
||||
and create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and create_time <= #{endTime}
|
||||
</if>
|
||||
<if test="clientIds != '' and clientIds != null">
|
||||
and client_id in
|
||||
<foreach collection="clientIds.split(',')" item="clientId" open="(" separator="," close=")">
|
||||
#{clientId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="interfaceNames != null and interfaceNames != ''">
|
||||
and name in
|
||||
<foreach collection="interfaceNames.split(',')" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
group by create_time
|
||||
ORDER BY max_speed desc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<resultMap type="RmEpsTopologyManagement" id="RmEpsTopologyManagementResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="switchName" column="switch_name" />
|
||||
<result property="clientId" column="client_Id" />
|
||||
<result property="switchSn" column="switch_sn" />
|
||||
<result property="interfaceName" column="interface_name" />
|
||||
<result property="connectedDeviceType" column="connected_device_type" />
|
||||
@@ -20,10 +21,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updaterId" column="updater_id" />
|
||||
<result property="updaterName" column="updater_name" />
|
||||
<result property="switchIpAddress" column="switch_ip_address" />
|
||||
<result property="peerSwitchName" column="peer_switch_name" />
|
||||
<result property="peerSwitchInterface" column="peer_switch_interface" />
|
||||
<result property="serverClientId" column="server_client_id" />
|
||||
</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, switch_ip_address from rm_eps_topology_management
|
||||
select id, switch_name, client_id, 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, switch_ip_address, peer_switch_name, peer_switch_interface, server_client_id from rm_eps_topology_management
|
||||
</sql>
|
||||
|
||||
<select id="selectRmEpsTopologyManagementList" parameterType="RmEpsTopologyManagement" resultMap="RmEpsTopologyManagementResult">
|
||||
@@ -42,6 +46,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if>
|
||||
<if test="switchIpAddress != null and switchIpAddress != ''"> and switch_ip_address = #{switchIpAddress}</if>
|
||||
<if test="resourceName != null and resourceName != ''">and (switch_name like concat('%', #{resourceName}, '%') or server_name like concat('%', #{resourceName}, '%'))</if>
|
||||
<if test="peerSwitchName != null and peerSwitchName != ''"> and peer_switch_name like concat('%', #{peerSwitchName}, '%')</if>
|
||||
<if test="peerSwitchInterface != null and peerSwitchInterface != ''"> and peer_switch_interface = #{peerSwitchInterface}</if>
|
||||
<if test="serverClientId != null and serverClientId != ''"> and server_client_id = #{serverClientId}</if>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -54,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
insert into rm_eps_topology_management
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="switchName != null">switch_name,</if>
|
||||
<if test="clientId != null">client_id,</if>
|
||||
<if test="switchSn != null">switch_sn,</if>
|
||||
<if test="interfaceName != null">interface_name,</if>
|
||||
<if test="connectedDeviceType != null">connected_device_type,</if>
|
||||
@@ -67,9 +76,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updaterId != null">updater_id,</if>
|
||||
<if test="updaterName != null">updater_name,</if>
|
||||
<if test="switchIpAddress != null">switch_ip_address,</if>
|
||||
<if test="peerSwitchName != null">peer_switch_name,</if>
|
||||
<if test="peerSwitchInterface != null">peer_switch_interface,</if>
|
||||
<if test="serverClientId != null">server_client_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="switchName != null">#{switchName},</if>
|
||||
<if test="clientId != null">#{clientId},</if>
|
||||
<if test="switchSn != null">#{switchSn},</if>
|
||||
<if test="interfaceName != null">#{interfaceName},</if>
|
||||
<if test="connectedDeviceType != null">#{connectedDeviceType},</if>
|
||||
@@ -83,6 +96,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updaterId != null">#{updaterId},</if>
|
||||
<if test="updaterName != null">#{updaterName},</if>
|
||||
<if test="switchIpAddress != null">#{switchIpAddress},</if>
|
||||
<if test="peerSwitchName != null">#{peerSwitchName},</if>
|
||||
<if test="peerSwitchInterface != null">#{peerSwitchInterface},</if>
|
||||
<if test="serverClientId != null">#{serverClientId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -90,6 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
update rm_eps_topology_management
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="switchName != null">switch_name = #{switchName},</if>
|
||||
<if test="clientId != null">client_id = #{clientId},</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>
|
||||
@@ -103,6 +120,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updaterId != null">updater_id = #{updaterId},</if>
|
||||
<if test="updaterName != null">updater_name = #{updaterName},</if>
|
||||
<if test="switchIpAddress != null">switch_ip_address = #{switchIpAddress},</if>
|
||||
<if test="peerSwitchName != null">peer_switch_name = #{peerSwitchName},</if>
|
||||
<if test="peerSwitchInterface != null">peer_switch_interface = #{peerSwitchInterface},</if>
|
||||
<if test="serverClientId != null">server_client_id = #{serverClientId},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
<?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.RmRegistrationMachineMapper">
|
||||
|
||||
<resultMap type="RmRegistrationMachine" id="RmRegistrationMachineResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="clientId" column="client_id" />
|
||||
<result property="machineCode" column="machine_code" />
|
||||
<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="selectRmRegistrationMachineVo">
|
||||
select id, client_id, machine_code, create_time, update_time, create_by, update_by from rm_registration_machine
|
||||
</sql>
|
||||
|
||||
<select id="selectRmRegistrationMachineList" parameterType="RmRegistrationMachine" resultMap="RmRegistrationMachineResult">
|
||||
<include refid="selectRmRegistrationMachineVo"/>
|
||||
<where>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
<if test="machineCode != null and machineCode != ''"> and machine_code = #{machineCode}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRmRegistrationMachineById" parameterType="Long" resultMap="RmRegistrationMachineResult">
|
||||
<include refid="selectRmRegistrationMachineVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRmRegistrationMachine" parameterType="RmRegistrationMachine" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into rm_registration_machine
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="clientId != null and clientId != ''">client_id,</if>
|
||||
<if test="machineCode != null and machineCode != ''">machine_code,</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="clientId != null and clientId != ''">#{clientId},</if>
|
||||
<if test="machineCode != null and machineCode != ''">#{machineCode},</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="updateRmRegistrationMachine" parameterType="RmRegistrationMachine">
|
||||
update rm_registration_machine
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="clientId != null and clientId != ''">client_id = #{clientId},</if>
|
||||
<if test="machineCode != null and machineCode != ''">machine_code = #{machineCode},</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="deleteRmRegistrationMachineById" parameterType="Long">
|
||||
delete from rm_registration_machine where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRmRegistrationMachineByIds" parameterType="String">
|
||||
delete from rm_registration_machine where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -37,10 +37,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="creatorName" column="creator_name" />
|
||||
<result property="updaterId" column="updater_id" />
|
||||
<result property="updaterName" column="updater_name" />
|
||||
<result property="clientId" column="client_id" />
|
||||
<result property="operator" column="operator" />
|
||||
<result property="province" column="province" />
|
||||
<result property="publicIp" column="public_ip" />
|
||||
<result property="businessName" column="business_name" />
|
||||
<result property="logicalNodeId" column="logical_node_id" />
|
||||
<result property="multiPublicIpStatus" column="multi_public_ip_status" />
|
||||
<result property="heartbeatCount" column="heartbeat_count" />
|
||||
<result property="heartbeatInterval" column="heartbeat_interval" />
|
||||
<result property="onboardTime" column="onboard_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRmResourceRegistrationVo">
|
||||
select id, hardware_sn, resource_type, resource_name, ip_address, resource_port, other_port_name, agent_version, protocol, resource_version, rw_permission, snmp_detect, team_name, snmp_collect_addr, snmp_collect_port, security_level, encryption, resource_user_name, resource_pwd, registration_status, online_status, switch_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,
|
||||
agent_version, protocol, resource_version, rw_permission, snmp_detect, team_name, snmp_collect_addr,
|
||||
snmp_collect_port, security_level, encryption, resource_user_name, resource_pwd, registration_status,
|
||||
online_status, switch_online_status, description, customer_id, customer_name, service_number,
|
||||
create_time, update_time, creator_id, creator_name, updater_id, updater_name, client_id, operator,
|
||||
province, public_ip, business_name, logical_node_id, multi_public_ip_status, heartbeat_count,
|
||||
heartbeat_interval, onboard_time from rm_resource_registration
|
||||
</sql>
|
||||
|
||||
<select id="selectRmResourceRegistrationList" parameterType="RmResourceRegistration" resultMap="RmResourceRegistrationResult">
|
||||
@@ -76,6 +92,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updaterId != null "> and updater_id = #{updaterId}</if>
|
||||
<if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if>
|
||||
<if test="queryName != null and queryName != ''"> and (hardware_sn = #{queryName} or resource_name like concat('%', #{queryName}, '%')) </if>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
<if test="operator != null and operator != ''"> and operator = #{operator}</if>
|
||||
<if test="province != null and province != ''"> and province = #{province}</if>
|
||||
<if test="publicIp != null and publicIp != ''"> and public_ip = #{publicIp}</if>
|
||||
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
|
||||
<if test="logicalNodeId != null and logicalNodeId != ''"> and logical_node_id = #{logicalNodeId}</if>
|
||||
<if test="multiPublicIpStatus != null and multiPublicIpStatus != ''"> and multi_public_ip_status = #{multiPublicIpStatus}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
@@ -119,6 +142,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="creatorName != null">creator_name,</if>
|
||||
<if test="updaterId != null">updater_id,</if>
|
||||
<if test="updaterName != null">updater_name,</if>
|
||||
<if test="clientId != null">client_id,</if>
|
||||
<if test="operator != null">operator,</if>
|
||||
<if test="province != null">province,</if>
|
||||
<if test="publicIp != null">public_ip,</if>
|
||||
<if test="businessName != null">business_name,</if>
|
||||
<if test="logicalNodeId != null">logical_node_id,</if>
|
||||
<if test="multiPublicIpStatus != null">multi_public_ip_status,</if>
|
||||
<if test="heartbeatCount != null">heartbeat_count,</if>
|
||||
<if test="heartbeatInterval != null">heartbeat_interval,</if>
|
||||
<if test="onboardTime != null">onboard_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="hardwareSn != null">#{hardwareSn},</if>
|
||||
@@ -152,6 +185,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="creatorName != null">#{creatorName},</if>
|
||||
<if test="updaterId != null">#{updaterId},</if>
|
||||
<if test="updaterName != null">#{updaterName},</if>
|
||||
<if test="clientId != null">#{clientId},</if>
|
||||
<if test="operator != null">#{operator},</if>
|
||||
<if test="province != null">#{province},</if>
|
||||
<if test="publicIp != null">#{publicIp},</if>
|
||||
<if test="businessName != null">#{businessName},</if>
|
||||
<if test="logicalNodeId != null">#{logicalNodeId},</if>
|
||||
<if test="multiPublicIpStatus != null">#{multiPublicIpStatus},</if>
|
||||
<if test="heartbeatCount != null">#{heartbeatCount},</if>
|
||||
<if test="heartbeatInterval != null">#{heartbeatInterval},</if>
|
||||
<if test="onboardTime != null">#{onboardTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -189,6 +232,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="creatorName != null">creator_name = #{creatorName},</if>
|
||||
<if test="updaterId != null">updater_id = #{updaterId},</if>
|
||||
<if test="updaterName != null">updater_name = #{updaterName},</if>
|
||||
<if test="clientId != null">client_id = #{clientId},</if>
|
||||
<if test="operator != null">operator = #{operator},</if>
|
||||
<if test="province != null">province = #{province},</if>
|
||||
<if test="publicIp != null">public_ip = #{publicIp},</if>
|
||||
<if test="businessName != null">business_name = #{businessName},</if>
|
||||
<if test="logicalNodeId != null">logical_node_id = #{logicalNodeId},</if>
|
||||
<if test="multiPublicIpStatus != null">multi_public_ip_status = #{multiPublicIpStatus},</if>
|
||||
<if test="heartbeatCount != null">heartbeat_count = #{heartbeatCount},</if>
|
||||
<if test="heartbeatInterval != null">heartbeat_interval = #{heartbeatInterval},</if>
|
||||
<if test="onboardTime != null">onboard_time = #{onboardTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
@@ -213,7 +266,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
<!-- 查询所有资源名称-->
|
||||
<select id="selectAllResourceNameByType" parameterType="RmResourceRegistration" resultType="java.util.Map">
|
||||
select resource_name resourceName,ip_address ipAddress,hardware_sn hardwareSn from rm_resource_registration
|
||||
SELECT
|
||||
resource_name AS resourceName,
|
||||
CASE
|
||||
WHEN resource_type = '1' THEN ip_address
|
||||
WHEN resource_type = '2' THEN snmp_collect_addr
|
||||
END AS ipAddress,
|
||||
hardware_sn AS hardwareSn
|
||||
FROM rm_resource_registration
|
||||
<where>
|
||||
and registration_status = 1
|
||||
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
|
||||
@@ -279,8 +339,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="creatorName != null">creator_name = #{creatorName},</if>
|
||||
<if test="updaterId != null">updater_id = #{updaterId},</if>
|
||||
<if test="updaterName != null">updater_name = #{updaterName},</if>
|
||||
<if test="clientId != null">client_id = #{clientId},</if>
|
||||
<if test="operator != null">operator = #{operator},</if>
|
||||
<if test="province != null">province = #{province},</if>
|
||||
<if test="publicIp != null">public_ip = #{publicIp},</if>
|
||||
<if test="businessName != null">business_name = #{businessName},</if>
|
||||
<if test="logicalNodeId != null">logical_node_id = #{logicalNodeId},</if>
|
||||
<if test="multiPublicIpStatus != null">multi_public_ip_status = #{multiPublicIpStatus},</if>
|
||||
<if test="heartbeatCount != null">heartbeat_count = #{heartbeatCount},</if>
|
||||
<if test="heartbeatInterval != null">heartbeat_interval = #{heartbeatInterval},</if>
|
||||
<if test="onboardTime != null">onboard_time = #{onboardTime},</if>
|
||||
</trim>
|
||||
where hardware_sn = #{hardwareSn}
|
||||
<where>
|
||||
<choose>
|
||||
<when test="hardwareSn != null">
|
||||
and hardware_sn = #{hardwareSn}
|
||||
</when>
|
||||
<when test="clientId != null">
|
||||
and client_id = #{clientId}
|
||||
</when>
|
||||
<otherwise>
|
||||
and 1=0 <!-- 如果两个条件都不满足,则不更新任何记录 -->
|
||||
</otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
</update>
|
||||
<select id="getRegistrationByIds" parameterType="String" resultMap="RmResourceRegistrationResult">
|
||||
<include refid="selectRmResourceRegistrationVo"/>
|
||||
@@ -289,4 +371,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectRegistMsgByClientId" parameterType="RmResourceRegistration" resultMap="RmResourceRegistrationResult">
|
||||
<include refid="selectRmResourceRegistrationVo"/>
|
||||
<where>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
<select id="getAllLogicalNodeId" parameterType="RmResourceRegistration" resultType="java.util.Map">
|
||||
select logical_node_id logicalNodeId from rm_resource_registration where logical_node_id != ''
|
||||
group by logical_node_id
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,91 @@
|
||||
<?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.RmSwitchInterfaceInfoMapper">
|
||||
|
||||
<resultMap type="RmSwitchInterfaceInfo" id="RmSwitchInterfaceInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="hardwareSn" column="hardware_sn" />
|
||||
<result property="switchName" column="switch_name" />
|
||||
<result property="interfaceName" column="interface_name" />
|
||||
<result property="interfaceRemark" column="interface_remark" />
|
||||
<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="clientId" column="client_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRmSwitchInterfaceInfoVo">
|
||||
select id, hardware_sn, switch_name, interface_name, interface_remark, create_time, update_time, create_by, update_by, client_id from rm_switch_interface_info
|
||||
</sql>
|
||||
|
||||
<select id="selectRmSwitchInterfaceInfoList" parameterType="RmSwitchInterfaceInfo" resultMap="RmSwitchInterfaceInfoResult">
|
||||
<include refid="selectRmSwitchInterfaceInfoVo"/>
|
||||
<where>
|
||||
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
|
||||
<if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</if>
|
||||
<if test="interfaceName != null and interfaceName != ''"> and interface_name like concat('%', #{interfaceName}, '%')</if>
|
||||
<if test="interfaceRemark != null and interfaceRemark != ''"> and interface_remark = #{interfaceRemark}</if>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRmSwitchInterfaceInfoById" parameterType="Long" resultMap="RmSwitchInterfaceInfoResult">
|
||||
<include refid="selectRmSwitchInterfaceInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRmSwitchInterfaceInfo" parameterType="RmSwitchInterfaceInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into rm_switch_interface_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="hardwareSn != null and hardwareSn != ''">hardware_sn,</if>
|
||||
<if test="switchName != null and switchName != ''">switch_name,</if>
|
||||
<if test="interfaceName != null and interfaceName != ''">interface_name,</if>
|
||||
<if test="interfaceRemark != null">interface_remark,</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="clientId != null">client_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="hardwareSn != null and hardwareSn != ''">#{hardwareSn},</if>
|
||||
<if test="switchName != null and switchName != ''">#{switchName},</if>
|
||||
<if test="interfaceName != null and interfaceName != ''">#{interfaceName},</if>
|
||||
<if test="interfaceRemark != null">#{interfaceRemark},</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="clientId != null">#{clientId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRmSwitchInterfaceInfo" parameterType="RmSwitchInterfaceInfo">
|
||||
update rm_switch_interface_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="hardwareSn != null and hardwareSn != ''">hardware_sn = #{hardwareSn},</if>
|
||||
<if test="switchName != null and switchName != ''">switch_name = #{switchName},</if>
|
||||
<if test="interfaceName != null and interfaceName != ''">interface_name = #{interfaceName},</if>
|
||||
<if test="interfaceRemark != null">interface_remark = #{interfaceRemark},</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="deleteRmSwitchInterfaceInfoById" parameterType="Long">
|
||||
delete from rm_switch_interface_info where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRmSwitchInterfaceInfoByIds" parameterType="String">
|
||||
delete from rm_switch_interface_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,159 @@
|
||||
<?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.RmSwitchManagementMapper">
|
||||
|
||||
<resultMap type="RmSwitchManagement" id="RmSwitchManagementResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="switchType" column="switch_type" />
|
||||
<result property="switchName" column="switch_name" />
|
||||
<result property="hardwareSn" column="hardware_sn" />
|
||||
<result property="snmpAddress" column="snmp_address" />
|
||||
<result property="snmpPort" column="snmp_port" />
|
||||
<result property="onlineStatus" column="online_status" />
|
||||
<result property="heartbeatCount" column="heartbeat_count" />
|
||||
<result property="heartbeatInterval" column="heartbeat_interval" />
|
||||
<result property="heartbeatOid" column="heartbeat_oid" />
|
||||
<result property="snmpVersion" column="snmp_version" />
|
||||
<result property="upTime" column="up_time" />
|
||||
<result property="readWritePermission" column="read_write_permission" />
|
||||
<result property="securityLevel" column="security_level" />
|
||||
<result property="encryptionMethod" column="encryption_method" />
|
||||
<result property="communityName" column="community_name" />
|
||||
<result property="switchUser" column="switch_user" />
|
||||
<result property="switchPassword" column="switch_password" />
|
||||
<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="clientId" column="client_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRmSwitchManagementVo">
|
||||
select id, switch_type, switch_name, hardware_sn, snmp_address, snmp_port, online_status, heartbeat_count, heartbeat_interval, heartbeat_oid, snmp_version, up_time, read_write_permission, security_level, encryption_method, community_name, switch_user, switch_password, create_time, update_time, create_by, update_by, client_id from rm_switch_management
|
||||
</sql>
|
||||
|
||||
<select id="selectRmSwitchManagementList" parameterType="RmSwitchManagement" resultMap="RmSwitchManagementResult">
|
||||
<include refid="selectRmSwitchManagementVo"/>
|
||||
<where>
|
||||
<if test="switchType != null and switchType != ''"> and switch_type = #{switchType}</if>
|
||||
<if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</if>
|
||||
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
|
||||
<if test="snmpAddress != null and snmpAddress != ''"> and snmp_address = #{snmpAddress}</if>
|
||||
<if test="snmpPort != null "> and snmp_port = #{snmpPort}</if>
|
||||
<if test="onlineStatus != null and onlineStatus != ''"> and online_status = #{onlineStatus}</if>
|
||||
<if test="heartbeatCount != null and heartbeatCount != ''"> and heartbeat_count = #{heartbeatCount}</if>
|
||||
<if test="heartbeatInterval != null and heartbeatInterval != ''"> and heartbeat_interval = #{heartbeatInterval}</if>
|
||||
<if test="heartbeatOid != null and heartbeatOid != ''"> and heartbeat_oid = #{heartbeatOid}</if>
|
||||
<if test="snmpVersion != null and snmpVersion != ''"> and snmp_version = #{snmpVersion}</if>
|
||||
<if test="upTime != null "> and up_time = #{upTime}</if>
|
||||
<if test="readWritePermission != null and readWritePermission != ''"> and read_write_permission = #{readWritePermission}</if>
|
||||
<if test="securityLevel != null and securityLevel != ''"> and security_level = #{securityLevel}</if>
|
||||
<if test="encryptionMethod != null and encryptionMethod != ''"> and encryption_method = #{encryptionMethod}</if>
|
||||
<if test="communityName != null and communityName != ''"> and community_name like concat('%', #{communityName}, '%')</if>
|
||||
<if test="switchUser != null and switchUser != ''"> and switch_user = #{switchUser}</if>
|
||||
<if test="switchPassword != null and switchPassword != ''"> and switch_password = #{switchPassword}</if>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
<if test="queryName != null and queryName != ''">
|
||||
and (snmp_address = #{snmpAddress} or switch_name like concat('%', #{switchName}, '%'))
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRmSwitchManagementById" parameterType="Long" resultMap="RmSwitchManagementResult">
|
||||
<include refid="selectRmSwitchManagementVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRmSwitchManagement" parameterType="RmSwitchManagement" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into rm_switch_management
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="switchType != null">switch_type,</if>
|
||||
<if test="switchName != null and switchName != ''">switch_name,</if>
|
||||
<if test="hardwareSn != null and hardwareSn != ''">hardware_sn,</if>
|
||||
<if test="snmpAddress != null and snmpAddress != ''">snmp_address,</if>
|
||||
<if test="snmpPort != null">snmp_port,</if>
|
||||
<if test="onlineStatus != null and onlineStatus != ''">online_status,</if>
|
||||
<if test="heartbeatCount != null and heartbeatCount != ''">heartbeat_count,</if>
|
||||
<if test="heartbeatInterval != null and heartbeatInterval != ''">heartbeat_interval,</if>
|
||||
<if test="heartbeatOid != null and heartbeatOid != ''">heartbeat_oid,</if>
|
||||
<if test="snmpVersion != null and snmpVersion != ''">snmp_version,</if>
|
||||
<if test="upTime != null">up_time,</if>
|
||||
<if test="readWritePermission != null">read_write_permission,</if>
|
||||
<if test="securityLevel != null">security_level,</if>
|
||||
<if test="encryptionMethod != null">encryption_method,</if>
|
||||
<if test="communityName != null">community_name,</if>
|
||||
<if test="switchUser != null">switch_user,</if>
|
||||
<if test="switchPassword != null">switch_password,</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="clientId != null">client_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="switchType != null">#{switchType},</if>
|
||||
<if test="switchName != null and switchName != ''">#{switchName},</if>
|
||||
<if test="hardwareSn != null and hardwareSn != ''">#{hardwareSn},</if>
|
||||
<if test="snmpAddress != null and snmpAddress != ''">#{snmpAddress},</if>
|
||||
<if test="snmpPort != null">#{snmpPort},</if>
|
||||
<if test="onlineStatus != null and onlineStatus != ''">#{onlineStatus},</if>
|
||||
<if test="heartbeatCount != null and heartbeatCount != ''">#{heartbeatCount},</if>
|
||||
<if test="heartbeatInterval != null and heartbeatInterval != ''">#{heartbeatInterval},</if>
|
||||
<if test="heartbeatOid != null and heartbeatOid != ''">#{heartbeatOid},</if>
|
||||
<if test="snmpVersion != null and snmpVersion != ''">#{snmpVersion},</if>
|
||||
<if test="upTime != null">#{upTime},</if>
|
||||
<if test="readWritePermission != null">#{readWritePermission},</if>
|
||||
<if test="securityLevel != null">#{securityLevel},</if>
|
||||
<if test="encryptionMethod != null">#{encryptionMethod},</if>
|
||||
<if test="communityName != null">#{communityName},</if>
|
||||
<if test="switchUser != null">#{switchUser},</if>
|
||||
<if test="switchPassword != null">#{switchPassword},</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="clientId != null">#{clientId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRmSwitchManagement" parameterType="RmSwitchManagement">
|
||||
update rm_switch_management
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="switchType != null">switch_type = #{switchType},</if>
|
||||
<if test="switchName != null and switchName != ''">switch_name = #{switchName},</if>
|
||||
<if test="hardwareSn != null and hardwareSn != ''">hardware_sn = #{hardwareSn},</if>
|
||||
<if test="snmpAddress != null and snmpAddress != ''">snmp_address = #{snmpAddress},</if>
|
||||
<if test="snmpPort != null">snmp_port = #{snmpPort},</if>
|
||||
<if test="onlineStatus != null and onlineStatus != ''">online_status = #{onlineStatus},</if>
|
||||
<if test="heartbeatCount != null and heartbeatCount != ''">heartbeat_count = #{heartbeatCount},</if>
|
||||
<if test="heartbeatInterval != null and heartbeatInterval != ''">heartbeat_interval = #{heartbeatInterval},</if>
|
||||
<if test="heartbeatOid != null and heartbeatOid != ''">heartbeat_oid = #{heartbeatOid},</if>
|
||||
<if test="snmpVersion != null and snmpVersion != ''">snmp_version = #{snmpVersion},</if>
|
||||
<if test="upTime != null">up_time = #{upTime},</if>
|
||||
<if test="readWritePermission != null">read_write_permission = #{readWritePermission},</if>
|
||||
<if test="securityLevel != null">security_level = #{securityLevel},</if>
|
||||
<if test="encryptionMethod != null">encryption_method = #{encryptionMethod},</if>
|
||||
<if test="communityName != null">community_name = #{communityName},</if>
|
||||
<if test="switchUser != null">switch_user = #{switchUser},</if>
|
||||
<if test="switchPassword != null">switch_password = #{switchPassword},</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="deleteRmSwitchManagementById" parameterType="Long">
|
||||
delete from rm_switch_management where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRmSwitchManagementByIds" parameterType="String">
|
||||
delete from rm_switch_management where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,97 @@
|
||||
<?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.UserTableColumnConfigMapper">
|
||||
|
||||
<resultMap type="UserTableColumnConfig" id="UserTableColumnConfigResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="pageRoute" column="page_route" />
|
||||
<result property="columnConfig" column="column_config" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUserTableColumnConfigVo">
|
||||
select id, user_id, page_route, column_config, create_by, create_time, update_by, update_time, remark from user_table_column_config
|
||||
</sql>
|
||||
|
||||
<select id="selectUserTableColumnConfigList" parameterType="UserTableColumnConfig" resultMap="UserTableColumnConfigResult">
|
||||
<include refid="selectUserTableColumnConfigVo"/>
|
||||
<where>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="pageRoute != null and pageRoute != ''"> and page_route = #{pageRoute}</if>
|
||||
<if test="columnConfig != null and columnConfig != ''"> and column_config = #{columnConfig}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectUserTableColumnConfigById" parameterType="Long" resultMap="UserTableColumnConfigResult">
|
||||
<include refid="selectUserTableColumnConfigVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertUserTableColumnConfig" parameterType="UserTableColumnConfig" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into user_table_column_config
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="pageRoute != null and pageRoute != ''">page_route,</if>
|
||||
<if test="columnConfig != null and columnConfig != ''">column_config,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="pageRoute != null and pageRoute != ''">#{pageRoute},</if>
|
||||
<if test="columnConfig != null and columnConfig != ''">#{columnConfig},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateUserTableColumnConfig" parameterType="UserTableColumnConfig">
|
||||
update user_table_column_config
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="pageRoute != null and pageRoute != ''">page_route = #{pageRoute},</if>
|
||||
<if test="columnConfig != null and columnConfig != ''">column_config = #{columnConfig},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
<where>
|
||||
<choose>
|
||||
<when test="id != null">
|
||||
and id = #{id}
|
||||
</when>
|
||||
<when test="userId != null">
|
||||
and user_id = #{userId}
|
||||
</when>
|
||||
<otherwise>
|
||||
and 1=0 <!-- 如果两个条件都不满足,则不更新任何记录 -->
|
||||
</otherwise>
|
||||
</choose>
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<delete id="deleteUserTableColumnConfigById" parameterType="Long">
|
||||
delete from user_table_column_config where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteUserTableColumnConfigByIds" parameterType="String">
|
||||
delete from user_table_column_config where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -87,6 +87,12 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!-- SNMP4J 核心库 -->
|
||||
<dependency>
|
||||
<groupId>org.snmp4j</groupId>
|
||||
<artifactId>snmp4j</artifactId>
|
||||
<version>2.8.9</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.ruoyi.rocketmq.domain.DeviceMessage;
|
||||
import com.ruoyi.rocketmq.enums.MessageCodeEnum;
|
||||
import com.ruoyi.rocketmq.handler.DeviceMessageHandler;
|
||||
import com.ruoyi.rocketmq.handler.MessageHandler;
|
||||
import com.ruoyi.rocketmq.producer.ConsumeException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
|
||||
@@ -25,6 +26,8 @@ import java.util.List;
|
||||
public class RocketMsgListener implements MessageListenerConcurrently {
|
||||
@Autowired
|
||||
private DeviceMessageHandler deviceMessageHandler;
|
||||
@Autowired
|
||||
private MessageHandler messageHandler;
|
||||
|
||||
/**
|
||||
* 消费消息
|
||||
@@ -62,6 +65,13 @@ public class RocketMsgListener implements MessageListenerConcurrently {
|
||||
deviceMessageHandler.handleMessage(message);
|
||||
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;//业务处理成功
|
||||
}
|
||||
if(MessageCodeEnum.TR_AGENT_UP.getCode().equals(topic)){
|
||||
// 拿到信息
|
||||
DeviceMessage message = JSON.parseObject(body, DeviceMessage.class);
|
||||
// 处理消息
|
||||
messageHandler.handleMessage(message);
|
||||
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;//业务处理成功
|
||||
}
|
||||
// 根据不同的topic处理不同的业务 这里以订单消息为例子
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,4 +147,15 @@ public class InitialDiskInfoController extends BaseController
|
||||
Map<String, Object> echartsData = initialDiskInfoService.rwBytesEcharts(initialDiskInfo);
|
||||
return success(echartsData);
|
||||
}
|
||||
/**
|
||||
* 获取指定服务器的磁盘名称
|
||||
* @param initialDiskInfo
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:mountPointInfo:list")
|
||||
@PostMapping("/getAllDistName")
|
||||
public AjaxResult getAllDistName(@RequestBody InitialDiskInfo initialDiskInfo){
|
||||
List<Map> list = initialDiskInfoService.getAllDistName(initialDiskInfo);
|
||||
return success(list);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user