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.
121 lines
6.5 KiB
Java
121 lines
6.5 KiB
Java
11 months ago
|
package com.engine.jucailinkq.attendance.attendanceanalysis.service.impl;
|
||
2 years ago
|
|
||
11 months ago
|
import com.engine.jucailinkq.attendance.attendanceanalysis.cmd.GetEvectionCmd;
|
||
|
import com.engine.jucailinkq.attendance.attendanceanalysis.service.EvectionService;
|
||
|
import com.engine.jucailinkq.attendance.enums.AccountingUnitEnum;
|
||
|
import com.engine.jucailinkq.attendance.enums.AttendanceItemTypeEnum;
|
||
|
import com.engine.jucailinkq.attendance.enums.CheckBoxEnum;
|
||
|
import com.engine.jucailinkq.attendance.enums.WorkForTimeEnum;
|
||
|
import com.engine.jucailinkq.common.util.Utils;
|
||
2 years ago
|
import com.engine.core.impl.Service;
|
||
2 years ago
|
import com.google.common.collect.Lists;
|
||
2 years ago
|
import com.google.common.collect.Maps;
|
||
2 years ago
|
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
|
||
2 years ago
|
public Map<String,Object> evectionByTime(Map<String, Object> param) {
|
||
2 years ago
|
//人员迟到、早退、漏卡等记录
|
||
|
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"));
|
||
2 years ago
|
//作用时段
|
||
|
String zysd = Util.null2String(param.get("zysd"));
|
||
2 years ago
|
//分析日期
|
||
|
String analysisDate = Util.null2String(param.get("analysisDate"));
|
||
|
//排班
|
||
|
List<Map<String,Object>> scheduleResult = (List<Map<String,Object>>)param.get("scheduleResult");
|
||
2 years ago
|
|
||
2 years ago
|
List<Map<String,Object>> offsetEvectionAnomaly = Lists.newArrayList();
|
||
2 years ago
|
for (int i=0;i<abnormalClockInList.size();i++){
|
||
2 years ago
|
String bdlx = Util.null2String(abnormalClockInList.get(i).get("bdlx"));
|
||
2 years ago
|
AttendanceItemTypeEnum itemType = (AttendanceItemTypeEnum)abnormalClockInList.get(i).get("itemType");
|
||
|
String classStartTime = Util.null2String(abnormalClockInList.get(i).get("classStartTime"));
|
||
|
String classEndTime = Util.null2String(abnormalClockInList.get(i).get("classEndTime"));
|
||
|
if ((zysd.contains(Utils.getWorkFor(bdlx)) || zysd.contains(WorkForTimeEnum.ALL_TIME.getKey())) &&
|
||
|
!AttendanceItemTypeEnum.MISSE_CARD.equals(itemType)) {
|
||
|
|
||
|
Map<String,Object> leaveMap = Maps.newHashMap();
|
||
|
leaveMap.put("kssj",kssj);
|
||
|
leaveMap.put("jssj",jssj);
|
||
2 years ago
|
int betweenTime = Utils.removeRestTime(classStartTime,classEndTime,scheduleResult,analysisDate);
|
||
|
int intersectionTime = Utils.getIntersectionTime(classStartTime,classEndTime,leaveMap,scheduleResult,analysisDate);
|
||
2 years ago
|
if (betweenTime == intersectionTime){
|
||
2 years ago
|
offsetEvectionAnomaly.add(abnormalClockInList.get(i));
|
||
2 years ago
|
}else {
|
||
|
String hsdw = Util.null2String(abnormalClockInList.get(i).get("hsdw"));
|
||
2 years ago
|
double hsl = Double.valueOf(Util.null2String(abnormalClockInList.get(i).get("hsl")));
|
||
2 years ago
|
double itemduration = Utils.getItemduration(hsl,hsdw,betweenTime-intersectionTime, AccountingUnitEnum.MINUTES);
|
||
|
abnormalClockInList.get(i).put("itemduration",itemduration);
|
||
2 years ago
|
}
|
||
2 years ago
|
}
|
||
|
}
|
||
2 years ago
|
abnormalClockInList.removeAll(offsetEvectionAnomaly);
|
||
|
Map<String,Object> resultMap = Maps.newHashMap();
|
||
|
resultMap.put("abnormalClockInList",abnormalClockInList);
|
||
|
resultMap.put("offsetEvectionAnomaly",offsetEvectionAnomaly);
|
||
|
return resultMap;
|
||
2 years ago
|
}
|
||
|
|
||
|
@Override
|
||
2 years ago
|
public Map<String,Object> evectionByDurationTime(Map<String, Object> param) {
|
||
2 years ago
|
//人员迟到、早退、漏卡等记录
|
||
|
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());
|
||
|
|
||
|
//请假时长,单位小时
|
||
11 months ago
|
int ccsc = param.get("ccsc") == null?0:Double.valueOf(Math.ceil(Double.valueOf(param.get("ccsc").toString())*60)).intValue();
|
||
2 years ago
|
//同一天可抵消多个异常
|
||
2 years ago
|
List<Map<String,Object>> offsetEvectionAnomaly = Lists.newArrayList();
|
||
2 years ago
|
//作用时段
|
||
|
String zysd = Util.null2String(param.get("zysd"));
|
||
2 years ago
|
|
||
2 years ago
|
String tybcndbjlhbjs = Util.null2String(param.get("tybcndbjlhbjs"));
|
||
2 years ago
|
if (CheckBoxEnum.CHECKED.getKey().equals(tybcndbjlhbjs)){
|
||
2 years ago
|
for (int i=abnormalClockInList.size() -1;i>=0;i--){
|
||
|
int time = Integer.valueOf(abnormalClockInList.get(i).get("betweenMinutes").toString());
|
||
2 years ago
|
String bdlx = Util.null2String(abnormalClockInList.get(i).get("bdlx"));
|
||
|
if (ccsc > time && (zysd.contains(Utils.getWorkFor(bdlx)) || zysd.contains(WorkForTimeEnum.ALL_TIME.getKey()))){
|
||
2 years ago
|
ccsc = ccsc-time;
|
||
2 years ago
|
offsetEvectionAnomaly.add(abnormalClockInList.get(i));
|
||
2 years ago
|
}
|
||
|
}
|
||
2 years ago
|
abnormalClockInList.removeAll(offsetEvectionAnomaly);
|
||
2 years ago
|
}else{
|
||
|
for (int i=abnormalClockInList.size() -1;i>=0;i--){
|
||
|
int time = Integer.valueOf(abnormalClockInList.get(i).get("betweenMinutes").toString());
|
||
2 years ago
|
String bdlx = Util.null2String(abnormalClockInList.get(i).get("bdlx"));
|
||
|
if (ccsc > time && (zysd.contains(Utils.getWorkFor(bdlx)) || zysd.contains(WorkForTimeEnum.ALL_TIME.getKey()))){
|
||
2 years ago
|
offsetEvectionAnomaly.add(abnormalClockInList.get(i));
|
||
2 years ago
|
abnormalClockInList.remove(i);
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
abnormalClockInList.addAll(forgetClockList);
|
||
2 years ago
|
Map<String,Object> resultMap = Maps.newHashMap();
|
||
|
resultMap.put("abnormalClockInList",abnormalClockInList);
|
||
|
resultMap.put("offsetEvectionAnomaly",offsetEvectionAnomaly);
|
||
|
return resultMap;
|
||
2 years ago
|
}
|
||
|
|
||
|
@Override
|
||
|
public List<Map<String,Object>> evectionByHalfDay(Map<String, Object> param) {
|
||
|
return null;
|
||
|
}
|
||
1 year ago
|
|
||
|
@Override
|
||
|
public Map<String, Object> getEvection(Map<String, Object> param) {
|
||
|
return commandExecutor.execute(new GetEvectionCmd(param));
|
||
|
}
|
||
2 years ago
|
}
|