chore(deps): 更新 fastexcel 依赖版本
- 将 fastexcel 版本从 1.2.0 升级到 1.3.0 - 更新 cutejava-springboot3 模块中的 fastexcel 版本属性
This commit is contained in:
@@ -55,7 +55,7 @@
|
||||
<commons-net.version>3.11.1</commons-net.version>
|
||||
<joda-time.version>2.12.7</joda-time.version>
|
||||
<pinyin.version>2.0.3.RELEASE</pinyin.version>
|
||||
<fastexcel.version>1.2.0</fastexcel.version>
|
||||
<fastexcel.version>1.3.0</fastexcel.version>
|
||||
<rhino.version>1.8.0</rhino.version>
|
||||
<guava.version>33.5.0-jre</guava.version>
|
||||
</properties>
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package cn.odboy.util.xlsx;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface KitXlsxExportDataTransferRowHandler<O, T> {
|
||||
|
||||
List<T> doHandler(O o);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package cn.odboy.util.xlsx;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.idev.excel.FastExcel;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
/**
|
||||
* xlsx文件导出工具
|
||||
*
|
||||
* @author odboy
|
||||
* @date 2025-12-29
|
||||
*/
|
||||
@UtilityClass
|
||||
public class KitXlsxExportUtil {
|
||||
|
||||
/**
|
||||
* @param response HttpServletResponse
|
||||
* @param title 标题
|
||||
* @param dataObjectList 数据源,一般为从数据库直接查询的数据
|
||||
* @param targetClazz 目标对象Class
|
||||
* @param rowHandler 数据对象 -> 目标对象 映射逻辑
|
||||
* @param <O> 数据源对象类型
|
||||
* @param <T> 目标对象类型
|
||||
* @throws IOException
|
||||
*/
|
||||
public static <O, T> void exportFile(HttpServletResponse response, String title, List<O> dataObjectList, Class<T> targetClazz, KitXlsxExportDataTransferRowHandler<O, T> rowHandler) throws IOException {
|
||||
if (response == null) {
|
||||
throw new BadRequestException("参数 HttpServletResponse(response) 必填");
|
||||
}
|
||||
if (CollUtil.isEmpty(dataObjectList)) {
|
||||
throw new BadRequestException("参数 数据源(dataObjectList) 必填");
|
||||
}
|
||||
if (StrUtil.isBlank(title)) {
|
||||
throw new BadRequestException("参数 标题(title) 必填");
|
||||
}
|
||||
String sheetName = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN);
|
||||
List<T> resultList = new ArrayList<>();
|
||||
for (O o : dataObjectList) {
|
||||
List<T> rows = rowHandler.doHandler(o);
|
||||
resultList.addAll(rows);
|
||||
}
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
String fileName = URLEncoder.encode(sheetName + "_" + title, StandardCharsets.UTF_8);
|
||||
response.setHeader("Content-disposition",
|
||||
"attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||
FastExcel.write(response.getOutputStream(), targetClazz)
|
||||
.sheet(sheetName)
|
||||
.doWrite(resultList);
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package cn.odboy.system.constant;
|
||||
|
||||
public interface SystemYesOrNoChConst {
|
||||
String YES_STR = "是";
|
||||
String NO_STR = "否";
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package cn.odboy.system.constant;
|
||||
|
||||
public interface SystemZhConst {
|
||||
|
||||
String YES_STR = "是";
|
||||
String NO_STR = "否";
|
||||
String ENABLE_STR = "启用";
|
||||
String DISABLE_STR = "停用";
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemDeptExportRowVo extends KitObject {
|
||||
|
||||
@ExcelProperty("部门名称")
|
||||
private String name;
|
||||
@ExcelProperty("部门状态")
|
||||
private String enabled;
|
||||
@ExcelProperty("创建日期")
|
||||
private Date createTime;
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemDictExportRowVo extends KitObject {
|
||||
@ExcelProperty("字典名称")
|
||||
private String name;
|
||||
@ExcelProperty("字典描述")
|
||||
private String description;
|
||||
@ExcelProperty("字典标签")
|
||||
private String label;
|
||||
@ExcelProperty("字典值")
|
||||
private String value;
|
||||
@ExcelProperty("创建日期")
|
||||
private Date createTime;
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemJobExportRowVo extends KitObject {
|
||||
|
||||
@ExcelProperty("岗位名称")
|
||||
private String name;
|
||||
@ExcelProperty("岗位状态")
|
||||
private String enabled;
|
||||
@ExcelProperty("创建日期")
|
||||
private Date createTime;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemLocalStorageExportRowVo extends KitObject {
|
||||
|
||||
@ExcelProperty(value = "文件名")
|
||||
private String realName;
|
||||
@ExcelProperty(value = "备注名")
|
||||
private String name;
|
||||
@ExcelProperty(value = "文件类型")
|
||||
private String type;
|
||||
@ExcelProperty(value = "文件大小")
|
||||
private String size;
|
||||
@ExcelProperty(value = "创建者")
|
||||
private String createBy;
|
||||
@ExcelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemMenuExportRowVo extends KitObject {
|
||||
|
||||
@ExcelProperty("菜单标题")
|
||||
private String title;
|
||||
@ExcelProperty("菜单类型")
|
||||
private String type;
|
||||
@ExcelProperty("权限标识")
|
||||
private String permission;
|
||||
@ExcelProperty("外链菜单")
|
||||
private String iFrame;
|
||||
@ExcelProperty("菜单可见")
|
||||
private String hidden;
|
||||
@ExcelProperty("是否缓存")
|
||||
private String cache;
|
||||
@ExcelProperty("创建日期")
|
||||
private Date createTime;
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemOssStorageExportRowVo extends KitObject {
|
||||
|
||||
@ExcelProperty("服务类型")
|
||||
private String serviceType;
|
||||
@ExcelProperty("服务地址")
|
||||
private String endpoint;
|
||||
@ExcelProperty("存储桶名称")
|
||||
private String bucketName;
|
||||
@ExcelProperty("文件名称")
|
||||
private String fileName;
|
||||
@ExcelProperty("文件大小")
|
||||
private String fileSizeDesc;
|
||||
@ExcelProperty("文件类型")
|
||||
private String fileMime;
|
||||
@ExcelProperty("创建人")
|
||||
private String createBy;
|
||||
@ExcelProperty("创建日期")
|
||||
private Date createTime;
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemQuartzJobExportRowVo extends KitObject {
|
||||
|
||||
@ExcelProperty("任务名称")
|
||||
private String jobName;
|
||||
@ExcelProperty("Bean名称")
|
||||
private String beanName;
|
||||
@ExcelProperty("执行方法")
|
||||
private String methodName;
|
||||
@ExcelProperty("参数")
|
||||
private String params;
|
||||
@ExcelProperty("表达式")
|
||||
private String cronExpression;
|
||||
@ExcelProperty("状态")
|
||||
private String isPause;
|
||||
@ExcelProperty("描述")
|
||||
private String description;
|
||||
@ExcelProperty("创建日期")
|
||||
private Date createTime;
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemQuartzLogExportRowVo extends KitObject {
|
||||
@ExcelProperty("任务名称")
|
||||
private String jobName;
|
||||
@ExcelProperty("Bean名称")
|
||||
private String beanName;
|
||||
@ExcelProperty("执行方法")
|
||||
private String methodName;
|
||||
@ExcelProperty("参数")
|
||||
private String params;
|
||||
@ExcelProperty("表达式")
|
||||
private String cronExpression;
|
||||
@ExcelProperty("异常详情")
|
||||
private String exceptionDetail;
|
||||
@ExcelProperty("耗时/毫秒")
|
||||
private Long time;
|
||||
@ExcelProperty("状态")
|
||||
private String status;
|
||||
@ExcelProperty("创建日期")
|
||||
private Date createTime;
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemRoleExportRowVo extends KitObject {
|
||||
@ExcelProperty("角色名称")
|
||||
private String name;
|
||||
@ExcelProperty("角色级别")
|
||||
private Integer level;
|
||||
@ExcelProperty("描述")
|
||||
private String description;
|
||||
@ExcelProperty("角色名称")
|
||||
private Date createTime;
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemUserExportRowVo extends KitObject {
|
||||
|
||||
@ExcelProperty("用户名")
|
||||
private String username;
|
||||
@ExcelProperty("角色")
|
||||
private String roles;
|
||||
@ExcelProperty("部门")
|
||||
private String dept;
|
||||
@ExcelProperty("岗位")
|
||||
private String jobs;
|
||||
@ExcelProperty("邮箱")
|
||||
private String email;
|
||||
@ExcelProperty("状态")
|
||||
private String status;
|
||||
@ExcelProperty("手机号码")
|
||||
private String mobile;
|
||||
@ExcelProperty("修改密码的时间")
|
||||
private Date updatePwdTime;
|
||||
@ExcelProperty("创建日期")
|
||||
private Date createTime;
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.odboy.base.KitObject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemUserOnlineExportRowVo extends KitObject {
|
||||
|
||||
@ExcelProperty("用户名")
|
||||
private String userName;
|
||||
@ExcelProperty("部门")
|
||||
private String dept;
|
||||
@ExcelProperty("登录IP")
|
||||
private String ip;
|
||||
@ExcelProperty("登录地点")
|
||||
private String address;
|
||||
@ExcelProperty("浏览器")
|
||||
private String browser;
|
||||
@ExcelProperty("登录日期")
|
||||
private String loginTime;
|
||||
}
|
||||
+2
-2
@@ -50,14 +50,14 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* OSS存储 服务实现类
|
||||
* OSS存储 Minio服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author codegen
|
||||
* @since 2025-07-15
|
||||
*/
|
||||
@Service
|
||||
public class SystemOssStorageServiceImpl extends ServiceImpl<SystemOssStorageMapper, SystemOssStorageTb>
|
||||
public class SystemMinioStorageServiceImpl extends ServiceImpl<SystemOssStorageMapper, SystemOssStorageTb>
|
||||
implements SystemOssStorageService {
|
||||
|
||||
@Autowired
|
||||
+1
-1
@@ -367,7 +367,7 @@
|
||||
<dependency>
|
||||
<groupId>cn.idev.excel</groupId>
|
||||
<artifactId>fastexcel</artifactId>
|
||||
<version>1.2.0</version>
|
||||
<version>1.3.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user