修复时间戳与数据表入库时间差1秒问题,开发重新计算接口,交换机详情增加业务代码,业务名称,修复各个表业务信息不匹配问题
This commit is contained in:
@@ -49,7 +49,7 @@ public class BaseEntity implements Serializable
|
|||||||
*/
|
*/
|
||||||
private String[] properties;
|
private String[] properties;
|
||||||
/** 时间戳 */
|
/** 时间戳 */
|
||||||
private String timestamp;
|
private long timestamp;
|
||||||
|
|
||||||
/** 请求参数 */
|
/** 请求参数 */
|
||||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
@@ -153,11 +153,11 @@ public class BaseEntity implements Serializable
|
|||||||
this.params = params;
|
this.params = params;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTimestamp() {
|
public long getTimestamp() {
|
||||||
return timestamp;
|
return timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTimestamp(String timestamp) {
|
public void setTimestamp(long timestamp) {
|
||||||
this.timestamp = timestamp;
|
this.timestamp = timestamp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class TableScheduleConfig {
|
|||||||
@Scheduled(cron = "0 0 0 1 * ?", zone = "Asia/Shanghai")
|
@Scheduled(cron = "0 0 0 1 * ?", zone = "Asia/Shanghai")
|
||||||
public void calculateMonthlyBandwidthTasks() {
|
public void calculateMonthlyBandwidthTasks() {
|
||||||
// 获取上个月的日期范围
|
// 获取上个月的日期范围
|
||||||
LocalDate lastMonth = LocalDate.now(ZoneId.of("Asia/Shanghai")).minusMonths(0);
|
LocalDate lastMonth = LocalDate.now(ZoneId.of("Asia/Shanghai")).minusMonths(1);
|
||||||
LocalDate firstDayOfMonth = lastMonth.withDayOfMonth(1);
|
LocalDate firstDayOfMonth = lastMonth.withDayOfMonth(1);
|
||||||
LocalDate lastDayOfMonth = lastMonth.withDayOfMonth(lastMonth.lengthOfMonth());
|
LocalDate lastDayOfMonth = lastMonth.withDayOfMonth(lastMonth.lengthOfMonth());
|
||||||
|
|
||||||
|
|||||||
@@ -106,4 +106,15 @@ public class InitialSwitchInfoDetailsController extends BaseController
|
|||||||
{
|
{
|
||||||
return initialSwitchInfoDetailsService.autoSaveSwitchTraffic(initialSwitchInfoDetails);
|
return initialSwitchInfoDetailsService.autoSaveSwitchTraffic(initialSwitchInfoDetails);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 获取交换机监控信息详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:switchInfoDetails:query")
|
||||||
|
@GetMapping(value = "recalculateSwitch/{id}")
|
||||||
|
public AjaxResult recalculateSwitch(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
initialSwitchInfoDetailsService.recalculateSwitch95Bandwidth(id);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,10 @@ public class InitialSwitchInfoDetails extends BaseEntity
|
|||||||
/** 交换机硬件SN */
|
/** 交换机硬件SN */
|
||||||
@Excel(name = "交换机硬件SN")
|
@Excel(name = "交换机硬件SN")
|
||||||
private String switchSn;
|
private String switchSn;
|
||||||
|
/** 业务代码 */
|
||||||
|
private String businessCode;
|
||||||
|
/** 业务名称 */
|
||||||
|
private String businessName;
|
||||||
/** 数据集合 */
|
/** 数据集合 */
|
||||||
private List<InitialSwitchInfoDetails> dataList;
|
private List<InitialSwitchInfoDetails> dataList;
|
||||||
|
|
||||||
|
|||||||
@@ -72,4 +72,10 @@ public interface IInitialSwitchInfoDetailsService
|
|||||||
* @return 流量数据列表
|
* @return 流量数据列表
|
||||||
*/
|
*/
|
||||||
void calculateSwitch95BandwidthDaily(InitialSwitchInfoDetails queryParam, String dailyStartTime, String dailyEndTime);
|
void calculateSwitch95BandwidthDaily(InitialSwitchInfoDetails queryParam, String dailyStartTime, String dailyEndTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重新计算交换机95带宽值
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
void recalculateSwitch95Bandwidth(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -377,8 +377,10 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
|||||||
bandwidth.setBusinessName(data.getBusinessName());
|
bandwidth.setBusinessName(data.getBusinessName());
|
||||||
bandwidth.setResourceType(data.getResourceType());
|
bandwidth.setResourceType(data.getResourceType());
|
||||||
bandwidth.setBandwidthType(data.getBandwidthType());
|
bandwidth.setBandwidthType(data.getBandwidthType());
|
||||||
bandwidth.setBandwidthResult(result);
|
|
||||||
bandwidth.setCreateTime(DateUtils.parseDate(dateTime));
|
bandwidth.setCreateTime(DateUtils.parseDate(dateTime));
|
||||||
|
// 查询此条数据是否存在
|
||||||
|
List<EpsNodeBandwidth> exitsList = epsNodeBandwidthMapper.selectEpsNodeBandwidthList(bandwidth);
|
||||||
|
bandwidth.setBandwidthResult(result);
|
||||||
switch (data.getBandwidthType()){
|
switch (data.getBandwidthType()){
|
||||||
case "1":
|
case "1":
|
||||||
bandwidth.setBandwidth95Daily(result);
|
bandwidth.setBandwidth95Daily(result);
|
||||||
@@ -404,6 +406,13 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
|||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Unknown bandwidthType: " + data.getBandwidthType());
|
throw new IllegalArgumentException("Unknown bandwidthType: " + data.getBandwidthType());
|
||||||
}
|
}
|
||||||
epsNodeBandwidthMapper.insertEpsNodeBandwidth(bandwidth);
|
if(!exitsList.isEmpty()){
|
||||||
|
bandwidth.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
bandwidth.setId(exitsList.get(0).getId());
|
||||||
|
epsNodeBandwidthMapper.updateEpsNodeBandwidth(bandwidth);
|
||||||
|
}else{
|
||||||
|
bandwidth.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
epsNodeBandwidthMapper.insertEpsNodeBandwidth(bandwidth);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ public class EpsNodeBandwidthServiceImpl implements IEpsNodeBandwidthService
|
|||||||
revenueConfig.setHardwareSn(epsNodeBandwidth.getHardwareSn());
|
revenueConfig.setHardwareSn(epsNodeBandwidth.getHardwareSn());
|
||||||
List<EpsServerRevenueConfig> changedList = epsServerRevenueConfigMapper.selectEpsServerRevenueConfigList(revenueConfig);
|
List<EpsServerRevenueConfig> changedList = epsServerRevenueConfigMapper.selectEpsServerRevenueConfigList(revenueConfig);
|
||||||
|
|
||||||
if (!changedList.isEmpty()) {
|
if (!changedList.isEmpty() && changedList.size() == 1) {
|
||||||
EpsServerRevenueConfig epsServerRevenueConfig = changedList.get(0);
|
EpsServerRevenueConfig epsServerRevenueConfig = changedList.get(0);
|
||||||
if (epsServerRevenueConfig.getUpdateTime() != null &&
|
if (epsServerRevenueConfig.getUpdateTime() != null &&
|
||||||
epsNodeBandwidth.getStartTime() != null &&
|
epsNodeBandwidth.getStartTime() != null &&
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -25,8 +29,9 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDetailsService
|
public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDetailsService
|
||||||
{
|
{
|
||||||
|
private static final DateTimeFormatter TIME_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
@Autowired
|
@Autowired
|
||||||
private InitialSwitchInfoDetailsMapper initialSwitchInfoDetailsMapper;
|
private InitialSwitchInfoDetailsMapper initialSwitchInfoDetailsMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -136,6 +141,21 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
|||||||
details.setInterfaceDeviceType(management.getConnectedDeviceType());
|
details.setInterfaceDeviceType(management.getConnectedDeviceType());
|
||||||
details.setServerName(management.getServerName());
|
details.setServerName(management.getServerName());
|
||||||
details.setServerPort(management.getServerPort());
|
details.setServerPort(management.getServerPort());
|
||||||
|
details.setServerSn(management.getServerSn());
|
||||||
|
// 根据服务器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());
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
details.setBusinessCode(null);
|
||||||
|
details.setBusinessName(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// id自增
|
// id自增
|
||||||
details.setId(null);
|
details.setId(null);
|
||||||
@@ -199,7 +219,20 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
|||||||
record.setInterfaceDeviceType(data.getInterfaceDeviceType());
|
record.setInterfaceDeviceType(data.getInterfaceDeviceType());
|
||||||
record.setSwitchName(data.getSwitchName());
|
record.setSwitchName(data.getSwitchName());
|
||||||
record.setSwitchSn(data.getSwitchSn());
|
record.setSwitchSn(data.getSwitchSn());
|
||||||
|
// 根据服务器sn查询业务
|
||||||
|
if(data.getServerSn() != null){
|
||||||
|
EpsServerRevenueConfig epsServerRevenueConfig = new EpsServerRevenueConfig();
|
||||||
|
epsServerRevenueConfig.setHardwareSn(data.getServerSn());
|
||||||
|
List<EpsServerRevenueConfig> businessList = epsServerRevenueConfigMapper.selectEpsServerRevenueConfigList(epsServerRevenueConfig);
|
||||||
|
if(!businessList.isEmpty()){
|
||||||
|
EpsServerRevenueConfig revenueConfig = businessList.get(0);
|
||||||
|
record.setBusinessName(revenueConfig.getBusinessName());
|
||||||
|
record.setBusinessCode(revenueConfig.getBusinessCode());
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
record.setBusinessCode(null);
|
||||||
|
record.setBusinessName(null);
|
||||||
|
}
|
||||||
// 判断是否需要更新
|
// 判断是否需要更新
|
||||||
if (existingNameMap.containsKey(name)) {
|
if (existingNameMap.containsKey(name)) {
|
||||||
AllInterfaceName existingRecord = existingNameMap.get(name);
|
AllInterfaceName existingRecord = existingNameMap.get(name);
|
||||||
@@ -232,6 +265,8 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
|||||||
!Objects.equals(oldRecord.getServerPort(), newRecord.getServerPort()) ||
|
!Objects.equals(oldRecord.getServerPort(), newRecord.getServerPort()) ||
|
||||||
!Objects.equals(oldRecord.getInterfaceDeviceType(), newRecord.getInterfaceDeviceType()) ||
|
!Objects.equals(oldRecord.getInterfaceDeviceType(), newRecord.getInterfaceDeviceType()) ||
|
||||||
!Objects.equals(oldRecord.getSwitchName(), newRecord.getSwitchName()) ||
|
!Objects.equals(oldRecord.getSwitchName(), newRecord.getSwitchName()) ||
|
||||||
|
!Objects.equals(oldRecord.getBusinessCode(), newRecord.getBusinessCode()) ||
|
||||||
|
!Objects.equals(oldRecord.getBusinessName(), newRecord.getBusinessName()) ||
|
||||||
!Objects.equals(oldRecord.getSwitchSn(), newRecord.getSwitchSn());
|
!Objects.equals(oldRecord.getSwitchSn(), newRecord.getSwitchSn());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,6 +282,63 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重新计算交换机95带宽值
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void recalculateSwitch95Bandwidth(Long id) {
|
||||||
|
// 获取需要重新计算的信息
|
||||||
|
EpsNodeBandwidth epsNodeBandwidth = epsNodeBandwidthMapper.selectEpsNodeBandwidthById(id);
|
||||||
|
// 将Date转换为LocalDateTime
|
||||||
|
LocalDateTime createDateTime = epsNodeBandwidth.getCreateTime().toInstant()
|
||||||
|
.atZone(ZoneId.systemDefault())
|
||||||
|
.toLocalDateTime();
|
||||||
|
// 获取当天的开始时间(00:00:00)
|
||||||
|
String dailyStartTime = createDateTime.with(LocalTime.MIN)
|
||||||
|
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
|
||||||
|
// 获取当天的结束时间(23:59:59)
|
||||||
|
String dailyEndTime = createDateTime.with(LocalTime.MAX)
|
||||||
|
.withNano(0) // 去除纳秒部分
|
||||||
|
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
InitialSwitchInfoDetails switchInfoDetails = new InitialSwitchInfoDetails();
|
||||||
|
switchInfoDetails.setStartTime(dailyStartTime);
|
||||||
|
switchInfoDetails.setEndTime(dailyEndTime);
|
||||||
|
switchInfoDetails.setSwitchSn(epsNodeBandwidth.getSwitchSn());
|
||||||
|
switchInfoDetails.setSwitchName(epsNodeBandwidth.getUplinkSwitch());
|
||||||
|
switchInfoDetails.setServerSn(epsNodeBandwidth.getHardwareSn());
|
||||||
|
switchInfoDetails.setInterfaceDeviceType(epsNodeBandwidth.getInterfaceLinkDeviceType());
|
||||||
|
switchInfoDetails.setName(epsNodeBandwidth.getInterfaceName());
|
||||||
|
switchInfoDetails.setBusinessCode(epsNodeBandwidth.getBusinessId());
|
||||||
|
switchInfoDetails.setBusinessName(epsNodeBandwidth.getBusinessName());
|
||||||
|
List<InitialSwitchInfoDetails> dataList = initialSwitchInfoDetailsMapper
|
||||||
|
.selectInitialSwitchInfoDetailsList(switchInfoDetails);
|
||||||
|
// 1. 提取并转换带宽值
|
||||||
|
List<BigDecimal> speedsInMbps = dataList.stream()
|
||||||
|
.map(data -> {
|
||||||
|
// 根据 interfaceDeviceType 选择 inSpeed 或 outSpeed
|
||||||
|
String speed = ("1".equals(data.getInterfaceDeviceType())) ?
|
||||||
|
data.getInSpeed() + "" : data.getOutSpeed() + "";
|
||||||
|
// 如果 speed 是纯数字,补充单位 "B/S"(Bytes/s)
|
||||||
|
if (speed.matches("^\\d+(\\.\\d+)?$")) {
|
||||||
|
speed += " B/S";
|
||||||
|
}
|
||||||
|
return CalculateUtil.parseSpeedToMbps(speed);
|
||||||
|
})
|
||||||
|
.sorted()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 2. 计算95百分位
|
||||||
|
BigDecimal percentile95 = CalculateUtil.calculatePercentile(speedsInMbps, 0.95);
|
||||||
|
|
||||||
|
// 3. 保存结果
|
||||||
|
InitialSwitchInfoDetails switchInfo = dataList.get(0);
|
||||||
|
switchInfo.setResourceType("2");
|
||||||
|
switchInfo.setBandwidthType(epsNodeBandwidth.getBandwidthType());
|
||||||
|
saveSwitchBandwidthResult(switchInfo, percentile95, dailyStartTime);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理单个交换机的带宽计算
|
* 处理单个交换机的带宽计算
|
||||||
*/
|
*/
|
||||||
@@ -435,16 +527,20 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
|||||||
BigDecimal result,
|
BigDecimal result,
|
||||||
String dateTime) {
|
String dateTime) {
|
||||||
EpsNodeBandwidth bandwidth = new EpsNodeBandwidth();
|
EpsNodeBandwidth bandwidth = new EpsNodeBandwidth();
|
||||||
|
bandwidth.setBusinessName(data.getBusinessName());
|
||||||
|
bandwidth.setBusinessId(data.getBusinessCode());
|
||||||
bandwidth.setHardwareSn(data.getServerSn());
|
bandwidth.setHardwareSn(data.getServerSn());
|
||||||
bandwidth.setSwitchSn(data.getSwitchSn());
|
bandwidth.setSwitchSn(data.getSwitchSn());
|
||||||
bandwidth.setNodeName(data.getServerName());
|
bandwidth.setNodeName(data.getServerName());
|
||||||
bandwidth.setUplinkSwitch(data.getSwitchName());
|
bandwidth.setUplinkSwitch(data.getSwitchName());
|
||||||
bandwidth.setInterfaceName(data.getName());
|
bandwidth.setInterfaceName(data.getName());
|
||||||
bandwidth.setBandwidthResult(result);
|
|
||||||
bandwidth.setResourceType(data.getResourceType());
|
bandwidth.setResourceType(data.getResourceType());
|
||||||
bandwidth.setBandwidthType(data.getBandwidthType());
|
bandwidth.setBandwidthType(data.getBandwidthType());
|
||||||
bandwidth.setBandwidthResult(result);
|
bandwidth.setInterfaceLinkDeviceType(data.getInterfaceDeviceType());
|
||||||
bandwidth.setCreateTime(DateUtils.parseDate(dateTime));
|
bandwidth.setCreateTime(DateUtils.parseDate(dateTime));
|
||||||
|
// 查询此条数据是否存在
|
||||||
|
List<EpsNodeBandwidth> exitsList = epsNodeBandwidthMapper.selectEpsNodeBandwidthList(bandwidth);
|
||||||
|
bandwidth.setBandwidthResult(result);
|
||||||
switch (data.getBandwidthType()){
|
switch (data.getBandwidthType()){
|
||||||
case "1":
|
case "1":
|
||||||
bandwidth.setBandwidth95Daily(result);
|
bandwidth.setBandwidth95Daily(result);
|
||||||
@@ -470,6 +566,13 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
|||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Unknown bandwidthType: " + data.getBandwidthType());
|
throw new IllegalArgumentException("Unknown bandwidthType: " + data.getBandwidthType());
|
||||||
}
|
}
|
||||||
epsNodeBandwidthMapper.insertEpsNodeBandwidth(bandwidth);
|
if(!exitsList.isEmpty()){
|
||||||
|
bandwidth.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
bandwidth.setId(exitsList.get(0).getId());
|
||||||
|
epsNodeBandwidthMapper.updateEpsNodeBandwidth(bandwidth);
|
||||||
|
}else{
|
||||||
|
bandwidth.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
epsNodeBandwidthMapper.insertEpsNodeBandwidth(bandwidth);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,13 +189,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</where>
|
</where>
|
||||||
group by switch_sn
|
group by switch_sn
|
||||||
</select>
|
</select>
|
||||||
<update id="batchUpdate">
|
<!-- MyBatis Mapper XML配置 -->
|
||||||
<foreach collection="list" item="item" separator=";">
|
<update id="batchUpdate" parameterType="java.util.List">
|
||||||
|
<foreach collection="list" item="item" index="index" open="" separator=";" close="">
|
||||||
UPDATE all_interface_name
|
UPDATE all_interface_name
|
||||||
SET
|
SET
|
||||||
business_code = #{item.businessCode},
|
business_code = #{item.businessCode},
|
||||||
business_name = #{item.businessName},
|
business_name = #{item.businessName},
|
||||||
update_time = now(),
|
update_time = NOW(),
|
||||||
client_id = #{item.clientId},
|
client_id = #{item.clientId},
|
||||||
device_sn = #{item.deviceSn},
|
device_sn = #{item.deviceSn},
|
||||||
node_name = #{item.nodeName},
|
node_name = #{item.nodeName},
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
node_name varchar(200) COMMENT '服务器名称',
|
node_name varchar(200) COMMENT '服务器名称',
|
||||||
revenue_method varchar(10) COMMENT '收益方式(1.流量,2包端)',
|
revenue_method varchar(10) COMMENT '收益方式(1.流量,2包端)',
|
||||||
package_bandwidth DECIMAL(10,2) COMMENT '包端带宽值',
|
package_bandwidth DECIMAL(10,2) COMMENT '包端带宽值',
|
||||||
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
create_time DATETIME COMMENT '创建时间',
|
||||||
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||||
create_by VARCHAR(50) COMMENT '创建人',
|
create_by VARCHAR(50) COMMENT '创建人',
|
||||||
update_by VARCHAR(50) COMMENT '修改人',
|
update_by VARCHAR(50) COMMENT '修改人',
|
||||||
@@ -45,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
`out_dropped` DECIMAL(5,2) COMMENT '出站丢包率(%)',
|
`out_dropped` DECIMAL(5,2) COMMENT '出站丢包率(%)',
|
||||||
`in_speed` VARCHAR(20) COMMENT '接收带宽(Mbps)',
|
`in_speed` VARCHAR(20) COMMENT '接收带宽(Mbps)',
|
||||||
`out_speed` VARCHAR(20) COMMENT '发送带宽(Mbps)',
|
`out_speed` VARCHAR(20) COMMENT '发送带宽(Mbps)',
|
||||||
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
create_time DATETIME COMMENT '创建时间',
|
||||||
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||||
create_by VARCHAR(50) COMMENT '创建人',
|
create_by VARCHAR(50) COMMENT '创建人',
|
||||||
update_by VARCHAR(50) COMMENT '修改人',
|
update_by VARCHAR(50) COMMENT '修改人',
|
||||||
|
|||||||
@@ -3,133 +3,175 @@
|
|||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.system.mapper.InitialSwitchInfoDetailsMapper">
|
<mapper namespace="com.ruoyi.system.mapper.InitialSwitchInfoDetailsMapper">
|
||||||
|
|
||||||
<resultMap type="InitialSwitchInfoDetails" id="InitialSwitchInfoDetailsResult">
|
<resultMap type="EpsNodeBandwidth" id="EpsNodeBandwidthResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="clientId" column="client_id" />
|
<result property="nodeName" column="node_name" />
|
||||||
<result property="name" column="name" />
|
<result property="hardwareSn" column="hardware_sn" />
|
||||||
<result property="inBytes" column="in_bytes" />
|
<result property="bandwidthType" column="bandwidth_type" />
|
||||||
<result property="outBytes" column="out_bytes" />
|
<result property="bandwidthResult" column="bandwidth_result" />
|
||||||
<result property="status" column="status" />
|
<result property="bandwidth95Daily" column="bandwidth_95_daily" />
|
||||||
<result property="type" column="type" />
|
<result property="bandwidth95Monthly" column="bandwidth_95_monthly" />
|
||||||
<result property="inSpeed" column="in_speed" />
|
<result property="avgMonthlyBandwidth95" column="avg_monthly_bandwidth_95" />
|
||||||
<result property="outSpeed" column="out_speed" />
|
<result property="packageBandwidthDaily" column="package_bandwidth_daily" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="customerId" column="customer_id" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="customerName" column="customer_name" />
|
||||||
|
<result property="serviceNumber" column="service_number" />
|
||||||
|
<result property="uplinkSwitch" column="uplink_switch" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
<result property="switchName" column="switch_name" />
|
<result property="creatorId" column="creator_id" />
|
||||||
<result property="interfaceDeviceType" column="interface_device_type" />
|
<result property="creatorName" column="creator_name" />
|
||||||
<result property="serverName" column="server_name" />
|
|
||||||
<result property="serverPort" column="server_port" />
|
|
||||||
<result property="serverSn" column="server_sn" />
|
|
||||||
<result property="switchSn" column="switch_sn" />
|
<result property="switchSn" column="switch_sn" />
|
||||||
|
<result property="interfaceName" column="interface_name" />
|
||||||
|
<result property="resourceType" column="resource_type" />
|
||||||
|
<result property="interfaceLinkDeviceType" column="interface_link_device_type" />
|
||||||
|
<result property="effectiveBandwidth95Daily" column="effective_bandwidth_95_daily" />
|
||||||
|
<result property="effectiveBandwidth95Monthly" column="effective_bandwidth_95_monthly" />
|
||||||
|
<result property="effectiveAvgMonthlyBandwidth95" column="effective_avg_monthly_bandwidth_95" />
|
||||||
|
<result property="businessName" column="business_name" />
|
||||||
|
<result property="businessId" column="business_id" />
|
||||||
|
<result property="remark1" column="remark1" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectInitialSwitchInfoDetailsVo">
|
<sql id="selectEpsNodeBandwidthVo">
|
||||||
select id, client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed, create_by, update_by, create_time, update_time, switch_name, interface_device_type, server_name, server_port, server_sn, switch_sn from initial_switch_info_details
|
select id, node_name, hardware_sn, bandwidth_type, bandwidth_result, bandwidth_95_daily, bandwidth_95_monthly, avg_monthly_bandwidth_95, package_bandwidth_daily, customer_id, customer_name, service_number, uplink_switch, create_time, update_time, creator_id, creator_name, 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 from eps_node_bandwidth
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectInitialSwitchInfoDetailsList" parameterType="InitialSwitchInfoDetails" resultMap="InitialSwitchInfoDetailsResult">
|
<select id="selectEpsNodeBandwidthList" parameterType="EpsNodeBandwidth" resultMap="EpsNodeBandwidthResult">
|
||||||
<include refid="selectInitialSwitchInfoDetailsVo"/>
|
<include refid="selectEpsNodeBandwidthVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
<if test="nodeName != null and nodeName != ''"> and node_name like concat('%', #{nodeName}, '%')</if>
|
||||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
|
||||||
<if test="inBytes != null "> and in_bytes = #{inBytes}</if>
|
<if test="bandwidthType != null and bandwidthType != ''"> and bandwidth_type = #{bandwidthType}</if>
|
||||||
<if test="outBytes != null "> and out_bytes = #{outBytes}</if>
|
<if test="bandwidthResult != null "> and bandwidth_result = #{bandwidthResult}</if>
|
||||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
<if test="bandwidth95Daily != null "> and bandwidth_95_daily = #{bandwidth95Daily}</if>
|
||||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
<if test="bandwidth95Monthly != null "> and bandwidth_95_monthly = #{bandwidth95Monthly}</if>
|
||||||
<if test="inSpeed != null "> and in_speed = #{inSpeed}</if>
|
<if test="avgMonthlyBandwidth95 != null "> and avg_monthly_bandwidth_95 = #{avgMonthlyBandwidth95}</if>
|
||||||
<if test="outSpeed != null "> and out_speed = #{outSpeed}</if>
|
<if test="packageBandwidthDaily != null "> and package_bandwidth_daily = #{packageBandwidthDaily}</if>
|
||||||
<if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</if>
|
<if test="customerId != null and customerId != ''"> and customer_id = #{customerId}</if>
|
||||||
<if test="interfaceDeviceType != null and interfaceDeviceType != ''"> and interface_device_type = #{interfaceDeviceType}</if>
|
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
|
||||||
<if test="serverName != null and serverName != ''"> and server_name like concat('%', #{serverName}, '%')</if>
|
<if test="serviceNumber != null and serviceNumber != ''"> and service_number = #{serviceNumber}</if>
|
||||||
<if test="serverPort != null and serverPort != ''"> and server_port = #{serverPort}</if>
|
<if test="uplinkSwitch != null and uplinkSwitch != ''"> and uplink_switch like concat('%', #{uplinkSwitch}, '%')</if>
|
||||||
<if test="serverSn != null and serverSn != ''"> and server_sn = #{serverSn}</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="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>
|
||||||
|
<if test="interfaceLinkDeviceType != null and interfaceLinkDeviceType != ''"> and interface_link_device_type = #{interfaceLinkDeviceType}</if>
|
||||||
|
<if test="effectiveBandwidth95Daily != null "> and effective_bandwidth_95_daily = #{effectiveBandwidth95Daily}</if>
|
||||||
|
<if test="effectiveBandwidth95Monthly != null "> and effective_bandwidth_95_monthly = #{effectiveBandwidth95Monthly}</if>
|
||||||
|
<if test="effectiveAvgMonthlyBandwidth95 != null "> and effective_avg_monthly_bandwidth_95 = #{effectiveAvgMonthlyBandwidth95}</if>
|
||||||
|
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
|
||||||
|
<if test="businessId != null and businessId != ''"> and business_id = #{businessId}</if>
|
||||||
|
<if test="remark1 != null and remark1 != ''"> and remark1 = #{remark1}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectInitialSwitchInfoDetailsById" parameterType="Long" resultMap="InitialSwitchInfoDetailsResult">
|
<select id="selectEpsNodeBandwidthById" parameterType="Long" resultMap="EpsNodeBandwidthResult">
|
||||||
<include refid="selectInitialSwitchInfoDetailsVo"/>
|
<include refid="selectEpsNodeBandwidthVo"/>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertInitialSwitchInfoDetails" parameterType="InitialSwitchInfoDetails" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertEpsNodeBandwidth" parameterType="EpsNodeBandwidth" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into initial_switch_info_details
|
insert into eps_node_bandwidth
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="clientId != null and clientId != ''">client_id,</if>
|
<if test="nodeName != null">node_name,</if>
|
||||||
<if test="name != null and name != ''">name,</if>
|
<if test="hardwareSn != null">hardware_sn,</if>
|
||||||
<if test="inBytes != null">in_bytes,</if>
|
<if test="bandwidthType != null">bandwidth_type,</if>
|
||||||
<if test="outBytes != null">out_bytes,</if>
|
<if test="bandwidthResult != null">bandwidth_result,</if>
|
||||||
<if test="status != null">status,</if>
|
<if test="bandwidth95Daily != null">bandwidth_95_daily,</if>
|
||||||
<if test="type != null">type,</if>
|
<if test="bandwidth95Monthly != null">bandwidth_95_monthly,</if>
|
||||||
<if test="inSpeed != null">in_speed,</if>
|
<if test="avgMonthlyBandwidth95 != null">avg_monthly_bandwidth_95,</if>
|
||||||
<if test="outSpeed != null">out_speed,</if>
|
<if test="packageBandwidthDaily != null">package_bandwidth_daily,</if>
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="customerId != null">customer_id,</if>
|
||||||
<if test="updateBy != null">update_by,</if>
|
<if test="customerName != null">customer_name,</if>
|
||||||
|
<if test="serviceNumber != null">service_number,</if>
|
||||||
|
<if test="uplinkSwitch != null">uplink_switch,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
<if test="updateTime != null">update_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
||||||
<if test="switchName != null">switch_name,</if>
|
<if test="creatorId != null">creator_id,</if>
|
||||||
<if test="interfaceDeviceType != null">interface_device_type,</if>
|
<if test="creatorName != null">creator_name,</if>
|
||||||
<if test="serverName != null">server_name,</if>
|
|
||||||
<if test="serverPort != null">server_port,</if>
|
|
||||||
<if test="serverSn != null">server_sn,</if>
|
|
||||||
<if test="switchSn != null">switch_sn,</if>
|
<if test="switchSn != null">switch_sn,</if>
|
||||||
</trim>
|
<if test="interfaceName != null">interface_name,</if>
|
||||||
|
<if test="resourceType != null">resource_type,</if>
|
||||||
|
<if test="interfaceLinkDeviceType != null">interface_link_device_type,</if>
|
||||||
|
<if test="effectiveBandwidth95Daily != null">effective_bandwidth_95_daily,</if>
|
||||||
|
<if test="effectiveBandwidth95Monthly != null">effective_bandwidth_95_monthly,</if>
|
||||||
|
<if test="effectiveAvgMonthlyBandwidth95 != null">effective_avg_monthly_bandwidth_95,</if>
|
||||||
|
<if test="businessName != null">business_name,</if>
|
||||||
|
<if test="businessId != null">business_id,</if>
|
||||||
|
<if test="remark1 != null">remark1,</if>
|
||||||
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="clientId != null and clientId != ''">#{clientId},</if>
|
<if test="nodeName != null">#{nodeName},</if>
|
||||||
<if test="name != null and name != ''">#{name},</if>
|
<if test="hardwareSn != null">#{hardwareSn},</if>
|
||||||
<if test="inBytes != null">#{inBytes},</if>
|
<if test="bandwidthType != null">#{bandwidthType},</if>
|
||||||
<if test="outBytes != null">#{outBytes},</if>
|
<if test="bandwidthResult != null">#{bandwidthResult},</if>
|
||||||
<if test="status != null">#{status},</if>
|
<if test="bandwidth95Daily != null">#{bandwidth95Daily},</if>
|
||||||
<if test="type != null">#{type},</if>
|
<if test="bandwidth95Monthly != null">#{bandwidth95Monthly},</if>
|
||||||
<if test="inSpeed != null">#{inSpeed},</if>
|
<if test="avgMonthlyBandwidth95 != null">#{avgMonthlyBandwidth95},</if>
|
||||||
<if test="outSpeed != null">#{outSpeed},</if>
|
<if test="packageBandwidthDaily != null">#{packageBandwidthDaily},</if>
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="customerId != null">#{customerId},</if>
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
<if test="customerName != null">#{customerName},</if>
|
||||||
|
<if test="serviceNumber != null">#{serviceNumber},</if>
|
||||||
|
<if test="uplinkSwitch != null">#{uplinkSwitch},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
<if test="switchName != null">#{switchName},</if>
|
<if test="creatorId != null">#{creatorId},</if>
|
||||||
<if test="interfaceDeviceType != null">#{interfaceDeviceType},</if>
|
<if test="creatorName != null">#{creatorName},</if>
|
||||||
<if test="serverName != null">#{serverName},</if>
|
|
||||||
<if test="serverPort != null">#{serverPort},</if>
|
|
||||||
<if test="serverSn != null">#{serverSn},</if>
|
|
||||||
<if test="switchSn != null">#{switchSn},</if>
|
<if test="switchSn != null">#{switchSn},</if>
|
||||||
</trim>
|
<if test="interfaceName != null">#{interfaceName},</if>
|
||||||
|
<if test="resourceType != null">#{resourceType},</if>
|
||||||
|
<if test="interfaceLinkDeviceType != null">#{interfaceLinkDeviceType},</if>
|
||||||
|
<if test="effectiveBandwidth95Daily != null">#{effectiveBandwidth95Daily},</if>
|
||||||
|
<if test="effectiveBandwidth95Monthly != null">#{effectiveBandwidth95Monthly},</if>
|
||||||
|
<if test="effectiveAvgMonthlyBandwidth95 != null">#{effectiveAvgMonthlyBandwidth95},</if>
|
||||||
|
<if test="businessName != null">#{businessName},</if>
|
||||||
|
<if test="businessId != null">#{businessId},</if>
|
||||||
|
<if test="remark1 != null">#{remark1},</if>
|
||||||
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateInitialSwitchInfoDetails" parameterType="InitialSwitchInfoDetails">
|
<update id="updateEpsNodeBandwidth" parameterType="EpsNodeBandwidth">
|
||||||
update initial_switch_info_details
|
update eps_node_bandwidth
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
<if test="clientId != null and clientId != ''">client_id = #{clientId},</if>
|
<if test="nodeName != null">node_name = #{nodeName},</if>
|
||||||
<if test="name != null and name != ''">name = #{name},</if>
|
<if test="hardwareSn != null">hardware_sn = #{hardwareSn},</if>
|
||||||
<if test="inBytes != null">in_bytes = #{inBytes},</if>
|
<if test="bandwidthType != null">bandwidth_type = #{bandwidthType},</if>
|
||||||
<if test="outBytes != null">out_bytes = #{outBytes},</if>
|
<if test="bandwidthResult != null">bandwidth_result = #{bandwidthResult},</if>
|
||||||
<if test="status != null">status = #{status},</if>
|
<if test="bandwidth95Daily != null">bandwidth_95_daily = #{bandwidth95Daily},</if>
|
||||||
<if test="type != null">type = #{type},</if>
|
<if test="bandwidth95Monthly != null">bandwidth_95_monthly = #{bandwidth95Monthly},</if>
|
||||||
<if test="inSpeed != null">in_speed = #{inSpeed},</if>
|
<if test="avgMonthlyBandwidth95 != null">avg_monthly_bandwidth_95 = #{avgMonthlyBandwidth95},</if>
|
||||||
<if test="outSpeed != null">out_speed = #{outSpeed},</if>
|
<if test="packageBandwidthDaily != null">package_bandwidth_daily = #{packageBandwidthDaily},</if>
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="customerId != null">customer_id = #{customerId},</if>
|
||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="customerName != null">customer_name = #{customerName},</if>
|
||||||
|
<if test="serviceNumber != null">service_number = #{serviceNumber},</if>
|
||||||
|
<if test="uplinkSwitch != null">uplink_switch = #{uplinkSwitch},</if>
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
<if test="switchName != null">switch_name = #{switchName},</if>
|
<if test="creatorId != null">creator_id = #{creatorId},</if>
|
||||||
<if test="interfaceDeviceType != null">interface_device_type = #{interfaceDeviceType},</if>
|
<if test="creatorName != null">creator_name = #{creatorName},</if>
|
||||||
<if test="serverName != null">server_name = #{serverName},</if>
|
|
||||||
<if test="serverPort != null">server_port = #{serverPort},</if>
|
|
||||||
<if test="serverSn != null">server_sn = #{serverSn},</if>
|
|
||||||
<if test="switchSn != null">switch_sn = #{switchSn},</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>
|
||||||
|
<if test="interfaceLinkDeviceType != null">interface_link_device_type = #{interfaceLinkDeviceType},</if>
|
||||||
|
<if test="effectiveBandwidth95Daily != null">effective_bandwidth_95_daily = #{effectiveBandwidth95Daily},</if>
|
||||||
|
<if test="effectiveBandwidth95Monthly != null">effective_bandwidth_95_monthly = #{effectiveBandwidth95Monthly},</if>
|
||||||
|
<if test="effectiveAvgMonthlyBandwidth95 != null">effective_avg_monthly_bandwidth_95 = #{effectiveAvgMonthlyBandwidth95},</if>
|
||||||
|
<if test="businessName != null">business_name = #{businessName},</if>
|
||||||
|
<if test="businessId != null">business_id = #{businessId},</if>
|
||||||
|
<if test="remark1 != null">remark1 = #{remark1},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deleteInitialSwitchInfoDetailsById" parameterType="Long">
|
<delete id="deleteEpsNodeBandwidthById" parameterType="Long">
|
||||||
delete from initial_switch_info_details where id = #{id}
|
delete from eps_node_bandwidth where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteInitialSwitchInfoDetailsByIds" parameterType="String">
|
<delete id="deleteEpsNodeBandwidthByIds" parameterType="String">
|
||||||
delete from initial_switch_info_details where id in
|
delete from eps_node_bandwidth where id in
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
@@ -176,6 +218,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
server_port,
|
server_port,
|
||||||
server_sn,
|
server_sn,
|
||||||
switch_sn,
|
switch_sn,
|
||||||
|
business_code,
|
||||||
|
business_name,
|
||||||
create_by,
|
create_by,
|
||||||
update_by,
|
update_by,
|
||||||
create_time,
|
create_time,
|
||||||
@@ -198,6 +242,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
#{item.serverPort},
|
#{item.serverPort},
|
||||||
#{item.serverSn},
|
#{item.serverSn},
|
||||||
#{item.switchSn},
|
#{item.switchSn},
|
||||||
|
#{item.businessCode},
|
||||||
|
#{item.businessName},
|
||||||
#{item.createBy},
|
#{item.createBy},
|
||||||
#{item.updateBy},
|
#{item.updateBy},
|
||||||
<choose>
|
<choose>
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import org.springframework.util.CollectionUtils;
|
|||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@@ -94,9 +95,6 @@ public class RocketMsgListener implements MessageListenerConcurrently {
|
|||||||
if (MessageCodeEnum.AGENT_MESSAGE_TOPIC.getCode().equals(topic)) {
|
if (MessageCodeEnum.AGENT_MESSAGE_TOPIC.getCode().equals(topic)) {
|
||||||
// 拿到信息
|
// 拿到信息
|
||||||
DeviceMessage message = JSON.parseObject(body, DeviceMessage.class);
|
DeviceMessage message = JSON.parseObject(body, DeviceMessage.class);
|
||||||
String duringTime = DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",message.getReceiveTime());
|
|
||||||
message.setDuringTime(duringTime);
|
|
||||||
message.setReceiveTime(DateUtils.dateTime("yyyy-MM-dd HH:mm:ss",duringTime));
|
|
||||||
switch (message.getDataType()){
|
switch (message.getDataType()){
|
||||||
case "NET":
|
case "NET":
|
||||||
handleNetMessage(message);
|
handleNetMessage(message);
|
||||||
@@ -164,18 +162,23 @@ public class RocketMsgListener implements MessageListenerConcurrently {
|
|||||||
private void handleNetMessage(DeviceMessage message) {
|
private void handleNetMessage(DeviceMessage message) {
|
||||||
List<InitialBandwidthTraffic> interfaces = JsonDataParser.parseJsonData(message.getData(), InitialBandwidthTraffic.class);
|
List<InitialBandwidthTraffic> interfaces = JsonDataParser.parseJsonData(message.getData(), InitialBandwidthTraffic.class);
|
||||||
if(!interfaces.isEmpty()){
|
if(!interfaces.isEmpty()){
|
||||||
|
// 时间戳转换
|
||||||
|
long timestamp = interfaces.get(0).getTimestamp();
|
||||||
|
long millis = timestamp < 1_000_000_000L ? timestamp * 1000 : timestamp;
|
||||||
|
Date createTime = new Date(millis / 1000 * 1000); // 去除毫秒
|
||||||
|
String timeStr = DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",createTime);
|
||||||
InitialBandwidthTraffic data = new InitialBandwidthTraffic();
|
InitialBandwidthTraffic data = new InitialBandwidthTraffic();
|
||||||
interfaces.forEach(iface -> {
|
interfaces.forEach(iface -> {
|
||||||
iface.setClientId(message.getClientId());
|
iface.setClientId(message.getClientId());
|
||||||
iface.setCreateTime(message.getReceiveTime());
|
iface.setCreateTime(createTime);
|
||||||
});
|
});
|
||||||
// 批量入库集合
|
// 批量入库集合
|
||||||
data.setList(interfaces);
|
data.setList(interfaces);
|
||||||
// 初始流量数据入库
|
// 初始流量数据入库
|
||||||
initialBandwidthTrafficService.batchInsert(data);
|
initialBandwidthTrafficService.batchInsert(data);
|
||||||
EpsInitialTrafficDataRemote epsInitialTrafficDataRemote = new EpsInitialTrafficDataRemote();
|
EpsInitialTrafficDataRemote epsInitialTrafficDataRemote = new EpsInitialTrafficDataRemote();
|
||||||
epsInitialTrafficDataRemote.setStartTime(message.getDuringTime());
|
epsInitialTrafficDataRemote.setStartTime(timeStr);
|
||||||
epsInitialTrafficDataRemote.setEndTime(message.getDuringTime());
|
epsInitialTrafficDataRemote.setEndTime(timeStr);
|
||||||
// 复制到业务初始库
|
// 复制到业务初始库
|
||||||
remoteRevenueConfigService.autoSaveServiceTrafficData(epsInitialTrafficDataRemote, SecurityConstants.INNER);
|
remoteRevenueConfigService.autoSaveServiceTrafficData(epsInitialTrafficDataRemote, SecurityConstants.INNER);
|
||||||
}else{
|
}else{
|
||||||
@@ -189,9 +192,13 @@ public class RocketMsgListener implements MessageListenerConcurrently {
|
|||||||
private void handleDockerMessage(DeviceMessage message) {
|
private void handleDockerMessage(DeviceMessage message) {
|
||||||
List<InitialDockerInfo> dockers = JsonDataParser.parseJsonData(message.getData(), InitialDockerInfo.class);
|
List<InitialDockerInfo> dockers = JsonDataParser.parseJsonData(message.getData(), InitialDockerInfo.class);
|
||||||
if(!dockers.isEmpty()){
|
if(!dockers.isEmpty()){
|
||||||
|
// 时间戳转换
|
||||||
|
long timestamp = dockers.get(0).getTimestamp();
|
||||||
|
long millis = timestamp < 1_000_000_000L ? timestamp * 1000 : timestamp;
|
||||||
|
Date createTime = new Date(millis / 1000 * 1000); // 去除毫秒
|
||||||
dockers.forEach(iface -> {
|
dockers.forEach(iface -> {
|
||||||
iface.setClientId(message.getClientId());
|
iface.setClientId(message.getClientId());
|
||||||
iface.setCreateTime(message.getReceiveTime());
|
iface.setCreateTime(createTime);
|
||||||
});
|
});
|
||||||
// 初始容器数据入库
|
// 初始容器数据入库
|
||||||
initialDockerInfoService.batchInsertInitialDockerInfo(dockers);
|
initialDockerInfoService.batchInsertInitialDockerInfo(dockers);
|
||||||
@@ -205,10 +212,14 @@ public class RocketMsgListener implements MessageListenerConcurrently {
|
|||||||
*/
|
*/
|
||||||
private void handleCpuMessage(DeviceMessage message) {
|
private void handleCpuMessage(DeviceMessage message) {
|
||||||
List<InitialCpuInfo> cpus = JsonDataParser.parseJsonData(message.getData(),InitialCpuInfo.class);
|
List<InitialCpuInfo> cpus = JsonDataParser.parseJsonData(message.getData(),InitialCpuInfo.class);
|
||||||
|
// 时间戳转换
|
||||||
|
long timestamp = cpus.get(0).getTimestamp();
|
||||||
|
long millis = timestamp < 1_000_000_000L ? timestamp * 1000 : timestamp;
|
||||||
|
Date createTime = new Date(millis / 1000 * 1000); // 去除毫秒
|
||||||
if(!cpus.isEmpty()){
|
if(!cpus.isEmpty()){
|
||||||
cpus.forEach(iface -> {
|
cpus.forEach(iface -> {
|
||||||
iface.setClientId(message.getClientId());
|
iface.setClientId(message.getClientId());
|
||||||
iface.setCreateTime(message.getReceiveTime());
|
iface.setCreateTime(createTime);
|
||||||
});
|
});
|
||||||
// 初始CPU数据入库
|
// 初始CPU数据入库
|
||||||
initialCpuInfoService.batchInsertInitialCpuInfo(cpus);
|
initialCpuInfoService.batchInsertInitialCpuInfo(cpus);
|
||||||
@@ -222,10 +233,14 @@ public class RocketMsgListener implements MessageListenerConcurrently {
|
|||||||
*/
|
*/
|
||||||
private void handleDiskMessage(DeviceMessage message) {
|
private void handleDiskMessage(DeviceMessage message) {
|
||||||
List<InitialDiskInfo> disks = JsonDataParser.parseJsonData(message.getData(), InitialDiskInfo.class);
|
List<InitialDiskInfo> disks = JsonDataParser.parseJsonData(message.getData(), InitialDiskInfo.class);
|
||||||
|
// 时间戳转换
|
||||||
|
long timestamp = disks.get(0).getTimestamp();
|
||||||
|
long millis = timestamp < 1_000_000_000L ? timestamp * 1000 : timestamp;
|
||||||
|
Date createTime = new Date(millis / 1000 * 1000); // 去除毫秒
|
||||||
if(!disks.isEmpty()){
|
if(!disks.isEmpty()){
|
||||||
disks.forEach(iface -> {
|
disks.forEach(iface -> {
|
||||||
iface.setClientId(message.getClientId());
|
iface.setClientId(message.getClientId());
|
||||||
iface.setCreateTime(message.getReceiveTime());
|
iface.setCreateTime(createTime);
|
||||||
});
|
});
|
||||||
// 初始磁盘数据入库
|
// 初始磁盘数据入库
|
||||||
initialDiskInfoService.batchInsertInitialDiskInfo(disks);
|
initialDiskInfoService.batchInsertInitialDiskInfo(disks);
|
||||||
@@ -240,9 +255,13 @@ public class RocketMsgListener implements MessageListenerConcurrently {
|
|||||||
private void handleMemoryMessage(DeviceMessage message) {
|
private void handleMemoryMessage(DeviceMessage message) {
|
||||||
List<InitialMemoryInfo> memorys = JsonDataParser.parseJsonData(message.getData(), InitialMemoryInfo.class);
|
List<InitialMemoryInfo> memorys = JsonDataParser.parseJsonData(message.getData(), InitialMemoryInfo.class);
|
||||||
if(!memorys.isEmpty()){
|
if(!memorys.isEmpty()){
|
||||||
|
// 时间戳转换
|
||||||
|
long timestamp = memorys.get(0).getTimestamp();
|
||||||
|
long millis = timestamp < 1_000_000_000L ? timestamp * 1000 : timestamp;
|
||||||
|
Date createTime = new Date(millis / 1000 * 1000); // 去除毫秒
|
||||||
memorys.forEach(iface -> {
|
memorys.forEach(iface -> {
|
||||||
iface.setClientId(message.getClientId());
|
iface.setClientId(message.getClientId());
|
||||||
iface.setCreateTime(message.getReceiveTime());
|
iface.setCreateTime(createTime);
|
||||||
});
|
});
|
||||||
// 初始内存数据入库
|
// 初始内存数据入库
|
||||||
initialMemoryInfoService.batchInsertInitialMemoryInfo(memorys);
|
initialMemoryInfoService.batchInsertInitialMemoryInfo(memorys);
|
||||||
@@ -257,9 +276,13 @@ public class RocketMsgListener implements MessageListenerConcurrently {
|
|||||||
private void handleMountPointMessage(DeviceMessage message) {
|
private void handleMountPointMessage(DeviceMessage message) {
|
||||||
List<InitialMountPointInfo> mountPointInfos = JsonDataParser.parseJsonData(message.getData(), InitialMountPointInfo.class);
|
List<InitialMountPointInfo> mountPointInfos = JsonDataParser.parseJsonData(message.getData(), InitialMountPointInfo.class);
|
||||||
if(!mountPointInfos.isEmpty()){
|
if(!mountPointInfos.isEmpty()){
|
||||||
|
// 时间戳转换
|
||||||
|
long timestamp = mountPointInfos.get(0).getTimestamp();
|
||||||
|
long millis = timestamp < 1_000_000_000L ? timestamp * 1000 : timestamp;
|
||||||
|
Date createTime = new Date(millis / 1000 * 1000); // 去除毫秒
|
||||||
mountPointInfos.forEach(iface -> {
|
mountPointInfos.forEach(iface -> {
|
||||||
iface.setClientId(message.getClientId());
|
iface.setClientId(message.getClientId());
|
||||||
iface.setCreateTime(message.getReceiveTime());
|
iface.setCreateTime(createTime);
|
||||||
});
|
});
|
||||||
// 初始挂载点数据入库
|
// 初始挂载点数据入库
|
||||||
initialMountPointInfoService.batchInsertInitialMountPointInfo(mountPointInfos);
|
initialMountPointInfoService.batchInsertInitialMountPointInfo(mountPointInfos);
|
||||||
@@ -274,6 +297,11 @@ public class RocketMsgListener implements MessageListenerConcurrently {
|
|||||||
private void handleSwitchMessage(DeviceMessage message) {
|
private void handleSwitchMessage(DeviceMessage message) {
|
||||||
List<InitialSwitchInfo> switchInfos = JsonDataParser.parseJsonData(message.getData(), InitialSwitchInfo.class);
|
List<InitialSwitchInfo> switchInfos = JsonDataParser.parseJsonData(message.getData(), InitialSwitchInfo.class);
|
||||||
if(!switchInfos.isEmpty()){
|
if(!switchInfos.isEmpty()){
|
||||||
|
// 时间戳转换
|
||||||
|
long timestamp = switchInfos.get(0).getTimestamp();
|
||||||
|
long millis = timestamp < 1_000_000_000L ? timestamp * 1000 : timestamp;
|
||||||
|
Date createTime = new Date(millis / 1000 * 1000); // 去除毫秒
|
||||||
|
String timeStr = DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",createTime);
|
||||||
// 查询临时表信息,计算实际流量值
|
// 查询临时表信息,计算实际流量值
|
||||||
InitialSwitchInfoTemp temp = new InitialSwitchInfoTemp();
|
InitialSwitchInfoTemp temp = new InitialSwitchInfoTemp();
|
||||||
temp.setClientId(message.getClientId());
|
temp.setClientId(message.getClientId());
|
||||||
@@ -293,7 +321,7 @@ public class RocketMsgListener implements MessageListenerConcurrently {
|
|||||||
// 3. 计算速度
|
// 3. 计算速度
|
||||||
switchInfos.forEach(switchInfo -> {
|
switchInfos.forEach(switchInfo -> {
|
||||||
switchInfo.setClientId(message.getClientId());
|
switchInfo.setClientId(message.getClientId());
|
||||||
switchInfo.setCreateTime(message.getReceiveTime());
|
switchInfo.setCreateTime(createTime);
|
||||||
InitialSwitchInfoTemp tempInfo = tempMap.get(switchInfo.getName());
|
InitialSwitchInfoTemp tempInfo = tempMap.get(switchInfo.getName());
|
||||||
if (tempInfo != null) {
|
if (tempInfo != null) {
|
||||||
// 计算inSpeed
|
// 计算inSpeed
|
||||||
@@ -319,8 +347,8 @@ public class RocketMsgListener implements MessageListenerConcurrently {
|
|||||||
// 业务表入库
|
// 业务表入库
|
||||||
InitialSwitchInfoDetailsRemote detailsRemote = new InitialSwitchInfoDetailsRemote();
|
InitialSwitchInfoDetailsRemote detailsRemote = new InitialSwitchInfoDetailsRemote();
|
||||||
detailsRemote.setClientId(message.getClientId());
|
detailsRemote.setClientId(message.getClientId());
|
||||||
detailsRemote.setStartTime(message.getDuringTime());
|
detailsRemote.setStartTime(timeStr);
|
||||||
detailsRemote.setEndTime(message.getDuringTime());
|
detailsRemote.setEndTime(timeStr);
|
||||||
remoteRevenueConfigService.autoSaveSwitchTraffic(detailsRemote, SecurityConstants.INNER);
|
remoteRevenueConfigService.autoSaveSwitchTraffic(detailsRemote, SecurityConstants.INNER);
|
||||||
}else{
|
}else{
|
||||||
throw new RuntimeException("交换机data数据为空");
|
throw new RuntimeException("交换机data数据为空");
|
||||||
@@ -333,9 +361,13 @@ public class RocketMsgListener implements MessageListenerConcurrently {
|
|||||||
private void handleSystemMessage(DeviceMessage message) {
|
private void handleSystemMessage(DeviceMessage message) {
|
||||||
List<InitialSystemInfo> systemInfos = JsonDataParser.parseJsonData(message.getData(), InitialSystemInfo.class);
|
List<InitialSystemInfo> systemInfos = JsonDataParser.parseJsonData(message.getData(), InitialSystemInfo.class);
|
||||||
if(!systemInfos.isEmpty()){
|
if(!systemInfos.isEmpty()){
|
||||||
|
// 时间戳转换
|
||||||
|
long timestamp = systemInfos.get(0).getTimestamp();
|
||||||
|
long millis = timestamp < 1_000_000_000L ? timestamp * 1000 : timestamp;
|
||||||
|
Date createTime = new Date(millis / 1000 * 1000); // 去除毫秒
|
||||||
systemInfos.forEach(iface -> {
|
systemInfos.forEach(iface -> {
|
||||||
iface.setClientId(message.getClientId());
|
iface.setClientId(message.getClientId());
|
||||||
iface.setCreateTime(message.getReceiveTime());
|
iface.setCreateTime(createTime);
|
||||||
});
|
});
|
||||||
// 初始系统数据入库
|
// 初始系统数据入库
|
||||||
initialSystemInfoService.batchInsertInitialSystemInfo(systemInfos);
|
initialSystemInfoService.batchInsertInitialSystemInfo(systemInfos);
|
||||||
|
|||||||
@@ -105,21 +105,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<insert id="insert" parameterType="InitialBandwidthTraffic">
|
<insert id="insert" parameterType="InitialBandwidthTraffic">
|
||||||
INSERT INTO ${tableName} (
|
INSERT INTO ${tableName} (
|
||||||
`name`, `mac`, `status`, `type`, ipV4, `in_dropped`, `out_dropped`,
|
`name`, `mac`, `status`, `type`, ipV4, `in_dropped`, `out_dropped`,
|
||||||
`in_speed`, `out_speed`, create_by, update_by, client_id
|
`in_speed`, `out_speed`, create_by, update_by, client_id, create_time
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{name}, #{mac}, #{status}, #{type}, #{ipV4}, #{inDropped}, #{outDropped},
|
#{name}, #{mac}, #{status}, #{type}, #{ipV4}, #{inDropped}, #{outDropped},
|
||||||
#{inSpeed}, #{outSpeed}, #{createBy}, #{updateBy}, #{clientId}
|
#{inSpeed}, #{outSpeed}, #{createBy}, #{updateBy}, #{clientId}, #{createTime}
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="batchInsert" parameterType="InitialBandwidthTraffic">
|
<insert id="batchInsert" parameterType="InitialBandwidthTraffic">
|
||||||
INSERT INTO ${tableName} (
|
INSERT INTO ${tableName} (
|
||||||
`name`, `mac`, `status`, `type`, ipV4, `in_dropped`, `out_dropped`,
|
`name`, `mac`, `status`, `type`, ipV4, `in_dropped`, `out_dropped`,
|
||||||
`in_speed`, `out_speed`,create_by, update_by, client_id
|
`in_speed`, `out_speed`,create_by, update_by, client_id, create_time
|
||||||
) VALUES
|
) VALUES
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(
|
(
|
||||||
#{item.name}, #{item.mac}, #{item.status}, #{item.type}, #{item.ipV4}, #{item.inDropped}, #{item.outDropped},
|
#{item.name}, #{item.mac}, #{item.status}, #{item.type}, #{item.ipV4}, #{item.inDropped}, #{item.outDropped},
|
||||||
#{item.inSpeed}, #{item.outSpeed}, #{item.createBy}, #{item.updateBy}, #{item.clientId}
|
#{item.inSpeed}, #{item.outSpeed}, #{item.createBy}, #{item.updateBy}, #{item.clientId}, #{item.createTime}
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|||||||
Reference in New Issue
Block a user