73 lines
1.7 KiB
Java
73 lines
1.7 KiB
Java
package com.ruoyi.schedule;
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
@RestController
|
|
@RequestMapping("/device/operation")
|
|
public class ThreadOperationController {
|
|
|
|
@Resource
|
|
private ScheduleThread scheduleThread;
|
|
|
|
/**
|
|
* 开启plc读取线程
|
|
*
|
|
* @return
|
|
*/
|
|
@RequestMapping("/startAllThread")
|
|
//@PreAuthorize("@ss.hasPermi('device:operation:start')")
|
|
public AjaxResult startAllThread() {
|
|
scheduleThread.startAllThread();
|
|
return AjaxResult.success();
|
|
}
|
|
|
|
/**
|
|
* 开启调度线程
|
|
*
|
|
* @return
|
|
*/
|
|
@RequestMapping("/startAllThread2")
|
|
//@PreAuthorize("@ss.hasPermi('device:operation:start')")
|
|
public AjaxResult startAllThread2() {
|
|
scheduleThread.startAllThread2();
|
|
return AjaxResult.success();
|
|
}
|
|
|
|
/**
|
|
* 关闭线程
|
|
*
|
|
* @return
|
|
*/
|
|
@RequestMapping("/stopAllThread")
|
|
//@PreAuthorize("@ss.hasPermi('device:operation:stop')")
|
|
public AjaxResult stopAllThread() {
|
|
scheduleThread.stopAllThread();
|
|
return AjaxResult.success();
|
|
}
|
|
|
|
/**
|
|
* 关闭线程
|
|
*
|
|
* @return
|
|
*/
|
|
@RequestMapping("/stopAllThread2")
|
|
//@PreAuthorize("@ss.hasPermi('device:operation:stop')")
|
|
public AjaxResult stopAllThread2() {
|
|
scheduleThread.stopAllThread2();
|
|
return AjaxResult.success();
|
|
}
|
|
|
|
/**
|
|
* 获取调度状态
|
|
* @return
|
|
*/
|
|
@RequestMapping("/getScheduleStatus")
|
|
public AjaxResult getScheduleStatus() {
|
|
return AjaxResult.success(scheduleThread.getScheduleStatusDetails());
|
|
}
|
|
}
|