新增字段和优化功能

- 在 BpmOAAssetClaimDO 中添加 type 字段,用于申领类型
- 在 BpmOAImprestCreateReqVO、BpmOAImprestDO 和 BpmOAImprestRespVO 中添加 reimbursedAmount 字段,用于已报销金额
- 在 BpmOAReimbursementDO 中添加 imprestId 字段,用于备用金表单编号
- 优化了 BpmOAReimbursementServiceImpl 中的报销审核逻辑,包括备用金报销和采购报销的处理
- 在 AssetReceiveMapper 和 AssetReceivePageReqVO 中添加了 assetsName 字段,用于资产名称的查询
This commit is contained in:
furongxin 2024-09-30 15:49:24 +08:00
parent 9ff735fdf7
commit ea16aaa5e9
8 changed files with 38 additions and 13 deletions

View File

@ -37,6 +37,9 @@ public class BpmOAImprestCreateReqVO {
@NotNull(message = "费用金额不能为空")
private BigDecimal amount;
@Schema(description = "已报销金额")
private BigDecimal reimbursedAmount;
@Schema(description = "使用日期", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "使用日期不能为空")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)

View File

@ -36,6 +36,9 @@ public class BpmOAImprestRespVO extends BpmOABaseRespVO {
@NotNull(message = "费用金额不能为空")
private BigDecimal amount;
@Schema(description = "已报销金额")
private BigDecimal reimbursedAmount;
@Schema(description = "使用日期", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "使用日期不能为空")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)

View File

@ -42,6 +42,11 @@ public class BpmOAAssetClaimDO extends BaseDO {
*/
private String reason;
/**
* 申领类型
*/
private Integer type;
/**
* 用章的结果
* 枚举 {@link BpmProcessInstanceResultEnum}

View File

@ -30,7 +30,7 @@ import java.util.List;
public class BpmOAImprestDO extends BaseDO {
/**
* 是否已报销 0否 1是 2进行
* 是否已报销 0否 1是 2报销
*/
public static final Integer FLAG_FALSE = 0;
public static final Integer FLAG_TRUE = 1;
@ -64,6 +64,11 @@ public class BpmOAImprestDO extends BaseDO {
*/
private BigDecimal amount;
/**
* 已报销的金额
*/
private BigDecimal reimbursedAmount;
/**
* 使用日期
*/

View File

@ -84,6 +84,11 @@ public class BpmOAReimbursementDO extends BaseDO {
*/
private Integer reimbursementType;
/**
* 备用金表单编号
*/
private Long imprestId;
/**
* 备用差额
*/

View File

@ -153,24 +153,23 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
@Override
@Transactional(rollbackFor = Exception.class)
public void updateReimbursementResult(String processInstanceId, Long id, Integer result) {
validateLeaveExists(id);
BpmOAReimbursementDO bpmOAReimbursementDO = validateLeaveExists(id);
//审核通过 最后节点
if (BpmProcessInstanceResultEnum.APPROVE.getResult().equals(result)) {
ProcessInstance instance = bpmProcessInstanceService.getProcessInstance(processInstanceId);
if (instance.isEnded()) {
//获得备用金信息
BpmOAImprestDO bpmOAImprestDO = bpmOAImprestMapper.selectOne(BpmOAImprestDO::getReimbursementId, id);
if (bpmOAImprestDO != null) {
//判断是否为备用金报销
if (bpmOAReimbursementDO.getImprestId() != null) {
//将相应备用金申请状态改为 已报销
bpmOAImprestMapper.updateById(new BpmOAImprestDO().setId(bpmOAImprestDO.getId()).setStatus(BpmOAImprestDO.FLAG_TRUE));
bpmOAImprestMapper.updateById(new BpmOAImprestDO().setId(bpmOAReimbursementDO.getImprestId()).setStatus(BpmOAImprestDO.FLAG_TRUE));
}
//判断是否有采购报销
List<Long> procureIds = new ArrayList<>();
BpmOAReimbursementDO bpmOAReimbursementDO = getReimbursement(id);
List<Reimbursement> reimbursements = bpmOAReimbursementDO.getReimbursements();
//直接从数据库取出来的List<Reimbursement> 实际上是List<LinkedHashMap>类型 所以不能直接遍历
@ -234,7 +233,6 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
//判断是否有采购报销
List<Long> procureIds = new ArrayList<>();
BpmOAReimbursementDO bpmOAReimbursementDO = getReimbursement(id);
List<Reimbursement> reimbursements = bpmOAReimbursementDO.getReimbursements();
//直接从数据库取出来的List<Reimbursement> 实际上是List<LinkedHashMap>类型 所以不能直接遍历
@ -269,10 +267,12 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
reimbursementMapper.updateById(new BpmOAReimbursementDO().setId(id).setResult(result));
}
private void validateLeaveExists(Long id) {
if (reimbursementMapper.selectById(id) == null) {
private BpmOAReimbursementDO validateLeaveExists(Long id) {
BpmOAReimbursementDO reimbursementDO = reimbursementMapper.selectById(id);
if (reimbursementDO == null) {
throw exception(OA_REIMBURSEMENT_NOT_EXISTS);
}
return reimbursementDO;
}
@Override

View File

@ -18,18 +18,21 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@ToString(callSuper = true)
public class AssetReceivePageReqVO extends PageParam {
@Schema(description = "领用人的用户编号", example = "146")
private Long userId;
@Schema(description = "领用人的部门编号", example = "128")
private Long deptId;
@Schema(description = "领用人的用户编号", example = "146")
private Long userId;
@Schema(description = "分配人的用户编号")
private Long receiveUserId;
@Schema(description = "资产编号")
private String assetsNo;
@Schema(description = "资产名称")
private String assetsName;
@Schema(description = "资产类型编号")
private Long assetsTypeId;

View File

@ -21,6 +21,7 @@ public interface AssetReceiveMapper extends BaseMapperX<AssetReceiveDO> {
.eqIfPresent(AssetReceiveDO::getDeptId, reqVO.getDeptId())
.eqIfPresent(AssetReceiveDO::getReceiveUserId, reqVO.getReceiveUserId())
.eqIfPresent(AssetReceiveDO::getAssetsNo, reqVO.getAssetsNo())
.likeIfPresent(AssetReceiveDO::getAssetsName, reqVO.getAssetsName())
.eqIfPresent(AssetReceiveDO::getAssetsTypeId, reqVO.getAssetsTypeId())
.betweenIfPresent(AssetReceiveDO::getApplyDate, reqVO.getApplyDate())
.betweenIfPresent(AssetReceiveDO::getAllocationDate, reqVO.getAllocationDate())