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