whycrzg
2021-02-23 351b9a53cb9ecebdf8f79db0117f540d9c42c2a4
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
package com.fgkj.controller;
 
import com.fgkj.util.*;
 
import com.fgkj.dto.*;
import com.fgkj.services.BattDischarge_planService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
import javax.annotation.Resource;
 
@RequestMapping("battDischargePlan")
@RestController
@Api(tags = "battDischargePlan接口")
public class BattDischarge_planController{
 
    @Resource
    private BattDischarge_planService service;
 
    @PostMapping("/")
    @ApiOperation(notes = "{ \"battgroupid\": 1000002, \"battIndexInFbs\": 0, \"discharge_starttime\": \"2020-12-30 11:04:21\", \"discharge_starttime1\": \"2020-12-30 11:04:21\", \"discharge_stoptime\": \"2020-12-30 11:04:21\", \"discharge_stoptime1\": \"2020-12-30 11:04:21\", \"discharge_state\": 0, \"discharge_reason\": 0, \"discharge_cleartype\": 0, \"preset_time\": 0, \"preset_cap\": 0.0, \"preset_monvol\": 0.0, \"preset_groupvol\": 0.0, \"preset_curr\": 0.0, \"preset_mon\": 0, \"dcvolhighlimit\": 0.0, \"chargecurrset\": 0.0, \"plan_circle\": 0, \"plan_rate\": 0, \"note\": \"\" }",value="新增")
    public ServiceModel add(@RequestBody BattDischarge_plan plan){
        // BattDischarge_plan plan = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattDischarge_plan.class);
        ServiceModel model =service.add(plan);
 
        return model;
    }
 
    //8.1批量添加电池计划
    @PostMapping("/batch")
    @ApiOperation(notes = "[{ \"battgroupid\": 1000002, \"battIndexInFbs\": 0, \"discharge_starttime\": \"2020-12-30 11:04:21\", \"discharge_starttime1\": \"2020-12-30 11:04:21\", \"discharge_stoptime\": \"2020-12-30 11:04:21\", \"discharge_stoptime1\": \"2020-12-30 11:04:21\", \"discharge_state\": 0, \"discharge_reason\": 0, \"discharge_cleartype\": 0, \"preset_time\": 0, \"preset_cap\": 0.0, \"preset_monvol\": 0.0, \"preset_groupvol\": 0.0, \"preset_curr\": 0.0, \"preset_mon\": 0, \"dcvolhighlimit\": 0.0, \"chargecurrset\": 0.0, \"plan_circle\": 0, \"plan_rate\": 0, \"note\": \"\" }]",value="批量添加电池计划")
    public ServiceModel  addPro(@RequestBody List<BattDischarge_plan> list){
        // List<BattDischarge_plan> plans = getGson("yyyy-MM-dd HH:mm:ss").fromJson(json,new TypeToken<List<BattDischarge_plan>>(){}.getType());
        ServiceModel model = service.addPro(list);
 
        return model;
    }
 
    @PutMapping("/")
    @ApiOperation(notes = "{ \"num\": 11, \"battgroupid\": 0, \"battIndexInFbs\": 0, \"discharge_starttime\": \"2020-12-31 11:52:56\", \"discharge_starttime1\": \"2020-12-31 11:52:56\", \"discharge_stoptime\": \"2020-12-31 11:52:56\", \"discharge_stoptime1\": \"2020-12-31 11:52:56\", \"discharge_state\": 0, \"discharge_reason\": 0, \"discharge_cleartype\": 0, \"preset_time\": 0, \"preset_cap\": 0.0, \"preset_monvol\": 0.0, \"preset_groupvol\": 0.0, \"preset_curr\": 0.0, \"preset_mon\": 0, \"dcvolhighlimit\": 0.0, \"chargecurrset\": 0.0, \"plan_circle\": 0, \"plan_rate\": 0, \"note\": \"\" }",value="修改")
    public ServiceModel update(@RequestBody BattDischarge_plan plan){
        // BattDischarge_plan plan = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattDischarge_plan.class);
        ServiceModel model = service.update(plan);///---------
 
        return model;
    }
 
     //8.1批量修改放电计划的开始时间
    @PutMapping("/batch")
    @ApiOperation(notes = "[{ \"num\":1, \"battgroupid\": 1000002, \"battIndexInFbs\": 0, \"discharge_starttime\": \"2020-12-30 11:04:21\", \"discharge_starttime1\": \"2020-12-30 11:04:21\", \"discharge_stoptime\": \"2020-12-30 11:04:21\", \"discharge_stoptime1\": \"2020-12-30 11:04:21\", \"discharge_state\": 0, \"discharge_reason\": 0, \"discharge_cleartype\": 0, \"preset_time\": 0, \"preset_cap\": 0.0, \"preset_monvol\": 0.0, \"preset_groupvol\": 0.0, \"preset_curr\": 0.0, \"preset_mon\": 0, \"dcvolhighlimit\": 0.0, \"chargecurrset\": 0.0, \"plan_circle\": 0, \"plan_rate\": 0, \"note\": \"\" }]",value="批量修改放电计划的开始时间")
    public ServiceModel updatePro(@RequestBody List<BattDischarge_plan> plans){
        // List<BattDischarge_plan> plans = getGson("yyyy-MM-dd HH:mm:ss").fromJson(json,new TypeToken<List<BattDischarge_plan>>(){}.getType());
        ServiceModel model = service.updatePro(plans);///---------
 
        return model;
    }
 
    @DeleteMapping("/")
    @ApiOperation(notes = "",value="删除")
    public ServiceModel del(@RequestParam Integer num) {
        BattDischarge_plan plan = new BattDischarge_plan();
        plan.setNum(num);
        ServiceModel model = service.del(plan);
 
        return model;
    }
 
    @GetMapping("all")
    @ApiOperation(notes = "",value="all")
    public ServiceModel searchAll(){
        ServiceModel model = service.searchAll();
 
        return model;
    }
 
    //8.1放电计划查询
    @PostMapping("byCondition")
    @ApiOperation(notes = "{ \"binf\": { \"stationName\": \"\", \"stationName1\": \"\", \"battGroupId\": 0 },\"pageBean\": { \"pageSize\": 3, \"pageNum\": 0 },\"bplan\": { \"discharge_starttime\": \"2001-02-01 08:16:35\", \"discharge_starttime1\": \"2021-02-01 08:16:35\", \"discharge_state\": 0 } }",value="放电计划查询")
    public ServiceModel serchByCondition(@RequestBody Batt_Maint_Dealarm bmd){
        User_inf uinf=(User_inf) ActionUtil.getUser();
        bmd.setUinf(uinf);
        ServiceModel model = service.serchByCondition(bmd);
 
        return model;
    }
    /*//8.1放电计划管理中查询
    public ServiceModel serchBattgroupinfo(){
        BattInf binf = ActionUtil.getGson("yyyy-MM-dd").fromJson(json, BattInf.class);
        ServiceModel model = service.serchBattgroupinfo(binf);
 
        return model;
    }*/
 
    //8.1放电计划管理中进页面查询
    @GetMapping("battGroupInfo")
    @ApiOperation(notes = "",value="放电计划管理中进页面查询")
    public ServiceModel serchBattgroupinfo(){
        User_inf uinf=(User_inf) ActionUtil.getUser();
        ServiceModel model = service.serchBattgroupinfo(uinf);
 
        return model;
    }
 
 
    //新版添加放电计划查询<排除设置过放电计划的电池组>
    @PostMapping("battPlan")
    @ApiOperation(notes = "stationId 等四个参数为模糊查询 结果集:{ \"code\": 1, \"msg\": \"查询成功!\", \"data\": [{ \"stationId\": \"42010007\", \"stationName\": \"山西省-太原市-迎泽区-局机房119-局机房站-1\", \"fbsDeviceId\": 910000001\"fparam\": { \"hourRate\": 0, \"disCurr\": 0, \"disCap\": 0, \"disTime\": 0, \"groupVol_Low\": 0, \"monomerVol_Low\": 0, \"monomerLowCount\": 0, \"battGroupNum\": 0, \"onlineLowAction\": 0, \"dCVolHighLimit\": 0, \"chargeCurrSet\": 0, \"offLineYH_Cycle\": 0, \"offLineYHTimes\": 0, \"offLineYHOnceCycle\": 0, \"onLineVol_Low\": 0 } }]}",value="新版添加放电计划查询<排除设置过放电计划的电池组>")
    public ServiceModel serchBattPlan(@RequestParam String stationId,@RequestParam String stationName1,@RequestParam String stationName2,@RequestParam String stationName5) {
        BattInf binf = new BattInf();
        User_inf uinf = (User_inf) ActionUtil.getUser();
        binf.setNum(uinf.getuId());
        binf.setStationId(stationId);
        binf.setStationName1(stationName1);
        binf.setStationName2(stationName2);
        binf.setStationName5(stationName5);
        ServiceModel model = service.serchBattPlan(binf);
 
        return model;
    }
    //8.1查询未开始放电的放电计划总数
    @GetMapping("nums")
    @ApiOperation(notes = "",value="查询未开始放电的放电计划总数")
    public ServiceModelOnce searchNums() {
        User_inf uinf = (User_inf) ActionUtil.getUser();
        ServiceModelOnce model = service.searchNums(uinf);
 
        return model;
    }
    
     //8.1放电计划管理中饼状图(放电计划统计查询)
    /*BattIndexInFbs:未放电
     *Preset_time:放电延时
     *Preset_cap: 放电完成
     *Preset_monvol:放电进行中
     *Preset_groupvol:放电失败 
     *num: 总数*/
    @GetMapping("state")
    @ApiOperation(notes = "",value="放电计划管理中饼状图(放电计划统计查询)")
    public ServiceModelOnce searchState() {
        User_inf uinf = (User_inf) ActionUtil.getUser();
        ServiceModelOnce model = service.searchState(uinf);
 
        return model;
    }
    
    //8.1批量添加作业计划/修改作业计划时时先检测计划的可行性
        /*原则:
             *1.同机房(或设备)同一时间只能一组电池组放电
             *2.同机房(或设备)内电池组放电时间相隔至少3天*/
    @PostMapping("/judgePlan")
    @ApiOperation(notes = "原则:\n" +
            "\t\t\t *1.同机房(或设备)同一时间只能一组电池组放电\n" +
            "\t\t\t *2.同机房(或设备)内电池组放电时间相隔至少3天",value="批量添加作业计划/修改作业计划时时先检测计划的可行性")
    public ServiceModelOnce judgePlan(@RequestBody List<BattDischarge_plan> listAll){
        // List<BattDischarge_plan> listAll= getGson("yyyy-MM-dd HH:mm:ss").fromJson(json,new TypeToken<List<BattDischarge_plan>>(){}.getType());
        ServiceModelOnce model = service.judgePlan(listAll);
 
        return model;
        
    }
 
}