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
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
package com.fgkj.services;
 
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
 
import com.fgkj.actions.ActionUtil;
import com.fgkj.dao.BaseDAO;
import com.fgkj.dao.BaseDAOFactory;
import com.fgkj.dao.BattTestData;
import com.fgkj.dao.TestDaoFactory;
import com.fgkj.dao.impl.BattInfAgainImpl;
import com.fgkj.dao.impl.BattInfImpl;
import com.fgkj.dao.impl.Batt_param_lowImpl;
import com.fgkj.db.DBUtil;
import com.fgkj.dto.AllModel;
import com.fgkj.dto.BattInf;
import com.fgkj.dto.Batt_Maint_Dealarm;
import com.fgkj.dto.Batt_maint_inf;
import com.fgkj.dto.Batt_maintenance_inf;
import com.fgkj.dto.Batt_param_low;
import com.fgkj.dto.Battalarm_data;
import com.fgkj.dto.Batttestdata;
import com.fgkj.dto.Batttestdata_inf;
import com.fgkj.dto.Batttestdatastop;
import com.fgkj.dto.Page;
import com.fgkj.dto.ServiceModel;
import com.fgkj.dto.User_battgroup_baojigroup_battgroup;
import com.fgkj.dto.User_inf;
import com.sun.org.apache.bcel.internal.generic.GETSTATIC;
 
public class Batt_Maint_DealarmService{
    private Batt_Maint_Dealarm bd;
    private ServiceModel model;
    private BattInfImpl binf;
    private BattInfServices bservice;
    private Batt_maint_infService maservice;
    private Batttestdata_infService tservice;
    private BatttestdatastopService sservice;
    private Battalarm_dataService aservice;
    private User_infService uservice;
    private BaseDAO dao;
    private BaseDAO daoAgain;
    
    public Batt_Maint_DealarmService() {
        model = new ServiceModel();
        binf = new BattInfImpl();
        bservice = new BattInfServices();
        maservice= new Batt_maint_infService();
        tservice = new Batttestdata_infService();
        sservice = new BatttestdatastopService();
        aservice = new Battalarm_dataService();
        uservice = new User_infService();
        dao=BaseDAOFactory.getBaseDAO(BaseDAO.BATTINF);
        daoAgain=BaseDAOFactory.getBaseDAO(BaseDAO.BATTINFAGIN);
    }
 
    //1.1电池信息统计查询
    public ServiceModel serchByConditionNew(Object obj){
        Batt_Maint_Dealarm bmd = (Batt_Maint_Dealarm) obj;
        List list=((BattInfImpl)dao).serchByConditionNew(bmd);
        if(list!=null&&list.size()>0){
            model.setCode(1);
            model.setData(list);
            model.setMsg("查询成功!");
        }else{
            model.setCode(0);
            model.setMsg("查询失败!");
        }
        return model;
    }
    
    //1.2电池组统计分析查询    
    public List serchLow(Object obj){
        Batt_Maint_Dealarm bmd = (Batt_Maint_Dealarm) obj;
        Batttestdata_inf tdata = bmd.getTdata();//设定时间
        List<BattInf> list=((BattInfImpl)dao).serchByTestType(bmd);
        List<AllModel> listAll=new ArrayList<AllModel>();
        if(list!=null&&list.size()>0){
            for(int i=0;i<list.size();i++){
                BattInf binf=list.get(i);
                tdata.setBattGroupId(binf.getBattGroupId());
                tdata.setGroup_vol(binf.getMonVolStd());//标存电压
                tdata.setTest_cap(binf.getMonCapStd());//标存容量
                tdata.setTest_record_count(binf.getNum());//次数
                //该电池组的放电结果
                ServiceModel tmodel=tservice.serchByTestType(tdata);
                AllModel allmodel=new AllModel();
                allmodel.setData(list.get(i));
                allmodel.setTmodel(tmodel);
                listAll.add(allmodel);
            }
        } 
        return listAll;
    }
 
 
 
     //1.4电池组性能评估
    public List serchGroupAssess(Object obj){
        Batt_Maint_Dealarm bmd = (Batt_Maint_Dealarm) obj;
        Batttestdata_inf tdata = bmd.getTdata();//设定时间
        List<BattInf> list=((BattInfImpl)dao).serchGroupAssess(bmd);
        List<AllModel> listAll=new ArrayList<AllModel>();
        if(list!=null&&list.size()>0){
            for(int i=0;i<list.size();i++){
                BattInf binf=list.get(i);
                tdata.setBattGroupId(binf.getBattGroupId());
                tdata.setGroup_vol(binf.getMonVolStd());//标存电压
                tdata.setTest_cap(binf.getMonCapStd());//标存容量
                //该电池组的放电结果
                ServiceModel tmodel=tservice.serchDischargeTest(tdata);
                
                AllModel allmodel=new AllModel();
                allmodel.setData(list.get(i));
                allmodel.setTmodel(tmodel);
                listAll.add(allmodel);
            }
        } 
        /*for(AllModel a:listAll){
            System.out.println(a.getTmodel().getData());
        }*/
        //System.out.println(listAll.size());
        return listAll;
    }
 
    public static void main(String[] args) throws ParseException {
        BattInf bi = new BattInf();
        bi.setStationName("内蒙古");
        bi.setStationName1("内蒙古");
        bi.setBattGroupId(0);
        //bi.setBattGroupName("");
        bi.setBattGroupName1("");
        bi.setBattProducer("");
        bi.setMonCapStd(0f);
        bi.setMonVolStd(0f);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date date1 = sdf.parse("2000-01-01");
        Date date2 = sdf.parse("2020-01-01");
        bi.setBattProductDate(ActionUtil.getSimpDate(date1));
        bi.setBattProductDate1(ActionUtil.getSimpDate(date2));
        bi.setBattInUseDate(ActionUtil.getSimpDate(date1));
        bi.setBattInUseDate1(ActionUtil.getSimpDate(date2));
 
        Batt_maint_inf mainf = new Batt_maint_inf();
        mainf.setRemark("100");
        mainf.setMaint_done_time(ActionUtil.getSimpDate(date1));
        mainf.setMaint_done_time1(ActionUtil.getSimpDate(date2));
 
        Batttestdata_inf tdata = new Batttestdata_inf();
        tdata.setTest_type(3);
        tdata.setTest_starttype(3);
        tdata.setRecord_time(ActionUtil.getSimpDate(date1));
        tdata.setRecord_time1(ActionUtil.getSimpDate(date2));
        Page p=new Page();
        p.setPageCurr(1);
        p.setPageSize(10);
        User_inf uinf=new User_inf();
        uinf.setUName("0");
        uinf.setUId(1002);
        Batt_Maint_Dealarm bmd = new Batt_Maint_Dealarm();
        bmd.setBinf(bi);
        bmd.setMainf(mainf);
        bmd.setTdata(tdata);
        bmd.setPage(p);
        bmd.setUinf(uinf);
        
        Batt_Maint_DealarmService bs =new Batt_Maint_DealarmService();
        bs.serchByConditionNew(bmd);
        //bs.serchLow(bmd);
        //bs.serchByCondition(bmd);
        
    }
}