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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
package com.fgkj.actions;
 
import java.util.ArrayList;
import java.util.List;
 
import com.fgkj.dao.BattTestData;
import com.fgkj.dao.impl.BattDischarge_planImpl;
import com.fgkj.dto.BattDischarge_plan;
import com.fgkj.dto.BattInf;
import com.fgkj.dto.Batt_Maint_Dealarm;
import com.fgkj.dto.ServiceModel;
import com.fgkj.dto.User_inf;
import com.fgkj.services.BattDischarge_planService;
import com.google.gson.reflect.TypeToken;
 
public class BattDischarge_planAction extends ActionUtil{
    private BattDischarge_planService service = new BattDischarge_planService();
    private String json;
    private String result;
    
    public String add(){
        BattDischarge_plan plan = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattDischarge_plan.class);
        ServiceModel model =service.add(plan);
        result = tojson(model);
        return SUCCESS;
    }
    
    //8.1批量添加电池计划
    public String  addPro(){
        List<BattDischarge_plan> plans = getGson("yyyy-MM-dd HH:mm:ss").fromJson(json,new TypeToken<List<BattDischarge_plan>>(){}.getType());
        ServiceModel model = service.addPro(plans);
        result = tojson(model);
        return SUCCESS;
    }
    public String update(){
        BattDischarge_plan plan = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattDischarge_plan.class);
        ServiceModel model = service.updatePro(plan);///---------
        result = tojson(model);
        return SUCCESS;
    }
    
     //8.1批量修改放电计划的开始时间
    public String updatePro(){
        List<BattDischarge_plan> plans = getGson("yyyy-MM-dd HH:mm:ss").fromJson(json,new TypeToken<List<BattDischarge_plan>>(){}.getType());
        ServiceModel model = service.updatePro(plans);///---------
        result = tojson(model);
        return SUCCESS;
    }
    
    public String del(){
        BattDischarge_plan plan = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattDischarge_plan.class);
        ServiceModel model = service.del(plan);
        result = tojson(model);
        return SUCCESS;
    }
    public String searchAll(){
        ServiceModel model = service.searchAll();
        result = tojson(model);
        return SUCCESS;
    }
    
    //8.1放电计划查询
    public String serchByCondition(){
        Batt_Maint_Dealarm bmd = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, Batt_Maint_Dealarm.class);
        User_inf uinf=(User_inf) ActionUtil.getUser();
        bmd.setUinf(uinf);
        ServiceModel model = service.serchByCondition(bmd);
        result = tojson(model);
        return SUCCESS;
    }
    /*//8.1放电计划管理中查询
    public String serchBattgroupinfo(){
        BattInf binf = ActionUtil.getGson("yyyy-MM-dd").fromJson(json, BattInf.class);
        ServiceModel model = service.serchBattgroupinfo(binf);
        result = tojson(model);
        return SUCCESS;
    }*/
    //8.1放电计划管理中进页面查询
    public String serchBattgroupinfo(){
        User_inf uinf=(User_inf) getUser();
        ServiceModel model = service.serchBattgroupinfo(uinf);
        result = tojson(model);
        return SUCCESS;
    }
    //新版添加放电计划查询<排除设置过放电计划的电池组>
    public String serchBattPlan(){
        BattInf binf= getGson("yyyy-MM-dd HH:mm:ss").fromJson(json,BattInf.class);
        User_inf uinf=(User_inf) getUser();
        binf.setNum(uinf.getUId());
        ServiceModel model = service.serchBattPlan(binf);
        result = tojson(model);
        return SUCCESS;
    }
    //8.1查询未开始放电的放电计划总数
    public String searchNums() {
        User_inf uinf=(User_inf) ActionUtil.getUser();
        ServiceModel model = service.searchNums(uinf);
        result = tojson(model);
        return SUCCESS;
    }
    
     //8.1放电计划管理中饼状图(放电计划统计查询)
    /*BattIndexInFbs:未放电
     *Preset_time:放电延时
     *Preset_cap: 放电完成
     *Preset_monvol:放电进行中
     *Preset_groupvol:放电失败 
     *num: 总数*/
    public String searchState(){
        User_inf uinf=(User_inf) getUser();
        ServiceModel model = service.searchState(uinf);
        result = tojson(model);
        return SUCCESS;
    }
    
    //8.1批量添加作业计划/修改作业计划时时先检测计划的可行性
        /*原则:
             *1.同机房(或设备)同一时间只能一组电池组放电
             *2.同机房(或设备)内电池组放电时间相隔至少3天*/    
    public String judgePlan(){
        List<BattDischarge_plan> listAll= getGson("yyyy-MM-dd HH:mm:ss").fromJson(json,new TypeToken<List<BattDischarge_plan>>(){}.getType());
        ServiceModel model = service.judgePlan(listAll);
        result = tojson(model);
        return SUCCESS;
        
    }
    
    
    public String getResult() {
        return result;
    }
    public void setJson(String json) {
        this.json = json;
    }
    
}