package com.ld.igds.inout.manager;
|
|
import com.ld.igds.io.sample.ApiSampleManager;
|
import com.ld.igds.io.sample.ApiSampleService;
|
import com.ld.igds.io.sample.data.SampleDto;
|
import com.ld.igds.m.service.InoutCommonService;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
@Component("inout.checkManager")
|
public class CheckManager {
|
|
@Autowired
|
private ApiSampleManager remoteManager;
|
|
@Autowired
|
private InoutCommonService inoutCommonService;
|
|
private ApiSampleService macService;
|
|
/**
|
* 扦样机执行
|
*
|
* @param param
|
* @return
|
*/
|
public String checkExe(SampleDto param) {
|
|
String protocol = param.getProtocol();
|
if (StringUtils.isEmpty(protocol)) {
|
return "当前扦样机没有配置通讯协议,无法执行操作!";
|
}
|
|
if (null == macService) {
|
macService = remoteManager.getApiSampleService(protocol);
|
}
|
|
if (null == macService) {
|
return "当前扦样机配置的协议,系统未实现接口!!";
|
}
|
|
return macService.doExe(param);
|
}
|
|
/**
|
* 扦样机停止
|
*
|
* @param param
|
* @return
|
*/
|
public String stop(SampleDto param) {
|
String protocol = param.getProtocol();
|
if (StringUtils.isEmpty(protocol)) {
|
return "当前扦样机没有配置通讯协议,无法执行操作!";
|
}
|
if (null == macService) {
|
macService = remoteManager.getApiSampleService(protocol);
|
}
|
if (null == macService) {
|
return "当前扦样机配置的协议,系统未实现接口!!";
|
}
|
return macService.doStop(param);
|
}
|
|
/**
|
* 扦样机恢复
|
*
|
* @param param
|
* @return
|
*/
|
public String reset(SampleDto param) {
|
String protocol = param.getProtocol();
|
if (StringUtils.isEmpty(protocol)) {
|
return "当前扦样机没有配置通讯协议,无法执行操作!";
|
}
|
if (null == macService) {
|
macService = remoteManager.getApiSampleService(protocol);
|
}
|
if (null == macService) {
|
return "当前扦样机配置的协议,系统未实现接口!!";
|
}
|
return macService.doReset(param);
|
}
|
|
/**
|
* 扦样机急停恢复
|
*
|
* @param param
|
* @return
|
*/
|
public String resetStop(SampleDto param) {
|
String protocol = param.getProtocol();
|
if (StringUtils.isEmpty(protocol)) {
|
return "当前扦样机没有配置通讯协议,无法执行操作!";
|
}
|
if (null == macService) {
|
macService = remoteManager.getApiSampleService(protocol);
|
}
|
if (null == macService) {
|
return "当前扦样机配置的协议,系统未实现接口!!";
|
}
|
return macService.doResetStop(param);
|
}
|
}
|