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

增加病假扣分机制以及绩效汇总导出自定义导出字段

parent f00c6054
......@@ -95,7 +95,8 @@ public class AttendanceLeaveRecordServiceImpl extends AbstractCRUDServiceImpl<At
boolean doPerformAttend = true;
AttendanceLeaveRecordEntity temp = this.get(entity.getId());
if (temp != null) {
if (AppealResultEnum.通过.getValue() == temp.getAuditResult() && LeaveTypeEnum.事假.getValue() == temp.getLeaveType()) {
boolean leaveType = LeaveTypeEnum.事假.getValue() == temp.getLeaveType() || LeaveTypeEnum.病假.getValue() == temp.getLeaveType();
if (AppealResultEnum.通过.getValue() == temp.getAuditResult() && leaveType) {
doPerformAttend = false;
}
}
......@@ -310,7 +311,8 @@ public class AttendanceLeaveRecordServiceImpl extends AbstractCRUDServiceImpl<At
private void creatPerformAttend(AttendanceLeaveRecordEntity entity, Context context) {
try {
if (AppealResultEnum.通过.getValue() == entity.getAuditResult() && LeaveTypeEnum.事假.getValue() == entity.getLeaveType()) {
boolean leaveType = LeaveTypeEnum.事假.getValue() == entity.getLeaveType() || LeaveTypeEnum.病假.getValue() == entity.getLeaveType();
if (AppealResultEnum.通过.getValue() == entity.getAuditResult() && leaveType) {
//以半天4小时为计算单位进行扣分
int multiple = entity.getDuration() / 14400;
if (multiple > 0) {
......@@ -392,7 +394,8 @@ public class AttendanceLeaveRecordServiceImpl extends AbstractCRUDServiceImpl<At
public void doCreatPerformAttend(Long id, Context context) {
AttendanceLeaveRecordEntity temp = this.get(id);
if (temp != null) {
if (AppealResultEnum.通过.getValue() == temp.getAuditResult() && LeaveTypeEnum.事假.getValue() == temp.getLeaveType()) {
boolean leaveType = LeaveTypeEnum.事假.getValue() == temp.getLeaveType() || LeaveTypeEnum.病假.getValue() == temp.getLeaveType();
if (AppealResultEnum.通过.getValue() == temp.getAuditResult() && leaveType) {
creatPerformAttend(temp, context);
}
}
......
......@@ -450,7 +450,7 @@ public class AttendanceStatServiceImpl extends AbstractCRUDServiceImpl<Attendanc
switch (leaveTypeEnum) {
case 事假:
temp.setPersonalLeave(leaveTime);
temp.setGoTimes(0); //有事假,当天不算全勤
temp.setGoTimes(0); //有事假,当天不算全勤
temp.setMorningTimes(0); //有请假则清空当天缺卡次数
temp.setLateTimes(0);
temp.setOvertimeTimes(0);
......@@ -460,6 +460,10 @@ public class AttendanceStatServiceImpl extends AbstractCRUDServiceImpl<Attendanc
break;
case 病假:
temp.setSickLeave(leaveTime);
temp.setGoTimes(0); //病假,当天不算全勤
temp.setMorningTimes(0); //有病假则清空当天缺卡次数
temp.setLateTimes(0);
temp.setOvertimeTimes(0);
break;
case 年假:
temp.setAnnualLeaveDays(leaveTime);
......
......@@ -31,4 +31,6 @@ public class StaffPerformSummaryVo extends BaseEntityLong {
/** 主键ID,主键,自增长列表 */
private List <Long> idList;
/** 导出字段 */
List<String> properties;
}
\ No newline at end of file
......@@ -16,7 +16,9 @@ import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryQuery;
import com.mortals.xhx.module.staff.service.StaffService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -176,4 +178,56 @@ public class StaffPerformSummaryController extends BaseCRUDJsonBodyMappingContro
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
@Override
public void doExportBefore(Context context, StaffPerformSummaryEntity query, List<String> properties) throws AppException {
if(CollectionUtils.isNotEmpty(query.getProperties())){
properties.addAll(query.getProperties());
}
}
@PostMapping({"init"})
@UnAuth
public Rest<Object> init(@RequestBody StaffCheckSummaryQuery query) {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
String busiDesc = "执行绩效初始化";
int code = 1;
try {
if(query.getStaffId()!=null && query.getYear()!=null && query.getMonth()!=null) {
StaffEntity staffEntity = staffService.get(query.getStaffId());
StaffPerformSummaryQuery summaryQuery = new StaffPerformSummaryQuery();
summaryQuery.setStaffId(query.getStaffId());
summaryQuery.setYear(query.getYear());
summaryQuery.setMonth(query.getMonth());
StaffPerformSummaryEntity temp = this.service.selectOne(summaryQuery);
if (temp == null) {
BigDecimal totalScore = new BigDecimal(100);
StaffPerformSummaryEntity staffPerformSummaryEntity = new StaffPerformSummaryEntity();
staffPerformSummaryEntity.initAttrValue();
staffPerformSummaryEntity.setStaffId(staffEntity.getId());
staffPerformSummaryEntity.setWorkNum(staffEntity.getWorkNum());
staffPerformSummaryEntity.setStaffName(staffEntity.getName());
staffPerformSummaryEntity.setDeptId(staffEntity.getDeptId());
staffPerformSummaryEntity.setDeptName(staffEntity.getDeptName());
staffPerformSummaryEntity.setSalaId(staffEntity.getSalaId());
staffPerformSummaryEntity.setSalaName(staffEntity.getSalaName());
staffPerformSummaryEntity.setYear(query.getYear());
staffPerformSummaryEntity.setMonth(query.getMonth());
staffPerformSummaryEntity.setTotalScore(totalScore);
staffPerformSummaryEntity.setCreateUserId(1l);
staffPerformSummaryEntity.setCreateTime(new Date());
this.service.save(staffPerformSummaryEntity);
}
}
model.put("message_info", "执行绩效初始化成功");
} catch (Exception var9) {
code = -1;
this.doException(this.request, busiDesc, model, var9);
}
ret.setCode(code);
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
}
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