初始化v1.2

This commit is contained in:
gaoyutao
2025-11-24 16:19:09 +08:00
parent c0f51ef007
commit de49404116
918 changed files with 4236 additions and 4239 deletions
@@ -0,0 +1,32 @@
package com.tongran.system;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.tongran.common.security.annotation.EnableCustomConfig;
import com.tongran.common.security.annotation.EnableRyFeignClients;
/**
* 系统模块
*
* @author tongran
*/
@EnableCustomConfig
@EnableRyFeignClients
@SpringBootApplication
public class TongRanSystemApplication
{
public static void main(String[] args)
{
SpringApplication.run(TongRanSystemApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
}
}
@@ -0,0 +1,259 @@
package com.tongran.system.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.tongran.common.core.utils.DateUtils;
import com.tongran.system.domain.EpsInitialTrafficData;
import com.tongran.system.domain.RmRegistrationMachine;
import com.tongran.system.service.EpsInitialTrafficDataService;
import com.tongran.system.service.IRmRegistrationMachineService;
import com.tongran.system.util.TableRouterUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
import javax.crypto.Mac;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import java.math.BigDecimal;
import java.net.URI;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@Component
public class HmacScheduledTask {
private static final String MAC_NAME = "HmacSHA1";
private static final String ENCODING = "UTF-8";
@Autowired
private IRmRegistrationMachineService rmRegistrationMachineService;
@Autowired
private EpsInitialTrafficDataService epsInitialTrafficDataService;
/**
* 每小时执行一次,查询4小时前的数据
* 例如:9:39执行时查询4:00-5:00的数据
*/
@Scheduled(cron = "0 0 * * * ?") // 每小时整点执行
// 或者每5分钟执行一次:@Scheduled(cron = "0 */5 * * * ?")
// @Scheduled(initialDelay = 5000, fixedDelay = Long.MAX_VALUE)
public void executeHourlyTask() {
RestTemplate restTemplate = new RestTemplate();
try {
System.out.println("开始执行定时任务,时间:" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
// 计算时间范围:当前时间往前推4小时的整点时间段
LocalDateTime now = LocalDateTime.now();
// 计算查询的时间段(4小时前的整点小时)
LocalDateTime queryBaseTime = now.minusHours(4);
LocalDateTime startTime = queryBaseTime.withMinute(0).withSecond(0).withNano(0);
LocalDateTime endTime = startTime.plusHours(1);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String startTimeStr = startTime.format(formatter);
String endTimeStr = endTime.format(formatter);
System.out.println("查询时间范围:" + startTimeStr + "" + endTimeStr);
long timestamp = System.currentTimeMillis();
String plainText = "efea5f0218c84a24b9fdab3264de3da5" + timestamp + "/supplier/outer/dev/getFlow";
String secretKey = getHmac(plainText, "91a73fd806ab2c005c13b4dc19130a884e909dea3f72d46e30266fe1a1f588d8");
// 设置请求头
HttpHeaders headers = new HttpHeaders();
headers.set("Content-Type", "application/json");
headers.set("TOKEN", "efea5f0218c84a24b9fdab3264de3da5");
headers.set("secret-key", secretKey);
headers.set("timestamps", String.valueOf(timestamp));
// 查询绑定的machinecode
List<RmRegistrationMachine> machineList = rmRegistrationMachineService.selectRmRegistrationMachineList(new RmRegistrationMachine());
for (RmRegistrationMachine rmRegistrationMachine : machineList) {
// 构建URL
URI uri = UriComponentsBuilder
.fromHttpUrl("https://ecscm-openapi.ksyun.com/supplier/outer/dev/getFlow")
.queryParam("srmChannel", "1000121954")
.queryParam("startTime", startTimeStr)
.queryParam("endTime", endTimeStr)
.queryParam("machineCode", rmRegistrationMachine.getMachineCode())
.build()
.toUri();
HttpEntity<String> entity = new HttpEntity<>(headers);
// GET 请求
ResponseEntity<String> response = restTemplate.exchange(
uri,
HttpMethod.GET,
entity,
String.class
);
String result = response.getBody();
// 保存流量数据
parseAndProcessResponse(result, rmRegistrationMachine.getClientId());
}
System.out.println("定时任务执行完成");
} catch (Exception e) {
System.err.println("定时任务执行失败:" + e.getMessage());
e.printStackTrace();
}
}
/**
* 解析和处理API响应
*/
private void parseAndProcessResponse(String responseBody, String clientId) {
ObjectMapper objectMapper = new ObjectMapper();
try {
Map<String, Object> responseMap = objectMapper.readValue(responseBody, Map.class);
if (responseMap.get("code").equals(200)) {
Map<String, Object> dataMap = (Map<String, Object>) responseMap.get("data");
Integer total = (Integer) dataMap.get("total");
List<Map<String, Object>> dataList = (List<Map<String, Object>>) dataMap.get("data");
System.out.println("成功获取数据,总记录数:" + total);
// 处理每条数据
for (Map<String, Object> item : dataList) {
processFlowData(item, clientId);
}
} else {
System.out.println("API返回错误:" + responseMap.get("msg"));
}
} catch (Exception e) {
System.err.println("JSON解析失败:" + e.getMessage());
}
}
/**
* 处理单条流量数据
*/
private void processFlowData(Map<String, Object> flowData, String clientId) {
String time = (String) flowData.get("time");
// 科学计数法转换为BigDecimal
BigDecimal flow = Optional.ofNullable(flowData.get("flow"))
.map(Object::toString)
.map(str -> {
try {
return new BigDecimal(str);
} catch (NumberFormatException e) {
return BigDecimal.ZERO;
}
})
.orElse(BigDecimal.ZERO);
// 字节转bit
flow = flow.multiply(new BigDecimal(8));
String flowPlain = flow.toPlainString();
String deviceid = (String) flowData.get("deviceid");
String ip = (String) flowData.get("ip");
String province = (String) flowData.get("province");
System.out.println(String.format("时间:%s, 流量:%.2f, 设备:%s, IP%s, 省份:%s",
time, flow, deviceid, ip, province));
String tableName = TableRouterUtil.getTableName(TableRouterUtil.parseDateTime(time));
EpsInitialTrafficData epsInitialTrafficData = new EpsInitialTrafficData();
epsInitialTrafficData.setTableName(tableName);
epsInitialTrafficData.setCreateTime(DateUtils.parseDate(time));
epsInitialTrafficData.setClientId(clientId);
epsInitialTrafficData.setMachineFlow(flowPlain);
epsInitialTrafficDataService.updateMachineTraffic(epsInitialTrafficData);
}
/**
* 测试方法:手动执行查询指定时间段
*/
public void manualExecuteForTimeRange(LocalDateTime start, LocalDateTime end) {
RestTemplate restTemplate = new RestTemplate();
try {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String startTimeStr = start.format(formatter);
String endTimeStr = end.format(formatter);
System.out.println("手动执行查询,时间范围:" + startTimeStr + "" + endTimeStr);
long timestamp = System.currentTimeMillis();
String plainText = "efea5f0218c84a24b9fdab3264de3da5" + timestamp + "/supplier/outer/dev/getFlow";
String secretKey = getHmac(plainText, "91a73fd806ab2c005c13b4dc19130a884e909dea3f72d46e30266fe1a1f588d8");
// 设置请求头
HttpHeaders headers = new HttpHeaders();
headers.set("Content-Type", "application/json");
headers.set("TOKEN", "efea5f0218c84a24b9fdab3264de3da5");
headers.set("secret-key", secretKey);
headers.set("timestamps", String.valueOf(timestamp));
// 构建URL
URI uri = UriComponentsBuilder
.fromHttpUrl("https://ecscm-openapi.ksyun.com/supplier/outer/dev/getFlow")
.queryParam("srmChannel", "1000121954")
.queryParam("startTime", startTimeStr)
.queryParam("endTime", endTimeStr)
.build()
.toUri();
HttpEntity<String> entity = new HttpEntity<>(headers);
// GET 请求
ResponseEntity<String> response = restTemplate.exchange(
uri,
HttpMethod.GET,
entity,
String.class
);
System.out.println("手动执行API响应结果:" + response.getBody());
} catch (Exception e) {
System.err.println("手动执行失败:" + e.getMessage());
e.printStackTrace();
}
}
/**
* HMAC加密方法
*/
public static String getHmac(String plainText, String encryptKey) {
try{
byte[] dataKey = encryptKey.getBytes(ENCODING);
byte[] dataValue = plainText.getBytes(ENCODING);
SecretKey secretKey = new SecretKeySpec(dataKey, MAC_NAME);
Mac mac = Mac.getInstance(MAC_NAME);
mac.init(secretKey);
byte[] bytes = mac.doFinal(dataValue);
String rs = encodeHex(bytes, false);
return rs;
} catch (Exception e){
throw new IllegalArgumentException(e.getMessage());
}
}
/**
* 数据转16进制编码
*/
public static String encodeHex(final byte[] data, final boolean toLowerCase) {
final char[] DIGITS_LOWER = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
final char[] DIGITS_UPPER = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
final char[] toDigits = toLowerCase ? DIGITS_LOWER : DIGITS_UPPER;
final int l = data.length;
final char[] out = new char[l << 1];
for (int i = 0, j = 0; i < l; i++) {
out[j++] = toDigits[(0xF0 & data[i]) >>> 4];
out[j++] = toDigits[0x0F & data[i]];
}
return new String(out);
}
}
@@ -0,0 +1,430 @@
package com.tongran.system.config;
import com.tongran.system.domain.*;
import com.tongran.system.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
/**
* 自动生成数据表
*/
@Configuration
@EnableScheduling
@Slf4j
public class TableScheduleConfig {
private static final DateTimeFormatter TIME_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
@Autowired
private EpsInitialTrafficDataService epsInitialTrafficDataService;
@Autowired
private IInitialSwitchInfoDetailsService initialSwitchInfoDetailsService;
@Autowired
private IEpsNodeBandwidthService epsNodeBandwidthService;
@Autowired
private IAllInterfaceNameService allInterfaceNameService;
@Autowired
private IRmEpsTopologyManagementService rmEpsTopologyManagementService;
@Autowired
private IEpsMethodChangeRecordService epsMethodChangeRecordService;
@Autowired
private IRmMonitorConfigService rmMonitorConfigService;
// 每月25号创建下月表
@Scheduled(cron = "0 0 0 25 * ?")
// @Scheduled(initialDelay = 5000, fixedDelay = Long.MAX_VALUE)
public void createNextMonthTables() {
epsInitialTrafficDataService.createNextMonthTables();
}
/**
* 每5分钟计算配置好的总流量
*/
@Scheduled(cron = "0 1/5 * * * ?")
public void sumTrafficMyMonitorConfigScheduled() {
rmMonitorConfigService.sumTrafficMyMonitorConfig(null);
}
// 每天0点执行 计算95带宽值/日
@Scheduled(cron = "0 4 0 * * ?", zone = "Asia/Shanghai")
public void calculate95BandwidthDaily() {
// 获取昨天的日期范围(北京时间)
LocalDate yesterday = LocalDate.now(ZoneId.of("Asia/Shanghai")).minusDays(1);
String dailyStartTime = yesterday.atStartOfDay().format(TIME_FORMAT); // 00:00:00
String dailyEndTime = yesterday.atTime(23, 59, 59).format(TIME_FORMAT); // 23:59:59
// 日
String dayOrMonth = "1";
// 95带宽值/日
EpsInitialTrafficData queryParam = new EpsInitialTrafficData();
queryParam.setDayOrMonth(dayOrMonth);
InitialSwitchInfoDetails initialSwitchInfoDetails = new InitialSwitchInfoDetails();
initialSwitchInfoDetails.setDayOrMonth(dayOrMonth);
// 顺序执行链
CompletableFuture.runAsync(() -> executeWithLog("业务带宽1000",
() -> epsInitialTrafficDataService.calculateBusiness95BandwidthDaily(queryParam, dailyStartTime, dailyEndTime, "1000")))
.thenRun(() -> executeWithLog("业务带宽1024",
() -> epsInitialTrafficDataService.calculateBusiness95BandwidthDaily(queryParam, dailyStartTime, dailyEndTime, "1024")))
.thenRun(() -> executeWithLog("交换机带宽1000",
() -> initialSwitchInfoDetailsService.calculateSwitch95BandwidthDaily(initialSwitchInfoDetails, dailyStartTime, dailyEndTime, "1000")))
.thenRun(() -> executeWithLog("交换机带宽1024",
() -> initialSwitchInfoDetailsService.calculateSwitch95BandwidthDaily(initialSwitchInfoDetails, dailyStartTime, dailyEndTime, "1024")));
}
// 每天5点04执行 计算金山95带宽值/日
@Scheduled(cron = "0 4 5 * * ?", zone = "Asia/Shanghai")
public void calculateJinShan95() {
// 获取昨天的日期范围(北京时间)
LocalDate yesterday = LocalDate.now(ZoneId.of("Asia/Shanghai")).minusDays(1);
String dailyStartTime = yesterday.atStartOfDay().format(TIME_FORMAT); // 00:00:00
String dailyEndTime = yesterday.atTime(23, 59, 59).format(TIME_FORMAT); // 23:59:59
// 日
String dayOrMonth = "1";
// 95带宽值/日
EpsInitialTrafficData queryParam = new EpsInitialTrafficData();
queryParam.setDayOrMonth(dayOrMonth);
InitialSwitchInfoDetails initialSwitchInfoDetails = new InitialSwitchInfoDetails();
initialSwitchInfoDetails.setDayOrMonth(dayOrMonth);
// 顺序执行链
CompletableFuture.runAsync(() -> executeWithLog("金山业务带宽1000",
() -> epsInitialTrafficDataService.calculate95ByJinShan(queryParam, dailyStartTime, dailyEndTime, "1000")))
.thenRun(() -> executeWithLog("金山业务带宽1024",
() -> epsInitialTrafficDataService.calculate95ByJinShan(queryParam, dailyStartTime, dailyEndTime, "1024")));
}
// 每月1号0点执行 计算95带宽值/月
@Scheduled(cron = "0 3 0 1 * ?", zone = "Asia/Shanghai")
public void calculateMonthlyBandwidthTasks() {
// 获取上个月的日期范围
LocalDate lastMonth = LocalDate.now(ZoneId.of("Asia/Shanghai")).minusMonths(1);
LocalDate firstDayOfMonth = lastMonth.withDayOfMonth(1);
LocalDate lastDayOfMonth = lastMonth.withDayOfMonth(lastMonth.lengthOfMonth());
String monthlyStartTime = firstDayOfMonth.atStartOfDay().format(TIME_FORMAT);
String monthlyEndTime = lastDayOfMonth.atTime(23, 59, 59).format(TIME_FORMAT);
// 链式顺序执行(无额外日志封装)
CompletableFuture.runAsync(() -> calculateServerMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000"))
.thenRun(() -> calculateServerMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024"))
.thenRun(() -> calculateSwitchMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000"))
.thenRun(() -> calculateSwitchMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024"))
.thenRun(() -> calculateServerAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000"))
.thenRun(() -> calculateServerAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024"))
.thenRun(() -> calculateSwitchAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000"))
.thenRun(() -> calculateSwitchAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024"))
.exceptionally(e -> {
log.error("月度带宽计算链执行异常", e); // 仅保留最终异常捕获
return null;
});
}
/**
* 执行任务日志
*/
private void executeWithLog(String taskName, Runnable task) {
log.info("开始执行: {}", taskName);
try {
task.run();
} catch (Exception e) {
log.error("{} 执行失败", taskName, e);
throw e; // 可选:是否终止后续任务
}
log.info("{} 执行完成", taskName);
}
/**
* 计算服务器月95带宽值
*/
private void calculateServerMonthlyBandwidth(String monthlyStartTime, String monthlyEndTime, String calculationMode) {
log.info("开始计算服务器月95带宽值...");
try {
String dayOrMonth = "2";
EpsInitialTrafficData queryParam = new EpsInitialTrafficData();
queryParam.setDayOrMonth(dayOrMonth);
epsInitialTrafficDataService.calculateBusiness95BandwidthDaily(queryParam, monthlyStartTime, monthlyEndTime, calculationMode);
log.info("服务器月95带宽值计算完成");
} catch (Exception e) {
log.error("计算服务器月95带宽值失败", e);
}
}
/**
* 计算交换机月95带宽值
*/
private void calculateSwitchMonthlyBandwidth(String monthlyStartTime, String monthlyEndTime, String calculationMode) {
log.info("开始计算交换机月95带宽值...");
try {
String dayOrMonth = "2";
InitialSwitchInfoDetails queryParam = new InitialSwitchInfoDetails();
queryParam.setDayOrMonth(dayOrMonth);
initialSwitchInfoDetailsService.calculateSwitch95BandwidthDaily(queryParam, monthlyStartTime, monthlyEndTime, calculationMode);
log.info("交换机月95带宽值计算完成");
} catch (Exception e) {
log.error("计算交换机月95带宽值失败", e);
}
}
/**
* 计算服务器月平均95带宽值
*/
private void calculateServerAvgMonthlyBandwidth(String monthlyStartTime, String monthlyEndTime, String calculationMode) {
log.info("开始计算服务器月平均95带宽值...");
try {
EpsNodeBandwidth epsNodeBandwidth = new EpsNodeBandwidth();
epsNodeBandwidth.setStartTime(monthlyStartTime);
epsNodeBandwidth.setEndTime(monthlyEndTime);
List<AllInterfaceName> snList = allInterfaceNameService.getAllDeviceSn(new AllInterfaceName());
for (AllInterfaceName allInterfaceName : snList) {
processServerAvgBandwidth(epsNodeBandwidth, allInterfaceName, calculationMode);
}
log.info("服务器月平均95带宽值计算完成");
} catch (Exception e) {
log.error("计算服务器月平均95带宽值失败", e);
}
}
/**
* 处理单个服务器的平均带宽计算
*/
private void processServerAvgBandwidth(EpsNodeBandwidth epsNodeBandwidth, AllInterfaceName allInterfaceName, String calculationMode) {
final String clientId = allInterfaceName.getClientId();
try {
// 1. 设置基础设备信息
epsNodeBandwidth.setClientId(clientId);
// 查询业务变更记录
EpsMethodChangeRecord changeQuery = new EpsMethodChangeRecord();
changeQuery.setClientId(clientId);
changeQuery.setStartTime(epsNodeBandwidth.getStartTime());
changeQuery.setEndTime(epsNodeBandwidth.getEndTime());
List<EpsMethodChangeRecord> records = epsMethodChangeRecordService.selectEpsMethodChangeRecordList(changeQuery);
// 按businessCode分组处理(修复null key问题)
if (!records.isEmpty()) {
Map<String, List<EpsMethodChangeRecord>> groupedRecords = records.stream()
.filter(record -> record.getBusinessCode() != null) // 过滤掉businessCode为null的记录
.collect(Collectors.groupingBy(EpsMethodChangeRecord::getBusinessCode));
// 处理每个业务分组
for (Map.Entry<String, List<EpsMethodChangeRecord>> entry : groupedRecords.entrySet()) {
String businessCode = entry.getKey();
// 取第一个有效业务名称(同businessCode的业务名称应该相同)
String businessName = entry.getValue().stream()
.filter(r -> r.getBusinessName() != null)
.findFirst()
.map(EpsMethodChangeRecord::getBusinessName)
.orElse("未知业务");
// 创建业务带宽对象
EpsNodeBandwidth bandwidthWithBiz = new EpsNodeBandwidth();
bandwidthWithBiz.setClientId(clientId);
bandwidthWithBiz.setCalculationMode(calculationMode);
bandwidthWithBiz.setStartTime(epsNodeBandwidth.getStartTime());
bandwidthWithBiz.setEndTime(epsNodeBandwidth.getEndTime());
bandwidthWithBiz.setBusinessId(businessCode);
bandwidthWithBiz.setBusinessName(businessName);
bandwidthWithBiz.setResourceType("1");
// 执行计算
epsNodeBandwidthService.calculateAvg(bandwidthWithBiz);
}
// 处理businessCode为null的记录(如果有)
List<EpsMethodChangeRecord> nullBusinessRecords = records.stream()
.filter(record -> record.getBusinessCode() == null)
.collect(Collectors.toList());
if (!nullBusinessRecords.isEmpty()) {
log.warn("服务器 {} 有 {} 条记录的businessCode为null", clientId, nullBusinessRecords.size());
// 可以选择记录日志或进行其他处理
}
return; // 业务变更处理完成后直接返回
}
String businessCode = null;
String businessName = null;
// 查询绑定的业务
EpsMethodChangeRecord queryParam = new EpsMethodChangeRecord();
queryParam.setClientId(clientId);
List<EpsMethodChangeRecord> recordList = epsMethodChangeRecordService.selectEpsMethodChangeRecordList(queryParam);
if(!recordList.isEmpty()){
EpsMethodChangeRecord record = recordList.stream()
.findFirst()
.orElse(null);
businessCode = record.getBusinessCode();
businessName = record.getBusinessName();
}
// 5. 处理正常情况(无业务变更或无需处理变更)
EpsNodeBandwidth normalBandwidth = new EpsNodeBandwidth();
normalBandwidth.setClientId(clientId);
normalBandwidth.setCalculationMode(calculationMode);
normalBandwidth.setStartTime(epsNodeBandwidth.getStartTime());
normalBandwidth.setEndTime(epsNodeBandwidth.getEndTime());
normalBandwidth.setBusinessId(businessCode);
normalBandwidth.setBusinessName(businessName);
normalBandwidth.setResourceType("1");
epsNodeBandwidthService.calculateAvg(normalBandwidth);
} catch (Exception e) {
log.error("处理服务器 {} 平均带宽失败", clientId, e);
}
}
/**
* 计算交换机月平均95带宽值
*/
private void calculateSwitchAvgMonthlyBandwidth(String monthlyStartTime, String monthlyEndTime, String calculationMode) {
log.info("开始计算交换机月平均95带宽值...");
try {
EpsNodeBandwidth epsNodeBandwidth = new EpsNodeBandwidth();
epsNodeBandwidth.setStartTime(monthlyStartTime);
epsNodeBandwidth.setEndTime(monthlyEndTime);
List<AllInterfaceName> switchSnList = allInterfaceNameService.getAllSwitchSn(new AllInterfaceName());
for (AllInterfaceName switchSnMsg : switchSnList) {
processSwitchAvgBandwidth(epsNodeBandwidth, switchSnMsg, calculationMode);
}
log.info("交换机月平均95带宽值计算完成");
} catch (Exception e) {
log.error("计算交换机月平均95带宽值失败", e);
}
}
/**
* 处理单个交换机的平均带宽计算
*/
private void processSwitchAvgBandwidth(EpsNodeBandwidth epsNodeBandwidth, AllInterfaceName switchSnMsg, String calculationMode) {
final String clientId = switchSnMsg.getClientId();
try {
// 1. 查询交换机拓扑信息
RmEpsTopologyManagement managementQuery = new RmEpsTopologyManagement();
managementQuery.setClientId(clientId);
List<RmEpsTopologyManagement> topologyList = rmEpsTopologyManagementService.selectRmEpsTopologyManagementList(managementQuery);
if(!topologyList.isEmpty()){
for (RmEpsTopologyManagement topology : topologyList) {
epsNodeBandwidth.setClientId(clientId);
epsNodeBandwidth.setInterfaceName(topology.getInterfaceName());
// 3. 判断连接设备类型
boolean isServerConnected = "1".equals(topology.getConnectedDeviceType());
// 4. 处理服务器连接的情况
if (isServerConnected && topology.getServerClientId() != null) {
String serverClientId = topology.getServerClientId();
String serverSn = topology.getServerSn();
// 查询业务变更记录
EpsMethodChangeRecord changeQuery = new EpsMethodChangeRecord();
changeQuery.setClientId(serverClientId);
changeQuery.setStartTime(epsNodeBandwidth.getStartTime());
changeQuery.setEndTime(epsNodeBandwidth.getEndTime());
List<EpsMethodChangeRecord> records = epsMethodChangeRecordService.selectEpsMethodChangeRecordList(changeQuery);
// 按businessCode分组处理
if (!records.isEmpty()) {
Map<String, List<EpsMethodChangeRecord>> groupedRecords = records.stream()
.filter(record -> record.getBusinessCode() != null) // 过滤掉businessCode为null的记录
.collect(Collectors.groupingBy(EpsMethodChangeRecord::getBusinessCode));
// 处理每个业务分组
for (Map.Entry<String, List<EpsMethodChangeRecord>> entry : groupedRecords.entrySet()) {
String businessCode = entry.getKey();
List<EpsMethodChangeRecord> businessRecords = entry.getValue();
// 取第一个有效业务名称
String businessName = businessRecords.stream()
.filter(r -> r.getBusinessName() != null)
.findFirst()
.map(EpsMethodChangeRecord::getBusinessName)
.orElse("未知业务");
// 创建业务带宽对象
EpsNodeBandwidth bandwidthWithBiz = new EpsNodeBandwidth();
bandwidthWithBiz.setClientId(clientId);
bandwidthWithBiz.setCalculationMode(calculationMode);
bandwidthWithBiz.setInterfaceName(topology.getInterfaceName());
bandwidthWithBiz.setHardwareSn(serverSn);
bandwidthWithBiz.setUplinkSwitch(topology.getSwitchName());
bandwidthWithBiz.setInterfaceLinkDeviceType(topology.getConnectedDeviceType());
bandwidthWithBiz.setStartTime(epsNodeBandwidth.getStartTime());
bandwidthWithBiz.setEndTime(epsNodeBandwidth.getEndTime());
bandwidthWithBiz.setBusinessId(businessCode);
bandwidthWithBiz.setBusinessName(businessName);
bandwidthWithBiz.setResourceType("2");
bandwidthWithBiz.setServerClientId(serverClientId);
// 执行计算
epsNodeBandwidthService.calculateAvg(bandwidthWithBiz);
}
// 处理businessCode为null的记录(如果有)
List<EpsMethodChangeRecord> nullBusinessRecords = records.stream()
.filter(record -> record.getBusinessCode() == null)
.collect(Collectors.toList());
if (!nullBusinessRecords.isEmpty()) {
log.warn("交换机 {} 有 {} 条记录的businessCode为null", clientId, nullBusinessRecords.size());
// 可以选择记录日志或进行其他处理
}
return; // 业务变更处理完成后直接返回
}else{
String businessCode = null;
String businessName = null;
// 查询绑定的业务
EpsMethodChangeRecord queryParam = new EpsMethodChangeRecord();
queryParam.setClientId(clientId);
queryParam.setTrafficPort(topology.getServerPort());
List<EpsMethodChangeRecord> recordList = epsMethodChangeRecordService.selectEpsMethodChangeRecordList(queryParam);
if(!recordList.isEmpty()){
EpsMethodChangeRecord record = recordList.stream()
.findFirst()
.orElse(null);
businessCode = record.getBusinessCode();
businessName = record.getBusinessName();
}
// 5. 处理普通情况(无变更记录)
EpsNodeBandwidth normalBandwidth = new EpsNodeBandwidth();
normalBandwidth.setClientId(clientId);
normalBandwidth.setBusinessId(businessCode);
normalBandwidth.setBusinessName(businessName);
normalBandwidth.setCalculationMode(calculationMode);
normalBandwidth.setInterfaceName(topology.getInterfaceName());
normalBandwidth.setHardwareSn(topology.getServerSn());
normalBandwidth.setUplinkSwitch(topology.getSwitchName());
normalBandwidth.setInterfaceLinkDeviceType(topology.getConnectedDeviceType());
normalBandwidth.setStartTime(epsNodeBandwidth.getStartTime());
normalBandwidth.setEndTime(epsNodeBandwidth.getEndTime());
normalBandwidth.setResourceType("2");
normalBandwidth.setServerClientId(serverClientId);
epsNodeBandwidthService.calculateAvg(normalBandwidth);
return;
}
}
// 5. 处理机房出口情况
EpsNodeBandwidth normalBandwidth = new EpsNodeBandwidth();
normalBandwidth.setClientId(clientId);
normalBandwidth.setCalculationMode(calculationMode);
normalBandwidth.setInterfaceName(topology.getInterfaceName());
normalBandwidth.setInterfaceLinkDeviceType(topology.getConnectedDeviceType());
normalBandwidth.setStartTime(epsNodeBandwidth.getStartTime());
normalBandwidth.setEndTime(epsNodeBandwidth.getEndTime());
normalBandwidth.setResourceType("2");
epsNodeBandwidthService.calculateAvg(normalBandwidth);
}
}else{
log.warn("未检测到拓扑配置,交换机clientId:{}", clientId);
}
} catch (Exception e) {
log.error("处理交换机 {} 平均带宽失败", clientId, e);
}
}
}
@@ -0,0 +1,52 @@
package com.tongran.system.controller;
import com.tongran.common.core.domain.R;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.security.annotation.InnerAuth;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.AllInterfaceName;
import com.tongran.system.service.IAllInterfaceNameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 所有接口名称Controller
*
* @author gyt
* @date 2025-08-25
*/
@RestController
@RequestMapping("/interfaceName")
public class AllInterfaceNameController extends BaseController
{
@Autowired
private IAllInterfaceNameService allInterfaceNameService;
/**
* 查询所有接口名称列表
*/
@RequiresPermissions("system:interfaceName:list")
@PostMapping("/getAllNames")
public List<AllInterfaceName> list(@RequestBody AllInterfaceName allInterfaceName)
{
List<AllInterfaceName> list = allInterfaceNameService.selectAllInterfaceNameList(allInterfaceName);
return list;
}
/**
* 查询所有接口名称列表
*/
@InnerAuth
@PostMapping("/getMsgByClientId")
public R<AllInterfaceName> getMsgByClientId(@RequestBody AllInterfaceName allInterfaceName)
{
List<AllInterfaceName> list = allInterfaceNameService.selectAllInterfaceNameList(allInterfaceName);
AllInterfaceName allInterfaceName1 = list.isEmpty()?new AllInterfaceName():list.get(0);
return R.ok(allInterfaceName1);
}
}
@@ -0,0 +1,90 @@
package com.tongran.system.controller;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.system.domain.EpsInitialTrafficData;
import com.tongran.system.domain.InitialSwitchInfoDetails;
import com.tongran.system.service.EpsInitialTrafficDataService;
import com.tongran.system.service.IInitialSwitchInfoDetailsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
@Slf4j
@RestController
@RequestMapping("calculateBandwidth")
public class CalculateController extends BaseController {
private static final DateTimeFormatter TIME_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
@Autowired
private EpsInitialTrafficDataService epsInitialTrafficDataService;
@Autowired
private IInitialSwitchInfoDetailsService initialSwitchInfoDetailsService;
@GetMapping("/calculate95BandwidthDaily")
public void calculate95BandwidthDaily(String day){
// 获取昨天的日期范围(北京时间)
LocalDate yesterday = LocalDate.parse(day);
String dailyStartTime = yesterday.atStartOfDay().format(TIME_FORMAT); // 00:00:00
String dailyEndTime = yesterday.atTime(23, 59, 59).format(TIME_FORMAT); // 23:59:59
// 日
String dayOrMonth = "1";
// 95带宽值/日
EpsInitialTrafficData queryParam = new EpsInitialTrafficData();
queryParam.setDayOrMonth(dayOrMonth);
InitialSwitchInfoDetails initialSwitchInfoDetails = new InitialSwitchInfoDetails();
initialSwitchInfoDetails.setDayOrMonth(dayOrMonth);
// epsInitialTrafficDataService.calculateBusiness95BandwidthDaily(queryParam, dailyStartTime, dailyEndTime, "1000");
// epsInitialTrafficDataService.calculateBusiness95BandwidthDaily(queryParam, dailyStartTime, dailyEndTime, "1024");
// initialSwitchInfoDetailsService.calculateSwitch95BandwidthDaily(initialSwitchInfoDetails, dailyStartTime, dailyEndTime, "1000");
// initialSwitchInfoDetailsService.calculateSwitch95BandwidthDaily(initialSwitchInfoDetails, dailyStartTime, dailyEndTime, "1024");
}
@GetMapping("/calculateMonthlyBandwidth")
public void calculateMonthlyBandwidth(String day){
// 获取上个月的日期范围
LocalDate lastMonth = LocalDate.parse(day);
LocalDate firstDayOfMonth = lastMonth.withDayOfMonth(1);
LocalDate lastDayOfMonth = lastMonth.withDayOfMonth(lastMonth.lengthOfMonth());
String monthlyStartTime = firstDayOfMonth.atStartOfDay().format(TIME_FORMAT);
String monthlyEndTime = lastDayOfMonth.atTime(23, 59, 59).format(TIME_FORMAT);
calculateServerMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000");
calculateServerMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024");
calculateSwitchMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000");
calculateSwitchMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024");
}
/**
* 计算服务器月95带宽值
*/
private void calculateServerMonthlyBandwidth(String monthlyStartTime, String monthlyEndTime, String calculationMode) {
log.info("开始计算服务器月95带宽值...");
try {
String dayOrMonth = "2";
EpsInitialTrafficData queryParam = new EpsInitialTrafficData();
queryParam.setDayOrMonth(dayOrMonth);
epsInitialTrafficDataService.calculateBusiness95BandwidthDaily(queryParam, monthlyStartTime, monthlyEndTime, calculationMode);
log.info("服务器月95带宽值计算完成");
} catch (Exception e) {
log.error("计算服务器月95带宽值失败", e);
}
}
/**
* 计算交换机月95带宽值
*/
private void calculateSwitchMonthlyBandwidth(String monthlyStartTime, String monthlyEndTime, String calculationMode) {
log.info("开始计算交换机月95带宽值...");
try {
String dayOrMonth = "2";
InitialSwitchInfoDetails queryParam = new InitialSwitchInfoDetails();
queryParam.setDayOrMonth(dayOrMonth);
initialSwitchInfoDetailsService.calculateSwitch95BandwidthDaily(queryParam, monthlyStartTime, monthlyEndTime, calculationMode);
log.info("交换机月95带宽值计算完成");
} catch (Exception e) {
log.error("计算交换机月95带宽值失败", e);
}
}
}
@@ -0,0 +1,142 @@
package com.tongran.system.controller;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.PageDomain;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.EpsBusiness;
import com.tongran.system.service.IEpsBusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Random;
/**
* 业务信息Controller
*
* @author gyt
* @date 2025-08-18
*/
@RestController
@RequestMapping("/business")
public class EpsBusinessController extends BaseController
{
@Autowired
private IEpsBusinessService epsBusinessService;
/**
* 查询业务信息列表
*/
@RequiresPermissions("system:business:list")
@PostMapping("/list")
public TableDataInfo list(@RequestBody EpsBusiness epsBusiness)
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(epsBusiness.getPageNum());
pageDomain.setPageSize(epsBusiness.getPageSize());
startPage(pageDomain);
List<EpsBusiness> list = epsBusinessService.selectEpsBusinessList(epsBusiness);
return getDataTable(list);
}
/**
* 查询业务信息列表
*/
@RequiresPermissions("system:business:list")
@PostMapping("/getAllBusinessMsg")
public AjaxResult getAllBusinessMsg(@RequestBody EpsBusiness epsBusiness)
{
List<EpsBusiness> list = epsBusinessService.selectEpsBusinessList(epsBusiness);
return success(list);
}
/**
* 导出业务信息列表
*/
@RequiresPermissions("system:business:export")
@Log(title = "业务信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, @RequestBody EpsBusiness epsBusiness)
{
List<EpsBusiness> list = epsBusinessService.selectEpsBusinessList(epsBusiness);
ExcelUtil<EpsBusiness> util = new ExcelUtil<EpsBusiness>(EpsBusiness.class);
util.showColumn(epsBusiness.getProperties());
util.exportExcel(response, list, "业务信息数据");
}
/**
* 获取业务信息详细信息
*/
@RequiresPermissions("system:business:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(epsBusinessService.selectEpsBusinessById(id));
}
/**
* 新增业务信息
*/
@RequiresPermissions("system:business:add")
@Log(title = "业务信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EpsBusiness epsBusiness)
{
int rows = epsBusinessService.insertEpsBusiness(epsBusiness);
if(-1==rows){
return AjaxResult.error(500,"业务名称不可重复");
}
return toAjax(rows);
}
/**
* 修改业务信息
*/
@RequiresPermissions("system:business:edit")
@Log(title = "业务信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EpsBusiness epsBusiness)
{
int rows = epsBusinessService.updateEpsBusiness(epsBusiness);
if(-1==rows){
return AjaxResult.error(500,"业务名称不可重复");
}
return toAjax(rows);
}
/**
* 生成12位唯一标识
*/
@RequiresPermissions("system:business:list")
@GetMapping("/getBusinessCode")
public String getBusinessCode()
{
long timestamp = System.currentTimeMillis() / 100; // 取前10位(精确到0.1秒)
int random = new Random().nextInt(100); // 2位随机数(00~99
return String.format("%010d%02d", timestamp, random);
}
/**
* 验证业务名称是否存在
* @param epsBusiness
* @return
*/
@RequiresPermissions("system:business:list")
@PostMapping("/countByBusinessName")
public AjaxResult countByBusinessName(@RequestBody EpsBusiness epsBusiness)
{
int rows = epsBusinessService.countByBusinessName(epsBusiness);
if(rows>0){
return AjaxResult.error(500,"业务名称不可重复");
}else {
return AjaxResult.success("添加成功");
}
}
}
@@ -0,0 +1,115 @@
package com.tongran.system.controller;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.PageDomain;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.EpsBusinessDeploy;
import com.tongran.system.service.IEpsBusinessDeployService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 业务下发管理Controller
*
* @author gyt
* @date 2025-10-13
*/
@RestController
@RequestMapping("/businessDeploy")
public class EpsBusinessDeployController extends BaseController
{
@Autowired
private IEpsBusinessDeployService epsBusinessDeployService;
/**
* 查询业务下发管理列表
*/
@RequiresPermissions("system:businessDeploy:list")
@PostMapping("/list")
public TableDataInfo list(@RequestBody EpsBusinessDeploy epsBusinessDeploy)
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(epsBusinessDeploy.getPageNum());
pageDomain.setPageSize(epsBusinessDeploy.getPageSize());
startPage(pageDomain);
List<EpsBusinessDeploy> list = epsBusinessDeployService.selectEpsBusinessDeployList(epsBusinessDeploy);
return getDataTable(list);
}
/**
* 导出
* @param response
* @param epsBusinessDeploy
*/
@PostMapping("/export")
public void export(HttpServletResponse response, @RequestBody EpsBusinessDeploy epsBusinessDeploy)
{
List<EpsBusinessDeploy> list = epsBusinessDeployService.selectEpsBusinessDeployList(epsBusinessDeploy);
ExcelUtil<EpsBusinessDeploy> util = new ExcelUtil<EpsBusinessDeploy>(EpsBusinessDeploy.class);
util.showColumn(epsBusinessDeploy.getProperties());
util.exportExcel(response, list, "业务下发管理");
}
/**
* 获取业务下发管理详细信息
*/
@RequiresPermissions("system:businessDeploy:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(epsBusinessDeployService.selectEpsBusinessDeployById(id));
}
/**
* 新增业务下发管理
*/
@RequiresPermissions("system:businessDeploy:add")
@Log(title = "业务下发管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EpsBusinessDeploy epsBusinessDeploy)
{
return toAjax(epsBusinessDeployService.insertEpsBusinessDeploy(epsBusinessDeploy));
}
/**
* 修改业务下发管理
*/
@RequiresPermissions("system:businessDeploy:edit")
@Log(title = "业务下发管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EpsBusinessDeploy epsBusinessDeploy)
{
return toAjax(epsBusinessDeployService.updateEpsBusinessDeploy(epsBusinessDeploy));
}
/**
* 删除业务下发管理
*/
@RequiresPermissions("system:businessDeploy:remove")
@Log(title = "业务下发管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(epsBusinessDeployService.deleteEpsBusinessDeployByIds(ids));
}
/**
* 审核
* @param epsBusinessDeploy
* @return
*/
@RequiresPermissions("system:businessDeploy:review")
@PostMapping("/reviewBusiness")
public AjaxResult reviewBusiness(@RequestBody EpsBusinessDeploy epsBusinessDeploy){
return toAjax(epsBusinessDeployService.reviewBusiness(epsBusinessDeploy));
}
}
@@ -0,0 +1,109 @@
package com.tongran.system.controller;
import com.tongran.common.core.domain.R;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.PageDomain;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.InnerAuth;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.EpsBusinessScript;
import com.tongran.system.service.IEpsBusinessScriptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 业务脚本管理Controller
*
* @author gyt
* @date 2025-10-13
*/
@RestController
@RequestMapping("/businessScript")
public class EpsBusinessScriptController extends BaseController
{
@Autowired
private IEpsBusinessScriptService epsBusinessScriptService;
/**
* 查询业务脚本管理列表
*/
@RequiresPermissions("system:businessScript:list")
@PostMapping("/list")
public TableDataInfo list(@RequestBody EpsBusinessScript epsBusinessScript)
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(epsBusinessScript.getPageNum());
pageDomain.setPageSize(epsBusinessScript.getPageSize());
startPage(pageDomain);
List<EpsBusinessScript> list = epsBusinessScriptService.selectEpsBusinessScriptList(epsBusinessScript);
return getDataTable(list);
}
/**
* 获取业务脚本管理详细信息
*/
@RequiresPermissions("system:businessScript:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(epsBusinessScriptService.selectEpsBusinessScriptById(id));
}
/**
* 获取业务脚本管理详细信息
*/
@GetMapping(value = "/inner/{id}")
@InnerAuth
public R<EpsBusinessScript> innerGetInfo(@PathVariable("id") Long id)
{
return R.ok(epsBusinessScriptService.selectEpsBusinessScriptById(id));
}
/**
* 新增业务脚本管理
*/
@RequiresPermissions("system:businessScript:add")
@Log(title = "业务脚本管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EpsBusinessScript epsBusinessScript)
{
return toAjax(epsBusinessScriptService.insertEpsBusinessScript(epsBusinessScript));
}
/**
* 修改业务脚本管理
*/
@RequiresPermissions("system:businessScript:edit")
@Log(title = "业务脚本管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EpsBusinessScript epsBusinessScript)
{
return toAjax(epsBusinessScriptService.updateEpsBusinessScript(epsBusinessScript));
}
/**
* 删除业务脚本管理
*/
@RequiresPermissions("system:businessScript:remove")
@Log(title = "业务脚本管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(epsBusinessScriptService.deleteEpsBusinessScriptByIds(ids));
}
/**
* 获取所有业务脚本名称
* @return
*/
@RequiresPermissions("system:businessScript:list")
@GetMapping("/getAllScriptName")
public AjaxResult getAllScriptName(){
List<EpsBusinessScript> list = epsBusinessScriptService.selectEpsBusinessScriptList(new EpsBusinessScript());
return success(list);
}
}
@@ -0,0 +1,92 @@
package com.tongran.system.controller;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.EpsInitialTrafficData;
import com.tongran.system.service.EpsInitialTrafficDataService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
import static com.tongran.common.core.web.domain.AjaxResult.success;
/**
* EPS初始流量数据控制器
* 提供流量数据的REST接口
*/
@RestController
@RequestMapping("/epsTrafficData")
@RequiredArgsConstructor
public class EpsInitialTrafficDataController {
private final EpsInitialTrafficDataService epsInitialTrafficDataService;
/**
* 保存单条流量数据
* @param data 流量数据实体
* @return 操作结果
*/
@PostMapping
public ResponseEntity<Void> save(@RequestBody EpsInitialTrafficData data) {
epsInitialTrafficDataService.save(data);
return ResponseEntity.ok().build();
}
/**
* 批量保存流量数据
* @param dataList 流量数据表
* @return 操作结果
*/
@PostMapping("/batch")
public ResponseEntity<Void> saveBatch(@RequestBody EpsInitialTrafficData dataList) {
epsInitialTrafficDataService.saveBatch(dataList);
return ResponseEntity.ok().build();
}
/**
* 查询流量数据(POST方式)
* @param queryParam 查询参数实体
* @return 流量数据列表
*/
@PostMapping("/query")
public ResponseEntity<List<EpsInitialTrafficData>> query(@RequestBody EpsInitialTrafficData queryParam) {
List<EpsInitialTrafficData> result = epsInitialTrafficDataService.query(queryParam);
return ResponseEntity.ok(result);
}
/**
* 图形分析 - 95值/日
* @return
*/
@RequiresPermissions("system:bandwidth:list")
@PostMapping("/getServerGraphicalAnalysisDaily")
public AjaxResult getServerGraphicalAnalysisDaily(@RequestBody EpsInitialTrafficData queryParam){
List<Map<String, Object>> echartsData = epsInitialTrafficDataService.getServerGraphicalAnalysisDaily(queryParam);
return success(echartsData);
}
/**
* 图形分析 - 95值/日
* @return
*/
@RequiresPermissions("system:bandwidth:list")
@PostMapping("/getServerGraphicalAnalysisMonthy")
public AjaxResult getServerGraphicalAnalysisMonthy(@RequestBody EpsInitialTrafficData queryParam){
List<Map<String, Object>> echartsData = epsInitialTrafficDataService.getServerGraphicalAnalysisMonthy(queryParam);
return success(echartsData);
}
/**
* 监控看板-详情视图 出入流量
*/
// @RequiresPermissions("system:bandwidth:list")
// @PostMapping("/getServerTrafficByMonitorView")
// public AjaxResult getServerTrafficByMonitorView(@RequestBody EpsInitialTrafficData queryParam)
// {
// Map<String, Object> echartsData = epsInitialTrafficDataService.getServerTrafficByMonitorView(queryParam);
// return success(echartsData);
// }
}
@@ -0,0 +1,63 @@
package com.tongran.system.controller;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.page.PageDomain;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.EpsMethodChangeRecord;
import com.tongran.system.service.IEpsMethodChangeRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 收益方式修改记录Controller
*
* @author gyt
* @date 2025-08-19
*/
@RestController
@RequestMapping("/record")
public class EpsMethodChangeRecordController extends BaseController
{
@Autowired
private IEpsMethodChangeRecordService epsMethodChangeRecordService;
/**
* 查询收益方式修改记录列表
*/
@RequiresPermissions("system:record:list")
@PostMapping("/list")
public TableDataInfo list(@RequestBody EpsMethodChangeRecord epsMethodChangeRecord)
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(epsMethodChangeRecord.getPageNum());
pageDomain.setPageSize(epsMethodChangeRecord.getPageSize());
startPage(pageDomain);
List<EpsMethodChangeRecord> list = epsMethodChangeRecordService.selectEpsMethodChangeRecordList(epsMethodChangeRecord);
return getDataTable(list);
}
/**
* 导出收益方式修改记录列表
*/
@RequiresPermissions("system:record:export")
@Log(title = "收益方式修改记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, @RequestBody EpsMethodChangeRecord epsMethodChangeRecord)
{
List<EpsMethodChangeRecord> list = epsMethodChangeRecordService.selectEpsMethodChangeRecordList(epsMethodChangeRecord);
ExcelUtil<EpsMethodChangeRecord> util = new ExcelUtil<EpsMethodChangeRecord>(EpsMethodChangeRecord.class);
util.showColumn(epsMethodChangeRecord.getProperties());
util.exportExcel(response, list, "收益方式修改记录数据");
}
}
@@ -0,0 +1,344 @@
package com.tongran.system.controller;
import com.github.pagehelper.PageInfo;
import com.tongran.common.core.domain.R;
import com.tongran.common.core.exception.ServiceException;
import com.tongran.common.core.utils.DateUtils;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.PageDomain;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.InnerAuth;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.EpsInitialTrafficData;
import com.tongran.system.domain.EpsNodeBandwidth;
import com.tongran.system.domain.InitialSwitchInfoDetails;
import com.tongran.system.service.EpsInitialTrafficDataService;
import com.tongran.system.service.IEpsNodeBandwidthService;
import com.tongran.system.service.IInitialSwitchInfoDetailsService;
import com.tongran.system.util.CalculateUtil;
import com.tongran.system.util.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.webjars.NotFoundException;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.Map;
/**
* 节点带宽信息Controller
*
* @author gyt
* @date 2025-08-12
*/
@RestController
@RequestMapping("/bandwidth")
@Slf4j
public class EpsNodeBandwidthController extends BaseController
{
private static final DateTimeFormatter TIME_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
private static final ZoneId ZONE = ZoneId.of("Asia/Shanghai");
@Autowired
private IEpsNodeBandwidthService epsNodeBandwidthService;
@Autowired
private IInitialSwitchInfoDetailsService initialSwitchInfoDetailsService;
@Autowired
private EpsInitialTrafficDataService epsInitialTrafficDataService;
/**
* 查询节点带宽信息列表
*/
@RequiresPermissions("system:bandwidth:list")
@PostMapping("/list")
public TableDataInfo list(@RequestBody EpsNodeBandwidth epsNodeBandwidth)
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(epsNodeBandwidth.getPageNum());
pageDomain.setPageSize(epsNodeBandwidth.getPageSize());
startPage(pageDomain);
// 获取时间类型 1--日, 2--月
if(epsNodeBandwidth.getBandwidthType() != null){
String type = CalculateUtil.getTypeByBandwidthType(epsNodeBandwidth.getBandwidthType());
// 获取开始时间 结束时间
DateUtil.TimeRange startTimeRange = DateUtil.getTimeRange(DateUtils.parseDate(epsNodeBandwidth.getStartTime()),type);
DateUtil.TimeRange endTimeRange = DateUtil.getTimeRange(DateUtils.parseDate(epsNodeBandwidth.getEndTime()),type);
String startTime = startTimeRange.getStart();
String endTime = endTimeRange.getEnd();
epsNodeBandwidth.setStartTime(startTime);
epsNodeBandwidth.setEndTime(endTime);
}
List<EpsNodeBandwidth> list = epsNodeBandwidthService.selectEpsNodeBandwidthList(epsNodeBandwidth);
return getDataTable(list);
}
/**
* 导出节点带宽信息列表
*/
@RequiresPermissions("system:bandwidth:export")
@Log(title = "节点带宽信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, @RequestBody EpsNodeBandwidth epsNodeBandwidth)
{
List<EpsNodeBandwidth> list = epsNodeBandwidthService.selectEpsNodeBandwidthList(epsNodeBandwidth);
ExcelUtil<EpsNodeBandwidth> util = new ExcelUtil<EpsNodeBandwidth>(EpsNodeBandwidth.class);
util.showColumn(epsNodeBandwidth.getProperties());
util.exportExcel(response, list, "节点带宽信息数据");
}
/**
* 获取节点带宽信息详细信息
*/
@RequiresPermissions("system:bandwidth:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(epsNodeBandwidthService.selectEpsNodeBandwidthById(id));
}
/**
* 新增节点带宽信息
*/
@RequiresPermissions("system:bandwidth:add")
@Log(title = "节点带宽信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EpsNodeBandwidth epsNodeBandwidth)
{
return toAjax(epsNodeBandwidthService.insertEpsNodeBandwidth(epsNodeBandwidth));
}
/**
* 修改节点带宽信息
*/
@RequiresPermissions("system:bandwidth:edit")
@Log(title = "节点带宽信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EpsNodeBandwidth epsNodeBandwidth)
{
return toAjax(epsNodeBandwidthService.updateEpsNodeBandwidth(epsNodeBandwidth));
}
/**
* 重新计算
*/
@RequiresPermissions("system:bandwidth:query")
@GetMapping(value = "recalculate/{id}")
public AjaxResult recalculate(@PathVariable("id") Long id)
{
// 获取需要重新计算的信息
EpsNodeBandwidth epsNodeBandwidth = epsNodeBandwidthService.selectEpsNodeBandwidthById(id);
if (epsNodeBandwidth == null) {
throw new NotFoundException("未找到ID为" + id + "的服务器信息");
}
// 获取时间类型 1--日, 2--月
String type = CalculateUtil.getTypeByBandwidthType(epsNodeBandwidth.getBandwidthType());
// 设置开始时间,结束时间
DateUtil.TimeRange timeRange = DateUtil.getTimeRange(epsNodeBandwidth.getCreateTime(),type);
String dailyStartTime = timeRange.getStart();
String dailyEndTime = timeRange.getEnd();
if("1".equals(epsNodeBandwidth.getResourceType())){
// 重新计算服务器95带宽值
epsInitialTrafficDataService.recalculateServer95Bandwidth(epsNodeBandwidth, dailyStartTime, dailyEndTime, epsNodeBandwidth.getCalculationMode());
}else{
// 重新计算交换机95带宽值
initialSwitchInfoDetailsService.recalculateSwitch95Bandwidth(epsNodeBandwidth, dailyStartTime, dailyEndTime, epsNodeBandwidth.getCalculationMode());
}
return success();
}
/**
* 根据ID获取相关数据
* @param id 资源ID
* @return 表格数据信息
*/
@RequiresPermissions("system:bandwidth:query")
@GetMapping(value = "relatedData/traffic")
public TableDataInfo relatedData(Long id,Integer pageNum,Integer pageSize) {
// 1. 参数校验
if (id == null || id <= 0) {
throw new IllegalArgumentException("无效的资源ID");
}
try {
// 2. 查询服务器信息
EpsNodeBandwidth epsNodeBandwidth = epsNodeBandwidthService.selectEpsNodeBandwidthById(id);
epsNodeBandwidth.setPageNum(pageNum);
epsNodeBandwidth.setPageSize(pageSize);
if (epsNodeBandwidth == null) {
log.warn("未找到ID为{}的服务器信息", id);
throw new NotFoundException("未找到ID为" + id + "的服务器信息");
}
// 3. 获取时间范围
String type = CalculateUtil.getTypeByBandwidthType(epsNodeBandwidth.getBandwidthType());
DateUtil.TimeRange timeRange = DateUtil.getTimeRange(epsNodeBandwidth.getCreateTime(), type);
String dailyStartTime = timeRange.getStart();
String dailyEndTime = timeRange.getEnd();
// 5. 根据资源类型处理不同数据
String resourceType = epsNodeBandwidth.getResourceType();
String bandwidthType = epsNodeBandwidth.getBandwidthType();
if ("4".equals(bandwidthType) || "7".equals(bandwidthType)) {
// 处理特定带宽类型数据
PageInfo<EpsNodeBandwidth> pageInfo = epsNodeBandwidthService.getAvgDetailMsg(id,pageNum,pageSize, dailyStartTime, dailyEndTime);
return getDataTable(pageInfo.getList(),pageInfo.getTotal());
}
if ("1".equals(resourceType)) {
// 处理服务器流量数据
PageInfo<EpsInitialTrafficData> pageInfo = epsNodeBandwidthService.relatedData(epsNodeBandwidth, dailyStartTime, dailyEndTime);;
for (EpsInitialTrafficData epsInitialTrafficData : pageInfo.getList()) {
if("2".equals(epsInitialTrafficData.getRevenueMethod())){
BigDecimal packageBandwidth = epsInitialTrafficData.getPackageBandwidth();
BigDecimal outSpeed = (packageBandwidth != null)
? packageBandwidth.multiply(new BigDecimal("1000000"))
: BigDecimal.ZERO;
epsInitialTrafficData.setOutSpeed(outSpeed.toString());
}
}
return getDataTable(pageInfo.getList(), pageInfo.getTotal());
} else{
// 处理交换机信息
PageInfo<InitialSwitchInfoDetails> pageInfo = initialSwitchInfoDetailsService.getRelevantSwitch(
epsNodeBandwidth, dailyStartTime, dailyEndTime);
return getDataTable(pageInfo.getList(), pageInfo.getTotal());
}
} catch (Exception e) {
log.error("获取ID为{}的相关数据失败", id, e);
throw new ServiceException("获取数据失败,请稍后重试");
}
}
/**
* 生成月均日95值
*/
@RequiresPermissions("system:bandwidth:add")
@Log(title = "节点带宽信息", businessType = BusinessType.INSERT)
@PostMapping("/calculateAvg")
public AjaxResult calculateAvg(@RequestBody EpsNodeBandwidth epsNodeBandwidth)
{
return toAjax(epsNodeBandwidthService.calculateAvg(epsNodeBandwidth));
}
/**
* 图形分析-95带宽值mbps/日
*/
@RequiresPermissions("system:bandwidth:list")
@PostMapping("/graphicalAnalysisDaily")
public AjaxResult graphicalAnalysisDaily(@RequestBody EpsNodeBandwidth epsNodeBandwidth)
{
// 设置时间
DateUtil.setTimeDay(epsNodeBandwidth);
List<Map> list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "1", ChronoUnit.DAYS);
return success(list);
}
/**
* 图形分析-95带宽值mbps/月
*/
@RequiresPermissions("system:bandwidth:list")
@PostMapping("/graphicalAnalysisMonthly")
public AjaxResult graphicalAnalysisMonthly(@RequestBody EpsNodeBandwidth epsNodeBandwidth)
{
// 设置时间
DateUtil.setTimeMonth(epsNodeBandwidth);
List<Map> list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "2", ChronoUnit.MONTHS);
return success(list);
}
/**
* 图形分析-包端带宽值Mbps/日
*/
@RequiresPermissions("system:bandwidth:list")
@PostMapping("/graphicalAnalysisPackage")
public AjaxResult graphicalAnalysisPackage(@RequestBody EpsNodeBandwidth epsNodeBandwidth)
{
// 设置时间
DateUtil.setTimeDay(epsNodeBandwidth);
List<Map> list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "3", ChronoUnit.DAYS);
return success(list);
}
/**
* 图形分析-月均日95值
*/
@RequiresPermissions("system:bandwidth:list")
@PostMapping("/graphicalAnalysisAvgMonthly")
public AjaxResult graphicalAnalysisAvgMonthly(@RequestBody EpsNodeBandwidth epsNodeBandwidth)
{
// 设置时间
DateUtil.setTimeMonth(epsNodeBandwidth);
List<Map> list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "4", ChronoUnit.MONTHS);
return success(list);
}
/**
* 图形分析-有效-95带宽值Mbps/日
*/
@RequiresPermissions("system:bandwidth:list")
@PostMapping("/graphicalAnalysisEffectiveDaily")
public AjaxResult graphicalAnalysisEffectiveDaily(@RequestBody EpsNodeBandwidth epsNodeBandwidth)
{
// 设置时间
DateUtil.setTimeDay(epsNodeBandwidth);
List<Map> list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "5", ChronoUnit.DAYS);
return success(list);
}
/**
* 图形分析-有效-95带宽值Mbps/月
*/
@RequiresPermissions("system:bandwidth:list")
@PostMapping("/graphicalAnalysisEffectiveMonthly")
public AjaxResult graphicalAnalysisEffectiveMonthly(@RequestBody EpsNodeBandwidth epsNodeBandwidth)
{
// 设置时间
DateUtil.setTimeMonth(epsNodeBandwidth);
List<Map> list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "6", ChronoUnit.MONTHS);
return success(list);
}
/**
* 图形分析-有效-月均日95值
*/
@RequiresPermissions("system:bandwidth:list")
@PostMapping("/graphicalAnalysisEffectiveAvgMonthly")
public AjaxResult graphicalAnalysisEffectiveAvgMonthly(@RequestBody EpsNodeBandwidth epsNodeBandwidth)
{
// 设置时间
DateUtil.setTimeMonth(epsNodeBandwidth);
List<Map> list = epsNodeBandwidthService.graphicalAnalysis(epsNodeBandwidth, "7", ChronoUnit.MONTHS);
return success(list);
}
/**
* 查询节点带宽信息列表
*/
@PostMapping("/getEpsNodeBandWidthList")
@InnerAuth
public R<List<EpsNodeBandwidth>> getEpsNodeBandWidthList(@RequestBody EpsNodeBandwidth epsNodeBandwidth)
{
List<EpsNodeBandwidth> list = epsNodeBandwidthService.selectEpsNodeBandwidthList(epsNodeBandwidth);
return R.ok(list);
}
/**
* 监控看板-详情视图 95值列表
* @param epsNodeBandwidth
* @return
*/
@RequiresPermissions("system:bandwidth:list")
@PostMapping("/getListByMonitorView")
public TableDataInfo getListByMonitorView(@RequestBody EpsNodeBandwidth epsNodeBandwidth)
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(epsNodeBandwidth.getPageNum());
pageDomain.setPageSize(epsNodeBandwidth.getPageSize());
startPage(pageDomain);
List<EpsNodeBandwidth> list = epsNodeBandwidthService.getListByMonitorView(epsNodeBandwidth);
return getDataTable(list);
}
}
@@ -0,0 +1,85 @@
package com.tongran.system.controller;
import com.tongran.common.core.domain.R;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.PageDomain;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.InnerAuth;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.EpsServerRevenueConfig;
import com.tongran.system.service.IEpsServerRevenueConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 服务器收益方式配置Controller
*
* @author gyt
* @date 2025-08-19
*/
@RestController
@RequestMapping("/revenueConfig")
public class EpsServerRevenueConfigController extends BaseController
{
@Autowired
private IEpsServerRevenueConfigService epsServerRevenueConfigService;
/**
* 查询服务器收益方式配置列表
*/
@RequiresPermissions("system:config:list")
@PostMapping("/list")
public TableDataInfo list(@RequestBody EpsServerRevenueConfig epsServerRevenueConfig)
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(epsServerRevenueConfig.getPageNum());
pageDomain.setPageSize(epsServerRevenueConfig.getPageSize());
startPage(pageDomain);
List<EpsServerRevenueConfig> list = epsServerRevenueConfigService.selectEpsServerRevenueConfigList(epsServerRevenueConfig);
return getDataTable(list);
}
/**
* 导出服务器收益方式配置列表
*/
@RequiresPermissions("system:config:export")
@Log(title = "服务器收益方式配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, @RequestBody EpsServerRevenueConfig epsServerRevenueConfig)
{
List<EpsServerRevenueConfig> list = epsServerRevenueConfigService.selectEpsServerRevenueConfigList(epsServerRevenueConfig);
ExcelUtil<EpsServerRevenueConfig> util = new ExcelUtil<EpsServerRevenueConfig>(EpsServerRevenueConfig.class);
util.showColumn(epsServerRevenueConfig.getProperties());
util.exportExcel(response, list, "服务器收益方式配置数据");
}
/**
* 修改服务器收益方式配置
*/
@RequiresPermissions("system:config:edit")
@Log(title = "服务器收益方式配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EpsServerRevenueConfig epsServerRevenueConfig)
{
return toAjax(epsServerRevenueConfigService.updateEpsServerRevenueConfig(epsServerRevenueConfig));
}
/**
* 流量相关数据入库
*/
@InnerAuth
@PostMapping("/autoSaveServiceTrafficData")
public R<String> autoSaveServiceTrafficData(@RequestBody EpsServerRevenueConfig epsServerRevenueConfig)
{
return epsServerRevenueConfigService.autoSaveServiceTrafficData(epsServerRevenueConfig);
}
}
@@ -0,0 +1,160 @@
package com.tongran.system.controller;
import com.github.pagehelper.PageInfo;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.PageDomain;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.EpsTaskStatistics;
import com.tongran.system.service.IEpsTaskStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 业务95值计算任务Controller
*
* @author gyt
* @date 2025-10-29
*/
@RestController
@RequestMapping("/taskStatistics")
public class EpsTaskStatisticsController extends BaseController
{
@Autowired
private IEpsTaskStatisticsService epsTaskStatisticsService;
/**
* 查询业务95值计算任务列表
*/
@RequiresPermissions("system:taskStatistics:list")
@PostMapping("/list")
public TableDataInfo list(@RequestBody EpsTaskStatistics epsTaskStatistics)
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(epsTaskStatistics.getPageNum());
pageDomain.setPageSize(epsTaskStatistics.getPageSize());
startPage(pageDomain);
List<EpsTaskStatistics> list = epsTaskStatisticsService.selectEpsTaskStatisticsList(epsTaskStatistics);
return getDataTable(list);
}
/**
* 导出业务95值计算任务列表
*/
@RequiresPermissions("system:taskStatistics:export")
@Log(title = "业务95值计算任务", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, @RequestBody EpsTaskStatistics epsTaskStatistics)
{
List<EpsTaskStatistics> list = epsTaskStatisticsService.selectEpsTaskStatisticsList(epsTaskStatistics);
ExcelUtil<EpsTaskStatistics> util = new ExcelUtil<EpsTaskStatistics>(EpsTaskStatistics.class);
util.showColumn(epsTaskStatistics.getProperties());
util.exportExcel(response, list, "业务95值计算任务数据");
}
/**
* 获取业务95值计算任务详细信息
*/
@RequiresPermissions("system:taskStatistics:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(epsTaskStatisticsService.selectEpsTaskStatisticsById(id));
}
/**
* 新增业务95值计算任务
*/
@RequiresPermissions("system:taskStatistics:add")
@Log(title = "业务95值计算任务", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EpsTaskStatistics epsTaskStatistics)
{
return toAjax(epsTaskStatisticsService.insertEpsTaskStatistics(epsTaskStatistics));
}
/**
* 修改业务95值计算任务
*/
@RequiresPermissions("system:taskStatistics:edit")
@Log(title = "业务95值计算任务", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EpsTaskStatistics epsTaskStatistics)
{
return toAjax(epsTaskStatisticsService.updateEpsTaskStatistics(epsTaskStatistics));
}
/**
* 删除业务95值计算任务
*/
@RequiresPermissions("system:taskStatistics:remove")
@Log(title = "业务95值计算任务", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(epsTaskStatisticsService.deleteEpsTaskStatisticsByIds(ids));
}
/**
* 相关数据查询
*/
@RequiresPermissions("system:taskStatistics:list")
@PostMapping("/getRelateData")
public TableDataInfo getRelateData(@RequestBody EpsTaskStatistics epsTaskStatistics)
{
PageInfo<?> list = epsTaskStatisticsService.getRelateData(epsTaskStatistics);
return getDataTable(list.getList(), list.getTotal());
}
/**
* 修改相关数据
* @param epsTaskStatistics
* @return
*/
@RequiresPermissions("system:taskStatistics:edit")
@PostMapping("/updateRelateData")
public AjaxResult updateRelateData(@RequestBody EpsTaskStatistics epsTaskStatistics)
{
int rows = epsTaskStatisticsService.updateRelateData(epsTaskStatistics);
return toAjax(rows);
}
/**
* 重新计算
*/
@RequiresPermissions("system:taskStatistics:list")
@PostMapping("/recaculate")
public AjaxResult recaculate(@RequestBody EpsTaskStatistics epsTaskStatistics)
{
int rows = epsTaskStatisticsService.recaculate(epsTaskStatistics);
return toAjax(rows);
}
/**
* 图形查看
*/
@RequiresPermissions("system:taskStatistics:list")
@PostMapping("/getRraphicalMsg")
public AjaxResult getRraphicalMsg(@RequestBody EpsTaskStatistics epsTaskStatistics)
{
Map echartsMap = epsTaskStatisticsService.getRraphicalMsg(epsTaskStatistics);
return success(echartsMap);
}
/**
* 获取月均日95值的日列表
* @param epsTaskStatistics
* @return
*/
@RequiresPermissions("system:taskStatistics:list")
@PostMapping("/getAvgTimeList")
public AjaxResult getAvgTimeList(@RequestBody EpsTaskStatistics epsTaskStatistics)
{
List<String> avgTimeList = epsTaskStatisticsService.getAvgTimeList(epsTaskStatistics);
return success(avgTimeList);
}
}
@@ -0,0 +1,105 @@
package com.tongran.system.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.EpsTrafficData;
import com.tongran.system.service.IEpsTrafficDataService;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.page.TableDataInfo;
/**
* 流量相关数据Controller
*
* @author gyt
* @date 2025-08-12
*/
@RestController
@RequestMapping("/data")
public class EpsTrafficDataController extends BaseController
{
@Autowired
private IEpsTrafficDataService epsTrafficDataService;
/**
* 查询流量相关数据列表
*/
@RequiresPermissions("system:data:list")
@GetMapping("/list")
public TableDataInfo list(EpsTrafficData epsTrafficData)
{
startPage();
List<EpsTrafficData> list = epsTrafficDataService.selectEpsTrafficDataList(epsTrafficData);
return getDataTable(list);
}
/**
* 导出流量相关数据列表
*/
@RequiresPermissions("system:data:export")
@Log(title = "流量相关数据", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EpsTrafficData epsTrafficData)
{
List<EpsTrafficData> list = epsTrafficDataService.selectEpsTrafficDataList(epsTrafficData);
ExcelUtil<EpsTrafficData> util = new ExcelUtil<EpsTrafficData>(EpsTrafficData.class);
util.exportExcel(response, list, "流量相关数据数据");
}
/**
* 获取流量相关数据详细信息
*/
@RequiresPermissions("system:data:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(epsTrafficDataService.selectEpsTrafficDataById(id));
}
/**
* 新增流量相关数据
*/
@RequiresPermissions("system:data:add")
@Log(title = "流量相关数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EpsTrafficData epsTrafficData)
{
return toAjax(epsTrafficDataService.insertEpsTrafficData(epsTrafficData));
}
/**
* 修改流量相关数据
*/
@RequiresPermissions("system:data:edit")
@Log(title = "流量相关数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EpsTrafficData epsTrafficData)
{
return toAjax(epsTrafficDataService.updateEpsTrafficData(epsTrafficData));
}
/**
* 删除流量相关数据
*/
@RequiresPermissions("system:data:remove")
@Log(title = "流量相关数据", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(epsTrafficDataService.deleteEpsTrafficDataByIds(ids));
}
}
@@ -0,0 +1,151 @@
package com.tongran.system.controller;
import com.github.pagehelper.PageInfo;
import com.tongran.common.core.domain.R;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.InnerAuth;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.InitialSwitchInfoDetails;
import com.tongran.system.service.IInitialSwitchInfoDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 交换机监控信息Controller
*
* @author gyt
* @date 2025-08-26
*/
@RestController
@RequestMapping("/switchInfoDetails")
public class InitialSwitchInfoDetailsController extends BaseController
{
@Autowired
private IInitialSwitchInfoDetailsService initialSwitchInfoDetailsService;
/**
* 查询交换机监控信息列表
*/
@RequiresPermissions("system:switchInfoDetails:list")
@GetMapping("/list")
public TableDataInfo list(InitialSwitchInfoDetails initialSwitchInfoDetails)
{
startPage();
List<InitialSwitchInfoDetails> list = initialSwitchInfoDetailsService.selectInitialSwitchInfoDetailsList(initialSwitchInfoDetails);
return getDataTable(list);
}
/**
* 导出交换机监控信息列表
*/
@RequiresPermissions("system:switchInfoDetails:export")
@Log(title = "交换机监控信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, InitialSwitchInfoDetails initialSwitchInfoDetails)
{
List<InitialSwitchInfoDetails> list = initialSwitchInfoDetailsService.selectInitialSwitchInfoDetailsList(initialSwitchInfoDetails);
ExcelUtil<InitialSwitchInfoDetails> util = new ExcelUtil<InitialSwitchInfoDetails>(InitialSwitchInfoDetails.class);
util.exportExcel(response, list, "交换机监控信息数据");
}
/**
* 获取交换机监控信息详细信息
*/
@RequiresPermissions("system:switchInfoDetails:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(initialSwitchInfoDetailsService.selectInitialSwitchInfoDetailsById(id));
}
/**
* 新增交换机监控信息
*/
@RequiresPermissions("system:switchInfoDetails:add")
@Log(title = "交换机监控信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody InitialSwitchInfoDetails initialSwitchInfoDetails)
{
return toAjax(initialSwitchInfoDetailsService.insertInitialSwitchInfoDetails(initialSwitchInfoDetails));
}
/**
* 修改交换机监控信息
*/
@RequiresPermissions("system:switchInfoDetails:edit")
@Log(title = "交换机监控信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody InitialSwitchInfoDetails initialSwitchInfoDetails)
{
return toAjax(initialSwitchInfoDetailsService.updateInitialSwitchInfoDetails(initialSwitchInfoDetails));
}
/**
* 删除交换机监控信息
*/
@RequiresPermissions("system:switchInfoDetails:remove")
@Log(title = "交换机监控信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(initialSwitchInfoDetailsService.deleteInitialSwitchInfoDetailsByIds(ids));
}
/**
* 交换机流量相关数据入库
*/
@InnerAuth
@PostMapping("/autoSaveSwitchTraffic")
public R<String> autoSaveSwitchTraffic(@RequestBody InitialSwitchInfoDetails initialSwitchInfoDetails)
{
return initialSwitchInfoDetailsService.autoSaveSwitchTrafficSharding(initialSwitchInfoDetails);
}
/**
* 图形分析-95带宽值mbps/日 v1.1
*/
@RequiresPermissions("system:bandwidth:list")
@PostMapping("/getGraphicalAnalysisDaily")
public AjaxResult getGraphicalAnalysisDaily(@RequestBody InitialSwitchInfoDetails initialSwitchInfoDetails)
{
List<Map<String, Object>> echartsData = initialSwitchInfoDetailsService.getGraphicalAnalysisDaily(initialSwitchInfoDetails);
return success(echartsData);
}
/**
* 图形分析-95带宽值mbps/月 v1.1
*/
@RequiresPermissions("system:bandwidth:list")
@PostMapping("/getGraphicalAnalysisMonthy")
public AjaxResult getGraphicalAnalysisMonthy(@RequestBody InitialSwitchInfoDetails initialSwitchInfoDetails)
{
List<Map<String, Object>> echartsData = initialSwitchInfoDetailsService.getGraphicalAnalysisMonthy(initialSwitchInfoDetails);
return success(echartsData);
}
/**
* 监控看板-详情视图 出入流量
*/
// @RequiresPermissions("system:bandwidth:list")
// @PostMapping("/getSwitchTrafficByMonitorView")
// public AjaxResult getSwitchTrafficByMonitorView(@RequestBody InitialSwitchInfoDetails initialSwitchInfoDetails)
// {
// Map<String, Object> echartsData = initialSwitchInfoDetailsService.getMonitorViewDetails(initialSwitchInfoDetails);
// return success(echartsData);
// }
/**
* 监控看板-详情视图 出入流量列表
*/
@RequiresPermissions("system:bandwidth:list")
@PostMapping("/geSwitchListByMonitorView")
public TableDataInfo geSwitchListByMonitorView(@RequestBody InitialSwitchInfoDetails initialSwitchInfoDetails)
{
PageInfo pageInfo = initialSwitchInfoDetailsService.geSwitchListByMonitorView(initialSwitchInfoDetails);
return getDataTable(pageInfo.getList(), pageInfo.getTotal());
}
}
@@ -0,0 +1,103 @@
package com.tongran.system.controller;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.PageDomain;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.KnowledgeBase;
import com.tongran.system.service.IKnowledgeBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 知识库Controller
*
* @author gyt
* @date 2025-08-15
*/
@RestController
@RequestMapping("/knowledgebase")
public class KnowledgeBaseController extends BaseController
{
@Autowired
private IKnowledgeBaseService knowledgeBaseService;
/**
* 查询知识库列表
*/
@RequiresPermissions("system:knowledgebase:list")
@PostMapping("/list")
public TableDataInfo list(@RequestBody KnowledgeBase knowledgeBase)
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(knowledgeBase.getPageNum());
pageDomain.setPageSize(knowledgeBase.getPageSize());
startPage(pageDomain);
List<KnowledgeBase> list = knowledgeBaseService.selectKnowledgeBaseList(knowledgeBase);
return getDataTable(list);
}
/**
* 导出知识库列表
*/
@RequiresPermissions("system:knowledgebase:export")
@Log(title = "知识库", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, KnowledgeBase knowledgeBase)
{
List<KnowledgeBase> list = knowledgeBaseService.selectKnowledgeBaseList(knowledgeBase);
ExcelUtil<KnowledgeBase> util = new ExcelUtil<KnowledgeBase>(KnowledgeBase.class);
util.showColumn(knowledgeBase.getProperties());
util.exportExcel(response, list, "知识库数据");
}
/**
* 获取知识库详细信息
*/
@RequiresPermissions("system:knowledgebase:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(knowledgeBaseService.selectKnowledgeBaseById(id));
}
/**
* 新增知识库
*/
@RequiresPermissions("system:knowledgebase:add")
@Log(title = "知识库", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody KnowledgeBase knowledgeBase)
{
return toAjax(knowledgeBaseService.insertKnowledgeBase(knowledgeBase));
}
/**
* 修改知识库
*/
@RequiresPermissions("system:knowledgebase:edit")
@Log(title = "知识库", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody KnowledgeBase knowledgeBase)
{
return toAjax(knowledgeBaseService.updateKnowledgeBase(knowledgeBase));
}
/**
* 删除知识库
*/
@RequiresPermissions("system:knowledgebase:remove")
@Log(title = "知识库", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(knowledgeBaseService.deleteKnowledgeBaseByIds(ids));
}
}
@@ -0,0 +1,105 @@
package com.tongran.system.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.MtmMonitoringTemplate;
import com.tongran.system.service.IMtmMonitoringTemplateService;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.page.TableDataInfo;
/**
* 监控模板管理Controller
*
* @author gyt
* @date 2025-08-12
*/
@RestController
@RequestMapping("/template")
public class MtmMonitoringTemplateController extends BaseController
{
@Autowired
private IMtmMonitoringTemplateService mtmMonitoringTemplateService;
/**
* 查询监控模板管理列表
*/
@RequiresPermissions("system:template:list")
@GetMapping("/list")
public TableDataInfo list(MtmMonitoringTemplate mtmMonitoringTemplate)
{
startPage();
List<MtmMonitoringTemplate> list = mtmMonitoringTemplateService.selectMtmMonitoringTemplateList(mtmMonitoringTemplate);
return getDataTable(list);
}
/**
* 导出监控模板管理列表
*/
@RequiresPermissions("system:template:export")
@Log(title = "监控模板管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MtmMonitoringTemplate mtmMonitoringTemplate)
{
List<MtmMonitoringTemplate> list = mtmMonitoringTemplateService.selectMtmMonitoringTemplateList(mtmMonitoringTemplate);
ExcelUtil<MtmMonitoringTemplate> util = new ExcelUtil<MtmMonitoringTemplate>(MtmMonitoringTemplate.class);
util.exportExcel(response, list, "监控模板管理数据");
}
/**
* 获取监控模板管理详细信息
*/
@RequiresPermissions("system:template:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(mtmMonitoringTemplateService.selectMtmMonitoringTemplateById(id));
}
/**
* 新增监控模板管理
*/
@RequiresPermissions("system:template:add")
@Log(title = "监控模板管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MtmMonitoringTemplate mtmMonitoringTemplate)
{
return toAjax(mtmMonitoringTemplateService.insertMtmMonitoringTemplate(mtmMonitoringTemplate));
}
/**
* 修改监控模板管理
*/
@RequiresPermissions("system:template:edit")
@Log(title = "监控模板管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MtmMonitoringTemplate mtmMonitoringTemplate)
{
return toAjax(mtmMonitoringTemplateService.updateMtmMonitoringTemplate(mtmMonitoringTemplate));
}
/**
* 删除监控模板管理
*/
@RequiresPermissions("system:template:remove")
@Log(title = "监控模板管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(mtmMonitoringTemplateService.deleteMtmMonitoringTemplateByIds(ids));
}
}
@@ -0,0 +1,73 @@
package com.tongran.system.controller;
import com.github.pagehelper.PageInfo;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.system.domain.RmResourceGroup;
import com.tongran.system.domain.RmResourceRegistration;
import com.tongran.system.service.EpsInitialTrafficDataService;
import com.tongran.system.service.IRmResourceGroupService;
import com.tongran.system.service.IRmResourceRegistrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 资源监控API
*
* @author gyt
* @date 2025-08-25
*/
@RestController
@RequestMapping("/resourceMonitor")
public class ResourceMonitorController extends BaseController
{
@Autowired
private EpsInitialTrafficDataService epsInitialTrafficDataService;
@Autowired
private IRmResourceGroupService rmResourceGroupService;
@Autowired
private IRmResourceRegistrationService rmResourceRegistrationService;
/**
* 获取资源分组列表
* @return
*/
@GetMapping("/resourceGroupList")
public AjaxResult resourceGroupList(){
RmResourceGroup rmResourceGroup = new RmResourceGroup();
return success(rmResourceGroupService.selectRmResourceGroupList(rmResourceGroup));
}
/**
* 服务器整体发送带宽利用率
* @return
*/
@GetMapping("/trafficRateByServer")
public AjaxResult trafficRateByServer(){
return success(epsInitialTrafficDataService.trafficRateByServer());
}
/**
* 获取资源列表
* @return
*/
@PostMapping("/getRegisterListByGroupId")
public TableDataInfo getRegisterListByGroupId(@RequestBody RmResourceGroup rmResourceGroup){
// 拿到注册信息
PageInfo<RmResourceRegistration> pageInfo = rmResourceGroupService.getRegisterList(rmResourceGroup);
return getDataTable(pageInfo.getList(), pageInfo.getTotal());
}
/**
* 获取资源列表
* @return
*/
@PostMapping("/getAllRegisterListByGroupId")
public AjaxResult getAllRegisterListByGroupId(@RequestBody RmResourceGroup rmResourceGroup){
// 拿到注册信息
List<RmResourceRegistration> list = rmResourceGroupService.getAllRegisterList(rmResourceGroup);
return success(list);
}
}
@@ -0,0 +1,123 @@
package com.tongran.system.controller;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.PageDomain;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.RmEpsTopologyManagement;
import com.tongran.system.service.IRmEpsTopologyManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 拓扑管理Controller
*
* @author gyt
* @date 2025-08-12
*/
@RestController
@RequestMapping("/management")
public class RmEpsTopologyManagementController extends BaseController
{
@Autowired
private IRmEpsTopologyManagementService rmEpsTopologyManagementService;
/**
* 查询交换机/服务器名称
*/
@RequiresPermissions("system:management:list")
@PostMapping ("/getNamesByResoureType")
public List<RmEpsTopologyManagement> getNamesByResoureType(@RequestBody RmEpsTopologyManagement rmEpsTopologyManagement)
{
List<RmEpsTopologyManagement> list = rmEpsTopologyManagementService.selectRmEpsTopologyManagementList(rmEpsTopologyManagement);
return list;
}
/**
* 查询拓扑管理列表
*/
@RequiresPermissions("system:management:list")
@PostMapping("/list")
public TableDataInfo list(@RequestBody RmEpsTopologyManagement rmEpsTopologyManagement)
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(rmEpsTopologyManagement.getPageNum());
pageDomain.setPageSize(rmEpsTopologyManagement.getPageSize());
startPage(pageDomain);
List<RmEpsTopologyManagement> list = rmEpsTopologyManagementService.selectRmEpsTopologyManagementList(rmEpsTopologyManagement);
return getDataTable(list);
}
/**
* 查询拓扑管理图形
*/
@RequiresPermissions("system:management:list")
@PostMapping("/getListChart")
public AjaxResult getListChart(@RequestBody RmEpsTopologyManagement rmEpsTopologyManagement)
{
List<RmEpsTopologyManagement> list = rmEpsTopologyManagementService.selectRmEpsTopologyManagementList(rmEpsTopologyManagement);
return success(list);
}
/**
* 导出拓扑管理列表
*/
@RequiresPermissions("system:management:export")
@Log(title = "拓扑管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, @RequestBody RmEpsTopologyManagement rmEpsTopologyManagement)
{
List<RmEpsTopologyManagement> list = rmEpsTopologyManagementService.selectRmEpsTopologyManagementList(rmEpsTopologyManagement);
ExcelUtil<RmEpsTopologyManagement> util = new ExcelUtil<RmEpsTopologyManagement>(RmEpsTopologyManagement.class);
util.showColumn(rmEpsTopologyManagement.getProperties());
util.exportExcel(response, list, "拓扑管理数据");
}
/**
* 获取拓扑管理详细信息
*/
@RequiresPermissions("system:management:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(rmEpsTopologyManagementService.selectRmEpsTopologyManagementById(id));
}
/**
* 新增拓扑管理
*/
@RequiresPermissions("system:management:add")
@Log(title = "拓扑管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RmEpsTopologyManagement rmEpsTopologyManagement)
{
return toAjax(rmEpsTopologyManagementService.insertRmEpsTopologyManagement(rmEpsTopologyManagement));
}
/**
* 修改拓扑管理
*/
@RequiresPermissions("system:management:edit")
@Log(title = "拓扑管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RmEpsTopologyManagement rmEpsTopologyManagement)
{
return toAjax(rmEpsTopologyManagementService.updateRmEpsTopologyManagement(rmEpsTopologyManagement));
}
/**
* 删除拓扑管理
*/
@RequiresPermissions("system:management:remove")
@Log(title = "拓扑管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(rmEpsTopologyManagementService.deleteRmEpsTopologyManagementByIds(ids));
}
}
@@ -0,0 +1,96 @@
package com.tongran.system.controller;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.RmMonitorConfig;
import com.tongran.system.service.IRmMonitorConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 监控配置Controller
*
* @author gyt
* @date 2025-11-12
*/
@RestController
@RequestMapping("/monitorConfig")
public class RmMonitorConfigController extends BaseController
{
@Autowired
private IRmMonitorConfigService rmMonitorConfigService;
/**
* 查询监控配置列表
*/
@RequiresPermissions("system:monitorConfig:list")
@PostMapping("/list")
public AjaxResult list(@RequestBody RmMonitorConfig rmMonitorConfig)
{
List<RmMonitorConfig> list = rmMonitorConfigService.selectRmMonitorConfigList(rmMonitorConfig);
return success(list);
}
/**
* 导出监控配置列表
*/
@RequiresPermissions("system:monitorConfig:export")
@Log(title = "监控配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RmMonitorConfig rmMonitorConfig)
{
List<RmMonitorConfig> list = rmMonitorConfigService.selectRmMonitorConfigList(rmMonitorConfig);
ExcelUtil<RmMonitorConfig> util = new ExcelUtil<RmMonitorConfig>(RmMonitorConfig.class);
util.exportExcel(response, list, "监控配置数据");
}
/**
* 获取监控配置详细信息
*/
@RequiresPermissions("system:monitorConfig:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(rmMonitorConfigService.selectRmMonitorConfigById(id));
}
/**
* 新增监控配置
*/
@RequiresPermissions("system:monitorConfig:add")
@Log(title = "监控配置", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RmMonitorConfig rmMonitorConfig)
{
return toAjax(rmMonitorConfigService.insertRmMonitorConfig(rmMonitorConfig));
}
/**
* 修改监控配置
*/
@RequiresPermissions("system:monitorConfig:edit")
@Log(title = "监控配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RmMonitorConfig rmMonitorConfig)
{
return toAjax(rmMonitorConfigService.updateRmMonitorConfig(rmMonitorConfig));
}
/**
* 删除监控配置
*/
@RequiresPermissions("system:monitorConfig:remove")
@Log(title = "监控配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(rmMonitorConfigService.deleteRmMonitorConfigByIds(ids));
}
}
@@ -0,0 +1,40 @@
package com.tongran.system.controller;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.RmMonitorConfigDetails;
import com.tongran.system.service.IRmMonitorConfigDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* 监控看板详情Controller
*
* @author gyt
* @date 2025-11-14
*/
@RestController
@RequestMapping("/monitorConfigDetails")
public class RmMonitorConfigDetailsController extends BaseController
{
@Autowired
private IRmMonitorConfigDetailsService rmMonitorConfigDetailsService;
/**
* 监控看板-详情视图 出入流量
*/
@RequiresPermissions("system:bandwidth:list")
@PostMapping("/getTrafficByMonitorView")
public AjaxResult getTrafficByMonitorView(@RequestBody RmMonitorConfigDetails queryParam)
{
List<Map<String, Object>> echartsData = rmMonitorConfigDetailsService.getTrafficByMonitorView(queryParam);
return success(echartsData);
}
}
@@ -0,0 +1,105 @@
package com.tongran.system.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.RmRegistrationMachine;
import com.tongran.system.service.IRmRegistrationMachineService;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.page.TableDataInfo;
/**
* 绑定金山machinecodeController
*
* @author gyt
* @date 2025-10-10
*/
@RestController
@RequestMapping("/machine")
public class RmRegistrationMachineController extends BaseController
{
@Autowired
private IRmRegistrationMachineService rmRegistrationMachineService;
/**
* 查询绑定金山machinecode列表
*/
@RequiresPermissions("system:machine:list")
@GetMapping("/list")
public TableDataInfo list(RmRegistrationMachine rmRegistrationMachine)
{
startPage();
List<RmRegistrationMachine> list = rmRegistrationMachineService.selectRmRegistrationMachineList(rmRegistrationMachine);
return getDataTable(list);
}
/**
* 导出绑定金山machinecode列表
*/
@RequiresPermissions("system:machine:export")
@Log(title = "绑定金山machinecode", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RmRegistrationMachine rmRegistrationMachine)
{
List<RmRegistrationMachine> list = rmRegistrationMachineService.selectRmRegistrationMachineList(rmRegistrationMachine);
ExcelUtil<RmRegistrationMachine> util = new ExcelUtil<RmRegistrationMachine>(RmRegistrationMachine.class);
util.exportExcel(response, list, "绑定金山machinecode数据");
}
/**
* 获取绑定金山machinecode详细信息
*/
@RequiresPermissions("system:machine:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(rmRegistrationMachineService.selectRmRegistrationMachineById(id));
}
/**
* 新增绑定金山machinecode
*/
@RequiresPermissions("system:machine:add")
@Log(title = "绑定金山machinecode", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RmRegistrationMachine rmRegistrationMachine)
{
return toAjax(rmRegistrationMachineService.insertRmRegistrationMachine(rmRegistrationMachine));
}
/**
* 修改绑定金山machinecode
*/
@RequiresPermissions("system:machine:edit")
@Log(title = "绑定金山machinecode", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RmRegistrationMachine rmRegistrationMachine)
{
return toAjax(rmRegistrationMachineService.updateRmRegistrationMachine(rmRegistrationMachine));
}
/**
* 删除绑定金山machinecode
*/
@RequiresPermissions("system:machine:remove")
@Log(title = "绑定金山machinecode", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(rmRegistrationMachineService.deleteRmRegistrationMachineByIds(ids));
}
}
@@ -0,0 +1,126 @@
package com.tongran.system.controller;
import com.tongran.common.core.domain.R;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.PageDomain;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.InnerAuth;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.RmResourceGroup;
import com.tongran.system.service.IRmResourceGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 资源分组Controller
*
* @author gyt
* @date 2025-08-12
*/
@RestController
@RequestMapping("/group")
public class RmResourceGroupController extends BaseController
{
@Autowired
private IRmResourceGroupService rmResourceGroupService;
/**
* 查询资源分组列表
*/
@RequiresPermissions("system:group:list")
@PostMapping("/list")
public TableDataInfo list(@RequestBody RmResourceGroup rmResourceGroup)
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(rmResourceGroup.getPageNum());
pageDomain.setPageSize(rmResourceGroup.getPageSize());
startPage(pageDomain);
List<RmResourceGroup> list = rmResourceGroupService.selectRmResourceGroupList(rmResourceGroup);
return getDataTable(list);
}
/**
* 导出资源分组列表
*/
@RequiresPermissions("system:group:export")
@Log(title = "资源分组", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, @RequestBody RmResourceGroup rmResourceGroup)
{
List<RmResourceGroup> list = rmResourceGroupService.selectRmResourceGroupList(rmResourceGroup);
ExcelUtil<RmResourceGroup> util = new ExcelUtil<RmResourceGroup>(RmResourceGroup.class);
util.showColumn(rmResourceGroup.getProperties());
util.exportExcel(response, list, "资源分组数据");
}
/**
* 获取资源分组详细信息
*/
@RequiresPermissions("system:group:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(rmResourceGroupService.selectRmResourceGroupById(id));
}
/**
* 新增资源分组
*/
@RequiresPermissions("system:group:add")
@Log(title = "资源分组", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RmResourceGroup rmResourceGroup)
{
return toAjax(rmResourceGroupService.insertRmResourceGroup(rmResourceGroup));
}
/**
* 修改资源分组
*/
@RequiresPermissions("system:group:edit")
@Log(title = "资源分组", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RmResourceGroup rmResourceGroup)
{
return toAjax(rmResourceGroupService.updateRmResourceGroup(rmResourceGroup));
}
/**
* 删除资源分组
*/
@RequiresPermissions("system:group:remove")
@Log(title = "资源分组", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(rmResourceGroupService.deleteRmResourceGroupByIds(ids));
}
/**
* 获取资源分组详细信息
*/
@InnerAuth
@PostMapping(value = "/getResourceGroupMsgById")
public R<RmResourceGroup> getResourceGroupMsgById(@RequestBody Long id)
{
return R.ok(rmResourceGroupService.selectRmResourceGroupById(id));
}
/**
* 获取资源分组详细信息
*/
@RequiresPermissions("system:group:query")
@PostMapping(value = "/exitsResourceById")
public AjaxResult exitsResourceById(@RequestBody RmResourceGroup rmResourceGroup)
{
// 根据资源id查询该资源是否已经在资源组中
String exits = rmResourceGroupService.exitsResourceById(rmResourceGroup);
return success(exits);
}
}
@@ -0,0 +1,253 @@
package com.tongran.system.controller;
import com.tongran.common.core.domain.R;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.InnerAuth;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.api.domain.RmRegisterMsgRemote;
import com.tongran.system.api.domain.RmResourceRegistrationRemote;
import com.tongran.system.domain.RmResourceRegistration;
import com.tongran.system.service.IRmResourceRegistrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 资源注册Controller
*
* @author gyt
* @date 2025-08-12
*/
@RestController
@RequestMapping("/registration")
public class RmResourceRegistrationController extends BaseController
{
@Autowired
private IRmResourceRegistrationService rmResourceRegistrationService;
/**
* 查询资源注册列表
*/
@RequiresPermissions("system:registration:list")
@PostMapping("/list")
public TableDataInfo list(@RequestBody RmResourceRegistration rmResourceRegistration)
{
Map<String, Object> resultMap = rmResourceRegistrationService.getRegistrationTableInfoList(rmResourceRegistration);
if(rmResourceRegistration.getQueryParam() != null && rmResourceRegistration.getQueryParam() != ""){
return getDataTable((List<RmResourceRegistration>) resultMap.get("list"), (int) resultMap.get("total"));
}
return getDataTable((List<RmResourceRegistration>) resultMap.get("list"));
}
/**
* 导出资源注册列表
*/
@RequiresPermissions("system:registration:export")
@Log(title = "资源注册", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, @RequestBody RmResourceRegistration rmResourceRegistration)
{
List<RmResourceRegistration> list = rmResourceRegistrationService.selectRmResourceRegistrationList(rmResourceRegistration);
ExcelUtil<RmResourceRegistration> util = new ExcelUtil<RmResourceRegistration>(RmResourceRegistration.class);
util.showColumn(rmResourceRegistration.getProperties());
util.exportExcel(response, list, "资源注册数据");
}
/**
* 获取资源注册详细信息
*/
@RequiresPermissions("system:registration:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(rmResourceRegistrationService.selectRmResourceRegistrationById(id));
}
/**
* 新增资源注册
*/
@RequiresPermissions("system:registration:add")
@Log(title = "资源注册", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RmResourceRegistration rmResourceRegistration)
{
int rows = rmResourceRegistrationService.insertRmResourceRegistration(rmResourceRegistration);
if(-1==rows){
return AjaxResult.error(500,"硬件SN不可重复");
}
return toAjax(rows);
}
/**
* 修改资源注册
*/
@RequiresPermissions("system:registration:edit")
@Log(title = "资源注册", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RmResourceRegistration rmResourceRegistration)
{
return toAjax(rmResourceRegistrationService.updateRmResourceRegistration(rmResourceRegistration));
}
/**
* 资源注册-注册
*/
@RequiresPermissions("system:registration:edit")
@Log(title = "资源注册-注册", businessType = BusinessType.UPDATE)
@PostMapping("/register")
public AjaxResult register(@RequestBody RmResourceRegistration rmResourceRegistration)
{
return toAjax(rmResourceRegistrationService.register(rmResourceRegistration));
}
/**
* 查询所有资源名称(包含设备使用)
* @return 资源注册集合
*/
@RequiresPermissions("system:group:list")
@GetMapping("/selectAllResourceName")
public List<Map> selectAllResourceName()
{
List<Map> list = rmResourceRegistrationService.selectAllResourceName();
return list;
}
/**
* 查询所有资源名称
* @return 资源注册集合
*/
@RequiresPermissions("system:group:list")
@PostMapping("/selectAllResourceNameByType")
public List<Map> selectAllResourceNameByType(@RequestBody RmResourceRegistration rmResourceRegistration)
{
List<Map> list = rmResourceRegistrationService.selectAllResourceNameByType(rmResourceRegistration);
return list;
}
/**
* 检测到服务器离线,修改状态为离线
* @param rmResourceRegistration
* @return
*/
@InnerAuth
@PostMapping("/updateStatusByResource")
public R<String> updateStatusByResource(@RequestBody RmResourceRegistration rmResourceRegistration)
{
R<String> rows = rmResourceRegistrationService.updateStatusByResource(rmResourceRegistration);
return rows;
}
/**
* 根据id查询资源信息
* @param ids
* @return
*/
@PostMapping("/getRegistrationByIds")
public R<List<RmResourceRegistration>> getRegistrationByIds(@RequestBody String[] ids)
{
List<RmResourceRegistration> list = rmResourceRegistrationService.getRegistrationByIds(ids);
return R.ok(list);
}
/**
* 查询资源注册列表
*/
@InnerAuth
@PostMapping("/getListByHardwareSn")
public R<RmResourceRegistration> getListByHardwareSn(@RequestBody RmResourceRegistration rmResourceRegistration)
{
List<RmResourceRegistration> list = rmResourceRegistrationService.selectRmResourceRegistrationList(rmResourceRegistration);
if(list != null && !list.isEmpty()){
return R.ok(list.get(0));
}
return R.ok(new RmResourceRegistration());
}
/**
* 查询资源注册列表
*/
@RequiresPermissions("system:registration:list")
@PostMapping("/getRegistList")
public AjaxResult getRegistList(@RequestBody RmResourceRegistration rmResourceRegistration)
{
List<RmResourceRegistration> list = rmResourceRegistrationService.selectRmResourceRegistrationList(rmResourceRegistration);
return success(list);
}
/**
* 自动注册服务器
* @param rmResourceRegistration mq接收的消息
* @return
*/
@PostMapping("/innerAddRegist")
@InnerAuth
public R<Integer> innerAddRegist(@RequestBody RmRegisterMsgRemote rmResourceRegistration)
{
int rows = rmResourceRegistrationService.innerAddRegist(rmResourceRegistration);
return R.ok(rows);
}
/**
* 添加节点标识
* @param rmResourceRegistration mq接收的消息
* @return
*/
@PostMapping("/innerUpdateRegist")
@InnerAuth
public R<Integer> innerUpdateRegist(@RequestBody RmResourceRegistrationRemote rmResourceRegistration)
{
int rows = rmResourceRegistrationService.innerUpdateRegist(rmResourceRegistration);
return R.ok(rows);
}
/**
* 选择公网业务IP
*/
@RequiresPermissions("system:registration:update")
@PostMapping("/bindBusinessPubulicIp")
public AjaxResult bindBusinessPubulicIp(@RequestBody RmResourceRegistration rmResourceRegistration)
{
int rows = rmResourceRegistrationService.bindBusinessPublicIp(rmResourceRegistration);
return toAjax(rows);
}
/**
* 查询所有逻辑标识节点
* @return 资源注册集合
*/
@RequiresPermissions("system:registration:list")
@GetMapping("/getAllLogicalNodeId")
public List<Map> getAllLogicalNodeId()
{
List<Map> list = rmResourceRegistrationService.getAllLogicalNodeId();
return list;
}
/**
* 绑定业务名称
* @return 资源注册集合
*/
@RequiresPermissions("system:registration:list")
@PostMapping("/bindBusinessByClientIds")
public AjaxResult bindBusinessByClientIds(@RequestBody RmResourceRegistration rmResourceRegistration)
{
int rows = rmResourceRegistrationService.bindBusinessByClientIds(rmResourceRegistration);
return toAjax(rows);
}
/**
* 根据clientId查询详情
* @return 资源注册集合
*/
@RequiresPermissions("system:registration:list")
@PostMapping("/getServerMsgByClientId")
public AjaxResult getServerMsgByClientId(@RequestBody RmResourceRegistration rmResourceRegistration)
{
List<RmResourceRegistration> list = rmResourceRegistrationService.selectRmResourceRegistrationList(rmResourceRegistration);
if(list != null && !list.isEmpty()){
return success(list.get(0));
}
return success(list);
}
}
@@ -0,0 +1,105 @@
package com.tongran.system.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.RmSwitchInterfaceInfo;
import com.tongran.system.service.IRmSwitchInterfaceInfoService;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.page.TableDataInfo;
/**
* 交换机接口信息Controller
*
* @author gyt
* @date 2025-10-10
*/
@RestController
@RequestMapping("/switchInterfaceInfo")
public class RmSwitchInterfaceInfoController extends BaseController
{
@Autowired
private IRmSwitchInterfaceInfoService rmSwitchInterfaceInfoService;
/**
* 查询交换机接口信息列表
*/
@RequiresPermissions("system:switchInterfaceInfo:list")
@GetMapping("/list")
public TableDataInfo list(RmSwitchInterfaceInfo rmSwitchInterfaceInfo)
{
startPage();
List<RmSwitchInterfaceInfo> list = rmSwitchInterfaceInfoService.selectRmSwitchInterfaceInfoList(rmSwitchInterfaceInfo);
return getDataTable(list);
}
/**
* 导出交换机接口信息列表
*/
@RequiresPermissions("system:switchInterfaceInfo:export")
@Log(title = "交换机接口信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RmSwitchInterfaceInfo rmSwitchInterfaceInfo)
{
List<RmSwitchInterfaceInfo> list = rmSwitchInterfaceInfoService.selectRmSwitchInterfaceInfoList(rmSwitchInterfaceInfo);
ExcelUtil<RmSwitchInterfaceInfo> util = new ExcelUtil<RmSwitchInterfaceInfo>(RmSwitchInterfaceInfo.class);
util.exportExcel(response, list, "交换机接口信息数据");
}
/**
* 获取交换机接口信息详细信息
*/
@RequiresPermissions("system:switchInterfaceInfo:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(rmSwitchInterfaceInfoService.selectRmSwitchInterfaceInfoById(id));
}
/**
* 新增交换机接口信息
*/
@RequiresPermissions("system:switchInterfaceInfo:add")
@Log(title = "交换机接口信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RmSwitchInterfaceInfo rmSwitchInterfaceInfo)
{
return toAjax(rmSwitchInterfaceInfoService.insertRmSwitchInterfaceInfo(rmSwitchInterfaceInfo));
}
/**
* 修改交换机接口信息
*/
@RequiresPermissions("system:switchInterfaceInfo:edit")
@Log(title = "交换机接口信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RmSwitchInterfaceInfo rmSwitchInterfaceInfo)
{
return toAjax(rmSwitchInterfaceInfoService.updateRmSwitchInterfaceInfo(rmSwitchInterfaceInfo));
}
/**
* 删除交换机接口信息
*/
@RequiresPermissions("system:switchInterfaceInfo:remove")
@Log(title = "交换机接口信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(rmSwitchInterfaceInfoService.deleteRmSwitchInterfaceInfoByIds(ids));
}
}
@@ -0,0 +1,144 @@
package com.tongran.system.controller;
import com.tongran.common.core.domain.R;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.PageDomain;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.InnerAuth;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.RmSwitchManagement;
import com.tongran.system.service.IRmSwitchManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 交换机管理Controller
*
* @author gyt
* @date 2025-10-10
*/
@RestController
@RequestMapping("/switchManagement")
public class RmSwitchManagementController extends BaseController
{
@Autowired
private IRmSwitchManagementService rmSwitchManagementService;
/**
* 查询交换机管理列表
*/
@RequiresPermissions("system:switchManagement:list")
@PostMapping("/list")
public TableDataInfo list(@RequestBody RmSwitchManagement rmSwitchManagement)
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(rmSwitchManagement.getPageNum());
pageDomain.setPageSize(rmSwitchManagement.getPageSize());
startPage(pageDomain);
List<RmSwitchManagement> list = rmSwitchManagementService.selectRmSwitchManagementList(rmSwitchManagement);
return getDataTable(list);
}
/**
* 导出交换机管理列表
*/
@RequiresPermissions("system:switchManagement:export")
@Log(title = "交换机管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RmSwitchManagement rmSwitchManagement)
{
List<RmSwitchManagement> list = rmSwitchManagementService.selectRmSwitchManagementList(rmSwitchManagement);
ExcelUtil<RmSwitchManagement> util = new ExcelUtil<RmSwitchManagement>(RmSwitchManagement.class);
util.showColumn(rmSwitchManagement.getProperties());
util.exportExcel(response, list, "交换机管理数据");
}
/**
* 获取交换机管理详细信息
*/
@RequiresPermissions("system:switchManagement:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(rmSwitchManagementService.selectRmSwitchManagementById(id));
}
/**
* 新增交换机管理
*/
@RequiresPermissions("system:switchManagement:add")
@Log(title = "交换机管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RmSwitchManagement rmSwitchManagement)
{
return toAjax(rmSwitchManagementService.insertRmSwitchManagement(rmSwitchManagement));
}
/**
* 修改交换机管理
*/
@RequiresPermissions("system:switchManagement:edit")
@Log(title = "交换机管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RmSwitchManagement rmSwitchManagement)
{
return toAjax(rmSwitchManagementService.updateRmSwitchManagement(rmSwitchManagement));
}
/**
* 删除交换机管理
*/
@RequiresPermissions("system:switchManagement:remove")
@Log(title = "交换机管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(rmSwitchManagementService.deleteRmSwitchManagementByIds(ids));
}
/**
* 查询交换机管理列表
*/
@RequiresPermissions("system:switchManagement:list")
@PostMapping("/getAllSwitchName")
public AjaxResult getAllSwitchName(@RequestBody RmSwitchManagement rmSwitchManagement)
{
List<RmSwitchManagement> list = rmSwitchManagementService.selectRmSwitchManagementList(rmSwitchManagement);
return success(list);
}
/**
* 查询交换机管理列表
*/
@InnerAuth
@PostMapping("/getSwitchNameByClientId")
public R<List<RmSwitchManagement>> getSwitchNameByClientId(@RequestBody RmSwitchManagement rmSwitchManagement)
{
List<RmSwitchManagement> list = rmSwitchManagementService.selectRmSwitchManagementList(rmSwitchManagement);
return R.ok(list);
}
/**
* 查询交换机信息树形接口
*/
@RequiresPermissions("system:switchManagement:list")
@GetMapping("/getAllSwitchNameTree")
public AjaxResult getAllSwitchNameTree()
{
List<RmSwitchManagement> list = rmSwitchManagementService.getAllSwitchNameTree();
return success(list);
}
/**
* 修改交换机管理
*/
@PostMapping("/updateSwitchMsgByClientId")
@InnerAuth
public R<Integer> updateSwitchMsgByClientId(@RequestBody RmSwitchManagement rmSwitchManagement)
{
return R.ok(rmSwitchManagementService.updateRmSwitchManagement(rmSwitchManagement));
}
}
@@ -0,0 +1,132 @@
package com.tongran.system.controller;
import com.tongran.common.core.constant.SecurityConstants;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.api.RemoteRocketMqService;
import com.tongran.system.domain.RmResourceRegistration;
import com.tongran.system.service.EpsInitialTrafficDataService;
import com.tongran.system.service.IEpsServerRevenueConfigService;
import com.tongran.system.service.IInitialSwitchInfoDetailsService;
import com.tongran.system.service.IRmResourceRegistrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
* 首页Controller
*
* @author gyt
* @date 2025-08-25
*/
@RestController
@RequestMapping("/screen")
public class ScreenController extends BaseController
{
@Autowired
private IEpsServerRevenueConfigService epsServerRevenueConfigService;
@Autowired
private IRmResourceRegistrationService rmResourceRegistrationService;
@Autowired
private EpsInitialTrafficDataService epsInitialTrafficDataService;
@Autowired
private IInitialSwitchInfoDetailsService initialSwitchInfoDetailsService;
@Autowired
private RemoteRocketMqService remoteRocketMqService;
/**
* 统计当前在线服务器的流量相关的业务数
* @return
*/
@RequiresPermissions("system:config:list")
@GetMapping("/countBusinessByTraffic")
public AjaxResult countBusinessByTraffic()
{
return success(epsServerRevenueConfigService.countBusinessByTraffic());
}
/**
* 服务器在线率
* @return
*/
@RequiresPermissions("system:config:list")
@GetMapping("/getServerOnlineRate")
public AjaxResult getServerOnlineRate()
{
return rmResourceRegistrationService.getServerOnlineRate();
}
/**
* 交换机在线数量
* @return
*/
@RequiresPermissions("system:config:list")
@GetMapping("/countSwitchNum")
public AjaxResult countSwitchNum()
{
RmResourceRegistration rmResourceRegistration = new RmResourceRegistration();
rmResourceRegistration.setResourceType("2");
// 查询资源列表(处理可能的null结果)
List<RmResourceRegistration> resourceList = Optional.ofNullable(rmResourceRegistrationService.selectRmResourceRegistrationList(rmResourceRegistration))
.orElse(Collections.emptyList());
int onlineCount = (int) resourceList.stream()
.filter(resource -> "1".equals(resource.getOnlineStatus()))
.count();
return AjaxResult.success()
.put("total", resourceList.size())
.put("onlineCount", onlineCount);
}
/**
* 当日业务的在线设备数量统计TOP5
* @return
*/
@RequiresPermissions("system:config:list")
@GetMapping("/countDeviceNumTop5")
public AjaxResult countDeviceNumTop5()
{
List<Map> maps = epsServerRevenueConfigService.countDeviceNumTop5();
if(maps.isEmpty()){
return success();
}else{
return success(maps);
}
}
/**
* 当前在线服务器发送带宽总流量
* @return
*/
@RequiresPermissions("system:config:list")
@GetMapping("/sumTrafficByServer")
public AjaxResult sumTrafficByServer()
{
return success(epsInitialTrafficDataService.sumTrafficByServer());
}
/**
* 当前在线交换机接收带宽总流量
* @return
*/
@RequiresPermissions("system:config:list")
@GetMapping("/sumTrafficBySwitch")
public AjaxResult sumTrafficBySwitch()
{
return success(initialSwitchInfoDetailsService.sumTrafficBySwitch());
}
/**
* 资源告警处理情况
* @return
*/
@RequiresPermissions("system:config:list")
@GetMapping("/alarmProcess")
public AjaxResult alarmProcess() {
Map alarmList = remoteRocketMqService.alarmHandlingStatus(SecurityConstants.INNER).getData();
return success(alarmList);
}
}
@@ -0,0 +1,133 @@
package com.tongran.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.common.security.utils.SecurityUtils;
import com.tongran.system.domain.SysConfig;
import com.tongran.system.service.ISysConfigService;
/**
* 参数配置 信息操作处理
*
* @author tongran
*/
@RestController
@RequestMapping("/config")
public class SysConfigController extends BaseController
{
@Autowired
private ISysConfigService configService;
/**
* 获取参数配置列表
*/
@RequiresPermissions("system:config:list")
@GetMapping("/list")
public TableDataInfo list(SysConfig config)
{
startPage();
List<SysConfig> list = configService.selectConfigList(config);
return getDataTable(list);
}
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:config:export")
@PostMapping("/export")
public void export(HttpServletResponse response, SysConfig config)
{
List<SysConfig> list = configService.selectConfigList(config);
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
util.exportExcel(response, list, "参数数据");
}
/**
* 根据参数编号获取详细信息
*/
@GetMapping(value = "/{configId}")
public AjaxResult getInfo(@PathVariable Long configId)
{
return success(configService.selectConfigById(configId));
}
/**
* 根据参数键名查询参数值
*/
@GetMapping(value = "/configKey/{configKey}")
public AjaxResult getConfigKey(@PathVariable String configKey)
{
return success(configService.selectConfigByKey(configKey));
}
/**
* 新增参数配置
*/
@RequiresPermissions("system:config:add")
@Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysConfig config)
{
if (!configService.checkConfigKeyUnique(config))
{
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setCreateBy(SecurityUtils.getUsername());
return toAjax(configService.insertConfig(config));
}
/**
* 修改参数配置
*/
@RequiresPermissions("system:config:edit")
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysConfig config)
{
if (!configService.checkConfigKeyUnique(config))
{
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setUpdateBy(SecurityUtils.getUsername());
return toAjax(configService.updateConfig(config));
}
/**
* 删除参数配置
*/
@RequiresPermissions("system:config:remove")
@Log(title = "参数管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{configIds}")
public AjaxResult remove(@PathVariable Long[] configIds)
{
configService.deleteConfigByIds(configIds);
return success();
}
/**
* 刷新参数缓存
*/
@RequiresPermissions("system:config:remove")
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache")
public AjaxResult refreshCache()
{
configService.resetConfigCache();
return success();
}
}
@@ -0,0 +1,133 @@
package com.tongran.system.controller;
import java.util.List;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tongran.common.core.constant.UserConstants;
import com.tongran.common.core.utils.StringUtils;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.common.security.utils.SecurityUtils;
import com.tongran.system.api.domain.SysDept;
import com.tongran.system.service.ISysDeptService;
/**
* 部门信息
*
* @author tongran
*/
@RestController
@RequestMapping("/dept")
public class SysDeptController extends BaseController
{
@Autowired
private ISysDeptService deptService;
/**
* 获取部门列表
*/
@RequiresPermissions("system:dept:list")
@GetMapping("/list")
public AjaxResult list(SysDept dept)
{
List<SysDept> depts = deptService.selectDeptList(dept);
return success(depts);
}
/**
* 查询部门列表(排除节点)
*/
@RequiresPermissions("system:dept:list")
@GetMapping("/list/exclude/{deptId}")
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
{
List<SysDept> depts = deptService.selectDeptList(new SysDept());
depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
return success(depts);
}
/**
* 根据部门编号获取详细信息
*/
@RequiresPermissions("system:dept:query")
@GetMapping(value = "/{deptId}")
public AjaxResult getInfo(@PathVariable Long deptId)
{
deptService.checkDeptDataScope(deptId);
return success(deptService.selectDeptById(deptId));
}
/**
* 新增部门
*/
@RequiresPermissions("system:dept:add")
@Log(title = "部门管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDept dept)
{
if (!deptService.checkDeptNameUnique(dept))
{
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
dept.setCreateBy(SecurityUtils.getUsername());
return toAjax(deptService.insertDept(dept));
}
/**
* 修改部门
*/
@RequiresPermissions("system:dept:edit")
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDept dept)
{
Long deptId = dept.getDeptId();
deptService.checkDeptDataScope(deptId);
if (!deptService.checkDeptNameUnique(dept))
{
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
else if (dept.getParentId().equals(deptId))
{
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
}
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
{
return error("该部门包含未停用的子部门!");
}
dept.setUpdateBy(SecurityUtils.getUsername());
return toAjax(deptService.updateDept(dept));
}
/**
* 删除部门
*/
@RequiresPermissions("system:dept:remove")
@Log(title = "部门管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{deptId}")
public AjaxResult remove(@PathVariable Long deptId)
{
if (deptService.hasChildByDeptId(deptId))
{
return warn("存在下级部门,不允许删除");
}
if (deptService.checkDeptExistUser(deptId))
{
return warn("部门存在用户,不允许删除");
}
deptService.checkDeptDataScope(deptId);
return toAjax(deptService.deleteDeptById(deptId));
}
}
@@ -0,0 +1,122 @@
package com.tongran.system.controller;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tongran.common.core.utils.StringUtils;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.common.security.utils.SecurityUtils;
import com.tongran.system.api.domain.SysDictData;
import com.tongran.system.service.ISysDictDataService;
import com.tongran.system.service.ISysDictTypeService;
/**
* 数据字典信息
*
* @author tongran
*/
@RestController
@RequestMapping("/dict/data")
public class SysDictDataController extends BaseController
{
@Autowired
private ISysDictDataService dictDataService;
@Autowired
private ISysDictTypeService dictTypeService;
@RequiresPermissions("system:dict:list")
@GetMapping("/list")
public TableDataInfo list(SysDictData dictData)
{
startPage();
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
return getDataTable(list);
}
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:dict:export")
@PostMapping("/export")
public void export(HttpServletResponse response, SysDictData dictData)
{
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
util.exportExcel(response, list, "字典数据");
}
/**
* 查询字典数据详细
*/
@RequiresPermissions("system:dict:query")
@GetMapping(value = "/{dictCode}")
public AjaxResult getInfo(@PathVariable Long dictCode)
{
return success(dictDataService.selectDictDataById(dictCode));
}
/**
* 根据字典类型查询字典数据信息
*/
@GetMapping(value = "/type/{dictType}")
public AjaxResult dictType(@PathVariable String dictType)
{
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
if (StringUtils.isNull(data))
{
data = new ArrayList<SysDictData>();
}
return success(data);
}
/**
* 新增字典类型
*/
@RequiresPermissions("system:dict:add")
@Log(title = "字典数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDictData dict)
{
dict.setCreateBy(SecurityUtils.getUsername());
return toAjax(dictDataService.insertDictData(dict));
}
/**
* 修改保存字典类型
*/
@RequiresPermissions("system:dict:edit")
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictData dict)
{
dict.setUpdateBy(SecurityUtils.getUsername());
return toAjax(dictDataService.updateDictData(dict));
}
/**
* 删除字典类型
*/
@RequiresPermissions("system:dict:remove")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictCodes}")
public AjaxResult remove(@PathVariable Long[] dictCodes)
{
dictDataService.deleteDictDataByIds(dictCodes);
return success();
}
}
@@ -0,0 +1,132 @@
package com.tongran.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.common.security.utils.SecurityUtils;
import com.tongran.system.api.domain.SysDictType;
import com.tongran.system.service.ISysDictTypeService;
/**
* 数据字典信息
*
* @author tongran
*/
@RestController
@RequestMapping("/dict/type")
public class SysDictTypeController extends BaseController
{
@Autowired
private ISysDictTypeService dictTypeService;
@RequiresPermissions("system:dict:list")
@GetMapping("/list")
public TableDataInfo list(SysDictType dictType)
{
startPage();
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list);
}
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:dict:export")
@PostMapping("/export")
public void export(HttpServletResponse response, SysDictType dictType)
{
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
util.exportExcel(response, list, "字典类型");
}
/**
* 查询字典类型详细
*/
@RequiresPermissions("system:dict:query")
@GetMapping(value = "/{dictId}")
public AjaxResult getInfo(@PathVariable Long dictId)
{
return success(dictTypeService.selectDictTypeById(dictId));
}
/**
* 新增字典类型
*/
@RequiresPermissions("system:dict:add")
@Log(title = "字典类型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDictType dict)
{
if (!dictTypeService.checkDictTypeUnique(dict))
{
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setCreateBy(SecurityUtils.getUsername());
return toAjax(dictTypeService.insertDictType(dict));
}
/**
* 修改字典类型
*/
@RequiresPermissions("system:dict:edit")
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictType dict)
{
if (!dictTypeService.checkDictTypeUnique(dict))
{
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setUpdateBy(SecurityUtils.getUsername());
return toAjax(dictTypeService.updateDictType(dict));
}
/**
* 删除字典类型
*/
@RequiresPermissions("system:dict:remove")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictIds}")
public AjaxResult remove(@PathVariable Long[] dictIds)
{
dictTypeService.deleteDictTypeByIds(dictIds);
return success();
}
/**
* 刷新字典缓存
*/
@RequiresPermissions("system:dict:remove")
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache")
public AjaxResult refreshCache()
{
dictTypeService.resetDictCache();
return success();
}
/**
* 获取字典选择框列表
*/
@GetMapping("/optionselect")
public AjaxResult optionselect()
{
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
return success(dictTypes);
}
}
@@ -0,0 +1,92 @@
package com.tongran.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tongran.common.core.constant.CacheConstants;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.redis.service.RedisService;
import com.tongran.common.security.annotation.InnerAuth;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.api.domain.SysLogininfor;
import com.tongran.system.service.ISysLogininforService;
/**
* 系统访问记录
*
* @author tongran
*/
@RestController
@RequestMapping("/logininfor")
public class SysLogininforController extends BaseController
{
@Autowired
private ISysLogininforService logininforService;
@Autowired
private RedisService redisService;
@RequiresPermissions("system:logininfor:list")
@GetMapping("/list")
public TableDataInfo list(SysLogininfor logininfor)
{
startPage();
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
return getDataTable(list);
}
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:logininfor:export")
@PostMapping("/export")
public void export(HttpServletResponse response, SysLogininfor logininfor)
{
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
util.exportExcel(response, list, "登录日志");
}
@RequiresPermissions("system:logininfor:remove")
@Log(title = "登录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{infoIds}")
public AjaxResult remove(@PathVariable Long[] infoIds)
{
return toAjax(logininforService.deleteLogininforByIds(infoIds));
}
@RequiresPermissions("system:logininfor:remove")
@Log(title = "登录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/clean")
public AjaxResult clean()
{
logininforService.cleanLogininfor();
return success();
}
@RequiresPermissions("system:logininfor:unlock")
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
@GetMapping("/unlock/{userName}")
public AjaxResult unlock(@PathVariable("userName") String userName)
{
redisService.deleteObject(CacheConstants.PWD_ERR_CNT_KEY + userName);
return success();
}
@InnerAuth
@PostMapping
public AjaxResult add(@RequestBody SysLogininfor logininfor)
{
return toAjax(logininforService.insertLogininfor(logininfor));
}
}
@@ -0,0 +1,48 @@
package com.tongran.system.controller;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.SysMenuClick;
import com.tongran.system.service.ISysMenuClickService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 菜单点击计数Controller
*
* @author gyt
* @date 2025-11-12
*/
@RestController
@RequestMapping("/sysMenuClick")
public class SysMenuClickController extends BaseController
{
@Autowired
private ISysMenuClickService sysMenuClickService;
/**
* 查询菜单点击计数列表
*/
@RequiresPermissions("system:sysMenuClick:list")
@GetMapping("/getMenuListTopEight")
public AjaxResult list()
{
List<SysMenuClick> list = sysMenuClickService.selectSysMenuClickList();
return success(list);
}
/**
* 新增菜单点击计数
*/
@RequiresPermissions("system:sysMenuClick:add")
@Log(title = "菜单点击计数", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysMenuClick sysMenuClick)
{
return toAjax(sysMenuClickService.insertSysMenuClick(sysMenuClick));
}
}
@@ -0,0 +1,159 @@
package com.tongran.system.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tongran.common.core.constant.UserConstants;
import com.tongran.common.core.utils.StringUtils;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.common.security.utils.SecurityUtils;
import com.tongran.system.domain.SysMenu;
import com.tongran.system.service.ISysMenuService;
/**
* 菜单信息
*
* @author tongran
*/
@RestController
@RequestMapping("/menu")
public class SysMenuController extends BaseController
{
@Autowired
private ISysMenuService menuService;
/**
* 获取菜单列表
*/
@RequiresPermissions("system:menu:list")
@GetMapping("/list")
public AjaxResult list(SysMenu menu)
{
Long userId = SecurityUtils.getUserId();
List<SysMenu> menus = menuService.selectMenuList(menu, userId);
return success(menus);
}
/**
* 根据菜单编号获取详细信息
*/
@RequiresPermissions("system:menu:query")
@GetMapping(value = "/{menuId}")
public AjaxResult getInfo(@PathVariable Long menuId)
{
return success(menuService.selectMenuById(menuId));
}
/**
* 获取菜单下拉树列表
*/
@GetMapping("/treeselect")
public AjaxResult treeselect(SysMenu menu)
{
Long userId = SecurityUtils.getUserId();
List<SysMenu> menus = menuService.selectMenuList(menu, userId);
return success(menuService.buildMenuTreeSelect(menus));
}
/**
* 加载对应角色菜单列表树
*/
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
{
Long userId = SecurityUtils.getUserId();
List<SysMenu> menus = menuService.selectMenuList(userId);
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
return ajax;
}
/**
* 新增菜单
*/
@RequiresPermissions("system:menu:add")
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysMenu menu)
{
if (!menuService.checkMenuNameUnique(menu))
{
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
}
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
{
return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
}
menu.setCreateBy(SecurityUtils.getUsername());
return toAjax(menuService.insertMenu(menu));
}
/**
* 修改菜单
*/
@RequiresPermissions("system:menu:edit")
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysMenu menu)
{
if (!menuService.checkMenuNameUnique(menu))
{
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
}
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
{
return error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
}
else if (menu.getMenuId().equals(menu.getParentId()))
{
return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
}
menu.setUpdateBy(SecurityUtils.getUsername());
return toAjax(menuService.updateMenu(menu));
}
/**
* 删除菜单
*/
@RequiresPermissions("system:menu:remove")
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{menuId}")
public AjaxResult remove(@PathVariable("menuId") Long menuId)
{
if (menuService.hasChildByMenuId(menuId))
{
return warn("存在子菜单,不允许删除");
}
if (menuService.checkMenuExistRole(menuId))
{
return warn("菜单已分配,不允许删除");
}
return toAjax(menuService.deleteMenuById(menuId));
}
/**
* 获取路由信息
*
* @return 路由信息
*/
@GetMapping("getRouters")
public AjaxResult getRouters()
{
Long userId = SecurityUtils.getUserId();
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
return success(menuService.buildMenus(menus));
}
}
@@ -0,0 +1,92 @@
package com.tongran.system.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.common.security.utils.SecurityUtils;
import com.tongran.system.domain.SysNotice;
import com.tongran.system.service.ISysNoticeService;
/**
* 公告 信息操作处理
*
* @author tongran
*/
@RestController
@RequestMapping("/notice")
public class SysNoticeController extends BaseController
{
@Autowired
private ISysNoticeService noticeService;
/**
* 获取通知公告列表
*/
@RequiresPermissions("system:notice:list")
@GetMapping("/list")
public TableDataInfo list(SysNotice notice)
{
startPage();
List<SysNotice> list = noticeService.selectNoticeList(notice);
return getDataTable(list);
}
/**
* 根据通知公告编号获取详细信息
*/
@RequiresPermissions("system:notice:query")
@GetMapping(value = "/{noticeId}")
public AjaxResult getInfo(@PathVariable Long noticeId)
{
return success(noticeService.selectNoticeById(noticeId));
}
/**
* 新增通知公告
*/
@RequiresPermissions("system:notice:add")
@Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysNotice notice)
{
notice.setCreateBy(SecurityUtils.getUsername());
return toAjax(noticeService.insertNotice(notice));
}
/**
* 修改通知公告
*/
@RequiresPermissions("system:notice:edit")
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysNotice notice)
{
notice.setUpdateBy(SecurityUtils.getUsername());
return toAjax(noticeService.updateNotice(notice));
}
/**
* 删除通知公告
*/
@RequiresPermissions("system:notice:remove")
@Log(title = "通知公告", businessType = BusinessType.DELETE)
@DeleteMapping("/{noticeIds}")
public AjaxResult remove(@PathVariable Long[] noticeIds)
{
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
}
}
@@ -0,0 +1,78 @@
package com.tongran.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.InnerAuth;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.api.domain.SysOperLog;
import com.tongran.system.service.ISysOperLogService;
/**
* 操作日志记录
*
* @author tongran
*/
@RestController
@RequestMapping("/operlog")
public class SysOperlogController extends BaseController
{
@Autowired
private ISysOperLogService operLogService;
@RequiresPermissions("system:operlog:list")
@GetMapping("/list")
public TableDataInfo list(SysOperLog operLog)
{
startPage();
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
return getDataTable(list);
}
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:operlog:export")
@PostMapping("/export")
public void export(HttpServletResponse response, SysOperLog operLog)
{
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
util.exportExcel(response, list, "操作日志");
}
@Log(title = "操作日志", businessType = BusinessType.DELETE)
@RequiresPermissions("system:operlog:remove")
@DeleteMapping("/{operIds}")
public AjaxResult remove(@PathVariable Long[] operIds)
{
return toAjax(operLogService.deleteOperLogByIds(operIds));
}
@RequiresPermissions("system:operlog:remove")
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
@DeleteMapping("/clean")
public AjaxResult clean()
{
operLogService.cleanOperLog();
return success();
}
@InnerAuth
@PostMapping
public AjaxResult add(@RequestBody SysOperLog operLog)
{
return toAjax(operLogService.insertOperlog(operLog));
}
}
@@ -0,0 +1,130 @@
package com.tongran.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.common.security.utils.SecurityUtils;
import com.tongran.system.domain.SysPost;
import com.tongran.system.service.ISysPostService;
/**
* 岗位信息操作处理
*
* @author tongran
*/
@RestController
@RequestMapping("/post")
public class SysPostController extends BaseController
{
@Autowired
private ISysPostService postService;
/**
* 获取岗位列表
*/
@RequiresPermissions("system:post:list")
@GetMapping("/list")
public TableDataInfo list(SysPost post)
{
startPage();
List<SysPost> list = postService.selectPostList(post);
return getDataTable(list);
}
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:post:export")
@PostMapping("/export")
public void export(HttpServletResponse response, SysPost post)
{
List<SysPost> list = postService.selectPostList(post);
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
util.exportExcel(response, list, "岗位数据");
}
/**
* 根据岗位编号获取详细信息
*/
@RequiresPermissions("system:post:query")
@GetMapping(value = "/{postId}")
public AjaxResult getInfo(@PathVariable Long postId)
{
return success(postService.selectPostById(postId));
}
/**
* 新增岗位
*/
@RequiresPermissions("system:post:add")
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysPost post)
{
if (!postService.checkPostNameUnique(post))
{
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
}
else if (!postService.checkPostCodeUnique(post))
{
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setCreateBy(SecurityUtils.getUsername());
return toAjax(postService.insertPost(post));
}
/**
* 修改岗位
*/
@RequiresPermissions("system:post:edit")
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysPost post)
{
if (!postService.checkPostNameUnique(post))
{
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
}
else if (!postService.checkPostCodeUnique(post))
{
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setUpdateBy(SecurityUtils.getUsername());
return toAjax(postService.updatePost(post));
}
/**
* 删除岗位
*/
@RequiresPermissions("system:post:remove")
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{postIds}")
public AjaxResult remove(@PathVariable Long[] postIds)
{
return toAjax(postService.deletePostByIds(postIds));
}
/**
* 获取岗位选择框列表
*/
@GetMapping("/optionselect")
public AjaxResult optionselect()
{
List<SysPost> posts = postService.selectPostAll();
return success(posts);
}
}
@@ -0,0 +1,163 @@
package com.tongran.system.controller;
import java.util.Arrays;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.tongran.common.core.domain.R;
import com.tongran.common.core.utils.DateUtils;
import com.tongran.common.core.utils.StringUtils;
import com.tongran.common.core.utils.file.FileTypeUtils;
import com.tongran.common.core.utils.file.MimeTypeUtils;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.service.TokenService;
import com.tongran.common.security.utils.SecurityUtils;
import com.tongran.system.api.RemoteFileService;
import com.tongran.system.api.domain.SysFile;
import com.tongran.system.api.domain.SysUser;
import com.tongran.system.api.model.LoginUser;
import com.tongran.system.service.ISysUserService;
/**
* 个人信息 业务处理
*
* @author tongran
*/
@RestController
@RequestMapping("/user/profile")
public class SysProfileController extends BaseController
{
@Autowired
private ISysUserService userService;
@Autowired
private TokenService tokenService;
@Autowired
private RemoteFileService remoteFileService;
/**
* 个人信息
*/
@GetMapping
public AjaxResult profile()
{
String username = SecurityUtils.getUsername();
SysUser user = userService.selectUserByUserName(username);
AjaxResult ajax = AjaxResult.success(user);
ajax.put("roleGroup", userService.selectUserRoleGroup(username));
ajax.put("postGroup", userService.selectUserPostGroup(username));
return ajax;
}
/**
* 修改用户
*/
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult updateProfile(@RequestBody SysUser user)
{
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser currentUser = loginUser.getSysUser();
currentUser.setNickName(user.getNickName());
currentUser.setEmail(user.getEmail());
currentUser.setPhonenumber(user.getPhonenumber());
currentUser.setSex(user.getSex());
if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser))
{
return error("修改用户'" + loginUser.getUsername() + "'失败,手机号码已存在");
}
if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser))
{
return error("修改用户'" + loginUser.getUsername() + "'失败,邮箱账号已存在");
}
if (userService.updateUserProfile(currentUser))
{
// 更新缓存用户信息
tokenService.setLoginUser(loginUser);
return success();
}
return error("修改个人信息异常,请联系管理员");
}
/**
* 重置密码
*/
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping("/updatePwd")
public AjaxResult updatePwd(@RequestBody Map<String, String> params)
{
String oldPassword = params.get("oldPassword");
String newPassword = params.get("newPassword");
LoginUser loginUser = SecurityUtils.getLoginUser();
Long userId = loginUser.getUserid();
String password = loginUser.getSysUser().getPassword();
if (!SecurityUtils.matchesPassword(oldPassword, password))
{
return error("修改密码失败,旧密码错误");
}
if (SecurityUtils.matchesPassword(newPassword, password))
{
return error("新密码不能与旧密码相同");
}
newPassword = SecurityUtils.encryptPassword(newPassword);
if (userService.resetUserPwd(userId, newPassword) > 0)
{
// 更新缓存用户密码&密码最后更新时间
loginUser.getSysUser().setPwdUpdateDate(DateUtils.getNowDate());
loginUser.getSysUser().setPassword(newPassword);
tokenService.setLoginUser(loginUser);
return success();
}
return error("修改密码异常,请联系管理员");
}
/**
* 头像上传
*/
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
@PostMapping("/avatar")
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file)
{
if (!file.isEmpty())
{
LoginUser loginUser = SecurityUtils.getLoginUser();
String extension = FileTypeUtils.getExtension(file);
if (!StringUtils.equalsAnyIgnoreCase(extension, MimeTypeUtils.IMAGE_EXTENSION))
{
return error("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtils.IMAGE_EXTENSION) + "格式");
}
R<SysFile> fileResult = remoteFileService.upload(file);
if (StringUtils.isNull(fileResult) || StringUtils.isNull(fileResult.getData()))
{
return error("文件服务异常,请联系管理员");
}
String url = fileResult.getData().getUrl();
if (userService.updateUserAvatar(loginUser.getUserid(), url))
{
String oldAvatarUrl = loginUser.getSysUser().getAvatar();
if (StringUtils.isNotEmpty(oldAvatarUrl))
{
remoteFileService.delete(oldAvatarUrl);
}
AjaxResult ajax = AjaxResult.success();
ajax.put("imgUrl", url);
// 更新缓存用户头像
loginUser.getSysUser().setAvatar(url);
tokenService.setLoginUser(loginUser);
return ajax;
}
}
return error("上传图片异常,请联系管理员");
}
}
@@ -0,0 +1,239 @@
package com.tongran.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.common.security.utils.SecurityUtils;
import com.tongran.system.api.domain.SysDept;
import com.tongran.system.api.domain.SysRole;
import com.tongran.system.api.domain.SysUser;
import com.tongran.system.domain.SysUserRole;
import com.tongran.system.service.ISysDeptService;
import com.tongran.system.service.ISysRoleService;
import com.tongran.system.service.ISysUserService;
/**
* 角色信息
*
* @author tongran
*/
@RestController
@RequestMapping("/role")
public class SysRoleController extends BaseController
{
@Autowired
private ISysRoleService roleService;
@Autowired
private ISysUserService userService;
@Autowired
private ISysDeptService deptService;
@RequiresPermissions("system:role:list")
@GetMapping("/list")
public TableDataInfo list(SysRole role)
{
startPage();
List<SysRole> list = roleService.selectRoleList(role);
return getDataTable(list);
}
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:role:export")
@PostMapping("/export")
public void export(HttpServletResponse response, SysRole role)
{
List<SysRole> list = roleService.selectRoleList(role);
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
util.exportExcel(response, list, "角色数据");
}
/**
* 根据角色编号获取详细信息
*/
@RequiresPermissions("system:role:query")
@GetMapping(value = "/{roleId}")
public AjaxResult getInfo(@PathVariable Long roleId)
{
roleService.checkRoleDataScope(roleId);
return success(roleService.selectRoleById(roleId));
}
/**
* 新增角色
*/
@RequiresPermissions("system:role:add")
@Log(title = "角色管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysRole role)
{
if (!roleService.checkRoleNameUnique(role))
{
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
}
else if (!roleService.checkRoleKeyUnique(role))
{
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
role.setCreateBy(SecurityUtils.getUsername());
return toAjax(roleService.insertRole(role));
}
/**
* 修改保存角色
*/
@RequiresPermissions("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysRole role)
{
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
if (!roleService.checkRoleNameUnique(role))
{
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
}
else if (!roleService.checkRoleKeyUnique(role))
{
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
role.setUpdateBy(SecurityUtils.getUsername());
return toAjax(roleService.updateRole(role));
}
/**
* 修改保存数据权限
*/
@RequiresPermissions("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/dataScope")
public AjaxResult dataScope(@RequestBody SysRole role)
{
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
return toAjax(roleService.authDataScope(role));
}
/**
* 状态修改
*/
@RequiresPermissions("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysRole role)
{
roleService.checkRoleAllowed(role);
roleService.checkRoleDataScope(role.getRoleId());
role.setUpdateBy(SecurityUtils.getUsername());
return toAjax(roleService.updateRoleStatus(role));
}
/**
* 删除角色
*/
@RequiresPermissions("system:role:remove")
@Log(title = "角色管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{roleIds}")
public AjaxResult remove(@PathVariable Long[] roleIds)
{
return toAjax(roleService.deleteRoleByIds(roleIds));
}
/**
* 获取角色选择框列表
*/
@RequiresPermissions("system:role:query")
@GetMapping("/optionselect")
public AjaxResult optionselect()
{
return success(roleService.selectRoleAll());
}
/**
* 查询已分配用户角色列表
*/
@RequiresPermissions("system:role:list")
@GetMapping("/authUser/allocatedList")
public TableDataInfo allocatedList(SysUser user)
{
startPage();
List<SysUser> list = userService.selectAllocatedList(user);
return getDataTable(list);
}
/**
* 查询未分配用户角色列表
*/
@RequiresPermissions("system:role:list")
@GetMapping("/authUser/unallocatedList")
public TableDataInfo unallocatedList(SysUser user)
{
startPage();
List<SysUser> list = userService.selectUnallocatedList(user);
return getDataTable(list);
}
/**
* 取消授权用户
*/
@RequiresPermissions("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancel")
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
{
return toAjax(roleService.deleteAuthUser(userRole));
}
/**
* 批量取消授权用户
*/
@RequiresPermissions("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancelAll")
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
{
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
}
/**
* 批量选择用户授权
*/
@RequiresPermissions("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/selectAll")
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
{
roleService.checkRoleDataScope(roleId);
return toAjax(roleService.insertAuthUsers(roleId, userIds));
}
/**
* 获取对应角色部门树列表
*/
@RequiresPermissions("system:role:query")
@GetMapping(value = "/deptTree/{roleId}")
public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
{
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
return ajax;
}
}
@@ -0,0 +1,380 @@
package com.tongran.system.controller;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.tongran.common.core.domain.R;
import com.tongran.common.core.text.Convert;
import com.tongran.common.core.utils.DateUtils;
import com.tongran.common.core.utils.StringUtils;
import com.tongran.common.core.utils.poi.ExcelUtil;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.InnerAuth;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.common.security.service.TokenService;
import com.tongran.common.security.utils.SecurityUtils;
import com.tongran.system.api.domain.SysDept;
import com.tongran.system.api.domain.SysRole;
import com.tongran.system.api.domain.SysUser;
import com.tongran.system.api.model.LoginUser;
import com.tongran.system.service.ISysConfigService;
import com.tongran.system.service.ISysDeptService;
import com.tongran.system.service.ISysPermissionService;
import com.tongran.system.service.ISysPostService;
import com.tongran.system.service.ISysRoleService;
import com.tongran.system.service.ISysUserService;
/**
* 用户信息
*
* @author tongran
*/
@RestController
@RequestMapping("/user")
public class SysUserController extends BaseController
{
@Autowired
private ISysUserService userService;
@Autowired
private ISysRoleService roleService;
@Autowired
private ISysDeptService deptService;
@Autowired
private ISysPostService postService;
@Autowired
private ISysPermissionService permissionService;
@Autowired
private ISysConfigService configService;
@Autowired
private TokenService tokenService;
/**
* 获取用户列表
*/
@RequiresPermissions("system:user:list")
@GetMapping("/list")
public TableDataInfo list(SysUser user)
{
startPage();
List<SysUser> list = userService.selectUserList(user);
return getDataTable(list);
}
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:user:export")
@PostMapping("/export")
public void export(HttpServletResponse response, SysUser user)
{
List<SysUser> list = userService.selectUserList(user);
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
util.exportExcel(response, list, "用户数据");
}
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
@RequiresPermissions("system:user:import")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
{
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
List<SysUser> userList = util.importExcel(file.getInputStream());
String operName = SecurityUtils.getUsername();
String message = userService.importUser(userList, updateSupport, operName);
return success(message);
}
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) throws IOException
{
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
util.importTemplateExcel(response, "用户数据");
}
/**
* 获取当前用户信息
*/
@InnerAuth
@GetMapping("/info/{username}")
public R<LoginUser> info(@PathVariable("username") String username)
{
SysUser sysUser = userService.selectUserByUserName(username);
if (StringUtils.isNull(sysUser))
{
return R.fail("用户名或密码错误");
}
// 角色集合
Set<String> roles = permissionService.getRolePermission(sysUser);
// 权限集合
Set<String> permissions = permissionService.getMenuPermission(sysUser);
LoginUser sysUserVo = new LoginUser();
sysUserVo.setSysUser(sysUser);
sysUserVo.setRoles(roles);
sysUserVo.setPermissions(permissions);
return R.ok(sysUserVo);
}
/**
* 注册用户信息
*/
@InnerAuth
@PostMapping("/register")
public R<Boolean> register(@RequestBody SysUser sysUser)
{
String username = sysUser.getUserName();
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
{
return R.fail("当前系统没有开启注册功能!");
}
if (!userService.checkUserNameUnique(sysUser))
{
return R.fail("保存用户'" + username + "'失败,注册账号已存在");
}
return R.ok(userService.registerUser(sysUser));
}
/**
*记录用户登录IP地址和登录时间
*/
@InnerAuth
@PutMapping("/recordlogin")
public R<Boolean> recordlogin(@RequestBody SysUser sysUser)
{
return R.ok(userService.updateUserProfile(sysUser));
}
/**
* 获取用户信息
*
* @return 用户信息
*/
@GetMapping("getInfo")
public AjaxResult getInfo()
{
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser user = loginUser.getSysUser();
// 角色集合
Set<String> roles = permissionService.getRolePermission(user);
// 权限集合
Set<String> permissions = permissionService.getMenuPermission(user);
if (!loginUser.getPermissions().equals(permissions))
{
loginUser.setPermissions(permissions);
tokenService.refreshToken(loginUser);
}
AjaxResult ajax = AjaxResult.success();
ajax.put("user", user);
ajax.put("roles", roles);
ajax.put("permissions", permissions);
ajax.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate()));
ajax.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate()));
return ajax;
}
// 检查初始密码是否提醒修改
public boolean initPasswordIsModify(Date pwdUpdateDate)
{
Integer initPasswordModify = Convert.toInt(configService.selectConfigByKey("sys.account.initPasswordModify"));
return initPasswordModify != null && initPasswordModify == 1 && pwdUpdateDate == null;
}
// 检查密码是否过期
public boolean passwordIsExpiration(Date pwdUpdateDate)
{
Integer passwordValidateDays = Convert.toInt(configService.selectConfigByKey("sys.account.passwordValidateDays"));
if (passwordValidateDays != null && passwordValidateDays > 0)
{
if (StringUtils.isNull(pwdUpdateDate))
{
// 如果从未修改过初始密码,直接提醒过期
return true;
}
Date nowDate = DateUtils.getNowDate();
return DateUtils.differentDaysByMillisecond(nowDate, pwdUpdateDate) > passwordValidateDays;
}
return false;
}
/**
* 根据用户编号获取详细信息
*/
@RequiresPermissions("system:user:query")
@GetMapping(value = { "/", "/{userId}" })
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
{
AjaxResult ajax = AjaxResult.success();
if (StringUtils.isNotNull(userId))
{
userService.checkUserDataScope(userId);
SysUser sysUser = userService.selectUserById(userId);
ajax.put(AjaxResult.DATA_TAG, sysUser);
ajax.put("postIds", postService.selectPostListByUserId(userId));
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
}
List<SysRole> roles = roleService.selectRoleAll();
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
ajax.put("posts", postService.selectPostAll());
return ajax;
}
/**
* 新增用户
*/
@RequiresPermissions("system:user:add")
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysUser user)
{
deptService.checkDeptDataScope(user.getDeptId());
roleService.checkRoleDataScope(user.getRoleIds());
if (!userService.checkUserNameUnique(user))
{
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
}
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
{
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
}
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
{
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
user.setCreateBy(SecurityUtils.getUsername());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
return toAjax(userService.insertUser(user));
}
/**
* 修改用户
*/
@RequiresPermissions("system:user:edit")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysUser user)
{
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
deptService.checkDeptDataScope(user.getDeptId());
roleService.checkRoleDataScope(user.getRoleIds());
if (!userService.checkUserNameUnique(user))
{
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
}
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
{
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
}
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
{
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
user.setUpdateBy(SecurityUtils.getUsername());
return toAjax(userService.updateUser(user));
}
/**
* 删除用户
*/
@RequiresPermissions("system:user:remove")
@Log(title = "用户管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{userIds}")
public AjaxResult remove(@PathVariable Long[] userIds)
{
if (ArrayUtils.contains(userIds, SecurityUtils.getUserId()))
{
return error("当前用户不能删除");
}
return toAjax(userService.deleteUserByIds(userIds));
}
/**
* 重置密码
*/
@RequiresPermissions("system:user:edit")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/resetPwd")
public AjaxResult resetPwd(@RequestBody SysUser user)
{
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
user.setUpdateBy(SecurityUtils.getUsername());
return toAjax(userService.resetPwd(user));
}
/**
* 状态修改
*/
@RequiresPermissions("system:user:edit")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysUser user)
{
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
user.setUpdateBy(SecurityUtils.getUsername());
return toAjax(userService.updateUserStatus(user));
}
/**
* 根据用户编号获取授权角色
*/
@RequiresPermissions("system:user:query")
@GetMapping("/authRole/{userId}")
public AjaxResult authRole(@PathVariable("userId") Long userId)
{
AjaxResult ajax = AjaxResult.success();
SysUser user = userService.selectUserById(userId);
List<SysRole> roles = roleService.selectRolesByUserId(userId);
ajax.put("user", user);
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
return ajax;
}
/**
* 用户授权角色
*/
@RequiresPermissions("system:user:edit")
@Log(title = "用户管理", businessType = BusinessType.GRANT)
@PutMapping("/authRole")
public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
{
userService.checkUserDataScope(userId);
roleService.checkRoleDataScope(roleIds);
userService.insertUserAuth(userId, roleIds);
return success();
}
/**
* 获取部门树列表
*/
@RequiresPermissions("system:user:list")
@GetMapping("/deptTree")
public AjaxResult deptTree(SysDept dept)
{
return success(deptService.selectDeptTreeList(dept));
}
}
@@ -0,0 +1,83 @@
package com.tongran.system.controller;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tongran.common.core.constant.CacheConstants;
import com.tongran.common.core.utils.StringUtils;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.core.web.page.TableDataInfo;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.redis.service.RedisService;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.api.model.LoginUser;
import com.tongran.system.domain.SysUserOnline;
import com.tongran.system.service.ISysUserOnlineService;
/**
* 在线用户监控
*
* @author tongran
*/
@RestController
@RequestMapping("/online")
public class SysUserOnlineController extends BaseController
{
@Autowired
private ISysUserOnlineService userOnlineService;
@Autowired
private RedisService redisService;
@RequiresPermissions("monitor:online:list")
@GetMapping("/list")
public TableDataInfo list(String ipaddr, String userName)
{
Collection<String> keys = redisService.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
for (String key : keys)
{
LoginUser user = redisService.getCacheObject(key);
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
{
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
}
else if (StringUtils.isNotEmpty(ipaddr))
{
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
}
else if (StringUtils.isNotEmpty(userName))
{
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
}
else
{
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
}
}
Collections.reverse(userOnlineList);
userOnlineList.removeAll(Collections.singleton(null));
return getDataTable(userOnlineList);
}
/**
* 强退用户
*/
@RequiresPermissions("monitor:online:forceLogout")
@Log(title = "在线用户", businessType = BusinessType.FORCE)
@DeleteMapping("/{tokenId}")
public AjaxResult forceLogout(@PathVariable String tokenId)
{
redisService.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
return success();
}
}
@@ -0,0 +1,50 @@
package com.tongran.system.controller;
import com.tongran.common.core.web.controller.BaseController;
import com.tongran.common.core.web.domain.AjaxResult;
import com.tongran.common.log.annotation.Log;
import com.tongran.common.log.enums.BusinessType;
import com.tongran.common.security.annotation.RequiresPermissions;
import com.tongran.system.domain.UserTableColumnConfig;
import com.tongran.system.service.IUserTableColumnConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 用户自定义列配置Controller
*
* @author gyt
* @date 2025-10-30
*/
@RestController
@RequestMapping("/columnConfig")
public class UserTableColumnConfigController extends BaseController
{
@Autowired
private IUserTableColumnConfigService userTableColumnConfigService;
/**
* 根据获取用户id获取自定义列配置详细信息
*/
@RequiresPermissions("system:columnConfig:query")
@PostMapping(value = "/getColumnConfigByUserId")
public AjaxResult getColumnConfigByUserId(@RequestBody UserTableColumnConfig userTableColumnConfig)
{
UserTableColumnConfig columnConfig = userTableColumnConfigService.getColumnConfigByUserId(userTableColumnConfig);
return success(columnConfig);
}
/**
* 新增用户自定义列配置
*/
@RequiresPermissions("system:columnConfig:add")
@Log(title = "用户自定义列配置", businessType = BusinessType.INSERT)
@PostMapping("addColumnConfig")
public AjaxResult add(@RequestBody UserTableColumnConfig userTableColumnConfig)
{
return toAjax(userTableColumnConfigService.insertUserTableColumnConfig(userTableColumnConfig));
}
}
@@ -0,0 +1,85 @@
package com.tongran.system.domain;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.util.Set;
/**
* 所有接口名称对象 all_interface_name
*
* @author gyt
* @date 2025-08-25
*/
@Data
public class AllInterfaceName extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 客户端唯一标识 */
@Excel(name = "客户端唯一标识")
private String clientId;
/** 接口名称 */
@Excel(name = "接口名称")
private String interfaceName;
/** 设备序列号 */
@Excel(name = "设备序列号")
private String deviceSn;
/** 节点名称 */
@Excel(name = "节点名称")
private String nodeName;
/** 业务代码 */
@Excel(name = "业务代码")
private String businessCode;
/** 业务名称 */
@Excel(name = "业务名称")
private String businessName;
/** 资源类型 */
@Excel(name = "资源类型")
private String resourceType;
/** 交换机名称 */
@Excel(name = "交换机名称")
private String switchName;
/** 接口连接设备类型 */
@Excel(name = "接口连接设备类型")
private String interfaceDeviceType;
/** 服务器网口 */
@Excel(name = "服务器网口")
private String serverPort;
/** 交换机硬件SN */
@Excel(name = "交换机硬件SN")
private String switchSn;
/** 接口名称集合 */
private Set<String> interfaceNames;
/** 交换机ip */
@Excel(name = "交换机ip")
private String switchIp;
/** 服务器ip */
@Excel(name = "服务器ip")
private String serverIp;
/** 交换机接口别名 */
private String otherName;
/** 业务需要 拼接id 交换机clientId,交换机接口名称值 别名 */
private String value;
/** 前端需要 name 别名 */
private String label;
/** 是否需要展开 */
private boolean expand;
}
@@ -0,0 +1,70 @@
package com.tongran.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
/**
* 业务信息对象 eps_business
*
* @author gyt
* @date 2025-08-18
*/
public class EpsBusiness extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 业务代码(12位唯一标识) */
private String id;
/** 业务名称 */
@Excel(name = "业务名称")
private String businessName;
/** 业务描述 */
private String description;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setBusinessName(String businessName)
{
this.businessName = businessName;
}
public String getBusinessName()
{
return businessName;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return description;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("businessName", getBusinessName())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.append("description", getDescription())
.toString();
}
}
@@ -0,0 +1,74 @@
package com.tongran.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.util.Date;
/**
* 业务下发管理对象 eps_business_deploy
*
* @author gyt
* @date 2025-10-13
*/
@Data
public class EpsBusinessDeploy extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 任务名称 */
@Excel(name = "任务名称")
private String taskName;
/** 业务code */
@Excel(name = "业务code")
private String businessCode;
/** 业务名称 */
@Excel(name = "业务名称")
private String businessName;
/** 脚本名称 */
@Excel(name = "脚本名称")
private String scriptName;
/** 脚本文件地址 */
@Excel(name = "脚本文件地址")
private String scriptPath;
/** 脚本参数 */
@Excel(name = "脚本参数")
private String scriptParams;
/** 部署设备 */
@Excel(name = "部署设备")
private String deployDevice;
/** 提交人 */
@Excel(name = "提交人")
private String submitBy;
/** 审核人 */
@Excel(name = "审核人")
private String reviewBy;
/** 审核状态(0-未提交,1-待审核,2-审核通过,3-审核驳回) */
@Excel(name = "审核状态")
private String reviewStatus;
/** 审核时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "审核时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date reviewTime;
/** 审核意见 */
@Excel(name = "审核意见")
private String reviewComment;
/** 服务器clientId */
private String clientId;
}
@@ -0,0 +1,35 @@
package com.tongran.system.domain;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
/**
* 业务脚本管理对象 eps_business_script
*
* @author gyt
* @date 2025-10-13
*/
@Data
public class EpsBusinessScript extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 脚本名称 */
@Excel(name = "脚本名称")
private String scriptName;
/** 脚本文件地址 */
@Excel(name = "脚本文件地址")
private String scriptPath;
/** 脚本默认参数 */
@Excel(name = "脚本默认参数")
private String defaultParams;
/** 结果失败判断关键字 */
@Excel(name = "结果失败判断关键字")
private String failedKeywords;
}
@@ -0,0 +1,133 @@
package com.tongran.system.domain;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* EPS初始流量数据实体类
* 用于存储设备的接收和发送流量数据
* 支持按时间自动分表存储(每月分成3个表)
*/
@Data
public class EpsInitialTrafficData extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 唯一标识ID */
private Long id;
/** 接口名称 */
@Excel(name = "接口名称")
private String name;
/** MAC地址 */
@Excel(name = "MAC地址")
private String mac;
/** 运行状态 */
@Excel(name = "运行状态")
private String status;
/** 接口类型 */
@Excel(name = "接口类型")
private String type;
/** IPv4地址 */
@Excel(name = "IPv4地址")
private String ipV4;
/** 入站丢包率(%) */
@Excel(name = "入站丢包率(%)")
private BigDecimal inDropped;
/** 出站丢包率(%) */
@Excel(name = "出站丢包率(%)")
private BigDecimal outDropped;
/** 接收带宽(Mbps) */
@Excel(name = "接收带宽(Mbps)")
private String inSpeed;
/** 发送带宽(Mbps) */
@Excel(name = "发送带宽(Mbps)")
private String outSpeed;
/** 协商速度 */
private String speed;
/** 工作模式 */
private String duplex;
/** 业务代码 */
@Excel(name = "业务代码")
private String businessId;
/** 业务名称 */
@Excel(name = "业务名称")
private String businessName;
/** 服务器SN */
@Excel(name = "服务器SN")
private String serviceSn;
/** 服务器名称 */
@Excel(name = "服务器名称")
private String nodeName;
/** 收益方式(1.流量,2包端) */
@Excel(name = "收益方式(1.流量,2包端)")
private String revenueMethod;
/** 包端带宽值 */
@Excel(name = "包端带宽值")
private BigDecimal packageBandwidth;
/** 批量插入集合 **/
private List<EpsInitialTrafficData> dataList;
/**
* 动态表名
* 格式:eps_traffic_[年]_[月]_[日期范围]
* 示例:eps_traffic_2023_08_1_10
*/
private String tableName;
/** 设备唯一标识 */
private String clientId;
/** 流量统计开始时间 */
private String startTime;
/** 流量统计结束时间 */
private String endTime;
/** 资源类型 */
private String resourceType;
/** 带宽类型 */
private String bandwidthType;
/** 日或月 */
private String dayOrMonth;
/** 金山流量 */
private String machineFlow;
/** 包含设备 */
private String clientIds;
/** 是否95值 */
private boolean flag95 = false;
/** 计算方式 */
private String calculationMode;
/** 95值 */
private BigDecimal percentile95;
/** 单位 */
private String unit;
/** 总接收带宽 */
private String totalInSpeed;
/** 总发送带宽 */
private String totalOutSpeed;
/** 监控看板id */
private Long monitorId;
}
@@ -0,0 +1,59 @@
package com.tongran.system.domain;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
/**
* 收益方式修改记录对象 eps_method_change_record
*
* @author gyt
* @date 2025-08-15
*/
@Data
public class EpsMethodChangeRecord extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 记录ID */
private Long id;
/** 节点名称 */
@Excel(name = "节点名称")
private String nodeName;
/** 修改内容 */
@Excel(name = "修改内容")
private String changeContent;
/** 硬件SN */
@Excel(name = "硬件SN")
private String hardwareSn;
/** 创建人 */
@Excel(name = "修改人")
private String creatBy;
/** 收益方式(1.流量,2包端) */
private String revenueMethod;
/** 流量网口 */
private String trafficPort;
/** 包端带宽值 */
private BigDecimal packageBandwidth;
/** 业务名称 */
private String businessName;
/** 业务代码(12位) */
private String businessCode;
/** 客户端id */
private String clientId;
/** 开始时间 */
private String startTime;
/** 结束时间 */
private String endTime;
}
@@ -0,0 +1,133 @@
package com.tongran.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 节点带宽信息对象 eps_node_bandwidth
*
* @author gyt
* @date 2025-08-12
*/
@Data
public class EpsNodeBandwidth extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 节点名称 */
@Excel(name = "节点名称")
private String nodeName;
/** 硬件SN */
@Excel(name = "硬件SN")
private String hardwareSn;
/** 带宽值类型
* 1-95带宽值Mbps/日
* 2-95带宽值Mbps/月
* 3-包端带宽值Mbps/日
* 4-月均日95值Mbps
* 5-有效-95带宽值Mbps/日
* 6-有效-95带宽值Mbps/月
* 7-有效-月均日95值
* */
private String bandwidthType;
/** 带宽值结果 */
private BigDecimal bandwidthResult;
/** 95带宽值Mbps/日 */
@Excel(name = "95带宽值Mbps/日")
private BigDecimal bandwidth95Daily;
/** 95带宽值Mbps/月 */
@Excel(name = "95带宽值Mbps/月")
private BigDecimal bandwidth95Monthly;
/** 月均日95值 */
@Excel(name = "月均日95值")
private BigDecimal avgMonthlyBandwidth95;
/** 包端带宽值Mbps/日 */
@Excel(name = "包端带宽值Mbps/日")
private BigDecimal packageBandwidthDaily;
/** 有效-95带宽值Mbps/日 */
@Excel(name = "有效-95带宽值Mbps/日")
private BigDecimal effectiveBandwidth95Daily;
/** 有效-95带宽值Mbps/月 */
@Excel(name = "有效-95带宽值Mbps/月")
private BigDecimal effectiveBandwidth95Monthly;
/** 有效-月均95值 */
@Excel(name = "有效-月均95值")
private BigDecimal effectiveAvgMonthlyBandwidth95;
/** 金山流量Mbps/日 */
private BigDecimal machineFlow;
/** 上联交换机 */
@Excel(name = "上联交换机")
private String uplinkSwitch;
/** 交换机sn */
@Excel(name = "交换机sn")
private String switchSn;
/** 接口名称 */
@Excel(name = "接口名称")
private String interfaceName;
/** 资源类型(1服务器,2交换机) */
@Excel(name = "资源类型")
private String resourceType;
/** 接口连接设备类型(1服务器,2机房出口) */
@Excel(name = "接口连接设备类型")
private String interfaceLinkDeviceType;
/** 业务名称 */
@Excel(name = "业务名称")
private String businessName;
/** 业务代码 */
@Excel(name = "业务代码")
private String businessId;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date createTime;
/** 开始时间 */
private String startTime;
/** 结束时间 */
private String endTime;
/** 月份 */
private String monthTime;
/** 交换机接口名称别名 */
private String remark1;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createDatetime;
/** 节点名称集合 */
private List<String> nodeNames;
/** 交换机名称集合 */
private List<String> switchNames;
/** 计算方式 */
private String calculationMode;
/** 客户端id */
private String clientId;
/** 交换机连接的服务器客户端id */
private String serverClientId;
/** 监控看板配置id */
private Long monitorId;
/** 服务器id \n 分割 */
private String clientIds;
}
@@ -0,0 +1,67 @@
package com.tongran.system.domain;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
/**
* 服务器收益方式配置对象 eps_server_revenue_config
*
* @author gyt
* @date 2025-08-19
*/
@Data
public class EpsServerRevenueConfig extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 唯一标识ID */
private Long id;
/** 节点名称 */
@Excel(name = "节点名称")
private String nodeName;
/** 收益方式(1.流量,2包端) */
@Excel(name = "收益方式(1.流量,2包端)")
private String revenueMethod;
/** 硬件SN */
@Excel(name = "硬件SN")
private String hardwareSn;
/** 流量网口 */
@Excel(name = "流量网口")
private String trafficPort;
/** 95带宽值(Mbps) */
@Excel(name = "95带宽值(Mbps)")
private BigDecimal bandwidth95;
/** 包端带宽值 */
@Excel(name = "包端带宽值")
private BigDecimal packageBandwidth;
/** 业务名称 */
@Excel(name = "业务名称")
private String businessName;
/** 业务代码(12位) */
@Excel(name = "业务代码(12位)")
private String businessCode;
/** 注册状态 */
@Excel(name = "注册状态")
private String registrationStatus;
/** 开始时间 */
private String startTime;
/** 结束时间 */
private String endTime;
/** 业务是否有变化 */
private String changed;
/** 服务器ip */
private String serverIp;
}
@@ -0,0 +1,79 @@
package com.tongran.system.domain;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
/**
* 业务95值计算任务对象 eps_task_statistics
*
* @author gyt
* @date 2025-10-29
*/
@Data
public class EpsTaskStatistics extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 任务名称 */
@Excel(name = "任务名称")
private String taskName;
/** 业务名称 */
@Excel(name = "业务名称")
private String businessName;
/** 业务代码 */
private String businessCode;
/** 开始时间 */
@Excel(name = "开始时间")
private String startTime;
/** 结束时间 */
@Excel(name = "结束时间")
private String endTime;
/** 95值 */
@Excel(name = "95值")
private BigDecimal percentile95;
/** 月均日95值 */
@Excel(name = "月均日95值")
private BigDecimal monthlyAvgPercentile95;
/** 资源类型 */
@Excel(name = "资源类型")
private String resourceType;
/** 包含资源 */
@Excel(name = "包含资源")
private String includedResources;
/** 计算类型 */
@Excel(name = "计算类型")
private String calculationType;
/** 计算模式 */
@Excel(name = "计算模式")
private String calculationMode;
/** 任务状态(1-计算中,2-计算完成) */
@Excel(name = "任务状态(1-计算中,2-计算完成)")
private String taskStatus;
/** 需要修改的流量值 */
private BigDecimal needSpeed;
/** 需要修改的值对应的时间 */
private String needTime;
/** 月均日相关数据时间 */
private String avgTime;
/** 接口名称s */
private String interfaceNames;
/** 时间段 */
private String timeRange;
}
@@ -0,0 +1,216 @@
package com.tongran.system.domain;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
/**
* 流量相关数据对象 eps_traffic_data
*
* @author gyt
* @date 2025-08-12
*/
public class EpsTrafficData extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 硬件SN */
@Excel(name = "硬件SN")
private String hardwareSn;
/** 节点名称 */
@Excel(name = "节点名称")
private String nodeName;
/** 收益方式 */
@Excel(name = "收益方式")
private String revenueMethod;
/** 流量端口 */
@Excel(name = "流量端口")
private String trafficPort;
/** 发送流量值(bytes */
@Excel(name = "发送流量值", readConverterExp = "b=ytes")
private Long txBytes;
/** 接收流量值(bytes */
@Excel(name = "接收流量值", readConverterExp = "b=ytes")
private Long rxBytes;
/** 包端带宽值(Mbps */
@Excel(name = "包端带宽值", readConverterExp = "M=bps")
private BigDecimal packageBandwidth;
/** 创建人id */
@Excel(name = "创建人id")
private Long creatorId;
/** 创建人名称 */
@Excel(name = "创建人名称")
private String creatorName;
/** 修改人id */
@Excel(name = "修改人id")
private Long updaterId;
/** 修改人名称 */
@Excel(name = "修改人名称")
private String updaterName;
/** 业务名称 */
private String businessName;
public String getBusinessName() {
return businessName;
}
public void setBusinessName(String businessName) {
this.businessName = businessName;
}
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 setNodeName(String nodeName)
{
this.nodeName = nodeName;
}
public String getNodeName()
{
return nodeName;
}
public void setRevenueMethod(String revenueMethod)
{
this.revenueMethod = revenueMethod;
}
public String getRevenueMethod()
{
return revenueMethod;
}
public void setTrafficPort(String trafficPort)
{
this.trafficPort = trafficPort;
}
public String getTrafficPort()
{
return trafficPort;
}
public void setTxBytes(Long txBytes)
{
this.txBytes = txBytes;
}
public Long getTxBytes()
{
return txBytes;
}
public void setRxBytes(Long rxBytes)
{
this.rxBytes = rxBytes;
}
public Long getRxBytes()
{
return rxBytes;
}
public void setPackageBandwidth(BigDecimal packageBandwidth)
{
this.packageBandwidth = packageBandwidth;
}
public BigDecimal getPackageBandwidth()
{
return packageBandwidth;
}
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("hardwareSn", getHardwareSn())
.append("nodeName", getNodeName())
.append("revenueMethod", getRevenueMethod())
.append("trafficPort", getTrafficPort())
.append("txBytes", getTxBytes())
.append("rxBytes", getRxBytes())
.append("packageBandwidth", getPackageBandwidth())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("creatorId", getCreatorId())
.append("creatorName", getCreatorName())
.append("updaterId", getUpdaterId())
.append("updaterName", getUpdaterName())
.toString();
}
}
@@ -0,0 +1,133 @@
package com.tongran.system.domain;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* 交换机监控信息对象 initial_switch_info_details
*
* @author gyt
* @date 2025-08-26
*/
@Data
public class InitialSwitchInfoDetails extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 自增主键ID */
private Long id;
/** 客户端ID */
@Excel(name = "客户端ID")
private String clientId;
/** 接口名称 */
@Excel(name = "接口名称")
private String name;
/** 接收流量(字节) */
@Excel(name = "接收流量(字节)")
private BigDecimal inBytes;
/** 发送流量(字节) */
@Excel(name = "发送流量(字节)")
private BigDecimal outBytes;
/** 接口状态(up/down等) */
@Excel(name = "接口状态(up/down等)")
private String status;
/** 接口类型*/
@Excel(name = "接口类型")
private String type;
/** 接收流量(bits/s */
@Excel(name = "接收流量")
private BigDecimal inSpeed;
/** 发送流量(bits/s */
@Excel(name = "发送流量")
private BigDecimal outSpeed;
/** 发送或接收流量的最大值 */
private BigDecimal maxSpeed;
/** 交换机名称 */
@Excel(name = "交换机名称")
private String switchName;
/** 接口连接设备类型 */
@Excel(name = "接口连接设备类型")
private String interfaceDeviceType;
/** 服务器名称 */
@Excel(name = "服务器名称")
private String serverName;
/** 服务器网口 */
@Excel(name = "服务器网口")
private String serverPort;
/** 服务器硬件SN */
@Excel(name = "服务器硬件SN")
private String serverSn;
/** 交换机硬件SN */
@Excel(name = "交换机硬件SN")
private String switchSn;
/** 业务代码 */
private String businessCode;
/** 业务名称 */
private String businessName;
/** 数据集合 */
private List<InitialSwitchInfoDetails> dataList;
private String startTime;
private String endTime;
/** 资源类型 */
private String resourceType;
/** 带宽类型 */
private String bandwidthType;
/** 日或月 */
private String dayOrMonth;
/** 交换机ip */
private String switchIp;
/** 端口配置速率(Mbps) */
private String ifSpeed;
/** 入站丢包 */
private String ifInDiscards;
/** 出站丢包 */
private String ifOutDiscards;
/** 错误的入站数据包数量 */
private String ifInErrors;
/** 错误的出站数据包数量 */
private String ifOutErrors;
/** 端口索引 */
private String ifIndex;
/** 计算方式 */
public String calculationMode;
/** 包含资源 */
public String clientIds;
/** 包含资源-接口名称 */
public String interfaceNames;
/** 是否95值 */
private boolean flag95 = false;
/** 服务器客户端id */
private String serverClientId;
/** 交换机接口别名 */
private String interfaceNameRemark;
/** 95值 */
private BigDecimal percentile95;
/** 单位 */
private String unit;
/** 监控看板概览id */
private Long monitorId;
/** 表名 */
private String tableName;
}
@@ -0,0 +1,99 @@
package com.tongran.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
/**
* 知识库对象 knowledge_base
*
* @author gyt
* @date 2025-08-15
*/
public class KnowledgeBase extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 标题 */
@Excel(name = "标题")
private String title;
/** 问题类型 */
@Excel(name = "问题类型")
private String issueType;
/** 解决方案 */
@Excel(name = "解决方案")
private String solution;
/** 创建人 */
private String creatBy;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTitle(String title)
{
this.title = title;
}
public String getTitle()
{
return title;
}
public void setIssueType(String issueType)
{
this.issueType = issueType;
}
public String getIssueType()
{
return issueType;
}
public void setSolution(String solution)
{
this.solution = solution;
}
public String getSolution()
{
return solution;
}
public void setCreatBy(String creatBy)
{
this.creatBy = creatBy;
}
public String getCreatBy()
{
return creatBy;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("title", getTitle())
.append("issueType", getIssueType())
.append("solution", getSolution())
.append("createTime", getCreateTime())
.append("creatBy", getCreatBy())
.append("updateTime", getUpdateTime())
.append("updateBy", getUpdateBy())
.toString();
}
}
@@ -0,0 +1,204 @@
package com.tongran.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
/**
* 监控模板管理对象 mtm_monitoring_template
*
* @author gyt
* @date 2025-08-12
*/
public class MtmMonitoringTemplate extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 模板名称 */
@Excel(name = "模板名称")
private String templateName;
/** 描述 */
@Excel(name = "描述")
private String description;
/** 项类型 */
@Excel(name = "项类型")
private String itemType;
/** 包含资源 */
@Excel(name = "包含资源")
private String includedResources;
/** 发现项类型 */
@Excel(name = "发现项类型")
private String discoveryItemType;
/** 项名 */
@Excel(name = "项名")
private String itemName;
/** 项描述 */
@Excel(name = "项描述")
private String itemDescription;
/** 创建人id */
@Excel(name = "创建人id")
private Long creatorId;
/** 创建人名称 */
@Excel(name = "创建人名称")
private String creatorName;
/** 修改人id */
@Excel(name = "修改人id")
private Long updaterId;
/** 修改人名称 */
@Excel(name = "修改人名称")
private String updaterName;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTemplateName(String templateName)
{
this.templateName = templateName;
}
public String getTemplateName()
{
return templateName;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return description;
}
public void setItemType(String itemType)
{
this.itemType = itemType;
}
public String getItemType()
{
return itemType;
}
public void setIncludedResources(String includedResources)
{
this.includedResources = includedResources;
}
public String getIncludedResources()
{
return includedResources;
}
public void setDiscoveryItemType(String discoveryItemType)
{
this.discoveryItemType = discoveryItemType;
}
public String getDiscoveryItemType()
{
return discoveryItemType;
}
public void setItemName(String itemName)
{
this.itemName = itemName;
}
public String getItemName()
{
return itemName;
}
public void setItemDescription(String itemDescription)
{
this.itemDescription = itemDescription;
}
public String getItemDescription()
{
return itemDescription;
}
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("templateName", getTemplateName())
.append("description", getDescription())
.append("itemType", getItemType())
.append("includedResources", getIncludedResources())
.append("discoveryItemType", getDiscoveryItemType())
.append("itemName", getItemName())
.append("itemDescription", getItemDescription())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("creatorId", getCreatorId())
.append("creatorName", getCreatorName())
.append("updaterId", getUpdaterId())
.append("updaterName", getUpdaterName())
.toString();
}
}
@@ -0,0 +1,95 @@
package com.tongran.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.util.Date;
/**
* 拓扑管理对象 rm_eps_topology_management
*
* @author gyt
* @date 2025-08-12
*/
@Data
public class RmEpsTopologyManagement extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 交换机名称 */
@Excel(name = "交换机名称")
private String switchName;
/** 交换机硬件SN */
@Excel(name = "交换机硬件SN")
private String switchSn;
/** 交换机clientId */
private String clientId;
/** 接口名称 */
@Excel(name = "接口名称")
private String interfaceName;
/** 接口连接设备类型 */
@Excel(name = "接口连接设备类型",readConverterExp = "1=服务器,2=机房出口")
private String connectedDeviceType;
/** 服务器名称 */
@Excel(name = "服务器名称")
private String serverName;
/** 服务器硬件SN */
@Excel(name = "服务器硬件SN")
private String serverSn;
/** 服务器网口 */
@Excel(name = "服务器网口")
private String serverPort;
/** 创建时间 */
@Excel(name = "创建时间",dateFormat = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 修改时间 */
@Excel(name = "修改时间",dateFormat = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/** 创建人id */
private Long creatorId;
/** 创建人名称 */
private String creatorName;
/** 修改人id */
private Long updaterId;
/** 修改人名称 */
private String updaterName;
/** 交换机ip */
private String switchIpAddress;
/** 资源名称 */
private String resourceName;
/**
* 对端交换机名称
*/
private String peerSwitchName;
/**
* 对端交换机接口
*/
private String peerSwitchInterface;
/**
* 服务器clientId
*/
private String serverClientId;
}
@@ -0,0 +1,44 @@
package com.tongran.system.domain;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
/**
* 监控配置对象 rm_monitor_config
*
* @author gyt
* @date 2025-11-12
*/
@Data
public class RmMonitorConfig extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 配置名称 */
@Excel(name = "配置名称")
private String configName;
/** 监控数据开始时间 */
@Excel(name = "监控数据开始时间")
private String monitorStartTime;
/** 资源类型 */
@Excel(name = "资源类型")
private String resourceType;
/** 业务代码 */
@Excel(name = "业务代码")
private String businessCode;
/** 业务名称 */
@Excel(name = "业务名称")
private String businessName;
/** 部署设备 */
@Excel(name = "部署设备")
private String deployDevice;
}
@@ -0,0 +1,53 @@
package com.tongran.system.domain;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
/**
* 监控看板详情对象 rm_monitor_config_details
*
* @author gyt
* @date 2025-11-14
*/
@Data
public class RmMonitorConfigDetails extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 自增主键ID */
private Long id;
/** 监控id */
@Excel(name = "监控id")
private Long monitorId;
/** 包含设备 */
@Excel(name = "包含设备")
private String deployDevice;
/** 接收流量(字节) */
@Excel(name = "接收流量(字节)")
private BigDecimal inBytes;
/** 发送流量(字节) */
@Excel(name = "发送流量(字节)")
private BigDecimal outBytes;
/** 接收流量(bit/s */
@Excel(name = "接收流量bit/s")
private BigDecimal inSpeed;
/** 发送流量(bit/s */
@Excel(name = "发送流量bit/s")
private BigDecimal outSpeed;
/** 开始时间 */
private String startTime;
/** 结束时间 */
private String endTime;
/** 单位 */
private String unit;
}
@@ -0,0 +1,71 @@
package com.tongran.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
/**
* 绑定金山machinecode对象 rm_registration_machine
*
* @author gyt
* @date 2025-10-10
*/
public class RmRegistrationMachine extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 客户端ID */
@Excel(name = "客户端ID")
private String clientId;
/** 机器码 */
@Excel(name = "机器码")
private String machineCode;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setClientId(String clientId)
{
this.clientId = clientId;
}
public String getClientId()
{
return clientId;
}
public void setMachineCode(String machineCode)
{
this.machineCode = machineCode;
}
public String getMachineCode()
{
return machineCode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("clientId", getClientId())
.append("machineCode", getMachineCode())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.toString();
}
}
@@ -0,0 +1,70 @@
package com.tongran.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.util.Date;
/**
* 资源分组对象 rm_resource_group
*
* @author gyt
* @date 2025-08-12
*/
@Data
public class RmResourceGroup extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 组名 */
@Excel(name = "组名")
private String groupName;
/** 描述 */
@Excel(name = "描述")
private String description;
/** 包含设备id */
private String includedDevicesId;
/** 包含设备名称 */
@Excel(name = "包含设备")
private String includedDevicesName;
/** 创建时间 */
@Excel(name = "创建时间",dateFormat = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 修改时间 */
@Excel(name = "修改时间",dateFormat = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/** 创建人id */
private Long creatorId;
/** 创建人名称 */
private String creatorName;
/** 修改人id */
private Long updaterId;
/** 修改人名称 */
private String updaterName;
/** 监控项 */
private String monitorItems;
/** 自动发现项 */
private String discoveryRules;
/** 资源id */
private String resourceIds;
/** 资源类型 */
private String resourceType;
/** 查询条件名称 */
private String queryName;
}
@@ -0,0 +1,311 @@
package com.tongran.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 资源注册对象 rm_resource_registration
*
* @author gyt
* @date 2025-08-12
*/
@Data
public class RmResourceRegistration extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** clientID */
@Excel(name = "clientID")
private String clientId;
/** 硬件SN */
@Excel(name = "设备SN")
private String hardwareSn;
/** 资源类型
* 1 服务器,2 交换机*/
private String resourceType;
/** 资源名称 */
private String resourceName;
/** IP地址 */
private String ipAddress;
/** 端口1.162(SNMP),2.其他 */
private String resourcePort;
/**其他端口名称 */
private String otherPortName;
/** agent版本 */
@Excel(name = "agent版本")
private String agentVersion;
/** 协议 1.TCP,2.UDP */
private String protocol;
/** SNMP探测 0=否,1=是 */
private String snmpDetect;
/** 版本(1.SNMPv2,2.SNMPv3) */
private String resourceVersion;
/** 读写权限(1.RW,2.ReadOnly) */
private String rwPermission;
/** 团体名称 */
private String teamName;
/** SNMP采集地址 */
private String snmpCollectAddr;
/** SNMP采集端口 */
private String snmpCollectPort;
/** 安全级别(1.authPriv、2.authNoPriv3.noAuthNoPriv) */
private String securityLevel;
/** 加密方式 1.md5,2.SHA */
private String encryption;
/** 用户名 */
private String resourceUserName;
/** 密码 */
private String resourcePwd;
/** 注册状态 0-未注册,1-已注册 */
private String registrationStatus;
/** 在线状态 0-离线,1-在线 */
@Excel(name = "在线状态", readConverterExp = "0=离线,1=在线")
private String onlineStatus;
private String switchOnlineStatus;
/** 描述 */
private String description;
/** 设备业务客户id */
private Long customerId;
/** 设备业务客户名称 */
private String customerName;
/** 业务号 */
private String serviceNumber;
/** 创建人id */
private Long creatorId;
/** 创建人名称 */
private String creatorName;
/** 修改人id */
private Long updaterId;
/** 修改人名称 */
private String updaterName;
/** 监控项 */
private String monitorItems;
/** 自动发现项 */
private String discoveryRules;
/** 查询名称 */
private String queryName;
/**
* 运营商
*/
private String operator;
/**
* 省
*/
private String province;
/**
* 公网IP
*/
private String publicIp;
/**
* 业务名称
*/
@Excel(name = "业务名称")
private String businessName;
/** 业务代码 */
private String businessCode;
/**
* 逻辑节点标识
*/
@Excel(name = "逻辑节点标识")
private String logicalNodeId;
/**
* 多公网IP状态
*/
private String multiPublicIpStatus;
/**
* 心跳次数
*/
@Excel(name = "心跳次数")
private Integer heartbeatCount;
/**
* 心跳周期(单位:秒)
*/
@Excel(name = "心跳时间间隔")
private Integer heartbeatInterval;
/** 需要绑定的网卡信息 */
private List<Map> bindNetworkMsg;
// IP1 相关字段
@Excel(name = "IP1-运营商")
private String ip1Isp; // IP1-运营商
@Excel(name = "IP1-省")
private String ip1Province; // IP1-省
@Excel(name = "IP1-市")
private String ip1City; // IP1-市
@Excel(name = "IP1-业务公网")
private String ip1PublicIp; // IP1-业务公网
@Excel(name = "IP1-接口名称")
private String ip1InterfaceName; // IP1-接口名称
@Excel(name = "IP1-mac地址")
private String ip1MacAddress; // IP1-mac地址
@Excel(name = "IP1-接口类型")
private String ip1InterfaceType; // IP1-接口类型
@Excel(name = "IP1-IPv4地址")
private String ip1Ipv4Address; // IP1-IPv4地址
@Excel(name = "IP1-网关")
private String ip1Gateway; // IP1-网关
// IP2 相关字段
@Excel(name = "IP2-运营商")
private String ip2Isp;
@Excel(name = "IP2-省")
private String ip2Province;
@Excel(name = "IP2-市")
private String ip2City;
@Excel(name = "IP2-业务公网")
private String ip2PublicIp;
@Excel(name = "IP2-接口名称")
private String ip2InterfaceName;
@Excel(name = "IP2-mac地址")
private String ip2MacAddress;
@Excel(name = "IP2-接口类型")
private String ip2InterfaceType;
@Excel(name = "IP2-IPv4地址")
private String ip2Ipv4Address;
@Excel(name = "IP2-网关")
private String ip2Gateway;
// IP3 相关字段
@Excel(name = "IP3-运营商")
private String ip3Isp;
@Excel(name = "IP3-省")
private String ip3Province;
@Excel(name = "IP3-市")
private String ip3City;
@Excel(name = "IP3-业务公网")
private String ip3PublicIp;
@Excel(name = "IP3-接口名称")
private String ip3InterfaceName;
@Excel(name = "IP3-mac地址")
private String ip3MacAddress;
@Excel(name = "IP3-接口类型")
private String ip3InterfaceType;
@Excel(name = "IP3-IPv4地址")
private String ip3Ipv4Address;
@Excel(name = "IP3-网关")
private String ip3Gateway;
// 管理网相关字段
@Excel(name = "管理网-运营商")
private String mgmtIsp; // 管理网-运营商
@Excel(name = "管理网-省")
private String mgmtProvince; // 管理网-省
@Excel(name = "管理网-市")
private String mgmtCity; // 管理网-市
@Excel(name = "管理网-公网IP")
private String mgmtPublicIp; // 管理网-公网IP
@Excel(name = "管理网-接口名称")
private String mgmtInterfaceName; // 管理网-接口名称
@Excel(name = "管理网-mac地址")
private String mgmtMacAddress; // 管理网-mac地址
@Excel(name = "管理网-接口类型")
private String mgmtInterfaceType; // 管理网-接口类型
@Excel(name = "管理网-IPv4地址")
private String mgmtIpv4Address; // 管理网-IPv4地址
@Excel(name = "管理网-网关")
private String mgmtGateway; // 管理网-IPv4地址
/** 多条件查询 */
private String queryParam;
/** 金山machineCode */
@Excel(name = "金山machineCode")
private String machineCode;
/** 注册时间 */
@Excel(name = "注册时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 上机时间 */
@Excel(name = "上机时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date onboardTime;
/** 服务器列表 */
private String deployDevice;
/** 业务空标识 */
private boolean businessEmpty;
/** 逻辑节点空标识 */
private boolean logicalNodeEmpty;
}
@@ -0,0 +1,38 @@
package com.tongran.system.domain;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
/**
* 交换机接口信息对象 rm_switch_interface_info
*
* @author gyt
* @date 2025-10-10
*/
@Data
public class RmSwitchInterfaceInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 硬件SN序列号 */
@Excel(name = "硬件SN序列号")
private String hardwareSn;
/** 交换机名称 */
@Excel(name = "交换机名称")
private String switchName;
/** 交换机接口名称 */
@Excel(name = "交换机接口名称")
private String interfaceName;
/** 接口备注 */
@Excel(name = "接口备注")
private String interfaceRemark;
/** 客户端id */
private String clientId;
}
@@ -0,0 +1,97 @@
package com.tongran.system.domain;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 交换机管理对象 rm_switch_management
*
* @author gyt
* @date 2025-10-10
*/
@Data
public class RmSwitchManagement extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 交换机名称 */
@Excel(name = "交换机名称")
private String switchName;
/** 硬件SN序列号 */
@Excel(name = "硬件SN序列号")
private String hardwareSn;
/** SNMP采集地址 */
@Excel(name = "SNMP采集地址")
private String snmpAddress;
/** SNMP采集端口 */
@Excel(name = "SNMP采集端口")
private Long snmpPort;
/** 在线状态(0-离线,1-在线) */
@Excel(name = "在线状态(0-离线,1-在线)")
private String onlineStatus;
/** 上机时间 */
private Date upTime;
/** 心跳监测次数 */
@Excel(name = "心跳监测次数")
private String heartbeatCount;
/** 心跳监测周期(秒) */
@Excel(name = "心跳监测周期(秒)")
private String heartbeatInterval;
/** 心跳检测OID */
@Excel(name = "心跳检测OID")
private String heartbeatOid;
/** SNMP版本(v1/v2c/v3) */
@Excel(name = "SNMP版本(v1/v2c/v3)")
private String snmpVersion;
/** 读写权限 */
@Excel(name = "读写权限")
private String readWritePermission;
/** 安全级别 */
@Excel(name = "安全级别")
private String securityLevel;
/** 加密方式 */
@Excel(name = "加密方式")
private String encryptionMethod;
/** 团体名称 */
@Excel(name = "团体名称")
private String communityName;
/** 密码 */
@Excel(name = "密码")
private String switchPassword;
/** 交换机类型 */
private String switchType;
/** 用户名 */
private String switchUser;
/** 端口备注列表 */
private List<RmSwitchInterfaceInfo> switchInterfaceInfoList;
/** 自动生成客户端id(uuid) */
private String clientId;
/** 查询条件 */
private String queryName;
/** 接口信息 */
private List<AllInterfaceName> children;
/** 前端需要 id 别名 */
private Long value;
/** 前端需要 name 别名 */
private String label;
}
@@ -0,0 +1,111 @@
package com.tongran.system.domain;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.annotation.Excel.ColumnType;
import com.tongran.common.core.web.domain.BaseEntity;
/**
* 参数配置表 sys_config
*
* @author tongran
*/
public class SysConfig extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 参数主键 */
@Excel(name = "参数主键", cellType = ColumnType.NUMERIC)
private Long configId;
/** 参数名称 */
@Excel(name = "参数名称")
private String configName;
/** 参数键名 */
@Excel(name = "参数键名")
private String configKey;
/** 参数键值 */
@Excel(name = "参数键值")
private String configValue;
/** 系统内置(Y是 N否) */
@Excel(name = "系统内置", readConverterExp = "Y=是,N=否")
private String configType;
public Long getConfigId()
{
return configId;
}
public void setConfigId(Long configId)
{
this.configId = configId;
}
@NotBlank(message = "参数名称不能为空")
@Size(min = 0, max = 100, message = "参数名称不能超过100个字符")
public String getConfigName()
{
return configName;
}
public void setConfigName(String configName)
{
this.configName = configName;
}
@NotBlank(message = "参数键名长度不能为空")
@Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符")
public String getConfigKey()
{
return configKey;
}
public void setConfigKey(String configKey)
{
this.configKey = configKey;
}
@NotBlank(message = "参数键值不能为空")
@Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符")
public String getConfigValue()
{
return configValue;
}
public void setConfigValue(String configValue)
{
this.configValue = configValue;
}
public String getConfigType()
{
return configType;
}
public void setConfigType(String configType)
{
this.configType = configType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("configId", getConfigId())
.append("configName", getConfigName())
.append("configKey", getConfigKey())
.append("configValue", getConfigValue())
.append("configType", getConfigType())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
@@ -0,0 +1,274 @@
package com.tongran.system.domain;
import java.util.ArrayList;
import java.util.List;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.tongran.common.core.web.domain.BaseEntity;
/**
* 菜单权限表 sys_menu
*
* @author tongran
*/
public class SysMenu extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 菜单ID */
private Long menuId;
/** 菜单名称 */
private String menuName;
/** 父菜单名称 */
private String parentName;
/** 父菜单ID */
private Long parentId;
/** 显示顺序 */
private Integer orderNum;
/** 路由地址 */
private String path;
/** 组件路径 */
private String component;
/** 路由参数 */
private String query;
/** 路由名称,默认和路由地址相同的驼峰格式(注意:因为vue3版本的router会删除名称相同路由,为避免名字的冲突,特殊情况可以自定义) */
private String routeName;
/** 是否为外链(0是 1否) */
private String isFrame;
/** 是否缓存(0缓存 1不缓存) */
private String isCache;
/** 类型(M目录 C菜单 F按钮) */
private String menuType;
/** 显示状态(0显示 1隐藏) */
private String visible;
/** 菜单状态(0正常 1停用) */
private String status;
/** 权限字符串 */
private String perms;
/** 菜单图标 */
private String icon;
/** 子菜单 */
private List<SysMenu> children = new ArrayList<SysMenu>();
public Long getMenuId()
{
return menuId;
}
public void setMenuId(Long menuId)
{
this.menuId = menuId;
}
@NotBlank(message = "菜单名称不能为空")
@Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
public String getMenuName()
{
return menuName;
}
public void setMenuName(String menuName)
{
this.menuName = menuName;
}
public String getParentName()
{
return parentName;
}
public void setParentName(String parentName)
{
this.parentName = parentName;
}
public Long getParentId()
{
return parentId;
}
public void setParentId(Long parentId)
{
this.parentId = parentId;
}
@NotNull(message = "显示顺序不能为空")
public Integer getOrderNum()
{
return orderNum;
}
public void setOrderNum(Integer orderNum)
{
this.orderNum = orderNum;
}
@Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
public String getPath()
{
return path;
}
public void setPath(String path)
{
this.path = path;
}
@Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
public String getComponent()
{
return component;
}
public void setComponent(String component)
{
this.component = component;
}
public String getQuery()
{
return query;
}
public void setQuery(String query)
{
this.query = query;
}
public String getRouteName()
{
return routeName;
}
public void setRouteName(String routeName)
{
this.routeName = routeName;
}
public String getIsFrame()
{
return isFrame;
}
public void setIsFrame(String isFrame)
{
this.isFrame = isFrame;
}
public String getIsCache()
{
return isCache;
}
public void setIsCache(String isCache)
{
this.isCache = isCache;
}
@NotBlank(message = "菜单类型不能为空")
public String getMenuType()
{
return menuType;
}
public void setMenuType(String menuType)
{
this.menuType = menuType;
}
public String getVisible()
{
return visible;
}
public void setVisible(String visible)
{
this.visible = visible;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
@Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
public String getPerms()
{
return perms;
}
public void setPerms(String perms)
{
this.perms = perms;
}
public String getIcon()
{
return icon;
}
public void setIcon(String icon)
{
this.icon = icon;
}
public List<SysMenu> getChildren()
{
return children;
}
public void setChildren(List<SysMenu> children)
{
this.children = children;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("menuId", getMenuId())
.append("menuName", getMenuName())
.append("parentId", getParentId())
.append("orderNum", getOrderNum())
.append("path", getPath())
.append("component", getComponent())
.append("query", getQuery())
.append("routeName", getRouteName())
.append("isFrame", getIsFrame())
.append("IsCache", getIsCache())
.append("menuType", getMenuType())
.append("visible", getVisible())
.append("status ", getStatus())
.append("perms", getPerms())
.append("icon", getIcon())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
@@ -0,0 +1,41 @@
package com.tongran.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.util.Date;
/**
* 菜单点击计数对象 sys_menu_click
*
* @author gyt
* @date 2025-11-12
*/
@Data
public class SysMenuClick extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 页面路由标识(例如:system:user:list, business:order:manage */
@Excel(name = "页面路由标识", readConverterExp = "例=如:system:user:list,,b=usiness:order:manage")
private String pageRoute;
/** 页面名称 */
@Excel(name = "页面名称")
private String pageName;
/** 点击次数 */
@Excel(name = "点击次数")
private Long clickCount;
/** 最后点击时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后点击时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date lastClickTime;
}
@@ -0,0 +1,102 @@
package com.tongran.system.domain;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.tongran.common.core.web.domain.BaseEntity;
import com.tongran.common.core.xss.Xss;
/**
* 通知公告表 sys_notice
*
* @author tongran
*/
public class SysNotice extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 公告ID */
private Long noticeId;
/** 公告标题 */
private String noticeTitle;
/** 公告类型(1通知 2公告) */
private String noticeType;
/** 公告内容 */
private String noticeContent;
/** 公告状态(0正常 1关闭) */
private String status;
public Long getNoticeId()
{
return noticeId;
}
public void setNoticeId(Long noticeId)
{
this.noticeId = noticeId;
}
public void setNoticeTitle(String noticeTitle)
{
this.noticeTitle = noticeTitle;
}
@Xss(message = "公告标题不能包含脚本字符")
@NotBlank(message = "公告标题不能为空")
@Size(min = 0, max = 50, message = "公告标题不能超过50个字符")
public String getNoticeTitle()
{
return noticeTitle;
}
public void setNoticeType(String noticeType)
{
this.noticeType = noticeType;
}
public String getNoticeType()
{
return noticeType;
}
public void setNoticeContent(String noticeContent)
{
this.noticeContent = noticeContent;
}
public String getNoticeContent()
{
return noticeContent;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("noticeId", getNoticeId())
.append("noticeTitle", getNoticeTitle())
.append("noticeType", getNoticeType())
.append("noticeContent", getNoticeContent())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
@@ -0,0 +1,124 @@
package com.tongran.system.domain;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.annotation.Excel.ColumnType;
import com.tongran.common.core.web.domain.BaseEntity;
/**
* 岗位表 sys_post
*
* @author tongran
*/
public class SysPost extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 岗位序号 */
@Excel(name = "岗位序号", cellType = ColumnType.NUMERIC)
private Long postId;
/** 岗位编码 */
@Excel(name = "岗位编码")
private String postCode;
/** 岗位名称 */
@Excel(name = "岗位名称")
private String postName;
/** 岗位排序 */
@Excel(name = "岗位排序")
private Integer postSort;
/** 状态(0正常 1停用) */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 用户是否存在此岗位标识 默认不存在 */
private boolean flag = false;
public Long getPostId()
{
return postId;
}
public void setPostId(Long postId)
{
this.postId = postId;
}
@NotBlank(message = "岗位编码不能为空")
@Size(min = 0, max = 64, message = "岗位编码长度不能超过64个字符")
public String getPostCode()
{
return postCode;
}
public void setPostCode(String postCode)
{
this.postCode = postCode;
}
@NotBlank(message = "岗位名称不能为空")
@Size(min = 0, max = 50, message = "岗位名称长度不能超过50个字符")
public String getPostName()
{
return postName;
}
public void setPostName(String postName)
{
this.postName = postName;
}
@NotNull(message = "显示顺序不能为空")
public Integer getPostSort()
{
return postSort;
}
public void setPostSort(Integer postSort)
{
this.postSort = postSort;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
public boolean isFlag()
{
return flag;
}
public void setFlag(boolean flag)
{
this.flag = flag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("postId", getPostId())
.append("postCode", getPostCode())
.append("postName", getPostName())
.append("postSort", getPostSort())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
@@ -0,0 +1,46 @@
package com.tongran.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 角色和部门关联 sys_role_dept
*
* @author tongran
*/
public class SysRoleDept
{
/** 角色ID */
private Long roleId;
/** 部门ID */
private Long deptId;
public Long getRoleId()
{
return roleId;
}
public void setRoleId(Long roleId)
{
this.roleId = roleId;
}
public Long getDeptId()
{
return deptId;
}
public void setDeptId(Long deptId)
{
this.deptId = deptId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("roleId", getRoleId())
.append("deptId", getDeptId())
.toString();
}
}
@@ -0,0 +1,46 @@
package com.tongran.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 角色和菜单关联 sys_role_menu
*
* @author tongran
*/
public class SysRoleMenu
{
/** 角色ID */
private Long roleId;
/** 菜单ID */
private Long menuId;
public Long getRoleId()
{
return roleId;
}
public void setRoleId(Long roleId)
{
this.roleId = roleId;
}
public Long getMenuId()
{
return menuId;
}
public void setMenuId(Long menuId)
{
this.menuId = menuId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("roleId", getRoleId())
.append("menuId", getMenuId())
.toString();
}
}
@@ -0,0 +1,100 @@
package com.tongran.system.domain;
/**
* 当前在线会话
*
* @author tongran
*/
public class SysUserOnline
{
/** 会话编号 */
private String tokenId;
/** 用户名称 */
private String userName;
/** 登录IP地址 */
private String ipaddr;
/** 登录地址 */
private String loginLocation;
/** 浏览器类型 */
private String browser;
/** 操作系统 */
private String os;
/** 登录时间 */
private Long loginTime;
public String getTokenId()
{
return tokenId;
}
public void setTokenId(String tokenId)
{
this.tokenId = tokenId;
}
public String getUserName()
{
return userName;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getIpaddr()
{
return ipaddr;
}
public void setIpaddr(String ipaddr)
{
this.ipaddr = ipaddr;
}
public String getLoginLocation()
{
return loginLocation;
}
public void setLoginLocation(String loginLocation)
{
this.loginLocation = loginLocation;
}
public String getBrowser()
{
return browser;
}
public void setBrowser(String browser)
{
this.browser = browser;
}
public String getOs()
{
return os;
}
public void setOs(String os)
{
this.os = os;
}
public Long getLoginTime()
{
return loginTime;
}
public void setLoginTime(Long loginTime)
{
this.loginTime = loginTime;
}
}
@@ -0,0 +1,46 @@
package com.tongran.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 用户和岗位关联 sys_user_post
*
* @author tongran
*/
public class SysUserPost
{
/** 用户ID */
private Long userId;
/** 岗位ID */
private Long postId;
public Long getUserId()
{
return userId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getPostId()
{
return postId;
}
public void setPostId(Long postId)
{
this.postId = postId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
.append("postId", getPostId())
.toString();
}
}
@@ -0,0 +1,46 @@
package com.tongran.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 用户和角色关联 sys_user_role
*
* @author tongran
*/
public class SysUserRole
{
/** 用户ID */
private Long userId;
/** 角色ID */
private Long roleId;
public Long getUserId()
{
return userId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getRoleId()
{
return roleId;
}
public void setRoleId(Long roleId)
{
this.roleId = roleId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
.append("roleId", getRoleId())
.toString();
}
}
@@ -0,0 +1,30 @@
package com.tongran.system.domain;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
/**
* 用户自定义列配置对象 user_table_column_config
*
* @author gyt
* @date 2025-10-30
*/
@Data
public class UserTableColumnConfig extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 用户ID */
@Excel(name = "用户ID")
private Long userId;
/** 页面路由标识(例如:system:user:list, business:order:manage */
private String pageRoute;
/** 列配置(JSON数组格式) */
private String columnConfig;
}
@@ -0,0 +1,13 @@
package com.tongran.system.domain.vo;
import lombok.Data;
@Data
public class MessageVo {
private String clientId;
private String dataType;
private String data;
}
@@ -0,0 +1,106 @@
package com.tongran.system.domain.vo;
import com.tongran.common.core.utils.StringUtils;
/**
* 路由显示信息
*
* @author tongran
*/
public class MetaVo
{
/**
* 设置该路由在侧边栏和面包屑中展示的名字
*/
private String title;
/**
* 设置该路由的图标,对应路径src/assets/icons/svg
*/
private String icon;
/**
* 设置为true,则不会被 <keep-alive>缓存
*/
private boolean noCache;
/**
* 内链地址(http(s)://开头)
*/
private String link;
public MetaVo()
{
}
public MetaVo(String title, String icon)
{
this.title = title;
this.icon = icon;
}
public MetaVo(String title, String icon, boolean noCache)
{
this.title = title;
this.icon = icon;
this.noCache = noCache;
}
public MetaVo(String title, String icon, String link)
{
this.title = title;
this.icon = icon;
this.link = link;
}
public MetaVo(String title, String icon, boolean noCache, String link)
{
this.title = title;
this.icon = icon;
this.noCache = noCache;
if (StringUtils.ishttp(link))
{
this.link = link;
}
}
public boolean isNoCache()
{
return noCache;
}
public void setNoCache(boolean noCache)
{
this.noCache = noCache;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getIcon()
{
return icon;
}
public void setIcon(String icon)
{
this.icon = icon;
}
public String getLink()
{
return link;
}
public void setLink(String link)
{
this.link = link;
}
}
@@ -0,0 +1,17 @@
package com.tongran.system.domain.vo;
import lombok.Data;
import java.time.Instant;
@Data
public class ResourceVo {
private String clientIp;
private Integer clientPort;
private String switchBoard;
private Long timestamp = Instant.now().getEpochSecond();
}
@@ -0,0 +1,148 @@
package com.tongran.system.domain.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.List;
/**
* 路由配置信息
*
* @author tongran
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class RouterVo
{
/**
* 路由名字
*/
private String name;
/**
* 路由地址
*/
private String path;
/**
* 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现
*/
private boolean hidden;
/**
* 重定向地址,当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
*/
private String redirect;
/**
* 组件地址
*/
private String component;
/**
* 路由参数:如 {"id": 1, "name": "ry"}
*/
private String query;
/**
* 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面
*/
private Boolean alwaysShow;
/**
* 其他元素
*/
private MetaVo meta;
/**
* 子路由
*/
private List<RouterVo> children;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getPath()
{
return path;
}
public void setPath(String path)
{
this.path = path;
}
public boolean getHidden()
{
return hidden;
}
public void setHidden(boolean hidden)
{
this.hidden = hidden;
}
public String getRedirect()
{
return redirect;
}
public void setRedirect(String redirect)
{
this.redirect = redirect;
}
public String getComponent()
{
return component;
}
public void setComponent(String component)
{
this.component = component;
}
public String getQuery()
{
return query;
}
public void setQuery(String query)
{
this.query = query;
}
public Boolean getAlwaysShow()
{
return alwaysShow;
}
public void setAlwaysShow(Boolean alwaysShow)
{
this.alwaysShow = alwaysShow;
}
public MetaVo getMeta()
{
return meta;
}
public void setMeta(MetaVo meta)
{
this.meta = meta;
}
public List<RouterVo> getChildren()
{
return children;
}
public void setChildren(List<RouterVo> children)
{
this.children = children;
}
}
@@ -0,0 +1,17 @@
package com.tongran.system.domain.vo;
import lombok.Data;
import java.time.Instant;
@Data
public class RspVo {
/** 状态码,0、失败;1、成功*/
private Integer resCode;
/** 描述 */
private String resMag;
/** 路由 */
private String addRoute;
/** 时间戳 */
private long timestamp = Instant.now().getEpochSecond();
}
@@ -0,0 +1,93 @@
package com.tongran.system.domain.vo;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.tongran.common.core.constant.UserConstants;
import com.tongran.common.core.utils.StringUtils;
import com.tongran.system.api.domain.SysDept;
import com.tongran.system.domain.SysMenu;
/**
* Treeselect树结构实体类
*
* @author tongran
*/
public class TreeSelect implements Serializable
{
private static final long serialVersionUID = 1L;
/** 节点ID */
private Long id;
/** 节点名称 */
private String label;
/** 节点禁用 */
private boolean disabled = false;
/** 子节点 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelect> children;
public TreeSelect()
{
}
public TreeSelect(SysDept dept)
{
this.id = dept.getDeptId();
this.label = dept.getDeptName();
this.disabled = StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus());
this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public TreeSelect(SysMenu menu)
{
this.id = menu.getMenuId();
this.label = menu.getMenuName();
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public String getLabel()
{
return label;
}
public void setLabel(String label)
{
this.label = label;
}
public boolean isDisabled()
{
return disabled;
}
public void setDisabled(boolean disabled)
{
this.disabled = disabled;
}
public List<TreeSelect> getChildren()
{
return children;
}
public void setChildren(List<TreeSelect> children)
{
this.children = children;
}
}
@@ -0,0 +1,15 @@
package com.tongran.system.enums;
import lombok.Getter;
@Getter
public enum ReviewEnum {
未提交("0"),
待审核("1"),
通过("2"),
驳回("3");
private String code;
ReviewEnum(String code){
this.code = code;
}
}
@@ -0,0 +1,95 @@
package com.tongran.system.mapper;
import com.tongran.system.domain.AllInterfaceName;
import org.springframework.data.repository.query.Param;
import java.util.List;
/**
* 所有接口名称Mapper接口
*
* @author gyt
* @date 2025-08-25
*/
public interface AllInterfaceNameMapper
{
/**
* 查询所有接口名称
*
* @param id 所有接口名称主键
* @return 所有接口名称
*/
public AllInterfaceName selectAllInterfaceNameById(Long id);
/**
* 查询所有接口名称列表
*
* @param allInterfaceName 所有接口名称
* @return 所有接口名称集合
*/
public List<AllInterfaceName> selectAllInterfaceNameList(AllInterfaceName allInterfaceName);
/**
* 新增所有接口名称
*
* @param allInterfaceName 所有接口名称
* @return 结果
*/
public int insertAllInterfaceName(AllInterfaceName allInterfaceName);
/**
* 修改所有接口名称
*
* @param allInterfaceName 所有接口名称
* @return 结果
*/
public int updateAllInterfaceName(AllInterfaceName allInterfaceName);
/**
* 删除所有接口名称
*
* @param id 所有接口名称主键
* @return 结果
*/
public int deleteAllInterfaceNameById(Long id);
/**
* 批量删除所有接口名称
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteAllInterfaceNameByIds(Long[] ids);
/**
* 根据接口名称查询表中是否存在信息
* @param interfaceName
* @return
*/
List<AllInterfaceName> selectByNames(AllInterfaceName interfaceName);
/**
* 批量插入接口名称
* @param list
* @return
*/
int batchInsert(@Param("list") List<AllInterfaceName> list);
/**
* 查询所有服务器sn
* @param interfaceName
* @return
*/
List<AllInterfaceName> getAllDeviceSn(AllInterfaceName interfaceName);
/**
* 查询所有交换机sn
* @param interfaceName
* @return
*/
List<AllInterfaceName> getAllSwitchSn(AllInterfaceName interfaceName);
/**
* 批量编辑
* @param records
*/
void batchUpdate(List<AllInterfaceName> records);
}
@@ -0,0 +1,61 @@
package com.tongran.system.mapper;
import java.util.List;
import com.tongran.system.domain.EpsBusinessDeploy;
/**
* 业务下发管理Mapper接口
*
* @author gyt
* @date 2025-10-13
*/
public interface EpsBusinessDeployMapper
{
/**
* 查询业务下发管理
*
* @param id 业务下发管理主键
* @return 业务下发管理
*/
public EpsBusinessDeploy selectEpsBusinessDeployById(Long id);
/**
* 查询业务下发管理列表
*
* @param epsBusinessDeploy 业务下发管理
* @return 业务下发管理集合
*/
public List<EpsBusinessDeploy> selectEpsBusinessDeployList(EpsBusinessDeploy epsBusinessDeploy);
/**
* 新增业务下发管理
*
* @param epsBusinessDeploy 业务下发管理
* @return 结果
*/
public int insertEpsBusinessDeploy(EpsBusinessDeploy epsBusinessDeploy);
/**
* 修改业务下发管理
*
* @param epsBusinessDeploy 业务下发管理
* @return 结果
*/
public int updateEpsBusinessDeploy(EpsBusinessDeploy epsBusinessDeploy);
/**
* 删除业务下发管理
*
* @param id 业务下发管理主键
* @return 结果
*/
public int deleteEpsBusinessDeployById(Long id);
/**
* 批量删除业务下发管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteEpsBusinessDeployByIds(Long[] ids);
}
@@ -0,0 +1,76 @@
package com.tongran.system.mapper;
import com.tongran.system.domain.EpsBusiness;
import java.util.List;
/**
* 业务信息Mapper接口
*
* @author gyt
* @date 2025-08-18
*/
public interface EpsBusinessMapper
{
/**
* 查询业务信息
*
* @param id 业务信息主键
* @return 业务信息
*/
public EpsBusiness selectEpsBusinessById(String id);
/**
* 查询业务代码
*
* @param businessName 业务名称
* @return 业务信息
*/
public EpsBusiness selectEpsBusinessByName(String businessName);
/**
* 查询业务信息列表
*
* @param epsBusiness 业务信息
* @return 业务信息集合
*/
public List<EpsBusiness> selectEpsBusinessList(EpsBusiness epsBusiness);
/**
* 新增业务信息
*
* @param epsBusiness 业务信息
* @return 结果
*/
public int insertEpsBusiness(EpsBusiness epsBusiness);
/**
* 修改业务信息
*
* @param epsBusiness 业务信息
* @return 结果
*/
public int updateEpsBusiness(EpsBusiness epsBusiness);
/**
* 删除业务信息
*
* @param id 业务信息主键
* @return 结果
*/
public int deleteEpsBusinessById(String id);
/**
* 批量删除业务信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteEpsBusinessByIds(String[] ids);
/**
* 验证业务名称是否存在
* @param epsBusiness
* @return
*/
Integer countByBusinessName(EpsBusiness epsBusiness);
}
@@ -0,0 +1,61 @@
package com.tongran.system.mapper;
import java.util.List;
import com.tongran.system.domain.EpsBusinessScript;
/**
* 业务脚本管理Mapper接口
*
* @author gyt
* @date 2025-10-13
*/
public interface EpsBusinessScriptMapper
{
/**
* 查询业务脚本管理
*
* @param id 业务脚本管理主键
* @return 业务脚本管理
*/
public EpsBusinessScript selectEpsBusinessScriptById(Long id);
/**
* 查询业务脚本管理列表
*
* @param epsBusinessScript 业务脚本管理
* @return 业务脚本管理集合
*/
public List<EpsBusinessScript> selectEpsBusinessScriptList(EpsBusinessScript epsBusinessScript);
/**
* 新增业务脚本管理
*
* @param epsBusinessScript 业务脚本管理
* @return 结果
*/
public int insertEpsBusinessScript(EpsBusinessScript epsBusinessScript);
/**
* 修改业务脚本管理
*
* @param epsBusinessScript 业务脚本管理
* @return 结果
*/
public int updateEpsBusinessScript(EpsBusinessScript epsBusinessScript);
/**
* 删除业务脚本管理
*
* @param id 业务脚本管理主键
* @return 结果
*/
public int deleteEpsBusinessScriptById(Long id);
/**
* 批量删除业务脚本管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteEpsBusinessScriptByIds(Long[] ids);
}
@@ -0,0 +1,72 @@
package com.tongran.system.mapper;
import com.tongran.system.domain.EpsInitialTrafficData;
import org.springframework.data.repository.query.Param;
import java.util.List;
public interface EpsInitialTrafficDataMapper {
/**
* 创建指定名称的EPS流量表
* @param tableName 表名
*/
void createEpsTrafficTable(@Param("tableName") String tableName);
/**
* 创建指定名称的EPS流量初始表
* @param tableName 表名
*/
void createEpsInitialTrafficTable(@Param("tableName") String tableName);
/**
* 创建置顶名称的mtr探测结果表
* @param tableName
*/
void createMtrProbeResultTable(@Param("tableName") String tableName);
/**
* 创建交换机初始流量表
* @param tableName
*/
void createSwitchInfoTable(@Param("tableName") String tableName);
/**
* 创建交换机业务流量表
* @param tableName
*/
void createSwitchInfoDetailsTable(@Param("tableName") String tableName);
/**
* 单条插入数据
* @param data 流量数据
*/
void insert(EpsInitialTrafficData data);
/**
* 批量插入数据
* @param epsInitialTrafficData 流量数据实体类
*/
void batchInsert(EpsInitialTrafficData epsInitialTrafficData);
/**
* 条件查询
* @param condition 查询条件实体
* @return 流量数据列表
*/
List<EpsInitialTrafficData> selectByCondition(EpsInitialTrafficData condition);
/**
* 查询初始流量信息
* @param condition 查询条件实体
* @return 初始流量数据列表
*/
List<EpsInitialTrafficData> getAllTraficMsg(EpsInitialTrafficData condition);
/**
* 保存金山流量信息
* @param epsInitialTrafficData
* @return
*/
int updateMachineTraffic(EpsInitialTrafficData epsInitialTrafficData);
List<EpsInitialTrafficData> getTrafficListByClientIds(EpsInitialTrafficData condition);
}
@@ -0,0 +1,61 @@
package com.tongran.system.mapper;
import java.util.List;
import com.tongran.system.domain.EpsMethodChangeRecord;
/**
* 收益方式修改记录Mapper接口
*
* @author gyt
* @date 2025-08-15
*/
public interface EpsMethodChangeRecordMapper
{
/**
* 查询收益方式修改记录
*
* @param id 收益方式修改记录主键
* @return 收益方式修改记录
*/
public EpsMethodChangeRecord selectEpsMethodChangeRecordById(Long id);
/**
* 查询收益方式修改记录列表
*
* @param epsMethodChangeRecord 收益方式修改记录
* @return 收益方式修改记录集合
*/
public List<EpsMethodChangeRecord> selectEpsMethodChangeRecordList(EpsMethodChangeRecord epsMethodChangeRecord);
/**
* 新增收益方式修改记录
*
* @param epsMethodChangeRecord 收益方式修改记录
* @return 结果
*/
public int insertEpsMethodChangeRecord(EpsMethodChangeRecord epsMethodChangeRecord);
/**
* 修改收益方式修改记录
*
* @param epsMethodChangeRecord 收益方式修改记录
* @return 结果
*/
public int updateEpsMethodChangeRecord(EpsMethodChangeRecord epsMethodChangeRecord);
/**
* 删除收益方式修改记录
*
* @param id 收益方式修改记录主键
* @return 结果
*/
public int deleteEpsMethodChangeRecordById(Long id);
/**
* 批量删除收益方式修改记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteEpsMethodChangeRecordByIds(Long[] ids);
}
@@ -0,0 +1,95 @@
package com.tongran.system.mapper;
import com.tongran.system.domain.EpsNodeBandwidth;
import java.util.List;
/**
* 节点带宽信息Mapper接口
*
* @author gyt
* @date 2025-08-12
*/
public interface EpsNodeBandwidthMapper
{
/**
* 查询节点带宽信息
*
* @param id 节点带宽信息主键
* @return 节点带宽信息
*/
public EpsNodeBandwidth selectEpsNodeBandwidthById(Long id);
/**
* 查询节点带宽信息列表
*
* @param epsNodeBandwidth 节点带宽信息
* @return 节点带宽信息集合
*/
public List<EpsNodeBandwidth> selectEpsNodeBandwidthList(EpsNodeBandwidth epsNodeBandwidth);
/**
* 新增节点带宽信息
*
* @param epsNodeBandwidth 节点带宽信息
* @return 结果
*/
public int insertEpsNodeBandwidth(EpsNodeBandwidth epsNodeBandwidth);
/**
* 修改节点带宽信息
*
* @param epsNodeBandwidth 节点带宽信息
* @return 结果
*/
public int updateEpsNodeBandwidth(EpsNodeBandwidth epsNodeBandwidth);
/**
* 删除节点带宽信息
*
* @param id 节点带宽信息主键
* @return 结果
*/
public int deleteEpsNodeBandwidthById(Long id);
/**
* 批量删除节点带宽信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteEpsNodeBandwidthByIds(Long[] ids);
/**
* 计算月均日95值
*
* @param epsNodeBandwidth 节点带宽信息
* @return 节点带宽信息
*/
public EpsNodeBandwidth calculateAvg(EpsNodeBandwidth epsNodeBandwidth);
/**
* 月均日95值-相关数据
*
* @param epsNodeBandwidth 节点带宽信息
* @return 节点带宽信息
*/
public List<EpsNodeBandwidth> getAvgDetailMsg(EpsNodeBandwidth epsNodeBandwidth);
/**
* 查询月均日95值是否存在
*
* @param epsNodeBandwidth 节点带宽信息
* @return 节点带宽信息
*/
public int countByAvgMsg(EpsNodeBandwidth epsNodeBandwidth);
int updateEpsNodeBandwidthByServerSn(EpsNodeBandwidth epsNodeBandwidth);
int updateEpsNodeBandwidthBySwitchSn(EpsNodeBandwidth epsNodeBandwidth);
/**
* 监控看板-详情视图 95值列表
* @param epsNodeBandwidth
* @return
*/
List<EpsNodeBandwidth> getListByMonitorView(EpsNodeBandwidth epsNodeBandwidth);
}
@@ -0,0 +1,101 @@
package com.tongran.system.mapper;
import com.tongran.system.domain.EpsServerRevenueConfig;
import org.springframework.data.repository.query.Param;
import java.util.List;
import java.util.Map;
/**
* 服务器收益方式配置Mapper接口
*
* @author gyt
* @date 2025-08-19
*/
public interface EpsServerRevenueConfigMapper
{
/**
* 查询服务器收益方式配置
*
* @param id 服务器收益方式配置主键
* @return 服务器收益方式配置
*/
public EpsServerRevenueConfig selectEpsServerRevenueConfigById(Long id);
/**
* 查询服务器收益方式配置列表
*
* @param epsServerRevenueConfig 服务器收益方式配置
* @return 服务器收益方式配置集合
*/
public List<EpsServerRevenueConfig> selectEpsServerRevenueConfigList(EpsServerRevenueConfig epsServerRevenueConfig);
/**
* 新增服务器收益方式配置
*
* @param epsServerRevenueConfig 服务器收益方式配置
* @return 结果
*/
public int insertEpsServerRevenueConfig(EpsServerRevenueConfig epsServerRevenueConfig);
/**
* 修改服务器收益方式配置
*
* @param epsServerRevenueConfig 服务器收益方式配置
* @return 结果
*/
public int updateEpsServerRevenueConfig(EpsServerRevenueConfig epsServerRevenueConfig);
/**
* 删除服务器收益方式配置
*
* @param id 服务器收益方式配置主键
* @return 结果
*/
public int deleteEpsServerRevenueConfigById(Long id);
/**
* 批量删除服务器收益方式配置
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteEpsServerRevenueConfigByIds(Long[] ids);
/**
* 查询该数据是否存在
*
* @param hardwareSn 服务器sn
* @return 数据条数
*/
public EpsServerRevenueConfig countBySn(@Param("hardwareSn") String hardwareSn);
/**
* 查询服务器信息
*
* @param ipAddress ipv4地址
* @return 服务器收益方式配置
*/
public Map getNodeMsgByIp(@Param("ipAddress") String ipAddress);
/**
* 根据sn查询服务器信息
*
* @param hardwareSn 硬件SN
* @return 服务器收益方式配置
*/
public Map getNodeMsgBySn(@Param("hardwareSn") String hardwareSn);
int updateEpsServerRevenueConfigByServerSn(EpsServerRevenueConfig epsServerRevenueConfig);
/**
* 当前在线服务器的流量相关的业务数
* @return
*/
Integer countBusinessByTraffic();
/**
* 当日业务的在线设备数量统计TOP5
* @return
*/
List<Map> countDeviceNumTop5();
}
@@ -0,0 +1,61 @@
package com.tongran.system.mapper;
import java.util.List;
import com.tongran.system.domain.EpsTaskStatistics;
/**
* 业务95值计算任务Mapper接口
*
* @author gyt
* @date 2025-10-29
*/
public interface EpsTaskStatisticsMapper
{
/**
* 查询业务95值计算任务
*
* @param id 业务95值计算任务主键
* @return 业务95值计算任务
*/
public EpsTaskStatistics selectEpsTaskStatisticsById(Long id);
/**
* 查询业务95值计算任务列表
*
* @param epsTaskStatistics 业务95值计算任务
* @return 业务95值计算任务集合
*/
public List<EpsTaskStatistics> selectEpsTaskStatisticsList(EpsTaskStatistics epsTaskStatistics);
/**
* 新增业务95值计算任务
*
* @param epsTaskStatistics 业务95值计算任务
* @return 结果
*/
public int insertEpsTaskStatistics(EpsTaskStatistics epsTaskStatistics);
/**
* 修改业务95值计算任务
*
* @param epsTaskStatistics 业务95值计算任务
* @return 结果
*/
public int updateEpsTaskStatistics(EpsTaskStatistics epsTaskStatistics);
/**
* 删除业务95值计算任务
*
* @param id 业务95值计算任务主键
* @return 结果
*/
public int deleteEpsTaskStatisticsById(Long id);
/**
* 批量删除业务95值计算任务
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteEpsTaskStatisticsByIds(Long[] ids);
}
@@ -0,0 +1,61 @@
package com.tongran.system.mapper;
import java.util.List;
import com.tongran.system.domain.EpsTrafficData;
/**
* 流量相关数据Mapper接口
*
* @author gyt
* @date 2025-08-12
*/
public interface EpsTrafficDataMapper
{
/**
* 查询流量相关数据
*
* @param id 流量相关数据主键
* @return 流量相关数据
*/
public EpsTrafficData selectEpsTrafficDataById(Long id);
/**
* 查询流量相关数据列表
*
* @param epsTrafficData 流量相关数据
* @return 流量相关数据集合
*/
public List<EpsTrafficData> selectEpsTrafficDataList(EpsTrafficData epsTrafficData);
/**
* 新增流量相关数据
*
* @param epsTrafficData 流量相关数据
* @return 结果
*/
public int insertEpsTrafficData(EpsTrafficData epsTrafficData);
/**
* 修改流量相关数据
*
* @param epsTrafficData 流量相关数据
* @return 结果
*/
public int updateEpsTrafficData(EpsTrafficData epsTrafficData);
/**
* 删除流量相关数据
*
* @param id 流量相关数据主键
* @return 结果
*/
public int deleteEpsTrafficDataById(Long id);
/**
* 批量删除流量相关数据
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteEpsTrafficDataByIds(Long[] ids);
}
@@ -0,0 +1,120 @@
package com.tongran.system.mapper;
import com.tongran.system.domain.InitialSwitchInfoDetails;
import java.util.List;
/**
* 交换机监控信息Mapper接口
*
* @author gyt
* @date 2025-08-26
*/
public interface InitialSwitchInfoDetailsMapper
{
/**
* 查询交换机监控信息
*
* @param id 交换机监控信息主键
* @return 交换机监控信息
*/
public InitialSwitchInfoDetails selectInitialSwitchInfoDetailsById(Long id);
/**
* 查询交换机监控信息列表
*
* @param initialSwitchInfoDetails 交换机监控信息
* @return 交换机监控信息集合
*/
public List<InitialSwitchInfoDetails> selectInitialSwitchInfoDetailsList(InitialSwitchInfoDetails initialSwitchInfoDetails);
public List<InitialSwitchInfoDetails> getswitchDetailList(InitialSwitchInfoDetails initialSwitchInfoDetails);
/**
* 新增交换机监控信息
*
* @param initialSwitchInfoDetails 交换机监控信息
* @return 结果
*/
public int insertInitialSwitchInfoDetails(InitialSwitchInfoDetails initialSwitchInfoDetails);
/**
* 修改交换机监控信息
*
* @param initialSwitchInfoDetails 交换机监控信息
* @return 结果
*/
public int updateInitialSwitchInfoDetails(InitialSwitchInfoDetails initialSwitchInfoDetails);
/**
* 删除交换机监控信息
*
* @param id 交换机监控信息主键
* @return 结果
*/
public int deleteInitialSwitchInfoDetailsById(Long id);
/**
* 批量删除交换机监控信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteInitialSwitchInfoDetailsByIds(Long[] ids);
/**
* 批量新增交换机流量业务数据
* @param initialSwitchInfoDetails
* @return
*/
int saveBatchSwitchTraffic(InitialSwitchInfoDetails initialSwitchInfoDetails);
/**
* 批量新增交换机流量业务数据
* @param initialSwitchInfoDetails
* @return
*/
int saveBatchSwitchTrafficSharding(InitialSwitchInfoDetails initialSwitchInfoDetails);
/**
* 查询交换机信息
* @param initialSwitchInfoDetails
* @return
*/
List<InitialSwitchInfoDetails> getAllSwitchInfoMsg(InitialSwitchInfoDetails initialSwitchInfoDetails);
/**
* 计算业务95值
* @param queryParam
* @return
*/
List<InitialSwitchInfoDetails> sumSwitchTrafficByclientIds(InitialSwitchInfoDetails queryParam);
/**
* 监控看板-详情视图 出入流量列表
* @param queryParam
* @return
*/
List<InitialSwitchInfoDetails> geSwitchListByMonitorView(InitialSwitchInfoDetails queryParam);
/**
* 分表查询流量数据
* @param initialSwitchInfoDetails
* @return
*/
List<InitialSwitchInfoDetails> getAllSwitchInfoMsgSharding(InitialSwitchInfoDetails initialSwitchInfoDetails);
/**
* 分表查询业务表流量数据
* @param condition
* @return
*/
List<InitialSwitchInfoDetails> getSwitchDetailListSharding(InitialSwitchInfoDetails condition);
/**
* 分表查询业务表信息
* @param condition
* @return
*/
List<InitialSwitchInfoDetails> selectInitialSwitchInfoDetailsListSharding(InitialSwitchInfoDetails condition);
}
@@ -0,0 +1,61 @@
package com.tongran.system.mapper;
import java.util.List;
import com.tongran.system.domain.KnowledgeBase;
/**
* 知识库Mapper接口
*
* @author gyt
* @date 2025-08-15
*/
public interface KnowledgeBaseMapper
{
/**
* 查询知识库
*
* @param id 知识库主键
* @return 知识库
*/
public KnowledgeBase selectKnowledgeBaseById(Long id);
/**
* 查询知识库列表
*
* @param knowledgeBase 知识库
* @return 知识库集合
*/
public List<KnowledgeBase> selectKnowledgeBaseList(KnowledgeBase knowledgeBase);
/**
* 新增知识库
*
* @param knowledgeBase 知识库
* @return 结果
*/
public int insertKnowledgeBase(KnowledgeBase knowledgeBase);
/**
* 修改知识库
*
* @param knowledgeBase 知识库
* @return 结果
*/
public int updateKnowledgeBase(KnowledgeBase knowledgeBase);
/**
* 删除知识库
*
* @param id 知识库主键
* @return 结果
*/
public int deleteKnowledgeBaseById(Long id);
/**
* 批量删除知识库
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteKnowledgeBaseByIds(Long[] ids);
}
@@ -0,0 +1,61 @@
package com.tongran.system.mapper;
import java.util.List;
import com.tongran.system.domain.MtmMonitoringTemplate;
/**
* 监控模板管理Mapper接口
*
* @author gyt
* @date 2025-08-12
*/
public interface MtmMonitoringTemplateMapper
{
/**
* 查询监控模板管理
*
* @param id 监控模板管理主键
* @return 监控模板管理
*/
public MtmMonitoringTemplate selectMtmMonitoringTemplateById(Long id);
/**
* 查询监控模板管理列表
*
* @param mtmMonitoringTemplate 监控模板管理
* @return 监控模板管理集合
*/
public List<MtmMonitoringTemplate> selectMtmMonitoringTemplateList(MtmMonitoringTemplate mtmMonitoringTemplate);
/**
* 新增监控模板管理
*
* @param mtmMonitoringTemplate 监控模板管理
* @return 结果
*/
public int insertMtmMonitoringTemplate(MtmMonitoringTemplate mtmMonitoringTemplate);
/**
* 修改监控模板管理
*
* @param mtmMonitoringTemplate 监控模板管理
* @return 结果
*/
public int updateMtmMonitoringTemplate(MtmMonitoringTemplate mtmMonitoringTemplate);
/**
* 删除监控模板管理
*
* @param id 监控模板管理主键
* @return 结果
*/
public int deleteMtmMonitoringTemplateById(Long id);
/**
* 批量删除监控模板管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteMtmMonitoringTemplateByIds(Long[] ids);
}
@@ -0,0 +1,66 @@
package com.tongran.system.mapper;
import com.tongran.system.domain.RmEpsTopologyManagement;
import java.util.List;
/**
* 拓扑管理Mapper接口
*
* @author gyt
* @date 2025-08-12
*/
public interface RmEpsTopologyManagementMapper
{
/**
* 查询拓扑管理
*
* @param id 拓扑管理主键
* @return 拓扑管理
*/
public RmEpsTopologyManagement selectRmEpsTopologyManagementById(Long id);
/**
* 查询拓扑管理列表
*
* @param rmEpsTopologyManagement 拓扑管理
* @return 拓扑管理集合
*/
public List<RmEpsTopologyManagement> selectRmEpsTopologyManagementList(RmEpsTopologyManagement rmEpsTopologyManagement);
/**
* 新增拓扑管理
*
* @param rmEpsTopologyManagement 拓扑管理
* @return 结果
*/
public int insertRmEpsTopologyManagement(RmEpsTopologyManagement rmEpsTopologyManagement);
/**
* 修改拓扑管理
*
* @param rmEpsTopologyManagement 拓扑管理
* @return 结果
*/
public int updateRmEpsTopologyManagement(RmEpsTopologyManagement rmEpsTopologyManagement);
/**
* 删除拓扑管理
*
* @param id 拓扑管理主键
* @return 结果
*/
public int deleteRmEpsTopologyManagementById(Long id);
/**
* 批量删除拓扑管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteRmEpsTopologyManagementByIds(Long[] ids);
int updateRmEpsTopologyManagementByServerSn(RmEpsTopologyManagement rmEpsTopologyManagement);
int updateRmEpsTopologyManagementBySwitchSn(RmEpsTopologyManagement rmEpsTopologyManagement);
}
@@ -0,0 +1,68 @@
package com.tongran.system.mapper;
import com.tongran.system.domain.RmMonitorConfigDetails;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 监控看板详情Mapper接口
*
* @author gyt
* @date 2025-11-14
*/
public interface RmMonitorConfigDetailsMapper
{
/**
* 查询监控看板详情
*
* @param id 监控看板详情主键
* @return 监控看板详情
*/
public RmMonitorConfigDetails selectRmMonitorConfigDetailsById(Long id);
/**
* 查询监控看板详情列表
*
* @param rmMonitorConfigDetails 监控看板详情
* @return 监控看板详情集合
*/
public List<RmMonitorConfigDetails> selectRmMonitorConfigDetailsList(RmMonitorConfigDetails rmMonitorConfigDetails);
/**
* 新增监控看板详情
*
* @param rmMonitorConfigDetails 监控看板详情
* @return 结果
*/
public int insertRmMonitorConfigDetails(RmMonitorConfigDetails rmMonitorConfigDetails);
/**
* 修改监控看板详情
*
* @param rmMonitorConfigDetails 监控看板详情
* @return 结果
*/
public int updateRmMonitorConfigDetails(RmMonitorConfigDetails rmMonitorConfigDetails);
/**
* 删除监控看板详情
*
* @param id 监控看板详情主键
* @return 结果
*/
public int deleteRmMonitorConfigDetailsById(Long id);
public int deleteRmMonitorConfigDetailsByMonitorIds(Long[] monitorId);
/**
* 批量删除监控看板详情
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteRmMonitorConfigDetailsByIds(Long[] ids);
@Transactional(rollbackFor = Exception.class)
int batchInsertRmMonitorConfigDetails(List<RmMonitorConfigDetails> batchInsertList);
}
@@ -0,0 +1,61 @@
package com.tongran.system.mapper;
import java.util.List;
import com.tongran.system.domain.RmMonitorConfig;
/**
* 监控配置Mapper接口
*
* @author gyt
* @date 2025-11-12
*/
public interface RmMonitorConfigMapper
{
/**
* 查询监控配置
*
* @param id 监控配置主键
* @return 监控配置
*/
public RmMonitorConfig selectRmMonitorConfigById(Long id);
/**
* 查询监控配置列表
*
* @param rmMonitorConfig 监控配置
* @return 监控配置集合
*/
public List<RmMonitorConfig> selectRmMonitorConfigList(RmMonitorConfig rmMonitorConfig);
/**
* 新增监控配置
*
* @param rmMonitorConfig 监控配置
* @return 结果
*/
public int insertRmMonitorConfig(RmMonitorConfig rmMonitorConfig);
/**
* 修改监控配置
*
* @param rmMonitorConfig 监控配置
* @return 结果
*/
public int updateRmMonitorConfig(RmMonitorConfig rmMonitorConfig);
/**
* 删除监控配置
*
* @param id 监控配置主键
* @return 结果
*/
public int deleteRmMonitorConfigById(Long id);
/**
* 批量删除监控配置
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteRmMonitorConfigByIds(Long[] ids);
}
@@ -0,0 +1,68 @@
package com.tongran.system.mapper;
import com.tongran.system.domain.RmRegistrationMachine;
import java.util.List;
/**
* 绑定金山machinecodeMapper接口
*
* @author gyt
* @date 2025-10-10
*/
public interface RmRegistrationMachineMapper
{
/**
* 查询绑定金山machinecode
*
* @param id 绑定金山machinecode主键
* @return 绑定金山machinecode
*/
public RmRegistrationMachine selectRmRegistrationMachineById(Long id);
/**
* 查询绑定金山machinecode列表
*
* @param rmRegistrationMachine 绑定金山machinecode
* @return 绑定金山machinecode集合
*/
public List<RmRegistrationMachine> selectRmRegistrationMachineList(RmRegistrationMachine rmRegistrationMachine);
/**
* 新增绑定金山machinecode
*
* @param rmRegistrationMachine 绑定金山machinecode
* @return 结果
*/
public int insertRmRegistrationMachine(RmRegistrationMachine rmRegistrationMachine);
/**
* 修改绑定金山machinecode
*
* @param rmRegistrationMachine 绑定金山machinecode
* @return 结果
*/
public int updateRmRegistrationMachine(RmRegistrationMachine rmRegistrationMachine);
/**
* 删除绑定金山machinecode
*
* @param id 绑定金山machinecode主键
* @return 结果
*/
public int deleteRmRegistrationMachineById(Long id);
/**
* 批量删除绑定金山machinecode
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteRmRegistrationMachineByIds(Long[] ids);
/**
* 获取绑定的clientId
* @return
*/
List<RmRegistrationMachine> getAllMachineClientId();
}
@@ -0,0 +1,75 @@
package com.tongran.system.mapper;
import com.tongran.system.domain.RmResourceGroup;
import java.util.List;
/**
* 资源分组Mapper接口
*
* @author gyt
* @date 2025-08-12
*/
public interface RmResourceGroupMapper
{
/**
* 查询资源分组
*
* @param id 资源分组主键
* @return 资源分组
*/
public RmResourceGroup selectRmResourceGroupById(Long id);
/**
* 查询资源分组列表
*
* @param rmResourceGroup 资源分组
* @return 资源分组集合
*/
public List<RmResourceGroup> selectRmResourceGroupList(RmResourceGroup rmResourceGroup);
/**
* 新增资源分组
*
* @param rmResourceGroup 资源分组
* @return 结果
*/
public int insertRmResourceGroup(RmResourceGroup rmResourceGroup);
/**
* 修改资源分组
*
* @param rmResourceGroup 资源分组
* @return 结果
*/
public int updateRmResourceGroup(RmResourceGroup rmResourceGroup);
/**
* 删除资源分组
*
* @param id 资源分组主键
* @return 结果
*/
public int deleteRmResourceGroupById(Long id);
/**
* 批量删除资源分组
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteRmResourceGroupByIds(Long[] ids);
/**
* 查询资源分组信息和监控项
* @param id
* @return
*/
public RmResourceGroup selectMonitorMsgAndGroupMsg(Long id);
int exitsResourceById(RmResourceGroup rmResourceGroup);
int updateRmPolicyStatus(Long resourceGroupId);
int updateScriptPolicyStatus(Long resourceGroupId);
}
@@ -0,0 +1,109 @@
package com.tongran.system.mapper;
import com.tongran.system.domain.RmResourceRegistration;
import java.util.List;
import java.util.Map;
/**
* 资源注册Mapper接口
*
* @author gyt
* @date 2025-08-12
*/
public interface RmResourceRegistrationMapper
{
/**
* 查询资源注册
*
* @param id 资源注册主键
* @return 资源注册
*/
public RmResourceRegistration selectRmResourceRegistrationById(Long id);
/**
* 查询资源注册列表
*
* @param rmResourceRegistration 资源注册
* @return 资源注册集合
*/
public List<RmResourceRegistration> selectRmResourceRegistrationList(RmResourceRegistration rmResourceRegistration);
/**
* 新增资源注册
*
* @param rmResourceRegistration 资源注册
* @return 结果
*/
public int insertRmResourceRegistration(RmResourceRegistration rmResourceRegistration);
/**
* 修改资源注册
*
* @param rmResourceRegistration 资源注册
* @return 结果
*/
public int updateRmResourceRegistration(RmResourceRegistration rmResourceRegistration);
/**
* 删除资源注册
*
* @param id 资源注册主键
* @return 结果
*/
public int deleteRmResourceRegistrationById(Long id);
/**
* 批量删除资源注册
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteRmResourceRegistrationByIds(Long[] ids);
/**
* 查询所有资源名称([包含设备]功能使用)
* @return 资源注册集合
*/
public List<Map> selectAllResourceName();
/**
* 查询是否有此设备
* @param hardwareSn 资源sn
* @return 结果
*/
public int countBySn(String hardwareSn);
/**
* 查询所有资源名称
* @return 资源注册集合
*/
public List<Map> selectAllResourceNameByType(RmResourceRegistration resourceRegistration);
/**
* 检测到服务器离线,修改状态为离线
* @param rmResourceRegistration
* @return
*/
Integer updateStatusByResource(RmResourceRegistration rmResourceRegistration);
List<RmResourceRegistration> getRegistrationByIds(String[] ids);
/**
* 根据clientId获取注册信息
* @param rmResourceRegistration
* @return
*/
RmResourceRegistration selectRegistMsgByClientId(RmResourceRegistration rmResourceRegistration);
/**
* 获取所有逻辑节点标识
* @return
*/
List<Map> getAllLogicalNodeId();
/**
* 关联查询machinecode
* @param rmResourceRegistration
* @return
*/
List<RmResourceRegistration> getRegistrationTableInfoList(RmResourceRegistration rmResourceRegistration);
}

Some files were not shown because too many files have changed in this diff Show More