package com.fgkj.actions; import java.util.List; import javax.servlet.http.HttpServletResponse; import com.fgkj.dao.impl.Batt_rtstateDAOImpl; import com.fgkj.dto.BattInf; import com.fgkj.dto.Batt_Maint_Dealarm; import com.fgkj.dto.Batt_rtdata; import com.fgkj.dto.Batt_rtstate; import com.fgkj.dto.ServiceModel; import com.fgkj.dto.User_inf; import com.fgkj.services.Batt_rtstateService; import com.opensymphony.xwork2.ActionSupport; public class Batt_rtstateAction extends ActionUtil{ private Batt_rtstateService service=new Batt_rtstateService(); private ServiceModel model; private Batt_rtstate rtstate; private String json; private String result; //实时监测中的查询实时组端信息 public String serchByCondition(){ //System.out.println("开始查询rtstate"); model=service.serchByCondition(rtstate); //System.out.println(model); result = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").toJson(model); return SUCCESS; } //9.1根据查询电池组单体的实时数据(电池单体实时信息) public String serchByMons(){ BattInf binf = ActionUtil.getGson().fromJson(json, BattInf.class); ServiceModel model = service.serchByMons(binf); result = ActionUtil.tojson(model); return SUCCESS; } //根据电池组id查询该电池组/单体的实时情况(电池续航能力) public String serchByInfo(){ BattInf binf = ActionUtil.getGson().fromJson(json, BattInf.class); ServiceModel model = service.serchByInfo(binf); result = ActionUtil.tojson(model); return SUCCESS; } //查询电池组的实时状态(电池组状态查询<放电,充电>) // public String serchBattState(){ // Batt_Maint_Dealarm bmd = ActionUtil.getGson().fromJson(json, Batt_Maint_Dealarm.class); // ServiceModel model = service.serchBattState(bmd); // result = ActionUtil.tojson(model); // return SUCCESS; // } //首页上饼状图电池状态比例 public String serchBattStateRate(){ User_inf uinf=(User_inf) ActionUtil.getUser(); ServiceModel model = service.serchBattStateRate(uinf); result = ActionUtil.tojson(model); return SUCCESS; } //电池组实时情况+实时电池续航能力查询 public String serchBattLife(){ Batt_Maint_Dealarm bmd = ActionUtil.getGson().fromJson(json, Batt_Maint_Dealarm.class); User_inf uinf=(User_inf) ActionUtil.getUser(); bmd.setUinf(uinf); ServiceModel model = service.serchBattLife(bmd); result = ActionUtil.tojson(model); return SUCCESS; } //测试数据——实时查询中左下角的充放电统计(旧) public String serchDisOrChargr(){ ServiceModel model = service.serchDisOrChargr(); result = ActionUtil.tojson(model); return SUCCESS; } //测试数据——实时查询中左下角的充放电统计(用户管理的机房) public String serchDisOrChargrNew(){ User_inf uinf=(User_inf) ActionUtil.getUser(); ServiceModel model = service.serchDisOrChargrNew(uinf); result = ActionUtil.tojson(model); return SUCCESS; } //实时监测中的查询实时组端信息 public String serchByCondition_ky(){ //ActionUtil.isAllowHeaders(); //允许跨域访问 model = new ServiceModel(); //System.out.println("开始查询rtstate"); rtstate = ActionUtil.getGson().fromJson(json, Batt_rtstate.class); model=service.serchByCondition_ky(rtstate); //System.out.println(model); result = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").toJson(model); return SUCCESS; } public ServiceModel getModel() { return model; } public void setModel(ServiceModel model) { this.model = model; } public Batt_rtstate getRtstate() { return rtstate; } public void setRtstate(Batt_rtstate rtstate) { this.rtstate = rtstate; } public String getResult() { return result; } public void setJson(String json) { this.json = json; } }