| | |
| | | import com.ots.project.exam.domain.TReportTemplate; |
| | | import com.ots.project.exam.dto.JAQTableStyle; |
| | | import com.ots.project.exam.dto.WordParam; |
| | | import com.ots.project.tool.PdfDockerUtil; |
| | | import com.ots.project.tool.PdfUtil; |
| | | import com.ots.project.tool.ShellTool; |
| | | import com.ots.project.tool.exam.ExamUtil; |
| | | import com.ots.project.tool.exam.ImageUtil; |
| | | import com.ots.project.tool.exam.JsonUtil; |
| | | import com.ots.project.tool.exam.ZipUtil; |
| | | import com.ots.project.tool.libreoffice.LibreOfficeUtil; |
| | | import com.ots.project.tool.report.APIFan.chart.APIFanChart; |
| | | import com.ots.project.tool.report.CIAQ.chart.CIAQChart; |
| | | import com.ots.project.tool.report.JAQ.condition.JAQTeam; |
| | | import com.ots.project.tool.report.LAQ.chart.LAQAllChart; |
| | | import com.ots.project.tool.report.LAQ.chart.LAQAllPng; |
| | | import com.ots.project.tool.report.LAQ.chart.LAQChart; |
| | | import com.ots.project.tool.report.MAQTR.chart.MAQTRChart; |
| | | import com.ots.project.tool.report.PAQ.chart.PAQChart; |
| | | import org.apache.commons.collections.map.HashedMap; |
| | | import org.apache.poi.ooxml.POIXMLDocument; |
| | | import org.apache.poi.openxml4j.exceptions.InvalidFormatException; |
| | | import org.apache.poi.openxml4j.util.ZipSecureFile; |
| | | import org.apache.poi.util.Units; |
| | | import org.apache.poi.xwpf.usermodel.*; |
| | | import org.apache.xmlbeans.XmlCursor; |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.w3c.dom.Node; |
| | | import org.w3c.dom.NodeList; |
| | | import springfox.documentation.spring.web.json.Json; |
| | | |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.*; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | import java.util.concurrent.CompletableFuture; |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | |
| | | log.info("表格数据:" + table.getText()); |
| | | //增加表格或者減少表格 |
| | | if (Objects.equals(textMap.get("sendEmailFileName"), ReportTypeEnum.JAQ.getCode())) { |
| | | log.info("表:{}",i); |
| | | addOrDelTableRow(table,i,textMap); |
| | | } |
| | | if (checkText(table.getText())) { |
| | |
| | | Integer tableNum = Integer.valueOf(textMap.get(tableEnum.getName()).toString()); |
| | | Integer rows = table.getRows().size(); |
| | | |
| | | log.info("[测试]-tableEnum:"+tableEnum.toString()); |
| | | |
| | | //表1-表3 需剔除表头 |
| | | Integer contentRows = rows - 1; |
| | | //表4 需剔除表头跟尾部预留行数 |
| | | if(tableEnum == TableEnum.table4){ |
| | | contentRows -= 5; |
| | | rows -= 5; |
| | | |
| | | //如果表4,要增加显示行,这里要改动 |
| | | contentRows -= 3; |
| | | rows -= 3; |
| | | |
| | | //表4 行为表现举例处理 |
| | | Integer table4ChildrenNum = Integer.valueOf(textMap.get(TableEnum.table4Children.getName()).toString()); |
| | |
| | | } |
| | | } |
| | | } |
| | | //表4 胜任力预留位置序号处理 |
| | | if(tableNum != null && tableNum != 8){ |
| | | for (int i = tableNum; i < tableNum+4; i++) { |
| | | XWPFTableRow row = table.getRows().get(i); |
| | | } |
| | | |
| | | //table5不需要追加,单独处理 |
| | | if(tableEnum != TableEnum.table5) { |
| | | //限制行数不为空 和 限制行数跟报告现有不一致需进行处理 |
| | | if (tableNum != null && !tableNum.equals(contentRows)) { |
| | | if (tableNum > contentRows) { |
| | | //增加行数 |
| | | Integer addRow = tableNum - contentRows; |
| | | log.info("{}增加{}行", tableEnum.getName(), addRow); |
| | | for (int i = rows; i < rows + addRow; i++) { |
| | | addJAQTable(table, tableEnum, i, textMap); |
| | | } |
| | | |
| | | } else { |
| | | //减少行数 |
| | | Integer delRow = rows - tableNum; |
| | | for (int i = contentRows; i > rows - delRow; i--) { |
| | | delJAQTable(table, i); |
| | | } |
| | | log.info("{}减少{}行数", TableEnum.codeOf(index).getName(), delRow - 1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //如果表4,要增加显示行,这里要改动 |
| | | //表4 胜任力预留位置序号处理 |
| | | if(tableEnum == TableEnum.table4){ |
| | | if(tableNum != null && tableNum != 12){ |
| | | for (int i = tableNum; i <= tableNum + 2; i++) { |
| | | if(i+2 > table.getRows().size()){ |
| | | continue; |
| | | } |
| | | XWPFTableRow row = table.getRows().get(i+2); |
| | | List<XWPFTableCell> cells = row.getTableCells(); |
| | | changeText(cells.get(0).getParagraphs().get(0),"#"+(i+1)+"."); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //限制行数不为空 和 限制行数跟报告现有不一致需进行处理 |
| | | if(tableNum != null && !tableNum.equals(contentRows)){ |
| | | if(tableNum > contentRows){ |
| | | //增加行数 |
| | | Integer addRow = tableNum - contentRows; |
| | | log.info("{}增加{}行",tableEnum.getName(),addRow); |
| | | for (int i = rows; i < rows+addRow; i++) { |
| | | addJAQTable(table,tableEnum,i,textMap); |
| | | |
| | | //表6,显示JAQ报告参与人 |
| | | if(tableEnum == TableEnum.table5) |
| | | { |
| | | log.info("【表5】开始处理...{}",tableNum); |
| | | // if(tableNum != null && !tableNum.equals(contentRows)) { |
| | | // if (tableNum > contentRows) { |
| | | // //增加行数 |
| | | // Integer addRow = tableNum - contentRows; |
| | | // log.info("{}增加{}行", tableEnum.getName(), addRow); |
| | | // for (int i = rows; i < rows + addRow; i++) { |
| | | // addJAQTable(table, tableEnum, i, textMap); |
| | | // } |
| | | // } |
| | | // } |
| | | if(tableNum>0) |
| | | { |
| | | for(int i=rows;i<rows+tableNum;i++) |
| | | { |
| | | addJAQTable(table, tableEnum, i, textMap); |
| | | } |
| | | |
| | | }else{ |
| | | //减少行数 |
| | | Integer delRow = rows - tableNum; |
| | | for (int i = contentRows; i > rows-delRow; i--) { |
| | | delJAQTable(table,i); |
| | | } |
| | | log.info("{}减少{}行数",TableEnum.codeOf(index).getName(),delRow-1); |
| | | delJAQTable(table,1); |
| | | } |
| | | log.info("【表5】处理完成..."); |
| | | } |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | log.info("表{}增加表格或者減少表格异常",index+1); |
| | | log.info("异常:{}",e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | XWPFTableRow row = table.getRows().get(index); |
| | | List<XWPFTableCell> cells = row.getTableCells(); |
| | | |
| | | switch (tableEnum){ |
| | | case table1: |
| | | cells.get(0).getParagraphs().get(0).getRuns().get(0).setText(textMap.get("T1rank"+index)+""); |
| | |
| | | cell.getParagraphs().get(cell.getParagraphs().size()-1).getRuns().get(0).setText(null); |
| | | } |
| | | } |
| | | break; |
| | | case table5: |
| | | log.info("[add] table5,增加行。index={}",index); |
| | | String teamUsers = textMap.get("teamUserList").toString(); |
| | | List<JAQTeam> teamUserList = JsonUtil.toJsonListObject(teamUsers,JAQTeam.class); |
| | | |
| | | int keyIndex = index-2; |
| | | if(keyIndex>=0) |
| | | { |
| | | log.info("当前keyIndex:{}",keyIndex); |
| | | for(int k =0;k<3;k++) |
| | | { |
| | | XWPFParagraph p =cells.get(k).getParagraphs().get(0); |
| | | List<XWPFRun> runs = p.getRuns(); |
| | | if(runs.isEmpty()) |
| | | { |
| | | p.createRun(); |
| | | } |
| | | for (int i = runs.size()-1;i>0;i--) |
| | | { |
| | | p.removeRun(i); |
| | | } |
| | | XWPFRun run = runs.get(0); |
| | | |
| | | switch (k){ |
| | | case 0:run.setText(String.valueOf(keyIndex+1),0); break; |
| | | case 1:run.setText(teamUserList.get(keyIndex).getTeamName(),0);break; |
| | | case 2:run.setText(teamUserList.get(keyIndex).getTeamDepart(),0);break; |
| | | case 3:run.setText(teamUserList.get(keyIndex).getTeamName(),0);break; |
| | | default:break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // cells.get(0).getParagraphs().get(0).getRuns().get(0).setText(index.toString()); |
| | | // cells.get(1).getParagraphs().get(0).getRuns().get(0).setText(teamUserList.get(index).getTeamName()); |
| | | // cells.get(2).getParagraphs().get(0).getRuns().get(0).setText(teamUserList.get(index).getTeamDepart()); |
| | | // cells.get(3).getParagraphs().get(0).getRuns().get(0).setText(teamUserList.get(index).getTeamName()); |
| | | break; |
| | | } |
| | | } |
| | |
| | | |
| | | if (checkText(runValue)) { |
| | | runValue = runValue.replaceAll("%.*%", ""); |
| | | runValue = runValue.replaceAll("N/A NONE", ""); |
| | | |
| | | } |
| | | runValue = runValue.replaceAll("N/A NONE", ""); |
| | | |
| | | return runValue; |
| | | } |
| | |
| | | if(StringUtils.contains(keyValue, "%table-line-feed%")){ |
| | | String[] keyValues = keyValue.split("%table-line-feed%"); |
| | | runValue = delDynList(keyTemp, Arrays.asList(keyValues), paragraph, document,1); |
| | | }else{ |
| | | }else if(StringUtils.contains(keyValue, "%line-feed%")){ |
| | | String[] keyValues = keyValue.split("%line-feed%"); |
| | | runValue = delDynList(keyTemp, Arrays.asList(keyValues), paragraph, document,0); |
| | | } |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | //删除文件 |
| | | deleteFileByStr(deleteFileStrList); |
| | | return AjaxResult.success(fileName + ".zip"); |
| | | } |
| | |
| | | reportType = getTypeIfIsSAQ(tReportTemplate, reportType); |
| | | reportType = getPositionIfJAQ(textMap, reportType); |
| | | reportName = textMap.get("sendEmailFileName") + "_" + reportType + "_" + ReportTypeNameEnum.valueOf(tReportTemplate.getTemplateType()).getCode() + "_" + ReportTypeNameEnum.valueOf(tReportTemplate.getLangType()).getCode() + ".docx"; |
| | | reportName = reportName.replace("\t",""); |
| | | reportName = reportName.replaceAll(" ", "_"); |
| | | |
| | | //模板文件需要加锁 |
| | | synchronized (reportName.intern()){ |
| | | out = getDownLoadFileOutputStream(reportName); |
| | | log.info("reportTemplate:" + fileName); |
| | | out = getDownLoadFileOutputStream(reportName); |
| | | //synchronized (fileName.intern()){ |
| | | //String templateType = tReportTemplate.getTemplateType(); |
| | | setChageWord(fileName, out, textMap, tReportTemplate.getReportType(),tReportTemplate.getDataPath(), autoTableMap); |
| | | out.flush(); |
| | | changColorIfJAQ(textMap, out, reportName, tReportTemplate.getReportType()); |
| | | } |
| | | long startTime1 = System.currentTimeMillis(); |
| | | setChageWord(fileName, out, textMap, tReportTemplate.getReportType(), tReportTemplate.getDataPath(), autoTableMap); |
| | | // 获取结束时间 |
| | | long endTime1 = System.currentTimeMillis(); |
| | | // 计算耗时(单位:毫秒) |
| | | long duration1 = endTime1 - startTime1; |
| | | log.info("setChageWord 程序执行耗时:" + duration1 + " 毫秒,生成报告:"+reportName); |
| | | |
| | | //PAQ、MAQTR采用新的doc转pdf |
| | | if(ReportTypeEnum.PAQ.getCode().equals(reportType) || ReportTypeEnum.MAQTR.getCode().equals(reportType)){ |
| | | out.flush(); |
| | | changColorIfJAQ(textMap, out, reportName, tReportTemplate.getReportType()); |
| | | //} |
| | | |
| | | //PAQ、MAQTR采用、CIAQ、APIFan新的doc转pdf |
| | | if(ReportTypeEnum.PAQ.getCode().equals(reportType) || ReportTypeEnum.MAQTR.getCode().equals(reportType) |
| | | || ReportTypeEnum.CIAQ.getCode().equals(reportType) ||ReportTypeEnum.API_Fan.getCode().equals(reportType)){ |
| | | PdfUtil.convertPDF(EssConfig.getProfile() + "/" + reportName); |
| | | }else if(ReportTypeEnum.LAQ.getCode().equals(reportType)){ |
| | | // 获取开始时间 |
| | | long startTime = System.currentTimeMillis(); |
| | | // PdfUtil.dockerConvertPDF(EssConfig.getProfile(),EssConfig.getDocx2pdfPath(),reportName); |
| | | PdfDockerUtil.convertPDF(EssConfig.getProfile(),EssConfig.getDocx2pdfPath(),reportName); |
| | | |
| | | // 获取结束时间 |
| | | long endTime = System.currentTimeMillis(); |
| | | // 计算耗时(单位:毫秒) |
| | | long duration = endTime - startTime; |
| | | log.info("dockerConvertPDF 程序执行耗时:" + duration + " 毫秒,生成报告:"+reportName); |
| | | |
| | | }else{ |
| | | //ShellTool.execLibreofficeCommand("pdf", EssConfig.getProfile() + "/" + reportName, EssConfig.getProfile() + "/"); |
| | | ShellTool shellTool = ShellTool.builder(); |
| | | shellTool.execNewLibreofficeCommand("pdf", EssConfig.getProfile() + "/" + reportName, EssConfig.getProfile() + "/" + reportName.replace("docx","pdf")); |
| | | ShellTool.execLibreofficeCommand("pdf", EssConfig.getProfile() + "/" + reportName, EssConfig.getProfile() + "/"); |
| | | // ShellTool shellTool = ShellTool.builder(); |
| | | // shellTool.execNewLibreofficeCommand("pdf", EssConfig.getProfile() + "/" + reportName, EssConfig.getProfile() + "/" + reportName.replace("docx","pdf")); |
| | | |
| | | //新方法测试 |
| | | //LibreOfficeUtil.convertOffice2PDFSyncIsSuccess(new File(EssConfig.getProfile() + "/" + reportName),new File(EssConfig.getProfile() + "/" + reportName.replace("docx","pdf"))); |
| | | } |
| | | zipFilePath = getPdfPath(reportName); |
| | | |
| | |
| | | } |
| | | return zipFilePath; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * LAQ使用-----太慢了。太慢了 |
| | | * @param fileName |
| | | * @param tReportTemplate |
| | | * @param textMap |
| | | * @param autoTableMap |
| | | * @param deleteFileStrList |
| | | * @return |
| | | */ |
| | | private static List<String> reportNameList = new ArrayList<>(); |
| | | // public static String makeReportFileForLAQ(String fileName, TReportTemplate tReportTemplate, Map<String, Object> textMap, Map<Integer, Map<Integer, List<String[]>>> autoTableMap, List<String> deleteFileStrList,Integer index,Integer totalNum,Boolean cleanFlag) { |
| | | // String returnMessage = "导出模板转移错误:"; |
| | | // InputStream in = null; |
| | | // FileOutputStream out = null; |
| | | // String zipFilePath = ""; |
| | | // String reportName = ""; |
| | | // |
| | | // if(cleanFlag) |
| | | // { |
| | | // reportNameList = new ArrayList<>(); |
| | | // } |
| | | // |
| | | // try { |
| | | // |
| | | // String reportType = tReportTemplate.getReportType(); |
| | | // reportName = textMap.get("sendEmailFileName") + "_" + reportType + "_" + ReportTypeNameEnum.valueOf(tReportTemplate.getTemplateType()).getCode() + "_" + ReportTypeNameEnum.valueOf(tReportTemplate.getLangType()).getCode() + ".docx"; |
| | | // reportName = reportName.replaceAll(" ", "_"); |
| | | // |
| | | // reportNameList.add(reportName); |
| | | // |
| | | // //模板文件需要加锁 |
| | | // out = getDownLoadFileOutputStream(reportName); |
| | | // |
| | | // long startTime1 = System.currentTimeMillis(); |
| | | // setChageWord(fileName, out, textMap, tReportTemplate.getReportType(), tReportTemplate.getDataPath(), autoTableMap); |
| | | // // 获取结束时间 |
| | | // long endTime1 = System.currentTimeMillis(); |
| | | // // 计算耗时(单位:毫秒) |
| | | // long duration1 = endTime1 - startTime1; |
| | | // log.info("setChageWord 程序执行耗时:" + duration1 + " 毫秒,生成报告:"+reportName); |
| | | // |
| | | // out.flush(); |
| | | // |
| | | //// if(ReportTypeEnum.LAQ.getCode().equals(reportType)){ |
| | | //// // 获取开始时间 |
| | | //// long startTime = System.currentTimeMillis(); |
| | | //// |
| | | //// PdfUtil.dockerConvertPDF(EssConfig.getProfile(),EssConfig.getDocx2pdfPath(),reportName); |
| | | //// // 获取结束时间 |
| | | //// long endTime = System.currentTimeMillis(); |
| | | //// // 计算耗时(单位:毫秒) |
| | | //// long duration = endTime - startTime; |
| | | //// log.info("dockerConvertPDF 程序执行耗时:" + duration + " 毫秒,生成报告:"+reportName); |
| | | //// } |
| | | // if(Objects.equals(index, totalNum)) |
| | | // { |
| | | // //并行转换 |
| | | // execLAQ2PDF(reportNameList); |
| | | // } |
| | | // |
| | | // zipFilePath = getPdfPath(reportName); |
| | | // |
| | | // deleteFileStrList.add(EssConfig.getProfile() + "/" + reportName); |
| | | // } catch (Exception ex) { |
| | | // returnMessage = returnMessage + ex.getMessage(); |
| | | // deleteFileStrList.add(EssConfig.getProfile() + "/" + reportName); |
| | | // log.error("导出模板转移错误:{}\n检查文件:" + fileName, returnMessage, ex); |
| | | // } finally { |
| | | // closeChannel(out); |
| | | // closeChannel(in); |
| | | // } |
| | | // return zipFilePath; |
| | | // } |
| | | |
| | | |
| | | private static void execLAQ2PDF(List<String> reportNames) |
| | | { |
| | | // 获取开始时间 |
| | | long startTime = System.currentTimeMillis(); |
| | | // 控制并行执行的最大线程数 |
| | | int parallelism = 2; // 设置为你希望的并行数量 |
| | | |
| | | // 创建一个固定大小的线程池 |
| | | ExecutorService executor = Executors.newFixedThreadPool(parallelism); |
| | | |
| | | // 创建一个 CompletableFuture 列表,每个 CompletableFuture 表示一个异步任务 |
| | | List<CompletableFuture<Void>> futures = new ArrayList<>(); |
| | | |
| | | // 构建异步任务列表 |
| | | for (String reportName : reportNames) { |
| | | CompletableFuture<Void> future = CompletableFuture.runAsync(() -> { |
| | | try { |
| | | long oneTime = System.currentTimeMillis(); |
| | | PdfUtil.dockerConvertPDF(EssConfig.getProfile(), EssConfig.getDocx2pdfPath(), reportName); |
| | | long twoTime = System.currentTimeMillis(); |
| | | long dura = twoTime - oneTime; |
| | | log.info("转换成功: " + reportName + " successfully.耗时:"+dura); |
| | | } catch (Exception e) { |
| | | log.info("转换失败: " + reportName + ": " + e.getMessage()); |
| | | } |
| | | }, executor); // 使用指定的线程池执行任务 |
| | | futures.add(future); |
| | | } |
| | | |
| | | // 等待所有异步任务完成 |
| | | CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join(); |
| | | |
| | | // 关闭线程池 |
| | | executor.shutdown(); |
| | | // 获取结束时间 |
| | | long endTime = System.currentTimeMillis(); |
| | | // 计算耗时(单位:毫秒) |
| | | long duration = endTime - startTime; |
| | | log.info("execLAQ2PDF 程序执行耗时:" + duration + " 毫秒"); |
| | | log.info("所有线程都执行完成!"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Nullable |
| | | private static String getPositionIfJAQ(Map<String, Object> textMap, String reportType) { |
| | | if (Objects.equals(reportType, "JAQ")) { |
| | |
| | | private static String getPdfPath(String reportName) { |
| | | return reportName.substring(0, reportName.lastIndexOf(".")) + ".pdf"; |
| | | } |
| | | |
| | | |
| | | //删除文件 |
| | | public static void deleteFileByStr(List<String> deleteFileStrList) { |
| | | |
| | | for (String deleteStr : deleteFileStrList) { |
| | | File file = new File(deleteStr); |
| | | log.info("删除文件:"+deleteStr); |
| | | file.delete(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | private static void setChageWord(String fileName, OutputStream out, Map<String, Object> textMap, String reportType,String dataPath, Map<Integer, Map<Integer, List<String[]>>> autoTableMap) throws IOException, InvalidFormatException, DocumentException { |
| | | //String filePath = getTemplateDownLoadPathByUpLoad(fileName); |
| | | ZipSecureFile.setMinInflateRatio(0.001); |
| | | |
| | | XWPFDocument document = new XWPFDocument(POIXMLDocument.openPackage(getTemplateDownLoadPathByUpLoad(fileName))); |
| | | |
| | | //设置文本 |
| | | changeText(document, textMap); |
| | | if (StringUtils.equals(reportType, ReportTypeEnum.JAQ.getCode())) { |
| | | //设置文本框 |
| | | changeTextBox(document, textMap); |
| | | |
| | | //设置文本框 |
| | | changeTextBox(document, textMap); |
| | | //设置文本 |
| | | changeText(document, textMap); |
| | | }else { |
| | | //设置文本 |
| | | changeText(document, textMap); |
| | | |
| | | //设置文本框 |
| | | changeTextBox(document, textMap); |
| | | } |
| | | |
| | | // //设置文本框 |
| | | // changeTextBox(document, textMap); |
| | | // |
| | | // //设置文本 |
| | | // changeText(document, textMap); |
| | | |
| | | //修改页脚 |
| | | changeFootNotes(document,textMap); |
| | | |
| | | //插入表格 |
| | | addTableValue(document, autoTableMap); |
| | |
| | | |
| | | //设置图表控件 |
| | | changChart(textMap, document, reportType,dataPath); |
| | | |
| | | //如果是LAQ的全景图,设置图表 |
| | | if (StringUtils.equals(reportType, ReportTypeEnum.LAQ.getCode())&& textMap.containsKey("allList")){ |
| | | LAQAllPng.changeChart(document,textMap); |
| | | } |
| | | |
| | | document.write(out); |
| | | } |
| | | |
| | | /** |
| | | * 修改页脚(主要是把年限给换了) |
| | | * @param document |
| | | * @param textMap |
| | | * @throws DocumentException |
| | | */ |
| | | private static void changeFootNotes(XWPFDocument document,Map<String,Object> textMap) throws DocumentException{ |
| | | |
| | | LocalDate currentDate = LocalDate.now(); |
| | | int year = currentDate.getYear(); |
| | | |
| | | // 获取所有页 |
| | | List<XWPFFooter> footers = document.getFooterList(); |
| | | |
| | | for (XWPFFooter footer : footers) { |
| | | // 获取每个页脚的段落 |
| | | List<XWPFParagraph> paragraphs = footer.getParagraphs(); |
| | | |
| | | // 打印每个段落的文本 |
| | | for (XWPFParagraph paragraph : paragraphs) { |
| | | System.out.println(paragraph.getText()); |
| | | |
| | | log.info("【页脚】:{}",paragraph.getText()); |
| | | if(paragraph.getText().contains("%year%")) |
| | | { |
| | | // 获取段落中的所有run |
| | | List<XWPFRun> runs = paragraph.getRuns(); |
| | | |
| | | // 替换文本 |
| | | for (XWPFRun run : runs) { |
| | | String text = run.getText(0); |
| | | if (text != null && text.contains("%year%")) { |
| | | text = text.replace("%year%", String.valueOf(year)); |
| | | run.setText(text, 0); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | private static void changeTextBox(XWPFDocument document, Map<String, Object> textMap) throws DocumentException { |
| | | List<XWPFParagraph> paragraphs = document.getParagraphs(); |
| | | |
| | |
| | | |
| | | String key = "%" + textSet.getKey() + "%"; |
| | | if (text.indexOf(key) != -1) { |
| | | text = text.replaceAll(key, (String) textMap.get(textSet.getKey())); |
| | | text = text.replaceAll(key, String.valueOf(textMap.get(textSet.getKey()))); |
| | | repText = text; |
| | | if (checkText(text)) { |
| | | continue; |
| | |
| | | repText = repText.replaceAll("<BoldText>", ""); |
| | | repText = repText.replaceAll("</BoldText>", ""); |
| | | } |
| | | if (repText.indexOf("N/A NONE") != -1) { |
| | | /* if (repText.indexOf("N/A NONE") != -1) { |
| | | repText = repText.replaceAll("N/A NONE", ""); |
| | | } |
| | | }*/ |
| | | return repText; |
| | | } |
| | | public static void changTableColor(String fileName, OutputStream out, List<JAQTableStyle> jaqTableStyleList) throws IOException { |
| | |
| | | if (ExamUtil.isListEmpty(charts)) { |
| | | return; |
| | | } |
| | | if (StringUtils.equals(reportType, ReportTypeEnum.MAQ.getCode())) { |
| | | setMAQCompleteChars(textMap, charts); |
| | | } else if (StringUtils.equals(reportType, ReportTypeEnum.MAQV2.getCode()) || StringUtils.equals(reportType, ReportTypeEnum.MAQIAR.getCode())) { |
| | | setMAQ_V2CompleteChars(textMap, charts); |
| | | } else if (StringUtils.equals(reportType, ReportTypeEnum.RuiLin.getCode())) { |
| | | setRuiLinChar(textMap, charts); |
| | | } else if (StringUtils.equals(reportType, ReportTypeEnum.PAQ.getCode())) { |
| | | PAQChart.changeChart(document, textMap); |
| | | } else if (StringUtils.equals(reportType, ReportTypeEnum.MAQTR.getCode())) { |
| | | MAQTRChart.changeMAQTRChart(document, dataPath); |
| | | } else { |
| | | return; |
| | | try{ |
| | | if (StringUtils.equals(reportType, ReportTypeEnum.MAQ.getCode())) { |
| | | setMAQCompleteChars(textMap, charts); |
| | | } else if (StringUtils.equals(reportType, ReportTypeEnum.MAQV2.getCode()) || StringUtils.equals(reportType, ReportTypeEnum.MAQIAR.getCode())) { |
| | | setMAQ_V2CompleteChars(textMap, charts); |
| | | } else if (StringUtils.equals(reportType, ReportTypeEnum.RuiLin.getCode())) { |
| | | setRuiLinChar(textMap, charts); |
| | | } else if (StringUtils.equals(reportType, ReportTypeEnum.PAQ.getCode())) { |
| | | PAQChart.changeChart(document, textMap); |
| | | } else if (StringUtils.equals(reportType, ReportTypeEnum.MAQTR.getCode())) { |
| | | MAQTRChart.changeMAQTRChart(document, dataPath); |
| | | } else if (StringUtils.equals(reportType, ReportTypeEnum.CIAQ.getCode())) { |
| | | CIAQChart.changeChart(document, textMap); |
| | | } else if (StringUtils.equals(reportType, ReportTypeEnum.LAQ.getCode())) { |
| | | if(textMap.containsKey("allList")) |
| | | { |
| | | log.info("【生成全景图报告】"); |
| | | //如果包含allList,则渲染全景图图表 |
| | | LAQAllChart.changeChart(document,textMap); |
| | | } |
| | | else |
| | | { |
| | | log.info("生成的是个人用户报告"); |
| | | LAQChart.changeChart(document, textMap); |
| | | } |
| | | } else if(StringUtils.equals(reportType, ReportTypeEnum.API_Fan.getCode())) |
| | | { |
| | | APIFanChart.changeChart(document,textMap); |
| | | } |
| | | else { |
| | | return; |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | private static void setMAQ_V2CompleteChars(Map<String, Object> textMap, List<XWPFChart> charts) { |
| | | String p_Task31 = textMap.get("P_Task31").toString(); |
| | |
| | | }*/ |
| | | |
| | | try { |
| | | InputStream is = new FileInputStream("C:\\Users\\大头\\Desktop\\JAQ中文版.docx"); |
| | | InputStream is = new FileInputStream("C:\\Users\\Administrator\\Desktop\\JAQ中文版.docx"); |
| | | XWPFDocument document = new XWPFDocument(is); |
| | | |
| | | String result = "{\"T3Line21C\":\"0\",\"T4com8item1\":\"JAQ0027\",\"T1com8IF_H\":\"15.20\",\"T4com8item3\":\"JAQ0070\",\"T4com8item2\":\"JAQ0014\",\"T1com8IF_L\":\"15.20\",\"T1com8IF_M\":\"15.20\",\"T3item2\":\"JAQ0092\",\"T2com1I_L\":\"4.40\",\"T3item3\":\"JAQ0019\",\"T3item4\":\"JAQ0027\",\"T3item5\":\"JAQ0048\",\"T3item6\":\"JAQ0044\",\"T3item7\":\"JAQ0045\",\"T3item8\":\"JAQ0057\",\"T3item9\":\"JAQ0053\",\"T2com1I_H\":\"4.40\",\"T3item3IF_M\":\"20.00\",\"T3Line10C\":\"0\",\"T3Line22C\":\"0\",\"T3Line9C\":\"0\",\"T1com1IF_M\":\"17.60\",\"T1com1IF_L\":\"17.60\",\"T2com6I_L\":\"4.00\",\"T1com1IF_H\":\"17.60\",\"T1com4IF_M\":\"16.72\",\"T1com4IF_L\":\"16.72\",\"T3Line11C\":\"0\",\"T2com6I_H\":\"4.00\",\"T1com4IF_H\":\"16.72\",\"T3item16IF_M\":\"20.00\",\"T3com18\":\"1. 适应性和变革管理\",\"T4com6item1\":\"JAQ0114\",\"T3com17\":\"20. 授权\",\"T4com6item3\":\"JAQ0050\",\"T3com19\":\"1. 适应性和变革管理\",\"T4com6item2\":\"JAQ0016\",\"T3Line8C\":\"0\",\"T3com10\":\"4. 沟通\",\"T3item13IF_M\":\"20.00\",\"T3com12\":\"6. 压力忍受-情绪韧性\",\"T3com11\":\"20. 授权\",\"T3com14\":\"15. 计划和组织\",\"T3Line23C\":\"0\",\"T3com13\":\"20. 授权\",\"T3com16\":\"8. 团队协作\",\"T3com15\":\"4. 沟通\",\"T1com11IF_L\":\"14.44\",\"T1com11IF_M\":\"14.44\",\"T1com11IF_H\":\"14.44\",\"T2com1\":\"8. 团队协作\",\"T2com2\":\"20. 授权\",\"T3Line6C\":\"0\",\"T2com9\":\"24. 组织敏锐度\",\"T2com7\":\"9. 同理心\",\"T2com8\":\"16. 创造性\",\"T2com5\":\"4. 沟通\",\"T3item7IF_M\":\"20.00\",\"T3Line7C\":\"0\",\"T2com6\":\"6. 压力忍受-情绪韧性\",\"T3item24IF_M\":\"16.00\",\"T2com3\":\"11. 客户导向(内部和外部)\",\"T2Com5I_M\":\"4.00\",\"T2com4\":\"23. 激励他人\",\"T3Line12C\":\"0\",\"T3Line24C\":\"0\",\"T1com4\":\"20. 授权\",\"T4com2item2\":\"JAQ0057\",\"T1com5\":\"4. 沟通\",\"T4com2item3\":\"JAQ0020\",\"T1com6\":\"6. 压力忍受-情绪韧性\",\"T1com7\":\"9. 同理心\",\"T4com2item1\":\"JAQ0045\",\"T1com8\":\"24. 组织敏锐度\",\"T1com9\":\"26. 正直、信任和公信力\",\"T2Com6I_M\":\"4.00\",\"T1com1\":\"8. 团队协作\",\"T1com2\":\"11. 客户导向(内部和外部)\",\"T1com3\":\"23. 激励他人\",\"T2Line9C\":\"0\",\"T1com7IF_H\":\"15.20\",\"T2com5I_H\":\"4.00\",\"T1com7IF_M\":\"15.20\",\"T3Line13C\":\"0\",\"T1com7IF_L\":\"15.20\",\"T3Line25C\":\"0\",\"T2com5I_L\":\"4.00\",\"T1com2IF_M\":\"16.80\",\"T1com2IF_L\":\"16.80\",\"T1com2IF_H\":\"16.80\",\"表4子集合\":\"3\",\"T2rank1\":\"1\",\"T3item4IF_M\":\"20.00\",\"T2rank3\":\"3\",\"T3com21\":\"26. 正直、信任和公信力\",\"T2rank2\":\"2\",\"T3com20\":\"20. 授权\",\"T2rank5\":\"5\",\"T3com23\":\"24. 组织敏锐度\",\"T2rank4\":\"4\",\"T3com22\":\"26. 正直、信任和公信力\",\"T2rank7\":\"7\",\"T3com25\":\"6. 压力忍受-情绪韧性\",\"T2rank6\":\"6\",\"T3com24\":\"23. 激励他人\",\"T2rank9\":\"9\",\"T3Line14C\":\"0\",\"T2rank8\":\"8\",\"T3item23IF_M\":\"16.00\",\"T3item25\":\"JAQ0016\",\"T3item24\":\"JAQ0015\",\"T3item23\":\"JAQ0014\",\"T1rank9\":\"9\",\"T3item22\":\"JAQ0090\",\"T3item21\":\"JAQ0095\",\"T3item20\":\"JAQ0129\",\"T1rank6\":\"6\",\"T1com3IF_M\":\"16.80\",\"T1rank5\":\"5\",\"T1com3IF_L\":\"16.80\",\"T1rank8\":\"8\",\"T1rank7\":\"7\",\"T1rank2\":\"2\",\"T1rank1\":\"1\",\"T1rank4\":\"4\",\"T1rank3\":\"3\",\"表1\":\"12\",\"表2\":\"12\",\"表3\":\"25\",\"表4\":\"8\",\"T1com3IF_H\":\"16.80\",\"T3Line15C\":\"0\",\"T4com1item3\":\"JAQ0042\",\"T3item8IF_M\":\"20.00\",\"T3item17IF_M\":\"20.00\",\"T4com7item3\":\"JAQ0100\",\"T3item19\":\"JAQ0128\",\"T3item18\":\"JAQ0006\",\"T4com7item1\":\"JAQ0044\",\"T3item12IF_M\":\"20.00\",\"T3item17\":\"JAQ0089\",\"T4com7item2\":\"JAQ0097\",\"T3item16\":\"JAQ0001\",\"T3item15\":\"JAQ0120\",\"T1com12IF_M\":\"14.40\",\"T3item14\":\"JAQ0002\",\"T3item13\":\"JAQ0076\",\"T3item12\":\"JAQ0114\",\"T3item11\":\"JAQ0105\",\"T3item10\":\"JAQ0102\",\"T3item1\":\"JAQ0008\",\"T1com12IF_H\":\"14.40\",\"T1com12IF_L\":\"14.40\",\"T2Com10I_M\":\"3.80\",\"T2com10I_H\":\"3.80\",\"T3Line16C\":\"0\",\"T2Com1I_M\":\"4.40\",\"T2com4I_H\":\"4.20\",\"T2com10I_L\":\"3.80\",\"T4com1item2\":\"JAQ0001\",\"T2com4I_L\":\"4.20\",\"T4com1item1\":\"JAQ0048\",\"T2Line4C\":\"0\",\"T3item5IF_M\":\"20.00\",\"T2com11I_H\":\"3.80\",\"T3Line1C\":\"1\",\"T3Line17C\":\"0\",\"T2Com2I_M\":\"4.40\",\"T2com11I_L\":\"3.80\",\"T2com9I_L\":\"4.00\",\"T2com9I_H\":\"4.00\",\"T2Line5C\":\"0\",\"T2Com7I_M\":\"4.00\",\"T2Line6C\":\"0\",\"T3Line18C\":\"0\",\"T2com12\":\"15. 计划和组织\",\"T2Line11C\":\"1\",\"T2com10\":\"1. 适应性和变革管理\",\"T2com11\":\"3. 主动性\",\"T4com5item3\":\"JAQ0034\",\"T4com5item1\":\"JAQ0102\",\"T4com5item2\":\"JAQ0120\",\"T4com3\":\"23. 激励他人\",\"T4com4\":\"20. 授权\",\"T4com1\":\"8. 团队协作\",\"T3item9IF_M\":\"20.00\",\"T3item22IF_M\":\"16.00\",\"T4com2\":\"11. 客户导向(内部和外部)\",\"T4com7\":\"9. 同理心\",\"T3item2IF_M\":\"20.00\",\"T4com8\":\"24. 组织敏锐度\",\"T4com5\":\"4. 沟通\",\"T2Com8I_M\":\"4.00\",\"T2Com11I_M\":\"3.80\",\"T4com6\":\"6. 压力忍受-情绪韧性\",\"T2com3I_H\":\"4.20\",\"T3rank22\":\"22\",\"T3rank21\":\"21\",\"T3rank20\":\"20\",\"T2Line7C\":\"0\",\"T3Line19C\":\"0\",\"T2com3I_L\":\"4.20\",\"T3rank25\":\"25\",\"T3rank24\":\"24\",\"T3rank23\":\"23\",\"T2Line10C\":\"0\",\"T1com6IF_M\":\"15.20\",\"T1com6IF_L\":\"15.20\",\"T3item18IF_M\":\"16.00\",\"T1com6IF_H\":\"15.20\",\"T3item11IF_M\":\"20.00\",\"T2Line8C\":\"0\",\"T2com8I_L\":\"4.00\",\"T1com9IF_M\":\"15.20\",\"T3rank1\":\"1\",\"T2com8I_H\":\"4.00\",\"T3rank2\":\"2\",\"T3item10IF_M\":\"20.00\",\"T3rank9\":\"9\",\"T3Line5C\":\"0\",\"T3rank7\":\"7\",\"T3rank8\":\"8\",\"T3rank5\":\"5\",\"T3rank6\":\"6\",\"T3rank3\":\"3\",\"T3rank4\":\"4\",\"T4rank7\":\"7\",\"T4rank6\":\"6\",\"T4rank5\":\"5\",\"T4rank4\":\"4\",\"T4com3item3\":\"JAQ0133\",\"T4com3item2\":\"JAQ0015\",\"T4com3item1\":\"JAQ0019\",\"T4rank8\":\"8\",\"T3item6IF_M\":\"20.00\",\"T4rank3\":\"3\",\"T4rank2\":\"2\",\"T4rank1\":\"1\",\"T3rank19\":\"19\",\"T2Line1C\":\"0\",\"T3rank18\":\"18\",\"T2Line12C\":\"1\",\"T3rank17\":\"17\",\"T3rank16\":\"16\",\"T2com12I_H\":\"3.80\",\"T3Line4C\":\"0\",\"T3item20IF_M\":\"16.00\",\"T2Com12I_M\":\"3.80\",\"T2Com3I_M\":\"4.20\",\"T3item14IF_M\":\"20.00\",\"T3rank11\":\"11\",\"T3rank10\":\"10\",\"T2com2I_H\":\"4.40\",\"T1com9IF_H\":\"15.20\",\"T2com12I_L\":\"3.80\",\"T3rank15\":\"15\",\"T3rank14\":\"14\",\"T2com2I_L\":\"4.40\",\"T3rank13\":\"13\",\"T1com9IF_L\":\"15.20\",\"T3rank12\":\"12\",\"T2rank10\":\"10\",\"T3item15IF_M\":\"20.00\",\"T2Line2C\":\"0\",\"T2rank12\":\"12\",\"T2rank11\":\"11\",\"T3Line3C\":\"0\",\"T1com10IF_M\":\"14.44\",\"T1com10IF_L\":\"14.44\",\"T2Com4I_M\":\"4.20\",\"T1com10IF_H\":\"14.44\",\"T3item25IF_M\":\"16.00\",\"T3item1IF_M\":\"20.00\",\"T3item21IF_M\":\"16.00\",\"T2com7I_L\":\"4.00\",\"T3com6\":\"9. 同理心\",\"T3com7\":\"11. 客户导向(内部和外部)\",\"T3Line20C\":\"0\",\"T2com7I_H\":\"4.00\",\"T3com8\":\"11. 客户导向(内部和外部)\",\"T3com9\":\"3. 主动性\",\"T3com2\":\"16. 创造性\",\"T3com3\":\"23. 激励他人\",\"T3com4\":\"24. 组织敏锐度\",\"T2Line3C\":\"0\",\"T3com5\":\"8. 团队协作\",\"T1rank12\":\"12\",\"T1rank11\":\"11\",\"T1rank10\":\"10\",\"T3Line2C\":\"0\",\"T1com5IF_H\":\"15.20\",\"T1com10\":\"1. 适应性和变革管理\",\"T1com11\":\"27. 行动果敢\",\"T2Com9I_M\":\"4.00\",\"T1com12\":\"16. 创造性\",\"T3item19IF_M\":\"16.00\",\"T1com5IF_M\":\"15.20\",\"T3com1\":\"13. 应用所习得的专业知识\",\"T4com4item1\":\"JAQ0105\",\"T1com5IF_L\":\"15.20\",\"T4com4item2\":\"JAQ0076\",\"T4com4item3\":\"JAQ0089\"}"; |
| | | |
| | | String result = "{\"T3Line21C\":\"0\",\"T4com8item1\":\"JAQ0117\",\"T1com8IF_H\":\"9.00\",\"T4com8item2\":\"JAQ0073\",\"T1com8IF_L\":\"6.76\",\"T1com8IF_M\":\"7.88\",\"T3item2\":\"JAQ0009\",\"T2com1I_L\":\"3.00\",\"T3item3\":\"JAQ0015\",\"T3item4\":\"JAQ0022\",\"T3item5\":\"JAQ0035\",\"T3item6\":\"JAQ0051\",\"T3item7\":\"JAQ0117\",\"T3item8\":\"JAQ0120\",\"T3item9\":\"JAQ0127\",\"T2com1I_H\":\"3.20\",\"T3item3IF_M\":\"12.50\",\"T3Line10C\":\"0\",\"T3Line22C\":\"0\",\"T3Line9C\":\"0\",\"T1com1IF_M\":\"9.62\",\"T1com1IF_L\":\"9.00\",\"T2com6I_L\":\"2.60\",\"T1com1IF_H\":\"10.24\",\"T4com11item2\":\"JAQ0008\",\"T1com4IF_M\":\"8.20\",\"T1com4IF_L\":\"4.84\",\"T3Line11C\":\"1\",\"T4com11item1\":\"JAQ0093\",\"T2com6I_H\":\"3.00\",\"T1com4IF_H\":\"11.56\",\"T3item16IF_M\":\"9.00\",\"T3com18\":\"24\",\"T4com6item1\":\"JAQ0038\",\"T3com17\":\"5\",\"T3com19\":\"15\",\"T4com6item2\":\"JAQ0100\",\"T3Line8C\":\"0\",\"T3com10\":\"13\",\"T3item13IF_M\":\"9.00\",\"T3com12\":\"13\",\"T3com11\":\"21\",\"T3com14\":\"26\",\"T3Line23C\":\"0\",\"T3com13\":\"10\",\"T3com16\":\"5\",\"T3com15\":\"1\",\"T1com11IF_L\":\"4.84\",\"T1com11IF_M\":\"7.54\",\"T1com11IF_H\":\"10.24\",\"T2com1\":\"18\",\"T2com2\":\"4\",\"T3Line6C\":\"0\",\"T2com9\":\"22\",\"T2com7\":\"17\",\"T2com8\":\"19\",\"T2com5\":\"9\",\"T3item7IF_M\":\"12.50\",\"T3Line7C\":\"0\",\"T2com6\":\"15\",\"T3item24IF_M\":\"9.00\",\"T2com3\":\"27\",\"T2Com5I_M\":\"2.80\",\"T2com4\":\"8\",\"T3Line12C\":\"0\",\"T3Line24C\":\"1\",\"T1com4\":\"8\",\"T4com2item2\":\"JAQ0034\",\"T1com5\":\"19\",\"T1com6\":\"9\",\"T1com7\":\"15\",\"T4com2item1\":\"JAQ0120\",\"T1com8\":\"17\",\"T1com9\":\"22\",\"T2Com6I_M\":\"2.80\",\"T1com1\":\"18\",\"T1com2\":\"4\",\"T1com3\":\"27\",\"T2Line9C\":\"0\",\"T1com7IF_H\":\"9.00\",\"T2com5I_H\":\"3.00\",\"T1com7IF_M\":\"7.88\",\"T3Line13C\":\"1\",\"T1com7IF_L\":\"6.76\",\"T3Line25C\":\"0\",\"T2com5I_L\":\"2.60\",\"T1com2IF_M\":\"8.42\",\"T1com2IF_L\":\"7.84\",\"T1com2IF_H\":\"9.00\",\"T4com12item2\":\"JAQ0135\",\"T4com12item1\":\"JAQ0134\",\"表4子集合\":\"2\",\"T2rank1\":\"1\",\"T3item4IF_M\":\"12.50\",\"T2rank3\":\"3\",\"T3com21\":\"18\",\"T2rank2\":\"2\",\"T3com20\":\"18\",\"T2rank5\":\"5\",\"T3com23\":\"1\",\"T2rank4\":\"4\",\"T3com22\":\"10\",\"T2rank7\":\"7\",\"T3com25\":\"9\",\"T2rank6\":\"6\",\"T3com24\":\"14\",\"T2rank9\":\"9\",\"T3Line14C\":\"0\",\"T2rank8\":\"8\",\"T3item23IF_M\":\"9.00\",\"T3item25\":\"JAQ0038\",\"T3item24\":\"JAQ0037\",\"T3item23\":\"JAQ0021\",\"T1rank9\":\"9\",\"T3item22\":\"JAQ0026\",\"T3item21\":\"JAQ0017\",\"T3item20\":\"JAQ0012\",\"T1rank6\":\"6\",\"T1com3IF_M\":\"8.42\",\"T1rank5\":\"5\",\"T1com3IF_L\":\"7.84\",\"T1rank8\":\"8\",\"T1rank7\":\"7\",\"T1rank2\":\"2\",\"T1rank1\":\"1\",\"T1rank4\":\"4\",\"T1rank3\":\"3\",\"表1\":\"12\",\"表2\":\"12\",\"表3\":\"25\",\"表4\":\"12\",\"T1com3IF_H\":\"9.00\",\"T3Line15C\":\"0\",\"T3item8IF_M\":\"12.50\",\"T3item17IF_M\":\"9.00\",\"T3item19\":\"JAQ0131\",\"T3item18\":\"JAQ0014\",\"T4com7item1\":\"JAQ0131\",\"T3item12IF_M\":\"9.00\",\"T3item17\":\"JAQ0135\",\"T4com7item2\":\"JAQ0066\",\"T3item16\":\"JAQ0134\",\"T3item15\":\"JAQ0013\",\"T1com12IF_M\":\"7.38\",\"T3item14\":\"JAQ0090\",\"T3item13\":\"JAQ0096\",\"T3item12\":\"JAQ0008\",\"T4com12\":\"5\",\"T3item11\":\"JAQ0110\",\"T3item10\":\"JAQ0093\",\"T4com10\":\"26\",\"T3item1\":\"JAQ0003\",\"T4com11\":\"13\",\"T1com12IF_H\":\"9.00\",\"T1com12IF_L\":\"5.76\",\"T2Com10I_M\":\"2.80\",\"T2com10I_H\":\"3.00\",\"T3Line16C\":\"0\",\"T2Com1I_M\":\"3.10\",\"T2com4I_H\":\"3.40\",\"T2com10I_L\":\"2.60\",\"T4com1item2\":\"JAQ0012\",\"T2com4I_L\":\"2.20\",\"T4com1item1\":\"JAQ0022\",\"T2Line4C\":\"0\",\"T3item5IF_M\":\"12.50\",\"T2com11I_H\":\"2.80\",\"T3Line1C\":\"0\",\"T4rank10\":\"10\",\"T4rank12\":\"12\",\"T4rank11\":\"11\",\"T3Line17C\":\"0\",\"T2Com2I_M\":\"2.90\",\"T2com11I_L\":\"2.60\",\"T2com9I_L\":\"2.60\",\"T4com9item1\":\"JAQ0035\",\"T4com9item2\":\"JAQ0083\",\"T2com9I_H\":\"3.00\",\"T2Line5C\":\"0\",\"T2Com7I_M\":\"2.80\",\"T2Line6C\":\"0\",\"T3Line18C\":\"1\",\"T2com12\":\"5\",\"T2Line11C\":\"1\",\"T2com10\":\"26\",\"T2com11\":\"1\",\"T4com5item1\":\"JAQ0127\",\"T4com5item2\":\"JAQ0046\",\"T4com3\":\"27\",\"T4com4\":\"8\",\"T4com1\":\"18\",\"T3item9IF_M\":\"10.00\",\"T3item22IF_M\":\"9.00\",\"T4com2\":\"4\",\"T4com7\":\"15\",\"T3item2IF_M\":\"12.50\",\"T4com8\":\"17\",\"T4com5\":\"19\",\"T2Com8I_M\":\"2.80\",\"T2Com11I_M\":\"2.70\",\"T4com6\":\"9\",\"T2com3I_H\":\"3.00\",\"T3rank22\":\"22\",\"T3rank21\":\"21\",\"T3rank20\":\"20\",\"T4com9\":\"22\",\"T2Line7C\":\"0\",\"T3Line19C\":\"0\",\"T2com3I_L\":\"2.80\",\"T3rank25\":\"25\",\"T3rank24\":\"24\",\"T3rank23\":\"23\",\"T2Line10C\":\"0\",\"T1com6IF_M\":\"7.88\",\"T1com6IF_L\":\"6.76\",\"T3item18IF_M\":\"9.00\",\"T1com6IF_H\":\"9.00\",\"T3item11IF_M\":\"10.00\",\"T2Line8C\":\"0\",\"T2com8I_L\":\"2.40\",\"T1com9IF_M\":\"7.88\",\"T3rank1\":\"1\",\"T2com8I_H\":\"3.20\",\"T3rank2\":\"2\",\"T3item10IF_M\":\"10.00\",\"T3rank9\":\"9\",\"T3Line5C\":\"0\",\"T3rank7\":\"7\",\"T3rank8\":\"8\",\"T3rank5\":\"5\",\"T3rank6\":\"6\",\"T3rank3\":\"3\",\"T3rank4\":\"4\",\"T4rank7\":\"7\",\"T4rank6\":\"6\",\"T4rank5\":\"5\",\"T4rank4\":\"4\",\"T4com3item2\":\"JAQ0055\",\"T4rank9\":\"9\",\"T4com3item1\":\"JAQ0051\",\"T4rank8\":\"8\",\"T3item6IF_M\":\"12.50\",\"T4rank3\":\"3\",\"T4rank2\":\"2\",\"T4rank1\":\"1\",\"T3rank19\":\"19\",\"T2Line1C\":\"0\",\"T3rank18\":\"18\",\"T2Line12C\":\"0\",\"T3rank17\":\"17\",\"T3rank16\":\"16\",\"T2com12I_H\":\"3.00\",\"T3Line4C\":\"0\",\"T3item20IF_M\":\"9.00\",\"T2Com12I_M\":\"2.70\",\"T2Com3I_M\":\"2.90\",\"T3item14IF_M\":\"9.00\",\"T3rank11\":\"11\",\"T3rank10\":\"10\",\"T2com2I_H\":\"3.00\",\"T1com9IF_H\":\"9.00\",\"T2com12I_L\":\"2.40\",\"T3rank15\":\"15\",\"T3rank14\":\"14\",\"T2com2I_L\":\"2.80\",\"T3rank13\":\"13\",\"T1com9IF_L\":\"6.76\",\"T3rank12\":\"12\",\"T2rank10\":\"10\",\"T3item15IF_M\":\"9.00\",\"T2Line2C\":\"0\",\"T2rank12\":\"12\",\"T2rank11\":\"11\",\"T3Line3C\":\"1\",\"T1com10IF_M\":\"7.88\",\"T1com10IF_L\":\"6.76\",\"T2Com4I_M\":\"2.80\",\"T4com10item2\":\"JAQ0040\",\"T1com10IF_H\":\"9.00\",\"T4com10item1\":\"JAQ0090\",\"T3item25IF_M\":\"9.00\",\"T3item1IF_M\":\"14.50\",\"T3item21IF_M\":\"9.00\",\"T2com7I_L\":\"2.60\",\"T3com6\":\"27\",\"T3com7\":\"17\",\"T3Line20C\":\"0\",\"T2com7I_H\":\"3.00\",\"T3com8\":\"4\",\"T3com9\":\"19\",\"T3com2\":\"25\",\"T3com3\":\"23\",\"T3com4\":\"18\",\"T2Line3C\":\"0\",\"T3com5\":\"22\",\"T1rank12\":\"12\",\"T1rank11\":\"11\",\"T1rank10\":\"10\",\"T3Line2C\":\"1\",\"T1com5IF_H\":\"10.24\",\"T1com10\":\"26\",\"T1com11\":\"13\",\"T2Com9I_M\":\"2.80\",\"T1com12\":\"5\",\"T3item19IF_M\":\"9.00\",\"T1com5IF_M\":\"8.00\",\"T3com1\":\"8\",\"T4com4item1\":\"JAQ0003\",\"T1com5IF_L\":\"5.76\",\"T4com4item2\":\"JAQ0042\"}"; |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | //json对象转Map |
| | | Map<String,Object> textMap = jsonObject; |
| | | |
| | | //更改表格的值 |
| | | textMap.put("sendEmailFileName", "JAQ"); |
| | | textMap.put("SelectUsers",8); |
| | | //changeTable(document, textMap); |
| | | |
| | | |
| | | changeText(document, textMap); |
| | | changeTextBox(document, textMap); |
| | | addTableValue(document, null); |
| | | changeTable(document, textMap); |
| | | //changChart(textMap, document, reportType, dataPath); |
| | | |
| | | //建立文件对象 |
| | | File file = new File("C:\\Users\\大头\\Desktop\\JAQ中文版1.docx"); |
| | | File file = new File("C:\\Users\\Administrator\\Desktop\\JAQ中文版1.docx"); |
| | | FileOutputStream out = new FileOutputStream(file); |
| | | document.write(out); |
| | | out.flush(); |