fix: 日期和查询日期相关bug

This commit is contained in:
Bunny 2024-11-25 00:43:34 +08:00
parent ec36a45f34
commit 1de5af34de
20 changed files with 342 additions and 44 deletions

View File

@ -7,6 +7,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.time.LocalDate;
@Data
@ -19,6 +20,9 @@ public class BillDto {
@Schema(name = "userId", title = "绑定的用户id")
private Long userId;
@Schema(name = "amount", title = "金额")
private BigDecimal amount;
@Schema(name = "username", title = "类型1 - 收入,-1 - 支出")
private Byte type;

View File

@ -18,6 +18,9 @@ public class ExpendWithIncomeListVo {
@Schema(name = "list", title = "基础列表")
private List<ExpendWithIncome> list;
@Schema(name = "chartList", title = "基础列表")
private List<ExpendWithIncome> chartList;
@Schema(name = "categoryList", title = "分类列表")
private List<CategoryAmount> categoryAmounts;

View File

@ -0,0 +1,24 @@
package cn.bunny.dao.vo.financial.user.home;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Schema(name = "Count对象", title = "计数内容", description = "计数内容")
public class CountTop {
@Schema(name = "type", title = "类型")
private String type;
@Schema(name = "amount", title = "金额")
private BigDecimal amount;
}

View File

@ -0,0 +1,33 @@
package cn.bunny.dao.vo.financial.user.home;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Schema(name = "ExpendWithIncomeVo对象", title = "账单收入和支出", description = "账单收入和支出")
public class HomeExpendWithIncome {
@Schema(name = "amount", title = "金额")
private BigDecimal amount;
@Schema(name = "transactionDate", title = "交易日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime transactionDate;
}

View File

@ -0,0 +1,29 @@
package cn.bunny.dao.vo.financial.user.home;
import cn.bunny.dao.vo.financial.user.expendAndIncome.ExpendWithIncome;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
import java.util.Map;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Schema(name = "ExpendWithIncomeVo对象", title = "首页展示数据", description = "首页展示数据")
public class HomeVo {
@Schema(name = "counts", title = "主页卡片数据")
private Map<String, CountTop> homeCard;
@Schema(name = "homeOverview", title = "分析概览")
private List<ExpendWithIncome> homeOverview;
@Schema(name = "homeRanks", title = "收入和支出排行榜")
private List<ExpendWithIncome> homeRanks;
}

View File

@ -1,9 +1,13 @@
package cn.bunny.services.controller.system;
package cn.bunny.services.controller;
import cn.bunny.dao.pojo.result.Result;
import cn.bunny.dao.vo.financial.user.home.HomeVo;
import cn.bunny.services.service.index.IndexService;
import cn.hutool.captcha.CaptchaUtil;
import cn.hutool.captcha.CircleCaptcha;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
@ -11,18 +15,29 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;
@Tag(name = "访问首页内容", description = "访问首页内容相关接口")
@RestController
@RequestMapping("/")
public class IndexController {
@Autowired
private IndexService indexService;
@Operation(summary = "访问首页", description = "访问首页")
@GetMapping("")
public String index() {
return "欢迎访问 Bunny Java Template欢迎去Giteehttps://gitee.com/BunnyBoss/java_single.git";
}
@Operation(summary = "首页内容展示", description = "首页内容展示")
@GetMapping("admin/noManage/homeDatalist")
public Mono<Result<HomeVo>> homeDatalist() {
HomeVo homeVo = indexService.homeDatalist();
return Mono.just(Result.success(homeVo));
}
@Operation(summary = "生成验证码", description = "生成验证码")
@GetMapping("noAuth/checkCode")
public ResponseEntity<byte[]> checkCode() {

View File

@ -1,9 +1,9 @@
package cn.bunny.services.controller.financial;
import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryAddUserDto;
import cn.bunny.dao.dto.financial.category.CategoryDto;
import cn.bunny.dao.dto.financial.category.admin.CategoryAddDto;
import cn.bunny.dao.dto.financial.category.admin.CategoryUpdateDto;
import cn.bunny.dao.dto.financial.category.user.CategoryUserAddDto;
import cn.bunny.dao.dto.financial.category.user.CategoryUserUpdateDto;
import cn.bunny.dao.entity.financial.Category;
import cn.bunny.dao.pojo.result.PageResult;
@ -81,7 +81,7 @@ public class CategoryController {
@Operation(summary = "用戶分类添加分类信息", description = "用戶分类添加分类信息")
@PostMapping("noManage/addCategoryUser")
public Mono<Result<String>> addCategoryUser(@Valid @RequestBody BudgetCategoryAddUserDto dto) {
public Mono<Result<String>> addCategoryUser(@Valid @RequestBody CategoryUserAddDto dto) {
categoryService.addCategoryUser(dto);
return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS));
}

View File

@ -0,0 +1,100 @@
package cn.bunny.services.factory;
import cn.bunny.dao.vo.financial.user.expendAndIncome.ExpendWithIncome;
import cn.bunny.dao.vo.financial.user.home.CountTop;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Component
public class HomeFactory {
/**
* 获取本月所有的日期时间
*/
private static @NotNull List<LocalDateTime> getLocalDateTimeList(LocalDateTime startDate, LocalDateTime endDate) {
List<LocalDateTime> dateList = new ArrayList<>();
LocalDateTime currentDate = startDate;
while (!currentDate.isAfter(endDate)) {
dateList.add(currentDate);
currentDate = currentDate.plusDays(1);
}
return dateList;
}
/**
* 主页卡片数据
*/
public Map<String, CountTop> homeCard(List<ExpendWithIncome> homeExpendWithIncomesTop) {
return homeExpendWithIncomesTop.stream().collect(Collectors.groupingBy(
ExpendWithIncome::getType,
Collectors.summingDouble(expendWithIncome -> expendWithIncome.getAmount().doubleValue()
))).entrySet()
.stream().map(expendWithIncome -> {
Byte key = expendWithIncome.getKey();
// 判断是支出还是收入
String type = key.equals(Byte.parseByte("-1")) ? "expend" : "income";
// 设置收入和支出类型
CountTop countTop = new CountTop();
countTop.setType(type);
// 保留金钱位两位小数
BigDecimal bigDecimal = BigDecimal.valueOf(expendWithIncome.getValue()).setScale(2, RoundingMode.HALF_UP);
countTop.setAmount(bigDecimal);
return countTop;
}).toList().stream()
.collect(Collectors.toMap(CountTop::getType, countTop -> countTop));
}
/**
* 主页分析概览
*/
public List<ExpendWithIncome> homeOverview(LocalDateTime startDate, LocalDateTime endDate, List<ExpendWithIncome> homeExpendWithIncomesTop) {
List<LocalDateTime> dateList = getLocalDateTimeList(startDate, endDate);
// 从时间表补齐收入字段
List<ExpendWithIncome> homeExpendWithIncomesOverview = new ArrayList<>(dateList.stream().map(date -> {
double sum = homeExpendWithIncomesTop.stream()
.filter(data -> data.getTransactionDate().toLocalDate().equals(date.toLocalDate()) && data.getType().equals(Byte.parseByte("1")))
.mapToDouble(data -> data.getAmount().doubleValue())
.sum();
ExpendWithIncome expendWithIncome = new ExpendWithIncome();
BeanUtils.copyProperties(date, expendWithIncome);
BigDecimal decimal = new BigDecimal(sum).setScale(2, RoundingMode.HALF_UP);
expendWithIncome.setAmount(decimal);
expendWithIncome.setType(Byte.parseByte("1"));
expendWithIncome.setTransactionDate(date);
return expendWithIncome;
}).toList());
// 从时间表补齐支出字段
homeExpendWithIncomesOverview.addAll(dateList.stream().map(date -> {
double sum = homeExpendWithIncomesTop.stream()
.filter(data -> data.getTransactionDate().toLocalDate().equals(date.toLocalDate()) && data.getType().equals(Byte.parseByte("-1")))
.mapToDouble(data -> data.getAmount().doubleValue())
.sum();
ExpendWithIncome expendWithIncome = new ExpendWithIncome();
BeanUtils.copyProperties(date, expendWithIncome);
BigDecimal decimal = new BigDecimal(sum).setScale(2, RoundingMode.HALF_UP);
expendWithIncome.setAmount(decimal);
expendWithIncome.setType(Byte.parseByte("-1"));
expendWithIncome.setTransactionDate(date);
return expendWithIncome;
}).toList());
return homeExpendWithIncomesOverview;
}
}

View File

@ -1,5 +1,6 @@
package cn.bunny.services.quartz;
import cn.bunny.services.aop.annotation.QuartzSchedulers;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
@ -18,7 +19,7 @@ import java.util.concurrent.TimeUnit;
@Slf4j
// @QuartzSchedulers(type = "backup", description = "数据库备份(仅限本地docker中MySQL)")
@QuartzSchedulers(type = "backup", description = "数据库备份(仅限本地docker中MySQL)")
@Component
public class DatabaseBackupJob implements Job {

View File

@ -1,16 +0,0 @@
package cn.bunny.services.quartz;
import cn.bunny.services.aop.annotation.QuartzSchedulers;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
@Slf4j
@QuartzSchedulers(type = "test", description = "JobHello任务内容")
public class JobHello implements Job {
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
System.out.print("执行任务--JobHello。。。。。。。。。");
}
}

View File

@ -1,16 +0,0 @@
package cn.bunny.services.quartz;
import cn.bunny.services.aop.annotation.QuartzSchedulers;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
@Slf4j
@QuartzSchedulers(type = "test", description = "Demo的类JobHello2")
public class JobHello2 implements Job {
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
System.out.print("执行任务--JobHello2。。。。。。。。。");
}
}

View File

@ -6,7 +6,7 @@ import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
@QuartzSchedulers(type = "email", description = "定时邮件任务")
@QuartzSchedulers(type = "email-overhead-report", description = "定时邮件任务")
public class MailingJob implements Job {
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {

View File

@ -1,9 +1,9 @@
package cn.bunny.services.service.financial;
import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryAddUserDto;
import cn.bunny.dao.dto.financial.category.CategoryDto;
import cn.bunny.dao.dto.financial.category.admin.CategoryAddDto;
import cn.bunny.dao.dto.financial.category.admin.CategoryUpdateDto;
import cn.bunny.dao.dto.financial.category.user.CategoryUserAddDto;
import cn.bunny.dao.dto.financial.category.user.CategoryUserUpdateDto;
import cn.bunny.dao.entity.financial.Category;
import cn.bunny.dao.pojo.result.PageResult;
@ -58,7 +58,7 @@ public interface CategoryService extends IService<Category> {
*
* @param dto 添加表单
*/
void addCategoryUser(@Valid BudgetCategoryAddUserDto dto);
void addCategoryUser(@Valid CategoryUserAddDto dto);
/**
* * 更新分类信息

View File

@ -16,6 +16,7 @@ import cn.bunny.dao.vo.financial.user.BillUserVo;
import cn.bunny.dao.vo.financial.user.expendAndIncome.CategoryAmount;
import cn.bunny.dao.vo.financial.user.expendAndIncome.ExpendWithIncome;
import cn.bunny.dao.vo.financial.user.expendAndIncome.ExpendWithIncomeListVo;
import cn.bunny.services.factory.HomeFactory;
import cn.bunny.services.mapper.financial.BillMapper;
import cn.bunny.services.service.financial.BillService;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -23,8 +24,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.List;
import java.util.stream.Collectors;
@ -39,6 +42,9 @@ import java.util.stream.Collectors;
@Service
public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements BillService {
@Autowired
private HomeFactory homeFactory;
/**
* * 账单信息 服务实现类
*
@ -48,6 +54,11 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements Bi
*/
@Override
public PageResult<BillUserVo> getUserBillList(Page<Bill> pageParams, BillDto dto) {
// 查询时候多加一天就可以查询到最后一个日期到晚上的数据
LocalDate endDate = dto.getEndDate();
if (endDate != null) {
dto.setEndDate(endDate.plusDays(1));
}
dto.setUserId(BaseContext.getUserId());
IPage<BillVo> page = baseMapper.selectListByPage(pageParams, dto);
@ -72,6 +83,11 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements Bi
*/
@Override
public PageResult<BillVo> getBillList(Page<Bill> pageParams, BillDto dto) {
// 查询时候多加一天就可以查询到最后一个日期到晚上的数据
LocalDate endDate = dto.getEndDate();
if (endDate != null) {
dto.setEndDate(endDate.plusDays(1));
}
// 判断创建用户的Id是否和当前请求的用户id是否相同
IPage<BillVo> page = baseMapper.selectListByPage(pageParams, dto);
@ -157,14 +173,21 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements Bi
*/
@Override
public ExpendWithIncomeListVo getExpendOrIncome(ExpendWithIncomeDto dto) {
// 查询时候多加一天就可以查询到最后一个日期到晚上的数据
dto.setEndDate(dto.getEndDate().plusDays(1));
// 判断请求用户id是否为空
if (dto.getUserId() == null) {
dto.setUserId(BaseContext.getUserId());
}
if (dto.getUserId() == null) dto.setUserId(BaseContext.getUserId());
// 查询收入和支出
List<ExpendWithIncome> expendWithIncomeList = baseMapper.selectListByExpendWithIncomeDto(dto);
// 图表数据
List<ExpendWithIncome> chartList = homeFactory.homeOverview(dto.getStartDate().atStartOfDay(), dto.getEndDate().atStartOfDay().minusDays(1), expendWithIncomeList);
if (dto.getType() != null) {
chartList = chartList.stream().filter(expendWithIncome -> expendWithIncome.getType().equals(dto.getType())).toList();
}
// 分类列表
List<CategoryAmount> categoryAmountList = expendWithIncomeList.stream()
.filter(expendWithIncome -> dto.getType() != null && expendWithIncome.getType().equals(dto.getType()))
@ -179,6 +202,7 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements Bi
}).toList();
return ExpendWithIncomeListVo.builder()
.chartList(chartList)
.categoryAmounts(categoryAmountList)
.list(expendWithIncomeList)
.build();

View File

@ -23,6 +23,7 @@ import jakarta.validation.Valid;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.List;
/**
@ -45,6 +46,11 @@ public class BudgetCategoryServiceImpl extends ServiceImpl<BudgetCategoryMapper,
*/
@Override
public PageResult<BudgetCategoryVo> getBudgetCategoryList(Page<BudgetCategory> pageParams, BudgetCategoryDto dto) {
// 查询时候多加一天就可以查询到最后一个日期到晚上的数据
LocalDate endPeriod = dto.getEndPeriod();
if (endPeriod != null) {
dto.setEndPeriod(endPeriod.plusDays(1));
}
IPage<BudgetCategoryVo> page = baseMapper.selectListByPage(pageParams, dto);
return PageResult.<BudgetCategoryVo>builder()
@ -114,6 +120,11 @@ public class BudgetCategoryServiceImpl extends ServiceImpl<BudgetCategoryMapper,
*/
@Override
public PageResult<BudgetCategoryUserVo> getUserBudgetCategoryList(Page<BudgetCategory> pageParams, BudgetCategoryDto dto) {
// 查询时候多加一天就可以查询到最后一个日期到晚上的数据
LocalDate endPeriod = dto.getEndPeriod();
if (endPeriod != null) {
dto.setEndPeriod(endPeriod.plusDays(1));
}
dto.setUserId(BaseContext.getUserId());
IPage<BudgetCategoryVo> page = baseMapper.selectListByPage(pageParams, dto);

View File

@ -2,10 +2,10 @@ package cn.bunny.services.service.financial.impl;
import cn.bunny.common.service.context.BaseContext;
import cn.bunny.common.service.exception.BunnyException;
import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryAddUserDto;
import cn.bunny.dao.dto.financial.category.CategoryDto;
import cn.bunny.dao.dto.financial.category.admin.CategoryAddDto;
import cn.bunny.dao.dto.financial.category.admin.CategoryUpdateDto;
import cn.bunny.dao.dto.financial.category.user.CategoryUserAddDto;
import cn.bunny.dao.dto.financial.category.user.CategoryUserUpdateDto;
import cn.bunny.dao.entity.financial.Category;
import cn.bunny.dao.pojo.constant.UserConstant;
@ -131,7 +131,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
* @param dto 分类信息添加
*/
@Override
public void addCategoryUser(@Valid BudgetCategoryAddUserDto dto) {
public void addCategoryUser(@Valid CategoryUserAddDto dto) {
// 查询当前用户添加了多少条
if (count(Wrappers.<Category>lambdaQuery().eq(Category::getIsBuiltin, false)) >= UserConstant.CATEGORY_COUNT) {
throw new BunnyException(ResultCodeEnum.THE_MAXIMUM_BAR_CODE);

View File

@ -21,6 +21,7 @@ import jakarta.validation.Valid;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.List;
/**
@ -43,6 +44,11 @@ public class SavingGoalServiceImpl extends ServiceImpl<SavingGoalMapper, SavingG
*/
@Override
public PageResult<SavingGoalVo> getSavingGoalList(Page<SavingGoal> pageParams, SavingGoalDto dto) {
// 查询时候多加一天就可以查询到最后一个日期到晚上的数据
LocalDate endDate = dto.getEndDuration();
if (endDate != null) {
dto.setEndDuration(endDate.plusDays(1));
}
IPage<SavingGoalVo> page = baseMapper.selectListByPage(pageParams, dto);
return PageResult.<SavingGoalVo>builder()
@ -98,6 +104,11 @@ public class SavingGoalServiceImpl extends ServiceImpl<SavingGoalMapper, SavingG
*/
@Override
public PageResult<SavingGoalUserVo> getUserSavingGoalList(Page<SavingGoal> pageParams, SavingGoalDto dto) {
// 查询时候多加一天就可以查询到最后一个日期到晚上的数据
LocalDate endDate = dto.getEndDuration();
if (endDate != null) {
dto.setEndDuration(endDate.plusDays(1));
}
dto.setUserId(BaseContext.getUserId());
IPage<SavingGoalVo> page = baseMapper.selectListByPage(pageParams, dto);

View File

@ -0,0 +1,13 @@
package cn.bunny.services.service.index;
import cn.bunny.dao.vo.financial.user.home.HomeVo;
public interface IndexService {
/**
* 主页数据内容
*
* @return 主页数据
*/
HomeVo homeDatalist();
}

View File

@ -0,0 +1,58 @@
package cn.bunny.services.service.index.impl;
import cn.bunny.common.service.context.BaseContext;
import cn.bunny.dao.dto.financial.bill.ExpendWithIncomeDto;
import cn.bunny.dao.vo.financial.user.expendAndIncome.ExpendWithIncome;
import cn.bunny.dao.vo.financial.user.home.CountTop;
import cn.bunny.dao.vo.financial.user.home.HomeVo;
import cn.bunny.services.factory.HomeFactory;
import cn.bunny.services.mapper.financial.BillMapper;
import cn.bunny.services.service.index.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.temporal.TemporalAdjusters;
import java.util.List;
import java.util.Map;
@Service
public class IndexServiceImpl implements IndexService {
@Autowired
private BillMapper billMapper;
@Autowired
private HomeFactory homeFactory;
/**
* 主页数据内容
*
* @return 主页数据
*/
@Override
public HomeVo homeDatalist() {
// 初始化本月开始日期和结束日期
LocalDateTime startDate = LocalDateTime.now().with(TemporalAdjusters.firstDayOfMonth());
LocalDateTime endDate = LocalDateTime.now().with(TemporalAdjusters.lastDayOfMonth());
ExpendWithIncomeDto expendWithIncomeDto = new ExpendWithIncomeDto();
expendWithIncomeDto.setUserId(BaseContext.getUserId());
expendWithIncomeDto.setStartDate(startDate.toLocalDate());
expendWithIncomeDto.setEndDate(endDate.toLocalDate().plusDays(1));// 查询时候多加一天就可以查询到最后一个日期到晚上的数据
// 查询收入和支出
List<ExpendWithIncome> homeRanks = billMapper.selectListByExpendWithIncomeDto(expendWithIncomeDto);
// 主页卡片数据
Map<String, CountTop> homeCard = homeFactory.homeCard(homeRanks);
// 分析概览
List<ExpendWithIncome> homeOverview = homeFactory.homeOverview(startDate, endDate, homeRanks);
return HomeVo.builder()
.homeCard(homeCard)
.homeOverview(homeOverview)
.homeRanks(homeRanks)
.build();
}
}

View File

@ -47,10 +47,14 @@
<if test="dto.description != null and dto.description != ''">
and base.description like CONCAT('%',#{dto.description},'%')
</if>
<if test="dto.amount != null">
and base.amount like CONCAT('%',#{dto.amount},'%')
</if>
<if test="dto.startDate != null and dto.endDate != null">
and base.transaction_date between #{dto.startDate} and #{dto.endDate}
</if>
</where>
order by base.transaction_date
</select>
<!-- 账单收入和支出 -->