From 856d69ce678173e0a8e165bcb0135037d20b48ee Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期二, 15 十月 2024 11:51:22 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 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..8f8ebed 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("代码生成异常",e);
+        }
     }
 
     @GetMapping("packageModel")
@@ -121,8 +125,13 @@
 
     @PostMapping("/upload")
     @Operation(summary = "python文件上传")
-    public CommonResult<Map<String,String>> importExcel(@RequestParam("file") MultipartFile file) throws Exception {
+    public CommonResult<Map<String,String>> upload(@RequestParam("file") MultipartFile file) throws Exception {
         Map<String,String> result = mpkFileService.savePyFile(file);
         return success(result);
     }
+
+    @PostMapping("/publish")
+    public CommonResult<String> publish(@RequestBody Map<String, Object> params) {
+        return mpkFileService.publish(params);
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3