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
167
168
169
170
171
172
173
174
175
176
177
package com.fgkj.controller;
 
import com.fgkj.dto.*;
import com.fgkj.services.Batt_maint_infService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.List;
 
@RequestMapping("battMaintInf")
@RestController
@Api(tags = "battMaintInf接口")
public class Batt_maint_infController{
 
    @Resource
    private Batt_maint_infService service;
 
    /*private Batt_maint_inf bmi;
    private Batt_Maint_Dealarm bd;
    private Batt_User_Permit bup;*/
    //private BattInf binf;
 
    
    //2.1电池故障维护记录查询
    @PostMapping("maint")
    @ApiOperation(notes = "TODO have no data",value="电池故障维护记录查询")
    public ServiceModel serchMaint(@RequestBody Batt_Maint_Dealarm bd){
        System.out.println(bd);
        ServiceModel model=service.serchMaint(bd);//222不带条件查询无数据
        return model;
    }
    
    // 2.2电池故障处理统计查询
    /*
     * maint_result存放统计方式 
     * fault_caption存放维护区 
     * master_check存放包机人 
     * remark存放品牌
     */
    @PostMapping("byCondition")
    @ApiOperation(notes = "TODO have no data",value="电池故障处理统计查询")
    public List serchByCondition(@RequestBody Batt_User_Permit bup){
        // bup= ActionUtil.getGson("yyyy-MM-dd").fromJson(result, Batt_User_Permit.class);
        List list=service.serchByCondition(bup);        
        return list;
    }
    
    //0.3查询所有的维护记录(只传page对象)
    @GetMapping("/")
    @ApiOperation(notes = "TODO have no data",value="查询所有的维护记录(只传page对象)")
    public ServiceModel search(){
        ServiceModel model=service.search();
        return model;
    }
    
    //0.4电池组故障率
    @GetMapping("all")
    @ApiOperation(notes = "newsum 所有故障的电池组;sum 所有的电池组",value="电池组故障率")
    public ServiceModelOnce searchAll(){
 
        return service.searchAll();
    }
    
    //0.4/0.8电池组故障率/维护率(最新)
    @PostMapping("byStationName")
    @ApiOperation(notes = "code 故障维护数;newsum 电池组数;sum 故障数; maint_done 100求故障率",value="电池组故障率/维护率(最新) TODO 待测")
    public ServiceModelOnce searchByStationName(@ApiParam(value = "站点", required = true) @RequestParam String stationName,
                                                @ApiParam(value = "100求故障率/1求维护率/其他全部", required = true) @RequestParam Integer maint_done) {
        Batt_Maint_Dealarm bd = new Batt_Maint_Dealarm();
        BattInf binf = new BattInf();
        binf.setStationName(stationName);
        Batt_maint_inf batt_maint_inf = new Batt_maint_inf();
        batt_maint_inf.setMaint_done(maint_done);
        bd.setMainf(batt_maint_inf);
        bd.setBinf(binf);
        return service.searchByStationName(bd);//数据不足待测
    }
    
    //根据电池组id查询电池的故障信息
    @PostMapping("byBattGroupId")
    @ApiOperation(notes = "TODO have no data",value="电池组id查询电池的故障信息TODO 待测")
    public ServiceModel searchByBattgroupId(@RequestParam Integer battGroupId){
        Batt_maint_inf bmi = new Batt_maint_inf();
        bmi.setBattGroupId(battGroupId);
        ServiceModel model=service.searchByBattgroupId(bmi);// have no data
        return model;
    }
    
    //2.1 电池维护记录查询(编辑记录)
    @PutMapping("/")
    @ApiOperation(notes = "",value="电池维护记录查询(编辑记录)TODO 待完成")
    public ServiceModel update(@RequestBody Batt_maint_inf bmi,@RequestBody List<Batt_maint_process> process) {
        // bmi=ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(result, Batt_maint_inf.class);
        // List<Batt_maint_process> process = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, new TypeToken<List<Batt_maint_process>>(){}.getType());
        ServiceModel model=service.update(bmi,process);
        return model;
    }
    //2.1 电池维护记录查询(删除记录)
    @DeleteMapping("/")
    @ApiOperation(notes = "",value="电池维护记录查询(删除记录)")
    public ServiceModel delete(@RequestParam Integer num){
        // bmi=ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(result, Batt_maint_inf.class);
        Batt_maint_inf bmi = new Batt_maint_inf();
        bmi.setNum(num);
        ServiceModel model=service.delete(bmi);
        return model;
    }
 
 
    /*public static void main(String[] args) throws ParseException {
        Batt_maint_infService us = new Batt_maint_infService();
        
        BattInf binf = new BattInf();
        
         binf.setStationName("");
         binf.setStationName1("");
         binf.setBattGroupName("");
         binf.setBattGroupName1(""); 
         binf.setBattProducer("");
         binf.setMonCapStd(100f); binf.setMonVolStd(12f);
         binf.setBattGroupId(0);
        binf.setStationName("");
        binf.setStationName1("");
        //binf.setBattGroupName("");
        binf.setBattGroupId(0);
        binf.setBattGroupName1("");
        binf.setBattProducer("");
        binf.setMonCapStd(0f);
        binf.setMonVolStd(0f);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date date1 = sdf.parse("2000-01-01");
        Date date2 = sdf.parse("2016-07-14");
        binf.setBattProductDate(ActionUtil.getSimpDate(date1));
        binf.setBattProductDate1(ActionUtil.getSimpDate(date2));
        binf.setBattInUseDate(ActionUtil.getSimpDate(date1));
        binf.setBattInUseDate1(ActionUtil.getSimpDate(date2));
 
        *//*
          binf.getStationName1(), binf.getStationName(),
          binf.getBattGroupName(), binf.getBattProducer(),
          binf.getBattGroupName1(), binf.getBattProductDate(),
          binf.getBattProductDate1(), binf.getBattInUseDate(),
          binf.getBattInUseDate1(),uinf.getuName()
         *//*
 
        Batt_maintenance_inf minf = new Batt_maintenance_inf();
        minf.setRemark("100");
        minf.setMaintenance_time(ActionUtil.getSimpDate(date1));
        minf.setMaintenance_time1(ActionUtil.getSimpDate(date2));
 
        Batttestdata_inf tdata = new Batttestdata_inf();
        tdata.setTest_type(0);
        tdata.setRecord_time(ActionUtil.getSimpDate(date1));
        tdata.setRecord_time1(ActionUtil.getSimpDate(date2));
        
        User_inf uinf=new User_inf();
        uinf.setuName("0");
        
        Page p=new Page();
        p.setPageCurr(1);
        p.setPageSize(1);
        
        Batt_Maint_Dealarm bmd = new Batt_Maint_Dealarm();
        bmd.setBinf(binf);
        bmd.setMinf(minf);
        bmd.setTdata(tdata);
        bmd.setPage(p);
        bmd.setUinf(uinf);
        //List list=us.serchMaint(bmd);
        List list=us.serchByCondition(bmd);
        //System.out.println(list);
    }*/
    
}