refactor: 删除Blog模块

This commit is contained in:
2025-06-10 23:29:25 +08:00
parent 1bc78e80b7
commit 43500ede69
107 changed files with 155 additions and 1535 deletions

View File

@@ -3,12 +3,12 @@ package com.cxx.home.controller;
import com.cxx.common.ReadView;
import com.cxx.common.WriteView;
import com.cxx.common.dto.StatsChartDto;
import com.cxx.common.dto.bill.BillCategoryDto;
import com.cxx.common.dto.bill.BillItemDto;
import com.cxx.common.dto.bill.BillRecordDto;
import com.cxx.common.dto.bill.BillSummaryDto;
import com.cxx.home.dto.bill.BillCategoryDto;
import com.cxx.home.dto.bill.BillItemDto;
import com.cxx.home.dto.bill.BillRecordDto;
import com.cxx.home.dto.bill.BillSummaryDto;
import com.cxx.home.service.BillRecordService;
import com.cxx.common.vo.bill.BillQueryVo;
import com.cxx.home.vo.BillQueryVo;
import com.fasterxml.jackson.annotation.JsonView;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

View File

@@ -0,0 +1,58 @@
package com.cxx.home.controller;
import com.cxx.common.WriteView;
import com.cxx.home.dto.bill.BillCategoryDto;
import com.cxx.home.dto.bill.BillItemDto;
import com.cxx.home.service.BillManageService;
import com.fasterxml.jackson.annotation.JsonView;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/bill-manage")
@Tag(name = "账单管理")
public class BillManageController {
@Resource
private BillManageService billManageService;
@Operation(summary = "新增支付账户")
@PostMapping("/pay")
public Boolean addBillPay(@JsonView(WriteView.class) @RequestBody BillItemDto billItemDto) {
return billManageService.addBillPay(billItemDto);
}
@Operation(summary = "更新支付账户")
@PutMapping("/pay/{id}")
public Boolean updateBillPay(@PathVariable("id") Long id,
@JsonView(WriteView.class) @RequestBody BillItemDto billItemDto) {
return billManageService.updateBillPay(id, billItemDto);
}
@Operation(summary = "新增账本类型")
@PostMapping("/book")
public Boolean addBillBook(@JsonView(WriteView.class) @RequestBody BillItemDto billItemDto) {
return billManageService.addBillBook(billItemDto);
}
@Operation(summary = "更新账本类型")
@PutMapping("/book/{id}")
public Boolean updateBillBook(@PathVariable("id") Long id,
@JsonView(WriteView.class) @RequestBody BillItemDto billItemDto) {
return billManageService.updateBillBook(id, billItemDto);
}
@Operation(summary = "新增账单类型")
@PostMapping("/category")
public Boolean addBillCategory(@RequestBody BillCategoryDto billCategoryDto) {
return billManageService.addBillCategory(billCategoryDto);
}
@Operation(summary = "更新账单类型")
@PutMapping("/category/{id}")
public Boolean updateBillCategory(@PathVariable("id") Long id,
@RequestBody BillCategoryDto billCategoryDto) {
return billManageService.updateBillCategory(id, billCategoryDto);
}
}

View File

@@ -1,67 +0,0 @@
package com.cxx.home.controller;
import com.cxx.common.ReadView;
import com.cxx.common.WriteView;
import com.cxx.common.dto.StatsChartDto;
import com.cxx.common.dto.budget.BudgetDto;
import com.cxx.home.service.BudgetService;
import com.fasterxml.jackson.annotation.JsonView;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/budget")
@Tag(name = "预算统计")
public class BudgetController {
@Resource
private BudgetService budgetService;
@Operation(summary = "查询预算类别")
@GetMapping("/category")
public List<String> queryBudgetCategory() {
return budgetService.queryBudgetCategory();
}
@Operation(summary = "新增预算")
@PostMapping("")
public Boolean addBudget(@RequestBody @JsonView(WriteView.class) @Validated BudgetDto budgetDto) {
return budgetService.addBudget(budgetDto);
}
@Operation(summary = "更新预算")
@PutMapping("/{id}")
public Boolean updateBudget(@PathVariable("id") long id,
@RequestBody @JsonView(WriteView.class) BudgetDto budgetDto) {
return budgetService.updateBudget(id, budgetDto);
}
@Operation(summary = "删除预算")
@DeleteMapping("/{id}")
public Boolean deleteBudget(@PathVariable("id") long id) {
return budgetService.deleteBudget(id);
}
@Operation(summary = "查询预算")
@GetMapping("")
public @JsonView(ReadView.class) List<BudgetDto> queryBudget(@RequestParam("category") String category) {
return budgetService.queryBudget(category);
}
@Operation(summary = "预算排行统计")
@GetMapping("stats/rank")
public List<StatsChartDto> queryBudgetRankStats(@RequestParam("category") String category) {
return budgetService.queryBudgetRankStats(category);
}
@Operation(summary = "预算项目统计")
@GetMapping("stats/project")
public List<StatsChartDto> queryBudgetProjectStats(@RequestParam("category") String category) {
return budgetService.queryBudgetProjectStats(category);
}
}

View File

@@ -2,9 +2,9 @@ package com.cxx.home.controller;
import com.cxx.common.ReadView;
import com.cxx.common.WriteView;
import com.cxx.common.dto.plan.PlanDto;
import com.cxx.common.dto.plan.PlanStatsDto;
import com.cxx.common.vo.plan.PlanQueryVo;
import com.cxx.home.dto.plan.PlanDto;
import com.cxx.home.dto.plan.PlanStatsDto;
import com.cxx.home.vo.PlanQueryVo;
import com.cxx.home.service.PlanService;
import com.fasterxml.jackson.annotation.JsonView;
import io.swagger.v3.oas.annotations.Operation;

View File

@@ -1,8 +1,11 @@
package com.cxx.home.dao;
import com.cxx.common.dto.StatsChartDto;
import com.cxx.common.dto.bill.*;
import com.cxx.common.vo.bill.BillQueryVo;
import com.cxx.home.dto.bill.BillCategoryDto;
import com.cxx.home.dto.bill.BillItemDto;
import com.cxx.home.dto.bill.BillRecordDto;
import com.cxx.home.dto.bill.BillSummaryDto;
import com.cxx.home.vo.BillQueryVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

View File

@@ -1,17 +0,0 @@
package com.cxx.home.dao;
import com.cxx.common.dto.StatsChartDto;
import com.cxx.common.dto.budget.BudgetDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface BudgetDao {
List<BudgetDto> queryBudget(@Param("category") String category);
List<StatsChartDto> queryBudgetRankStats(@Param("category") String category);
List<StatsChartDto> queryBudgetProjectStats(@Param("category") String category);
}

View File

@@ -1,8 +1,8 @@
package com.cxx.home.dao;
import com.cxx.common.dto.plan.PlanDto;
import com.cxx.common.dto.plan.PlanStatsDto;
import com.cxx.common.vo.plan.PlanQueryVo;
import com.cxx.home.dto.plan.PlanDto;
import com.cxx.home.dto.plan.PlanStatsDto;
import com.cxx.home.vo.PlanQueryVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

View File

@@ -0,0 +1,18 @@
package com.cxx.home.dto.bill;
import com.cxx.common.PlainView;
import com.fasterxml.jackson.annotation.JsonView;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@JsonView(PlainView.class)
public class BillCategoryDto extends BillItemDto{
@Schema(description = "账本名称")
private String bookName;
@Schema(description = "账本类型")
private String type;
}

View File

@@ -0,0 +1,26 @@
package com.cxx.home.dto.bill;
import com.cxx.common.PlainView;
import com.cxx.common.ReadView;
import com.fasterxml.jackson.annotation.JsonView;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@JsonView(PlainView.class)
public class BillItemDto {
@Schema(description = "id")
@JsonView(ReadView.class)
private Long id;
@Schema(description = "名称")
private String name;
@Schema(description = "图标")
private String icon;
@Schema(description = "颜色")
private String color;
}

View File

@@ -0,0 +1,52 @@
package com.cxx.home.dto.bill;
import com.cxx.common.PlainView;
import com.cxx.common.ReadView;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonView;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
import java.util.List;
@Getter
@Setter
@JsonView(PlainView.class)
public class BillRecordDto {
@Schema(description = "id")
@JsonView(ReadView.class)
private Long id;
@Schema(description = "账本名称")
private String bookName;
@Schema(description = "账单类型")
private String type;
@Schema(description = "账单类别")
private String category;
@Schema(description = "账单地点")
private String location;
@Schema(description = "账单账户")
private String payAccount;
@Schema(description = "账单金额")
private Double amount;
@Schema(description = "账单内容")
private String content;
@Schema(description = "账单备注")
private String remark;
@Schema(description = "账单图片")
private List<String> imageList;
@Schema(description = "账单日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date date;
}

View File

@@ -0,0 +1,49 @@
package com.cxx.home.dto.bill;
import com.cxx.common.PlainView;
import com.cxx.common.ReadView;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonView;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
import java.util.List;
@Getter
@Setter
@JsonView(PlainView.class)
public class BillSummaryDto {
@Schema(description = "id")
@JsonView(ReadView.class)
private Long id;
@Schema(description = "账本名称")
private String bookName;
@Schema(description = "账单类型")
private String type;
@Schema(description = "账单类别")
private String category;
@Schema(description = "账单地点")
private String location;
@Schema(description = "账单账户")
private String payAccount;
@Schema(description = "账单金额")
private Double amount;
@Schema(description = "账单内容")
private String content;
@Schema(description = "账单备注")
private String remark;
@Schema(description = "账单日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date date;
}

View File

@@ -0,0 +1,10 @@
package com.cxx.home.dto.message;
import lombok.Data;
@Data
public class MailMessageDto {
private String to;
private String subject;
private String body;
}

View File

@@ -0,0 +1,62 @@
package com.cxx.home.dto.plan;
import com.cxx.common.PlainView;
import com.cxx.common.ReadView;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonView;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
@Getter
@Setter
@JsonView(PlainView.class)
public class PlanDto {
@Schema(description = "id")
@JsonView(ReadView.class)
private Long id;
@Schema(description = "标题")
@NotBlank(message = "标题不能为空")
private String title;
@Schema(description = "内容")
private String content;
@Schema(description = "日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date date;
@Schema(description = "开始时间")
@JsonFormat(pattern = "HH:mm", timezone = "GMT+8")
private Date startTime;
@Schema(description = "结束时间")
@JsonFormat(pattern = "HH:mm", timezone = "GMT+8")
private Date endTime;
@Schema(description = "提醒时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date alterTime;
@Schema(description = "邮箱地址")
private String email;
@Schema(description = "任务id")
private Long taskId;
@Schema(description = "标签")
private String tag;
@Schema(description = "是否置顶")
private Integer isTop;
@Schema(description = "优先级")
private Integer priority;
@Schema(description = "是否完成")
private Integer completed;
}

View File

@@ -0,0 +1,21 @@
package com.cxx.home.dto.plan;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class PlanStatsDto {
@Schema(description = "计划总数")
private Integer totalCount;
@Schema(description = "完成总数")
private Integer completedCount;
@Schema(description = "当前计划")
private Integer currentCount;
@Schema(description = "过期计划")
private Integer remainCount;
}

View File

@@ -0,0 +1,25 @@
package com.cxx.home.dto.task;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
@Getter
@Setter
public class TaskDto {
@Schema(description = "任务类型")
private String type;
@Schema(description = "任务内容")
private String content;
@Schema(description = "执行时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date executeTime;
@Schema(description = "定时任务表达式")
private String cronExpression;
}

View File

@@ -0,0 +1,21 @@
package com.cxx.home.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cxx.framework.data.AbstractEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("bill_book")
public class BillBook extends AbstractEntity {
@TableField("name")
private String name;
@TableField("icon")
private String icon;
@TableField("color")
private String color;
}

View File

@@ -0,0 +1,27 @@
package com.cxx.home.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cxx.framework.data.AbstractEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("bill_category")
public class BillCategory extends AbstractEntity {
@TableField("book_id")
private Long bookId;
@TableField("name")
private String name;
@TableField("type")
private String type;
@TableField("icon")
private String icon;
@TableField("color")
private String color;
}

View File

@@ -0,0 +1,15 @@
package com.cxx.home.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName("bill_image")
public class BillImage {
@TableField("bill_id")
private Long billId;
@TableField("image_url")
private String imageUrl;
}

View File

@@ -0,0 +1,21 @@
package com.cxx.home.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cxx.framework.data.AbstractEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("bill_pay")
public class BillPay extends AbstractEntity {
@TableField("name")
private String name;
@TableField("icon")
private String icon;
@TableField("color")
private String color;
}

View File

@@ -0,0 +1,41 @@
package com.cxx.home.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cxx.framework.data.AbstractEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("bill_record")
public class BillRecord extends AbstractEntity {
@TableField("book_id")
private Long bookId;
@TableField("type")
private String type;
@TableField("category_id")
private Long categoryId;
@TableField("location")
private String location;
@TableField("date")
private Date date;
@TableField("amount")
private Double amount;
@TableField("content")
private String content;
@TableField("pay_id")
private Long payId;
@TableField("remark")
private String remark;
}

View File

@@ -0,0 +1,48 @@
package com.cxx.home.entity;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cxx.framework.data.AbstractEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("plan")
public class Plan extends AbstractEntity {
@TableField("title")
private String title;
@TableField("content")
private String content;
@TableField(value = "date", updateStrategy = FieldStrategy.ALWAYS)
private Date date;
@TableField(value = "start_time", updateStrategy = FieldStrategy.ALWAYS)
private Date startTime;
@TableField(value = "end_time", updateStrategy = FieldStrategy.ALWAYS)
private Date endTime;
@TableField(value = "alter_time", updateStrategy = FieldStrategy.ALWAYS)
private Date alterTime;
@TableField(value = "task_id", updateStrategy = FieldStrategy.ALWAYS)
private Long taskId;
@TableField("tag")
private String tag;
@TableField("is_top")
private Integer isTop;
@TableField("priority")
private Integer priority;
@TableField("completed")
private Integer completed;
}

View File

@@ -0,0 +1,27 @@
package com.cxx.home.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cxx.framework.data.AbstractEntity;
import com.cxx.framework.data.AbstractIdEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("task")
public class Task extends AbstractIdEntity {
@TableField("type")
private String type;
@TableField("content")
private String content;
@TableField("execute_time")
private Date executeTime;
@TableField("cron_expression")
private String cronExpression;
}

View File

@@ -0,0 +1,9 @@
package com.cxx.home.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cxx.home.entity.BillBook;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface BillBookMapper extends BaseMapper<BillBook> {
}

View File

@@ -0,0 +1,9 @@
package com.cxx.home.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cxx.home.entity.BillCategory;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface BillCategoryMapper extends BaseMapper<BillCategory> {
}

View File

@@ -0,0 +1,9 @@
package com.cxx.home.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cxx.home.entity.BillImage;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface BillImageMapper extends BaseMapper<BillImage> {
}

View File

@@ -0,0 +1,9 @@
package com.cxx.home.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cxx.home.entity.BillPay;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface BillPayMapper extends BaseMapper<BillPay> {
}

View File

@@ -0,0 +1,9 @@
package com.cxx.home.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cxx.home.entity.BillRecord;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface BillRecordMapper extends BaseMapper<BillRecord> {
}

View File

@@ -0,0 +1,9 @@
package com.cxx.home.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cxx.home.entity.Plan;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PlanMapper extends BaseMapper<Plan> {
}

View File

@@ -0,0 +1,9 @@
package com.cxx.home.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cxx.home.entity.Task;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TaskMapper extends BaseMapper<Task> {
}

View File

@@ -1,7 +1,7 @@
package com.cxx.home.schedule;
import com.cxx.common.dto.task.TaskDto;
import com.cxx.home.dto.task.TaskDto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

View File

@@ -1,9 +1,9 @@
package com.cxx.home.schedule;
import com.cxx.common.dto.message.MailMessageDto;
import com.cxx.common.entity.Task;
import com.cxx.home.dto.message.MailMessageDto;
import com.cxx.home.entity.Task;
import com.cxx.framework.web.CustomException;
import com.cxx.common.mapper.TaskMapper;
import com.cxx.home.mapper.TaskMapper;
import com.cxx.home.service.MessageService;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

View File

@@ -1,6 +1,6 @@
package com.cxx.home.schedule;
import com.cxx.common.entity.Task;
import com.cxx.home.entity.Task;
import com.cxx.framework.web.CustomException;
import org.quartz.*;
import org.springframework.stereotype.Component;

View File

@@ -0,0 +1,18 @@
package com.cxx.home.service;
import com.cxx.home.dto.bill.BillCategoryDto;
import com.cxx.home.dto.bill.BillItemDto;
public interface BillManageService {
Boolean addBillPay(BillItemDto billItemDto);
Boolean updateBillPay(Long id, BillItemDto billItemDto);
Boolean addBillBook(BillItemDto billItemDto);
Boolean updateBillBook(Long id,BillItemDto billItemDto);
Boolean addBillCategory(BillCategoryDto billCategoryDto);
Boolean updateBillCategory(Long id, BillCategoryDto billCategoryDto);
}

View File

@@ -1,11 +1,11 @@
package com.cxx.home.service;
import com.cxx.common.dto.StatsChartDto;
import com.cxx.common.dto.bill.BillCategoryDto;
import com.cxx.common.dto.bill.BillItemDto;
import com.cxx.common.dto.bill.BillRecordDto;
import com.cxx.common.dto.bill.BillSummaryDto;
import com.cxx.common.vo.bill.BillQueryVo;
import com.cxx.home.dto.bill.BillCategoryDto;
import com.cxx.home.dto.bill.BillItemDto;
import com.cxx.home.dto.bill.BillRecordDto;
import com.cxx.home.dto.bill.BillSummaryDto;
import com.cxx.home.vo.BillQueryVo;
import java.util.List;

View File

@@ -1,23 +0,0 @@
package com.cxx.home.service;
import com.cxx.common.dto.StatsChartDto;
import com.cxx.common.dto.budget.BudgetDto;
import java.util.List;
public interface BudgetService {
List<String> queryBudgetCategory();
Boolean addBudget(BudgetDto budgetDto);
Boolean updateBudget(Long id, BudgetDto budgetDto);
Boolean deleteBudget(Long id);
List<BudgetDto> queryBudget(String category);
List<StatsChartDto> queryBudgetRankStats(String category);
List<StatsChartDto> queryBudgetProjectStats(String category);
}

View File

@@ -1,6 +1,6 @@
package com.cxx.home.service;
import com.cxx.common.dto.message.MailMessageDto;
import com.cxx.home.dto.message.MailMessageDto;
public interface MessageService {
void sendMailMessage(MailMessageDto mailMessageDto);

View File

@@ -1,8 +1,8 @@
package com.cxx.home.service;
import com.cxx.common.dto.plan.PlanDto;
import com.cxx.common.dto.plan.PlanStatsDto;
import com.cxx.common.vo.plan.PlanQueryVo;
import com.cxx.home.dto.plan.PlanDto;
import com.cxx.home.dto.plan.PlanStatsDto;
import com.cxx.home.vo.PlanQueryVo;
import java.util.List;

View File

@@ -1,6 +1,6 @@
package com.cxx.home.service;
import com.cxx.common.entity.Task;
import com.cxx.home.entity.Task;
import com.cxx.home.schedule.QuartzDto;
import org.quartz.JobKey;

View File

@@ -1,6 +1,6 @@
package com.cxx.home.service;
import com.cxx.common.dto.task.TaskDto;
import com.cxx.home.dto.task.TaskDto;
public interface TaskService {

View File

@@ -0,0 +1,134 @@
package com.cxx.home.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.cxx.home.dto.bill.BillCategoryDto;
import com.cxx.home.dto.bill.BillItemDto;
import com.cxx.framework.web.CustomException;
import com.cxx.home.entity.BillBook;
import com.cxx.home.entity.BillCategory;
import com.cxx.home.entity.BillPay;
import com.cxx.home.mapper.BillBookMapper;
import com.cxx.home.mapper.BillCategoryMapper;
import com.cxx.home.mapper.BillPayMapper;
import com.cxx.home.service.BillManageService;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.Objects;
@Service
public class BillManageServiceImpl implements BillManageService {
@Resource
private BillPayMapper billPayMapper;
@Resource
private BillBookMapper billBookMapper;
@Resource
private BillCategoryMapper billCategoryMapper;
@Override
public Boolean addBillPay(BillItemDto billItemDto) {
// 1. 校验是否存在
LambdaQueryWrapper<BillPay> queryWrapper = new LambdaQueryWrapper<>();
if (billPayMapper.exists(queryWrapper.eq(BillPay::getName, billItemDto.getName()))) {
throw new CustomException("该账户已经存在");
}
// 2. 新增账户
BillPay newbillPay = new BillPay();
BeanUtils.copyProperties(billItemDto, newbillPay);
return billPayMapper.insert(newbillPay) == 1;
}
@Override
public Boolean updateBillPay(Long id, BillItemDto billItemDto) {
// 1. 校验是否存在
if (Objects.isNull(billPayMapper.selectById(id))) {
throw new RuntimeException("该账户不存在");
}
// 2. 更新账户
BillPay billPay = new BillPay();
BeanUtils.copyProperties(billItemDto, billPay);
billPay.setId(id);
return billPayMapper.updateById(billPay) == 1;
}
@Override
public Boolean addBillBook(BillItemDto billItemDto) {
// 1. 校验是否存在
LambdaQueryWrapper<BillBook> queryWrapper = new LambdaQueryWrapper<>();
if (billBookMapper.exists(queryWrapper.eq(BillBook::getName, billItemDto.getName()))) {
throw new CustomException("该账本已经存在");
}
// 2. 新增账本
BillBook billBook = new BillBook();
BeanUtils.copyProperties(billItemDto, billBook);
return billBookMapper.insert(billBook) == 1;
}
@Override
public Boolean updateBillBook(Long id, BillItemDto billItemDto) {
// 1. 校验是否存在
if (Objects.isNull(billBookMapper.selectById(id))) {
throw new CustomException("该账单不存在");
}
// 2. 更新账本
BillBook billBook = new BillBook();
BeanUtils.copyProperties(billItemDto, billBook);
billBook.setId(id);
return billBookMapper.updateById(billBook) == 1;
}
private Long getBillBook(String name) {
LambdaQueryWrapper<BillBook> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BillBook::getName, name);
BillBook billBook = billBookMapper.selectOne(queryWrapper);
if (Objects.isNull(billBook)) {
throw new CustomException("该账本类型不存在");
}
return billBook.getId();
}
@Override
public Boolean addBillCategory(BillCategoryDto billCategoryDto) {
// 1. 校验是否存在
LambdaQueryWrapper<BillCategory> queryWrapper = new LambdaQueryWrapper<>();
if (billCategoryMapper.exists(queryWrapper.eq(BillCategory::getName, billCategoryDto.getName()))) {
throw new CustomException("该账单类型已经存在");
}
// 2. 新增账单类型
BillCategory newBillCategory = new BillCategory();
BeanUtils.copyProperties(billCategoryDto, newBillCategory);
newBillCategory.setBookId(getBillBook(billCategoryDto.getBookName()));
return billCategoryMapper.insert(newBillCategory) == 1;
}
@Override
public Boolean updateBillCategory(Long id, BillCategoryDto billCategoryDto) {
// 1. 校验是否存在
if (Objects.isNull(billCategoryMapper.selectById(id))) {
throw new CustomException("该账单类型不存在");
}
// 2. 更新账单类型
BillCategory billCategory = new BillCategory();
BeanUtils.copyProperties(billCategoryDto, billCategory);
billCategory.setBookId(getBillBook(billCategoryDto.getBookName()));
billCategory.setId(id);
return billCategoryMapper.updateById(billCategory) == 1;
}
}

View File

@@ -3,21 +3,16 @@ package com.cxx.home.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.cxx.common.dto.StatsChartDto;
import com.cxx.common.dto.bill.*;
import com.cxx.common.entity.*;
import com.cxx.common.mapper.*;
import com.cxx.common.entity.BillBook;
import com.cxx.common.entity.BillCategory;
import com.cxx.common.entity.BillPay;
import com.cxx.common.entity.BillRecord;
import com.cxx.common.mapper.BillBookMapper;
import com.cxx.common.mapper.BillCategoryMapper;
import com.cxx.common.mapper.BillPayMapper;
import com.cxx.common.mapper.BillRecordMapper;
import com.cxx.home.dto.bill.BillCategoryDto;
import com.cxx.home.dto.bill.BillItemDto;
import com.cxx.home.dto.bill.BillRecordDto;
import com.cxx.home.dto.bill.BillSummaryDto;
import com.cxx.home.entity.*;
import com.cxx.home.mapper.*;
import com.cxx.framework.web.CustomException;
import com.cxx.home.dao.BillDao;
import com.cxx.home.service.BillRecordService;
import com.cxx.common.vo.bill.BillQueryVo;
import com.cxx.home.vo.BillQueryVo;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

View File

@@ -1,88 +0,0 @@
package com.cxx.home.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.toolkit.SimpleQuery;
import com.cxx.common.dto.StatsChartDto;
import com.cxx.common.dto.budget.BudgetDto;
import com.cxx.common.entity.Budget;
import com.cxx.common.entity.BudgetCategory;
import com.cxx.common.mapper.BudgetCategoryMapper;
import com.cxx.common.mapper.BudgetMapper;
import com.cxx.home.dao.BudgetDao;
import com.cxx.home.service.BudgetService;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
@Service
public class BudgetServiceImpl implements BudgetService {
@Resource
private BudgetDao budgetDao;
@Resource
private BudgetMapper budgetMapper;
@Resource
private BudgetCategoryMapper budgetCategoryMapper;
@Override
public List<String> queryBudgetCategory() {
LambdaQueryWrapper<BudgetCategory> queryWrapper = Wrappers.lambdaQuery(BudgetCategory.class);
return SimpleQuery.list(queryWrapper.select(BudgetCategory::getName), BudgetCategory::getName);
}
@Override
public Boolean addBudget(BudgetDto budgetDto) {
Budget budge = new Budget();
BeanUtils.copyProperties(budgetDto, budge);
budge.setCategoryId(getBudgetCategory(budgetDto.getCategory()));
return budgetMapper.insert(budge) == 1;
}
@Override
public Boolean updateBudget(Long id, BudgetDto budgetDto) {
Budget budge = new Budget();
BeanUtils.copyProperties(budgetDto, budge);
budge.setCategoryId(getBudgetCategory(budgetDto.getCategory()));
budge.setId(id);
return budgetMapper.updateById(budge) == 1;
}
private Long getBudgetCategory(String category) {
LambdaQueryWrapper<BudgetCategory> queryWrapper = new LambdaQueryWrapper<>();
BudgetCategory budgetCategory = budgetCategoryMapper.selectOne(queryWrapper.eq(BudgetCategory::getName, category));
if (Objects.isNull(budgetCategory)) {
BudgetCategory newBudgetCategory = new BudgetCategory();
newBudgetCategory.setName(category);
budgetCategoryMapper.insert(newBudgetCategory);
return newBudgetCategory.getId();
} else {
return budgetCategory.getId();
}
}
@Override
public Boolean deleteBudget(Long id) {
return budgetMapper.deleteById(id) == 1;
}
@Override
public List<BudgetDto> queryBudget(String category) {
return budgetDao.queryBudget(category);
}
@Override
public List<StatsChartDto> queryBudgetRankStats(String category) {
return budgetDao.queryBudgetRankStats(category);
}
@Override
public List<StatsChartDto> queryBudgetProjectStats(String category) {
return budgetDao.queryBudgetProjectStats(category);
}
}

View File

@@ -1,6 +1,6 @@
package com.cxx.home.service.impl;
import com.cxx.common.dto.message.MailMessageDto;
import com.cxx.home.dto.message.MailMessageDto;
import com.cxx.home.service.MessageService;
import jakarta.annotation.Resource;
import jakarta.mail.MessagingException;

View File

@@ -3,13 +3,13 @@ package com.cxx.home.service.impl;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.cxx.common.dto.message.MailMessageDto;
import com.cxx.common.dto.plan.PlanDto;
import com.cxx.common.dto.plan.PlanStatsDto;
import com.cxx.common.dto.task.TaskDto;
import com.cxx.common.entity.Plan;
import com.cxx.common.mapper.PlanMapper;
import com.cxx.common.vo.plan.PlanQueryVo;
import com.cxx.home.dto.message.MailMessageDto;
import com.cxx.home.dto.plan.PlanDto;
import com.cxx.home.dto.plan.PlanStatsDto;
import com.cxx.home.dto.task.TaskDto;
import com.cxx.home.entity.Plan;
import com.cxx.home.mapper.PlanMapper;
import com.cxx.home.vo.PlanQueryVo;
import com.cxx.home.dao.PlanDao;
import com.cxx.home.schedule.TaskType;
import com.cxx.home.service.PlanService;

View File

@@ -1,7 +1,7 @@
package com.cxx.home.service.impl;
import com.cxx.common.entity.Task;
import com.cxx.common.mapper.TaskMapper;
import com.cxx.home.entity.Task;
import com.cxx.home.mapper.TaskMapper;
import com.cxx.framework.web.CustomException;
import com.cxx.home.schedule.QuartzDto;
import com.cxx.home.schedule.QuartzUtils;

View File

@@ -1,8 +1,8 @@
package com.cxx.home.service.impl;
import com.cxx.common.dto.task.TaskDto;
import com.cxx.common.entity.Task;
import com.cxx.common.mapper.TaskMapper;
import com.cxx.home.dto.task.TaskDto;
import com.cxx.home.entity.Task;
import com.cxx.home.mapper.TaskMapper;
import com.cxx.home.service.QuartzService;
import com.cxx.home.service.TaskService;
import jakarta.annotation.Resource;

View File

@@ -0,0 +1,21 @@
package com.cxx.home.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class BillQueryVo {
@Schema(description = "账本名称")
private String bookName;
@Schema(description = "账单类型")
private String type;
@Schema(description = "开始日期")
private String startDate;
@Schema(description = "结束日期")
private String endDate;
}

View File

@@ -0,0 +1,15 @@
package com.cxx.home.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class PlanQueryVo {
@Schema(description = "数据类型")
private String planType;
@Schema(description = "排序类型")
private String orderType;
}