| | |
| | | import cn.hutool.core.util.ObjUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; |
| | | import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi; |
| | | import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; |
| | | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO; |
| | |
| | | import cn.iocoder.yudao.module.hrm.enums.HrmLeaveTypeEnum; |
| | | import cn.iocoder.yudao.module.system.api.dept.DeptApi; |
| | | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; |
| | | import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| | | import jakarta.annotation.Resource; |
| | |
| | | @Resource |
| | | private BpmCategoryService bpmCategoryService; |
| | | @Resource |
| | | private StorageAttachmentApi storageAttachmentApi; |
| | | @Resource |
| | | private BpmProcessDefinitionService bpmProcessDefinitionService; |
| | | |
| | | @Override |
| | |
| | | application.setDeptId(createReqVO.getDeptId() != null ? createReqVO.getDeptId() : user.getDeptId()); |
| | | application.setStatus(HrmAuditStatusEnum.DRAFT.getStatus()); |
| | | leaveApplicationMapper.insert(application); |
| | | // 绑定附件 |
| | | storageAttachmentApi.bindAttachments("file", "hrm_leave_application", |
| | | application.getId(), createReqVO.getBlobIds()); |
| | | return application.getId(); |
| | | } |
| | | |
| | | private Long getCurrentUserId() { |
| | | // TODO: 获取当前登录用户ID |
| | | return 1L; |
| | | return SecurityFrameworkUtils.getLoginUserId(); |
| | | } |
| | | |
| | | private String generateUniqueNo() { |
| | |
| | | // 更新 |
| | | HrmLeaveApplicationDO updateObj = BeanUtils.toBean(updateReqVO, HrmLeaveApplicationDO.class); |
| | | leaveApplicationMapper.updateById(updateObj); |
| | | // 重新绑定附件 |
| | | if (updateReqVO.getBlobIds() != null) { |
| | | storageAttachmentApi.deleteAttachmentsByRecord("hrm_leave_application", updateReqVO.getId()); |
| | | storageAttachmentApi.bindAttachments("file", "hrm_leave_application", |
| | | updateReqVO.getId(), updateReqVO.getBlobIds()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (!Objects.equals(application.getStatus(), HrmAuditStatusEnum.DRAFT.getStatus())) { |
| | | throw exception(LEAVE_APPLICATION_UPDATE_FAIL_NOT_DRAFT); |
| | | } |
| | | // 删除附件关联 |
| | | storageAttachmentApi.deleteAttachmentsByRecord("hrm_leave_application", id); |
| | | // 删除 |
| | | leaveApplicationMapper.deleteById(id); |
| | | } |
| | |
| | | respVO.setLeaveTypeName(HrmLeaveTypeEnum.getNameByStatus(application.getLeaveType())); |
| | | // 填充审批状态名称 |
| | | respVO.setStatusName(HrmAuditStatusEnum.getNameByStatus(application.getStatus())); |
| | | // 填充附件列表 |
| | | respVO.setAttachmentList(storageAttachmentApi.listAttachments("hrm_leave_application", id)); |
| | | return respVO; |
| | | } |
| | | |