1
81041
2019-06-20 ab3c4acf83f54f8449ca8664c4a2bb79bd30f297
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
package com.fgkj.services;
 
import java.util.List;
 
import com.fgkj.dao.BaseDAO;
import com.fgkj.dao.BaseDAOFactory;
import com.fgkj.dao.impl.Batt_attentionImpl;
import com.fgkj.dao.impl.BatttestdatastopDAOImpl;
import com.fgkj.dto.BattInf;
import com.fgkj.dto.Batt_Maint_Dealarm;
import com.fgkj.dto.Page;
import com.fgkj.dto.ServiceModel;
 
public class Batt_attentionService {
    private BaseDAO dao;
    private ServiceModel model;
    
    public Batt_attentionService() {
        super();
        model=new ServiceModel();
        dao=BaseDAOFactory.getBaseDAO(BaseDAO.BATT_ATTENTION);
    }
    //添加关注
    public ServiceModel add(Object obj) {
        Boolean bl = dao.add(obj);
        if (bl) {
            model.setCode(1);
            model.setMsg("添加成功!");
        } else {
            model.setMsg("添加失败!");
        }
        return model;
 
    }
 
    public ServiceModel update(Object obj) {
        Boolean bl = dao.update(obj);
        if (bl) {
            model.setCode(1);
            model.setMsg("修改成功!");
        } else {
            model.setMsg("修改失败!");
        }
        return model;
    }
    //取消关注
    public ServiceModel delete(Object obj) {
        Boolean bl = dao.del(obj);
        if (bl) {
            model.setCode(1);
            model.setMsg("删除成功!");
        } else {
            model.setMsg("删除失败!");
        }
        return model;
    }
    //根据电池组的筛选条件,查询单体的实际电压
    public ServiceModel serchByCondition(Object obj) {
        List<BattInf> list = dao.serchByCondition(obj);
        if(list!=null&&list.size()>0){
            for (int i=0;i<list.size();i++) {
                BattInf binf=list.get(i);
                //最近一笔的实际容量
                double realcap=(new BatttestdatastopDAOImpl()).serchRealCapByMon_num(binf);
                binf.setMonSerStd((float) realcap);//实际容量
            }
            model.setCode(1);
            model.setData(list);
            model.setMsg("查询成功!");
        }else{
            model.setCode(0);
            model.setMsg("查询失败!");
        }
        //System.out.println(list);
        return model;
    }
     //关注之前识别是否关注过
    public ServiceModel judgeInOrNot(Object obj) {
        int flag = ((Batt_attentionImpl)dao).judgeInOrNot(obj);
        if (flag==1) {
            model.setCode(1);
            model.setMsg("该信息已经被关注!");
        }else{
            model.setCode(0);
            model.setMsg("该信息未被关注!");
        }
        return model;
    }
    
    public static void main(String[] args) {
        Batt_attentionService bservice=new Batt_attentionService();
        BattInf binf=new BattInf();
        binf.setStationName("");
        binf.setStationName1("");
        binf.setBattGroupId(0);
        binf.setMonNum(0);
        binf.setNum(1002);
        Page page=new Page();
        page.setPageCurr(1);
        page.setPageSize(10);
        
        Batt_Maint_Dealarm bmd=new Batt_Maint_Dealarm();
        bmd.setBinf(binf);
        bmd.setPage(page);
        bservice.serchByCondition(bmd);
    }
}