liuxiaolong
2019-05-06 a7bed6b4cfecd61ec153818945f982c5bb796b98
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
package com.cloud.attendance.controller;
 
import com.alibaba.fastjson.JSONObject;
import com.cloud.attendance.model.AttDay;
import com.cloud.attendance.model.EsAttExcelData;
import com.cloud.attendance.service.AttDayService;
import com.cloud.attendance.service.QueryEsService;
import com.cloud.attendance.utils.EnumStr;
import com.cloud.attendance.utils.ExportExcelUtils;
import com.cloud.model.common.Result;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.List;
import java.util.Map;
 
@Slf4j
@Api( value = "AttDayController",description = "考勤记录查询")
@RestController
@RequestMapping("/api-a/att")
public class AttDayController {
 
@Autowired
private AttDayService attDayService;
@Autowired
private QueryEsService queryEsService;
 
private String queryEsParam = "queryEsParam";
 
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    private SimpleDateFormat sdfTime = new SimpleDateFormat("HH:mm:ss");
private  SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
    @ApiOperation(value = "查询单人某月考勤记录", notes = "查询考勤记录", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "mouthDate", value = "年-月 2018-11", required = true, dataType = "string", paramType = "query" ,example="2018-11"),
            @ApiImplicitParam(name = "personId", value = "查询人id 9f25143b-2663-52cf-973b-72295c19fae1", required = true, dataType = "string", paramType = "query",example="5767")
    })
    @PostMapping("/queryperson")
    public Result queryperson( String mouthDate, String personId){
        try{
            log.info("mouthDate:"+mouthDate+"personId:"+personId);
            return Result.ok("查询单人某月考勤记录成功", attDayService.findPerDayRecord(mouthDate,personId));
        }catch(Exception e){
            log.error(e.getLocalizedMessage());
            return Result.error(e);
        }
    }
 
    @ApiOperation(value = "导出单人某月考勤记录", notes = "导出单人某月考勤记录", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "mouthDate", value = "年-月 2018-11", required = true, dataType = "string", paramType = "query" ,example="2018-11"),
            @ApiImplicitParam(name = "personId", value = "查询人id 9f25143b-2663-52cf-973b-72295c19fae1", required = true, dataType = "string", paramType = "query",example="5767")
    })
    @GetMapping("/poiPersonMouuthDataExcel")
    public void excelPersonData(String mouthDate,String personId,HttpServletResponse response,HttpServletRequest req){
            personId = req.getParameter("personId");
            mouthDate = req.getParameter("mouthDate");
            log.info("mouthDate:"+mouthDate+"personId:"+personId);
            Map<String, Object> perDayRecord = attDayService.findPerDayRecord(mouthDate, personId);
            Object employeeName = perDayRecord.get("employeeName");
            Object identity = perDayRecord.get("identity");
            EsAttExcelData<List<Object>> data = new EsAttExcelData<List<Object>>();
            data.setName(""+employeeName+mouthDate+"月考勤记录");
            List<String> titles = new ArrayList();
            // {"pid","pname","photo","identity","indeviceid","indevicename","onlinetime","Snapshotpath"}
            titles.add("日期");titles.add("考勤时间(首次)"); titles.add("首次考勤位置");
            titles.add("考勤时间(末次)");// titles.add("人员Id");
             titles.add("末次考勤位置");titles.add("考勤状态");
            data.setTitles(titles);
            List<List<Object>> rows = new ArrayList();
            List<AttDay>  attDays = ( List<AttDay>) perDayRecord.get("dayList");
            for (AttDay attDay : attDays) {
                ArrayList<Object> obj = new ArrayList<>();
                obj.add(attDay.getSignDate()!=null?sdfDate.format(attDay.getSignDate()):"");
                obj.add(attDay.getInTime()!=null?sdfTime.format(attDay.getInTime()):"");
                obj.add(attDay.getInDeviceName());
                obj.add(attDay.getOutTime()!=null?sdfTime.format(attDay.getOutTime()):"");
                obj.add(attDay.getOutDeviceName());
                obj.add(attDay.getDayStatus());
                rows.add(obj);
            }
        try {
            data.setRows(rows);
            String fileName = "" + (employeeName==null?"":employeeName)  + mouthDate + "月考勤记录.xlsx";  // .xlsx  + (identity==null?"":identity)
            String s = new String((fileName).getBytes("utf-8"), "utf-8");
            ExportExcelUtils.exportObjectExcel(response,fileName,data);
//            return Result.ok("导出单人某月考勤记录成功","导出单人某月考勤记录");
        } catch (Exception e){
            e.printStackTrace();
        }
    }
    @ApiOperation(value = "查询多人某月考勤记录", notes = "查询多人某月考勤记录", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE
    , response = Result.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "mouthDate", value = "年-月 2018-11", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "gradeValue", value = "年级 暂无",  required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "classValue", value = "班级 暂无", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "identity", value = "身份 student/teacher", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "delFlag", value = "是否已删除 true包含/false不包含", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "days", value = "30 默认30", required = false, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "orgIds", value = "组织机构id集合", required = false, dataType = "String", paramType = "query")
    })
    @PostMapping("/morequery")
    public Result save(@RequestParam String mouthDate,@RequestParam(required = false) String gradeValue,
                       @RequestParam(required = false) String classValue,
                       @RequestParam(required = false) String orgIds,@RequestParam(required = false) Boolean delFlag,  // 是否包含已删除
                       @RequestParam(required = false,defaultValue ="30") Integer days
            ,@RequestParam(required = true) String identity){
            if ("".equals(gradeValue)||"all".equalsIgnoreCase(gradeValue)){ gradeValue =null;  }
            if ("".equals(classValue)||"all".equalsIgnoreCase(classValue))classValue = null;
            log.info("mouthDate:"+mouthDate+"gradeValue:"+gradeValue+"classValue:"+classValue+"identity:"+identity+"days"+days+"orgIds:"+orgIds);
            return Result.ok("查询多人"+mouthDate+"月考勤记录成功", attDayService.findAllDayRecord(mouthDate,gradeValue,classValue,identity,days,delFlag,orgIds));
    }
 
    @ApiOperation(value = "请假或补签接口", notes = "修改某人某天考勤记录---暂不用18-11-09", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "recordId", value = "考勤记录Id", required = true, dataType = "long", paramType = "query"),
            @ApiImplicitParam(name = "mouthDay", value = "年-月-日",  required = false,dataType = "date", paramType = "query"),
            @ApiImplicitParam(name = "leaveOrRepair", value = "leave 请假 repair 补签",  required = true, dataType = "String", paramType = "query")
    })
    @PostMapping("/updateRecord")
    public Result updateRecord(@RequestParam Long recordId,
                                @RequestParam(required = false) Date mouthDay,
                                @RequestParam String leaveOrRepair){
            if ("".equals(mouthDay)){
                mouthDay = null;
            }
            log.info("recordId:"+recordId+"mouthDay:"+mouthDay+"leaveOrRepair"+leaveOrRepair);
            return Result.ok("请假或补签成功", attDayService.updateDayRecord(recordId,mouthDay,leaveOrRepair));
    }
 
    @ApiOperation(value = "流水记录查询接口", notes = "流水记录查询", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "contentValue", value = "姓名/身份证号/学号 曹 1211", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "location", value = "位置 北门考勤机", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "identity", value = "身份 学生student老师teacher", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "orgIds", value = "组织机构id 集合", required = false, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "gradeValue", value = "年级",  required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "classValue", value = "班级", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "order", value = "排序 descending ascending", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "orderName", value = "排序列 pname identity indevicename onlinetime", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "delFlag", value = "是否包含已上除 true包含/false", required = false, dataType = "boolean", paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "起始时间 2018/11/03 12:00:00",  required = true, dataType = "date",
                    paramType = "query",example = "2018/11/30 12:00:00"),
            @ApiImplicitParam(name = "endTime", value = "结束时间 2018/11/29 12:00:00", required = true, dataType = "date", paramType = "query"
                    ,example = "2018/11/29 12:00:00"),
            @ApiImplicitParam(name = "page", value = "页数 1",  required = false, dataType = "int32", paramType = "query"),
            @ApiImplicitParam(name = "size", value = "每页条数 10", required = false, dataType = "int32", paramType = "query")
    })
    @PostMapping("/queryEsRecord")
    public Result queryEsRecord(
            @RequestParam(required = false) String contentValue,@RequestParam(required = false) String location,
            @RequestParam(required = false) String identity,@RequestParam(required = false) String gradeValue,
            @RequestParam(required = false) String classValue, @RequestParam(required = false) String orgIds,   //  多组织机构数据 , 拼接
            @RequestParam(name = "order",required = false,defaultValue = "descending") String sortDate,
            @RequestParam(name = "delFlag",required = false,defaultValue = "false") Boolean delFlag,
            @RequestParam   Date startTime,       //    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
            @RequestParam  Date endTime,  // @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
            @RequestParam(required = false,defaultValue = "1") Integer page,String orderName,
            @RequestParam(required = false,defaultValue = "10") Integer size, HttpServletRequest request){
            if ("".equals(contentValue)){contentValue =null;}
            if ("".equals(location)){location =null;}
            if ("".equals(identity)||"all".equalsIgnoreCase(identity)){identity = null;}
            if ("".equals(gradeValue)||"all".equalsIgnoreCase(gradeValue)){gradeValue = null;}
            if ("".equals(classValue)||"all".equalsIgnoreCase(classValue)){classValue = null;}
            if (sortDate.equalsIgnoreCase("descending")){
                sortDate = "desc";
            }else { sortDate = "asc"; }
        List<String> orgIdList = new ArrayList<>();
        if (!StringUtils.isBlank(orgIds)){
            String[] ids = orgIds.split(",");
            orgIdList = Arrays.asList(ids);
        }
            Map<String,Object> map = new HashMap<String, Object>();
            map.put("contentValue",contentValue); map.put("location",location);  map.put("identity",identity);
            map.put("delFlag",delFlag); map.put("orgIds",orgIdList);map.put("orderName",orderName);
            map.put("gradeValue",gradeValue);  map.put("classValue",classValue );map.put("sortDate",sortDate);
            map.put("startTime",startTime);map.put("endTime",endTime); map.put("page",page); map.put("size",size);
            request.getSession().setAttribute(queryEsParam,map);
            log.info("流水记录查询 参数:"+map);
            return Result.ok("流水记录查询成功", queryEsService.queryAttRecord(contentValue,location,
                    identity,gradeValue,classValue,delFlag,orgIdList,orderName,sortDate,startTime,endTime, page, size));
    }
    @ApiOperation(value = "搜索流水记录导出接口", notes = "流水记录导出", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParams({
          })
    @RequestMapping(value = "/searchExcel", method = RequestMethod.GET)
    public void poiEsRecord( HttpServletResponse response,HttpServletRequest request){
            EsAttExcelData<JSONObject> data = new EsAttExcelData<JSONObject>();
            data.setName("考勤流水记录");
            List<String> titles = new ArrayList();
            String contentValue=null,location=null,identity=null,gradeValue =null,classValue =null,sortDate=null,orderName = null;
            Date startTime =null,endTime =null;Integer page = null,size =null; Boolean delFlag = false;List<String> orgIds = null;
            // {"pid","pname","photo","identity","indeviceid","indevicename","onlinetime","Snapshotpath"}
            titles.add("人员Id"); titles.add("姓名");titles.add("身份证号");titles.add("人员属性");titles.add("考勤时间");
//            titles.add("人员图片");
            titles.add("设备Id");titles.add("设备名称");titles.add("设备地址");
//            titles.add("抓拍图片");
            data.setTitles(titles);
            Map<String,Object> params = (Map<String, Object>) request.getSession().getAttribute(queryEsParam);
            if(params !=null){
                 contentValue = (String) params.get("contentValue");
                 location = (String) params.get("location");
                 identity = (String) params.get("identity");
                 gradeValue = (String) params.get("gradeValue");
                 classValue = (String) params.get("classValue");
                delFlag = (Boolean) params.get("delFlag");
                orgIds = (List<String>) params.get("orgIds");
                sortDate = (String) params.get("sortDate");
                orderName = (String) params.get("orderName");
                 startTime = (Date) params.get("startTime");
                 endTime = (Date) params.get("endTime");
                 page = (Integer) params.get("page");
                 size = (Integer) params.get("size");
            }else{
                RuntimeException re = new RuntimeException("导出考勤数据失败,请重新搜索数据再导出。");
                throw  re;
            }
            Map<String, Object> record = queryEsService.queryAttRecord(contentValue, location,
                    identity, gradeValue, classValue,delFlag,orgIds, orderName, sortDate,startTime, endTime, 1, 10000);
            List<List<Object>> rows = new ArrayList();
            List<JSONObject> esAttList = (List<JSONObject>) record.get("esAttList");
 
             data.setRows(esAttList);
        try {
            String s = new String(("考勤记录.xlsx").getBytes("utf-8"), "utf-8");
            ExportExcelUtils.exportExcel(response,s,data);
//        return Result.ok("导出考勤数据成功!",null);
        } catch (Exception e) {
            e.printStackTrace();
        }
 
    }
   /* @ApiOperation(value = "流水记录导出接口", notes = "流水记录导出--暂不用", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    @ApiImplicitParams({
    })*/
//    @RequestMapping(value = "/AllRecordExcel", method = RequestMethod.GET)
    public Result poiAllEsRecord( HttpServletResponse response,HttpServletRequest request){
        XSSFWorkbook wb =null;
            EsAttExcelData data = new EsAttExcelData();
            data.setName("考勤流水记录");
            List<String> titles = new ArrayList();
            String contentValue=null,location=null,identity=null,gradeValue =null,classValue =null,sortDate = null,orderName = null;
            Date startTime =null,endTime =null;Integer page = null,size =null;Boolean delFlag = false;List<String> orgIds = null;
            // {"pid","pname","photo","identity","indeviceid","indevicename","onlinetime","Snapshotpath"}
            titles.add("人员Id"); titles.add("名字"); titles.add("人员图片");titles.add("身份");
            titles.add("设备Id");titles.add("设备名称"); titles.add("考勤时间");titles.add("抓拍图片");
            data.setTitles(titles);
            Map<String,Object> params = (Map<String, Object>) request.getSession().getAttribute("queryEsParam");
            if(params !=null){
                contentValue = (String) params.get("contentValue");location = (String) params.get("location");
                identity = (String) params.get("identity");gradeValue = (String) params.get("gradeValue");
                classValue = (String) params.get("classValue");delFlag = (Boolean) params.get("delFlag");
                orgIds = (List<String>) params.get("orgIds");sortDate = (String) params.get("sortDate");
                orderName = (String) params.get("orderName");startTime = (Date) params.get("startTime");
                endTime = (Date) params.get("endTime");page = (Integer) params.get("page");
                size = (Integer) params.get("size");
            }else{
                RuntimeException re = new RuntimeException("导出考勤数据失败!");
                throw  re;
            }
            Map<String, Object> record = queryEsService.queryAttRecord(contentValue, location,
                    identity, gradeValue, classValue,delFlag,orgIds, orderName, sortDate, startTime, endTime, 1, 10000);
        Integer total = (Integer) record.get("total");
            if (total>0){
                List<JSONObject> esAttList = null; page = 2;
                do {
                     /* for (int i=0,item = esAttList.size(); i<item;i++){
                   List<Object> row = new ArrayList();
                   row.add("id"+i);
                   row.add("名字"+i);
                   row.add("http://192.168.1.203"+i);
                   row.add(sdf.format(new Date()));
                   rows.add(row);
                  }*/
                    esAttList = (List<JSONObject>) record.get("esAttList");
                    data.setRows(esAttList);
                    //生成本地
                /*File f = new File("c:/test.xlsx");
                FileOutputStream out = new FileOutputStream(f);
                ExportExcelUtils.exportExcel(data, out);
                out.close();*/
                    try {
                        ExportExcelUtils.exportMoreExcel(response, "多人考勤流水记录" + (page - 1) + ".xlsx", data);
                        record = queryEsService.queryAttRecord(contentValue, location,
                                identity, gradeValue, classValue,delFlag,orgIds, orderName, sortDate, startTime, endTime, page++, 10000);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }while(esAttList.size()>0 || page >9);
            }
            return Result.ok("导出考勤数据成功!",null);
    }
 
    @ApiOperation(value = "查询个人单日考勤流水接口", notes = "查询个人单日考勤流水查询", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "personId 9f25143b-2663-52cf-973b-72295c19fae1", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "beginTime", value = "起始时间 2019-03-21",  required = true, dataType = "date",
                    paramType = "query",example = "2018/11/06"),
            @ApiImplicitParam(name = "endTime", value = "结束时间 2019-03-21", required = true, dataType = "date", paramType = "query"
                    ,example = "2018/11/06")
    })
//    @AuthNoneIgnore
    @PostMapping("/queryPersonById")
    public Result queryPersonById(@RequestParam String id,@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime,
                                  @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){
        try{
            return Result.ok("查询个人单日考勤流水成功!",
                    queryEsService.queryPersonById(id,beginTime,endTime));
        }catch (Exception e){
            e.printStackTrace();
            log.error(e.getLocalizedMessage());
            return Result.error(e);
        }
    }
 
    @ApiOperation(value = "导出单人单日考勤记录", notes = "导出单人单日考勤记录", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "personId 9f25143b-2663-52cf-973b-72295c19fae1", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "dayTime", value = "起始时间 2018-11-06",  required = true, dataType = "date",
                    paramType = "query",example = "2018-11-06")
    })
    @RequestMapping(value = "/poiPersonDayDataExcel",method = RequestMethod.GET)
    public void excelPersonDayData(@RequestParam(value = "id") String personId,
                                   @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date dayTime,
                                   HttpServletResponse response,
                                   HttpServletRequest req){
        try{
            String id = req.getParameter("id");
            log.info(id+"id参数变化");
            String mouthDate = sdfDate.format(dayTime);
            log.info("导出单人单日参数:beginTime:"+mouthDate+"personId:"+id);
            Map<String, Object> perDayRecord = queryEsService.queryPersonById(id, dayTime, dayTime);
            Object employeeName = perDayRecord.get(EnumStr.pnameShow);
            Object idCard = perDayRecord.get(EnumStr.idCardField);if (idCard == null){idCard ="";}
            EsAttExcelData<List<Object>> data = new EsAttExcelData<List<Object>>();
            String fileName = ""+(employeeName==null||"".equals(employeeName)?idCard:employeeName)+mouthDate+"考勤记录"; // (identity==null?"":identity)+
            data.setName(fileName);
            log.info("employeeName:"+employeeName+"idCard:"+idCard+"mouthDate:"+mouthDate);
            List<String> titles = new ArrayList();
            // {"pid","pname","photo","identity","indeviceid","indevicename","onlinetime","Snapshotpath"}
//            titles.add("人员Id");   titles.add("设备ID");  // 2018-12-21
            titles.add("考勤时间"); titles.add("考勤位置");
//            titles.add("抓拍图片");
            data.setTitles(titles);
            List<List<Object>> rows = new ArrayList();
            List<JSONObject>  attDays = (List<JSONObject>) perDayRecord.get("dayList");
            for (JSONObject attDay : attDays) {
                ArrayList<Object> obj = new ArrayList<>();
//                obj.add(attDay.getString("pid"));
//                obj.add(attDay.getString("indeviceid"));
                obj.add(attDay.getString("onlinetime"));
                obj.add(attDay.getString("indevicename"));  // indevicename
//                obj.add(attDay.getString("Snapshotpath"));
                rows.add(obj);
            }
            data.setRows(rows);
            String s = new String((fileName+".xlsx").getBytes("utf-8"), "utf-8");
            ExportExcelUtils.exportObjectExcel(response,s,data);
//            return Result.ok("导出单人单日考勤记录成功","导出单人单日考勤记录");
        }catch(Exception e){
            log.error(e.getLocalizedMessage());
//            return Result.error(e);
        }
    }
 
}