孔祥富
2021-03-07 f337e00700b069f6d3229a9fef1fcd8623e9d69f
提交档案导出
13个文件已添加
8个文件已修改
1785 ■■■■■ 已修改文件
application.properties 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
febs-server/febs-server-hr/pom.xml 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/controller/PdfController.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/entity/EmpAccidentCases.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/entity/EmpInsurance.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/entity/EmpLaborTrouble.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/entity/EmpOccupational.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/feign/IRemoteDicItemService.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/po/AvailableResult.java 185 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/po/User.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/ExportPdfService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/EmpWorkExperienceServiceImpl.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/ExportPdfServiceImpl.java 383 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/util/CreatePdf.java 780 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/util/GenerateFileName.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/util/GenerateFold.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/util/GetFilePlace.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/util/HeaderHandle.java 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
febs-server/febs-server-hr/src/main/resources/application.properties 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
febs-server/febs-server-system/src/main/java/cc/mrbird/febs/server/system/controller/DicController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
febs-server/febs-server-system/src/main/java/cc/mrbird/febs/server/system/controller/DiciIemController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
application.properties
New file
@@ -0,0 +1,2 @@
#pdf存放目录
pdfPath=C:/appDataPdf
febs-server/febs-server-hr/pom.xml
@@ -58,6 +58,21 @@
            <version>2.2-RELEASE</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.itextpdf</groupId>
            <artifactId>itextpdf</artifactId>
            <version>5.5.13</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.itextpdf/itext-asian -->
        <dependency>
            <groupId>com.itextpdf</groupId>
            <artifactId>itext-asian</artifactId>
            <version>5.2.0</version>
        </dependency>
    </dependencies>
    <build>
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/controller/PdfController.java
New file
@@ -0,0 +1,63 @@
package cc.mrbird.febs.server.hr.controller;
import cc.mrbird.febs.common.core.entity.FebsResponse;
import cc.mrbird.febs.common.core.entity.QueryRequest;
import cc.mrbird.febs.server.hr.annotation.ControllerEndpoint;
import cc.mrbird.febs.server.hr.entity.EmpBaseInfo;
import cc.mrbird.febs.server.hr.po.AvailableResult;
import cc.mrbird.febs.server.hr.service.ExportPdfService;
import cc.mrbird.febs.server.hr.service.IEmpBaseInfoService;
import cc.mrbird.febs.server.hr.util.PoiExportExcel;
import cn.hutool.core.date.DateUtil;
import com.itextpdf.text.*;
import com.itextpdf.text.pdf.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javassist.runtime.Cflow;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.HeaderFooter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import sun.font.FontFamily;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Api(tags = "PDF")
@Slf4j
@Validated
@RestController
@RequestMapping("/pdf")
@RequiredArgsConstructor
public class PdfController {
    @Autowired
    private ExportPdfService exportPdfService;
    @Autowired
    private IEmpBaseInfoService iEmpBaseInfoService;
    @PostMapping(value = "/contract")
    public void createContractPdf(@RequestParam("empNumb") String empNumb,QueryRequest queryRequest, HttpServletRequest request, HttpServletResponse response) {
        try{
            queryRequest.setPageSize(25535);
            queryRequest.setPageNum(1);
            exportPdfService.exportPdf(empNumb,queryRequest,request,response);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    @ApiOperation(value = "导出员工")
    @RequestMapping(value = "exportWithField",method= RequestMethod.POST)
    @ControllerEndpoint(operation = "导出用户数据", exceptionMessage = "导出Excel失败")
    public FebsResponse exportWithField(QueryRequest queryRequest, HttpServletRequest request, HttpServletResponse response, EmpBaseInfo empBaseinfo) throws IOException {
        List<EmpBaseInfo> exportList = this.iEmpBaseInfoService.findZsEmpBaseInfos(queryRequest, empBaseinfo).getRecords();
        return new FebsResponse().data(exportList);
    }
}
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/entity/EmpAccidentCases.java
@@ -131,7 +131,8 @@
    @TableField("hospitalizatioFlag")
    @ExcelField(value = "是否住院", writeConverterExp = "0=未住院,1=已住院")
    private Integer hospitalizatioFlag = 0;
    @TableField(exist = false)
    private String hospitalizatioFlagName ;
    @FieldInfo(name = "bedNumb", type = "varchar", explain = "床号")
    @TableField("bedNumb")
    @ExcelField(value = "床号")
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/entity/EmpInsurance.java
@@ -108,12 +108,15 @@
    @TableField("reportStatus")
    @ExcelField(value = "是否已报告", writeConverterExp = "0=未报告,1=已报告")
    private Integer reportStatus = 0;
    @TableField(exist = false)
    private String reportStatusName ;
    @FieldInfo(name = "applayStatus", type = "bit", explain = "申请状态 0-未申请 1-已申请")
    @TableField("applayStatus")
    @ExcelField(value = "申请状态", writeConverterExp = "0=未申请,1=已申请")
    private Integer applayStatus = 0;
    @TableField(exist = false)
    private String applayStatusName ;
    @FieldInfo(name = "auditor", type = "varchar", explain = "审核人")
    @TableField("auditor")
    @ExcelField(value = "审核人")
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/entity/EmpLaborTrouble.java
@@ -123,7 +123,8 @@
    @FieldInfo(name = "arbitrationStatus", type = "bit", explain = "仲裁状态")
    @TableField("arbitrationStatus")
    private Integer arbitrationStatus = 0;
    @TableField(exist = false)
    private String arbitrationStatusName ;
    @FieldInfo(name = "settleDate", type = "date", explain = "案结日期")
    @TableField("settleDate")
    @JsonSerialize(using = DateSerializer.class)
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/entity/EmpOccupational.java
@@ -131,7 +131,8 @@
    @TableField("hospitalizatioFlag")
    @ExcelField(value = "是否住院", writeConverterExp = "0=未住院,1=已住院")
    private Integer hospitalizatioFlag = 0;
    @TableField(exist = false)
    private String hospitalizatioFlagName ;
    @FieldInfo(name = "bedNumb", type = "varchar", explain = "床号")
    @TableField("bedNumb")
    @ExcelField(value = "床号")
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/feign/IRemoteDicItemService.java
New file
@@ -0,0 +1,31 @@
package cc.mrbird.febs.server.hr.feign;
import cc.mrbird.febs.common.core.entity.FebsResponse;
import cc.mrbird.febs.common.core.entity.constant.FebsServerConstant;
import cc.mrbird.febs.common.core.entity.system.Dept;
import cc.mrbird.febs.common.core.entity.system.DicItem;
import cc.mrbird.febs.server.hr.feign.fallback.RemoteDeptServiceFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.List;
/**
 * name: IRemoteDeptService
 * package: cc.mrbird.febs.server.hr.feign
 * description: 从系统管理微服务中获取部门信息
 * date: 2021-01-30 12:46
 *
 * @author luoyibo
 * @version 0.1
 * @since JDK 1.8
 */
@FeignClient(value = FebsServerConstant.FEBS_SERVER_SYSTEM, contextId = "dicItemServiceClient")
public interface IRemoteDicItemService {
    @GetMapping("dicItem/types/{dictType}")
    List<DicItem> dictType(@PathVariable String dictType);
    @GetMapping("dept/userRightDepts")
    String userRightDepts();
}
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/po/AvailableResult.java
New file
@@ -0,0 +1,185 @@
package cc.mrbird.febs.server.hr.po;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.List;
/**
 * @Description: 自定义响应数据结构
 */
public class AvailableResult {
    // 定义jackson对象
    private static final ObjectMapper MAPPER = new ObjectMapper();
    // 响应业务状态
    private Integer status;
    // 响应消息
    private String msg;
    // 响应中的数据
    private Object data;
    private String ok; // 不使用
    public static AvailableResult build(Integer status, String msg, Object data) {
        return new AvailableResult(status, msg, data);
    }
    public static AvailableResult ok(Object data) {
        return new AvailableResult(data);
    }
    public static AvailableResult ok() {
        return new AvailableResult(null);
    }
    public static AvailableResult errorMsg(String msg) {
        return new AvailableResult(500, msg, null);
    }
    public static AvailableResult errorMap(Object data) {
        return new AvailableResult(501, "error", data);
    }
    public static AvailableResult errorTokenMsg(String msg) {
        return new AvailableResult(502, msg, null);
    }
    public static AvailableResult errorException(String msg) {
        return new AvailableResult(555, msg, null);
    }
    public AvailableResult() {
    }
    // public static LeeJSONResult build(Integer status, String msg) {
    // return new LeeJSONResult(status, msg, null);
    // }
    public AvailableResult(Integer status, String msg, Object data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }
    public AvailableResult(Object data) {
        this.status = 200;
        this.msg = "OK";
        this.data = data;
    }
    public Boolean isOK() {
        return this.status == 200;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getMsg() {
        return msg;
    }
    public void setMsg(String msg) {
        this.msg = msg;
    }
    public Object getData() {
        return data;
    }
    public void setData(Object data) {
        this.data = data;
    }
    /**
     *
     * @Description: 将json结果集转化为LeeJSONResult对象 需要转换的对象是一个类
     * @param jsonData
     * @param clazz
     * @return
     *
     *
     * @date 2016年4月22日 下午8:34:58
     */
    public static AvailableResult formatToPojo(String jsonData, Class<?> clazz) {
        try {
            if (clazz == null) {
                return MAPPER.readValue(jsonData, AvailableResult.class);
            }
            JsonNode jsonNode = MAPPER.readTree(jsonData);
            JsonNode data = jsonNode.get("data");
            Object obj = null;
            if (clazz != null) {
                if (data.isObject()) {
                    obj = MAPPER.readValue(data.traverse(), clazz);
                } else if (data.isTextual()) {
                    obj = MAPPER.readValue(data.asText(), clazz);
                }
            }
            return build(jsonNode.get("status").intValue(), jsonNode.get("msg").asText(), obj);
        } catch (Exception e) {
            return null;
        }
    }
    /**
     *
     * @Description: 没有object对象的转化
     * @param json
     * @return
     *
     *
     * @date 2016年4月22日 下午8:35:21
     */
    public static AvailableResult format(String json) {
        try {
            return MAPPER.readValue(json, AvailableResult.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    /**
     *
     * @Description: Object是集合转化 需要转换的对象是一个list
     * @param jsonData
     * @param clazz
     * @return
     *
     *
     * @date 2016年4月22日 下午8:35:31
     */
    public static AvailableResult formatToList(String jsonData, Class<?> clazz) {
        try {
            JsonNode jsonNode = MAPPER.readTree(jsonData);
            JsonNode data = jsonNode.get("data");
            Object obj = null;
            if (data.isArray() && data.size() > 0) {
                obj = MAPPER.readValue(data.traverse(),
                        MAPPER.getTypeFactory().constructCollectionType(List.class, clazz));
            }
            return build(jsonNode.get("status").intValue(), jsonNode.get("msg").asText(), obj);
        } catch (Exception e) {
            return null;
        }
    }
    public String getOk() {
        return ok;
    }
    public void setOk(String ok) {
        this.ok = ok;
    }
}
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/po/User.java
New file
@@ -0,0 +1,84 @@
package cc.mrbird.febs.server.hr.po;
import java.io.Serializable;
public class User implements Serializable{
    private static final long serialVersionUID = -9180229310895087286L;
    private String name; // 姓名
    private String sex; // 性别
    private Integer age; // 年龄
    private String phoneNo; // 手机号
    private String address; // 地址
    private String hobby; // 爱好
    public User(String name, String sex, Integer age, String phoneNo, String address, String hobby) {
        super();
        this.name = name;
        this.sex = sex;
        this.age = age;
        this.phoneNo = phoneNo;
        this.address = address;
        this.hobby = hobby;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    public Integer getAge() {
        return age;
    }
    public void setAge(Integer age) {
        this.age = age;
    }
    public String getPhoneNo() {
        return phoneNo;
    }
    public void setPhoneNo(String phoneNo) {
        this.phoneNo = phoneNo;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public String getHobby() {
        return hobby;
    }
    public void setHobby(String hobby) {
        this.hobby = hobby;
    }
    @Override
    public String toString() {
        return "User [name=" + name + ", sex=" + sex + ", age=" + age + ", phoneNo=" + phoneNo + ", address=" + address
                + ", hobby=" + hobby + "]";
    }
}
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/ExportPdfService.java
New file
@@ -0,0 +1,13 @@
package cc.mrbird.febs.server.hr.service;
import cc.mrbird.febs.common.core.entity.QueryRequest;
import cc.mrbird.febs.server.hr.po.AvailableResult;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public interface ExportPdfService {
    void exportPdf(String empNum, QueryRequest queryRequest, HttpServletRequest request, HttpServletResponse response);
}
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/EmpWorkExperienceServiceImpl.java
@@ -81,6 +81,9 @@
    public List<EmpWorkExperience> findEmpWorkExperiences(EmpWorkExperience empWorkexperience) {
        LambdaQueryWrapper<EmpWorkExperience> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(EmpWorkExperience::getDelFlag,empWorkexperience.getDelFlag());
        if(StringUtils.isNotBlank(empWorkexperience.getEmpNumb())){
            queryWrapper.eq(EmpWorkExperience::getEmpNumb,empWorkexperience.getEmpNumb());
        }
        return this.baseMapper.selectList(queryWrapper);
    }
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/ExportPdfServiceImpl.java
New file
@@ -0,0 +1,383 @@
package cc.mrbird.febs.server.hr.service.impl;
import cc.mrbird.febs.common.core.entity.QueryRequest;
import cc.mrbird.febs.common.core.entity.system.DicItem;
import cc.mrbird.febs.server.hr.entity.*;
import cc.mrbird.febs.server.hr.feign.IRemoteDicItemService;
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 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<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("PHYSICALEXAMTYPE")) {
                physicalExamType.put(m.getDicItemCode(),m.getDicItemName());
            }
            //心电图
            Map<String,String> ecg = new HashMap<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("ECG")) {
                ecg.put(m.getDicItemCode(),m.getDicItemName());
            }
            //合同状态
            Map<String,String> contractstatus = new HashMap<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("CONTRACTSTATUS")) {
                contractstatus.put(m.getDicItemCode(),m.getDicItemName());
            }
            //调岗类型
            Map<String,String> changeType = new HashMap<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("changeType")) {
                changeType.put(m.getDicItemCode(),m.getDicItemName());
            }
            //请假类型
            Map<String,String> leavetype = new HashMap<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("LEAVETYPE")) {
                leavetype.put(m.getDicItemCode(),m.getDicItemName());
            }
            //入离职类型
            Map<String,String> lztype = new HashMap<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("LZTYPE")) {
                lztype.put(m.getDicItemCode(),m.getDicItemName());
            }
            //社保档位
            Map<String,String> insuranceGaers = new HashMap<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("insuranceGaers")) {
                insuranceGaers.put(m.getDicItemCode(),m.getDicItemName());
            }
            //社保是否已经报告
            Map<String,String> reportStatus = new HashMap<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("reportStatus")) {
                reportStatus.put(m.getDicItemCode(),m.getDicItemName());
            }
            //社保状态
            Map<String,String> applayStatus = new HashMap<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("applayStatus")) {
                applayStatus.put(m.getDicItemCode(),m.getDicItemName());
            }
            //是否住院
            Map<String,String> hospitalizatioFlag = new HashMap<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("hospitalizatioFlag")) {
                hospitalizatioFlag.put(m.getDicItemCode(),m.getDicItemName());
            }
            //仲裁类型
            Map<String,String> zctype = new HashMap<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("ZCTYPE")) {
                zctype.put(m.getDicItemCode(),m.getDicItemName());
            }
            //结案状态
            Map<String,String> settleStatus = new HashMap<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("settleStatus")) {
                settleStatus.put(m.getDicItemCode(),m.getDicItemName());
            }
            //性别
            Map<String,String> sex = new HashMap<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("sex")) {
                sex.put(m.getDicItemCode(),m.getDicItemName());
            }
            //员工类别
            Map<String,String> empType = new HashMap<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("EMPTYPE")) {
                empType.put(m.getDicItemCode(),m.getDicItemName());
            }
            //民族
            Map<String,String> NATION = new HashMap<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("NATION")) {
                NATION.put(m.getDicItemCode(),m.getDicItemName());
            }
            //婚姻状态
            Map<String,String> MARRIAGE = new HashMap<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("MARRIAGE")) {
                MARRIAGE.put(m.getDicItemCode(),m.getDicItemName());
            }
            //政治面貌
            Map<String,String> PLITICAL = new HashMap<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("PLITICAL")) {
                PLITICAL.put(m.getDicItemCode(),m.getDicItemName());
            }
            //最高学历
            Map<String,String> EDUCATION= new HashMap<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("EDUCATION")) {
                EDUCATION.put(m.getDicItemCode(),m.getDicItemName());
            }
            //籍贯
            Map<String,String> NATIVEPLACE= new HashMap<>();
            /*for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("NATIVEPLACE")) {
                NATIVEPLACE.put(m.getDicItemCode(),m.getDicItemName());
            }*/
            //保险类型
            Map<String,String> INSURANCETYPE= new HashMap<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("INSURANCETYPE")) {
                INSURANCETYPE.put(m.getDicItemCode(),m.getDicItemName());
            }
            //员工手册
            Map<String,String> handbookStatus= new HashMap<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("handbookStatus")) {
                handbookStatus.put(m.getDicItemCode(),m.getDicItemName());
            }
            //相关证件
            Map<String,String> certificateList= new HashMap<>();
            for (DicItem m:    (List<DicItem>)iRemoteDicItemService.dictType("certificateList")) {
                certificateList.put(m.getDicItemCode(),m.getDicItemName());
            }
            logger.info(">>>>>>>>>>开始导出pdf>>>>>>>>>>");
            //基本信息
                String[] baseinfo = { "档案号", "姓名", "性别", "部门(护卫点)", "岗位", "员工类别", "民族", "年龄", "婚姻状态", "身份证有效期"
                    , "身高(cm)"
                    , "政治面貌", "出生日期", "最高学历", "籍贯", "户籍地址", "现住址", "保安员回执", "保安员证号", "档案情况", "银行名称"
                    , "银行账号",
                    "电话号码", "入职日期"
                    , "保险类型", "社保电脑号", "招聘介绍人", "入司工龄", "工作证", "家庭成员及关系", "紧急联系电话", "员工手册", "相关证件"
                    , "身份证号码"};
            EmpBaseInfo baseInfo=new EmpBaseInfo();
            baseInfo.setEmpNumb(empNum);
            List<EmpBaseInfo> empBaseInfoList = iEmpBaseInfoService.findEmpBaseInfos(queryRequest, baseInfo).getRecords();
            for (EmpBaseInfo empBaseInfo: empBaseInfoList){
                empBaseInfo.setSexName(sex.get(empBaseInfo.getSex()));
                empBaseInfo.setEmpTypeName(empType.get(empBaseInfo.getEmpType()));
                empBaseInfo.setNationName(NATION.get(empBaseInfo.getNation()));
                empBaseInfo.setMarriageName(MARRIAGE.get(empBaseInfo.getMarriage()));
                empBaseInfo.setPoliticsName(PLITICAL.get(empBaseInfo.getPolitics()));
                empBaseInfo.setEducationName(EDUCATION.get(empBaseInfo.getEducation()));
                empBaseInfo.setNativePlaceName(NATIVEPLACE.get(empBaseInfo.getNativePlace()));
                empBaseInfo.setInsuranceTypeName(INSURANCETYPE.get(empBaseInfo.getInsuranceType()));
                empBaseInfo.setHandbookStatusName(handbookStatus.get(empBaseInfo.getHandbookStatus()));
                empBaseInfo.setCertificateListName(certificateList.get(empBaseInfo.getCertificateList()));
            }
            //工作经历
            String[] workhead = { "开始时间", "结束时间", "工作单位", "主要工作内容"};
            EmpWorkExperience empWorkExperiences=new EmpWorkExperience();
            empWorkExperiences.setEmpNumb(empNum);
            empWorkExperiences.setDelFlag(0);
            List<EmpWorkExperience> empWorkExperiences1 = iEmpWorkExperienceService.findEmpWorkExperiences(queryRequest, empWorkExperiences).getRecords();
            //体检信息
            String[] empPhysicalhead = { "体检医院", "体检日期", "体检类型", "血压", "转氨酶", "心电图", "体检结论", "复查记录", "备注"};
            EmpPhysicalExam empPhysicalExam=new EmpPhysicalExam();
            empPhysicalExam.setEmpNumb(empNum);
            List<EmpPhysicalExam> records = iEmpPhysicalExamService.findEmpPhysicalExams(queryRequest, empPhysicalExam).getRecords();
            for (EmpPhysicalExam empPhysicalExam1:records){
                empPhysicalExam1.setPhysicalExamTypeName(physicalExamType.get(empPhysicalExam1.getPhysicalExamType()));
            }
            //合同信息
            String[] empContractInfo = { "合同签订日期", "合同结束日期", "合同期限(年)", "合同状态", "合同办理人"};
            EmpContractInfo empContractInfo1=new EmpContractInfo();
            empContractInfo1.setEmpNumb(empNum);
            List<EmpContractInfo> empContractInfos = iEmpContractInfoService.findEmpContractinfos(queryRequest, empContractInfo1).getRecords();
            for (EmpContractInfo empCon:empContractInfos){
                empCon.setContractStatusName(contractstatus.get(empCon.getContractStatus()));
            }
            //调岗记录
            String[] empJobChange = { "现部门", "现岗位", "姓名", "原部门", "原岗位", "调岗日期", "调岗类型"};
            EmpJobChange empJobChange1=new EmpJobChange();
            empJobChange1.setEmpNumb(empNum);
            List<Map<String, Object>> empJobChangeList = iEmpJobChangeService.findEmpJobChanges(queryRequest, empJobChange1).getRecords();
            for (Map<String, Object> map:empJobChangeList){
                map.put("changeType",changeType.get(map.get("changeType")).toString());
            }
            //请假记录
            String[] leaveInfo = { "开始时间", "结束时间", "请假天数", "请假类型", "到岗时间", "报备人", "备注"};
            EmpLeaveInfo empLeaveInfo=new EmpLeaveInfo();
            empLeaveInfo.setEmpNumb(empNum);
            List<EmpLeaveInfo> empLeaveInfos = iEmpLeaveInfoService.findEmpLeaveInfos(queryRequest, empLeaveInfo).getRecords();
            for (EmpLeaveInfo leaveInfo1:empLeaveInfos){
                leaveInfo1.setLeaveTypeName(leavetype.get(leaveInfo1.getLeaveType()));
            }
            //辞职申请
            String[] resign = { "辞职申请日期", "辞职事由", "汇报人", "备注"};
            EmpResign empResign=new EmpResign();
            empResign.setEmpNumb(empNum);
            List<EmpResign> empResigns = iEmpResignService.findEmpResigns(queryRequest, empResign).getRecords();
            //离职当月考勤
            String[] dimissionAttend = { "离职考勤月份", "出勤天数", "加班(天)", "加班(小时)", "有无代扣款项", "请假(天)", "旷工(天)", "备注"};
            EmpDimissionAttend empDimissionAttend=new EmpDimissionAttend();
            empDimissionAttend.setEmpNumb(empNum);
            List<EmpDimissionAttend> dimissionAttends = iEmpDimissionAttendService.findEmpDimissionattends(queryRequest, empDimissionAttend).getRecords();
            //入离职记录
            String[] dimissionLog = { "入职日期", "离职日期", "离职类型", "自离天数", "报备人", "备注"};
            EmpDimissionLog empDimissionLog=new EmpDimissionLog();
            empDimissionLog.setEmpNumb(empNum);
            List<Map<String, Object>> records1 = iEmpDimissionLogService.findEmpDimissionLogs(queryRequest, empDimissionLog).getRecords();
            for (Map<String, Object> objectMap:records1){
                objectMap.put("dimissionType",lztype.get(objectMap.get("dimissionType")).toString());
            }
            //失业金领取
            String[] unemployment = { "失业金申请日期", "申报事由", "汇报人", "审核人", "备注"};
            EmpUnemployment empUnemployment=new EmpUnemployment();
            empUnemployment.setEmpNumb(empNum);
            List<EmpUnemployment> empUnemployments = iEmpUnemploymentService.findEmpUnemployments(queryRequest, empUnemployment).getRecords();
           //社保申请
            String[] insurance = { "社保申请日期", "申请人", "社保档位", "是否已报告", "状态", "审核人", "备注"};
            EmpInsurance empInsurance=new EmpInsurance();
            empInsurance.setEmpNumb(empNum);
            List<EmpInsurance> empInsurances = iEmpInsuranceService.findEmpInsurances(queryRequest, empInsurance).getRecords();
            for (EmpInsurance leaveInfo1:empInsurances){
                leaveInfo1.setInsuranceGaers(insuranceGaers.get(leaveInfo1.getInsuranceGaers()));
                leaveInfo1.setReportStatusName(reportStatus.get(String.valueOf(leaveInfo1.getReportStatus())));
                leaveInfo1.setApplayStatusName(applayStatus.get(String.valueOf(leaveInfo1.getApplayStatus())));
            }
            //意外险案件
            String[] accidentCases = { "受伤日期", "受伤地点", "受伤部位", "受伤经过描述", "意外险诊断", "就诊医院", "是否住院", "床号", "报案时间", "递交资料时间", "递交人", "医疗总费用", "保险赔付费用"};
            EmpAccidentCases empAccidentCases=new EmpAccidentCases();
            empAccidentCases.setEmpNumb(empNum);
            List<EmpAccidentCases> empAccidentCases1 = iEmpAccidentCasesService.findEmpAccidentcasess(queryRequest, empAccidentCases).getRecords();
            for (EmpAccidentCases leaveInfo1:empAccidentCases1){
                leaveInfo1.setHospitalizatioFlagName(hospitalizatioFlag.get(leaveInfo1.getHospitalizatioFlag()));
            }
            //工伤案件
            String[] occupational = { "受伤日期", "受伤地点", "受伤部位", "受伤经过描述", "工伤诊断", "就诊医院", "就诊科室", "是否住院", "床号", "报案时间", "递交资料时间", "递交人", "医疗总费用", "已赔付医药费用"};
            EmpOccupational empOccupational=new EmpOccupational();
            empOccupational.setEmpNumb(empNum);
            List<EmpOccupational> empOccupationals = iEmpOccupationalService.findEmpOccupationals(queryRequest, empOccupational).getRecords();
            for (EmpOccupational leaveInfo1:empOccupationals){
                leaveInfo1.setHospitalizatioFlagName(hospitalizatioFlag.get(leaveInfo1.getHospitalizatioFlag()));
            }
            //劳资案件
            String[] laborTrouble = { "仲裁日期", "仲裁类型", "仲裁事由", "报备人", "备注", "仲裁赔付(元)", "状态", "案结日期"};
            EmpLaborTrouble empLaborTrouble=new EmpLaborTrouble();
            empLaborTrouble.setEmpNumb(empNum);
            List<EmpLaborTrouble> empLaborTroubles = iEmpLaborTroubleService.findEmpLabortroubles(queryRequest, empLaborTrouble).getRecords();
            for (EmpLaborTrouble leaveInfo1:empLaborTroubles){
                leaveInfo1.setArbitrationTypeName(zctype.get(leaveInfo1.getArbitrationType()));
                leaveInfo1.setArbitrationStatusName(reportStatus.get(String.valueOf(leaveInfo1.getArbitrationStatus())));
            }
            //不良记录
            String[] badRecord = { "不良记录日期", "不良记录描述", "汇报人", "备注"};
            EmpBadRecord empBadRecord=new EmpBadRecord();
            empBadRecord.setEmpNumb(empNum);
            List<EmpBadRecord> empBadRecords = iEmpBadRecordService.findEmpBadrecords(queryRequest, empBadRecord).getRecords();
            //备注
            String[] remarkInfo = { "备注日期", "备注信息"};
            EmpRemarkInfo empRemarkInfo=new EmpRemarkInfo();
            empRemarkInfo.setEmpNumb(empNum);
            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;
    }
}
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/util/CreatePdf.java
New file
@@ -0,0 +1,780 @@
package cc.mrbird.febs.server.hr.util;
import cc.mrbird.febs.server.hr.entity.*;
import cc.mrbird.febs.server.hr.po.User;
import cc.mrbird.febs.server.hr.service.IEmpWorkExperienceService;
import cn.hutool.core.util.StrUtil;
import com.itextpdf.text.*;
import com.itextpdf.text.pdf.BaseFont;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
import io.netty.util.internal.StringUtil;
import org.apache.poi.hssf.usermodel.HeaderFooter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class CreatePdf {
    Document document = new Document();// 建立一个Document对象
    private static Font headfont;// 设置字体大小
    private static Font keyfont;// 设置字体大小
    private static Font textfont;// 设置字体大小
    static {
        // 中文格式
        BaseFont bfChinese;
        try {
            // 设置中文显示
            bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
            headfont = new Font(bfChinese, 15, Font.BOLD);// 设置字体大小
            keyfont = new Font(bfChinese, 10, Font.BOLD);// 设置字体大小
            textfont = new Font(bfChinese, 10, Font.NORMAL);// 设置字体大小
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * 文成文件
     *
     * @param file
     *            待生成的文件名
     */
    public CreatePdf(File file) {
        document.setPageSize(PageSize.A3);// 设置页面大小
        try {
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file));
            HeaderHandle footer=new HeaderHandle("12",Font.NORMAL,PageSize.A4);
            writer.setPageEvent(footer);
            document.open();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    public CreatePdf() {
    }
    public void initFile(File file) {
        document.setPageSize(PageSize.A4);// 设置页面大小
        try {
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file));
            HeaderHandle footer=new HeaderHandle("12",Font.NORMAL,PageSize.A4);
            writer.setPageEvent(footer);
            document.open();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    int maxWidth = 842;
    /**
     * 为表格添加一个内容
     *
     * @param value
     *            值
     * @param font
     *            字体
     * @param align
     *            对齐方式
     * @return 添加的文本框
     */
    public PdfPCell createCell(String value, Font font, int align) {
        PdfPCell cell = new PdfPCell();
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setHorizontalAlignment(align);
        cell.setPhrase(new Phrase(value, font));
        return cell;
    }
    /**
     * 为表格添加一个内容
     *
     * @param value
     *            值
     * @param font
     *            字体
     * @return 添加的文本框
     */
    public PdfPCell createCell(String value, Font font) {
        PdfPCell cell = new PdfPCell();
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setPhrase(new Phrase(value, font));
        return cell;
    }
    /**
     * 为表格添加一个内容
     *
     * @param value
     *            值
     * @param font
     *            字体
     * @param align
     *            对齐方式
     * @param colspan
     *            占多少列
     * @return 添加的文本框
     */
    public PdfPCell createCell(String value, Font font, int align, int colspan) {
        PdfPCell cell = new PdfPCell();
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setHorizontalAlignment(align);
        cell.setColspan(colspan);
        cell.setPhrase(new Phrase(value, font));
        return cell;
    }
    /**
     * 为表格添加一个内容
     *
     * @param value
     *            值
     * @param font
     *            字体
     * @param align
     *            对齐方式
     * @param colspan
     *            占多少列
     * @param boderFlag
     *            是否有有边框
     * @return 添加的文本框
     */
    public PdfPCell createCell(String value, Font font, int align, int colspan, boolean boderFlag) {
        PdfPCell cell = new PdfPCell();
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setHorizontalAlignment(align);
        cell.setColspan(colspan);
        cell.setPhrase(new Phrase(value, font));
        cell.setPadding(3.0f);
        if (!boderFlag) {
            cell.setBorder(0);
            cell.setPaddingTop(15.0f);
            cell.setPaddingBottom(8.0f);
        }
        return cell;
    }
    /**
     * 创建一个表格对象
     *
     * @param colNumber
     *            表格的列数
     * @return 生成的表格对象
     */
    public PdfPTable createTable(int colNumber) {
        PdfPTable table = new PdfPTable(colNumber);
        try {
            table.setTotalWidth(maxWidth);
            table.setLockedWidth(true);
            table.setHorizontalAlignment(Element.ALIGN_CENTER);
            table.getDefaultCell().setBorder(1);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return table;
    }
    public PdfPTable createTable(float[] widths) {
        PdfPTable table = new PdfPTable(widths);
        try {
            table.setTotalWidth(maxWidth);
            table.setLockedWidth(true);
            table.setHorizontalAlignment(Element.ALIGN_CENTER);
            table.getDefaultCell().setBorder(1);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return table;
    }
    public PdfPTable createBlankTable() {
        PdfPTable table = new PdfPTable(1);
        table.getDefaultCell().setBorder(0);
        table.addCell(createCell("", keyfont));
        table.setSpacingAfter(20.0f);
        table.setSpacingBefore(20.0f);
        return table;
    }
    public static Font getPdfChineseFont() throws Exception {
        BaseFont bfChinese = BaseFont.createFont("STSongStd-Light", "UniGB-UCS2-H",
                BaseFont.NOT_EMBEDDED);
        Font fontChinese = new Font(bfChinese, 12, Font.NORMAL);
        return fontChinese;
    }
    public static void setTableStyle(PdfPTable table, PdfPCell cell) {
// 设置表格样式
        table.setLockedWidth(true);
        table.setTotalWidth(500);
        table.setHorizontalAlignment(Element.ALIGN_LEFT);
// 设置单元格样式
        cell.setMinimumHeight(35);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        cell.setBackgroundColor(BaseColor.WHITE);
        cell.setBorder(0);
        cell.setBorderWidthTop(0.1f);
        cell.setBorderWidthBottom(0.1f);
        cell.setBorderWidthLeft(0.1f);
        cell.setBorderWidthRight(0.1f);
        cell.setBorderColorBottom(BaseColor.BLACK);
        cell.setBorderColorLeft(BaseColor.BLACK);
        cell.setBorderColorRight(BaseColor.BLACK);
        cell.setBorderColorTop(BaseColor.BLACK);
        cell.setPadding(3);
    }
    /**
     * @param
     *
     * @param
     *
     * @param
     * @param
     * @param baseinfo
     * @param empBaseInfoList
     * @param
     * @param workhead
     * @param empWorkExperiences1
     * @param
     * @param empPhysicalhead
     * @param records
     * @param
     * @param empContractInfo
     * @param empContractInfos
     * @param
     * @param empJobChange
     * @param empJobChangeList
     * @param
     * @param leaveInfo
     * @param empLeaveInfos
     * @param
     * @param resign
     * @param empResigns
     * @param
     * @param dimissionAttend
     * @param dimissionAttends
     * @param
     * @param dimissionLog
     * @param records1
     * @param
     * @param unemployment
     * @param empUnemployments
     * @param
     * @param insurance
     * @param empInsurances
     * @param
     * @param accidentCases
     * @param empAccidentCases1
     * @param
     * @param occupational
     * @param empOccupationals
     * @param
     * @param laborTrouble
     * @param empLaborTroubles
     * @param
     * @param badRecord
     * @param empBadRecords
     * @param
     * @param remarkInfo
     * @param empRemarkInfos
     * @param
     */
    public <T> void generatePDF(String[] baseinfo, List<EmpBaseInfo> empBaseInfoList, int baseinfolength,
                                String[] workhead, List<EmpWorkExperience> empWorkExperiences1, int workheadlength,
                                String[] empPhysicalhead, List<EmpPhysicalExam> records, int empPhysicalheadlength,
                                String[] empContractInfo, List<EmpContractInfo> empContractInfos, int empContractInfolength,
                                String[] empJobChange, List<Map<String, Object>> empJobChangeList, int empJobChangelength,
                                String[] leaveInfo, List<EmpLeaveInfo> empLeaveInfos, int leaveInfolength,
                                String[] resign, List<EmpResign> empResigns, int resignlength,
                                String[] dimissionAttend, List<EmpDimissionAttend> dimissionAttends, int dimissionAttendlength,
                                String[] dimissionLog, List<Map<String, Object>> records1, int dimissionLoglength,
                                String[] unemployment, List<EmpUnemployment> empUnemployments, int unemploymentlength,
                                String[] insurance, List<EmpInsurance> empInsurances, int insurancelength,
                                String[] accidentCases, List<EmpAccidentCases> empAccidentCases1, int accidentCaseslength,
                                String[] occupational, List<EmpOccupational> empOccupationals, int occupationallength,
                                String[] laborTrouble, List<EmpLaborTrouble> empLaborTroubles, int laborTroublelength,
                                String[] badRecord, List<EmpBadRecord> empBadRecords, int badRecordlength,
                                String[] remarkInfo, List<EmpRemarkInfo> empRemarkInfos, int remarkInfolength) {
        // 创建一个只有colNum列的表格
        DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd");
        document.addHeader("标题","标题");
        EmpBaseInfo empBaseInfo = empBaseInfoList.get(0);
        PdfPTable workheadtable = createTable(workheadlength);
        PdfPTable empPhysicalheadtable = createTable(empPhysicalheadlength);
        PdfPTable empContractInfotable = createTable(empContractInfolength);
        PdfPTable empJobChangetable = createTable(empJobChangelength);
        PdfPTable leaveInfotable = createTable(leaveInfolength);
        PdfPTable resigntable = createTable(resignlength);
        PdfPTable dimissionAttendtable = createTable(dimissionAttendlength);
        PdfPTable dimissionLogtable = createTable(dimissionLoglength);
        PdfPTable unemploymenttable = createTable(unemploymentlength);
        PdfPTable insurancetable = createTable(insurancelength);
        PdfPTable accidentCasestable = createTable(accidentCaseslength);
        PdfPTable occupationaltable = createTable(occupationallength);
        PdfPTable laborTroubletable = createTable(laborTroublelength);
        PdfPTable badRecordtable = createTable(badRecordlength);
        PdfPTable remarkInfotable = createTable(remarkInfolength);
        Object[][] basicDatas = {
                {"档案号",empBaseInfo.getEmpNumb(),
                        "姓名",empBaseInfo.getEmpName(),
                        "性别",empBaseInfo.getSexName()},
                {"部门(护卫点)",empBaseInfo.getDeptName(),
                        "岗位",empBaseInfo.getJobName(),
                        "员工类别",empBaseInfo.getEmpTypeName()==null?"":empBaseInfo.getEmpTypeName()},
                {"民族",empBaseInfo.getNationName()==null?"":empBaseInfo.getNationName(),
                        "年龄",empBaseInfo.getAge()==null?"":empBaseInfo.getAge(),
                        "婚姻状态",empBaseInfo.getMarriageName()==null?"":empBaseInfo.getMarriageName()},
                {"身份证有效期",empBaseInfo.getCertificateValidity()==null?"":format1.format(empBaseInfo.getCertificateValidity()),
                        "身高(cm)",empBaseInfo.getStature()==null?"":empBaseInfo.getStature(),
                        "政治面貌",empBaseInfo.getNativePlaceName()==null?"":empBaseInfo.getNativePlaceName()},
                {"出生日期",empBaseInfo.getBirthdate()==null?"":format1.format(empBaseInfo.getBirthdate()),
                        "最高学历",empBaseInfo.getEducationName()==null?"":empBaseInfo.getEducationName(),
                        "籍贯",empBaseInfo.getNativePlaceName()==null?"":empBaseInfo.getNativePlaceName()},
                {"户籍地址",empBaseInfo.getCensusAddress()==null?"":empBaseInfo.getCensusAddress(),
                        "现住址",empBaseInfo.getCurrentAddress()==null?"":empBaseInfo.getCurrentAddress(),
                        "保安员回执",empBaseInfo.getReturnReceipt()==null?"":empBaseInfo.getReturnReceipt()},
                {"保安员证号",empBaseInfo.getGuardNumb()==null?"":empBaseInfo.getGuardNumb(),
                        "档案情况",empBaseInfo.getArchivesStatus()==null?"":empBaseInfo.getArchivesStatus(),
                        "银行名称",empBaseInfo.getBankName()==null?"":empBaseInfo.getBankName()},
                {"银行账号",empBaseInfo.getBankNumb()==null?"":empBaseInfo.getBankNumb(),
                        "电话号码",empBaseInfo.getTelePhone()==null?"":empBaseInfo.getTelePhone(),
                        "入职日期",empBaseInfo.getEntryDate()==null?"":format1.format(empBaseInfo.getEntryDate())},
                {"保险类型",empBaseInfo.getInsuranceType()==null?"":empBaseInfo.getInsuranceType(),
                        "社保电脑号",empBaseInfo.getSocialNumb()==null?"":empBaseInfo.getSocialNumb(),
                        "招聘介绍人",empBaseInfo.getIntroducer()==null?"":empBaseInfo.getIntroducer()},
                {"入司工龄",empBaseInfo.getSeniority()==null?"":empBaseInfo.getSeniority(),
                        "工作证",empBaseInfo.getEmpCardStatusName()==null?"":empBaseInfo.getEmpCardStatusName(),
                        "家庭成员及关系",empBaseInfo.getFamily()==null?"":empBaseInfo.getFamily()},
                {"紧急联系电话",empBaseInfo.getUrgencyPhone()==null?"":empBaseInfo.getUrgencyPhone(),
                        "员工手册",empBaseInfo.getHandbookStatusName()==null?"":empBaseInfo.getHandbookStatusName(),
                        "相关证件",empBaseInfo.getCertificateListName()==null?"":empBaseInfo.getCertificateListName()},
                {"身份证号码",empBaseInfo.getCertificateNumb()==null?"":empBaseInfo.getCertificateNumb()}};
//            每个cell的宽度
        float[] widthss = {400, 400, 400, 400,400, 400};
//          创建一个表格,每一行有四个cell
        PdfPTable basicTable = new PdfPTable(widthss);
        basicTable.addCell(createCell("基本信息:", keyfont, Element.ALIGN_LEFT,basicDatas.length, false));
        // 添加备注,靠左,不显示边框
//            外层循环表格的行
        for (int i = 0; i < basicDatas.length; i++) {
//            内层循环每一行具体数据
            for (int j = 0; j < basicDatas[i].length; j++) {
//          新建一个cell
                PdfPCell cell = new PdfPCell();
//            这个方法是统一设置表格和cell的样式,下面会写
                setTableStyle(basicTable, cell);
//            cell中需要填充数据的格式
                Paragraph paragraph =
                        null;
                try {
                    paragraph = new Paragraph(StrUtil.toString(basicDatas[i][j]), getPdfChineseFont());
                } catch (Exception e) {
                    e.printStackTrace();
                }
//          设置cell的值
                cell.setPhrase(paragraph);
//            将cell添加到表格中
                basicTable.addCell(cell);
            }
        }
        // 添加备注,靠左,不显示边框
        workheadtable.addCell(createCell("工作经历:", keyfont, Element.ALIGN_LEFT, workheadlength, false));
        // 添加备注,靠左,不显示边框
        empPhysicalheadtable.addCell(createCell("体检信息:", keyfont, Element.ALIGN_LEFT, empPhysicalheadlength, false));
        // 添加备注,靠左,不显示边框
        empContractInfotable.addCell(createCell("合同信息:", keyfont, Element.ALIGN_LEFT, empContractInfolength, false));
        // 添加备注,靠左,不显示边框
        empJobChangetable.addCell(createCell("调岗记录:", keyfont, Element.ALIGN_LEFT, empJobChangelength, false));
        // 添加备注,靠左,不显示边框
        leaveInfotable.addCell(createCell("请假记录:", keyfont, Element.ALIGN_LEFT, leaveInfolength, false));
        // 添加备注,靠左,不显示边框
        resigntable.addCell(createCell("辞职申请:", keyfont, Element.ALIGN_LEFT, resignlength, false));
        // 添加备注,靠左,不显示边框
        dimissionAttendtable.addCell(createCell("离职当月考勤:", keyfont, Element.ALIGN_LEFT, dimissionAttendlength, false));
        // 添加备注,靠左,不显示边框
        dimissionLogtable.addCell(createCell("入离职记录:", keyfont, Element.ALIGN_LEFT, dimissionLoglength, false));
        // 添加备注,靠左,不显示边框
        unemploymenttable.addCell(createCell("失业金领取:", keyfont, Element.ALIGN_LEFT, unemploymentlength, false));
        // 添加备注,靠左,不显示边框
        insurancetable.addCell(createCell("社保申请:", keyfont, Element.ALIGN_LEFT, insurancelength, false));
        // 添加备注,靠左,不显示边框
        accidentCasestable.addCell(createCell("意外险案件:", keyfont, Element.ALIGN_LEFT, accidentCaseslength, false));
        // 添加备注,靠左,不显示边框
        occupationaltable.addCell(createCell("工伤案件:", keyfont, Element.ALIGN_LEFT, occupationallength, false));
        // 添加备注,靠左,不显示边框
        laborTroubletable.addCell(createCell("劳资案件:", keyfont, Element.ALIGN_LEFT, laborTroublelength, false));// 添加备注,靠左,不显示边框
        badRecordtable.addCell(createCell("不良记录:", keyfont, Element.ALIGN_LEFT, badRecordlength, false));
        // 添加备注,靠左,不显示边框
        remarkInfotable.addCell(createCell("备注:", keyfont, Element.ALIGN_LEFT, remarkInfolength, false));
// 添加备注,靠左,不显示边框
        // 设置表头
        for (int i = 0; i < workheadlength; i++) {
            workheadtable.addCell(createCell(workhead[i], keyfont, Element.ALIGN_CENTER));
        }
        for (int i = 0; i < empPhysicalheadlength; i++) {
            empPhysicalheadtable.addCell(createCell(empPhysicalhead[i], keyfont, Element.ALIGN_CENTER));
        }
        for (int i = 0; i < empContractInfolength; i++) {
            empContractInfotable.addCell(createCell(empContractInfo[i], keyfont, Element.ALIGN_CENTER));
        }
        for (int i = 0; i < empJobChangelength; i++) {
            empJobChangetable.addCell(createCell(empJobChange[i], keyfont, Element.ALIGN_CENTER));
        }
        for (int i = 0; i < leaveInfolength; i++) {
            leaveInfotable.addCell(createCell(leaveInfo[i], keyfont, Element.ALIGN_CENTER));
        }
        for (int i = 0; i < resignlength; i++) {
            resigntable.addCell(createCell(resign[i], keyfont, Element.ALIGN_CENTER));
        }
        for (int i = 0; i < dimissionAttendlength; i++) {
            dimissionAttendtable.addCell(createCell(dimissionAttend[i], keyfont, Element.ALIGN_CENTER));
        }
        for (int i = 0; i < dimissionLoglength; i++) {
            dimissionLogtable.addCell(createCell(dimissionLog[i], keyfont, Element.ALIGN_CENTER));
        }
        for (int i = 0; i < unemploymentlength; i++) {
            unemploymenttable.addCell(createCell(unemployment[i], keyfont, Element.ALIGN_CENTER));
        }
        for (int i = 0; i < insurancelength; i++) {
            insurancetable.addCell(createCell(insurance[i], keyfont, Element.ALIGN_CENTER));
        }
        for (int i = 0; i < accidentCaseslength; i++) {
            accidentCasestable.addCell(createCell(accidentCases[i], keyfont, Element.ALIGN_CENTER));
        }
        for (int i = 0; i < occupationallength; i++) {
            occupationaltable.addCell(createCell(occupational[i], keyfont, Element.ALIGN_CENTER));
        }
        for (int i = 0; i < laborTroublelength; i++) {
            laborTroubletable.addCell(createCell(laborTrouble[i], keyfont, Element.ALIGN_CENTER));
        }
        for (int i = 0; i < badRecordlength; i++) {
            badRecordtable.addCell(createCell(badRecord[i], keyfont, Element.ALIGN_CENTER));
        }
        for (int i = 0; i < remarkInfolength; i++) {
            remarkInfotable.addCell(createCell(remarkInfo[i], keyfont, Element.ALIGN_CENTER));
        }
        if (null != empWorkExperiences1 && empWorkExperiences1.size() > 0) {
            int size = empWorkExperiences1.size();
            for (int i = 0; i < size; i++) {
                EmpWorkExperience user = empWorkExperiences1.get(i);
                workheadtable.addCell(createCell(user.getBeginDate()==null?"":format1.format(user.getBeginDate()), textfont));
                workheadtable.addCell(createCell(user.getEndDate()==null?"":format1.format(user.getEndDate()), textfont));
                workheadtable.addCell(createCell(user.getWorkUnit()==null?"":user.getWorkUnit(), textfont));
                workheadtable.addCell(createCell(user.getJobContent()==null?"":user.getJobContent() , textfont));
            }
        }
        if (null != records && records.size() > 0) {
            int size = records.size();
            for (int i = 0; i < size; i++) {
                EmpPhysicalExam user = records.get(i);
                empPhysicalheadtable.addCell(createCell(user.getHospital()==null?"":user.getHospital(), textfont));
                empPhysicalheadtable.addCell(createCell(user.getPhysicalExamDate()==null?"":format1.format(user.getPhysicalExamDate()), textfont));
                empPhysicalheadtable.addCell(createCell(user.getPhysicalExamTypeName()==null?"":user.getPhysicalExamTypeName(), textfont));
                empPhysicalheadtable.addCell(createCell(user.getBloodPressure()==null?"":user.getBloodPressure(), textfont));
                empPhysicalheadtable.addCell(createCell(user.getTransaminase()==null?"":user.getTransaminase(), textfont));
                empPhysicalheadtable.addCell(createCell(user.getEcgName()==null?"":user.getEcgName(), textfont));
                empPhysicalheadtable.addCell(createCell(user.getConclusion()==null?"":user.getConclusion(), textfont));
                empPhysicalheadtable.addCell(createCell(user.getReviewRecord()==null?"":user.getReviewRecord(), textfont));
                empPhysicalheadtable.addCell(createCell(user.getRemark()==null?"":user.getRemark(), textfont));
            }
        }
        if (null != empContractInfos && empContractInfos.size() > 0) {
            int size = empContractInfos.size();
            for (int i = 0; i < size; i++) {
                EmpContractInfo user = empContractInfos.get(i);
                empContractInfotable.addCell(createCell(user.getSigningDate()==null?"":format1.format(user.getSigningDate()), textfont));
                empContractInfotable.addCell(createCell(user.getEndDate()==null?"":format1.format(user.getEndDate()), textfont));
                empContractInfotable.addCell(createCell(user.getContractPeriod()==null?"":String.valueOf(user.getContractPeriod()), textfont));
                empContractInfotable.addCell(createCell(user.getContractStatusName()==null?"":user.getContractStatusName(), textfont));
                empContractInfotable.addCell(createCell(user.getTransactor()==null?"":user.getTransactor() , textfont));
            }
        }
        if (null != empJobChangeList && empJobChangeList.size() > 0) {
            int size = empJobChangeList.size();
            for (int i = 0; i < size; i++) {
                Map user = empJobChangeList.get(i);
                empJobChangetable.addCell(createCell(user.get("newDeptName")==null?"":user.get("newDeptName").toString(), textfont));
                empJobChangetable.addCell(createCell(user.get("newJobName")==null?"":user.get("newJobName").toString(), textfont));
                empJobChangetable.addCell(createCell(user.get("empName")==null?"":user.get("empName").toString(), textfont));
                empJobChangetable.addCell(createCell(user.get("oldDeptName")==null?"":user.get("oldDeptName").toString(), textfont));
                empJobChangetable.addCell(createCell(user.get("oldJobName")==null?"":user.get("oldJobName").toString(), textfont));
                empJobChangetable.addCell(createCell(user.get("changeDate")==null?"":user.get("changeDate").toString(), textfont));
                empJobChangetable.addCell(createCell(user.get("changeType")==null?"":user.get("changeType").toString(), textfont));
            }
        }
        if (null != records1 && records1.size() > 0) {
            int size = records1.size();
            for (int i = 0; i < size; i++) {
                Map user = records1.get(i);
                dimissionLogtable.addCell(createCell(user.get("entryDate")==null?"":user.get("entryDate").toString(), textfont));
                dimissionLogtable.addCell(createCell(user.get("dimissionDate")==null?"":user.get("dimissionDate").toString(), textfont));
                dimissionLogtable.addCell(createCell(user.get("dimissionType")==null?"":user.get("dimissionType").toString(), textfont));
                dimissionLogtable.addCell(createCell(user.get("selfLeaveDay")==null?"":user.get("selfLeaveDay").toString(), textfont));
                dimissionLogtable.addCell(createCell(user.get("reporter")==null?"":user.get("reporter").toString(), textfont));
                dimissionLogtable.addCell(createCell(user.get("remark")==null?"":user.get("remark").toString(), textfont));
            }
        }
        if (null != empLeaveInfos && empLeaveInfos.size() > 0) {
            int size = empLeaveInfos.size();
            for (int i = 0; i < size; i++) {
                EmpLeaveInfo user = empLeaveInfos.get(i);
                leaveInfotable.addCell(createCell(user.getBeginTime()==null?"":format1.format(user.getBeginTime()), textfont));
                leaveInfotable.addCell(createCell(user.getEndTime()==null?"":format1.format(user.getEndTime()), textfont));
                leaveInfotable.addCell(createCell(user.getLeaveDay()==null?"":String.valueOf(user.getLeaveDay()), textfont));
                leaveInfotable.addCell(createCell(user.getLeaveTypeName()==null?"":user.getLeaveTypeName(), textfont));
                leaveInfotable.addCell(createCell(user.getReturnDate()==null?"":format1.format(user.getReturnDate()), textfont));
                leaveInfotable.addCell(createCell(user.getReporter()==null?"":user.getReporter() , textfont));
                leaveInfotable.addCell(createCell(user.getRemark()==null?"":user.getRemark() , textfont));
            }
        }
        if (null != empResigns && empResigns.size() > 0) {
            int size = empResigns.size();
            for (int i = 0; i < size; i++) {
                EmpResign user = empResigns.get(i);
                resigntable.addCell(createCell(user.getApplayDate()==null?"":format1.format(user.getApplayDate()), textfont));
                resigntable.addCell(createCell(user.getReason()==null?"":user.getReason(), textfont));
                resigntable.addCell(createCell(user.getReporter()==null?"":user.getReporter() , textfont));
                resigntable.addCell(createCell(user.getRemark()==null?"":user.getRemark() , textfont));
            }
        }
        if (null != dimissionAttends && dimissionAttends.size() > 0) {
            int size = dimissionAttends.size();
            for (int i = 0; i < size; i++) {
                EmpDimissionAttend user = dimissionAttends.get(i);
                dimissionAttendtable.addCell(createCell(user.getAttendMonth()==null?"":user.getAttendMonth(), textfont));
                dimissionAttendtable.addCell(createCell(user.getAttendDays()==null?"":user.getAttendDays().toString() , textfont));
                dimissionAttendtable.addCell(createCell(user.getOvertimeDay()==null?"":user.getOvertimeDay().toString(), textfont));
                dimissionAttendtable.addCell(createCell(user.getOvertimeHour()==null?"":user.getOvertimeHour().toString(), textfont));
                dimissionAttendtable.addCell(createCell(user.getDeduct()==null?"":user.getDeduct(), textfont));
                dimissionAttendtable.addCell(createCell(user.getLeaveDay()==null?"":user.getLeaveDay().toString(), textfont));
                dimissionAttendtable.addCell(createCell(user.getAbsenteeism()==null?"":user.getAbsenteeism().toString(), textfont));
                dimissionAttendtable.addCell(createCell(user.getRemark()==null?"":user.getRemark() , textfont));
            }
        }
        if (null != empUnemployments && empUnemployments.size() > 0) {
            int size = empUnemployments.size();
            for (int i = 0; i < size; i++) {
                EmpUnemployment user = empUnemployments.get(i);
                unemploymenttable.addCell(createCell(user.getApplayDate()==null?"":format1.format(user.getApplayDate()), textfont));
                unemploymenttable.addCell(createCell(user.getApplayReason()==null?"":user.getApplayReason().toString() , textfont));
                unemploymenttable.addCell(createCell(user.getReporter()==null?"":user.getReporter().toString(), textfont));
                unemploymenttable.addCell(createCell(user.getAuditor()==null?"":user.getAuditor().toString(), textfont));
                unemploymenttable.addCell(createCell(user.getRemark()==null?"":user.getRemark() , textfont));
            }
        }
        if (null != empInsurances && empInsurances.size() > 0) {
            int size = empInsurances.size();
            for (int i = 0; i < size; i++) {
                EmpInsurance user = empInsurances.get(i);
                insurancetable.addCell(createCell(user.getApplayDate()==null?"":format1.format(user.getApplayDate()), textfont));
                insurancetable.addCell(createCell(user.getProposer()==null?"":user.getProposer().toString() , textfont));
                insurancetable.addCell(createCell(user.getInsuranceGaers()==null?"":user.getInsuranceGaers().toString(), textfont));
                insurancetable.addCell(createCell(user.getReportStatusName()==null?"":user.getReportStatusName().toString(), textfont));
                insurancetable.addCell(createCell(user.getApplayStatusName()==null?"":user.getApplayStatusName().toString(), textfont));
                insurancetable.addCell(createCell(user.getAuditor()==null?"":user.getAuditor().toString(), textfont));
                insurancetable.addCell(createCell(user.getRemark()==null?"":user.getRemark() , textfont));
            }
        }
        if (null != empAccidentCases1 && empAccidentCases1.size() > 0) {
            int size = empAccidentCases1.size();
            for (int i = 0; i < size; i++) {
                EmpAccidentCases user = empAccidentCases1.get(i);
                accidentCasestable.addCell(createCell(user.getInjuredTime()==null?"":format1.format(user.getInjuredTime()), textfont));
                accidentCasestable.addCell(createCell(user.getInjuredAddress()==null?"":user.getInjuredAddress().toString() , textfont));
                accidentCasestable.addCell(createCell(user.getInjuredPart()==null?"":user.getInjuredPart().toString(), textfont));
                accidentCasestable.addCell(createCell(user.getInjuredDescribe()==null?"":user.getInjuredDescribe().toString(), textfont));
                accidentCasestable.addCell(createCell(user.getInjuredDiacrisis()==null?"":user.getInjuredDiacrisis().toString(), textfont));
                accidentCasestable.addCell(createCell(user.getHospitalName()==null?"":user.getHospitalName().toString(), textfont));
                accidentCasestable.addCell(createCell(user.getHospitalizatioFlagName()==null?"":user.getHospitalizatioFlagName().toString(), textfont));
                accidentCasestable.addCell(createCell(user.getBedNumb()==null?"":user.getBedNumb().toString(), textfont));
                accidentCasestable.addCell(createCell(user.getReprotTime()==null?"":format1.format(user.getReprotTime()), textfont));
                accidentCasestable.addCell(createCell(user.getSubmitTime()==null?"":format1.format(user.getSubmitTime()), textfont));
                accidentCasestable.addCell(createCell(user.getSbumitBy()==null?"":user.getSbumitBy().toString(), textfont));
                accidentCasestable.addCell(createCell(user.getExpensesFee()==null?"":user.getExpensesFee().toString(), textfont));
                accidentCasestable.addCell(createCell(user.getInnsureFee()==null?"":user.getInnsureFee().toString() , textfont));
            }
        }
        if (null != empOccupationals && empOccupationals.size() > 0) {
            int size = empOccupationals.size();
            for (int i = 0; i < size; i++) {
                EmpOccupational user = empOccupationals.get(i);
                occupationaltable.addCell(createCell(user.getInjuredTime()==null?"":format1.format(user.getInjuredTime()), textfont));
                occupationaltable.addCell(createCell(user.getInjuredAddress()==null?"":user.getInjuredAddress().toString() , textfont));
                occupationaltable.addCell(createCell(user.getInjuredPart()==null?"":user.getInjuredPart().toString(), textfont));
                occupationaltable.addCell(createCell(user.getInjuredDescribe()==null?"":user.getInjuredDescribe().toString(), textfont));
                occupationaltable.addCell(createCell(user.getInjuredDiacrisis()==null?"":user.getInjuredDiacrisis().toString(), textfont));
                occupationaltable.addCell(createCell(user.getHospitalName()==null?"":user.getHospitalName().toString(), textfont));
                occupationaltable.addCell(createCell(user.getHospitalizatioFlagName()==null?"":user.getHospitalizatioFlagName().toString(), textfont));
                occupationaltable.addCell(createCell(user.getBedNumb()==null?"":user.getBedNumb().toString(), textfont));
                occupationaltable.addCell(createCell(user.getReportTime()==null?"":format1.format(user.getReportTime()), textfont));
                occupationaltable.addCell(createCell(user.getSubmitTime()==null?"":format1.format(user.getSubmitTime()), textfont));
                occupationaltable.addCell(createCell(user.getSbumitBy()==null?"":user.getSbumitBy().toString(), textfont));
                occupationaltable.addCell(createCell(user.getExpensesFee()==null?"":user.getExpensesFee().toString(), textfont));
                occupationaltable.addCell(createCell(user.getCompensated()==null?"":user.getCompensated().toString() , textfont));
            }
        }
        if (null != empLaborTroubles && empLaborTroubles.size() > 0) {
            int size = empLaborTroubles.size();
            for (int i = 0; i < size; i++) {
                EmpLaborTrouble user = empLaborTroubles.get(i);
                laborTroubletable.addCell(createCell(user.getArbitrationDate()==null?"":format1.format(user.getArbitrationDate()), textfont));
                laborTroubletable.addCell(createCell(user.getArbitrationTypeName()==null?"":user.getArbitrationTypeName().toString() , textfont));
                laborTroubletable.addCell(createCell(user.getArbitrationReason()==null?"":user.getArbitrationReason().toString(), textfont));
                laborTroubletable.addCell(createCell(user.getReporter()==null?"":user.getReporter().toString(), textfont));
                laborTroubletable.addCell(createCell(user.getRemark()==null?"":user.getRemark().toString(), textfont));
                laborTroubletable.addCell(createCell(user.getArbitrationPay()==null?"":user.getArbitrationPay().toString(), textfont));
                laborTroubletable.addCell(createCell(user.getArbitrationStatusName()==null?"":user.getArbitrationStatusName().toString(), textfont));
                laborTroubletable.addCell(createCell(user.getSettleDate()==null?"":format1.format(user.getSettleDate()), textfont));
            }
        }
        if (null != empBadRecords && empBadRecords.size() > 0) {
            int size = empBadRecords.size();
            for (int i = 0; i < size; i++) {
                EmpBadRecord user = empBadRecords.get(i);
                badRecordtable.addCell(createCell(user.getBadDate()==null?"":format1.format(user.getBadDate()), textfont));
                badRecordtable.addCell(createCell(user.getBadContent()==null?"":user.getBadContent().toString() , textfont));
                badRecordtable.addCell(createCell(user.getReporter()==null?"":user.getReporter().toString(), textfont));
                badRecordtable.addCell(createCell(user.getRemark()==null?"":user.getRemark().toString(), textfont));
            }
        }
        if (null != empRemarkInfos && empRemarkInfos.size() > 0) {
            int size = empRemarkInfos.size();
            for (int i = 0; i < size; i++) {
                EmpRemarkInfo user = empRemarkInfos.get(i);
                remarkInfotable.addCell(createCell(user.getRemarkDate()==null?"":format1.format(user.getRemarkDate()), textfont));
                remarkInfotable.addCell(createCell(user.getRemarkContent()==null?"":user.getRemarkContent().toString() , textfont));
            }
        }
        try {
            // 将表格添加到文档中
            document.add(basicTable);
            document.add(workheadtable);
            document.add(empPhysicalheadtable);
            document.add(empContractInfotable);
            document.add(empJobChangetable);
            document.add(leaveInfotable);
            document.add(resigntable);
            document.add(dimissionAttendtable);
            document.add(dimissionLogtable);
            document.add(unemploymenttable);
            document.add(insurancetable);
            document.add(accidentCasestable);
            document.add(occupationaltable);
            document.add(laborTroubletable);
            document.add(badRecordtable);
            document.add(remarkInfotable);
        } catch (DocumentException e) {
            e.printStackTrace();
        }
        // 关闭流
        document.close();
    }
    /**
     * 提供外界调用的接口,生成以head为表头,list为数据的pdf
     *
     * @param
     *            //数据表头
     * @param
     *            //数据
     * @param
     * @param baseinfo
     * @param empBaseInfoList
     * @param workhead
     * @param empWorkExperiences1
     * @param empPhysicalhead
     * @param records
     * @param empContractInfo
     * @param empContractInfos
     * @param empJobChange
     * @param empJobChangeList
     * @param leaveInfo
     * @param empLeaveInfos
     * @param resign
     * @param empResigns
     * @param dimissionAttend
     * @param dimissionAttends
     * @param dimissionLog
     * @param records1
     * @param unemployment
     * @param empUnemployments
     * @param insurance
     * @param empInsurances
     * @param accidentCases
     * @param empAccidentCases1
     * @param occupational
     * @param empOccupationals
     * @param laborTrouble
     * @param empLaborTroubles
     * @param badRecord
     * @param empBadRecords
     * @param remarkInfo
     * @param empRemarkInfos
     * @param response
     * @return //excel所在的路径
     */
    public <T> String generatePDFs(String[] baseinfo, List<EmpBaseInfo> empBaseInfoList, String[] workhead, List<EmpWorkExperience> empWorkExperiences1, String[] empPhysicalhead, List<EmpPhysicalExam> records, String[] empContractInfo, List<EmpContractInfo> empContractInfos, String[] empJobChange, List<Map<String, Object>> empJobChangeList, String[] leaveInfo, List<EmpLeaveInfo> empLeaveInfos, String[] resign, List<EmpResign> empResigns, String[] dimissionAttend, List<EmpDimissionAttend> dimissionAttends, String[] dimissionLog, List<Map<String, Object>> records1, String[] unemployment, List<EmpUnemployment> empUnemployments, String[] insurance, List<EmpInsurance> empInsurances, String[] accidentCases, List<EmpAccidentCases> empAccidentCases1, String[] occupational, List<EmpOccupational> empOccupationals, String[] laborTrouble, List<EmpLaborTrouble> empLaborTroubles, String[] badRecord, List<EmpBadRecord> empBadRecords, String[] remarkInfo, List<EmpRemarkInfo> empRemarkInfos, HttpServletResponse response) {
        final String FilePath = "pdfPath";
        String saveFilePathAndName = "";
        // 获得存储的根目录
        String savePath = new GetFilePlace().getFileDirFromProperties(FilePath);
        // 获得当天存储的路径,不存在则生成当天的文件夹
        String realSavePath = new GenerateFold().getFold(savePath);
        saveFilePathAndName = new GenerateFileName().generateFileName(realSavePath, "pdf",empBaseInfoList.get(0).getEmpName());
        File file = new File(saveFilePathAndName);
        try {
            file.createNewFile();
        } catch (IOException e1) {
            e1.printStackTrace();
        }
        initFile(file);
        try {
            file.createNewFile(); // 生成一个pdf文件
        } catch (IOException e) {
            e.printStackTrace();
        }
        new CreatePdf(file).generatePDF(baseinfo,empBaseInfoList,baseinfo.length,
                workhead, empWorkExperiences1,workhead.length,
                empPhysicalhead,records,empPhysicalhead.length,
                empContractInfo,empContractInfos,empContractInfo.length,
                empJobChange,empJobChangeList,empJobChange.length,
                leaveInfo,empLeaveInfos,leaveInfo.length,
                resign,empResigns,resign.length,
                dimissionAttend,dimissionAttends,dimissionAttend.length,
                dimissionLog,records1,dimissionLog.length,
                unemployment,empUnemployments,unemployment.length,
                insurance,empInsurances,insurance.length,
                accidentCases,empAccidentCases1,accidentCases.length,
                occupational,empOccupationals,occupational.length,
                laborTrouble,empLaborTroubles,laborTrouble.length,
                badRecord,empBadRecords,badRecord.length,
                remarkInfo,empRemarkInfos,remarkInfo.length);
        return saveFilePathAndName;
    }
}
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/util/GenerateFileName.java
New file
@@ -0,0 +1,30 @@
package cc.mrbird.febs.server.hr.util;
import javax.validation.constraints.NotBlank;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.UUID;
public class GenerateFileName {
    /**
     * 根据文件类别生成文件的名字,文件的命名规则是:文件目录/生成时间-uuid(全球唯一编码).文件类别
     * @param fileDir  文件的存储路径
     * @param fileType 文件的类别
     * @param empName
     * @return                 文件的名字
     */
    public String generateFileName(String fileDir, String fileType, String empName)
    {
        String saveFileName = "";
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSS");
        saveFileName += format.format(Calendar.getInstance().getTime());
        saveFileName += "-" + empName;
        saveFileName += "." + fileType;
        saveFileName = fileDir + File.separator + saveFileName;
        return saveFileName;
    }
}
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/util/GenerateFold.java
New file
@@ -0,0 +1,35 @@
package cc.mrbird.febs.server.hr.util;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class GenerateFold {
    /**
     * 查询当前生成的excel需要存在在哪个路径,如果存在则存储在相应的位置,否则生成改目录, 每天生成一个文件夹,文件夹的命名规则为 年月日的时间戳
     * @param foldName  生成excel保存路径
     * @return            现在的excel需要保存路径
     */
    public  String getFold(String foldName)
    {
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
        String todayStr = format.format(Calendar.getInstance().getTime());
        String foldPath = foldName + File.separator + todayStr;
        File file = new File(foldPath);
        if(!file.exists() && !file.isDirectory())
        {
            System.out.println("不存在");
            file.mkdirs();
        }
        else
        {
            System.out.println("存在");
        }
        return  foldPath;
    }
}
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/util/GetFilePlace.java
New file
@@ -0,0 +1,56 @@
package cc.mrbird.febs.server.hr.util;
import java.io.*;
import java.util.Properties;
public class GetFilePlace {
    /**
     * 读取文件,获取excel保存的根目录
     *
     * @return excel保存的根目录
     */
    public String getFilePath() {
        String dir = System.getProperty("user.dir"); // 获得tomcat所在的工作路径
        // 获取到存储了文件存储位置的filedir.properties 文件路径 --->java Project的文件路径
        String realDir = dir + File.separator +File.separator + "application.properties";
        return realDir;
    }
    /**
     * 获取filePath路径【properities文件】中key对应的值,
     *
     * @param filePath
     *            properities文件路径【包含properities文件】
     * @param key
     *            要查找的key值
     * @return key对应的value
     */
    public String GetValueByKey(String filePath, String key) {
        Properties pps = new Properties();
        try {
            InputStream in = new BufferedInputStream(new FileInputStream(filePath));
            pps.load(in);
            String value = pps.getProperty(key);
            in.close();
            return value;
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
    /**
     * 查询properities文件中可以对应的存储地点
     *
     * @param key
     *            查询主键
     * @return key对应的存储地址
     */
    public String getFileDirFromProperties(String key) {
        return GetValueByKey(getFilePath(), key);
    }
}
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/util/HeaderHandle.java
New file
@@ -0,0 +1,80 @@
package cc.mrbird.febs.server.hr.util;
import com.itextpdf.text.*;
import com.itextpdf.text.pdf.*;
import java.io.IOException;
public class HeaderHandle extends PdfPageEventHelper {
    /**
     * 页眉
     */
    public String header = "12121";
    /**
     * 表格式页眉
     */
    protected PdfPTable headerTable;
    /**
     * 文档字体大小,页脚页眉最好和文本大小一致
     */
    public int presentFontSize = 12;
    private float size=1.0f;
    /**
     * 文档页面大小,最好前面传入,否则默认为A4纸张
     */
    public Rectangle pageSize = PageSize.A4;
    // 基础字体对象
    public BaseFont bf = null;
    // 利用基础字体生成的字体对象,一般用于生成中文文字
    public Font fontDetail = null;
    /**
     *
     * Creates a new instance of PdfReportM1HeaderFooter 构造方法.
     *
     * @param yeMei
     *            页眉字符串
     * @param presentFontSize
     *            数据体字体大小
     * @param pageSize
     *            页面文档大小,A4,A5,A6横转翻转等Rectangle对象
     */
    public HeaderHandle(String yeMei, int presentFontSize, Rectangle pageSize) {
        this.header = yeMei;
        this.presentFontSize = presentFontSize;
        this.pageSize = pageSize;
    }
    public HeaderHandle(PdfPTable headerTable) {
        this.headerTable = headerTable;
    }
    public void setHeaderTable(PdfPTable headerTable) {
        this.headerTable = headerTable;
    }
    @Override
    public void onEndPage(PdfWriter writer, Document document) {
        try {
            if (bf == null) {
                bf = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", false);
            }
            if (fontDetail == null) {
                fontDetail = new Font(bf, presentFontSize, Font.BOLD);// 数据体字体
                fontDetail.setSize(size);
            }
        } catch (DocumentException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        // 1.写入页眉
        ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_LEFT, new Phrase(header, fontDetail), document.left(), document.top() + 20, 0);
        // rowEnd为-1 表示写入所有行
       // headerTable.writeSelectedRows(0, -1, document.left()+document.leftMargin()/2, document.top() + headerTable.getTotalHeight(), writer.getDirectContent());
    }
}
febs-server/febs-server-hr/src/main/resources/application.properties
New file
@@ -0,0 +1,2 @@
#pdf存放目录
pdfPath=D\:/appDataPdf
febs-server/febs-server-system/src/main/java/cc/mrbird/febs/server/system/controller/DicController.java
@@ -42,6 +42,7 @@
    @GetMapping("list")
    public FebsResponse dicList(QueryRequest request, Dic dic) {
        System.out.println("Hello Word");
        Map<String, Object> dataTable = FebsUtil.getDataTable(this.dicService.findDics(request, dic));
        return new FebsResponse().data(dataTable);
    }
febs-server/febs-server-system/src/main/java/cc/mrbird/febs/server/system/controller/DiciIemController.java
@@ -15,6 +15,7 @@
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
/**
@@ -48,7 +49,12 @@
        dicItem.setDicCode(dictType);
        return new FebsResponse().data(dicitemService.findDicItems(dicItem));
    }
    @GetMapping(value = "/types/{dictType}")
    public List<DicItem> dictTypes(@PathVariable String dictType) {
        DicItem dicItem = new DicItem();
        dicItem.setDicCode(dictType);
        return dicitemService.findDicItems(dicItem);
    }
    @GetMapping("list")
    public FebsResponse dicitemList(QueryRequest request, DicItem dicitem) {
        Map<String, Object> dataTable = FebsUtil.getDataTable(this.dicitemService.findDicItems(request, dicitem));