优化实时95值计算功能、服务器收益功能、用户自定义列展示
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.system.domain.EpsInitialTrafficData;
|
||||
import com.ruoyi.system.service.EpsInitialTrafficDataService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -10,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* EPS初始流量数据控制器
|
||||
@@ -53,4 +56,25 @@ public class EpsInitialTrafficDataController {
|
||||
List<EpsInitialTrafficData> result = epsInitialTrafficDataService.query(queryParam);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 图形分析 - 95值/日
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:bandwidth:list")
|
||||
@PostMapping("/getServerGraphicalAnalysisDaily")
|
||||
public AjaxResult getServerGraphicalAnalysisDaily(@RequestBody EpsInitialTrafficData queryParam){
|
||||
List<Map<String, Object>> echartsData = epsInitialTrafficDataService.getServerGraphicalAnalysisDaily(queryParam);
|
||||
return AjaxResult.success(echartsData);
|
||||
}
|
||||
/**
|
||||
* 图形分析 - 95值/日
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:bandwidth:list")
|
||||
@PostMapping("/getServerGraphicalAnalysisMonthy")
|
||||
public AjaxResult getServerGraphicalAnalysisMonthy(@RequestBody EpsInitialTrafficData queryParam){
|
||||
List<Map<String, Object>> echartsData = epsInitialTrafficDataService.getServerGraphicalAnalysisMonthy(queryParam);
|
||||
return AjaxResult.success(echartsData);
|
||||
}
|
||||
}
|
||||
@@ -216,12 +216,23 @@ public class RmResourceRegistrationController extends BaseController
|
||||
* 查询所有逻辑标识节点
|
||||
* @return 资源注册集合
|
||||
*/
|
||||
@RequiresPermissions("system:group:list")
|
||||
@RequiresPermissions("system:registration:list")
|
||||
@GetMapping("/getAllLogicalNodeId")
|
||||
public List<Map> getAllLogicalNodeId()
|
||||
{
|
||||
List<Map> list = rmResourceRegistrationService.getAllLogicalNodeId();
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 绑定业务名称
|
||||
* @return 资源注册集合
|
||||
*/
|
||||
@RequiresPermissions("system:registration:list")
|
||||
@PostMapping("/bindBusinessByClientIds")
|
||||
public AjaxResult bindBusinessByClientIds(@RequestBody RmResourceRegistration rmResourceRegistration)
|
||||
{
|
||||
int rows = rmResourceRegistrationService.bindBusinessByClientIds(rmResourceRegistration);
|
||||
return toAjax(rows);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -122,4 +122,14 @@ public class RmSwitchManagementController extends BaseController
|
||||
List<RmSwitchManagement> list = rmSwitchManagementService.selectRmSwitchManagementList(rmSwitchManagement);
|
||||
return R.ok(list);
|
||||
}
|
||||
/**
|
||||
* 查询交换机信息树形接口
|
||||
*/
|
||||
@RequiresPermissions("system:switchManagement:list")
|
||||
@GetMapping("/getAllSwitchNameTree")
|
||||
public AjaxResult getAllSwitchNameTree()
|
||||
{
|
||||
List<RmSwitchManagement> list = rmSwitchManagementService.getAllSwitchNameTree();
|
||||
return success(list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
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.UserTableColumnConfig;
|
||||
import com.ruoyi.system.service.IUserTableColumnConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 用户自定义列配置Controller
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/columnConfig")
|
||||
public class UserTableColumnConfigController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IUserTableColumnConfigService userTableColumnConfigService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户自定义列配置详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:columnConfig:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(userTableColumnConfigService.selectUserTableColumnConfigById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户自定义列配置
|
||||
*/
|
||||
@RequiresPermissions("system:columnConfig:add")
|
||||
@Log(title = "用户自定义列配置", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody UserTableColumnConfig userTableColumnConfig)
|
||||
{
|
||||
return toAjax(userTableColumnConfigService.insertUserTableColumnConfig(userTableColumnConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户自定义列配置
|
||||
*/
|
||||
@RequiresPermissions("system:columnConfig:edit")
|
||||
@Log(title = "用户自定义列配置", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody UserTableColumnConfig userTableColumnConfig)
|
||||
{
|
||||
return toAjax(userTableColumnConfigService.updateUserTableColumnConfig(userTableColumnConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户自定义列配置
|
||||
*/
|
||||
@RequiresPermissions("system:columnConfig:remove")
|
||||
@Log(title = "用户自定义列配置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(userTableColumnConfigService.deleteUserTableColumnConfigByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -73,5 +73,11 @@ public class AllInterfaceName extends BaseEntity
|
||||
/** 服务器ip */
|
||||
@Excel(name = "服务器ip")
|
||||
private String serverIp;
|
||||
/** 交换机接口别名 */
|
||||
private String otherName;
|
||||
/** 前端需要 id 别名 */
|
||||
private Long value;
|
||||
/** 前端需要 name 别名 */
|
||||
private String label;
|
||||
|
||||
}
|
||||
|
||||
@@ -69,4 +69,6 @@ public class EpsBusinessDeploy extends BaseEntity
|
||||
/** 审核意见 */
|
||||
@Excel(name = "审核意见")
|
||||
private String reviewComment;
|
||||
/** 服务器clientId */
|
||||
private String clientId;
|
||||
}
|
||||
|
||||
@@ -116,6 +116,8 @@ public class EpsInitialTrafficData extends BaseEntity {
|
||||
private String clientIds;
|
||||
/** 是否95值 */
|
||||
private boolean flag95 = false;
|
||||
/** 计算方式 */
|
||||
private String calculationMode;
|
||||
|
||||
|
||||
}
|
||||
@@ -69,5 +69,11 @@ public class EpsTaskStatistics extends BaseEntity
|
||||
private BigDecimal needSpeed;
|
||||
/** 需要修改的值对应的时间 */
|
||||
private String needTime;
|
||||
/** 月均日相关数据时间 */
|
||||
private String avgTime;
|
||||
/** 接口名称s */
|
||||
private String interfaceNames;
|
||||
/** 时间段 */
|
||||
private String timeRange;
|
||||
|
||||
}
|
||||
|
||||
@@ -114,6 +114,8 @@ public class InitialSwitchInfoDetails extends BaseEntity
|
||||
public String calculationMode;
|
||||
/** 包含资源 */
|
||||
public String clientIds;
|
||||
/** 包含资源-接口名称 */
|
||||
public String interfaceNames;
|
||||
/** 是否95值 */
|
||||
private boolean flag95 = false;
|
||||
}
|
||||
|
||||
@@ -146,6 +146,8 @@ public class RmResourceRegistration extends BaseEntity
|
||||
*/
|
||||
@Excel(name = "业务名称")
|
||||
private String businessName;
|
||||
/** 业务代码 */
|
||||
private String businessCode;
|
||||
|
||||
/**
|
||||
* 逻辑节点标识
|
||||
@@ -300,4 +302,6 @@ public class RmResourceRegistration extends BaseEntity
|
||||
@Excel(name = "上机时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date onboardTime;
|
||||
/** 服务器列表 */
|
||||
private String deployDevice;
|
||||
}
|
||||
@@ -87,5 +87,11 @@ public class RmSwitchManagement extends BaseEntity
|
||||
private String clientId;
|
||||
/** 查询条件 */
|
||||
private String queryName;
|
||||
/** 接口信息 */
|
||||
private List<AllInterfaceName> children;
|
||||
/** 前端需要 id 别名 */
|
||||
private Long value;
|
||||
/** 前端需要 name 别名 */
|
||||
private String label;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户自定义列配置对象 user_table_column_config
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-30
|
||||
*/
|
||||
@Data
|
||||
public class UserTableColumnConfig extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/** 页面路由标识(例如:system:user:list, business:order:manage) */
|
||||
@Excel(name = "页面路由标识", readConverterExp = "例=如:system:user:list,,b=usiness:order:manage")
|
||||
private String pageRoute;
|
||||
|
||||
/** 列配置(JSON数组格式) */
|
||||
@Excel(name = "列配置", readConverterExp = "J=SON数组格式")
|
||||
private String columnConfig;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.UserTableColumnConfig;
|
||||
|
||||
/**
|
||||
* 用户自定义列配置Mapper接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-30
|
||||
*/
|
||||
public interface UserTableColumnConfigMapper
|
||||
{
|
||||
/**
|
||||
* 查询用户自定义列配置
|
||||
*
|
||||
* @param id 用户自定义列配置主键
|
||||
* @return 用户自定义列配置
|
||||
*/
|
||||
public UserTableColumnConfig selectUserTableColumnConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 查询用户自定义列配置列表
|
||||
*
|
||||
* @param userTableColumnConfig 用户自定义列配置
|
||||
* @return 用户自定义列配置集合
|
||||
*/
|
||||
public List<UserTableColumnConfig> selectUserTableColumnConfigList(UserTableColumnConfig userTableColumnConfig);
|
||||
|
||||
/**
|
||||
* 新增用户自定义列配置
|
||||
*
|
||||
* @param userTableColumnConfig 用户自定义列配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUserTableColumnConfig(UserTableColumnConfig userTableColumnConfig);
|
||||
|
||||
/**
|
||||
* 修改用户自定义列配置
|
||||
*
|
||||
* @param userTableColumnConfig 用户自定义列配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserTableColumnConfig(UserTableColumnConfig userTableColumnConfig);
|
||||
|
||||
/**
|
||||
* 删除用户自定义列配置
|
||||
*
|
||||
* @param id 用户自定义列配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserTableColumnConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除用户自定义列配置
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserTableColumnConfigByIds(Long[] ids);
|
||||
}
|
||||
@@ -83,4 +83,8 @@ public interface EpsInitialTrafficDataService {
|
||||
BigDecimal sumTrafficByServer();
|
||||
|
||||
int updateMachineTraffic(EpsInitialTrafficData epsInitialTrafficData);
|
||||
|
||||
List<Map<String, Object>> getServerGraphicalAnalysisDaily(EpsInitialTrafficData queryParam);
|
||||
|
||||
List<Map<String, Object>> getServerGraphicalAnalysisMonthy(EpsInitialTrafficData queryParam);
|
||||
}
|
||||
|
||||
@@ -119,4 +119,11 @@ public interface IRmResourceRegistrationService
|
||||
* @return
|
||||
*/
|
||||
List<Map> getAllLogicalNodeId();
|
||||
|
||||
/**
|
||||
* 绑定业务名称
|
||||
* @param rmResourceRegistration
|
||||
* @return
|
||||
*/
|
||||
int bindBusinessByClientIds(RmResourceRegistration rmResourceRegistration);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.RmSwitchManagement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 交换机管理Service接口
|
||||
*
|
||||
@@ -58,4 +59,11 @@ public interface IRmSwitchManagementService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRmSwitchManagementById(Long id);
|
||||
|
||||
/**
|
||||
* 交换机信息树形结构
|
||||
* @param rmSwitchManagement
|
||||
* @return
|
||||
*/
|
||||
List<RmSwitchManagement> getAllSwitchNameTree();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.UserTableColumnConfig;
|
||||
|
||||
/**
|
||||
* 用户自定义列配置Service接口
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-30
|
||||
*/
|
||||
public interface IUserTableColumnConfigService
|
||||
{
|
||||
/**
|
||||
* 查询用户自定义列配置
|
||||
*
|
||||
* @param id 用户自定义列配置主键
|
||||
* @return 用户自定义列配置
|
||||
*/
|
||||
public UserTableColumnConfig selectUserTableColumnConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 查询用户自定义列配置列表
|
||||
*
|
||||
* @param userTableColumnConfig 用户自定义列配置
|
||||
* @return 用户自定义列配置集合
|
||||
*/
|
||||
public List<UserTableColumnConfig> selectUserTableColumnConfigList(UserTableColumnConfig userTableColumnConfig);
|
||||
|
||||
/**
|
||||
* 新增用户自定义列配置
|
||||
*
|
||||
* @param userTableColumnConfig 用户自定义列配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUserTableColumnConfig(UserTableColumnConfig userTableColumnConfig);
|
||||
|
||||
/**
|
||||
* 修改用户自定义列配置
|
||||
*
|
||||
* @param userTableColumnConfig 用户自定义列配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserTableColumnConfig(UserTableColumnConfig userTableColumnConfig);
|
||||
|
||||
/**
|
||||
* 批量删除用户自定义列配置
|
||||
*
|
||||
* @param ids 需要删除的用户自定义列配置主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserTableColumnConfigByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除用户自定义列配置信息
|
||||
*
|
||||
* @param id 用户自定义列配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserTableColumnConfigById(Long id);
|
||||
}
|
||||
@@ -169,6 +169,7 @@ public class EpsBusinessDeployServiceImpl implements IEpsBusinessDeployService
|
||||
// 添加服务器脚本执行策略
|
||||
RmDeployScriptRemote addData = new RmDeployScriptRemote();
|
||||
addData.setDeployDevice(clientIdStr);
|
||||
addData.setExecutionMethod(0);
|
||||
addData.setPolicyStatus("0");
|
||||
addData.setTaskName(businessMsg.getTaskName());
|
||||
addData.setScriptName(businessMsg.getScriptName());
|
||||
@@ -201,6 +202,7 @@ public class EpsBusinessDeployServiceImpl implements IEpsBusinessDeployService
|
||||
changeRecord.setCreatBy(SecurityUtils.getUsername());
|
||||
// 修改内容
|
||||
String content = "流量网口设置为" + interfaceName + ",业务为" + businessName;
|
||||
changeRecord.setChangeContent(content);
|
||||
// 保存数据
|
||||
epsMethodChangeRecordMapper.insertEpsMethodChangeRecord(changeRecord);
|
||||
// 绑定业务名称
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.utils.EchartsDataUtils;
|
||||
import com.ruoyi.common.core.utils.SpeedUtils;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.enums.ReviewEnum;
|
||||
import com.ruoyi.system.mapper.*;
|
||||
import com.ruoyi.system.service.EpsInitialTrafficDataService;
|
||||
import com.ruoyi.system.util.CalculateUtil;
|
||||
@@ -19,10 +22,12 @@ import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.YearMonth;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@@ -39,6 +44,8 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
private EpsServerRevenueConfigMapper epsServerRevenueConfigMapper;
|
||||
@Autowired
|
||||
private EpsMethodChangeRecordMapper epsMethodChangeRecordMapper;
|
||||
@Autowired
|
||||
private EpsBusinessDeployMapper epsBusinessDeployMapper;
|
||||
@Override
|
||||
public void createNextMonthTables() {
|
||||
LocalDate nextMonth = LocalDate.now().plusMonths(1);
|
||||
@@ -184,6 +191,7 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
.flatMap(tableName -> {
|
||||
EpsInitialTrafficData condition = new EpsInitialTrafficData();
|
||||
condition.setTableName(tableName);
|
||||
condition.setClientId(queryParam.getClientId());
|
||||
condition.setServiceSn(queryParam.getServiceSn());
|
||||
condition.setStartTime(queryParam.getStartTime());
|
||||
condition.setEndTime(queryParam.getEndTime());
|
||||
@@ -416,6 +424,178 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
return rows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getServerGraphicalAnalysisDaily(EpsInitialTrafficData queryParam) {
|
||||
|
||||
// 拿到时间范围
|
||||
String startTime = queryParam.getStartTime();
|
||||
String endTime = queryParam.getEndTime();
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
|
||||
// 2. 解析日期范围
|
||||
LocalDate startDate = LocalDate.parse(startTime);
|
||||
LocalDate endDate = LocalDate.parse(endTime);
|
||||
|
||||
// 3. 循环处理每一天
|
||||
for (LocalDate date = startDate; !date.isAfter(endDate); date = date.plusDays(1)) {
|
||||
// 构造当天的开始和结束时间(精确到秒)
|
||||
String dayStart = date.atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
String dayEnd = date.atTime(23, 59, 59).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
|
||||
// 创建当天的查询条件
|
||||
EpsInitialTrafficData dailyQuery = new EpsInitialTrafficData();
|
||||
BeanUtils.copyProperties(queryParam, dailyQuery); // 复制原有属性
|
||||
dailyQuery.setStartTime(dayStart);
|
||||
dailyQuery.setEndTime(dayEnd);
|
||||
|
||||
// 根据clientId查询已经配置的接口
|
||||
String clientIds = queryParam.getClientIds();
|
||||
String[] clientIdArr = clientIds.split(",");
|
||||
if(clientIdArr != null){
|
||||
for (String clientId : clientIdArr) {
|
||||
try {
|
||||
dailyQuery.setClientIds(clientId);
|
||||
Map<String, Object> resultMap = serverNetSpeedEcharts(dailyQuery);
|
||||
// 查询95值
|
||||
EpsNodeBandwidth bandwidthQuery = new EpsNodeBandwidth();
|
||||
bandwidthQuery.setBandwidthType("1");
|
||||
bandwidthQuery.setCreateTime(DateUtils.parseDate(date));
|
||||
bandwidthQuery.setCalculationMode(queryParam.getCalculationMode());
|
||||
bandwidthQuery.setClientId(clientId);
|
||||
List<EpsNodeBandwidth> epsNodeBandwidthList = epsNodeBandwidthMapper.selectEpsNodeBandwidthList(bandwidthQuery);
|
||||
|
||||
if(!epsNodeBandwidthList.isEmpty()){
|
||||
EpsNodeBandwidth nodeBandwidth = epsNodeBandwidthList.get(0);
|
||||
resultMap.put("95value", nodeBandwidth.getBandwidthResult());
|
||||
}
|
||||
// 查询业务信息
|
||||
String businessName = null;
|
||||
EpsBusinessDeploy businessQuery = new EpsBusinessDeploy();
|
||||
businessQuery.setClientId(clientId);
|
||||
businessQuery.setReviewStatus(ReviewEnum.通过.getCode());
|
||||
List<EpsBusinessDeploy> businessDeploys = epsBusinessDeployMapper.selectEpsBusinessDeployList(businessQuery);
|
||||
|
||||
if(!businessDeploys.isEmpty()){
|
||||
businessName = businessDeploys.get(0).getBusinessName();
|
||||
}
|
||||
|
||||
StringJoiner joiner = new StringJoiner("");
|
||||
if (clientId != null) {
|
||||
joiner.add("【" + clientId + "】");
|
||||
}
|
||||
if (businessName != null) {
|
||||
joiner.add("【" + businessName + "】");
|
||||
}
|
||||
String name = joiner.toString();
|
||||
resultMap.put("name", name);
|
||||
resultList.add(resultMap);
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultList.isEmpty() ? new ArrayList<>() : resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 图形分析-95带宽值/月
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getServerGraphicalAnalysisMonthy(EpsInitialTrafficData queryParam) {
|
||||
// 拿到时间范围
|
||||
String startTime = queryParam.getStartTime();
|
||||
String endTime = queryParam.getEndTime();
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
// 2. 解析月份范围
|
||||
YearMonth start = YearMonth.parse(startTime);
|
||||
YearMonth end = YearMonth.parse(endTime);
|
||||
// 3. 循环处理每个月
|
||||
for (YearMonth month = start; !month.isAfter(end); month = month.plusMonths(1)) {
|
||||
// 获取当月的第一天和最后一天(精确到秒)
|
||||
String monthStart = month.atDay(1).atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
String monthEnd = month.atEndOfMonth().atTime(23, 59, 59)
|
||||
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
// 创建当天的查询条件
|
||||
EpsInitialTrafficData dailyQuery = new EpsInitialTrafficData();
|
||||
BeanUtils.copyProperties(queryParam, dailyQuery); // 复制原有属性
|
||||
dailyQuery.setStartTime(monthStart);
|
||||
dailyQuery.setEndTime(monthEnd);
|
||||
// 根据clientId查询已经配置的接口
|
||||
String clientIds = queryParam.getClientIds();
|
||||
String[] clientIdArr = clientIds.split(",");
|
||||
if(clientIdArr != null){
|
||||
for (String clientId : clientIdArr) {
|
||||
try {
|
||||
dailyQuery.setClientIds(clientId);
|
||||
Map<String, Object> resultMap = serverNetSpeedEcharts(dailyQuery);
|
||||
// 查询95值
|
||||
EpsNodeBandwidth bandwidthQuery = new EpsNodeBandwidth();
|
||||
bandwidthQuery.setBandwidthType("1");
|
||||
bandwidthQuery.setCreateTime(DateUtils.parseDate(monthStart));
|
||||
bandwidthQuery.setCalculationMode(queryParam.getCalculationMode());
|
||||
bandwidthQuery.setClientId(clientId);
|
||||
List<EpsNodeBandwidth> epsNodeBandwidthList = epsNodeBandwidthMapper.selectEpsNodeBandwidthList(bandwidthQuery);
|
||||
|
||||
if(!epsNodeBandwidthList.isEmpty()){
|
||||
EpsNodeBandwidth nodeBandwidth = epsNodeBandwidthList.get(0);
|
||||
resultMap.put("95value", nodeBandwidth.getBandwidthResult());
|
||||
}
|
||||
// 查询业务信息
|
||||
String businessName = null;
|
||||
EpsBusinessDeploy businessQuery = new EpsBusinessDeploy();
|
||||
businessQuery.setClientId(clientId);
|
||||
businessQuery.setReviewStatus(ReviewEnum.通过.getCode());
|
||||
List<EpsBusinessDeploy> businessDeploys = epsBusinessDeployMapper.selectEpsBusinessDeployList(businessQuery);
|
||||
|
||||
if(!businessDeploys.isEmpty()){
|
||||
businessName = businessDeploys.get(0).getBusinessName();
|
||||
}
|
||||
|
||||
StringJoiner joiner = new StringJoiner("");
|
||||
if (clientId != null) {
|
||||
joiner.add("【" + clientId + "】");
|
||||
}
|
||||
if (businessName != null) {
|
||||
joiner.add("【" + businessName + "】");
|
||||
}
|
||||
String name = joiner.toString();
|
||||
resultMap.put("name", name);
|
||||
resultList.add(resultMap);
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultList.isEmpty() ? new ArrayList<>() : resultList;
|
||||
}
|
||||
/**
|
||||
* 获取服务器网口网络速率
|
||||
* @param epsInitialTrafficData
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> serverNetSpeedEcharts(EpsInitialTrafficData epsInitialTrafficData) {
|
||||
List<EpsInitialTrafficData> list = getTrafficListByClientIds(epsInitialTrafficData);
|
||||
try {
|
||||
SpeedUtils.SpeedResult result = SpeedUtils.calculateWithStringTraffic(list, "inSpeed", "outSpeed");
|
||||
BigDecimal divisor = SpeedUtils.getDivisor(result.getRecommendedUnit());
|
||||
Map<String, Function<EpsInitialTrafficData, ?>> extractors = new LinkedHashMap<>();
|
||||
|
||||
extractors.put("netOutSpeedData", info ->
|
||||
info != null && info.getOutSpeed() != null ?
|
||||
new BigDecimal(info.getOutSpeed()).divide(divisor, 0, RoundingMode.HALF_UP) :
|
||||
0);
|
||||
Map<String, Object> resultMap = EchartsDataUtils.buildEchartsData(list, EpsInitialTrafficData::getCreateTime, extractors);
|
||||
resultMap.put("other", result);
|
||||
return resultMap;
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new HashMap<>();
|
||||
}
|
||||
/**
|
||||
* 提取公共方法
|
||||
* @return
|
||||
|
||||
@@ -16,12 +16,15 @@ import com.ruoyi.system.service.EpsInitialTrafficDataService;
|
||||
import com.ruoyi.system.service.IEpsTaskStatisticsService;
|
||||
import com.ruoyi.system.service.IInitialSwitchInfoDetailsService;
|
||||
import com.ruoyi.system.util.CalculateUtil;
|
||||
import com.ruoyi.system.util.DateUtil;
|
||||
import com.ruoyi.system.util.PaginationUtil;
|
||||
import com.ruoyi.system.util.TrafficRedisHashUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.YearMonth;
|
||||
import java.util.*;
|
||||
@@ -71,7 +74,19 @@ public class EpsTaskStatisticsServiceImpl implements IEpsTaskStatisticsService
|
||||
@Override
|
||||
public List<EpsTaskStatistics> selectEpsTaskStatisticsList(EpsTaskStatistics epsTaskStatistics)
|
||||
{
|
||||
return epsTaskStatisticsMapper.selectEpsTaskStatisticsList(epsTaskStatistics);
|
||||
List<EpsTaskStatistics> epsTaskStatisticsList = epsTaskStatisticsMapper.selectEpsTaskStatisticsList(epsTaskStatistics);
|
||||
for (EpsTaskStatistics taskStatistics : epsTaskStatisticsList) {
|
||||
String startTime = taskStatistics.getStartTime();
|
||||
String endTime = taskStatistics.getEndTime();
|
||||
String timeRange = "";
|
||||
if(endTime == null){
|
||||
timeRange = startTime;
|
||||
}else{
|
||||
timeRange = startTime + "~" + endTime;
|
||||
}
|
||||
taskStatistics.setTimeRange(timeRange);
|
||||
}
|
||||
return epsTaskStatisticsList;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,11 +111,29 @@ public class EpsTaskStatisticsServiceImpl implements IEpsTaskStatisticsService
|
||||
List<EpsInitialTrafficData> dataList = epsInitialTrafficDataService.getTrafficListByClientIds(queryParam);
|
||||
if(!dataList.isEmpty()){
|
||||
// 存储数据到redis缓存
|
||||
trafficRedisHashUtil.addItemToHash(epsTaskStatistics.getId().toString(), dataList);
|
||||
trafficRedisHashUtil.saveListToHash(epsTaskStatistics.getId().toString(), dataList);
|
||||
// 计算95数据
|
||||
processServer95Data(dataList, epsTaskStatistics);
|
||||
}else{
|
||||
EpsTaskStatistics updataData = new EpsTaskStatistics();
|
||||
updataData.setId(epsTaskStatistics.getId());
|
||||
updataData.setTaskStatus("2");
|
||||
updataData.setPercentile95(BigDecimal.ZERO);
|
||||
epsTaskStatisticsMapper.updateEpsTaskStatistics(updataData);
|
||||
}
|
||||
}else{
|
||||
// 查询当月的流量 存到redis缓存
|
||||
// 处理时间
|
||||
DateUtil.TimeRange timeRange = DateUtil.getTimeRange(DateUtils.parseDate(epsTaskStatistics.getStartTime()), "2");
|
||||
EpsInitialTrafficData queryParam = new EpsInitialTrafficData();
|
||||
queryParam.setStartTime(timeRange.getStart());
|
||||
queryParam.setEndTime(timeRange.getEnd());
|
||||
queryParam.setBusinessId(epsTaskStatistics.getBusinessCode());
|
||||
queryParam.setClientIds(epsTaskStatistics.getIncludedResources());
|
||||
List<EpsInitialTrafficData> dataList = epsInitialTrafficDataService.getTrafficListByClientIds(queryParam);
|
||||
if(!dataList.isEmpty()){
|
||||
trafficRedisHashUtil.saveListToHash(epsTaskStatistics.getId().toString(), dataList);
|
||||
}
|
||||
processAvg95Data(epsTaskStatistics);
|
||||
}
|
||||
}else{
|
||||
@@ -110,13 +143,36 @@ public class EpsTaskStatisticsServiceImpl implements IEpsTaskStatisticsService
|
||||
queryParam.setEndTime(epsTaskStatistics.getEndTime());
|
||||
queryParam.setBusinessCode(epsTaskStatistics.getBusinessCode());
|
||||
queryParam.setClientIds(epsTaskStatistics.getIncludedResources());
|
||||
queryParam.setInterfaceNames(epsTaskStatistics.getInterfaceNames());
|
||||
List<InitialSwitchInfoDetails> dataList = initialSwitchInfoDetailsMapper
|
||||
.sumSwitchTrafficByclientIds(queryParam);
|
||||
if(!dataList.isEmpty()){
|
||||
trafficRedisHashUtil.addItemToHash(epsTaskStatistics.getId().toString(), dataList);
|
||||
trafficRedisHashUtil.saveListToHash(epsTaskStatistics.getId().toString(), dataList);
|
||||
processSwitch95Data(dataList, epsTaskStatistics);
|
||||
}else{
|
||||
// 保存计算结果
|
||||
EpsTaskStatistics updateData = new EpsTaskStatistics();
|
||||
updateData.setId(epsTaskStatistics.getId());
|
||||
updateData.setTaskStatus("2");
|
||||
updateData.setPercentile95(BigDecimal.ZERO);
|
||||
updateData.setUpdateTime(DateUtils.getNowDate());
|
||||
epsTaskStatisticsMapper.updateEpsTaskStatistics(updateData);
|
||||
}
|
||||
}else{
|
||||
// 查询当月的流量 存到redis缓存
|
||||
// 处理时间
|
||||
DateUtil.TimeRange timeRange = DateUtil.getTimeRange(DateUtils.parseDate(epsTaskStatistics.getStartTime()), "2");
|
||||
InitialSwitchInfoDetails queryParam = new InitialSwitchInfoDetails();
|
||||
queryParam.setStartTime(timeRange.getStart());
|
||||
queryParam.setEndTime(timeRange.getEnd());
|
||||
queryParam.setBusinessCode(epsTaskStatistics.getBusinessCode());
|
||||
queryParam.setClientIds(epsTaskStatistics.getIncludedResources());
|
||||
queryParam.setInterfaceNames(epsTaskStatistics.getInterfaceNames());
|
||||
List<InitialSwitchInfoDetails> dataList = initialSwitchInfoDetailsMapper
|
||||
.sumSwitchTrafficByclientIds(queryParam);
|
||||
if(!dataList.isEmpty()){
|
||||
trafficRedisHashUtil.saveListToHash(epsTaskStatistics.getId().toString(), dataList);
|
||||
}
|
||||
processAvg95Data(epsTaskStatistics);
|
||||
}
|
||||
}
|
||||
@@ -203,6 +259,13 @@ public class EpsTaskStatisticsServiceImpl implements IEpsTaskStatisticsService
|
||||
updateData.setMonthlyAvgPercentile95(avgMonthly);
|
||||
updateData.setUpdateTime(DateUtils.getNowDate());
|
||||
epsTaskStatisticsMapper.updateEpsTaskStatistics(updateData);
|
||||
}else{
|
||||
EpsTaskStatistics updataData = new EpsTaskStatistics();
|
||||
updataData.setId(epsTaskStatistics.getId());
|
||||
updataData.setTaskStatus("2");
|
||||
updataData.setMonthlyAvgPercentile95(BigDecimal.ZERO);
|
||||
updataData.setUpdateTime(DateUtils.getNowDate());
|
||||
epsTaskStatisticsMapper.updateEpsTaskStatistics(updataData);
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -252,40 +315,78 @@ public class EpsTaskStatisticsServiceImpl implements IEpsTaskStatisticsService
|
||||
EpsTaskStatistics taskMsg = epsTaskStatisticsMapper.selectEpsTaskStatisticsById(taskId);
|
||||
if(StringUtils.equals("1", taskMsg.getResourceType())){
|
||||
List<EpsInitialTrafficData> list = trafficRedisHashUtil.getListFromHash(taskId.toString(), EpsInitialTrafficData.class);
|
||||
int index = CalculateUtil.calculate95Index(list, 0.05);
|
||||
list.get(index).setFlag95(true);
|
||||
List<EpsInitialTrafficData> pageList = list.stream()
|
||||
.skip((long) (pageNum - 1) * pageSize)
|
||||
.limit(pageSize)
|
||||
.collect(Collectors.toList());
|
||||
for (EpsInitialTrafficData epsInitialTrafficData : pageList) {
|
||||
epsInitialTrafficData.setBusinessId(taskMsg.getBusinessCode());
|
||||
epsInitialTrafficData.setClientId(taskMsg.getIncludedResources());
|
||||
if(!list.isEmpty()){
|
||||
if(StringUtils.equals("1", taskMsg.getCalculationType())){
|
||||
int index = CalculateUtil.calculate95Index(list, 0.05);
|
||||
list.get(index).setFlag95(true);
|
||||
List<EpsInitialTrafficData> pageList = list.stream()
|
||||
.skip((long) (pageNum - 1) * pageSize)
|
||||
.limit(pageSize)
|
||||
.collect(Collectors.toList());
|
||||
for (EpsInitialTrafficData epsInitialTrafficData : pageList) {
|
||||
epsInitialTrafficData.setBusinessId(taskMsg.getBusinessCode());
|
||||
epsInitialTrafficData.setClientId(taskMsg.getIncludedResources());
|
||||
}
|
||||
PageInfo<EpsInitialTrafficData> pageInfo = new PageInfo<>();
|
||||
pageInfo.setPageNum(pageNum);
|
||||
pageInfo.setPageSize(pageSize);
|
||||
pageInfo.setTotal(list.size());
|
||||
pageInfo.setList(pageList);
|
||||
return pageInfo;
|
||||
}else{
|
||||
// 2. 按天分组
|
||||
Map<String, List<EpsInitialTrafficData>> groupedData = list.stream()
|
||||
.collect(Collectors.groupingBy(data -> {
|
||||
// 使用 SimpleDateFormat 格式化日期部分
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
return sdf.format(data.getCreateTime());
|
||||
}));
|
||||
// 获取指定日期的数据
|
||||
List<EpsInitialTrafficData> dailyData = groupedData.getOrDefault(epsTaskStatistics.getAvgTime(), new ArrayList<>());
|
||||
int index = CalculateUtil.calculate95Index(dailyData, 0.05);
|
||||
dailyData.get(index).setFlag95(true);
|
||||
PageInfo<EpsInitialTrafficData> resultData = PaginationUtil.paginate(dailyData, pageNum, pageSize);
|
||||
return resultData;
|
||||
}
|
||||
}
|
||||
PageInfo<EpsInitialTrafficData> pageInfo = new PageInfo<>();
|
||||
pageInfo.setPageNum(pageNum);
|
||||
pageInfo.setPageSize(pageSize);
|
||||
pageInfo.setTotal(list.size());
|
||||
pageInfo.setList(pageList);
|
||||
return pageInfo;
|
||||
}else{
|
||||
List<InitialSwitchInfoDetails> list = trafficRedisHashUtil.getListFromHash(taskId.toString(), InitialSwitchInfoDetails.class);
|
||||
int index = CalculateUtil.calculate95Index(list, 0.05);
|
||||
list.get(index).setFlag95(true);
|
||||
List<InitialSwitchInfoDetails> pageList = list.stream()
|
||||
.skip((long) (pageNum - 1) * pageSize)
|
||||
.limit(pageSize)
|
||||
.collect(Collectors.toList());
|
||||
for (InitialSwitchInfoDetails initialSwitchInfoDetails : pageList) {
|
||||
initialSwitchInfoDetails.setName(taskMsg.getIncludedResources());
|
||||
if(!list.isEmpty()){
|
||||
if(StringUtils.equals("1", taskMsg.getCalculationType())){
|
||||
|
||||
int index = CalculateUtil.calculate95Index(list, 0.05);
|
||||
list.get(index).setFlag95(true);
|
||||
List<InitialSwitchInfoDetails> pageList = list.stream()
|
||||
.skip((long) (pageNum - 1) * pageSize)
|
||||
.limit(pageSize)
|
||||
.collect(Collectors.toList());
|
||||
for (InitialSwitchInfoDetails initialSwitchInfoDetails : pageList) {
|
||||
initialSwitchInfoDetails.setName(taskMsg.getIncludedResources());
|
||||
}
|
||||
PageInfo<InitialSwitchInfoDetails> pageInfo = new PageInfo<>();
|
||||
pageInfo.setPageNum(pageNum);
|
||||
pageInfo.setPageSize(pageSize);
|
||||
pageInfo.setTotal(list.size());
|
||||
pageInfo.setList(pageList);
|
||||
return pageInfo;
|
||||
}else{
|
||||
// 2. 按天分组
|
||||
Map<String, List<InitialSwitchInfoDetails>> groupedData = list.stream()
|
||||
.collect(Collectors.groupingBy(data -> {
|
||||
// 使用 SimpleDateFormat 格式化日期部分
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
return sdf.format(data.getCreateTime());
|
||||
}));
|
||||
// 获取指定日期的数据
|
||||
List<InitialSwitchInfoDetails> dailyData = groupedData.getOrDefault(epsTaskStatistics.getAvgTime(), new ArrayList<>());
|
||||
int index = CalculateUtil.calculate95Index(dailyData, 0.05);
|
||||
dailyData.get(index).setFlag95(true);
|
||||
PageInfo<InitialSwitchInfoDetails> resultData = PaginationUtil.paginate(dailyData, pageNum, pageSize);
|
||||
return resultData;
|
||||
}
|
||||
}
|
||||
PageInfo<InitialSwitchInfoDetails> pageInfo = new PageInfo<>();
|
||||
pageInfo.setPageNum(pageNum);
|
||||
pageInfo.setPageSize(pageSize);
|
||||
pageInfo.setTotal(list.size());
|
||||
pageInfo.setList(pageList);
|
||||
return pageInfo;
|
||||
}
|
||||
return new PageInfo<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -297,22 +398,12 @@ public class EpsTaskStatisticsServiceImpl implements IEpsTaskStatisticsService
|
||||
EpsInitialTrafficData epsInitialTrafficData = new EpsInitialTrafficData();
|
||||
epsInitialTrafficData.setOutSpeed(epsTaskStatistics.getNeedSpeed().toString());
|
||||
epsInitialTrafficData.setCreateTime(DateUtils.parseDate(epsTaskStatistics.getNeedTime()));
|
||||
trafficRedisHashUtil.updateItemInHash(taskId.toString(), epsInitialTrafficData,
|
||||
item -> {
|
||||
Object createTime = trafficRedisHashUtil.getCreateTimeFromObject(item);
|
||||
return createTime != null && createTime.toString().equals(epsTaskStatistics.getNeedTime().toString());
|
||||
}
|
||||
);
|
||||
trafficRedisHashUtil.updateItemInHash(taskId.toString(), epsInitialTrafficData, epsTaskStatistics.getNeedTime());
|
||||
}else{
|
||||
InitialSwitchInfoDetails initialSwitchInfoDetails = new InitialSwitchInfoDetails();
|
||||
initialSwitchInfoDetails.setMaxSpeed(epsTaskStatistics.getNeedSpeed());
|
||||
initialSwitchInfoDetails.setCreateTime(DateUtils.parseDate(epsTaskStatistics.getNeedTime()));
|
||||
trafficRedisHashUtil.updateItemInHash(taskId.toString(), initialSwitchInfoDetails,
|
||||
item -> {
|
||||
Object createTime = trafficRedisHashUtil.getCreateTimeFromObject(item);
|
||||
return createTime != null && createTime.toString().equals(epsTaskStatistics.getNeedTime().toString());
|
||||
}
|
||||
);
|
||||
trafficRedisHashUtil.updateItemInHash(taskId.toString(), initialSwitchInfoDetails, epsTaskStatistics.getNeedTime());
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -330,17 +421,17 @@ public class EpsTaskStatisticsServiceImpl implements IEpsTaskStatisticsService
|
||||
// 开始计算
|
||||
if(StringUtils.equals("1", taskMsg.getResourceType())){
|
||||
List<EpsInitialTrafficData> dataList = trafficRedisHashUtil.getListFromHash(taskId.toString(), EpsInitialTrafficData.class);
|
||||
if(StringUtils.equals(epsTaskStatistics.getCalculationType(), "1")){
|
||||
processServer95Data(dataList, epsTaskStatistics);
|
||||
if(StringUtils.equals(taskMsg.getCalculationType(), "1")){
|
||||
processServer95Data(dataList, taskMsg);
|
||||
}else{
|
||||
processAvg95Data(epsTaskStatistics);
|
||||
processAvg95Data(taskMsg);
|
||||
}
|
||||
}else{
|
||||
List<InitialSwitchInfoDetails> dataList = trafficRedisHashUtil.getListFromHash(taskId.toString(), InitialSwitchInfoDetails.class);
|
||||
if(StringUtils.equals(epsTaskStatistics.getCalculationType(), "1")){
|
||||
processSwitch95Data(dataList, epsTaskStatistics);
|
||||
if(StringUtils.equals(taskMsg.getCalculationType(), "1")){
|
||||
processSwitch95Data(dataList, taskMsg);
|
||||
}else{
|
||||
processAvg95Data(epsTaskStatistics);
|
||||
processAvg95Data(taskMsg);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
@@ -352,51 +443,55 @@ public class EpsTaskStatisticsServiceImpl implements IEpsTaskStatisticsService
|
||||
Long taskId = epsTaskStatistics.getId();
|
||||
EpsTaskStatistics taskMsg = epsTaskStatisticsMapper.selectEpsTaskStatisticsById(taskId);
|
||||
if(StringUtils.equals("1", taskMsg.getResourceType())){
|
||||
if(StringUtils.equals("1", taskMsg.getCalculationType())){
|
||||
List<EpsInitialTrafficData> list = trafficRedisHashUtil.getListFromHash(taskId.toString(), EpsInitialTrafficData.class);
|
||||
if(!list.isEmpty()){
|
||||
try{
|
||||
SpeedUtils.SpeedResult result = SpeedUtils.calculateWithStringTraffic(list, "inSpeed", "outSpeed");
|
||||
BigDecimal divisor = SpeedUtils.getDivisor(result.getRecommendedUnit());
|
||||
Map<String, Function<EpsInitialTrafficData, ?>> extractors = new LinkedHashMap<>();
|
||||
List<EpsInitialTrafficData> list = trafficRedisHashUtil.getListFromHash(taskId.toString(), EpsInitialTrafficData.class);
|
||||
if(!list.isEmpty()){
|
||||
try{
|
||||
SpeedUtils.SpeedResult result = SpeedUtils.calculateWithStringTraffic(list, "inSpeed", "outSpeed");
|
||||
BigDecimal divisor = SpeedUtils.getDivisor(result.getRecommendedUnit());
|
||||
Map<String, Function<EpsInitialTrafficData, ?>> extractors = new LinkedHashMap<>();
|
||||
|
||||
extractors.put("netOutSpeedData", info ->
|
||||
info != null && info.getOutSpeed() != null ?
|
||||
new BigDecimal(info.getOutSpeed()).divide(divisor, 0, RoundingMode.HALF_UP) :
|
||||
0);
|
||||
Map<String, Object> resultMap = EchartsDataUtils.buildEchartsData(list, EpsInitialTrafficData::getCreateTime, extractors);
|
||||
resultMap.put("other", result);
|
||||
extractors.put("netOutSpeedData", info ->
|
||||
info != null && info.getOutSpeed() != null ?
|
||||
new BigDecimal(info.getOutSpeed()).divide(divisor, 0, RoundingMode.HALF_UP) :
|
||||
0);
|
||||
Map<String, Object> resultMap = EchartsDataUtils.buildEchartsData(list, EpsInitialTrafficData::getCreateTime, extractors);
|
||||
resultMap.put("other", result);
|
||||
if(StringUtils.equals("1", taskMsg.getCalculationType())){
|
||||
resultMap.put("percentile95", taskMsg.getPercentile95());
|
||||
return resultMap;
|
||||
}catch (Exception e){
|
||||
System.err.println(e.getMessage());
|
||||
}else{
|
||||
resultMap.put("percentile95", taskMsg.getMonthlyAvgPercentile95());
|
||||
}
|
||||
return resultMap;
|
||||
}catch (Exception e){
|
||||
System.err.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(StringUtils.equals("1", taskMsg.getCalculationType())){
|
||||
List<InitialSwitchInfoDetails> list = trafficRedisHashUtil.getListFromHash(taskId.toString(), InitialSwitchInfoDetails.class);
|
||||
if(!list.isEmpty()){
|
||||
try{
|
||||
SpeedUtils.SpeedResult result = SpeedUtils.calculateWithAverageBasedUnit(list, "inSpeed", "outSpeed");
|
||||
BigDecimal divisor = SpeedUtils.getDivisor(result.getRecommendedUnit());
|
||||
Map<String, Function<InitialSwitchInfoDetails, ?>> extractors = new LinkedHashMap<>();
|
||||
extractors.put("netInSpeedData", info ->
|
||||
info != null && info.getInSpeed() != null ?
|
||||
info.getInSpeed().divide(divisor, 0, RoundingMode.HALF_UP) :
|
||||
0);
|
||||
List<InitialSwitchInfoDetails> list = trafficRedisHashUtil.getListFromHash(taskId.toString(), InitialSwitchInfoDetails.class);
|
||||
if(!list.isEmpty()){
|
||||
try{
|
||||
SpeedUtils.SpeedResult result = SpeedUtils.calculateWithAverageBasedUnit(list, "inSpeed", "outSpeed");
|
||||
BigDecimal divisor = SpeedUtils.getDivisor(result.getRecommendedUnit());
|
||||
Map<String, Function<InitialSwitchInfoDetails, ?>> extractors = new LinkedHashMap<>();
|
||||
extractors.put("netInSpeedData", info ->
|
||||
info != null && info.getInSpeed() != null ?
|
||||
info.getInSpeed().divide(divisor, 0, RoundingMode.HALF_UP) :
|
||||
0);
|
||||
|
||||
extractors.put("netOutSpeedData", info ->
|
||||
info != null && info.getOutSpeed() != null ?
|
||||
info.getOutSpeed().divide(divisor, 0, RoundingMode.HALF_UP) :
|
||||
0);
|
||||
Map<String, Object> resultMap = EchartsDataUtils.buildEchartsData(list, InitialSwitchInfoDetails::getCreateTime, extractors);
|
||||
resultMap.put("other", result);
|
||||
extractors.put("netOutSpeedData", info ->
|
||||
info != null && info.getOutSpeed() != null ?
|
||||
info.getOutSpeed().divide(divisor, 0, RoundingMode.HALF_UP) :
|
||||
0);
|
||||
Map<String, Object> resultMap = EchartsDataUtils.buildEchartsData(list, InitialSwitchInfoDetails::getCreateTime, extractors);
|
||||
resultMap.put("other", result);
|
||||
if(StringUtils.equals("1", taskMsg.getCalculationType())){
|
||||
resultMap.put("percentile95", taskMsg.getPercentile95());
|
||||
return resultMap;
|
||||
}catch (Exception e){
|
||||
System.err.println(e.getMessage());
|
||||
}else{
|
||||
resultMap.put("percentile95", taskMsg.getMonthlyAvgPercentile95());
|
||||
}
|
||||
return resultMap;
|
||||
}catch (Exception e){
|
||||
System.err.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.ruoyi.common.core.utils.EchartsDataUtils;
|
||||
import com.ruoyi.common.core.utils.SpeedUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.enums.ReviewEnum;
|
||||
import com.ruoyi.system.mapper.*;
|
||||
import com.ruoyi.system.service.IInitialSwitchInfoDetailsService;
|
||||
import com.ruoyi.system.util.CalculateUtil;
|
||||
@@ -49,6 +50,10 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
private EpsMethodChangeRecordMapper epsMethodChangeRecordMapper;
|
||||
@Autowired
|
||||
private EpsNodeBandwidthMapper epsNodeBandwidthMapper;
|
||||
@Autowired
|
||||
private RmSwitchInterfaceInfoMapper rmSwitchInterfaceInfoMapper;
|
||||
@Autowired
|
||||
private EpsBusinessDeployMapper epsBusinessDeployMapper;
|
||||
|
||||
/**
|
||||
* 查询交换机监控信息
|
||||
@@ -723,30 +728,69 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
BeanUtils.copyProperties(initialSwitchInfoDetails, dailyQuery); // 复制原有属性
|
||||
dailyQuery.setStartTime(dayStart);
|
||||
dailyQuery.setEndTime(dayEnd);
|
||||
// 根据clientId查询交换机接口名称
|
||||
AllInterfaceName queryParam = new AllInterfaceName();
|
||||
queryParam.setSwitchIp(initialSwitchInfoDetails.getSwitchIp());
|
||||
queryParam.setClientId(initialSwitchInfoDetails.getClientId());
|
||||
List<AllInterfaceName> allInterfaceNames = allInterfaceNameMapper.selectAllInterfaceNameList(queryParam);
|
||||
for (AllInterfaceName allInterfaceName : allInterfaceNames) {
|
||||
try {
|
||||
dailyQuery.setName(allInterfaceName.getInterfaceName());
|
||||
Map<String, Object> resultMap = switchNetSpeedEcharts(dailyQuery);
|
||||
// 查询95值
|
||||
EpsNodeBandwidth query = new EpsNodeBandwidth();
|
||||
query.setBandwidthType("1");
|
||||
query.setCreateTime(DateUtils.parseDate(date));
|
||||
query.setCalculationMode(initialSwitchInfoDetails.getCalculationMode());
|
||||
query.setClientId(initialSwitchInfoDetails.getClientId());
|
||||
query.setInterfaceName(allInterfaceName.getInterfaceName());
|
||||
List<EpsNodeBandwidth> epsNodeBandwidthList = epsNodeBandwidthMapper.selectEpsNodeBandwidthList(query);
|
||||
if(!epsNodeBandwidthList.isEmpty()){
|
||||
EpsNodeBandwidth nodeBandwidth = epsNodeBandwidthList.get(0);
|
||||
resultMap.put("95value", nodeBandwidth.getBandwidthResult());
|
||||
// 根据交换机名称查询clientId
|
||||
String clientIds = initialSwitchInfoDetails.getClientIds();
|
||||
String[] clientIdArr = clientIds.split(",");
|
||||
for (String clientId : clientIdArr) {
|
||||
// 根据clientId查询已经配置的接口
|
||||
RmEpsTopologyManagement queryParam = new RmEpsTopologyManagement();
|
||||
queryParam.setClientId(clientId);
|
||||
List<RmEpsTopologyManagement> rmEpsTopologyManagements = rmEpsTopologyManagementMapper.selectRmEpsTopologyManagementList(queryParam);
|
||||
if(!rmEpsTopologyManagements.isEmpty()){
|
||||
for (RmEpsTopologyManagement rmEpsTopologyManagement : rmEpsTopologyManagements) {
|
||||
try {
|
||||
dailyQuery.setName(rmEpsTopologyManagement.getInterfaceName());
|
||||
Map<String, Object> resultMap = switchNetSpeedEcharts(dailyQuery);
|
||||
// 查询95值
|
||||
EpsNodeBandwidth query = new EpsNodeBandwidth();
|
||||
query.setBandwidthType("1");
|
||||
query.setCreateTime(DateUtils.parseDate(date));
|
||||
query.setCalculationMode(initialSwitchInfoDetails.getCalculationMode());
|
||||
query.setClientId(clientId);
|
||||
query.setInterfaceName(rmEpsTopologyManagement.getInterfaceName());
|
||||
List<EpsNodeBandwidth> epsNodeBandwidthList = epsNodeBandwidthMapper.selectEpsNodeBandwidthList(query);
|
||||
if(!epsNodeBandwidthList.isEmpty()){
|
||||
EpsNodeBandwidth nodeBandwidth = epsNodeBandwidthList.get(0);
|
||||
resultMap.put("95value", nodeBandwidth.getBandwidthResult());
|
||||
}
|
||||
// 查询端口备注信息
|
||||
RmSwitchInterfaceInfo queryOtheName = new RmSwitchInterfaceInfo();
|
||||
queryOtheName.setClientId(clientId);
|
||||
queryOtheName.setInterfaceName(rmEpsTopologyManagement.getInterfaceName());
|
||||
List<RmSwitchInterfaceInfo> interfaceInfos = rmSwitchInterfaceInfoMapper.selectRmSwitchInterfaceInfoList(queryOtheName);
|
||||
String otherName = null;
|
||||
if(!interfaceInfos.isEmpty()){
|
||||
otherName = interfaceInfos.get(0).getInterfaceRemark();
|
||||
}
|
||||
// 查询业务信息
|
||||
String businessName = null;
|
||||
EpsBusinessDeploy queryBD = new EpsBusinessDeploy();
|
||||
queryBD.setClientId(clientId);
|
||||
queryBD.setReviewStatus(ReviewEnum.通过.getCode());
|
||||
List<EpsBusinessDeploy> businessDeploys = epsBusinessDeployMapper.selectEpsBusinessDeployList(queryBD);
|
||||
if(!businessDeploys.isEmpty()){
|
||||
businessName = businessDeploys.get(0).getBusinessName();
|
||||
}
|
||||
StringJoiner joiner = new StringJoiner("");
|
||||
if (rmEpsTopologyManagement.getSwitchName() != null) {
|
||||
joiner.add("【" + rmEpsTopologyManagement.getSwitchName() + "】");
|
||||
}
|
||||
if (rmEpsTopologyManagement.getInterfaceName() != null) {
|
||||
joiner.add("【" + rmEpsTopologyManagement.getInterfaceName() + "】");
|
||||
}
|
||||
if (otherName != null) {
|
||||
joiner.add("【" + otherName + "】");
|
||||
}
|
||||
if (businessName != null) {
|
||||
joiner.add("【" + businessName + "】");
|
||||
}
|
||||
String name = joiner.toString();
|
||||
resultMap.put("name", name);
|
||||
resultList.add(resultMap);
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
resultList.add(resultMap);
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -777,23 +821,70 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
|
||||
InitialSwitchInfoDetails dailyQuery = new InitialSwitchInfoDetails();
|
||||
BeanUtils.copyProperties(initialSwitchInfoDetails, dailyQuery); // 复制原有属性
|
||||
dailyQuery.setStartTime(monthStart);
|
||||
dailyQuery.setEndTime(monthStart);
|
||||
try {
|
||||
Map<String, Object> resultMap = switchNetSpeedEcharts(dailyQuery);
|
||||
// 查询95值
|
||||
EpsNodeBandwidth query = new EpsNodeBandwidth();
|
||||
query.setBandwidthType("1");
|
||||
query.setCreateTime(DateUtils.parseDate(monthStart));
|
||||
query.setCalculationMode(initialSwitchInfoDetails.getCalculationMode());
|
||||
query.setClientId(initialSwitchInfoDetails.getClientId());
|
||||
List<EpsNodeBandwidth> epsNodeBandwidthList = epsNodeBandwidthMapper.selectEpsNodeBandwidthList(query);
|
||||
if(!epsNodeBandwidthList.isEmpty()){
|
||||
EpsNodeBandwidth nodeBandwidth = epsNodeBandwidthList.get(0);
|
||||
resultMap.put("95value", nodeBandwidth.getBandwidthResult());
|
||||
dailyQuery.setEndTime(monthEnd);
|
||||
// 根据交换机名称查询clientId
|
||||
String clientIds = initialSwitchInfoDetails.getClientIds();
|
||||
String[] clientIdArr = clientIds.split(",");
|
||||
for (String clientId : clientIdArr) {
|
||||
// 根据clientId查询已经配置的接口
|
||||
RmEpsTopologyManagement queryParam = new RmEpsTopologyManagement();
|
||||
queryParam.setClientId(clientId);
|
||||
List<RmEpsTopologyManagement> rmEpsTopologyManagements = rmEpsTopologyManagementMapper.selectRmEpsTopologyManagementList(queryParam);
|
||||
if(!rmEpsTopologyManagements.isEmpty()){
|
||||
for (RmEpsTopologyManagement rmEpsTopologyManagement : rmEpsTopologyManagements) {
|
||||
try {
|
||||
dailyQuery.setName(rmEpsTopologyManagement.getInterfaceName());
|
||||
Map<String, Object> resultMap = switchNetSpeedEcharts(dailyQuery);
|
||||
// 查询95值
|
||||
EpsNodeBandwidth query = new EpsNodeBandwidth();
|
||||
query.setBandwidthType("1");
|
||||
query.setCreateTime(DateUtils.parseDate(monthStart));
|
||||
query.setCalculationMode(initialSwitchInfoDetails.getCalculationMode());
|
||||
query.setClientId(clientId);
|
||||
List<EpsNodeBandwidth> epsNodeBandwidthList = epsNodeBandwidthMapper.selectEpsNodeBandwidthList(query);
|
||||
if(!epsNodeBandwidthList.isEmpty()){
|
||||
EpsNodeBandwidth nodeBandwidth = epsNodeBandwidthList.get(0);
|
||||
resultMap.put("95value", nodeBandwidth.getBandwidthResult());
|
||||
}
|
||||
// 查询端口备注信息
|
||||
RmSwitchInterfaceInfo queryOtheName = new RmSwitchInterfaceInfo();
|
||||
queryOtheName.setClientId(clientId);
|
||||
queryOtheName.setInterfaceName(rmEpsTopologyManagement.getInterfaceName());
|
||||
List<RmSwitchInterfaceInfo> interfaceInfos = rmSwitchInterfaceInfoMapper.selectRmSwitchInterfaceInfoList(queryOtheName);
|
||||
String otherName = null;
|
||||
if(!interfaceInfos.isEmpty()){
|
||||
otherName = interfaceInfos.get(0).getInterfaceRemark();
|
||||
}
|
||||
// 查询业务信息
|
||||
String businessName = null;
|
||||
EpsBusinessDeploy queryBD = new EpsBusinessDeploy();
|
||||
queryBD.setClientId(clientId);
|
||||
queryBD.setReviewStatus(ReviewEnum.通过.getCode());
|
||||
List<EpsBusinessDeploy> businessDeploys = epsBusinessDeployMapper.selectEpsBusinessDeployList(queryBD);
|
||||
if(!businessDeploys.isEmpty()){
|
||||
businessName = businessDeploys.get(0).getBusinessName();
|
||||
}
|
||||
StringJoiner joiner = new StringJoiner("");
|
||||
if (rmEpsTopologyManagement.getSwitchName() != null) {
|
||||
joiner.add("【" + rmEpsTopologyManagement.getSwitchName() + "】");
|
||||
}
|
||||
if (rmEpsTopologyManagement.getInterfaceName() != null) {
|
||||
joiner.add("【" + rmEpsTopologyManagement.getInterfaceName() + "】");
|
||||
}
|
||||
if (otherName != null) {
|
||||
joiner.add("【" + otherName + "】");
|
||||
}
|
||||
if (businessName != null) {
|
||||
joiner.add("【" + businessName + "】");
|
||||
}
|
||||
String name = joiner.toString();
|
||||
resultMap.put("name", name);
|
||||
resultList.add(resultMap);
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
resultList.add(resultMap);
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return resultList.isEmpty() ? new ArrayList<>() : resultList;
|
||||
|
||||
@@ -699,5 +699,36 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
|
||||
return rmResourceRegistrationMapper.getAllLogicalNodeId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定业务
|
||||
* @param rmResourceRegistration
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int bindBusinessByClientIds(RmResourceRegistration rmResourceRegistration) {
|
||||
String clientIds = rmResourceRegistration.getDeployDevice();
|
||||
String[] clientIdArr = clientIds.split("\n");
|
||||
for (String clientId : clientIdArr) {
|
||||
RmResourceRegistration updateData = new RmResourceRegistration();
|
||||
updateData.setClientId(clientId);
|
||||
updateData.setBusinessName(rmResourceRegistration.getBusinessName());
|
||||
rmResourceRegistrationMapper.updateStatusByResource(updateData);
|
||||
// 增加业务变更记录
|
||||
EpsMethodChangeRecord changeRecord = new EpsMethodChangeRecord();
|
||||
// 设置基本信息
|
||||
changeRecord.setClientId(clientId);
|
||||
changeRecord.setBusinessCode(rmResourceRegistration.getBusinessCode());
|
||||
changeRecord.setBusinessName(rmResourceRegistration.getBusinessName());
|
||||
changeRecord.setCreateTime(DateUtils.getNowDate());
|
||||
changeRecord.setCreatBy(SecurityUtils.getUsername());
|
||||
// 修改内容
|
||||
String content = "业务为" + rmResourceRegistration.getBusinessName();
|
||||
changeRecord.setChangeContent(content);
|
||||
// 保存数据
|
||||
epsMethodChangeRecordMapper.insertEpsMethodChangeRecord(changeRecord);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,8 +7,10 @@ import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.core.utils.uuid.IdUtils;
|
||||
import com.ruoyi.system.api.RemoteRocketMqService;
|
||||
import com.ruoyi.system.api.domain.RmMonitorPolicyRemote;
|
||||
import com.ruoyi.system.domain.AllInterfaceName;
|
||||
import com.ruoyi.system.domain.RmSwitchInterfaceInfo;
|
||||
import com.ruoyi.system.domain.RmSwitchManagement;
|
||||
import com.ruoyi.system.mapper.AllInterfaceNameMapper;
|
||||
import com.ruoyi.system.mapper.RmSwitchInterfaceInfoMapper;
|
||||
import com.ruoyi.system.mapper.RmSwitchManagementMapper;
|
||||
import com.ruoyi.system.service.IRmSwitchManagementService;
|
||||
@@ -32,6 +34,8 @@ public class RmSwitchManagementServiceImpl implements IRmSwitchManagementService
|
||||
private RmSwitchInterfaceInfoMapper rmSwitchInterfaceInfoMapper;
|
||||
@Autowired
|
||||
private RemoteRocketMqService remoteRocketMqService;
|
||||
@Autowired
|
||||
private AllInterfaceNameMapper allInterfaceNameMapper;
|
||||
|
||||
/**
|
||||
* 查询交换机管理
|
||||
@@ -149,4 +153,37 @@ public class RmSwitchManagementServiceImpl implements IRmSwitchManagementService
|
||||
{
|
||||
return rmSwitchManagementMapper.deleteRmSwitchManagementById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 交换机信息树形结构
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<RmSwitchManagement> getAllSwitchNameTree() {
|
||||
List<RmSwitchManagement> list = rmSwitchManagementMapper.selectRmSwitchManagementList(new RmSwitchManagement());
|
||||
// 构建树形结构结果
|
||||
for (RmSwitchManagement switchManagement : list) {
|
||||
switchManagement.setValue(switchManagement.getId());
|
||||
switchManagement.setLabel(switchManagement.getSwitchName());
|
||||
// 该交换机的所有接口信息
|
||||
String clientId = switchManagement.getClientId();
|
||||
AllInterfaceName allInterfaceName = new AllInterfaceName();
|
||||
allInterfaceName.setClientId(clientId);
|
||||
List<AllInterfaceName> interfaceNameList = allInterfaceNameMapper.selectAllInterfaceNameList(allInterfaceName);
|
||||
for (AllInterfaceName interfaceName : interfaceNameList) {
|
||||
interfaceName.setValue(interfaceName.getId());
|
||||
interfaceName.setLabel(interfaceName.getInterfaceName());
|
||||
// 查询别名
|
||||
RmSwitchInterfaceInfo query = new RmSwitchInterfaceInfo();
|
||||
query.setInterfaceName(interfaceName.getInterfaceName());
|
||||
query.setClientId(clientId);
|
||||
List<RmSwitchInterfaceInfo> interfaceInfos = rmSwitchInterfaceInfoMapper.selectRmSwitchInterfaceInfoList(query);
|
||||
if(!interfaceInfos.isEmpty()){
|
||||
interfaceName.setOtherName(interfaceInfos.get(0).getInterfaceRemark());
|
||||
}
|
||||
}
|
||||
switchManagement.setChildren(interfaceNameList);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.UserTableColumnConfigMapper;
|
||||
import com.ruoyi.system.domain.UserTableColumnConfig;
|
||||
import com.ruoyi.system.service.IUserTableColumnConfigService;
|
||||
|
||||
/**
|
||||
* 用户自定义列配置Service业务层处理
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-10-30
|
||||
*/
|
||||
@Service
|
||||
public class UserTableColumnConfigServiceImpl implements IUserTableColumnConfigService
|
||||
{
|
||||
@Autowired
|
||||
private UserTableColumnConfigMapper userTableColumnConfigMapper;
|
||||
|
||||
/**
|
||||
* 查询用户自定义列配置
|
||||
*
|
||||
* @param id 用户自定义列配置主键
|
||||
* @return 用户自定义列配置
|
||||
*/
|
||||
@Override
|
||||
public UserTableColumnConfig selectUserTableColumnConfigById(Long id)
|
||||
{
|
||||
return userTableColumnConfigMapper.selectUserTableColumnConfigById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户自定义列配置列表
|
||||
*
|
||||
* @param userTableColumnConfig 用户自定义列配置
|
||||
* @return 用户自定义列配置
|
||||
*/
|
||||
@Override
|
||||
public List<UserTableColumnConfig> selectUserTableColumnConfigList(UserTableColumnConfig userTableColumnConfig)
|
||||
{
|
||||
return userTableColumnConfigMapper.selectUserTableColumnConfigList(userTableColumnConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户自定义列配置
|
||||
*
|
||||
* @param userTableColumnConfig 用户自定义列配置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertUserTableColumnConfig(UserTableColumnConfig userTableColumnConfig)
|
||||
{
|
||||
userTableColumnConfig.setCreateTime(DateUtils.getNowDate());
|
||||
return userTableColumnConfigMapper.insertUserTableColumnConfig(userTableColumnConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户自定义列配置
|
||||
*
|
||||
* @param userTableColumnConfig 用户自定义列配置
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUserTableColumnConfig(UserTableColumnConfig userTableColumnConfig)
|
||||
{
|
||||
userTableColumnConfig.setUpdateTime(DateUtils.getNowDate());
|
||||
return userTableColumnConfigMapper.updateUserTableColumnConfig(userTableColumnConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户自定义列配置
|
||||
*
|
||||
* @param ids 需要删除的用户自定义列配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUserTableColumnConfigByIds(Long[] ids)
|
||||
{
|
||||
return userTableColumnConfigMapper.deleteUserTableColumnConfigByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户自定义列配置信息
|
||||
*
|
||||
* @param id 用户自定义列配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUserTableColumnConfigById(Long id)
|
||||
{
|
||||
return userTableColumnConfigMapper.deleteUserTableColumnConfigById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.ruoyi.system.util;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class PaginationUtil {
|
||||
|
||||
/**
|
||||
* 通用分页方法
|
||||
*/
|
||||
public static <T> PageInfo<T> paginate(List<T> dataList, int pageNum, int pageSize) {
|
||||
if (dataList == null) {
|
||||
dataList = new ArrayList<>();
|
||||
}
|
||||
|
||||
int total = dataList.size();
|
||||
|
||||
// 计算分页参数
|
||||
int totalPages = calculateTotalPages(total, pageSize);
|
||||
pageNum = validatePageNum(pageNum, totalPages);
|
||||
|
||||
// 分页数据
|
||||
List<T> pageData = getPageData(dataList, pageNum, pageSize);
|
||||
|
||||
return buildPageInfo(pageData, pageNum, pageSize, total, totalPages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 带排序的分页
|
||||
*/
|
||||
public static <T> PageInfo<T> paginateWithSort(
|
||||
List<T> dataList,
|
||||
int pageNum,
|
||||
int pageSize,
|
||||
Comparator<T> comparator) {
|
||||
|
||||
if (dataList == null) {
|
||||
dataList = new ArrayList<>();
|
||||
}
|
||||
|
||||
// 先排序
|
||||
List<T> sortedList = dataList.stream()
|
||||
.sorted(comparator)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return paginate(sortedList, pageNum, pageSize);
|
||||
}
|
||||
|
||||
private static int calculateTotalPages(int total, int pageSize) {
|
||||
if (pageSize <= 0) {
|
||||
return 0;
|
||||
}
|
||||
return (int) Math.ceil((double) total / pageSize);
|
||||
}
|
||||
|
||||
private static int validatePageNum(int pageNum, int totalPages) {
|
||||
if (pageNum < 1) {
|
||||
return 1;
|
||||
}
|
||||
if (totalPages > 0 && pageNum > totalPages) {
|
||||
return totalPages;
|
||||
}
|
||||
return pageNum;
|
||||
}
|
||||
|
||||
private static <T> List<T> getPageData(List<T> dataList, int pageNum, int pageSize) {
|
||||
int fromIndex = (pageNum - 1) * pageSize;
|
||||
if (fromIndex >= dataList.size()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
int toIndex = Math.min(fromIndex + pageSize, dataList.size());
|
||||
return dataList.subList(fromIndex, toIndex);
|
||||
}
|
||||
|
||||
private static <T> PageInfo<T> buildPageInfo(List<T> data, int pageNum, int pageSize,
|
||||
int total, int totalPages) {
|
||||
PageInfo<T> pageInfo = new PageInfo<>();
|
||||
pageInfo.setList(data);
|
||||
pageInfo.setPageNum(pageNum);
|
||||
pageInfo.setPageSize(pageSize);
|
||||
pageInfo.setTotal((long) total);
|
||||
pageInfo.setPages(totalPages);
|
||||
pageInfo.setHasNextPage(pageNum < totalPages);
|
||||
pageInfo.setHasPreviousPage(pageNum > 1);
|
||||
pageInfo.setIsFirstPage(pageNum == 1);
|
||||
pageInfo.setIsLastPage(pageNum == totalPages || totalPages == 0);
|
||||
|
||||
return pageInfo;
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public class TrafficRedisHashUtil {
|
||||
if (result instanceof List) {
|
||||
return (List<T>) result;
|
||||
}
|
||||
return null;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,13 +62,13 @@ public class TrafficRedisHashUtil {
|
||||
/**
|
||||
* 更新Hash中的特定项(通过createTime匹配)
|
||||
*/
|
||||
public <T> void updateItemInHash(String taskId, T updatedItem, Object createTime) {
|
||||
public <T> void updateItemInHash(String taskId, T updatedItem, String createTime) {
|
||||
List<T> dataList = (List<T>) getListFromHash(taskId);
|
||||
|
||||
if (dataList != null) {
|
||||
for (int i = 0; i < dataList.size(); i++) {
|
||||
T item = dataList.get(i);
|
||||
Object itemCreateTime = getCreateTimeFromObject(item);
|
||||
String itemCreateTime = getCreateTimeFromObject(item);
|
||||
if (itemCreateTime != null && itemCreateTime.equals(createTime)) {
|
||||
dataList.set(i, updatedItem);
|
||||
break;
|
||||
@@ -293,33 +293,94 @@ public class TrafficRedisHashUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 从对象中提取createTime字段值
|
||||
* 从对象中提取createTime字段值(支持继承链查找),并转换为字符串格式
|
||||
*/
|
||||
public <T> Object getCreateTimeFromObject(T item) {
|
||||
public <T> String getCreateTimeFromObject(T item) {
|
||||
if (item == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
// 尝试通过反射获取createTime字段
|
||||
java.lang.reflect.Field createTimeField = item.getClass().getDeclaredField("createTime");
|
||||
createTimeField.setAccessible(true);
|
||||
return createTimeField.get(item);
|
||||
} catch (NoSuchFieldException e) {
|
||||
// 如果字段名不是createTime,尝试常见的时间字段名
|
||||
String[] timeFieldNames = {"createTime", "create_time", "createdTime", "timestamp", "createAt"};
|
||||
for (String fieldName : timeFieldNames) {
|
||||
try {
|
||||
java.lang.reflect.Field timeField = item.getClass().getDeclaredField(fieldName);
|
||||
timeField.setAccessible(true);
|
||||
return timeField.get(item);
|
||||
} catch (Exception ex) {
|
||||
// 继续尝试下一个字段名
|
||||
System.out.println("开始查找createTime字段,对象类型: " + item.getClass().getName());
|
||||
|
||||
// 在类的继承链中查找createTime字段
|
||||
Class<?> clazz = item.getClass();
|
||||
while (clazz != null && clazz != Object.class) {
|
||||
try {
|
||||
System.out.println("在当前类中查找: " + clazz.getName());
|
||||
java.lang.reflect.Field createTimeField = clazz.getDeclaredField("createTime");
|
||||
createTimeField.setAccessible(true);
|
||||
Object value = createTimeField.get(item);
|
||||
|
||||
if (value != null) {
|
||||
System.out.println("成功在 " + clazz.getName() + " 中找到createTime字段,值: " + value + ", 类型: " + value.getClass().getName());
|
||||
|
||||
// 将Date类型转换为字符串
|
||||
return convertDateToString(value);
|
||||
}
|
||||
return null;
|
||||
|
||||
} catch (NoSuchFieldException e) {
|
||||
// 当前类没有该字段,继续在父类中查找
|
||||
System.out.println(clazz.getName() + " 中没有createTime字段,继续查找父类");
|
||||
clazz = clazz.getSuperclass();
|
||||
} catch (Exception e) {
|
||||
System.out.println("获取字段值时发生异常: " + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("在整个继承链中都未找到createTime字段");
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Date对象转换为 yyyy-MM-dd HH:mm:ss 格式的字符串
|
||||
*/
|
||||
private String convertDateToString(Object dateObj) {
|
||||
if (dateObj == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
// 如果是java.util.Date类型
|
||||
if (dateObj instanceof java.util.Date) {
|
||||
java.util.Date date = (java.util.Date) dateObj;
|
||||
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return sdf.format(date);
|
||||
}
|
||||
// 如果是java.sql.Date类型
|
||||
else if (dateObj instanceof java.sql.Date) {
|
||||
java.sql.Date sqlDate = (java.sql.Date) dateObj;
|
||||
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return sdf.format(new java.util.Date(sqlDate.getTime()));
|
||||
}
|
||||
// 如果是java.sql.Timestamp类型
|
||||
else if (dateObj instanceof java.sql.Timestamp) {
|
||||
java.sql.Timestamp timestamp = (java.sql.Timestamp) dateObj;
|
||||
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return sdf.format(new java.util.Date(timestamp.getTime()));
|
||||
}
|
||||
// 如果是LocalDateTime类型(Java 8+)
|
||||
else if (dateObj instanceof java.time.LocalDateTime) {
|
||||
java.time.LocalDateTime localDateTime = (java.time.LocalDateTime) dateObj;
|
||||
return localDateTime.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
// 如果是LocalDate类型(Java 8+)
|
||||
else if (dateObj instanceof java.time.LocalDate) {
|
||||
java.time.LocalDate localDate = (java.time.LocalDate) dateObj;
|
||||
return localDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd")) + " 00:00:00";
|
||||
}
|
||||
// 如果是字符串类型,直接返回
|
||||
else if (dateObj instanceof String) {
|
||||
return (String) dateObj;
|
||||
}
|
||||
// 其他类型,尝试转换为字符串
|
||||
else {
|
||||
return dateObj.toString();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
System.out.println("日期转换异常: " + e.getMessage());
|
||||
return dateObj.toString(); // 转换失败时返回原始字符串
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="reviewStatus != null and reviewStatus != ''"> and review_status = #{reviewStatus}</if>
|
||||
<if test="reviewTime != null "> and review_time = #{reviewTime}</if>
|
||||
<if test="reviewComment != null and reviewComment != ''"> and review_comment = #{reviewComment}</if>
|
||||
<if test="clientId != null and clientId != ''">
|
||||
and FIND_IN_SET(#{clientId}, REPLACE(deploy_device, '\n', ',')) > 0
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
@@ -199,6 +199,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="businessId != '' and businessId != null">
|
||||
and business_id = #{businessId}
|
||||
</if>
|
||||
<if test="clientId != '' and clientId != null">
|
||||
and client_id = #{clientId}
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
and create_time >= #{startTime}
|
||||
</if>
|
||||
|
||||
@@ -346,6 +346,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{clientId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="interfaceNames != null and interfaceNames != ''">
|
||||
and name in
|
||||
<foreach collection="interfaceNames.split(',')" item="name" open="(" separator="," close=")">
|
||||
#{name}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
group by create_time
|
||||
ORDER BY max_speed desc
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
<?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.UserTableColumnConfigMapper">
|
||||
|
||||
<resultMap type="UserTableColumnConfig" id="UserTableColumnConfigResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="pageRoute" column="page_route" />
|
||||
<result property="columnConfig" column="column_config" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUserTableColumnConfigVo">
|
||||
select id, user_id, page_route, column_config, create_by, create_time, update_by, update_time, remark from user_table_column_config
|
||||
</sql>
|
||||
|
||||
<select id="selectUserTableColumnConfigList" parameterType="UserTableColumnConfig" resultMap="UserTableColumnConfigResult">
|
||||
<include refid="selectUserTableColumnConfigVo"/>
|
||||
<where>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="pageRoute != null and pageRoute != ''"> and page_route = #{pageRoute}</if>
|
||||
<if test="columnConfig != null and columnConfig != ''"> and column_config = #{columnConfig}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectUserTableColumnConfigById" parameterType="Long" resultMap="UserTableColumnConfigResult">
|
||||
<include refid="selectUserTableColumnConfigVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertUserTableColumnConfig" parameterType="UserTableColumnConfig" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into user_table_column_config
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="pageRoute != null and pageRoute != ''">page_route,</if>
|
||||
<if test="columnConfig != null and columnConfig != ''">column_config,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="pageRoute != null and pageRoute != ''">#{pageRoute},</if>
|
||||
<if test="columnConfig != null and columnConfig != ''">#{columnConfig},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateUserTableColumnConfig" parameterType="UserTableColumnConfig">
|
||||
update user_table_column_config
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="pageRoute != null and pageRoute != ''">page_route = #{pageRoute},</if>
|
||||
<if test="columnConfig != null and columnConfig != ''">column_config = #{columnConfig},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteUserTableColumnConfigById" parameterType="Long">
|
||||
delete from user_table_column_config where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteUserTableColumnConfigByIds" parameterType="String">
|
||||
delete from user_table_column_config where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -101,7 +101,7 @@ public class InitialSystemOtherCollectDataController extends BaseController
|
||||
*/
|
||||
@RequiresPermissions("rocketmq:systemOtherCollectData:list")
|
||||
@PostMapping("/getMontiorMsg")
|
||||
public AjaxResult getMontiorMsg(InitialSystemOtherCollectData initialSystemOtherCollectData)
|
||||
public AjaxResult getMontiorMsg(@RequestBody InitialSystemOtherCollectData initialSystemOtherCollectData)
|
||||
{
|
||||
Map list = initialSystemOtherCollectDataService.getMonitorMsg(initialSystemOtherCollectData);
|
||||
return success(list);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.rocketmq.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.utils.EchartsDataUtils;
|
||||
import com.ruoyi.common.core.utils.SpeedUtils;
|
||||
import com.ruoyi.rocketmq.domain.InitialBandwidthTraffic;
|
||||
import com.ruoyi.rocketmq.mapper.InitialBandwidthTrafficMapper;
|
||||
import com.ruoyi.rocketmq.service.IInitialBandwidthTrafficService;
|
||||
@@ -13,6 +14,8 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
@@ -207,6 +210,8 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf
|
||||
condition.setTableName(tableName);
|
||||
condition.setStartTime(initialBandwidthTraffic.getStartTime());
|
||||
condition.setEndTime(initialBandwidthTraffic.getEndTime());
|
||||
condition.setClientId(initialBandwidthTraffic.getClientId());
|
||||
condition.setName(initialBandwidthTraffic.getName());
|
||||
return initialBandwidthTrafficMapper.getNetTrafficList(condition).stream();
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
@@ -221,11 +226,26 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf
|
||||
public Map<String, Object> netInterfaceTrafficEcharts(InitialBandwidthTraffic initialBandwidthTraffic) {
|
||||
// 流量信息
|
||||
List<InitialBandwidthTraffic> list = getListByTableName(initialBandwidthTraffic);
|
||||
Map<String, Function<InitialBandwidthTraffic, ?>> extractors = new LinkedHashMap<>();
|
||||
extractors.put("inSpeedData", info -> safeConvertToKB(info.getInSpeed()));
|
||||
extractors.put("outSpeedData", info -> safeConvertToKB(info.getOutSpeed()));
|
||||
try {
|
||||
String unit = SpeedUtils.calculateUnitWithStringTraffic(list, "inSpeed", "outSpeed");
|
||||
BigDecimal divisor = SpeedUtils.getDivisor(unit);
|
||||
Map<String, Function<InitialBandwidthTraffic, ?>> extractors = new LinkedHashMap<>();
|
||||
extractors.put("netInSpeedData", info ->
|
||||
info != null && info.getInSpeed() != null ?
|
||||
new BigDecimal(info.getInSpeed()).divide(divisor, 0, RoundingMode.HALF_UP) :
|
||||
0);
|
||||
|
||||
return EchartsDataUtils.buildEchartsData(list, InitialBandwidthTraffic::getCreateTime, extractors);
|
||||
extractors.put("netOutSpeedData", info ->
|
||||
info != null && info.getOutSpeed() != null ?
|
||||
new BigDecimal(info.getOutSpeed()).divide(divisor, 0, RoundingMode.HALF_UP) :
|
||||
0);
|
||||
Map<String, Object> resultMap = EchartsDataUtils.buildEchartsData(list, InitialBandwidthTraffic::getCreateTime, extractors);
|
||||
resultMap.put("unit", unit);
|
||||
return resultMap;
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new HashMap<>();
|
||||
}
|
||||
// 安全转换方法(处理可能的NumberFormatException)
|
||||
private Double safeConvertToKB(String byteValue) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.enums.MsgEnum;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.rocketmq.domain.DeviceMessage;
|
||||
import com.ruoyi.rocketmq.domain.RmDeploymentPolicy;
|
||||
import com.ruoyi.rocketmq.domain.RmResourceRemote;
|
||||
@@ -119,6 +120,9 @@ public class RmDeploymentPolicyServiceImpl implements IRmDeploymentPolicyService
|
||||
* @param policy
|
||||
*/
|
||||
public void getIncludeNameById(RmDeploymentPolicy policy){
|
||||
if(policy == null){
|
||||
return;
|
||||
}
|
||||
if (StringUtils.isBlank(policy.getIncludedDevicesId())) {
|
||||
policy.setIncludedDevicesName("");
|
||||
return;
|
||||
@@ -156,6 +160,7 @@ public class RmDeploymentPolicyServiceImpl implements IRmDeploymentPolicyService
|
||||
public int insertRmDeploymentPolicy(RmDeploymentPolicy rmDeploymentPolicy)
|
||||
{
|
||||
rmDeploymentPolicy.setCreateTime(DateUtils.getNowDate());
|
||||
rmDeploymentPolicy.setCreateBy(SecurityUtils.getUsername());
|
||||
return rmDeploymentPolicyMapper.insertRmDeploymentPolicy(rmDeploymentPolicy);
|
||||
}
|
||||
|
||||
|
||||
@@ -106,12 +106,14 @@ public class RmResourceRemoteServiceImpl implements IRmResourceRemoteService
|
||||
// 构建返回结果
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
// 资源详情
|
||||
RmResourceRegistrationRemote queryParam = new RmResourceRegistrationRemote();
|
||||
queryParam.setHardwareSn(rmResourceRemote.getHardwareSn());
|
||||
R<RmResourceRegistrationRemote> registrationRemote = remoteRevenueConfigService.getListByHardwareSn(queryParam, SecurityConstants.INNER);
|
||||
if(registrationRemote != null && registrationRemote.getData() != null){
|
||||
RmResourceRegistrationRemote resourceMsg = registrationRemote.getData();
|
||||
resultMap.put("resourceMsg", resourceMsg);
|
||||
if(rmResourceRemote.getHardwareSn() != null){
|
||||
RmResourceRegistrationRemote queryParam = new RmResourceRegistrationRemote();
|
||||
queryParam.setHardwareSn(rmResourceRemote.getHardwareSn());
|
||||
R<RmResourceRegistrationRemote> registrationRemote = remoteRevenueConfigService.getListByHardwareSn(queryParam, SecurityConstants.INNER);
|
||||
if(registrationRemote != null && registrationRemote.getData() != null){
|
||||
RmResourceRegistrationRemote resourceMsg = registrationRemote.getData();
|
||||
resultMap.put("resourceMsg", resourceMsg);
|
||||
}
|
||||
}
|
||||
// 脚本执行结果构建
|
||||
List<Map<String, Object>> scriptList = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user