|
|
|
|
package com.engine.attendance.attendanceanalysis.wrapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.engine.attendance.attendanceanalysis.cmd.UpdateAttendanceResultsCmd;
|
|
|
|
|
import com.engine.attendance.attendanceanalysis.service.AbnormalAttendanceService;
|
|
|
|
|
import com.engine.attendance.attendanceanalysis.service.AskForLeaveService;
|
|
|
|
|
import com.engine.attendance.attendanceanalysis.service.EvectionService;
|
|
|
|
|
import com.engine.attendance.attendanceanalysis.service.ForgetClockInService;
|
|
|
|
|
import com.engine.attendance.attendanceanalysis.service.impl.AbnormalAttendanceServiceImpl;
|
|
|
|
|
import com.engine.attendance.attendanceanalysis.service.impl.AskForLeaveServiceImpl;
|
|
|
|
|
import com.engine.attendance.attendanceanalysis.service.impl.EvectionServiceImpl;
|
|
|
|
|
import com.engine.attendance.attendanceanalysis.service.impl.ForgetClockInServiceImpl;
|
|
|
|
|
import com.engine.attendance.enums.*;
|
|
|
|
|
import com.engine.common.util.DateUtil;
|
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
|
|
|
|
import com.engine.common.util.Utils;
|
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import weaver.general.Util;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class UpdateAttendanceResultWrapper extends Service {
|
|
|
|
|
private AbnormalAttendanceService beLateService = ServiceUtil.getService(AbnormalAttendanceServiceImpl.class);
|
|
|
|
|
private ForgetClockInService forgetClockInService = ServiceUtil.getService(ForgetClockInServiceImpl.class);
|
|
|
|
|
private AskForLeaveService askForLeaveService= ServiceUtil.getService(AskForLeaveServiceImpl.class);
|
|
|
|
|
private EvectionService evectionService= ServiceUtil.getService(EvectionServiceImpl.class);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 记录异常打卡
|
|
|
|
|
* */
|
|
|
|
|
public List<Map<String,Object>> 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()));
|
|
|
|
|
List<Map<String,Object>> resultList = Lists.newArrayList();
|
|
|
|
|
|
|
|
|
|
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> missCardParams = Maps.newHashMap();
|
|
|
|
|
missCardParams.put("classInfo",classInfo);
|
|
|
|
|
missCardParams.put("clcokInTimeData",clcokInTimeData);
|
|
|
|
|
missCardParams.put("attendanceItems",attendanceItems);
|
|
|
|
|
missCardParams.put("analysisDate",analysisDate);
|
|
|
|
|
missCardParams.put("userId",userId);
|
|
|
|
|
log.info("missCardParams classInfo: [{}],clcokInTimeData:[{}]",classInfo,clcokInTimeData);
|
|
|
|
|
List<Map<String,Object>> iforgetClockIn = forgetClockInService.forgetClockIn(missCardParams);
|
|
|
|
|
if (iforgetClockIn.size() >0){
|
|
|
|
|
iforgetClockIn.get(0).put("pointTime",pointTime);
|
|
|
|
|
resultList.add(iforgetClockIn.get(0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}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);
|
|
|
|
|
log.info("beLateParams classInfo: [{}],clcokInTimeData:[{}]",classInfo,clcokInTimeData);
|
|
|
|
|
List<Map<String,Object>> ifBeLate = beLateService.beLate(beLateParams);
|
|
|
|
|
if (ifBeLate.size() > 0){
|
|
|
|
|
ifBeLate.get(0).put("pointTime",pointTime);
|
|
|
|
|
resultList.add(ifBeLate.get(0));
|
|
|
|
|
}
|
|
|
|
|
}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);
|
|
|
|
|
log.info("leaveEarlyParams classInfo: [{}],clcokInTimeData:[{}]",classInfo,clcokInTimeData);
|
|
|
|
|
List<Map<String,Object>> ifLeaveEarly = beLateService.leaveEarly(leaveEarlyParams);
|
|
|
|
|
if (ifLeaveEarly.size() > 0){
|
|
|
|
|
ifLeaveEarly.get(0).put("pointTime",pointTime);
|
|
|
|
|
resultList.add(ifLeaveEarly.get(0));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if (iforgetClockIn || ifBeLate ||ifLeaveEarly){
|
|
|
|
|
// return true;
|
|
|
|
|
// }
|
|
|
|
|
return resultList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 记录加班
|
|
|
|
|
* @param params
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public boolean recordWorkOverTime(Map<String,Object> params){
|
|
|
|
|
//考勤项目
|
|
|
|
|
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 Map<String, Object> recordAskForLeave(Map<String,Object> params){
|
|
|
|
|
//请假项目
|
|
|
|
|
Map<String,Map<String,Object>> askForLeaveItems = (Map<String,Map<String,Object>>)params.get("askForLeaveItems");
|
|
|
|
|
//分析日期
|
|
|
|
|
String analysisDate = Util.null2String(params.get("analysisDate"));
|
|
|
|
|
//排班
|
|
|
|
|
List<Map<String, Object>> scheduleResult = (List<Map<String,Object>>)params.get("scheduleResult");
|
|
|
|
|
//请假记录
|
|
|
|
|
List<Map<String, Object>> askForLeaveList = (List<Map<String,Object>>)params.get("askForLeaveList");
|
|
|
|
|
//异常记录
|
|
|
|
|
List<Map<String,Object>> abnormalClockInList = (List<Map<String,Object>>)params.get("abnormalClockInList");
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = Maps.newHashMap();
|
|
|
|
|
List<Map<String, Object>> resultList = Lists.newArrayList();
|
|
|
|
|
|
|
|
|
|
for (int i=0;i<askForLeaveList.size();i++){
|
|
|
|
|
Map<String, Object> resultMap = Maps.newHashMap();
|
|
|
|
|
resultList.add(resultMap);
|
|
|
|
|
resultMap.put("item",askForLeaveList.get(i).get("jqlx"));
|
|
|
|
|
String kssj = askForLeaveList.get(i).get("ksrq") + " "+askForLeaveList.get(i).get("kssj");
|
|
|
|
|
String jssj = askForLeaveList.get(i).get("jsrq")+ " "+askForLeaveList.get(i).get("jssj");
|
|
|
|
|
//半天请假
|
|
|
|
|
String btj = Util.null2String(askForLeaveList.get(i).get("btj"));
|
|
|
|
|
//请假时长
|
|
|
|
|
String qjsc = Util.null2String(askForLeaveList.get(i).get("qjsc"));
|
|
|
|
|
//请假项目
|
|
|
|
|
Map<String,Object> askForLeaveItem = askForLeaveItems.get(askForLeaveList.get(i).get("jqlx"));
|
|
|
|
|
//自动移除时间区间内的非工作时长
|
|
|
|
|
String zdycbcndfgzsd = Util.null2String(askForLeaveItem.get("zdycbcndfgzsd"));
|
|
|
|
|
//同一天可抵消多个异常
|
|
|
|
|
String tybcndbjlhbjs = Util.null2String(askForLeaveItem.get("tybcndbjlhbjs"));
|
|
|
|
|
//核算量
|
|
|
|
|
double hsl = Double.valueOf(Util.null2String(askForLeaveItem.get("hsl")));
|
|
|
|
|
//核算单位
|
|
|
|
|
String hsdw = Util.null2String(askForLeaveItem.get("hsdw"));
|
|
|
|
|
|
|
|
|
|
Map<String,Object> param = Maps.newHashMap();
|
|
|
|
|
param.put("abnormalClockInList",abnormalClockInList);
|
|
|
|
|
|
|
|
|
|
double itemduration = 0;
|
|
|
|
|
if ("".equals(Util.null2String(askForLeaveList.get(i).get("kssj"))) || "".equals(Util.null2String(askForLeaveList.get(i).get("jssj")))){
|
|
|
|
|
//弹性请假,半天请假
|
|
|
|
|
if (CheckBoxEnum.CHECKED.getKey().equals(btj)){
|
|
|
|
|
//半天请假
|
|
|
|
|
askForLeaveService.askForLeaveByHalfDay(param);
|
|
|
|
|
}else if (!"".equals(qjsc)){
|
|
|
|
|
//时长请假
|
|
|
|
|
itemduration = Utils.getItemduration(hsl,hsdw,Double.valueOf(Double.valueOf(qjsc)*60).intValue(),AccountingUnitEnum.MINUTES);
|
|
|
|
|
|
|
|
|
|
resultMap.put("itemduration",itemduration);
|
|
|
|
|
param.put("qjsc",qjsc);
|
|
|
|
|
param.put("tybcndbjlhbjs",tybcndbjlhbjs);
|
|
|
|
|
if (abnormalClockInList.size()>0){
|
|
|
|
|
abnormalClockInList =askForLeaveService.askForLeaveByDurationTime(param);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
//按照开始时间,结束时间请假
|
|
|
|
|
int timeMinutes = DateUtil.getBetWeenMinutes(kssj,jssj);
|
|
|
|
|
if (CheckBoxEnum.CHECKED.getKey().equals(zdycbcndfgzsd)){
|
|
|
|
|
timeMinutes = removeRestTime(kssj,jssj,scheduleResult,analysisDate);
|
|
|
|
|
}
|
|
|
|
|
log.info("recordAskForLeave timeMinutes :[{}] ,hsl:{},hsdw",timeMinutes,hsl,hsdw);
|
|
|
|
|
itemduration = Utils.getItemduration(hsl,hsdw,timeMinutes,AccountingUnitEnum.MINUTES);
|
|
|
|
|
resultMap.put("itemduration",itemduration);
|
|
|
|
|
param.put("kssj",kssj);
|
|
|
|
|
param.put("jssj",jssj);
|
|
|
|
|
if (abnormalClockInList.size()>0){
|
|
|
|
|
abnormalClockInList = askForLeaveService.askForLeaveByTime(param);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
map.put("resultList",resultList);
|
|
|
|
|
map.put("abnormalClockInList",abnormalClockInList);
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 外出
|
|
|
|
|
* @param params
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Map<String, Object> recordEvection(Map<String,Object> params){
|
|
|
|
|
|
|
|
|
|
//外出项目
|
|
|
|
|
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"));
|
|
|
|
|
//出差记录
|
|
|
|
|
List<Map<String, Object>> evectionList = (List<Map<String,Object>>)params.get("evectionList");
|
|
|
|
|
//异常记录
|
|
|
|
|
List<Map<String,Object>> abnormalClockInList = (List<Map<String,Object>>)params.get("abnormalClockInList");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = Maps.newHashMap();
|
|
|
|
|
List<Map<String, Object>> resultList = Lists.newArrayList();
|
|
|
|
|
|
|
|
|
|
for (int i=0;i<evectionList.size();i++){
|
|
|
|
|
Map<String, Object> resultMap = Maps.newHashMap();
|
|
|
|
|
resultList.add(resultMap);
|
|
|
|
|
resultMap.put("item",evectionList.get(i).get("cclx"));
|
|
|
|
|
String kssj = evectionList.get(i).get("ksrq") + " "+evectionList.get(i).get("kssj");
|
|
|
|
|
String jssj = evectionList.get(i).get("jsrq")+ " "+evectionList.get(i).get("jssj");
|
|
|
|
|
//半天请假
|
|
|
|
|
String btj = Util.null2String(evectionList.get(i).get("btcc"));
|
|
|
|
|
//请假时长
|
|
|
|
|
String qjsc = Util.null2String(evectionList.get(i).get("ccsc"));
|
|
|
|
|
//请假项目
|
|
|
|
|
Map<String,Object> evectionItem = evectionItems.get(evectionList.get(i).get("cclx"));
|
|
|
|
|
//自动移除时间区间内的非工作时长
|
|
|
|
|
String zdycbcndfgzsd = Util.null2String(evectionItem.get("zdycbcndfgzsd"));
|
|
|
|
|
//同一天可抵消多个异常
|
|
|
|
|
String tybcndbjlhbjs = Util.null2String(evectionItem.get("tybcndbjlhbjs"));
|
|
|
|
|
//核算量
|
|
|
|
|
double hsl = Double.valueOf(Util.null2String(evectionItem.get("hsl")));
|
|
|
|
|
//核算单位
|
|
|
|
|
String hsdw = Util.null2String(evectionItem.get("hsdw"));
|
|
|
|
|
|
|
|
|
|
Map<String,Object> param = Maps.newHashMap();
|
|
|
|
|
param.put("abnormalClockInList",abnormalClockInList);
|
|
|
|
|
|
|
|
|
|
double itemduration = 0;
|
|
|
|
|
if ("".equals(Util.null2String(evectionList.get(i).get("kssj"))) || "".equals(Util.null2String(evectionList.get(i).get("jssj")))){
|
|
|
|
|
//弹性请假,半天出差
|
|
|
|
|
if (CheckBoxEnum.CHECKED.getKey().equals(btj)){
|
|
|
|
|
//半天出差
|
|
|
|
|
evectionService.evectionByHalfDay(param);
|
|
|
|
|
}else if (!"".equals(qjsc)){
|
|
|
|
|
//时长出差
|
|
|
|
|
itemduration = Utils.getItemduration(hsl,hsdw,Double.valueOf(Double.valueOf(qjsc)*60).intValue(),AccountingUnitEnum.MINUTES);
|
|
|
|
|
|
|
|
|
|
resultMap.put("itemduration",itemduration);
|
|
|
|
|
param.put("ccsc",qjsc);
|
|
|
|
|
param.put("tybcndbjlhbjs",tybcndbjlhbjs);
|
|
|
|
|
if (abnormalClockInList.size()>0){
|
|
|
|
|
abnormalClockInList =evectionService.evectionByDurationTime(param);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
//按照开始时间,结束时间出差
|
|
|
|
|
int timeMinutes = DateUtil.getBetWeenMinutes(kssj,jssj);
|
|
|
|
|
if (CheckBoxEnum.CHECKED.getKey().equals(zdycbcndfgzsd)){
|
|
|
|
|
timeMinutes = removeRestTime(kssj,jssj,scheduleResult,analysisDate);
|
|
|
|
|
}
|
|
|
|
|
log.info("recordEvection timeMinutes :[{}] ,hsl:{},hsdw",timeMinutes,hsl,hsdw);
|
|
|
|
|
itemduration = Utils.getItemduration(hsl,hsdw,timeMinutes,AccountingUnitEnum.MINUTES);
|
|
|
|
|
resultMap.put("itemduration",itemduration);
|
|
|
|
|
param.put("kssj",kssj);
|
|
|
|
|
param.put("jssj",jssj);
|
|
|
|
|
if (abnormalClockInList.size()>0){
|
|
|
|
|
abnormalClockInList = evectionService.evectionByTime(param);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
map.put("resultList",resultList);
|
|
|
|
|
map.put("abnormalClockInList",abnormalClockInList);
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 正常上下班,填写
|
|
|
|
|
* @param params
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public List<Map<String,Object>> recordNormal(Map<String,Object> params){
|
|
|
|
|
//排班
|
|
|
|
|
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"));
|
|
|
|
|
//日期类型
|
|
|
|
|
String rqlx = Util.null2String(scheduleResult.get(0).get("rqlx"));
|
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> resultList = Lists.newArrayList();
|
|
|
|
|
|
|
|
|
|
Map<String,Object> normalParams = Maps.newHashMap();
|
|
|
|
|
|
|
|
|
|
// normalParams.put("userId",userId);
|
|
|
|
|
// normalParams.put("date",analysisDate);
|
|
|
|
|
// normalParams.put("classInfo",scheduleResult);
|
|
|
|
|
// normalParams.put("modeId",params.get("modeId"));
|
|
|
|
|
if (DateTypeEnum.WORK_DAY.getKey().equals(rqlx) || DateTypeEnum.CHANGECLASS.getKey().equals(rqlx)){
|
|
|
|
|
//工作日
|
|
|
|
|
normalParams.put("item",SystemItemEnum.WORK_DAY.getKey());
|
|
|
|
|
}else if (DateTypeEnum.HOLIDAY.getKey().equals(rqlx)){
|
|
|
|
|
//节假日
|
|
|
|
|
normalParams.put("item",SystemItemEnum.HOLIDAY.getKey());
|
|
|
|
|
}else if (DateTypeEnum.PUBLIC_RESTDAY.getKey().equals(rqlx) ||
|
|
|
|
|
DateTypeEnum.EXCHANGE_LEAVEDAY.getKey().equals(rqlx)){
|
|
|
|
|
//休息日
|
|
|
|
|
normalParams.put("item",SystemItemEnum.REST_DAY.getKey());
|
|
|
|
|
}
|
|
|
|
|
resultList.add(normalParams);
|
|
|
|
|
//commandExecutor.execute(new UpdateAttendanceResultsCmd(normalParams));
|
|
|
|
|
|
|
|
|
|
return resultList;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 没有排班
|
|
|
|
|
* @param params
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public boolean recordNoClass(Map<String,Object> params){
|
|
|
|
|
//分析日期
|
|
|
|
|
String analysisDate = Util.null2String(params.get("analysisDate"));
|
|
|
|
|
//人员
|
|
|
|
|
String userId = Util.null2String(params.get("userId"));
|
|
|
|
|
|
|
|
|
|
Map<String,Object> normalParams = Maps.newHashMap();
|
|
|
|
|
|
|
|
|
|
normalParams.put("userId",userId);
|
|
|
|
|
normalParams.put("date",analysisDate);
|
|
|
|
|
normalParams.put("modeId",params.get("modeId"));
|
|
|
|
|
log.info("userId : {} ,analysisDate: {} have no class",userId,analysisDate);
|
|
|
|
|
commandExecutor.execute(new UpdateAttendanceResultsCmd(normalParams));
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 请假、外出时间扣出休息时间
|
|
|
|
|
* @param kssj 开始时间
|
|
|
|
|
* @param jssj 结束时间
|
|
|
|
|
* @param scheduleResult 班次
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public int removeRestTime(String kssj,String jssj,List<Map<String, Object>> scheduleResult,String analysisDate){
|
|
|
|
|
scheduleResult = scheduleResult.stream().filter(e -> ClassSegmentTypeEnum.REST_AND_DINE.getKey().equals(e.get("bdlx")) ||
|
|
|
|
|
ClassSegmentTypeEnum.REST_PERIOD.getKey().equals(e.get("bdlx")) || ClassSegmentTypeEnum.DINING_PERIOD.getKey().equals(e.get("bdlx"))).collect(Collectors.toList());
|
|
|
|
|
int betweenMinutes = DateUtil.getBetWeenMinutes(kssj,jssj);
|
|
|
|
|
log.info("removeRestTime scheduleResult : {}",scheduleResult);
|
|
|
|
|
for (Map<String, Object> restSchedule :scheduleResult){
|
|
|
|
|
String dtkssj = analysisDate+" "+restSchedule.get("dtkssj");
|
|
|
|
|
String dtjssj = analysisDate+" "+restSchedule.get("dtjssj");
|
|
|
|
|
if (DateUtil.getTime(dtkssj).compareTo(DateUtil.getTime(dtjssj)) > 0){
|
|
|
|
|
dtjssj = DateUtil.AfterDay(analysisDate,1) +" "+restSchedule.get("dtjssj");
|
|
|
|
|
}
|
|
|
|
|
if (DateUtil.getTime(kssj).compareTo(DateUtil.getTime(dtkssj)) <=0 && DateUtil.getTime(jssj).compareTo(DateUtil.getTime(dtjssj)) >=0){
|
|
|
|
|
//休息时间在请假时间中间
|
|
|
|
|
betweenMinutes = betweenMinutes - DateUtil.getBetWeenMinutes(dtkssj,dtjssj);
|
|
|
|
|
log.info("休息时间在请假时间中间");
|
|
|
|
|
}else if (DateUtil.getTime(kssj).compareTo(DateUtil.getTime(dtkssj)) <=0 && DateUtil.getTime(jssj).compareTo(DateUtil.getTime(dtjssj)) <=0 && DateUtil.getTime(jssj).compareTo(DateUtil.getTime(dtkssj)) >=0){
|
|
|
|
|
//休息时间在请假时间 左边
|
|
|
|
|
betweenMinutes = betweenMinutes - DateUtil.getBetWeenMinutes(dtkssj,jssj);
|
|
|
|
|
log.info("休息时间在请假时间 左边");
|
|
|
|
|
}else if (DateUtil.getTime(kssj).compareTo(DateUtil.getTime(dtkssj)) >=0 && DateUtil.getTime(jssj).compareTo(DateUtil.getTime(dtjssj)) >=0 && DateUtil.getTime(kssj).compareTo(DateUtil.getTime(dtjssj)) <=0){
|
|
|
|
|
//休息时间在请假时间 右边
|
|
|
|
|
betweenMinutes = betweenMinutes - DateUtil.getBetWeenMinutes(kssj,dtjssj);
|
|
|
|
|
log.info("休息时间在请假时间 右边");
|
|
|
|
|
}else if (DateUtil.getTime(kssj).compareTo(DateUtil.getTime(dtkssj)) >=0 && DateUtil.getTime(jssj).compareTo(DateUtil.getTime(dtjssj)) <=0){
|
|
|
|
|
//请假时间在休息时间中间
|
|
|
|
|
betweenMinutes = 0;
|
|
|
|
|
log.info("请假时间在休息时间中间");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return betweenMinutes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|