| | |
| | | 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; |
| | |
| | | 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(" ", "_"); |
| | | |
| | | //模板文件需要加锁 |
| | |
| | | }else if(ReportTypeEnum.LAQ.getCode().equals(reportType)){ |
| | | // 获取开始时间 |
| | | long startTime = System.currentTimeMillis(); |
| | | |
| | | PdfUtil.dockerConvertPDF(EssConfig.getProfile(),EssConfig.getDocx2pdfPath(),reportName); |
| | | |
| | | // 获取结束时间 |
| | | long endTime = System.currentTimeMillis(); |
| | | // 计算耗时(单位:毫秒) |
| | |
| | | * @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(); |
| | | // 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 = ""; |
| | | // |
| | | // PdfUtil.dockerConvertPDF(EssConfig.getProfile(),EssConfig.getDocx2pdfPath(),reportName); |
| | | // // 获取结束时间 |
| | | // long endTime = System.currentTimeMillis(); |
| | | // // 计算耗时(单位:毫秒) |
| | | // long duration = endTime - startTime; |
| | | // log.info("dockerConvertPDF 程序执行耗时:" + duration + " 毫秒,生成报告:"+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); |
| | | // } |
| | | 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; |
| | | } |
| | | // |
| | | // 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) |
| | |
| | | |
| | | //设置图表控件 |
| | | changChart(textMap, document, reportType,dataPath); |
| | | |
| | | //如果是LAQ的全景图,设置图表 |
| | | if (StringUtils.equals(reportType, ReportTypeEnum.LAQ.getCode())&& textMap.containsKey("allList")){ |
| | | LAQAllPng.changeChart(document,textMap); |
| | | } |
| | | |
| | | document.write(out); |
| | | } |
| | | |
| | |
| | | } else if (StringUtils.equals(reportType, ReportTypeEnum.CIAQ.getCode())) { |
| | | CIAQChart.changeChart(document, textMap); |
| | | } else if (StringUtils.equals(reportType, ReportTypeEnum.LAQ.getCode())) { |
| | | if(!textMap.containsKey("allList")) |
| | | if(textMap.containsKey("allList")) |
| | | { |
| | | System.out.println("个人用户报告"); |
| | | LAQChart.changeChart(document, textMap); |
| | | log.info("【生成全景图报告】"); |
| | | //如果包含allList,则渲染全景图图表 |
| | | LAQAllChart.changeChart(document,textMap); |
| | | } |
| | | else |
| | | { |
| | | System.out.println("全景图报告"); |
| | | //如果包含allList,则渲染全景图图表 |
| | | LAQAllChart.changeChart(document,textMap); |
| | | log.info("生成的是个人用户报告"); |
| | | LAQChart.changeChart(document, textMap); |
| | | } |
| | | } else if(StringUtils.equals(reportType, ReportTypeEnum.API_Fan.getCode())) |
| | | { |