From 0a2f6f78683ba1c4e07f1359c1e7bf105a4bd507 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期一, 23 九月 2024 13:59:07 +0800 Subject: [PATCH] mpk 分组管理 --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java | 47 ++++++++++++++++++++++++----------------------- 1 files changed, 24 insertions(+), 23 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 bba6bb7..f172db5 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 @@ -1,16 +1,13 @@ package com.iailab.module.model.mpk.controller.admin; -import com.alibaba.fastjson.JSON; import com.iailab.framework.common.page.PageData; import com.iailab.framework.common.pojo.CommonResult; -import com.iailab.framework.common.util.date.DateUtils; -import com.iailab.module.model.mpk.common.utils.Readtxt; import com.iailab.module.model.mpk.dto.MpkFileDTO; -import com.iailab.module.model.mpk.service.MdkFileService; +import com.iailab.module.model.mpk.service.MpkFileService; import io.swagger.v3.oas.annotations.Operation; import org.apache.commons.io.IOUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.util.CollectionUtils; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -30,51 +27,55 @@ @RequestMapping("/model/mpk/file") public class MpkFileController { @Autowired - private MdkFileService mdkFileService; + private MpkFileService mpkFileService; @GetMapping("page") @Operation(summary = "分页") + @PreAuthorize("@ss.hasPermission('mpk:file:query')") public CommonResult<PageData<MpkFileDTO>> page(@RequestParam Map<String, Object> params) { - PageData<MpkFileDTO> page = mdkFileService.page(params); - + PageData<MpkFileDTO> page = mpkFileService.page(params); return success(page); } + @PreAuthorize("@ss.hasPermission('mpk:file:query')") @GetMapping("{id}") public CommonResult<MpkFileDTO> info(@PathVariable("id") String id) { - MpkFileDTO schedule = mdkFileService.get(id); - + MpkFileDTO schedule = mpkFileService.get(id); return success(schedule); } + @PreAuthorize("@ss.hasPermission('mpk:file:query')") @GetMapping("list") public CommonResult<List<MpkFileDTO>> list() { - List<MpkFileDTO> list = mdkFileService.list(new HashMap<>()); + List<MpkFileDTO> list = mpkFileService.list(new HashMap<>()); return success(list); } + @PreAuthorize("@ss.hasPermission('mpk:file:create')") @PostMapping - public CommonResult save(@RequestBody MpkFileDTO dto) { - mdkFileService.save(dto); - return CommonResult.success(); + public CommonResult<Boolean> save(@RequestBody MpkFileDTO dto) { + mpkFileService.save(dto); + return CommonResult.success(true); } + @PreAuthorize("@ss.hasPermission('mpk:file:delete')") @DeleteMapping - public CommonResult delete(String id) { - mdkFileService.delete(id); - return CommonResult.success(); + public CommonResult<Boolean> delete(String id) { + mpkFileService.delete(id); + return CommonResult.success(true); } + @PreAuthorize("@ss.hasPermission('mpk:file:update')") @PutMapping - public CommonResult update(@RequestBody MpkFileDTO dto) { - mdkFileService.update(dto); - return CommonResult.success(); + public CommonResult<Boolean> update(@RequestBody MpkFileDTO dto) { + mpkFileService.update(dto); + return CommonResult.success(true); } @GetMapping("generat") public void generat(String id, String remark,String zipFileName, HttpServletResponse response) throws IOException { - byte[] data = mdkFileService.generatorCode(id, remark,zipFileName); + byte[] data = mpkFileService.generatorCode(id, remark,zipFileName); response.reset(); response.setHeader("Content-Disposition", "attachment; filename=\"" + URLEncoder.encode(zipFileName, "UTF-8") + "\""); @@ -88,7 +89,7 @@ public void packageModel(String ids ,String projectId,String log ,String projectName,String version,String zipFileName,HttpServletResponse response) throws IOException { byte[] data; try { - data = mdkFileService.packageModel(Arrays.asList(ids.split(",")),projectId,projectName,zipFileName,log,version); + data = mpkFileService.packageModel(Arrays.asList(ids.split(",")),projectId,projectName,zipFileName,log,version); } catch (InterruptedException e) { throw new RuntimeException("模型打包失败",e); } @@ -104,7 +105,7 @@ @PostMapping("/upload") @Operation(summary = "python文件上传") public CommonResult<Map<String,String>> importExcel(@RequestParam("file") MultipartFile file) throws Exception { - Map<String,String> result = mdkFileService.savePyFile(file); + Map<String,String> result = mpkFileService.savePyFile(file); return success(result); } } \ No newline at end of file -- Gitblit v1.9.3