diff --git a/pom.xml b/pom.xml
index d050202362e2fb910083589d8e689a8656907145..af40b07591961ecd9df3f18452c064148c55f9cb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -244,6 +244,11 @@
gson
2.10.1
+
+ org.apache.poi
+ poi
+ 4.1.2
+
diff --git a/src/main/java/com/kwan/springbootkwan/controller/ExcelController.java b/src/main/java/com/kwan/springbootkwan/controller/ExcelController.java
new file mode 100644
index 0000000000000000000000000000000000000000..ebb3f1d5baa9f4413219a2cad66c313b9346c6f4
--- /dev/null
+++ b/src/main/java/com/kwan/springbootkwan/controller/ExcelController.java
@@ -0,0 +1,37 @@
+package com.kwan.springbootkwan.controller;
+
+import com.kwan.springbootkwan.entity.Result;
+import com.kwan.springbootkwan.service.IExcelService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+
+/**
+ * excel测试信息
+ *
+ * @author : qinyingjie
+ * @version : 2.2.0
+ * @date : 2023/11/17 09:04
+ */
+@Slf4j
+@Api(value = "excel测试信息", tags = "ExcelController")
+@RestController
+@RequestMapping("/test")
+public class ExcelController {
+
+ @Resource
+ private IExcelService excelService;
+
+ @ApiOperation(value = "下载excel", notes = "下载excel")
+ @GetMapping("/downloadExcel")
+ public Result downloadExcel() {
+// excelService.downloadExcel();
+ return Result.ok();
+ }
+}
diff --git a/src/main/java/com/kwan/springbootkwan/service/IExcelService.java b/src/main/java/com/kwan/springbootkwan/service/IExcelService.java
new file mode 100644
index 0000000000000000000000000000000000000000..b872fd6bdf55a41a9d0fcf62645f9f4a796f6d05
--- /dev/null
+++ b/src/main/java/com/kwan/springbootkwan/service/IExcelService.java
@@ -0,0 +1,9 @@
+package com.kwan.springbootkwan.service;
+
+public interface IExcelService {
+
+
+
+
+
+}
diff --git a/src/main/java/com/kwan/springbootkwan/service/impl/IExcelServiceImpl.java b/src/main/java/com/kwan/springbootkwan/service/impl/IExcelServiceImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..da2e4e457acb262154790c9e25d747dd5aa95476
--- /dev/null
+++ b/src/main/java/com/kwan/springbootkwan/service/impl/IExcelServiceImpl.java
@@ -0,0 +1,8 @@
+package com.kwan.springbootkwan.service.impl;
+
+import com.kwan.springbootkwan.service.IExcelService;
+import org.springframework.stereotype.Service;
+
+@Service
+public class IExcelServiceImpl implements IExcelService {
+}
diff --git a/src/main/java/com/kwan/springbootkwan/utils/ExcelWriter.java b/src/main/java/com/kwan/springbootkwan/utils/ExcelWriter.java
new file mode 100644
index 0000000000000000000000000000000000000000..abd89c294f41e646d8dbbd9a580bbeaee3ca8152
--- /dev/null
+++ b/src/main/java/com/kwan/springbootkwan/utils/ExcelWriter.java
@@ -0,0 +1,76 @@
+package com.kwan.springbootkwan.utils;
+
+import com.kwan.springbootkwan.entity.User;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class ExcelWriter {
+
+ private static List header = Arrays.asList("1");
+
+ public static void writeListToExcel(List dataList, String filePath, String sheetName) {
+ try (Workbook workbook = new XSSFWorkbook()) {
+ Sheet sheet = workbook.createSheet(sheetName);
+
+ // 创建标题行
+ Row headerRow = sheet.createRow(0);
+ for (int i = 0; i < dataList.size(); i++) {
+ Cell cell = headerRow.createCell(i);
+ cell.setCellValue("季节");
+ }
+
+ // 写入数据行
+ int rowNum = 1;
+ for (Object data : dataList) {
+ Row row = sheet.createRow(rowNum++);
+ CellStyle style = workbook.createCellStyle();
+ style.setWrapText(true);
+ Cell cell = row.createCell(0);
+ cell.setCellValue(data.toString());
+ cell.setCellStyle(style);
+ }
+
+ // 将Workbook写入文件
+ try (FileOutputStream fileOut = new FileOutputStream(filePath)) {
+ workbook.write(fileOut);
+ }
+
+ System.out.println("Excel文件成功创建!");
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void main(String[] args) {
+ // 你的数据列表
+ List dataList = new ArrayList<>();
+ User user1 = new User();
+ user1.setId(1);
+ user1.setName("张三");
+ user1.setSex("男");
+ dataList.add(user1);
+ User user2 = new User();
+ user2.setId(2);
+ user2.setName("程满");
+ user2.setSex("女");
+ dataList.add(user2);
+
+ User user3 = new User();
+ user3.setId(3);
+ user3.setName("禹辰");
+ user3.setSex("男");
+ dataList.add(user3);
+ // Excel文件路径和工作表名称
+ String filePath = "/Users/qinyingjie/Downloads/file.xlsx";
+ String sheetName = "Sheet1";
+ // 调用写入Excel的方法
+ writeListToExcel(dataList, filePath, sheetName);
+ }
+}
+
diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml
index edf96981f801fc3f553ce975d92ade86cfcfc5e5..a9050ba8fee8c2487f5064aed214b81f11e2811a 100644
--- a/src/main/resources/application-local.yml
+++ b/src/main/resources/application-local.yml
@@ -15,9 +15,10 @@ spring:
required: true
redis:
database: 0 # Redis数据库索引(默认为0)
- host: 120.79.36.53 #Redis服务器地址
+# host: 43.139.90.182 #Redis服务器地址
+ host: 47.94.110.103 #Redis服务器地址
port: 6379 # Redis服务器连接端口
- password: 123456 # Redis服务器连接密码(默认为空)
+ password: zzk # Redis服务器连接密码(默认为空)
jedis:
pool:
max-active: 200 # 连接池最大连接数(使用负值表示没有限制)
@@ -32,15 +33,15 @@ spring:
kwan-ds:
driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://localhost:3306/kwan?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
- url: jdbc:mysql://120.79.36.53:3306/kwan?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
+ url: jdbc:mysql://43.139.90.182:3306/kwan?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
username: root
# password: 716288qwe
- password: 15671628341Qwe.
+ password: 123456
ali-ds:
driver-class-name: com.mysql.cj.jdbc.Driver
- url: jdbc:mysql://120.79.36.53:3306/kwan?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
+ url: jdbc:mysql://43.139.90.182:3306/kwan?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
username: root
- password: 15671628341Qwe.
+ password: 123456
# jasypt加密的密匙
jasypt:
encryptor: