You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
3.3 KiB
Java

2 years ago
package com.engine.attendance.attendanceanalysis.service.impl;
import com.engine.attendance.attendanceanalysis.service.EvectionService;
import com.engine.attendance.enums.CheckBoxEnum;
import com.engine.common.util.DateUtil;
import com.engine.core.impl.Service;
import weaver.general.Util;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class EvectionServiceImpl extends Service implements EvectionService {
@Override
public List<Map<String, Object>> evectionByTime(Map<String, Object> param) {
//人员迟到、早退、漏卡等记录
List<Map<String,Object>> abnormalClockInList = (List<Map<String,Object>>)param.get("abnormalClockInList");
//请假开始时间
String kssj = Util.null2String(param.get("kssj"));
//请假结束时间
String jssj = Util.null2String(param.get("jssj"));
for (int i=0;i<abnormalClockInList.size();i++){
String pointTime = Util.null2String(abnormalClockInList.get(i).get("pointTime"));
if (DateUtil.getTime(kssj).compareTo(DateUtil.getTime(pointTime)) <=0 &&
DateUtil.getTime(jssj).compareTo(DateUtil.getTime(pointTime)) >=0){
abnormalClockInList.remove(i);
i--;
}
}
return abnormalClockInList;
}
@Override
public List<Map<String, Object>> evectionByDurationTime(Map<String, Object> param) {
//人员迟到、早退、漏卡等记录
List<Map<String,Object>> abnormalClockInList = (List<Map<String,Object>>)param.get("abnormalClockInList");
List<Map<String,Object>> forgetClockList = abnormalClockInList.stream().filter(e -> e.get("betweenMinutes") == null).collect(Collectors.toList());
abnormalClockInList = abnormalClockInList.stream().filter(e -> e.get("betweenMinutes") != null).collect(Collectors.toList());
abnormalClockInList = abnormalClockInList.stream().sorted(Comparator.comparing(e->Integer.valueOf(e.get("betweenMinutes").toString()))).collect(Collectors.toList());
//请假时长,单位小时
int ccsc = param.get("ccsc") == null?0:Double.valueOf(Double.valueOf(param.get("ccsc").toString())*60).intValue();
//同一天可抵消多个异常
String tybcndbjlhbjs = Util.null2String(param.get("tybcndbjlhbjs"));
if (CheckBoxEnum.CHECKED.equals(tybcndbjlhbjs)){
for (int i=abnormalClockInList.size() -1;i>=0;i--){
int time = Integer.valueOf(abnormalClockInList.get(i).get("betweenMinutes").toString());
if (ccsc > time){
ccsc = ccsc-time;
abnormalClockInList.remove(i);
i++;
}
}
}else{
for (int i=abnormalClockInList.size() -1;i>=0;i--){
int time = Integer.valueOf(abnormalClockInList.get(i).get("betweenMinutes").toString());
if (ccsc > time){
abnormalClockInList.remove(i);
break;
}
}
}
abnormalClockInList.addAll(forgetClockList);
return abnormalClockInList;
}
@Override
public List<Map<String,Object>> evectionByHalfDay(Map<String, Object> param) {
return null;
}
}