Przeglądaj źródła

1、年假申请校验完善

dongpo 1 rok temu
rodzic
commit
d2611190e4

+ 15 - 3
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/leave/OaLeaveServiceImpl.java

@@ -195,7 +195,11 @@ public class OaLeaveServiceImpl implements OaLeaveService {
             throw exception(ErrorCodeConstants.OA_EMPLOYEE_NOT_EXISTS);
         }
 
-        if ("年假".equals(commitReqVO.getLeaveType())) {
+        // 请假类型
+        List<DictDataTenantRespDTO> dictDataList = dictDataTenantApi.getDictDataList(DictTypeTenantEnum.TENANT_LEAVE_TYPE.getType());
+        Map<String, String> dictDataMap = CollectionUtils.convertMap(dictDataList, DictDataTenantRespDTO::getValue, DictDataTenantRespDTO::getLabel);
+        String leaveTypeDesc = dictDataMap.get(commitReqVO.getLeaveType());
+        if ("年假".equals(commitReqVO.getLeaveType()) || "年假".equals(leaveTypeDesc)) {
             // 获取剩余年假和申请天数
             BigDecimal remainingAnnualLeave = loginEmployee.getRemainingAnnualLeave();
             String requestDayStr = commitReqVO.getDay(); // 更清晰的变量名
@@ -326,7 +330,11 @@ public class OaLeaveServiceImpl implements OaLeaveService {
             throw exception(ErrorCodeConstants.OA_LEAVE_NOT_EXISTS);
         }
 
-        if ("年假".equals(oaLeave.getLeaveType())) {
+        // 请假类型
+        List<DictDataTenantRespDTO> dictDataList = dictDataTenantApi.getDictDataList(DictTypeTenantEnum.TENANT_LEAVE_TYPE.getType());
+        Map<String, String> dictDataMap = CollectionUtils.convertMap(dictDataList, DictDataTenantRespDTO::getValue, DictDataTenantRespDTO::getLabel);
+        String leaveTypeDesc = dictDataMap.get(oaLeave.getLeaveType());
+        if ("年假".equals(oaLeave.getLeaveType()) || "年假".equals(leaveTypeDesc)) {
             // 请假人
             Long employeeId = oaLeave.getEmployeeId();
             EmployeeRespDTO employee = employeeApi.getEmployeeById(employeeId);
@@ -549,7 +557,11 @@ public class OaLeaveServiceImpl implements OaLeaveService {
             throw exception(ErrorCodeConstants.OA_EMPLOYEE_NOT_EXISTS);
         }
 
-        if ("年假".equals(reCommitReqVO.getLeaveType())) {
+        // 请假类型
+        List<DictDataTenantRespDTO> dictDataList = dictDataTenantApi.getDictDataList(DictTypeTenantEnum.TENANT_LEAVE_TYPE.getType());
+        Map<String, String> dictDataMap = CollectionUtils.convertMap(dictDataList, DictDataTenantRespDTO::getValue, DictDataTenantRespDTO::getLabel);
+        String leaveTypeDesc = dictDataMap.get(reCommitReqVO.getLeaveType());
+        if ("年假".equals(reCommitReqVO.getLeaveType()) || "年假".equals(leaveTypeDesc)) {
             // 获取剩余年假和申请天数
             BigDecimal remainingAnnualLeave = loginEmployee.getRemainingAnnualLeave();
             String requestDayStr = reCommitReqVO.getDay(); // 更清晰的变量名