Просмотр исходного кода

安全检查登记簿样式修改完成代码提交

jingyuanchao 1 год назад
Родитель
Сommit
1d396598a0

+ 3 - 0
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/domain/SafeCheckTaskRegisterBookVo.java

@@ -39,6 +39,9 @@ public class SafeCheckTaskRegisterBookVo {
   @ApiModelProperty("检查人员信息 eg: 张三(一级支行行长)")
   private String checkUserInfo;
 
+  @ApiModelProperty("检查类型")
+  private String checkTypeText;
+
   private List<CheckDataVo> checkDatas;
   private String dest;
 

+ 4 - 1
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/constant/DictConstants.java

@@ -279,5 +279,8 @@ public class DictConstants {
     public static final String QUESTION_CONFIRM_STATUS = "question_confirm_status";
 
 
-
+    /**
+     * 安全检查-检查类型
+     */
+    public static final String CHECK_TYPE = "check_type";
 }

+ 3 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/service/impl/CoreSafecheckPlanServiceImpl.java

@@ -13,6 +13,7 @@ import com.alibaba.excel.util.CollectionUtils;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
+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.DateRange;
@@ -26,6 +27,7 @@ import com.xunmei.common.core.exception.ServiceException;
 import com.xunmei.common.core.exception.SystemException;
 import com.xunmei.common.core.utils.DateHelper;
 import com.xunmei.common.core.utils.DateUtils;
+import com.xunmei.common.security.utils.DictUtils;
 import com.xunmei.common.security.utils.SecurityUtils;
 import com.xunmei.core.question.QuestionSrcType;
 import com.xunmei.core.question.service.IQuestionService;
@@ -1017,7 +1019,7 @@ public class CoreSafecheckPlanServiceImpl extends ServiceImpl<CoreSafecheckPlanM
         registerBookVo.setOrgName(appSafetyCheckTask.getOrgName());
         String checkUserInfo = appSafetyCheckTask.getSubmitBy();
         registerBookVo.setCheckUserInfo(checkUserInfo);
-
+        registerBookVo.setCheckTypeText(DictUtils.getDictLabel(DictConstants.CHECK_TYPE,appSafetyCheckTask.getCheckType().intValue()));
         List<CheckDataVo> pointCheckDataList = new ArrayList<>();
 
         List<AppTaskRegisterPointVo> appTaskRegisterPointVos = coreSafetyTaskMapper.selectPointByTask(appSafetyCheckTask.getId());

+ 9 - 35
soc-modules/soc-modules-file/src/main/java/com/xunmei/file/service/LocalSysFileServiceImpl.java

@@ -112,7 +112,7 @@ public class LocalSysFileServiceImpl implements ISysFileService {
 
         PdfFilePathVo pathVo = new PdfFilePathVo();
         pathVo.setAbsolutePath(localFilePath + path + fileName);
-        pathVo.setTempFileName(localFilePath + path + IdWorker.getId()+".pdf");
+        pathVo.setTempFileName(localFilePath + path + IdWorker.getId() + ".pdf");
         pathVo.setRelativePath(path + fileName);
         return pathVo;
     }
@@ -250,7 +250,7 @@ public class LocalSysFileServiceImpl implements ISysFileService {
 
         document.close();
         writer.close();
-        PdfUtil.addPageNum(pathVo.getTempFileName(),pathVo.getAbsolutePath(),fs,tableFont);
+        PdfUtil.addPageNum(pathVo.getTempFileName(), pathVo.getAbsolutePath(), fs, tableFont);
         log.info("教育培训登记簿生成结束,当前绝对地址为:{}", afterStr);
         //此处返回  /statics/edu/xxx.pdf
         return this.prefix + pathVo.getRelativePath();
@@ -284,46 +284,20 @@ public class LocalSysFileServiceImpl implements ISysFileService {
     @Override
     public String generateSafeCheckPdf(SafeCheckTaskRegisterBookVo data) throws Exception {
         PdfFilePathVo pathVo = getLocalFilePath("safeCheck", data.getDest());
-        String afterStr = StringEscapeUtils.escapeEcmaScript(pathVo.getAbsolutePath());
+        String afterStr = StringEscapeUtils.escapeEcmaScript(pathVo.getTempFileName());
         log.info("开始生成安全检查登记簿,当前绝对地址为:{}", afterStr);
-        final ItextPdfTableVo pdfTableVo = PdfUtil.createTable(pathVo.getAbsolutePath(), 46, 7);
+        final ItextPdfTableVo pdfTableVo = PdfUtil.createTable(pathVo.getTempFileName(), 6, 10);
         final Document document = pdfTableVo.getDocument();
         final PdfWriter writer = pdfTableVo.getWriter();
         final PdfPTable table = pdfTableVo.getTable();
         final BaseFont fs = pdfTableVo.getFs();
         final Font tableFont = pdfTableVo.getTableFont();
-        Font font = new Font(fs, 9, Font.NORMAL);
-
-        PdfUtil.dealHeader(document, fs, data.getTaskTitle() + "情况表", 14);
-        //日期
-        String orgName = "被查支行: " + data.getOrgName();
-        String checkUser = "检查人: " + data.getCheckUserInfo();
-        String dateStr = data.getDateStr();
-        PdfPCell orgCell = new PdfPCell(new Phrase(orgName, font));
-        orgCell.setColspan(16);
-        orgCell.setRowspan(1);
-        orgCell.setBorder(Rectangle.NO_BORDER);
-        orgCell.setHorizontalAlignment(Element.ALIGN_LEFT);
-
-        PdfPCell checkUserCell = new PdfPCell(new Phrase(checkUser, font));
-        checkUserCell.setColspan(20);
-        checkUserCell.setRowspan(1);
-        checkUserCell.setBorder(Rectangle.NO_BORDER);
-        checkUserCell.setHorizontalAlignment(Element.ALIGN_CENTER);
-
-        PdfPCell dateStrCell = new PdfPCell(new Phrase(dateStr, font));
-        dateStrCell.setColspan(10);
-        dateStrCell.setRowspan(1);
-        dateStrCell.setBorder(Rectangle.NO_BORDER);
-        dateStrCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
-        table.addCell(orgCell);
-        table.addCell(checkUserCell);
-        table.addCell(dateStrCell);
-        Font titleFont = new Font(fs, 8, Font.NORMAL);
-        PdfUtil.dealSafeCheckPBody(document, table, tableFont, titleFont, data.getCheckDatas());
 
+        PdfUtil.dealHeader(document, fs, "安全保卫检查情况登记簿", 24);
+        PdfUtil.dealSafeCheckPBody(document, table, tableFont, data);
         document.close();
         writer.close();
+        PdfUtil.addPageNum(pathVo.getTempFileName(), pathVo.getAbsolutePath(), fs, tableFont);
         log.info("安全检查登记簿生成结束,当前绝对地址为:{}", afterStr);
         //此处返回  /statics/edu/xxx.pdf
         return this.prefix + pathVo.getRelativePath();
@@ -334,7 +308,7 @@ public class LocalSysFileServiceImpl implements ISysFileService {
         PdfFilePathVo pathVo = getLocalFilePath("access", data.getDest());
         String afterStr = StringEscapeUtils.escapeEcmaScript(pathVo.getAbsolutePath());
         log.info("开始生成监控调阅登记簿,当前绝对地址为:{}", afterStr);
-        final ItextPdfTableVo pdfTableVo = PdfUtil.createTable(pathVo.getAbsolutePath(), 46, 7);
+        final ItextPdfTableVo pdfTableVo = PdfUtil.createTable(pathVo.getAbsolutePath(), 46, 10);
         final Document document = pdfTableVo.getDocument();
         final PdfWriter writer = pdfTableVo.getWriter();
         final PdfPTable table = pdfTableVo.getTable();
@@ -428,7 +402,7 @@ public class LocalSysFileServiceImpl implements ISysFileService {
         document.close();
         writer.close();
         log.info("预案演练登记簿生成结束,当前绝对地址为:{}", afterStr);
-        PdfUtil.addPageNum(pathVo.getTempFileName(),pathVo.getAbsolutePath(),fs,tableFont);
+        PdfUtil.addPageNum(pathVo.getTempFileName(), pathVo.getAbsolutePath(), fs, tableFont);
         //此处返回  /statics/edu/xxx.pdf
         return this.prefix + pathVo.getRelativePath();
 

+ 32 - 16
soc-modules/soc-modules-file/src/main/java/com/xunmei/file/utils/PdfUtil.java

@@ -9,6 +9,7 @@ import com.lowagie.text.pdf.*;
 import com.xunmei.file.vo.ItextPdfTableVo;
 import com.xunmei.system.api.domain.AccessDataVo;
 import com.xunmei.system.api.domain.CheckDataVo;
+import com.xunmei.system.api.domain.SafeCheckTaskRegisterBookVo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -523,26 +524,41 @@ public class PdfUtil {
             PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getHostName(), Element.ALIGN_MIDDLE, 16, 0, 10);
             PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getVideoChannelName(), Element.ALIGN_MIDDLE, 9, 0, 10);
             PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getProject(), Element.ALIGN_MIDDLE, 9, 0, 10);
-         //   PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getSituation().equals("0") ? "正常" : "异常", Element.ALIGN_MIDDLE, 2, 0, 10);
+            //   PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getSituation().equals("0") ? "正常" : "异常", Element.ALIGN_MIDDLE, 2, 0, 10);
             PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getAbnormalIllustrate(), Element.ALIGN_MIDDLE, 9, 0, 10);
         }
         document.add(table);
     }
 
-    public static void dealSafeCheckPBody(Document document, PdfPTable table, Font tableFont, Font tableTitleFont, List<CheckDataVo> data) throws DocumentException {
-        PdfUtil.createPDFCell(tableTitleFont, table, "序号", Element.ALIGN_MIDDLE, 2, 0);
-        PdfUtil.createPDFCell(tableTitleFont, table, "检查内容", Element.ALIGN_MIDDLE, 5, 0);
-        PdfUtil.createPDFCell(tableTitleFont, table, "主要指标描述情况", Element.ALIGN_MIDDLE, 17, 0);
-        PdfUtil.createPDFCell(tableTitleFont, table, "检查情况", Element.ALIGN_MIDDLE, 5, 0);
-        PdfUtil.createPDFCell(tableTitleFont, table, "存在的问题及整改意见", Element.ALIGN_MIDDLE, 15, 0);
-        PdfUtil.createPDFCell(tableTitleFont, table, "整改期限", Element.ALIGN_MIDDLE, 2, 0);
-        for (int i = 1; i <= data.size(); i++) {
-            PdfUtil.createPDFCell(tableFont, table, String.valueOf(i), Element.ALIGN_MIDDLE, 2, 0, 10);
-            PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getItemName(), Element.ALIGN_MIDDLE, 5, 0, 10);
-            PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getPointName(), Element.ALIGN_MIDDLE, 17, 0, 10);
-            PdfUtil.createPDFCell(tableFont, table, StringUtils.isEmpty(data.get(i - 1).getResRemark()) ? "√" : "×", Element.ALIGN_MIDDLE, 5, 0, 10);
-            PdfUtil.createPDFCell(tableFont, table, StringUtils.isEmpty(data.get(i - 1).getResRemark()) ? "" : data.get(i - 1).getResRemark(), Element.ALIGN_MIDDLE, 15, 0, 10);
-            PdfUtil.createPDFCell(tableFont, table, data.get(i - 1).getRectificationDeadline(), Element.ALIGN_MIDDLE, 2, 0, 10);
+    public static void dealSafeCheckPBody(Document document, PdfPTable table, Font tableFont, SafeCheckTaskRegisterBookVo data) throws DocumentException {
+        PdfUtil.createPDFCell(tableFont, table, "被查单位", Element.ALIGN_CENTER, 1, 1);
+        PdfUtil.createPDFCell(tableFont, table, data.getOrgName(), Element.ALIGN_CENTER, 2, 1);
+        PdfUtil.createPDFCell(tableFont, table, "被查日期", Element.ALIGN_CENTER, 1, 1);
+        PdfUtil.createPDFCell(tableFont, table, data.getDateStr(), Element.ALIGN_CENTER, 2, 1);
+
+        PdfUtil.createPDFCell(tableFont, table, "检查类型", Element.ALIGN_CENTER, 1, 1);
+        PdfUtil.createPDFCell(tableFont, table, data.getCheckTypeText(), Element.ALIGN_CENTER, 2, 1);
+        PdfUtil.createPDFCell(tableFont, table, "检查名称", Element.ALIGN_CENTER, 1, 1);
+        PdfUtil.createPDFCell(tableFont, table, data.getTaskTitle(), Element.ALIGN_CENTER, 2, 1);
+
+        PdfUtil.createPDFCell(tableFont, table, "检查单位", Element.ALIGN_CENTER, 1, 1);
+        PdfUtil.createPDFCell(tableFont, table, data.getCheckOrgName(), Element.ALIGN_CENTER, 2, 1);
+        PdfUtil.createPDFCell(tableFont, table, "检查人", Element.ALIGN_CENTER, 1, 1);
+        PdfUtil.createPDFCell(tableFont, table, data.getCheckUserInfo(), Element.ALIGN_CENTER, 2, 1);
+
+        PdfUtil.createPDFCell(tableFont, table, "检查组成员", Element.ALIGN_CENTER, 1, 1);
+        PdfUtil.createPDFCell(tableFont, table, data.getCheckUserInfo(), Element.ALIGN_CENTER, 5, 1);
+
+        PdfUtil.createPDFCell(tableFont, table, "发现问题情况", Element.ALIGN_CENTER, 6, 1);
+
+        PdfUtil.createPDFCell(tableFont, table, "序号", Element.ALIGN_CENTER, 1, 1);
+        PdfUtil.createPDFCell(tableFont, table, "检查项目", Element.ALIGN_CENTER, 2, 1);
+        PdfUtil.createPDFCell(tableFont, table, "存在问题", Element.ALIGN_CENTER, 2, 1);
+        for (int i = 1; i <= data.getCheckDatas().size(); i++) {
+            final CheckDataVo checkDataVo = data.getCheckDatas().get(i - 1);
+            PdfUtil.createPDFCell(tableFont, table, String.valueOf(i), Element.ALIGN_MIDDLE, 1, 1, 10);
+            PdfUtil.createPDFCell(tableFont, table, checkDataVo.getItemName(), Element.ALIGN_MIDDLE, 2, 1, 10);
+            PdfUtil.createPDFCell(tableFont, table, checkDataVo.getResRemark(), Element.ALIGN_MIDDLE, 2, 1, 10);
         }
         document.add(table);
     }
@@ -556,7 +572,7 @@ public class PdfUtil {
             // 获取 源文件总页数
             int num = reader.getNumberOfPages();
             // 新建文档,默认A4大小
-            Document document =createDocument(0,0,50,50);
+            Document document = createDocument(0, 0, 50, 50);
             PdfWriter writer = PdfWriter.getInstance(document, fos);
             writer.setPageEvent(new PdfPageHelperEvent(num, writer, fs, tableFont));
             document.open();