diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/config/HmacScheduledTask.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/config/HmacScheduledTask.java new file mode 100644 index 0000000..f4b927e --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/config/HmacScheduledTask.java @@ -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 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 entity = new HttpEntity<>(headers); + + // GET 请求 + ResponseEntity 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 responseMap = objectMapper.readValue(responseBody, Map.class); + + if (responseMap.get("code").equals(200)) { + Map dataMap = (Map) responseMap.get("data"); + Integer total = (Integer) dataMap.get("total"); + List> dataList = (List>) dataMap.get("data"); + + System.out.println("成功获取数据,总记录数:" + total); + + // 处理每条数据 + for (Map 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 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 entity = new HttpEntity<>(headers); + + // GET 请求 + ResponseEntity 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); + } +} \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/config/TableScheduleConfig.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/config/TableScheduleConfig.java index 81db79e..c4b1486 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/config/TableScheduleConfig.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/config/TableScheduleConfig.java @@ -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") diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/RmRegistrationMachineController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/RmRegistrationMachineController.java new file mode 100644 index 0000000..baa4339 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/RmRegistrationMachineController.java @@ -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 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 list = rmRegistrationMachineService.selectRmRegistrationMachineList(rmRegistrationMachine); + ExcelUtil util = new ExcelUtil(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)); + } +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/RmSwitchInterfaceInfoController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/RmSwitchInterfaceInfoController.java new file mode 100644 index 0000000..c2eae81 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/RmSwitchInterfaceInfoController.java @@ -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 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 list = rmSwitchInterfaceInfoService.selectRmSwitchInterfaceInfoList(rmSwitchInterfaceInfo); + ExcelUtil util = new ExcelUtil(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)); + } +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/RmSwitchManagementController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/RmSwitchManagementController.java new file mode 100644 index 0000000..1d2170c --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/RmSwitchManagementController.java @@ -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 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 list = rmSwitchManagementService.selectRmSwitchManagementList(rmSwitchManagement); + ExcelUtil util = new ExcelUtil(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)); + } +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/EpsInitialTrafficData.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/EpsInitialTrafficData.java index 4301491..1304e6e 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/EpsInitialTrafficData.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/EpsInitialTrafficData.java @@ -110,6 +110,8 @@ public class EpsInitialTrafficData extends BaseEntity { private String bandwidthType; /** 日或月 */ private String dayOrMonth; + /** 金山流量 */ + private String machineFlow; } \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/EpsNodeBandwidth.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/EpsNodeBandwidth.java index 49f7fd4..edc42ad 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/EpsNodeBandwidth.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/EpsNodeBandwidth.java @@ -71,6 +71,8 @@ public class EpsNodeBandwidth extends BaseEntity /** 有效-月均95值 */ @Excel(name = "有效-月均95值") private BigDecimal effectiveAvgMonthlyBandwidth95; + /** 金山流量Mbps/日 */ + private BigDecimal machineFlow; /** 设备业务客户id */ @Excel(name = "设备业务客户id") diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/RmRegistrationMachine.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/RmRegistrationMachine.java new file mode 100644 index 0000000..dc7b13b --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/RmRegistrationMachine.java @@ -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(); + } +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/RmSwitchInterfaceInfo.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/RmSwitchInterfaceInfo.java new file mode 100644 index 0000000..ca64448 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/RmSwitchInterfaceInfo.java @@ -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(); + } +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/RmSwitchManagement.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/RmSwitchManagement.java new file mode 100644 index 0000000..e66f5e3 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/RmSwitchManagement.java @@ -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(); + } +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/EpsInitialTrafficDataMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/EpsInitialTrafficDataMapper.java index a04166f..1e81774 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/EpsInitialTrafficDataMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/EpsInitialTrafficDataMapper.java @@ -41,4 +41,10 @@ public interface EpsInitialTrafficDataMapper { */ List getAllTraficMsg(EpsInitialTrafficData condition); + /** + * 保存金山流量信息 + * @param epsInitialTrafficData + * @return + */ + int updateMachineTraffic(EpsInitialTrafficData epsInitialTrafficData); } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/RmRegistrationMachineMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/RmRegistrationMachineMapper.java new file mode 100644 index 0000000..a166d54 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/RmRegistrationMachineMapper.java @@ -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 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); +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/RmSwitchInterfaceInfoMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/RmSwitchInterfaceInfoMapper.java new file mode 100644 index 0000000..8242b43 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/RmSwitchInterfaceInfoMapper.java @@ -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 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); +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/RmSwitchManagementMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/RmSwitchManagementMapper.java new file mode 100644 index 0000000..1ad088a --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/RmSwitchManagementMapper.java @@ -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 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); +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/EpsInitialTrafficDataService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/EpsInitialTrafficDataService.java index 63d56fd..73f5f3e 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/EpsInitialTrafficDataService.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/EpsInitialTrafficDataService.java @@ -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); } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/IRmRegistrationMachineService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/IRmRegistrationMachineService.java new file mode 100644 index 0000000..8d915f0 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/IRmRegistrationMachineService.java @@ -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 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); +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/IRmSwitchInterfaceInfoService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/IRmSwitchInterfaceInfoService.java new file mode 100644 index 0000000..0f1e4c6 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/IRmSwitchInterfaceInfoService.java @@ -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 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); +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/IRmSwitchManagementService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/IRmSwitchManagementService.java new file mode 100644 index 0000000..b316bcd --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/IRmSwitchManagementService.java @@ -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 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); +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/EpsInitialTrafficDataServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/EpsInitialTrafficDataServiceImpl.java index 263f2fb..e01db7c 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/EpsInitialTrafficDataServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/EpsInitialTrafficDataServiceImpl.java @@ -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 snList = allInterfaceNameMapper.getAllDeviceSn(new AllInterfaceName()); + // 遍历处理每个设备 + snList.forEach(interfaceName -> { + queryParam.setServiceSn(interfaceName.getDeviceSn()); + queryParam.setStartTime(dailyStartTime); + queryParam.setEndTime(dailyEndTime); + List dataList = query(queryParam); + + if (!dataList.isEmpty()) { + // 1. 提取并转换带宽值 + List 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()); } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/RmRegistrationMachineServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/RmRegistrationMachineServiceImpl.java new file mode 100644 index 0000000..f7a323a --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/RmRegistrationMachineServiceImpl.java @@ -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 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); + } +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/RmSwitchInterfaceInfoServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/RmSwitchInterfaceInfoServiceImpl.java new file mode 100644 index 0000000..fd79971 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/RmSwitchInterfaceInfoServiceImpl.java @@ -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 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); + } +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/RmSwitchManagementServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/RmSwitchManagementServiceImpl.java new file mode 100644 index 0000000..555a9b2 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/RmSwitchManagementServiceImpl.java @@ -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 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); + } +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/util/HmacUtils.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/util/HmacUtils.java index bf80e8f..29df934 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/util/HmacUtils.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/util/HmacUtils.java @@ -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 entity = new HttpEntity<>(headers); - - // GET 请求 - ResponseEntity 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 entity = new HttpEntity<>(headers); +// +// // GET 请求 +// ResponseEntity 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(); +// } +// } +//} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/util/TableRouterUtil.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/util/TableRouterUtil.java index 1636e06..41af916 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/util/TableRouterUtil.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/util/TableRouterUtil.java @@ -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("时间字符串不能为空"); } diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/EpsInitialTrafficDataMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/EpsInitialTrafficDataMapper.xml index d1c33b8..fbca1fc 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/EpsInitialTrafficDataMapper.xml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/EpsInitialTrafficDataMapper.xml @@ -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" ORDER BY create_time desc + + update ${tableName} set machine_flow=#{machineFlow} where client_id=#{clientId} and create_time=#{createTime} + \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/EpsNodeBandwidthMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/EpsNodeBandwidthMapper.xml index 4146927..1fb57dd 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/EpsNodeBandwidthMapper.xml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/EpsNodeBandwidthMapper.xml @@ -15,6 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -37,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - 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 + + + and client_id = #{clientId} + and machine_code = #{machineCode} + + + + + + + insert into rm_registration_machine + + client_id, + machine_code, + create_time, + update_time, + create_by, + update_by, + + + #{clientId}, + #{machineCode}, + #{createTime}, + #{updateTime}, + #{createBy}, + #{updateBy}, + + + + + update rm_registration_machine + + client_id = #{clientId}, + machine_code = #{machineCode}, + create_time = #{createTime}, + update_time = #{updateTime}, + create_by = #{createBy}, + update_by = #{updateBy}, + + where id = #{id} + + + + delete from rm_registration_machine where id = #{id} + + + + delete from rm_registration_machine where id in + + #{id} + + + \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/RmSwitchInterfaceInfoMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/RmSwitchInterfaceInfoMapper.xml new file mode 100644 index 0000000..b24afed --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/RmSwitchInterfaceInfoMapper.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + select id, hardware_sn, switch_name, interface_name, interface_remark, create_time, update_time, create_by, update_by from rm_switch_interface_info + + + + + + + + insert into rm_switch_interface_info + + hardware_sn, + switch_name, + interface_name, + interface_remark, + create_time, + update_time, + create_by, + update_by, + + + #{hardwareSn}, + #{switchName}, + #{interfaceName}, + #{interfaceRemark}, + #{createTime}, + #{updateTime}, + #{createBy}, + #{updateBy}, + + + + + update rm_switch_interface_info + + hardware_sn = #{hardwareSn}, + switch_name = #{switchName}, + interface_name = #{interfaceName}, + interface_remark = #{interfaceRemark}, + create_time = #{createTime}, + update_time = #{updateTime}, + create_by = #{createBy}, + update_by = #{updateBy}, + + where id = #{id} + + + + delete from rm_switch_interface_info where id = #{id} + + + + delete from rm_switch_interface_info where id in + + #{id} + + + \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/RmSwitchManagementMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/RmSwitchManagementMapper.xml new file mode 100644 index 0000000..d047e3e --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/RmSwitchManagementMapper.xml @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + insert into rm_switch_management + + 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, + + + #{switchName}, + #{hardwareSn}, + #{snmpAddress}, + #{snmpPort}, + #{onlineStatus}, + #{heartbeatCount}, + #{heartbeatInterval}, + #{heartbeatOid}, + #{snmpVersion}, + #{readWritePermission}, + #{securityLevel}, + #{encryptionMethod}, + #{communityName}, + #{switchPassword}, + #{createTime}, + #{updateTime}, + #{createBy}, + #{updateBy}, + + + + + update rm_switch_management + + switch_name = #{switchName}, + hardware_sn = #{hardwareSn}, + snmp_address = #{snmpAddress}, + snmp_port = #{snmpPort}, + online_status = #{onlineStatus}, + heartbeat_count = #{heartbeatCount}, + heartbeat_interval = #{heartbeatInterval}, + heartbeat_oid = #{heartbeatOid}, + snmp_version = #{snmpVersion}, + read_write_permission = #{readWritePermission}, + security_level = #{securityLevel}, + encryption_method = #{encryptionMethod}, + community_name = #{communityName}, + switch_password = #{switchPassword}, + create_time = #{createTime}, + update_time = #{updateTime}, + create_by = #{createBy}, + update_by = #{updateBy}, + + where id = #{id} + + + + delete from rm_switch_management where id = #{id} + + + + delete from rm_switch_management where id in + + #{id} + + + \ No newline at end of file diff --git a/ruoyi-rocketmq/src/main/java/com/ruoyi/rocketmq/domain/RmMonitorPolicy.java b/ruoyi-rocketmq/src/main/java/com/ruoyi/rocketmq/domain/RmMonitorPolicy.java index 84a99f3..eee4459 100644 --- a/ruoyi-rocketmq/src/main/java/com/ruoyi/rocketmq/domain/RmMonitorPolicy.java +++ b/ruoyi-rocketmq/src/main/java/com/ruoyi/rocketmq/domain/RmMonitorPolicy.java @@ -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; } diff --git a/ruoyi-rocketmq/src/main/resources/mapper/rocketmq/RmMonitorPolicyMapper.xml b/ruoyi-rocketmq/src/main/resources/mapper/rocketmq/RmMonitorPolicyMapper.xml index f69772e..3d8a934 100644 --- a/ruoyi-rocketmq/src/main/resources/mapper/rocketmq/RmMonitorPolicyMapper.xml +++ b/ruoyi-rocketmq/src/main/resources/mapper/rocketmq/RmMonitorPolicyMapper.xml @@ -16,10 +16,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + - 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