perryhsu
2020-10-17 a543f4de1c91ef6f43aace92975c6cf28de23618
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
package com.fgkj.controller.Ld9;
 
import com.fgkj.dto.BattInf;
import com.fgkj.dto.LD9_setparam;
import com.fgkj.dto.ServiceModel;
import com.fgkj.dto.User_log;
import com.fgkj.mapper.FBS9100_ComBase;
import com.fgkj.mapper.UinfDaoFactory;
import com.fgkj.services.Ld9.LD9_setparamService;
import com.fgkj.services.User_logService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
@RequestMapping("ld9SetParam")
@RestController
@Api
public class LD9_setparamController{
 
    @Autowired
    private LD9_setparamService service;
 
    @Autowired
    private User_logService uservice;
 
    ///根据设备id和单体编号查询参数
    @GetMapping("byCondition")
    public ServiceModel serchByCondition(@RequestBody  BattInf binf) {
        // BattInf binf=ActionUtil.getGson().fromJson(json, BattInf.class);
        ServiceModel model=service.serchByCondition(binf);
        return model;
    }
    //根据设备id修改参数
    @PutMapping("dev_id")
    public ServiceModel update(@RequestBody LD9_setparam ld9) {
        // LD9_setparam ld9=ActionUtil.getGson().fromJson(json, LD9_setparam.class);
        ServiceModel model=service.update(ld9);
        {   String msg="";
            if(ld9.getNum()==FBS9100_ComBase.CMD_SetDischargeParm){
                 msg="修改"+ld9.getDev_id()+"的设备放电参数";
            }else if(ld9.getNum()==FBS9100_ComBase.CMD_Start){
                 msg="启动"+ld9.getDev_id()+"的设备放电";
            }else if(ld9.getNum()==FBS9100_ComBase.CMD_StartRES){
                 msg="启动"+ld9.getDev_id()+"的设备内阻测试";
            }else if(ld9.getNum()==FBS9100_ComBase.CMD_Stop){
                 msg="停止"+ld9.getDev_id()+"的设备放电";
            }
            User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Alter, msg);
            uservice.add(ulog);//将用户的操作记录下来
            }
        return model;
    }
 
    //右键查看参数和弹出框的刷新按钮
    @GetMapping("devId")
    public ServiceModel serchbyDev_id(@RequestBody LD9_setparam ld9) {
        // LD9_setparam ld9=ActionUtil.getGson().fromJson(json, LD9_setparam.class);
        ServiceModel model = service.serchbyDev_id(ld9);
        return model;
    }
    
    
    //根据电池组id查询电池组内前五的内阻数据
    @GetMapping("byThirdBatt")
    public ServiceModel serchByThirdBatt(@RequestBody BattInf binf){
        // BattInf binf = ActionUtil.getGson().fromJson(json, BattInf.class);
        ServiceModel model = service.serchByThirdBatt(binf);
        return model;
    }
 
}