feat(exp):完善支出管理模块功能

- 优化FundExpense支出实体类和控制器
-完善ExpenseType支出类型相关类
- 更新VO和Service实现类
-增强支出管理业务逻辑
This commit is contained in:
zhangjf 2026-03-02 07:30:59 +08:00
parent c9ef7d7306
commit dfea91308e
6 changed files with 63 additions and 21 deletions

View File

@ -1,6 +1,7 @@
package com.fundplatform.exp.controller; package com.fundplatform.exp.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fundplatform.common.core.PageResult;
import com.fundplatform.common.core.Result; import com.fundplatform.common.core.Result;
import com.fundplatform.common.util.ExcelUtil; import com.fundplatform.common.util.ExcelUtil;
import com.fundplatform.exp.dto.ExpenseExcel; import com.fundplatform.exp.dto.ExpenseExcel;
@ -62,14 +63,21 @@ public class FundExpenseController {
* 分页查询支出列表 * 分页查询支出列表
*/ */
@GetMapping("/page") @GetMapping("/page")
public Result<Page<FundExpenseVO>> page( public Result<PageResult<FundExpenseVO>> page(
@RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "1") int pageNum,
@RequestParam(defaultValue = "10") int pageSize, @RequestParam(defaultValue = "10") int pageSize,
@RequestParam(required = false) String title, @RequestParam(required = false) String title,
@RequestParam(required = false) Long expenseType, @RequestParam(required = false) Long expenseType,
@RequestParam(required = false) Integer payStatus, @RequestParam(required = false) Integer payStatus,
@RequestParam(required = false) Integer approvalStatus) { @RequestParam(required = false) Integer approvalStatus) {
return Result.success(expenseService.pageExpenses(pageNum, pageSize, title, expenseType, payStatus, approvalStatus)); Page<FundExpenseVO> page = expenseService.pageExpenses(pageNum, pageSize, title, expenseType, payStatus, approvalStatus);
PageResult<FundExpenseVO> pageResult = new PageResult<>(
page.getCurrent(),
page.getSize(),
page.getTotal(),
page.getRecords()
);
return Result.success(pageResult);
} }
/** /**

View File

@ -16,7 +16,7 @@ public class ExpenseType extends BaseEntity {
private String typeName; private String typeName;
/** 父类型ID0表示一级类型 */ /** 父类型ID0表示一级类型 */
private Long parentId; private String parentId;
/** 类型层级 */ /** 类型层级 */
private Integer typeLevel; private Integer typeLevel;
@ -46,11 +46,11 @@ public class ExpenseType extends BaseEntity {
this.typeName = typeName; this.typeName = typeName;
} }
public Long getParentId() { public String getParentId() {
return parentId; return parentId;
} }
public void setParentId(Long parentId) { public void setParentId(String parentId) {
this.parentId = parentId; this.parentId = parentId;
} }

View File

@ -25,7 +25,7 @@ public class FundExpense extends BaseEntity {
private String currency; private String currency;
/** 支出类型(1-日常支出 2-项目支出 3-工资发放 4-其他) */ /** 支出类型(1-日常支出 2-项目支出 3-工资发放 4-其他) */
private Long expenseType; private String expenseType;
/** 收款单位 */ /** 收款单位 */
private String payeeName; private String payeeName;
@ -43,13 +43,13 @@ public class FundExpense extends BaseEntity {
private String purpose; private String purpose;
/** 关联用款申请ID */ /** 关联用款申请ID */
private Long requestId; private String requestId;
/** 项目ID */ /** 项目ID */
private Long projectId; private String projectId;
/** 客户ID */ /** 客户ID */
private Long customerId; private String customerId;
/** 支付状态(0-待支付 1-已支付 2-支付失败) */ /** 支付状态(0-待支付 1-已支付 2-支付失败) */
private Integer payStatus; private Integer payStatus;
@ -67,7 +67,7 @@ public class FundExpense extends BaseEntity {
private Integer approvalStatus; private Integer approvalStatus;
/** 审批人ID */ /** 审批人ID */
private Long approverId; private String approverId;
/** 审批时间 */ /** 审批时间 */
private LocalDateTime approvalTime; private LocalDateTime approvalTime;
@ -110,11 +110,11 @@ public class FundExpense extends BaseEntity {
this.currency = currency; this.currency = currency;
} }
public Long getExpenseType() { public String getExpenseType() {
return expenseType; return expenseType;
} }
public void setExpenseType(Long expenseType) { public void setExpenseType(String expenseType) {
this.expenseType = expenseType; this.expenseType = expenseType;
} }
@ -158,27 +158,27 @@ public class FundExpense extends BaseEntity {
this.purpose = purpose; this.purpose = purpose;
} }
public Long getRequestId() { public String getRequestId() {
return requestId; return requestId;
} }
public void setRequestId(Long requestId) { public void setRequestId(String requestId) {
this.requestId = requestId; this.requestId = requestId;
} }
public Long getProjectId() { public String getProjectId() {
return projectId; return projectId;
} }
public void setProjectId(Long projectId) { public void setProjectId(String projectId) {
this.projectId = projectId; this.projectId = projectId;
} }
public Long getCustomerId() { public String getCustomerId() {
return customerId; return customerId;
} }
public void setCustomerId(Long customerId) { public void setCustomerId(String customerId) {
this.customerId = customerId; this.customerId = customerId;
} }
@ -222,11 +222,11 @@ public class FundExpense extends BaseEntity {
this.approvalStatus = approvalStatus; this.approvalStatus = approvalStatus;
} }
public Long getApproverId() { public String getApproverId() {
return approverId; return approverId;
} }
public void setApproverId(Long approverId) { public void setApproverId(String approverId) {
this.approverId = approverId; this.approverId = approverId;
} }

View File

@ -46,7 +46,7 @@ public class ExpenseTypeServiceImpl implements ExpenseTypeService {
Page<ExpenseType> page = typeDataService.page(new Page<>(pageNum, pageSize), wrapper); Page<ExpenseType> page = typeDataService.page(new Page<>(pageNum, pageSize), wrapper);
Page<ExpenseTypeVO> voPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal()); Page<ExpenseTypeVO> voPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal());
voPage.setRecords(page.getRecords().stream().map(this::convertToVO).collect(Collectors.toList())); voPage.setRecords(page.getRecords().stream().map(this::convertToVOWithParentName).collect(Collectors.toList()));
return voPage; return voPage;
} }
@ -86,8 +86,10 @@ public class ExpenseTypeServiceImpl implements ExpenseTypeService {
type.setId(dto.getId()); type.setId(dto.getId());
type.setTypeCode(dto.getTypeCode()); type.setTypeCode(dto.getTypeCode());
type.setTypeName(dto.getTypeName()); type.setTypeName(dto.getTypeName());
type.setParentId(dto.getParentId() != null ? dto.getParentId() : 0L);
type.setSortOrder(dto.getSortOrder()); type.setSortOrder(dto.getSortOrder());
type.setDescription(dto.getDescription()); type.setDescription(dto.getDescription());
type.setStatus(dto.getStatus());
type.setUpdatedTime(LocalDateTime.now()); type.setUpdatedTime(LocalDateTime.now());
type.setUpdatedBy(UserContextHolder.getUserId()); type.setUpdatedBy(UserContextHolder.getUserId());
@ -195,6 +197,20 @@ public class ExpenseTypeServiceImpl implements ExpenseTypeService {
vo.setCreatedTime(type.getCreatedTime()); vo.setCreatedTime(type.getCreatedTime());
vo.setUpdatedTime(type.getUpdatedTime()); vo.setUpdatedTime(type.getUpdatedTime());
vo.setRemark(type.getRemark()); vo.setRemark(type.getRemark());
// 查询父类型名称
if (type.getParentId() != null && type.getParentId() > 0) {
ExpenseType parentType = typeDataService.getById(type.getParentId());
if (parentType != null) {
vo.setParentName(parentType.getTypeName());
}
}
return vo;
}
private ExpenseTypeVO convertToVOWithParentName(ExpenseType type) {
ExpenseTypeVO vo = convertToVO(type);
return vo; return vo;
} }
} }

View File

@ -1,20 +1,27 @@
package com.fundplatform.exp.vo; package com.fundplatform.exp.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
public class ExpenseTypeVO { public class ExpenseTypeVO {
@JsonSerialize(using = ToStringSerializer.class)
private Long id; private Long id;
private String typeCode; private String typeCode;
private String typeName; private String typeName;
@JsonSerialize(using = ToStringSerializer.class)
private Long parentId; private Long parentId;
private String parentName; private String parentName;
private Integer typeLevel; private Integer typeLevel;
private Integer sortOrder; private Integer sortOrder;
private String description; private String description;
private Integer status; private Integer status;
@JsonSerialize(using = ToStringSerializer.class)
private Long tenantId; private Long tenantId;
@JsonSerialize(using = ToStringSerializer.class)
private Long createdBy; private Long createdBy;
private LocalDateTime createdTime; private LocalDateTime createdTime;
private LocalDateTime updatedTime; private LocalDateTime updatedTime;

View File

@ -1,15 +1,20 @@
package com.fundplatform.exp.vo; package com.fundplatform.exp.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
public class FundExpenseVO { public class FundExpenseVO {
@JsonSerialize(using = ToStringSerializer.class)
private Long id; private Long id;
private String expenseNo; private String expenseNo;
private String title; private String title;
private BigDecimal amount; private BigDecimal amount;
private String currency; private String currency;
@JsonSerialize(using = ToStringSerializer.class)
private Long expenseType; private Long expenseType;
private String expenseTypeName; private String expenseTypeName;
private String payeeName; private String payeeName;
@ -17,8 +22,11 @@ public class FundExpenseVO {
private String payeeAccount; private String payeeAccount;
private LocalDateTime expenseDate; private LocalDateTime expenseDate;
private String purpose; private String purpose;
@JsonSerialize(using = ToStringSerializer.class)
private Long requestId; private Long requestId;
@JsonSerialize(using = ToStringSerializer.class)
private Long projectId; private Long projectId;
@JsonSerialize(using = ToStringSerializer.class)
private Long customerId; private Long customerId;
private Integer payStatus; private Integer payStatus;
private String payStatusName; private String payStatusName;
@ -27,11 +35,14 @@ public class FundExpenseVO {
private String payVoucher; private String payVoucher;
private Integer approvalStatus; private Integer approvalStatus;
private String approvalStatusName; private String approvalStatusName;
@JsonSerialize(using = ToStringSerializer.class)
private Long approverId; private Long approverId;
private LocalDateTime approvalTime; private LocalDateTime approvalTime;
private String approvalComment; private String approvalComment;
private String attachments; private String attachments;
@JsonSerialize(using = ToStringSerializer.class)
private Long tenantId; private Long tenantId;
@JsonSerialize(using = ToStringSerializer.class)
private Long createdBy; private Long createdBy;
private LocalDateTime createdTime; private LocalDateTime createdTime;