修改入库bug 资源管理模块bug

This commit is contained in:
gaoyutao
2025-09-02 19:54:54 +08:00
parent 05e57a2fe7
commit 4dd9324dba
24 changed files with 315 additions and 724 deletions

View File

@@ -54,14 +54,6 @@ public class RmResourceRegistrationController extends BaseController
public void export(HttpServletResponse response, RmResourceRegistration rmResourceRegistration) public void export(HttpServletResponse response, RmResourceRegistration rmResourceRegistration)
{ {
List<RmResourceRegistration> list = rmResourceRegistrationService.selectRmResourceRegistrationList(rmResourceRegistration); List<RmResourceRegistration> list = rmResourceRegistrationService.selectRmResourceRegistrationList(rmResourceRegistration);
for (RmResourceRegistration resourceRegistration : list) {
// 根据端口类型导出端口名称
if("1".equals(resourceRegistration.getResourcePort())){
resourceRegistration.setResourcePort("162(SNMP)");
}else{
resourceRegistration.setResourcePort(resourceRegistration.getOtherPortName());
}
}
ExcelUtil<RmResourceRegistration> util = new ExcelUtil<RmResourceRegistration>(RmResourceRegistration.class); ExcelUtil<RmResourceRegistration> util = new ExcelUtil<RmResourceRegistration>(RmResourceRegistration.class);
util.showColumn(rmResourceRegistration.getProperties()); util.showColumn(rmResourceRegistration.getProperties());
util.exportExcel(response, list, "资源注册数据"); util.exportExcel(response, list, "资源注册数据");

View File

@@ -4,6 +4,8 @@ import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity; import com.ruoyi.common.core.web.domain.BaseEntity;
import lombok.Data; import lombok.Data;
import java.util.Set;
/** /**
* 所有接口名称对象 all_interface_name * 所有接口名称对象 all_interface_name
* *
@@ -62,4 +64,14 @@ public class AllInterfaceName extends BaseEntity
@Excel(name = "交换机硬件SN") @Excel(name = "交换机硬件SN")
private String switchSn; private String switchSn;
/** 接口名称集合 */
private Set<String> interfaceNames;
/** 交换机ip */
@Excel(name = "交换机ip")
private String switchIp;
/** 服务器ip */
@Excel(name = "服务器ip")
private String serverIp;
} }

View File

@@ -62,4 +62,6 @@ public class EpsServerRevenueConfig extends BaseEntity
private String endTime; private String endTime;
/** 业务是否有变化 */ /** 业务是否有变化 */
private String changed; private String changed;
/** 服务器ip */
private String serverIp;
} }

View File

@@ -93,4 +93,7 @@ public class InitialSwitchInfoDetails extends BaseEntity
private String bandwidthType; private String bandwidthType;
/** 日或月 */ /** 日或月 */
private String dayOrMonth; private String dayOrMonth;
/** 交换机ip */
private String switchIp;
} }

View File

@@ -3,8 +3,7 @@ package com.ruoyi.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity; import com.ruoyi.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder; import lombok.Data;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date; import java.util.Date;
@@ -14,6 +13,7 @@ import java.util.Date;
* @author gyt * @author gyt
* @date 2025-08-12 * @date 2025-08-12
*/ */
@Data
public class RmEpsTopologyManagement extends BaseEntity public class RmEpsTopologyManagement extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -71,166 +71,6 @@ public class RmEpsTopologyManagement extends BaseEntity
/** 修改人名称 */ /** 修改人名称 */
private String updaterName; private String updaterName;
/** 交换机ip */
private String switchIpAddress;
@Override
public Date getCreateTime() {
return createTime;
}
@Override
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public Date getUpdateTime() {
return updateTime;
}
@Override
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setSwitchName(String switchName)
{
this.switchName = switchName;
}
public String getSwitchName()
{
return switchName;
}
public void setSwitchSn(String switchSn)
{
this.switchSn = switchSn;
}
public String getSwitchSn()
{
return switchSn;
}
public void setInterfaceName(String interfaceName)
{
this.interfaceName = interfaceName;
}
public String getInterfaceName()
{
return interfaceName;
}
public void setConnectedDeviceType(String connectedDeviceType)
{
this.connectedDeviceType = connectedDeviceType;
}
public String getConnectedDeviceType()
{
return connectedDeviceType;
}
public void setServerName(String serverName)
{
this.serverName = serverName;
}
public String getServerName()
{
return serverName;
}
public void setServerSn(String serverSn)
{
this.serverSn = serverSn;
}
public String getServerSn()
{
return serverSn;
}
public void setServerPort(String serverPort)
{
this.serverPort = serverPort;
}
public String getServerPort()
{
return serverPort;
}
public void setCreatorId(Long creatorId)
{
this.creatorId = creatorId;
}
public Long getCreatorId()
{
return creatorId;
}
public void setCreatorName(String creatorName)
{
this.creatorName = creatorName;
}
public String getCreatorName()
{
return creatorName;
}
public void setUpdaterId(Long updaterId)
{
this.updaterId = updaterId;
}
public Long getUpdaterId()
{
return updaterId;
}
public void setUpdaterName(String updaterName)
{
this.updaterName = updaterName;
}
public String getUpdaterName()
{
return updaterName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("switchName", getSwitchName())
.append("switchSn", getSwitchSn())
.append("interfaceName", getInterfaceName())
.append("connectedDeviceType", getConnectedDeviceType())
.append("serverName", getServerName())
.append("serverSn", getServerSn())
.append("serverPort", getServerPort())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("creatorId", getCreatorId())
.append("creatorName", getCreatorName())
.append("updaterId", getUpdaterId())
.append("updaterName", getUpdaterName())
.toString();
}
} }

View File

@@ -1,9 +1,8 @@
package com.ruoyi.system.domain; package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity; import com.ruoyi.common.core.web.domain.BaseEntity;
import lombok.Data;
/** /**
* 资源注册对象 rm_resource_registration * 资源注册对象 rm_resource_registration
@@ -11,6 +10,7 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
* @author gyt * @author gyt
* @date 2025-08-12 * @date 2025-08-12
*/ */
@Data
public class RmResourceRegistration extends BaseEntity public class RmResourceRegistration extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -42,19 +42,32 @@ public class RmResourceRegistration extends BaseEntity
/**其他端口名称 */ /**其他端口名称 */
private String otherPortName; private String otherPortName;
/** agent版本 */
@Excel(name = "agent版本")
private String agentVersion;
/** 协议 1.TCP,2.UDP */ /** 协议 1.TCP,2.UDP */
@Excel(name = "协议",readConverterExp = "1=TCP,2=UDP") @Excel(name = "协议",readConverterExp = "1=TCP,2=UDP")
private String protocol; private String protocol;
/** SNMP探测 0=否,1=是 */
@Excel(name = "",readConverterExp = "0=否,1=是")
private String snmpDetect;
/** 版本(1.SNMPv2,2.SNMPv3) */ /** 版本(1.SNMPv2,2.SNMPv3) */
@Excel(name = "版本",readConverterExp = "1=SNMPv2,2=SNMPv3") @Excel(name = "SNMP版本",readConverterExp = "1=华为SNMPv2c,2=华为SNMPv3")
private String resourceVersion; private String resourceVersion;
/** 读写权限(1.RW,2.ReadOnly) */ /** 读写权限(1.RW,2.ReadOnly) */
@Excel(name = "读写权限",readConverterExp = "1=RW,2=ReadOnly") @Excel(name = "读写权限",readConverterExp = "1=只读,2=可读可写")
private String rwPermission; private String rwPermission;
/** 团体名称 */
@Excel(name = "团体名称")
private String teamName;
/** SNMP采集地址 */
@Excel(name = "SNMP采集地址")
private String snmpCollectAddr;
/** 安全级别(1.authPriv、2.authNoPriv3.noAuthNoPriv) */ /** 安全级别(1.authPriv、2.authNoPriv3.noAuthNoPriv) */
@Excel(name = "安全级别",readConverterExp = "1=authPriv,2=authNoPriv,3=noAuthNoPriv") @Excel(name = "安全级别",readConverterExp = "1=authPriv,2=authNoPriv,3=noAuthNoPriv")
@@ -106,271 +119,4 @@ public class RmResourceRegistration extends BaseEntity
/** 修改人名称 */ /** 修改人名称 */
private String updaterName; private String updaterName;
public String getOtherPortName() {
return otherPortName;
}
public void setOtherPortName(String otherPortName) {
this.otherPortName = otherPortName;
}
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setHardwareSn(String hardwareSn)
{
this.hardwareSn = hardwareSn;
}
public String getHardwareSn()
{
return hardwareSn;
}
public void setResourceType(String resourceType)
{
this.resourceType = resourceType;
}
public String getResourceType()
{
return resourceType;
}
public void setResourceName(String resourceName)
{
this.resourceName = resourceName;
}
public String getResourceName()
{
return resourceName;
}
public void setIpAddress(String ipAddress)
{
this.ipAddress = ipAddress;
}
public String getIpAddress()
{
return ipAddress;
}
public void setResourcePort(String resourcePort)
{
this.resourcePort = resourcePort;
}
public String getResourcePort()
{
return resourcePort;
}
public void setProtocol(String protocol)
{
this.protocol = protocol;
}
public String getProtocol()
{
return protocol;
}
public void setResourceVersion(String resourceVersion)
{
this.resourceVersion = resourceVersion;
}
public String getResourceVersion()
{
return resourceVersion;
}
public void setRwPermission(String rwPermission)
{
this.rwPermission = rwPermission;
}
public String getRwPermission()
{
return rwPermission;
}
public void setSecurityLevel(String securityLevel)
{
this.securityLevel = securityLevel;
}
public String getSecurityLevel()
{
return securityLevel;
}
public void setEncryption(String encryption)
{
this.encryption = encryption;
}
public String getEncryption()
{
return encryption;
}
public void setResourcePwd(String resourcePwd)
{
this.resourcePwd = resourcePwd;
}
public String getResourcePwd()
{
return resourcePwd;
}
public void setRegistrationStatus(String registrationStatus)
{
this.registrationStatus = registrationStatus;
}
public String getRegistrationStatus()
{
return registrationStatus;
}
public void setOnlineStatus(String onlineStatus)
{
this.onlineStatus = onlineStatus;
}
public String getOnlineStatus()
{
return onlineStatus;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return description;
}
public void setCustomerId(Long customerId)
{
this.customerId = customerId;
}
public Long getCustomerId()
{
return customerId;
}
public void setCustomerName(String customerName)
{
this.customerName = customerName;
}
public String getCustomerName()
{
return customerName;
}
public void setServiceNumber(String serviceNumber)
{
this.serviceNumber = serviceNumber;
}
public String getServiceNumber()
{
return serviceNumber;
}
public void setCreatorId(Long creatorId)
{
this.creatorId = creatorId;
}
public Long getCreatorId()
{
return creatorId;
}
public void setCreatorName(String creatorName)
{
this.creatorName = creatorName;
}
public String getCreatorName()
{
return creatorName;
}
public void setUpdaterId(Long updaterId)
{
this.updaterId = updaterId;
}
public Long getUpdaterId()
{
return updaterId;
}
public void setUpdaterName(String updaterName)
{
this.updaterName = updaterName;
}
public String getUpdaterName()
{
return updaterName;
}
public String getResourceUserName() {
return resourceUserName;
}
public void setResourceUserName(String resourceUserName) {
this.resourceUserName = resourceUserName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("hardwareSn", getHardwareSn())
.append("resourceType", getResourceType())
.append("resourceName", getResourceName())
.append("ipAddress", getIpAddress())
.append("resourcePort", getResourcePort())
.append("otherPortName", getOtherPortName())
.append("protocol", getProtocol())
.append("resourceVersion", getResourceVersion())
.append("rwPermission", getRwPermission())
.append("securityLevel", getSecurityLevel())
.append("encryption", getEncryption())
.append("resourcePwd", getResourcePwd())
.append("resourceUserName", getResourceName())
.append("registrationStatus", getRegistrationStatus())
.append("onlineStatus", getOnlineStatus())
.append("description", getDescription())
.append("customerId", getCustomerId())
.append("customerName", getCustomerName())
.append("serviceNumber", getServiceNumber())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("creatorId", getCreatorId())
.append("creatorName", getCreatorName())
.append("updaterId", getUpdaterId())
.append("updaterName", getUpdaterName())
.toString();
}
} }

View File

@@ -4,7 +4,6 @@ import com.ruoyi.system.domain.AllInterfaceName;
import org.springframework.data.repository.query.Param; import org.springframework.data.repository.query.Param;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 所有接口名称Mapper接口 * 所有接口名称Mapper接口
@@ -64,10 +63,10 @@ public interface AllInterfaceNameMapper
/** /**
* 根据接口名称查询表中是否存在信息 * 根据接口名称查询表中是否存在信息
* @param names * @param interfaceName
* @return * @return
*/ */
List<AllInterfaceName> selectByNames(Set<String> names); List<AllInterfaceName> selectByNames(AllInterfaceName interfaceName);
/** /**
* 批量插入接口名称 * 批量插入接口名称

View File

@@ -179,12 +179,12 @@ public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfi
Map nodeMsg = epsServerRevenueConfigMapper.getNodeMsgByIp(ip); Map nodeMsg = epsServerRevenueConfigMapper.getNodeMsgByIp(ip);
// 赋值 // 赋值
if(nodeMsg != null){ if(nodeMsg != null){
initialTrafficData.setServiceSn(nodeMsg.get("hardwareSn") + ""); initialTrafficData.setServiceSn(getNullableString(nodeMsg, "hardwareSn"));
initialTrafficData.setNodeName(nodeMsg.get("resourceName") + ""); initialTrafficData.setNodeName(getNullableString(nodeMsg, "resourceName"));
initialTrafficData.setRevenueMethod(nodeMsg.get("revenueMethod") + ""); initialTrafficData.setRevenueMethod(getNullableString(nodeMsg, "revenueMethod"));
initialTrafficData.setBusinessId(nodeMsg.get("businessCode") + ""); initialTrafficData.setBusinessId(getNullableString(nodeMsg, "businessCode"));
initialTrafficData.setBusinessName(nodeMsg.get("businessName") + ""); initialTrafficData.setBusinessName(getNullableString(nodeMsg, "businessName"));
if("2".equals(String.valueOf(nodeMsg.get("revenueMethod"))) if("2".equals(nodeMsg.get("revenueMethod") + "")
&& nodeMsg.containsKey("packageBandwidth")){ && nodeMsg.containsKey("packageBandwidth")){
Object bandwidth = nodeMsg.get("packageBandwidth"); Object bandwidth = nodeMsg.get("packageBandwidth");
if (bandwidth instanceof BigDecimal) { if (bandwidth instanceof BigDecimal) {
@@ -210,6 +210,13 @@ public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfi
return R.fail("数据保存失败:" + e.getMessage()); return R.fail("数据保存失败:" + e.getMessage());
} }
} }
private static String getNullableString(Map<String, Object> map, String key) {
Object value = map.get(key);
return value != null ? value.toString() : null;
}
private String getCompositeKey(String clientId, String interfaceName) {
return clientId + "|" + interfaceName;
}
/** /**
* 批量处理接口名称 * 批量处理接口名称
*/ */
@@ -225,11 +232,19 @@ public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfi
} }
// 批量查询已存在的接口名称 // 批量查询已存在的接口名称
List<AllInterfaceName> existingNames = allInterfaceNameMapper.selectByNames(interfaceNames); AllInterfaceName allInterfaceName = new AllInterfaceName();
if(!trafficDataList.isEmpty()){
allInterfaceName.setClientId(trafficDataList.get(0).getClientId());
allInterfaceName.setInterfaceNames(interfaceNames);
}
List<AllInterfaceName> existingNames = allInterfaceNameMapper.selectByNames(allInterfaceName);
// 转为 Map<接口名称, 数据库记录> 便于快速查找 // 转为 Map<接口名称, 数据库记录> 便于快速查找
Map<String, AllInterfaceName> existingNameMap = existingNames.stream() Map<String, AllInterfaceName> existingNameMap = existingNames.stream()
.collect(Collectors.toMap(AllInterfaceName::getInterfaceName, Function.identity())); .collect(Collectors.toMap(
item -> item.getClientId() + "|" + item.getInterfaceName(), // 关键修改点
Function.identity(),
(oldValue, newValue) -> oldValue // 重复时保留旧记录
));
// 分类处理:新增列表 vs 更新列表 // 分类处理:新增列表 vs 更新列表
List<AllInterfaceName> namesToInsert = new ArrayList<>(); List<AllInterfaceName> namesToInsert = new ArrayList<>();
List<AllInterfaceName> namesToUpdate = new ArrayList<>(); List<AllInterfaceName> namesToUpdate = new ArrayList<>();
@@ -249,10 +264,11 @@ public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfi
newRecord.setNodeName(data.getNodeName()); newRecord.setNodeName(data.getNodeName());
newRecord.setBusinessCode(data.getBusinessId()); newRecord.setBusinessCode(data.getBusinessId());
newRecord.setBusinessName(data.getBusinessName()); newRecord.setBusinessName(data.getBusinessName());
newRecord.setServerIp(data.getIpV4());
// 判断是否需要更新 // 判断是否需要更新
if (existingNameMap.containsKey(name)) { String compositeKey = data.getClientId() + "|" + name;
AllInterfaceName oldRecord = existingNameMap.get(name); if (existingNameMap.containsKey(compositeKey)) {
AllInterfaceName oldRecord = existingNameMap.get(compositeKey);
if (isRecordChanged(oldRecord, newRecord)) { if (isRecordChanged(oldRecord, newRecord)) {
newRecord.setId(oldRecord.getId()); // 保留原ID newRecord.setId(oldRecord.getId()); // 保留原ID
namesToUpdate.add(newRecord); namesToUpdate.add(newRecord);
@@ -279,7 +295,8 @@ public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfi
!Objects.equals(oldRecord.getDeviceSn(), newRecord.getDeviceSn()) || !Objects.equals(oldRecord.getDeviceSn(), newRecord.getDeviceSn()) ||
!Objects.equals(oldRecord.getNodeName(), newRecord.getNodeName()) || !Objects.equals(oldRecord.getNodeName(), newRecord.getNodeName()) ||
!Objects.equals(oldRecord.getBusinessCode(), newRecord.getBusinessCode()) || !Objects.equals(oldRecord.getBusinessCode(), newRecord.getBusinessCode()) ||
!Objects.equals(oldRecord.getBusinessName(), newRecord.getBusinessName()); !Objects.equals(oldRecord.getBusinessName(), newRecord.getBusinessName()) ||
!Objects.equals(oldRecord.getServerIp(), newRecord.getServerIp());
} }
/** /**
* 批量删除服务器收益方式配置 * 批量删除服务器收益方式配置

View File

@@ -127,8 +127,10 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
for (InitialSwitchInfoDetails details : dataList) { for (InitialSwitchInfoDetails details : dataList) {
// 根据接口名称查询交换机信息 // 根据接口名称查询交换机信息
String interfaceName = details.getName(); String interfaceName = details.getName();
String switchIp = details.getSwitchIp();
RmEpsTopologyManagement rmEpsTopologyManagement = new RmEpsTopologyManagement(); RmEpsTopologyManagement rmEpsTopologyManagement = new RmEpsTopologyManagement();
rmEpsTopologyManagement.setInterfaceName(interfaceName); rmEpsTopologyManagement.setInterfaceName(interfaceName);
rmEpsTopologyManagement.setSwitchIpAddress(switchIp);
List<RmEpsTopologyManagement> managements = rmEpsTopologyManagementMapper.selectRmEpsTopologyManagementList(rmEpsTopologyManagement); List<RmEpsTopologyManagement> managements = rmEpsTopologyManagementMapper.selectRmEpsTopologyManagementList(rmEpsTopologyManagement);
// 赋值 // 赋值
if(!managements.isEmpty()){ if(!managements.isEmpty()){
@@ -190,12 +192,19 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
if (interfaceNames.isEmpty()) { if (interfaceNames.isEmpty()) {
return; return;
} }
AllInterfaceName allInterfaceName = new AllInterfaceName();
if(!initialSwitchInfoDetails.isEmpty()){
allInterfaceName.setClientId(initialSwitchInfoDetails.get(0).getClientId());
allInterfaceName.setInterfaceNames(interfaceNames);
}
// 批量查询已存在的接口名称 // 批量查询已存在的接口名称
List<AllInterfaceName> existingNames = allInterfaceNameMapper.selectByNames(interfaceNames); List<AllInterfaceName> existingNames = allInterfaceNameMapper.selectByNames(allInterfaceName);
Map<String, AllInterfaceName> existingNameMap = existingNames.stream() Map<String, AllInterfaceName> existingNameMap = existingNames.stream()
.collect(Collectors.toMap(AllInterfaceName::getInterfaceName, Function.identity())); .collect(Collectors.toMap(
item -> item.getClientId() + "|" + item.getInterfaceName(), // 关键修改点
Function.identity(),
(oldValue, newValue) -> oldValue // 重复时保留旧记录
));
// 分类处理:新增列表 vs 更新列表 // 分类处理:新增列表 vs 更新列表
List<AllInterfaceName> namesToInsert = new ArrayList<>(); List<AllInterfaceName> namesToInsert = new ArrayList<>();
List<AllInterfaceName> namesToUpdate = new ArrayList<>(); List<AllInterfaceName> namesToUpdate = new ArrayList<>();
@@ -216,6 +225,7 @@ 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());
record.setSwitchIp(data.getSwitchIp());
// 根据服务器sn查询业务 // 根据服务器sn查询业务
if(data.getServerSn() != null){ if(data.getServerSn() != null){
EpsServerRevenueConfig epsServerRevenueConfig = new EpsServerRevenueConfig(); EpsServerRevenueConfig epsServerRevenueConfig = new EpsServerRevenueConfig();
@@ -231,8 +241,9 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
record.setBusinessName(null); record.setBusinessName(null);
} }
// 判断是否需要更新 // 判断是否需要更新
if (existingNameMap.containsKey(name)) { String compositeKey = data.getClientId() + "|" + name;
AllInterfaceName existingRecord = existingNameMap.get(name); if (existingNameMap.containsKey(compositeKey)) {
AllInterfaceName existingRecord = existingNameMap.get(compositeKey);
if (isRecordChanged(existingRecord, record)) { if (isRecordChanged(existingRecord, record)) {
record.setId(existingRecord.getId()); // 保留原ID record.setId(existingRecord.getId()); // 保留原ID
namesToUpdate.add(record); namesToUpdate.add(record);
@@ -264,7 +275,8 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
!Objects.equals(oldRecord.getSwitchName(), newRecord.getSwitchName()) || !Objects.equals(oldRecord.getSwitchName(), newRecord.getSwitchName()) ||
!Objects.equals(oldRecord.getBusinessCode(), newRecord.getBusinessCode()) || !Objects.equals(oldRecord.getBusinessCode(), newRecord.getBusinessCode()) ||
!Objects.equals(oldRecord.getBusinessName(), newRecord.getBusinessName()) || !Objects.equals(oldRecord.getBusinessName(), newRecord.getBusinessName()) ||
!Objects.equals(oldRecord.getSwitchSn(), newRecord.getSwitchSn()); !Objects.equals(oldRecord.getSwitchSn(), newRecord.getSwitchSn()) ||
!Objects.equals(oldRecord.getSwitchIp(), newRecord.getSwitchIp());
} }
public void calculateSwitch95BandwidthDaily(InitialSwitchInfoDetails queryParam, String dailyStartTime, String dailyEndTime) { public void calculateSwitch95BandwidthDaily(InitialSwitchInfoDetails queryParam, String dailyStartTime, String dailyEndTime) {

View File

@@ -126,6 +126,7 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
epsServerRevenueConfig.setNodeName(rmResourceRegistration.getResourceName()); epsServerRevenueConfig.setNodeName(rmResourceRegistration.getResourceName());
epsServerRevenueConfig.setCreateTime(DateUtils.getNowDate()); epsServerRevenueConfig.setCreateTime(DateUtils.getNowDate());
epsServerRevenueConfig.setRegistrationStatus(rmResourceRegistration.getRegistrationStatus()); epsServerRevenueConfig.setRegistrationStatus(rmResourceRegistration.getRegistrationStatus());
epsServerRevenueConfig.setServerIp(rmResourceRegistration.getIpAddress());
// 新增前判断是否存在 // 新增前判断是否存在
EpsServerRevenueConfig exits = epsServerRevenueConfigMapper.countBySn(epsServerRevenueConfig.getHardwareSn()); EpsServerRevenueConfig exits = epsServerRevenueConfigMapper.countBySn(epsServerRevenueConfig.getHardwareSn());
if(exits != null){ if(exits != null){

View File

@@ -17,10 +17,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="switchName" column="switch_name" />
<result property="interfaceDeviceType" column="interface_device_type" />
<result property="serverPort" column="server_port" />
<result property="switchSn" column="switch_sn" />
<result property="switchIp" column="switch_ip" />
<result property="serverIp" column="server_ip" />
</resultMap> </resultMap>
<sql id="selectAllInterfaceNameVo"> <sql id="selectAllInterfaceNameVo">
select id, client_id, interface_name, device_sn, node_name, business_code, business_name, resource_type, switch_name, interface_device_type, server_port, switch_sn, create_time, update_time, create_by, update_by from all_interface_name select id, client_id, interface_name, device_sn, node_name, business_code, business_name, resource_type, create_time, update_time, create_by, update_by, switch_name, interface_device_type, server_port, switch_sn, switch_ip, server_ip from all_interface_name
</sql> </sql>
<select id="selectAllInterfaceNameList" parameterType="AllInterfaceName" resultMap="AllInterfaceNameResult"> <select id="selectAllInterfaceNameList" parameterType="AllInterfaceName" resultMap="AllInterfaceNameResult">
@@ -33,6 +39,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</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="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
<if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</if> <if test="resourceType != null and resourceType != ''"> and resource_type = #{resourceType}</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="serverPort != null and serverPort != ''"> and server_port = #{serverPort}</if>
<if test="switchSn != null and switchSn != ''"> and switch_sn = #{switchSn}</if>
<if test="switchIp != null and switchIp != ''"> and switch_ip = #{switchIp}</if>
<if test="serverIp != null and serverIp != ''"> and server_ip = #{serverIp}</if>
</where> </where>
</select> </select>
@@ -51,14 +63,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessCode != null">business_code,</if> <if test="businessCode != null">business_code,</if>
<if test="businessName != null">business_name,</if> <if test="businessName != null">business_name,</if>
<if test="resourceType != null">resource_type,</if> <if test="resourceType != null">resource_type,</if>
<if test="switchName != null">switch_name,</if>
<if test="interfaceDeviceType != null">interface_device_type,</if>
<if test="serverPort != null">server_port,</if>
<if test="switchSn != null">switch_sn,</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="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="switchName != null">switch_name,</if>
<if test="interfaceDeviceType != null">interface_device_type,</if>
<if test="serverPort != null">server_port,</if>
<if test="switchSn != null">switch_sn,</if>
<if test="switchIp != null">switch_ip,</if>
<if test="serverIp != null">server_ip,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="clientId != null and clientId != ''">#{clientId},</if> <if test="clientId != null and clientId != ''">#{clientId},</if>
@@ -68,14 +82,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessCode != null">#{businessCode},</if> <if test="businessCode != null">#{businessCode},</if>
<if test="businessName != null">#{businessName},</if> <if test="businessName != null">#{businessName},</if>
<if test="resourceType != null">#{resourceType},</if> <if test="resourceType != null">#{resourceType},</if>
<if test="switchName != null">#{switchName},</if>
<if test="interfaceDeviceType != null">#{interfaceDeviceType},</if>
<if test="serverPort != null">#{serverPort},</if>
<if test="switchSn != null">#{switchSn},</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="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="switchName != null">#{switchName},</if>
<if test="interfaceDeviceType != null">#{interfaceDeviceType},</if>
<if test="serverPort != null">#{serverPort},</if>
<if test="switchSn != null">#{switchSn},</if>
<if test="switchIp != null">#{switchIp},</if>
<if test="serverIp != null">#{serverIp},</if>
</trim> </trim>
</insert> </insert>
@@ -89,14 +105,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessCode != null">business_code = #{businessCode},</if> <if test="businessCode != null">business_code = #{businessCode},</if>
<if test="businessName != null">business_name = #{businessName},</if> <if test="businessName != null">business_name = #{businessName},</if>
<if test="resourceType != null">resource_type = #{resourceType},</if> <if test="resourceType != null">resource_type = #{resourceType},</if>
<if test="switchName != null">switch_name = #{switchName},</if>
<if test="interfaceDeviceType != null">interface_device_type = #{interfaceDeviceType},</if>
<if test="serverPort != null">server_port = #{serverPort},</if>
<if test="switchSn != null">switch_sn = #{switchSn},</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="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="switchName != null">switch_name = #{switchName},</if>
<if test="interfaceDeviceType != null">interface_device_type = #{interfaceDeviceType},</if>
<if test="serverPort != null">server_port = #{serverPort},</if>
<if test="switchSn != null">switch_sn = #{switchSn},</if>
<if test="switchIp != null">switch_ip = #{switchIp},</if>
<if test="serverIp != null">server_ip = #{serverIp},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
@@ -112,7 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</delete> </delete>
<!-- 根据接口名称批量查询 --> <!-- 根据接口名称批量查询 -->
<select id="selectByNames" parameterType="java.lang.String" resultType="AllInterfaceName"> <select id="selectByNames" parameterType="AllInterfaceName" resultType="AllInterfaceName">
SELECT SELECT
id, id,
interface_name AS interfaceName, interface_name AS interfaceName,
@@ -125,12 +143,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
switch_name AS switchName, switch_name AS switchName,
interface_device_type AS interfaceDeviceType, interface_device_type AS interfaceDeviceType,
server_port AS serverPort, server_port AS serverPort,
switch_sn AS switchSn switch_sn AS switchSn,
switch_ip AS switchIp,
server_ip AS serverIp
FROM FROM
all_interface_name all_interface_name
WHERE WHERE
client_id = #{clientId} and
interface_name IN interface_name IN
<foreach collection="collection" item="name" open="(" separator="," close=")"> <foreach collection="interfaceNames" item="name" open="(" separator="," close=")">
#{name} #{name}
</foreach> </foreach>
</select> </select>
@@ -146,7 +167,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
node_name, node_name,
business_code, business_code,
business_name, business_name,
switch_name, interface_device_type, server_port, switch_sn, switch_name, interface_device_type, server_port, switch_sn, switch_ip, server_ip,
create_time, create_time,
update_time update_time
) )
@@ -160,7 +181,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.nodeName}, #{item.nodeName},
#{item.businessCode}, #{item.businessCode},
#{item.businessName}, #{item.businessName},
#{item.switchName}, #{item.interfaceDeviceType}, #{item.serverPort}, #{item.switchSn}, #{item.switchName}, #{item.interfaceDeviceType}, #{item.serverPort}, #{item.switchSn}, #{item.switchIp}, #{item.serverIp},
NOW(), NOW(),
NOW() NOW()
) )
@@ -203,7 +224,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
server_port = #{item.serverPort}, server_port = #{item.serverPort},
interface_device_type = #{item.interfaceDeviceType}, interface_device_type = #{item.interfaceDeviceType},
switch_name = #{item.switchName}, switch_name = #{item.switchName},
switch_sn = #{item.switchSn} switch_sn = #{item.switchSn},
switch_ip = #{item.switchIp},
server_ip = #{item.serverIp}
WHERE id = #{item.id} WHERE id = #{item.id}
</foreach> </foreach>
</update> </update>

View File

@@ -12,8 +12,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
`status` VARCHAR(20) COMMENT '运行状态', `status` VARCHAR(20) COMMENT '运行状态',
`type` VARCHAR(30) COMMENT '接口类型', `type` VARCHAR(30) COMMENT '接口类型',
ipV4 VARCHAR(20) COMMENT 'IPv4地址', ipV4 VARCHAR(20) COMMENT 'IPv4地址',
`in_dropped` DECIMAL(5,2) COMMENT '入站丢包率(%)', `in_dropped` DECIMAL(20,2) COMMENT '入站丢包率(%)',
`out_dropped` DECIMAL(5,2) COMMENT '出站丢包率(%)', `out_dropped` DECIMAL(20,2) COMMENT '出站丢包率(%)',
`in_speed` varchar(50) COMMENT '接收带宽(Mbps)', `in_speed` varchar(50) COMMENT '接收带宽(Mbps)',
`out_speed` varchar(50) COMMENT '发送带宽(Mbps)', `out_speed` varchar(50) COMMENT '发送带宽(Mbps)',
`speed` varchar(100) COMMENT '协商速度', `speed` varchar(100) COMMENT '协商速度',
@@ -43,8 +43,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
`status` VARCHAR(20) COMMENT '运行状态', `status` VARCHAR(20) COMMENT '运行状态',
`type` VARCHAR(30) COMMENT '接口类型', `type` VARCHAR(30) COMMENT '接口类型',
ipV4 VARCHAR(20) COMMENT 'IPv4地址', ipV4 VARCHAR(20) COMMENT 'IPv4地址',
`in_dropped` DECIMAL(5,2) COMMENT '入站丢包率(%)', `in_dropped` DECIMAL(20,2) COMMENT '入站丢包率(%)',
`out_dropped` DECIMAL(5,2) COMMENT '出站丢包率(%)', `out_dropped` DECIMAL(20,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)',
`speed` varchar(100) COMMENT '协商速度', `speed` varchar(100) COMMENT '协商速度',

View File

@@ -20,16 +20,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="changed" column="changed" /> <result property="changed" column="changed" />
<result property="serverIp" column="server_ip" />
</resultMap> </resultMap>
<sql id="selectEpsServerRevenueConfigVo"> <sql id="selectEpsServerRevenueConfigVo">
select id, node_name, revenue_method, hardware_sn, traffic_port, bandwidth_95, package_bandwidth, update_time, business_name, business_code, registration_status, create_by, update_by, create_time, changed from eps_server_revenue_config select id, node_name, revenue_method, hardware_sn, traffic_port, bandwidth_95, package_bandwidth, update_time, business_name, business_code, registration_status, create_by, update_by, create_time, changed, server_ip from eps_server_revenue_config
</sql> </sql>
<select id="selectEpsServerRevenueConfigList" parameterType="EpsServerRevenueConfig" resultMap="EpsServerRevenueConfigResult"> <select id="selectEpsServerRevenueConfigList" parameterType="EpsServerRevenueConfig" resultMap="EpsServerRevenueConfigResult">
<include refid="selectEpsServerRevenueConfigVo"/> <include refid="selectEpsServerRevenueConfigVo"/>
<where> <where>
and registration_status = '1' and registration_status = "1"
<if test="nodeName != null and nodeName != ''"> and node_name like concat('%', #{nodeName}, '%')</if> <if test="nodeName != null and nodeName != ''"> and node_name like concat('%', #{nodeName}, '%')</if>
<if test="revenueMethod != null and revenueMethod != ''"> and revenue_method = #{revenueMethod}</if> <if test="revenueMethod != null and revenueMethod != ''"> and revenue_method = #{revenueMethod}</if>
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if> <if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
@@ -39,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if> <if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
<if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if> <if test="businessCode != null and businessCode != ''"> and business_code = #{businessCode}</if>
<if test="changed != null and changed != ''"> and changed = #{changed}</if> <if test="changed != null and changed != ''"> and changed = #{changed}</if>
<if test="serverIp != null and serverIp != ''"> and server_ip = #{serverIp}</if>
</where> </where>
</select> </select>
@@ -47,11 +49,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</select> </select>
<select id="countBySn" parameterType="String">
<include refid="selectEpsServerRevenueConfigVo"/>
where hardware_sn = #{hardwareSn}
</select>
<insert id="insertEpsServerRevenueConfig" parameterType="EpsServerRevenueConfig"> <insert id="insertEpsServerRevenueConfig" parameterType="EpsServerRevenueConfig">
insert into eps_server_revenue_config insert into eps_server_revenue_config
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -70,6 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="changed != null">changed,</if> <if test="changed != null">changed,</if>
<if test="serverIp != null">server_ip,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">#{id},</if>
@@ -87,6 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="changed != null">#{changed},</if> <if test="changed != null">#{changed},</if>
<if test="serverIp != null">#{serverIp},</if>
</trim> </trim>
</insert> </insert>
@@ -107,6 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="changed != null">changed = #{changed},</if> <if test="changed != null">changed = #{changed},</if>
<if test="serverIp != null">server_ip = #{serverIp},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
@@ -141,4 +141,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and rrr.ip_address = #{ipAddress} and rrr.ip_address = #{ipAddress}
</where> </where>
</select> </select>
<select id="countBySn" parameterType="String">
<include refid="selectEpsServerRevenueConfigVo"/>
where hardware_sn = #{hardwareSn}
</select>
</mapper> </mapper>

View File

@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="type" column="type" /> <result property="type" column="type" />
<result property="inSpeed" column="in_speed" /> <result property="inSpeed" column="in_speed" />
<result property="outSpeed" column="out_speed" /> <result property="outSpeed" column="out_speed" />
<result property="switchIp" column="switch_ip" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
@@ -29,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectInitialSwitchInfoDetailsVo"> <sql id="selectInitialSwitchInfoDetailsVo">
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, business_code, business_name from initial_switch_info_details select id, client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed, switch_ip, create_by, update_by, create_time, update_time, switch_name, interface_device_type, server_name, server_port, server_sn, switch_sn, business_code, business_name from initial_switch_info_details
</sql> </sql>
<select id="selectInitialSwitchInfoDetailsList" parameterType="InitialSwitchInfoDetails" resultMap="InitialSwitchInfoDetailsResult"> <select id="selectInitialSwitchInfoDetailsList" parameterType="InitialSwitchInfoDetails" resultMap="InitialSwitchInfoDetailsResult">
@@ -43,6 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null and type != ''"> and type = #{type}</if> <if test="type != null and type != ''"> and type = #{type}</if>
<if test="inSpeed != null "> and in_speed = #{inSpeed}</if> <if test="inSpeed != null "> and in_speed = #{inSpeed}</if>
<if test="outSpeed != null "> and out_speed = #{outSpeed}</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="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="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="serverName != null and serverName != ''"> and server_name like concat('%', #{serverName}, '%')</if>
@@ -70,6 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null">type,</if> <if test="type != null">type,</if>
<if test="inSpeed != null">in_speed,</if> <if test="inSpeed != null">in_speed,</if>
<if test="outSpeed != null">out_speed,</if> <if test="outSpeed != null">out_speed,</if>
<if test="switchIp != null">switch_ip,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
@@ -92,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null">#{type},</if> <if test="type != null">#{type},</if>
<if test="inSpeed != null">#{inSpeed},</if> <if test="inSpeed != null">#{inSpeed},</if>
<if test="outSpeed != null">#{outSpeed},</if> <if test="outSpeed != null">#{outSpeed},</if>
<if test="switchIp != null">#{switchIp},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
@@ -118,6 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null">type = #{type},</if> <if test="type != null">type = #{type},</if>
<if test="inSpeed != null">in_speed = #{inSpeed},</if> <if test="inSpeed != null">in_speed = #{inSpeed},</if>
<if test="outSpeed != null">out_speed = #{outSpeed},</if> <if test="outSpeed != null">out_speed = #{outSpeed},</if>
<if test="switchIp != null">switch_ip = #{switchIp},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
@@ -156,6 +161,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
`type`, `type`,
in_speed AS inSpeed, in_speed AS inSpeed,
out_speed AS outSpeed, out_speed AS outSpeed,
switch_ip AS switchIp,
create_by AS createBy, create_by AS createBy,
update_by AS updateBy, update_by AS updateBy,
create_time AS createTime, create_time AS createTime,
@@ -173,16 +179,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
INSERT INTO initial_switch_info_details INSERT INTO initial_switch_info_details
( (
client_id, client_id,
name, `name`,
in_bytes, in_bytes,
out_bytes, out_bytes,
status, status,
type, `type`,
in_speed, in_speed,
out_speed, out_speed,
switch_ip,
switch_name, switch_name,
interface_device_type, interface_device_type,
server_name, `server_name`,
server_port, server_port,
server_sn, server_sn,
switch_sn, switch_sn,
@@ -204,6 +211,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.type}, #{item.type},
#{item.inSpeed}, #{item.inSpeed},
#{item.outSpeed}, #{item.outSpeed},
#{item.switchIp},
#{item.switchName}, #{item.switchName},
#{item.interfaceDeviceType}, #{item.interfaceDeviceType},
#{item.serverName}, #{item.serverName},

View File

@@ -19,10 +19,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="creatorName" column="creator_name" /> <result property="creatorName" column="creator_name" />
<result property="updaterId" column="updater_id" /> <result property="updaterId" column="updater_id" />
<result property="updaterName" column="updater_name" /> <result property="updaterName" column="updater_name" />
<result property="switchIpAddress" column="switch_ip_address" />
</resultMap> </resultMap>
<sql id="selectRmEpsTopologyManagementVo"> <sql id="selectRmEpsTopologyManagementVo">
select id, switch_name, switch_sn, interface_name, connected_device_type, server_name, server_sn, server_port, create_time, update_time, creator_id, creator_name, updater_id, updater_name from rm_eps_topology_management select id, switch_name, switch_sn, interface_name, connected_device_type, server_name, server_sn, server_port, create_time, update_time, creator_id, creator_name, updater_id, updater_name, switch_ip_address from rm_eps_topology_management
</sql> </sql>
<select id="selectRmEpsTopologyManagementList" parameterType="RmEpsTopologyManagement" resultMap="RmEpsTopologyManagementResult"> <select id="selectRmEpsTopologyManagementList" parameterType="RmEpsTopologyManagement" resultMap="RmEpsTopologyManagementResult">
@@ -30,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where> <where>
<if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</if> <if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</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= #{interfaceName}</if> <if test="interfaceName != null and interfaceName != ''"> and interface_name like concat('%', #{interfaceName}, '%')</if>
<if test="connectedDeviceType != null and connectedDeviceType != ''"> and connected_device_type = #{connectedDeviceType}</if> <if test="connectedDeviceType != null and connectedDeviceType != ''"> and connected_device_type = #{connectedDeviceType}</if>
<if test="serverName != null and serverName != ''"> and server_name like concat('%', #{serverName}, '%')</if> <if test="serverName != null and serverName != ''"> and server_name like concat('%', #{serverName}, '%')</if>
<if test="serverSn != null and serverSn != ''"> and server_sn = #{serverSn}</if> <if test="serverSn != null and serverSn != ''"> and server_sn = #{serverSn}</if>
@@ -39,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="creatorName != null and creatorName != ''"> and creator_name like concat('%', #{creatorName}, '%')</if> <if test="creatorName != null and creatorName != ''"> and creator_name like concat('%', #{creatorName}, '%')</if>
<if test="updaterId != null "> and updater_id = #{updaterId}</if> <if test="updaterId != null "> and updater_id = #{updaterId}</if>
<if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if> <if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if>
<if test="switchIpAddress != null and switchIpAddress != ''"> and switch_ip_address = #{switchIpAddress}</if>
</where> </where>
</select> </select>
@@ -63,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="creatorName != null">creator_name,</if> <if test="creatorName != null">creator_name,</if>
<if test="updaterId != null">updater_id,</if> <if test="updaterId != null">updater_id,</if>
<if test="updaterName != null">updater_name,</if> <if test="updaterName != null">updater_name,</if>
<if test="switchIpAddress != null">switch_ip_address,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="switchName != null">#{switchName},</if> <if test="switchName != null">#{switchName},</if>
@@ -78,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="creatorName != null">#{creatorName},</if> <if test="creatorName != null">#{creatorName},</if>
<if test="updaterId != null">#{updaterId},</if> <if test="updaterId != null">#{updaterId},</if>
<if test="updaterName != null">#{updaterName},</if> <if test="updaterName != null">#{updaterName},</if>
<if test="switchIpAddress != null">#{switchIpAddress},</if>
</trim> </trim>
</insert> </insert>
@@ -97,6 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="creatorName != null">creator_name = #{creatorName},</if> <if test="creatorName != null">creator_name = #{creatorName},</if>
<if test="updaterId != null">updater_id = #{updaterId},</if> <if test="updaterId != null">updater_id = #{updaterId},</if>
<if test="updaterName != null">updater_name = #{updaterName},</if> <if test="updaterName != null">updater_name = #{updaterName},</if>
<if test="switchIpAddress != null">switch_ip_address = #{switchIpAddress},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>

View File

@@ -12,9 +12,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="ipAddress" column="ip_address" /> <result property="ipAddress" column="ip_address" />
<result property="resourcePort" column="resource_port" /> <result property="resourcePort" column="resource_port" />
<result property="otherPortName" column="other_port_name" /> <result property="otherPortName" column="other_port_name" />
<result property="agentVersion" column="agent_version" />
<result property="protocol" column="protocol" /> <result property="protocol" column="protocol" />
<result property="resourceVersion" column="resource_version" /> <result property="resourceVersion" column="resource_version" />
<result property="rwPermission" column="rw_permission" /> <result property="rwPermission" column="rw_permission" />
<result property="snmpDetect" column="snmp_detect" />
<result property="teamName" column="team_name" />
<result property="snmpCollectAddr" column="snmp_collect_addr" />
<result property="securityLevel" column="security_level" /> <result property="securityLevel" column="security_level" />
<result property="encryption" column="encryption" /> <result property="encryption" column="encryption" />
<result property="resourceUserName" column="resource_user_name" /> <result property="resourceUserName" column="resource_user_name" />
@@ -34,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectRmResourceRegistrationVo"> <sql id="selectRmResourceRegistrationVo">
select id, hardware_sn, resource_type, resource_name, ip_address, resource_port, other_port_name, protocol, resource_version, rw_permission, security_level, encryption, resource_user_name,resource_pwd, registration_status, online_status, description, customer_id, customer_name, service_number, create_time, update_time, creator_id, creator_name, updater_id, updater_name from rm_resource_registration select id, hardware_sn, resource_type, resource_name, ip_address, resource_port, other_port_name, agent_version, protocol, resource_version, rw_permission, snmp_detect, team_name, snmp_collect_addr, security_level, encryption, resource_user_name, resource_pwd, registration_status, online_status, description, customer_id, customer_name, service_number, create_time, update_time, creator_id, creator_name, updater_id, updater_name from rm_resource_registration
</sql> </sql>
<select id="selectRmResourceRegistrationList" parameterType="RmResourceRegistration" resultMap="RmResourceRegistrationResult"> <select id="selectRmResourceRegistrationList" parameterType="RmResourceRegistration" resultMap="RmResourceRegistrationResult">
@@ -45,13 +49,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="resourceName != null and resourceName != ''"> and resource_name like concat('%', #{resourceName}, '%')</if> <if test="resourceName != null and resourceName != ''"> and resource_name like concat('%', #{resourceName}, '%')</if>
<if test="ipAddress != null and ipAddress != ''"> and ip_address = #{ipAddress}</if> <if test="ipAddress != null and ipAddress != ''"> and ip_address = #{ipAddress}</if>
<if test="resourcePort != null and resourcePort != ''"> and resource_port = #{resourcePort}</if> <if test="resourcePort != null and resourcePort != ''"> and resource_port = #{resourcePort}</if>
<if test="otherPortName != null and otherPortName != ''"> and other_port_name = #{otherPortName}</if> <if test="otherPortName != null and otherPortName != ''"> and other_port_name like concat('%', #{otherPortName}, '%')</if>
<if test="agentVersion != null and agentVersion != ''"> and agent_version = #{agentVersion}</if>
<if test="protocol != null and protocol != ''"> and protocol = #{protocol}</if> <if test="protocol != null and protocol != ''"> and protocol = #{protocol}</if>
<if test="resourceVersion != null and resourceVersion != ''"> and resource_version = #{resourceVersion}</if> <if test="resourceVersion != null and resourceVersion != ''"> and resource_version = #{resourceVersion}</if>
<if test="rwPermission != null and rwPermission != ''"> and rw_permission = #{rwPermission}</if> <if test="rwPermission != null and rwPermission != ''"> and rw_permission = #{rwPermission}</if>
<if test="snmpDetect != null and snmpDetect != ''"> and snmp_detect = #{snmpDetect}</if>
<if test="teamName != null and teamName != ''"> and team_name like concat('%', #{teamName}, '%')</if>
<if test="snmpCollectAddr != null and snmpCollectAddr != ''"> and snmp_collect_addr = #{snmpCollectAddr}</if>
<if test="securityLevel != null and securityLevel != ''"> and security_level = #{securityLevel}</if> <if test="securityLevel != null and securityLevel != ''"> and security_level = #{securityLevel}</if>
<if test="encryption != null and encryption != ''"> and encryption = #{encryption}</if> <if test="encryption != null and encryption != ''"> and encryption = #{encryption}</if>
<if test="resourceUserName != null and resourceUserName != ''"> and resource_user_name = #{resourceUserName}</if> <if test="resourceUserName != null and resourceUserName != ''"> and resource_user_name like concat('%', #{resourceUserName}, '%')</if>
<if test="resourcePwd != null and resourcePwd != ''"> and resource_pwd = #{resourcePwd}</if> <if test="resourcePwd != null and resourcePwd != ''"> and resource_pwd = #{resourcePwd}</if>
<if test="registrationStatus != null and registrationStatus != ''"> and registration_status = #{registrationStatus}</if> <if test="registrationStatus != null and registrationStatus != ''"> and registration_status = #{registrationStatus}</if>
<if test="onlineStatus != null and onlineStatus != ''"> and online_status = #{onlineStatus}</if> <if test="onlineStatus != null and onlineStatus != ''"> and online_status = #{onlineStatus}</if>
@@ -64,17 +72,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updaterId != null "> and updater_id = #{updaterId}</if> <if test="updaterId != null "> and updater_id = #{updaterId}</if>
<if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if> <if test="updaterName != null and updaterName != ''"> and updater_name like concat('%', #{updaterName}, '%')</if>
</where> </where>
order by create_time desc
</select> </select>
<select id="selectRmResourceRegistrationById" parameterType="Long" resultMap="RmResourceRegistrationResult"> <select id="selectRmResourceRegistrationById" parameterType="Long" resultMap="RmResourceRegistrationResult">
<include refid="selectRmResourceRegistrationVo"/> <include refid="selectRmResourceRegistrationVo"/>
where id = #{id} where id = #{id}
</select> </select>
<select id="countBySn" parameterType="String">
select count(1) from rm_resource_registration
where hardware_sn = #{hardwareSn}
</select>
<insert id="insertRmResourceRegistration" parameterType="RmResourceRegistration" useGeneratedKeys="true" keyProperty="id"> <insert id="insertRmResourceRegistration" parameterType="RmResourceRegistration" useGeneratedKeys="true" keyProperty="id">
insert into rm_resource_registration insert into rm_resource_registration
@@ -85,9 +88,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ipAddress != null">ip_address,</if> <if test="ipAddress != null">ip_address,</if>
<if test="resourcePort != null">resource_port,</if> <if test="resourcePort != null">resource_port,</if>
<if test="otherPortName != null">other_port_name,</if> <if test="otherPortName != null">other_port_name,</if>
<if test="agentVersion != null">agent_version,</if>
<if test="protocol != null">protocol,</if> <if test="protocol != null">protocol,</if>
<if test="resourceVersion != null">resource_version,</if> <if test="resourceVersion != null">resource_version,</if>
<if test="rwPermission != null">rw_permission,</if> <if test="rwPermission != null">rw_permission,</if>
<if test="snmpDetect != null">snmp_detect,</if>
<if test="teamName != null">team_name,</if>
<if test="snmpCollectAddr != null">snmp_collect_addr,</if>
<if test="securityLevel != null">security_level,</if> <if test="securityLevel != null">security_level,</if>
<if test="encryption != null">encryption,</if> <if test="encryption != null">encryption,</if>
<if test="resourceUserName != null">resource_user_name,</if> <if test="resourceUserName != null">resource_user_name,</if>
@@ -112,9 +119,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ipAddress != null">#{ipAddress},</if> <if test="ipAddress != null">#{ipAddress},</if>
<if test="resourcePort != null">#{resourcePort},</if> <if test="resourcePort != null">#{resourcePort},</if>
<if test="otherPortName != null">#{otherPortName},</if> <if test="otherPortName != null">#{otherPortName},</if>
<if test="agentVersion != null">#{agentVersion},</if>
<if test="protocol != null">#{protocol},</if> <if test="protocol != null">#{protocol},</if>
<if test="resourceVersion != null">#{resourceVersion},</if> <if test="resourceVersion != null">#{resourceVersion},</if>
<if test="rwPermission != null">#{rwPermission},</if> <if test="rwPermission != null">#{rwPermission},</if>
<if test="snmpDetect != null">#{snmpDetect},</if>
<if test="teamName != null">#{teamName},</if>
<if test="snmpCollectAddr != null">#{snmpCollectAddr},</if>
<if test="securityLevel != null">#{securityLevel},</if> <if test="securityLevel != null">#{securityLevel},</if>
<if test="encryption != null">#{encryption},</if> <if test="encryption != null">#{encryption},</if>
<if test="resourceUserName != null">#{resourceUserName},</if> <if test="resourceUserName != null">#{resourceUserName},</if>
@@ -143,9 +154,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ipAddress != null">ip_address = #{ipAddress},</if> <if test="ipAddress != null">ip_address = #{ipAddress},</if>
<if test="resourcePort != null">resource_port = #{resourcePort},</if> <if test="resourcePort != null">resource_port = #{resourcePort},</if>
<if test="otherPortName != null">other_port_name = #{otherPortName},</if> <if test="otherPortName != null">other_port_name = #{otherPortName},</if>
<if test="agentVersion != null">agent_version = #{agentVersion},</if>
<if test="protocol != null">protocol = #{protocol},</if> <if test="protocol != null">protocol = #{protocol},</if>
<if test="resourceVersion != null">resource_version = #{resourceVersion},</if> <if test="resourceVersion != null">resource_version = #{resourceVersion},</if>
<if test="rwPermission != null">rw_permission = #{rwPermission},</if> <if test="rwPermission != null">rw_permission = #{rwPermission},</if>
<if test="snmpDetect != null">snmp_detect = #{snmpDetect},</if>
<if test="teamName != null">team_name = #{teamName},</if>
<if test="snmpCollectAddr != null">snmp_collect_addr = #{snmpCollectAddr},</if>
<if test="securityLevel != null">security_level = #{securityLevel},</if> <if test="securityLevel != null">security_level = #{securityLevel},</if>
<if test="encryption != null">encryption = #{encryption},</if> <if test="encryption != null">encryption = #{encryption},</if>
<if test="resourceUserName != null">resource_user_name = #{resourceUserName},</if> <if test="resourceUserName != null">resource_user_name = #{resourceUserName},</if>
@@ -186,7 +201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<!-- 查询所有资源名称--> <!-- 查询所有资源名称-->
<select id="selectAllResourceNameByType" parameterType="RmResourceRegistration" resultType="java.util.Map"> <select id="selectAllResourceNameByType" parameterType="RmResourceRegistration" resultType="java.util.Map">
select resource_name resourceName from rm_resource_registration select resource_name resourceName,ip_address ipAddress,hardware_sn hardwareSn from rm_resource_registration
<where> <where>
and registration_status = 1 and registration_status = 1
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if> <if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
@@ -215,4 +230,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
group by resource_name group by resource_name
</select> </select>
<select id="countBySn" parameterType="String">
select count(1) from rm_resource_registration
where hardware_sn = #{hardwareSn}
</select>
</mapper> </mapper>

View File

@@ -337,9 +337,14 @@ public class RocketMsgListener implements MessageListenerConcurrently {
} }
} }
}); });
}else{
switchInfos.forEach(switchInfo -> {
switchInfo.setClientId(message.getClientId());
switchInfo.setCreateTime(createTime);
});
} }
// 清空临时表 // 清空临时表对应switch信息
initialSwitchInfoTempService.truncateSwitchInfoTemp(); initialSwitchInfoTempService.truncateSwitchInfoTemp(message.getClientId());
// 临时表 用来计算inSpeed outSeppd // 临时表 用来计算inSpeed outSeppd
initialSwitchInfoTempService.batchInsertInitialSwitchInfoTemp(switchInfos); initialSwitchInfoTempService.batchInsertInitialSwitchInfoTemp(switchInfos);
// 初始交换机数据入库 // 初始交换机数据入库

View File

@@ -39,6 +39,8 @@ public class InitialSwitchInfo extends BaseEntity
private BigDecimal inSpeed; private BigDecimal inSpeed;
/** 发送流量(bytes/s) */ /** 发送流量(bytes/s) */
private BigDecimal outSpeed; private BigDecimal outSpeed;
/** 交换机ip */
private String switchIp;
} }

View File

@@ -1,10 +1,10 @@
package com.ruoyi.rocketmq.domain; 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.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity; import com.ruoyi.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
/** /**
* 交换机监控信息对象 initial_switch_info_temp * 交换机监控信息对象 initial_switch_info_temp
@@ -12,6 +12,7 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
* @author gyt * @author gyt
* @date 2025-08-26 * @date 2025-08-26
*/ */
@Data
public class InitialSwitchInfoTemp extends BaseEntity public class InitialSwitchInfoTemp extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -50,113 +51,6 @@ public class InitialSwitchInfoTemp extends BaseEntity
/** 发送流量bytes/s */ /** 发送流量bytes/s */
@Excel(name = "发送流量", readConverterExp = "b=ytes/s") @Excel(name = "发送流量", readConverterExp = "b=ytes/s")
private BigDecimal outSpeed; private BigDecimal outSpeed;
/** 交换机ip */
public void setId(Long id) private String switchIp;
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setClientId(String clientId)
{
this.clientId = clientId;
}
public String getClientId()
{
return clientId;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setInBytes(BigDecimal inBytes)
{
this.inBytes = inBytes;
}
public BigDecimal getInBytes()
{
return inBytes;
}
public void setOutBytes(BigDecimal outBytes)
{
this.outBytes = outBytes;
}
public BigDecimal getOutBytes()
{
return outBytes;
}
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 setInSpeed(BigDecimal inSpeed)
{
this.inSpeed = inSpeed;
}
public BigDecimal getInSpeed()
{
return inSpeed;
}
public void setOutSpeed(BigDecimal outSpeed)
{
this.outSpeed = outSpeed;
}
public BigDecimal getOutSpeed()
{
return outSpeed;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("clientId", getClientId())
.append("name", getName())
.append("inBytes", getInBytes())
.append("outBytes", getOutBytes())
.append("status", getStatus())
.append("type", getType())
.append("inSpeed", getInSpeed())
.append("outSpeed", getOutSpeed())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.toString();
}
} }

View File

@@ -69,5 +69,5 @@ public interface InitialSwitchInfoTempMapper
*/ */
public int batchInsertInitialSwitchInfoTemp(@Param("list") List<InitialSwitchInfo> list); public int batchInsertInitialSwitchInfoTemp(@Param("list") List<InitialSwitchInfo> list);
void truncateSwitchInfoTemp(); void truncateSwitchInfoTemp(String clientId);
} }

View File

@@ -69,5 +69,5 @@ public interface IInitialSwitchInfoTempService
*/ */
public int batchInsertInitialSwitchInfoTemp(List<InitialSwitchInfo> list); public int batchInsertInitialSwitchInfoTemp(List<InitialSwitchInfo> list);
void truncateSwitchInfoTemp(); void truncateSwitchInfoTemp(String clientId);
} }

View File

@@ -116,7 +116,7 @@ public class InitialSwitchInfoTempServiceImpl implements IInitialSwitchInfoTempS
} }
@Override @Override
public void truncateSwitchInfoTemp() { public void truncateSwitchInfoTemp(String clientId) {
initialSwitchInfoTempMapper.truncateSwitchInfoTemp(); initialSwitchInfoTempMapper.truncateSwitchInfoTemp(clientId);
} }
} }

View File

@@ -5,7 +5,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.ruoyi.rocketmq.mapper.InitialSwitchInfoMapper"> <mapper namespace="com.ruoyi.rocketmq.mapper.InitialSwitchInfoMapper">
<resultMap type="InitialSwitchInfo" id="InitialSwitchInfoResult"> <resultMap type="InitialSwitchInfo" id="InitialSwitchInfoResult">
<id property="id" column="id"/> <result property="id" column="id" />
<result property="clientId" column="client_id" /> <result property="clientId" column="client_id" />
<result property="name" column="name" /> <result property="name" column="name" />
<result property="inBytes" column="in_bytes" /> <result property="inBytes" column="in_bytes" />
@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="type" column="type" /> <result property="type" column="type" />
<result property="inSpeed" column="in_speed" /> <result property="inSpeed" column="in_speed" />
<result property="outSpeed" column="out_speed" /> <result property="outSpeed" column="out_speed" />
<result property="switchIp" column="switch_ip" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
@@ -21,35 +22,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectInitialSwitchInfoVo"> <sql id="selectInitialSwitchInfoVo">
SELECT select id, client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed, switch_ip, create_by, update_by, create_time, update_time from initial_switch_info
id, client_id, `name`, in_bytes, out_bytes, status, `type`,
in_speed, out_speed, create_by, update_by, create_time, update_time
FROM initial_switch_info
</sql> </sql>
<select id="selectInitialSwitchInfoList" parameterType="InitialSwitchInfo" resultMap="InitialSwitchInfoResult"> <select id="selectInitialSwitchInfoList" parameterType="InitialSwitchInfo" resultMap="InitialSwitchInfoResult">
<include refid="selectInitialSwitchInfoVo"/> <include refid="selectInitialSwitchInfoVo"/>
<where> <where>
<if test="clientId != null and clientId != ''"> <if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
AND client_id = #{clientId} <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
</if> <if test="inBytes != null "> and in_bytes = #{inBytes}</if>
<if test="name != null and name != ''"> <if test="outBytes != null "> and out_bytes = #{outBytes}</if>
AND name LIKE CONCAT('%', #{name}, '%') <if test="status != null and status != ''"> and status = #{status}</if>
</if> <if test="type != null and type != ''"> and type = #{type}</if>
<if test="status != null and status != ''"> <if test="inSpeed != null "> and in_speed = #{inSpeed}</if>
AND status = #{status} <if test="outSpeed != null "> and out_speed = #{outSpeed}</if>
</if> <if test="switchIp != null and switchIp != ''"> and switch_ip = #{switchIp}</if>
<if test="type != null and type != ''">
AND type = #{type}
</if>
<if test="params.beginTime != null and params.beginTime != ''">
AND create_time &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''">
AND create_time &lt;= #{params.endTime}
</if>
</where> </where>
ORDER BY create_time DESC
</select> </select>
<select id="selectInitialSwitchInfoById" parameterType="Long" resultMap="InitialSwitchInfoResult"> <select id="selectInitialSwitchInfoById" parameterType="Long" resultMap="InitialSwitchInfoResult">
@@ -58,52 +46,57 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<insert id="insertInitialSwitchInfo" parameterType="InitialSwitchInfo" useGeneratedKeys="true" keyProperty="id"> <insert id="insertInitialSwitchInfo" parameterType="InitialSwitchInfo" useGeneratedKeys="true" keyProperty="id">
INSERT INTO initial_switch_info insert into initial_switch_info
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
client_id, <if test="clientId != null and clientId != ''">client_id,</if>
<if test="name != null">name,</if> <if test="name != null and name != ''">name,</if>
<if test="inBytes != null">in_bytes,</if> <if test="inBytes != null">in_bytes,</if>
<if test="outBytes != null">out_bytes,</if> <if test="outBytes != null">out_bytes,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="type != null">type,</if> <if test="type != null">type,</if>
<if test="inSpeed != null">in_speed,</if> <if test="inSpeed != null">in_speed,</if>
<if test="outSeppd != null">out_speed,</if> <if test="outSpeed != null">out_speed,</if>
<if test="switchIp != null and switchIp != ''">switch_ip,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
create_time, <if test="createTime != null">create_time,</if>
update_time <if test="updateTime != null">update_time,</if>
</trim> </trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
#{clientId}, <if test="clientId != null and clientId != ''">#{clientId},</if>
<if test="name != null">#{name},</if> <if test="name != null and name != ''">#{name},</if>
<if test="inBytes != null">#{inBytes},</if> <if test="inBytes != null">#{inBytes},</if>
<if test="outBytes != null">#{outBytes},</if> <if test="outBytes != null">#{outBytes},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
<if test="type != null">#{type},</if> <if test="type != null">#{type},</if>
<if test="inSpeed != null">#{inSpeed},</if> <if test="inSpeed != null">#{inSpeed},</if>
<if test="outSeppd != null">#{outSpeed},</if> <if test="outSpeed != null">#{outSpeed},</if>
<if test="switchIp != null and switchIp != ''">#{switchIp},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
NOW(), <if test="createTime != null">#{createTime},</if>
NOW() <if test="updateTime != null">#{updateTime},</if>
</trim> </trim>
</insert> </insert>
<update id="updateInitialSwitchInfo" parameterType="InitialSwitchInfo"> <update id="updateInitialSwitchInfo" parameterType="InitialSwitchInfo">
UPDATE initial_switch_info update initial_switch_info
<set> <trim prefix="SET" suffixOverrides=",">
<if test="clientId != null">client_id = #{clientId},</if> <if test="clientId != null and clientId != ''">client_id = #{clientId},</if>
<if test="name != null">name = #{name},</if> <if test="name != null and name != ''">name = #{name},</if>
<if test="inBytes != null">in_bytes = #{inBytes},</if> <if test="inBytes != null">in_bytes = #{inBytes},</if>
<if test="outBytes != null">out_bytes = #{outBytes},</if> <if test="outBytes != null">out_bytes = #{outBytes},</if>
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
<if test="type != null">type = #{type},</if> <if test="type != null">type = #{type},</if>
<if test="inSpeed != null">in_speed = #{inSpeed}</if> <if test="inSpeed != null">in_speed = #{inSpeed},</if>
<if test="outSeppd != null">out_speed = #{outSpeed}</if> <if test="outSpeed != null">out_speed = #{outSpeed},</if>
<if test="switchIp != null and switchIp != ''">switch_ip = #{switchIp},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
update_time = NOW() <if test="createTime != null">create_time = #{createTime},</if>
</set> <if test="updateTime != null">update_time = #{updateTime},</if>
WHERE id = #{id} </trim>
where id = #{id}
</update> </update>
<delete id="deleteInitialSwitchInfoById" parameterType="Long"> <delete id="deleteInitialSwitchInfoById" parameterType="Long">
@@ -120,14 +113,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="batchInsertInitialSwitchInfo" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id"> <insert id="batchInsertInitialSwitchInfo" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
INSERT INTO initial_switch_info INSERT INTO initial_switch_info
( (
client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed, client_id, `name`, in_bytes, out_bytes, status, `type`, in_speed, out_speed, switch_ip,
create_by, update_by, create_time, update_time create_by, update_by, create_time, update_time
) )
VALUES VALUES
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
( (
#{item.clientId}, #{item.name}, #{item.inBytes}, #{item.outBytes}, #{item.clientId}, #{item.name}, #{item.inBytes}, #{item.outBytes},
#{item.status}, #{item.type}, #{item.inSpeed}, #{item.outSpeed}, #{item.createBy}, #{item.updateBy}, #{item.status}, #{item.type}, #{item.inSpeed}, #{item.outSpeed}, #{item.switchIp}, #{item.createBy}, #{item.updateBy},
<choose> <choose>
<when test="item.createTime != null"> <when test="item.createTime != null">
#{item.createTime} #{item.createTime}

View File

@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="type" column="type" /> <result property="type" column="type" />
<result property="inSpeed" column="in_speed" /> <result property="inSpeed" column="in_speed" />
<result property="outSpeed" column="out_speed" /> <result property="outSpeed" column="out_speed" />
<result property="switchIp" column="switch_ip" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
@@ -21,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectInitialSwitchInfoTempVo"> <sql id="selectInitialSwitchInfoTempVo">
select id, client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed, create_by, update_by, create_time, update_time from initial_switch_info_temp select id, client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed, switch_ip, create_by, update_by, create_time, update_time from initial_switch_info_temp
</sql> </sql>
<select id="selectInitialSwitchInfoTempList" parameterType="InitialSwitchInfoTemp" resultMap="InitialSwitchInfoTempResult"> <select id="selectInitialSwitchInfoTempList" parameterType="InitialSwitchInfoTemp" resultMap="InitialSwitchInfoTempResult">
@@ -35,6 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null and type != ''"> and type = #{type}</if> <if test="type != null and type != ''"> and type = #{type}</if>
<if test="inSpeed != null "> and in_speed = #{inSpeed}</if> <if test="inSpeed != null "> and in_speed = #{inSpeed}</if>
<if test="outSpeed != null "> and out_speed = #{outSpeed}</if> <if test="outSpeed != null "> and out_speed = #{outSpeed}</if>
<if test="switchIp != null and switchIp != ''"> and switch_ip = #{switchIp}</if>
</where> </where>
</select> </select>
@@ -54,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null">type,</if> <if test="type != null">type,</if>
<if test="inSpeed != null">in_speed,</if> <if test="inSpeed != null">in_speed,</if>
<if test="outSpeed != null">out_speed,</if> <if test="outSpeed != null">out_speed,</if>
<if test="switchIp != null">switch_ip,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
@@ -68,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null">#{type},</if> <if test="type != null">#{type},</if>
<if test="inSpeed != null">#{inSpeed},</if> <if test="inSpeed != null">#{inSpeed},</if>
<if test="outSpeed != null">#{outSpeed},</if> <if test="outSpeed != null">#{outSpeed},</if>
<if test="switchIp != null">#{switchIp},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
@@ -86,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null">type = #{type},</if> <if test="type != null">type = #{type},</if>
<if test="inSpeed != null">in_speed = #{inSpeed},</if> <if test="inSpeed != null">in_speed = #{inSpeed},</if>
<if test="outSpeed != null">out_speed = #{outSpeed},</if> <if test="outSpeed != null">out_speed = #{outSpeed},</if>
<if test="switchIp != null">switch_ip = #{switchIp},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
@@ -107,14 +112,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="batchInsertInitialSwitchInfoTemp" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id"> <insert id="batchInsertInitialSwitchInfoTemp" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
INSERT INTO initial_switch_info_temp INSERT INTO initial_switch_info_temp
( (
client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed, client_id, name, in_bytes, out_bytes, status, type, in_speed, out_speed, switch_ip,
create_by, update_by, create_time, update_time create_by, update_by, create_time, update_time
) )
VALUES VALUES
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
( (
#{item.clientId}, #{item.name}, #{item.inBytes}, #{item.outBytes}, #{item.clientId}, #{item.name}, #{item.inBytes}, #{item.outBytes},
#{item.status}, #{item.type}, #{item.inSpeed}, #{item.outSpeed}, #{item.createBy}, #{item.updateBy}, #{item.status}, #{item.type}, #{item.inSpeed}, #{item.outSpeed}, #{item.switchIp}, #{item.createBy}, #{item.updateBy},
<choose> <choose>
<when test="item.createTime != null"> <when test="item.createTime != null">
#{item.createTime} #{item.createTime}
@@ -134,7 +139,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) )
</foreach> </foreach>
</insert> </insert>
<update id="truncateSwitchInfoTemp"> <delete id="truncateSwitchInfoTemp" parameterType="String">
truncate table initial_switch_info_temp DELETE FROM initial_switch_info_temp
</update> WHERE
<choose>
<when test="clientId != null and clientId != ''">
client_id = #{clientId}
</when>
<otherwise>
1=0 <!-- 安全措施:条件不满足时不删除任何数据 -->
</otherwise>
</choose>
</delete>
</mapper> </mapper>