diff --git a/tongran-modules/tongran-mtragent/src/main/java/com/tongran/mtragent/domain/RmMtrPolicyConfig.java b/tongran-modules/tongran-mtragent/src/main/java/com/tongran/mtragent/domain/RmMtrPolicyConfig.java index 62a87fb..959caf1 100644 --- a/tongran-modules/tongran-mtragent/src/main/java/com/tongran/mtragent/domain/RmMtrPolicyConfig.java +++ b/tongran-modules/tongran-mtragent/src/main/java/com/tongran/mtragent/domain/RmMtrPolicyConfig.java @@ -64,7 +64,9 @@ public class RmMtrPolicyConfig extends BaseEntity /** 查询条件 */ private String queryName; @Excel(name = "修改时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime; @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; } diff --git a/tongran-modules/tongran-mtragent/src/main/java/com/tongran/mtragent/handler/MessageHandler.java b/tongran-modules/tongran-mtragent/src/main/java/com/tongran/mtragent/handler/MessageHandler.java index 19b5504..730f0fa 100644 --- a/tongran-modules/tongran-mtragent/src/main/java/com/tongran/mtragent/handler/MessageHandler.java +++ b/tongran-modules/tongran-mtragent/src/main/java/com/tongran/mtragent/handler/MessageHandler.java @@ -353,7 +353,7 @@ public class MessageHandler { boolean needUpdate = false; RmMtrClientRegistration updateData = new RmMtrClientRegistration(); updateData.setId(rmMtrClientRegistration.getId()); - if(rmMtrClientRegistration.getLogicalNode() == null || + if((rmMtrClientRegistration.getLogicalNode() == null && heartbeat.getLogicalNode()!=null) || !StringUtils.equals(rmMtrClientRegistration.getLogicalNode(), heartbeat.getLogicalNode())){ updateData.setLogicalNode(heartbeat.getLogicalNode()); needUpdate = true; @@ -371,7 +371,7 @@ public class MessageHandler { } needUpdate = true; } - if(rmMtrClientRegistration.getCpucores() == null || + if((rmMtrClientRegistration.getCpucores() == null && heartbeat.getCpucores() != null) || rmMtrClientRegistration.getCpucores() != heartbeat.getCpucores()){ updateData.setCpucores(heartbeat.getCpucores()); needUpdate = true; diff --git a/tongran-modules/tongran-system/src/main/java/com/tongran/system/controller/CalculateController.java b/tongran-modules/tongran-system/src/main/java/com/tongran/system/controller/CalculateController.java index 0c9f37a..3a8d784 100644 --- a/tongran-modules/tongran-system/src/main/java/com/tongran/system/controller/CalculateController.java +++ b/tongran-modules/tongran-system/src/main/java/com/tongran/system/controller/CalculateController.java @@ -37,8 +37,8 @@ public class CalculateController extends BaseController { queryParam.setDayOrMonth(dayOrMonth); InitialSwitchInfoDetails initialSwitchInfoDetails = new InitialSwitchInfoDetails(); initialSwitchInfoDetails.setDayOrMonth(dayOrMonth); -// epsInitialTrafficDataService.calculateBusiness95BandwidthDaily(queryParam, dailyStartTime, dailyEndTime, "1000"); -// epsInitialTrafficDataService.calculateBusiness95BandwidthDaily(queryParam, dailyStartTime, dailyEndTime, "1024"); + epsInitialTrafficDataService.calculateBusiness95BandwidthDaily(queryParam, dailyStartTime, dailyEndTime, "1000"); + epsInitialTrafficDataService.calculateBusiness95BandwidthDaily(queryParam, dailyStartTime, dailyEndTime, "1024"); // initialSwitchInfoDetailsService.calculateSwitch95BandwidthDaily(initialSwitchInfoDetails, dailyStartTime, dailyEndTime, "1000"); // initialSwitchInfoDetailsService.calculateSwitch95BandwidthDaily(initialSwitchInfoDetails, dailyStartTime, dailyEndTime, "1024"); } diff --git a/tongran-modules/tongran-system/src/main/java/com/tongran/system/service/impl/EpsInitialTrafficDataServiceImpl.java b/tongran-modules/tongran-system/src/main/java/com/tongran/system/service/impl/EpsInitialTrafficDataServiceImpl.java index 8b3b15c..fd7288a 100644 --- a/tongran-modules/tongran-system/src/main/java/com/tongran/system/service/impl/EpsInitialTrafficDataServiceImpl.java +++ b/tongran-modules/tongran-system/src/main/java/com/tongran/system/service/impl/EpsInitialTrafficDataServiceImpl.java @@ -282,7 +282,12 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe // 遍历处理每个设备 snList.forEach(interfaceName -> { queryParam.setClientId(interfaceName.getClientId()); - calculateChangedDeviceBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode); + try { + calculateChangedDeviceBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode); + log.info("计算{}的95带宽值完成", interfaceName.getClientId()); + }catch (Exception e){ + log.error("计算{}的95带宽值失败,详情:{}", interfaceName.getClientId(), e.getMessage()); + } }); } /** diff --git a/tongran-modules/tongran-system/src/main/java/com/tongran/system/service/impl/EpsServerRevenueConfigServiceImpl.java b/tongran-modules/tongran-system/src/main/java/com/tongran/system/service/impl/EpsServerRevenueConfigServiceImpl.java index ab83ca5..6079415 100644 --- a/tongran-modules/tongran-system/src/main/java/com/tongran/system/service/impl/EpsServerRevenueConfigServiceImpl.java +++ b/tongran-modules/tongran-system/src/main/java/com/tongran/system/service/impl/EpsServerRevenueConfigServiceImpl.java @@ -13,8 +13,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; /** * 服务器收益方式配置Service业务层处理 @@ -238,97 +241,67 @@ public class EpsServerRevenueConfigServiceImpl implements IEpsServerRevenueConfi /** * 批量处理接口名称 */ - @Transactional(rollbackFor = Exception.class, isolation = Isolation.REPEATABLE_READ) + @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED) public void processInterfaceNames(List trafficDataList) { - // 分类处理:新增列表 vs 更新列表 - List namesToInsert = new ArrayList<>(); - List namesToUpdate = new ArrayList<>(); + if (CollectionUtils.isEmpty(trafficDataList)) { + return; + } - // 用于去重的临时集合,防止同一批数据中的重复 - Set processedKeys = new HashSet<>(); - - trafficDataList.forEach(data -> { - String name = data.getName(); - String ip = data.getMac(); - String clientId = data.getClientId(); - if (StringUtils.isBlank(name) || StringUtils.isBlank(ip) || StringUtils.isBlank(clientId)) { - return; - } - - // 生成唯一键,防止同一批数据中的重复处理 - String uniqueKey = name + "|" + clientId + "|" + ip; - if (processedKeys.contains(uniqueKey)) { - return; - } - processedKeys.add(uniqueKey); - - // 构造新记录 - AllInterfaceName newRecord = new AllInterfaceName(); - newRecord.setInterfaceName(name); - newRecord.setClientId(data.getClientId()); - newRecord.setResourceType("1"); - newRecord.setDeviceSn(data.getServiceSn()); - newRecord.setNodeName(data.getNodeName()); - newRecord.setBusinessCode(data.getBusinessId()); - newRecord.setBusinessName(data.getBusinessName()); - newRecord.setServerIp(data.getMac()); - - List existingNames = allInterfaceNameMapper.selectByNames(newRecord); - - if (!existingNames.isEmpty()) { - for (AllInterfaceName existingName : existingNames) { - if (isRecordChanged(existingName, newRecord)) { - newRecord.setId(existingName.getId()); - newRecord.setUpdateTime(DateUtils.getNowDate()); - - // 检查是否已经存在于更新列表中 - boolean alreadyInUpdateList = namesToUpdate.stream() - .anyMatch(item -> item.getId() != null && item.getId().equals(existingName.getId())); - if (!alreadyInUpdateList) { - namesToUpdate.add(newRecord); - } - } - } - } else { - newRecord.setCreateTime(DateUtils.getNowDate()); - newRecord.setUpdateTime(DateUtils.getNowDate()); - - // 检查namesToInsert中是否已有相同记录 - boolean alreadyInInsertList = namesToInsert.stream() - .anyMatch(item -> item.getInterfaceName().equals(name) - && item.getClientId().equals(clientId) - && item.getServerIp().equals(ip)); - - if (!alreadyInInsertList) { - namesToInsert.add(newRecord); - } - } - }); - - // 批量操作数据库 - if (!namesToInsert.isEmpty()) { - try { - allInterfaceNameMapper.batchInsert(namesToInsert); - log.info("新增接口名称数量:{}", namesToInsert.size()); - } catch (Exception e) { - log.error("新增接口名称失败:{}", e.getMessage()); + // 直接转换并过滤 + List records = new ArrayList<>(); + for (EpsInitialTrafficData data : trafficDataList) { + if (isValidData(data)) { + records.add(convertToInterfaceName(data)); } } - if (!namesToUpdate.isEmpty()) { - namesToUpdate.sort(Comparator.comparing(AllInterfaceName::getId)); - allInterfaceNameMapper.batchUpdate(namesToUpdate); - log.info("更新接口名称数量:{}", namesToUpdate.size()); + if (!records.isEmpty()) { + try { + allInterfaceNameMapper.batchInsert(records); + log.info("批量处理接口名称完成,记录数: {}", records.size()); + }catch (Exception e){ + // 处理死锁异常 + if (isDeadlockException(e)) { + // 找到第一个非null的clientId + String deadlockClientId = records.stream() + .map(AllInterfaceName::getClientId) + .filter(StringUtils::isNotBlank) + .findFirst() + .orElse("unknown"); + log.error("检测到死锁,涉及的clientId: {}", deadlockClientId); + } else { + // 非死锁异常,重新抛出 + log.error("批量处理接口名称失败:{}", e.getMessage()); + } + } } } + private boolean isDeadlockException(Exception e) { + String message = e.getMessage(); + return message != null && ( + message.contains("deadlock") || + message.contains("Deadlock") || + message.contains("1213") // MySQL死锁错误码 + ); + } + private boolean isValidData(EpsInitialTrafficData data) { + return StringUtils.isNotBlank(data.getName()) + && StringUtils.isNotBlank(data.getMac()) + && StringUtils.isNotBlank(data.getClientId()); + } - // 辅助方法:检查记录是否有变化 - private boolean isRecordChanged(AllInterfaceName oldRecord, AllInterfaceName newRecord) { - return !Objects.equals(oldRecord.getDeviceSn(), newRecord.getDeviceSn()) || - !Objects.equals(oldRecord.getNodeName(), newRecord.getNodeName()) || - !Objects.equals(oldRecord.getBusinessCode(), newRecord.getBusinessCode()) || - !Objects.equals(oldRecord.getBusinessName(), newRecord.getBusinessName()) || - !Objects.equals(oldRecord.getServerIp(), newRecord.getServerIp()); + private AllInterfaceName convertToInterfaceName(EpsInitialTrafficData data) { + AllInterfaceName record = new AllInterfaceName(); + record.setInterfaceName(data.getName()); + record.setClientId(data.getClientId()); + record.setResourceType("1"); + record.setDeviceSn(data.getServiceSn()); + record.setNodeName(data.getNodeName()); + record.setBusinessCode(data.getBusinessId()); + record.setBusinessName(data.getBusinessName()); + record.setServerIp(data.getMac()); + + return record; } /** * 批量删除服务器收益方式配置 diff --git a/tongran-modules/tongran-system/src/main/java/com/tongran/system/service/impl/InitialSwitchInfoDetailsServiceImpl.java b/tongran-modules/tongran-system/src/main/java/com/tongran/system/service/impl/InitialSwitchInfoDetailsServiceImpl.java index 1f1eaa6..bd13100 100644 --- a/tongran-modules/tongran-system/src/main/java/com/tongran/system/service/impl/InitialSwitchInfoDetailsServiceImpl.java +++ b/tongran-modules/tongran-system/src/main/java/com/tongran/system/service/impl/InitialSwitchInfoDetailsServiceImpl.java @@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import java.math.BigDecimal; import java.math.RoundingMode; @@ -349,99 +350,83 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe /** * 批量处理接口名称 */ - @Transactional(rollbackFor = Exception.class, isolation = Isolation.REPEATABLE_READ) - private void processSwitchInterfaceNames(List initialSwitchInfoDetails) { - // 分类处理:新增列表 vs 更新列表 - List namesToInsert = new ArrayList<>(); - List namesToUpdate = new ArrayList<>(); + @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED) + public void processSwitchInterfaceNames(List initialSwitchInfoDetails) { + if (CollectionUtils.isEmpty(initialSwitchInfoDetails)) { + return; + } - initialSwitchInfoDetails.forEach(data -> { - String name = data.getName(); - String ip = data.getSwitchIp(); - String clientId = data.getClientId(); - if (StringUtils.isBlank(name) || StringUtils.isBlank(ip) || StringUtils.isBlank(clientId)) { - return; - } - AllInterfaceName record = new AllInterfaceName(); - record.setInterfaceName(name); - record.setClientId(data.getClientId()); - record.setResourceType("2"); - record.setDeviceSn(data.getServerSn()); - record.setNodeName(data.getServerName()); - record.setServerPort(data.getServerPort()); - record.setInterfaceDeviceType(data.getInterfaceDeviceType()); - record.setSwitchName(data.getSwitchName()); - record.setSwitchSn(data.getSwitchSn()); - record.setSwitchIp(data.getSwitchIp()); - List existingNames = allInterfaceNameMapper.selectByNames(record); - // 根据服务器sn查询业务 - if(data.getServerSn() != null){ - EpsServerRevenueConfig epsServerRevenueConfig = new EpsServerRevenueConfig(); - epsServerRevenueConfig.setHardwareSn(data.getServerSn()); - List businessList = epsServerRevenueConfigMapper.selectEpsServerRevenueConfigList(epsServerRevenueConfig); - if(!businessList.isEmpty()){ - EpsServerRevenueConfig revenueConfig = businessList.get(0); - record.setBusinessName(revenueConfig.getBusinessName()); - record.setBusinessCode(revenueConfig.getBusinessCode()); - } - }else { - record.setBusinessCode(null); - record.setBusinessName(null); - } - // 判断是否需要更新 - if (!existingNames.isEmpty()) { - for (AllInterfaceName existingName : existingNames) { - if(isRecordChanged(existingName,record)){ - record.setId(existingName.getId()); // 保留原ID - // 检查是否已经存在于更新列表中 - boolean alreadyInUpdateList = namesToUpdate.stream() - .anyMatch(item -> item.getId() != null && item.getId().equals(existingName.getId())); - if (!alreadyInUpdateList) { - namesToUpdate.add(record); - } - } - } - } else { - // 检查namesToInsert中是否已有相同记录 - boolean alreadyInInsertList = namesToInsert.stream() - .anyMatch(item -> item.getInterfaceName().equals(name) - && item.getClientId().equals(clientId) - && item.getSwitchIp().equals(ip)); - - if (!alreadyInInsertList) { - namesToInsert.add(record); - } - } - }); - - // 批量操作数据库 - if (!namesToInsert.isEmpty()) { - try { - allInterfaceNameMapper.batchInsert(namesToInsert); - log.info("交换机新增接口名称数量:{}", namesToInsert.size()); - } catch (Exception e) { - log.error("交换机接口名称批量插入失败:{}", e.getMessage()); + // 直接转换并过滤 + List records = new ArrayList<>(); + for (InitialSwitchInfoDetails data : initialSwitchInfoDetails) { + if (isValidData(data)) { + AllInterfaceName record = convertToInterfaceName(data); + // 查询业务信息 + fillBusinessInfo(record, data.getServerSn()); + records.add(record); } } - if (!namesToUpdate.isEmpty()) { - namesToUpdate.sort(Comparator.comparing(AllInterfaceName::getId)); - allInterfaceNameMapper.batchUpdate(namesToUpdate); - log.info("交换机更新接口名称数量:{}", namesToUpdate.size()); + if (!records.isEmpty()) { + try { + allInterfaceNameMapper.batchInsert(records); + log.info("批量处理交换机接口名称完成,记录数: {}", records.size()); + }catch (Exception e){ + // 处理死锁异常 + if (isDeadlockException(e)) { + // 找到第一个非null的clientId + String deadlockClientId = records.stream() + .map(AllInterfaceName::getClientId) + .filter(StringUtils::isNotBlank) + .findFirst() + .orElse("unknown"); + log.error("检测到死锁,涉及的clientId: {}", deadlockClientId); + } else { + // 非死锁异常,重新抛出 + log.error("批量处理交换机接口名称失败:{}", e.getMessage()); + } + } } } + private boolean isDeadlockException(Exception e) { + String message = e.getMessage(); + return message != null && ( + message.contains("deadlock") || + message.contains("Deadlock") || + message.contains("1213") // MySQL死锁错误码 + ); + } - // 辅助方法:检查记录是否有变化 - private boolean isRecordChanged(AllInterfaceName oldRecord, AllInterfaceName newRecord) { - return !Objects.equals(oldRecord.getDeviceSn(), newRecord.getDeviceSn()) || - !Objects.equals(oldRecord.getNodeName(), newRecord.getNodeName()) || - !Objects.equals(oldRecord.getServerPort(), newRecord.getServerPort()) || - !Objects.equals(oldRecord.getInterfaceDeviceType(), newRecord.getInterfaceDeviceType()) || - !Objects.equals(oldRecord.getSwitchName(), newRecord.getSwitchName()) || - !Objects.equals(oldRecord.getBusinessCode(), newRecord.getBusinessCode()) || - !Objects.equals(oldRecord.getBusinessName(), newRecord.getBusinessName()) || - !Objects.equals(oldRecord.getSwitchSn(), newRecord.getSwitchSn()) || - !Objects.equals(oldRecord.getSwitchIp(), newRecord.getSwitchIp()); + private boolean isValidData(InitialSwitchInfoDetails data) { + return StringUtils.isNotBlank(data.getName()) + && StringUtils.isNotBlank(data.getSwitchIp()) + && StringUtils.isNotBlank(data.getClientId()); + } + private AllInterfaceName convertToInterfaceName(InitialSwitchInfoDetails data) { + AllInterfaceName record = new AllInterfaceName(); + record.setInterfaceName(data.getName()); + record.setClientId(data.getClientId()); + record.setResourceType("2"); + record.setDeviceSn(data.getServerSn()); + record.setNodeName(data.getServerName()); + record.setServerPort(data.getServerPort()); + record.setInterfaceDeviceType(data.getInterfaceDeviceType()); + record.setSwitchName(data.getSwitchName()); + record.setSwitchSn(data.getSwitchSn()); + record.setSwitchIp(data.getSwitchIp()); + return record; + } + private void fillBusinessInfo(AllInterfaceName record, String serverSn) { + if (StringUtils.isNotBlank(serverSn)) { + EpsServerRevenueConfig query = new EpsServerRevenueConfig(); + query.setHardwareSn(serverSn); + List businessList = epsServerRevenueConfigMapper.selectEpsServerRevenueConfigList(query); + if (!CollectionUtils.isEmpty(businessList)) { + EpsServerRevenueConfig revenueConfig = businessList.get(0); + record.setBusinessCode(revenueConfig.getBusinessCode()); + record.setBusinessName(revenueConfig.getBusinessName()); + } + } } public void calculateSwitch95BandwidthDaily(InitialSwitchInfoDetails queryParam, String dailyStartTime, @@ -453,7 +438,12 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe // 遍历处理每个交换机 switchSnList.forEach(interfaceName -> { queryParam.setClientId(interfaceName.getClientId()); - processSwitchBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode); + try { + processSwitchBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode); + log.info("计算{}交换机的95带宽值完成", interfaceName.getClientId()); + }catch (Exception e){ + log.error("计算{}交换机的95带宽值失败,详情:{}", interfaceName.getClientId(), e.getMessage()); + } }); } diff --git a/tongran-modules/tongran-system/src/main/java/com/tongran/system/service/impl/RmResourceRegistrationServiceImpl.java b/tongran-modules/tongran-system/src/main/java/com/tongran/system/service/impl/RmResourceRegistrationServiceImpl.java index 0804914..06a2190 100644 --- a/tongran-modules/tongran-system/src/main/java/com/tongran/system/service/impl/RmResourceRegistrationServiceImpl.java +++ b/tongran-modules/tongran-system/src/main/java/com/tongran/system/service/impl/RmResourceRegistrationServiceImpl.java @@ -101,7 +101,7 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio startPage(pageDomain); List list = rmResourceRegistrationMapper.getRegistrationTableInfoList(rmResourceRegistration); - + batchSetNetWorkMsg(list); // 只处理当前页的数据 processCurrentPageData(list); @@ -111,6 +111,7 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio // 情况2: 有查询参数或需要排序,全量查询+内存处理 List allData = rmResourceRegistrationMapper.getRegistrationTableInfoList(rmResourceRegistration); + batchSetNetWorkMsg(allData); // 1. 过滤 List filteredList = allData; @@ -152,7 +153,6 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio for (RmResourceRegistration item : pageList) { if (item.getClientId() != null) { - setNetWorkMsg(item); setBandwidthYestoday(item); } } @@ -311,7 +311,7 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio if (result == null || result.getData() == null || result.getData().isEmpty()) { log.warn("批量查询网络信息返回为空,clientIds: {}", clientIdsStr); // 回退到单条查询 - fallbackSetNetworkInfo(pageList); +// fallbackSetNetworkInfo(pageList); return; } @@ -341,7 +341,7 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio } catch (Exception e) { log.error("批量查询网络信息异常", e); // 回退到单条查询 - fallbackSetNetworkInfo(pageList); +// fallbackSetNetworkInfo(pageList); } } /** @@ -910,19 +910,19 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio updateData.setOnlineStatus("1"); needUpdate = true; } - if(exits.getLogicalNodeId() == null || + if((exits.getLogicalNodeId() == null && rmResourceRegistration.getLogicalNodeId()!=null) || !StringUtils.equals(rmResourceRegistration.getLogicalNodeId(),exits.getLogicalNodeId())){ // 如果服务器已注册 增加节点标识 updateData.setLogicalNodeId(rmResourceRegistration.getLogicalNodeId()); needUpdate = true; } - if(exits.getAgentVersion() == null || + if((exits.getAgentVersion() == null && rmResourceRegistration.getAgentVersion()!=null) || !StringUtils.equals(rmResourceRegistration.getAgentVersion(),exits.getAgentVersion())){ // 如果服务器已注册 增加版本信息 updateData.setAgentVersion(rmResourceRegistration.getAgentVersion()); needUpdate = true; } - if(exits.getHardwareSn() == null || + if((exits.getHardwareSn() == null && rmResourceRegistration.getHardwareSn()!=null) || !StringUtils.equals(rmResourceRegistration.getHardwareSn(),exits.getHardwareSn())){ // 如果服务器已注册 增加SN信息 updateData.setHardwareSn(rmResourceRegistration.getHardwareSn()); diff --git a/tongran-modules/tongran-system/src/main/resources/logback.xml b/tongran-modules/tongran-system/src/main/resources/logback.xml index 5e8d5d7..1116191 100644 --- a/tongran-modules/tongran-system/src/main/resources/logback.xml +++ b/tongran-modules/tongran-system/src/main/resources/logback.xml @@ -1,94 +1,84 @@ - - - + + + - - - ${log.pattern} - - - - - - ${log.path}/info.log - - - - ${log.path}/info.%d{yyyy-MM-dd}.log - - 60 - - - ${log.pattern} - - - - INFO - - ACCEPT - - DENY - - - - - ${log.path}/error.log - - - - ${log.path}/error.%d{yyyy-MM-dd}.log - - 60 - + ${log.pattern} - - - ERROR - - ACCEPT - - DENY - - + + ${log.path}/debug.log + ${log.path}/debug.%d{yyyy-MM-dd}.log - 30 + 7 ${log.pattern} - - - ERROR - DENY - NEUTRAL - + DEBUG - - - - + + + ${log.path}/info.log + + ${log.path}/info.%d{yyyy-MM-dd}.log + 60 + + + ${log.pattern} + + + INFO + ACCEPT + DENY + + + + + ${log.path}/error.log + + ${log.path}/error.%d{yyyy-MM-dd}.log + 60 + + + ${log.pattern} + + + ERROR + ACCEPT + DENY + + + + + + + + + + + + + + + - - - - - + + \ No newline at end of file diff --git a/tongran-modules/tongran-system/src/main/resources/mapper/system/AllInterfaceNameMapper.xml b/tongran-modules/tongran-system/src/main/resources/mapper/system/AllInterfaceNameMapper.xml index 120600a..e4f5485 100644 --- a/tongran-modules/tongran-system/src/main/resources/mapper/system/AllInterfaceNameMapper.xml +++ b/tongran-modules/tongran-system/src/main/resources/mapper/system/AllInterfaceNameMapper.xml @@ -194,6 +194,65 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" NOW() ) + ON DUPLICATE KEY UPDATE + device_sn = CASE + WHEN device_sn != VALUES(device_sn) OR (device_sn IS NULL AND VALUES(device_sn) IS NOT NULL) + THEN VALUES(device_sn) + ELSE device_sn + END, + node_name = CASE + WHEN node_name != VALUES(node_name) OR (node_name IS NULL AND VALUES(node_name) IS NOT NULL) + THEN VALUES(node_name) + ELSE node_name + END, + business_code = CASE + WHEN business_code != VALUES(business_code) OR (business_code IS NULL AND VALUES(business_code) IS NOT NULL) + THEN VALUES(business_code) + ELSE business_code + END, + business_name = CASE + WHEN business_name != VALUES(business_name) OR (business_name IS NULL AND VALUES(business_name) IS NOT NULL) + THEN VALUES(business_name) + ELSE business_name + END, + switch_name = CASE + WHEN switch_name != VALUES(switch_name) OR (switch_name IS NULL AND VALUES(switch_name) IS NOT NULL) + THEN VALUES(switch_name) + ELSE switch_name + END, + interface_device_type = CASE + WHEN interface_device_type != VALUES(interface_device_type) OR (interface_device_type IS NULL AND VALUES(interface_device_type) IS NOT NULL) + THEN VALUES(interface_device_type) + ELSE interface_device_type + END, + server_port = CASE + WHEN server_port != VALUES(server_port) OR (server_port IS NULL AND VALUES(server_port) IS NOT NULL) + THEN VALUES(server_port) + ELSE server_port + END, + switch_sn = CASE + WHEN switch_sn != VALUES(switch_sn) OR (switch_sn IS NULL AND VALUES(switch_sn) IS NOT NULL) + THEN VALUES(switch_sn) + ELSE switch_sn + END, + switch_ip = CASE + WHEN switch_ip != VALUES(switch_ip) OR (switch_ip IS NULL AND VALUES(switch_ip) IS NOT NULL) + THEN VALUES(switch_ip) + ELSE switch_ip + END, + update_time = CASE + WHEN device_sn != VALUES(device_sn) OR (device_sn IS NULL AND VALUES(device_sn) IS NOT NULL) + OR node_name != VALUES(node_name) OR (node_name IS NULL AND VALUES(node_name) IS NOT NULL) + OR business_code != VALUES(business_code) OR (business_code IS NULL AND VALUES(business_code) IS NOT NULL) + OR business_name != VALUES(business_name) OR (business_name IS NULL AND VALUES(business_name) IS NOT NULL) + OR switch_name != VALUES(switch_name) OR (switch_name IS NULL AND VALUES(switch_name) IS NOT NULL) + OR interface_device_type != VALUES(interface_device_type) OR (interface_device_type IS NULL AND VALUES(interface_device_type) IS NOT NULL) + OR server_port != VALUES(server_port) OR (server_port IS NULL AND VALUES(server_port) IS NOT NULL) + OR switch_sn != VALUES(switch_sn) OR (switch_sn IS NULL AND VALUES(switch_sn) IS NOT NULL) + OR switch_ip != VALUES(switch_ip) OR (switch_ip IS NULL AND VALUES(switch_ip) IS NOT NULL) + THEN NOW() + ELSE update_time + END