金山云服务API调用并入库,交换机管理功能新增
This commit is contained in:
+259
@@ -0,0 +1,259 @@
|
||||
package com.ruoyi.system.config;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.system.domain.EpsInitialTrafficData;
|
||||
import com.ruoyi.system.domain.RmRegistrationMachine;
|
||||
import com.ruoyi.system.service.EpsInitialTrafficDataService;
|
||||
import com.ruoyi.system.service.IRmRegistrationMachineService;
|
||||
import com.ruoyi.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);
|
||||
}
|
||||
}
|
||||
+20
@@ -72,6 +72,26 @@ public class TableScheduleConfig {
|
||||
.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")
|
||||
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
package com.ruoyi.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.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.system.domain.RmRegistrationMachine;
|
||||
import com.ruoyi.system.service.IRmRegistrationMachineService;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.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));
|
||||
}
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
package com.ruoyi.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.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.system.domain.RmSwitchInterfaceInfo;
|
||||
import com.ruoyi.system.service.IRmSwitchInterfaceInfoService;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.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));
|
||||
}
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.web.page.PageDomain;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.system.domain.RmSwitchManagement;
|
||||
import com.ruoyi.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(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));
|
||||
}
|
||||
}
|
||||
+2
@@ -110,6 +110,8 @@ public class EpsInitialTrafficData extends BaseEntity {
|
||||
private String bandwidthType;
|
||||
/** 日或月 */
|
||||
private String dayOrMonth;
|
||||
/** 金山流量 */
|
||||
private String machineFlow;
|
||||
|
||||
|
||||
}
|
||||
@@ -71,6 +71,8 @@ public class EpsNodeBandwidth extends BaseEntity
|
||||
/** 有效-月均95值 */
|
||||
@Excel(name = "有效-月均95值")
|
||||
private BigDecimal effectiveAvgMonthlyBandwidth95;
|
||||
/** 金山流量Mbps/日 */
|
||||
private BigDecimal machineFlow;
|
||||
|
||||
/** 设备业务客户id */
|
||||
@Excel(name = "设备业务客户id")
|
||||
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.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();
|
||||
}
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 交换机接口信息对象 rm_switch_interface_info
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
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;
|
||||
|
||||
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 setSwitchName(String switchName)
|
||||
{
|
||||
this.switchName = switchName;
|
||||
}
|
||||
|
||||
public String getSwitchName()
|
||||
{
|
||||
return switchName;
|
||||
}
|
||||
|
||||
public void setInterfaceName(String interfaceName)
|
||||
{
|
||||
this.interfaceName = interfaceName;
|
||||
}
|
||||
|
||||
public String getInterfaceName()
|
||||
{
|
||||
return interfaceName;
|
||||
}
|
||||
|
||||
public void setInterfaceRemark(String interfaceRemark)
|
||||
{
|
||||
this.interfaceRemark = interfaceRemark;
|
||||
}
|
||||
|
||||
public String getInterfaceRemark()
|
||||
{
|
||||
return interfaceRemark;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("hardwareSn", getHardwareSn())
|
||||
.append("switchName", getSwitchName())
|
||||
.append("interfaceName", getInterfaceName())
|
||||
.append("interfaceRemark", getInterfaceRemark())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
+251
@@ -0,0 +1,251 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 交换机管理对象 rm_switch_management
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
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 Integer onlineStatus;
|
||||
|
||||
/** 心跳监测次数 */
|
||||
@Excel(name = "心跳监测次数")
|
||||
private Long heartbeatCount;
|
||||
|
||||
/** 心跳监测周期(秒) */
|
||||
@Excel(name = "心跳监测周期(秒)")
|
||||
private Long 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;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setSwitchName(String switchName)
|
||||
{
|
||||
this.switchName = switchName;
|
||||
}
|
||||
|
||||
public String getSwitchName()
|
||||
{
|
||||
return switchName;
|
||||
}
|
||||
|
||||
public void setHardwareSn(String hardwareSn)
|
||||
{
|
||||
this.hardwareSn = hardwareSn;
|
||||
}
|
||||
|
||||
public String getHardwareSn()
|
||||
{
|
||||
return hardwareSn;
|
||||
}
|
||||
|
||||
public void setSnmpAddress(String snmpAddress)
|
||||
{
|
||||
this.snmpAddress = snmpAddress;
|
||||
}
|
||||
|
||||
public String getSnmpAddress()
|
||||
{
|
||||
return snmpAddress;
|
||||
}
|
||||
|
||||
public void setSnmpPort(Long snmpPort)
|
||||
{
|
||||
this.snmpPort = snmpPort;
|
||||
}
|
||||
|
||||
public Long getSnmpPort()
|
||||
{
|
||||
return snmpPort;
|
||||
}
|
||||
|
||||
public void setOnlineStatus(Integer onlineStatus)
|
||||
{
|
||||
this.onlineStatus = onlineStatus;
|
||||
}
|
||||
|
||||
public Integer getOnlineStatus()
|
||||
{
|
||||
return onlineStatus;
|
||||
}
|
||||
|
||||
public void setHeartbeatCount(Long heartbeatCount)
|
||||
{
|
||||
this.heartbeatCount = heartbeatCount;
|
||||
}
|
||||
|
||||
public Long getHeartbeatCount()
|
||||
{
|
||||
return heartbeatCount;
|
||||
}
|
||||
|
||||
public void setHeartbeatInterval(Long heartbeatInterval)
|
||||
{
|
||||
this.heartbeatInterval = heartbeatInterval;
|
||||
}
|
||||
|
||||
public Long getHeartbeatInterval()
|
||||
{
|
||||
return heartbeatInterval;
|
||||
}
|
||||
|
||||
public void setHeartbeatOid(String heartbeatOid)
|
||||
{
|
||||
this.heartbeatOid = heartbeatOid;
|
||||
}
|
||||
|
||||
public String getHeartbeatOid()
|
||||
{
|
||||
return heartbeatOid;
|
||||
}
|
||||
|
||||
public void setSnmpVersion(String snmpVersion)
|
||||
{
|
||||
this.snmpVersion = snmpVersion;
|
||||
}
|
||||
|
||||
public String getSnmpVersion()
|
||||
{
|
||||
return snmpVersion;
|
||||
}
|
||||
|
||||
public void setReadWritePermission(String readWritePermission)
|
||||
{
|
||||
this.readWritePermission = readWritePermission;
|
||||
}
|
||||
|
||||
public String getReadWritePermission()
|
||||
{
|
||||
return readWritePermission;
|
||||
}
|
||||
|
||||
public void setSecurityLevel(String securityLevel)
|
||||
{
|
||||
this.securityLevel = securityLevel;
|
||||
}
|
||||
|
||||
public String getSecurityLevel()
|
||||
{
|
||||
return securityLevel;
|
||||
}
|
||||
|
||||
public void setEncryptionMethod(String encryptionMethod)
|
||||
{
|
||||
this.encryptionMethod = encryptionMethod;
|
||||
}
|
||||
|
||||
public String getEncryptionMethod()
|
||||
{
|
||||
return encryptionMethod;
|
||||
}
|
||||
|
||||
public void setCommunityName(String communityName)
|
||||
{
|
||||
this.communityName = communityName;
|
||||
}
|
||||
|
||||
public String getCommunityName()
|
||||
{
|
||||
return communityName;
|
||||
}
|
||||
|
||||
public void setSwitchPassword(String switchPassword)
|
||||
{
|
||||
this.switchPassword = switchPassword;
|
||||
}
|
||||
|
||||
public String getSwitchPassword()
|
||||
{
|
||||
return switchPassword;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("switchName", getSwitchName())
|
||||
.append("hardwareSn", getHardwareSn())
|
||||
.append("snmpAddress", getSnmpAddress())
|
||||
.append("snmpPort", getSnmpPort())
|
||||
.append("onlineStatus", getOnlineStatus())
|
||||
.append("heartbeatCount", getHeartbeatCount())
|
||||
.append("heartbeatInterval", getHeartbeatInterval())
|
||||
.append("heartbeatOid", getHeartbeatOid())
|
||||
.append("snmpVersion", getSnmpVersion())
|
||||
.append("readWritePermission", getReadWritePermission())
|
||||
.append("securityLevel", getSecurityLevel())
|
||||
.append("encryptionMethod", getEncryptionMethod())
|
||||
.append("communityName", getCommunityName())
|
||||
.append("switchPassword", getSwitchPassword())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
+6
@@ -41,4 +41,10 @@ public interface EpsInitialTrafficDataMapper {
|
||||
*/
|
||||
List<EpsInitialTrafficData> getAllTraficMsg(EpsInitialTrafficData condition);
|
||||
|
||||
/**
|
||||
* 保存金山流量信息
|
||||
* @param epsInitialTrafficData
|
||||
* @return
|
||||
*/
|
||||
int updateMachineTraffic(EpsInitialTrafficData epsInitialTrafficData);
|
||||
}
|
||||
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.RmRegistrationMachine;
|
||||
|
||||
/**
|
||||
* 绑定金山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);
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.RmSwitchInterfaceInfo;
|
||||
|
||||
/**
|
||||
* 交换机接口信息Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
public interface RmSwitchInterfaceInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询交换机接口信息
|
||||
*
|
||||
* @param id 交换机接口信息主键
|
||||
* @return 交换机接口信息
|
||||
*/
|
||||
public RmSwitchInterfaceInfo selectRmSwitchInterfaceInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询交换机接口信息列表
|
||||
*
|
||||
* @param rmSwitchInterfaceInfo 交换机接口信息
|
||||
* @return 交换机接口信息集合
|
||||
*/
|
||||
public List<RmSwitchInterfaceInfo> selectRmSwitchInterfaceInfoList(RmSwitchInterfaceInfo rmSwitchInterfaceInfo);
|
||||
|
||||
/**
|
||||
* 新增交换机接口信息
|
||||
*
|
||||
* @param rmSwitchInterfaceInfo 交换机接口信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmSwitchInterfaceInfo(RmSwitchInterfaceInfo rmSwitchInterfaceInfo);
|
||||
|
||||
/**
|
||||
* 修改交换机接口信息
|
||||
*
|
||||
* @param rmSwitchInterfaceInfo 交换机接口信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmSwitchInterfaceInfo(RmSwitchInterfaceInfo rmSwitchInterfaceInfo);
|
||||
|
||||
/**
|
||||
* 删除交换机接口信息
|
||||
*
|
||||
* @param id 交换机接口信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmSwitchInterfaceInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除交换机接口信息
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmSwitchInterfaceInfoByIds(Long[] ids);
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.RmSwitchManagement;
|
||||
|
||||
/**
|
||||
* 交换机管理Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
public interface RmSwitchManagementMapper
|
||||
{
|
||||
/**
|
||||
* 查询交换机管理
|
||||
*
|
||||
* @param id 交换机管理主键
|
||||
* @return 交换机管理
|
||||
*/
|
||||
public RmSwitchManagement selectRmSwitchManagementById(Long id);
|
||||
|
||||
/**
|
||||
* 查询交换机管理列表
|
||||
*
|
||||
* @param rmSwitchManagement 交换机管理
|
||||
* @return 交换机管理集合
|
||||
*/
|
||||
public List<RmSwitchManagement> selectRmSwitchManagementList(RmSwitchManagement rmSwitchManagement);
|
||||
|
||||
/**
|
||||
* 新增交换机管理
|
||||
*
|
||||
* @param rmSwitchManagement 交换机管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmSwitchManagement(RmSwitchManagement rmSwitchManagement);
|
||||
|
||||
/**
|
||||
* 修改交换机管理
|
||||
*
|
||||
* @param rmSwitchManagement 交换机管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmSwitchManagement(RmSwitchManagement rmSwitchManagement);
|
||||
|
||||
/**
|
||||
* 删除交换机管理
|
||||
*
|
||||
* @param id 交换机管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmSwitchManagementById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除交换机管理
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmSwitchManagementByIds(Long[] ids);
|
||||
}
|
||||
+8
@@ -48,6 +48,12 @@ public interface EpsInitialTrafficDataService {
|
||||
* @return 流量数据列表
|
||||
*/
|
||||
void calculateBusiness95BandwidthDaily(EpsInitialTrafficData queryParam, String dailyStartTime, String dailyEndTime, String calculationMode);
|
||||
/**
|
||||
* 计算95带宽值-金山带宽/日
|
||||
* @param queryParam 查询参数实体
|
||||
* @return 流量数据列表
|
||||
*/
|
||||
void calculate95ByJinShan(EpsInitialTrafficData queryParam, String dailyStartTime, String dailyEndTime, String calculationMode);
|
||||
|
||||
/**
|
||||
* 重新计算服务器95带宽值
|
||||
@@ -67,4 +73,6 @@ public interface EpsInitialTrafficDataService {
|
||||
* @return
|
||||
*/
|
||||
BigDecimal sumTrafficByServer();
|
||||
|
||||
int updateMachineTraffic(EpsInitialTrafficData epsInitialTrafficData);
|
||||
}
|
||||
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.RmRegistrationMachine;
|
||||
|
||||
/**
|
||||
* 绑定金山machinecodeService接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
public interface IRmRegistrationMachineService
|
||||
{
|
||||
/**
|
||||
* 查询绑定金山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 ids 需要删除的绑定金山machinecode主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmRegistrationMachineByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除绑定金山machinecode信息
|
||||
*
|
||||
* @param id 绑定金山machinecode主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmRegistrationMachineById(Long id);
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.RmSwitchInterfaceInfo;
|
||||
|
||||
/**
|
||||
* 交换机接口信息Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
public interface IRmSwitchInterfaceInfoService
|
||||
{
|
||||
/**
|
||||
* 查询交换机接口信息
|
||||
*
|
||||
* @param id 交换机接口信息主键
|
||||
* @return 交换机接口信息
|
||||
*/
|
||||
public RmSwitchInterfaceInfo selectRmSwitchInterfaceInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询交换机接口信息列表
|
||||
*
|
||||
* @param rmSwitchInterfaceInfo 交换机接口信息
|
||||
* @return 交换机接口信息集合
|
||||
*/
|
||||
public List<RmSwitchInterfaceInfo> selectRmSwitchInterfaceInfoList(RmSwitchInterfaceInfo rmSwitchInterfaceInfo);
|
||||
|
||||
/**
|
||||
* 新增交换机接口信息
|
||||
*
|
||||
* @param rmSwitchInterfaceInfo 交换机接口信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmSwitchInterfaceInfo(RmSwitchInterfaceInfo rmSwitchInterfaceInfo);
|
||||
|
||||
/**
|
||||
* 修改交换机接口信息
|
||||
*
|
||||
* @param rmSwitchInterfaceInfo 交换机接口信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmSwitchInterfaceInfo(RmSwitchInterfaceInfo rmSwitchInterfaceInfo);
|
||||
|
||||
/**
|
||||
* 批量删除交换机接口信息
|
||||
*
|
||||
* @param ids 需要删除的交换机接口信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmSwitchInterfaceInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除交换机接口信息信息
|
||||
*
|
||||
* @param id 交换机接口信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmSwitchInterfaceInfoById(Long id);
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.RmSwitchManagement;
|
||||
|
||||
/**
|
||||
* 交换机管理Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
public interface IRmSwitchManagementService
|
||||
{
|
||||
/**
|
||||
* 查询交换机管理
|
||||
*
|
||||
* @param id 交换机管理主键
|
||||
* @return 交换机管理
|
||||
*/
|
||||
public RmSwitchManagement selectRmSwitchManagementById(Long id);
|
||||
|
||||
/**
|
||||
* 查询交换机管理列表
|
||||
*
|
||||
* @param rmSwitchManagement 交换机管理
|
||||
* @return 交换机管理集合
|
||||
*/
|
||||
public List<RmSwitchManagement> selectRmSwitchManagementList(RmSwitchManagement rmSwitchManagement);
|
||||
|
||||
/**
|
||||
* 新增交换机管理
|
||||
*
|
||||
* @param rmSwitchManagement 交换机管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRmSwitchManagement(RmSwitchManagement rmSwitchManagement);
|
||||
|
||||
/**
|
||||
* 修改交换机管理
|
||||
*
|
||||
* @param rmSwitchManagement 交换机管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRmSwitchManagement(RmSwitchManagement rmSwitchManagement);
|
||||
|
||||
/**
|
||||
* 批量删除交换机管理
|
||||
*
|
||||
* @param ids 需要删除的交换机管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmSwitchManagementByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除交换机管理信息
|
||||
*
|
||||
* @param id 交换机管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmSwitchManagementById(Long id);
|
||||
}
|
||||
+48
@@ -226,6 +226,40 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
processDeviceBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 计算金山95带宽值/日
|
||||
* @param queryParam
|
||||
*/
|
||||
@Override
|
||||
public void calculate95ByJinShan(EpsInitialTrafficData queryParam,
|
||||
String dailyStartTime, String dailyEndTime, String calculationMode) {
|
||||
// 获取所有设备SN列表
|
||||
List<AllInterfaceName> snList = allInterfaceNameMapper.getAllDeviceSn(new AllInterfaceName());
|
||||
// 遍历处理每个设备
|
||||
snList.forEach(interfaceName -> {
|
||||
queryParam.setServiceSn(interfaceName.getDeviceSn());
|
||||
queryParam.setStartTime(dailyStartTime);
|
||||
queryParam.setEndTime(dailyEndTime);
|
||||
List<EpsInitialTrafficData> dataList = query(queryParam);
|
||||
|
||||
if (!dataList.isEmpty()) {
|
||||
// 1. 提取并转换带宽值
|
||||
List<BigDecimal> speedsInMbps = dataList.stream()
|
||||
.map(data -> CalculateUtil.parseSpeedToMbps(data.getMachineFlow(), calculationMode))
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 2. 计算95百分位
|
||||
BigDecimal percentile95 = CalculateUtil.calculatePercentile(speedsInMbps, 0.95);
|
||||
|
||||
// 3. 保存结果
|
||||
EpsInitialTrafficData epsInitialTrafficData = dataList.get(0);
|
||||
epsInitialTrafficData.setResourceType("1");
|
||||
epsInitialTrafficData.setBandwidthType("8");
|
||||
saveBandwidthResult(epsInitialTrafficData, percentile95, dailyStartTime, calculationMode);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新计算服务器95带宽值
|
||||
@@ -343,6 +377,17 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
return total.setScale(0, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
/**
|
||||
* 金山流量插入数据
|
||||
* @param epsInitialTrafficData
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int updateMachineTraffic(EpsInitialTrafficData epsInitialTrafficData) {
|
||||
int rows = epsInitialTrafficDataMapper.updateMachineTraffic(epsInitialTrafficData);
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取公共方法
|
||||
* @return
|
||||
@@ -599,6 +644,9 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
case "7":
|
||||
bandwidth.setEffectiveAvgMonthlyBandwidth95(result);
|
||||
break;
|
||||
case "8":
|
||||
bandwidth.setMachineFlow(result);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown bandwidthType: " + data.getBandwidthType());
|
||||
}
|
||||
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.RmRegistrationMachineMapper;
|
||||
import com.ruoyi.system.domain.RmRegistrationMachine;
|
||||
import com.ruoyi.system.service.IRmRegistrationMachineService;
|
||||
|
||||
/**
|
||||
* 绑定金山machinecodeService业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
@Service
|
||||
public class RmRegistrationMachineServiceImpl implements IRmRegistrationMachineService
|
||||
{
|
||||
@Autowired
|
||||
private RmRegistrationMachineMapper rmRegistrationMachineMapper;
|
||||
|
||||
/**
|
||||
* 查询绑定金山machinecode
|
||||
*
|
||||
* @param id 绑定金山machinecode主键
|
||||
* @return 绑定金山machinecode
|
||||
*/
|
||||
@Override
|
||||
public RmRegistrationMachine selectRmRegistrationMachineById(Long id)
|
||||
{
|
||||
return rmRegistrationMachineMapper.selectRmRegistrationMachineById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询绑定金山machinecode列表
|
||||
*
|
||||
* @param rmRegistrationMachine 绑定金山machinecode
|
||||
* @return 绑定金山machinecode
|
||||
*/
|
||||
@Override
|
||||
public List<RmRegistrationMachine> selectRmRegistrationMachineList(RmRegistrationMachine rmRegistrationMachine)
|
||||
{
|
||||
return rmRegistrationMachineMapper.selectRmRegistrationMachineList(rmRegistrationMachine);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增绑定金山machinecode
|
||||
*
|
||||
* @param rmRegistrationMachine 绑定金山machinecode
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRmRegistrationMachine(RmRegistrationMachine rmRegistrationMachine)
|
||||
{
|
||||
rmRegistrationMachine.setCreateTime(DateUtils.getNowDate());
|
||||
return rmRegistrationMachineMapper.insertRmRegistrationMachine(rmRegistrationMachine);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改绑定金山machinecode
|
||||
*
|
||||
* @param rmRegistrationMachine 绑定金山machinecode
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRmRegistrationMachine(RmRegistrationMachine rmRegistrationMachine)
|
||||
{
|
||||
rmRegistrationMachine.setUpdateTime(DateUtils.getNowDate());
|
||||
return rmRegistrationMachineMapper.updateRmRegistrationMachine(rmRegistrationMachine);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除绑定金山machinecode
|
||||
*
|
||||
* @param ids 需要删除的绑定金山machinecode主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmRegistrationMachineByIds(Long[] ids)
|
||||
{
|
||||
return rmRegistrationMachineMapper.deleteRmRegistrationMachineByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除绑定金山machinecode信息
|
||||
*
|
||||
* @param id 绑定金山machinecode主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmRegistrationMachineById(Long id)
|
||||
{
|
||||
return rmRegistrationMachineMapper.deleteRmRegistrationMachineById(id);
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.RmSwitchInterfaceInfoMapper;
|
||||
import com.ruoyi.system.domain.RmSwitchInterfaceInfo;
|
||||
import com.ruoyi.system.service.IRmSwitchInterfaceInfoService;
|
||||
|
||||
/**
|
||||
* 交换机接口信息Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
@Service
|
||||
public class RmSwitchInterfaceInfoServiceImpl implements IRmSwitchInterfaceInfoService
|
||||
{
|
||||
@Autowired
|
||||
private RmSwitchInterfaceInfoMapper rmSwitchInterfaceInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询交换机接口信息
|
||||
*
|
||||
* @param id 交换机接口信息主键
|
||||
* @return 交换机接口信息
|
||||
*/
|
||||
@Override
|
||||
public RmSwitchInterfaceInfo selectRmSwitchInterfaceInfoById(Long id)
|
||||
{
|
||||
return rmSwitchInterfaceInfoMapper.selectRmSwitchInterfaceInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询交换机接口信息列表
|
||||
*
|
||||
* @param rmSwitchInterfaceInfo 交换机接口信息
|
||||
* @return 交换机接口信息
|
||||
*/
|
||||
@Override
|
||||
public List<RmSwitchInterfaceInfo> selectRmSwitchInterfaceInfoList(RmSwitchInterfaceInfo rmSwitchInterfaceInfo)
|
||||
{
|
||||
return rmSwitchInterfaceInfoMapper.selectRmSwitchInterfaceInfoList(rmSwitchInterfaceInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增交换机接口信息
|
||||
*
|
||||
* @param rmSwitchInterfaceInfo 交换机接口信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRmSwitchInterfaceInfo(RmSwitchInterfaceInfo rmSwitchInterfaceInfo)
|
||||
{
|
||||
rmSwitchInterfaceInfo.setCreateTime(DateUtils.getNowDate());
|
||||
return rmSwitchInterfaceInfoMapper.insertRmSwitchInterfaceInfo(rmSwitchInterfaceInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改交换机接口信息
|
||||
*
|
||||
* @param rmSwitchInterfaceInfo 交换机接口信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRmSwitchInterfaceInfo(RmSwitchInterfaceInfo rmSwitchInterfaceInfo)
|
||||
{
|
||||
rmSwitchInterfaceInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return rmSwitchInterfaceInfoMapper.updateRmSwitchInterfaceInfo(rmSwitchInterfaceInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除交换机接口信息
|
||||
*
|
||||
* @param ids 需要删除的交换机接口信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmSwitchInterfaceInfoByIds(Long[] ids)
|
||||
{
|
||||
return rmSwitchInterfaceInfoMapper.deleteRmSwitchInterfaceInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除交换机接口信息信息
|
||||
*
|
||||
* @param id 交换机接口信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmSwitchInterfaceInfoById(Long id)
|
||||
{
|
||||
return rmSwitchInterfaceInfoMapper.deleteRmSwitchInterfaceInfoById(id);
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.RmSwitchManagementMapper;
|
||||
import com.ruoyi.system.domain.RmSwitchManagement;
|
||||
import com.ruoyi.system.service.IRmSwitchManagementService;
|
||||
|
||||
/**
|
||||
* 交换机管理Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-10
|
||||
*/
|
||||
@Service
|
||||
public class RmSwitchManagementServiceImpl implements IRmSwitchManagementService
|
||||
{
|
||||
@Autowired
|
||||
private RmSwitchManagementMapper rmSwitchManagementMapper;
|
||||
|
||||
/**
|
||||
* 查询交换机管理
|
||||
*
|
||||
* @param id 交换机管理主键
|
||||
* @return 交换机管理
|
||||
*/
|
||||
@Override
|
||||
public RmSwitchManagement selectRmSwitchManagementById(Long id)
|
||||
{
|
||||
return rmSwitchManagementMapper.selectRmSwitchManagementById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询交换机管理列表
|
||||
*
|
||||
* @param rmSwitchManagement 交换机管理
|
||||
* @return 交换机管理
|
||||
*/
|
||||
@Override
|
||||
public List<RmSwitchManagement> selectRmSwitchManagementList(RmSwitchManagement rmSwitchManagement)
|
||||
{
|
||||
return rmSwitchManagementMapper.selectRmSwitchManagementList(rmSwitchManagement);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增交换机管理
|
||||
*
|
||||
* @param rmSwitchManagement 交换机管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRmSwitchManagement(RmSwitchManagement rmSwitchManagement)
|
||||
{
|
||||
rmSwitchManagement.setCreateTime(DateUtils.getNowDate());
|
||||
return rmSwitchManagementMapper.insertRmSwitchManagement(rmSwitchManagement);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改交换机管理
|
||||
*
|
||||
* @param rmSwitchManagement 交换机管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRmSwitchManagement(RmSwitchManagement rmSwitchManagement)
|
||||
{
|
||||
rmSwitchManagement.setUpdateTime(DateUtils.getNowDate());
|
||||
return rmSwitchManagementMapper.updateRmSwitchManagement(rmSwitchManagement);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除交换机管理
|
||||
*
|
||||
* @param ids 需要删除的交换机管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmSwitchManagementByIds(Long[] ids)
|
||||
{
|
||||
return rmSwitchManagementMapper.deleteRmSwitchManagementByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除交换机管理信息
|
||||
*
|
||||
* @param id 交换机管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRmSwitchManagementById(Long id)
|
||||
{
|
||||
return rmSwitchManagementMapper.deleteRmSwitchManagementById(id);
|
||||
}
|
||||
}
|
||||
@@ -1,91 +1,115 @@
|
||||
package com.ruoyi.system.util;
|
||||
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
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.net.URI;
|
||||
|
||||
public class HmacUtils {
|
||||
private static final String MAC_NAME = "HmacSHA1";
|
||||
private static final String ENCODING = "UTF-8";
|
||||
/**
|
||||
*@param encryptKey 秘钥由中控系统分配
|
||||
*@param plainText 加密内容:token + 时间戳 + URI
|
||||
*/
|
||||
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);
|
||||
// 2、创建MAC对象
|
||||
Mac mac = Mac.getInstance(MAC_NAME);
|
||||
// 3、设置密钥
|
||||
mac.init(secretKey);
|
||||
// 4、数据加密
|
||||
byte[] bytes = mac.doFinal(dataValue);
|
||||
// 5、生成数据
|
||||
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];
|
||||
// two characters form the hex value.
|
||||
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);
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
long timestamp = DateUtils.getNowDate().getTime();
|
||||
String plainText = "efea5f0218c84a24b9fdab3264de3da5" + timestamp + "/supplier/outer/dev/getFlow";
|
||||
String secretKey = getHmac(plainText, "91a73fd806ab2c005c13b4dc19130a884e909dea3f72d46e30266fe1a1f588d8");
|
||||
System.out.println(secretKey);
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
// 设置请求头
|
||||
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));
|
||||
|
||||
// 使用 UriComponentsBuilder 构建URL(推荐)
|
||||
URI uri = UriComponentsBuilder
|
||||
.fromHttpUrl("https://ecscm-openapi.ksyun.com/supplier/outer/dev/getFlow")
|
||||
.queryParam("srmChannel", "1000121954")
|
||||
.queryParam("startTime", "2025-10-09 00:00:00")
|
||||
.queryParam("endTime", "2025-10-09 01:00:00")
|
||||
.build()
|
||||
.toUri();
|
||||
HttpEntity<String> entity = new HttpEntity<>(headers);
|
||||
|
||||
// GET 请求
|
||||
ResponseEntity<String> response = restTemplate.exchange(
|
||||
uri,
|
||||
HttpMethod.GET,
|
||||
entity,
|
||||
String.class
|
||||
);
|
||||
|
||||
System.out.println(response.getBody());
|
||||
}
|
||||
}
|
||||
//package com.ruoyi.system.util;
|
||||
//
|
||||
//import org.springframework.http.HttpEntity;
|
||||
//import org.springframework.http.HttpHeaders;
|
||||
//import org.springframework.http.HttpMethod;
|
||||
//import org.springframework.http.ResponseEntity;
|
||||
//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.net.URI;
|
||||
//import java.time.LocalDateTime;
|
||||
//import java.time.format.DateTimeFormatter;
|
||||
//
|
||||
//public class HmacUtils {
|
||||
// private static final String MAC_NAME = "HmacSHA1";
|
||||
// private static final String ENCODING = "UTF-8";
|
||||
// /**
|
||||
// *@param encryptKey 秘钥由中控系统分配
|
||||
// *@param plainText 加密内容:token + 时间戳 + URI
|
||||
// */
|
||||
// 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);
|
||||
// // 2、创建MAC对象
|
||||
// Mac mac = Mac.getInstance(MAC_NAME);
|
||||
// // 3、设置密钥
|
||||
// mac.init(secretKey);
|
||||
// // 4、数据加密
|
||||
// byte[] bytes = mac.doFinal(dataValue);
|
||||
// // 5、生成数据
|
||||
// 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];
|
||||
// // two characters form the hex value.
|
||||
// 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);
|
||||
// }
|
||||
// public static void main(String[] args) {
|
||||
// RestTemplate restTemplate = new RestTemplate();
|
||||
// try {
|
||||
// System.out.println("开始执行定时任务,时间:" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
//
|
||||
// // 计算时间范围:当前时间往前推3小时的整点时间段
|
||||
// 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));
|
||||
//
|
||||
// // 构建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());
|
||||
// System.out.println("定时任务执行完成");
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// System.err.println("定时任务执行失败:" + e.getMessage());
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class TableRouterUtil {
|
||||
return tableNames;
|
||||
}
|
||||
// 解析字符串为LocalDateTime
|
||||
private static LocalDateTime parseDateTime(String dateTimeStr) {
|
||||
public static LocalDateTime parseDateTime(String dateTimeStr) {
|
||||
if (dateTimeStr == null || dateTimeStr.trim().isEmpty()) {
|
||||
throw new IllegalArgumentException("时间字符串不能为空");
|
||||
}
|
||||
|
||||
+7
-2
@@ -14,8 +14,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
ipV4 VARCHAR(20) COMMENT 'IPv4地址',
|
||||
`in_dropped` DECIMAL(20,2) COMMENT '入站丢包率(%)',
|
||||
`out_dropped` DECIMAL(20,2) COMMENT '出站丢包率(%)',
|
||||
`in_speed` varchar(50) COMMENT '接收带宽(Mbps)',
|
||||
`out_speed` varchar(50) COMMENT '发送带宽(Mbps)',
|
||||
`in_speed` varchar(50) COMMENT '接收带宽(bit)',
|
||||
`out_speed` varchar(50) COMMENT '发送带宽(bit)',
|
||||
`machine_flow` varchar(50) COMMENT '金山带宽(bit)',
|
||||
`speed` varchar(100) COMMENT '协商速度',
|
||||
`duplex` varchar(100) COMMENT '工作模式',
|
||||
business_id varchar(50) COMMENT '业务代码',
|
||||
@@ -176,6 +177,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
`out_dropped` AS outDropped,
|
||||
`in_speed` AS inSpeed,
|
||||
`out_speed` AS outSpeed,
|
||||
`machine_flow` AS machineFlow,
|
||||
`speed` AS speed,
|
||||
`duplex` AS duplex,
|
||||
business_id AS businessId,
|
||||
@@ -243,4 +245,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</where>
|
||||
ORDER BY create_time desc
|
||||
</select>
|
||||
<update id="updateMachineTraffic" parameterType="EpsInitialTrafficData">
|
||||
update ${tableName} set machine_flow=#{machineFlow} where client_id=#{clientId} and create_time=#{createTime}
|
||||
</update>
|
||||
</mapper>
|
||||
+2
-1
@@ -15,6 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="bandwidth95Monthly" column="bandwidth_95_monthly" />
|
||||
<result property="avgMonthlyBandwidth95" column="avg_monthly_bandwidth_95" />
|
||||
<result property="packageBandwidthDaily" column="package_bandwidth_daily" />
|
||||
<result property="machineFlow" column="machine_flow" />
|
||||
<result property="customerId" column="customer_id" />
|
||||
<result property="customerName" column="customer_name" />
|
||||
<result property="serviceNumber" column="service_number" />
|
||||
@@ -37,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEpsNodeBandwidthVo">
|
||||
select id, node_name, hardware_sn, calculation_mode, bandwidth_type, bandwidth_result, bandwidth_95_daily, bandwidth_95_monthly, avg_monthly_bandwidth_95, package_bandwidth_daily, customer_id, customer_name, service_number, uplink_switch, create_time, update_time, creator_id, creator_name, switch_sn, interface_name, resource_type, interface_link_device_type, effective_bandwidth_95_daily, effective_bandwidth_95_monthly, effective_avg_monthly_bandwidth_95, business_name, business_id, remark1, create_datetime from eps_node_bandwidth
|
||||
select id, node_name, hardware_sn, calculation_mode, bandwidth_type, bandwidth_result, bandwidth_95_daily, bandwidth_95_monthly, avg_monthly_bandwidth_95, package_bandwidth_daily, machine_flow, customer_id, customer_name, service_number, uplink_switch, create_time, update_time, creator_id, creator_name, switch_sn, interface_name, resource_type, interface_link_device_type, effective_bandwidth_95_daily, effective_bandwidth_95_monthly, effective_avg_monthly_bandwidth_95, business_name, business_id, remark1, create_datetime from eps_node_bandwidth
|
||||
</sql>
|
||||
|
||||
<select id="selectEpsNodeBandwidthList" parameterType="EpsNodeBandwidth" resultMap="EpsNodeBandwidthResult">
|
||||
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.RmRegistrationMachineMapper">
|
||||
|
||||
<resultMap type="RmRegistrationMachine" id="RmRegistrationMachineResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="clientId" column="client_id" />
|
||||
<result property="machineCode" column="machine_code" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRmRegistrationMachineVo">
|
||||
select id, client_id, machine_code, create_time, update_time, create_by, update_by from rm_registration_machine
|
||||
</sql>
|
||||
|
||||
<select id="selectRmRegistrationMachineList" parameterType="RmRegistrationMachine" resultMap="RmRegistrationMachineResult">
|
||||
<include refid="selectRmRegistrationMachineVo"/>
|
||||
<where>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
<if test="machineCode != null and machineCode != ''"> and machine_code = #{machineCode}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRmRegistrationMachineById" parameterType="Long" resultMap="RmRegistrationMachineResult">
|
||||
<include refid="selectRmRegistrationMachineVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRmRegistrationMachine" parameterType="RmRegistrationMachine" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into rm_registration_machine
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="clientId != null and clientId != ''">client_id,</if>
|
||||
<if test="machineCode != null and machineCode != ''">machine_code,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="clientId != null and clientId != ''">#{clientId},</if>
|
||||
<if test="machineCode != null and machineCode != ''">#{machineCode},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRmRegistrationMachine" parameterType="RmRegistrationMachine">
|
||||
update rm_registration_machine
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="clientId != null and clientId != ''">client_id = #{clientId},</if>
|
||||
<if test="machineCode != null and machineCode != ''">machine_code = #{machineCode},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRmRegistrationMachineById" parameterType="Long">
|
||||
delete from rm_registration_machine where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRmRegistrationMachineByIds" parameterType="String">
|
||||
delete from rm_registration_machine where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.RmSwitchInterfaceInfoMapper">
|
||||
|
||||
<resultMap type="RmSwitchInterfaceInfo" id="RmSwitchInterfaceInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="hardwareSn" column="hardware_sn" />
|
||||
<result property="switchName" column="switch_name" />
|
||||
<result property="interfaceName" column="interface_name" />
|
||||
<result property="interfaceRemark" column="interface_remark" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRmSwitchInterfaceInfoVo">
|
||||
select id, hardware_sn, switch_name, interface_name, interface_remark, create_time, update_time, create_by, update_by from rm_switch_interface_info
|
||||
</sql>
|
||||
|
||||
<select id="selectRmSwitchInterfaceInfoList" parameterType="RmSwitchInterfaceInfo" resultMap="RmSwitchInterfaceInfoResult">
|
||||
<include refid="selectRmSwitchInterfaceInfoVo"/>
|
||||
<where>
|
||||
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
|
||||
<if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</if>
|
||||
<if test="interfaceName != null and interfaceName != ''"> and interface_name like concat('%', #{interfaceName}, '%')</if>
|
||||
<if test="interfaceRemark != null and interfaceRemark != ''"> and interface_remark = #{interfaceRemark}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRmSwitchInterfaceInfoById" parameterType="Long" resultMap="RmSwitchInterfaceInfoResult">
|
||||
<include refid="selectRmSwitchInterfaceInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRmSwitchInterfaceInfo" parameterType="RmSwitchInterfaceInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into rm_switch_interface_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="hardwareSn != null and hardwareSn != ''">hardware_sn,</if>
|
||||
<if test="switchName != null and switchName != ''">switch_name,</if>
|
||||
<if test="interfaceName != null and interfaceName != ''">interface_name,</if>
|
||||
<if test="interfaceRemark != null">interface_remark,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="hardwareSn != null and hardwareSn != ''">#{hardwareSn},</if>
|
||||
<if test="switchName != null and switchName != ''">#{switchName},</if>
|
||||
<if test="interfaceName != null and interfaceName != ''">#{interfaceName},</if>
|
||||
<if test="interfaceRemark != null">#{interfaceRemark},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRmSwitchInterfaceInfo" parameterType="RmSwitchInterfaceInfo">
|
||||
update rm_switch_interface_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="hardwareSn != null and hardwareSn != ''">hardware_sn = #{hardwareSn},</if>
|
||||
<if test="switchName != null and switchName != ''">switch_name = #{switchName},</if>
|
||||
<if test="interfaceName != null and interfaceName != ''">interface_name = #{interfaceName},</if>
|
||||
<if test="interfaceRemark != null">interface_remark = #{interfaceRemark},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRmSwitchInterfaceInfoById" parameterType="Long">
|
||||
delete from rm_switch_interface_info where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRmSwitchInterfaceInfoByIds" parameterType="String">
|
||||
delete from rm_switch_interface_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.RmSwitchManagementMapper">
|
||||
|
||||
<resultMap type="RmSwitchManagement" id="RmSwitchManagementResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="switchName" column="switch_name" />
|
||||
<result property="hardwareSn" column="hardware_sn" />
|
||||
<result property="snmpAddress" column="snmp_address" />
|
||||
<result property="snmpPort" column="snmp_port" />
|
||||
<result property="onlineStatus" column="online_status" />
|
||||
<result property="heartbeatCount" column="heartbeat_count" />
|
||||
<result property="heartbeatInterval" column="heartbeat_interval" />
|
||||
<result property="heartbeatOid" column="heartbeat_oid" />
|
||||
<result property="snmpVersion" column="snmp_version" />
|
||||
<result property="readWritePermission" column="read_write_permission" />
|
||||
<result property="securityLevel" column="security_level" />
|
||||
<result property="encryptionMethod" column="encryption_method" />
|
||||
<result property="communityName" column="community_name" />
|
||||
<result property="switchPassword" column="switch_password" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRmSwitchManagementVo">
|
||||
select id, switch_name, hardware_sn, snmp_address, snmp_port, online_status, heartbeat_count, heartbeat_interval, heartbeat_oid, snmp_version, read_write_permission, security_level, encryption_method, community_name, switch_password, create_time, update_time, create_by, update_by from rm_switch_management
|
||||
</sql>
|
||||
|
||||
<select id="selectRmSwitchManagementList" parameterType="RmSwitchManagement" resultMap="RmSwitchManagementResult">
|
||||
<include refid="selectRmSwitchManagementVo"/>
|
||||
<where>
|
||||
<if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</if>
|
||||
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
|
||||
<if test="snmpAddress != null and snmpAddress != ''"> and snmp_address = #{snmpAddress}</if>
|
||||
<if test="snmpPort != null "> and snmp_port = #{snmpPort}</if>
|
||||
<if test="onlineStatus != null "> and online_status = #{onlineStatus}</if>
|
||||
<if test="heartbeatCount != null "> and heartbeat_count = #{heartbeatCount}</if>
|
||||
<if test="heartbeatInterval != null "> and heartbeat_interval = #{heartbeatInterval}</if>
|
||||
<if test="heartbeatOid != null and heartbeatOid != ''"> and heartbeat_oid = #{heartbeatOid}</if>
|
||||
<if test="snmpVersion != null and snmpVersion != ''"> and snmp_version = #{snmpVersion}</if>
|
||||
<if test="readWritePermission != null and readWritePermission != ''"> and read_write_permission = #{readWritePermission}</if>
|
||||
<if test="securityLevel != null and securityLevel != ''"> and security_level = #{securityLevel}</if>
|
||||
<if test="encryptionMethod != null and encryptionMethod != ''"> and encryption_method = #{encryptionMethod}</if>
|
||||
<if test="communityName != null and communityName != ''"> and community_name like concat('%', #{communityName}, '%')</if>
|
||||
<if test="switchPassword != null and switchPassword != ''"> and switch_password = #{switchPassword}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRmSwitchManagementById" parameterType="Long" resultMap="RmSwitchManagementResult">
|
||||
<include refid="selectRmSwitchManagementVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRmSwitchManagement" parameterType="RmSwitchManagement" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into rm_switch_management
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="switchName != null and switchName != ''">switch_name,</if>
|
||||
<if test="hardwareSn != null and hardwareSn != ''">hardware_sn,</if>
|
||||
<if test="snmpAddress != null and snmpAddress != ''">snmp_address,</if>
|
||||
<if test="snmpPort != null">snmp_port,</if>
|
||||
<if test="onlineStatus != null">online_status,</if>
|
||||
<if test="heartbeatCount != null">heartbeat_count,</if>
|
||||
<if test="heartbeatInterval != null">heartbeat_interval,</if>
|
||||
<if test="heartbeatOid != null and heartbeatOid != ''">heartbeat_oid,</if>
|
||||
<if test="snmpVersion != null and snmpVersion != ''">snmp_version,</if>
|
||||
<if test="readWritePermission != null">read_write_permission,</if>
|
||||
<if test="securityLevel != null">security_level,</if>
|
||||
<if test="encryptionMethod != null">encryption_method,</if>
|
||||
<if test="communityName != null">community_name,</if>
|
||||
<if test="switchPassword != null">switch_password,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="switchName != null and switchName != ''">#{switchName},</if>
|
||||
<if test="hardwareSn != null and hardwareSn != ''">#{hardwareSn},</if>
|
||||
<if test="snmpAddress != null and snmpAddress != ''">#{snmpAddress},</if>
|
||||
<if test="snmpPort != null">#{snmpPort},</if>
|
||||
<if test="onlineStatus != null">#{onlineStatus},</if>
|
||||
<if test="heartbeatCount != null">#{heartbeatCount},</if>
|
||||
<if test="heartbeatInterval != null">#{heartbeatInterval},</if>
|
||||
<if test="heartbeatOid != null and heartbeatOid != ''">#{heartbeatOid},</if>
|
||||
<if test="snmpVersion != null and snmpVersion != ''">#{snmpVersion},</if>
|
||||
<if test="readWritePermission != null">#{readWritePermission},</if>
|
||||
<if test="securityLevel != null">#{securityLevel},</if>
|
||||
<if test="encryptionMethod != null">#{encryptionMethod},</if>
|
||||
<if test="communityName != null">#{communityName},</if>
|
||||
<if test="switchPassword != null">#{switchPassword},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRmSwitchManagement" parameterType="RmSwitchManagement">
|
||||
update rm_switch_management
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="switchName != null and switchName != ''">switch_name = #{switchName},</if>
|
||||
<if test="hardwareSn != null and hardwareSn != ''">hardware_sn = #{hardwareSn},</if>
|
||||
<if test="snmpAddress != null and snmpAddress != ''">snmp_address = #{snmpAddress},</if>
|
||||
<if test="snmpPort != null">snmp_port = #{snmpPort},</if>
|
||||
<if test="onlineStatus != null">online_status = #{onlineStatus},</if>
|
||||
<if test="heartbeatCount != null">heartbeat_count = #{heartbeatCount},</if>
|
||||
<if test="heartbeatInterval != null">heartbeat_interval = #{heartbeatInterval},</if>
|
||||
<if test="heartbeatOid != null and heartbeatOid != ''">heartbeat_oid = #{heartbeatOid},</if>
|
||||
<if test="snmpVersion != null and snmpVersion != ''">snmp_version = #{snmpVersion},</if>
|
||||
<if test="readWritePermission != null">read_write_permission = #{readWritePermission},</if>
|
||||
<if test="securityLevel != null">security_level = #{securityLevel},</if>
|
||||
<if test="encryptionMethod != null">encryption_method = #{encryptionMethod},</if>
|
||||
<if test="communityName != null">community_name = #{communityName},</if>
|
||||
<if test="switchPassword != null">switch_password = #{switchPassword},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRmSwitchManagementById" parameterType="Long">
|
||||
delete from rm_switch_management where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRmSwitchManagementByIds" parameterType="String">
|
||||
delete from rm_switch_management where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -65,5 +65,8 @@ public class RmMonitorPolicy extends BaseEntity
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
/** 交换机类型 */
|
||||
private String switchType;
|
||||
/** 部署设备 */
|
||||
private String deployDevice;
|
||||
}
|
||||
|
||||
@@ -16,10 +16,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="switchType" column="switch_type" />
|
||||
<result property="deployDevice" column="deploy_device" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRmMonitorPolicyVo">
|
||||
select id, template_id, resource_group_id, policy_name, description, status, deploy_time, create_time, update_time, create_by, update_by from rm_monitor_policy
|
||||
select id, template_id, resource_group_id, policy_name, description, status, deploy_time, create_time, update_time, create_by, update_by, switch_type, deploy_device from rm_monitor_policy
|
||||
</sql>
|
||||
|
||||
<select id="selectRmMonitorPolicyList" parameterType="RmMonitorPolicy" resultMap="RmMonitorPolicyResult">
|
||||
@@ -58,7 +60,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
</trim>
|
||||
<if test="switchType != null">switch_type,</if>
|
||||
<if test="deployDevice != null">deploy_device,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="templateId != null">#{templateId},</if>
|
||||
<if test="resourceGroupId != null">#{resourceGroupId},</if>
|
||||
@@ -70,7 +74,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
</trim>
|
||||
<if test="switchType != null">#{switchType},</if>
|
||||
<if test="deployDevice != null">#{deployDevice},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRmMonitorPolicy" parameterType="RmMonitorPolicy">
|
||||
@@ -86,6 +92,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="switchType != null">switch_type = #{switchType},</if>
|
||||
<if test="deployDevice != null">deploy_device = #{deployDevice},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
Reference in New Issue
Block a user