mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-06 02:50:13 +08:00
update DateUtils 工具类
This commit is contained in:
@@ -7,6 +7,7 @@ import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.pile.domain.MemberPlateNumberRelation;
|
||||
import com.jsowell.pile.dto.CarVinDTO;
|
||||
import com.jsowell.pile.dto.QueryOrderDTO;
|
||||
@@ -113,9 +114,8 @@ public class TempController extends BaseController {
|
||||
try {
|
||||
String startTime = dto.getStartTime();
|
||||
String endTime = dto.getEndTime();
|
||||
|
||||
List<String> dateList = Lists.newArrayList();
|
||||
|
||||
// 获取日期区间内所有日期
|
||||
List<String> dateList = DateUtils.getAllDatesInTheDateRange(startTime, endTime);
|
||||
|
||||
dto.getStationIdList().parallelStream().forEach(stationId -> {
|
||||
for (String tradeDate : dateList) {
|
||||
|
||||
@@ -153,6 +153,9 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
public static void main(String[] args) throws ParseException {
|
||||
String startDate = "2023-07-01";
|
||||
String endDate = "2023-07-20";
|
||||
LocalDate of = LocalDate.of(2023, 07, 20);
|
||||
System.out.println(of);
|
||||
|
||||
List<String> list = getAllDatesInTheDateRange(startDate, endDate);
|
||||
System.out.println(list);
|
||||
|
||||
@@ -309,14 +312,14 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* localDate转dateStr
|
||||
* localDate转dateStr 直接 .toString()
|
||||
* @param localDate
|
||||
* @return 格式"yyyy-MM-dd"
|
||||
*/
|
||||
public static String localDate2DateStr(LocalDate localDate) {
|
||||
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
return localDate.format(df);
|
||||
}
|
||||
// public static String localDate2DateStr(LocalDate localDate) {
|
||||
// DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
// return localDate.format(df);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Date转LocalDateTime
|
||||
@@ -909,7 +912,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
}
|
||||
List<String> resultList = new ArrayList<>();
|
||||
localDateList.forEach(localDate -> {
|
||||
String dateStr = localDate2DateStr(localDate);
|
||||
String dateStr = localDate.toString();
|
||||
resultList.add(dateStr);
|
||||
});
|
||||
return resultList;
|
||||
|
||||
Reference in New Issue
Block a user