Commit a5149572 authored by 赵啸非's avatar 赵啸非

考勤异常添加绩效考核

parent 2c9be544
......@@ -11,6 +11,7 @@ import com.mortals.xhx.module.attendance.model.AttendanceClassDetailEntity;
import com.mortals.xhx.module.attendance.model.AttendanceClassEntity;
import com.mortals.xhx.module.attendance.service.AttendanceClassDetailService;
import com.mortals.xhx.module.attendance.service.AttendanceClassService;
import com.mortals.xhx.module.perform.service.PerformAttendRecordService;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -40,6 +41,8 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At
@Autowired
private AttendanceClassService attendanceClassService;
@Autowired
private PerformAttendRecordService attendRecordService;
@Autowired
private ApiWebPerformController apiWebPerformController;
......@@ -73,7 +76,6 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At
});
}
@Override
protected void updateAfter(AttendanceRecordErrorEntity entity, Context context) throws AppException {
if (YesNoEnum.YES.getValue() == entity.getProcessStatus()) {
......@@ -115,8 +117,6 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At
ruleCode = "ATTEND1007";
}
if (!ObjectUtils.isEmpty(ruleCode)) {
StaffEntity staffEntity = staffService.getCache(entity.getStaffId().toString());
AttendSaveReq attendSaveReq = new AttendSaveReq();
attendSaveReq.setAttendanceGroupId(entity.getAttendanceGroupId());
attendSaveReq.setAttendanceGroupName(entity.getAttendanceGroupName());
......@@ -126,19 +126,12 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At
attendSaveReq.setActualAttendTime(entity.getActualAttendanceDateTime());
attendSaveReq.setErrorResult(entity.getRemark());
attendSaveReq.setWorkNum(staffEntity.getWorkNum());
attendSaveReq.setTitle("考勤:" + ErrorStatusEnum.getByValue(entity.getErrorStatus()).getDesc());
attendSaveReq.setHappenTime(entity.getErrorDateTime());
attendSaveReq.setRuleCode(ruleCode);
attendSaveReq.setPhone(staffEntity.getPhoneNumber());
attendSaveReq.setStaffId(entity.getStaffId());
apiWebPerformController.attendSave(attendSaveReq);
attendRecordService.saveAttend(attendSaveReq,context);
}
}
}
}
\ No newline at end of file
package com.mortals.xhx.module.perform.service;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.busiz.h5.req.AttendSaveReq;
import com.mortals.xhx.module.perform.model.PerformAttendRecordEntity;
import com.mortals.xhx.module.perform.dao.PerformAttendRecordDao;
/**
......@@ -23,4 +25,7 @@ public interface PerformAttendRecordService extends ICRUDService<PerformAttendRe
*/
void updateProcessStatus(Long id,Integer status) throws AppException;
void saveAttend(AttendSaveReq req, Context context) throws AppException;
}
\ No newline at end of file
package com.mortals.xhx.module.perform.service.impl;
import cn.hutool.core.date.DateUtil;
import com.mortals.xhx.busiz.h5.req.AttendSaveReq;
import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.attendance.model.*;
......@@ -12,7 +13,9 @@ import com.mortals.xhx.module.check.model.CheckAttendRecordEntity;
import com.mortals.xhx.module.check.service.CheckAttendRecordService;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.perform.model.PerformRulesCategoryEntity;
import com.mortals.xhx.module.perform.model.PerformRulesEntity;
import com.mortals.xhx.module.perform.service.PerformRulesCategoryService;
import com.mortals.xhx.module.perform.service.PerformRulesService;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.service.StaffService;
......@@ -55,6 +58,8 @@ public class PerformAttendRecordServiceImpl extends AbstractCRUDServiceImpl<Perf
private AttendanceClassService classService;
@Autowired
private AttendanceClassDetailService classDetailService;
@Autowired
private PerformRulesCategoryService categoryService;
@Autowired
private PerformRulesService rulesService;
......@@ -202,4 +207,44 @@ public class PerformAttendRecordServiceImpl extends AbstractCRUDServiceImpl<Perf
dao.update(update);
}
@Override
public void saveAttend(AttendSaveReq req, Context context) throws AppException {
//考勤保存
//通过手机号码查询员工属性
PerformRulesEntity rule = getRule(req.getRuleCode());
StaffEntity staffEntity = staffService.getCache(req.getStaffId().toString());
PerformAttendRecordEntity recordEntity = new PerformAttendRecordEntity();
recordEntity.initAttrValue();
recordEntity.setSubMethod(SubMethodEnum.系统自动.getValue());
BeanUtils.copyProperties(req, recordEntity);
recordEntity.setStaffId(staffEntity.getId());
recordEntity.setStaffName(staffEntity.getName());
recordEntity.setDeptId(staffEntity.getDeptId());
recordEntity.setDeptName(staffEntity.getDeptName());
recordEntity.setSubAddType(rule.getSubAddType());
recordEntity.setScore(rule.getScore());
recordEntity.setRuleId(rule.getId());
recordEntity.setRuleName(rule.getName());
recordEntity.setCategoryId(rule.getCategoryId());
recordEntity.setCategoryName(rule.getCategoryName());
recordEntity.setDeductPerson("系统管理员");
recordEntity.setDeductTime(new Date());
recordEntity.setCreateUserId(this.getContextUserId(context));
recordEntity.setCreateTime(new Date());
recordEntity.setWorkNum(staffEntity.getWorkNum());
PerformRulesCategoryEntity categoryEntity = categoryService.get(rule.getCategoryId());
recordEntity.setCategoryName(categoryEntity == null ? "" : categoryEntity.getName());
this.save(recordEntity);
}
private PerformRulesEntity getRule(String ruleCode) {
PerformRulesEntity rule = rulesService.getCache(ruleCode);
if (ObjectUtils.isEmpty(rule))
throw new AppException(String.format("当前手机号码未找到匹配的员工!rule:%s", ruleCode));
return rule;
}
}
\ No newline at end of file
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