From 44e0f0472d8efa0646b20db8a40c16beab0b752e Mon Sep 17 00:00:00 2001
From: luoyb <412940104@qq.com>
Date: 星期六, 06 四月 2024 12:22:12 +0800
Subject: [PATCH] feat: 一些需求改进 打开档案时增加了部门选择项 处理了合同信息录入时的性别不自动填入问题 合同到期提醒模块发布
---
febs-common/febs-common-core/src/main/java/cc/mrbird/febs/common/core/utils/MyUtil.java | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/febs-common/febs-common-core/src/main/java/cc/mrbird/febs/common/core/utils/MyUtil.java b/febs-common/febs-common-core/src/main/java/cc/mrbird/febs/common/core/utils/MyUtil.java
index e90d58b..9656734 100644
--- a/febs-common/febs-common-core/src/main/java/cc/mrbird/febs/common/core/utils/MyUtil.java
+++ b/febs-common/febs-common-core/src/main/java/cc/mrbird/febs/common/core/utils/MyUtil.java
@@ -128,6 +128,35 @@
return Dict.create().set("fileName",fileName).set("suffix",suffix).set("newName",newName);
}
+ public static Dict filesUpload(MultipartFile file, String uploadPpath) throws FebsException, IOException {
+ if (file.isEmpty()) {
+ throw new FebsException("上传的文件不能为空!请重新上传");
+ }
+ if (file.getSize() <= 0) {
+ throw new FebsException("上传的文件大小需要大于0kb");
+ }
+ if (file.getSize() > 200 * 1024* 1024) {
+ throw new FebsException("上传的文件大于200M");
+ }
+ if (!FileUtil.exist(uploadPpath)) {
+ FileUtil.mkdir(uploadPpath);
+ }
+ //原本名字
+ String fileName = file.getOriginalFilename();
+ String suffix = "";
+ if (fileName.lastIndexOf(".") > 0) {
+ //后缀
+ suffix = fileName.substring(fileName.lastIndexOf("."));
+ }
+ if(FileUtil.exist(uploadPpath + fileName)){
+ throw new FebsException("文件已经存在");
+ }
+
+ //上传
+ file.transferTo(new File(uploadPpath + fileName));
+ return Dict.create().set("fileName",fileName).set("suffix",suffix);
+ }
+
/**
* 对字节数组字符串进行Base64解码并生成图片
*/
--
Gitblit v1.8.0