feat: 实现检查行是否已失败方法
- 添加 isRowAlreadyFailed 方法用于检查行是否已在失败列表中 - 通过比较员工ID、调动日期、调动前部门ID、调动后部门ID判断行的唯一性 - 在 StaffTransferImportFailureVO 中添加 deptIdBefore 和 deptIdAfter 字段 - 使用 Stream API 的 anyMatch 方法实现高效的匹配判断 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,6 +29,14 @@ public class StaffTransferImportFailureVO implements Serializable {
|
|||||||
@Schema(description = "员工姓名")
|
@Schema(description = "员工姓名")
|
||||||
private String staffName;
|
private String staffName;
|
||||||
|
|
||||||
|
/** 调动前部门ID */
|
||||||
|
@Schema(description = "调动前部门ID")
|
||||||
|
private Long deptIdBefore;
|
||||||
|
|
||||||
|
/** 调动后部门ID */
|
||||||
|
@Schema(description = "调动后部门ID")
|
||||||
|
private Long deptIdAfter;
|
||||||
|
|
||||||
/** 调动类型 */
|
/** 调动类型 */
|
||||||
@Schema(description = "调动类型")
|
@Schema(description = "调动类型")
|
||||||
private String transferType;
|
private String transferType;
|
||||||
|
|||||||
@@ -373,4 +373,20 @@ public class CcdiStaffTransferImportServiceImpl implements ICcdiStaffTransferImp
|
|||||||
|
|
||||||
return existingStaffIds;
|
return existingStaffIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查某行数据是否已在失败列表中
|
||||||
|
*
|
||||||
|
* @param excel Excel数据
|
||||||
|
* @param failures 失败记录列表
|
||||||
|
* @return true-已失败,false-未失败
|
||||||
|
*/
|
||||||
|
private boolean isRowAlreadyFailed(CcdiStaffTransferExcel excel,
|
||||||
|
List<StaffTransferImportFailureVO> failures) {
|
||||||
|
return failures.stream()
|
||||||
|
.anyMatch(f -> f.getStaffId().equals(excel.getStaffId())
|
||||||
|
&& Objects.equals(f.getTransferDate(), excel.getTransferDate())
|
||||||
|
&& Objects.equals(f.getDeptIdBefore(), excel.getDeptIdBefore())
|
||||||
|
&& Objects.equals(f.getDeptIdAfter(), excel.getDeptIdAfter()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user