1
81041
2019-06-20 ab3c4acf83f54f8449ca8664c4a2bb79bd30f297
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
package com.fgkj.actions;
 
import java.util.List;
 
import com.fgkj.dto.BattInf;
import com.fgkj.dto.Batt_electricity;
import com.fgkj.dto.ServiceModel;
import com.fgkj.services.Batt_electricityService;
 
public class Batt_electricityAction extends ActionUtil{
    private Batt_electricityService service = new Batt_electricityService();
    private String result;        //返回数据
    private String json;        //接收数据
    
    public String add(){
        Batt_electricity be = getGson().fromJson(json, Batt_electricity.class);
        ServiceModel model = service.add(be);
        result = tojson(model);
        return SUCCESS;
    }
    public String update(){
        Batt_electricity be = getGson().fromJson(json, Batt_electricity.class);
        ServiceModel model  = service.update(be);
        result = tojson(model);
        return SUCCESS;
    }
    public String del(){
        Batt_electricity be = getGson().fromJson(json, Batt_electricity.class);
        ServiceModel model = service.del(be);
        result = tojson(model);
        return SUCCESS;
    }
    public String searchAll(){
        ServiceModel model = service.searchAll();
        result = tojson(model);
        return SUCCESS;
    }
    
    
    //10.1根据设备id连battinf和batt_devdischarge表      查询电度
    /*
     * 记录时间放在battinf的battproducer
     * 统计方式放在battinf  的signalname  中       1 - 月       2-季度    3-年份
     * */   
    public String serchByCondition(){
        BattInf binf = getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattInf.class);
        List list = service.serchByCondition(binf);
        result = tojson(list);
        //System.out.println(result);
        return SUCCESS;
    }
    
    //9.1机房主控中用电量的统计的折线图
    public String  serchByInfo(){
        System.out.println(json);
        BattInf binf = getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattInf.class);
        //System.out.println(binf);
        ServiceModel model = service.serchByInfo(binf);
        result = tojson(model);
        return SUCCESS;
    }
    
    public String getResult() {
        return result;
    }
    
    public void setJson(String json) {
        this.json = json;
    }
    
    
}