fix(高级检索): excel导出修改单元格最大限制
This commit is contained in:
+21
-7
@@ -18,7 +18,6 @@ import com.jero.common.system.api.ISysBaseAPI;
|
||||
import com.jero.common.system.vo.DictModel;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.BeanCopyUtils;
|
||||
import com.jero.common.util.SnowflakeUtils;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.modules.document.utils.ReadPdfUtil;
|
||||
import com.jero.modules.document.utils.ReadWordUtil;
|
||||
@@ -52,6 +51,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.SpreadsheetVersion;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
@@ -1290,6 +1290,8 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
||||
@Override
|
||||
public ModelAndView advancedSearchExportExcel(Map<String, Object> parameterMap) {
|
||||
String resourceType = String.valueOf(parameterMap.get("resourceType"));
|
||||
// 导出数据前调用
|
||||
initCellMaxTextLength();
|
||||
if (LawsHomeSearchCommon.LAWS_DOMESTIC_STANDARD.equals(resourceType)){
|
||||
// 外来标准法规
|
||||
return exportExcelByDomestic(parameterMap);
|
||||
@@ -1305,6 +1307,24 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化 cell 内容长度
|
||||
* cell 原本内容长度限制 32767 现修改为Integer.MAX_VALUE
|
||||
*/
|
||||
public static void initCellMaxTextLength() {
|
||||
SpreadsheetVersion excel2007 = SpreadsheetVersion.EXCEL2007;
|
||||
if (Integer.MAX_VALUE != excel2007.getMaxTextLength()) {
|
||||
Field field;
|
||||
try {
|
||||
field = excel2007.getClass().getDeclaredField("_maxTextLength");
|
||||
field.setAccessible(true);
|
||||
field.set(excel2007,Integer.MAX_VALUE);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ModelAndView exportExcelByAll(Map<String, Object> parameterMap) {
|
||||
parameterMap.put("pageNo", "1");
|
||||
parameterMap.put("pageSize", "-1");
|
||||
@@ -1900,10 +1920,4 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
||||
log.error("文档库添加es失败",e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
for (int i = 0; i < 14; i++) {
|
||||
System.out.println(SnowflakeUtils.snowflake());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+13
-2
@@ -20,7 +20,7 @@ public class LawsHomeAdvancedSearchExportExcelVO implements Serializable {
|
||||
* 资源类型 1:外来标准法规 3:企业标准
|
||||
*/
|
||||
@ApiModelProperty(value = "资源类型 1:外来标准法规 3:企业标准")
|
||||
@Excel(name = "资源类型", replace = {"外来标准法规_1", "企业标准_3"}, width = 20)
|
||||
// @Excel(name = "资源类型", replace = {"外来标准法规_1", "企业标准_3"}, width = 20)
|
||||
private String resourceType;
|
||||
|
||||
/**
|
||||
@@ -50,7 +50,18 @@ public class LawsHomeAdvancedSearchExportExcelVO implements Serializable {
|
||||
@ApiModelProperty(value = "实施日期")
|
||||
@Excel(name = "实施日期", width = 20, format = "yyyy-MM-dd")
|
||||
private Date implementationDate;
|
||||
|
||||
/**
|
||||
* 在产车实施日期
|
||||
* */
|
||||
@Excel(name = "新认证车实施日期", width = 20, format = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "新认证车实施日期")
|
||||
private java.lang.String newAuthImplDate;
|
||||
/**
|
||||
* 新车型实施日期
|
||||
* */
|
||||
@Excel(name = "新生产车实施日期", width = 20, format = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "新生产车实施日期")
|
||||
private java.lang.String newProductImplDate;
|
||||
/**
|
||||
* 标准状态
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user