|
@@ -13,40 +13,37 @@ import java.io.InputStream;
|
|
|
import java.math.BigInteger;
|
|
import java.math.BigInteger;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
-// 扩展:新增英文父/子项字段
|
|
|
|
|
-class CheckItem {
|
|
|
|
|
- private String parent; // 中文父项(如:个人防护)
|
|
|
|
|
- private String child; // 中文子项(如:头部)
|
|
|
|
|
- private String englishParent; // 英文父项(如:Personal Protection Equipment)
|
|
|
|
|
- private String englishChild; // 英文子项(如:Head)
|
|
|
|
|
-
|
|
|
|
|
- public CheckItem(String parent, String child, String englishParent, String englishChild) {
|
|
|
|
|
- this.parent = parent;
|
|
|
|
|
- this.child = child;
|
|
|
|
|
- this.englishParent = englishParent;
|
|
|
|
|
- this.englishChild = englishChild;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+public class SafetyObservationCardGenerator {
|
|
|
|
|
+ static class CheckItem {
|
|
|
|
|
+ private String parent; // 中文父项(如:个人防护)
|
|
|
|
|
+ private String child; // 中文子项(如:头部)
|
|
|
|
|
+ private String englishParent; // 英文父项(如:Personal Protection Equipment)
|
|
|
|
|
+ private String englishChild; // 英文子项(如:Head)
|
|
|
|
|
+
|
|
|
|
|
+ public CheckItem(String parent, String child, String englishParent, String englishChild) {
|
|
|
|
|
+ this.parent = parent;
|
|
|
|
|
+ this.child = child;
|
|
|
|
|
+ this.englishParent = englishParent;
|
|
|
|
|
+ this.englishChild = englishChild;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- // getter
|
|
|
|
|
- public String getParent() {
|
|
|
|
|
- return parent;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // getter
|
|
|
|
|
+ public String getParent() {
|
|
|
|
|
+ return parent;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- public String getChild() {
|
|
|
|
|
- return child;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ public String getChild() {
|
|
|
|
|
+ return child;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- public String getEnglishParent() {
|
|
|
|
|
- return englishParent;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ public String getEnglishParent() {
|
|
|
|
|
+ return englishParent;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- public String getEnglishChild() {
|
|
|
|
|
- return englishChild;
|
|
|
|
|
|
|
+ public String getEnglishChild() {
|
|
|
|
|
+ return englishChild;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-public class SafetyObservationCardGenerator {
|
|
|
|
|
-
|
|
|
|
|
// 新增入参:person(实施观察人员)、date(日期)、remark(观察描述)
|
|
// 新增入参:person(实施观察人员)、date(日期)、remark(观察描述)
|
|
|
public static void generateCard(List<CheckItem> checkItems, String person, String date, String remark) {
|
|
public static void generateCard(List<CheckItem> checkItems, String person, String date, String remark) {
|
|
|
try (XWPFDocument document = new XWPFDocument();
|
|
try (XWPFDocument document = new XWPFDocument();
|
|
@@ -475,7 +472,11 @@ public class SafetyObservationCardGenerator {
|
|
|
XWPFRun run = paragraph.createRun();
|
|
XWPFRun run = paragraph.createRun();
|
|
|
run.setText(line.trim());
|
|
run.setText(line.trim());
|
|
|
run.setFontSize(9);
|
|
run.setFontSize(9);
|
|
|
- run.setFontFamily(isEnglish(line) ? "Arial" : "宋体");
|
|
|
|
|
|
|
+ if (isEnglish(line)) {
|
|
|
|
|
+ run.setFontFamily("Arial");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ run.setFontFamily("宋体");
|
|
|
|
|
+ }
|
|
|
run.setBold(bold);
|
|
run.setBold(bold);
|
|
|
run.setTextPosition(12);
|
|
run.setTextPosition(12);
|
|
|
}
|
|
}
|