| | |
| | | } else { |
| | | String keyTemp = textSet.getKey(); |
| | | String keyValue = Objects.isNull(textSet.getValue()) ? "" : textSet.getValue().toString(); |
| | | if (StringUtils.contains(keyValue, "%line-feed%") || StringUtils.contains(keyValue, "%table-line-feed%")) { |
| | | |
| | | //表格里的换行 特殊处理 因为没有段落 |
| | | if(StringUtils.contains(keyValue, "table")){ |
| | | String[] keyValues = keyValue.split("%table-line-feed%"); |
| | | runValue = delDynList(keyTemp, Arrays.asList(keyValues), paragraph, document,1); |
| | | }else{ |
| | | String[] keyValues = keyValue.split("%line-feed%"); |
| | | runValue = delDynList(keyTemp, Arrays.asList(keyValues), paragraph, document,0); |
| | | } |
| | | //表格里的换行 特殊处理 因为没有段落 |
| | | if(StringUtils.contains(keyValue, "%table-line-feed%")){ |
| | | String[] keyValues = keyValue.split("%table-line-feed%"); |
| | | runValue = delDynList(keyTemp, Arrays.asList(keyValues), paragraph, document,1); |
| | | }else{ |
| | | String[] keyValues = keyValue.split("%line-feed%"); |
| | | runValue = delDynList(keyTemp, Arrays.asList(keyValues), paragraph, document,0); |
| | | } |
| | | |
| | | log.info("ChangeValue的key值:" + key + " ChangeValue的value值:" + keyValue); |
| | | runValue = runValue.replaceAll(key, keyValue); |
| | | } |
| | |
| | | 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.replaceAll(" ", "_"); |
| | | out = getDownLoadFileOutputStream(reportName); |
| | | |
| | | log.info("reportTemplate:" + fileName); |
| | | //String templateType = tReportTemplate.getTemplateType(); |
| | | setChageWord(fileName, out, textMap, tReportTemplate.getReportType(),tReportTemplate.getDataPath(), autoTableMap); |
| | | out.flush(); |
| | | changColorIfJAQ(textMap, out, reportName, tReportTemplate.getReportType()); |
| | | //模板文件需要加锁 |
| | | 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()); |
| | | } |
| | | |
| | | //PAQ、MAQTR采用新的doc转pdf |
| | | if(ReportTypeEnum.PAQ.getCode().equals(reportType) || ReportTypeEnum.MAQTR.getCode().equals(reportType)){ |
| | | PdfUtil.convertPDF(EssConfig.getProfile() + "/" + reportName); |
| | | }else{ |
| | | ShellTool.execLibreofficeCommand("pdf", EssConfig.getProfile() + "/" + reportName, EssConfig.getProfile() + "/"); |
| | | |
| | | //ShellTool.execLibreofficeCommand("pdf", EssConfig.getProfile() + "/" + reportName, EssConfig.getProfile() + "/"); |
| | | ShellTool shellTool = ShellTool.builder(); |
| | | shellTool.execNewLibreofficeCommand("pdf", EssConfig.getProfile() + "/" + reportName, EssConfig.getProfile() + "/" + reportName.replace("docx","pdf")); |
| | | } |
| | | zipFilePath = getPdfPath(reportName); |
| | | |