diff --git a/.lightly/settings.toml b/.lightly/settings.toml
new file mode 100644
index 0000000..0445325
--- /dev/null
+++ b/.lightly/settings.toml
@@ -0,0 +1,6 @@
+ports = []
+[languages.java]
+language = "java"
+src_folder = "src/main/java/"
+
+[languages.java.run]
diff --git a/JavaProject/.lightly/settings.toml b/JavaProject/.lightly/settings.toml
new file mode 100644
index 0000000..0445325
--- /dev/null
+++ b/JavaProject/.lightly/settings.toml
@@ -0,0 +1,6 @@
+ports = []
+[languages.java]
+language = "java"
+src_folder = "src/main/java/"
+
+[languages.java.run]
diff --git a/JavaProject/pom.xml b/JavaProject/pom.xml
new file mode 100644
index 0000000..7e3c7d4
--- /dev/null
+++ b/JavaProject/pom.xml
@@ -0,0 +1,69 @@
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.2.1.RELEASE
+
+
+ com.example
+ JavaProject
+ 1.0.0-SNAPSHOT
+ SpringBootProject
+ Demo project for Spring Boot
+
+ 11
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+ org.apache.poi
+ poi
+ 3.17
+
+
+ org.apache.poi
+ poi-ooxml
+ 3.17
+
+
+ org.apache.poi
+ poi-scratchpad
+ 3.17
+
+
+
+ io.springfox
+ springfox-swagger2
+ 2.8.0
+
+
+ io.springfox
+ springfox-swagger-ui
+ 2.8.0
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/JavaProject/src/main/java/com/example/demo/Application.java b/JavaProject/src/main/java/com/example/demo/Application.java
new file mode 100644
index 0000000..9b21b25
--- /dev/null
+++ b/JavaProject/src/main/java/com/example/demo/Application.java
@@ -0,0 +1,13 @@
+package com.example.demo;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+}
diff --git a/JavaProject/src/main/java/com/example/demo/controller/ExcelConvertHtml.java b/JavaProject/src/main/java/com/example/demo/controller/ExcelConvertHtml.java
new file mode 100644
index 0000000..df299c5
--- /dev/null
+++ b/JavaProject/src/main/java/com/example/demo/controller/ExcelConvertHtml.java
@@ -0,0 +1,98 @@
+package com.example.demo.controller;
+
+public class ExcelConvertHtml {
+
+ public String static resolveExcel(MultipartFile file) throws Exception {
+ try {
+ File toFile = null;
+ if (file.equals("") || file.getSIze() <= 0) {
+ file = null;
+ } else {
+ InputStream ins = null;
+ ins = file.getInputStream():
+ toFile = new File(file.getOriginalFilename());
+ inputStreamToFile(ins, toFile);
+ ins.close();
+ }
+ // 获取数据
+ FileInputStream input = new FileInputStream(toFile);
+ Workbook workbook = new XSSFWorkbook(input);
+ Sheet sheet = workbook.getSheetAt(0);
+ // create html table
+ Element table = new Element(Tag.valueOf("table"), "");
+ table.attr("border", "1");
+ table.attr("cellspacing", "0");
+ table.attr("cellpadding", "0");
+ // Add column widths
+ Element colgroup = new Element(Tag.valueOf("colgroup"), "");
+ for (int i = 0; i < sheet.getRow(0).getLastCellNum(); i++) {
+ Element col = new Element(Tag.valueOf("col"), "");
+ col.attr("width", "150px");// set column width
+ colgroup.appendChild(col);
+ }
+ table.appendChild(colgroup);
+
+ // Add header row
+ Element thead = new Element(Tag.valueOf("thread"), "");
+ Element tr = new Element(Tag.valueOf("tr"), "");
+ tr.attr("bgcolor", "#CCCCCC");
+ for (int i = 0; i < 2; i++) {
+ Cell cell = sheet.getRow(0).getCell(i);
+ String value = cell.getStringCellValue();
+ Element th = new Element(Tag.valueOf("th"), "");
+ th.text(value);
+ if (i == 0) {
+ // Merge first two columns
+ th.attr("colspan", "2");
+ }
+ tr.appendChild(th);
+ }
+ for (int i = 2; i < sheet,getRow(0).getLastCellNum();
+ i++){
+ Cell cell = sheet.getRow(0).getCell(i);
+ String value = cell.getStringCellValue();
+ Element th = new Element(Tag.valueOf("th"), "");
+ th.text(value);
+ tr.appendChild(th);
+ }
+ thread.appendChild(tr);
+ table.appendChild(thread);
+
+ // Add data rows
+ Element tbody = new Element(Tag.valueOf("tbody"), "");
+ // for (int i = 1; i <= sheet.getLastRowNum(); i++) {
+ // Element trData
+ // }
+ for (int i = 1; i <= sheet.getLastRowNum(); i++) {
+ Element trData = new Element(Tag.valueOf("tr"), "");
+ for (int j = 0; j < sheet.getRow(i).getLastCellNum(); j++) {
+ Cell cell = sheet.getRow(i).getCell(j);
+ String value = "";
+ if (cell.getCellType() == CellType.NUMERIC) {
+ value = String.valueOf(cell.getNumericCellValue());
+ } else {
+ value = cell.getStringCellValue();
+ }
+ Element td = new Element(Tag.valueOf("td"), "");
+ td.text(value);
+ if (j < 2) {
+ td.attr("align", "left");
+ }
+ trData.appendChild(td);
+ }
+ tbody.appendChild(trData);
+ }
+ table.appendChild(tbody); // Convert to HTML
+ Document doc = new Document("");
+ doc.appendChild(table);
+ String html = doc.outerHtml();
+ // Write to file
+ FileWriter writer = new FileWriter(new File("output.html"));
+ writer.write(html);
+ writer.close();
+ } catch (Exception ex) {
+ System.out.println(ex.getMessage());
+ }
+ }
+}
+}
\ No newline at end of file
diff --git a/JavaProject/src/main/java/com/example/demo/controller/HelloController.java b/JavaProject/src/main/java/com/example/demo/controller/HelloController.java
new file mode 100644
index 0000000..5ba8c5f
--- /dev/null
+++ b/JavaProject/src/main/java/com/example/demo/controller/HelloController.java
@@ -0,0 +1,14 @@
+package com.example.demo.controller;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Controller
+@RestMapping
+public class HelloController {
+
+ @GetMapping(value = "/")
+ public String index() {
+ return "Hello World!";
+ }
+}
diff --git a/JavaProject/src/main/resources/application.properties b/JavaProject/src/main/resources/application.properties
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/JavaProject/src/main/resources/application.properties
@@ -0,0 +1 @@
+
diff --git a/JavaProject/src/test/java/com/example/demo/ApplicationTests.java b/JavaProject/src/test/java/com/example/demo/ApplicationTests.java
new file mode 100644
index 0000000..70a27d2
--- /dev/null
+++ b/JavaProject/src/test/java/com/example/demo/ApplicationTests.java
@@ -0,0 +1,13 @@
+package com.example.demo;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class ApplicationTests {
+
+ @Test
+ void contextLoads() {
+ }
+
+}
diff --git a/output.html b/output.html
new file mode 100644
index 0000000..9a615d0
--- /dev/null
+++ b/output.html
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 主机名 |
+ 管理IP |
+ 数据IP |
+ 所在资源池 |
+ 操作系统 |
+ 设备编码 |
+ 所在楼宇 |
+ 机房 |
+ 机架 |
+ 机位 |
+ 设备序列号 |
+ 配置信息 |
+ CPU型号 |
+ 内存型号 |
+ 内存数 |
+ vcore数 |
+ 磁盘容量 |
+ 磁盘详细信息 |
+ 主机描述 |
+
+
+
+
+ hostname1 |
+ 127.0.0.1 |
+ 10.10.10.1 |
+ 第一资源池 |
+ CentOS |
+ A01-01-101-1A01 |
+ A01 |
+ 1 |
+ 101 |
+ 1A01 |
+ 123456789 |
+ 1*1C/1GB/1*1GSSD/1*1TBSATA |
+ 型号1 |
+ 型号1 |
+ 1GB |
+ 1 |
+ 1TB |
+ 1*1TB |
+ 模板主机 |
+
+
+ hostname2 |
+ 127.0.0.2 |
+ 10.10.10.2 |
+ 第二资源池 |
+ CentOS |
+ A01-01-101-1A02 |
+ A02 |
+ 1 |
+ 101 |
+ 1A02 |
+ 223456789 |
+ 1*1C/1GB/1*1GSSD/1*1TBSATA |
+ 型号2 |
+ 型号2 |
+ 1GB |
+ 1 |
+ 1TB |
+ 1*1TB |
+ 模板主机 |
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..6b3a96f
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,78 @@
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.2.1.RELEASE
+
+
+ com.example
+ JavaProject
+ 1.0.0-SNAPSHOT
+ SpringBootProject
+ Demo project for Spring Boot
+
+ 8
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+ org.apache.poi
+ poi
+ 3.17
+
+
+ org.apache.poi
+ poi-ooxml
+ 3.17
+
+
+ org.apache.poi
+ poi-scratchpad
+ 3.17
+
+
+
+ io.springfox
+ springfox-swagger2
+ 2.8.0
+
+
+ io.springfox
+ springfox-swagger-ui
+ 2.8.0
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+
+
+ org.jsoup
+ jsoup
+ 1.10.2
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/src/main/java/com/example/demo/Application.java b/src/main/java/com/example/demo/Application.java
new file mode 100644
index 0000000..9b21b25
--- /dev/null
+++ b/src/main/java/com/example/demo/Application.java
@@ -0,0 +1,13 @@
+package com.example.demo;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+}
diff --git a/src/main/java/com/example/demo/CalculatorPrefectNumber.java b/src/main/java/com/example/demo/CalculatorPrefectNumber.java
new file mode 100644
index 0000000..5d44651
--- /dev/null
+++ b/src/main/java/com/example/demo/CalculatorPrefectNumber.java
@@ -0,0 +1,42 @@
+package com.example.demo;
+
+/**
+ * @author shixiang
+ * @date 2025/7/1 14:01
+ */
+public class CalculatorPrefectNumber {
+ public static int countPrefectNumber(int n) {
+ if (n < 6) {
+ return 0;
+ }
+ int count = 0;
+ for (int num = 6; num <= n; num++) {
+ if (isPrefectNumber(num)) {
+ count++;
+ }
+ }
+ return count;
+ }
+
+ private static boolean isPrefectNumber(int num) {
+ if (num < 2) {
+ return false;
+ }
+ int sum = 1;
+ for (int i = 2; i * i <= num; i++) {
+ if (num % i == 0) {
+ sum += i;
+ if (i != num / i) {
+ sum += num / i;
+ }
+ }
+ }
+ return num == sum;
+ }
+
+ public static void main(String[] args) {
+ int i = countPrefectNumber(6);
+ int i1 = countPrefectNumber(28);
+ System.out.println("i=" + i + ",i1=" + i1);
+ }
+}
diff --git a/src/main/java/com/example/demo/LinkedListRemover.java b/src/main/java/com/example/demo/LinkedListRemover.java
new file mode 100644
index 0000000..9e0dfc2
--- /dev/null
+++ b/src/main/java/com/example/demo/LinkedListRemover.java
@@ -0,0 +1,96 @@
+package com.example.demo;
+
+/**
+ * @author shixiang
+ * @date 2025/7/1 13:36
+ */
+
+// 单向链表节点类(使用无参构造)
+class ListNode {
+ int val;
+ ListNode next;
+
+ // 无参构造函数
+ public ListNode() {
+ }
+
+ // 带值的构造函数(可选)
+ public ListNode(int val) {
+ this.val = val;
+ }
+}
+
+public class LinkedListRemover {
+
+ public ListNode removeNthFromEnd(ListNode head, int n) {
+ // 创建虚拟头节点(使用无参构造)
+ ListNode dummy = new ListNode();
+ dummy.next = head; // 指向实际头节点
+
+ // 初始化快慢指针
+ ListNode fast = dummy;
+ ListNode slow = dummy;
+
+ // 快指针先前进n步
+ for (int i = 0; i < n; i++) {
+ fast = fast.next;
+ }
+
+ // 同时移动双指针,直到快指针到达最后一个节点
+ while (fast.next != null) {
+ fast = fast.next;
+ slow = slow.next;
+ }
+
+ // 删除目标节点:跳过要移除的节点
+ slow.next = slow.next.next;
+
+ // 返回新的头节点(虚拟头节点的下一个)
+ return dummy.next;
+ }
+
+ // 辅助方法:打印链表(用于测试)
+ public static void printList(ListNode head) {
+ ListNode current = head;
+ while (current != null) {
+ System.out.print(current.val + " ");
+ current = current.next;
+ }
+ System.out.println();
+ }
+
+ // 测试用例
+ public static void main(String[] args) {
+ // 创建链表 1->2->3->4->5
+ ListNode head = new ListNode();
+ head.val = 1;
+ head.next = new ListNode();
+ head.next.val = 2;
+ head.next.next = new ListNode();
+ head.next.next.val = 3;
+ head.next.next.next = new ListNode();
+ head.next.next.next.val = 4;
+ head.next.next.next.next = new ListNode();
+ head.next.next.next.next.val = 5;
+
+ LinkedListRemover remover = new LinkedListRemover();
+
+ System.out.print("原始链表: ");
+ printList(head); // 输出: 1 2 3 4 5
+
+ // 移除倒数第2个节点(值为4)
+ head = remover.removeNthFromEnd(head, 4);
+ System.out.print("移除后: ");
+ printList(head); // 输出: 1 2 3 5
+
+ // 测试边界情况:移除头节点(倒数第4个)
+ head = remover.removeNthFromEnd(head, 4);
+ System.out.print("移除头节点后: ");
+ printList(head); // 输出: 2 3 5
+
+ // 测试边界情况:移除尾节点(倒数第3个)
+ head = remover.removeNthFromEnd(head, 3);
+ System.out.print("移除尾节点后: ");
+ printList(head); // 输出: 3 5
+ }
+}
diff --git a/src/main/java/com/example/demo/PrefectNumberCalculator.java b/src/main/java/com/example/demo/PrefectNumberCalculator.java
new file mode 100644
index 0000000..4a16e70
--- /dev/null
+++ b/src/main/java/com/example/demo/PrefectNumberCalculator.java
@@ -0,0 +1,44 @@
+package com.example.demo;
+
+/**
+ * @author shixiang
+ * @date 2025/7/1 12:37
+ */
+public class PrefectNumberCalculator {
+ public static int countPerfectNumber(int n) {
+ if (n < 6) {
+ return 0;
+ }
+ int count = 0;
+ for (int num = 6; num <= n; num++) {
+ if (isPerfectNumber(num)) {
+ count++;
+ }
+ }
+ return count;
+ }
+
+ private static boolean isPerfectNumber(int num) {
+ if (num < 2) {
+ return false;
+ }
+ int sum = 1;
+ for (int i = 2; i * i <= num; i++) {
+ if (num % i == 0) {
+ sum += i;
+ if (i != num / i) {
+ sum += num / i;
+ }
+ }
+ }
+ return sum == num;
+
+ }
+
+ public static void main(String[] args) {
+ int i1 = countPerfectNumber(6);
+ int i = countPerfectNumber(28);
+ int i2 = countPerfectNumber(29);
+ System.out.println("i1" + i1 + ",i2=" + i2 + ",i=" + i);
+ }
+}
diff --git a/src/main/java/com/example/demo/RemoveReversePosition.java b/src/main/java/com/example/demo/RemoveReversePosition.java
new file mode 100644
index 0000000..3f12130
--- /dev/null
+++ b/src/main/java/com/example/demo/RemoveReversePosition.java
@@ -0,0 +1,92 @@
+package com.example.demo;
+
+/**
+ * 移除指定倒数位置的单向链表位置
+ *
+ * @author shixiang
+ * @date 2025/7/3 10:26
+ */
+
+public class RemoveReversePosition {
+
+ static class ListNode {
+ int val;
+ ListNode next;
+
+ // 无参构造函数
+ public ListNode() {
+ }
+
+ // 带值的构造函数(可选)
+ public ListNode(int val) {
+ this.val = val;
+ }
+ }
+
+ /**
+ * 具体思路:我们通过快慢指针(双指针方式)做处理即可
+ * 比如1-2-3-4-5 n=2 ==>本质上就是取第4位的节点并删除=》其实就是将1-2-3-5 即找到第三个节点,然后使用current.next= current.next.next;
+ * 其实本质上就是找到倒数n-1的位置,所以假设链表长度为L 那么这个位置就是L-n(比如L等于5,那么n=2,即需要找到第三个的位置即L-n
+ *
+ * @param head
+ * @param n
+ * @return
+ */
+ public static ListNode removeList(ListNode head, int n) {
+ // 定义一个虚拟节点用于关联最初始的链表
+ ListNode dummp = new ListNode();
+ dummp.next = head;
+ ListNode fast = dummp;
+ ListNode slow = dummp;
+ //那么我们先移动fast的位置n个位置 此时fast的后续位置为L-N;
+ for (int i = 0; i < n; i++) {
+ fast = fast.next;
+ }
+ // 所以这个时候我们只需要判断fast.next!=null,然后同时移动fast和slow即可
+ while (fast.next != null) {
+ fast = fast.next;
+ slow = slow.next;
+ }
+ // 此时slow的节点位置在L-N上
+ // 那么只需要去删除slow的下一节点位置即可
+ slow.next = slow.next.next;
+ // 注意这里slow节点与最初始的时候dummp定义的引用地址保持一致。
+ return dummp.next;
+ }
+
+ public static void main(String[] args) {
+ // 1,2,3,4,5 n =2 =>1,2,3,5
+ ListNode test1 = new ListNode(1);
+ test1.next = new ListNode(2);
+ test1.next.next = new ListNode(3);
+ test1.next.next.next = new ListNode(4);
+ test1.next.next.next.next = new ListNode(5);
+ printList(test1);
+ ListNode listNode1 = removeList(test1, 2);
+ printList(listNode1);
+ ListNode test2 = new ListNode(1);
+ test2.next = new ListNode(2);
+ printList(test2);
+ ListNode listNode2 = removeList(test2, 1);
+ printList(listNode2);
+ ListNode test3 = new ListNode(1);
+ printList(test3);
+ ListNode listNode3 = removeList(test3, 1);
+ printList(listNode3);
+ }
+
+ // 辅助方法:打印链表(用于测试)
+ public static void printList(ListNode head) {
+ ListNode current = head;
+ if (current == null) {
+ System.out.print("[]");
+ return;
+ }
+ while (current != null) {
+ System.out.print(current.val + " ");
+ current = current.next;
+ }
+ System.out.println();
+ }
+
+}
diff --git a/src/main/java/com/example/demo/Test.java b/src/main/java/com/example/demo/Test.java
new file mode 100644
index 0000000..55795d0
--- /dev/null
+++ b/src/main/java/com/example/demo/Test.java
@@ -0,0 +1,28 @@
+package com.example.demo;
+
+/**
+ * @author shixiang
+ * @date 2025/7/1 16:04
+ */
+public class Test {
+ // n= 1 1
+ // n = 2 2
+ // n = 3 3
+ // n = 4 5
+ public static int getMethod(int n) {
+ if (n <= 1) {
+ return 1;
+ }
+ if (n == 2) {
+ return 2;
+ }
+ int method = getMethod(n - 1);
+ int method1 = getMethod(n-2);
+ return method+method1;
+ }
+
+ public static void main(String[] args) {
+ int method = getMethod(5);
+
+ }
+}
diff --git a/src/main/java/com/example/demo/TestLinkedListRemover.java b/src/main/java/com/example/demo/TestLinkedListRemover.java
new file mode 100644
index 0000000..12011e1
--- /dev/null
+++ b/src/main/java/com/example/demo/TestLinkedListRemover.java
@@ -0,0 +1,83 @@
+package com.example.demo;
+
+/**
+ * @author shixiang
+ * @date 2025/7/1 13:51
+ */
+public class TestLinkedListRemover {
+ // 单向链表节点类(使用无参构造)
+ static class ListNode {
+ int val;
+ ListNode next;
+
+ // 无参构造函数
+ public ListNode() {
+ }
+
+ // 带值的构造函数(可选)
+ public ListNode(int val) {
+ this.val = val;
+ }
+ }
+
+ public static void main(String[] args) {
+ // 创建链表 1->2->3->4->5
+ ListNode head = new ListNode();
+ head.val = 1;
+ head.next = new ListNode();
+ head.next.val = 2;
+ head.next.next = new ListNode();
+ head.next.next.val = 3;
+ head.next.next.next = new ListNode();
+ head.next.next.next.val = 4;
+ head.next.next.next.next = new ListNode();
+ head.next.next.next.next.val = 5;
+
+ System.out.print("原始链表: ");
+ printList(head); // 输出: 1 2 3 4 5
+ ListNode listNode = removeList(head, 2);
+ System.out.print("移除指定位置: ");
+ printList(listNode); // 输出: 1 2 3 4 5
+
+ ListNode head1 = new ListNode();
+ head1.val = 1;
+ head1.next = new ListNode();
+ head1.next.val = 2;
+ ListNode listNode1 = removeList(head1, 1);
+ System.out.print("移除指定位置: ");
+ printList(listNode1);
+
+ }
+
+ // 辅助方法:打印链表(用于测试)
+ public static void printList(ListNode head) {
+ ListNode current = head;
+ while (current != null) {
+ System.out.print(current.val + " ");
+ current = current.next;
+ }
+ System.out.println();
+ }
+
+ public static ListNode removeList(ListNode node, int n) {
+ ListNode dumpNode = new ListNode();
+ dumpNode.next = node;
+ ListNode fast = dumpNode;
+ ListNode slow = dumpNode;
+
+ // 先移动n步
+ for (int i = 0; i < n; i++) {
+ fast = fast.next;
+ }
+ // 这里移动慢指针L-n步骤
+ while (fast.next != null) {
+ fast = fast.next;
+ slow = slow.next;
+ }
+ slow.next = slow.next.next;
+ return dumpNode.next;
+ }
+
+}
+
+
diff --git a/src/main/java/com/example/demo/controller/ExcelConvertHtml.java b/src/main/java/com/example/demo/controller/ExcelConvertHtml.java
new file mode 100644
index 0000000..c3014d5
--- /dev/null
+++ b/src/main/java/com/example/demo/controller/ExcelConvertHtml.java
@@ -0,0 +1,113 @@
+//package com.example.demo.controller;
+//
+//import org.apache.poi.ss.usermodel.Cell;
+//import org.apache.poi.ss.usermodel.CellType;
+//import org.apache.poi.ss.usermodel.Sheet;
+//import org.apache.poi.ss.usermodel.Workbook;
+//import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+//import org.jsoup.*;
+//import org.jsoup.nodes.*;
+//import org.jsoup.parser.*;
+//import org.jsoup.select.*;
+//import org.springframework.web.multipart.MultipartFile;
+//
+//import java.io.File;
+//import java.io.FileInputStream;
+//import java.io.FileWriter;
+//import java.io.InputStream;
+//
+//public class ExcelConvertHtml {
+//
+// public String static resolveExcel(MultipartFile file) throws Exception {
+// try {
+// File toFile = null;
+// if (file.equals("") || file.getSize() <= 0) {
+// file = null;
+// } else {
+// InputStream ins = null;
+// ins = file.getInputStream();
+// toFile = new File(file.getOriginalFilename());
+// inputStreamToFile(ins, toFile);
+// ins.close();
+// }
+// // 获取数据
+// FileInputStream input = new FileInputStream(toFile);
+// Workbook workbook = new XSSFWorkbook(input);
+// Sheet sheet = workbook.getSheetAt(0);
+// // create html table
+// Element table = new Element(Tag.valueOf("table"), "");
+// table.attr("border", "1");
+// table.attr("cellspacing", "0");
+// table.attr("cellpadding", "0");
+// // Add column widths
+// Element colgroup = new Element(Tag.valueOf("colgroup"), "");
+// for (int i = 0; i < sheet.getRow(0).getLastCellNum(); i++) {
+// Element col = new Element(Tag.valueOf("col"), "");
+// col.attr("width", "150px");// set column width
+// colgroup.appendChild(col);
+// }
+// table.appendChild(colgroup);
+//
+// // Add header row
+// Element thead = new Element(Tag.valueOf("thread"), "");
+// Element tr = new Element(Tag.valueOf("tr"), "");
+// tr.attr("bgcolor", "#CCCCCC");
+// for (int i = 0; i < 2; i++) {
+// Cell cell = sheet.getRow(0).getCell(i);
+// String value = cell.getStringCellValue();
+// Element th = new Element(Tag.valueOf("th"), "");
+// th.text(value);
+// if (i == 0) {
+// // Merge first two columns
+// th.attr("colspan", "2");
+// }
+// tr.appendChild(th);
+// }
+// for (int i = 2; i < sheet.getRow(0).getLastCellNum(); i++) {
+// Cell cell = sheet.getRow(0).getCell(i);
+// String value = cell.getStringCellValue();
+// Element th = new Element(Tag.valueOf("th"), "");
+// th.text(value);
+// tr.appendChild(th);
+// }
+// thread.appendChild(tr);
+// table.appendChild(thread);
+//
+// // Add data rows
+// Element tbody = new Element(Tag.valueOf("tbody"), "");
+// // for (int i = 1; i <= sheet.getLastRowNum(); i++) {
+// // Element trData
+// // }
+// for (int i = 1; i <= sheet.getLastRowNum(); i++) {
+// Element trData = new Element(Tag.valueOf("tr"), "");
+// for (int j = 0; j < sheet.getRow(i).getLastCellNum(); j++) {
+// Cell cell = sheet.getRow(i).getCell(j);
+// String value = "";
+// if (cell.getCellType() == CellType.NUMERIC) {
+// value = String.valueOf(cell.getNumericCellValue());
+// } else {
+// value = cell.getStringCellValue();
+// }
+// Element td = new Element(Tag.valueOf("td"), "");
+// td.text(value);
+// if (j < 2) {
+// td.attr("align", "left");
+// }
+// trData.appendChild(td);
+// }
+// tbody.appendChild(trData);
+// }
+// table.appendChild(tbody); // Convert to HTML
+// Document doc = new Document("");
+// doc.appendChild(table);
+// String html = doc.outerHtml();
+// // Write to file
+// FileWriter writer = new FileWriter(new File("output.html"));
+// writer.write(html);
+// writer.close();
+// } catch (Exception ex) {
+// System.out.println(ex.getMessage());
+// }
+// }
+//}
+//}
\ No newline at end of file
diff --git a/src/main/java/com/example/demo/controller/HelloController.java b/src/main/java/com/example/demo/controller/HelloController.java
new file mode 100644
index 0000000..302211b
--- /dev/null
+++ b/src/main/java/com/example/demo/controller/HelloController.java
@@ -0,0 +1,16 @@
+package com.example.demo.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Controller
+@RequestMapping
+public class HelloController {
+
+ @GetMapping(value = "/")
+ public String index() {
+ return "Hello World!";
+ }
+}
diff --git a/src/main/java/com/example/demo/service/ExcelToHtmlConverter.java b/src/main/java/com/example/demo/service/ExcelToHtmlConverter.java
new file mode 100644
index 0000000..925aa3c
--- /dev/null
+++ b/src/main/java/com/example/demo/service/ExcelToHtmlConverter.java
@@ -0,0 +1,95 @@
+package com.example.demo.service;
+
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellType;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.jsoup.parser.Tag;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+
+
+public class ExcelToHtmlConverter {
+ public static void main(String[] args) {
+ try {
+ // C:\\Users\\Lenovo\\Desktop\\1
+ FileInputStream input = new FileInputStream(new File("D:\\uploads\\input.xlsx"));
+ Workbook workbook = new XSSFWorkbook(input);
+ Sheet sheet = workbook.getSheetAt(0);
+ // Create HTML table
+ Element table = new Element(Tag.valueOf("table"), "");
+ table.attr("border", "1");
+ table.attr("cellspacing", "0");
+ table.attr("cellpadding", "10");
+ // Add column widths
+ Element colgroup = new Element(Tag.valueOf("colgroup"), "");
+ for (int i = 0; i < sheet.getRow(0).getLastCellNum(); i++) {
+ Element col = new Element(Tag.valueOf("col"), "");
+ // Set column width
+ col.attr("width", "100px");
+ colgroup.appendChild(col);
+ }
+ table.appendChild(colgroup);
+ // Add header row
+ Element thead = new Element(Tag.valueOf("thead"), "");
+ Element tr = new Element(Tag.valueOf("tr"), "");
+ tr.attr("bgcolor", "#CCCCCC"); // Set background color
+ for (int i = 0; i < 2; i++) {
+ Cell cell = sheet.getRow(0).getCell(i);
+ String value = cell.getStringCellValue();
+ Element th = new Element(Tag.valueOf("th"), "");
+ th.text(value);
+ if (i == 0) {
+ th.attr("colspan", "2"); // Merge first two columns
+ }
+ tr.appendChild(th);
+ }
+ for (int i = 2; i < sheet.getRow(0).getLastCellNum(); i++) {
+ Cell cell = sheet.getRow(0).getCell(i);
+ String value = cell.getStringCellValue();
+ Element th = new Element(Tag.valueOf("th"), "");
+ th.text(value);
+ tr.appendChild(th);
+ }
+ thead.appendChild(tr);
+ table.appendChild(thead);
+ // Add data rows
+ Element tbody = new Element(Tag.valueOf("tbody"), "");
+ for (int i = 1; i <= sheet.getLastRowNum(); i++) {
+ Element trData = new Element(Tag.valueOf("tr"), "");
+ for (int j = 0; j < sheet.getRow(i).getLastCellNum(); j++) {
+ Cell cell = sheet.getRow(i).getCell(j);
+ String value = "";
+ if (cell.getCellTypeEnum() == CellType.NUMERIC) {
+ value = String.valueOf(cell.getNumericCellValue());
+ } else {
+ value = cell.getStringCellValue();
+ }
+ Element td = new Element(Tag.valueOf("td"), "");
+ td.text(value);
+ if (j < 2) {
+ td.attr("align", "left");
+ }
+ trData.appendChild(td);
+ }
+ tbody.appendChild(trData);
+ }
+ table.appendChild(tbody);
+ // Convert to HTML
+ Document doc = new Document("");
+ doc.appendChild(table);
+ String html = doc.outerHtml();
+ // Write to file
+ FileWriter writer = new FileWriter(new File("D:\\uploads\\output.html"));
+ writer.write(html);
+ writer.close();
+ } catch (Exception ex) {
+ System.out.println(ex.getMessage());
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/demo/service/input.xlsx b/src/main/java/com/example/demo/service/input.xlsx
new file mode 100644
index 0000000..c4c4a08
Binary files /dev/null and b/src/main/java/com/example/demo/service/input.xlsx differ
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/src/main/resources/application.properties
@@ -0,0 +1 @@
+
diff --git a/src/test/java/com/example/demo/ApplicationTests.java b/src/test/java/com/example/demo/ApplicationTests.java
new file mode 100644
index 0000000..70a27d2
--- /dev/null
+++ b/src/test/java/com/example/demo/ApplicationTests.java
@@ -0,0 +1,13 @@
+package com.example.demo;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+class ApplicationTests {
+
+ @Test
+ void contextLoads() {
+ }
+
+}