|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.engine.attendance.attendanceanalysis.cmd.getclockInpoint;
|
|
|
|
|
|
|
|
|
|
import com.engine.attendance.attendanceanalysis.dto.ClockPointDTO;
|
|
|
|
|
import com.engine.attendance.enums.AccountingUnitEnum;
|
|
|
|
|
import com.engine.attendance.enums.CheckBoxEnum;
|
|
|
|
|
import com.engine.attendance.enums.ClassSegmentTypeEnum;
|
|
|
|
@ -217,7 +218,7 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
|
|
|
|
|
log.info("经过重新计算卡点时 新的scheduleResult : [{}]",scheduleResult);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<String, Map<String, Object>>> clcokInTimeData = getClockInPoint(analysisDate, scheduleResult, clockInTimeList,needClockDateList);
|
|
|
|
|
List<ClockPointDTO> clcokInTimeData = getClockInPoint(analysisDate, scheduleResult, clockInTimeList,needClockDateList);
|
|
|
|
|
|
|
|
|
|
log.info("clcokInTimeData :[{}]",clcokInTimeData);
|
|
|
|
|
resultMap.put("clcokInTimeData", clcokInTimeData);
|
|
|
|
@ -236,10 +237,10 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
|
|
|
|
|
* @return {2023-11-12 09:00|0|3|2023-11-12 09:15 ={signtime=09:11:00, id=48, userid=53, signdate=2023-11-12}}
|
|
|
|
|
* 班次时间|打卡类型(上班卡或下班卡)|打卡时间处所在位置|timeType|弹性时间 = 打卡时间map集合
|
|
|
|
|
*/
|
|
|
|
|
public List<Map<String, Map<String, Object>>> getClockInPoint(String analysisDate, List<Map<String, Object>> scheduleResult, List<Map<String, Object>> clockInTimeList, List<String> needClockDateList) {
|
|
|
|
|
public List<ClockPointDTO> getClockInPoint(String analysisDate, List<Map<String, Object>> scheduleResult, List<Map<String, Object>> clockInTimeList, List<String> needClockDateList) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<String, Map<String, Object>>> clcokInTimeData = Lists.newArrayList();
|
|
|
|
|
List<ClockPointDTO> clcokInTimeData = Lists.newArrayList();
|
|
|
|
|
for (Map<String, Object> needClockIn : scheduleResult) {
|
|
|
|
|
|
|
|
|
|
/**非请假外出开始打卡逻辑处理*/
|
|
|
|
@ -257,30 +258,29 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
|
|
|
|
|
tqdkfzs = Util.null2String(needClockIn.get("tqdkfzs")).equals("")?60:Integer.valueOf(needClockIn.get("tqdkfzs").toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, Map<String, Object>> ksdkNearestClcokInTime = Utils.getNearestClcokInTimeCmd(dtkssj, clockInTimeList);
|
|
|
|
|
String timeType = ClockPointEnum.EMPTY.getKey();
|
|
|
|
|
Map<String, Map<String, Object>> clcokInTimeMap = Maps.newHashMap();
|
|
|
|
|
if (ksdkNearestClcokInTime.get(ClockPointEnum.EQUAL.getKey()) != null) {
|
|
|
|
|
timeType = ClockPointEnum.EQUAL.getKey();
|
|
|
|
|
Map<ClockPointEnum, Map<String, Object>> ksdkNearestClcokInTime = Utils.getNearestClcokInTimeCmd(dtkssj, clockInTimeList);
|
|
|
|
|
ClockPointEnum timeType = ClockPointEnum.EMPTY;
|
|
|
|
|
if (ksdkNearestClcokInTime.get(ClockPointEnum.EQUAL) != null) {
|
|
|
|
|
timeType = ClockPointEnum.EQUAL;
|
|
|
|
|
}
|
|
|
|
|
if (ClockPointEnum.EMPTY.getKey().equals(timeType) && ksdkNearestClcokInTime.get(ClockPointEnum.BEFORE.getKey()) != null) {
|
|
|
|
|
String clockInTime = ksdkNearestClcokInTime.get(ClockPointEnum.BEFORE.getKey()).get("signdate") + " " + ksdkNearestClcokInTime.get(ClockPointEnum.BEFORE.getKey()).get("signtime");
|
|
|
|
|
if (ClockPointEnum.EMPTY.equals(timeType) && ksdkNearestClcokInTime.get(ClockPointEnum.BEFORE) != null) {
|
|
|
|
|
String clockInTime = ksdkNearestClcokInTime.get(ClockPointEnum.BEFORE).get("signdate") + " " + ksdkNearestClcokInTime.get(ClockPointEnum.BEFORE).get("signtime");
|
|
|
|
|
if (DateUtil.getTime(clockInTime).compareTo(DateUtil.getTime(DateUtil.beforeMinutes(dtkssj, tqdkfzs))) >= 0 &&
|
|
|
|
|
(getBeforeClockTime(needClockDateList,dtkssj).equals("") || DateUtil.getTime(clockInTime).compareTo(DateUtil.getTime(getBeforeClockTime(needClockDateList,dtkssj))) > 0)) {
|
|
|
|
|
//打卡时间大于等于最早打卡时间
|
|
|
|
|
timeType = ClockPointEnum.BEFORE.getKey();
|
|
|
|
|
timeType = ClockPointEnum.BEFORE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (ClockPointEnum.EMPTY.getKey().equals(timeType) && ksdkNearestClcokInTime.get(ClockPointEnum.AFTER.getKey()) != null) {
|
|
|
|
|
String clockInTime = ksdkNearestClcokInTime.get(ClockPointEnum.AFTER.getKey()).get("signdate") + " " + ksdkNearestClcokInTime.get(ClockPointEnum.AFTER.getKey()).get("signtime");
|
|
|
|
|
if (ClockPointEnum.EMPTY.equals(timeType) && ksdkNearestClcokInTime.get(ClockPointEnum.AFTER) != null) {
|
|
|
|
|
String clockInTime = ksdkNearestClcokInTime.get(ClockPointEnum.AFTER).get("signdate") + " " + ksdkNearestClcokInTime.get(ClockPointEnum.AFTER).get("signtime");
|
|
|
|
|
|
|
|
|
|
if (getNextClockTime(needClockDateList,dtkssj).equals("") || DateUtil.getTime(clockInTime).compareTo(DateUtil.getTime(getNextClockTime(needClockDateList,dtkssj))) < 0) {
|
|
|
|
|
//打卡时间小于结束时间
|
|
|
|
|
timeType = ClockPointEnum.AFTER.getKey();
|
|
|
|
|
timeType = ClockPointEnum.AFTER;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
clcokInTimeMap.put(dtkssj + "|" + ClockPointEnum.START.getKey() + "|" + timeType, ksdkNearestClcokInTime.get(timeType));
|
|
|
|
|
clcokInTimeData.add(clcokInTimeMap);
|
|
|
|
|
//clcokInTimeMap.put(dtkssj + "|" + ClockPointEnum.START.getKey() + "|" + timeType, ksdkNearestClcokInTime.get(timeType));
|
|
|
|
|
clcokInTimeData.add(ClockPointDTO.builder().classTime(dtkssj).pointType(ClockPointEnum.START).timeType(timeType).classSegmentType(needClockIn.get("bdlx").toString()).clockTime(ksdkNearestClcokInTime.get(timeType)).build());
|
|
|
|
|
}
|
|
|
|
|
/**非请假外出结束打卡逻辑处理*/
|
|
|
|
|
if (CheckBoxEnum.CHECKED.getKey().equals(needClockIn.get("jsdk")) && !ClassSegmentTypeEnum.EVECTION.getKey().equals(needClockIn.get("bdlx")) &&
|
|
|
|
@ -295,28 +295,28 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
|
|
|
|
|
thdkfzs = Util.null2String(needClockIn.get("thdkfzs")).equals("")?60:Integer.valueOf(needClockIn.get("thdkfzs").toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, Map<String, Object>> jsdkNearestClcokInTime = Utils.getNearestClcokInTimeCmd(dtjssj, clockInTimeList);
|
|
|
|
|
Map<ClockPointEnum, Map<String, Object>> jsdkNearestClcokInTime = Utils.getNearestClcokInTimeCmd(dtjssj, clockInTimeList);
|
|
|
|
|
|
|
|
|
|
String timeType = ClockPointEnum.EMPTY.getKey();
|
|
|
|
|
Map<String, Map<String, Object>> clcokInTimeMap = Maps.newHashMap();
|
|
|
|
|
if (jsdkNearestClcokInTime.get(ClockPointEnum.EQUAL.getKey()) != null) {
|
|
|
|
|
timeType = ClockPointEnum.EQUAL.getKey();
|
|
|
|
|
ClockPointEnum timeType = ClockPointEnum.EMPTY;
|
|
|
|
|
|
|
|
|
|
if (jsdkNearestClcokInTime.get(ClockPointEnum.EQUAL) != null) {
|
|
|
|
|
timeType = ClockPointEnum.EQUAL;
|
|
|
|
|
}
|
|
|
|
|
if (ClockPointEnum.EMPTY.getKey().equals(timeType) && jsdkNearestClcokInTime.get(ClockPointEnum.AFTER.getKey()) != null) {
|
|
|
|
|
String clockInTime = jsdkNearestClcokInTime.get(ClockPointEnum.AFTER.getKey()).get("signdate") + " " + jsdkNearestClcokInTime.get(ClockPointEnum.AFTER.getKey()).get("signtime");
|
|
|
|
|
if (ClockPointEnum.EMPTY.equals(timeType) && jsdkNearestClcokInTime.get(ClockPointEnum.AFTER) != null) {
|
|
|
|
|
String clockInTime = jsdkNearestClcokInTime.get(ClockPointEnum.AFTER).get("signdate") + " " + jsdkNearestClcokInTime.get(ClockPointEnum.AFTER).get("signtime");
|
|
|
|
|
if (DateUtil.getTime(clockInTime).compareTo(DateUtil.getTime(DateUtil.AfterMinutes(dtjssj, thdkfzs))) <= 0 &&
|
|
|
|
|
(getNextClockTime(needClockDateList,dtjssj).equals("") || DateUtil.getTime(clockInTime).compareTo(DateUtil.getTime(getNextClockTime(needClockDateList,dtjssj))) < 0)) {
|
|
|
|
|
timeType = ClockPointEnum.AFTER.getKey();
|
|
|
|
|
timeType = ClockPointEnum.AFTER;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (ClockPointEnum.EMPTY.getKey().equals(timeType) && jsdkNearestClcokInTime.get(ClockPointEnum.BEFORE.getKey()) != null) {
|
|
|
|
|
String clockInTime = jsdkNearestClcokInTime.get(ClockPointEnum.BEFORE.getKey()).get("signdate") + " " + jsdkNearestClcokInTime.get(ClockPointEnum.BEFORE.getKey()).get("signtime");
|
|
|
|
|
if (ClockPointEnum.EMPTY.equals(timeType) && jsdkNearestClcokInTime.get(ClockPointEnum.BEFORE) != null) {
|
|
|
|
|
String clockInTime = jsdkNearestClcokInTime.get(ClockPointEnum.BEFORE).get("signdate") + " " + jsdkNearestClcokInTime.get(ClockPointEnum.BEFORE).get("signtime");
|
|
|
|
|
if (getBeforeClockTime(needClockDateList,dtjssj).equals("") || DateUtil.getTime(clockInTime).compareTo(DateUtil.getTime(getBeforeClockTime(needClockDateList,dtjssj))) > 0) {
|
|
|
|
|
timeType = ClockPointEnum.BEFORE.getKey();
|
|
|
|
|
timeType = ClockPointEnum.BEFORE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
clcokInTimeMap.put(dtjssj + "|" + ClockPointEnum.END.getKey() + "|" + timeType, jsdkNearestClcokInTime.get(timeType));
|
|
|
|
|
clcokInTimeData.add(clcokInTimeMap);
|
|
|
|
|
//clcokInTimeMap.put(dtjssj + "|" + ClockPointEnum.END.getKey() + "|" + timeType, jsdkNearestClcokInTime.get(timeType));
|
|
|
|
|
clcokInTimeData.add(ClockPointDTO.builder().classTime(dtjssj).pointType(ClockPointEnum.END).timeType(timeType).classSegmentType(needClockIn.get("bdlx").toString()).clockTime(jsdkNearestClcokInTime.get(timeType)).build());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -330,28 +330,28 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
|
|
|
|
|
DateUtil.getBetWeenMinutes(dtkssj,getNextClockTime(needClockDateList,dtkssj));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, Map<String, Object>> jsdkNearestClcokInTime = Utils.getNearestClcokInTimeCmd(dtkssj, clockInTimeList);
|
|
|
|
|
Map<ClockPointEnum, Map<String, Object>> jsdkNearestClcokInTime = Utils.getNearestClcokInTimeCmd(dtkssj, clockInTimeList);
|
|
|
|
|
|
|
|
|
|
String timeType = ClockPointEnum.EMPTY.getKey();
|
|
|
|
|
ClockPointEnum timeType = ClockPointEnum.EMPTY;
|
|
|
|
|
Map<String, Map<String, Object>> clcokInTimeMap = Maps.newHashMap();
|
|
|
|
|
if (jsdkNearestClcokInTime.get(ClockPointEnum.EQUAL.getKey()) != null) {
|
|
|
|
|
timeType = ClockPointEnum.EQUAL.getKey();
|
|
|
|
|
if (jsdkNearestClcokInTime.get(ClockPointEnum.EQUAL) != null) {
|
|
|
|
|
timeType = ClockPointEnum.EQUAL;
|
|
|
|
|
}
|
|
|
|
|
if (ClockPointEnum.EMPTY.getKey().equals(timeType) && jsdkNearestClcokInTime.get(ClockPointEnum.AFTER.getKey()) != null) {
|
|
|
|
|
String clockInTime = jsdkNearestClcokInTime.get(ClockPointEnum.AFTER.getKey()).get("signdate") + " " + jsdkNearestClcokInTime.get(ClockPointEnum.AFTER.getKey()).get("signtime");
|
|
|
|
|
if (ClockPointEnum.EMPTY.equals(timeType) && jsdkNearestClcokInTime.get(ClockPointEnum.AFTER) != null) {
|
|
|
|
|
String clockInTime = jsdkNearestClcokInTime.get(ClockPointEnum.AFTER).get("signdate") + " " + jsdkNearestClcokInTime.get(ClockPointEnum.AFTER).get("signtime");
|
|
|
|
|
if (DateUtil.getTime(clockInTime).compareTo(DateUtil.getTime(DateUtil.AfterMinutes(dtkssj, thdkfzs))) <= 0 &&
|
|
|
|
|
(getNextClockTime(needClockDateList,dtkssj).equals("") || DateUtil.getTime(clockInTime).compareTo(DateUtil.getTime(getNextClockTime(needClockDateList,dtkssj))) < 0)) {
|
|
|
|
|
timeType = ClockPointEnum.AFTER.getKey();
|
|
|
|
|
timeType = ClockPointEnum.AFTER;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (ClockPointEnum.EMPTY.getKey().equals(timeType) && jsdkNearestClcokInTime.get(ClockPointEnum.BEFORE.getKey()) != null) {
|
|
|
|
|
String clockInTime = jsdkNearestClcokInTime.get(ClockPointEnum.BEFORE.getKey()).get("signdate") + " " + jsdkNearestClcokInTime.get(ClockPointEnum.BEFORE.getKey()).get("signtime");
|
|
|
|
|
if (ClockPointEnum.EMPTY.equals(timeType) && jsdkNearestClcokInTime.get(ClockPointEnum.BEFORE) != null) {
|
|
|
|
|
String clockInTime = jsdkNearestClcokInTime.get(ClockPointEnum.BEFORE).get("signdate") + " " + jsdkNearestClcokInTime.get(ClockPointEnum.BEFORE).get("signtime");
|
|
|
|
|
if (getBeforeClockTime(needClockDateList,dtkssj).equals("") || DateUtil.getTime(clockInTime).compareTo(DateUtil.getTime(getBeforeClockTime(needClockDateList,dtkssj))) > 0) {
|
|
|
|
|
timeType = ClockPointEnum.BEFORE.getKey();
|
|
|
|
|
timeType = ClockPointEnum.BEFORE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
clcokInTimeMap.put(dtkssj + "|" + ClockPointEnum.END.getKey() + "|" + timeType+"|0", jsdkNearestClcokInTime.get(timeType));
|
|
|
|
|
clcokInTimeData.add(clcokInTimeMap);
|
|
|
|
|
// clcokInTimeMap.put(dtkssj + "|" + ClockPointEnum.END.getKey() + "|" + timeType+"|0", jsdkNearestClcokInTime.get(timeType));
|
|
|
|
|
clcokInTimeData.add(ClockPointDTO.builder().classTime(dtkssj).pointType(ClockPointEnum.END).timeType(timeType).classSegmentType(needClockIn.get("bdlx").toString()).clockTime(jsdkNearestClcokInTime.get(timeType)).build());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
@ -369,46 +369,36 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Map<String, Object>> ksdkNearestClcokInTime = Utils.getNearestClcokInTimeCmd(dtjssj, clockInTimeList);
|
|
|
|
|
String timeType = ClockPointEnum.EMPTY.getKey();
|
|
|
|
|
Map<String, Map<String, Object>> clcokInTimeMap = Maps.newHashMap();
|
|
|
|
|
if (ksdkNearestClcokInTime.get(ClockPointEnum.EQUAL.getKey()) != null) {
|
|
|
|
|
timeType = ClockPointEnum.EQUAL.getKey();
|
|
|
|
|
Map<ClockPointEnum, Map<String, Object>> ksdkNearestClcokInTime = Utils.getNearestClcokInTimeCmd(dtjssj, clockInTimeList);
|
|
|
|
|
ClockPointEnum timeType = ClockPointEnum.EMPTY;
|
|
|
|
|
if (ksdkNearestClcokInTime.get(ClockPointEnum.EQUAL) != null) {
|
|
|
|
|
timeType = ClockPointEnum.EQUAL;
|
|
|
|
|
}
|
|
|
|
|
if (ClockPointEnum.EMPTY.getKey().equals(timeType) && ksdkNearestClcokInTime.get(ClockPointEnum.BEFORE.getKey()) != null) {
|
|
|
|
|
String clockInTime = ksdkNearestClcokInTime.get(ClockPointEnum.BEFORE.getKey()).get("signdate") + " " + ksdkNearestClcokInTime.get(ClockPointEnum.BEFORE.getKey()).get("signtime");
|
|
|
|
|
if (ClockPointEnum.EMPTY.equals(timeType) && ksdkNearestClcokInTime.get(ClockPointEnum.BEFORE) != null) {
|
|
|
|
|
String clockInTime = ksdkNearestClcokInTime.get(ClockPointEnum.BEFORE).get("signdate") + " " + ksdkNearestClcokInTime.get(ClockPointEnum.BEFORE).get("signtime");
|
|
|
|
|
if (DateUtil.getTime(clockInTime).compareTo(DateUtil.getTime(DateUtil.beforeMinutes(dtjssj, tqdkfzs))) >= 0 &&
|
|
|
|
|
(getBeforeClockTime(needClockDateList,dtjssj).equals("") || DateUtil.getTime(clockInTime).compareTo(DateUtil.getTime(getBeforeClockTime(needClockDateList,dtjssj))) > 0)) {
|
|
|
|
|
//打卡时间大于等于最早打卡时间
|
|
|
|
|
timeType = ClockPointEnum.BEFORE.getKey();
|
|
|
|
|
timeType = ClockPointEnum.BEFORE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (ClockPointEnum.EMPTY.getKey().equals(timeType) && ksdkNearestClcokInTime.get(ClockPointEnum.AFTER.getKey()) != null) {
|
|
|
|
|
String clockInTime = ksdkNearestClcokInTime.get(ClockPointEnum.AFTER.getKey()).get("signdate") + " " + ksdkNearestClcokInTime.get(ClockPointEnum.AFTER.getKey()).get("signtime");
|
|
|
|
|
if (ClockPointEnum.EMPTY.equals(timeType) && ksdkNearestClcokInTime.get(ClockPointEnum.AFTER) != null) {
|
|
|
|
|
String clockInTime = ksdkNearestClcokInTime.get(ClockPointEnum.AFTER).get("signdate") + " " + ksdkNearestClcokInTime.get(ClockPointEnum.AFTER).get("signtime");
|
|
|
|
|
|
|
|
|
|
if (getNextClockTime(needClockDateList,dtjssj).equals("") || DateUtil.getTime(clockInTime).compareTo(DateUtil.getTime(getNextClockTime(needClockDateList,dtjssj))) < 0) {
|
|
|
|
|
//打卡时间小于结束时间
|
|
|
|
|
timeType = ClockPointEnum.AFTER.getKey();
|
|
|
|
|
timeType = ClockPointEnum.AFTER;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
clcokInTimeMap.put(dtjssj + "|" + ClockPointEnum.START.getKey() + "|" + timeType+"|0", ksdkNearestClcokInTime.get(timeType));
|
|
|
|
|
clcokInTimeData.add(clcokInTimeMap);
|
|
|
|
|
//clcokInTimeMap.put(dtjssj + "|" + ClockPointEnum.START.getKey() + "|" + timeType+"|0", ksdkNearestClcokInTime.get(timeType));
|
|
|
|
|
clcokInTimeData.add(ClockPointDTO.builder().classTime(dtjssj).pointType(ClockPointEnum.START).timeType(timeType).classSegmentType(needClockIn.get("bdlx").toString()).clockTime(ksdkNearestClcokInTime.get(timeType)).build());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clcokInTimeData = clcokInTimeData.stream().sorted(Comparator.comparing(e->{
|
|
|
|
|
//卡点
|
|
|
|
|
String point = "";
|
|
|
|
|
//当天打卡数据
|
|
|
|
|
for (Map.Entry<String,Map<String,Object>> entry :e.entrySet()){
|
|
|
|
|
point = entry.getKey();
|
|
|
|
|
}
|
|
|
|
|
return DateUtil.getTime(point.split("\\|")[0]).toInstant(ZoneOffset.of("+8")).toEpochMilli();
|
|
|
|
|
})).collect(Collectors.toList());
|
|
|
|
|
//根据班次时间排序
|
|
|
|
|
clcokInTimeData = clcokInTimeData.stream().sorted(Comparator.comparing(e-> DateUtil.getTime(e.getClassTime()).toInstant(ZoneOffset.of("+8")).toEpochMilli())).collect(Collectors.toList());
|
|
|
|
|
/**
|
|
|
|
|
* 计算弹性上下班
|
|
|
|
|
*/ //上下班弹性,
|
|
|
|
@ -475,21 +465,16 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
|
|
|
|
|
}
|
|
|
|
|
//弹性上班卡
|
|
|
|
|
for (int i = 0; i < clcokInTimeData.size(); i++) {
|
|
|
|
|
Map<String, Map<String, Object>> clcokInTimeMap = clcokInTimeData.get(i);
|
|
|
|
|
//卡点
|
|
|
|
|
String point = "";
|
|
|
|
|
ClockPointDTO clockdto = clcokInTimeData.get(i);
|
|
|
|
|
|
|
|
|
|
//当天打卡数据
|
|
|
|
|
Map<String, Object> clcokInTime = null;
|
|
|
|
|
for (Map.Entry<String, Map<String, Object>> entry : clcokInTimeMap.entrySet()) {
|
|
|
|
|
point = entry.getKey();
|
|
|
|
|
clcokInTime = entry.getValue();
|
|
|
|
|
}
|
|
|
|
|
Map<String, Object> clcokInTime = clockdto.getClockTime();
|
|
|
|
|
//需要计算的班次打卡时间点
|
|
|
|
|
String pointTime = point.split("\\|")[0];
|
|
|
|
|
String pointTime = clockdto.getClassTime();
|
|
|
|
|
//start:开始打卡时间点,end:结束打卡时间点
|
|
|
|
|
String pointType = point.split("\\|")[1];
|
|
|
|
|
ClockPointEnum pointType = clockdto.getPointType();
|
|
|
|
|
//empty:漏卡,equal:打卡时间和班次时间相等,before:打卡时间在班次时间之前,after:打卡时间在班次时间之后
|
|
|
|
|
String timeType = point.split("\\|")[2];
|
|
|
|
|
ClockPointEnum timeType = clockdto.getTimeType();
|
|
|
|
|
|
|
|
|
|
if (pointTime.equals(kssjStart) && ClockPointEnum.START.getKey().equals(pointType) && clcokInTime != null
|
|
|
|
|
&& CheckBoxEnum.CHECKED.getKey().equals(ifToWorkClock)) {
|
|
|
|
@ -497,39 +482,31 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
|
|
|
|
|
//该卡点是弹性开始时间
|
|
|
|
|
if ("".equals(flexibleWorkTime) ){
|
|
|
|
|
//弹性上班期间未被请假开始时间占据
|
|
|
|
|
if (ClockPointEnum.BEFORE.getKey().equals(timeType)) {
|
|
|
|
|
if (ClockPointEnum.BEFORE.equals(timeType)) {
|
|
|
|
|
int betWeenTime = DateUtil.getBetWeenMinutes(signTime, kssjStart);
|
|
|
|
|
String newPonit = point;
|
|
|
|
|
if (betWeenTime <= zddxfz) {
|
|
|
|
|
betWeenTime = Double.valueOf(Utils.getItemdurationDown(dxhs, AccountingUnitEnum.MINUTES.getKey(), betWeenTime, AccountingUnitEnum.MINUTES)).intValue();
|
|
|
|
|
flexibleWorkTime = DateUtil.beforeMinutes(kssjStart, betWeenTime);
|
|
|
|
|
newPonit = pointTime + "|" + pointType + "|" + ClockPointEnum.EQUAL.getKey() + "|" + flexibleWorkTime;
|
|
|
|
|
clockdto.setTimeType(ClockPointEnum.EQUAL);
|
|
|
|
|
} else if (betWeenTime > zddxfz) {
|
|
|
|
|
flexibleWorkTime = DateUtil.beforeMinutes(kssjStart, zddxfz);
|
|
|
|
|
newPonit = point + "|" + flexibleWorkTime;
|
|
|
|
|
}
|
|
|
|
|
clcokInTimeMap.remove(point);
|
|
|
|
|
clcokInTimeMap.put(newPonit, clcokInTime);
|
|
|
|
|
} else if (ClockPointEnum.AFTER.getKey().equals(timeType)) {
|
|
|
|
|
clockdto.setElasticTime(flexibleWorkTime);
|
|
|
|
|
} else if (ClockPointEnum.AFTER.equals(timeType)) {
|
|
|
|
|
//迟到
|
|
|
|
|
String newPonit = point;
|
|
|
|
|
int betWeenTime = DateUtil.getBetWeenMinutes(kssjStart, signTime);
|
|
|
|
|
if (betWeenTime <= zddxfz) {
|
|
|
|
|
betWeenTime = Double.valueOf(Utils.getItemduration(dxhs, AccountingUnitEnum.MINUTES.getKey(), betWeenTime, AccountingUnitEnum.MINUTES)).intValue();
|
|
|
|
|
flexibleWorkTime = DateUtil.AfterMinutes(kssjStart, betWeenTime);
|
|
|
|
|
newPonit = pointTime + "|" + pointType + "|" + ClockPointEnum.EQUAL.getKey() + "|" + flexibleWorkTime;
|
|
|
|
|
clockdto.setTimeType(ClockPointEnum.EQUAL);
|
|
|
|
|
} else if (betWeenTime > zddxfz) {
|
|
|
|
|
flexibleWorkTime = DateUtil.AfterMinutes(kssjStart, zddxfz);
|
|
|
|
|
newPonit = point + "|" + flexibleWorkTime;
|
|
|
|
|
}
|
|
|
|
|
clcokInTimeMap.remove(point);
|
|
|
|
|
clcokInTimeMap.put(newPonit, clcokInTime);
|
|
|
|
|
clockdto.setElasticTime(flexibleWorkTime);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
//弹性上班期间被请假开始时间占据
|
|
|
|
|
String newPonit = point +"|"+flexibleWorkTime;
|
|
|
|
|
clcokInTimeMap.remove(point);
|
|
|
|
|
clcokInTimeMap.put(newPonit, clcokInTime);
|
|
|
|
|
clockdto.setElasticTime(flexibleWorkTime);
|
|
|
|
|
}
|
|
|
|
|
} else if (pointTime.equals(jssjEnd) && ClockPointEnum.END.getKey().equals(pointType) && CheckBoxEnum.CHECKED.getKey().equals(ifToCloseClock)) {
|
|
|
|
|
//该卡点是弹性下班点
|
|
|
|
@ -545,28 +522,32 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
|
|
|
|
|
}
|
|
|
|
|
if (!"".equals(flexibleOffWorkTime)){
|
|
|
|
|
//根据弹性下班时间点重新计算
|
|
|
|
|
Map<String, Map<String, Object>> jsdkNearestClcokInTime = Utils.getNearestClcokInTimeCmd(flexibleOffWorkTime, clockInTimeList);
|
|
|
|
|
Map<ClockPointEnum, Map<String, Object>> jsdkNearestClcokInTime = Utils.getNearestClcokInTimeCmd(flexibleOffWorkTime, clockInTimeList);
|
|
|
|
|
|
|
|
|
|
String newtimeType = ClockPointEnum.EMPTY.getKey();
|
|
|
|
|
if (jsdkNearestClcokInTime.get(ClockPointEnum.EQUAL.getKey()) != null) {
|
|
|
|
|
newtimeType = ClockPointEnum.EQUAL.getKey();
|
|
|
|
|
ClockPointEnum newtimeType = ClockPointEnum.EMPTY;
|
|
|
|
|
if (jsdkNearestClcokInTime.get(ClockPointEnum.EQUAL) != null) {
|
|
|
|
|
newtimeType = ClockPointEnum.EQUAL;
|
|
|
|
|
}
|
|
|
|
|
if (ClockPointEnum.EMPTY.getKey().equals(newtimeType) && jsdkNearestClcokInTime.get(ClockPointEnum.AFTER.getKey()) != null) {
|
|
|
|
|
String clockInTime = jsdkNearestClcokInTime.get(ClockPointEnum.AFTER.getKey()).get("signdate") + " " + jsdkNearestClcokInTime.get(ClockPointEnum.AFTER.getKey()).get("signtime");
|
|
|
|
|
if (ClockPointEnum.EMPTY.equals(newtimeType) && jsdkNearestClcokInTime.get(ClockPointEnum.AFTER) != null) {
|
|
|
|
|
String clockInTime = jsdkNearestClcokInTime.get(ClockPointEnum.AFTER).get("signdate") + " " + jsdkNearestClcokInTime.get(ClockPointEnum.AFTER).get("signtime");
|
|
|
|
|
if (DateUtil.getTime(clockInTime).compareTo(DateUtil.getTime(DateUtil.AfterMinutes(flexibleOffWorkTime, thdkfzs))) <= 0) {
|
|
|
|
|
newtimeType = ClockPointEnum.AFTER.getKey();
|
|
|
|
|
newtimeType = ClockPointEnum.AFTER;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (ClockPointEnum.EMPTY.getKey().equals(newtimeType) && jsdkNearestClcokInTime.get(ClockPointEnum.BEFORE.getKey()) != null) {
|
|
|
|
|
String clockInTime = jsdkNearestClcokInTime.get(ClockPointEnum.BEFORE.getKey()).get("signdate") + " " + jsdkNearestClcokInTime.get(ClockPointEnum.BEFORE.getKey()).get("signtime");
|
|
|
|
|
if (ClockPointEnum.EMPTY.equals(newtimeType) && jsdkNearestClcokInTime.get(ClockPointEnum.BEFORE) != null) {
|
|
|
|
|
String clockInTime = jsdkNearestClcokInTime.get(ClockPointEnum.BEFORE).get("signdate") + " " + jsdkNearestClcokInTime.get(ClockPointEnum.BEFORE).get("signtime");
|
|
|
|
|
if (DateUtil.getTime(clockInTime).compareTo(DateUtil.getTime(getBeforeClockTime(needClockDateList,jssjEnd))) > 0) {
|
|
|
|
|
newtimeType = ClockPointEnum.BEFORE.getKey();
|
|
|
|
|
newtimeType = ClockPointEnum.BEFORE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
String newPonit = jssjEnd + "|" + ClockPointEnum.END.getKey() + "|" + newtimeType + "|" + flexibleOffWorkTime;
|
|
|
|
|
|
|
|
|
|
clcokInTimeMap.remove(point);
|
|
|
|
|
clcokInTimeMap.put(newPonit, jsdkNearestClcokInTime.get(newtimeType));
|
|
|
|
|
// String newPonit = jssjEnd + "|" + ClockPointEnum.END.getKey() + "|" + newtimeType + "|" + flexibleOffWorkTime;
|
|
|
|
|
// clcokInTimeMap.put(newPonit, jsdkNearestClcokInTime.get(newtimeType));
|
|
|
|
|
|
|
|
|
|
clockdto.setClassTime(jssjEnd);
|
|
|
|
|
clockdto.setPointType(ClockPointEnum.END);
|
|
|
|
|
clockdto.setTimeType(newtimeType);
|
|
|
|
|
clockdto.setElasticTime(flexibleOffWorkTime);
|
|
|
|
|
clockdto.setClockTime(jsdkNearestClcokInTime.get(newtimeType));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -594,29 +575,20 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
|
|
|
|
|
*/
|
|
|
|
|
if (clcokInTimeData.size() > 1) {
|
|
|
|
|
for (int i = 0; i < clcokInTimeData.size() - 1; i++) {
|
|
|
|
|
Map<String, Map<String, Object>> beforeClcokInTimeData = clcokInTimeData.get(i);
|
|
|
|
|
Map<String, Map<String, Object>> afterClcokInTimeData = clcokInTimeData.get(i + 1);
|
|
|
|
|
Map<String, Object> beforeClcokInTimeMap = null;
|
|
|
|
|
String beforeClcokInTime = "";
|
|
|
|
|
String afterClcokInTime = "";
|
|
|
|
|
Map<String, Object> afterClcokInTimeMap = null;
|
|
|
|
|
for (Map.Entry<String, Map<String, Object>> beforeEntry : beforeClcokInTimeData.entrySet()) {
|
|
|
|
|
beforeClcokInTimeMap = beforeEntry.getValue();
|
|
|
|
|
beforeClcokInTime = beforeEntry.getKey();
|
|
|
|
|
}
|
|
|
|
|
for (Map.Entry<String, Map<String, Object>> afterEntry : afterClcokInTimeData.entrySet()) {
|
|
|
|
|
afterClcokInTimeMap = afterEntry.getValue();
|
|
|
|
|
afterClcokInTime = afterEntry.getKey();
|
|
|
|
|
}
|
|
|
|
|
ClockPointDTO beforeClcokDTO = clcokInTimeData.get(i);
|
|
|
|
|
ClockPointDTO afterClcokInDTO = clcokInTimeData.get(i + 1);
|
|
|
|
|
Map<String, Object> beforeClcokInTimeMap = beforeClcokDTO.getClockTime();
|
|
|
|
|
Map<String, Object> afterClcokInTimeMap = afterClcokInDTO.getClockTime();
|
|
|
|
|
|
|
|
|
|
//重复
|
|
|
|
|
if (beforeClcokInTimeMap != null && beforeClcokInTimeMap == afterClcokInTimeMap) {
|
|
|
|
|
String beforeTime = beforeClcokInTime.split("\\|")[0];
|
|
|
|
|
if (beforeClcokInTime.split("\\|").length ==4 && !"0".equals(beforeClcokInTime.split("\\|")[3])){
|
|
|
|
|
beforeTime = beforeClcokInTime.split("\\|")[3];
|
|
|
|
|
String beforeTime = beforeClcokDTO.getClassTime();
|
|
|
|
|
if (beforeClcokDTO.getElasticTime() != null && !"".equals(beforeClcokDTO.getElasticTime())){
|
|
|
|
|
beforeTime = beforeClcokDTO.getElasticTime();
|
|
|
|
|
}
|
|
|
|
|
String afterTime = afterClcokInTime.split("\\|")[0];
|
|
|
|
|
if (afterClcokInTime.split("\\|").length ==4 && !"0".equals(afterClcokInTime.split("\\|")[3])){
|
|
|
|
|
afterTime = afterClcokInTime.split("\\|")[3];
|
|
|
|
|
String afterTime = afterClcokInDTO.getClassTime();
|
|
|
|
|
if (afterClcokInDTO.getElasticTime() != null && !"".equals(afterClcokInDTO.getElasticTime())){
|
|
|
|
|
afterTime = afterClcokInDTO.getElasticTime();
|
|
|
|
|
}
|
|
|
|
|
long betWeenMinutes = DateUtil.getBetWeenMinutes(beforeTime, afterTime);
|
|
|
|
|
|
|
|
|
@ -624,109 +596,90 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
|
|
|
|
|
|
|
|
|
|
String signdateTime = beforeClcokInTimeMap.get("signdate") + " " + beforeClcokInTimeMap.get("signtime");
|
|
|
|
|
|
|
|
|
|
String resetClcokInTime ="";
|
|
|
|
|
Map<String, Map<String, Object>> resetClcokInTimeData = null;
|
|
|
|
|
ClockPointDTO resetClcokDTO =null;
|
|
|
|
|
if (DateUtil.getTime(signdateTime).compareTo(DateUtil.getTime(middileTime)) <= 0) {
|
|
|
|
|
//该打卡归属前一个打卡点,后一个打卡点需要重新设置
|
|
|
|
|
resetClcokInTime = afterClcokInTime;
|
|
|
|
|
resetClcokInTimeData = afterClcokInTimeData;
|
|
|
|
|
resetClcokDTO=afterClcokInDTO;
|
|
|
|
|
} else if (DateUtil.getTime(signdateTime).compareTo(DateUtil.getTime(middileTime)) > 0) {
|
|
|
|
|
//该打卡归属后一个打卡点,前一个打卡点需要重新设置
|
|
|
|
|
resetClcokInTime=beforeClcokInTime;
|
|
|
|
|
resetClcokInTimeData = beforeClcokInTimeData;
|
|
|
|
|
resetClcokDTO=beforeClcokDTO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//需要重新赋值的打卡时间
|
|
|
|
|
String restTime = resetClcokInTime.split("\\|")[0];
|
|
|
|
|
if (resetClcokInTime.split("\\|").length ==4 && !"0".equals(resetClcokInTime.split("\\|")[3])){
|
|
|
|
|
restTime = resetClcokInTime.split("\\|")[3];
|
|
|
|
|
String restTime = resetClcokDTO.getClassTime();
|
|
|
|
|
if (resetClcokDTO.getElasticTime() != null && !"".equals(resetClcokDTO.getElasticTime())){
|
|
|
|
|
restTime = resetClcokDTO.getElasticTime();
|
|
|
|
|
}
|
|
|
|
|
Map<String, Map<String, Object>> nearestClcokInTime = Utils.getNearestClcokInTimeCmd(restTime, clockInTimeList);
|
|
|
|
|
Map<ClockPointEnum, Map<String, Object>> nearestClcokInTime = Utils.getNearestClcokInTimeCmd(restTime, clockInTimeList);
|
|
|
|
|
//start:开始打卡时间点,end:结束打卡时间点
|
|
|
|
|
String pointType = resetClcokInTime.split("\\|")[1];
|
|
|
|
|
ClockPointEnum pointType = resetClcokDTO.getPointType();
|
|
|
|
|
//empty:漏卡,equal:打卡时间和班次时间相等,before:打卡时间在班次时间之前,after:打卡时间在班次时间之后
|
|
|
|
|
String timeType = resetClcokInTime.split("\\|")[2];
|
|
|
|
|
String time = resetClcokInTime.split("\\|")[0];
|
|
|
|
|
String newPonit = time+"|"+pointType;
|
|
|
|
|
|
|
|
|
|
String newtimeType = "";
|
|
|
|
|
if (timeType.equals(ClockPointEnum.BEFORE.getKey())){
|
|
|
|
|
newtimeType = ClockPointEnum.AFTER.getKey();
|
|
|
|
|
}else if (timeType.equals(ClockPointEnum.AFTER.getKey())){
|
|
|
|
|
newtimeType = ClockPointEnum.BEFORE.getKey();
|
|
|
|
|
ClockPointEnum timeType = resetClcokDTO.getTimeType();
|
|
|
|
|
String time = resetClcokDTO.getClassTime();
|
|
|
|
|
|
|
|
|
|
ClockPointEnum newtimeType = null;
|
|
|
|
|
if (timeType.equals(ClockPointEnum.BEFORE)){
|
|
|
|
|
newtimeType = ClockPointEnum.AFTER;
|
|
|
|
|
}else if (timeType.equals(ClockPointEnum.AFTER)){
|
|
|
|
|
newtimeType = ClockPointEnum.BEFORE;
|
|
|
|
|
}
|
|
|
|
|
if (nearestClcokInTime.get(newtimeType) != null){
|
|
|
|
|
newPonit = newPonit +"|"+newtimeType;
|
|
|
|
|
if (resetClcokInTime.split("\\|").length ==4){
|
|
|
|
|
newPonit = newPonit +"|"+resetClcokInTime.split("\\|")[3];
|
|
|
|
|
}
|
|
|
|
|
Map<String, Object> newClockTimeMap = nearestClcokInTime.get(newtimeType);
|
|
|
|
|
String newClockTime = newClockTimeMap.get("signdate")+ " "+newClockTimeMap.get("signtime");
|
|
|
|
|
int index = clcokInTimeData.indexOf(resetClcokInTimeData);
|
|
|
|
|
if (newtimeType.equals(ClockPointEnum.BEFORE.getKey())){
|
|
|
|
|
int index = clcokInTimeData.indexOf(resetClcokDTO);
|
|
|
|
|
if (newtimeType.equals(ClockPointEnum.BEFORE)){
|
|
|
|
|
if (!getBeforeClockTime(needClockDateList,time).equals("") && DateUtil.getTime(newClockTime).compareTo(DateUtil.getTime(getBeforeClockTime(needClockDateList,time))) <= 0){
|
|
|
|
|
newClockTimeMap = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((index-1) >= 0){
|
|
|
|
|
//当重新需要打卡的时间戳与打卡时间之前的打卡集合时,进行比对
|
|
|
|
|
Map<String, Map<String, Object>> resetBeforeData = clcokInTimeData.get(index-1);
|
|
|
|
|
Map<String, Object> resetBeforeClcokInTimeMap = null;
|
|
|
|
|
for (Map.Entry<String, Map<String, Object>> resetBeforeEntry : resetBeforeData.entrySet()) {
|
|
|
|
|
resetBeforeClcokInTimeMap = resetBeforeEntry.getValue();
|
|
|
|
|
}
|
|
|
|
|
ClockPointDTO resetBeforeDTO = clcokInTimeData.get(index-1);
|
|
|
|
|
Map<String, Object> resetBeforeClcokInTimeMap = resetBeforeDTO.getClockTime();
|
|
|
|
|
if (newClockTimeMap == resetBeforeClcokInTimeMap){
|
|
|
|
|
newClockTimeMap = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else if (newtimeType.equals(ClockPointEnum.AFTER.getKey())){
|
|
|
|
|
}else if (newtimeType.equals(ClockPointEnum.AFTER)){
|
|
|
|
|
if (!getNextClockTime(needClockDateList,time).equals("") && DateUtil.getTime(newClockTime).compareTo(DateUtil.getTime(getNextClockTime(needClockDateList,time))) >= 0){
|
|
|
|
|
newClockTimeMap = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (newClockTimeMap == null){
|
|
|
|
|
//当需要调整的卡点为漏卡时将打卡进行退回,若另一个卡点调整后为不漏卡情况,则调整该节点
|
|
|
|
|
if (resetClcokInTimeData == beforeClcokInTimeData){
|
|
|
|
|
resetClcokInTime = afterClcokInTime;
|
|
|
|
|
resetClcokInTimeData = afterClcokInTimeData;
|
|
|
|
|
}else if (resetClcokInTimeData == afterClcokInTimeData){
|
|
|
|
|
resetClcokInTime=beforeClcokInTime;
|
|
|
|
|
resetClcokInTimeData = beforeClcokInTimeData;
|
|
|
|
|
if (resetClcokDTO == beforeClcokDTO){
|
|
|
|
|
resetClcokDTO=afterClcokInDTO;
|
|
|
|
|
}else if (resetClcokDTO == afterClcokInDTO){
|
|
|
|
|
resetClcokDTO=beforeClcokDTO;
|
|
|
|
|
}
|
|
|
|
|
if (!resetClcokInTimeData(analysisDate,resetClcokInTime,resetClcokInTimeData,clockInTimeList,needClockDateList,clcokInTimeData,scheduleResult)){
|
|
|
|
|
if (resetClcokInTimeData == beforeClcokInTimeData){
|
|
|
|
|
resetClcokInTimeData = afterClcokInTimeData;
|
|
|
|
|
}else if (resetClcokInTimeData == afterClcokInTimeData){
|
|
|
|
|
resetClcokInTimeData = beforeClcokInTimeData;
|
|
|
|
|
if (!resetClcokInTimeData(analysisDate,resetClcokDTO,clockInTimeList,needClockDateList,clcokInTimeData,scheduleResult)){
|
|
|
|
|
if (resetClcokDTO == beforeClcokDTO){
|
|
|
|
|
resetClcokDTO = afterClcokInDTO;
|
|
|
|
|
}else if (resetClcokDTO == afterClcokInDTO){
|
|
|
|
|
resetClcokDTO = beforeClcokDTO;
|
|
|
|
|
}
|
|
|
|
|
clcokInTimeData.remove(resetClcokInTimeData);
|
|
|
|
|
resetClcokInTimeData = Maps.newHashMap();
|
|
|
|
|
resetClcokInTimeData.put(newPonit,newClockTimeMap);
|
|
|
|
|
clcokInTimeData.add(index,resetClcokInTimeData);
|
|
|
|
|
|
|
|
|
|
resetClcokDTO.setTimeType(newtimeType);
|
|
|
|
|
resetClcokDTO.setClockTime(newClockTimeMap);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
clcokInTimeData.remove(resetClcokInTimeData);
|
|
|
|
|
resetClcokInTimeData = Maps.newHashMap();
|
|
|
|
|
resetClcokInTimeData.put(newPonit,newClockTimeMap);
|
|
|
|
|
clcokInTimeData.add(index,resetClcokInTimeData);
|
|
|
|
|
|
|
|
|
|
resetClcokDTO.setTimeType(newtimeType);
|
|
|
|
|
resetClcokDTO.setClockTime(newClockTimeMap);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
if (resetClcokInTimeData == beforeClcokInTimeData){
|
|
|
|
|
resetClcokInTime = afterClcokInTime;
|
|
|
|
|
resetClcokInTimeData = afterClcokInTimeData;
|
|
|
|
|
}else if (resetClcokInTimeData == afterClcokInTimeData){
|
|
|
|
|
resetClcokInTime=beforeClcokInTime;
|
|
|
|
|
resetClcokInTimeData = beforeClcokInTimeData;
|
|
|
|
|
if (resetClcokDTO == beforeClcokDTO){
|
|
|
|
|
resetClcokDTO = afterClcokInDTO;
|
|
|
|
|
}else if (resetClcokDTO == afterClcokInDTO){
|
|
|
|
|
resetClcokDTO = beforeClcokDTO;
|
|
|
|
|
}
|
|
|
|
|
if (!resetClcokInTimeData(analysisDate,resetClcokInTime,resetClcokInTimeData,clockInTimeList,needClockDateList,clcokInTimeData,scheduleResult)){
|
|
|
|
|
if (resetClcokInTimeData == beforeClcokInTimeData){
|
|
|
|
|
resetClcokInTime = afterClcokInTime;
|
|
|
|
|
resetClcokInTimeData = afterClcokInTimeData;
|
|
|
|
|
}else if (resetClcokInTimeData == afterClcokInTimeData){
|
|
|
|
|
resetClcokInTime=beforeClcokInTime;
|
|
|
|
|
resetClcokInTimeData = beforeClcokInTimeData;
|
|
|
|
|
if (!resetClcokInTimeData(analysisDate,resetClcokDTO,clockInTimeList,needClockDateList,clcokInTimeData,scheduleResult)){
|
|
|
|
|
if (resetClcokDTO == beforeClcokDTO){
|
|
|
|
|
resetClcokDTO = afterClcokInDTO;
|
|
|
|
|
}else if (resetClcokDTO == afterClcokInDTO){
|
|
|
|
|
resetClcokDTO = beforeClcokDTO;
|
|
|
|
|
}
|
|
|
|
|
resetClcokInTimeData.put(resetClcokInTime, null);
|
|
|
|
|
resetClcokDTO.setClockTime(null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -770,35 +723,31 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean resetClcokInTimeData(String analysisDate,String resetClcokInTime,Map<String, Map<String, Object>> resetClcokInTimeData,List<Map<String, Object>> clockInTimeList, List<String> needClockDateList,List<Map<String, Map<String, Object>>> clcokInTimeData,List<Map<String, Object>> scheduleResult){
|
|
|
|
|
String restTime = resetClcokInTime.split("\\|")[0];
|
|
|
|
|
if (resetClcokInTime.split("\\|").length ==4 && !"0".equals(resetClcokInTime.split("\\|")[3])){
|
|
|
|
|
restTime = resetClcokInTime.split("\\|")[3];
|
|
|
|
|
public boolean resetClcokInTimeData(String analysisDate,ClockPointDTO resetClcokDTO,List<Map<String, Object>> clockInTimeList, List<String> needClockDateList,List<ClockPointDTO> clcokInTimeData,List<Map<String, Object>> scheduleResult){
|
|
|
|
|
String restTime = resetClcokDTO.getClassTime();
|
|
|
|
|
if (resetClcokDTO.getElasticTime() != null && !"".equals(resetClcokDTO.getElasticTime())){
|
|
|
|
|
restTime = resetClcokDTO.getElasticTime();
|
|
|
|
|
}
|
|
|
|
|
Map<String, Map<String, Object>> nearestClcokInTime = Utils.getNearestClcokInTimeCmd(restTime, clockInTimeList);
|
|
|
|
|
Map<ClockPointEnum, Map<String, Object>> nearestClcokInTime = Utils.getNearestClcokInTimeCmd(restTime, clockInTimeList);
|
|
|
|
|
//start:开始打卡时间点,end:结束打卡时间点
|
|
|
|
|
String pointType = resetClcokInTime.split("\\|")[1];
|
|
|
|
|
ClockPointEnum pointType = resetClcokDTO.getPointType();
|
|
|
|
|
//empty:漏卡,equal:打卡时间和班次时间相等,before:打卡时间在班次时间之前,after:打卡时间在班次时间之后
|
|
|
|
|
String timeType = resetClcokInTime.split("\\|")[2];
|
|
|
|
|
String time = resetClcokInTime.split("\\|")[0];
|
|
|
|
|
String newPonit = time+"|"+pointType;
|
|
|
|
|
|
|
|
|
|
String newtimeType = "";
|
|
|
|
|
if (timeType.equals(ClockPointEnum.BEFORE.getKey())){
|
|
|
|
|
newtimeType = ClockPointEnum.AFTER.getKey();
|
|
|
|
|
}else if (timeType.equals(ClockPointEnum.AFTER.getKey())){
|
|
|
|
|
newtimeType = ClockPointEnum.BEFORE.getKey();
|
|
|
|
|
ClockPointEnum timeType = resetClcokDTO.getTimeType();
|
|
|
|
|
String time = resetClcokDTO.getClassTime();
|
|
|
|
|
|
|
|
|
|
ClockPointEnum newtimeType = null;
|
|
|
|
|
if (timeType.equals(ClockPointEnum.BEFORE)){
|
|
|
|
|
newtimeType = ClockPointEnum.AFTER;
|
|
|
|
|
}else if (timeType.equals(ClockPointEnum.AFTER)){
|
|
|
|
|
newtimeType = ClockPointEnum.BEFORE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (nearestClcokInTime.get(newtimeType) != null){
|
|
|
|
|
newPonit = newPonit +"|"+newtimeType;
|
|
|
|
|
if (resetClcokInTime.split("\\|").length ==4){
|
|
|
|
|
newPonit = newPonit +"|"+resetClcokInTime.split("\\|")[3];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, Object> newClockTimeMap = nearestClcokInTime.get(newtimeType);
|
|
|
|
|
String newClockTime = newClockTimeMap.get("signdate")+ " "+newClockTimeMap.get("signtime");
|
|
|
|
|
int index = clcokInTimeData.indexOf(resetClcokInTimeData);
|
|
|
|
|
if (newtimeType.equals(ClockPointEnum.BEFORE.getKey())){
|
|
|
|
|
int index = clcokInTimeData.indexOf(resetClcokDTO);
|
|
|
|
|
if (newtimeType.equals(ClockPointEnum.BEFORE)){
|
|
|
|
|
if (pointType.equals(ClockPointEnum.START.getKey())){
|
|
|
|
|
//开始卡点
|
|
|
|
|
Map<String,Object> needClockIn = scheduleResult.stream().filter(e -> {
|
|
|
|
@ -827,16 +776,13 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
|
|
|
|
|
|
|
|
|
|
if ((index-1) >= 0){
|
|
|
|
|
//当重新需要打卡的时间戳与打卡时间之前的打卡集合时,进行比对
|
|
|
|
|
Map<String, Map<String, Object>> resetBeforeData = clcokInTimeData.get(index-1);
|
|
|
|
|
Map<String, Object> resetBeforeClcokInTimeMap = null;
|
|
|
|
|
for (Map.Entry<String, Map<String, Object>> resetBeforeEntry : resetBeforeData.entrySet()) {
|
|
|
|
|
resetBeforeClcokInTimeMap = resetBeforeEntry.getValue();
|
|
|
|
|
}
|
|
|
|
|
ClockPointDTO resetBeforeDTO = clcokInTimeData.get(index-1);
|
|
|
|
|
Map<String, Object> resetBeforeClcokInTimeMap = resetBeforeDTO.getClockTime();
|
|
|
|
|
if (newClockTimeMap == resetBeforeClcokInTimeMap){
|
|
|
|
|
newClockTimeMap = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else if (newtimeType.equals(ClockPointEnum.AFTER.getKey())){
|
|
|
|
|
}else if (newtimeType.equals(ClockPointEnum.AFTER)){
|
|
|
|
|
if (pointType.equals(ClockPointEnum.END.getKey())){
|
|
|
|
|
//结束卡点
|
|
|
|
|
Map<String,Object> needClockIn = scheduleResult.stream().filter(e -> {
|
|
|
|
@ -863,10 +809,8 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (newClockTimeMap != null){
|
|
|
|
|
clcokInTimeData.remove(resetClcokInTimeData);
|
|
|
|
|
resetClcokInTimeData = Maps.newHashMap();
|
|
|
|
|
resetClcokInTimeData.put(newPonit,newClockTimeMap);
|
|
|
|
|
clcokInTimeData.add(index,resetClcokInTimeData);
|
|
|
|
|
resetClcokDTO.setTimeType(newtimeType);
|
|
|
|
|
resetClcokDTO.setClockTime(newClockTimeMap);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|