|
|
|
@ -575,7 +575,7 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
|
|
|
|
|
List<Map<String, Object>> restScheduleList = 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"))) && CheckBoxEnum.CHECKED.getKey().equals(e.get("dtsfdx"))).collect(Collectors.toList());
|
|
|
|
|
if (restScheduleList.size() > 0){
|
|
|
|
|
|
|
|
|
|
adjustClockPointDTOByRestClass(restScheduleList,clcokInTimeData,needClockDateList,scheduleResult);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 当有2笔需要打卡时,可能会有打卡歧义的情况,歧义情况取2个时间点的中间值,当打卡时间小于中间值归属前一个打卡,大于则相反
|
|
|
|
@ -874,5 +874,121 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 休息时段弹性上班
|
|
|
|
|
*/
|
|
|
|
|
public void adjustClockPointDTOByRestClass(List<Map<String, Object>> restScheduleList,List<ClockPointDTO> clcokInTimeData,List<String> needClockDateList,List<Map<String, Object>> scheduleResult){
|
|
|
|
|
String analysisDate = Util.null2String(params.get("analysisDate"));
|
|
|
|
|
List<Map<String, Object>> clockInTimeList = (List<Map<String, Object>>) params.get("clockInTimeList");
|
|
|
|
|
|
|
|
|
|
for (Map<String, Object> restSchedule:restScheduleList){
|
|
|
|
|
String dtkssj = Utils.getkssjTime(restSchedule,analysisDate);
|
|
|
|
|
String dtjssj = Utils.getjssjTime(restSchedule,analysisDate);
|
|
|
|
|
//最大弹性分钟
|
|
|
|
|
int dtzddxfz = Integer.valueOf(Util.null2String(restSchedule.get("dtzddxfz")));
|
|
|
|
|
//弹性核算
|
|
|
|
|
double dtdxhs = Utils.convertDouble(restSchedule.get("dtdxhs"));
|
|
|
|
|
|
|
|
|
|
//下班去休息卡点
|
|
|
|
|
ClockPointDTO toRestClockPointDTO = null;
|
|
|
|
|
//休息完上班卡点
|
|
|
|
|
ClockPointDTO endRestClockPointDTO = null;
|
|
|
|
|
for (ClockPointDTO clockPointDTO:clcokInTimeData){
|
|
|
|
|
|
|
|
|
|
if (clockPointDTO.getClassTime().equals(dtkssj) && clockPointDTO.getPointType()==ClockPointEnum.END){
|
|
|
|
|
toRestClockPointDTO = clockPointDTO;
|
|
|
|
|
}else if (clockPointDTO.getClassTime().equals(dtjssj) && clockPointDTO.getPointType()==ClockPointEnum.START){
|
|
|
|
|
endRestClockPointDTO = clockPointDTO;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<Map<String, Object>> endRestSchedule = scheduleResult.stream().filter(e->dtjssj.equals(Utils.getkssjTime(e,analysisDate))).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 当休息时段的开始和结束时间都要打卡时才进行弹性
|
|
|
|
|
*/
|
|
|
|
|
if (toRestClockPointDTO != null && endRestClockPointDTO != null){
|
|
|
|
|
String toRestClassTime = toRestClockPointDTO.getClassTime();
|
|
|
|
|
String endRestClassTime = endRestClockPointDTO.getClassTime();
|
|
|
|
|
Map<String, Object> toRestClockTimeMap = toRestClockPointDTO.getClockTime();
|
|
|
|
|
if (toRestClockTimeMap == null || toRestClockTimeMap.size() == 0 || toRestClockPointDTO.getTimeType() == ClockPointEnum.EQUAL || toRestClockPointDTO.getTimeType() == ClockPointEnum.EMPTY){
|
|
|
|
|
//不存在打卡时间,打卡时间与班次时间相等,漏卡
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
String toRestClockTime = toRestClockTimeMap.get("signdate")+" "+toRestClockTimeMap.get("signtime");
|
|
|
|
|
int betweenMinute = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//设置下上班的弹性时间
|
|
|
|
|
if (toRestClockPointDTO.getTimeType() == ClockPointEnum.BEFORE){
|
|
|
|
|
betweenMinute = DateUtil.getBetWeenMinutes(toRestClockTime,toRestClassTime);
|
|
|
|
|
if (betweenMinute > dtzddxfz){
|
|
|
|
|
toRestClockPointDTO.setElasticTime(DateUtil.beforeMinutes(toRestClassTime,dtzddxfz));
|
|
|
|
|
toRestClockPointDTO.setTimeType(ClockPointEnum.BEFORE);
|
|
|
|
|
endRestClockPointDTO.setElasticTime(DateUtil.beforeMinutes(endRestClassTime,dtzddxfz));
|
|
|
|
|
}else {
|
|
|
|
|
betweenMinute = Double.valueOf(Utils.getItemdurationDown(dtdxhs, AccountingUnitEnum.MINUTES.getKey(), betweenMinute, AccountingUnitEnum.MINUTES)).intValue();
|
|
|
|
|
endRestClockPointDTO.setElasticTime(DateUtil.beforeMinutes(endRestClassTime,betweenMinute));
|
|
|
|
|
}
|
|
|
|
|
}else if (toRestClockPointDTO.getTimeType() == ClockPointEnum.AFTER){
|
|
|
|
|
betweenMinute = DateUtil.getBetWeenMinutes(toRestClassTime,toRestClockTime);
|
|
|
|
|
betweenMinute = Double.valueOf(Utils.getItemdurationDown(dtdxhs, AccountingUnitEnum.MINUTES.getKey(), betweenMinute, AccountingUnitEnum.MINUTES)).intValue();
|
|
|
|
|
endRestClockPointDTO.setElasticTime(DateUtil.AfterMinutes(endRestClassTime,betweenMinute));
|
|
|
|
|
if (betweenMinute > dtzddxfz){
|
|
|
|
|
toRestClockPointDTO.setElasticTime(DateUtil.AfterMinutes(toRestClassTime,dtzddxfz));
|
|
|
|
|
toRestClockPointDTO.setTimeType(ClockPointEnum.AFTER);
|
|
|
|
|
endRestClockPointDTO.setElasticTime(DateUtil.AfterMinutes(endRestClassTime,dtzddxfz));
|
|
|
|
|
}else {
|
|
|
|
|
betweenMinute = Double.valueOf(Utils.getItemdurationDown(dtdxhs, AccountingUnitEnum.MINUTES.getKey(), betweenMinute, AccountingUnitEnum.MINUTES)).intValue();
|
|
|
|
|
endRestClockPointDTO.setElasticTime(DateUtil.AfterMinutes(endRestClassTime,betweenMinute));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (betweenMinute <= dtzddxfz){
|
|
|
|
|
toRestClockPointDTO.setElasticTime(toRestClockTime);
|
|
|
|
|
toRestClockPointDTO.setTimeType(ClockPointEnum.EQUAL);
|
|
|
|
|
}
|
|
|
|
|
//变更休息时间
|
|
|
|
|
restSchedule.put("dtkssj",toRestClockPointDTO.getElasticTime().split(" ")[1]);
|
|
|
|
|
restSchedule.put("dtjssj",endRestClockPointDTO.getElasticTime().split(" ")[1]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//根据弹性上班时间点重新获取打卡时间
|
|
|
|
|
//计算最大提前打卡分钟数
|
|
|
|
|
int tqdkfzs = 60;
|
|
|
|
|
if (Util.null2String(endRestSchedule.get(0).get("tqdkfzs")).equals("") && !"".equals(getBeforeClockTime(needClockDateList,dtkssj))){
|
|
|
|
|
tqdkfzs = DateUtil.getBetWeenMinutes(getBeforeClockTime(needClockDateList,dtkssj),dtkssj);
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
|
|
tqdkfzs = Util.null2String(endRestSchedule.get(0).get("tqdkfzs")).equals("")?60:Integer.valueOf(endRestSchedule.get(0).get("tqdkfzs").toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<ClockPointEnum, Map<String, Object>> ksdkNearestClcokInTime = Utils.getNearestClcokInTimeCmd(endRestClockPointDTO.getElasticTime(), clockInTimeList);
|
|
|
|
|
ClockPointEnum timeType = ClockPointEnum.EMPTY;
|
|
|
|
|
if (ksdkNearestClcokInTime.get(ClockPointEnum.EQUAL) != null) {
|
|
|
|
|
timeType = ClockPointEnum.EQUAL;
|
|
|
|
|
}
|
|
|
|
|
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(endRestClockPointDTO.getElasticTime(), tqdkfzs))) >= 0 &&
|
|
|
|
|
(getBeforeClockTime(needClockDateList,endRestClockPointDTO.getElasticTime()).equals("") || DateUtil.getTime(clockInTime).compareTo(DateUtil.getTime(getBeforeClockTime(needClockDateList,endRestClockPointDTO.getElasticTime()))) > 0)) {
|
|
|
|
|
//打卡时间大于等于最早打卡时间
|
|
|
|
|
timeType = ClockPointEnum.BEFORE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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,endRestClockPointDTO.getElasticTime()).equals("") || DateUtil.getTime(clockInTime).compareTo(DateUtil.getTime(getNextClockTime(needClockDateList,endRestClockPointDTO.getElasticTime()))) < 0) {
|
|
|
|
|
//打卡时间小于结束时间
|
|
|
|
|
timeType = ClockPointEnum.AFTER;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
endRestClockPointDTO.setClockTime(ksdkNearestClcokInTime.get(timeType));
|
|
|
|
|
endRestClockPointDTO.setTimeType(timeType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|