优化代码

This commit is contained in:
thinkgem
2018-04-12 22:32:06 +08:00
parent 2482343c4e
commit 81fd46f394
4 changed files with 12 additions and 32 deletions

View File

@@ -18,7 +18,6 @@ import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Comment;
@@ -37,11 +36,13 @@ import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jeesite.common.codec.EncodeUtils;
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.utils.excel.annotation.ExcelField;
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.ExcelFields;
/**
* 导出Excel文件导出“XLSX”格式支持大数据量导出 @see org.apache.poi.ss.SpreadsheetVersion
@@ -474,7 +475,7 @@ public class ExcelExport {
// }
} catch (Exception ex) {
log.info("Set cell value ["+row.getRowNum()+","+column+"] error: " + ex.toString());
cell.setCellValue(val.toString());
cell.setCellValue(ObjectUtils.toString(val));
}
return cell;
}

View File

@@ -464,14 +464,14 @@ public class BookMark {
// Get the first node and catch it's reference for return if
// the first child node is a style node (w:rPr).
childNode = parentNode.getFirstChild();
if (childNode.getNodeName().equals("w:rPr")) {
if (childNode != null && childNode.getNodeName().equals("w:rPr")) {
styleNode = childNode;
} else {
// If the first node was not a style node and there are other
// child nodes remaining to be checked, then step through
// the remaining child nodes until either a style node is
// 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)) {
styleNode = childNode;
// Note setting to null here if a style node is

View File

@@ -221,8 +221,12 @@ public class WordExport {
e.printStackTrace();
} finally {
try {
fos.flush();
fos.close();
if (fos != null){
fos.flush();
}
if (fos != null){
fos.close();
}
} catch (IOException e) {
e.printStackTrace();
}

View File

@@ -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);
}
}