|
|
@ -19,11 +19,13 @@ import java.util.List; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
import java.util.Set; |
|
|
import java.util.Set; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
|
import com.hxhq.common.core.annotation.Excel; |
|
|
import com.hxhq.common.core.annotation.Excel; |
|
|
import com.hxhq.common.core.exception.UtilException; |
|
|
import com.hxhq.common.core.exception.UtilException; |
|
|
import com.hxhq.common.core.utils.DateUtils; |
|
|
import com.hxhq.common.core.utils.DateUtils; |
|
|
|
|
|
import com.hxhq.common.core.utils.ServletUtils; |
|
|
import com.hxhq.common.core.utils.StringUtils; |
|
|
import com.hxhq.common.core.utils.StringUtils; |
|
|
import org.apache.commons.lang3.ArrayUtils; |
|
|
import org.apache.commons.lang3.ArrayUtils; |
|
|
import org.apache.commons.lang3.RegExUtils; |
|
|
import org.apache.commons.lang3.RegExUtils; |
|
|
@ -62,6 +64,8 @@ import com.hxhq.common.core.text.Convert; |
|
|
import com.hxhq.common.core.utils.file.FileTypeUtils; |
|
|
import com.hxhq.common.core.utils.file.FileTypeUtils; |
|
|
import com.hxhq.common.core.utils.file.ImageUtils; |
|
|
import com.hxhq.common.core.utils.file.ImageUtils; |
|
|
import com.hxhq.common.core.utils.reflect.ReflectUtils; |
|
|
import com.hxhq.common.core.utils.reflect.ReflectUtils; |
|
|
|
|
|
import org.springframework.web.context.request.RequestContextHolder; |
|
|
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Excel相关处理 |
|
|
* Excel相关处理 |
|
|
@ -255,7 +259,7 @@ public class ExcelUtil |
|
|
if (Collection.class.isAssignableFrom(field.getType())) |
|
|
if (Collection.class.isAssignableFrom(field.getType())) |
|
|
{ |
|
|
{ |
|
|
Cell cell = subRow.createCell(column); |
|
|
Cell cell = subRow.createCell(column); |
|
|
cell.setCellValue(attr.name()); |
|
|
|
|
|
|
|
|
cell.setCellValue(ServletUtils.getRequest().getHeader("lang").equals("zh_CN")?attr.name():attr.nameEn()); |
|
|
cell.setCellStyle(cellStyle); |
|
|
cell.setCellStyle(cellStyle); |
|
|
int subFieldSize = subFieldsMap != null ? subFieldsMap.get(field.getName()).size() : 0; |
|
|
int subFieldSize = subFieldsMap != null ? subFieldsMap.get(field.getName()).size() : 0; |
|
|
if (subFieldSize > 1) |
|
|
if (subFieldSize > 1) |
|
|
@ -268,7 +272,7 @@ public class ExcelUtil |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
Cell cell = subRow.createCell(column++); |
|
|
Cell cell = subRow.createCell(column++); |
|
|
cell.setCellValue(attr.name()); |
|
|
|
|
|
|
|
|
cell.setCellValue(ServletUtils.getRequest().getHeader("lang").equals("zh_CN")?attr.name():attr.nameEn()); |
|
|
cell.setCellStyle(cellStyle); |
|
|
cell.setCellStyle(cellStyle); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -840,7 +844,7 @@ public class ExcelUtil |
|
|
// 创建列 |
|
|
// 创建列 |
|
|
Cell cell = row.createCell(column); |
|
|
Cell cell = row.createCell(column); |
|
|
// 写入列信息 |
|
|
// 写入列信息 |
|
|
cell.setCellValue(attr.name()); |
|
|
|
|
|
|
|
|
cell.setCellValue(ServletUtils.getRequest().getHeader("lang").equals("zh_CN")?attr.name():attr.nameEn()); |
|
|
setDataValidation(attr, row, column); |
|
|
setDataValidation(attr, row, column); |
|
|
cell.setCellStyle(styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor()))); |
|
|
cell.setCellStyle(styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor()))); |
|
|
if (isSubList()) |
|
|
if (isSubList()) |
|
|
|