From 2dcfb8e3ce6bd78f2856e428b3dc4a1e002a8a4e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?=
<15040126243@163.com>
Date: Wed, 10 May 2023 00:00:17 +0800
Subject: [PATCH 01/46] =?UTF-8?q?update=20=E6=9B=B4=E6=94=B9=E8=AF=B4?=
=?UTF-8?q?=E6=98=8E=20cglib=20=E5=9F=BA=E4=BA=8Eget=20set=E6=8B=B7?=
=?UTF-8?q?=E8=B4=9D=20=E4=B8=8D=E5=B1=9E=E4=BA=8E=E6=B7=B1=E6=8B=B7?=
=?UTF-8?q?=E8=B4=9D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/main/java/com/ruoyi/common/utils/BeanCopyUtils.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/BeanCopyUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/BeanCopyUtils.java
index e1bafee22..d5b341419 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/BeanCopyUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/BeanCopyUtils.java
@@ -17,11 +17,10 @@ import java.util.List;
import java.util.Map;
/**
- * bean深拷贝工具(基于 cglib 性能优异)
+ * bean拷贝工具(基于 cglib 性能优异)
*
* 重点 cglib 不支持 拷贝到链式对象
* 例如: 源对象 拷贝到 目标(链式对象)
- * 请区分好`浅拷贝`和`深拷贝`再做使用
*
* @author Lion Li
*/
From a412b20118989128faca0fd2345086a9ad10c16d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?=
<15040126243@163.com>
Date: Wed, 10 May 2023 14:05:57 +0800
Subject: [PATCH 02/46] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20admin=E7=9B=91?=
=?UTF-8?q?=E6=8E=A7=20=E5=88=87=E6=8D=A2tab=E9=A1=B5=E9=9C=80=E8=A6=81?=
=?UTF-8?q?=E9=87=8D=E5=A4=8D=E7=99=BB=E5=BD=95=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ruoyi-ui/.env.development | 2 +-
ruoyi-ui/.env.production | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ruoyi-ui/.env.development b/ruoyi-ui/.env.development
index 232d9077b..c5457c9a6 100644
--- a/ruoyi-ui/.env.development
+++ b/ruoyi-ui/.env.development
@@ -11,7 +11,7 @@ VUE_APP_BASE_API = '/dev-api'
VUE_APP_CONTEXT_PATH = '/'
# 监控地址
-VUE_APP_MONITRO_ADMIN = 'http://localhost:9090/admin/login'
+VUE_APP_MONITRO_ADMIN = 'http://localhost:9090/admin/applications'
# xxl-job 控制台地址
VUE_APP_XXL_JOB_ADMIN = 'http://localhost:9100/xxl-job-admin'
diff --git a/ruoyi-ui/.env.production b/ruoyi-ui/.env.production
index f92c1af3d..1d2cbae6a 100644
--- a/ruoyi-ui/.env.production
+++ b/ruoyi-ui/.env.production
@@ -11,7 +11,7 @@ VUE_APP_BASE_API = '/prod-api'
VUE_APP_CONTEXT_PATH = '/'
# 监控地址
-VUE_APP_MONITRO_ADMIN = '/admin/login'
+VUE_APP_MONITRO_ADMIN = '/admin/applications'
# xxl-job 控制台地址
VUE_APP_XXL_JOB_ADMIN = '/xxl-job-admin'
From 0affb8ab54f0167ed480c4270568dd7f425b6496 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?=
<15040126243@163.com>
Date: Wed, 10 May 2023 18:37:20 +0800
Subject: [PATCH 03/46] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E9=87=8D?=
=?UTF-8?q?=E6=9E=84=20CellMergeStrategy=20=E6=94=AF=E6=8C=81=E5=A4=9A?=
=?UTF-8?q?=E7=BA=A7=E8=A1=A8=E5=A4=B4=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B?=
=?UTF-8?q?=E5=B0=8F=E9=97=AE=E9=A2=98=20=E6=95=B4=E7=90=86=E4=BB=A3?=
=?UTF-8?q?=E7=A0=81=E7=BB=93=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ruoyi/common/excel/CellMergeStrategy.java | 166 +++++++++---------
1 file changed, 87 insertions(+), 79 deletions(-)
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/excel/CellMergeStrategy.java b/ruoyi-common/src/main/java/com/ruoyi/common/excel/CellMergeStrategy.java
index 6102eec50..dead983af 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/excel/CellMergeStrategy.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/excel/CellMergeStrategy.java
@@ -1,19 +1,20 @@
package com.ruoyi.common.excel;
+import cn.hutool.core.collection.CollUtil;
+import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.write.merge.AbstractMergeStrategy;
import com.ruoyi.common.annotation.CellMerge;
+import com.ruoyi.common.utils.reflect.ReflectUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.util.CellRangeAddress;
import java.lang.reflect.Field;
-import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -24,91 +25,98 @@ import java.util.Map;
*
* @author Lion Li
*/
-@AllArgsConstructor
@Slf4j
public class CellMergeStrategy extends AbstractMergeStrategy {
- private List> list;
- private boolean hasTitle;
+ private final List> list;
+ private final boolean hasTitle;
+ private int rowIndex;
- @Override
- protected void merge(Sheet sheet, Cell cell, Head head, Integer relativeRowIndex) {
- List cellList = handle(list, hasTitle);
- // judge the list is not null
- if (CollectionUtils.isNotEmpty(cellList)) {
- // the judge is necessary
- if (cell.getRowIndex() == 1 && cell.getColumnIndex() == 0) {
- for (CellRangeAddress item : cellList) {
- sheet.addMergedRegion(item);
- }
- }
- }
- }
+ public CellMergeStrategy(List> list, boolean hasTitle) {
+ this.list = list;
+ this.hasTitle = hasTitle;
+ // 行合并开始下标
+ this.rowIndex = hasTitle ? 1 : 0;
+ }
- @SneakyThrows
- private static List handle(List> list, boolean hasTitle) {
- List cellList = new ArrayList<>();
- if (CollectionUtils.isEmpty(list)) {
- return cellList;
- }
- Class> clazz = list.get(0).getClass();
- Field[] fields = clazz.getDeclaredFields();
- // 有注解的字段
- List mergeFields = new ArrayList<>();
- List mergeFieldsIndex = new ArrayList<>();
- for (int i = 0; i < fields.length; i++) {
- Field field = fields[i];
- if (field.isAnnotationPresent(CellMerge.class)) {
- CellMerge cm = field.getAnnotation(CellMerge.class);
- mergeFields.add(field);
- mergeFieldsIndex.add(cm.index() == -1 ? i : cm.index());
- }
- }
- // 行合并开始下标
- int rowIndex = hasTitle ? 1 : 0;
- Map map = new HashMap<>();
- // 生成两两合并单元格
- for (int i = 0; i < list.size(); i++) {
- for (int j = 0; j < mergeFields.size(); j++) {
- Field field = mergeFields.get(j);
- String name = field.getName();
- String methodName = "get" + name.substring(0, 1).toUpperCase() + name.substring(1);
- Method readMethod = clazz.getMethod(methodName);
- Object val = readMethod.invoke(list.get(i));
+ @Override
+ protected void merge(Sheet sheet, Cell cell, Head head, Integer relativeRowIndex) {
+ List cellList = handle(list, hasTitle);
+ // judge the list is not null
+ if (CollUtil.isNotEmpty(cellList)) {
+ // the judge is necessary
+ if (cell.getRowIndex() == rowIndex && cell.getColumnIndex() == 0) {
+ for (CellRangeAddress item : cellList) {
+ sheet.addMergedRegion(item);
+ }
+ }
+ }
+ }
- int colNum = mergeFieldsIndex.get(j);
- if (!map.containsKey(field)) {
- map.put(field, new RepeatCell(val, i));
- } else {
- RepeatCell repeatCell = map.get(field);
- Object cellValue = repeatCell.getValue();
- if (cellValue == null || "".equals(cellValue)) {
- // 空值跳过不合并
- continue;
- }
- if (!cellValue.equals(val)) {
- if (i - repeatCell.getCurrent() > 1) {
- cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex - 1, colNum, colNum));
- }
- map.put(field, new RepeatCell(val, i));
- } else if (i == list.size() - 1) {
- if (i > repeatCell.getCurrent()) {
- cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex, colNum, colNum));
- }
- }
- }
- }
- }
- return cellList;
- }
+ @SneakyThrows
+ private List handle(List> list, boolean hasTitle) {
+ List cellList = new ArrayList<>();
+ if (CollUtil.isEmpty(list)) {
+ return cellList;
+ }
+ Field[] fields = ReflectUtils.getFields(list.get(0).getClass(), field -> !"serialVersionUID".equals(field.getName()));
- @Data
- @AllArgsConstructor
- static class RepeatCell {
+ // 有注解的字段
+ List mergeFields = new ArrayList<>();
+ List mergeFieldsIndex = new ArrayList<>();
+ for (int i = 0; i < fields.length; i++) {
+ Field field = fields[i];
+ if (field.isAnnotationPresent(CellMerge.class)) {
+ CellMerge cm = field.getAnnotation(CellMerge.class);
+ mergeFields.add(field);
+ mergeFieldsIndex.add(cm.index() == -1 ? i : cm.index());
+ if (hasTitle) {
+ ExcelProperty property = field.getAnnotation(ExcelProperty.class);
+ rowIndex = Math.max(rowIndex, property.value().length);
+ }
+ }
+ }
- private Object value;
+ Map map = new HashMap<>();
+ // 生成两两合并单元格
+ for (int i = 0; i < list.size(); i++) {
+ for (int j = 0; j < mergeFields.size(); j++) {
+ Field field = mergeFields.get(j);
+ Object val = ReflectUtils.invokeGetter(list.get(i), field.getName());
- private int current;
+ int colNum = mergeFieldsIndex.get(j);
+ if (!map.containsKey(field)) {
+ map.put(field, new RepeatCell(val, i));
+ } else {
+ RepeatCell repeatCell = map.get(field);
+ Object cellValue = repeatCell.getValue();
+ if (cellValue == null || "".equals(cellValue)) {
+ // 空值跳过不合并
+ continue;
+ }
+ if (!cellValue.equals(val)) {
+ if (i - repeatCell.getCurrent() > 1) {
+ cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex - 1, colNum, colNum));
+ }
+ map.put(field, new RepeatCell(val, i));
+ } else if (i == list.size() - 1) {
+ if (i > repeatCell.getCurrent()) {
+ cellList.add(new CellRangeAddress(repeatCell.getCurrent() + rowIndex, i + rowIndex, colNum, colNum));
+ }
+ }
+ }
+ }
+ }
+ return cellList;
+ }
- }
+ @Data
+ @AllArgsConstructor
+ static class RepeatCell {
+
+ private Object value;
+
+ private int current;
+
+ }
}
From 049da896f832dfcb1ebcbe5673f88252864a913b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=A2=81=E5=89=91=E9=94=8B?= <1822213252@qq.com>
Date: Sat, 13 May 2023 07:50:30 +0000
Subject: [PATCH 04/46] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8Delement=20ui=20?=
=?UTF-8?q?=E5=9B=A0=E7=89=88=E6=9C=AC=E8=80=8C=E6=9C=AA=E8=A2=AB=E5=B7=A5?=
=?UTF-8?q?=E5=85=B7=E8=AF=86=E5=88=AB=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: 梁剑锋 <1822213252@qq.com>
---
ruoyi-ui/package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json
index 651eab334..16924f395 100644
--- a/ruoyi-ui/package.json
+++ b/ruoyi-ui/package.json
@@ -40,7 +40,7 @@
"clipboard": "2.0.8",
"core-js": "3.25.3",
"echarts": "5.4.0",
- "element-ui": "2.15.12",
+ "element-ui": "2.15.13",
"file-saver": "2.0.5",
"fuse.js": "6.4.3",
"highlight.js": "9.18.5",
From 72882374be15d1e6a23ccc7d0c8ad3e809caf88a Mon Sep 17 00:00:00 2001
From: "Emil.Zhang" <356141959@qq.com>
Date: Sat, 13 May 2023 14:17:59 +0000
Subject: [PATCH 05/46] =?UTF-8?q?!345=20=E5=A2=9E=E5=8A=A0Excel=E5=AF=BC?=
=?UTF-8?q?=E5=87=BA=E8=A1=A8=E6=A0=BC=E6=97=B6=E7=BA=A7=E8=81=94=E4=B8=8B?=
=?UTF-8?q?=E6=8B=89=E9=80=89=E9=A1=B9=E5=8A=9F=E8=83=BD=20*=20fixed(Excel?=
=?UTF-8?q?=E5=B7=A5=E5=85=B7=E7=B1=BB=E9=87=8D=E8=BD=BD):=20*=20fixed(?=
=?UTF-8?q?=E5=AD=97=E5=85=B8=E6=8E=A5=E5=8F=A3=E8=80=A6=E5=90=88=E9=97=AE?=
=?UTF-8?q?=E9=A2=98):=20*=20fixed(=E8=B0=83=E6=95=B4=E6=8E=A5=E5=8F=A3):?=
=?UTF-8?q?=20*=20fixed(=E5=88=87=E6=8D=A2=E6=9D=A1=E4=BB=B6=E4=B8=8D?=
=?UTF-8?q?=E6=AD=A3=E7=A1=AE):=20*=20feat(=E4=BC=98=E5=8C=96=E6=B3=A8?=
=?UTF-8?q?=E8=A7=A3|=E5=8F=8D=E5=90=91=E8=A7=A3=E6=9E=90=E5=A4=B1?=
=?UTF-8?q?=E6=95=88):=20*=20feat(=E5=A2=9E=E5=8A=A0=E6=B3=A8=E9=87=8A|?=
=?UTF-8?q?=E7=BC=96=E5=86=99Demo|=E4=BF=AE=E5=A4=8Dbug):=20*=20feat(Excel?=
=?UTF-8?q?=E5=AF=BC=E5=87=BA=E9=99=84=E5=B8=A6=E6=9C=89=E4=B8=8B=E6=8B=89?=
=?UTF-8?q?=E6=A1=86):?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../common/convert/ExcelEnumConvert.java | 30 +-
.../common/core/service/DictService.java | 9 +
.../ruoyi/common/excel/DropDownOptions.java | 91 ++++
.../ruoyi/common/excel/ExcelDownHandler.java | 391 ++++++++++++++++++
.../com/ruoyi/common/utils/poi/ExcelUtil.java | 80 +++-
.../demo/controller/TestExcelController.java | 37 +-
.../ruoyi/demo/domain/vo/ExportDemoVo.java | 119 ++++++
.../demo/listener/ExportDemoListener.java | 68 +++
.../demo/service/IExportExcelService.java | 18 +
.../service/impl/ExportExcelServiceImpl.java | 262 ++++++++++++
.../service/impl/SysDictTypeServiceImpl.java | 14 +-
11 files changed, 1106 insertions(+), 13 deletions(-)
create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/excel/DropDownOptions.java
create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/excel/ExcelDownHandler.java
create mode 100644 ruoyi-demo/src/main/java/com/ruoyi/demo/domain/vo/ExportDemoVo.java
create mode 100644 ruoyi-demo/src/main/java/com/ruoyi/demo/listener/ExportDemoListener.java
create mode 100644 ruoyi-demo/src/main/java/com/ruoyi/demo/service/IExportExcelService.java
create mode 100644 ruoyi-demo/src/main/java/com/ruoyi/demo/service/impl/ExportExcelServiceImpl.java
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/convert/ExcelEnumConvert.java b/ruoyi-common/src/main/java/com/ruoyi/common/convert/ExcelEnumConvert.java
index c69d90cfb..2069c154f 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/convert/ExcelEnumConvert.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/convert/ExcelEnumConvert.java
@@ -37,14 +37,34 @@ public class ExcelEnumConvert implements Converter