refactor: 重构账单、预算分类、分类

This commit is contained in:
Bunny 2024-11-16 22:30:16 +08:00
parent 6bc4eb0cbd
commit 0ae6a9d9bd
49 changed files with 880 additions and 87 deletions

View File

@ -3,9 +3,9 @@ package cn.bunny.common.generator.generator;
import cn.bunny.common.generator.entity.BaseField;
import cn.bunny.common.generator.entity.BaseResultMap;
import cn.bunny.common.generator.utils.GeneratorCodeUtils;
import cn.bunny.dao.dto.financial.bill.BillAddDto;
import cn.bunny.dao.dto.financial.bill.BillDto;
import cn.bunny.dao.dto.financial.bill.BillUpdateDto;
import cn.bunny.dao.dto.financial.bill.admin.BillAddDto;
import cn.bunny.dao.dto.financial.bill.admin.BillUpdateDto;
import cn.bunny.dao.entity.financial.Bill;
import cn.bunny.dao.vo.financial.admin.BillVo;
import com.baomidou.mybatisplus.annotation.TableName;

View File

@ -1,4 +1,4 @@
package cn.bunny.dao.dto.financial.bill;
package cn.bunny.dao.dto.financial.bill.admin;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
@ -21,6 +21,7 @@ import java.time.LocalDateTime;
public class BillAddDto {
@Schema(name = "userId", title = "绑定的用户id")
@NotNull(message = "用户不能为空")
private Long userId;
@Schema(name = "username", title = "类型1 - 收入,-1 - 支出")

View File

@ -1,4 +1,4 @@
package cn.bunny.dao.dto.financial.bill;
package cn.bunny.dao.dto.financial.bill.admin;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
@ -25,6 +25,7 @@ public class BillUpdateDto {
private Long id;
@Schema(name = "userId", title = "绑定的用户id")
@NotNull(message = "用户不能为空")
private Long userId;
@Schema(name = "username", title = "类型1 - 收入,-1 - 支出")

View File

@ -0,0 +1,46 @@
package cn.bunny.dao.dto.financial.bill.user;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
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 = "BillAddDto对象", title = "账单信息添加内容", description = "账单信息添加内容")
public class BillAddUserDto {
@Schema(name = "username", title = "类型1 - 收入,-1 - 支出")
@NotNull(message = "类型不能为空")
@Min(value = -1, message = "类型格式不正确")
@Max(value = 1, message = "类型格式不正确")
private Byte type;
@Schema(name = "amount", title = "金额")
@NotNull(message = "金额不能为空")
@Min(value = 0, message = "金额格式不正确")
private BigDecimal amount;
@Schema(name = "description", title = "描述")
private String description;
@Schema(name = "transactionDate", title = "交易日期")
@NotNull(message = "交易日期不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime transactionDate;
@Schema(name = "categoryId", title = "类别id")
@NotNull(message = "类别id不能为空")
private Long categoryId;
}

View File

@ -0,0 +1,48 @@
package cn.bunny.dao.dto.financial.bill.user;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
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 = "BillUpdateDto对象", title = "账单信息更新内容", description = "账单信息更新内容")
public class BillUpdateUserDto {
@Schema(name = "id", title = "主键")
@NotNull(message = "id不能为空")
private Long id;
@Schema(name = "username", title = "类型1 - 收入,-1 - 支出")
@NotNull(message = "类型不能为空")
@Min(value = -1, message = "类型格式不正确")
@Max(value = 1, message = "类型格式不正确")
private Byte type;
@Schema(name = "amount", title = "金额")
@NotNull(message = "金额不能为空")
@Min(value = 0, message = "金额格式不正确")
private BigDecimal amount;
@Schema(name = "description", title = "描述")
private String description;
@Schema(name = "transactionDate", title = "交易日期")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime transactionDate;
@Schema(name = "categoryId", title = "类别id")
private Long categoryId;
}

View File

@ -1,4 +1,4 @@
package cn.bunny.dao.dto.financial.budgetCategory;
package cn.bunny.dao.dto.financial.budgetCategory.admin;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
@ -25,7 +25,7 @@ public class BudgetCategoryAddDto {
private Long parentId;
@Schema(name = "userId", title = "绑定的用户id")
@NotNull(message = "债绑定的用户不能为空")
@NotNull(message = "用户不能为空")
private Long userId;
@Schema(name = "categoryName", title = "分类名称")

View File

@ -1,4 +1,4 @@
package cn.bunny.dao.dto.financial.budgetCategory;
package cn.bunny.dao.dto.financial.budgetCategory.admin;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
@ -29,7 +29,7 @@ public class BudgetCategoryUpdateDto {
private Long parentId;
@Schema(name = "userId", title = "绑定的用户id")
@NotNull(message = "债绑定的用户不能为空")
@NotNull(message = "用户不能为空")
private Long userId;
@Schema(name = "categoryName", title = "分类名称")

View File

@ -0,0 +1,57 @@
package cn.bunny.dao.dto.financial.budgetCategory.user;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
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 = "BudgetCategoryAddDto对象", title = "预算分类添加", description = "预算分类添加")
public class BudgetCategoryAddUserDto {
@Schema(name = "parentId", title = "父级id")
@NotNull(message = "父级id不能为空")
private Long parentId;
@Schema(name = "categoryName", title = "分类名称")
@NotNull(message = "分类名称不能为空")
@NotBlank(message = "分类名称不能为空")
private String categoryName;
@Schema(name = "budgetName", title = "预算名称")
@NotNull(message = "预算名称不能为空")
@NotBlank(message = "预算名称不能为空")
private String budgetName;
@Schema(name = "statusType", title = "完成状态")
@NotNull(message = "完成状态不能为空")
@NotBlank(message = "完成状态不能为空")
private String statusType;
@Schema(name = "amount", title = "预算金额")
@NotNull(message = "预算金额不能为空")
@Min(value = 0, message = "不能低于0")
private BigDecimal amount;
@Schema(name = "period", title = "预算周期")
@NotNull(message = "预算周期不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime startPeriod;
@Schema(name = "period", title = "预算周期")
@NotNull(message = "预算周期不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime endPeriod;
}

View File

@ -0,0 +1,62 @@
package cn.bunny.dao.dto.financial.budgetCategory.user;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
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 = "BudgetCategoryUpdateDto对象", title = "预算分类更新", description = "预算分类更新")
public class BudgetCategoryUpdateUserDto {
@Schema(name = "id", title = "主键")
@NotNull(message = "id不能为空")
private Long id;
@Schema(name = "parentId", title = "父级id")
@NotNull(message = "父级id不能为空")
private Long parentId;
@Schema(name = "categoryName", title = "分类名称")
@NotNull(message = "分类名称不能为空")
@NotBlank(message = "分类名称不能为空")
private String categoryName;
@Schema(name = "budgetName", title = "预算名称")
@NotNull(message = "预算名称不能为空")
@NotBlank(message = "预算名称不能为空")
private String budgetName;
@Schema(name = "statusType", title = "完成状态")
@NotNull(message = "完成状态不能为空")
@NotBlank(message = "完成状态不能为空")
private String statusType;
@Schema(name = "amount", title = "预算金额")
@NotNull(message = "预算金额不能为空")
@Min(value = 0, message = "不能低于0")
private BigDecimal amount;
@Schema(name = "period", title = "预算周期")
@NotNull(message = "预算周期不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime startPeriod;
@Schema(name = "period", title = "预算周期")
@NotNull(message = "预算周期不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime endPeriod;
}

View File

@ -1,4 +1,4 @@
package cn.bunny.dao.dto.financial.category.admin;
package cn.bunny.dao.dto.financial.category;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;

View File

@ -16,6 +16,7 @@ import lombok.NoArgsConstructor;
public class CategoryAddDto {
@Schema(name = "userId", title = "绑定的用户id")
@NotNull(message = "用户不能为空")
private Long userId;
@Schema(name = "categoryName", title = "分类名称")

View File

@ -20,6 +20,7 @@ public class CategoryUpdateDto {
private Long id;
@Schema(name = "userId", title = "绑定的用户id")
@NotNull(message = "用户不能为空")
private Long userId;
@Schema(name = "categoryName", title = "分类名称")

View File

@ -1,4 +1,4 @@
package cn.bunny.dao.dto.financial.debtRepaymentPlan;
package cn.bunny.dao.dto.financial.debtRepaymentPlan.admin;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
@ -21,6 +21,7 @@ import java.time.LocalDateTime;
public class DebtRepaymentPlanAddDto {
@Schema(name = "userId", title = "绑定的用户id")
@NotNull(message = "用户不能为空")
private Long userId;
@Schema(name = "installmentNumber", title = "债务金额")

View File

@ -1,4 +1,4 @@
package cn.bunny.dao.dto.financial.debtRepaymentPlan;
package cn.bunny.dao.dto.financial.debtRepaymentPlan.admin;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
@ -25,6 +25,7 @@ public class DebtRepaymentPlanUpdateDto {
private Long id;
@Schema(name = "userId", title = "绑定的用户id")
@NotNull(message = "用户不能为空")
private Long userId;
@Schema(name = "installmentNumber", title = "债务金额")

View File

@ -0,0 +1,46 @@
package cn.bunny.dao.dto.financial.debtRepaymentPlan.user;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
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 = "CategoryUserAddDto对象", title = "债务还款计划表添加", description = "债务还款计划表添加")
public class DebtRepaymentPlanAddUserDto {
@Schema(name = "installmentNumber", title = "债务金额")
@NotNull(message = "债务金额不能为空")
private BigDecimal installmentNumber;
@Schema(name = "installmentAmount", title = "每期应还金额")
@NotNull(message = "每期应还金额不能为空")
private BigDecimal installmentAmount;
@Schema(name = "dueDate", title = "还款截止日期")
@NotNull(message = "还款截止日期不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime dueDate;
@Schema(name = "paidAmount", title = "已还金额")
@NotNull(message = "已还金额不能为空")
@Min(value = 0, message = "金额格式不正确")
private BigDecimal paidAmount;
@Schema(name = "paymentStatus", title = "还款状态")
@NotNull(message = "还款状态不能为空")
@NotBlank(message = "还款状态不能为空")
private String paymentStatus;
}

View File

@ -0,0 +1,50 @@
package cn.bunny.dao.dto.financial.debtRepaymentPlan.user;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
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 = "DebtRepaymentPlanUpdateDto对象", title = "债务还款计划更新", description = "债务还款计划更新")
public class DebtRepaymentPlanUpdateUserDto {
@Schema(name = "id", title = "主键")
@NotNull(message = "id不能为空")
private Long id;
@Schema(name = "installmentNumber", title = "债务金额")
@NotNull(message = "债务金额不能为空")
private BigDecimal installmentNumber;
@Schema(name = "installmentAmount", title = "每期应还金额")
@NotNull(message = "每期应还金额不能为空")
@Min(value = 0, message = "金额格式不正确")
private BigDecimal installmentAmount;
@Schema(name = "dueDate", title = "还款截止日期")
@NotNull(message = "还款截止日期不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime dueDate;
@Schema(name = "paidAmount", title = "已还金额")
@NotNull(message = "已还金额不能为空")
private BigDecimal paidAmount;
@Schema(name = "paymentStatus", title = "还款状态")
@NotNull(message = "还款状态不能为空")
@NotBlank(message = "还款状态不能为空")
private String paymentStatus;
}

View File

@ -1,4 +1,4 @@
package cn.bunny.dao.dto.financial.debtTracking;
package cn.bunny.dao.dto.financial.debtTracking.admin;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
@ -21,7 +21,7 @@ import java.time.LocalDateTime;
public class DebtTrackingAddDto {
@Schema(name = "userId", title = "绑定的用户")
@NotNull(message = "债务不能为空")
@NotNull(message = "用户不能为空")
private Long userId;
@Schema(name = "debtorName", title = "债务人姓名")

View File

@ -1,4 +1,4 @@
package cn.bunny.dao.dto.financial.debtTracking;
package cn.bunny.dao.dto.financial.debtTracking.admin;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
@ -25,6 +25,7 @@ public class DebtTrackingUpdateDto {
private Long id;
@Schema(name = "userId", title = "绑定的用户")
@NotNull(message = "用户不能为空")
private Long userId;
@Schema(name = "debtorName", title = "债务人姓名")

View File

@ -0,0 +1,49 @@
package cn.bunny.dao.dto.financial.debtTracking.user;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
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 = "DebtTrackingAddDto对象", title = "债务追踪添加", description = "债务追踪")
public class DebtTrackingAddUserDto {
@Schema(name = "debtorName", title = "债务人姓名")
@NotNull(message = "债务人姓名不能为空")
@NotBlank(message = "债务人姓名不能为空")
private String debtorName;
@Schema(name = "debtAmount", title = "债务金额")
@NotNull(message = "债务不能为空")
@Min(value = 0, message = "金额格式不正确")
private BigDecimal debtAmount;
@Schema(name = "debtType", title = "债务类型")
@NotNull(message = "债务类型不能为空")
@NotBlank(message = "债务类型不能为空")
private String debtType;
@Schema(name = "debtStatus", title = "债务状态")
@NotNull(message = "债务状态不能为空")
@NotBlank(message = "债务状态不能为空")
private String debtStatus;
@Schema(name = "dueDate", title = "还款截止日期")
@NotNull(message = "债务不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime dueDate;
}

View File

@ -0,0 +1,52 @@
package cn.bunny.dao.dto.financial.debtTracking.user;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
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 = "DebtTrackingUpdateDto对象", title = "债务追踪更新", description = "债务追踪更新")
public class DebtTrackingUpdateUserDto {
@Schema(name = "id", title = "主键")
@NotNull(message = "id不能为空")
private Long id;
@Schema(name = "debtorName", title = "债务人姓名")
@NotNull(message = "债务人姓名不能为空")
@NotBlank(message = "债务人姓名不能为空")
private String debtorName;
@Schema(name = "debtAmount", title = "债务金额")
@NotNull(message = "债务不能为空")
@Min(value = 0, message = "金额格式不正确")
private BigDecimal debtAmount;
@Schema(name = "debtType", title = "债务类型")
@NotNull(message = "债务类型不能为空")
@NotBlank(message = "债务类型不能为空")
private String debtType;
@Schema(name = "debtStatus", title = "债务状态")
@NotNull(message = "债务状态不能为空")
@NotBlank(message = "债务状态不能为空")
private String debtStatus;
@Schema(name = "dueDate", title = "还款截止日期")
@NotNull(message = "债务不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime dueDate;
}

View File

@ -1,4 +1,4 @@
package cn.bunny.dao.dto.financial.savingGoal;
package cn.bunny.dao.dto.financial.savingGoal.admin;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
@ -21,7 +21,7 @@ import java.time.LocalDateTime;
public class SavingGoalAddDto {
@Schema(name = "userId", title = "绑定的用户id")
@NotNull(message = "用户id不能为空")
@NotNull(message = "用户不能为空")
private Long userId;
@Schema(name = "statusType", title = "完成状态")

View File

@ -1,4 +1,4 @@
package cn.bunny.dao.dto.financial.savingGoal;
package cn.bunny.dao.dto.financial.savingGoal.admin;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
@ -25,7 +25,7 @@ public class SavingGoalUpdateDto {
private Long id;
@Schema(name = "userId", title = "绑定的用户id")
@NotNull(message = "用户id不能为空")
@NotNull(message = "用户不能为空")
private Long userId;
@Schema(name = "statusType", title = "完成状态")

View File

@ -0,0 +1,48 @@
package cn.bunny.dao.dto.financial.savingGoal.user;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
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 = "SavingGoalAddDto对象", title = "用户储值添加", description = "用户储值添加")
public class SavingGoalAddUserDto {
@Schema(name = "statusType", title = "完成状态")
@NotNull(message = "完成状态不能为空")
@NotBlank(message = "完成状态不能为空")
private String statusType;
@Schema(name = "savingGoalName", title = "储值目标名称")
@NotNull(message = "储值目标名称不能为空")
@NotBlank(message = "储值目标名称不能为空")
private String savingGoalName;
@Schema(name = "amount", title = "目标金额")
@NotNull(message = "目标金额不能为空")
@Min(value = 0, message = "储蓄值不能小于0")
private BigDecimal amount;
@Schema(name = "startDuration", title = "开始目标时长")
@NotNull(message = "开始目标时长不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime startDuration;
@Schema(name = "endDuration", title = "结束目标时长")
@NotNull(message = "结束目标时长不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime endDuration;
}

View File

@ -0,0 +1,52 @@
package cn.bunny.dao.dto.financial.savingGoal.user;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
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 = "SavingGoalUpdateDto对象", title = "用户储值更新", description = "用户储值更新")
public class SavingGoalUpdateUserDto {
@Schema(name = "id", title = "主键")
@NotNull(message = "id不能为空")
private Long id;
@Schema(name = "statusType", title = "完成状态")
@NotNull(message = "完成状态不能为空")
@NotBlank(message = "完成状态不能为空")
private String statusType;
@Schema(name = "savingGoalName", title = "储值目标名称")
@NotNull(message = "储值目标名称不能为空")
@NotBlank(message = "储值目标名称不能为空")
private String savingGoalName;
@Schema(name = "amount", title = "目标金额")
@NotNull(message = "目标金额不能为空")
@Min(value = 0, message = "金额格式不正确")
private BigDecimal amount;
@Schema(name = "startDuration", title = "开始目标时长")
@NotNull(message = "开始目标时长不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime startDuration;
@Schema(name = "endDuration", title = "结束目标时长")
@NotNull(message = "结束目标时长不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime endDuration;
}

View File

@ -1,4 +1,4 @@
package cn.bunny.dao.vo.financial.admin;
package cn.bunny.dao.vo.financial;
import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;

View File

@ -0,0 +1,54 @@
package cn.bunny.dao.vo.financial.user;
import cn.bunny.dao.common.vo.BaseUserVo;
import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
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.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Schema(name = "BudgetCategoryVo对象", title = "预算分类查询返回对象", description = "预算分类查询返回对象")
public class BudgetCategoryUserVo extends BaseUserVo {
@Schema(name = "parentId", title = "父级id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
@JSONField(serializeUsing = ToStringSerializer.class)
private Long parentId;
@Schema(name = "categoryName", title = "分类名称")
private String categoryName;
@Schema(name = "budgetName", title = "预算名称")
private String budgetName;
@Schema(name = "statusType", title = "完成状态")
private String statusType;
@Schema(name = "amount", title = "预算金额")
private BigDecimal amount;
@Schema(name = "startPeriod", title = "预算周期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime startPeriod;
@Schema(name = "endPeriod", title = "预算周期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime endPeriod;
}

View File

@ -1,9 +1,10 @@
package cn.bunny.services.controller.financial;
import cn.bunny.common.service.context.BaseContext;
import cn.bunny.dao.dto.financial.bill.BillAddDto;
import cn.bunny.dao.dto.financial.bill.BillDto;
import cn.bunny.dao.dto.financial.bill.BillUpdateDto;
import cn.bunny.dao.dto.financial.bill.admin.BillAddDto;
import cn.bunny.dao.dto.financial.bill.admin.BillUpdateDto;
import cn.bunny.dao.dto.financial.bill.user.BillAddUserDto;
import cn.bunny.dao.dto.financial.bill.user.BillUpdateUserDto;
import cn.bunny.dao.entity.financial.Bill;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.pojo.result.Result;
@ -73,9 +74,8 @@ public class BillController {
@Operation(summary = "用户添加账单信息", description = "用户添加账单信息")
@PostMapping("noManage/addUserBill")
public Mono<Result<String>> addUserBill(@Valid @RequestBody BillAddDto dto) {
dto.setUserId(BaseContext.getUserId());
billService.addBill(dto);
public Mono<Result<String>> addUserBill(@Valid @RequestBody BillAddUserDto dto) {
billService.addUserBill(dto);
return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS));
}
@ -88,9 +88,8 @@ public class BillController {
@Operation(summary = "用户更新账单信息", description = "用户更新账单信息")
@PutMapping("noManage/updateUserBill")
public Mono<Result<String>> updateUserBill(@Valid @RequestBody BillUpdateDto dto) {
dto.setUserId(BaseContext.getUserId());
billService.updateBill(dto);
public Mono<Result<String>> updateUserBill(@Valid @RequestBody BillUpdateUserDto dto) {
billService.updateUserBill(dto);
return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS));
}

View File

@ -1,14 +1,17 @@
package cn.bunny.services.controller.financial;
import cn.bunny.dao.dto.financial.budgetCategory.BudgetCategoryAddDto;
import cn.bunny.dao.dto.financial.budgetCategory.BudgetCategoryDto;
import cn.bunny.dao.dto.financial.budgetCategory.BudgetCategoryUpdateDto;
import cn.bunny.dao.dto.financial.budgetCategory.admin.BudgetCategoryAddDto;
import cn.bunny.dao.dto.financial.budgetCategory.admin.BudgetCategoryUpdateDto;
import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryAddUserDto;
import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryUpdateUserDto;
import cn.bunny.dao.entity.financial.BudgetCategory;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.pojo.result.Result;
import cn.bunny.dao.pojo.result.ResultCodeEnum;
import cn.bunny.dao.vo.financial.admin.BudgetCategoryParentVo;
import cn.bunny.dao.vo.financial.BudgetCategoryParentVo;
import cn.bunny.dao.vo.financial.admin.BudgetCategoryVo;
import cn.bunny.dao.vo.financial.user.BudgetCategoryUserVo;
import cn.bunny.services.service.financial.BudgetCategoryService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
@ -37,6 +40,20 @@ public class BudgetCategoryController {
@Autowired
private BudgetCategoryService budgetCategoryService;
@Operation(summary = "返回所有父级对象", description = "返回所有父级对象")
@GetMapping("noManage/getAllParentList")
public Mono<Result<List<BudgetCategoryParentVo>>> getAllParentList(@RequestBody(required = false) Long userId) {
List<BudgetCategoryParentVo> voList = budgetCategoryService.getAllParentList(userId);
return Mono.just(Result.success(voList));
}
@Operation(summary = "返回当前用户所有父级对象", description = "返回当前用户所有父级对象")
@GetMapping("noManage/getAllUserParentList")
public Mono<Result<List<BudgetCategoryParentVo>>> getAllUserParentList() {
List<BudgetCategoryParentVo> voList = budgetCategoryService.getAllUserParentList();
return Mono.just(Result.success(voList));
}
@Operation(summary = "分页查询预算分类表", description = "分页查询预算分类表")
@GetMapping("getBudgetCategoryList/{page}/{limit}")
public Mono<Result<PageResult<BudgetCategoryVo>>> getBudgetCategoryList(
@ -50,11 +67,17 @@ public class BudgetCategoryController {
return Mono.just(Result.success(pageResult));
}
@Operation(summary = "返回所有父级对象", description = "返回所有父级对象")
@GetMapping("noManage/getAllParentList")
public Mono<Result<List<BudgetCategoryParentVo>>> getAllParentList() {
List<BudgetCategoryParentVo> voList = budgetCategoryService.getAllParentList();
return Mono.just(Result.success(voList));
@Operation(summary = "用户分页查询预算分类表", description = "用户分页查询预算分类表")
@GetMapping("noManage/getUserBudgetCategoryList/{page}/{limit}")
public Mono<Result<PageResult<BudgetCategoryUserVo>>> getUserBudgetCategoryList(
@Parameter(name = "page", description = "当前页", required = true)
@PathVariable("page") Integer page,
@Parameter(name = "limit", description = "每页记录数", required = true)
@PathVariable("limit") Integer limit,
BudgetCategoryDto dto) {
Page<BudgetCategory> pageParams = new Page<>(page, limit);
PageResult<BudgetCategoryUserVo> pageResult = budgetCategoryService.getUserBudgetCategoryList(pageParams, dto);
return Mono.just(Result.success(pageResult));
}
@Operation(summary = "添加预算分类表", description = "添加预算分类表")
@ -64,6 +87,13 @@ public class BudgetCategoryController {
return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS));
}
@Operation(summary = "用户添加预算分类表", description = "用户添加预算分类表")
@PostMapping("noManage/addUserBudgetCategory")
public Mono<Result<String>> addUserBudgetCategory(@Valid @RequestBody BudgetCategoryAddUserDto dto) {
budgetCategoryService.addUserBudgetCategory(dto);
return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS));
}
@Operation(summary = "更新预算分类表", description = "更新预算分类表")
@PutMapping("updateBudgetCategory")
public Mono<Result<String>> updateBudgetCategory(@Valid @RequestBody BudgetCategoryUpdateDto dto) {
@ -71,10 +101,24 @@ public class BudgetCategoryController {
return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS));
}
@Operation(summary = "用户更新预算分类表", description = "用户更新预算分类表")
@PutMapping("noManage/updateUserBudgetCategory")
public Mono<Result<String>> updateUserBudgetCategory(@Valid @RequestBody BudgetCategoryUpdateUserDto dto) {
budgetCategoryService.updateUserBudgetCategory(dto);
return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS));
}
@Operation(summary = "删除预算分类表", description = "删除预算分类表")
@DeleteMapping("deleteBudgetCategory")
public Mono<Result<String>> deleteBudgetCategory(@RequestBody List<Long> ids) {
budgetCategoryService.deleteBudgetCategory(ids);
return Mono.just(Result.success(ResultCodeEnum.DELETE_SUCCESS));
}
@Operation(summary = "用户删除预算分类表", description = "用户删除预算分类表")
@DeleteMapping("noManage/deleteUserBudgetCategory")
public Mono<Result<String>> deleteUserBudgetCategory(@RequestBody List<Long> ids) {
budgetCategoryService.deleteUserBudgetCategory(ids);
return Mono.just(Result.success(ResultCodeEnum.DELETE_SUCCESS));
}
}

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.CategoryDto;
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 CategoryUserAddDto dto) {
public Mono<Result<String>> addCategoryUser(@Valid @RequestBody BudgetCategoryAddUserDto dto) {
categoryService.addCategoryUser(dto);
return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS));
}

View File

@ -1,8 +1,8 @@
package cn.bunny.services.controller.financial;
import cn.bunny.dao.dto.financial.debtRepaymentPlan.DebtRepaymentPlanAddDto;
import cn.bunny.dao.dto.financial.debtRepaymentPlan.DebtRepaymentPlanDto;
import cn.bunny.dao.dto.financial.debtRepaymentPlan.DebtRepaymentPlanUpdateDto;
import cn.bunny.dao.dto.financial.debtRepaymentPlan.admin.DebtRepaymentPlanAddDto;
import cn.bunny.dao.dto.financial.debtRepaymentPlan.admin.DebtRepaymentPlanUpdateDto;
import cn.bunny.dao.entity.financial.DebtRepaymentPlan;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.pojo.result.Result;

View File

@ -1,8 +1,8 @@
package cn.bunny.services.controller.financial;
import cn.bunny.dao.dto.financial.debtTracking.DebtTrackingAddDto;
import cn.bunny.dao.dto.financial.debtTracking.DebtTrackingDto;
import cn.bunny.dao.dto.financial.debtTracking.DebtTrackingUpdateDto;
import cn.bunny.dao.dto.financial.debtTracking.admin.DebtTrackingAddDto;
import cn.bunny.dao.dto.financial.debtTracking.admin.DebtTrackingUpdateDto;
import cn.bunny.dao.entity.financial.DebtTracking;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.pojo.result.Result;

View File

@ -1,8 +1,8 @@
package cn.bunny.services.controller.financial;
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalAddDto;
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalDto;
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalUpdateDto;
import cn.bunny.dao.dto.financial.savingGoal.admin.SavingGoalAddDto;
import cn.bunny.dao.dto.financial.savingGoal.admin.SavingGoalUpdateDto;
import cn.bunny.dao.entity.financial.SavingGoal;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.pojo.result.Result;

View File

@ -1,6 +1,6 @@
package cn.bunny.services.mapper.financial;
import cn.bunny.dao.dto.financial.category.admin.CategoryDto;
import cn.bunny.dao.dto.financial.category.CategoryDto;
import cn.bunny.dao.entity.financial.Category;
import cn.bunny.dao.vo.financial.admin.CategoryVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

View File

@ -1,8 +1,10 @@
package cn.bunny.services.service.financial;
import cn.bunny.dao.dto.financial.bill.BillAddDto;
import cn.bunny.dao.dto.financial.bill.BillDto;
import cn.bunny.dao.dto.financial.bill.BillUpdateDto;
import cn.bunny.dao.dto.financial.bill.admin.BillAddDto;
import cn.bunny.dao.dto.financial.bill.admin.BillUpdateDto;
import cn.bunny.dao.dto.financial.bill.user.BillAddUserDto;
import cn.bunny.dao.dto.financial.bill.user.BillUpdateUserDto;
import cn.bunny.dao.entity.financial.Bill;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.vo.financial.admin.BillVo;
@ -63,4 +65,18 @@ public interface BillService extends IService<Bill> {
* @param ids 删除的ids
*/
void deleteBill(List<Long> ids);
/**
* 用户添加账单信息
*
* @param dto 添加表单
*/
void addUserBill(BillAddUserDto dto);
/**
* 用户更新账单信息
*
* @param dto 更新表单
*/
void updateUserBill(BillUpdateUserDto dto);
}

View File

@ -1,12 +1,15 @@
package cn.bunny.services.service.financial;
import cn.bunny.dao.dto.financial.budgetCategory.BudgetCategoryAddDto;
import cn.bunny.dao.dto.financial.budgetCategory.BudgetCategoryDto;
import cn.bunny.dao.dto.financial.budgetCategory.BudgetCategoryUpdateDto;
import cn.bunny.dao.dto.financial.budgetCategory.admin.BudgetCategoryAddDto;
import cn.bunny.dao.dto.financial.budgetCategory.admin.BudgetCategoryUpdateDto;
import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryAddUserDto;
import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryUpdateUserDto;
import cn.bunny.dao.entity.financial.BudgetCategory;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.vo.financial.admin.BudgetCategoryParentVo;
import cn.bunny.dao.vo.financial.BudgetCategoryParentVo;
import cn.bunny.dao.vo.financial.admin.BudgetCategoryVo;
import cn.bunny.dao.vo.financial.user.BudgetCategoryUserVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import jakarta.validation.Valid;
@ -56,5 +59,42 @@ public interface BudgetCategoryService extends IService<BudgetCategory> {
*
* @return 父级列表
*/
List<BudgetCategoryParentVo> getAllParentList();
List<BudgetCategoryParentVo> getAllParentList(Long userId);
/**
* 用户分页查询预算分类表
*
* @param pageParams 分页参数
* @param dto 查询表单
* @return 分页返回结果
*/
PageResult<BudgetCategoryUserVo> getUserBudgetCategoryList(Page<BudgetCategory> pageParams, BudgetCategoryDto dto);
/**
* 用户删除预算分类表
*
* @param ids 删除id列表
*/
void deleteUserBudgetCategory(List<Long> ids);
/**
* 返回当前用户所有父级对象
*
* @return 所有父级列表
*/
List<BudgetCategoryParentVo> getAllUserParentList();
/**
* 用户添加预算分类表
*
* @param dto 添加表单
*/
void addUserBudgetCategory(BudgetCategoryAddUserDto dto);
/**
* 用户更新预算分类表
*
* @param dto 更新表单
*/
void updateUserBudgetCategory(BudgetCategoryUpdateUserDto dto);
}

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.CategoryDto;
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 CategoryUserAddDto dto);
void addCategoryUser(@Valid BudgetCategoryAddUserDto dto);
/**
* * 更新分类信息

View File

@ -1,8 +1,8 @@
package cn.bunny.services.service.financial;
import cn.bunny.dao.dto.financial.debtRepaymentPlan.DebtRepaymentPlanAddDto;
import cn.bunny.dao.dto.financial.debtRepaymentPlan.DebtRepaymentPlanDto;
import cn.bunny.dao.dto.financial.debtRepaymentPlan.DebtRepaymentPlanUpdateDto;
import cn.bunny.dao.dto.financial.debtRepaymentPlan.admin.DebtRepaymentPlanAddDto;
import cn.bunny.dao.dto.financial.debtRepaymentPlan.admin.DebtRepaymentPlanUpdateDto;
import cn.bunny.dao.entity.financial.DebtRepaymentPlan;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.vo.financial.admin.DebtRepaymentPlanVo;

View File

@ -1,8 +1,8 @@
package cn.bunny.services.service.financial;
import cn.bunny.dao.dto.financial.debtTracking.DebtTrackingAddDto;
import cn.bunny.dao.dto.financial.debtTracking.DebtTrackingDto;
import cn.bunny.dao.dto.financial.debtTracking.DebtTrackingUpdateDto;
import cn.bunny.dao.dto.financial.debtTracking.admin.DebtTrackingAddDto;
import cn.bunny.dao.dto.financial.debtTracking.admin.DebtTrackingUpdateDto;
import cn.bunny.dao.entity.financial.DebtTracking;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.vo.financial.admin.DebtTrackingVo;

View File

@ -1,8 +1,8 @@
package cn.bunny.services.service.financial;
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalAddDto;
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalDto;
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalUpdateDto;
import cn.bunny.dao.dto.financial.savingGoal.admin.SavingGoalAddDto;
import cn.bunny.dao.dto.financial.savingGoal.admin.SavingGoalUpdateDto;
import cn.bunny.dao.entity.financial.SavingGoal;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.vo.financial.admin.SavingGoalVo;

View File

@ -2,9 +2,11 @@ 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.bill.BillAddDto;
import cn.bunny.dao.dto.financial.bill.BillDto;
import cn.bunny.dao.dto.financial.bill.BillUpdateDto;
import cn.bunny.dao.dto.financial.bill.admin.BillAddDto;
import cn.bunny.dao.dto.financial.bill.admin.BillUpdateDto;
import cn.bunny.dao.dto.financial.bill.user.BillAddUserDto;
import cn.bunny.dao.dto.financial.bill.user.BillUpdateUserDto;
import cn.bunny.dao.entity.financial.Bill;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.pojo.result.ResultCodeEnum;
@ -41,11 +43,8 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements Bi
*/
@Override
public PageResult<BillUserVo> getUserBillList(Page<Bill> pageParams, BillDto dto) {
// 需要根据当前用户去查询
Long userId = BaseContext.getUserId();
dto.setUserId(userId);
dto.setUserId(BaseContext.getUserId());
// 判断创建用户的Id是否和当前请求的用户id是否相同
IPage<BillVo> page = baseMapper.selectListByPage(pageParams, dto);
List<BillUserVo> userVoList = page.getRecords().stream().map(billVo -> {
BillUserVo billUserVo = new BillUserVo();
@ -115,6 +114,36 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements Bi
baseMapper.deleteBatchIdsWithPhysics(ids);
}
/**
* 用户添加账单信息
*
* @param dto 添加表单
*/
@Override
public void addUserBill(BillAddUserDto dto) {
// 保存数据
Bill bill = new Bill();
BeanUtils.copyProperties(dto, bill);
bill.setUserId(BaseContext.getUserId());
save(bill);
}
/**
* 用户更新账单信息
*
* @param dto 更新表单
*/
@Override
public void updateUserBill(BillUpdateUserDto dto) {
// 更新内容
Bill bill = new Bill();
BeanUtils.copyProperties(dto, bill);
bill.setUserId(BaseContext.getUserId());
updateById(bill);
}
/**
* 删除|批量删除账单信息
*

View File

@ -1,15 +1,22 @@
package cn.bunny.services.service.financial.impl;
import cn.bunny.dao.dto.financial.budgetCategory.BudgetCategoryAddDto;
import cn.bunny.common.service.context.BaseContext;
import cn.bunny.common.service.exception.BunnyException;
import cn.bunny.dao.dto.financial.budgetCategory.BudgetCategoryDto;
import cn.bunny.dao.dto.financial.budgetCategory.BudgetCategoryUpdateDto;
import cn.bunny.dao.dto.financial.budgetCategory.admin.BudgetCategoryAddDto;
import cn.bunny.dao.dto.financial.budgetCategory.admin.BudgetCategoryUpdateDto;
import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryAddUserDto;
import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryUpdateUserDto;
import cn.bunny.dao.entity.financial.BudgetCategory;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.vo.financial.admin.BudgetCategoryParentVo;
import cn.bunny.dao.pojo.result.ResultCodeEnum;
import cn.bunny.dao.vo.financial.BudgetCategoryParentVo;
import cn.bunny.dao.vo.financial.admin.BudgetCategoryVo;
import cn.bunny.dao.vo.financial.user.BudgetCategoryUserVo;
import cn.bunny.services.mapper.financial.BudgetCategoryMapper;
import cn.bunny.services.service.financial.BudgetCategoryService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.validation.Valid;
@ -90,11 +97,94 @@ public class BudgetCategoryServiceImpl extends ServiceImpl<BudgetCategoryMapper,
* @return 父级列表
*/
@Override
public List<BudgetCategoryParentVo> getAllParentList() {
public List<BudgetCategoryParentVo> getAllParentList(Long userId) {
return list().stream().map(budgetCategory -> {
BudgetCategoryParentVo budgetCategoryParentVo = new BudgetCategoryParentVo();
BeanUtils.copyProperties(budgetCategory, budgetCategoryParentVo);
return budgetCategoryParentVo;
}).toList();
}
/**
* 用户分页查询预算分类表
*
* @param pageParams 分页参数
* @param dto 查询表单
* @return 分页返回结果
*/
@Override
public PageResult<BudgetCategoryUserVo> getUserBudgetCategoryList(Page<BudgetCategory> pageParams, BudgetCategoryDto dto) {
dto.setUserId(BaseContext.getUserId());
IPage<BudgetCategoryVo> page = baseMapper.selectListByPage(pageParams, dto);
List<BudgetCategoryUserVo> categoryUserVoList = page.getRecords().stream().map(budgetCategoryVo -> {
BudgetCategoryUserVo budgetCategoryUserVo = new BudgetCategoryUserVo();
BeanUtils.copyProperties(budgetCategoryVo, budgetCategoryUserVo);
return budgetCategoryUserVo;
}).toList();
return PageResult.<BudgetCategoryUserVo>builder()
.list(categoryUserVoList)
.pageNo(page.getCurrent())
.pageSize(page.getSize())
.total(page.getTotal())
.build();
}
@Override
public void deleteUserBudgetCategory(List<Long> ids) {
// 判断删除的是否是自己的账单
List<BudgetCategory> billList = list(Wrappers.<BudgetCategory>lambdaQuery().in(BudgetCategory::getId, ids))
.stream().filter(bill -> !bill.getUserId().equals(BaseContext.getUserId())).toList();
if (!billList.isEmpty()) {
throw new BunnyException(ResultCodeEnum.ILLEGAL_DATA_REQUEST);
}
baseMapper.deleteBatchIdsWithPhysics(ids);
}
/**
* 返回当前用户所有父级对象
*
* @return 父级列表
*/
@Override
public List<BudgetCategoryParentVo> getAllUserParentList() {
return list(Wrappers.<BudgetCategory>lambdaQuery().eq(BudgetCategory::getUserId, BaseContext.getUserId()))
.stream().map(budgetCategory -> {
BudgetCategoryParentVo budgetCategoryParentVo = new BudgetCategoryParentVo();
BeanUtils.copyProperties(budgetCategory, budgetCategoryParentVo);
return budgetCategoryParentVo;
}).toList();
}
/**
* 用户添加预算分类表
*
* @param dto 添加表单
*/
@Override
public void addUserBudgetCategory(BudgetCategoryAddUserDto dto) {
// 保存数据
BudgetCategory budgetCategory = new BudgetCategory();
BeanUtils.copyProperties(dto, budgetCategory);
budgetCategory.setUserId(BaseContext.getUserId());
save(budgetCategory);
}
/**
* 用户更新预算分类表
*
* @param dto 更新表单
*/
@Override
public void updateUserBudgetCategory(BudgetCategoryUpdateUserDto dto) {
// 更新内容
BudgetCategory budgetCategory = new BudgetCategory();
BeanUtils.copyProperties(dto, budgetCategory);
budgetCategory.setUserId(BaseContext.getUserId());
updateById(budgetCategory);
}
}

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.CategoryDto;
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;
@ -125,7 +125,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
* @param dto 分类信息添加
*/
@Override
public void addCategoryUser(@Valid CategoryUserAddDto dto) {
public void addCategoryUser(@Valid BudgetCategoryAddUserDto dto) {
// 查询当前用户添加了多少条
if (count(Wrappers.<Category>lambdaQuery().eq(Category::getIsBuiltin, false)) >= UserConstant.CATEGORY_COUNT) {
throw new BunnyException(ResultCodeEnum.THE_MAXIMUM_BAR_CODE);

View File

@ -1,8 +1,8 @@
package cn.bunny.services.service.financial.impl;
import cn.bunny.dao.dto.financial.debtRepaymentPlan.DebtRepaymentPlanAddDto;
import cn.bunny.dao.dto.financial.debtRepaymentPlan.DebtRepaymentPlanDto;
import cn.bunny.dao.dto.financial.debtRepaymentPlan.DebtRepaymentPlanUpdateDto;
import cn.bunny.dao.dto.financial.debtRepaymentPlan.admin.DebtRepaymentPlanAddDto;
import cn.bunny.dao.dto.financial.debtRepaymentPlan.admin.DebtRepaymentPlanUpdateDto;
import cn.bunny.dao.entity.financial.DebtRepaymentPlan;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.vo.financial.admin.DebtRepaymentPlanVo;

View File

@ -1,8 +1,8 @@
package cn.bunny.services.service.financial.impl;
import cn.bunny.dao.dto.financial.debtTracking.DebtTrackingAddDto;
import cn.bunny.dao.dto.financial.debtTracking.DebtTrackingDto;
import cn.bunny.dao.dto.financial.debtTracking.DebtTrackingUpdateDto;
import cn.bunny.dao.dto.financial.debtTracking.admin.DebtTrackingAddDto;
import cn.bunny.dao.dto.financial.debtTracking.admin.DebtTrackingUpdateDto;
import cn.bunny.dao.entity.financial.DebtTracking;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.vo.financial.admin.DebtTrackingVo;

View File

@ -1,8 +1,8 @@
package cn.bunny.services.service.financial.impl;
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalAddDto;
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalDto;
import cn.bunny.dao.dto.financial.savingGoal.SavingGoalUpdateDto;
import cn.bunny.dao.dto.financial.savingGoal.admin.SavingGoalAddDto;
import cn.bunny.dao.dto.financial.savingGoal.admin.SavingGoalUpdateDto;
import cn.bunny.dao.entity.financial.SavingGoal;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.vo.financial.admin.SavingGoalVo;

View File

@ -38,7 +38,7 @@
left join sys_user update_user on update_user.id = base.update_user
<where>
base.is_deleted = 0
<if test="dto.userId != null and dto.userId != ''">
<if test="dto.userId != null">
and base.user_id = #{dto.userId}
</if>
<if test="dto.categoryName != null and dto.categoryName != ''">
@ -54,8 +54,10 @@
and base.amount like CONCAT('%',#{dto.amount},'%')
</if>
<if test="dto.startPeriod != null and dto.endPeriod != null">
and (base.start_period between #{dto.startPeriod} and #{dto.endPeriod})
and (
(base.start_period between #{dto.startPeriod} and #{dto.endPeriod})
or (base.end_period between #{dto.startPeriod} and #{dto.endPeriod})
)
</if>
</where>
</select>

View File

@ -49,7 +49,7 @@
and base.paid_amount like CONCAT('%',#{dto.paidAmount},'%')
</if>
<if test="dto.paymentStatus != null and dto.paymentStatus != ''">
and base.payment_status like CONCAT('%',#{dto.paymentStatus},'%')
and base.payment_status = #{dto.paymentStatus}
</if>
</where>
</select>

View File

@ -37,7 +37,7 @@
<where>
base.is_deleted = 0
<if test="dto.userId != null and dto.userId != ''">
and base.user_id like CONCAT('%',#{dto.userId},'%')
and base.user_id = #{dto.userId}
</if>
<if test="dto.debtorName != null and dto.debtorName != ''">
and base.debtor_name like CONCAT('%',#{dto.debtorName},'%')
@ -46,10 +46,10 @@
and base.debt_amount like CONCAT('%',#{dto.debtAmount},'%')
</if>
<if test="dto.debtType != null and dto.debtType != ''">
and base.debt_type like CONCAT('%',#{dto.debtType},'%')
and base.debt_type = #{dto.debtType}
</if>
<if test="dto.debtStatus != null and dto.debtStatus != ''">
and base.debt_status like CONCAT('%',#{dto.debtStatus},'%')
and base.debt_status = #{dto.debtStatus}
</if>
<if test="dto.dueDate != null and dto.dueDate != ''">
and base.due_date like CONCAT('%',#{dto.dueDate},'%')

View File

@ -49,8 +49,10 @@
and base.amount like CONCAT('%',#{dto.amount},'%')
</if>
<if test="dto.startDuration != null and dto.endDuration != null">
and (base.start_duration between #{dto.startDuration} and #{dto.endDuration})
and (
(base.start_duration between #{dto.startDuration} and #{dto.endDuration})
or (base.end_duration between #{dto.startDuration} and #{dto.endDuration})
)
</if>
</where>
</select>