优化95值计算相关数据查看

This commit is contained in:
gaoyutao
2026-01-27 11:27:55 +08:00
parent 5dd1b90acb
commit 3ef0aacf0c
7 changed files with 55 additions and 4 deletions
@@ -129,5 +129,7 @@ public class EpsNodeBandwidth extends BaseEntity
private Long monitorId;
/** 服务器id \n 分割 */
private String clientIds;
/** mac 地址 */
private String macAddress;
}
@@ -1,8 +1,9 @@
package com.tongran.system.mapper;
import java.util.List;
import com.tongran.system.domain.EpsMethodChangeRecord;
import java.util.List;
/**
* 收益方式修改记录Mapper接口
*
@@ -58,4 +59,12 @@ public interface EpsMethodChangeRecordMapper
* @return 结果
*/
public int deleteEpsMethodChangeRecordByIds(Long[] ids);
/**
* 查询收益方式修改记录列表
*
* @param epsMethodChangeRecord 收益方式修改记录
* @return 收益方式修改记录
*/
public EpsMethodChangeRecord getNetNameByRecord(EpsMethodChangeRecord epsMethodChangeRecord);
}
@@ -844,6 +844,26 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
private void calculateNormalDeviceBandwidth(EpsInitialTrafficData queryParam,
String dailyStartTime,
String dailyEndTime, String calculationMode) {
// 获取业务变更记录
EpsMethodChangeRecord changeQuery = new EpsMethodChangeRecord();
changeQuery.setClientId(queryParam.getClientId());
changeQuery.setEndTime(dailyEndTime);
EpsMethodChangeRecord record = epsMethodChangeRecordMapper
.getNetNameByRecord(changeQuery);
if(record != null){
String name = record.getTrafficPort();
// 查询mac
AllInterfaceName allInterfaceName = new AllInterfaceName();
allInterfaceName.setClientId(queryParam.getClientId());
allInterfaceName.setInterfaceName(name);
allInterfaceName.setResourceType("1");
List<AllInterfaceName> allInterfaceNameList = allInterfaceNameMapper.selectByNames(allInterfaceName);
if(allInterfaceNameList != null && !allInterfaceNameList.isEmpty()){
AllInterfaceName interfaceName = allInterfaceNameList.get(0);
queryParam.setMac(interfaceName.getServerIp());
}
}
queryParam.setStartTime(dailyStartTime);
queryParam.setEndTime(dailyEndTime);
List<EpsInitialTrafficData> dataList = query(queryParam);
@@ -967,6 +987,7 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
// 查询此条数据是否存在
List<EpsNodeBandwidth> exitsList = epsNodeBandwidthMapper.selectEpsNodeBandwidthList(bandwidth);
bandwidth.setBandwidthResult(result);
bandwidth.setMacAddress(data.getMac());
switch (data.getBandwidthType()){
case "1":
bandwidth.setBandwidth95Daily(result);
@@ -72,6 +72,7 @@ public class EpsNodeBandwidthServiceImpl implements IEpsNodeBandwidthService
queryParams.setClientId(epsNodeBandwidth.getClientId());
queryParams.setServiceSn(epsNodeBandwidth.getHardwareSn());
queryParams.setBusinessId(epsNodeBandwidth.getBusinessId());
queryParams.setMac(epsNodeBandwidth.getMacAddress());
queryParams.setStartTime(dailyStartTime);
queryParams.setEndTime(dailyEndTime);
// 获取总数
@@ -383,7 +383,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
a.id,
GROUP_CONCAT(DISTINCT a.`name` SEPARATOR ',') AS name,
a.`mac` AS mac,
GROUP_CONCAT(DISTINCT a.`mac` SEPARATOR ',') AS mac,
a.`status` AS status,
a.`type` AS type,
a.`ipV4` AS ipV4,
@@ -453,7 +453,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and a.revenue_method = #{revenueMethod}
</if>
<if test="mac != null and mac != ''">
and a.mac = #{mac}
and a.mac in
<foreach collection="mac.split(',')" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
GROUP BY a.create_time DESC
@@ -115,4 +115,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="getNetNameByRecord" parameterType="EpsMethodChangeRecord" resultMap="EpsMethodChangeRecordResult">
<include refid="selectEpsMethodChangeRecordVo"/>
<where>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
<if test="endTime != null and endTime != ''"> and create_time &lt;= #{endTime}</if>
</where>
order by create_time desc
limit 1
</select>
</mapper>
@@ -34,15 +34,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="serverClientId" column="server_client_id" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="macAddress" column="mac_address" />
</resultMap>
<sql id="selectEpsNodeBandwidthVo">
select id, node_name, hardware_sn, calculation_mode, bandwidth_type, bandwidth_result, bandwidth_95_daily, bandwidth_95_monthly, avg_monthly_bandwidth_95, package_bandwidth_daily, machine_flow, uplink_switch, create_time, update_time, switch_sn, interface_name, resource_type, interface_link_device_type, effective_bandwidth_95_daily, effective_bandwidth_95_monthly, effective_avg_monthly_bandwidth_95, business_name, business_id, remark1, create_datetime, client_id, server_client_id, create_by, update_by from eps_node_bandwidth
select id, node_name, hardware_sn, calculation_mode, bandwidth_type, bandwidth_result, bandwidth_95_daily, bandwidth_95_monthly, avg_monthly_bandwidth_95, package_bandwidth_daily, machine_flow, uplink_switch, create_time, update_time, switch_sn, interface_name, resource_type, interface_link_device_type, effective_bandwidth_95_daily, effective_bandwidth_95_monthly, effective_avg_monthly_bandwidth_95, business_name, business_id, remark1, create_datetime, client_id, server_client_id, create_by, update_by, mac_address from eps_node_bandwidth
</sql>
<select id="selectEpsNodeBandwidthList" parameterType="EpsNodeBandwidth" resultMap="EpsNodeBandwidthResult">
<include refid="selectEpsNodeBandwidthVo"/>
<where>
<if test="macAddress != null and macAddress != ''"> and mac_address = #{macAddress}</if>
<if test="nodeName != null and nodeName != ''"> and node_name like concat('%', #{nodeName}, '%')</if>
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
<if test="calculationMode != null and calculationMode != ''"> and calculation_mode = #{calculationMode}</if>
@@ -120,6 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="serverClientId != null">server_client_id,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="macAddress != null">mac_address,</if>
create_time,
update_time,
</trim>
@@ -150,6 +153,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="serverClientId != null">#{serverClientId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="macAddress != null">#{macAddress},</if>
<choose>
<when test="createTime != null">
#{createTime},
@@ -200,6 +204,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="serverClientId != null">server_client_id = #{serverClientId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="macAddress != null">mac_address = #{macAddress},</if>
</trim>
where id = #{id}
</update>