|
|
@@ -26,9 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.time.LocalDate;
|
|
|
-import java.time.LocalDateTime;
|
|
|
-import java.time.YearMonth;
|
|
|
+import java.time.*;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
@@ -328,13 +326,30 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
|
|
|
for (Map.Entry<String, IncomeAndExpenseVo.IncomeAndExpense> entry : monthSummaryMap.entrySet()) {
|
|
|
IncomeAndExpenseVo vo = new IncomeAndExpenseVo();
|
|
|
vo.setIncomeAndExpense(entry.getValue());
|
|
|
+ String rangeKey = entry.getKey();
|
|
|
// 筛选当前月份的明细记录
|
|
|
List<IncomeAndExpenseVo.IncomeAndExpenseList> monthRecords = allRecords.stream()
|
|
|
.filter(record -> {
|
|
|
- if(StrUtil.isEmpty(entry.getKey())){
|
|
|
+ // 空key,返回所有记录
|
|
|
+ if (StrUtil.isEmpty(rangeKey)) {
|
|
|
return true;
|
|
|
}
|
|
|
- return entry.getKey().equals(record.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM")));
|
|
|
+ // 将毫秒时间戳转为LocalDateTime
|
|
|
+ LocalDateTime createDateTime = record.getCreateTime();
|
|
|
+ String dayStr = createDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
|
|
+
|
|
|
+ // 拆分时间区间标识
|
|
|
+ if (rangeKey.contains("到")) {
|
|
|
+ String[] arr = rangeKey.split("到");
|
|
|
+ String startDay = arr[0];
|
|
|
+ if(arr.length == 1 || StrUtil.isEmpty(arr[1])){
|
|
|
+ return dayStr.equals(startDay);
|
|
|
+ }else{
|
|
|
+ String endDay = arr[1];
|
|
|
+ return dayStr.compareTo(startDay) >= 0 && dayStr.compareTo(endDay) <= 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
})
|
|
|
.filter(action->{
|
|
|
if(StrUtil.isNotEmpty(param.getStatus())){
|