lxw
2020-07-11 9db52f2f2dd3665fe9da1ae5657e0167c3a34d40
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
package com.fgkj.actions;
 
import java.util.List;
 
import com.fgkj.dto.BattInf;
import com.fgkj.dto.Batttestdata;
import com.fgkj.dto.Batttestdata_inf;
import com.fgkj.dto.ServiceModel;
import com.fgkj.services.BatttestdataService;
import com.fgkj.services.Batttestdata_infService;
import com.google.gson.reflect.TypeToken;
import com.opensymphony.xwork2.ActionSupport;
 
public class BatttestdataAction extends ActionUtil{
    private BatttestdataService service = new BatttestdataService();
    private String result;
    private Batttestdata btd;
    private String json;
 
    public String findByInfo() {
        //System.out.println(btd);
        ServiceModel model = service.serchByCondition(btd);
        result = ActionUtil.tojson(model);
        model = null;
        System.gc();
        return SUCCESS;
    }
    
    /**
     * 历史数据查询
     * @return
     */
    public String findhistory(){
        Batttestdata btd = ActionUtil.getGson().fromJson(json, Batttestdata.class);
        //System.out.println(btd);
        ServiceModel model = service.serchByCondition(btd);
        result = ActionUtil.tojson(model);
        //System.out.println("*************************");
        return SUCCESS;
    }
    
    /**
     * 历史数据查询            <!-------------  跨域访问 -------------------->
     * @return
     */
    public String findhistory_ky(){
        //isAllowHeaders();
        ServiceModel model = new ServiceModel();
        btd = ActionUtil.getGson().fromJson(json, Batttestdata.class);
        model = service.serchByCondition_ky(btd);
        result = ActionUtil.tojson(model);
        return SUCCESS;
    }
    //查询电池组监测放电中
    public String serchByInfo(){
        List<Batttestdata_inf> list=ActionUtil.getGson().fromJson(json, new TypeToken<List<Batttestdata_inf>>(){}.getType());
        ServiceModel model=service.serchByInfo(list);
           result=tojson(model);
           return SUCCESS;
    }
    
    public void setBtd(Batttestdata btd) {
        this.btd = btd;
    }
 
    public String getResult() {
        return result;
    }
 
    public Batttestdata getBtd() {
        return btd;
    }
 
    public void setResult(String result) {
        this.result = result;
    }
 
    public void setJson(String json) {
        this.json = json;
    }
    
    
 
}