From ffed5a09cb6904ce55b33c49a5d38461f863756b Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期三, 04 八月 2021 19:02:59 +0800
Subject: [PATCH] remove 移除原生excel工具
---
/dev/null | 150 --------------------------------------------------
1 files changed, 0 insertions(+), 150 deletions(-)
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java
deleted file mode 100644
index 50482c5..0000000
--- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package com.ruoyi.common.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.math.BigDecimal;
-
-/**
- * 鑷畾涔夊鍑篍xcel鏁版嵁娉ㄨВ
- *
- * @author ruoyi
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.FIELD)
-public @interface Excel
-{
- /**
- * 瀵煎嚭鏃跺湪excel涓帓搴�
- */
- public int sort() default Integer.MAX_VALUE;
-
- /**
- * 瀵煎嚭鍒癊xcel涓殑鍚嶅瓧.
- */
- public String name() default "";
-
- /**
- * 鏃ユ湡鏍煎紡, 濡�: yyyy-MM-dd
- */
- public String dateFormat() default "";
-
- /**
- * 濡傛灉鏄瓧鍏哥被鍨嬶紝璇疯缃瓧鍏哥殑type鍊� (濡�: sys_user_sex)
- */
- public String dictType() default "";
-
- /**
- * 璇诲彇鍐呭杞〃杈惧紡 (濡�: 0=鐢�,1=濂�,2=鏈煡)
- */
- public String readConverterExp() default "";
-
- /**
- * 鍒嗛殧绗︼紝璇诲彇瀛楃涓茬粍鍐呭
- */
- public String separator() default ",";
-
- /**
- * BigDecimal 绮惧害 榛樿:-1(榛樿涓嶅紑鍚疊igDecimal鏍煎紡鍖�)
- */
- public int scale() default -1;
-
- /**
- * BigDecimal 鑸嶅叆瑙勫垯 榛樿:BigDecimal.ROUND_HALF_EVEN
- */
- public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
-
- /**
- * 瀵煎嚭绫诲瀷锛�0鏁板瓧 1瀛楃涓诧級
- */
- public ColumnType cellType() default ColumnType.STRING;
-
- /**
- * 瀵煎嚭鏃跺湪excel涓瘡涓垪鐨勯珮搴� 鍗曚綅涓哄瓧绗�
- */
- public double height() default 14;
-
- /**
- * 瀵煎嚭鏃跺湪excel涓瘡涓垪鐨勫 鍗曚綅涓哄瓧绗�
- */
- public double width() default 16;
-
- /**
- * 鏂囧瓧鍚庣紑,濡�% 90 鍙樻垚90%
- */
- public String suffix() default "";
-
- /**
- * 褰撳�间负绌烘椂,瀛楁鐨勯粯璁ゅ��
- */
- public String defaultValue() default "";
-
- /**
- * 鎻愮ず淇℃伅
- */
- public String prompt() default "";
-
- /**
- * 璁剧疆鍙兘閫夋嫨涓嶈兘杈撳叆鐨勫垪鍐呭.
- */
- public String[] combo() default {};
-
- /**
- * 鏄惁瀵煎嚭鏁版嵁,搴斿闇�姹�:鏈夋椂鎴戜滑闇�瑕佸鍑轰竴浠芥ā鏉�,杩欐槸鏍囬闇�瑕佷絾鍐呭闇�瑕佺敤鎴锋墜宸ュ~鍐�.
- */
- public boolean isExport() default true;
-
- /**
- * 鍙︿竴涓被涓殑灞炴�у悕绉�,鏀寔澶氱骇鑾峰彇,浠ュ皬鏁扮偣闅斿紑
- */
- public String targetAttr() default "";
-
- /**
- * 鏄惁鑷姩缁熻鏁版嵁,鍦ㄦ渶鍚庤拷鍔犱竴琛岀粺璁℃暟鎹�诲拰
- */
- public boolean isStatistics() default false;
-
- /**
- * 瀵煎嚭瀛楁瀵归綈鏂瑰紡锛�0锛氶粯璁わ紱1锛氶潬宸︼紱2锛氬眳涓紱3锛氶潬鍙筹級
- */
- Align align() default Align.AUTO;
-
- public enum Align
- {
- AUTO(0), LEFT(1), CENTER(2), RIGHT(3);
- private final int value;
-
- Align(int value)
- {
- this.value = value;
- }
-
- public int value()
- {
- return this.value;
- }
- }
-
- /**
- * 瀛楁绫诲瀷锛�0锛氬鍑哄鍏ワ紱1锛氫粎瀵煎嚭锛�2锛氫粎瀵煎叆锛�
- */
- Type type() default Type.ALL;
-
- public enum Type
- {
- ALL(0), EXPORT(1), IMPORT(2);
- private final int value;
-
- Type(int value)
- {
- this.value = value;
- }
-
- public int value()
- {
- return this.value;
- }
- }
-
- public enum ColumnType
- {
- NUMERIC(0), STRING(1), IMAGE(2);
- private final int value;
-
- ColumnType(int value)
- {
- this.value = value;
- }
-
- public int value()
- {
- return this.value;
- }
- }
-}
\ No newline at end of file
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java
deleted file mode 100644
index 940763f..0000000
--- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.ruoyi.common.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Excel娉ㄨВ闆�
- *
- * @author ruoyi
- */
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Excels
-{
- Excel[] value();
-}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtils.java
deleted file mode 100644
index 4d52d0b..0000000
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtils.java
+++ /dev/null
@@ -1,150 +0,0 @@
-package com.ruoyi.common.utils.poi;
-
-import cn.hutool.core.util.IdUtil;
-import com.alibaba.excel.EasyExcel;
-import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
-import com.ruoyi.common.utils.DictUtils;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.file.FileUtils;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URLEncoder;
-import java.nio.charset.StandardCharsets;
-import java.util.List;
-
-/**
- * Excel鐩稿叧澶勭悊
- *
- * @author ruoyi
- */
-public class ExcelUtils {
-
- /**
- * 瀵筫xcel琛ㄥ崟榛樿绗竴涓储寮曞悕杞崲鎴恖ist锛圗asyExcel锛�
- *
- * @param is 杈撳叆娴�
- * @return 杞崲鍚庨泦鍚�
- */
- public static <T> List<T> importExcel(InputStream is, Class<T> clazz) {
- return EasyExcel.read(is).autoCloseStream(false).sheet().doReadSync();
- }
-
- /**
- * 瀵筶ist鏁版嵁婧愬皢鍏堕噷闈㈢殑鏁版嵁瀵煎叆鍒癳xcel琛ㄥ崟锛圗asyExcel锛�
- *
- * @param list 瀵煎嚭鏁版嵁闆嗗悎
- * @param sheetName 宸ヤ綔琛ㄧ殑鍚嶇О
- * @return 缁撴灉
- */
- public static <T> void exportExcel(List<T> list, String sheetName, Class<T> clazz, HttpServletResponse response) {
- try {
- String filename = encodingFilename(sheetName);
- response.reset();
- response.addHeader("Access-Control-Allow-Origin", "*");
- response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
- FileUtils.setAttachmentResponseHeader(response, URLEncoder.encode(filename, StandardCharsets.UTF_8.toString()));
- response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8");
- ServletOutputStream os = response.getOutputStream();
- EasyExcel.write(os, clazz)
- .autoCloseStream(false)
- // 鑷姩閫傞厤
- .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
- .sheet(sheetName).doWrite(list);
- } catch (IOException e) {
- throw new RuntimeException("瀵煎嚭Excel寮傚父");
- }
- }
-
- /**
- * 瑙f瀽瀵煎嚭鍊� 0=鐢�,1=濂�,2=鏈煡
- *
- * @param propertyValue 鍙傛暟鍊�
- * @param converterExp 缈昏瘧娉ㄨВ
- * @param separator 鍒嗛殧绗�
- * @return 瑙f瀽鍚庡��
- */
- public static String convertByExp(String propertyValue, String converterExp, String separator) {
- StringBuilder propertyString = new StringBuilder();
- String[] convertSource = converterExp.split(",");
- for (String item : convertSource) {
- String[] itemArray = item.split("=");
- if (StringUtils.containsAny(separator, propertyValue)) {
- for (String value : propertyValue.split(separator)) {
- if (itemArray[0].equals(value)) {
- propertyString.append(itemArray[1] + separator);
- break;
- }
- }
- } else {
- if (itemArray[0].equals(propertyValue)) {
- return itemArray[1];
- }
- }
- }
- return StringUtils.stripEnd(propertyString.toString(), separator);
- }
-
- /**
- * 鍙嶅悜瑙f瀽鍊� 鐢�=0,濂�=1,鏈煡=2
- *
- * @param propertyValue 鍙傛暟鍊�
- * @param converterExp 缈昏瘧娉ㄨВ
- * @param separator 鍒嗛殧绗�
- * @return 瑙f瀽鍚庡��
- */
- public static String reverseByExp(String propertyValue, String converterExp, String separator) {
- StringBuilder propertyString = new StringBuilder();
- String[] convertSource = converterExp.split(",");
- for (String item : convertSource) {
- String[] itemArray = item.split("=");
- if (StringUtils.containsAny(separator, propertyValue)) {
- for (String value : propertyValue.split(separator)) {
- if (itemArray[1].equals(value)) {
- propertyString.append(itemArray[0] + separator);
- break;
- }
- }
- } else {
- if (itemArray[1].equals(propertyValue)) {
- return itemArray[0];
- }
- }
- }
- return StringUtils.stripEnd(propertyString.toString(), separator);
- }
-
- /**
- * 瑙f瀽瀛楀吀鍊�
- *
- * @param dictValue 瀛楀吀鍊�
- * @param dictType 瀛楀吀绫诲瀷
- * @param separator 鍒嗛殧绗�
- * @return 瀛楀吀鏍囩
- */
- public static String convertDictByExp(String dictValue, String dictType, String separator) {
- return DictUtils.getDictLabel(dictType, dictValue, separator);
- }
-
- /**
- * 鍙嶅悜瑙f瀽鍊煎瓧鍏稿��
- *
- * @param dictLabel 瀛楀吀鏍囩
- * @param dictType 瀛楀吀绫诲瀷
- * @param separator 鍒嗛殧绗�
- * @return 瀛楀吀鍊�
- */
- public static String reverseDictByExp(String dictLabel, String dictType, String separator) {
- return DictUtils.getDictValue(dictType, dictLabel, separator);
- }
-
- /**
- * 缂栫爜鏂囦欢鍚�
- */
- public static String encodingFilename(String filename) {
- return IdUtil.fastSimpleUUID() + "_" + filename + ".xlsx";
- }
-
-}
--
Gitblit v1.9.3