星伟
2018-09-21 482825da5c78b3d4daa7d8804570da85d12e0758
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
package com.fgkj.actions.ram;
 
import java.util.List;
 
import com.fgkj.actions.ActionUtil;
import com.fgkj.dao.FBS9100_ComBase;
import com.fgkj.dao.UinfDaoFactory;
import com.fgkj.dao.impl.Batt_rtdataDAOImpl;
import com.fgkj.dto.BattInf;
import com.fgkj.dto.ServiceModel;
import com.fgkj.dto.User_log;
import com.fgkj.dto.User_permitgroup;
import com.fgkj.dto.ram.Fbs9100_setparam;
import com.fgkj.services.User_logService;
import com.fgkj.services.ram.Fbs9100_setparamService;
import com.google.gson.reflect.TypeToken;
 
public class Fbs9100_setparamAction extends ActionUtil{
    private Fbs9100_setparamService service = new Fbs9100_setparamService();
    private User_logService uservice=new User_logService();
    private String json;
    private String result;
    
    //根据机房编号和维护区查询放电机房的信息和放电参数
    public String serchByCondition(){
        BattInf binf = getGson().fromJson(json, BattInf.class);
        ServiceModel model = service.serchByCondition(binf);
        result = tojson(model);
        return SUCCESS;
    }
    
    //弹出框的确定操作
    public String update() {
        Fbs9100_setparam fbs = getGson().fromJson(json, Fbs9100_setparam.class);
        ServiceModel model = service.update(fbs);
        {   String msg="";
            if(fbs.getNum()==FBS9100_ComBase.CMD_SetDischargeParm){
                 msg="修改"+fbs.getDev_id()+"的设备放电参数";
            }else if(fbs.getNum()==FBS9100_ComBase.CMD_Start){
                 msg="启动"+fbs.getDev_id()+"的设备放电";
            }else if(fbs.getNum()==FBS9100_ComBase.CMD_Stop){
                 msg="停止"+fbs.getDev_id()+"的设备放电";
            }
            User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Alter, msg);
            uservice.add(ulog);//将用户的操作记录下来
        }
        result = tojson(model);        
        return SUCCESS;    
    }
    //点击弹出框的设定按钮,修改ld6测试参数
    public String updateld6Param(){
        Fbs9100_setparam fbs = getGson().fromJson(json, Fbs9100_setparam.class);
        ServiceModel model = service.updateld6Param(fbs);
        {   String msg="";
            if(fbs.getNum()==FBS9100_ComBase.CMD_SetDischargeParm){
                 msg="修改"+fbs.getDev_id()+"的设备放电参数";
            }else if(fbs.getNum()==FBS9100_ComBase.CMD_Start){
                 msg="启动"+fbs.getDev_id()+"的设备放电";
            }else if(fbs.getNum()==FBS9100_ComBase.CMD_Stop){
                 msg="停止"+fbs.getDev_id()+"的设备放电";
            }
            User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Alter, msg);
            uservice.add(ulog);//将用户的操作记录下来
        }
        result = tojson(model);        
        return SUCCESS;
    }
    //点击弹出框的设定按钮,修改61850测试参数
    public String update61850Param(){
        Fbs9100_setparam fbs = getGson().fromJson(json, Fbs9100_setparam.class);
        ServiceModel model = service.update61850Param(fbs);
        {   String msg="";
            if(fbs.getNum()==FBS9100_ComBase.CMD_SetDischargeParm){
                 msg="修改"+fbs.getDev_id()+"的设备放电参数";
            }else if(fbs.getNum()==FBS9100_ComBase.CMD_Start){
                 msg="启动"+fbs.getDev_id()+"的设备放电";
            }else if(fbs.getNum()==FBS9100_ComBase.CMD_Stop){
                 msg="停止"+fbs.getDev_id()+"的设备放电";
            }
            User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Alter, msg);
            uservice.add(ulog);//将用户的操作记录下来
        }
        result = tojson(model);        
        return SUCCESS;
    }
    
    //右键查看参数和弹出框的刷新按钮
    public String serchbyDev_id() {
        Fbs9100_setparam fsparam = getGson().fromJson(json, Fbs9100_setparam.class);
        ServiceModel model = service.serchbyDev_id(fsparam);
        result = tojson(model);
        return SUCCESS;    
    }
    
    //实时刷新放电表格的电池组状态(集合)
    public String serchByInfo(){
        List<BattInf> binf = getGson().fromJson(json, new TypeToken<List<BattInf>>(){}.getType());
        ServiceModel model = service.serchByInfo(binf);
        result = tojson(model);
        return SUCCESS;
    }
    
    //根据电池组id查询电池组内前五的内阻数据(修改为前10)
    public String serchByThirdBatt(){
        BattInf binf = ActionUtil.getGson().fromJson(json, BattInf.class);
        ServiceModel model = service.serchByThirdBatt(binf);
        result = tojson(model);
        return SUCCESS;
    }
 
    public String getResult() {
        return result;
    }
 
    public void setJson(String json) {
        this.json = json;
    }
    
}