package com.fgkj.actions.ram;
|
|
import com.fgkj.actions.ActionUtil;
|
import com.fgkj.dto.ServiceModel;
|
import com.fgkj.dto.ram.Server_state;
|
import com.fgkj.services.Process_surveyService;
|
import com.fgkj.services.ram.Server_stateService;
|
import org.apache.struts2.json.annotations.JSON;
|
|
import java.io.Serializable;
|
import java.util.Date;
|
import java.util.HashMap;
|
import java.util.Map;
|
|
public class Server_stateAction extends ActionUtil{
|
private Server_stateService service = new Server_stateService();
|
private Process_surveyService serviceP=new Process_surveyService();
|
private String result;
|
private String json;
|
|
public String add() {
|
Server_state server_state = ActionUtil.getGson().fromJson(json, Server_state.class);
|
ServiceModel model = service.add(server_state);
|
result = tojson(model);
|
return SUCCESS;
|
|
}
|
public String update() {
|
Server_state server_state = ActionUtil.getGson().fromJson(json, Server_state.class);
|
ServiceModel model = service.update(server_state);
|
result = tojson(model);
|
return SUCCESS;
|
}
|
public String delete() {
|
Server_state server_state = ActionUtil.getGson().fromJson(json, Server_state.class);
|
ServiceModel model = service.delete(server_state);
|
result = tojson(model);
|
return SUCCESS;
|
}
|
public String serchByCondition(){
|
Server_state server_state = ActionUtil.getGson().fromJson(json, Server_state.class);
|
ServiceModel model = service.serchByCondition(server_state);
|
result = tojson(model);
|
return SUCCESS;
|
}
|
//查询服务器信息和线程信息 serverState:服务器信息,processSurvey:进程信息
|
public String serchServerManageInfo() {
|
Map dataMap = new HashMap();
|
//查询服务器信息
|
ServiceModel serverModel = service.searchAll();
|
dataMap.put("serverState", serverModel);
|
//查询线程状态
|
ServiceModel processModel = serviceP.searchAll();
|
dataMap.put("processSurvey", processModel);
|
|
return SUCCESS;
|
}
|
/**查询系统的硬件状态-通过数据库*/
|
public String searchAll(){
|
ServiceModel model = service.searchAll();
|
result = tojson(model);
|
return SUCCESS;
|
}
|
|
/**查询系统的硬件状态-代码计算*/
|
public String searchAll2(){
|
ServiceModel model = service.searchAll2();
|
result = tojson(model);
|
return SUCCESS;
|
}
|
|
/**查询系统时间戳*/
|
@JSON(serialize = false)
|
public String getTimestamp(){
|
ServiceModel model = new ServiceModel();
|
long l = System.currentTimeMillis();
|
model.set(1,l);
|
result = getGson().toJson(model);
|
return SUCCESS;
|
}
|
|
public String getResult() {
|
return result;
|
}
|
public void setJson(String json) {
|
this.json = json;
|
}
|
}
|