实时95值计算功能、优化服务器收益功能

This commit is contained in:
gaoyutao
2025-10-29 18:35:44 +08:00
parent 8c439013e1
commit 15ecd5caaf
22 changed files with 1606 additions and 71 deletions
@@ -198,13 +198,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getAllDeviceSn" parameterType="AllInterfaceName" resultType="AllInterfaceName">
SELECT
device_sn AS deviceSn
client_id AS clientId, interface_name interfaceName
FROM
all_interface_name
<where>
and resource_type = '1' and device_sn != ''
and resource_type = '1' and interface_name != ''
</where>
group by device_sn
group by interface_name
</select>
<select id="getAllSwitchSn" parameterType="AllInterfaceName" resultType="AllInterfaceName">
SELECT
@@ -248,4 +248,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateMachineTraffic" parameterType="EpsInitialTrafficData">
update ${tableName} set machine_flow=#{machineFlow} where client_id=#{clientId} and create_time=#{createTime}
</update>
<select id="getTrafficListByClientIds" resultType="EpsInitialTrafficData">
SELECT
sum(ifnull(out_speed,0)) AS outSpeed,
create_time AS createTime
FROM ${tableName}
<where>
<if test="businessId != '' and businessId != null">
and business_id = #{businessId}
</if>
<if test="startTime != null">
and create_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and create_time &lt;= #{endTime}
</if>
<if test="clientIds != '' and clientIds != null">
and client_id in
<foreach collection="clientIds.split(',')" item="clientId" open="(" separator="," close=")">
#{clientId}
</foreach>
</if>
</where>
group by create_time
ORDER BY out_speed desc
</select>
</mapper>
@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.EpsTaskStatisticsMapper">
<resultMap type="EpsTaskStatistics" id="EpsTaskStatisticsResult">
<result property="id" column="id" />
<result property="taskName" column="task_name" />
<result property="businessCode" column="business_code" />
<result property="businessName" column="business_name" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="percentile95" column="percentile_95" />
<result property="monthlyAvgPercentile95" column="monthly_avg_percentile_95" />
<result property="resourceType" column="resource_type" />
<result property="includedResources" column="included_resources" />
<result property="calculationType" column="calculation_type" />
<result property="calculationMode" column="calculation_mode" />
<result property="taskStatus" column="task_status" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectEpsTaskStatisticsVo">
select id, task_name, business_code, business_name, start_time, end_time, percentile_95, monthly_avg_percentile_95, resource_type, included_resources, calculation_type, calculation_mode, task_status, create_time, update_time, create_by, update_by from eps_task_statistics
</sql>
<select id="selectEpsTaskStatisticsList" parameterType="EpsTaskStatistics" resultMap="EpsTaskStatisticsResult">
<include refid="selectEpsTaskStatisticsVo"/>
<where>
<if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
<if test="startTime != null and startTime != ''"> and start_time = #{startTime}</if>
<if test="endTime != null and endTime != ''"> and end_time = #{endTime}</if>
<if test="percentile95 != null "> and percentile_95 = #{percentile95}</if>
<if test="monthlyAvgPercentile95 != null "> and monthly_avg_percentile_95 = #{monthlyAvgPercentile95}</if>
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</if>
<if test="includedResources != null and includedResources != ''"> and included_resources = #{includedResources}</if>
<if test="calculationType != null and calculationType != ''"> and calculation_type = #{calculationType}</if>
<if test="calculationMode != null and calculationMode != ''"> and calculation_mode = #{calculationMode}</if>
<if test="taskStatus != null and taskStatus != ''"> and task_status = #{taskStatus}</if>
</where>
</select>
<select id="selectEpsTaskStatisticsById" parameterType="Long" resultMap="EpsTaskStatisticsResult">
<include refid="selectEpsTaskStatisticsVo"/>
where id = #{id}
</select>
<insert id="insertEpsTaskStatistics" parameterType="EpsTaskStatistics" useGeneratedKeys="true" keyProperty="id">
insert into eps_task_statistics
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskName != null and taskName != ''">task_name,</if>
<if test="businessCode != null">business_code,</if>
<if test="businessName != null and businessName != ''">business_name,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="percentile95 != null">percentile_95,</if>
<if test="monthlyAvgPercentile95 != null">monthly_avg_percentile_95,</if>
<if test="resourceType != null">resource_type,</if>
<if test="includedResources != null">included_resources,</if>
<if test="calculationType != null">calculation_type,</if>
<if test="calculationMode != null">calculation_mode,</if>
<if test="taskStatus != null and taskStatus != ''">task_status,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskName != null and taskName != ''">#{taskName},</if>
<if test="businessCode != null">#{businessCode},</if>
<if test="businessName != null and businessName != ''">#{businessName},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="percentile95 != null">#{percentile95},</if>
<if test="monthlyAvgPercentile95 != null">#{monthlyAvgPercentile95},</if>
<if test="resourceType != null">#{resourceType},</if>
<if test="includedResources != null">#{includedResources},</if>
<if test="calculationType != null">#{calculationType},</if>
<if test="calculationMode != null">#{calculationMode},</if>
<if test="taskStatus != null and taskStatus != ''">#{taskStatus},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
</insert>
<update id="updateEpsTaskStatistics" parameterType="EpsTaskStatistics">
update eps_task_statistics
<trim prefix="SET" suffixOverrides=",">
<if test="taskName != null and taskName != ''">task_name = #{taskName},</if>
<if test="businessCode != null">business_code = #{businessCode},</if>
<if test="businessName != null and businessName != ''">business_name = #{businessName},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="percentile95 != null">percentile_95 = #{percentile95},</if>
<if test="monthlyAvgPercentile95 != null">monthly_avg_percentile_95 = #{monthlyAvgPercentile95},</if>
<if test="resourceType != null">resource_type = #{resourceType},</if>
<if test="includedResources != null">included_resources = #{includedResources},</if>
<if test="calculationType != null">calculation_type = #{calculationType},</if>
<if test="calculationMode != null">calculation_mode = #{calculationMode},</if>
<if test="taskStatus != null and taskStatus != ''">task_status = #{taskStatus},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEpsTaskStatisticsById" parameterType="Long">
delete from eps_task_statistics where id = #{id}
</delete>
<delete id="deleteEpsTaskStatisticsByIds" parameterType="String">
delete from eps_task_statistics where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
@@ -298,4 +298,56 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</foreach>
</insert>
<select id="getswitchDetailList" parameterType="InitialSwitchInfoDetails" resultType="InitialSwitchInfoDetails">
select in_speed inSpeed, out_speed outSpeed, create_time createTime from initial_switch_info_details
<where>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
<if test="name != null and name != ''"> and name = #{name}</if>
<if test="inBytes != null "> and in_bytes = #{inBytes}</if>
<if test="outBytes != null "> and out_bytes = #{outBytes}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="inSpeed != null "> and in_speed = #{inSpeed}</if>
<if test="outSpeed != null "> and out_speed = #{outSpeed}</if>
<if test="switchIp != null and switchIp != ''"> and switch_ip = #{switchIp}</if>
<if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</if>
<if test="interfaceDeviceType != null and interfaceDeviceType != ''"> and interface_device_type = #{interfaceDeviceType}</if>
<if test="serverName != null and serverName != ''"> and server_name like concat('%', #{serverName}, '%')</if>
<if test="serverPort != null and serverPort != ''"> and server_port = #{serverPort}</if>
<if test="serverSn != null and serverSn != ''"> and server_sn = #{serverSn}</if>
<if test="switchSn != null and switchSn != ''"> and switch_sn = #{switchSn}</if>
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
<if test="startTime != null">
and create_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and create_time &lt;= #{endTime}
</if>
</where>
</select>
<select id="sumSwitchTrafficByclientIds" parameterType="InitialSwitchInfoDetails" resultType="InitialSwitchInfoDetails">
select sum(ifnull(in_speed,0)) AS inSpeed,
sum(ifnull(out_speed,0)) AS outSpeed,
sum(ifnull(max_speed,0)) AS maxSpeed,
create_time createTime from initial_switch_info_details
<where>
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
<if test="startTime != null">
and create_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and create_time &lt;= #{endTime}
</if>
<if test="clientIds != '' and clientIds != null">
and client_id in
<foreach collection="clientIds.split(',')" item="clientId" open="(" separator="," close=")">
#{clientId}
</foreach>
</if>
</where>
group by create_time
ORDER BY max_speed desc
</select>
</mapper>