java POI 读写 excel(项目实际需求)

本贴最后更新于 4350 天前,其中的信息可能已经时过境迁

这几天由于工作需要,需要做一个报表比对工具(找出两张报表的差异)。需求如下

1、做一个客户端工具,采用java,可以不用GUI(考虑到,我目前只懂j2ee相关的技术,其实这个需求用python(python版本)来做是最合适的,可是我目前不会,当然后面我会学习下这们语言)

2、两张报表的比队列需要灵活配置,通过配置文件来控制需要比对的列(可以是一列,可以是多列)

3、需要找出表A中有的一条数据,但是表B中没有的。或者表B中有的,表A中没有的。或者表A和表B同时都存在的一条数据,但是里面的某一些字段不一样。

4、两张报表的格式可能不一样,有可能为csv,xls,xlsx。两张报表的列数也是不固定的(这两张报表可以是任意的两张报表)

5、将比对结果再汇总到一张excel中(格式没有要求,我这里默认的是xls)

6、主键可能为复合主键,比对的报表,可能需要一次比对多组报表(由于这个需求,是今天才加上的,所以目前代码还处理这个问题,当然会很快加上)

思路一:

POI1-1

1、采用二维数组为主要的数据结构。因为,报表的列数不确定,所以不能构造对象,采用下标来控制每一列

2、将A表中的第一行的主键,然后搜索表B的主键,如果没搜到记下来,如果搜到了,比较所配置的列看是否相同,如果不同记下来,再反搜,表B中的主键来搜素表A,如果表B中有的,表A中没有的,记下来。

将记下来的数据重组,再导出excel。

效率:两张表都是30多列,52行,大概一秒左右比对完导出到excel中。

思路二

 POI1-2

1、主要采用了循环加map的方式,再比较是否有相等行的时候,直接用,表A的mapA.get(mapB.get("key"))如果数据不为空,说明在表A中有数据和表B匹配,这里的get有效的减少了一次循环。利用了map.get的方法速度更快。其他的。但是主要逻辑,还是如思路相同

接下来贴出,处理这个需求的主要代码。贴出代码的目的,主要是希望各位网友看到后,能够给指点一二,我这代码,肯定还需要优化,重构。或者说换思路。当然你有什么想法,通过评论,或者邮件告诉我。谢谢

ReadCSVExcel方法

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

import au.com.bytecode.opencsv.CSVReader;

import com.qly.report.operate.facade.IReadExcel;

public class ReadCsvImpl implements IReadExcel{
static String qlyStringArr[][] = new String[1000][1000];
static String otherStringArr[][] = new String[1000][1000];
static Map<String,Integer > qlycontent = new HashMap<String,Integer >();
static Map<String,Integer > othercontent = new HashMap<String,Integer >();

@Override public Map&lt;String, Object&gt; readExcel(String path, String flag) { CSVReader reader = null; // 取特定列放到集合 try { InputStream ins = new FileInputStream(new File(path)); InputStreamReader in = new InputStreamReader(ins, &quot;gbk&quot;); reader = new CSVReader(in); int len = reader.readNext().length; String nextline[]; int counter = 0; // 将不同的来源的csv文件分别存放到不同的二维数组中 if (&quot;qly&quot;.equals(flag)) { Map&lt;String, Object&gt; qlyMap = new HashMap&lt;String, Object&gt;(); while ((nextline = reader.readNext()) != null) { for (int i = 0; i &lt; len; i++) { qlyStringArr[counter][i] = nextline[i]; } counter++; } qlycontent.put(&quot;colNum&quot;, len); qlycontent.put(&quot;rowNum&quot;, counter); qlyMap.put(&quot;qlyStringArr&quot;, qlyStringArr); qlyMap.put(&quot;qlycontent&quot;, qlycontent); return qlyMap; } if (&quot;other&quot;.equals(flag)) { Map&lt;String, Object&gt; otherMap = new HashMap&lt;String, Object&gt;(); while ((nextline = reader.readNext()) != null) { for (int i = 0; i &lt; len; i++) { otherStringArr[counter][i] = nextline[i]; } counter++; } othercontent.put(&quot;colNum&quot;, len); othercontent.put(&quot;rowNum&quot;, counter); otherMap.put(&quot;othercontent&quot;, othercontent); otherMap.put(&quot;otherStringArr&quot;, otherStringArr); return otherMap; } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } return null; }

}

ReadXlsExcel 方法

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Map;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import com.qly.report.operate.facade.IReadExcel;
import com.qly.report.util.ReportUtil;

public class ReadXlsImpl implements IReadExcel{

public static HSSFWorkbook wb = null; public static HSSFSheet hssfSheet =null; public static HSSFRow hssfRow = null; public static XSSFWorkbook xb = null; public static XSSFSheet xssfSheet =null; public static XSSFRow xssfRow =null; public static String qlyStringArr[][] = new String[1000][1000]; public static String otherStringArr[][] = new String[1000][1000]; static Map&lt;String,Integer &gt; qlycontent = new HashMap&lt;String,Integer &gt;(); static Map&lt;String,Integer &gt; othercontent = new HashMap&lt;String,Integer &gt;(); @SuppressWarnings({ &quot;deprecation&quot; }) @Override public Map&lt;String ,Object&gt; readExcel(String path, String flag) { int counter = 0; try { InputStream is = new FileInputStream(new File(path)); wb = new HSSFWorkbook(is); hssfSheet = wb.getSheetAt(0); // 得到总行数 int rowNum = hssfSheet.getLastRowNum(); hssfRow = hssfSheet.getRow(1); int colNum = hssfRow.getPhysicalNumberOfCells(); // 正文内容应该从第二行开始,第一行为表头内容 if(&quot;qly&quot;.equals(flag)){ Map&lt;String,Object&gt;qlyMap = new HashMap&lt;String, Object&gt;(); for (int i = 1; i &lt; rowNum; i++) { hssfRow = hssfSheet.getRow(i); counter = 0; while (counter &lt; colNum) { qlyStringArr[i][counter] = get2003StringCellValue( hssfRow.getCell((short)counter)).trim(); counter++; } } qlycontent.put(&quot;colNum&quot;, counter); qlycontent.put(&quot;rowNum&quot;, rowNum); qlyMap.put(&quot;qlyStringArr&quot;, qlyStringArr); qlyMap.put(&quot;qlycontent&quot;, qlycontent); return qlyMap; } if(&quot;other&quot;.equals(flag)){ Map&lt;String,Object&gt;otherMap = new HashMap&lt;String, Object&gt;(); for (int i =1; i &lt; rowNum; i++) { hssfRow = hssfSheet.getRow(i); counter = 0; while (counter &lt; colNum) { otherStringArr[i][counter] = get2003StringCellValue(hssfRow.getCell((short) counter)).trim(); counter++; } } othercontent.put(&quot;colNum&quot;, counter); othercontent.put(&quot;rowNum&quot;, rowNum); otherMap.put(&quot;othercontent&quot;, othercontent); otherMap.put(&quot;otherStringArr&quot;, otherStringArr); return otherMap; } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } private static String get2003StringCellValue(HSSFCell cell) { String strCell = &quot;&quot;; if (null == cell) { return &quot;&quot;; } switch (cell.getCellType()) { case HSSFCell.CELL_TYPE_STRING: strCell = cell.getStringCellValue(); break; case HSSFCell.CELL_TYPE_NUMERIC: //使用DecimalFormat类对科学计数法格式的数字进行格式化 DecimalFormat df = new DecimalFormat(&quot;#&quot;); String str = String.valueOf(cell.getNumericCellValue()); if(ReportUtil.isNumber(str)){ strCell = df.format(cell.getNumericCellValue()); }else{ strCell = str; } break; case HSSFCell.CELL_TYPE_BOOLEAN: strCell = String.valueOf(cell.getBooleanCellValue()); break; case HSSFCell.CELL_TYPE_BLANK: strCell = &quot;&quot;; break; default: strCell = &quot;&quot;; break; } if (strCell.equals(&quot;&quot;) || null == strCell) { return &quot;&quot;; } return strCell; }

}

ReadXlsxExcel方法

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Map;

import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import com.qly.report.operate.facade.IReadExcel;
import com.qly.report.util.ReportUtil;

public class ReadXlsxImpl implements IReadExcel {
public static HSSFWorkbook wb = null;
public static HSSFSheet hssfSheet =null;
public static HSSFRow hssfRow = null;
public static XSSFWorkbook xb = null;
public static XSSFSheet xssfSheet =null;
public static XSSFRow xssfRow =null;
public static String qlyStringArr[][] = new String[1000][1000];
public static String otherStringArr[][] = new String[1000][1000];
static Map<String,Integer > qlycontent = new HashMap<String,Integer >();
static Map<String,Integer > othercontent = new HashMap<String,Integer >();
@Override
public Map<String,Object> readExcel(String path, String flag) {
int counter = 0;
try {
InputStream is = new FileInputStream(new File(path));

xb = new XSSFWorkbook(is); xssfSheet = xb.getSheetAt(0); // 得到总行数 int rowNum = xssfSheet.getLastRowNum(); xssfRow = xssfSheet.getRow(1); int colNum = xssfRow.getPhysicalNumberOfCells(); // 正文内容应该从第二行开始,第一行为表头内容 if(&quot;qly&quot;.equals(flag)){ Map&lt;String,Object&gt;qlyMap = new HashMap&lt;String, Object&gt;(); for (int i = 1; i &lt; rowNum; i++) { xssfRow = xssfSheet.getRow(i); counter = 0; while (counter &lt; colNum) { qlyStringArr[i][counter] = get2007StringCellValue( xssfRow.getCell((short) counter)).trim(); counter++; } } qlycontent.put(&quot;colNum&quot;, counter); qlycontent.put(&quot;rowNum&quot;, rowNum); qlyMap.put(&quot;qlyStringArr&quot;, qlyStringArr); qlyMap.put(&quot;qlycontent&quot;, qlycontent); return qlyMap; } if(&quot;other&quot;.equals(flag)){ Map&lt;String,Object&gt;otherMap = new HashMap&lt;String, Object&gt;(); for (int i = 1; i &lt; rowNum; i++) { xssfRow = xssfSheet.getRow(i); counter = 0; while (counter &lt; colNum) { otherStringArr[i][counter] = get2007StringCellValue( xssfRow.getCell((short) counter)).trim(); counter++; } } othercontent.put(&quot;colNum&quot;, counter); othercontent.put(&quot;rowNum&quot;, rowNum); otherMap.put(&quot;othercontent&quot;, othercontent); otherMap.put(&quot;otherStringArr&quot;, otherStringArr); return otherMap; } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } private static String get2007StringCellValue(XSSFCell cell) { String strCell = &quot;&quot;; if (null == cell) { return &quot;&quot;; } switch (cell.getCellType()) { case XSSFCell.CELL_TYPE_STRING: strCell = cell.getStringCellValue(); break; case XSSFCell.CELL_TYPE_NUMERIC: //使用DecimalFormat类对科学计数法格式的数字进行格式化 DecimalFormat df = new DecimalFormat(&quot;#&quot;); String str = String.valueOf(cell.getNumericCellValue()); if(ReportUtil.isNumber(str)){ strCell = df.format(cell.getNumericCellValue()); }else{ strCell = str; } break; case XSSFCell.CELL_TYPE_BOOLEAN: strCell = String.valueOf(cell.getBooleanCellValue()); break; case XSSFCell.CELL_TYPE_BLANK: strCell = &quot;&quot;; break; default: strCell = &quot;&quot;; break; } if (strCell.equals(&quot;&quot;) || null == strCell) { return &quot;&quot;; } return strCell; }

}

 

 

CompareExcel方法,比较算法在这里

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.qly.report.operate.facade.ICompareExcel;
import com.qly.report.util.ReportUtil;
/**

  • by guop 2013-7-12 上午 9:11:06

  • 比较 excel
    */
    public class CompareExcelImpl implements ICompareExcel{

    @Override
    public Map<String ,Object> compareExcel(String [][] qlyString, String [][] otherString,
    int[] qlycolumn, int[] othercolumn,
    Map<String,Integer> qlycontent, Map<String,Integer> othercontent,
    int qlyflag, int otherflag, int qlystartRow, int otherstartRow,
    String outReportPath) {

    // 761报表的行数 int qlyRowNum = qlycontent.get(&quot;rowNum&quot;); // 761报表的列数 int otherRowNum = othercontent.get(&quot;rowNum&quot;); List&lt;Map&lt;String, Integer&gt;&gt; listErrorStr = new ArrayList&lt;Map&lt;String, Integer&gt;&gt;(); // 在这里比较下,用a表的标记字段扫描b表从1开始,0为表头 for (int i = qlystartRow; i &lt; qlyRowNum; i++) { boolean boolflag = false; boolean boolother = true; Map&lt;String, Integer&gt; errorMap = new HashMap&lt;String, Integer&gt;(); for (int j = otherstartRow; j &lt; otherRowNum; j++) { // 按照配置的标记列,如761中的票号,和腾邦的票号 // 表a中的第一行某字段,遍历表b中的行中的这一字段,看是否相同0 if (ReportUtil.handleSpecialCharacter(qlyString[i][qlyflag].trim()).equals(ReportUtil.handleSpecialCharacter(otherString[j][otherflag].trim()))) { boolother = false; int rowother = j; // 在寻找到b表中,有相同的字段后,比较其他字段是否相同 for (int a1 = 0; a1 &lt; qlycolumn.length;a1++) { if(null == qlyString[i][qlycolumn[a1]] || null == otherString[rowother][othercolumn[a1]]){ break; } // 当a表和b表中的 票面号相同,比较里面的规定的字段的值是否相同 if (!ReportUtil.handleSpecialCharacter(qlyString[i][qlycolumn[a1]].trim()).equals(ReportUtil.handleSpecialCharacter(otherString[rowother][othercolumn[a1]].trim()))) { errorMap.put(&quot;qlylinenumber&quot;, i); errorMap.put(&quot;otherlinenumber&quot;, rowother); listErrorStr.add(errorMap); boolflag = true; break; } } if (boolflag) { break; } } } if (boolother) { errorMap.put(&quot;qlylinenumber&quot;, i); listErrorStr.add(errorMap); } } //用b表扫描a表的某一个字段 // 在这里比较下,用a表的标记字段扫描b表 for (int i = otherstartRow; i &lt; otherRowNum; i++) { boolean boolother = true; Map&lt;String, Integer&gt; errorMap = new HashMap&lt;String, Integer&gt;(); for (int j = qlystartRow; j &lt; qlyRowNum; j++) { // 按照配置的标记列,如761中的票号,和腾邦的票号 // 表a中的第一行某字段,遍历表b中的行中的这一字段,看是否相同0 if (ReportUtil.handleSpecialCharacter(qlyString[j][qlyflag].trim()).equals(ReportUtil.handleSpecialCharacter(otherString[i][otherflag].trim()))) { boolother = false; // 在寻找到b表中,有相同的字段后,比较其他字段是否相同 } } if (boolother) { errorMap.put(&quot;otherlinenumber&quot;, i); listErrorStr.add(errorMap); } } Map&lt;String,Object&gt; compareMap = new HashMap&lt;String, Object&gt;(); compareMap.put(&quot;listErrorStr&quot;, listErrorStr);

    return compareMap;
    }

}

全部代码在这里,github,请多多指教

  • POI
    23 引用 • 21 回帖
  • Excel
    31 引用 • 28 回帖
  • Java

    Java 是一种可以撰写跨平台应用软件的面向对象的程序设计语言,是由 Sun Microsystems 公司于 1995 年 5 月推出的。Java 技术具有卓越的通用性、高效性、平台移植性和安全性。

    3201 引用 • 8217 回帖

相关帖子

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...
  • someone

    老船长这个不是专栏是博客吧。哈哈。专栏不是这个意思吧。

推荐标签 标签

  • 书籍

    宋真宗赵恒曾经说过:“书中自有黄金屋,书中自有颜如玉。”

    83 引用 • 412 回帖
  • JVM

    JVM(Java Virtual Machine)Java 虚拟机是一个微型操作系统,有自己的硬件构架体系,还有相应的指令系统。能够识别 Java 独特的 .class 文件(字节码),能够将这些文件中的信息读取出来,使得 Java 程序只需要生成 Java 虚拟机上的字节码后就能在不同操作系统平台上进行运行。

    180 引用 • 120 回帖 • 3 关注
  • IDEA

    IDEA 全称 IntelliJ IDEA,是一款 Java 语言开发的集成环境,在业界被公认为最好的 Java 开发工具之一。IDEA 是 JetBrains 公司的产品,这家公司总部位于捷克共和国的首都布拉格,开发人员以严谨著称的东欧程序员为主。

    181 引用 • 400 回帖
  • BAE

    百度应用引擎(Baidu App Engine)提供了 PHP、Java、Python 的执行环境,以及云存储、消息服务、云数据库等全面的云服务。它可以让开发者实现自动地部署和管理应用,并且提供动态扩容和负载均衡的运行环境,让开发者不用考虑高成本的运维工作,只需专注于业务逻辑,大大降低了开发者学习和迁移的成本。

    19 引用 • 75 回帖 • 682 关注
  • Gitea

    Gitea 是一个开源社区驱动的轻量级代码托管解决方案,后端采用 Go 编写,采用 MIT 许可证。

    5 引用 • 16 回帖
  • React

    React 是 Facebook 开源的一个用于构建 UI 的 JavaScript 库。

    192 引用 • 291 回帖 • 369 关注
  • OnlyOffice
    4 引用 • 18 关注
  • PHP

    PHP(Hypertext Preprocessor)是一种开源脚本语言。语法吸收了 C 语言、 Java 和 Perl 的特点,主要适用于 Web 开发领域,据说是世界上最好的编程语言。

    167 引用 • 408 回帖 • 486 关注
  • 阿里巴巴

    阿里巴巴网络技术有限公司(简称:阿里巴巴集团)是以曾担任英语教师的马云为首的 18 人,于 1999 年在中国杭州创立,他们相信互联网能够创造公平的竞争环境,让小企业通过创新与科技扩展业务,并在参与国内或全球市场竞争时处于更有利的位置。

    43 引用 • 221 回帖 • 52 关注
  • Google

    Google(Google Inc.,NASDAQ:GOOG)是一家美国上市公司(公有股份公司),于 1998 年 9 月 7 日以私有股份公司的形式创立,设计并管理一个互联网搜索引擎。Google 公司的总部称作“Googleplex”,它位于加利福尼亚山景城。Google 目前被公认为是全球规模最大的搜索引擎,它提供了简单易用的免费服务。不作恶(Don't be evil)是谷歌公司的一项非正式的公司口号。

    49 引用 • 192 回帖 • 1 关注
  • OpenResty

    OpenResty 是一个基于 NGINX 与 Lua 的高性能 Web 平台,其内部集成了大量精良的 Lua 库、第三方模块以及大多数的依赖项。用于方便地搭建能够处理超高并发、扩展性极高的动态 Web 应用、Web 服务和动态网关。

    17 引用 • 53 关注
  • jsDelivr

    jsDelivr 是一个开源的 CDN 服务,可为 npm 包、GitHub 仓库提供免费、快速并且可靠的全球 CDN 加速服务。

    5 引用 • 31 回帖 • 110 关注
  • Markdown

    Markdown 是一种轻量级标记语言,用户可使用纯文本编辑器来排版文档,最终通过 Markdown 引擎将文档转换为所需格式(比如 HTML、PDF 等)。

    172 引用 • 1538 回帖 • 1 关注
  • AWS
    11 引用 • 28 回帖 • 9 关注
  • 博客

    记录并分享人生的经历。

    273 引用 • 2389 回帖
  • WebSocket

    WebSocket 是 HTML5 中定义的一种新协议,它实现了浏览器与服务器之间的全双工通信(full-duplex)。

    48 引用 • 206 回帖 • 280 关注
  • Netty

    Netty 是一个基于 NIO 的客户端-服务器编程框架,使用 Netty 可以让你快速、简单地开发出一个可维护、高性能的网络应用,例如实现了某种协议的客户、服务端应用。

    49 引用 • 33 回帖 • 43 关注
  • Mac

    Mac 是苹果公司自 1984 年起以“Macintosh”开始开发的个人消费型计算机,如:iMac、Mac mini、Macbook Air、Macbook Pro、Macbook、Mac Pro 等计算机。

    167 引用 • 597 回帖 • 4 关注
  • Tomcat

    Tomcat 最早是由 Sun Microsystems 开发的一个 Servlet 容器,在 1999 年被捐献给 ASF(Apache Software Foundation),隶属于 Jakarta 项目,现在已经独立为一个顶级项目。Tomcat 主要实现了 JavaEE 中的 Servlet、JSP 规范,同时也提供 HTTP 服务,是市场上非常流行的 Java Web 容器。

    162 引用 • 529 回帖 • 8 关注
  • 链书

    链书(Chainbook)是 B3log 开源社区提供的区块链纸质书交易平台,通过 B3T 实现共享激励与价值链。可将你的闲置书籍上架到链书,我们共同构建这个全新的交易平台,让闲置书籍继续发挥它的价值。

    链书社

    链书目前已经下线,也许以后还有计划重制上线。

    14 引用 • 257 回帖 • 1 关注
  • SQLite

    SQLite 是一个进程内的库,实现了自给自足的、无服务器的、零配置的、事务性的 SQL 数据库引擎。SQLite 是全世界使用最为广泛的数据库引擎。

    4 引用 • 7 回帖
  • GraphQL

    GraphQL 是一个用于 API 的查询语言,是一个使用基于类型系统来执行查询的服务端运行时(类型系统由你的数据定义)。GraphQL 并没有和任何特定数据库或者存储引擎绑定,而是依靠你现有的代码和数据支撑。

    4 引用 • 3 回帖 • 8 关注
  • Hexo

    Hexo 是一款快速、简洁且高效的博客框架,使用 Node.js 编写。

    22 引用 • 148 回帖 • 9 关注
  • ZeroNet

    ZeroNet 是一个基于比特币加密技术和 BT 网络技术的去中心化的、开放开源的网络和交流系统。

    1 引用 • 21 回帖 • 649 关注
  • ngrok

    ngrok 是一个反向代理,通过在公共的端点和本地运行的 Web 服务器之间建立一个安全的通道。

    7 引用 • 63 回帖 • 656 关注
  • HHKB

    HHKB 是富士通的 Happy Hacking 系列电容键盘。电容键盘即无接点静电电容式键盘(Capacitive Keyboard)。

    5 引用 • 74 回帖 • 519 关注
  • 宕机

    宕机,多指一些网站、游戏、网络应用等服务器一种区别于正常运行的状态,也叫“Down 机”、“当机”或“死机”。宕机状态不仅仅是指服务器“挂掉了”、“死机了”状态,也包括服务器假死、停用、关闭等一些原因而导致出现的不能够正常运行的状态。

    13 引用 • 82 回帖 • 78 关注