| | |
| | | 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; |
| | |
| | | if(ReportTypeEnum.PAQ.getCode().equals(reportType) || ReportTypeEnum.MAQTR.getCode().equals(reportType) |
| | | || ReportTypeEnum.CIAQ.getCode().equals(reportType)){ |
| | | PdfUtil.convertPDF(EssConfig.getProfile() + "/" + reportName); |
| | | }else if(ReportTypeEnum.LAQ.getCode().equals(reportType)){ |
| | | PdfUtil.convertPythonPDF(EssConfig.getDocx2pdf(),EssConfig.getProfile() + "/" + reportName); |
| | | }else{ |
| | | ShellTool.execLibreofficeCommand("pdf", EssConfig.getProfile() + "/" + reportName, EssConfig.getProfile() + "/"); |
| | | // ShellTool shellTool = ShellTool.builder(); |
| | |
| | | */ |
| | | 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))); |
| | | |
| | |
| | | private boolean demoEnabled; |
| | | |
| | | private static String profile; |
| | | private static String docx2pdf; |
| | | |
| | | private static boolean addressEnabled; |
| | | private static String imagePath; |
| | |
| | | public static String getUploadImagePath() { |
| | | return getProfile() + "/images"; |
| | | } |
| | | |
| | | public static String getDocx2pdf() { |
| | | return docx2pdf; |
| | | } |
| | | |
| | | public static void setDocx2pdf(String docx2pdf) { |
| | | EssConfig.docx2pdf = docx2pdf; |
| | | } |
| | | } |
| | |
| | | import com.aspose.words.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileOutputStream; |
| | | import java.io.*; |
| | | import java.lang.reflect.Constructor; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 执行python脚本 docx转pdf |
| | | * @param filePath |
| | | */ |
| | | public static void convertPythonPDF(String pythonScript,String filePath){ |
| | | try { |
| | | File file = new File(filePath); |
| | | if(!file.exists()){ |
| | | file.mkdirs(); |
| | | } |
| | | //手动替换输出pdf名称 |
| | | String output = filePath.replaceAll(".docx", ".pdf"); |
| | | String[] args1 = new String[] { "python3", pythonScript, filePath, output }; |
| | | // 执行py文件 |
| | | Process proc = Runtime.getRuntime().exec(args1); |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream(), "GBK")); |
| | | String line = null; |
| | | log.info("python执行命令:{}", Arrays.toString(args1)); |
| | | log.info("python执行返回"); |
| | | while ((line = in.readLine()) != null) { |
| | | log.info(line); |
| | | } |
| | | in.close(); |
| | | proc.waitFor(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * aspose-words:jdk17:23.4 版本 |
| | | */ |
| | | public static void registerWord() throws Exception { |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @description: LAQ导入模板 |
| | |
| | | private String email; |
| | | |
| | | @Excel(name = "Scored on") |
| | | private String ScoredOn; |
| | | private Date scoredOn; |
| | | |
| | | private String scoredOnStr; |
| | | |
| | | @Excel(name = "Company") |
| | | private String company; |
| | |
| | | MapDataUtil.objectToMap(laqTemplate,textMap); |
| | | |
| | | LAQReport report = new LAQReport(); |
| | | ReportResultData resultData = report.getTemplateParameters(textMap, ReportTypeEnum.LAQ, LangTypeEnum.codeOf("English")); |
| | | // ReportResultData resultData = report.getTemplateParameters(textMap, ReportTypeEnum.LAQ, LangTypeEnum.codeOf("English")); |
| | | // TReportTemplate template = null; |
| | | // String zipFileName = WordUtil.makeReportFile("D:\\测评系统\\需求\\LAQ\\report\\LAQ英文报告-20230926.docx", template, textMap, new HashMap<>(), deleteStrList); |
| | | // fileNameList.add(zipFileName); |
| | | ZipSecureFile.setMinInflateRatio(0.001); |
| | | try (OutputStream os = new FileOutputStream("D:\\测评系统\\需求\\2023\\5.领导潜力报告\\report\\LAQ.docx");XWPFDocument document = new XWPFDocument(POIXMLDocument.openPackage("D:\\测评系统\\需求\\2023\\5.领导潜力报告\\report\\LAQ英文报告-20230926.docx"))){ |
| | | try (OutputStream os = new FileOutputStream("D:\\测评系统\\需求\\2023\\5.领导潜力报告\\report\\LAQ编译报告英文.docx");XWPFDocument document = new XWPFDocument(POIXMLDocument.openPackage("D:\\测评系统\\需求\\2023\\5.领导潜力报告\\report\\LAQ英文版.docx"))){ |
| | | Map<Integer,List<SeriesData>> seriesDatas = initData(textMap); |
| | | changeChart(document,seriesDatas,textMap); |
| | | document.write(os); |
| | |
| | | @Setter |
| | | @Slf4j |
| | | public class ScoreInterpretationBLA extends BaseCondition_V2 { |
| | | private String name = "BehaviorCharacteristicsV1"; |
| | | private String name = "ScoreInterpretationBLA"; |
| | | private Double BLA; |
| | | |
| | | @Override |