@ -31,7 +31,13 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
}
}
/ * *
* 需 要 打 卡 的 卡 点
* /
private List < String > needClockDateList ;
private List < String > needClockDateList ;
/ * *
* 分 析 日 期
* /
private String analysisDate ;
private String analysisDate ;
@Override
@Override
@ -254,88 +260,28 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
* @param scheduleResult 需 要 打 卡 的 班 次
* @param scheduleResult 需 要 打 卡 的 班 次
* @param clockInTimeList 打 卡 集 合
* @param clockInTimeList 打 卡 集 合
* @param needClockDateList 需 要 打 卡 的 时 间 点
* @param needClockDateList 需 要 打 卡 的 时 间 点
* @return { 2023 - 11 - 12 0 9 : 00 | 0 | 3 | 2023 - 11 - 12 0 9 : 15 = { signtime = 0 9 : 11 : 00 , id = 48 , userid = 53 , signdate = 2023 - 11 - 12 } }
* @return clcokInTimeData 卡 点 集 合
* 班 次 时 间 | 打 卡 类 型 ( 上 班 卡 或 下 班 卡 ) | 打 卡 时 间 处 所 在 位 置 | timeType | 弹 性 时 间 = 打 卡 时 间 map 集 合
* /
* /
public List < ClockPointDTO > 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 < ClockPointDTO > clcokInTimeData = Lists . newArrayList ( ) ;
List < ClockPointDTO > clcokInTimeData = Lists . newArrayList ( ) ;
for ( Map < String , Object > needClockIn : scheduleResult ) {
for ( Map < String , Object > needClockIn : scheduleResult ) {
/**非请假外出开始打卡逻辑处理*/
/**非请假外出开始打卡逻辑处理*/
if ( CheckBoxEnum . CHECKED . getKey ( ) . equals ( needClockIn . get ( "ksdk" ) ) & & ! ClassSegmentTypeEnum . EVECTION . getKey ( ) . equals ( needClockIn . get ( "bdlx" ) ) & &
if ( CheckBoxEnum . CHECKED . getKey ( ) . equals ( needClockIn . get ( "ksdk" ) ) & & ! ClassSegmentTypeEnum . EVECTION . getKey ( ) . equals ( needClockIn . get ( "bdlx" ) ) & &
! ClassSegmentTypeEnum . ASK_FOR_LEAVE . getKey ( ) . equals ( needClockIn . get ( "bdlx" ) ) ) {
! ClassSegmentTypeEnum . ASK_FOR_LEAVE . getKey ( ) . equals ( needClockIn . get ( "bdlx" ) ) ) {
String dtkssj = Utils . getkssjTime ( needClockIn , analysisDate ) ;
String dtkssj = Utils . getkssjTime ( needClockIn , analysisDate ) ;
String dtjssj = Utils . getjssjTime ( needClockIn , analysisDate ) ;
//计算最大提前打卡分钟数
int tqdkfzs = 60 ;
if ( Util . null2String ( needClockIn . get ( "tqdkfzs" ) ) . equals ( "" ) & & ! "" . equals ( getBeforeClockTime ( needClockDateList , dtkssj ) ) ) {
tqdkfzs = DateUtil . getBetWeenMinutes ( getBeforeClockTime ( needClockDateList , dtkssj ) , dtkssj ) ;
} else {
tqdkfzs = Util . null2String ( needClockIn . get ( "tqdkfzs" ) ) . equals ( "" ) ? 60 : Integer . valueOf ( needClockIn . get ( "tqdkfzs" ) . toString ( ) ) ;
}
Map < ClockPointEnum , Map < String , Object > > ksdkNearestClcokInTime = Utils . getNearestClcokInTimeCmd ( dtkssj , clockInTimeList ) ;
Map < ClockPointEnum , Map < String , Object > > ksdkNearestClcokInTime = Utils . getNearestClcokInTimeCmd ( dtkssj , clockInTimeList ) ;
ClockPointEnum timeType = ClockPointEnum . EMPTY ;
ClockPointEnum timeType = getStartClassTimeType ( needClockIn , ksdkNearestClcokInTime , dtkssj , dtkssj ) ;
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 ( dtkssj , tqdkfzs ) ) ) > = 0 & &
( getBeforeClockTime ( needClockDateList , dtkssj ) . equals ( "" ) | | DateUtil . getTime ( clockInTime ) . compareTo ( DateUtil . getTime ( getBeforeClockTime ( needClockDateList , dtkssj ) ) ) > 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 , dtkssj ) . equals ( "" ) | | DateUtil . getTime ( clockInTime ) . compareTo ( DateUtil . getTime ( getNextClockTime ( needClockDateList , dtkssj ) ) ) < 0 ) {
//打卡时间小于结束时间
timeType = ClockPointEnum . AFTER ;
}
}
//clcokInTimeMap.put(dtkssj + "|" + ClockPointEnum.START.getKey() + "|" + timeType, ksdkNearestClcokInTime.get(timeType));
clcokInTimeData . add ( ClockPointDTO . builder ( ) . classTime ( dtkssj ) . pointType ( ClockPointEnum . START ) . timeType ( timeType ) . record ( true ) . classSegmentType ( needClockIn . get ( "bdlx" ) . toString ( ) ) . clockTime ( ksdkNearestClcokInTime . get ( timeType ) ) . build ( ) ) ;
clcokInTimeData . add ( ClockPointDTO . builder ( ) . classTime ( dtkssj ) . pointType ( ClockPointEnum . START ) . timeType ( timeType ) . record ( true ) . 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" ) ) & &
if ( CheckBoxEnum . CHECKED . getKey ( ) . equals ( needClockIn . get ( "jsdk" ) ) & & ! ClassSegmentTypeEnum . EVECTION . getKey ( ) . equals ( needClockIn . get ( "bdlx" ) ) & &
! ClassSegmentTypeEnum . ASK_FOR_LEAVE . getKey ( ) . equals ( needClockIn . get ( "bdlx" ) ) ) {
! ClassSegmentTypeEnum . ASK_FOR_LEAVE . getKey ( ) . equals ( needClockIn . get ( "bdlx" ) ) ) {
String dtkssj = Utils . getkssjTime ( needClockIn , analysisDate ) ;
String dtjssj = Utils . getjssjTime ( needClockIn , analysisDate ) ;
String dtjssj = Utils . getjssjTime ( needClockIn , analysisDate ) ;
//计算最大退后打卡分钟数
int thdkfzs = 60 ;
if ( Util . null2String ( needClockIn . get ( "thdkfzs" ) ) . equals ( "" ) & & ! "" . equals ( getNextClockTime ( needClockDateList , dtjssj ) ) ) {
thdkfzs = DateUtil . getBetWeenMinutes ( dtjssj , getNextClockTime ( needClockDateList , dtjssj ) ) ;
} else {
thdkfzs = Util . null2String ( needClockIn . get ( "thdkfzs" ) ) . equals ( "" ) ? 60 : Integer . valueOf ( needClockIn . get ( "thdkfzs" ) . toString ( ) ) ;
}
Map < ClockPointEnum , Map < String , Object > > jsdkNearestClcokInTime = Utils . getNearestClcokInTimeCmd ( dtjssj , clockInTimeList ) ;
Map < ClockPointEnum , Map < String , Object > > jsdkNearestClcokInTime = Utils . getNearestClcokInTimeCmd ( dtjssj , clockInTimeList ) ;
ClockPointEnum timeType = getEndClassTimeType ( needClockIn , jsdkNearestClcokInTime , dtjssj , dtjssj ) ;
ClockPointEnum timeType = ClockPointEnum . EMPTY ;
if ( jsdkNearestClcokInTime . get ( ClockPointEnum . EQUAL ) ! = null ) {
timeType = ClockPointEnum . EQUAL ;
}
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 ;
}
}
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 ;
}
}
//clcokInTimeMap.put(dtjssj + "|" + ClockPointEnum.END.getKey() + "|" + timeType, jsdkNearestClcokInTime.get(timeType));
clcokInTimeData . add ( ClockPointDTO . builder ( ) . classTime ( dtjssj ) . pointType ( ClockPointEnum . END ) . timeType ( timeType ) . record ( true ) . classSegmentType ( needClockIn . get ( "bdlx" ) . toString ( ) ) . clockTime ( jsdkNearestClcokInTime . get ( timeType ) ) . build ( ) ) ;
clcokInTimeData . add ( ClockPointDTO . builder ( ) . classTime ( dtjssj ) . pointType ( ClockPointEnum . END ) . timeType ( timeType ) . record ( true ) . classSegmentType ( needClockIn . get ( "bdlx" ) . toString ( ) ) . clockTime ( jsdkNearestClcokInTime . get ( timeType ) ) . build ( ) ) ;
}
}
@ -345,76 +291,20 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
if ( CheckBoxEnum . CHECKED . getKey ( ) . equals ( needClockIn . get ( "ksdk" ) ) & & ( ClassSegmentTypeEnum . EVECTION . getKey ( ) . equals ( needClockIn . get ( "bdlx" ) ) | |
if ( CheckBoxEnum . CHECKED . getKey ( ) . equals ( needClockIn . get ( "ksdk" ) ) & & ( ClassSegmentTypeEnum . EVECTION . getKey ( ) . equals ( needClockIn . get ( "bdlx" ) ) | |
ClassSegmentTypeEnum . ASK_FOR_LEAVE . getKey ( ) . equals ( needClockIn . get ( "bdlx" ) ) ) ) {
ClassSegmentTypeEnum . ASK_FOR_LEAVE . getKey ( ) . equals ( needClockIn . get ( "bdlx" ) ) ) ) {
String dtkssj = Utils . getkssjTime ( needClockIn , analysisDate ) ;
String dtkssj = Utils . getkssjTime ( needClockIn , analysisDate ) ;
int thdkfzs = Integer . valueOf ( Util . null2String ( needClockIn . get ( "thdkfzs" ) ) ) ;
if ( ! "" . equals ( getNextClockTime ( needClockDateList , dtkssj ) ) ) {
DateUtil . getBetWeenMinutes ( dtkssj , getNextClockTime ( needClockDateList , dtkssj ) ) ;
}
Map < ClockPointEnum , Map < String , Object > > jsdkNearestClcokInTime = Utils . getNearestClcokInTimeCmd ( dtkssj , clockInTimeList ) ;
Map < ClockPointEnum , Map < String , Object > > jsdkNearestClcokInTime = Utils . getNearestClcokInTimeCmd ( dtkssj , clockInTimeList ) ;
ClockPointEnum timeType = getEndClassTimeType ( needClockIn , jsdkNearestClcokInTime , dtkssj , dtkssj ) ;
ClockPointEnum timeType = ClockPointEnum . EMPTY ;
Map < String , Map < String , Object > > clcokInTimeMap = Maps . newHashMap ( ) ;
if ( jsdkNearestClcokInTime . get ( ClockPointEnum . EQUAL ) ! = null ) {
timeType = ClockPointEnum . EQUAL ;
}
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 ;
}
}
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 ;
}
}
// clcokInTimeMap.put(dtkssj + "|" + ClockPointEnum.END.getKey() + "|" + timeType+"|0", jsdkNearestClcokInTime.get(timeType));
clcokInTimeData . add ( ClockPointDTO . builder ( ) . classTime ( dtkssj ) . pointType ( ClockPointEnum . END ) . record ( true ) . timeType ( timeType ) . classSegmentType ( needClockIn . get ( "bdlx" ) . toString ( ) ) . clockTime ( jsdkNearestClcokInTime . get ( timeType ) ) . build ( ) ) ;
clcokInTimeData . add ( ClockPointDTO . builder ( ) . classTime ( dtkssj ) . pointType ( ClockPointEnum . END ) . record ( true ) . timeType ( timeType ) . classSegmentType ( needClockIn . get ( "bdlx" ) . toString ( ) ) . clockTime ( jsdkNearestClcokInTime . get ( timeType ) ) . build ( ) ) ;
}
}
/ * *
/ * *
* 请 假 外 出 的 结 束 打 卡 处 理
* 请 假 外 出 的 结 束 打 卡 处 理
* /
* /
if ( CheckBoxEnum . CHECKED . getKey ( ) . equals ( needClockIn . get ( "jsdk" ) ) & & ( ClassSegmentTypeEnum . EVECTION . getKey ( ) . equals ( needClockIn . get ( "bdlx" ) ) | |
if ( CheckBoxEnum . CHECKED . getKey ( ) . equals ( needClockIn . get ( "jsdk" ) ) & & ( ClassSegmentTypeEnum . EVECTION . getKey ( ) . equals ( needClockIn . get ( "bdlx" ) ) | |
ClassSegmentTypeEnum . ASK_FOR_LEAVE . getKey ( ) . equals ( needClockIn . get ( "bdlx" ) ) ) ) {
ClassSegmentTypeEnum . ASK_FOR_LEAVE . getKey ( ) . equals ( needClockIn . get ( "bdlx" ) ) ) ) {
String dtkssj = Utils . getkssjTime ( needClockIn , analysisDate ) ;
String dtjssj = Utils . getjssjTime ( needClockIn , analysisDate ) ;
String dtjssj = Utils . getjssjTime ( needClockIn , analysisDate ) ;
int tqdkfzs = Integer . valueOf ( Util . null2String ( needClockIn . get ( "tqdkfzs" ) ) ) ;
if ( ! "" . equals ( getBeforeClockTime ( needClockDateList , dtjssj ) ) ) {
tqdkfzs = DateUtil . getBetWeenMinutes ( getBeforeClockTime ( needClockDateList , dtjssj ) , dtjssj ) ;
}
Map < ClockPointEnum , Map < String , Object > > ksdkNearestClcokInTime = Utils . getNearestClcokInTimeCmd ( dtjssj , clockInTimeList ) ;
Map < ClockPointEnum , Map < String , Object > > ksdkNearestClcokInTime = Utils . getNearestClcokInTimeCmd ( dtjssj , clockInTimeList ) ;
ClockPointEnum timeType = ClockPointEnum . EMPTY ;
ClockPointEnum timeType = getStartClassTimeType ( needClockIn , ksdkNearestClcokInTime , dtjssj , dtjssj ) ;
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 ( dtjssj , tqdkfzs ) ) ) > = 0 & &
( getBeforeClockTime ( needClockDateList , dtjssj ) . equals ( "" ) | | DateUtil . getTime ( clockInTime ) . compareTo ( DateUtil . getTime ( getBeforeClockTime ( needClockDateList , dtjssj ) ) ) > 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 , dtjssj ) . equals ( "" ) | | DateUtil . getTime ( clockInTime ) . compareTo ( DateUtil . getTime ( getNextClockTime ( needClockDateList , dtjssj ) ) ) < 0 ) {
//打卡时间小于结束时间
timeType = ClockPointEnum . AFTER ;
}
}
//clcokInTimeMap.put(dtjssj + "|" + ClockPointEnum.START.getKey() + "|" + timeType+"|0", ksdkNearestClcokInTime.get(timeType));
clcokInTimeData . add ( ClockPointDTO . builder ( ) . classTime ( dtjssj ) . pointType ( ClockPointEnum . START ) . record ( true ) . timeType ( timeType ) . classSegmentType ( needClockIn . get ( "bdlx" ) . toString ( ) ) . clockTime ( ksdkNearestClcokInTime . get ( timeType ) ) . build ( ) ) ;
clcokInTimeData . add ( ClockPointDTO . builder ( ) . classTime ( dtjssj ) . pointType ( ClockPointEnum . START ) . record ( true ) . timeType ( timeType ) . classSegmentType ( needClockIn . get ( "bdlx" ) . toString ( ) ) . clockTime ( ksdkNearestClcokInTime . get ( timeType ) ) . build ( ) ) ;
}
}
}
}
//根据班次时间排序
//根据班次时间排序
@ -422,165 +312,14 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
/ * *
/ * *
* 计 算 弹 性 上 下 班
* 计 算 弹 性 上 下 班
* / //上下班弹性,
* / //上下班弹性,
List < Map < String , Object > > workScheduleList = scheduleResult . stream ( ) . filter ( e - > ClassSegmentTypeEnum . WORK_TIME . getKey ( ) . equals ( e . get ( "bdlx" ) ) | | ClassSegmentTypeEnum . EARLY_OVERTIME . getKey ( ) . equals ( e . get ( "bdlx" ) ) ) . collect ( Collectors . toList ( ) ) ;
flexibleWork ( clcokInTimeData , scheduleResult ) ;
if ( scheduleResult . size ( ) > 0 & & workScheduleList . size ( ) > 0 ) {
//请假和外出集合
List < Map < String , Object > > leaveAndEvctionList = scheduleResult . stream ( ) . filter ( e - > ClassSegmentTypeEnum . ASK_FOR_LEAVE . getKey ( ) . equals ( e . get ( "bdlx" ) ) | |
ClassSegmentTypeEnum . EVECTION . getKey ( ) . equals ( e . get ( "bdlx" ) ) ) . collect ( Collectors . toList ( ) ) ;
//是否弹性
String sfdx = Util . null2String ( workScheduleList . get ( 0 ) . get ( "sfdx" ) ) ;
//上班是否需要打卡
String ifToWorkClock = Util . null2String ( workScheduleList . get ( 0 ) . get ( "ksdk" ) ) ;
//下班是否需要打卡
String ifToCloseClock = Util . null2String ( workScheduleList . get ( workScheduleList . size ( ) - 1 ) . get ( "jsdk" ) ) ;
//第一条工作时段、早上加班
if ( workScheduleList . size ( ) > 0 & & CheckBoxEnum . CHECKED . getKey ( ) . equals ( sfdx ) ) {
//最大弹性分钟
int zddxfz = Integer . valueOf ( Util . null2String ( workScheduleList . get ( 0 ) . get ( "zddxfz" ) ) ) ;
//弹性核算
int dxhs = Integer . valueOf ( Util . null2String ( workScheduleList . get ( 0 ) . get ( "dxhs" ) ) ) ;
Map < String , Object > ksdkMap = workScheduleList . get ( 0 ) ;
//最早上班时间
String kssjStart = Utils . getkssjTime ( ksdkMap , analysisDate ) ;
Map < String , Object > jsdkMap = workScheduleList . get ( workScheduleList . size ( ) - 1 ) ;
//最晚下班时间
int thdkfzs = Integer . valueOf ( Util . null2String ( jsdkMap . get ( "thdkfzs" ) ) . equals ( "" ) ? "60" : Util . null2String ( jsdkMap . get ( "thdkfzs" ) ) ) ;
String jssjEnd = Utils . getjssjTime ( jsdkMap , analysisDate ) ;
//弹性上班时间
String flexibleWorkTime = "" ;
//弹性下班时间
String flexibleOffWorkTime = "" ;
if ( leaveAndEvctionList . size ( ) > 0 ) {
//第一笔请假、外出时间
Map < String , Object > leaveAndEvctionMap = leaveAndEvctionList . get ( 0 ) ;
String leaveAndEvctionkssj = Utils . getkssjTime ( leaveAndEvctionMap , analysisDate ) ;
//最大开始弹性时间
String minkssjStart = DateUtil . beforeMinutes ( kssjStart , zddxfz ) ;
String maxkssjStart = DateUtil . AfterMinutes ( kssjStart , zddxfz ) ;
//请假开始时间在最大开始弹性时间之内
if ( DateUtil . getTime ( leaveAndEvctionkssj ) . compareTo ( DateUtil . getTime ( maxkssjStart ) ) < = 0 ) {
//弹性上班卡
flexibleWorkTime = leaveAndEvctionkssj ;
if ( DateUtil . getTime ( leaveAndEvctionkssj ) . compareTo ( DateUtil . getTime ( minkssjStart ) ) < 0 ) {
flexibleWorkTime = minkssjStart ;
}
//弹性下班时间点
int betweenToWorkTime = DateUtil . getBetWeenMinutes ( flexibleWorkTime , kssjStart ) ;
//弹性下班时间点
flexibleOffWorkTime = jssjEnd ;
if ( betweenToWorkTime > = 0 ) {
flexibleOffWorkTime = DateUtil . beforeMinutes ( flexibleOffWorkTime , Math . abs ( betweenToWorkTime ) ) ;
} else if ( betweenToWorkTime < 0 ) {
flexibleOffWorkTime = DateUtil . AfterMinutes ( flexibleOffWorkTime , Math . abs ( betweenToWorkTime ) ) ;
}
}
}
//弹性上班卡
for ( int i = 0 ; i < clcokInTimeData . size ( ) ; i + + ) {
ClockPointDTO clockdto = clcokInTimeData . get ( i ) ;
//当天打卡数据
Map < String , Object > clcokInTime = clockdto . getClockTime ( ) ;
//需要计算的班次打卡时间点
String pointTime = clockdto . getClassTime ( ) ;
//start: 开始打卡时间点, end: 结束打卡时间点
ClockPointEnum pointType = clockdto . getPointType ( ) ;
//empty:漏卡, equal:打卡时间和班次时间相等, before: 打卡时间在班次时间之前, after: 打卡时间在班次时间之后
ClockPointEnum timeType = clockdto . getTimeType ( ) ;
if ( pointTime . equals ( kssjStart ) & & ClockPointEnum . START . equals ( pointType ) & & clcokInTime ! = null
& & CheckBoxEnum . CHECKED . getKey ( ) . equals ( ifToWorkClock ) ) {
String signTime = clcokInTime . get ( "signdate" ) + " " + clcokInTime . get ( "signtime" ) ;
//该卡点是弹性开始时间
if ( "" . equals ( flexibleWorkTime ) ) {
//弹性上班期间未被请假开始时间占据
if ( ClockPointEnum . BEFORE . equals ( timeType ) ) {
int betWeenTime = DateUtil . getBetWeenMinutes ( signTime , kssjStart ) ;
if ( betWeenTime < = zddxfz ) {
betWeenTime = Double . valueOf ( Utils . getItemdurationDown ( dxhs , AccountingUnitEnum . MINUTES . getKey ( ) , betWeenTime , AccountingUnitEnum . MINUTES ) ) . intValue ( ) ;
flexibleWorkTime = DateUtil . beforeMinutes ( kssjStart , betWeenTime ) ;
clockdto . setTimeType ( ClockPointEnum . EQUAL ) ;
} else if ( betWeenTime > zddxfz ) {
flexibleWorkTime = DateUtil . beforeMinutes ( kssjStart , zddxfz ) ;
}
clockdto . setElasticTime ( flexibleWorkTime ) ;
} else if ( ClockPointEnum . AFTER . equals ( timeType ) ) {
//迟到
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 ) ;
clockdto . setTimeType ( ClockPointEnum . EQUAL ) ;
} else if ( betWeenTime > zddxfz ) {
flexibleWorkTime = DateUtil . AfterMinutes ( kssjStart , zddxfz ) ;
}
clockdto . setElasticTime ( flexibleWorkTime ) ;
}
} else {
//弹性上班期间被请假开始时间占据
clockdto . setElasticTime ( flexibleWorkTime ) ;
}
} else if ( pointTime . equals ( jssjEnd ) & & ClockPointEnum . END . equals ( pointType ) & & CheckBoxEnum . CHECKED . getKey ( ) . equals ( ifToCloseClock ) ) {
//该卡点是弹性下班点
if ( "" . equals ( flexibleOffWorkTime ) & & ! "" . equals ( flexibleWorkTime ) ) {
int betweenToWorkTime = DateUtil . getBetWeenMinutes ( flexibleWorkTime , kssjStart ) ;
//弹性下班时间点
flexibleOffWorkTime = jssjEnd ;
if ( betweenToWorkTime > = 0 ) {
flexibleOffWorkTime = DateUtil . beforeMinutes ( flexibleOffWorkTime , Math . abs ( betweenToWorkTime ) ) ;
} else if ( betweenToWorkTime < 0 ) {
flexibleOffWorkTime = DateUtil . AfterMinutes ( flexibleOffWorkTime , Math . abs ( betweenToWorkTime ) ) ;
}
}
if ( ! "" . equals ( flexibleOffWorkTime ) ) {
//根据弹性下班时间点重新计算
Map < ClockPointEnum , Map < String , Object > > jsdkNearestClcokInTime = Utils . getNearestClcokInTimeCmd ( flexibleOffWorkTime , clockInTimeList ) ;
ClockPointEnum newtimeType = ClockPointEnum . EMPTY ;
if ( jsdkNearestClcokInTime . get ( ClockPointEnum . EQUAL ) ! = null ) {
newtimeType = ClockPointEnum . EQUAL ;
}
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 ;
}
}
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 ;
}
}
// 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 ) ) ;
}
}
}
}
}
/ * *
/ * *
* 计 算 休 息 时 间 段 的 弹 性 上 下 班
* 计 算 休 息 时 间 段 的 弹 性 上 下 班
* /
* /
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" ) )
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 ( ) ) ;
| | ClassSegmentTypeEnum . DINING_PERIOD . getKey ( ) . equals ( e . get ( "bdlx" ) ) ) & & CheckBoxEnum . CHECKED . getKey ( ) . equals ( e . get ( "dtsfdx" ) ) ) . collect ( Collectors . toList ( ) ) ;
if ( restScheduleList . size ( ) > 0 ) {
if ( restScheduleList . size ( ) > 0 ) {
adjustClockPointDTOBy RestClass( restScheduleList , clcokInTimeData , needClockDateList , scheduleResult ) ;
flexibleRestClass ( restScheduleList , clcokInTimeData , scheduleResult ) ;
}
}
/ * *
/ * *
* 当 有 2 笔 需 要 打 卡 时 , 可 能 会 有 打 卡 歧 义 的 情 况 , 歧 义 情 况 取 2 个 时 间 点 的 中 间 值 , 当 打 卡 时 间 小 于 中 间 值 归 属 前 一 个 打 卡 , 大 于 则 相 反
* 当 有 2 笔 需 要 打 卡 时 , 可 能 会 有 打 卡 歧 义 的 情 况 , 歧 义 情 况 取 2 个 时 间 点 的 中 间 值 , 当 打 卡 时 间 小 于 中 间 值 归 属 前 一 个 打 卡 , 大 于 则 相 反
@ -704,37 +443,6 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
public String getNextClockTime ( List < String > needClockDateList , String time ) {
int index = 0 ;
for ( int i = 0 ; i < needClockDateList . size ( ) ; i + + ) {
if ( needClockDateList . get ( i ) . equals ( time ) ) {
index = i + 1 ;
break ;
}
}
if ( index < needClockDateList . size ( ) & & index ! = 0 ) {
return needClockDateList . get ( index ) ;
} else {
return "" ;
}
}
public String getBeforeClockTime ( List < String > needClockDateList , String time ) {
int index = 0 ;
for ( int i = 0 ; i < needClockDateList . size ( ) ; i + + ) {
if ( needClockDateList . get ( i ) . equals ( time ) ) {
index = i - 1 ;
break ;
}
}
if ( index > = 0 ) {
return needClockDateList . get ( index ) ;
} else {
return "" ;
}
}
public boolean resetClcokInTimeData ( String analysisDate , ClockPointDTO resetClcokDTO , List < Map < String , Object > > clockInTimeList , List < String > needClockDateList , List < ClockPointDTO > clcokInTimeData , List < Map < String , Object > > scheduleResult ) {
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 ( ) ;
String restTime = resetClcokDTO . getClassTime ( ) ;
if ( resetClcokDTO . getElasticTime ( ) ! = null & & ! "" . equals ( resetClcokDTO . getElasticTime ( ) ) ) {
if ( resetClcokDTO . getElasticTime ( ) ! = null & & ! "" . equals ( resetClcokDTO . getElasticTime ( ) ) ) {
@ -866,23 +574,165 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
return scheduleResult ;
return scheduleResult ;
}
}
/ * *
/ * *
* 判 断 是 否 是 工 作 ( 包 含 加 班 ) 类 型 时 段
* 早 晚 上 下 班 弹 性
* @param classSegmentType
* @return
* /
* /
public boolean ifWorkClassSegment ( String classSegmentType ) {
public void flexibleWork ( List < ClockPointDTO > clcokInTimeData , List < Map < String , Object > > scheduleResult ) {
if ( classSegmentType . equals ( ClassSegmentTypeEnum . WORK_TIME . getKey ( ) ) | | classSegmentType . equals ( ClassSegmentTypeEnum . EXTENDED_OVERTIME . getKey ( ) )
List < Map < String , Object > > clockInTimeList = ( List < Map < String , Object > > ) params . get ( "clockInTimeList" ) ;
| | classSegmentType . equals ( ClassSegmentTypeEnum . OVERTIME_PLAN . getKey ( ) ) | | classSegmentType . equals ( ClassSegmentTypeEnum . EARLY_OVERTIME . getKey ( ) ) | | classSegmentType . equals ( ClassSegmentTypeEnum . OVERTIME_IN_CLASS . getKey ( ) ) ) {
List < Map < String , Object > > workScheduleList = scheduleResult . stream ( ) . filter ( e - > ClassSegmentTypeEnum . WORK_TIME . getKey ( ) . equals ( e . get ( "bdlx" ) ) | | ClassSegmentTypeEnum . EARLY_OVERTIME . getKey ( ) . equals ( e . get ( "bdlx" ) ) ) . collect ( Collectors . toList ( ) ) ;
return true ;
if ( scheduleResult . size ( ) > 0 & & workScheduleList . size ( ) > 0 ) {
//请假和外出集合
List < Map < String , Object > > leaveAndEvctionList = scheduleResult . stream ( ) . filter ( e - > ClassSegmentTypeEnum . ASK_FOR_LEAVE . getKey ( ) . equals ( e . get ( "bdlx" ) ) | |
ClassSegmentTypeEnum . EVECTION . getKey ( ) . equals ( e . get ( "bdlx" ) ) ) . collect ( Collectors . toList ( ) ) ;
//是否弹性
String sfdx = Util . null2String ( workScheduleList . get ( 0 ) . get ( "sfdx" ) ) ;
//上班是否需要打卡
String ifToWorkClock = Util . null2String ( workScheduleList . get ( 0 ) . get ( "ksdk" ) ) ;
//下班是否需要打卡
String ifToCloseClock = Util . null2String ( workScheduleList . get ( workScheduleList . size ( ) - 1 ) . get ( "jsdk" ) ) ;
//第一条工作时段、早上加班
if ( workScheduleList . size ( ) > 0 & & CheckBoxEnum . CHECKED . getKey ( ) . equals ( sfdx ) ) {
//最大弹性分钟
int zddxfz = Integer . valueOf ( Util . null2String ( workScheduleList . get ( 0 ) . get ( "zddxfz" ) ) ) ;
//弹性核算
int dxhs = Integer . valueOf ( Util . null2String ( workScheduleList . get ( 0 ) . get ( "dxhs" ) ) ) ;
Map < String , Object > ksdkMap = workScheduleList . get ( 0 ) ;
//最早上班时间
String kssjStart = Utils . getkssjTime ( ksdkMap , analysisDate ) ;
Map < String , Object > jsdkMap = workScheduleList . get ( workScheduleList . size ( ) - 1 ) ;
//最晚下班时间
int thdkfzs = Integer . valueOf ( Util . null2String ( jsdkMap . get ( "thdkfzs" ) ) . equals ( "" ) ? "60" : Util . null2String ( jsdkMap . get ( "thdkfzs" ) ) ) ;
String jssjEnd = Utils . getjssjTime ( jsdkMap , analysisDate ) ;
//弹性上班时间
String flexibleWorkTime = "" ;
//弹性下班时间
String flexibleOffWorkTime = "" ;
if ( leaveAndEvctionList . size ( ) > 0 ) {
//第一笔请假、外出时间
Map < String , Object > leaveAndEvctionMap = leaveAndEvctionList . get ( 0 ) ;
String leaveAndEvctionkssj = Utils . getkssjTime ( leaveAndEvctionMap , analysisDate ) ;
//最大开始弹性时间
String minkssjStart = DateUtil . beforeMinutes ( kssjStart , zddxfz ) ;
String maxkssjStart = DateUtil . AfterMinutes ( kssjStart , zddxfz ) ;
//请假开始时间在最大开始弹性时间之内
if ( DateUtil . getTime ( leaveAndEvctionkssj ) . compareTo ( DateUtil . getTime ( maxkssjStart ) ) < = 0 ) {
//弹性上班卡
flexibleWorkTime = leaveAndEvctionkssj ;
if ( DateUtil . getTime ( leaveAndEvctionkssj ) . compareTo ( DateUtil . getTime ( minkssjStart ) ) < 0 ) {
flexibleWorkTime = minkssjStart ;
}
//弹性下班时间点
int betweenToWorkTime = DateUtil . getBetWeenMinutes ( flexibleWorkTime , kssjStart ) ;
//弹性下班时间点
flexibleOffWorkTime = jssjEnd ;
if ( betweenToWorkTime > = 0 ) {
flexibleOffWorkTime = DateUtil . beforeMinutes ( flexibleOffWorkTime , Math . abs ( betweenToWorkTime ) ) ;
} else if ( betweenToWorkTime < 0 ) {
flexibleOffWorkTime = DateUtil . AfterMinutes ( flexibleOffWorkTime , Math . abs ( betweenToWorkTime ) ) ;
}
}
}
//弹性上班卡
for ( int i = 0 ; i < clcokInTimeData . size ( ) ; i + + ) {
ClockPointDTO clockdto = clcokInTimeData . get ( i ) ;
//需要计算的班次打卡时间点
String pointTime = clockdto . getClassTime ( ) ;
//start: 开始打卡时间点, end: 结束打卡时间点
ClockPointEnum pointType = clockdto . getPointType ( ) ;
//重新获取最早上班时间
Map < ClockPointEnum , Map < String , Object > > startNearestClcokInTime = Utils . getNearestClcokInTimeCmd ( DateUtil . beforeMinutes ( clockdto . getClassTime ( ) , zddxfz ) , clockInTimeList ) ;
ClockPointEnum timeType = getStartClassTimeType ( ksdkMap , startNearestClcokInTime , kssjStart , DateUtil . beforeMinutes ( kssjStart , zddxfz ) ) ;
clockdto . setTimeType ( timeType ) ;
clockdto . setClockTime ( startNearestClcokInTime . get ( timeType ) ) ;
Map < String , Object > clcokInTime = clockdto . getClockTime ( ) ;
if ( pointTime . equals ( kssjStart ) & & ClockPointEnum . START . equals ( pointType ) & & clcokInTime ! = null
& & CheckBoxEnum . CHECKED . getKey ( ) . equals ( ifToWorkClock ) ) {
//该卡点是弹性开始时间
//弹性上班期间未被请假开始时间占据
if ( "" . equals ( flexibleWorkTime ) ) {
String signTime = clcokInTime . get ( "signdate" ) + " " + clcokInTime . get ( "signtime" ) ;
if ( ClockPointEnum . BEFORE . equals ( timeType ) ) {
int betWeenTime = DateUtil . getBetWeenMinutes ( signTime , kssjStart ) ;
if ( betWeenTime < = zddxfz ) {
betWeenTime = Double . valueOf ( Utils . getItemdurationDown ( dxhs , AccountingUnitEnum . MINUTES . getKey ( ) , betWeenTime , AccountingUnitEnum . MINUTES ) ) . intValue ( ) ;
flexibleWorkTime = DateUtil . beforeMinutes ( kssjStart , betWeenTime ) ;
clockdto . setTimeType ( ClockPointEnum . EQUAL ) ;
} else if ( betWeenTime > zddxfz ) {
flexibleWorkTime = DateUtil . beforeMinutes ( kssjStart , zddxfz ) ;
}
clockdto . setElasticTime ( flexibleWorkTime ) ;
} else if ( ClockPointEnum . AFTER . equals ( timeType ) ) {
//迟到
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 ) ;
clockdto . setTimeType ( ClockPointEnum . EQUAL ) ;
} else if ( betWeenTime > zddxfz ) {
flexibleWorkTime = DateUtil . AfterMinutes ( kssjStart , zddxfz ) ;
}
clockdto . setElasticTime ( flexibleWorkTime ) ;
}
} else {
} else {
return false ;
//弹性上班期间被请假开始时间占据
clockdto . setElasticTime ( flexibleWorkTime ) ;
}
//重新设置打卡时间
int startWorkIndex = needClockDateList . indexOf ( kssjStart ) ;
needClockDateList . remove ( startWorkIndex ) ;
needClockDateList . add ( startWorkIndex , clockdto . getElasticTime ( ) ) ;
} else if ( pointTime . equals ( jssjEnd ) & & ClockPointEnum . END . equals ( pointType ) & & CheckBoxEnum . CHECKED . getKey ( ) . equals ( ifToCloseClock ) ) {
//该卡点是弹性下班点
if ( "" . equals ( flexibleOffWorkTime ) & & ! "" . equals ( flexibleWorkTime ) ) {
int betweenToWorkTime = DateUtil . getBetWeenMinutes ( flexibleWorkTime , kssjStart ) ;
//弹性下班时间点
flexibleOffWorkTime = jssjEnd ;
if ( betweenToWorkTime > = 0 ) {
flexibleOffWorkTime = DateUtil . beforeMinutes ( flexibleOffWorkTime , Math . abs ( betweenToWorkTime ) ) ;
} else if ( betweenToWorkTime < 0 ) {
flexibleOffWorkTime = DateUtil . AfterMinutes ( flexibleOffWorkTime , Math . abs ( betweenToWorkTime ) ) ;
}
}
if ( ! "" . equals ( flexibleOffWorkTime ) ) {
//重新设置打卡时间
int endWorkIndex = needClockDateList . indexOf ( jssjEnd ) ;
needClockDateList . remove ( endWorkIndex ) ;
needClockDateList . add ( endWorkIndex , flexibleOffWorkTime ) ;
//根据弹性下班时间点重新计算
Map < ClockPointEnum , Map < String , Object > > jsdkNearestClcokInTime = Utils . getNearestClcokInTimeCmd ( flexibleOffWorkTime , clockInTimeList ) ;
ClockPointEnum newtimeType = getEndClassTimeType ( jsdkMap , jsdkNearestClcokInTime , flexibleOffWorkTime , flexibleOffWorkTime ) ;
clockdto . setClassTime ( jssjEnd ) ;
clockdto . setPointType ( ClockPointEnum . END ) ;
clockdto . setTimeType ( newtimeType ) ;
clockdto . setElasticTime ( flexibleOffWorkTime ) ;
clockdto . setClockTime ( jsdkNearestClcokInTime . get ( newtimeType ) ) ;
}
}
}
}
}
}
}
}
/ * *
/ * *
* 休 息 时 段 弹 性 上 班
* 休 息 时 段 弹 性
* /
* /
public void adjustClockPointDTOByRestClass ( List < Map < String , Object > > restScheduleList , List < ClockPointDTO > clcokInTimeData , List < String > needClockDateList , List < Map < String , Object > > scheduleResult ) {
public void flexible RestClass( List < Map < String , Object > > restScheduleList , List < ClockPointDTO > clcokInTimeData , List < Map < String , Object > > scheduleResult ) {
String analysisDate = Util . null2String ( params . get ( "analysisDate" ) ) ;
String analysisDate = Util . null2String ( params . get ( "analysisDate" ) ) ;
List < Map < String , Object > > clockInTimeList = ( List < Map < String , Object > > ) params . get ( "clockInTimeList" ) ;
List < Map < String , Object > > clockInTimeList = ( List < Map < String , Object > > ) params . get ( "clockInTimeList" ) ;
@ -907,7 +757,7 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
}
}
}
}
List < Map < String , Object > > endRestSchedule = scheduleResult . stream ( ) . filter ( e - > dtjssj . equals ( Utils . getkssjTime ( e , analysisDate ) ) ) . collect ( Collectors . toList ( ) ) ;
List < Map < String , Object > > endRestSchedule = scheduleResult . stream ( ) . filter ( e - > dtjssj . equals ( Utils . getkssjTime ( e , analysisDate ) ) ) . collect ( Collectors . toList ( ) ) ;
List < Map < String , Object > > startRestSchedule = scheduleResult . stream ( ) . filter ( e - > dtkssj . equals ( Utils . get k ssjTime( e , analysisDate ) ) ) . collect ( Collectors . toList ( ) ) ;
List < Map < String , Object > > startRestSchedule = scheduleResult . stream ( ) . filter ( e - > dtkssj . equals ( Utils . get j ssjTime( e , analysisDate ) ) ) . collect ( Collectors . toList ( ) ) ;
/ * *
/ * *
* 当 休 息 时 段 的 开 始 和 结 束 时 间 都 要 打 卡 时 才 进 行 弹 性
* 当 休 息 时 段 的 开 始 和 结 束 时 间 都 要 打 卡 时 才 进 行 弹 性
@ -915,33 +765,8 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
if ( toRestClockPointDTO ! = null & & endRestClockPointDTO ! = null ) {
if ( toRestClockPointDTO ! = null & & endRestClockPointDTO ! = null ) {
String toRestClassTime = toRestClockPointDTO . getClassTime ( ) ;
String toRestClassTime = toRestClockPointDTO . getClassTime ( ) ;
String endRestClassTime = endRestClockPointDTO . getClassTime ( ) ;
String endRestClassTime = endRestClockPointDTO . getClassTime ( ) ;
int thdkfzs = 60 ;
if ( Util . null2String ( startRestSchedule . get ( 0 ) . get ( "thdkfzs" ) ) . equals ( "" ) & & ! "" . equals ( getNextClockTime ( needClockDateList , dtkssj ) ) ) {
thdkfzs = DateUtil . getBetWeenMinutes ( dtkssj , getNextClockTime ( needClockDateList , dtkssj ) ) ;
} else {
thdkfzs = Util . null2String ( startRestSchedule . get ( 0 ) . get ( "thdkfzs" ) ) . equals ( "" ) ? 60 : Integer . valueOf ( startRestSchedule . get ( 0 ) . get ( "thdkfzs" ) . toString ( ) ) ;
}
Map < ClockPointEnum , Map < String , Object > > toRestNearestClcokInTime = Utils . getNearestClcokInTimeCmd ( DateUtil . beforeMinutes ( dtkssj , dtzddxfz ) , clockInTimeList ) ;
Map < ClockPointEnum , Map < String , Object > > toRestNearestClcokInTime = Utils . getNearestClcokInTimeCmd ( DateUtil . beforeMinutes ( dtkssj , dtzddxfz ) , clockInTimeList ) ;
ClockPointEnum timeType = getEndClassTimeType ( startRestSchedule . get ( 0 ) , toRestNearestClcokInTime , dtkssj , DateUtil . AfterMinutes ( dtkssj , dtzddxfz ) ) ;
ClockPointEnum timeType = ClockPointEnum . EMPTY ;
if ( toRestNearestClcokInTime . get ( ClockPointEnum . EQUAL ) ! = null ) {
timeType = ClockPointEnum . EQUAL ;
}
if ( ClockPointEnum . EMPTY . equals ( timeType ) & & toRestNearestClcokInTime . get ( ClockPointEnum . AFTER ) ! = null ) {
String clockInTime = toRestNearestClcokInTime . get ( ClockPointEnum . AFTER ) . get ( "signdate" ) + " " + toRestNearestClcokInTime . get ( ClockPointEnum . AFTER ) . get ( "signtime" ) ;
if ( DateUtil . getTime ( clockInTime ) . compareTo ( DateUtil . getTime ( DateUtil . AfterMinutes ( DateUtil . beforeMinutes ( dtkssj , dtzddxfz ) , thdkfzs ) ) ) < = 0 & &
( getNextClockTime ( needClockDateList , dtkssj ) . equals ( "" ) | | DateUtil . getTime ( clockInTime ) . compareTo ( DateUtil . getTime ( getNextClockTime ( needClockDateList , dtkssj ) ) ) < 0 ) ) {
timeType = ClockPointEnum . AFTER ;
}
}
if ( ClockPointEnum . EMPTY . equals ( timeType ) & & toRestNearestClcokInTime . get ( ClockPointEnum . BEFORE ) ! = null ) {
String clockInTime = toRestNearestClcokInTime . get ( ClockPointEnum . BEFORE ) . get ( "signdate" ) + " " + toRestNearestClcokInTime . get ( ClockPointEnum . BEFORE ) . get ( "signtime" ) ;
if ( getBeforeClockTime ( needClockDateList , dtkssj ) . equals ( "" ) | | DateUtil . getTime ( clockInTime ) . compareTo ( DateUtil . getTime ( getBeforeClockTime ( needClockDateList , dtkssj ) ) ) > 0 ) {
timeType = ClockPointEnum . BEFORE ;
}
}
toRestClockPointDTO . setTimeType ( timeType ) ;
toRestClockPointDTO . setTimeType ( timeType ) ;
toRestClockPointDTO . setClockTime ( toRestNearestClcokInTime . get ( timeType ) ) ;
toRestClockPointDTO . setClockTime ( toRestNearestClcokInTime . get ( timeType ) ) ;
@ -954,8 +779,6 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
}
}
String toRestClockTime = toRestClockTimeMap . get ( "signdate" ) + " " + toRestClockTimeMap . get ( "signtime" ) ;
String toRestClockTime = toRestClockTimeMap . get ( "signdate" ) + " " + toRestClockTimeMap . get ( "signtime" ) ;
int betweenMinute = 0 ;
int betweenMinute = 0 ;
//设置下上班的弹性时间
//设置下上班的弹性时间
if ( toRestClockPointDTO . getTimeType ( ) = = ClockPointEnum . BEFORE ) {
if ( toRestClockPointDTO . getTimeType ( ) = = ClockPointEnum . BEFORE ) {
betweenMinute = DateUtil . getBetWeenMinutes ( toRestClockTime , toRestClassTime ) ;
betweenMinute = DateUtil . getBetWeenMinutes ( toRestClockTime , toRestClassTime ) ;
@ -984,42 +807,22 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
toRestClockPointDTO . setElasticTime ( toRestClockTime ) ;
toRestClockPointDTO . setElasticTime ( toRestClockTime ) ;
toRestClockPointDTO . setTimeType ( ClockPointEnum . EQUAL ) ;
toRestClockPointDTO . setTimeType ( ClockPointEnum . EQUAL ) ;
}
}
//重新设置打卡时间
int toRestIndex = needClockDateList . indexOf ( toRestClockPointDTO . getClassTime ( ) ) ;
needClockDateList . remove ( toRestIndex ) ;
needClockDateList . add ( toRestIndex , toRestClockPointDTO . getElasticTime ( ) ) ;
int endRestIndex = needClockDateList . indexOf ( endRestClockPointDTO . getClassTime ( ) ) ;
needClockDateList . remove ( endRestIndex ) ;
needClockDateList . add ( endRestIndex , endRestClockPointDTO . getElasticTime ( ) ) ;
//变更休息时间
//变更休息时间
restSchedule . put ( "dtkssj" , toRestClockPointDTO . getElasticTime ( ) . split ( " " ) [ 1 ] ) ;
restSchedule . put ( "dtkssj" , toRestClockPointDTO . getElasticTime ( ) . split ( " " ) [ 1 ] ) ;
restSchedule . put ( "dtjssj" , endRestClockPointDTO . 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 , dtjssj ) ) ) {
tqdkfzs = DateUtil . getBetWeenMinutes ( getBeforeClockTime ( needClockDateList , dtjssj ) , dtjssj ) ;
} 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 ) ;
Map < ClockPointEnum , Map < String , Object > > ksdkNearestClcokInTime = Utils . getNearestClcokInTimeCmd ( endRestClockPointDTO . getElasticTime ( ) , clockInTimeList ) ;
ClockPointEnum endResttimeType = ClockPointEnum . EMPTY ;
ClockPointEnum endResttimeType = getStartClassTimeType ( endRestSchedule . get ( 0 ) , ksdkNearestClcokInTime , endRestClockPointDTO . getElasticTime ( ) , endRestClockPointDTO . getElasticTime ( ) ) ;
if ( ksdkNearestClcokInTime . get ( ClockPointEnum . EQUAL ) ! = null ) {
endResttimeType = ClockPointEnum . EQUAL ;
}
if ( ClockPointEnum . EMPTY . equals ( endResttimeType ) & & 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 , dtjssj ) . equals ( "" ) | | DateUtil . getTime ( clockInTime ) . compareTo ( DateUtil . getTime ( getBeforeClockTime ( needClockDateList , dtjssj ) ) ) > 0 ) ) {
//打卡时间大于等于最早打卡时间
endResttimeType = ClockPointEnum . BEFORE ;
}
}
if ( ClockPointEnum . EMPTY . equals ( endResttimeType ) & & 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 ) {
//打卡时间小于结束时间
endResttimeType = ClockPointEnum . AFTER ;
}
}
endRestClockPointDTO . setClockTime ( ksdkNearestClcokInTime . get ( endResttimeType ) ) ;
endRestClockPointDTO . setClockTime ( ksdkNearestClcokInTime . get ( endResttimeType ) ) ;
endRestClockPointDTO . setTimeType ( endResttimeType ) ;
endRestClockPointDTO . setTimeType ( endResttimeType ) ;
}
}
@ -1029,9 +832,14 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
}
}
public ClockPointEnum getStartClassTimeType ( Map < String , Object > needClockIn , Map < ClockPointEnum , Map < String , Object > > ksdkNearestClcokInTime ) {
/ * *
String dtkssj = Utils . getkssjTime ( needClockIn , analysisDate ) ;
* 获 取 开 始 打 卡 的 打 卡 数 据 在 卡 点 的 位 置
String dtjssj = Utils . getjssjTime ( needClockIn , analysisDate ) ;
* @param needClockIn
* @param ksdkNearestClcokInTime
* @return
* /
public ClockPointEnum getStartClassTimeType ( Map < String , Object > needClockIn , Map < ClockPointEnum , Map < String , Object > > ksdkNearestClcokInTime , String dtkssj , String minelasticTime ) {
int tqdkfzs = 60 ;
int tqdkfzs = 60 ;
if ( Util . null2String ( needClockIn . get ( "tqdkfzs" ) ) . equals ( "" ) & & ! "" . equals ( getBeforeClockTime ( needClockDateList , dtkssj ) ) ) {
if ( Util . null2String ( needClockIn . get ( "tqdkfzs" ) ) . equals ( "" ) & & ! "" . equals ( getBeforeClockTime ( needClockDateList , dtkssj ) ) ) {
tqdkfzs = DateUtil . getBetWeenMinutes ( getBeforeClockTime ( needClockDateList , dtkssj ) , dtkssj ) ;
tqdkfzs = DateUtil . getBetWeenMinutes ( getBeforeClockTime ( needClockDateList , dtkssj ) , dtkssj ) ;
@ -1045,7 +853,7 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
}
}
if ( ClockPointEnum . EMPTY . equals ( timeType ) & & ksdkNearestClcokInTime . get ( ClockPointEnum . BEFORE ) ! = null ) {
if ( ClockPointEnum . EMPTY . equals ( timeType ) & & ksdkNearestClcokInTime . get ( ClockPointEnum . BEFORE ) ! = null ) {
String clockInTime = ksdkNearestClcokInTime . get ( ClockPointEnum . BEFORE ) . get ( "signdate" ) + " " + ksdkNearestClcokInTime . get ( ClockPointEnum . BEFORE ) . get ( "signtime" ) ;
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 & &
if ( DateUtil . getTime ( clockInTime ) . compareTo ( DateUtil . getTime ( DateUtil . beforeMinutes ( minelasticTime , tqdkfzs ) ) ) > = 0 & &
( getBeforeClockTime ( needClockDateList , dtkssj ) . equals ( "" ) | | DateUtil . getTime ( clockInTime ) . compareTo ( DateUtil . getTime ( getBeforeClockTime ( needClockDateList , dtkssj ) ) ) > 0 ) ) {
( getBeforeClockTime ( needClockDateList , dtkssj ) . equals ( "" ) | | DateUtil . getTime ( clockInTime ) . compareTo ( DateUtil . getTime ( getBeforeClockTime ( needClockDateList , dtkssj ) ) ) > 0 ) ) {
//打卡时间大于等于最早打卡时间
//打卡时间大于等于最早打卡时间
timeType = ClockPointEnum . BEFORE ;
timeType = ClockPointEnum . BEFORE ;
@ -1061,4 +869,82 @@ public class GetClockInPointCmd extends AbstractCommonCommand<Map<String, Object
}
}
return timeType ;
return timeType ;
}
}
/ * *
* 获 取 结 束 打 卡 的 打 卡 数 据 在 卡 点 的 位 置
* @param needClockIn
* @param jsdkNearestClcokInTime
* @return
* /
public ClockPointEnum getEndClassTimeType ( Map < String , Object > needClockIn , Map < ClockPointEnum , Map < String , Object > > jsdkNearestClcokInTime , String dtjssj , String maxelasticTime ) {
int thdkfzs = 60 ;
if ( Util . null2String ( needClockIn . get ( "thdkfzs" ) ) . equals ( "" ) & & ! "" . equals ( getNextClockTime ( needClockDateList , dtjssj ) ) ) {
thdkfzs = DateUtil . getBetWeenMinutes ( dtjssj , getNextClockTime ( needClockDateList , dtjssj ) ) ;
} else {
thdkfzs = Util . null2String ( needClockIn . get ( "thdkfzs" ) ) . equals ( "" ) ? 60 : Integer . valueOf ( needClockIn . get ( "thdkfzs" ) . toString ( ) ) ;
}
ClockPointEnum timeType = ClockPointEnum . EMPTY ;
if ( jsdkNearestClcokInTime . get ( ClockPointEnum . EQUAL ) ! = null ) {
timeType = ClockPointEnum . EQUAL ;
}
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 ( maxelasticTime , thdkfzs ) ) ) < = 0 & &
( getNextClockTime ( needClockDateList , dtjssj ) . equals ( "" ) | | DateUtil . getTime ( clockInTime ) . compareTo ( DateUtil . getTime ( getNextClockTime ( needClockDateList , dtjssj ) ) ) < 0 ) ) {
timeType = ClockPointEnum . AFTER ;
}
}
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 ;
}
}
return timeType ;
}
public String getNextClockTime ( List < String > needClockDateList , String time ) {
int index = 0 ;
for ( int i = 0 ; i < needClockDateList . size ( ) ; i + + ) {
if ( needClockDateList . get ( i ) . equals ( time ) ) {
index = i + 1 ;
break ;
}
}
if ( index < needClockDateList . size ( ) & & index ! = 0 ) {
return needClockDateList . get ( index ) ;
} else {
return "" ;
}
}
public String getBeforeClockTime ( List < String > needClockDateList , String time ) {
int index = 0 ;
for ( int i = 0 ; i < needClockDateList . size ( ) ; i + + ) {
if ( needClockDateList . get ( i ) . equals ( time ) ) {
index = i - 1 ;
break ;
}
}
if ( index > = 0 ) {
return needClockDateList . get ( index ) ;
} else {
return "" ;
}
}
/ * *
* 判 断 是 否 是 工 作 ( 包 含 加 班 ) 类 型 时 段
* @param classSegmentType
* @return
* /
public boolean ifWorkClassSegment ( String classSegmentType ) {
if ( classSegmentType . equals ( ClassSegmentTypeEnum . WORK_TIME . getKey ( ) ) | | classSegmentType . equals ( ClassSegmentTypeEnum . EXTENDED_OVERTIME . getKey ( ) )
| | classSegmentType . equals ( ClassSegmentTypeEnum . OVERTIME_PLAN . getKey ( ) ) | | classSegmentType . equals ( ClassSegmentTypeEnum . EARLY_OVERTIME . getKey ( ) ) | | classSegmentType . equals ( ClassSegmentTypeEnum . OVERTIME_IN_CLASS . getKey ( ) ) ) {
return true ;
} else {
return false ;
}
}
}
}