优化代码
This commit is contained in:
@@ -18,7 +18,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
import org.apache.poi.ss.usermodel.CellStyle;
|
import org.apache.poi.ss.usermodel.CellStyle;
|
||||||
import org.apache.poi.ss.usermodel.Comment;
|
import org.apache.poi.ss.usermodel.Comment;
|
||||||
@@ -37,11 +36,13 @@ import org.slf4j.LoggerFactory;
|
|||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.jeesite.common.codec.EncodeUtils;
|
import com.jeesite.common.codec.EncodeUtils;
|
||||||
import com.jeesite.common.collect.ListUtils;
|
import com.jeesite.common.collect.ListUtils;
|
||||||
|
import com.jeesite.common.lang.ObjectUtils;
|
||||||
|
import com.jeesite.common.lang.StringUtils;
|
||||||
import com.jeesite.common.reflect.ReflectUtils;
|
import com.jeesite.common.reflect.ReflectUtils;
|
||||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
|
||||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||||
|
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出Excel文件(导出“XLSX”格式,支持大数据量导出 @see org.apache.poi.ss.SpreadsheetVersion)
|
* 导出Excel文件(导出“XLSX”格式,支持大数据量导出 @see org.apache.poi.ss.SpreadsheetVersion)
|
||||||
@@ -474,7 +475,7 @@ public class ExcelExport {
|
|||||||
// }
|
// }
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
log.info("Set cell value ["+row.getRowNum()+","+column+"] error: " + ex.toString());
|
log.info("Set cell value ["+row.getRowNum()+","+column+"] error: " + ex.toString());
|
||||||
cell.setCellValue(val.toString());
|
cell.setCellValue(ObjectUtils.toString(val));
|
||||||
}
|
}
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -464,14 +464,14 @@ public class BookMark {
|
|||||||
// Get the first node and catch it's reference for return if
|
// Get the first node and catch it's reference for return if
|
||||||
// the first child node is a style node (w:rPr).
|
// the first child node is a style node (w:rPr).
|
||||||
childNode = parentNode.getFirstChild();
|
childNode = parentNode.getFirstChild();
|
||||||
if (childNode.getNodeName().equals("w:rPr")) {
|
if (childNode != null && childNode.getNodeName().equals("w:rPr")) {
|
||||||
styleNode = childNode;
|
styleNode = childNode;
|
||||||
} else {
|
} else {
|
||||||
// If the first node was not a style node and there are other
|
// If the first node was not a style node and there are other
|
||||||
// child nodes remaining to be checked, then step through
|
// child nodes remaining to be checked, then step through
|
||||||
// the remaining child nodes until either a style node is
|
// the remaining child nodes until either a style node is
|
||||||
// found or until all child nodes have been processed.
|
// found or until all child nodes have been processed.
|
||||||
while ((childNode = childNode.getNextSibling()) != null) {
|
while (childNode != null && (childNode = childNode.getNextSibling()) != null) {
|
||||||
if (childNode.getNodeName().equals(BookMark.STYLE_NODE_NAME)) {
|
if (childNode.getNodeName().equals(BookMark.STYLE_NODE_NAME)) {
|
||||||
styleNode = childNode;
|
styleNode = childNode;
|
||||||
// Note setting to null here if a style node is
|
// Note setting to null here if a style node is
|
||||||
|
|||||||
@@ -221,8 +221,12 @@ public class WordExport {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
fos.flush();
|
if (fos != null){
|
||||||
fos.close();
|
fos.flush();
|
||||||
|
}
|
||||||
|
if (fos != null){
|
||||||
|
fos.close();
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
package com.jeesite.test;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.jeesite.common.collect.MapUtils;
|
|
||||||
import com.jeesite.common.web.http.HttpClientUtils;
|
|
||||||
|
|
||||||
public class HttpClientTest {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
|
|
||||||
String url = "http://:8080/multData/a/login";
|
|
||||||
|
|
||||||
Map<String, String> map = MapUtils.newHashMap();
|
|
||||||
|
|
||||||
map.put("currentDataSource", "86fecee8d2e04bbe8e6c23dff9338f66");
|
|
||||||
map.put("mobileLogin", "true");
|
|
||||||
map.put("username", "system");
|
|
||||||
map.put("password", "admin");
|
|
||||||
|
|
||||||
String res = HttpClientUtils.ajaxPost(url, map);
|
|
||||||
System.out.println(res);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user