增加计算服务器平均流量方法、优化95值自动计算方法
This commit is contained in:
+4
@@ -122,6 +122,10 @@ public class EpsInitialTrafficData extends BaseEntity {
|
||||
private BigDecimal percentile95;
|
||||
/** 单位 */
|
||||
private String unit;
|
||||
/** 总接收带宽 */
|
||||
private String totalInSpeed;
|
||||
/** 总发送带宽 */
|
||||
private String totalOutSpeed;
|
||||
|
||||
|
||||
}
|
||||
+11
-1
@@ -674,7 +674,17 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
records.sort((r1, r2) -> r2.getCreateTime().compareTo(r1.getCreateTime()));
|
||||
|
||||
// 3. 计算各时间段95值
|
||||
calculateTimeSegments95(queryParam, records, dailyStartTime, dailyEndTime, calculationMode);
|
||||
// 获取所有不同的businessCode
|
||||
Set<String> businessCodes = records.stream()
|
||||
.map(EpsMethodChangeRecord::getBusinessCode)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 对每个businessCode计算全天的95带宽
|
||||
for (String businessCode : businessCodes) {
|
||||
// 设置当前要统计的业务代码(需要在queryParam或calculateSegment95中支持businessCode过滤)
|
||||
queryParam.setBusinessId(businessCode); // 假设queryParam有setBusinessCode方法
|
||||
calculateSegment95(queryParam, dailyStartTime, dailyEndTime, calculationMode);
|
||||
}
|
||||
}else{
|
||||
calculateNormalDeviceBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode);
|
||||
}
|
||||
|
||||
+3
-1
@@ -103,7 +103,9 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
||||
queryValue.equals(item.getMgmtIpv4Address()) ||
|
||||
|
||||
// 检查设备SN
|
||||
queryValue.equals(item.getHardwareSn()))
|
||||
queryValue.equals(item.getHardwareSn()) ||
|
||||
queryValue.equals(item.getClientId())
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
return filteredList;
|
||||
}
|
||||
|
||||
+44
-28
@@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<update id="createEpsTrafficTable">
|
||||
CREATE TABLE IF NOT EXISTS ${tableName} (
|
||||
id BIGINT(20) AUTO_INCREMENT COMMENT '唯一标识ID',
|
||||
`name` VARCHAR(100) COMMENT '接口名称',
|
||||
`name` VARCHAR(255) COMMENT '接口名称',
|
||||
`mac` VARCHAR(50) COMMENT 'MAC地址',
|
||||
`status` VARCHAR(20) COMMENT '运行状态',
|
||||
`type` VARCHAR(30) COMMENT '接口类型',
|
||||
@@ -16,6 +16,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
`out_dropped` DECIMAL(20,2) COMMENT '出站丢包率(%)',
|
||||
`in_speed` varchar(50) COMMENT '接收带宽(bit)',
|
||||
`out_speed` varchar(50) COMMENT '发送带宽(bit)',
|
||||
`total_in_speed` varchar(50) COMMENT '总接收带宽(bit)',
|
||||
`total_out_speed` varchar(50) COMMENT '总发送带宽(bit)',
|
||||
`machine_flow` varchar(50) COMMENT '金山带宽(bit)',
|
||||
`speed` varchar(100) COMMENT '协商速度',
|
||||
`duplex` varchar(100) COMMENT '工作模式',
|
||||
@@ -37,10 +39,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
INDEX idx_service_sn (service_sn)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='EPS设备流量初始数据表';
|
||||
</update>
|
||||
|
||||
<update id="createEpsInitialTrafficTable">
|
||||
CREATE TABLE IF NOT EXISTS ${tableName} (
|
||||
id BIGINT(20) AUTO_INCREMENT COMMENT '唯一标识ID',
|
||||
`name` VARCHAR(100) COMMENT '接口名称',
|
||||
`name` VARCHAR(255) COMMENT '接口名称',
|
||||
`mac` VARCHAR(20) COMMENT 'MAC地址',
|
||||
`status` VARCHAR(20) COMMENT '运行状态',
|
||||
`type` VARCHAR(30) COMMENT '接口类型',
|
||||
@@ -49,6 +52,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
`out_dropped` DECIMAL(20,2) COMMENT '出站丢包率(%)',
|
||||
`in_speed` VARCHAR(50) COMMENT '接收带宽(Mbps)',
|
||||
`out_speed` VARCHAR(50) COMMENT '发送带宽(Mbps)',
|
||||
`total_in_speed` VARCHAR(50) COMMENT '总接收带宽(Mbps)',
|
||||
`total_out_speed` VARCHAR(50) COMMENT '总发送带宽(Mbps)',
|
||||
`speed` varchar(100) COMMENT '协商速度',
|
||||
`duplex` varchar(100) COMMENT '工作模式',
|
||||
create_time DATETIME COMMENT '创建时间',
|
||||
@@ -61,6 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
INDEX idx_name_time (`name`,create_time)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='初始带宽流量表';
|
||||
</update>
|
||||
|
||||
<!-- 单条插入语句 -->
|
||||
<insert id="insert">
|
||||
INSERT INTO ${tableName} (
|
||||
@@ -73,6 +79,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
`out_dropped`,
|
||||
`in_speed`,
|
||||
`out_speed`,
|
||||
`total_in_speed`,
|
||||
`total_out_speed`,
|
||||
`speed`,
|
||||
`duplex`,
|
||||
business_id,
|
||||
@@ -94,6 +102,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{outDropped},
|
||||
#{inSpeed},
|
||||
#{outSpeed},
|
||||
#{totalInSpeed},
|
||||
#{totalOutSpeed},
|
||||
#{speed},
|
||||
#{duplex},
|
||||
#{businessId},
|
||||
@@ -121,6 +131,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
`out_dropped`,
|
||||
`in_speed`,
|
||||
`out_speed`,
|
||||
`total_in_speed`,
|
||||
`total_out_speed`,
|
||||
`speed`,
|
||||
`duplex`,
|
||||
business_id,
|
||||
@@ -147,6 +159,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{data.outDropped,jdbcType=DECIMAL},
|
||||
#{data.inSpeed,jdbcType=VARCHAR},
|
||||
#{data.outSpeed,jdbcType=VARCHAR},
|
||||
#{data.totalInSpeed,jdbcType=VARCHAR},
|
||||
#{data.totalOutSpeed,jdbcType=VARCHAR},
|
||||
#{data.speed,jdbcType=VARCHAR},
|
||||
#{data.duplex,jdbcType=VARCHAR},
|
||||
#{data.businessId,jdbcType=VARCHAR},
|
||||
@@ -167,30 +181,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<!-- 条件查询 -->
|
||||
<select id="selectByCondition" resultType="EpsInitialTrafficData">
|
||||
SELECT
|
||||
id,
|
||||
`name` AS name,
|
||||
`mac` AS mac,
|
||||
`status` AS status,
|
||||
`type` AS type,
|
||||
`ipV4` AS ipV4,
|
||||
`in_dropped` AS inDropped,
|
||||
`out_dropped` AS outDropped,
|
||||
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,
|
||||
business_name AS businessName,
|
||||
service_sn AS serviceSn,
|
||||
node_name AS nodeName,
|
||||
revenue_method AS revenueMethod,
|
||||
package_bandwidth AS packageBandwidth,
|
||||
create_time AS createTime,
|
||||
update_time AS updateTime,
|
||||
create_by AS createBy,
|
||||
update_by AS updateBy,
|
||||
client_id AS clientId
|
||||
id,
|
||||
`name` AS name,
|
||||
`mac` AS mac,
|
||||
`status` AS status,
|
||||
`type` AS type,
|
||||
`ipV4` AS ipV4,
|
||||
`in_dropped` AS inDropped,
|
||||
`out_dropped` AS outDropped,
|
||||
sum(ifnull(`in_speed`,0)) AS inSpeed,
|
||||
sum(ifnull(`out_speed`,0)) AS outSpeed,
|
||||
sum(ifnull(`total_in_speed`,0)) AS totalInSpeed,
|
||||
sum(ifnull(`total_out_speed`,0)) AS totalOutSpeed,
|
||||
`machine_flow` AS machineFlow,
|
||||
`speed` AS speed,
|
||||
`duplex` AS duplex,
|
||||
business_id AS businessId,
|
||||
business_name AS businessName,
|
||||
service_sn AS serviceSn,
|
||||
node_name AS nodeName,
|
||||
revenue_method AS revenueMethod,
|
||||
package_bandwidth AS packageBandwidth,
|
||||
create_time AS createTime,
|
||||
update_time AS updateTime,
|
||||
create_by AS createBy,
|
||||
update_by AS updateBy,
|
||||
client_id AS clientId
|
||||
FROM ${tableName}
|
||||
<where>
|
||||
<if test="serviceSn != '' and serviceSn != null">
|
||||
@@ -211,7 +227,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="revenueMethod != null">
|
||||
and revenue_method = #{revenueMethod}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
group BY create_time desc
|
||||
</select>
|
||||
@@ -229,6 +244,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
`out_dropped` AS outDropped,
|
||||
`in_speed` AS inSpeed,
|
||||
`out_speed` AS outSpeed,
|
||||
`total_in_speed` AS totalInSpeed,
|
||||
`total_out_speed` AS totalOutSpeed,
|
||||
`speed` AS speed,
|
||||
`duplex` AS duplex,
|
||||
create_time AS createTime,
|
||||
@@ -244,7 +261,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="endTime != null">
|
||||
and create_time <= #{endTime}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
ORDER BY create_time desc
|
||||
</select>
|
||||
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
package com.ruoyi.rocketmq.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.rocketmq.domain.InitialBandwidthTrafficTemp;
|
||||
import com.ruoyi.rocketmq.service.IInitialBandwidthTrafficTempService;
|
||||
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-11-05
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/trafficTemp")
|
||||
public class InitialBandwidthTrafficTempController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IInitialBandwidthTrafficTempService initialBandwidthTrafficTempService;
|
||||
|
||||
/**
|
||||
* 查询初始带宽流量临时表列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:trafficTemp:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(InitialBandwidthTrafficTemp initialBandwidthTrafficTemp)
|
||||
{
|
||||
startPage();
|
||||
List<InitialBandwidthTrafficTemp> list = initialBandwidthTrafficTempService.selectInitialBandwidthTrafficTempList(initialBandwidthTrafficTemp);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出初始带宽流量临时表列表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:trafficTemp:export")
|
||||
@Log(title = "初始带宽流量临时表", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, InitialBandwidthTrafficTemp initialBandwidthTrafficTemp)
|
||||
{
|
||||
List<InitialBandwidthTrafficTemp> list = initialBandwidthTrafficTempService.selectInitialBandwidthTrafficTempList(initialBandwidthTrafficTemp);
|
||||
ExcelUtil<InitialBandwidthTrafficTemp> util = new ExcelUtil<InitialBandwidthTrafficTemp>(InitialBandwidthTrafficTemp.class);
|
||||
util.exportExcel(response, list, "初始带宽流量临时表数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取初始带宽流量临时表详细信息
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:trafficTemp:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(initialBandwidthTrafficTempService.selectInitialBandwidthTrafficTempById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增初始带宽流量临时表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:trafficTemp:add")
|
||||
@Log(title = "初始带宽流量临时表", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody InitialBandwidthTrafficTemp initialBandwidthTrafficTemp)
|
||||
{
|
||||
return toAjax(initialBandwidthTrafficTempService.insertInitialBandwidthTrafficTemp(initialBandwidthTrafficTemp));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改初始带宽流量临时表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:trafficTemp:edit")
|
||||
@Log(title = "初始带宽流量临时表", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody InitialBandwidthTrafficTemp initialBandwidthTrafficTemp)
|
||||
{
|
||||
return toAjax(initialBandwidthTrafficTempService.updateInitialBandwidthTrafficTemp(initialBandwidthTrafficTemp));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除初始带宽流量临时表
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:trafficTemp:remove")
|
||||
@Log(title = "初始带宽流量临时表", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(initialBandwidthTrafficTempService.deleteInitialBandwidthTrafficTempByIds(ids));
|
||||
}
|
||||
}
|
||||
+11
-4
@@ -51,12 +51,12 @@ public class InitialBandwidthTraffic extends BaseEntity
|
||||
@Excel(name = "出站丢包率(%)")
|
||||
private BigDecimal outDropped;
|
||||
|
||||
/** 接收带宽(Mbps) */
|
||||
@Excel(name = "接收带宽(Mbps)")
|
||||
/** 接收带宽(bit) */
|
||||
@Excel(name = "接收带宽(bit)")
|
||||
private String inSpeed;
|
||||
|
||||
/** 发送带宽(Mbps) */
|
||||
@Excel(name = "发送带宽(Mbps)")
|
||||
/** 发送带宽(bit) */
|
||||
@Excel(name = "发送带宽(bit)")
|
||||
private String outSpeed;
|
||||
|
||||
/** 设备唯一标识 */
|
||||
@@ -74,5 +74,12 @@ public class InitialBandwidthTraffic extends BaseEntity
|
||||
private String endTime;
|
||||
/** 单位 */
|
||||
private String unit;
|
||||
/** 总接收带宽 */
|
||||
@Excel(name = "总接收带宽")
|
||||
private String totalInSpeed;
|
||||
|
||||
/** 总发送带宽 */
|
||||
@Excel(name = "总发送带宽")
|
||||
private String totalOutSpeed;
|
||||
|
||||
}
|
||||
|
||||
+252
@@ -0,0 +1,252 @@
|
||||
package com.ruoyi.rocketmq.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 初始带宽流量临时表对象 initial_bandwidth_traffic_temp
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-11-05
|
||||
*/
|
||||
public class InitialBandwidthTrafficTemp extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 唯一标识ID */
|
||||
private Long id;
|
||||
|
||||
/** 接口名称 */
|
||||
@Excel(name = "接口名称")
|
||||
private String name;
|
||||
|
||||
/** MAC地址 */
|
||||
@Excel(name = "MAC地址")
|
||||
private String mac;
|
||||
|
||||
/** 运行状态 */
|
||||
@Excel(name = "运行状态")
|
||||
private String status;
|
||||
|
||||
/** 接口类型 */
|
||||
@Excel(name = "接口类型")
|
||||
private String type;
|
||||
|
||||
/** IPv4地址 */
|
||||
@Excel(name = "IPv4地址")
|
||||
private String ipV4;
|
||||
|
||||
/** 入站丢包率(%) */
|
||||
@Excel(name = "入站丢包率(%)")
|
||||
private BigDecimal inDropped;
|
||||
|
||||
/** 出站丢包率(%) */
|
||||
@Excel(name = "出站丢包率(%)")
|
||||
private BigDecimal outDropped;
|
||||
|
||||
/** 接收带宽(big) */
|
||||
@Excel(name = "接收带宽(big)")
|
||||
private String inSpeed;
|
||||
|
||||
/** 发送带宽(bit) */
|
||||
@Excel(name = "发送带宽(bit)")
|
||||
private String outSpeed;
|
||||
|
||||
/** 协商速度 */
|
||||
@Excel(name = "协商速度")
|
||||
private String speed;
|
||||
|
||||
/** 工作模式 */
|
||||
@Excel(name = "工作模式")
|
||||
private String duplex;
|
||||
|
||||
/** 设备唯一标识 */
|
||||
@Excel(name = "设备唯一标识")
|
||||
private String clientId;
|
||||
|
||||
/** 总接收带宽(bit) */
|
||||
@Excel(name = "总接收带宽(bit)")
|
||||
private String totalInSpeed;
|
||||
|
||||
/** 总发送带宽(bit) */
|
||||
@Excel(name = "总发送带宽(bit)")
|
||||
private String totalOutSpeed;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setMac(String mac)
|
||||
{
|
||||
this.mac = mac;
|
||||
}
|
||||
|
||||
public String getMac()
|
||||
{
|
||||
return mac;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setIpV4(String ipV4)
|
||||
{
|
||||
this.ipV4 = ipV4;
|
||||
}
|
||||
|
||||
public String getIpV4()
|
||||
{
|
||||
return ipV4;
|
||||
}
|
||||
|
||||
public void setInDropped(BigDecimal inDropped)
|
||||
{
|
||||
this.inDropped = inDropped;
|
||||
}
|
||||
|
||||
public BigDecimal getInDropped()
|
||||
{
|
||||
return inDropped;
|
||||
}
|
||||
|
||||
public void setOutDropped(BigDecimal outDropped)
|
||||
{
|
||||
this.outDropped = outDropped;
|
||||
}
|
||||
|
||||
public BigDecimal getOutDropped()
|
||||
{
|
||||
return outDropped;
|
||||
}
|
||||
|
||||
public void setInSpeed(String inSpeed)
|
||||
{
|
||||
this.inSpeed = inSpeed;
|
||||
}
|
||||
|
||||
public String getInSpeed()
|
||||
{
|
||||
return inSpeed;
|
||||
}
|
||||
|
||||
public void setOutSpeed(String outSpeed)
|
||||
{
|
||||
this.outSpeed = outSpeed;
|
||||
}
|
||||
|
||||
public String getOutSpeed()
|
||||
{
|
||||
return outSpeed;
|
||||
}
|
||||
|
||||
public void setSpeed(String speed)
|
||||
{
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public String getSpeed()
|
||||
{
|
||||
return speed;
|
||||
}
|
||||
|
||||
public void setDuplex(String duplex)
|
||||
{
|
||||
this.duplex = duplex;
|
||||
}
|
||||
|
||||
public String getDuplex()
|
||||
{
|
||||
return duplex;
|
||||
}
|
||||
|
||||
public void setClientId(String clientId)
|
||||
{
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public String getClientId()
|
||||
{
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setTotalInSpeed(String totalInSpeed)
|
||||
{
|
||||
this.totalInSpeed = totalInSpeed;
|
||||
}
|
||||
|
||||
public String getTotalInSpeed()
|
||||
{
|
||||
return totalInSpeed;
|
||||
}
|
||||
|
||||
public void setTotalOutSpeed(String totalOutSpeed)
|
||||
{
|
||||
this.totalOutSpeed = totalOutSpeed;
|
||||
}
|
||||
|
||||
public String getTotalOutSpeed()
|
||||
{
|
||||
return totalOutSpeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("mac", getMac())
|
||||
.append("status", getStatus())
|
||||
.append("type", getType())
|
||||
.append("ipV4", getIpV4())
|
||||
.append("inDropped", getInDropped())
|
||||
.append("outDropped", getOutDropped())
|
||||
.append("inSpeed", getInSpeed())
|
||||
.append("outSpeed", getOutSpeed())
|
||||
.append("speed", getSpeed())
|
||||
.append("duplex", getDuplex())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("clientId", getClientId())
|
||||
.append("totalInSpeed", getTotalInSpeed())
|
||||
.append("totalOutSpeed", getTotalOutSpeed())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -27,8 +27,12 @@ import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 设备消息处理器
|
||||
@@ -81,6 +85,8 @@ public class MessageHandler {
|
||||
private IRmMonitorPolicyService rmMonitorPolicyService;
|
||||
@Autowired
|
||||
private IRmDeploymentPolicyService rmDeploymentPolicyService;
|
||||
@Autowired
|
||||
private IInitialBandwidthTrafficTempService initialBandwidthTrafficTempService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -631,22 +637,88 @@ public class MessageHandler {
|
||||
private void handleNetMessage(DeviceMessage message) {
|
||||
List<InitialBandwidthTraffic> interfaces = JsonDataParser.parseJsonData(message.getData(), InitialBandwidthTraffic.class);
|
||||
if(!interfaces.isEmpty()){
|
||||
String clientId = message.getClientId();
|
||||
// 时间戳转换
|
||||
long timestamp = interfaces.get(0).getTimestamp();
|
||||
long millis = timestamp * 1000;
|
||||
Date createTime = new Date(millis / 1000 * 1000); // 去除毫秒
|
||||
String timeStr = DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",createTime);
|
||||
// 创建比timestamp少5分钟的时间
|
||||
long fiveMinutesEarlier = millis - (5 * 60 * 1000); // 减去5分钟的毫秒数
|
||||
Date fiveMinutesEarlierDate = new Date(fiveMinutesEarlier / 1000 * 1000); // 同样去除毫秒
|
||||
// 查询临时表信息,计算实际流量值
|
||||
InitialBandwidthTrafficTemp temp = new InitialBandwidthTrafficTemp();
|
||||
temp.setCreateTime(fiveMinutesEarlierDate);
|
||||
temp.setClientId(clientId);
|
||||
List<InitialBandwidthTrafficTemp> tempList = initialBandwidthTrafficTempService.selectInitialBandwidthTrafficTempList(temp);
|
||||
if(!tempList.isEmpty()){
|
||||
// 1. 构建快速查找的Map
|
||||
Map<String, InitialBandwidthTrafficTemp> tempMap = tempList.stream()
|
||||
.collect(Collectors.toMap(
|
||||
InitialBandwidthTrafficTemp::getMac,
|
||||
Function.identity(),
|
||||
(existing, replacement) -> existing
|
||||
));
|
||||
|
||||
// 2. 预计算除数(避免重复创建对象)
|
||||
BigDecimal divisor = new BigDecimal(300);
|
||||
|
||||
interfaces.forEach(iface -> {
|
||||
iface.setClientId(clientId);
|
||||
iface.setCreateTime(createTime);
|
||||
// 发送流量
|
||||
iface.setTotalOutSpeed(dataProcessUtil.bytesToBits(iface.getOutSpeed()));
|
||||
// 接收流量
|
||||
iface.setTotalInSpeed(dataProcessUtil.bytesToBits(iface.getInSpeed()));
|
||||
InitialBandwidthTrafficTemp tempInfo = tempMap.get(iface.getMac());
|
||||
if (tempInfo != null) {
|
||||
// 计算inSpeed
|
||||
if (iface.getTotalInSpeed() != null && tempInfo.getTotalInSpeed() != null) {
|
||||
BigDecimal nowInSpeed = new BigDecimal(iface.getTotalInSpeed());
|
||||
BigDecimal tempInSpeed = new BigDecimal(tempInfo.getTotalInSpeed());
|
||||
BigDecimal inDiff = nowInSpeed.subtract(tempInSpeed);
|
||||
|
||||
// 检查相减结果是否为非负数
|
||||
if (inDiff.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
iface.setInSpeed(inDiff.divide(divisor, 2, RoundingMode.HALF_UP).toString());
|
||||
}else{
|
||||
iface.setInSpeed(null);
|
||||
}
|
||||
}
|
||||
// 计算outSpeed
|
||||
if (iface.getTotalOutSpeed() != null && tempInfo.getTotalOutSpeed() != null) {
|
||||
BigDecimal nowOutSpeed = new BigDecimal(iface.getTotalOutSpeed());
|
||||
BigDecimal tempOutSpeed = new BigDecimal(tempInfo.getTotalOutSpeed());
|
||||
BigDecimal outDiff = nowOutSpeed.subtract(tempOutSpeed);
|
||||
|
||||
// 检查相减结果是否为非负数
|
||||
if (outDiff.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
iface.setOutSpeed(outDiff.divide(divisor, 2, RoundingMode.HALF_UP).toString());
|
||||
}else{
|
||||
iface.setOutSpeed(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
// 清空临时表对应server信息
|
||||
initialBandwidthTrafficTempService.deleteTempMsgByClientId(clientId);
|
||||
}else{
|
||||
interfaces.forEach(iface -> {
|
||||
iface.setClientId(clientId);
|
||||
iface.setCreateTime(createTime);
|
||||
iface.setInSpeed(null);
|
||||
iface.setOutSpeed(null);
|
||||
// 总发送流量
|
||||
iface.setTotalOutSpeed(dataProcessUtil.bytesToBits(iface.getOutSpeed()));
|
||||
// 总接收流量
|
||||
iface.setTotalInSpeed(dataProcessUtil.bytesToBits(iface.getInSpeed()));
|
||||
});
|
||||
}
|
||||
InitialBandwidthTraffic data = new InitialBandwidthTraffic();
|
||||
interfaces.forEach(iface -> {
|
||||
iface.setClientId(message.getClientId());
|
||||
iface.setCreateTime(createTime);
|
||||
// 发送流量
|
||||
iface.setOutSpeed(dataProcessUtil.bytesToBits(iface.getOutSpeed()));
|
||||
// 接收流量
|
||||
iface.setInSpeed(dataProcessUtil.bytesToBits(iface.getInSpeed()));
|
||||
});
|
||||
// 批量入库集合
|
||||
data.setList(interfaces);
|
||||
// 临时表 用来计算inSpeed outSeppd
|
||||
initialBandwidthTrafficTempService.batchInsertServerTemp(interfaces);
|
||||
// 初始流量数据入库
|
||||
initialBandwidthTrafficService.batchInsert(data);
|
||||
EpsInitialTrafficDataRemote epsInitialTrafficDataRemote = new EpsInitialTrafficDataRemote();
|
||||
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package com.ruoyi.rocketmq.mapper;
|
||||
|
||||
import com.ruoyi.rocketmq.domain.InitialBandwidthTraffic;
|
||||
import com.ruoyi.rocketmq.domain.InitialBandwidthTrafficTemp;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 初始带宽流量临时表Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-11-05
|
||||
*/
|
||||
public interface InitialBandwidthTrafficTempMapper
|
||||
{
|
||||
/**
|
||||
* 查询初始带宽流量临时表
|
||||
*
|
||||
* @param id 初始带宽流量临时表主键
|
||||
* @return 初始带宽流量临时表
|
||||
*/
|
||||
public InitialBandwidthTrafficTemp selectInitialBandwidthTrafficTempById(Long id);
|
||||
|
||||
/**
|
||||
* 查询初始带宽流量临时表列表
|
||||
*
|
||||
* @param initialBandwidthTrafficTemp 初始带宽流量临时表
|
||||
* @return 初始带宽流量临时表集合
|
||||
*/
|
||||
public List<InitialBandwidthTrafficTemp> selectInitialBandwidthTrafficTempList(InitialBandwidthTrafficTemp initialBandwidthTrafficTemp);
|
||||
|
||||
/**
|
||||
* 新增初始带宽流量临时表
|
||||
*
|
||||
* @param initialBandwidthTrafficTemp 初始带宽流量临时表
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertInitialBandwidthTrafficTemp(InitialBandwidthTrafficTemp initialBandwidthTrafficTemp);
|
||||
|
||||
/**
|
||||
* 修改初始带宽流量临时表
|
||||
*
|
||||
* @param initialBandwidthTrafficTemp 初始带宽流量临时表
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateInitialBandwidthTrafficTemp(InitialBandwidthTrafficTemp initialBandwidthTrafficTemp);
|
||||
|
||||
/**
|
||||
* 删除初始带宽流量临时表
|
||||
*
|
||||
* @param id 初始带宽流量临时表主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteInitialBandwidthTrafficTempById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除初始带宽流量临时表
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteInitialBandwidthTrafficTempByIds(Long[] ids);
|
||||
|
||||
int deleteTempMsgByClientId(String clientId);
|
||||
|
||||
/**
|
||||
* 批量新增
|
||||
* @param interfaces
|
||||
* @return
|
||||
*/
|
||||
int batchInsertServerTemp(@Param("list") List<InitialBandwidthTraffic> interfaces);
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
package com.ruoyi.rocketmq.service;
|
||||
|
||||
import com.ruoyi.rocketmq.domain.InitialBandwidthTraffic;
|
||||
import com.ruoyi.rocketmq.domain.InitialBandwidthTrafficTemp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 初始带宽流量临时表Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-11-05
|
||||
*/
|
||||
public interface IInitialBandwidthTrafficTempService
|
||||
{
|
||||
/**
|
||||
* 查询初始带宽流量临时表
|
||||
*
|
||||
* @param id 初始带宽流量临时表主键
|
||||
* @return 初始带宽流量临时表
|
||||
*/
|
||||
public InitialBandwidthTrafficTemp selectInitialBandwidthTrafficTempById(Long id);
|
||||
|
||||
/**
|
||||
* 查询初始带宽流量临时表列表
|
||||
*
|
||||
* @param initialBandwidthTrafficTemp 初始带宽流量临时表
|
||||
* @return 初始带宽流量临时表集合
|
||||
*/
|
||||
public List<InitialBandwidthTrafficTemp> selectInitialBandwidthTrafficTempList(InitialBandwidthTrafficTemp initialBandwidthTrafficTemp);
|
||||
|
||||
/**
|
||||
* 新增初始带宽流量临时表
|
||||
*
|
||||
* @param initialBandwidthTrafficTemp 初始带宽流量临时表
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertInitialBandwidthTrafficTemp(InitialBandwidthTrafficTemp initialBandwidthTrafficTemp);
|
||||
|
||||
/**
|
||||
* 修改初始带宽流量临时表
|
||||
*
|
||||
* @param initialBandwidthTrafficTemp 初始带宽流量临时表
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateInitialBandwidthTrafficTemp(InitialBandwidthTrafficTemp initialBandwidthTrafficTemp);
|
||||
|
||||
/**
|
||||
* 批量删除初始带宽流量临时表
|
||||
*
|
||||
* @param ids 需要删除的初始带宽流量临时表主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteInitialBandwidthTrafficTempByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除初始带宽流量临时表信息
|
||||
*
|
||||
* @param id 初始带宽流量临时表主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteInitialBandwidthTrafficTempById(Long id);
|
||||
|
||||
/**
|
||||
* 根据clientId删除信息
|
||||
* @param clientId
|
||||
* @return
|
||||
*/
|
||||
int deleteTempMsgByClientId(String clientId);
|
||||
|
||||
/**
|
||||
* 批量新增临时表信息
|
||||
* @param interfaces
|
||||
* @return
|
||||
*/
|
||||
int batchInsertServerTemp(List<InitialBandwidthTraffic> interfaces);
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
package com.ruoyi.rocketmq.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.rocketmq.domain.InitialBandwidthTraffic;
|
||||
import com.ruoyi.rocketmq.domain.InitialBandwidthTrafficTemp;
|
||||
import com.ruoyi.rocketmq.mapper.InitialBandwidthTrafficTempMapper;
|
||||
import com.ruoyi.rocketmq.service.IInitialBandwidthTrafficTempService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 初始带宽流量临时表Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-11-05
|
||||
*/
|
||||
@Service
|
||||
public class InitialBandwidthTrafficTempServiceImpl implements IInitialBandwidthTrafficTempService
|
||||
{
|
||||
@Autowired
|
||||
private InitialBandwidthTrafficTempMapper initialBandwidthTrafficTempMapper;
|
||||
|
||||
/**
|
||||
* 查询初始带宽流量临时表
|
||||
*
|
||||
* @param id 初始带宽流量临时表主键
|
||||
* @return 初始带宽流量临时表
|
||||
*/
|
||||
@Override
|
||||
public InitialBandwidthTrafficTemp selectInitialBandwidthTrafficTempById(Long id)
|
||||
{
|
||||
return initialBandwidthTrafficTempMapper.selectInitialBandwidthTrafficTempById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询初始带宽流量临时表列表
|
||||
*
|
||||
* @param initialBandwidthTrafficTemp 初始带宽流量临时表
|
||||
* @return 初始带宽流量临时表
|
||||
*/
|
||||
@Override
|
||||
public List<InitialBandwidthTrafficTemp> selectInitialBandwidthTrafficTempList(InitialBandwidthTrafficTemp initialBandwidthTrafficTemp)
|
||||
{
|
||||
return initialBandwidthTrafficTempMapper.selectInitialBandwidthTrafficTempList(initialBandwidthTrafficTemp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增初始带宽流量临时表
|
||||
*
|
||||
* @param initialBandwidthTrafficTemp 初始带宽流量临时表
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertInitialBandwidthTrafficTemp(InitialBandwidthTrafficTemp initialBandwidthTrafficTemp)
|
||||
{
|
||||
initialBandwidthTrafficTemp.setCreateTime(DateUtils.getNowDate());
|
||||
return initialBandwidthTrafficTempMapper.insertInitialBandwidthTrafficTemp(initialBandwidthTrafficTemp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改初始带宽流量临时表
|
||||
*
|
||||
* @param initialBandwidthTrafficTemp 初始带宽流量临时表
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateInitialBandwidthTrafficTemp(InitialBandwidthTrafficTemp initialBandwidthTrafficTemp)
|
||||
{
|
||||
initialBandwidthTrafficTemp.setUpdateTime(DateUtils.getNowDate());
|
||||
return initialBandwidthTrafficTempMapper.updateInitialBandwidthTrafficTemp(initialBandwidthTrafficTemp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除初始带宽流量临时表
|
||||
*
|
||||
* @param ids 需要删除的初始带宽流量临时表主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteInitialBandwidthTrafficTempByIds(Long[] ids)
|
||||
{
|
||||
return initialBandwidthTrafficTempMapper.deleteInitialBandwidthTrafficTempByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除初始带宽流量临时表信息
|
||||
*
|
||||
* @param id 初始带宽流量临时表主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteInitialBandwidthTrafficTempById(Long id)
|
||||
{
|
||||
return initialBandwidthTrafficTempMapper.deleteInitialBandwidthTrafficTempById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteTempMsgByClientId(String clientId) {
|
||||
return initialBandwidthTrafficTempMapper.deleteTempMsgByClientId(clientId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchInsertServerTemp(List<InitialBandwidthTraffic> interfaces) {
|
||||
return initialBandwidthTrafficTempMapper.batchInsertServerTemp(interfaces);
|
||||
}
|
||||
}
|
||||
+14
-6
@@ -107,28 +107,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<insert id="insert" parameterType="InitialBandwidthTraffic">
|
||||
INSERT INTO ${tableName} (
|
||||
`name`, `mac`, `status`, `type`, ipV4, `in_dropped`, `out_dropped`,
|
||||
`in_speed`, `out_speed`, duplex, speed, create_by, update_by, client_id, create_time
|
||||
`in_speed`, `out_speed`, `total_in_speed`, `total_out_speed`, duplex, speed,
|
||||
create_by, update_by, client_id, create_time
|
||||
) VALUES (
|
||||
#{name}, #{mac}, #{status}, #{type}, #{ipV4}, #{inDropped}, #{outDropped},
|
||||
#{inSpeed}, #{outSpeed}, #{duplex}, #{speed}, #{createBy}, #{updateBy}, #{clientId}, #{createTime}
|
||||
#{inSpeed}, #{outSpeed}, #{totalInSpeed}, #{totalOutSpeed}, #{duplex}, #{speed},
|
||||
#{createBy}, #{updateBy}, #{clientId}, #{createTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsert" parameterType="InitialBandwidthTraffic">
|
||||
INSERT IGNORE INTO ${tableName} (
|
||||
`name`, `mac`, `status`, `type`, ipV4, `in_dropped`, `out_dropped`,
|
||||
`in_speed`, `out_speed`,duplex, speed, create_by, update_by, client_id, create_time
|
||||
`in_speed`, `out_speed`, `total_in_speed`, `total_out_speed`, duplex, speed,
|
||||
create_by, update_by, client_id, create_time
|
||||
) VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.name}, #{item.mac}, #{item.status}, #{item.type}, #{item.ipV4}, #{item.inDropped}, #{item.outDropped},
|
||||
#{item.inSpeed}, #{item.outSpeed}, #{item.duplex}, #{item.speed}, #{item.createBy}, #{item.updateBy}, #{item.clientId}, #{item.createTime}
|
||||
#{item.inSpeed}, #{item.outSpeed}, #{item.totalInSpeed}, #{item.totalOutSpeed}, #{item.duplex}, #{item.speed},
|
||||
#{item.createBy}, #{item.updateBy}, #{item.clientId}, #{item.createTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="getNetInterfaceDetailsMsg" parameterType="InitialBandwidthTraffic" resultMap="InitialBandwidthTrafficResult">
|
||||
select id, `name`, mac, status, `type`, ipV4, in_dropped, out_dropped, in_speed, out_speed,
|
||||
create_time, update_time, create_by, update_by, client_id, duplex, speed
|
||||
total_in_speed, total_out_speed, create_time, update_time, create_by, update_by,
|
||||
client_id, duplex, speed
|
||||
from ${tableName}
|
||||
<where>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
@@ -137,9 +143,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
order by create_time desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="getNetTrafficList" parameterType="InitialBandwidthTraffic" resultMap="InitialBandwidthTrafficResult">
|
||||
select id, `name`, mac, status, `type`, ipV4, in_dropped, out_dropped, in_speed, out_speed,
|
||||
create_time, update_time, create_by, update_by, client_id, duplex, speed
|
||||
total_in_speed, total_out_speed, create_time, update_time, create_by, update_by,
|
||||
client_id, duplex, speed
|
||||
from ${tableName}
|
||||
<where>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.rocketmq.mapper.InitialBandwidthTrafficTempMapper">
|
||||
|
||||
<resultMap type="InitialBandwidthTrafficTemp" id="InitialBandwidthTrafficTempResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="mac" column="mac" />
|
||||
<result property="status" column="status" />
|
||||
<result property="type" column="type" />
|
||||
<result property="ipV4" column="ipV4" />
|
||||
<result property="inDropped" column="in_dropped" />
|
||||
<result property="outDropped" column="out_dropped" />
|
||||
<result property="inSpeed" column="in_speed" />
|
||||
<result property="outSpeed" column="out_speed" />
|
||||
<result property="speed" column="speed" />
|
||||
<result property="duplex" column="duplex" />
|
||||
<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" />
|
||||
<result property="totalInSpeed" column="total_in_speed" />
|
||||
<result property="totalOutSpeed" column="total_out_speed" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectInitialBandwidthTrafficTempVo">
|
||||
select id, name, mac, status, type, ipV4, in_dropped, out_dropped, in_speed, out_speed, speed, duplex, create_time, update_time, create_by, update_by, client_id, total_in_speed, total_out_speed from initial_bandwidth_traffic_temp
|
||||
</sql>
|
||||
|
||||
<select id="selectInitialBandwidthTrafficTempList" parameterType="InitialBandwidthTrafficTemp" resultMap="InitialBandwidthTrafficTempResult">
|
||||
<include refid="selectInitialBandwidthTrafficTempVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="mac != null and mac != ''"> and mac = #{mac}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||
<if test="ipV4 != null and ipV4 != ''"> and ipV4 = #{ipV4}</if>
|
||||
<if test="inDropped != null "> and in_dropped = #{inDropped}</if>
|
||||
<if test="outDropped != null "> and out_dropped = #{outDropped}</if>
|
||||
<if test="inSpeed != null and inSpeed != ''"> and in_speed = #{inSpeed}</if>
|
||||
<if test="outSpeed != null and outSpeed != ''"> and out_speed = #{outSpeed}</if>
|
||||
<if test="speed != null and speed != ''"> and speed = #{speed}</if>
|
||||
<if test="duplex != null and duplex != ''"> and duplex = #{duplex}</if>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
<if test="totalInSpeed != null and totalInSpeed != ''"> and total_in_speed = #{totalInSpeed}</if>
|
||||
<if test="totalOutSpeed != null and totalOutSpeed != ''"> and total_out_speed = #{totalOutSpeed}</if>
|
||||
<if test="createTime != null"> and create_time = #{createTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectInitialBandwidthTrafficTempById" parameterType="Long" resultMap="InitialBandwidthTrafficTempResult">
|
||||
<include refid="selectInitialBandwidthTrafficTempVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertInitialBandwidthTrafficTemp" parameterType="InitialBandwidthTrafficTemp" useGeneratedKeys="true" keyProperty="id">
|
||||
insert IGNORE into initial_bandwidth_traffic_temp
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">name,</if>
|
||||
<if test="mac != null">mac,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="ipV4 != null">ipV4,</if>
|
||||
<if test="inDropped != null">in_dropped,</if>
|
||||
<if test="outDropped != null">out_dropped,</if>
|
||||
<if test="inSpeed != null">in_speed,</if>
|
||||
<if test="outSpeed != null">out_speed,</if>
|
||||
<if test="speed != null">speed,</if>
|
||||
<if test="duplex != null">duplex,</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>
|
||||
<if test="totalInSpeed != null">total_in_speed,</if>
|
||||
<if test="totalOutSpeed != null">total_out_speed,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="mac != null">#{mac},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="ipV4 != null">#{ipV4},</if>
|
||||
<if test="inDropped != null">#{inDropped},</if>
|
||||
<if test="outDropped != null">#{outDropped},</if>
|
||||
<if test="inSpeed != null">#{inSpeed},</if>
|
||||
<if test="outSpeed != null">#{outSpeed},</if>
|
||||
<if test="speed != null">#{speed},</if>
|
||||
<if test="duplex != null">#{duplex},</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>
|
||||
<if test="totalInSpeed != null">#{totalInSpeed},</if>
|
||||
<if test="totalOutSpeed != null">#{totalOutSpeed},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateInitialBandwidthTrafficTemp" parameterType="InitialBandwidthTrafficTemp">
|
||||
update initial_bandwidth_traffic_temp
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="mac != null">mac = #{mac},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="ipV4 != null">ipV4 = #{ipV4},</if>
|
||||
<if test="inDropped != null">in_dropped = #{inDropped},</if>
|
||||
<if test="outDropped != null">out_dropped = #{outDropped},</if>
|
||||
<if test="inSpeed != null">in_speed = #{inSpeed},</if>
|
||||
<if test="outSpeed != null">out_speed = #{outSpeed},</if>
|
||||
<if test="speed != null">speed = #{speed},</if>
|
||||
<if test="duplex != null">duplex = #{duplex},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="clientId != null">client_id = #{clientId},</if>
|
||||
<if test="totalInSpeed != null">total_in_speed = #{totalInSpeed},</if>
|
||||
<if test="totalOutSpeed != null">total_out_speed = #{totalOutSpeed},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteInitialBandwidthTrafficTempById" parameterType="Long">
|
||||
delete from initial_bandwidth_traffic_temp where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteInitialBandwidthTrafficTempByIds" parameterType="String">
|
||||
delete from initial_bandwidth_traffic_temp where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="deleteTempMsgByClientId" parameterType="String">
|
||||
delete from initial_bandwidth_traffic_temp where client_id = #{clientId}
|
||||
</delete>
|
||||
|
||||
<insert id="batchInsertServerTemp" parameterType="java.util.List">
|
||||
insert IGNORE into initial_bandwidth_traffic_temp
|
||||
(
|
||||
name, mac, status, type, ipV4, in_dropped, out_dropped,
|
||||
in_speed, out_speed, speed, duplex, create_time, update_time,
|
||||
create_by, update_by, client_id, total_in_speed, total_out_speed
|
||||
)
|
||||
values
|
||||
<foreach collection="list" item="item" index="index" separator=",">
|
||||
(
|
||||
#{item.name}, #{item.mac}, #{item.status}, #{item.type}, #{item.ipV4},
|
||||
#{item.inDropped}, #{item.outDropped}, #{item.inSpeed}, #{item.outSpeed},
|
||||
#{item.speed}, #{item.duplex}, #{item.createTime}, #{item.updateTime},
|
||||
#{item.createBy}, #{item.updateBy}, #{item.clientId}, #{item.totalInSpeed},
|
||||
#{item.totalOutSpeed}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user