Add user interfaces to turn on and end all sar
This commit is contained in:
parent
286f3b3c3a
commit
b32b2cbbbd
@ -29,4 +29,26 @@ public class SarControlController {
|
|||||||
controlInfoService.sendUdp(param);
|
controlInfoService.sendUdp(param);
|
||||||
return Result.successData("发送成功");
|
return Result.successData("发送成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送开机控制指令
|
||||||
|
* @param ip
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/turnon")
|
||||||
|
public Result turnOn(@RequestBody String ip) {
|
||||||
|
controlInfoService.turnOn(ip);
|
||||||
|
return Result.successData("发送成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送控制指令
|
||||||
|
* @param ip
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/endall")
|
||||||
|
public Result endAll(@RequestBody String ip) {
|
||||||
|
controlInfoService.endAll(ip);
|
||||||
|
return Result.successData("发送成功");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,6 +43,13 @@ public interface ISarControlService {
|
|||||||
*/
|
*/
|
||||||
void connect(String ip);
|
void connect(String ip);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* turn on sar
|
||||||
|
*
|
||||||
|
* @param ip
|
||||||
|
*/
|
||||||
|
void turnOn(String ip);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结束所有任务
|
* 结束所有任务
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.zhangy.skyeye.sar.service.impl;
|
package com.zhangy.skyeye.sar.service.impl;
|
||||||
|
|
||||||
|
import com.zhangy.skyeye.common.extend.exception.ServiceException;
|
||||||
import com.zhangy.skyeye.common.extend.util.JsonUtil;
|
import com.zhangy.skyeye.common.extend.util.JsonUtil;
|
||||||
import com.zhangy.skyeye.jm.dto.JmJobDTO;
|
import com.zhangy.skyeye.jm.dto.JmJobDTO;
|
||||||
import com.zhangy.skyeye.jm.dto.JmSarStatusDTO;
|
import com.zhangy.skyeye.jm.dto.JmSarStatusDTO;
|
||||||
@ -84,8 +85,22 @@ public class SarControlServiceImpl implements ISarControlService {
|
|||||||
udpSendContext.execute(param);
|
udpSendContext.execute(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void turnOn(String ip) {
|
||||||
|
if (!redisUtil.hHasKey(CacheKey.SAR_CONNECTED, ip) || !redisUtil.hasKey(CacheKey.getSarConnect(ip))) {
|
||||||
|
throw new ServiceException("请先加电并连接sar");
|
||||||
|
}
|
||||||
|
|
||||||
|
SarControlParamDTO param = new SarControlParamDTO(ip, SarControlTypeEnum.TURNON);
|
||||||
|
udpSendContext.execute(param);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void endAll(String ip) {
|
public void endAll(String ip) {
|
||||||
|
if (!redisUtil.hHasKey(CacheKey.SAR_CONNECTED, ip) || !redisUtil.hasKey(CacheKey.getSarConnect(ip))) {
|
||||||
|
throw new ServiceException("请先加电并连接sar");
|
||||||
|
}
|
||||||
|
|
||||||
SarControlParamDTO param = new SarControlParamDTO(ip, SarControlTypeEnum.ENDALL);
|
SarControlParamDTO param = new SarControlParamDTO(ip, SarControlTypeEnum.ENDALL);
|
||||||
udpSendContext.execute(param);
|
udpSendContext.execute(param);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user