diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/report/enums/DictCodeReportEnum.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/report/enums/DictCodeReportEnum.java new file mode 100644 index 000000000..7aea0d69d --- /dev/null +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/report/enums/DictCodeReportEnum.java @@ -0,0 +1,40 @@ +package com.jero.modules.report.enums; + + +/** + * @description + * @date 2022/1/21 15:22 + * @auth zhn + */ +public enum DictCodeReportEnum { + APPLYCAR("适用车型","car_type"), + APPLYSCOPE("适用范围","apply_scope"), + STATE("状态","state"), + USEMETHOD("用法","yong4_fa3"); + + + + String name; + String value; + + private DictCodeReportEnum(String name, String value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/report/service/impl/LawsMonthlyReportWriteEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/report/service/impl/LawsMonthlyReportWriteEOServiceImpl.java index b51b54e76..8a2229740 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/report/service/impl/LawsMonthlyReportWriteEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/report/service/impl/LawsMonthlyReportWriteEOServiceImpl.java @@ -343,9 +343,42 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl lawsMonthlyReportWriteEOS = this.list(wrapper); + + List lawsMonthlyReportIdList = lawsMonthlyReportWriteEOS.stream().map(LawsMonthlyReportWriteEO::getId).collect(Collectors.toList()); + //新征求意见清单模板 + List newOpinionTemplateEOList = new ArrayList<>(); + if(lawsMonthlyReportIdList.size() != 0){ + LambdaQueryWrapper wrapperTemp = new LambdaQueryWrapper<>(); + wrapperTemp.in(NewOpinionTemplateEO::getLawsMonthlyReportWriteId,lawsMonthlyReportIdList); + newOpinionTemplateEOList = iNewOpinionTemplateEOService.list(wrapperTemp); + } + + //新发布标准清单模板 + List newStandardTemplateEOList = new ArrayList<>(); + if(lawsMonthlyReportIdList.size() != 0){ + LambdaQueryWrapper qrapperTemp = new LambdaQueryWrapper<>(); + qrapperTemp.in(NewStandardTemplateEO::getLawsMonthlyReportWriteId,lawsMonthlyReportIdList); + newStandardTemplateEOList = iNewStandardTemplateEOService.list(qrapperTemp); + } + for (LawsMonthlyReportWriteEO monthlyReportWriteEO : lawsMonthlyReportWriteEOS) { + if(ContentTemplateEnum.NEW_REQUEST_LIST_TEMPLATE.getValue().equals(monthlyReportWriteEO.getContentTemplate())){ + //新征求意见清单模板 + List collect = newOpinionTemplateEOList.stream() + .filter(e -> monthlyReportWriteEO.getId().equals(e.getLawsMonthlyReportWriteId())).collect(Collectors.toList()); + monthlyReportWriteEO.setNewOpinionTemplateEOList(collect); + + }else if(ContentTemplateEnum.NEW_RELEASE_STANDARD_MANIFEST_TEMPLATE.getValue().equals(monthlyReportWriteEO.getContentTemplate())){ + //新发布标准清单模板 + List collect = newStandardTemplateEOList.stream() + .filter(e -> monthlyReportWriteEO.getId().equals(e.getLawsMonthlyReportWriteId())).collect(Collectors.toList()); + monthlyReportWriteEO.setNewStandardTemplateEOList(collect); + } + } + + //月报填写列表所有的章节目录 List memoriesChapterList = lawsMonthlyReportWriteEOS.stream() .map(LawsMonthlyReportWriteEO::getMemoriesChapter).distinct().collect(Collectors.toList()); @@ -406,11 +439,15 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl reportTitleTwoList = lawsMonthlyReportTitleTemplateEOS.stream().filter(e -> e.getParentId().equals(lawsMonthlyReportTitleTemplateEO.getId())).collect(Collectors.toList()); @@ -481,8 +558,10 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl lawsMonthlyReportWriteEOS, + List lawsMonthlyReportTitleTemplateEOS, + List reportTitleOneList, + String titleCN, + XWPFDocument document, + String cut) { + //数据字典 + List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); + + //树形数据字典 + List categoryList = sysCategoryService.list(); + String content = ""; + if(CutEnum.CN.getValue().equals(cut)){ + content = "主要内容"; + }else{ + content = "Content"; + } + WordUtil.exportWord(document, titleCN, null, ParagraphAlignment.CENTER, 0, 12, false, true, "Microsoft YaHei UI"); + WordUtil.exportWord(document, content, null, ParagraphAlignment.LEFT, 0, 12, false, true, "Microsoft YaHei UI"); + int oneCount = 1; + + for (LawsMonthlyReportTitleTemplateEO lawsMonthlyReportTitleTemplateEO : reportTitleOneList) { + int twoCount = 1; + String oneNumber = intToRoman(oneCount); + //一级标题 + String oneTitle = ""; + if(CutEnum.CN.getValue().equals(cut)){ + oneTitle = lawsMonthlyReportTitleTemplateEO.getTitleCn(); + }else{ + oneTitle = lawsMonthlyReportTitleTemplateEO.getTitleEn(); + } + if(StringUtils.isNotBlank(oneTitle)){ + WordUtil.exportWord(document, oneNumber+" "+oneTitle, null, ParagraphAlignment.LEFT, 0, 12, false, true, "Microsoft YaHei UI"); + oneCount++; + } + + List reportTitleTwoList = lawsMonthlyReportTitleTemplateEOS.stream().filter(e -> e.getParentId().equals(lawsMonthlyReportTitleTemplateEO.getId())).collect(Collectors.toList()); + + + for (LawsMonthlyReportTitleTemplateEO monthlyReportTitleTemplateEO : reportTitleTwoList) { + int reportCount = 1; + //子标题对应的月报填写的内容 + List lawsMonthlyReportWriteEOList = lawsMonthlyReportWriteEOS.stream().filter(e -> monthlyReportTitleTemplateEO.getId().equals(e.getMemoriesChapter())).collect(Collectors.toList()); + String twoNumber = intToRoman(twoCount); + twoNumber = oneNumber+"."+twoNumber; + + //二级标题 + String twoTitle = ""; + if(CutEnum.CN.getValue().equals(cut)){ + twoTitle = monthlyReportTitleTemplateEO.getTitleCn(); + }else{ + twoTitle = monthlyReportTitleTemplateEO.getTitleEn(); + } + if(StringUtils.isNotBlank(twoTitle)){ + WordUtil.exportWord(document, twoNumber+" "+twoTitle, null, ParagraphAlignment.LEFT, 2, 12, false, true, "Microsoft YaHei UI"); + twoCount++; + } + //二级目录下放--->新征求意见清单模板, 新发布标准清单模板 + List askList = lawsMonthlyReportWriteEOList.stream().filter(e -> ContentTemplateEnum.NEW_REQUEST_LIST_TEMPLATE.getValue().equals(e.getContentTemplate())).collect(Collectors.toList()); + List issueList = lawsMonthlyReportWriteEOList.stream().filter(e -> ContentTemplateEnum.NEW_RELEASE_STANDARD_MANIFEST_TEMPLATE.getValue().equals(e.getContentTemplate())).collect(Collectors.toList()); + for (LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO : askList) { + WordUtil.exportWordExcelAsk(document,lawsMonthlyReportWriteEO,cut); + WordUtil.exportWord(document, null, null, null, 0, 0, false, true, null); + } + + for (LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO : issueList) { + WordUtil.exportWordExcelIssue(document,lawsMonthlyReportWriteEO,cut); + WordUtil.exportWord(document, null, null, null, 0, 0, false, true, null); + } + + for (LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO : lawsMonthlyReportWriteEOList) { + //月报内容标题 + String reportTitle = ""; + if(CutEnum.CN.getValue().equals(cut)){ + reportTitle = lawsMonthlyReportWriteEO.getTitleCn(); + }else{ + reportTitle = lawsMonthlyReportWriteEO.getTitleEn(); + } + if(StringUtils.isNotBlank(reportTitle)){ + WordUtil.exportWord(document, reportCount+". "+reportTitle, null, ParagraphAlignment.LEFT, 6, 10, false, false, "Microsoft YaHei UI"); + } + + + String contentTemplate = lawsMonthlyReportWriteEO.getContentTemplate(); + if(ContentTemplateEnum.DEFAULT_TEMPLATE.getValue().equals(contentTemplate)){ + //写入模板 + WordUtil.exportWordExcelDefault(document,lawsMonthlyReportWriteEO,sysDictItems,categoryList,cut); + + } +// else if(ContentTemplateEnum.NEW_REQUEST_LIST_TEMPLATE.getValue().equals(contentTemplate)){ +// //新征求意见清单模板 +// WordUtil.exportWordExcelAsk(document,lawsMonthlyReportWriteEO,cut); +// +// }else if(ContentTemplateEnum.NEW_RELEASE_STANDARD_MANIFEST_TEMPLATE.getValue().equals(contentTemplate)){ +// //新发布标准清单模板 +// WordUtil.exportWordExcelIssue(document,lawsMonthlyReportWriteEO,cut); +// } reportCount++; } } } } +// private void word(List lawsMonthlyReportWriteEOS, +// List lawsMonthlyReportTitleTemplateEOS, +// List reportTitleOneList, +// String titleCN, +// XWPFDocument document, +// String cut) { +// String content = ""; +// if(CutEnum.CN.getValue().equals(cut)){ +// content = "主要内容"; +// }else{ +// content = "Content"; +// } +// WordUtil.exportWord(document, titleCN, null, ParagraphAlignment.CENTER, 0, 12, false, true, "Microsoft YaHei UI"); +// WordUtil.exportWord(document, content, null, ParagraphAlignment.LEFT, 0, 12, false, true, "Microsoft YaHei UI"); +// int oneCount = 1; +// +// for (LawsMonthlyReportTitleTemplateEO lawsMonthlyReportTitleTemplateEO : reportTitleOneList) { +// int twoCount = 1; +// String oneNumber = intToRoman(oneCount); +// //一级标题 +// String oneTitle = ""; +// if(CutEnum.CN.getValue().equals(cut)){ +// oneTitle = lawsMonthlyReportTitleTemplateEO.getTitleCn(); +// }else{ +// oneTitle = lawsMonthlyReportTitleTemplateEO.getTitleEn(); +// } +// WordUtil.exportWord(document, oneNumber+" "+oneTitle, null, ParagraphAlignment.LEFT, 0, 12, false, true, "Microsoft YaHei UI"); +// oneCount++; +// List reportTitleTwoList = lawsMonthlyReportTitleTemplateEOS.stream().filter(e -> e.getParentId().equals(lawsMonthlyReportTitleTemplateEO.getId())).collect(Collectors.toList()); +// +// +// for (LawsMonthlyReportTitleTemplateEO monthlyReportTitleTemplateEO : reportTitleTwoList) { +// int reportCount = 1; +// //子标题对应的月报填写的内容 +// List lawsMonthlyReportWriteEOList = lawsMonthlyReportWriteEOS.stream().filter(e -> monthlyReportTitleTemplateEO.getId().equals(e.getMemoriesChapter())).collect(Collectors.toList()); +// String twoNumber = intToRoman(twoCount); +// twoNumber = oneNumber+"."+twoNumber; +// +// //二级标题 +// String twoTitle = ""; +// if(CutEnum.CN.getValue().equals(cut)){ +// twoTitle = monthlyReportTitleTemplateEO.getTitleCn(); +// }else{ +// twoTitle = monthlyReportTitleTemplateEO.getTitleEn(); +// } +// WordUtil.exportWord(document, twoNumber+" "+twoTitle, null, ParagraphAlignment.LEFT, 2, 12, false, true, "Microsoft YaHei UI"); +// twoCount++; +// +// for (LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO : lawsMonthlyReportWriteEOList) { +// //月报内容标题 +// String reportTitle = ""; +// if(CutEnum.CN.getValue().equals(cut)){ +// reportTitle = lawsMonthlyReportWriteEO.getTitleCn(); +// }else{ +// reportTitle = lawsMonthlyReportWriteEO.getTitleEn(); +// } +// WordUtil.exportWord(document, reportCount+". "+reportTitle, null, ParagraphAlignment.LEFT, 6, 10, false, false, "Microsoft YaHei UI"); +// reportCount++; +// } +// } +// } +// } /** * 数字转罗马字 diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/report/util/WordUtil.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/report/util/WordUtil.java index 607d5da73..c23a58de5 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/report/util/WordUtil.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/report/util/WordUtil.java @@ -1,11 +1,31 @@ package com.jero.modules.report.util; import cn.hutool.core.util.ObjectUtil; +import com.jero.common.constant.enums.CutEnum; +import com.jero.modules.report.entity.LawsMonthlyReportWriteEO; +import com.jero.modules.report.entity.NewOpinionTemplateEO; +import com.jero.modules.report.entity.NewStandardTemplateEO; +import com.jero.modules.report.enums.DictCodeReportEnum; +import com.jero.modules.system.entity.SysCategory; +import com.jero.modules.system.entity.SysDictItem; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.ObjectUtils; import org.apache.poi.xwpf.usermodel.ParagraphAlignment; import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFParagraph; import org.apache.poi.xwpf.usermodel.XWPFRun; +import org.apache.poi.xwpf.usermodel.XWPFTable; +import org.apache.poi.xwpf.usermodel.XWPFTableRow; +import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTJc; +import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblPr; +import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblWidth; +import org.openxmlformats.schemas.wordprocessingml.x2006.main.STJc; +import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTblWidth; + +import java.math.BigInteger; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; public class WordUtil { /** @@ -83,5 +103,338 @@ public class WordUtil { } } + + public static void exportWordExcelDefault(XWPFDocument document, + LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO, + List sysDictItems, + List categoryList, + String cut) { + String technologyTerritory = lawsMonthlyReportWriteEO.getTechnologyTerritory();//技术领域 + String applyCar = lawsMonthlyReportWriteEO.getApplyCar();//适用车型 + String applyScope = lawsMonthlyReportWriteEO.getApplyScope();//适用范围 + String state = lawsMonthlyReportWriteEO.getState();//状态 + String useMethod = lawsMonthlyReportWriteEO.getUseMethod();//用法 + String implementCar = lawsMonthlyReportWriteEO.getImplementCar();//实施车型 + String newCarImplementTime = lawsMonthlyReportWriteEO.getNewCarImplementTime();//新车型实施日期 + String productionCarImplementTime = lawsMonthlyReportWriteEO.getProductionCarImplementTime();//在产车实施日期 + String contentCn = lawsMonthlyReportWriteEO.getContentCn();//主要内容中文 + String contentEn = lawsMonthlyReportWriteEO.getContentEn();//主要内容英文 + String workProgressCn = lawsMonthlyReportWriteEO.getWorkProgressCn();//NIO工作进展中文 + String workProgressEn = lawsMonthlyReportWriteEO.getWorkProgressEn();//NIO工作进展英文 + String lawsContact = lawsMonthlyReportWriteEO.getLawsContact();//法规联系人 + String link = lawsMonthlyReportWriteEO.getLink();//链接 + String technologyTerritoryName = ""; + if(org.apache.commons.lang3.StringUtils.isNotBlank(technologyTerritory)){ + List technologyTerritoryList = Arrays.asList(technologyTerritory.split(",")); + StringBuilder sb = new StringBuilder(); + for (String technologyTerritoryTemp : technologyTerritoryList) { + List collect = categoryList.stream().filter(e -> technologyTerritoryTemp.equals(e.getId())).collect(Collectors.toList()); + if (collect.size() != 0) { + sb.append(collect.get(0).getName() + ","); + } + } + if (org.apache.commons.lang3.StringUtils.isNotBlank(sb)) { + technologyTerritoryName = sb.substring(0, sb.length() - 1); + } + } + //适用车型中文名 + String applyCarName = dictItem(sysDictItems, applyCar,cut, DictCodeReportEnum.APPLYCAR.getValue()); + String applyScopeName = dictItem(sysDictItems, applyScope,cut, DictCodeReportEnum.APPLYSCOPE.getValue()); + String stateName = dictItem(sysDictItems, state,cut, DictCodeReportEnum.STATE.getValue()); + String useMethodName = dictItem(sysDictItems, useMethod,cut, DictCodeReportEnum.USEMETHOD.getValue()); + + + XWPFTable table = document.createTable(12, 2); + + //表格属性 + CTTblPr tablePr = table.getCTTbl().addNewTblPr(); + //表格宽度 + CTJc cTJc = tablePr.addNewJc(); + //居中 + cTJc.setVal(STJc.CENTER); + //列宽自动分割 + CTTblWidth tableWidth = tablePr.addNewTblW(); + //设置表格宽度 + tableWidth.setType(STTblWidth.DXA); + tableWidth.setW(BigInteger.valueOf(8000)); + + + //第1行 + if(CutEnum.CN.getValue().equals(cut)){ + //第1行 + setCell(table.getRow(0), "技术领域",technologyTerritoryName); + //第2行 + setCell(table.getRow(1), "适用车型",applyCarName); + //第3行 + setCell(table.getRow(2), "适用范围",applyScopeName); + //第4行 + setCell(table.getRow(3), "状态",stateName); + //第5行 + setCell(table.getRow(4), "用法",useMethodName); + //第6行 + setCell(table.getRow(5), "实施车型",implementCar); + //第7行 + setCell(table.getRow(6), "新车型实施日期",newCarImplementTime); + //第8行 + setCell(table.getRow(7), "在产车实施日期",productionCarImplementTime); + //第9行 + setCell(table.getRow(8), "主要内容中文",contentCn); + //第10行 + setCell(table.getRow(9), "NIO工作进展中文",workProgressCn); + //第11行 + setCell(table.getRow(10), "法规联系人",lawsContact); + //第12行 + setCell(table.getRow(11), "链接",link); + }else{ + //第1行 + setCell(table.getRow(0), "Technical Field",technologyTerritoryName); + //第2行 + setCell(table.getRow(1), "Vehicle Type",applyCarName); + //第3行 + setCell(table.getRow(2), "Scope",applyScopeName); + //第4行 + setCell(table.getRow(3), "Status",stateName); + //第5行 + setCell(table.getRow(4), "usage",useMethodName); + //第6行 + setCell(table.getRow(5), "Implementation Model",implementCar); + //第7行 + setCell(table.getRow(6), "New Type Execution Date",newCarImplementTime); + //第8行 + setCell(table.getRow(7), "New Vehicle Execution Date",productionCarImplementTime); + //第9行 + setCell(table.getRow(8), "Main Content (English)",contentEn); + //第10行 + setCell(table.getRow(9), "NIO Work Progress (English)",workProgressEn); + //第11行 + setCell(table.getRow(10), "Regulatory Contact",lawsContact); + //第12行 + setCell(table.getRow(11), "Link",link); + } + } + public static void exportWordExcelAsk(XWPFDocument document, + LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO, + String cut) { + List newOpinionTemplateEOList = lawsMonthlyReportWriteEO.getNewOpinionTemplateEOList(); + if(ObjectUtils.isNotEmpty(newOpinionTemplateEOList)){ + XWPFTable table = document.createTable(newOpinionTemplateEOList.size()+1, 4); + //表格属性 + CTTblPr tablePr = table.getCTTbl().addNewTblPr(); + //表格宽度 + CTJc cTJc = tablePr.addNewJc(); + //居中 + cTJc.setVal(STJc.CENTER); + //列宽自动分割 + CTTblWidth tableWidth = tablePr.addNewTblW(); + //设置表格宽度 + tableWidth.setType(STTblWidth.DXA); + tableWidth.setW(BigInteger.valueOf(8000)); + if(CutEnum.CN.getValue().equals(cut)){ + setCellAskOne(table,"序号","计划号","标准名称","征求意见截止日期"); + }else{ + setCellAskOne(table,"Number","Plan Number","Standard Name","Deadline For Comments"); + } + for (int i = 0; i < newOpinionTemplateEOList.size(); i++) { + String planNumberCn = newOpinionTemplateEOList.get(i).getPlanNumberCn();//计划号 + String standardNameCn = newOpinionTemplateEOList.get(i).getStandardNameCn();//标准名称中文 + String standardNameEn = newOpinionTemplateEOList.get(i).getStandardNameEn();//标准名称英文 + String expirationDate = newOpinionTemplateEOList.get(i).getExpirationDate();//征求意见截止日期 + if(CutEnum.CN.getValue().equals(cut)){ + setCellAsk(table, i+1, planNumberCn, standardNameCn, expirationDate); + }else{ + setCellAsk(table, i+1, planNumberCn, standardNameEn, expirationDate); + } + } + } + } + public static void exportWordExcelIssue(XWPFDocument document, + LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO, + String cut) { + List newStandardTemplateEOList = lawsMonthlyReportWriteEO.getNewStandardTemplateEOList(); + if(ObjectUtils.isNotEmpty(newStandardTemplateEOList)){ + XWPFTable table = document.createTable(newStandardTemplateEOList.size()+1, 5); + //表格属性 + CTTblPr tablePr = table.getCTTbl().addNewTblPr(); + //表格宽度 + CTJc cTJc = tablePr.addNewJc(); + //居中 + cTJc.setVal(STJc.CENTER); + //列宽自动分割 + CTTblWidth tableWidth = tablePr.addNewTblW(); + //设置表格宽度 + tableWidth.setType(STTblWidth.DXA); + tableWidth.setW(BigInteger.valueOf(8000)); + if(CutEnum.CN.getValue().equals(cut)){ + setCellIssueOne(table,"序号","标准编号","标准名称","发布日期","实施日期"); + }else{ + setCellIssueOne(table,"Number","Standard Number","Standard Name","Release Date","Implementation date"); + } + for (int i = 0; i < newStandardTemplateEOList.size(); i++) { + String standardNumber = newStandardTemplateEOList.get(i ).getStandardNumber();//标准编号 + String standardNameCn = newStandardTemplateEOList.get(i).getStandardNameCn();//标准名称中文 + String standardNameEn = newStandardTemplateEOList.get(i).getStandardNameEn();//标准名称英文 + String issueTime = newStandardTemplateEOList.get(i).getIssueTime();//发布日期 + String implementTime = newStandardTemplateEOList.get(i).getImplementTime();//实施日期 + if(CutEnum.CN.getValue().equals(cut)){ + setCellIssue(table, i+1, standardNumber, standardNameCn, issueTime,implementTime); + }else{ + setCellIssue(table, i+1, standardNumber, standardNameEn, issueTime,implementTime); + } + } + } + } + + private static void setCellAsk(XWPFTable table, int i, String planNumber, String standardName, String expirationDate) { + //设置单元格高度 + table.getRow(i).setHeight(500); + + //设置每个单元格宽度 + CTTblWidth ctTblWidth0 = table.getRow(i).getCell(0).getCTTc().addNewTcPr().addNewTcW(); + ctTblWidth0.setType(STTblWidth.DXA); + ctTblWidth0.setW(BigInteger.valueOf(1000)); + + CTTblWidth ctTblWidth1 = table.getRow(i).getCell(1).getCTTc().addNewTcPr().addNewTcW(); + ctTblWidth1.setType(STTblWidth.DXA); + ctTblWidth1.setW(BigInteger.valueOf(2000)); + + CTTblWidth ctTblWidth2 = table.getRow(i).getCell(2).getCTTc().addNewTcPr().addNewTcW(); + ctTblWidth2.setType(STTblWidth.DXA); + ctTblWidth2.setW(BigInteger.valueOf(2500)); + + CTTblWidth ctTblWidth3 = table.getRow(i).getCell(3).getCTTc().addNewTcPr().addNewTcW(); + ctTblWidth3.setType(STTblWidth.DXA); + ctTblWidth3.setW(BigInteger.valueOf(2500)); + + table.getRow(i).getCell(0).setText(String.valueOf(i)); + table.getRow(i).getCell(1).setText(planNumber); + table.getRow(i).getCell(2).setText(standardName); + table.getRow(i).getCell(3).setText(expirationDate); + } + private static void setCellIssue(XWPFTable table, int i, String planNumber, String standardName, String expirationDate,String implementTime) { + //设置单元格高度 + table.getRow(i).setHeight(500); + + //设置每个单元格宽度 + CTTblWidth ctTblWidth0 = table.getRow(i).getCell(0).getCTTc().addNewTcPr().addNewTcW(); + ctTblWidth0.setType(STTblWidth.DXA); + ctTblWidth0.setW(BigInteger.valueOf(1000)); + + CTTblWidth ctTblWidth1 = table.getRow(i).getCell(1).getCTTc().addNewTcPr().addNewTcW(); + ctTblWidth1.setType(STTblWidth.DXA); + ctTblWidth1.setW(BigInteger.valueOf(2000)); + + CTTblWidth ctTblWidth2 = table.getRow(i).getCell(2).getCTTc().addNewTcPr().addNewTcW(); + ctTblWidth2.setType(STTblWidth.DXA); + ctTblWidth2.setW(BigInteger.valueOf(2600)); + + CTTblWidth ctTblWidth3 = table.getRow(i).getCell(3).getCTTc().addNewTcPr().addNewTcW(); + ctTblWidth3.setType(STTblWidth.DXA); + ctTblWidth3.setW(BigInteger.valueOf(1200)); + + CTTblWidth ctTblWidth4 = table.getRow(i).getCell(4).getCTTc().addNewTcPr().addNewTcW(); + ctTblWidth4.setType(STTblWidth.DXA); + ctTblWidth4.setW(BigInteger.valueOf(1200)); + + table.getRow(i).getCell(0).setText(String.valueOf(i)); + table.getRow(i).getCell(1).setText(planNumber); + table.getRow(i).getCell(2).setText(standardName); + table.getRow(i).getCell(3).setText(expirationDate); + table.getRow(i).getCell(4).setText(implementTime); + } + private static void setCellIssueOne(XWPFTable table, String number,String planNumber, String standardName, String expirationDate,String implementTime) { + //设置单元格高度 + table.getRow(0).setHeight(500); + + //设置每个单元格宽度 + CTTblWidth ctTblWidth0 = table.getRow(0).getCell(0).getCTTc().addNewTcPr().addNewTcW(); + ctTblWidth0.setType(STTblWidth.DXA); + ctTblWidth0.setW(BigInteger.valueOf(1000)); + + CTTblWidth ctTblWidth1 = table.getRow(0).getCell(1).getCTTc().addNewTcPr().addNewTcW(); + ctTblWidth1.setType(STTblWidth.DXA); + ctTblWidth1.setW(BigInteger.valueOf(2000)); + + CTTblWidth ctTblWidth2 = table.getRow(0).getCell(2).getCTTc().addNewTcPr().addNewTcW(); + ctTblWidth2.setType(STTblWidth.DXA); + ctTblWidth2.setW(BigInteger.valueOf(2600)); + + CTTblWidth ctTblWidth3 = table.getRow(0).getCell(3).getCTTc().addNewTcPr().addNewTcW(); + ctTblWidth3.setType(STTblWidth.DXA); + ctTblWidth3.setW(BigInteger.valueOf(1200)); + + CTTblWidth ctTblWidth4 = table.getRow(0).getCell(4).getCTTc().addNewTcPr().addNewTcW(); + ctTblWidth4.setType(STTblWidth.DXA); + ctTblWidth4.setW(BigInteger.valueOf(1200)); + + table.getRow(0).getCell(0).setText(number); + table.getRow(0).getCell(1).setText(planNumber); + table.getRow(0).getCell(2).setText(standardName); + table.getRow(0).getCell(3).setText(expirationDate); + table.getRow(0).getCell(4).setText(implementTime); + } + private static void setCellAskOne(XWPFTable table, String number,String planNumber, String standardName, String expirationDate) { + //设置单元格高度 + table.getRow(0).setHeight(500); + + //设置每个单元格宽度 + CTTblWidth ctTblWidth0 = table.getRow(0).getCell(0).getCTTc().addNewTcPr().addNewTcW(); + ctTblWidth0.setType(STTblWidth.DXA); + ctTblWidth0.setW(BigInteger.valueOf(1000)); + + CTTblWidth ctTblWidth1 = table.getRow(0).getCell(1).getCTTc().addNewTcPr().addNewTcW(); + ctTblWidth1.setType(STTblWidth.DXA); + ctTblWidth1.setW(BigInteger.valueOf(2000)); + + CTTblWidth ctTblWidth2 = table.getRow(0).getCell(2).getCTTc().addNewTcPr().addNewTcW(); + ctTblWidth2.setType(STTblWidth.DXA); + ctTblWidth2.setW(BigInteger.valueOf(2500)); + + CTTblWidth ctTblWidth3 = table.getRow(0).getCell(3).getCTTc().addNewTcPr().addNewTcW(); + ctTblWidth3.setType(STTblWidth.DXA); + ctTblWidth3.setW(BigInteger.valueOf(2500)); + + table.getRow(0).getCell(0).setText(number); + table.getRow(0).getCell(1).setText(planNumber); + table.getRow(0).getCell(2).setText(standardName); + table.getRow(0).getCell(3).setText(expirationDate); + } + + + private static String dictItem(List sysDictItems, String fieldValue,String cut,String dictCode) { + String fieldValueName = ""; + if(StringUtils.isNotEmpty(fieldValue)){ + List fieldValueList = Arrays.asList(fieldValue.split(",")); + StringBuilder sb = new StringBuilder(); + for (String fieldValueTemp : fieldValueList) { + List collect = sysDictItems.stream() + .filter(e -> fieldValueTemp.equals(e.getItemValue()) && dictCode.equals(e.getDictCode())) + .collect(Collectors.toList()); + if(collect.size() != 0){ + if(CutEnum.CN.getValue().equals(cut)){ + sb.append(collect.get(0).getItemText() + ","); + }else{ + sb.append(collect.get(0).getEnName() + ","); + } + } + } + if(org.apache.commons.lang3.StringUtils.isNotBlank(sb)){ + fieldValueName = sb.substring(0, sb.length() - 1); + } + } + return fieldValueName; + } + + private static void setCell(XWPFTableRow tableRow, String fieldName,String technologyTerritory) { + tableRow.setHeight(500); + CTTblWidth ctTblWidth0 = tableRow.getCell(0).getCTTc().addNewTcPr().addNewTcW(); + ctTblWidth0.setType(STTblWidth.DXA); + ctTblWidth0.setW(BigInteger.valueOf(3000)); + CTTblWidth ctTblWidth1 = tableRow.getCell(1).getCTTc().addNewTcPr().addNewTcW(); + ctTblWidth1.setType(STTblWidth.DXA); + ctTblWidth1.setW(BigInteger.valueOf(5000)); + + tableRow.getCell(0).setText(fieldName); + tableRow.getCell(1).setText(technologyTerritory); + } }