|
|
@@ -0,0 +1,51 @@ |
|
|
|
package com.ningdatech.pmapi.sys.controller; |
|
|
|
|
|
|
|
import com.ningdatech.log.annotation.WebLog; |
|
|
|
import com.ningdatech.pmapi.sys.manage.CpuManage; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Classname CpuController |
|
|
|
* @Description |
|
|
|
* @Date 2023/10/30 11:06 |
|
|
|
* @Author PoffyZhang |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@Validated |
|
|
|
@RestController |
|
|
|
@RequestMapping("/api/v1/cpu") |
|
|
|
@Api(value = "CpuController", tags = "CPU提升和关闭提升") |
|
|
|
@RequiredArgsConstructor |
|
|
|
public class CpuController { |
|
|
|
|
|
|
|
private final CpuManage cpuManage; |
|
|
|
|
|
|
|
@ApiOperation(value = "CPU初始化任务", notes = "CPU初始化任务") |
|
|
|
@PostMapping("/start") |
|
|
|
@WebLog("CPU初始化任务") |
|
|
|
public String start() { |
|
|
|
cpuManage.whileTrueTask(); |
|
|
|
return "初始化成功"; |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation(value = "提升CPU", notes = "提升CPU") |
|
|
|
@PostMapping("/high/{cpu}") |
|
|
|
@WebLog("提升CPU") |
|
|
|
public String high(@PathVariable Integer cpu) { |
|
|
|
cpuManage.open(cpu); |
|
|
|
return "提高成功"; |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation(value = "关闭CPU任务", notes = "关闭CPU任务") |
|
|
|
@PostMapping("/close") |
|
|
|
@WebLog("关闭CPU任务") |
|
|
|
public String close() { |
|
|
|
cpuManage.close(); |
|
|
|
return "关闭成功"; |
|
|
|
} |
|
|
|
} |