yz
2021-04-06 e42bbb438b21ad7ef01888b7172ee5f810d2ab39
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
package cc.mrbird.febs.server.hr.service.impl;
 
import cc.mrbird.febs.common.core.constant.DicCode;
import cc.mrbird.febs.common.core.entity.QueryRequest;
import cc.mrbird.febs.common.core.entity.system.DicItem;
import cc.mrbird.febs.common.core.utils.CastUtil;
import cc.mrbird.febs.common.redis.service.RedisService;
import cc.mrbird.febs.server.hr.entity.*;
import cc.mrbird.febs.server.hr.feign.IRemoteDicItemService;
import cc.mrbird.febs.server.hr.mapper.EmpAccessoryMapper;
import cc.mrbird.febs.server.hr.po.AvailableResult;
import cc.mrbird.febs.server.hr.po.User;
import cc.mrbird.febs.server.hr.service.*;
import cc.mrbird.febs.server.hr.util.CreatePdf;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
@Service
public class ExportPdfServiceImpl implements ExportPdfService {
    @Autowired
    private IEmpWorkExperienceService iEmpWorkExperienceService;
    @Autowired
    private IEmpBadRecordService iEmpBadRecordService;
    @Autowired
    private IEmpBaseInfoService iEmpBaseInfoService;
    @Autowired
    private IEmpContractInfoService iEmpContractInfoService;
    @Autowired
    private IEmpDimissionAttendService iEmpDimissionAttendService;
    @Autowired
    private IEmpDimissionLogService iEmpDimissionLogService;
    @Autowired
    private IEmpInsuranceService iEmpInsuranceService;
    @Autowired
    private IEmpJobChangeService iEmpJobChangeService;
    @Autowired
    private IEmpLaborTroubleService iEmpLaborTroubleService;
    @Autowired
    private     IEmpLeaveInfoService iEmpLeaveInfoService;
    @Autowired
    private     IEmpOccupationalService iEmpOccupationalService;
    @Autowired
    private     IEmpOpenArchivesService iEmpOpenArchivesService;
    @Autowired
    private     IEmpPhysicalExamService iEmpPhysicalExamService;
    @Autowired
    private     IEmpRemarkinfoService iEmpRemarkinfoService;
    @Autowired
    private     IEmpResignService iEmpResignService;
    @Autowired
    private     IEmpUnemploymentService iEmpUnemploymentService;
    @Autowired
    private     IEmpAccidentCasesService iEmpAccidentCasesService;
    @Autowired
    private  RedisService redisService;
    @Autowired
    private EmpAccessoryMapper empAccessoryMapper;
    @Autowired
            private IRemoteDicItemService iRemoteDicItemService;
    Logger logger = LoggerFactory.getLogger(ExportPdfServiceImpl.class);
    @Override
    public void exportPdf(String empNum, QueryRequest queryRequest, HttpServletRequest request, HttpServletResponse response) {
        try {
            //体检类型
            Map<String,String> physicalExamType = new HashMap<>();
            List<DicItem> list=empAccessoryMapper.getDictType("PHYSICALEXAMTYPE");
            for (DicItem m:    list) {
                physicalExamType.put(m.getDicItemCode(),m.getDicItemName());
            }
            //心电图
            Map<String,String> ecg = new HashMap<>();
            for (DicItem m:    empAccessoryMapper.getDictType("ECG")) {
                ecg.put(m.getDicItemCode(),m.getDicItemName());
            }
            //合同状态
            Map<String,String> contractstatus = new HashMap<>();
            for (DicItem m:  empAccessoryMapper.getDictType("CONTRACTSTATUS")) {
                contractstatus.put(m.getDicItemCode(),m.getDicItemName());
            }
            //调岗类型
            Map<String,String> changeType = new HashMap<>();
            for (DicItem m:  empAccessoryMapper.getDictType("changeType")) {
                changeType.put(m.getDicItemCode(),m.getDicItemName());
            }
            //请假类型
            Map<String,String> leavetype = new HashMap<>();
            for (DicItem m:   empAccessoryMapper.getDictType("LEAVETYPE")) {
                leavetype.put(m.getDicItemCode(),m.getDicItemName());
            }
            //入离职类型
            Map<String,String> lztype = new HashMap<>();
            for (DicItem m:   empAccessoryMapper.getDictType("LZTYPE")) {
                lztype.put(m.getDicItemCode(),m.getDicItemName());
            }
            //社保档位
            Map<String,String> insuranceGaers = new HashMap<>();
            for (DicItem m:   empAccessoryMapper.getDictType("insuranceGaers")) {
                insuranceGaers.put(m.getDicItemCode(),m.getDicItemName());
            }
            //社保是否已经报告
            Map<String,String> reportStatus = new HashMap<>();
            for (DicItem m:  empAccessoryMapper.getDictType("reportStatus")) {
                reportStatus.put(m.getDicItemCode(),m.getDicItemName());
            }
            //社保状态
            Map<String,String> applayStatus = new HashMap<>();
            for (DicItem m:  empAccessoryMapper.getDictType("applayStatus")) {
                applayStatus.put(m.getDicItemCode(),m.getDicItemName());
            }
            //是否住院
            Map<String,String> hospitalizatioFlag = new HashMap<>();
            for (DicItem m:  empAccessoryMapper.getDictType("hospitalizatioFlag")) {
                hospitalizatioFlag.put(m.getDicItemCode(),m.getDicItemName());
            }
            //仲裁类型
            Map<String,String> zctype = new HashMap<>();
            for (DicItem m:  empAccessoryMapper.getDictType("ZCTYPE")) {
                zctype.put(m.getDicItemCode(),m.getDicItemName());
            }
            //结案状态
            Map<String,String> settleStatus = new HashMap<>();
            for (DicItem m:   empAccessoryMapper.getDictType("settleStatus")) {
                settleStatus.put(m.getDicItemCode(),m.getDicItemName());
            }
            //性别
            Map<String,String> sex = new HashMap<>();
            for (DicItem m:  empAccessoryMapper.getDictType("sex")) {
                sex.put(m.getDicItemCode(),m.getDicItemName());
            }
            //员工类别
            Map<String,String> empType = new HashMap<>();
            for (DicItem m:  empAccessoryMapper.getDictType("EMPTYPE")) {
                empType.put(m.getDicItemCode(),m.getDicItemName());
            }
            //民族
            Map<String,String> NATION = new HashMap<>();
            for (DicItem m:  empAccessoryMapper.getDictType("NATION")) {
                NATION.put(m.getDicItemCode(),m.getDicItemName());
            }
            //婚姻状态
            Map<String,String> MARRIAGE = new HashMap<>();
            for (DicItem m:  empAccessoryMapper.getDictType("MARRIAGE")) {
                MARRIAGE.put(m.getDicItemCode(),m.getDicItemName());
            }
            //政治面貌
            Map<String,String> PLITICAL = new HashMap<>();
            for (DicItem m:  empAccessoryMapper.getDictType("PLITICAL")) {
                PLITICAL.put(m.getDicItemCode(),m.getDicItemName());
            }
            //最高学历
            Map<String,String> EDUCATION= new HashMap<>();
            for (DicItem m:  empAccessoryMapper.getDictType("EDUCATION") ) {
                EDUCATION.put(m.getDicItemCode(),m.getDicItemName());
            }
            //籍贯
            /*Map<String,String> NATIVEPLACE= new HashMap<>();
            for (DicItem m:    empAccessoryMapper.getDictType("NATIVEPLACE")) {
                NATIVEPLACE.put(m.getDicItemCode(),m.getDicItemName());
            }*/
            //保险类型
            Map<String,String> INSURANCETYPE= new HashMap<>();
            for (DicItem m:   empAccessoryMapper.getDictType("INSURANCETYPE")) {
                INSURANCETYPE.put(m.getDicItemCode(),m.getDicItemName());
            }
            //员工手册
            Map<String,String> handbookStatus= new HashMap<>();
            for (DicItem m:  empAccessoryMapper.getDictType("handbookStatus") ) {
                handbookStatus.put(m.getDicItemCode(),m.getDicItemName());
            }
            //相关证件
            Map<String,String> certificateList= new HashMap<>();
            for (DicItem m:  empAccessoryMapper.getDictType("certificateList")) {
                certificateList.put(m.getDicItemCode(),m.getDicItemName());
            }
            //相关证件
            Map<String,String> archivesStatus= new HashMap<>();
            for (DicItem m:  empAccessoryMapper.getDictType("archivesStatus")) {
                archivesStatus.put(m.getDicItemCode(),m.getDicItemName());
            }
 
            logger.info(">>>>>>>>>>开始导出pdf>>>>>>>>>>");
            //基本信息
                String[] baseinfo = { "档案号", "姓名", "性别", "部门(护卫点)", "岗位", "员工类别", "民族", "年龄", "婚姻状态", "身份证有效期"
                    , "身高(cm)"
                    , "政治面貌", "出生日期", "最高学历", "籍贯", "户籍地址", "现住址", "保安员回执", "保安员证号", "档案情况", "银行名称"
                    , "银行账号",
                    "电话号码", "入职日期"
                    , "保险类型", "社保电脑号", "招聘介绍人", "入司工龄", "工作证", "家庭成员及关系", "紧急联系电话", "员工手册", "相关证件"
                    , "身份证号码"};
            EmpBaseInfo baseInfo=new EmpBaseInfo();
            baseInfo.setCertificateNumb(empNum);
            List<DicItem> dicItems = CastUtil.castList(redisService.get("dicItems"), DicItem.class);
            List<EmpBaseInfo> empBaseInfoList = iEmpBaseInfoService.findEmpBaseInfos(queryRequest, baseInfo).getRecords();
            for (EmpBaseInfo empBaseInfo: empBaseInfoList){
                empBaseInfo.setArchivesStatusName(archivesStatus.get(empBaseInfo.getArchivesStatus()==null?"":empBaseInfo.getArchivesStatus()));
                empBaseInfo.setSexName(sex.get(empBaseInfo.getSex()==null?"":empBaseInfo.getSex()));
                empBaseInfo.setEmpTypeName(empType.get(empBaseInfo.getEmpType()==null?"":empBaseInfo.getEmpType()));
                empBaseInfo.setNationName(NATION.get(empBaseInfo.getNation()==null?"":empBaseInfo.getNation()));
                empBaseInfo.setMarriageName(MARRIAGE.get(empBaseInfo.getMarriage()==null?"":empBaseInfo.getMarriage()));
                empBaseInfo.setPoliticsName(PLITICAL.get(empBaseInfo.getPolitics()==null?"":empBaseInfo.getPolitics()));
                empBaseInfo.setEducationName(EDUCATION.get(empBaseInfo.getEducation()==null?"":empBaseInfo.getEducation()));
                empBaseInfo.setNativePlaceName(dicItems.stream()
                        .filter(k -> DicCode.NATIVEPLACE.equals(k.getDicCode()) && k.getDicItemCode().equals(empBaseInfo.getNativePlace()==null?"":empBaseInfo.getNativePlace()))
                        .findFirst()
                        .map(DicItem::getDicItemName)
                        .orElse(""));
                empBaseInfo.setInsuranceTypeName(INSURANCETYPE.get(empBaseInfo.getInsuranceType()==null?"":empBaseInfo.getInsuranceType()));
                empBaseInfo.setHandbookStatusName(handbookStatus.get(empBaseInfo.getHandbookStatus()==null?"":empBaseInfo.getHandbookStatus()));
                empBaseInfo.setCertificateListName(certificateList.get(empBaseInfo.getCertificateList()==null?"":empBaseInfo.getCertificateList()));
                empBaseInfo.setEmpStatusName("0".equals(empBaseInfo.getEmpStatus()) ? "在职" : "离职");
                empBaseInfo.setEntryTypeName(dicItems.stream()
                        .filter(k -> DicCode.IN_OUT_TYPE.equals(k.getDicCode()) && k.getDicItemCode().equals(empBaseInfo.getEntryType()))
                        .findFirst()
                        .map(DicItem::getDicItemName)
                        .orElse(""));
            }
            EmpBaseInfo empBaseInfo = empBaseInfoList.get(0);
            //工作经历
            String[] workhead = { "开始时间", "结束时间", "工作单位", "主要工作内容"};
            EmpWorkExperience empWorkExperiences=new EmpWorkExperience();
            empWorkExperiences.setCertificateNumb(empNum);
            empWorkExperiences.setDelFlag(0);
            
            List<EmpWorkExperience> empWorkExperiences1 = iEmpWorkExperienceService.findEmpWorkExperiences(queryRequest, empWorkExperiences).getRecords();
            //体检信息
            String[] empPhysicalhead = {  "体检医院", "体检日期", "体检类型", "血压", "转氨酶", "心电图", "体检结论", "复查日期", "备注"};
            EmpPhysicalExam empPhysicalExam=new EmpPhysicalExam();
            empPhysicalExam.setCertificateNumb(empNum);
            
            List<EmpPhysicalExam> records = iEmpPhysicalExamService.findEmpPhysicalExams(queryRequest, empPhysicalExam).getRecords();
            for (EmpPhysicalExam empPhysicalExam1:records){
                empPhysicalExam1.setPhysicalExamTypeName(physicalExamType.get(empPhysicalExam1.getPhysicalExamType()==null?"":empPhysicalExam1.getPhysicalExamType()));
            }
            //合同信息
            String[] empContractInfo = {  "合同签订日期", "合同结束日期", "合同期限(年)", "合同状态", "合同办理人","备注"};
            EmpContractInfo empContractInfo1=new EmpContractInfo();
            empContractInfo1.setCertificateNumb(empNum);
            empContractInfo1.setEmpStatus(empBaseInfo.getEmpStatus());
            List<EmpContractInfo> empContractInfos = iEmpContractInfoService.findEmpContractinfos(queryRequest, empContractInfo1).getRecords();
            for (EmpContractInfo empCon:empContractInfos){
                empCon.setContractStatusName(contractstatus.get(empCon.getContractStatus()==null?"":empCon.getContractStatus()));
            }
            //调岗记录
            String[] empJobChange = {  "现部门", "现岗位", "姓名", "原部门", "原岗位", "调岗日期", "调岗类型", "调岗理由"};
            EmpJobChange empJobChange1=new EmpJobChange();
            empJobChange1.setCertificateNumb(empNum);
            empJobChange1.setEmpStatus(empBaseInfo.getEmpStatus());
            List<Map<String, Object>> empJobChangeList = iEmpJobChangeService.findEmpJobChanges(queryRequest, empJobChange1).getRecords();
            for (Map<String, Object> map:empJobChangeList){
                map.put("changeType",changeType.get(map.get("changeType")==null?"":map.get("changeType").toString()));
            }
            //请假记录
            String[] leaveInfo = {  "开始时间", "结束时间", "请假天数", "请假类型", "到岗时间", "报备人", "备注"};
            EmpLeaveInfo empLeaveInfo=new EmpLeaveInfo();
            empLeaveInfo.setCertificateNumb(empNum);
            
            List<EmpLeaveInfo> empLeaveInfos = iEmpLeaveInfoService.findEmpLeaveInfos(queryRequest, empLeaveInfo).getRecords();
            for (EmpLeaveInfo leaveInfo1:empLeaveInfos){
                leaveInfo1.setLeaveTypeName(leavetype.get(leaveInfo1.getLeaveType()==null?"":leaveInfo1.getLeaveType()));
            }
            //辞职申请
            String[] resign = {  "辞职申请日期", "辞职事由", "汇报人", "备注"};
            EmpResign empResign=new EmpResign();
            empResign.setCertificateNumb(empNum);
            empResign.setEmpStatus(empBaseInfo.getEmpStatus());
            List<EmpResign> empResigns = iEmpResignService.findEmpResigns(queryRequest, empResign).getRecords();
            //离职当月考勤
            String[] dimissionAttend = {  "离职考勤月份", "出勤天数", "加班(天)", "加班(小时)", "有无代扣款项", "请假(天)", "旷工(天)", "备注"};
            EmpDimissionAttend empDimissionAttend=new EmpDimissionAttend();
            empDimissionAttend.setCertificateNumb(empNum);
            
            List<EmpDimissionAttend> dimissionAttends = iEmpDimissionAttendService.findEmpDimissionattends(queryRequest, empDimissionAttend).getRecords();
            //入离职记录
            String[] dimissionLog = {  "入职日期", "离职日期", "离职类型", "自离天数", "报备人", "备注"};
            EmpDimissionLog empDimissionLog=new EmpDimissionLog();
            empDimissionLog.setEmpId(empBaseInfo.getEmpId());
            empDimissionLog.setEmpStatus(empBaseInfo.getEmpStatus());
            List<Map<String, Object>> records1 = iEmpDimissionLogService.findEmpDimissionLogs(queryRequest, empDimissionLog).getRecords();
            for (Map<String, Object> objectMap:records1){
                objectMap.put("dimissionType",lztype.get(objectMap.get("dimissionType")==null?"":objectMap.get("dimissionType").toString()));
            }
            //失业金领取
            String[] unemployment = {  "失业金申请日期", "申报事由", "汇报人", "审核人", "备注"};
            EmpUnemployment empUnemployment=new EmpUnemployment();
            empUnemployment.setCertificateNumb(empNum);
            empUnemployment.setEmpStatus(empBaseInfo.getEmpStatus());
            List<EmpUnemployment> empUnemployments = iEmpUnemploymentService.findEmpUnemployments(queryRequest, empUnemployment).getRecords();
           //社保申请
            String[] insurance = {  "社保申请日期", "申请人", "社保档位", "是否已报告", "状态", "审核人", "备注"};
            EmpInsurance empInsurance=new EmpInsurance();
            empInsurance.setCertificateNumb(empNum);
            
            List<EmpInsurance> empInsurances = iEmpInsuranceService.findEmpInsurances(queryRequest, empInsurance).getRecords();
            for (EmpInsurance leaveInfo1:empInsurances){
                leaveInfo1.setInsuranceGaers(insuranceGaers.get(leaveInfo1.getInsuranceGaers()==null?"":leaveInfo1.getInsuranceGaers()));
                leaveInfo1.setReportStatusName(reportStatus.get(leaveInfo1.getReportStatus()==null?"":String.valueOf(leaveInfo1.getReportStatus())));
                leaveInfo1.setApplayStatusName(applayStatus.get(leaveInfo1.getApplayStatus()==null?"":String.valueOf(leaveInfo1.getApplayStatus())));
            }
            //意外险案件
            String[] accidentCases = {  "受伤日期", "受伤地点", "受伤部位", "受伤经过描述", "意外险诊断", "就诊医院", "是否住院", "床号", "报案时间", "递交资料时间", "递交人", "医疗总费用", "保险赔付费用", "是否结案"};
            EmpAccidentCases empAccidentCases=new EmpAccidentCases();
            empAccidentCases.setCertificateNumb(empNum);
            
            List<EmpAccidentCases> empAccidentCases1 = iEmpAccidentCasesService.findEmpAccidentcasess(queryRequest, empAccidentCases).getRecords();
            for (EmpAccidentCases leaveInfo1:empAccidentCases1){
                leaveInfo1.setHospitalizatioFlagName(hospitalizatioFlag.get(leaveInfo1.getHospitalizatioFlag()==null?"":leaveInfo1.getHospitalizatioFlag().toString()));
                leaveInfo1.setSettleStatusName(settleStatus.get(leaveInfo1.getSettleStatus()==null?"":leaveInfo1.getSettleStatus().toString()));
            }
            //工伤案件
            String[] occupational = {  "受伤日期", "受伤地点", "受伤部位", "受伤经过描述", "工伤诊断", "就诊医院", "就诊科室", "是否住院", "床号", "报案时间", "递交资料时间", "递交人", "医疗总费用", "已赔付医药费用", "是否结案"};
            EmpOccupational empOccupational=new EmpOccupational();
            empOccupational.setCertificateNumb(empNum);
            
            List<EmpOccupational> empOccupationals = iEmpOccupationalService.findEmpOccupationals(queryRequest, empOccupational).getRecords();
            for (EmpOccupational leaveInfo1:empOccupationals){
                leaveInfo1.setHospitalizatioFlagName(hospitalizatioFlag.get(leaveInfo1.getHospitalizatioFlag()==null?"":leaveInfo1.getHospitalizatioFlag().toString()));
                leaveInfo1.setSettleStatusName(settleStatus.get(leaveInfo1.getSettleStatus()==null?"":leaveInfo1.getSettleStatus().toString()));
            }
            //劳资案件
            String[] laborTrouble = {  "仲裁日期", "仲裁类型", "仲裁事由", "报备人", "备注", "仲裁赔付(元)", "是否结案", "案结日期"};
            EmpLaborTrouble empLaborTrouble=new EmpLaborTrouble();
            empLaborTrouble.setCertificateNumb(empNum);
            
            List<EmpLaborTrouble> empLaborTroubles = iEmpLaborTroubleService.findEmpLabortroubles(queryRequest, empLaborTrouble).getRecords();
            for (EmpLaborTrouble leaveInfo1:empLaborTroubles){
                leaveInfo1.setArbitrationTypeName(zctype.get(leaveInfo1.getArbitrationType()==null?"":leaveInfo1.getArbitrationType()));
                leaveInfo1.setArbitrationStatusName(settleStatus.get(leaveInfo1.getArbitrationStatus()==null?"":String.valueOf(leaveInfo1.getArbitrationStatus())));
            }
            //不良记录
            String[] badRecord = {  "不良记录日期", "不良记录描述", "汇报人", "备注"};
            EmpBadRecord empBadRecord=new EmpBadRecord();
            empBadRecord.setCertificateNumb(empNum);
            empBadRecord.setEmpStatus(empBaseInfo.getEmpStatus());
            List<EmpBadRecord> empBadRecords = iEmpBadRecordService.findEmpBadrecords(queryRequest, empBadRecord).getRecords();
            //备注
            String[] remarkInfo = {  "备注日期", "备注信息"};
            EmpRemarkInfo empRemarkInfo=new EmpRemarkInfo();
            empRemarkInfo.setCertificateNumb(empNum);
            empRemarkInfo.setEmpStatus(empBaseInfo.getEmpStatus());
            List<EmpRemarkInfo> empRemarkInfos = iEmpRemarkinfoService.findEmpRemarkinfos(queryRequest, empRemarkInfo).getRecords();
            String filePath = new CreatePdf().generatePDFs(baseinfo,empBaseInfoList,workhead, empWorkExperiences1,empPhysicalhead,records,
                    empContractInfo,empContractInfos,
                    empJobChange,empJobChangeList,
                    leaveInfo,empLeaveInfos,
                    resign,empResigns,
                    dimissionAttend,dimissionAttends,
                    dimissionLog,records1,
                    unemployment,empUnemployments,
                    insurance,empInsurances,
                    accidentCases,empAccidentCases1,
                    occupational,empOccupationals,
                    laborTrouble,empLaborTroubles,
                    badRecord,empBadRecords,
                    remarkInfo,empRemarkInfos,response);
            System.out.println(filePath);
            downloadPdf(filePath,request,response);
            logger.info(">>>>>>>>>>结束导出pdf>>>>>>>>>>");
        } catch (Exception e) {
            e.printStackTrace();
            logger.error(">>>>>>>>>>导出pdf 异常,原因为:" + e.getMessage());
        }
    }
    public String downloadPdf( String filepath,HttpServletRequest request, HttpServletResponse response) throws IOException {
        File file = new File(filepath);
        if (!file.exists()) {
            request.setAttribute("error", "附件已删除或不存在");
// return "/error";
        }
        InputStream in = null;
        OutputStream os = null;
        try {
            response.setContentType("application/pdf"); // 设置返回内容格式
            in = new FileInputStream(file); //用该文件创建一个输入流
            os = response.getOutputStream(); //创建输出流
            byte[] b = new byte[1024];
            while (in.read(b) != -1) {
                os.write(b);
            }
            in.close();
            os.flush();
            os.close();
        } catch (Exception e) {
            try {
                if (null != in) {
                    in.close();
                }
            } catch (IOException e1) {
                e1.printStackTrace();
            }
            try {
                if (null != os) {
                    os.close();
                }
            } catch (IOException e2) {
                e2.printStackTrace();
            }
        }
        return null;
    }
}