feat(exp):完善支出管理模块功能
- 优化FundExpense支出实体类和控制器 -完善ExpenseType支出类型相关类 - 更新VO和Service实现类 -增强支出管理业务逻辑
This commit is contained in:
parent
c9ef7d7306
commit
dfea91308e
@ -1,6 +1,7 @@
|
||||
package com.fundplatform.exp.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fundplatform.common.core.PageResult;
|
||||
import com.fundplatform.common.core.Result;
|
||||
import com.fundplatform.common.util.ExcelUtil;
|
||||
import com.fundplatform.exp.dto.ExpenseExcel;
|
||||
@ -62,14 +63,21 @@ public class FundExpenseController {
|
||||
* 分页查询支出列表
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public Result<Page<FundExpenseVO>> page(
|
||||
public Result<PageResult<FundExpenseVO>> page(
|
||||
@RequestParam(defaultValue = "1") int pageNum,
|
||||
@RequestParam(defaultValue = "10") int pageSize,
|
||||
@RequestParam(required = false) String title,
|
||||
@RequestParam(required = false) Long expenseType,
|
||||
@RequestParam(required = false) Integer payStatus,
|
||||
@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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -16,7 +16,7 @@ public class ExpenseType extends BaseEntity {
|
||||
private String typeName;
|
||||
|
||||
/** 父类型ID(0表示一级类型) */
|
||||
private Long parentId;
|
||||
private String parentId;
|
||||
|
||||
/** 类型层级 */
|
||||
private Integer typeLevel;
|
||||
@ -46,11 +46,11 @@ public class ExpenseType extends BaseEntity {
|
||||
this.typeName = typeName;
|
||||
}
|
||||
|
||||
public Long getParentId() {
|
||||
public String getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId) {
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ public class FundExpense extends BaseEntity {
|
||||
private String currency;
|
||||
|
||||
/** 支出类型(1-日常支出 2-项目支出 3-工资发放 4-其他) */
|
||||
private Long expenseType;
|
||||
private String expenseType;
|
||||
|
||||
/** 收款单位 */
|
||||
private String payeeName;
|
||||
@ -43,13 +43,13 @@ public class FundExpense extends BaseEntity {
|
||||
private String purpose;
|
||||
|
||||
/** 关联用款申请ID */
|
||||
private Long requestId;
|
||||
private String requestId;
|
||||
|
||||
/** 项目ID */
|
||||
private Long projectId;
|
||||
private String projectId;
|
||||
|
||||
/** 客户ID */
|
||||
private Long customerId;
|
||||
private String customerId;
|
||||
|
||||
/** 支付状态(0-待支付 1-已支付 2-支付失败) */
|
||||
private Integer payStatus;
|
||||
@ -67,7 +67,7 @@ public class FundExpense extends BaseEntity {
|
||||
private Integer approvalStatus;
|
||||
|
||||
/** 审批人ID */
|
||||
private Long approverId;
|
||||
private String approverId;
|
||||
|
||||
/** 审批时间 */
|
||||
private LocalDateTime approvalTime;
|
||||
@ -110,11 +110,11 @@ public class FundExpense extends BaseEntity {
|
||||
this.currency = currency;
|
||||
}
|
||||
|
||||
public Long getExpenseType() {
|
||||
public String getExpenseType() {
|
||||
return expenseType;
|
||||
}
|
||||
|
||||
public void setExpenseType(Long expenseType) {
|
||||
public void setExpenseType(String expenseType) {
|
||||
this.expenseType = expenseType;
|
||||
}
|
||||
|
||||
@ -158,27 +158,27 @@ public class FundExpense extends BaseEntity {
|
||||
this.purpose = purpose;
|
||||
}
|
||||
|
||||
public Long getRequestId() {
|
||||
public String getRequestId() {
|
||||
return requestId;
|
||||
}
|
||||
|
||||
public void setRequestId(Long requestId) {
|
||||
public void setRequestId(String requestId) {
|
||||
this.requestId = requestId;
|
||||
}
|
||||
|
||||
public Long getProjectId() {
|
||||
public String getProjectId() {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
public void setProjectId(Long projectId) {
|
||||
public void setProjectId(String projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public Long getCustomerId() {
|
||||
public String getCustomerId() {
|
||||
return customerId;
|
||||
}
|
||||
|
||||
public void setCustomerId(Long customerId) {
|
||||
public void setCustomerId(String customerId) {
|
||||
this.customerId = customerId;
|
||||
}
|
||||
|
||||
@ -222,11 +222,11 @@ public class FundExpense extends BaseEntity {
|
||||
this.approvalStatus = approvalStatus;
|
||||
}
|
||||
|
||||
public Long getApproverId() {
|
||||
public String getApproverId() {
|
||||
return approverId;
|
||||
}
|
||||
|
||||
public void setApproverId(Long approverId) {
|
||||
public void setApproverId(String approverId) {
|
||||
this.approverId = approverId;
|
||||
}
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ public class ExpenseTypeServiceImpl implements ExpenseTypeService {
|
||||
|
||||
Page<ExpenseType> page = typeDataService.page(new Page<>(pageNum, pageSize), wrapper);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -86,8 +86,10 @@ public class ExpenseTypeServiceImpl implements ExpenseTypeService {
|
||||
type.setId(dto.getId());
|
||||
type.setTypeCode(dto.getTypeCode());
|
||||
type.setTypeName(dto.getTypeName());
|
||||
type.setParentId(dto.getParentId() != null ? dto.getParentId() : 0L);
|
||||
type.setSortOrder(dto.getSortOrder());
|
||||
type.setDescription(dto.getDescription());
|
||||
type.setStatus(dto.getStatus());
|
||||
type.setUpdatedTime(LocalDateTime.now());
|
||||
type.setUpdatedBy(UserContextHolder.getUserId());
|
||||
|
||||
@ -195,6 +197,20 @@ public class ExpenseTypeServiceImpl implements ExpenseTypeService {
|
||||
vo.setCreatedTime(type.getCreatedTime());
|
||||
vo.setUpdatedTime(type.getUpdatedTime());
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,20 +1,27 @@
|
||||
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.util.List;
|
||||
|
||||
public class ExpenseTypeVO {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
private String typeCode;
|
||||
private String typeName;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long parentId;
|
||||
private String parentName;
|
||||
private Integer typeLevel;
|
||||
private Integer sortOrder;
|
||||
private String description;
|
||||
private Integer status;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long tenantId;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long createdBy;
|
||||
private LocalDateTime createdTime;
|
||||
private LocalDateTime updatedTime;
|
||||
|
||||
@ -1,15 +1,20 @@
|
||||
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.time.LocalDateTime;
|
||||
|
||||
public class FundExpenseVO {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
private String expenseNo;
|
||||
private String title;
|
||||
private BigDecimal amount;
|
||||
private String currency;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long expenseType;
|
||||
private String expenseTypeName;
|
||||
private String payeeName;
|
||||
@ -17,8 +22,11 @@ public class FundExpenseVO {
|
||||
private String payeeAccount;
|
||||
private LocalDateTime expenseDate;
|
||||
private String purpose;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long requestId;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long projectId;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long customerId;
|
||||
private Integer payStatus;
|
||||
private String payStatusName;
|
||||
@ -27,11 +35,14 @@ public class FundExpenseVO {
|
||||
private String payVoucher;
|
||||
private Integer approvalStatus;
|
||||
private String approvalStatusName;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long approverId;
|
||||
private LocalDateTime approvalTime;
|
||||
private String approvalComment;
|
||||
private String attachments;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long tenantId;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long createdBy;
|
||||
private LocalDateTime createdTime;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user