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

考勤异常添加绩效考核

parent 2c9be544
...@@ -11,6 +11,7 @@ import com.mortals.xhx.module.attendance.model.AttendanceClassDetailEntity; ...@@ -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.model.AttendanceClassEntity;
import com.mortals.xhx.module.attendance.service.AttendanceClassDetailService; import com.mortals.xhx.module.attendance.service.AttendanceClassDetailService;
import com.mortals.xhx.module.attendance.service.AttendanceClassService; 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.model.StaffEntity;
import com.mortals.xhx.module.staff.service.StaffService; import com.mortals.xhx.module.staff.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -40,6 +41,8 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At ...@@ -40,6 +41,8 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At
@Autowired @Autowired
private AttendanceClassService attendanceClassService; private AttendanceClassService attendanceClassService;
@Autowired
private PerformAttendRecordService attendRecordService;
@Autowired @Autowired
private ApiWebPerformController apiWebPerformController; private ApiWebPerformController apiWebPerformController;
...@@ -73,7 +76,6 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At ...@@ -73,7 +76,6 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At
}); });
} }
@Override @Override
protected void updateAfter(AttendanceRecordErrorEntity entity, Context context) throws AppException { protected void updateAfter(AttendanceRecordErrorEntity entity, Context context) throws AppException {
if (YesNoEnum.YES.getValue() == entity.getProcessStatus()) { if (YesNoEnum.YES.getValue() == entity.getProcessStatus()) {
...@@ -115,8 +117,6 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At ...@@ -115,8 +117,6 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At
ruleCode = "ATTEND1007"; ruleCode = "ATTEND1007";
} }
if (!ObjectUtils.isEmpty(ruleCode)) { if (!ObjectUtils.isEmpty(ruleCode)) {
StaffEntity staffEntity = staffService.getCache(entity.getStaffId().toString());
AttendSaveReq attendSaveReq = new AttendSaveReq(); AttendSaveReq attendSaveReq = new AttendSaveReq();
attendSaveReq.setAttendanceGroupId(entity.getAttendanceGroupId()); attendSaveReq.setAttendanceGroupId(entity.getAttendanceGroupId());
attendSaveReq.setAttendanceGroupName(entity.getAttendanceGroupName()); attendSaveReq.setAttendanceGroupName(entity.getAttendanceGroupName());
...@@ -126,19 +126,12 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At ...@@ -126,19 +126,12 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At
attendSaveReq.setActualAttendTime(entity.getActualAttendanceDateTime()); attendSaveReq.setActualAttendTime(entity.getActualAttendanceDateTime());
attendSaveReq.setErrorResult(entity.getRemark()); attendSaveReq.setErrorResult(entity.getRemark());
attendSaveReq.setWorkNum(staffEntity.getWorkNum());
attendSaveReq.setTitle("考勤:" + ErrorStatusEnum.getByValue(entity.getErrorStatus()).getDesc()); attendSaveReq.setTitle("考勤:" + ErrorStatusEnum.getByValue(entity.getErrorStatus()).getDesc());
attendSaveReq.setHappenTime(entity.getErrorDateTime()); attendSaveReq.setHappenTime(entity.getErrorDateTime());
attendSaveReq.setRuleCode(ruleCode); attendSaveReq.setRuleCode(ruleCode);
attendSaveReq.setPhone(staffEntity.getPhoneNumber());
attendSaveReq.setStaffId(entity.getStaffId()); attendSaveReq.setStaffId(entity.getStaffId());
attendRecordService.saveAttend(attendSaveReq,context);
apiWebPerformController.attendSave(attendSaveReq);
} }
} }
} }
} }
\ No newline at end of file
package com.mortals.xhx.module.perform.service; package com.mortals.xhx.module.perform.service;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService; 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.model.PerformAttendRecordEntity;
import com.mortals.xhx.module.perform.dao.PerformAttendRecordDao; import com.mortals.xhx.module.perform.dao.PerformAttendRecordDao;
/** /**
...@@ -23,4 +25,7 @@ public interface PerformAttendRecordService extends ICRUDService<PerformAttendRe ...@@ -23,4 +25,7 @@ public interface PerformAttendRecordService extends ICRUDService<PerformAttendRe
*/ */
void updateProcessStatus(Long id,Integer status) throws AppException; 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; package com.mortals.xhx.module.perform.service.impl;
import cn.hutool.core.date.DateUtil; 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.code.*;
import com.mortals.xhx.common.utils.BeanUtil; import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.attendance.model.*; import com.mortals.xhx.module.attendance.model.*;
...@@ -12,7 +13,9 @@ import com.mortals.xhx.module.check.model.CheckAttendRecordEntity; ...@@ -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.check.service.CheckAttendRecordService;
import com.mortals.xhx.module.dept.model.DeptEntity; import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.service.DeptService; 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.model.PerformRulesEntity;
import com.mortals.xhx.module.perform.service.PerformRulesCategoryService;
import com.mortals.xhx.module.perform.service.PerformRulesService; import com.mortals.xhx.module.perform.service.PerformRulesService;
import com.mortals.xhx.module.staff.model.StaffEntity; import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.service.StaffService; import com.mortals.xhx.module.staff.service.StaffService;
...@@ -55,6 +58,8 @@ public class PerformAttendRecordServiceImpl extends AbstractCRUDServiceImpl<Perf ...@@ -55,6 +58,8 @@ public class PerformAttendRecordServiceImpl extends AbstractCRUDServiceImpl<Perf
private AttendanceClassService classService; private AttendanceClassService classService;
@Autowired @Autowired
private AttendanceClassDetailService classDetailService; private AttendanceClassDetailService classDetailService;
@Autowired
private PerformRulesCategoryService categoryService;
@Autowired @Autowired
private PerformRulesService rulesService; private PerformRulesService rulesService;
...@@ -202,4 +207,44 @@ public class PerformAttendRecordServiceImpl extends AbstractCRUDServiceImpl<Perf ...@@ -202,4 +207,44 @@ public class PerformAttendRecordServiceImpl extends AbstractCRUDServiceImpl<Perf
dao.update(update); 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