whyclj
2019-10-29 1c0469e45346d464e0c5672ee68f9ecd4fb6be7c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
package com.fgkj.actions;
 
import java.util.List;
 
import com.fgkj.dao.impl.Batt_rtstateDAOImpl;
import com.fgkj.dto.BattInf;
import com.fgkj.dto.Batt_Maint_Dealarm;
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 ActionSupport{
    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();
        rtstate = ActionUtil.getGson().fromJson(json, Batt_rtstate.class);
        model=service.serchByCondition_ky(rtstate);            
        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;
    }
 
        
}