From c258cc7d81c8ffc340bec14c2a92264620fb9454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AE=B6=E4=B8=9C?= <1654135867@qq.com> Date: Fri, 1 Nov 2024 15:47:12 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E9=97=A8=E4=B8=8A=E4=BC=A0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=8A=A0=E5=88=86=E7=B1=BB=E5=92=8C=E5=90=8E=E7=BC=80?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../depfile/controller/DepfileController.java | 22 +++++++++++++++++-- .../modules/demo/depfile/entity/Depfile.java | 10 +++++++++ .../src/views/depfile/Depfile.data.ts | 10 +++++++++ .../views/depfile/components/DepfileForm.vue | 10 +++++++++ 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/controller/DepfileController.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/controller/DepfileController.java index a163ee9..ccfcaad 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/controller/DepfileController.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/controller/DepfileController.java @@ -1,5 +1,7 @@ package org.jeecg.modules.demo.depfile.controller; +import java.io.File; +import java.net.URL; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -97,6 +99,10 @@ public class DepfileController extends JeecgController depfile.setUserid(user.getId()); String depiid = depadminlxService.getdepid(user.getId()); depfile.setDepid(depiid); + String extension = getFileExtensionFromUrl(depfile.getUpfile()); + System.out.println(depfile.getUpfile()); + System.out.println(depfile.getUpfile()); + depfile.setFilehz(extension); depfileService.save(depfile); return Result.OK("添加成功!"); } @@ -111,6 +117,10 @@ public class DepfileController extends JeecgController @ApiOperation(value="单位技术研究资质情况-编辑", notes="单位技术研究资质情况-编辑") @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) public Result edit(@RequestBody Depfile depfile) { + String extension = getFileExtensionFromUrl(depfile.getUpfile()); + depfile.setFilehz(extension); + System.out.println(depfile.getUpfile()); + System.out.println(depfile.getUpfile()); depfileService.updateById(depfile); return Result.OK("编辑成功!"); } @@ -181,6 +191,14 @@ public class DepfileController extends JeecgController @RequestMapping(value = "/importExcel", method = RequestMethod.POST) public Result importExcel(HttpServletRequest request, HttpServletResponse response) { return super.importExcel(request, response, Depfile.class); - } -} + + } + public static String getFileExtensionFromUrl(String fileUrl) { + + File file = new File(fileUrl); + String fileName = file.getName(); + String extension = fileName.substring(fileName.lastIndexOf(".") + 1); + return extension; + } + } diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/entity/Depfile.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/entity/Depfile.java index 542eada..a2334ad 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/entity/Depfile.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/entity/Depfile.java @@ -85,4 +85,14 @@ public class Depfile implements Serializable { @Excel(name = "用户id", width = 15) @ApiModelProperty(value = "用户id") private java.lang.String userid; + + /**文件后缀*/ + @Excel(name = "文件后缀", width = 15) + @ApiModelProperty(value = "文件后缀") + private java.lang.String filehz; + /**文件类型*/ + @Excel(name = "文件类型", width = 15, dicCode = "filetext") + @Dict(dicCode = "filetext") + @ApiModelProperty(value = "文件类型") + private java.lang.String filelx; } diff --git a/jeecgboot-vue3/src/views/depfile/Depfile.data.ts b/jeecgboot-vue3/src/views/depfile/Depfile.data.ts index 70e98ce..5e30b38 100644 --- a/jeecgboot-vue3/src/views/depfile/Depfile.data.ts +++ b/jeecgboot-vue3/src/views/depfile/Depfile.data.ts @@ -30,6 +30,16 @@ export const columns: BasicColumn[] = [ align: "center", dataIndex: 'upfile', }, + { + title: '文件后缀', + align: "center", + dataIndex: 'filehz' + }, + { + title: '文件类型', + align: "center", + dataIndex: 'filelx_dictText' + }, ]; // 高级查询数据 diff --git a/jeecgboot-vue3/src/views/depfile/components/DepfileForm.vue b/jeecgboot-vue3/src/views/depfile/components/DepfileForm.vue index d785682..eb42378 100644 --- a/jeecgboot-vue3/src/views/depfile/components/DepfileForm.vue +++ b/jeecgboot-vue3/src/views/depfile/components/DepfileForm.vue @@ -29,6 +29,12 @@ + + + + + + @@ -37,6 +43,7 @@