From f83950d292a8933390b3b4b516f90f21a9946c68 Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期四, 27 八月 2026 11:41:47 +0800
Subject: [PATCH] fix 修复逻辑缺陷
---
yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/attendance/HrmAttendanceExceptionServiceImpl.java | 28 ++++++++++++++++++++--------
1 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/attendance/HrmAttendanceExceptionServiceImpl.java b/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/attendance/HrmAttendanceExceptionServiceImpl.java
index 0196b9b..54eb8ab 100644
--- a/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/attendance/HrmAttendanceExceptionServiceImpl.java
+++ b/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/attendance/HrmAttendanceExceptionServiceImpl.java
@@ -12,6 +12,8 @@
import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi;
import cn.iocoder.yudao.module.hrm.dal.redis.HrmNoRedisDAO;
import cn.iocoder.yudao.module.hrm.enums.HrmAuditStatusEnum;
+import cn.iocoder.yudao.module.hrm.dal.dataobject.employee.HrmEmployeeDO;
+import cn.iocoder.yudao.module.hrm.service.employee.HrmEmployeeService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -26,7 +28,7 @@
/**
* 鑰冨嫟寮傚父鐢宠 Service 瀹炵幇绫�
*
- * @author 鑺嬮亾婧愮爜
+ * @author 瓒呯骇绠$悊鍛�
*/
@Service
@Validated
@@ -43,10 +45,18 @@
private StorageAttachmentApi storageAttachmentApi;
@Resource
private BpmProcessDefinitionService bpmProcessDefinitionService;
+ @Resource
+ private HrmEmployeeService employeeService;
@Override
public Long createAttendanceException(HrmAttendanceExceptionSaveReqVO createReqVO) {
+ HrmEmployeeDO employee = employeeService.getEmployeeByUserId(
+ cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId());
+ if (employee == null) {
+ throw exception(EMPLOYEE_NOT_EXISTS);
+ }
HrmAttendanceExceptionDO attendanceException = BeanUtils.toBean(createReqVO, HrmAttendanceExceptionDO.class);
+ attendanceException.setUserId(employee.getId()).setDeptId(employee.getDeptId());
attendanceException.setNo(generateNo());
attendanceException.setStatus(HrmAuditStatusEnum.DRAFT.getStatus());
attendanceExceptionMapper.insert(attendanceException);
@@ -61,19 +71,21 @@
@Override
public void updateAttendanceException(HrmAttendanceExceptionSaveReqVO updateReqVO) {
- validateAttendanceExceptionExists(updateReqVO.getId());
+ HrmAttendanceExceptionDO attendanceException = validateAttendanceExceptionExists(updateReqVO.getId());
+ if (!HrmAuditStatusEnum.DRAFT.getStatus().equals(attendanceException.getStatus())) {
+ throw exception(ATTENDANCE_EXCEPTION_UPDATE_FAIL_NOT_DRAFT);
+ }
HrmAttendanceExceptionDO updateObj = BeanUtils.toBean(updateReqVO, HrmAttendanceExceptionDO.class);
attendanceExceptionMapper.updateById(updateObj);
- if (updateReqVO.getBlobIds() != null) {
- storageAttachmentApi.deleteAttachmentsByRecord("hrm_attendance_exception", updateReqVO.getId());
- storageAttachmentApi.bindAttachments("file", "hrm_attendance_exception",
- updateReqVO.getId(), updateReqVO.getBlobIds());
- }
+ storageAttachmentApi.updateAttachments("file", "hrm_attendance_exception", updateReqVO.getId(), updateReqVO.getBlobIds());
}
@Override
public void deleteAttendanceException(Long id) {
- validateAttendanceExceptionExists(id);
+ HrmAttendanceExceptionDO attendanceException = validateAttendanceExceptionExists(id);
+ if (!HrmAuditStatusEnum.DRAFT.getStatus().equals(attendanceException.getStatus())) {
+ throw exception(ATTENDANCE_EXCEPTION_DELETE_FAIL_NOT_DRAFT);
+ }
storageAttachmentApi.deleteAttachmentsByRecord("hrm_attendance_exception", id);
attendanceExceptionMapper.deleteById(id);
}
--
Gitblit v1.9.3