Sfoglia il codice sorgente

出入管理模块:登记簿重构初始化搭建;

IO_linweisheng_s 6 giorni fa
parent
commit
4eaec77584

+ 7 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/letter/vo/CoreIntroduceLetterOutInRequestVo.java

@@ -159,4 +159,11 @@ public class CoreIntroduceLetterOutInRequestVo {
     @ApiModelProperty(value = "登记簿Url")
     private String pdfUrl;
 
+    @ApiModelProperty(value = "提交人签名")
+    private String checkSign;
+
+    @ApiModelProperty(value = "审批人名称")
+    private String approveUser;
+
+
 }

+ 5 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/letter/controller/CoreIntroduceLetterController.java

@@ -288,4 +288,9 @@ public class CoreIntroduceLetterController extends BaseController {
         outInRequestUserService.removeById(outInRequestUserId);
         return success();
     }
+        @ApiOperation(value = "生成来访管理登记簿")
+    @GetMapping("build/{id}")
+    public AjaxResult pdf(@PathVariable("id") Long id) {
+        return coreIntroduceLetterService.buildOutInRecordPdf(id);
+    }
 }

+ 9 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/letter/service/ICoreIntroduceLetterService.java

@@ -9,6 +9,7 @@ import com.xunmei.common.core.domain.letter.vo.*;
 import com.xunmei.common.core.domain.panel.dto.PanelListDto;
 import com.xunmei.common.core.domain.panel.vo.PanelListVo;
 import com.xunmei.common.core.domain.panel.vo.WebPanelResult;
+import com.xunmei.common.core.web.domain.AjaxResult;
 import com.xunmei.common.core.web.page.TableDataInfo;
 
 import javax.servlet.http.HttpServletResponse;
@@ -133,4 +134,12 @@ public interface ICoreIntroduceLetterService extends IService<CoreIntroduceLette
      * @return 介绍信
      */
     CoreIntroduceLetterOutInRequestVo selectOutInRequestInfoById(Long id);
+
+    /**
+     * 生成登记簿
+     *
+     * @param requestId 介绍信主键
+     * @return 结果
+     */
+    public AjaxResult buildOutInRecordPdf(Long requestId);
 }

+ 235 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/letter/service/impl/CoreIntroduceLetterServiceImpl.java

@@ -7,13 +7,16 @@ import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy
 import com.alibaba.fastjson2.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xunmei.common.core.constant.CacheConstants;
 import com.xunmei.common.core.constant.DictConstants;
 import com.xunmei.common.core.constant.ErrorMsgConstants;
 import com.xunmei.common.core.constant.SecurityConstants;
+import com.xunmei.common.core.domain.R;
 import com.xunmei.common.core.domain.letter.domain.*;
 import com.xunmei.common.core.domain.letter.dto.*;
 import com.xunmei.common.core.domain.letter.vo.*;
@@ -21,9 +24,15 @@ import com.xunmei.common.core.domain.panel.dto.PanelListDto;
 import com.xunmei.common.core.domain.panel.enums.PanelTypeEnums;
 import com.xunmei.common.core.domain.panel.vo.PanelListVo;
 import com.xunmei.common.core.domain.panel.vo.WebPanelResult;
+import com.xunmei.common.core.domain.registerbook.domain.CoreRegisterBookPdf;
+import com.xunmei.common.core.enums.RegisterBookType;
 import com.xunmei.common.core.exception.SystemException;
+import com.xunmei.common.core.thread.ThreadPoolConfig;
 import com.xunmei.common.core.util.BeanHelper;
+import com.xunmei.common.core.utils.StringUtils;
+import com.xunmei.common.core.web.domain.AjaxResult;
 import com.xunmei.common.core.web.page.TableDataInfo;
+import com.xunmei.common.redis.utils.RedisUtils;
 import com.xunmei.common.security.utils.DictUtils;
 import com.xunmei.common.security.utils.SecurityUtils;
 import com.xunmei.core.edu.service.impl.ValueCellWriteHandler;
@@ -37,22 +46,28 @@ import com.xunmei.core.letter.mapper.CoreOutInRecordMapper;
 import com.xunmei.core.letter.service.ICoreIntroduceLetterOutInHistoryUserService;
 import com.xunmei.core.letter.service.ICoreIntroduceLetterOutInRequestUserService;
 import com.xunmei.core.letter.service.ICoreIntroduceLetterService;
+import com.xunmei.core.registerbook.service.ICoreRegisterBookPdfService;
 import com.xunmei.system.api.RemoteFileService;
 import com.xunmei.system.api.RemoteOrgService;
 import com.xunmei.system.api.RemoteRoleService;
 import com.xunmei.system.api.RemoteUserService;
 import com.xunmei.system.api.domain.SysOrg;
 import com.xunmei.system.api.function.RemoteCallHandlerExecutor;
+import com.xunmei.system.api.vo.SysOrgVO;
 import io.netty.util.internal.StringUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.net.URLEncoder;
+import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.concurrent.CompletableFuture;
 import java.util.stream.Collectors;
 
 /**
@@ -92,6 +107,13 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
     @Resource
     private RemoteOrgService orgService;
 
+    @Autowired
+    private ICoreRegisterBookPdfService registerBookPdfService;
+
+    @Autowired
+    @Qualifier(ThreadPoolConfig.SOC_EXECUTOR)
+    private ThreadPoolTaskExecutor threadPoolTaskExecutor;
+
     @Override
     public TableDataInfo<CoreIntroduceLetterVo> selectPage(CoreIntroduceLetterRequestDto request) {
         //未删除
@@ -993,7 +1015,12 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
         });
         outInRequestUserService.updateBatchById(users);
         // 人员信息回写介绍信人员,历史人员库
-        syncUserInfoToHistoryUserAndLetterUser(outInRequestDto,outInRequest);
+        syncUserInfoToHistoryUserAndLetterUser(outInRequestDto, outInRequest);
+
+        //生成出入管理登记簿PDF
+        if (outInRequestDto.getType() == 2 ) {
+            this.buildOutInRecordPdf(outInRequestDto.getId());
+        }
     }
 
     public void syncUserInfoToHistoryUserAndLetterUser (CoreIntroduceLetterUpdateOutInRequestDto outInRequestDto,CoreIntroduceLetterOutInRequest outInRequest) {
@@ -1055,4 +1082,211 @@ public class CoreIntroduceLetterServiceImpl extends ServiceImpl<CoreIntroduceLet
         }
         return coreIntroduceLetterVo;
     }
+
+    /**
+     * 提交时生成PDF
+     *
+     * @param requestId
+     */
+    public AjaxResult buildOutInRecordPdf(Long requestId) {
+        //获取介绍信信息
+        CoreIntroduceLetterOutInRequestVo coreIntroduceLetterVo = coreIntroduceLetterMapper.selectOneOutInRequestById(requestId);
+        coreIntroduceLetterVo.setLetterFile(
+                ObjectUtil.isNotEmpty(coreIntroduceLetterVo.getLetterFileStr())
+                        ? JSON.parseArray(coreIntroduceLetterVo.getLetterFileStr(), String.class) : null);
+        coreIntroduceLetterVo.setStartTimeStr(coreIntroduceLetterVo.getStartTime());
+        coreIntroduceLetterVo.setEndTimeStr(coreIntroduceLetterVo.getEndTime());
+
+        //获取机构信息
+        final List<SysOrgVO> orgList = RedisUtils.getCacheList(CacheConstants.ORG_CACHE_LIST_KEY);
+        SysOrg sysOrg = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.selectOrgById(coreIntroduceLetterVo.getOrgId(), SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
+
+        //获取PDF文件名
+        String fileName = registerBookPdfService.getPdfFileName(RegisterBookType.VISIT_RECORD, sysOrg);
+        fileName = fileName.replace("来访登记簿", "出入登记簿");
+        //拼凑PDF数据
+        Map<String, Object> data = this.getFtlEdu(coreIntroduceLetterVo);
+        data.put("fileName", fileName);
+        data.put("id", requestId);
+
+
+        log.info("来访管理登记簿数据准备完成,开始生成登记簿:{}", JSON.toJSONString(data));
+        String finalFileName = fileName;
+
+        CompletableFuture.runAsync(() -> {
+            log.info("来访管理登记簿数据准备完成,开始生成登记簿:{}", JSON.toJSONString(data));
+            R<String> r = RemoteCallHandlerExecutor.executeRemoteCall(() -> fileService.generateOutInPdf(data), ErrorMsgConstants.GENERATE_PDF_ERROR);
+            if (null == r || null == r.getData()) {
+                log.info("来访管理登记簿数据生成失败,参数:{}", JSON.toJSONString(data));
+                throw new SystemException(ErrorMsgConstants.GENERATE_PDF_ERROR);
+            }
+            log.info("来访管理登记簿数据生成成功,文件系统返回值:{}", JSON.toJSONString(r));
+            String pdfUrl = r.getData();
+            LambdaUpdateWrapper<CoreIntroduceLetterOutInRequest> updateWrapper = new LambdaUpdateWrapper<>();
+            updateWrapper.eq(CoreIntroduceLetterOutInRequest::getId, requestId);
+            updateWrapper.set(CoreIntroduceLetterOutInRequest::getPdfUrl, pdfUrl);
+            outInRequestMapper.update(null,updateWrapper);
+            log.info("来访管理登记簿数据生成成功,文件系统返回地址:{}", pdfUrl);
+            CoreRegisterBookPdf registerBookPdf = new CoreRegisterBookPdf();
+            registerBookPdf.setId(requestId);
+            registerBookPdf.setRegisterBookType(RegisterBookType.VISIT_RECORD.getNum());
+            //日期原先取的是以人员为单位的离开时间,现在改成以最后一个离开时间为日期
+            Date departureTime = (Date) data.get("maxTime");
+            registerBookPdf.setDate(departureTime);
+
+            registerBookPdf.setOrgId(coreIntroduceLetterVo.getOrgId());
+            registerBookPdf.setOrgName(coreIntroduceLetterVo.getOrgName());
+            registerBookPdf.setOrgPath(sysOrg.getPath());
+            registerBookPdf.setFileUrl(pdfUrl);
+            registerBookPdf.setFileName(finalFileName);
+            //registerBookPdf.setFileName(StringUtils.substringAfterLast(pdfUrl, File.separator));
+            registerBookPdfService.saveOrUpdate(registerBookPdf);
+        }, threadPoolTaskExecutor);
+
+        return AjaxResult.success("正在生成pdf,请稍后刷新页面查看!");
+    }
+
+    private Map<String, Object> getFtlEdu(CoreIntroduceLetterOutInRequestVo record) {
+        //获取机构信息
+        SysOrg inOrg = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.selectSysOrgById(SecurityUtils.getLoginUser().getOrgId(), SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
+
+        //获取人员信息
+        final LambdaQueryWrapper<CoreIntroduceLetterOutInRequestUser> oqw = new LambdaQueryWrapper<CoreIntroduceLetterOutInRequestUser>();
+        oqw.eq(CoreIntroduceLetterOutInRequestUser::getOutInRequestId, record.getId());
+        List<CoreIntroduceLetterOutInRequestUser> userList = outInRequestUserMapper.selectList(oqw);
+
+        //获取文件前缀
+        String prefixPath = RemoteCallHandlerExecutor.executeRemoteCall(() -> fileService.getLocalPathPrefix(), ErrorMsgConstants.QUERY_FILE_PATH_ERROR).getData();
+        String staticsPath = RemoteCallHandlerExecutor.executeRemoteCall(() -> fileService.getStaticPathPrefix(), ErrorMsgConstants.QUERY_FILE_PATH_ERROR).getData();
+
+        Map<String, Object> data = new HashMap<>();
+
+        //接待机构
+        String inOrgName = ObjectUtil.isNotEmpty(inOrg.getShortName()) ? inOrg.getShortName() : inOrg.getName();
+        data.put("inOrg", inOrgName);
+
+        //申请日期
+        String time = "";
+        Optional<Date> minTime = Optional.empty();
+        Optional<Date> maxTime = Optional.empty();
+
+        if (ObjectUtil.isNotEmpty(userList)) {
+            minTime = userList.stream().filter(item -> item.getArrivalTime() != null)
+                    .map(CoreIntroduceLetterOutInRequestUser::getArrivalTime)
+                    .min(Date::compareTo);
+
+            maxTime = userList.stream()
+                    .filter(item -> item.getDepartureTime() != null)
+                    .map(CoreIntroduceLetterOutInRequestUser::getDepartureTime)
+                    .max(Date::compareTo);
+        }
+        // 处理时间范围
+        if (minTime.isPresent() && maxTime.isPresent()) {
+            time = DateUtil.format(minTime.get(), "yyy年MM月dd日");
+        }
+
+
+        if (minTime.isPresent() && maxTime.isPresent()) {
+            if (!DateUtil.isSameDay(minTime.get(), maxTime.get())) {
+                time = dealTime(minTime.get(), maxTime.get());
+            }
+        }
+        //申请日期
+        data.put("time", StringUtils.isNotEmpty(time) ? time : StringUtil.EMPTY_STRING);
+
+        //来访事由
+        data.put("reasons", StringUtils.isNotEmpty(record.getLetterReasons()) ? record.getLetterReasons() : StringUtil.EMPTY_STRING);
+
+        //陪同人员人员
+        data.put("accompanyingPerson", record.getAccompanyingPerson());
+        //审批人名称
+        data.put("approveUser", record.getApproveUser());
+        //登记人员
+        data.put("createBy", record.getCreateBy());
+
+        //审批人签名
+        List<String> approveSignList = new ArrayList<>();
+        if (ObjectUtil.isNotEmpty(record.getApproveSignImg())) {
+            approveSignList.add(record.getApproveSignImg());
+        }
+        data.put("approveSign", getFileRealPath(approveSignList, prefixPath, staticsPath));
+
+        //登记人签名
+        List<String> checkSignList = new ArrayList<>();
+        if (ObjectUtil.isNotEmpty(record.getCheckSign())) {
+            checkSignList.add(record.getCheckSign());
+        }
+        data.put("checkSign", getFileRealPath(checkSignList, prefixPath, staticsPath));
+
+        //介绍信附件
+        String letterFileStr = record.getLetterFileStr();
+        if (ObjectUtil.isEmpty(letterFileStr)) {
+            data.put("letterFile", new ArrayList<String>());
+        } else {
+            List<String> jsonList = JSON.parseArray(letterFileStr, String.class);
+            List<String> strings = new ArrayList<>();
+
+            for (String json : jsonList) {
+                final Map map = JSON.parseObject(json, Map.class);
+                final String url = (String) map.get("imgPath");
+                if (ObjectUtil.isNotEmpty(url)) {
+                    strings.add(url);
+                } else {
+                    strings.add((String) map.get("url"));
+                }
+            }
+            data.put("letterFIle", getOutInFileRealPath(strings, prefixPath, staticsPath));
+        }
+
+        //人员信息
+        List<CoreIntroduceLetterOutInRequestUser> userInfos = record.getUserInfos();
+        if (ObjectUtil.isEmpty(userInfos)) {
+            data.put("userInfos", new ArrayList<CoreIntroduceLetterOutInRequestUser>());
+        } else {
+            for (CoreIntroduceLetterOutInRequestUser user : userInfos) {
+                if (!ObjectUtil.isEmpty(user.getImgFile())) {
+                    String path = user.getImgFile();
+                    if (path.contains(staticsPath)) {
+                        //删除 /statics 前缀路径
+                        path = path.replace(staticsPath, StringUtil.EMPTY_STRING);
+                        user.setImgFile(prefixPath + path);
+                    }
+                }
+            }
+            data.put("userInfos", userInfos);
+        }
+
+        return data;
+    }
+
+    private String dealTime(Date start, Date end) {
+        final SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分");
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(end);
+        String d = String.valueOf(calendar.get(Calendar.DAY_OF_MONTH));
+        if (d.length() == 1) {
+            d = "0" + calendar.get(Calendar.MINUTE);
+        }
+        String m = String.valueOf(calendar.get(Calendar.MONTH));
+        if (m.length() == 1) {
+            m = "0" + calendar.get(Calendar.HOUR_OF_DAY);
+        }
+        String dateStr = format.format(start) + "-" + m + "月" + d + "日";
+        return dateStr;
+    }
+
+    private List<String> getOutInFileRealPath(List<String> fileList, String prefixPath, String staticsPath) {
+        List<String> list = new ArrayList<>();
+        if (ObjectUtil.isEmpty(fileList)) {
+            return list;
+        }
+        for (String path : fileList) {
+            if (path.contains(staticsPath)) {
+                //删除 /statics 前缀路径
+                path = path.replace(staticsPath, StringUtil.EMPTY_STRING);
+            }
+            list.add(prefixPath + path);
+        }
+        return list;
+    }
 }

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/letter/service/impl/CoreOutInRecordServiceImpl.java

@@ -315,7 +315,7 @@ public class CoreOutInRecordServiceImpl extends ServiceImpl<CoreOutInRecordMappe
         //接待机构
         String inOrgName = ObjectUtil.isNotEmpty(inOrg.getShortName()) ? inOrg.getShortName() : inOrg.getName();
         data.put("inOrg", inOrgName);
-        //接待日期
+        //申请日期
         String time = DateUtil.format(record.getArrivalTime(), "yyyy年MM月dd日");
         data.put("time", StringUtils.isNotEmpty(time) ? time : StringUtil.EMPTY_STRING);
         //来访事由

+ 45 - 0
soc-modules/soc-modules-file/src/main/java/com/xunmei/file/enums/IdTypeEnums.java

@@ -0,0 +1,45 @@
+package com.xunmei.file.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.Arrays;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+@Getter
+@AllArgsConstructor
+public enum IdTypeEnums {
+
+    ID_CARD("身份证", 0),
+
+    WORK_CARD("工作证", 1),
+
+    OTHER("其他", 2);
+
+
+    private final String description;
+    private final Integer type;
+
+
+    //根据类型找描述
+    public static String description(Integer type) {
+        return Optional
+                .of(Arrays.stream(values())
+                        .filter(item -> item.type.equals(type))
+                        .collect(Collectors.toList()))
+                .filter(value -> !value.isEmpty())
+                .map(value -> value.get(0).description)
+                .orElse(null);
+    }
+
+    //根据描述找类型
+    public static Integer type(String description) {
+        return Optional.of(Arrays.stream(values())
+                        .filter(item -> item.description.equals(description))
+                        .collect(Collectors.toList()))
+                .filter(value -> !value.isEmpty())
+                .map(value -> value.get(0).type)
+                .orElse(null);
+    }
+}

+ 419 - 148
soc-modules/soc-modules-file/src/main/java/com/xunmei/file/utils/PdfUtil.java

@@ -3,13 +3,19 @@ package com.xunmei.file.utils;
 
 import cn.hutool.core.collection.ListUtil;
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.extra.spring.SpringUtil;
 import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONArray;
 import com.lowagie.text.*;
 import com.lowagie.text.pdf.*;
 import com.xunmei.common.core.constant.DictConstants;
 import com.xunmei.common.core.domain.iot.domain.IotAlarmSubsystem;
+import com.xunmei.common.core.domain.letter.domain.CoreIntroduceLetterOutInRequestUser;
+import com.xunmei.common.core.domain.letter.dto.CoreIntroduceLetterUserAddDto;
+import com.xunmei.common.core.exception.ServiceException;
 import com.xunmei.common.security.utils.DictUtils;
+import com.xunmei.file.enums.IdTypeEnums;
 import com.xunmei.file.vo.ItextPdfTableVo;
 import com.xunmei.system.api.domain.AccessDataVo;
 import com.xunmei.system.api.domain.CheckDataVo;
@@ -26,6 +32,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.text.SimpleDateFormat;
 import java.util.List;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -39,7 +46,7 @@ public class PdfUtil {
     }
 
     public static ItextPdfTableVo createTable(String filename, int numColumns, int fontSize) throws Exception {
-        Document document = createDocument(0, 0, 50, 50);
+        Document document = createDocument(0, 0, 50, 12);
         File file = FileUtils.getFile(filename);
         FileOutputStream fos = new FileOutputStream(file);
         final PdfWriter writer = PdfWriter.getInstance(document, fos);
@@ -52,7 +59,7 @@ public class PdfUtil {
         PdfPTable table = new PdfPTable(numColumns);
         // 设置各列列宽
         // table.setTotalWidth(new float[]{90, 100, 100, 120, 100, 100});
-        table.setSpacingBefore(16f);
+//        table.setSpacingBefore(16f);
         table.setSplitRows(true);
         table.setSplitLate(false);
         ItextPdfTableVo itextPdfTableVo = new ItextPdfTableVo();
@@ -78,6 +85,80 @@ public class PdfUtil {
         return cell;
     }
 
+    /**
+     * 创建单元格 - 固定单元格大小
+     * @param tableFont
+     * @param table
+     * @param content
+     * @param align
+     * @param colspan
+     * @param rowspan
+     * @param
+     * @return
+     */
+    public static PdfPCell createOutInPDFCell(Font tableFont, PdfPTable table, String content, int align, Integer colspan, Integer rowspan) {
+        final PdfPCell cell = outInCell(tableFont, content, align, colspan, rowspan);
+        table.addCell(cell);
+        return cell;
+    }
+    public static PdfPCell createOutInPDFCell(Font tableFont, PdfPTable table, String content, int align, Integer colspan, Integer rowspan, Float fixedHeight) {
+        final PdfPCell cell = OutInCell(tableFont, content, align, colspan, rowspan, fixedHeight);
+        table.addCell(cell);
+        return cell;
+    }
+
+    private static PdfPCell OutInCell(Font tableFont, String content, int align, Integer colspan, Integer rowspan, Float fixedHeight) {
+        PdfPCell cell = new PdfPCell(new Phrase(content, tableFont));
+        if (colspan != null && colspan > 0) {
+            cell.setColspan(colspan);
+        }
+        if (rowspan != null && rowspan > 0) {
+            cell.setRowspan(rowspan);
+        }
+
+        cell.setPaddingTop(2f);
+        cell.setPaddingBottom(7f);
+        cell.setPaddingLeft(8f);
+        cell.setPaddingRight(8f);
+
+        cell.setFixedHeight(fixedHeight);
+
+        cell.setLeading(0F, 1.2F);
+        if (PdfPCell.ALIGN_MIDDLE != align) {
+            cell.setHorizontalAlignment(align);
+        } else {
+            //设置单元格的垂直方向对齐方式
+            cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
+            //设置单元格的水平方向对齐方式
+            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
+        }
+        return cell;
+    }
+
+    private static PdfPCell outInCell(Font tableFont, String content, int align, Integer colspan, Integer rowspan) {
+        PdfPCell cell = new PdfPCell(new Phrase(content, tableFont));
+        if (colspan != null && colspan > 0) {
+            cell.setColspan(colspan);
+        }
+        if (rowspan != null && rowspan > 0) {
+            cell.setRowspan(rowspan);
+        }
+        cell.setPaddingTop(2f);
+        cell.setPaddingBottom(7f);
+        cell.setPaddingLeft(8f);
+        cell.setPaddingRight(8f);
+
+        cell.setLeading(0f, 1.2F);
+        if (PdfPCell.ALIGN_MIDDLE != align) {
+            cell.setHorizontalAlignment(align);
+        } else {
+            //设置单元格的垂直方向对齐方式
+            cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
+            //设置单元格的水平方向对齐方式
+            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
+        }
+        return cell;
+    }
     private static PdfPCell cell(Font tableFont, String content, int align, Integer colspan, Integer rowspan) {
         PdfPCell cell = new PdfPCell(new Phrase(content, tableFont));
         if (colspan != null && colspan > 0) {
@@ -110,10 +191,10 @@ public class PdfUtil {
         if (rowspan != null && rowspan > 0) {
             cell.setRowspan(rowspan);
         }
-        // cell.setPaddingTop(8f);
+//         cell.setPaddingTop(8f);
         cell.setPaddingLeft(paddingLeft);
         cell.setPaddingRight(paddingRight);
-        cell.setPaddingBottom(8f);
+//        cell.setPaddingBottom(8f);
         cell.setLeading(1F, 1.5F);
         if (PdfPCell.ALIGN_MIDDLE != align) {
             cell.setHorizontalAlignment(align);
@@ -223,7 +304,7 @@ public class PdfUtil {
         document.add(table);
         PdfPTable imageTable = new PdfPTable(6);
         final List<List<String>> listList = ListUtil.split((List<String>) data.get("fileImage"), 2);
-        createPDFCell(tableFont, imageTable, "图片附件", Element.ALIGN_MIDDLE, 1, listList.size()==0?1:listList.size());
+        createPDFCell(tableFont, imageTable, "图片附件", Element.ALIGN_MIDDLE, 1, listList.size() == 0 ? 1 : listList.size());
         for (List<String> stringList : listList) {
             PdfPTable innerTable = new PdfPTable(5);
             innerTable.setWidthPercentage(100F);
@@ -273,7 +354,7 @@ public class PdfUtil {
                         //序号
                         PdfUtil.createPDFCell(tableFont, table, String.valueOf(o), PdfPCell.ALIGN_MIDDLE, 2, 0);
                         // 检查内容
-                        String rowContent = listVo.get("pointName")+"";
+                        String rowContent = listVo.get("pointName") + "";
                         PdfUtil.createPDFCell(tableFont, table, rowContent, Element.ALIGN_LEFT, 6, 0);
                         // 检查情况
                         PdfUtil.createPDFCell(tableFont, table, ObjectUtil.isEmpty(listVo.get("resValue")) ? "" : (((Integer) listVo.get("resValue")) == 0 ? "正常" : "异常"), Element.ALIGN_MIDDLE, 2, 0);
@@ -404,150 +485,274 @@ public class PdfUtil {
         return result.toString();
     }
 
+    //    public static void dealOutInBody(Document document, PdfPTable table, Font tableFont, Map<String, Object> data) throws Exception {
+//        table.setSplitLate(false);
+//        table.setSplitRows(true);
+//        //第一行
+//        createPDFCell(tableFont, table, "接待机构", Element.ALIGN_MIDDLE, 1, 1);
+//        createPDFCell(tableFont, table, data.get("inOrg").toString(), Element.ALIGN_MIDDLE, 2, 1);
+//        createPDFCell(tableFont, table, "接待日期", Element.ALIGN_MIDDLE, 1, 1);
+//        createPDFCell(tableFont, table, data.get("time").toString(), Element.ALIGN_MIDDLE, 2, 1);
+//        //第二行
+//        createPDFCell(tableFont, table, "出入事由", Element.ALIGN_MIDDLE, 1, 1);
+//        createPDFCell(tableFont, table, data.get("reasons").toString(), Element.ALIGN_MIDDLE, 2, 1);
+//        createPDFCell(tableFont, table, "陪同人员", Element.ALIGN_MIDDLE, 1, 1);
+//        createPDFCell(tableFont, table, data.get("accompanyingPerson").toString(), Element.ALIGN_MIDDLE, 2, 1);
+//
+//        //第三行
+//        createPDFCell(tableFont, table, "申请单位", Element.ALIGN_MIDDLE, 1, 1);
+//        createPDFCell(tableFont, table, data.get("outOrgName").toString(), Element.ALIGN_MIDDLE, 2, 1);
+//        createPDFCell(tableFont, table, "出入人员", Element.ALIGN_MIDDLE, 1, 1);
+//        createPDFCell(tableFont, table, data.get("userName").toString(), Element.ALIGN_MIDDLE, 2, 1);
+//        //第四行
+//        createPDFCell(tableFont, table, "证件类型", Element.ALIGN_MIDDLE, 1, 1);
+//        createPDFCell(tableFont, table, data.get("idType").toString(), Element.ALIGN_MIDDLE, 2, 1);
+//        createPDFCell(tableFont, table, "证件号码", Element.ALIGN_MIDDLE, 1, 1);
+//        createPDFCell(tableFont, table, data.get("idCard").toString(), Element.ALIGN_MIDDLE, 2, 1);
+//        //第五行
+//        createPDFCell(tableFont, table, "进入时间", Element.ALIGN_MIDDLE, 1, 1);
+//        createPDFCell(tableFont, table, data.get("inTime").toString(), Element.ALIGN_MIDDLE, 2, 1);
+//        createPDFCell(tableFont, table, "离开时间", Element.ALIGN_MIDDLE, 1, 1);
+//        createPDFCell(tableFont, table, data.get("outTime").toString(), Element.ALIGN_MIDDLE, 2, 1);
+//
+//        //第六行
+//        createPDFCell(tableFont, table, "审批人", Element.ALIGN_MIDDLE, 1, 1);
+//        createPDFCell(tableFont, table, data.get("approveUser").toString(), Element.ALIGN_MIDDLE, 2, 1);
+//        createPDFCell(tableFont, table, "登记人", Element.ALIGN_MIDDLE, 1, 1);
+//        createPDFCell(tableFont, table, data.get("createBy").toString(), Element.ALIGN_MIDDLE, 2, 1);
+//
+//        //第七行
+//        createPDFCell(tableFont, table, "审批人签字", Element.ALIGN_MIDDLE, 1, 1);
+//        dealImageCell((List<String>) data.get("approveSign"), table, 1, 80, 30, 2, 1);
+//        createPDFCell(tableFont, table, "登记人签字", Element.ALIGN_MIDDLE, 1, 1);
+//        dealImageCell((List<String>) data.get("submitSign"), table, 1, 80, 30, 2, 1);
+////        //第8行
+////        createPDFCell(tableFont, table, "备注", Element.ALIGN_MIDDLE, 1, 1);
+////        createPDFCell(tableFont, table, data.get("remark").toString(), Element.ALIGN_MIDDLE, 5, 1);
+//
+//
+//        //证件图片
+//        createPDFCell(tableFont, table, "证件图片", Element.ALIGN_MIDDLE, 1, 1);
+//        //证件图片 图片填充
+//        final PdfPTable imageTable1 = getImage((List<String>) data.get("imageFile"), 2, 190, 130, 2,0f);
+//        final PdfPCell cell1 = new PdfPCell();
+//        cell1.setNoWrap(false);
+//        cell1.setPaddingLeft(4f);
+//        cell1.setPaddingRight(4f);
+//        cell1.setPaddingBottom(4f);
+//        cell1.setPaddingTop(4f);
+//        cell1.setColspan(5);
+//        cell1.setRowspan(1);
+//        //cell1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
+//        cell1.addElement(imageTable1);
+//        table.addCell(cell1);
+//
+//
+//
+//        List<String> files= (List<String>) data.get("file");
+//        List<String> files1=new ArrayList<>();
+//        List<String> files2= new ArrayList<>();
+//        // 没有备注图片时 需要把介绍信图片上移
+//        if(ObjectUtil.isNotEmpty(files))
+//        {
+//            files1= files.subList(0,1);
+//            if(files.size()>1)
+//            {
+//                files2= files.subList(1,files.size());
+//            }
+//        }
+//        else{
+//            files2=files;
+//        }
+//
+//        if(ObjectUtil.isNotEmpty(files1))
+//        {
+//            createPDFCell(tableFont, table, "介绍信附件", Element.ALIGN_MIDDLE, 1, 1);
+//            final PdfPTable imageTable3 = getImage(files1, 1, 380, 320, 1,0f);
+//            final PdfPCell cell3 = new PdfPCell();
+//            cell3.setNoWrap(false);
+//            cell3.setPaddingLeft(4f);
+//            cell3.setPaddingRight(4f);
+//            cell3.setPaddingBottom(4f);
+//            cell3.setPaddingTop(4f);
+//            cell3.setColspan(5);
+//            cell3.setRowspan(1);
+//            //cell1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
+//            cell3.addElement(imageTable3);
+//            table.addCell(cell3);
+//            document.add(table);
+//        }
+//        else { // 紧急类型的出入 可能没有介绍信图片
+//            document.add(table);
+//        }
+//
+//        if(files2.size()>0)
+//        {
+//            PdfPTable innerTable = new PdfPTable(6);
+//            createPDFCell(tableFont, innerTable, "介绍信附件", Element.ALIGN_MIDDLE, 1, 1);
+//
+//    //        createPDFCell(tableFont, table, "介绍信附件", Element.ALIGN_MIDDLE, 1, 1);
+//            final PdfPTable imageTable2 = getImage(files2, 2, 380, 340, 1,8f);
+//            final PdfPCell cell2 = new PdfPCell();
+//            cell2.setNoWrap(false);
+//            cell2.setPaddingLeft(4f);
+//            cell2.setPaddingRight(4f);
+//            cell2.setPaddingBottom(4f);
+//            cell2.setPaddingTop(4f);
+//            cell2.setColspan(5);
+//            cell2.setRowspan(1);
+//            cell2.addElement(imageTable2);
+//            innerTable.addCell(cell2);
+//            document.newPage();
+//            document.add(innerTable);
+//        }
+//
+//        List<String> checkImages= (List<String>) data.get("checkImage");
+//
+//        PdfPTable innerTable2 = new PdfPTable(6);
+//        createPDFCell(tableFont, innerTable2, "备注", Element.ALIGN_MIDDLE, 1, checkImages.isEmpty()?1:2);
+//        createPDFCell(tableFont, innerTable2, data.get("remark").toString(), Element.ALIGN_LEFT, 5, 1);
+//        // 核查结果图片为非必填,没有图片时不显示
+//        if(!checkImages.isEmpty())
+//        {
+//            final PdfPTable imageTable3 = getImage((List<String>) data.get("checkImage"), 2, 190, 190, 2,0f);
+//            final PdfPCell cell3 = new PdfPCell();
+//            cell3.setNoWrap(false);
+//            cell3.setPaddingLeft(4f);
+//            cell3.setPaddingRight(4f);
+//            cell3.setPaddingBottom(4f);
+//            cell3.setPaddingTop(4f);
+//            cell3.setColspan(5);
+//            cell3.setRowspan(1);
+//            //cell1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
+//            cell3.addElement(imageTable3);
+//            innerTable2.addCell(cell3);
+//        }
+//        document.add(innerTable2);
+//    }
     public static void dealOutInBody(Document document, PdfPTable table, Font tableFont, Map<String, Object> data) throws Exception {
         table.setSplitLate(false);
         table.setSplitRows(true);
-        //第一行
-        createPDFCell(tableFont, table, "接待机构", Element.ALIGN_MIDDLE, 1, 1);
-        createPDFCell(tableFont, table, data.get("inOrg").toString(), Element.ALIGN_MIDDLE, 2, 1);
-        createPDFCell(tableFont, table, "接待日期", Element.ALIGN_MIDDLE, 1, 1);
-        createPDFCell(tableFont, table, data.get("time").toString(), Element.ALIGN_MIDDLE, 2, 1);
-        //第二行
-        createPDFCell(tableFont, table, "出入事由", Element.ALIGN_MIDDLE, 1, 1);
-        createPDFCell(tableFont, table, data.get("reasons").toString(), Element.ALIGN_MIDDLE, 2, 1);
-        createPDFCell(tableFont, table, "陪同人员", Element.ALIGN_MIDDLE, 1, 1);
-        createPDFCell(tableFont, table, data.get("accompanyingPerson").toString(), Element.ALIGN_MIDDLE, 2, 1);
+        //第1行
+        createOutInPDFCell(tableFont, table, "接待机构", Element.ALIGN_MIDDLE, 1, 1);
+        createOutInPDFCell(tableFont, table, data.get("inOrg").toString(), Element.ALIGN_MIDDLE, 2, 1);
+        createOutInPDFCell(tableFont, table, "接待日期", Element.ALIGN_MIDDLE, 1, 1);
+        createOutInPDFCell(tableFont, table, data.get("time").toString(), Element.ALIGN_MIDDLE, 2, 1);
+        //第2行
+        createOutInPDFCell(tableFont, table, "出入事由", Element.ALIGN_MIDDLE, 1, 1,33F);
+        createOutInPDFCell(tableFont, table, data.get("reasons").toString(), Element.ALIGN_MIDDLE, 2, 1);
+        createOutInPDFCell(tableFont, table, "陪同人员", Element.ALIGN_MIDDLE, 1, 1);
+        createOutInPDFCell(tableFont, table, data.get("accompanyingPerson").toString(), Element.ALIGN_MIDDLE, 2, 1);
+
+        //第3行
+        createOutInPDFCell(tableFont, table, "审批人", Element.ALIGN_MIDDLE, 1, 1);
+        createOutInPDFCell(tableFont, table, data.get("approveUser").toString(), Element.ALIGN_MIDDLE, 2, 1);
+        createOutInPDFCell(tableFont, table, "登记人", Element.ALIGN_MIDDLE, 1, 1);
+        createOutInPDFCell(tableFont, table, data.get("createBy").toString(), Element.ALIGN_MIDDLE, 2, 1);
+
+        //第4行
+        createOutInPDFCell(tableFont, table, "审批人签字", Element.ALIGN_MIDDLE, 1, 1);
+        dealImageCell((List<String>) data.get("approveSign"), table, 1, 100, 50, 2, 1);
+        createOutInPDFCell(tableFont, table, "登记人签字", Element.ALIGN_MIDDLE, 1, 1);
+        dealImageCell((List<String>) data.get("checkSign"), table, 1, 100, 50, 2, 1);
+
+
+        List<String> letterFiles = (List<String>) data.get("letterFile");
+
+        List<String> files1 = new ArrayList<>();
+
+        List<String> files2 = new ArrayList<>();
 
-        //第三行
-        createPDFCell(tableFont, table, "申请单位", Element.ALIGN_MIDDLE, 1, 1);
-        createPDFCell(tableFont, table, data.get("outOrgName").toString(), Element.ALIGN_MIDDLE, 2, 1);
-        createPDFCell(tableFont, table, "出入人员", Element.ALIGN_MIDDLE, 1, 1);
-        createPDFCell(tableFont, table, data.get("userName").toString(), Element.ALIGN_MIDDLE, 2, 1);
-        //第四行
-        createPDFCell(tableFont, table, "证件类型", Element.ALIGN_MIDDLE, 1, 1);
-        createPDFCell(tableFont, table, data.get("idType").toString(), Element.ALIGN_MIDDLE, 2, 1);
-        createPDFCell(tableFont, table, "证件号码", Element.ALIGN_MIDDLE, 1, 1);
-        createPDFCell(tableFont, table, data.get("idCard").toString(), Element.ALIGN_MIDDLE, 2, 1);
-        //第五行
-        createPDFCell(tableFont, table, "进入时间", Element.ALIGN_MIDDLE, 1, 1);
-        createPDFCell(tableFont, table, data.get("inTime").toString(), Element.ALIGN_MIDDLE, 2, 1);
-        createPDFCell(tableFont, table, "离开时间", Element.ALIGN_MIDDLE, 1, 1);
-        createPDFCell(tableFont, table, data.get("outTime").toString(), Element.ALIGN_MIDDLE, 2, 1);
-
-        //第六行
-        createPDFCell(tableFont, table, "审批人", Element.ALIGN_MIDDLE, 1, 1);
-        createPDFCell(tableFont, table, data.get("approveUser").toString(), Element.ALIGN_MIDDLE, 2, 1);
-        createPDFCell(tableFont, table, "登记人", Element.ALIGN_MIDDLE, 1, 1);
-        createPDFCell(tableFont, table, data.get("createBy").toString(), Element.ALIGN_MIDDLE, 2, 1);
-
-        //第七行
-        createPDFCell(tableFont, table, "审批人签字", Element.ALIGN_MIDDLE, 1, 1);
-        dealImageCell((List<String>) data.get("approveSign"), table, 1, 80, 30, 2, 1);
-        createPDFCell(tableFont, table, "登记人签字", Element.ALIGN_MIDDLE, 1, 1);
-        dealImageCell((List<String>) data.get("submitSign"), table, 1, 80, 30, 2, 1);
-//        //第8行
-//        createPDFCell(tableFont, table, "备注", Element.ALIGN_MIDDLE, 1, 1);
-//        createPDFCell(tableFont, table, data.get("remark").toString(), Element.ALIGN_MIDDLE, 5, 1);
-
-
-        //证件图片
-        createPDFCell(tableFont, table, "证件图片", Element.ALIGN_MIDDLE, 1, 1);
-        //证件图片 图片填充
-        final PdfPTable imageTable1 = getImage((List<String>) data.get("imageFile"), 2, 190, 130, 2,0f);
-        final PdfPCell cell1 = new PdfPCell();
-        cell1.setNoWrap(false);
-        cell1.setPaddingLeft(4f);
-        cell1.setPaddingRight(4f);
-        cell1.setPaddingBottom(4f);
-        cell1.setPaddingTop(4f);
-        cell1.setColspan(5);
-        cell1.setRowspan(1);
-        //cell1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
-        cell1.addElement(imageTable1);
-        table.addCell(cell1);
-
-
-
-        List<String> files= (List<String>) data.get("file");
-        List<String> files1=new ArrayList<>();
-        List<String> files2= new ArrayList<>();
         // 没有备注图片时 需要把介绍信图片上移
-        if(ObjectUtil.isNotEmpty(files))
-        {
-            files1= files.subList(0,1);
-            if(files.size()>1)
-            {
-                files2= files.subList(1,files.size());
+        if (ObjectUtil.isNotEmpty(letterFiles)) {
+
+            if (letterFiles.size() == 1) {
+                letterFilesModelOne(tableFont, table, letterFiles);
+            }
+            if (letterFiles.size() == 2) {
+                letterFilesModelTwo(tableFont, table, letterFiles);
+            }
+            if (letterFiles.size() > 2) {
+                letterFilesModelThree(tableFont, table, letterFiles);
             }
         }
-        else{
-            files2=files;
-        }
-
-        if(ObjectUtil.isNotEmpty(files1))
-        {
-            createPDFCell(tableFont, table, "介绍信附件", Element.ALIGN_MIDDLE, 1, 1);
-            final PdfPTable imageTable3 = getImage(files1, 1, 380, 320, 1,0f);
-            final PdfPCell cell3 = new PdfPCell();
-            cell3.setNoWrap(false);
-            cell3.setPaddingLeft(4f);
-            cell3.setPaddingRight(4f);
-            cell3.setPaddingBottom(4f);
-            cell3.setPaddingTop(4f);
-            cell3.setColspan(5);
-            cell3.setRowspan(1);
-            //cell1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
-            cell3.addElement(imageTable3);
-            table.addCell(cell3);
-            document.add(table);
-        }
-        else { // 紧急类型的出入 可能没有介绍信图片
-            document.add(table);
+
+        // 个人信息部分
+        String userInfos = JSON.toJSONString(data.get("userInfos"));
+        List<CoreIntroduceLetterOutInRequestUser> personInfoList = JSON.parseArray(userInfos, CoreIntroduceLetterOutInRequestUser.class);
+        if (ObjectUtil.isNotEmpty(personInfoList)) {
+            personInfoList.forEach(item -> {
+
+                createOutInPDFCell(tableFont, table, "工作单位", Element.ALIGN_MIDDLE, 1, 1,33F);
+                createOutInPDFCell(tableFont, table, item.getCompanyName(), Element.ALIGN_MIDDLE, 2, 1);
+
+//
+                createOutInPDFCell(tableFont, table, "出入人员", Element.ALIGN_MIDDLE, 1, 1);
+                createOutInPDFCell(tableFont, table, item.getUserName(), Element.ALIGN_MIDDLE, 2, 1);
+//第二行 30
+                createOutInPDFCell(tableFont, table, "证件类型", Element.ALIGN_MIDDLE, 1, 1);
+                createOutInPDFCell(tableFont, table, IdTypeEnums.description(item.getIdType()), Element.ALIGN_MIDDLE, 2, 1);
+
+                createOutInPDFCell(tableFont, table, "证件号码", Element.ALIGN_MIDDLE, 1, 1);
+                createOutInPDFCell(tableFont, table, item.getIdCard(), Element.ALIGN_MIDDLE, 2, 1);
+                SimpleDateFormat sdf = new SimpleDateFormat("YYYY年MM月dd日 HH时mm分");
+                String arrivalTime = sdf.format(item.getArrivalTime());
+                String departureTime = sdf.format(item.getDepartureTime());
+                createOutInPDFCell(tableFont, table, "进入时间", Element.ALIGN_MIDDLE, 1, 1);
+                createOutInPDFCell(tableFont, table, arrivalTime, Element.ALIGN_MIDDLE, 2, 1);
+                createOutInPDFCell(tableFont, table, "离开时间", Element.ALIGN_MIDDLE, 1, 1);
+                createOutInPDFCell(tableFont, table, departureTime, Element.ALIGN_MIDDLE, 2, 1);
+
+                createOutInPDFCell(tableFont, table, "证件图片", Element.ALIGN_MIDDLE, 1, 1);
+
+                List<String> images = new ArrayList<>(Arrays.asList(item.getImgFile().split(",")));
+
+                try {
+                    PdfPTable image = getImage(images, 2, 168, 104, 2, 0f);
+                    PdfPCell cell = new PdfPCell();
+                    cell.setNoWrap(false);
+                    cell.setPaddingLeft(4f);
+                    cell.setPaddingRight(4f);
+                    cell.setPaddingBottom(8f);
+                    cell.setPaddingTop(8f);
+                    cell.setColspan(5);
+                    cell.setRowspan(1);
+                    cell.addElement(image);
+                    table.addCell(cell);
+
+                } catch (Exception e) {
+                    throw new ServiceException("出入管理登记簿,证件图片处理失败");
+                }
+
+
+            });
         }
+        document.add(table);
 
-        if(files2.size()>0)
-        {
-            PdfPTable innerTable = new PdfPTable(6);
-            createPDFCell(tableFont, innerTable, "介绍信附件", Element.ALIGN_MIDDLE, 1, 1);
-
-    //        createPDFCell(tableFont, table, "介绍信附件", Element.ALIGN_MIDDLE, 1, 1);
-            final PdfPTable imageTable2 = getImage(files2, 2, 380, 340, 1,8f);
-            final PdfPCell cell2 = new PdfPCell();
-            cell2.setNoWrap(false);
-            cell2.setPaddingLeft(4f);
-            cell2.setPaddingRight(4f);
-            cell2.setPaddingBottom(4f);
-            cell2.setPaddingTop(4f);
-            cell2.setColspan(5);
-            cell2.setRowspan(1);
-            cell2.addElement(imageTable2);
-            innerTable.addCell(cell2);
-            document.newPage();
-            document.add(innerTable);
-        }
-
-        List<String> checkImages= (List<String>) data.get("checkImage");
-
-        PdfPTable innerTable2 = new PdfPTable(6);
-        createPDFCell(tableFont, innerTable2, "备注", Element.ALIGN_MIDDLE, 1, checkImages.isEmpty()?1:2);
-        createPDFCell(tableFont, innerTable2, data.get("remark").toString(), Element.ALIGN_LEFT, 5, 1);
-        // 核查结果图片为非必填,没有图片时不显示
-        if(!checkImages.isEmpty())
-        {
-            final PdfPTable imageTable3 = getImage((List<String>) data.get("checkImage"), 2, 190, 190, 2,0f);
-            final PdfPCell cell3 = new PdfPCell();
-            cell3.setNoWrap(false);
-            cell3.setPaddingLeft(4f);
-            cell3.setPaddingRight(4f);
-            cell3.setPaddingBottom(4f);
-            cell3.setPaddingTop(4f);
-            cell3.setColspan(5);
-            cell3.setRowspan(1);
-            //cell1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
-            cell3.addElement(imageTable3);
-            innerTable2.addCell(cell3);
-        }
-        document.add(innerTable2);
+        String remark = (String) data.get("remark");
+        List<String> remarkImage = (List<String>) data.get("remarkImage");
+
+        if (!StringUtil.isNullOrEmpty(remark) || ObjectUtil.isNotEmpty(remarkImage)) {
+            PdfPTable remarkTable = new PdfPTable(6);
+            createOutInPDFCell(tableFont, remarkTable, "备注", Element.ALIGN_MIDDLE, 1, remarkImage.isEmpty() ? 1 : 2);
+            if (StrUtil.isNotEmpty(remark)) {
+                createOutInPDFCell(tableFont, remarkTable, data.get("remark").toString(), Element.ALIGN_LEFT, 5, 1);
+            }
+            if (ObjectUtil.isNotEmpty(remarkImage)) {
+                PdfPTable remarkImageTable = getImage(remarkImage, 2, 168, 104, 2, 0f);
+                PdfPCell remarkImageCell = new PdfPCell();
+                remarkImageCell.setNoWrap(false);
+                remarkImageCell.setPaddingLeft(4f);
+                remarkImageCell.setPaddingRight(4f);
+                remarkImageCell.setPaddingBottom(8f);
+                remarkImageCell.setPaddingTop(8f);
+                remarkImageCell.setColspan(5);
+                remarkImageCell.setRowspan(1);
+                remarkImageCell.addElement(remarkImageTable);
+                remarkTable.addCell(remarkImageCell);
+            }
+            document.add(remarkTable);
+        }
     }
 
     public static void dealDrillBody(Document document, PdfPTable table, Font tableFont, Map<String, Object> data) throws Exception {
@@ -594,7 +799,7 @@ public class PdfUtil {
         document.add(table);
         PdfPTable imageTable = new PdfPTable(6);
         final List<List<String>> listList = ListUtil.split((List<String>) data.get("fileImage"), 2);
-        createPDFCell(tableFont, imageTable, "图片附件", Element.ALIGN_MIDDLE, 1, listList.size()==0?1:listList.size());
+        createPDFCell(tableFont, imageTable, "图片附件", Element.ALIGN_MIDDLE, 1, listList.size() == 0 ? 1 : listList.size());
         for (List<String> stringList : listList) {
             PdfPTable innerTable = new PdfPTable(5);
             innerTable.setWidthPercentage(100F);
@@ -650,6 +855,72 @@ public class PdfUtil {
         table.addCell(outCell);
     }
 
+    private static void letterFilesModelOne(Font tableFont, PdfPTable table, List<String> letterFiles) throws Exception {
+        createPDFCell(tableFont, table, "介绍信附件", Element.ALIGN_MIDDLE, 1, 1);
+        PdfPTable letterFileTable = getImage(letterFiles, 1, 380, 386, 1, 0f);
+        PdfPCell cell = new PdfPCell();
+        cell.setNoWrap(false);
+        cell.setPaddingLeft(4f);
+        cell.setPaddingRight(4f);
+        cell.setPaddingBottom(4f);
+        cell.setPaddingTop(4f);
+        cell.setColspan(5);
+        cell.setRowspan(1);
+        cell.addElement(letterFileTable);
+        table.addCell(cell);
+    }
+
+    private static void letterFilesModelTwo(Font tableFont, PdfPTable table, List<String> letterFiles) throws Exception {
+        createPDFCell(tableFont, table, "介绍信附件", Element.ALIGN_MIDDLE, 1, 1);
+        PdfPTable letterFileTable = getImage(letterFiles, 2, 380, 286, 1, 4f);
+        PdfPCell cell = new PdfPCell();
+        cell.setNoWrap(false);
+        cell.setPaddingLeft(4f);
+        cell.setPaddingRight(4f);
+        cell.setPaddingBottom(4f);
+        cell.setPaddingTop(4f);
+        cell.setColspan(5);
+        cell.setRowspan(1);
+        cell.addElement(letterFileTable);
+        table.addCell(cell);
+    }
+
+    private static void letterFilesModelThree(Font tableFont, PdfPTable table, List<String> letterFiles) throws Exception {
+
+        List<String> headFiles = letterFiles.subList(0, 2);
+        List<String> otherFiles = letterFiles.subList(2, letterFiles.size());
+
+        createOutInPDFCell(tableFont, table, "介绍信附件", Element.ALIGN_MIDDLE, 1, 1);
+        PdfPTable headLetterFileTable = getImage(headFiles, 2, 380, 286, 1, 4f);
+        PdfPCell headCell = new PdfPCell();
+        headCell.setNoWrap(false);
+        headCell.setPaddingLeft(4f);
+        headCell.setPaddingRight(4f);
+        headCell.setPaddingBottom(4f);
+        headCell.setPaddingTop(4f);
+        headCell.setColspan(5);
+        headCell.setRowspan(1);
+        headCell.addElement(headLetterFileTable);
+        table.addCell(headCell);
+
+
+
+        int otherFilesSize = otherFiles.size();
+
+        createOutInPDFCell(tableFont, table, "介绍信附件", Element.ALIGN_MIDDLE, 1, 1);
+        PdfPTable otherLetterFileTable = getImage(otherFiles, otherFilesSize, 380, 378, 1, 4f);
+        PdfPCell ohterCell = new PdfPCell();
+        ohterCell.setNoWrap(false);
+        ohterCell.setPaddingLeft(4f);
+        ohterCell.setPaddingRight(4f);
+        ohterCell.setPaddingBottom(4f);
+        ohterCell.setPaddingTop(4f);
+        ohterCell.setColspan(5);
+        ohterCell.setRowspan(1);
+        ohterCell.addElement(otherLetterFileTable);
+        table.addCell(ohterCell);
+    }
+
     public static void dealEduImageCell2(List<String> imageList, PdfPTable table, Integer imageNumsOfRow, Integer imageWith, Integer imageHigh) throws Exception {
         //签字区域
         PdfPCell outCell = new PdfPCell();
@@ -726,7 +997,7 @@ public class PdfUtil {
         table.addCell(outCell);
     }
 
-    private static PdfPTable getImage(List<String> images, int totalImages, float imageWidth, float imageHeight, Integer ImageNumsOfRow,Float paddingBottom) throws Exception {
+    private static PdfPTable getImage(List<String> images, int totalImages, float imageWidth, float imageHeight, Integer ImageNumsOfRow, Float paddingBottom) throws Exception {
         if (images == null) {
             images = new ArrayList<>();
         }
@@ -800,14 +1071,14 @@ public class PdfUtil {
         }
     }
 
-    public static void dealAccessTimes(Document document, PdfPTable table, Font tableFont, Font tableTitleFont, List<String> data)throws DocumentException {
-        if(ObjectUtil.isNotEmpty(data)){
-            for (int i = 1; i <= data.size() ; i++) {
+    public static void dealAccessTimes(Document document, PdfPTable table, Font tableFont, Font tableTitleFont, List<String> data) throws DocumentException {
+        if (ObjectUtil.isNotEmpty(data)) {
+            for (int i = 1; i <= data.size(); i++) {
                 String time = data.get(i - 1);
                 PdfUtil.createPDFCell(tableFont, table, String.valueOf(i), Element.ALIGN_MIDDLE, 2, 1);
                 PdfUtil.createPDFCell(tableFont, table, time, Element.ALIGN_MIDDLE, 17, 1);
             }
-        }else {
+        } else {
             PdfUtil.createPDFCell(tableFont, table, "/", Element.ALIGN_MIDDLE, 2, 1);
             PdfUtil.createPDFCell(tableFont, table, "/", Element.ALIGN_MIDDLE, 17, 1);
         }
@@ -897,7 +1168,7 @@ public class PdfUtil {
             for (CheckDataVo checkDataVo : data.getCheckDatas()) {
                 PdfUtil.createPDFCell(tableFont, table, String.valueOf(data.getCheckDatas().indexOf(checkDataVo) + 1), Element.ALIGN_MIDDLE, 2, 1);
                 PdfUtil.createPDFCell(tableFont, table, checkDataVo.getPointName(), Element.ALIGN_MIDDLE, 10, 1);
-                PdfUtil.createPDFCell(tableFont, table, ObjectUtil.equal(Boolean.TRUE, checkDataVo.getCheckStatus())?"正常":"异常", Element.ALIGN_MIDDLE, 2, 1);
+                PdfUtil.createPDFCell(tableFont, table, ObjectUtil.equal(Boolean.TRUE, checkDataVo.getCheckStatus()) ? "正常" : "异常", Element.ALIGN_MIDDLE, 2, 1);
             }
         } else {
             PdfUtil.createPDFCell(tableFont, table, "/", Element.ALIGN_MIDDLE, 2, 1);