review code.

This commit is contained in:
lijiahang
2022-07-19 17:30:05 +08:00
parent 7362174850
commit 1a6b203ca3
8 changed files with 38 additions and 27 deletions
-1
View File
@@ -658,7 +658,6 @@ CREATE TABLE `machine_terminal`
`font_size` int(11) NULL DEFAULT 14 COMMENT '字体大小',
`font_family` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '字体名称',
`enable_web_link` tinyint(4) NULL DEFAULT 2 COMMENT '是否开启url link 1开启 2关闭',
`enable_web_gl` tinyint(4) NULL DEFAULT 2 COMMENT '是否开启webGL加速 1开启 2关闭',
`deleted` tinyint(4) NULL DEFAULT 1 COMMENT '是否删除 1未删除 2已删除',
`create_time` datetime(4) NULL DEFAULT CURRENT_TIMESTAMP(4) COMMENT '创建时间',
`update_time` datetime(4) NULL DEFAULT CURRENT_TIMESTAMP(4) ON UPDATE CURRENT_TIMESTAMP(4) COMMENT '修改时间',
@@ -4,6 +4,9 @@ import com.orion.lang.define.wrapper.HttpWrapper;
import com.orion.ops.annotation.EventLog;
import com.orion.ops.annotation.RequireRole;
import com.orion.ops.annotation.RestWrapper;
import com.orion.ops.constant.CnConst;
import com.orion.ops.constant.Const;
import com.orion.ops.constant.PropertiesConst;
import com.orion.ops.constant.event.EventType;
import com.orion.ops.constant.system.SystemCleanType;
import com.orion.ops.constant.system.SystemConfigKey;
@@ -11,19 +14,13 @@ import com.orion.ops.constant.user.RoleType;
import com.orion.ops.entity.request.ConfigIpListRequest;
import com.orion.ops.entity.request.SystemFileCleanRequest;
import com.orion.ops.entity.request.SystemOptionRequest;
import com.orion.ops.entity.vo.IpListConfigVO;
import com.orion.ops.entity.vo.SystemAnalysisVO;
import com.orion.ops.entity.vo.SystemOptionVO;
import com.orion.ops.entity.vo.ThreadPoolMetricsVO;
import com.orion.ops.entity.vo.*;
import com.orion.ops.service.api.SystemService;
import com.orion.ops.utils.Valid;
import com.orion.web.servlet.web.Servlets;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -45,7 +42,7 @@ public class SystemController {
@Resource
private SystemService systemService;
@PostMapping("/ip-info")
@GetMapping("/ip-info")
@ApiOperation(value = "获取ip信息")
public IpListConfigVO getIpInfo(HttpServletRequest request) {
return systemService.getIpInfo(Servlets.getRemoteAddr(request));
@@ -70,13 +67,13 @@ public class SystemController {
return HttpWrapper.ok();
}
@PostMapping("/get-system-analysis")
@GetMapping("/get-system-analysis")
@ApiOperation(value = "获取系统分析信息")
public SystemAnalysisVO getSystemAnalysis() {
return systemService.getSystemAnalysis();
}
@PostMapping("/re-analysis")
@GetMapping("/re-analysis")
@ApiOperation(value = "重新进行系统统计分析")
@EventLog(EventType.RE_ANALYSIS_SYSTEM)
@RequireRole(RoleType.ADMINISTRATOR)
@@ -96,18 +93,29 @@ public class SystemController {
return HttpWrapper.ok();
}
@PostMapping("/get-system-options")
@GetMapping("/get-system-options")
@ApiOperation(value = "获取系统配置项")
@RequireRole(RoleType.ADMINISTRATOR)
public SystemOptionVO getSystemOptions() {
return systemService.getSystemOptions();
}
@PostMapping("/get-thread-metrics")
@GetMapping("/get-thread-metrics")
@ApiOperation(value = "获取线程池指标")
@RequireRole(RoleType.ADMINISTRATOR)
public List<ThreadPoolMetricsVO> getThreadMetrics() {
return systemService.getThreadPoolMetrics();
}
@GetMapping("/about")
@ApiOperation(value = "获取应用信息")
public SystemAboutVO getSystemAbout() {
return SystemAboutVO.builder()
.orionKitVersion(Const.ORION_KIT_VERSION)
.orionOpsVersion(PropertiesConst.ORION_OPS_VERSION)
.author(Const.ORION_AUTHOR)
.authorCn(CnConst.ORION_OPS_AUTHOR)
.build();
}
}
@@ -13,8 +13,8 @@ import lombok.Data;
*/
@Data
@Builder
@ApiModel(value = "系统配置响应")
public class SystemVersionVO {
@ApiModel(value = "系统信息响应")
public class SystemAboutVO {
/**
* orion-kit 版本
@@ -26,4 +26,14 @@ public class SystemVersionVO {
*/
private String orionOpsVersion;
/**
* 作者
*/
private String author;
/**
* 作者
*/
private String authorCn;
}
@@ -50,12 +50,6 @@ public class SystemAnalysisVO {
@ApiModelProperty(value = "应用仓库大小")
private String vcsVersionFileSize;
@ApiModelProperty(value = "黑名单数量")
private Long blackIpListCount;
@ApiModelProperty(value = "白名单数量")
private Long whiteIpListCount;
@ApiModelProperty(value = "文件清理阈值")
private Integer fileCleanThreshold;
@@ -40,7 +40,7 @@ public class FileCleaner {
releasedBytes += deletePathFiles(thresholdTime, new File(SystemEnvAttr.SWAP_PATH.getValue()));
// 构建产物
releasedBytes += deletePathFiles(thresholdTime, new File(SystemEnvAttr.DIST_PATH.getValue()));
// // vcs产物 文件太多会 oom
// // vcs仓库 文件太多会 oom
// File vcsPath = new File(SystemEnvAttr.VCS_PATH.getValue());
// List<File> vcsPaths = Files1.listFilesFilter(vcsPath, (f, n) -> f.isDirectory() && !Const.EVENT.equals(n), false, true);
// for (File vcs : vcsPaths) {
@@ -77,7 +77,7 @@ public class FileCleaner {
releasedBytes += deletePathFiles(thresholdTime, new File(SystemEnvAttr.DIST_PATH.getValue()));
break;
case VCS_FILE:
// vcs产物
// vcs仓库
File vcsPath = new File(SystemEnvAttr.VCS_PATH.getValue());
List<File> vcsPaths = Files1.listFilesFilter(vcsPath, (f, n) -> f.isDirectory() && !Const.EVENT.equals(n), false, true);
for (File vcs : vcsPaths) {
@@ -101,7 +101,7 @@
]
},
{
"name": "CI/CD",
"name": "构建发布",
"icon": "deployment-unit",
"children": [
{
@@ -93,7 +93,7 @@
]
},
{
"name": "CI/CD",
"name": "构建发布",
"icon": "deployment-unit",
"children": [
{
@@ -93,7 +93,7 @@
]
},
{
"name": "CI/CD",
"name": "构建发布",
"icon": "deployment-unit",
"children": [
{