Commit d38fdce0 authored by 廖旭伟's avatar 廖旭伟

考勤异常处理结果与原来不符合时先删除已生成的考勤绩效

parent d370a4cc
......@@ -91,6 +91,25 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At
});
}
@Override
protected void updateBefore(AttendanceRecordErrorEntity entity, Context context) throws AppException {
AttendanceRecordErrorEntity temp = this.get(entity.getId());
if(temp==null){
throw new AppException("考勤异常数据不存在");
}
if(temp.getErrorStatus().intValue()!=DataUtil.converStr2Int(entity.getProcessResult(),0)){
//异常处理结果与原来不符合时先删除已生成的考勤绩效
PerformAttendRecordQuery query = new PerformAttendRecordQuery();
query.setStaffId(temp.getStaffId());
query.setErrorTime(temp.getErrorDateTime());
List<PerformAttendRecordEntity> delAttendRecords = performAttendRecordService.find(query, context);
if (!ObjectUtils.isEmpty(delAttendRecords)) {
Long[] delIds = delAttendRecords.stream().map(i -> i.getId()).toArray(Long[]::new);
performAttendRecordService.remove(delIds, context);
}
}
}
@Override
protected void updateAfter(AttendanceRecordErrorEntity entity, Context context) throws AppException {
if (YesNoEnum.YES.getValue() == entity.getProcessStatus()) {
......
......@@ -282,7 +282,7 @@ public class PerformAttendRecordServiceImpl extends AbstractCRUDServiceImpl<Perf
private PerformRulesEntity getRule(String ruleCode) {
PerformRulesEntity rule = rulesService.getCache(ruleCode);
if (ObjectUtils.isEmpty(rule))
throw new AppException(String.format("当前手机号码未找到匹配的员工!rule:%s", ruleCode));
throw new AppException(String.format("当前绩效规则编码没有匹配到正确的规则!rule:%s", ruleCode));
return rule;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment