|
|
|
|
package com.engine.attendance.attendanceanalysis.wrapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.engine.attendance.attendanceanalysis.service.AbnormalAttendanceService;
|
|
|
|
|
import com.engine.attendance.attendanceanalysis.service.ForgetClockInService;
|
|
|
|
|
import com.engine.attendance.attendanceanalysis.service.impl.AbnormalAttendanceServiceImpl;
|
|
|
|
|
import com.engine.attendance.attendanceanalysis.service.impl.ForgetClockInServiceImpl;
|
|
|
|
|
import com.engine.attendance.enums.ClassSegmentTypeEnum;
|
|
|
|
|
import com.engine.attendance.enums.ClockPointEnum;
|
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
import weaver.general.Util;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
public class UpdateAttendanceResultWrapper extends Service {
|
|
|
|
|
private AbnormalAttendanceService beLateService = ServiceUtil.getService(AbnormalAttendanceServiceImpl.class);
|
|
|
|
|
private ForgetClockInService forgetClockInService = ServiceUtil.getService(ForgetClockInServiceImpl.class);
|
|
|
|
|
/**
|
|
|
|
|
* 记录异常打卡
|
|
|
|
|
* */
|
|
|
|
|
public boolean recordAbnormalClockIn(Map<String,Object> params){
|
|
|
|
|
//卡点
|
|
|
|
|
List<Map<String,Map<String,Object>>> clcokInTimeList = (List<Map<String,Map<String,Object>>>)params.get("clcokInTimeList");
|
|
|
|
|
//考勤项目
|
|
|
|
|
List<Map<String,Object>> attendanceItems = (List<Map<String,Object>>)params.get("attendanceItems");
|
|
|
|
|
//排班
|
|
|
|
|
List<Map<String, Object>> scheduleResult = (List<Map<String,Object>>)params.get("scheduleResult");
|
|
|
|
|
//分析日期
|
|
|
|
|
String analysisDate = Util.null2String(params.get("analysisDate"));
|
|
|
|
|
//人员
|
|
|
|
|
String userId = Util.null2String(params.get("userId"));
|
|
|
|
|
|
|
|
|
|
//以开始时间分割班次
|
|
|
|
|
Map<String,List<Map<String, Object>>> startScheduleResult = scheduleResult.stream().collect(Collectors.groupingBy(e->e.get("dtkssj").toString()));
|
|
|
|
|
//以结束时间分割班次
|
|
|
|
|
Map<String,List<Map<String, Object>>> endScheduleResult = scheduleResult.stream().collect(Collectors.groupingBy(e->e.get("dtjssj").toString()));
|
|
|
|
|
boolean iforgetClockIn = false;
|
|
|
|
|
boolean ifBeLate = false;
|
|
|
|
|
boolean ifLeaveEarly = false;
|
|
|
|
|
for (Map<String,Map<String,Object>> clcokInTimeMap :clcokInTimeList){
|
|
|
|
|
//卡点
|
|
|
|
|
String point = "";
|
|
|
|
|
//当天打卡数据
|
|
|
|
|
Map<String,Object> clcokInTimeData = null;
|
|
|
|
|
for (Map.Entry<String,Map<String,Object>> entry :clcokInTimeMap.entrySet()){
|
|
|
|
|
point = entry.getKey();
|
|
|
|
|
clcokInTimeData = entry.getValue();
|
|
|
|
|
}
|
|
|
|
|
//需要计算的班次打卡时间点
|
|
|
|
|
String pointTime = point.split("\\|")[0];
|
|
|
|
|
//start:开始打卡时间点,end:结束打卡时间点
|
|
|
|
|
String pointType = point.split("\\|")[1];
|
|
|
|
|
//empty:漏卡,equal:打卡时间和班次时间相等,before:打卡时间在班次时间之前,after:打卡时间在班次时间之后
|
|
|
|
|
String timeType = point.split("\\|")[2];
|
|
|
|
|
//班次
|
|
|
|
|
Map<String, Object> classInfo = Maps.newHashMap();
|
|
|
|
|
if (ClockPointEnum.START.getKey().equals(pointType)){
|
|
|
|
|
classInfo = startScheduleResult.get(pointTime.split(" ")[1]).get(0);
|
|
|
|
|
}else if (ClockPointEnum.END.getKey().equals(pointType)){
|
|
|
|
|
classInfo = endScheduleResult.get(pointTime.split(" ")[1]).get(0);
|
|
|
|
|
}
|
|
|
|
|
if (ClockPointEnum.EMPTY.getKey().equals(timeType) || clcokInTimeData == null){
|
|
|
|
|
//漏卡
|
|
|
|
|
Map<String,Object> beLateParams = Maps.newHashMap();
|
|
|
|
|
beLateParams.put("classInfo",classInfo);
|
|
|
|
|
beLateParams.put("clcokInTimeData",clcokInTimeData);
|
|
|
|
|
beLateParams.put("attendanceItems",attendanceItems);
|
|
|
|
|
beLateParams.put("analysisDate",analysisDate);
|
|
|
|
|
beLateParams.put("userId",userId);
|
|
|
|
|
|
|
|
|
|
iforgetClockIn = forgetClockInService.forgetClockIn(beLateParams);
|
|
|
|
|
|
|
|
|
|
}else if (ClockPointEnum.START.getKey().equals(pointType) && ClockPointEnum.AFTER.getKey().equals(timeType)){
|
|
|
|
|
//迟到
|
|
|
|
|
Map<String,Object> beLateParams = Maps.newHashMap();
|
|
|
|
|
beLateParams.put("classInfo",classInfo);
|
|
|
|
|
beLateParams.put("clcokInTimeData",clcokInTimeData);
|
|
|
|
|
beLateParams.put("attendanceItems",attendanceItems);
|
|
|
|
|
beLateParams.put("analysisDate",analysisDate);
|
|
|
|
|
beLateParams.put("userId",userId);
|
|
|
|
|
|
|
|
|
|
ifBeLate = beLateService.beLate(beLateParams);
|
|
|
|
|
|
|
|
|
|
}else if (ClockPointEnum.END.getKey().equals(pointType) && ClockPointEnum.BEFORE.getKey().equals(timeType)){
|
|
|
|
|
//早退
|
|
|
|
|
Map<String,Object> leaveEarlyParams = Maps.newHashMap();
|
|
|
|
|
leaveEarlyParams.put("classInfo",classInfo);
|
|
|
|
|
leaveEarlyParams.put("clcokInTimeData",clcokInTimeData);
|
|
|
|
|
leaveEarlyParams.put("attendanceItems",attendanceItems);
|
|
|
|
|
leaveEarlyParams.put("analysisDate",analysisDate);
|
|
|
|
|
leaveEarlyParams.put("userId",userId);
|
|
|
|
|
|
|
|
|
|
ifLeaveEarly = beLateService.leaveEarly(leaveEarlyParams);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (iforgetClockIn || ifBeLate ||ifLeaveEarly){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean recordWorkOverTime(Map<String,Object> params){
|
|
|
|
|
//卡点
|
|
|
|
|
List<Map<String,Map<String,Object>>> clcokInTimeList = (List<Map<String,Map<String,Object>>>)params.get("clcokInTimeList");
|
|
|
|
|
//考勤项目
|
|
|
|
|
List<Map<String,Object>> attendanceItems = (List<Map<String,Object>>)params.get("attendanceItems");
|
|
|
|
|
//排班
|
|
|
|
|
List<Map<String, Object>> scheduleResult = (List<Map<String,Object>>)params.get("scheduleResult");
|
|
|
|
|
//分析日期
|
|
|
|
|
String analysisDate = Util.null2String(params.get("analysisDate"));
|
|
|
|
|
//人员
|
|
|
|
|
String userId = Util.null2String(params.get("userId"));
|
|
|
|
|
|
|
|
|
|
scheduleResult = scheduleResult.stream().filter(e -> {
|
|
|
|
|
String bdlx = Util.null2String(e.get("bdlx"));
|
|
|
|
|
if (ClassSegmentTypeEnum.EXTENDED_OVERTIME.getKey().equals(bdlx) || ClassSegmentTypeEnum.EARLY_OVERTIME.getKey().equals(bdlx)
|
|
|
|
|
|| ClassSegmentTypeEnum.OVERTIME_PLAN.getKey().equals(bdlx)){
|
|
|
|
|
return true;
|
|
|
|
|
}else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 请假
|
|
|
|
|
* @param params
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public boolean recordVaction(Map<String,Object> params){
|
|
|
|
|
//卡点
|
|
|
|
|
List<Map<String,Map<String,Object>>> clcokInTimeList = (List<Map<String,Map<String,Object>>>)params.get("clcokInTimeList");
|
|
|
|
|
//请假项目
|
|
|
|
|
Map<String,Map<String,Object>> askForLeaveItems = (Map<String,Map<String,Object>>)params.get("askForLeaveItems");
|
|
|
|
|
//排班
|
|
|
|
|
List<Map<String, Object>> scheduleResult = (List<Map<String,Object>>)params.get("scheduleResult");
|
|
|
|
|
//分析日期
|
|
|
|
|
String analysisDate = Util.null2String(params.get("analysisDate"));
|
|
|
|
|
//人员
|
|
|
|
|
String userId = Util.null2String(params.get("userId"));
|
|
|
|
|
//请假
|
|
|
|
|
List<Map<String, Object>> askForLeaveList = (List<Map<String,Object>>)params.get("askForLeaveList");
|
|
|
|
|
|
|
|
|
|
for (int i=0;i<askForLeaveList.size();i++){
|
|
|
|
|
String kssj = askForLeaveList.get(i).get("ksrq") + " "+askForLeaveList.get(i).get("kssj");
|
|
|
|
|
String jssj = askForLeaveList.get(i).get("jsrq")+ " "+askForLeaveList.get(i).get("jssj");
|
|
|
|
|
Map<String,Object> askForLeaveItem = askForLeaveItems.get(askForLeaveList.get(i).get("jqlx"));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 外出
|
|
|
|
|
* @param params
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public boolean recordAskForLeave(Map<String,Object> params){
|
|
|
|
|
//卡点
|
|
|
|
|
List<Map<String,Map<String,Object>>> clcokInTimeList = (List<Map<String,Map<String,Object>>>)params.get("clcokInTimeList");
|
|
|
|
|
//外出项目
|
|
|
|
|
Map<String,Map<String,Object>> evectionItems = (Map<String,Map<String,Object>>)params.get("evectionItems");
|
|
|
|
|
//排班
|
|
|
|
|
List<Map<String, Object>> scheduleResult = (List<Map<String,Object>>)params.get("scheduleResult");
|
|
|
|
|
//分析日期
|
|
|
|
|
String analysisDate = Util.null2String(params.get("analysisDate"));
|
|
|
|
|
//人员
|
|
|
|
|
String userId = Util.null2String(params.get("userId"));
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|