升级spring-boot到最新版本2.6.4

pull/161/head
RuoYi 3 years ago
parent df0813089e
commit a30622b460

@ -17,7 +17,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<spring-boot.version>2.6.3</spring-boot.version> <spring-boot.version>2.6.4</spring-boot.version>
<spring-cloud.version>2021.0.1</spring-cloud.version> <spring-cloud.version>2021.0.1</spring-cloud.version>
<spring-cloud-alibaba.version>2021.1</spring-cloud-alibaba.version> <spring-cloud-alibaba.version>2021.1</spring-cloud-alibaba.version>
<alibaba.nacos.version>2.0.4</alibaba.nacos.version> <alibaba.nacos.version>2.0.4</alibaba.nacos.version>

@ -3,7 +3,11 @@ package com.ruoyi.common.core.utils;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.*; import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date; import java.util.Date;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;

@ -284,7 +284,7 @@ public class ExcelUtil<T>
String dateFormat = field.getAnnotation(Excel.class).dateFormat(); String dateFormat = field.getAnnotation(Excel.class).dateFormat();
if (StringUtils.isNotEmpty(dateFormat)) if (StringUtils.isNotEmpty(dateFormat))
{ {
val = this.parseDateToStr(dateFormat, (Date) val); val = parseDateToStr(dateFormat, (Date) val);
} }
else else
{ {
@ -703,7 +703,7 @@ public class ExcelUtil<T>
String separator = attr.separator(); String separator = attr.separator();
if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value)) if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value))
{ {
cell.setCellValue(this.parseDateToStr(dateFormat, (Date) value)); cell.setCellValue(parseDateToStr(dateFormat, (Date) value));
} }
else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value)) else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value))
{ {
@ -1158,25 +1158,33 @@ public class ExcelUtil<T>
} }
/** /**
* ExcelUtiljava8 *
* {@link Date}{@link LocalDateTime} {@link LocalDate} *
* @param dateFormat * @param dateFormat
* @param val * @param val
* @see DateUtils#parseDateToStr(String, Date) * @return
*/ */
private String parseDateToStr(final String dateFormat, Object val) public String parseDateToStr(String dateFormat, Object val)
{ {
if (val == null) { if (val == null)
{
return ""; return "";
} }
String str; String str;
if (val instanceof Date) { if (val instanceof Date)
{
str = DateUtils.parseDateToStr(dateFormat, (Date) val); str = DateUtils.parseDateToStr(dateFormat, (Date) val);
} else if (val instanceof LocalDateTime) { }
else if (val instanceof LocalDateTime)
{
str = DateUtils.parseDateToStr(dateFormat, DateUtils.toDate((LocalDateTime) val)); str = DateUtils.parseDateToStr(dateFormat, DateUtils.toDate((LocalDateTime) val));
} else if (val instanceof LocalDate) { }
else if (val instanceof LocalDate)
{
str = DateUtils.parseDateToStr(dateFormat, DateUtils.toDate((LocalDate) val)); str = DateUtils.parseDateToStr(dateFormat, DateUtils.toDate((LocalDate) val));
} else { }
else
{
str = val.toString(); str = val.toString();
} }
return str; return str;

Loading…
Cancel
Save