feat: 添加存储已存储金额

This commit is contained in:
Bunny 2024-11-29 16:56:22 +08:00
parent afd8591020
commit 60592ec580
12 changed files with 41 additions and 3 deletions

View File

@ -29,6 +29,9 @@ public class SavingGoalDto {
@Schema(name = "amount", title = "目标金额")
private BigDecimal amount;
@Schema(name = "amountDeposited", title = "已存入金额")
private BigDecimal amountDeposited;
@Schema(name = "startDuration", title = "开始目标时长")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
private LocalDate startDuration;

View File

@ -39,6 +39,11 @@ public class SavingGoalAddDto {
@Min(value = 0, message = "储蓄值不能小于0")
private BigDecimal amount;
@Schema(name = "amountDeposited", title = "已存入金额")
@NotNull(message = "目标金额不能为空")
@Min(value = 0, message = "储蓄值不能小于0")
private BigDecimal amountDeposited;
@Schema(name = "startDuration", title = "开始目标时长")
@NotNull(message = "开始目标时长不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")

View File

@ -43,6 +43,11 @@ public class SavingGoalUpdateDto {
@Min(value = 0, message = "金额格式不正确")
private BigDecimal amount;
@Schema(name = "amountDeposited", title = "已存入金额")
@NotNull(message = "目标金额不能为空")
@Min(value = 0, message = "储蓄值不能小于0")
private BigDecimal amountDeposited;
@Schema(name = "startDuration", title = "开始目标时长")
@NotNull(message = "开始目标时长不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")

View File

@ -35,6 +35,11 @@ public class SavingGoalAddUserDto {
@Min(value = 0, message = "储蓄值不能小于0")
private BigDecimal amount;
@Schema(name = "amountDeposited", title = "已存入金额")
@NotNull(message = "目标金额不能为空")
@Min(value = 0, message = "储蓄值不能小于0")
private BigDecimal amountDeposited;
@Schema(name = "startDuration", title = "开始目标时长")
@NotNull(message = "开始目标时长不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")

View File

@ -39,6 +39,11 @@ public class SavingGoalUpdateUserDto {
@Min(value = 0, message = "金额格式不正确")
private BigDecimal amount;
@Schema(name = "amountDeposited", title = "已存入金额")
@NotNull(message = "目标金额不能为空")
@Min(value = 0, message = "储蓄值不能小于0")
private BigDecimal amountDeposited;
@Schema(name = "startDuration", title = "开始目标时长")
@NotNull(message = "开始目标时长不能为空")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")

View File

@ -37,6 +37,9 @@ public class SavingGoal extends BaseEntity {
@Schema(name = "amount", title = "目标金额")
private BigDecimal amount;
@Schema(name = "amountDeposited", title = "已存入金额")
private BigDecimal amountDeposited;
@Schema(name = "startDuration", title = "开始目标时长")
private LocalDateTime startDuration;

View File

@ -39,6 +39,9 @@ public class SavingGoalVo extends BaseUserVo {
@Schema(name = "amount", title = "目标金额")
private BigDecimal amount;
@Schema(name = "amountDeposited", title = "已存入金额")
private BigDecimal amountDeposited;
@Schema(name = "startDuration", title = "开始目标时长")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonSerialize(using = LocalDateTimeSerializer.class)

View File

@ -29,6 +29,9 @@ public class SavingGoalUserVo extends BaseVo {
@Schema(name = "amount", title = "目标金额")
private BigDecimal amount;
@Schema(name = "amountDeposited", title = "已存入金额")
private BigDecimal amountDeposited;
@Schema(name = "startDuration", title = "开始目标时长")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonSerialize(using = LocalDateTimeSerializer.class)

View File

@ -4,6 +4,7 @@ import cn.bunny.dao.dto.financial.savingGoal.SavingGoalDto;
import cn.bunny.dao.dto.financial.savingGoal.admin.SavingGoalAddDto;
import cn.bunny.dao.dto.financial.savingGoal.admin.SavingGoalUpdateDto;
import cn.bunny.dao.dto.financial.savingGoal.user.SavingGoalAddUserDto;
import cn.bunny.dao.dto.financial.savingGoal.user.SavingGoalUpdateUserDto;
import cn.bunny.dao.entity.financial.SavingGoal;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.pojo.result.Result;
@ -87,7 +88,7 @@ public class SavingGoalController {
@Operation(summary = "用户更新储值", description = "用户更新储值")
@PutMapping("noManage/updateUserSavingGoal")
public Mono<Result<String>> updateUserSavingGoal(@Valid @RequestBody SavingGoalUpdateDto dto) {
public Mono<Result<String>> updateUserSavingGoal(@Valid @RequestBody SavingGoalUpdateUserDto dto) {
savingGoalService.updateUserSavingGoal(dto);
return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS));
}

View File

@ -4,6 +4,7 @@ import cn.bunny.dao.dto.financial.savingGoal.SavingGoalDto;
import cn.bunny.dao.dto.financial.savingGoal.admin.SavingGoalAddDto;
import cn.bunny.dao.dto.financial.savingGoal.admin.SavingGoalUpdateDto;
import cn.bunny.dao.dto.financial.savingGoal.user.SavingGoalAddUserDto;
import cn.bunny.dao.dto.financial.savingGoal.user.SavingGoalUpdateUserDto;
import cn.bunny.dao.entity.financial.SavingGoal;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.vo.financial.admin.SavingGoalVo;
@ -73,7 +74,7 @@ public interface SavingGoalService extends IService<SavingGoal> {
*
* @param dto 更新表单
*/
void updateUserSavingGoal(SavingGoalUpdateDto dto);
void updateUserSavingGoal(@Valid SavingGoalUpdateUserDto dto);
/**
* 用户删除储值

View File

@ -6,6 +6,7 @@ import cn.bunny.dao.dto.financial.savingGoal.SavingGoalDto;
import cn.bunny.dao.dto.financial.savingGoal.admin.SavingGoalAddDto;
import cn.bunny.dao.dto.financial.savingGoal.admin.SavingGoalUpdateDto;
import cn.bunny.dao.dto.financial.savingGoal.user.SavingGoalAddUserDto;
import cn.bunny.dao.dto.financial.savingGoal.user.SavingGoalUpdateUserDto;
import cn.bunny.dao.entity.financial.SavingGoal;
import cn.bunny.dao.pojo.result.PageResult;
import cn.bunny.dao.pojo.result.ResultCodeEnum;
@ -147,7 +148,7 @@ public class SavingGoalServiceImpl extends ServiceImpl<SavingGoalMapper, SavingG
* @param dto 更新表单
*/
@Override
public void updateUserSavingGoal(SavingGoalUpdateDto dto) {
public void updateUserSavingGoal(@Valid SavingGoalUpdateUserDto dto) {
// 更新内容
SavingGoal savingGoal = new SavingGoal();
BeanUtils.copyProperties(dto, savingGoal);

View File

@ -48,6 +48,9 @@
<if test="dto.amount != null and dto.amount != ''">
and base.amount like CONCAT('%',#{dto.amount},'%')
</if>
<if test="dto.amountDeposited != null and dto.amountDeposited != ''">
and base.amount_deposited like CONCAT('%',#{dto.amountDeposited},'%')
</if>
<if test="dto.startDuration != null and dto.endDuration != null">
and (
(base.start_duration between #{dto.startDuration} and #{dto.endDuration})