月报整合导出
This commit is contained in:
+40
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
+251
-6
@@ -343,9 +343,42 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
|
|||||||
wrapper.eq(LawsMonthlyReportWriteEO::getMonth,lawsMonthlyReportWriteEO.getMonth());
|
wrapper.eq(LawsMonthlyReportWriteEO::getMonth,lawsMonthlyReportWriteEO.getMonth());
|
||||||
}
|
}
|
||||||
if(StringUtils.isNotBlank(lawsMonthlyReportWriteEO.getIds())){
|
if(StringUtils.isNotBlank(lawsMonthlyReportWriteEO.getIds())){
|
||||||
wrapper.in(LawsMonthlyReportWriteEO::getId,StringUtils.join(lawsMonthlyReportWriteEO.getIds(),""));
|
wrapper.in(LawsMonthlyReportWriteEO::getId,Arrays.asList(lawsMonthlyReportWriteEO.getIds().split(",")));
|
||||||
}
|
}
|
||||||
List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOS = this.list(wrapper);
|
List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOS = this.list(wrapper);
|
||||||
|
|
||||||
|
List<String> lawsMonthlyReportIdList = lawsMonthlyReportWriteEOS.stream().map(LawsMonthlyReportWriteEO::getId).collect(Collectors.toList());
|
||||||
|
//新征求意见清单模板
|
||||||
|
List<NewOpinionTemplateEO> newOpinionTemplateEOList = new ArrayList<>();
|
||||||
|
if(lawsMonthlyReportIdList.size() != 0){
|
||||||
|
LambdaQueryWrapper<NewOpinionTemplateEO> wrapperTemp = new LambdaQueryWrapper<>();
|
||||||
|
wrapperTemp.in(NewOpinionTemplateEO::getLawsMonthlyReportWriteId,lawsMonthlyReportIdList);
|
||||||
|
newOpinionTemplateEOList = iNewOpinionTemplateEOService.list(wrapperTemp);
|
||||||
|
}
|
||||||
|
|
||||||
|
//新发布标准清单模板
|
||||||
|
List<NewStandardTemplateEO> newStandardTemplateEOList = new ArrayList<>();
|
||||||
|
if(lawsMonthlyReportIdList.size() != 0){
|
||||||
|
LambdaQueryWrapper<NewStandardTemplateEO> 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<NewOpinionTemplateEO> 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<NewStandardTemplateEO> collect = newStandardTemplateEOList.stream()
|
||||||
|
.filter(e -> monthlyReportWriteEO.getId().equals(e.getLawsMonthlyReportWriteId())).collect(Collectors.toList());
|
||||||
|
monthlyReportWriteEO.setNewStandardTemplateEOList(collect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//月报填写列表所有的章节目录
|
//月报填写列表所有的章节目录
|
||||||
List<String> memoriesChapterList = lawsMonthlyReportWriteEOS.stream()
|
List<String> memoriesChapterList = lawsMonthlyReportWriteEOS.stream()
|
||||||
.map(LawsMonthlyReportWriteEO::getMemoriesChapter).distinct().collect(Collectors.toList());
|
.map(LawsMonthlyReportWriteEO::getMemoriesChapter).distinct().collect(Collectors.toList());
|
||||||
@@ -406,11 +439,15 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
|
|||||||
//NIO Monthly Report on Automobile Regulations-202004-Main Page-EN
|
//NIO Monthly Report on Automobile Regulations-202004-Main Page-EN
|
||||||
String memoriesChapterCN = path + File.separator +"蔚来汽车法规月报" + lawsMonthlyReportWriteEOS.get(0).getMonth()+"主页面-CN.docx";
|
String memoriesChapterCN = path + File.separator +"蔚来汽车法规月报" + lawsMonthlyReportWriteEOS.get(0).getMonth()+"主页面-CN.docx";
|
||||||
String memoriesChapterEN = path + File.separator +"NIO Monthly Report on Automobile Regulations-" + lawsMonthlyReportWriteEOS.get(0).getMonth()+"-Main Page-EN.docx";
|
String memoriesChapterEN = path + File.separator +"NIO Monthly Report on Automobile Regulations-" + lawsMonthlyReportWriteEOS.get(0).getMonth()+"-Main Page-EN.docx";
|
||||||
|
String memoriesChapterContentCn = path + File.separator +"蔚来汽车法规月报" + lawsMonthlyReportWriteEOS.get(0).getMonth()+"-CN.docx";
|
||||||
|
String memoriesChapterContentEn = path + File.separator +"Weilai Automobile Regulations Monthly Report-" + lawsMonthlyReportWriteEOS.get(0).getMonth()+"-EN.docx";
|
||||||
String titleCN = "蔚来汽车法规月报" + lawsMonthlyReportWriteEOS.get(0).getMonth();
|
String titleCN = "蔚来汽车法规月报" + lawsMonthlyReportWriteEOS.get(0).getMonth();
|
||||||
String titleEN = "NIO Monthly Report on Automobile Regulations-" + lawsMonthlyReportWriteEOS.get(0).getMonth();
|
String titleEN = "NIO Monthly Report on Automobile Regulations-" + lawsMonthlyReportWriteEOS.get(0).getMonth();
|
||||||
|
|
||||||
File wordFile = new File(memoriesChapterCN);
|
File wordFile = new File(memoriesChapterCN);
|
||||||
File wordFileEn = new File(memoriesChapterEN);
|
File wordFileEn = new File(memoriesChapterEN);
|
||||||
|
File wordFileContentCn = new File(memoriesChapterContentCn);
|
||||||
|
File wordFileContentEn = new File(memoriesChapterContentEn);
|
||||||
if(!wordFile.exists()){
|
if(!wordFile.exists()){
|
||||||
try {
|
try {
|
||||||
wordFile.getParentFile().mkdirs();
|
wordFile.getParentFile().mkdirs();
|
||||||
@@ -419,6 +456,30 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
|
|||||||
log.error("文件《"+titleCN+"》创建失败");
|
log.error("文件《"+titleCN+"》创建失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!wordFileEn.exists()){
|
||||||
|
try {
|
||||||
|
wordFileEn.getParentFile().mkdirs();
|
||||||
|
wordFileEn.createNewFile();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("文件《"+titleCN+"》创建失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!wordFileContentCn.exists()){
|
||||||
|
try {
|
||||||
|
wordFileContentCn.getParentFile().mkdirs();
|
||||||
|
wordFileContentCn.createNewFile();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("文件《"+titleCN+"》创建失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!wordFileContentEn.exists()){
|
||||||
|
try {
|
||||||
|
wordFileContentEn.getParentFile().mkdirs();
|
||||||
|
wordFileContentEn.createNewFile();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("文件《"+titleCN+"》创建失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//主页面中文版
|
//主页面中文版
|
||||||
@@ -431,6 +492,19 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
|
|||||||
FileOutputStream outCn = new FileOutputStream(wordFileEn);
|
FileOutputStream outCn = new FileOutputStream(wordFileEn);
|
||||||
word(lawsMonthlyReportWriteEOS, lawsMonthlyReportTitleTemplateEOS, reportTitleOneList, titleEN, documentEn,CutEnum.EN.getValue());
|
word(lawsMonthlyReportWriteEOS, lawsMonthlyReportTitleTemplateEOS, reportTitleOneList, titleEN, documentEn,CutEnum.EN.getValue());
|
||||||
documentEn.write(outCn);
|
documentEn.write(outCn);
|
||||||
|
|
||||||
|
//内容中文版
|
||||||
|
XWPFDocument documentContentCn = new XWPFDocument();
|
||||||
|
FileOutputStream outContentCn = new FileOutputStream(wordFileContentCn);
|
||||||
|
wordContent(lawsMonthlyReportWriteEOS, lawsMonthlyReportTitleTemplateEOS, reportTitleOneList, titleCN, documentContentCn,CutEnum.CN.getValue());
|
||||||
|
documentContentCn.write(outContentCn);
|
||||||
|
|
||||||
|
//内容英文版
|
||||||
|
XWPFDocument documentContentEn = new XWPFDocument();
|
||||||
|
FileOutputStream outContentEn = new FileOutputStream(wordFileContentEn);
|
||||||
|
wordContent(lawsMonthlyReportWriteEOS, lawsMonthlyReportTitleTemplateEOS, reportTitleOneList, titleCN, documentContentEn,CutEnum.EN.getValue());
|
||||||
|
documentContentEn.write(outContentEn);
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("文件创建异常,异常信息为:" + e.getMessage());
|
log.error("文件创建异常,异常信息为:" + e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -462,8 +536,11 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
|
|||||||
}else{
|
}else{
|
||||||
oneTitle = lawsMonthlyReportTitleTemplateEO.getTitleEn();
|
oneTitle = lawsMonthlyReportTitleTemplateEO.getTitleEn();
|
||||||
}
|
}
|
||||||
WordUtil.exportWord(document, oneNumber+" "+oneTitle, null, ParagraphAlignment.LEFT, 0, 12, false, true, "Microsoft YaHei UI");
|
if(StringUtils.isNotBlank(oneTitle)){
|
||||||
oneCount++;
|
WordUtil.exportWord(document, oneNumber+" "+oneTitle, null, ParagraphAlignment.LEFT, 0, 12, false, true, "Microsoft YaHei UI");
|
||||||
|
oneCount++;
|
||||||
|
}
|
||||||
|
|
||||||
List<LawsMonthlyReportTitleTemplateEO> reportTitleTwoList = lawsMonthlyReportTitleTemplateEOS.stream().filter(e -> e.getParentId().equals(lawsMonthlyReportTitleTemplateEO.getId())).collect(Collectors.toList());
|
List<LawsMonthlyReportTitleTemplateEO> reportTitleTwoList = lawsMonthlyReportTitleTemplateEOS.stream().filter(e -> e.getParentId().equals(lawsMonthlyReportTitleTemplateEO.getId())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
@@ -481,8 +558,10 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
|
|||||||
}else{
|
}else{
|
||||||
twoTitle = monthlyReportTitleTemplateEO.getTitleEn();
|
twoTitle = monthlyReportTitleTemplateEO.getTitleEn();
|
||||||
}
|
}
|
||||||
WordUtil.exportWord(document, twoNumber+" "+twoTitle, null, ParagraphAlignment.LEFT, 2, 12, false, true, "Microsoft YaHei UI");
|
if(StringUtils.isNotBlank(twoTitle)){
|
||||||
twoCount++;
|
WordUtil.exportWord(document, twoNumber+" "+twoTitle, null, ParagraphAlignment.LEFT, 2, 12, false, true, "Microsoft YaHei UI");
|
||||||
|
twoCount++;
|
||||||
|
}
|
||||||
|
|
||||||
for (LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO : lawsMonthlyReportWriteEOList) {
|
for (LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO : lawsMonthlyReportWriteEOList) {
|
||||||
//月报内容标题
|
//月报内容标题
|
||||||
@@ -492,12 +571,178 @@ public class LawsMonthlyReportWriteEOServiceImpl extends ServiceImpl<LawsMonthly
|
|||||||
}else{
|
}else{
|
||||||
reportTitle = lawsMonthlyReportWriteEO.getTitleEn();
|
reportTitle = lawsMonthlyReportWriteEO.getTitleEn();
|
||||||
}
|
}
|
||||||
WordUtil.exportWord(document, reportCount+". "+reportTitle, null, ParagraphAlignment.LEFT, 6, 10, false, false, "Microsoft YaHei UI");
|
if(org.apache.commons.lang3.StringUtils.isNotBlank(reportTitle)){
|
||||||
|
WordUtil.exportWord(document, reportCount+". "+reportTitle, null, ParagraphAlignment.LEFT, 6, 10, false, false, "Microsoft YaHei UI");
|
||||||
|
reportCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void wordContent(List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOS,
|
||||||
|
List<LawsMonthlyReportTitleTemplateEO> lawsMonthlyReportTitleTemplateEOS,
|
||||||
|
List<LawsMonthlyReportTitleTemplateEO> reportTitleOneList,
|
||||||
|
String titleCN,
|
||||||
|
XWPFDocument document,
|
||||||
|
String cut) {
|
||||||
|
//数据字典
|
||||||
|
List<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll();
|
||||||
|
|
||||||
|
//树形数据字典
|
||||||
|
List<SysCategory> 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<LawsMonthlyReportTitleTemplateEO> reportTitleTwoList = lawsMonthlyReportTitleTemplateEOS.stream().filter(e -> e.getParentId().equals(lawsMonthlyReportTitleTemplateEO.getId())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
for (LawsMonthlyReportTitleTemplateEO monthlyReportTitleTemplateEO : reportTitleTwoList) {
|
||||||
|
int reportCount = 1;
|
||||||
|
//子标题对应的月报填写的内容
|
||||||
|
List<LawsMonthlyReportWriteEO> 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<LawsMonthlyReportWriteEO> askList = lawsMonthlyReportWriteEOList.stream().filter(e -> ContentTemplateEnum.NEW_REQUEST_LIST_TEMPLATE.getValue().equals(e.getContentTemplate())).collect(Collectors.toList());
|
||||||
|
List<LawsMonthlyReportWriteEO> 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++;
|
reportCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// private void word(List<LawsMonthlyReportWriteEO> lawsMonthlyReportWriteEOS,
|
||||||
|
// List<LawsMonthlyReportTitleTemplateEO> lawsMonthlyReportTitleTemplateEOS,
|
||||||
|
// List<LawsMonthlyReportTitleTemplateEO> 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<LawsMonthlyReportTitleTemplateEO> reportTitleTwoList = lawsMonthlyReportTitleTemplateEOS.stream().filter(e -> e.getParentId().equals(lawsMonthlyReportTitleTemplateEO.getId())).collect(Collectors.toList());
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// for (LawsMonthlyReportTitleTemplateEO monthlyReportTitleTemplateEO : reportTitleTwoList) {
|
||||||
|
// int reportCount = 1;
|
||||||
|
// //子标题对应的月报填写的内容
|
||||||
|
// List<LawsMonthlyReportWriteEO> 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++;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数字转罗马字
|
* 数字转罗马字
|
||||||
|
|||||||
@@ -1,11 +1,31 @@
|
|||||||
package com.jero.modules.report.util;
|
package com.jero.modules.report.util;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
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.lang.StringUtils;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.apache.poi.xwpf.usermodel.ParagraphAlignment;
|
import org.apache.poi.xwpf.usermodel.ParagraphAlignment;
|
||||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||||
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
|
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
|
||||||
import org.apache.poi.xwpf.usermodel.XWPFRun;
|
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 {
|
public class WordUtil {
|
||||||
/**
|
/**
|
||||||
@@ -83,5 +103,338 @@ public class WordUtil {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void exportWordExcelDefault(XWPFDocument document,
|
||||||
|
LawsMonthlyReportWriteEO lawsMonthlyReportWriteEO,
|
||||||
|
List<SysDictItem> sysDictItems,
|
||||||
|
List<SysCategory> 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<String> technologyTerritoryList = Arrays.asList(technologyTerritory.split(","));
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (String technologyTerritoryTemp : technologyTerritoryList) {
|
||||||
|
List<SysCategory> 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<NewOpinionTemplateEO> 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<NewStandardTemplateEO> 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<SysDictItem> sysDictItems, String fieldValue,String cut,String dictCode) {
|
||||||
|
String fieldValueName = "";
|
||||||
|
if(StringUtils.isNotEmpty(fieldValue)){
|
||||||
|
List<String> fieldValueList = Arrays.asList(fieldValue.split(","));
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (String fieldValueTemp : fieldValueList) {
|
||||||
|
List<SysDictItem> 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user