From da4e0806569af3e676c88cbbe637debf4d1a57c3 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期二, 03 八月 2021 19:29:59 +0800
Subject: [PATCH] update 修改 操作日志导出 适配easyexcel工具

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java |   12 +++--
 ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java                   |   47 +++++++++++++----------
 ruoyi-ui/src/views/monitor/operlog/index.vue                                         |   14 +------
 ruoyi-ui/src/views/system/oss/index.vue                                              |    4 -
 4 files changed, 37 insertions(+), 40 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java
index 97f9920..c7d1fcd 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java
@@ -5,18 +5,19 @@
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.utils.poi.ExcelUtils;
 import com.ruoyi.system.domain.SysOperLog;
 import com.ruoyi.system.service.ISysOperLogService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 /**
  * 鎿嶄綔鏃ュ織璁板綍
- * 
+ *
  * @author ruoyi
  */
 @RestController
@@ -36,11 +37,12 @@
     @Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
     @GetMapping("/export")
-    public AjaxResult export(SysOperLog operLog)
+    public void export(SysOperLog operLog, HttpServletResponse response)
     {
         List<SysOperLog> list = operLogService.selectOperLogList(operLog);
-        ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
-        return util.exportExcel(list, "鎿嶄綔鏃ュ織");
+		ExcelUtils.exportExcel(list, "鎿嶄綔鏃ュ織", SysOperLog.class, response);
+//        ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
+//        return util.exportEasyExcel(list, "鎿嶄綔鏃ュ織");
     }
 
     @Log(title = "鎿嶄綔鏃ュ織", businessType = BusinessType.DELETE)
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java
index 03e5d26..8b14c36 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java
@@ -1,12 +1,13 @@
 package com.ruoyi.system.domain;
 
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.common.annotation.Excel;
-import com.ruoyi.common.annotation.Excel.ColumnType;
+import com.ruoyi.common.annotation.ExcelDictFormat;
+import com.ruoyi.common.convert.ExcelDictConvert;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
@@ -26,26 +27,31 @@
 @NoArgsConstructor
 @Accessors(chain = true)
 @TableName("sys_oper_log")
+@ExcelIgnoreUnannotated
+//@ColumnWidth(16)
+//@HeadRowHeight(14)
+//@HeadFontStyle(fontHeightInPoints = 11)
 public class SysOperLog implements Serializable {
     private static final long serialVersionUID = 1L;
 
     /**
      * 鏃ュ織涓婚敭
      */
-    @Excel(name = "鎿嶄綔搴忓彿", cellType = ColumnType.NUMERIC)
+    @ExcelProperty(value = "鎿嶄綔搴忓彿")
     @TableId(value = "oper_id", type = IdType.AUTO)
     private Long operId;
 
     /**
      * 鎿嶄綔妯″潡
      */
-    @Excel(name = "鎿嶄綔妯″潡")
+    @ExcelProperty(value = "鎿嶄綔妯″潡")
     private String title;
 
     /**
      * 涓氬姟绫诲瀷锛�0鍏跺畠 1鏂板 2淇敼 3鍒犻櫎锛�
      */
-    @Excel(name = "涓氬姟绫诲瀷", readConverterExp = "0=鍏跺畠,1=鏂板,2=淇敼,3=鍒犻櫎,4=鎺堟潈,5=瀵煎嚭,6=瀵煎叆,7=寮洪��,8=鐢熸垚浠g爜,9=娓呯┖鏁版嵁")
+    @ExcelProperty(value = "涓氬姟绫诲瀷", converter = ExcelDictConvert.class)
+	@ExcelDictFormat(dictType = "sys_oper_type")
     private Integer businessType;
 
     /**
@@ -57,80 +63,81 @@
     /**
      * 璇锋眰鏂规硶
      */
-    @Excel(name = "璇锋眰鏂规硶")
+    @ExcelProperty(value = "璇锋眰鏂规硶")
     private String method;
 
     /**
      * 璇锋眰鏂瑰紡
      */
-    @Excel(name = "璇锋眰鏂瑰紡")
+    @ExcelProperty(value = "璇锋眰鏂瑰紡")
     private String requestMethod;
 
     /**
      * 鎿嶄綔绫诲埆锛�0鍏跺畠 1鍚庡彴鐢ㄦ埛 2鎵嬫満绔敤鎴凤級
      */
-    @Excel(name = "鎿嶄綔绫诲埆", readConverterExp = "0=鍏跺畠,1=鍚庡彴鐢ㄦ埛,2=鎵嬫満绔敤鎴�")
+    @ExcelProperty(value = "鎿嶄綔绫诲埆", converter = ExcelDictConvert.class)
+	@ExcelDictFormat(readConverterExp = "0=鍏跺畠,1=鍚庡彴鐢ㄦ埛,2=鎵嬫満绔敤鎴�")
     private Integer operatorType;
 
     /**
      * 鎿嶄綔浜哄憳
      */
-    @Excel(name = "鎿嶄綔浜哄憳")
+    @ExcelProperty(value = "鎿嶄綔浜哄憳")
     private String operName;
 
     /**
      * 閮ㄩ棬鍚嶇О
      */
-    @Excel(name = "閮ㄩ棬鍚嶇О")
+    @ExcelProperty(value = "閮ㄩ棬鍚嶇О")
     private String deptName;
 
     /**
      * 璇锋眰url
      */
-    @Excel(name = "璇锋眰鍦板潃")
+    @ExcelProperty(value = "璇锋眰鍦板潃")
     private String operUrl;
 
     /**
      * 鎿嶄綔鍦板潃
      */
-    @Excel(name = "鎿嶄綔鍦板潃")
+    @ExcelProperty(value = "鎿嶄綔鍦板潃")
     private String operIp;
 
     /**
      * 鎿嶄綔鍦扮偣
      */
-    @Excel(name = "鎿嶄綔鍦扮偣")
+    @ExcelProperty(value = "鎿嶄綔鍦扮偣")
     private String operLocation;
 
     /**
      * 璇锋眰鍙傛暟
      */
-    @Excel(name = "璇锋眰鍙傛暟")
+    @ExcelProperty(value = "璇锋眰鍙傛暟")
     private String operParam;
 
     /**
      * 杩斿洖鍙傛暟
      */
-    @Excel(name = "杩斿洖鍙傛暟")
+    @ExcelProperty(value = "杩斿洖鍙傛暟")
     private String jsonResult;
 
     /**
      * 鎿嶄綔鐘舵�侊紙0姝e父 1寮傚父锛�
      */
-    @Excel(name = "鐘舵��", readConverterExp = "0=姝e父,1=寮傚父")
+    @ExcelProperty(value = "鐘舵��", converter = ExcelDictConvert.class)
+	@ExcelDictFormat(dictType = "sys_common_status")
     private Integer status;
 
     /**
      * 閿欒娑堟伅
      */
-    @Excel(name = "閿欒娑堟伅")
+    @ExcelProperty(value = "閿欒娑堟伅")
     private String errorMsg;
 
     /**
      * 鎿嶄綔鏃堕棿
      */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @Excel(name = "鎿嶄綔鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    @ExcelProperty(value = "鎿嶄綔鏃堕棿")
     private Date operTime;
 
     /**
diff --git a/ruoyi-ui/src/views/monitor/operlog/index.vue b/ruoyi-ui/src/views/monitor/operlog/index.vue
index ff6c798..08f3d43 100644
--- a/ruoyi-ui/src/views/monitor/operlog/index.vue
+++ b/ruoyi-ui/src/views/monitor/operlog/index.vue
@@ -189,6 +189,7 @@
 
 <script>
 import { list, delOperlog, cleanOperlog, exportOperlog } from "@/api/monitor/operlog";
+import { downLoadExcel } from "@/utils/zipdownload";
 
 export default {
   name: "Operlog",
@@ -316,18 +317,7 @@
     },
     /** 瀵煎嚭鎸夐挳鎿嶄綔 */
     handleExport() {
-      const queryParams = this.queryParams;
-      this.$confirm('鏄惁纭瀵煎嚭鎵�鏈夋搷浣滄棩蹇楁暟鎹」?', "璀﹀憡", {
-          confirmButtonText: "纭畾",
-          cancelButtonText: "鍙栨秷",
-          type: "warning"
-        }).then(() => {
-          this.exportLoading = true;
-          return exportOperlog(queryParams);
-        }).then(response => {
-          this.download(response.msg);
-          this.exportLoading = false;
-        }).catch(() => {});
+      downLoadExcel('/monitor/operlog/export', this.queryParams);
     }
   }
 };
diff --git a/ruoyi-ui/src/views/system/oss/index.vue b/ruoyi-ui/src/views/system/oss/index.vue
index 1171cc9..724a6cc 100644
--- a/ruoyi-ui/src/views/system/oss/index.vue
+++ b/ruoyi-ui/src/views/system/oss/index.vue
@@ -170,9 +170,7 @@
 
 <script>
 import { listOss, delOss } from "@/api/system/oss";
-import { downLoadOss } from "@/utils/ossdownload";
-import { updateConfig } from "@/api/system/config";
-
+import { downLoadOss } from "@/utils/zipdownload";
 
 export default {
   name: "Oss",

--
Gitblit v1.9.3