| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.*; |
| | | import java.nio.file.Files; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | VelocityContext dataContext = new VelocityContext(map); |
| | | |
| | | //临时文件夹 |
| | | File dirPath = new File("D:/DLUT/tmp/"); |
| | | dirPath.deleteOnExit(); |
| | | dirPath.mkdirs(); |
| | | File dirPath = null; |
| | | try { |
| | | dirPath = Files.createTempDirectory("generatorCodeTmp").toFile(); |
| | | log.info("生成临时文件夹," + dirPath.getAbsolutePath()); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException("创建临时文件夹异常",e); |
| | | } |
| | | |
| | | List<String> javaFilePaths = new ArrayList<>(); |
| | | List<String> cppFilePaths = new ArrayList<>(); |
| | |
| | | try { |
| | | FileUtils.deleteDirectory(dirPath); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException("删除临时文件异常"); |
| | | throw new RuntimeException("删除临时文件异常",e); |
| | | } |
| | | return bytes; |
| | | } |
| | |
| | | // VelocityContext context = new VelocityContext(map); |
| | | |
| | | //临时文件夹 |
| | | File dirPath = new File("D:/DLUT/tmp/"); |
| | | dirPath.deleteOnExit(); |
| | | dirPath.mkdirs(); |
| | | File dirPath = null; |
| | | try { |
| | | dirPath = Files.createTempDirectory("packageModelTmp").toFile(); |
| | | log.info("生成临时文件夹," + dirPath.getAbsolutePath()); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException("创建临时文件夹异常",e); |
| | | } |
| | | |
| | | //设置velocity资源加载器 |
| | | Properties prop = new Properties(); |
| | |
| | | // 等待命令执行完成 |
| | | process.waitFor(); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("执行cmd命令生成dll异常"); |
| | | throw new RuntimeException("执行cmd命令生成dll异常",e); |
| | | } |
| | | } |
| | | |
| | |
| | | process.waitFor(); |
| | | return jarSavePath; |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException("执行cmd命令打jar包异常"); |
| | | throw new RuntimeException("执行cmd命令打jar包异常",e); |
| | | } |
| | | } |
| | | |
| | |
| | | Process process = RuntimeUtil.exec(sb.toString()); |
| | | process.waitFor(); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException("执行cmd命令生成class异常"); |
| | | throw new RuntimeException("执行cmd命令生成class异常",e); |
| | | } |
| | | } |
| | | } |