From 1fea3eea8bf676ac6cf35c6b98e42efdbc5b897e Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期日, 29 九月 2024 11:50:08 +0800 Subject: [PATCH] 模型生成代码后备份dll和jar,用于测试运行模型 --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java index 9931ccc..180c168 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java @@ -91,15 +91,19 @@ } @GetMapping("generat") - public void generat(String id, String remark,String zipFileName, HttpServletResponse response) throws IOException { - byte[] data = mpkFileService.generatorCode(id, remark,zipFileName); + public void generat(String id, String remark,String zipFileName, HttpServletResponse response) { + try { + byte[] data = mpkFileService.generatorCode(id, remark,zipFileName); - response.reset(); - response.setHeader("Content-Disposition", "attachment; filename=\"" + URLEncoder.encode(zipFileName, "UTF-8") + "\""); - response.addHeader("Content-Length", "" + data.length); - response.setContentType("application/octet-stream; charset=UTF-8"); + response.reset(); + response.setHeader("Content-Disposition", "attachment; filename=\"" + URLEncoder.encode(zipFileName, "UTF-8") + "\""); + response.addHeader("Content-Length", "" + data.length); + response.setContentType("application/octet-stream; charset=UTF-8"); - IOUtils.write(data, response.getOutputStream()); + IOUtils.write(data, response.getOutputStream()); + } catch (Exception e) { + throw new RuntimeException("代码生成异常"); + } } @GetMapping("packageModel") -- Gitblit v1.9.3