whychw
2021-05-24 8e85954e958bcb1bba811884dbc9cde65e94aa04
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
package com.fgkj.actions;
 
import java.io.File;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
 
import com.fgkj.dao.CsvUtil;
import com.fgkj.dao.UinfDaoFactory;
import com.fgkj.dao.impl.Batt_realdataImpl;
import com.fgkj.dao.impl.BattcurrdataImpl;
import com.fgkj.dao.impl.BatttestdataDAOImpl;
import com.fgkj.dto.Batt_realdata;
import com.fgkj.dto.Battcurrdata;
import com.fgkj.dto.Batttestdata;
import com.fgkj.dto.CsvFile;
import com.fgkj.dto.MyFile;
import com.fgkj.dto.User_log;
import com.fgkj.dynamicload.dto.Dynamicload_realdata;
import com.fgkj.dynamicload.impl.Dynamicload_realdataImpl;
import com.fgkj.electric2mwsystem.Impl.Electric2mw_realdataImpl;
import com.fgkj.electric2mwsystem.dto.Electric2mw_realdata;
import com.fgkj.electricsystem.Impl.Electric_realhist_dataImpl;
import com.fgkj.electricsystem.dto.Electric_realhist_data;
import com.fgkj.elemachinery.dto.Motor_readdata;
import com.fgkj.elemachinery.impl.Motor_readdataImpl;
import com.fgkj.partinsystem.dto.Ac230v_ups;
import com.fgkj.partinsystem.dto.AcDistribution;
import com.fgkj.partinsystem.dto.Acinsulation;
import com.fgkj.partinsystem.dto.Battery_monitor;
import com.fgkj.partinsystem.dto.Cabin_board;
import com.fgkj.partinsystem.dto.Dc230v_batt;
import com.fgkj.partinsystem.dto.Dc25v_batt;
import com.fgkj.partinsystem.dto.DcDistribution;
import com.fgkj.partinsystem.dto.Dcinsulation;
import com.fgkj.partinsystem.dto.Electrical_monitor_station;
import com.fgkj.partinsystem.dto.Inverter_ele;
import com.fgkj.partinsystem.dto.Propulsion_motor;
import com.fgkj.partinsystem.dto.Reliable_board;
import com.fgkj.partinsystem.dto.Switch_board;
import com.fgkj.partinsystem.impl.Ac230v_upsImpl;
import com.fgkj.partinsystem.impl.AcDistributionImpl;
import com.fgkj.partinsystem.impl.AcinsulationImpl;
import com.fgkj.partinsystem.impl.Battery_monitorImpl;
import com.fgkj.partinsystem.impl.Cabin_boardImpl;
import com.fgkj.partinsystem.impl.Dc230v_battImpl;
import com.fgkj.partinsystem.impl.Dc25v_battImpl;
import com.fgkj.partinsystem.impl.DcDistributionImpl;
import com.fgkj.partinsystem.impl.DcinsulationImpl;
import com.fgkj.partinsystem.impl.Electrical_monitor_stationImpl;
import com.fgkj.partinsystem.impl.Inverter_eleImpl;
import com.fgkj.partinsystem.impl.Propulsion_motorImpl;
import com.fgkj.partinsystem.impl.Reliable_boardImpl;
import com.fgkj.partinsystem.impl.Switch_boardImpl;
import com.fgkj.services.ServiceModel;
import com.fgkj.services.User_logService;
import com.fgkj.watersystem.Impl.Water_realdataImpl;
import com.fgkj.watersystem.dto.Water_realdata;
import com.google.gson.reflect.TypeToken;
import com.partinsystem.udpall.dto.Partin_elemonitor;
import com.partinsystem.udpall.impl.Partin_elemonitorImpl;
 
public class CsvFileDownloadAction extends ActionUtil{
    private String json;
    private String result;
    //private static String path="d:/tomcat7_csv/";
    
    //下载服务器CSV文件<陪试设备>
    public String  searchDownloadFile(){
        ActionUtil.getSession().setAttribute("percent",0);//导出文件先清空百分比
        CsvFile  cs=ActionUtil.getGson(ActionUtil.time_yyyyMMddHHmmss).fromJson(json, CsvFile.class);
        String loadpath = ActionUtil.getSession().getServletContext().getRealPath("/");
        //String str = new File(loadpath).getParentFile().getAbsolutePath();
        String str = new File(loadpath).getAbsolutePath();
        String path=str+File.separator+"tomcat7_csv"+File.separator;
        ServiceModel model=new ServiceModel();
        String msg="";
        if(cs.getExport_num()==1){
            String state="时间(HH:MM:SS),FZ按钮1,FZ按钮2,FZ按钮3,FZ按钮4,FZ按钮5,FZ按钮6,FZ按钮7,FZ按钮8,FZ按钮9,FZ按钮10,FZ按钮11"
                    + ",启动自动加载,停止自动加载,突加突卸,全部分闸,实际设定功率,已输出功率,设定功率,间隔时间s,实际电流,实际电压,是否合闸"
                    + ",FZ自动状态1,FZ自动状态2,FZ自动状态3,FZ自动状态4,FZ自动状态5,电抗超温,冷却水超温,冷却水液位低,冷却水压高,就地控制"
                    + ",后台控制,中控控制,开关柜状态,中间量M200,风机按钮,风机输出,是否允许合闸";
            cs.setStates(state);
            createFileCsv(cs,path);
            model=searchStationSource(cs,path);
        }else if(cs.getExport_num()==2){
            String state="时间(HH:MM:SS),加载电机功率,加载电机转速,加载电机转矩,加载电机电流(A),加载电机电压(V),加载功率给定,加载转矩给定,加载电机转速限制,加载电机转矩限制,加载步长"
                    + ",加载电机水冷进水风温,加载电机水冷出水风温,加载电机绕组温度1,加载电机绕组温度2,加载电机绕组温度3,加载电机轴承温度1,加载电机轴承温度2,加载电机出口温度,加载电机进口温度"
                    + ",加载电机启动,加载电机停机,加载,减载,手动加载,加载电机紧停,加载电机风机状态,备用加载电机绕组温度1,备用加载电机绕组温度2,备用加载电机绕组温度3,传感器转矩,传感器功率,故障确认"
                    + ",齿轮箱轴功率,推进轴功率,齿轮箱轴承温度1,齿轮箱轴承温度2,齿轮箱轴承温度3,齿轮箱轴承温度4,齿轮箱轴承温度5,齿轮箱轴承温度6,油站启动,油站停机,功率控制,转矩控制,变压器高温报警"
                    + ",变压器高温故障,变压器缺相报警,润滑泵1运行,润滑泵2运行,润滑允许远程访问,遥控/就地,变频器就绪,变频器运行,变频器报警,变频器故障,润滑允许主机运行,主开关状态"
                    + ",受试电机运行,受试电机报警,受试电机故障,受试电机紧停,润滑故障,润滑报警";
            cs.setStates(state);
            createFileCsv(cs,path);
            model=searchStationSource(cs,path);
        }else if(cs.getExport_num()==3){
            String state="时间(HH:MM:SS),单体编号,在线电压(V),组端电压(V),测试电流(A),单体电压(V),单体温度(℃)";
            cs.setStates(state);
            createFileCsv(cs,path);
            model=searchStationSource(cs,path);
        }else if(cs.getExport_num()==4){
            String state="时间(HH:MM:SS),直流电压(V),直流电流(A),控制角(°)";
            cs.setStates(state);
            createFileCsv(cs,path);
            model=searchStationSource(cs,path);
        }else if(cs.getExport_num()==5){
            String state="时间(HH:MM:SS),P01主泵运行,P11补水泵运行,P12试压泵运行,P13补气泵运行,H01电加热器运行,H02电加热器运行,电磁阀开限位,电磁阀关限位,阀打开,排气阀打开"
                    + ",远程启动水冷系统,远程停止水冷系统,被冷却器件投运,水冷系统自动控制状态,水冷系统手动控制状态,水冷系统远程控制状态,水冷系统运行,冷却水流量,供水温度,供水压力"
                    + ",回水温度,回水压力,冷却水电导率,缓冲罐液位,缓冲罐压力,阀厅湿度,阀厅温度,外水温度,外水压力"
                    + ",1#支路流量,2#支路流量,3#支路流量,4#支路流量,5#支路流量,6#支路流量,7#支路流量,8#支路流量,9#支路流量"
                    + ",1#支路温度,2#支路温度,3#支路温度,4#支路温度,5#支路温度,6#支路温度,7#支路温度,8#支路温度,9#支路温度"
                    + ",1#支路压力,2#支路压力,3#支路压力,4#支路压力,5#支路压力,6#支路压力,7#支路压力,8#支路压力,9#支路压力";
            cs.setStates(state);
            createFileCsv(cs,path);
            model=searchStationSource(cs,path);
        }else if(cs.getExport_num()==6){
            String state="时间(HH:MM:SS),分直流电压(V),分直流电流(A),总直流电压(V),总直流电流(A),控制角(°)";
            cs.setStates(state);
            createFileCsv(cs,path);
            model=searchStationSource(cs,path);
        }else if(cs.getExport_num()==7){
            String state="时间(HH:MM:SS.sss),组端电流";
            cs.setStates(state);
            createFileCsv(cs,path);
            model=searchStationSource(cs,path);
        }else if(cs.getExport_num()==8){
            String state="时间(HH:MM:SS),组端电压(V),在线电压(V),组端电流(A)";
            cs.setStates(state);
            createFileCsv(cs,path);
            model=searchStationSource(cs,path);
        }else{
            model.setCode(0);
            model.setMsg("导出文件页面匹配不上");
        }
        result=tojson(model);
        return SUCCESS;
    }
    
    //导出文件时服务器生成CSV
    public  void createFileCsv(Object obj,String path){
         CsvFile cs=(CsvFile) obj;
         //List exportData = new ArrayList<Map>();  
         //文件名=生产的文件名称+时间戳
         String fileName = cs.getDev_name()+cs.getTable_name();
         //列名
         LinkedHashMap map = new LinkedHashMap();
         String[] state=cs.getStates().split(",");
        /* List<String> tabTh = new ArrayList<String>();
         for(int i=0;i<state.length;i++){
            tabTh.add(state[i]);
         }*/
         for(int i=0;i<state.length;i++){
            map.put(i+1, state[i]);
         }
         //获取数据
         List exportData =new ArrayList();
         if(cs.getExport_num()==1){
             Dynamicload_realdata drd=new Dynamicload_realdata();
             drd.setDev_id(cs.getDev_id());
             drd.setRecord_time(cs.getRecord_time());
             exportData=(new Dynamicload_realdataImpl()).serchByInfo(drd);
             
         }else if(cs.getExport_num()==2){
             Motor_readdata mread=new Motor_readdata();
             mread.setMotor_id(cs.getDev_id());
             mread.setRecord_time(cs.getRecord_time());
             exportData=(new Motor_readdataImpl()).serchByInfo(mread);
         }else if(cs.getExport_num()==3){
             Batttestdata btd=new Batttestdata();
             btd.setBattGroupId(cs.getDev_id());
             btd.setTest_record_count(cs.getTest_record_count());
             exportData=(new BatttestdataDAOImpl()).serchByInfo(btd);
         }else if(cs.getExport_num()==4){
             Electric_realhist_data ereal=new Electric_realhist_data();
             ereal.setElectric_id(cs.getDev_id());
             ereal.setRecord_time(cs.getRecord_time());
             exportData=(new Electric_realhist_dataImpl()).serchByInfo(ereal);
         }else if(cs.getExport_num()==5){
             Water_realdata wreal=new Water_realdata();
             wreal.setWater_id(cs.getDev_id());
             wreal.setRecord_time(cs.getRecord_time());
             exportData=(new Water_realdataImpl()).serchByInfo(wreal);
         }else if(cs.getExport_num()==6){
             Electric2mw_realdata ereal2=new Electric2mw_realdata();
             ereal2.setElectric2KW_id(cs.getDev_id());
             ereal2.setRecord_time(cs.getRecord_time());
             exportData=(new Electric2mw_realdataImpl()).serchByInfo(ereal2);
         }else if(cs.getExport_num()==7){
             Battcurrdata bcd=new Battcurrdata();
             bcd.setBattGroupId(cs.getDev_id());
             bcd.setTest_record_count(cs.getTest_record_count());
             exportData=(new BattcurrdataImpl()).serchByInfo(bcd);
         }else if(cs.getExport_num()==8){
             Batt_realdata brd=new Batt_realdata();
             brd.setBattGroupId(cs.getDev_id());
             brd.setRecord_time(cs.getRecord_time());
             exportData=(new Batt_realdataImpl()).serchByInfo(brd);
         }
         if(exportData==null&&exportData.size()<=0){
             Map row = new LinkedHashMap<String, String>();
             row.put(1, "");
             for(int i=0;i<state.length;i++){
                row.put(2+i,"");
             } 
             exportData.add(row);
         }
         {
                String msg="导出了"+cs.getDev_name()+"历史数据";
                User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Export,cs.getExport_num(), msg);
                User_logService uservice=new User_logService();
                uservice.add(ulog);//将用户的操作记录下来
         }
         CsvUtil.createCSVFile2(exportData, map, path, fileName);
    }
    
    /**
     * 
     *     获取指定机房得资源
     */
    public ServiceModel searchStationSource(Object obj,String path){
        CsvFile cs=(CsvFile) obj;
        String filesource=path;
        String filename=cs.getDev_name()+cs.getTable_name()+".csv";
        ServiceModel model=new ServiceModel();
        File source = new File(filesource);
        File[] files = source.listFiles();
        if(files!=null && files.length>0){
            List myfiles = new ArrayList<MyFile>();
            for(int i=0;i<files.length;i++){
                MyFile myfile = new MyFile();
                if(files[i].isFile()&&files[i].getName().equals(filename)){
                    myfile.setFile(files[i]);
                    myfiles.add(myfile);
                }
            }
            if(myfiles.size() > 0){
                model.setCode(1);
                model.setData(myfiles);
                model.setMsg("读取成功");
            }
        }else{
            model.setCode(0);
            model.setMsg("读取不成功");
        }
        return model;
    }
    
    
    //参试设备历史数据下载
    public String  searchDownloadFile_partinsystem(){
        ActionUtil.getSession().setAttribute("percent",0);//导出文件先清空百分比
        CsvFile  cs=ActionUtil.getGson(ActionUtil.time_yyyyMMddHHmmss).fromJson(json, CsvFile.class);
        String loadpath = ActionUtil.getSession().getServletContext().getRealPath("/");
        //String str = new File(loadpath).getParentFile().getAbsolutePath();
        String str = new File(loadpath).getAbsolutePath();
        String path=str+File.separator+"tomcat7_csv"+File.separator;
        ServiceModel model=new ServiceModel();
        String msg="";
        if(cs.getExport_num()>=7){
            createFileCsv_partinsystem(cs,path);
            model=searchStationSource(cs,path);
        /*}else if(cs.getExport_num()==8){
            createFileCsv_partinsystem(cs,path);
            model=searchStationSource(cs,path);
        }else if(cs.getExport_num()==9){
            createFileCsv_partinsystem(cs,path);
            model=searchStationSource(cs,path);
        }else if(cs.getExport_num()==10){
            createFileCsv_partinsystem(cs,path);
            model=searchStationSource(cs,path);
        }else if(cs.getExport_num()==11){
            createFileCsv_partinsystem(cs,path);
            model=searchStationSource(cs,path);
        }else if(cs.getExport_num()==12){
            createFileCsv_partinsystem(cs,path);
            model=searchStationSource(cs,path);
        }else if(cs.getExport_num()==13){
            createFileCsv_partinsystem(cs,path);
            model=searchStationSource(cs,path);
        }else if(cs.getExport_num()==14){
            createFileCsv_partinsystem(cs,path);
            model=searchStationSource(cs,path);
        }else if(cs.getExport_num()==15){
            createFileCsv_partinsystem(cs,path);
            model=searchStationSource(cs,path);
        }else if(cs.getExport_num()==16){
            createFileCsv_partinsystem(cs,path);
            model=searchStationSource(cs,path);
        }else if(cs.getExport_num()==17){
            createFileCsv_partinsystem(cs,path);
            model=searchStationSource(cs,path);
        }else if(cs.getExport_num()==18){
            createFileCsv_partinsystem(cs,path);
            model=searchStationSource(cs,path);*/
        }else{
            model.setCode(0);
            model.setMsg("导出文件页面匹配不上");
        }
        result=tojson(model);
        return SUCCESS;
    }
    //导出文件时服务器生成CSV<参试设备>
    public  void createFileCsv_partinsystem(Object obj,String path){
         CsvFile cs=(CsvFile) obj;
         //List exportData = new ArrayList<Map>();  
         //文件名=生产的文件名称+时间戳
         String fileName = cs.getDev_name()+cs.getTable_name();
         //列名
         LinkedHashMap map = new LinkedHashMap();
         String stateString=cs.getStates();
         String switchString1="Q100,Q101,Q102,Q103,Q108,Q112,Q113,Q120"
                 + ",Q122,Q200,Q202,Q204,Q208,Q211,Q212,Q213"
                 + ",Q220,Q300,Q301,Q303,Q309,Q344,Q400,Q402"
                 + ",Q403,Q404,Q409,Q433,Q11,Q12,Q15,Q17";
         String switchString2="Q18,Q19,Q20,Q22,Q26,Q27,Q28,Q29"
                 + ",Q30,Q33,Q35,Q37,Q38,Q43,Q44,Q46"
                 + ",Q47,Q48,Q10,Q53,Q56,Q40,Q62,Q65";
         String switchString3="1#可靠配电板Q51,AC20的Q10,AC51的Q2,AC51的Q4,AC52的Q1,AC52的Q6,AC53的Q3"
                 + ",AC60的Q1,AR11的Q8,AR12的Q2,AR12的Q3,AR12的Q4,AR12的Q5,AR12的Q6,AR13的Q1,AR23的Q1"
                 + ",AR23的Q2,AR23的Q3,AR23的Q4,AR23的Q6";
         String switchString4="Q11,Q22,Q29,Q33,Q44,Q59,Q55,Q57,Q58,Q67,Q68,AR11的Q5,AR11的Q6,AR21的Q11,AR23的Q5";
         if(stateString.contains("开关量1")) {
             stateString=stateString.replaceAll("开关量1", switchString1);
         }
         if(stateString.contains("开关量2")) {
             stateString=stateString.replaceAll("开关量2", switchString2);
         }
         if(stateString.contains("开关量3")) {
             stateString=stateString.replaceAll("开关量3", switchString3);
         }
         if(stateString.contains("开关量4")) {
             stateString=stateString.replaceAll("开关量4", switchString4);
         }
         //System.out.println(stateString);
         String[] state=stateString.split(",");
         map.put(1, "时间(HH:MM:SS)");
         for(int i=0;i<state.length;i++){
            map.put(i+2,state[i]);
         }
         //获取数据
         List exportData =new ArrayList();
         if(cs.getExport_num()==7){                   //逆变电源
             Inverter_ele ie=new Inverter_ele();
             ie.setDev_id(cs.getDev_id());
             ie.setRecord_time(cs.getRecord_time());
             ie.setRecord_time1(cs.getRecord_time1());
             ie.setNote(cs.getTablists());//取得列名
             exportData=(new Inverter_eleImpl()).serchCSV(ie);
         }else if(cs.getExport_num()==8){            //电气综合监控台
             Electrical_monitor_station ems=new Electrical_monitor_station();
             ems.setDev_id(cs.getDev_id());
             ems.setRecord_time(cs.getRecord_time());
             ems.setRecord_time1(cs.getRecord_time1());
             ems.setNote(cs.getTablists());
             exportData=(new Electrical_monitor_stationImpl()).serchCSV(ems);
         }else if(cs.getExport_num()==9){           //DC230V电源
             Dc230v_batt dc=new Dc230v_batt();
             dc.setDev_id(cs.getDev_id());
             dc.setRecord_time(cs.getRecord_time());
             dc.setRecord_time1(cs.getRecord_time1());
             dc.setNote(cs.getTablists());
             exportData=(new Dc230v_battImpl()).serchCSV(dc);
         }else if(cs.getExport_num()==10){         //DC25V电源
             Dc25v_batt dc=new Dc25v_batt();
             dc.setDev_id(cs.getDev_id());
             dc.setRecord_time(cs.getRecord_time());
             dc.setRecord_time1(cs.getRecord_time1());
             dc.setNote(cs.getTablists());
             exportData=(new Dc25v_battImpl()).serchCSV(dc);
         }else if(cs.getExport_num()==11){        //直流主配电板
             DcDistribution dd=new DcDistribution();
             dd.setDev_id(cs.getDev_id());
             dd.setRecord_time(cs.getRecord_time());
             dd.setRecord_time1(cs.getRecord_time1());
             dd.setNote(cs.getTablists());
             exportData=(new DcDistributionImpl()).serchCSV(dd);
         }else if(cs.getExport_num()==12){
             AcDistribution ad=new AcDistribution();
             ad.setDev_id(cs.getDev_id());
             ad.setRecord_time(cs.getRecord_time());
             ad.setRecord_time1(cs.getRecord_time1());
             ad.setNote(cs.getTablists());
             exportData=(new AcDistributionImpl()).serchCSV(ad);
            
         }else if(cs.getExport_num()==13){       //推进电机
             Propulsion_motor pm=new Propulsion_motor();
             pm.setDev_id(cs.getDev_id());
             pm.setRecord_time(cs.getRecord_time());
             pm.setRecord_time1(cs.getRecord_time1());
             pm.setNote(cs.getTablists());
             exportData=(new Propulsion_motorImpl()).serchCSV(pm);
         }else if(cs.getExport_num()==14){          //蓄电池充电与监测装置 
             Battery_monitor bm=new Battery_monitor();
             bm.setDev_id(cs.getDev_id());
             bm.setRecord_time(cs.getRecord_time());
             bm.setRecord_time1(cs.getRecord_time1());
             bm.setNote(cs.getTablists());
             exportData=(new Battery_monitorImpl()).serchCSV(bm);
         }else if(cs.getExport_num()==15){         //AC230V不间断电源
             Ac230v_ups ac=new Ac230v_ups();
             ac.setDev_id(cs.getDev_id());
             ac.setRecord_time(cs.getRecord_time());
             ac.setRecord_time1(cs.getRecord_time1());
             ac.setNote(cs.getTablists());
             exportData=(new Ac230v_upsImpl()).serchCSV(ac);
         }else if(cs.getExport_num()==16){
             
         }else if(cs.getExport_num()==17){        //舱室配电板
             Cabin_board cb=new Cabin_board();
             cb.setDev_id(cs.getDev_id());
             cb.setRecord_time(cs.getRecord_time());
             cb.setRecord_time1(cs.getRecord_time1());
             cb.setNote(cs.getTablists());
             exportData=(new Cabin_boardImpl()).serchCSV(cb);
         }else if(cs.getExport_num()==18){        //可靠分配电板
             Reliable_board rb=new Reliable_board();
             rb.setDev_id(cs.getDev_id());
             rb.setRecord_time(cs.getRecord_time());
             rb.setRecord_time1(cs.getRecord_time1());
             rb.setNote(cs.getTablists());
             exportData=(new Reliable_boardImpl()).serchCSV(rb);
         }else if(cs.getExport_num()==19){        //开关量板
             Switch_board sb=new Switch_board();
             sb.setDev_id(cs.getDev_id());
             sb.setRecord_time(cs.getRecord_time());
             sb.setRecord_time1(cs.getRecord_time1());
             sb.setNote(cs.getTablists());
             exportData=(new Switch_boardImpl()).serchCSV(sb);
         }else if(cs.getExport_num()==20){        //直流绝缘监测装置
             Dcinsulation di=new Dcinsulation();
             di.setDev_id(cs.getDev_id());
             di.setRecord_time(cs.getRecord_time());
             di.setRecord_time1(cs.getRecord_time1());
             di.setNote(cs.getTablists());
             exportData=(new DcinsulationImpl()).serchCSV(di);
         }else if(cs.getExport_num()==21){        //交流绝缘监测装置
             Acinsulation ai=new Acinsulation();
             ai.setDev_id(cs.getDev_id());
             ai.setRecord_time(cs.getRecord_time());
             ai.setRecord_time1(cs.getRecord_time1());
             ai.setNote(cs.getTablists());
             exportData=(new AcinsulationImpl()).serchCSV(ai);
         }else if(cs.getExport_num()==22){        //udp发包参试设备
             Partin_elemonitor pe=new Partin_elemonitor();
             pe.setRecord_time(cs.getRecord_time());
             pe.setRecord_time1(cs.getRecord_time1());
             pe.setNote(cs.getTablists());
             exportData=(new Partin_elemonitorImpl()).serchCSV(pe);
         }
         if(exportData==null&&exportData.size()<=0){
             Map row = new LinkedHashMap<String, String>();
             row.put(1, "");
             for(int i=0;i<state.length;i++){
                row.put(2+i,"");
             } 
             exportData.add(row);
         }
         CsvUtil.createCSVFile2(exportData, map, path, fileName);
    }
    
    
    
    
    public String getResult() {
        return result;
    }
    public void setJson(String json) {
        this.json = json;
    }
    public static void main(String[] args) {
        String myInput = "直流绝缘低报警,1号AC230不间断电源电压,2号交流主配电板电压,1号蓄电池充电与监测装置工作状态,3号大功率逆变电源输出电流,开关量1";
        String switchString1="Q100,Q101,Q102,Q103,Q108,Q112,Q113,Q120"
                 + ",Q122,Q200,Q202,Q204,Q208,Q211,Q212,Q213"
                 + ",Q220,Q300,Q301,Q303,Q309,Q344,Q400,Q402"
                 + ",Q403,Q404,Q409,Q433,Q11,Q12,Q15,Q17";
        String myout=myInput.replaceAll("开关量1",switchString1);
        System.out.println(myout);
    }
    
}