|
|
@@ -6,6 +6,7 @@ import cn.hutool.extra.spring.SpringUtil;
|
|
|
import com.lowagie.text.*;
|
|
|
import com.lowagie.text.pdf.*;
|
|
|
import com.xunmei.file.vo.ItextPdfTableVo;
|
|
|
+import com.xunmei.system.api.domain.ResumptionPdf;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.context.ApplicationContext;
|
|
|
import org.springframework.core.io.Resource;
|
|
|
@@ -14,10 +15,8 @@ import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Iterator;
|
|
|
+import java.util.*;
|
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
|
|
|
@Slf4j
|
|
|
public class PdfUtil {
|
|
|
@@ -205,33 +204,34 @@ public class PdfUtil {
|
|
|
public static void dealResumptionBody(Document document, PdfPTable table, Font tableFont, Map<String, Object> data) throws Exception {
|
|
|
PdfUtil.createPDFCell(tableFont, table, "检查内容", Element.ALIGN_CENTER, 6, 0);
|
|
|
PdfUtil.createPDFCell(tableFont, table, "检查情况", Element.ALIGN_CENTER, 0, 0);
|
|
|
- PdfUtil.createPDFCell(tableFont, table, "检查人", Element.ALIGN_CENTER, 0, 0);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, "登记人", Element.ALIGN_CENTER, 0, 0);
|
|
|
+
|
|
|
+ List<String> names = new ArrayList<>();
|
|
|
+ names.add("营业前");
|
|
|
+ names.add("营业期间");
|
|
|
+ names.add("营业终了");
|
|
|
|
|
|
- final Map<String,List<AppResumptionDataInfoVo>> lists = (Map<String,List<AppResumptionDataInfoVo>>) data.get("items");
|
|
|
- if (ObjectUtil.isEmpty(lists)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- Iterator<String> iterator=lists.keySet().iterator();
|
|
|
- while (iterator.hasNext()) {
|
|
|
- List<AppResumptionDataInfoVo> list = lists.get(iterator.next());
|
|
|
- //不同的执行时刻
|
|
|
- String execTimeName = iterator.next();
|
|
|
- PdfUtil.createPDFCell(tableFont, table, getLineStr(execTimeName), PdfPCell.ALIGN_MIDDLE, 0, list.size());
|
|
|
- int o=1;
|
|
|
- for (AppResumptionDataInfoVo listVo : list) {
|
|
|
|
|
|
+ for(String s:names){
|
|
|
+ List<LinkedHashMap<String, Object>> lists = (List<LinkedHashMap<String, Object>>) data.get(s);
|
|
|
+ if (ObjectUtil.isEmpty(lists)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ //不同的执行时刻
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, getLineStr(s), PdfPCell.ALIGN_MIDDLE, 0, lists.size());
|
|
|
+ int o = 1;
|
|
|
+ for (LinkedHashMap<String, Object> listVo : lists) {
|
|
|
// 检查内容
|
|
|
- String rowContent = o+ "、" + listVo.getPointName();
|
|
|
+ String rowContent = o + "、" + listVo.get("pointName");
|
|
|
PdfUtil.createPDFCell(tableFont, table, rowContent, Element.ALIGN_LEFT, 5, 0);
|
|
|
// 检查情况
|
|
|
- PdfUtil.createPDFCell(tableFont, table, listVo.getExecuteResult(), Element.ALIGN_CENTER, 0, 0);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, ((Integer) listVo.get("resValue")) == 0 ? "√" : "×", Element.ALIGN_CENTER, 0, 0);
|
|
|
// 检查人
|
|
|
- PdfUtil.createPDFCell(tableFont, table, listVo.getCheckName(), Element.ALIGN_CENTER, 0, 0);
|
|
|
+ PdfUtil.createPDFCell(tableFont, table, String.valueOf(listVo.get("submitName")), Element.ALIGN_CENTER, 0, 0);
|
|
|
o++;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 备注数据
|
|
|
PdfUtil.createPDFCell(tableFont, table, getLineStr("备注"), PdfPCell.ALIGN_MIDDLE, 0, 0);
|
|
|
PdfUtil.createPDFCell(tableFont, table, data.get("remark").toString(), Element.ALIGN_LEFT, 7, 0);
|
|
|
@@ -245,8 +245,6 @@ public class PdfUtil {
|
|
|
document.add(foot);
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
//
|
|
|
//
|
|
|
//// //段落
|
|
|
@@ -384,7 +382,8 @@ public class PdfUtil {
|
|
|
//
|
|
|
//
|
|
|
// document.add(table);
|
|
|
-}
|
|
|
+ }
|
|
|
+
|
|
|
public static String getLineStr(String str) {
|
|
|
StringBuilder result = new StringBuilder();
|
|
|
for (int i = 0; i < str.length(); i++) {
|
|
|
@@ -392,6 +391,7 @@ public class PdfUtil {
|
|
|
}
|
|
|
return result.toString();
|
|
|
}
|
|
|
+
|
|
|
public static void dealDrillBody(Document document, PdfPTable table, Font tableFont, Map<String, Object> data) throws Exception {
|
|
|
//第一行
|
|
|
createPDFCell(tableFont, table, "演练单位", Element.ALIGN_CENTER, 1, 1);
|