|
|
@ -54,7 +54,7 @@ public class OvertimePlanServiceImpl extends Service implements OvertimePlanServ
|
|
|
|
Map<String, String> detailItem;
|
|
|
|
Map<String, String> detailItem;
|
|
|
|
String sql = "";
|
|
|
|
String sql = "";
|
|
|
|
//获取作用时段包含计划加班的加班类型的考勤项目集合
|
|
|
|
//获取作用时段包含计划加班的加班类型的考勤项目集合
|
|
|
|
sql = "select id,mc, bddrqlx, jbqsfzs, xzzjbsc, rzdjbxss, zzdjbxss, yzdjbxss, zysd, ccclfs from uf_jcl_kq_kqxm where xmlx = ?";
|
|
|
|
sql = "select id,mc, bddrqlx, jbqsfzs, xzzjbsc, rzdjbxss, zzdjbxss, yzdjbxss, zysd, ccclfs,zdkcjcxxsc from uf_jcl_kq_kqxm where xmlx = ?";
|
|
|
|
List<Map<String, Object>> jblxAttendanceList = DbTools.getSqlToList(sql, AttendanceItemTypeEnum.WORK_OVERTIME.getKey());
|
|
|
|
List<Map<String, Object>> jblxAttendanceList = DbTools.getSqlToList(sql, AttendanceItemTypeEnum.WORK_OVERTIME.getKey());
|
|
|
|
jblxAttendanceList = jblxAttendanceList.stream().filter(f -> Util.null2String(f.get("zysd")).contains(WorkForTimeEnum.PLAN_WORK_OVERTIME.getKey())).collect(Collectors.toList());
|
|
|
|
jblxAttendanceList = jblxAttendanceList.stream().filter(f -> Util.null2String(f.get("zysd")).contains(WorkForTimeEnum.PLAN_WORK_OVERTIME.getKey())).collect(Collectors.toList());
|
|
|
|
//获取人员id和姓名信息
|
|
|
|
//获取人员id和姓名信息
|
|
|
@ -127,6 +127,14 @@ public class OvertimePlanServiceImpl extends Service implements OvertimePlanServ
|
|
|
|
boolean currentToNextDay = false;
|
|
|
|
boolean currentToNextDay = false;
|
|
|
|
boolean beforeToNextDay = false;
|
|
|
|
boolean beforeToNextDay = false;
|
|
|
|
String belongDate = "";
|
|
|
|
String belongDate = "";
|
|
|
|
|
|
|
|
//20240812需求变更,休息班次,允许加班计划区间和班次班段区间有重叠
|
|
|
|
|
|
|
|
boolean currentDayOverLap = false;
|
|
|
|
|
|
|
|
boolean beforeDayOverLap = false;
|
|
|
|
|
|
|
|
boolean nextDayOverLap = false;
|
|
|
|
|
|
|
|
//20240820需求变更,非休息班次,加班区间完全处于休息班段内时,允许申请加班计划,并在匹配加班类型时避开勾选了去除休息时段的加班类型
|
|
|
|
|
|
|
|
boolean onlyInRestPeriod = false;
|
|
|
|
|
|
|
|
//20240814需求变更。非休息班次,出现重叠时间,自动调整加班开始或结束时间,并返回提示
|
|
|
|
|
|
|
|
Map<String, String> adjustInfo = new HashMap<>();
|
|
|
|
if (!"".equals(currentDayStartToEnd)) {
|
|
|
|
if (!"".equals(currentDayStartToEnd)) {
|
|
|
|
//1-加班时间段处于前一日下班后和当日上班前
|
|
|
|
//1-加班时间段处于前一日下班后和当日上班前
|
|
|
|
beforeToCurrentDay = ("".equals(beforeDayEndTime) || beforeDayEndTime.compareTo(date + " " + startTime) <= 0) && currentDayStartTime.compareTo(realEndDate + " " + endTime) >=0;
|
|
|
|
beforeToCurrentDay = ("".equals(beforeDayEndTime) || beforeDayEndTime.compareTo(date + " " + startTime) <= 0) && currentDayStartTime.compareTo(realEndDate + " " + endTime) >=0;
|
|
|
@ -156,29 +164,44 @@ public class OvertimePlanServiceImpl extends Service implements OvertimePlanServ
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
//20240812需求变更,休息班次,允许加班计划区间和班次班段区间有重叠
|
|
|
|
//20240812需求变更,休息班次,允许加班计划区间和班次班段区间有重叠
|
|
|
|
boolean currentDayOverLap = !"".equals(currentDayStartToEnd) && DateUtil.isOverlapping(date + " " + startTime, realEndDate + " " + endTime, currentDayStartTime, currentDayEndTime);
|
|
|
|
currentDayOverLap = !"".equals(currentDayStartToEnd) && DateUtil.isOverlapping(date + " " + startTime, realEndDate + " " + endTime, currentDayStartTime, currentDayEndTime);
|
|
|
|
boolean beforeDayOverLap = !"".equals(beforeDayStartToEnd) && DateUtil.isOverlapping(date + " " + startTime, realEndDate + " " + endTime, beforeDayStartTime, beforeDayEndTime);
|
|
|
|
beforeDayOverLap = !"".equals(beforeDayStartToEnd) && DateUtil.isOverlapping(date + " " + startTime, realEndDate + " " + endTime, beforeDayStartTime, beforeDayEndTime);
|
|
|
|
boolean nextDayOverLap = !"".equals(nextDayStartToEnd) && DateUtil.isOverlapping(date + " " + startTime, realEndDate + " " + endTime, nextDayStartTime, nextDayEndTime);
|
|
|
|
nextDayOverLap = !"".equals(nextDayStartToEnd) && DateUtil.isOverlapping(date + " " + startTime, realEndDate + " " + endTime, nextDayStartTime, nextDayEndTime);
|
|
|
|
//20240814需求变更。非休息班次,出现重叠时间,自动调整加班开始或结束时间,并返回提示
|
|
|
|
//20240814需求变更。非休息班次,出现重叠时间,自动调整加班开始或结束时间,并返回提示
|
|
|
|
Map<String, String> adjustInfo = new HashMap<>();
|
|
|
|
|
|
|
|
adjustInfo.put("startWithAdjust", date + " " + startTime);
|
|
|
|
adjustInfo.put("startWithAdjust", date + " " + startTime);
|
|
|
|
adjustInfo.put("endWithAdjust", realEndDate + " " + endTime);
|
|
|
|
adjustInfo.put("endWithAdjust", realEndDate + " " + endTime);
|
|
|
|
|
|
|
|
adjustInfo.put("startDate", date);
|
|
|
|
|
|
|
|
adjustInfo.put("startTime", startTime);
|
|
|
|
|
|
|
|
adjustInfo.put("endDate", realEndDate);
|
|
|
|
|
|
|
|
adjustInfo.put("endTime", endTime);
|
|
|
|
if ((!currentDayRestBc && currentDayOverLap) || (!beforeDayRestBc && beforeDayOverLap) || (!nextDayRestBc && nextDayOverLap)) {
|
|
|
|
if ((!currentDayRestBc && currentDayOverLap) || (!beforeDayRestBc && beforeDayOverLap) || (!nextDayRestBc && nextDayOverLap)) {
|
|
|
|
//处理前一天
|
|
|
|
//处理前一天
|
|
|
|
if(!beforeDayRestBc && beforeDayOverLap) {
|
|
|
|
if(!beforeDayRestBc && beforeDayOverLap) {
|
|
|
|
belongDate = DateUtil.beforeDay(date, 1);
|
|
|
|
belongDate = DateUtil.beforeDay(date, 1);
|
|
|
|
|
|
|
|
if (overtimeOnlyInRestRange(beforeDayBcId, date + " " + startTime, realEndDate + " " + endTime, DateUtil.beforeDay(date, 1))) {
|
|
|
|
|
|
|
|
onlyInRestPeriod = true;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
adjustInfo = doAdjust(adjustInfo, beforeDayStartTime, beforeDayEndTime);
|
|
|
|
adjustInfo = doAdjust(adjustInfo, beforeDayStartTime, beforeDayEndTime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
//处理当天
|
|
|
|
//处理当天
|
|
|
|
if(!currentDayRestBc && currentDayOverLap) {
|
|
|
|
if(!currentDayRestBc && currentDayOverLap) {
|
|
|
|
belongDate = "".equals(belongDate) ? date : belongDate;
|
|
|
|
belongDate = "".equals(belongDate) ? date : belongDate;
|
|
|
|
|
|
|
|
if (overtimeOnlyInRestRange(currentDayBcId, date + " " + startTime, realEndDate + " " + endTime, date)) {
|
|
|
|
|
|
|
|
onlyInRestPeriod = true;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
adjustInfo = doAdjust(adjustInfo, currentDayStartTime, currentDayEndTime);
|
|
|
|
adjustInfo = doAdjust(adjustInfo, currentDayStartTime, currentDayEndTime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
//处理次日
|
|
|
|
//处理次日
|
|
|
|
if(!nextDayRestBc && nextDayOverLap) {
|
|
|
|
if(!nextDayRestBc && nextDayOverLap) {
|
|
|
|
belongDate = "".equals(belongDate) ? DateUtil.AfterDay(date, 1) : belongDate;
|
|
|
|
belongDate = "".equals(belongDate) ? DateUtil.AfterDay(date, 1) : belongDate;
|
|
|
|
|
|
|
|
if (overtimeOnlyInRestRange(nextDayBcId, date + " " + startTime, realEndDate + " " + endTime, DateUtil.AfterDay(date, 1))) {
|
|
|
|
|
|
|
|
onlyInRestPeriod = true;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
adjustInfo = doAdjust(adjustInfo, nextDayStartTime, nextDayEndTime);
|
|
|
|
adjustInfo = doAdjust(adjustInfo, nextDayStartTime, nextDayEndTime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
//重置加班开始和结束时间、加班时长
|
|
|
|
//重置加班开始和结束时间、加班时长
|
|
|
|
detailItem.put("ksrq", adjustInfo.get("startDate"));
|
|
|
|
detailItem.put("ksrq", adjustInfo.get("startDate"));
|
|
|
|
detailItem.put("kssj", adjustInfo.get("startTime"));
|
|
|
|
detailItem.put("kssj", adjustInfo.get("startTime"));
|
|
|
@ -186,26 +209,19 @@ public class OvertimePlanServiceImpl extends Service implements OvertimePlanServ
|
|
|
|
detailItem.put("jsrq", adjustInfo.get("endDate"));
|
|
|
|
detailItem.put("jsrq", adjustInfo.get("endDate"));
|
|
|
|
overtimeMinutes = DateUtil.getBetWeenMinutes(adjustInfo.get("startWithAdjust"), adjustInfo.get("endWithAdjust"));
|
|
|
|
overtimeMinutes = DateUtil.getBetWeenMinutes(adjustInfo.get("startWithAdjust"), adjustInfo.get("endWithAdjust"));
|
|
|
|
//4-非休息班次,出现重叠时间,属于不合理加班安排,返回提示”已自动调整开始和结束时间点“
|
|
|
|
//4-非休息班次,出现重叠时间,属于不合理加班安排,返回提示”已自动调整开始和结束时间点“
|
|
|
|
|
|
|
|
if (!onlyInRestPeriod) {
|
|
|
|
errorMessage.add(Util.null2String(empIdToNameInfo.get(empId)) + "在日期" + date + "的加班计划区间和非休息班次班段出现时间重叠,已自动调整开始和结束时间点!");
|
|
|
|
errorMessage.add(Util.null2String(empIdToNameInfo.get(empId)) + "在日期" + date + "的加班计划区间和非休息班次班段出现时间重叠,已自动调整开始和结束时间点!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
//5-加班区间和休息班次出现重叠,首次重叠的日期,即为归属日期;如果已有归属日,则比较当前日期和归属日谁更早
|
|
|
|
//5-加班区间和休息班次出现重叠,首次重叠的日期,即为归属日期;如果已有归属日,则比较当前日期和归属日谁更早
|
|
|
|
//20240816需求变更,需要去除重叠的休息班次中的休息时段时长
|
|
|
|
|
|
|
|
int restOverLapMinutes = 0;
|
|
|
|
|
|
|
|
if (beforeDayRestBc && beforeDayOverLap) {
|
|
|
|
if (beforeDayRestBc && beforeDayOverLap) {
|
|
|
|
belongDate = DateUtil.beforeDay(date, 1);
|
|
|
|
belongDate = DateUtil.beforeDay(date, 1);
|
|
|
|
restOverLapMinutes = restOverLapMinutes
|
|
|
|
|
|
|
|
+ countRestOverLapMinutes(beforeDayBcId, adjustInfo.get("startWithAdjust"), adjustInfo.get("endWithAdjust"), DateUtil.beforeDay(date, 1));
|
|
|
|
|
|
|
|
} else if (currentDayRestBc && currentDayOverLap) {
|
|
|
|
} else if (currentDayRestBc && currentDayOverLap) {
|
|
|
|
belongDate = "".equals(belongDate) || date.compareTo(belongDate) < 0 ? date : belongDate;
|
|
|
|
belongDate = "".equals(belongDate) || date.compareTo(belongDate) < 0 ? date : belongDate;
|
|
|
|
restOverLapMinutes = restOverLapMinutes
|
|
|
|
|
|
|
|
+ countRestOverLapMinutes(currentDayBcId, adjustInfo.get("startWithAdjust"), adjustInfo.get("endWithAdjust"), date);
|
|
|
|
|
|
|
|
} else if (nextDayRestBc && nextDayOverLap) {
|
|
|
|
} else if (nextDayRestBc && nextDayOverLap) {
|
|
|
|
belongDate = "".equals(belongDate) ? DateUtil.AfterDay(date, 1) : belongDate;
|
|
|
|
belongDate = "".equals(belongDate) ? DateUtil.AfterDay(date, 1) : belongDate;
|
|
|
|
restOverLapMinutes = restOverLapMinutes
|
|
|
|
|
|
|
|
+ countRestOverLapMinutes(nextDayBcId, adjustInfo.get("startWithAdjust"), adjustInfo.get("endWithAdjust"), DateUtil.AfterDay(date, 1));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
overtimeMinutes = overtimeMinutes - restOverLapMinutes;
|
|
|
|
|
|
|
|
detailItem.put("jbsc", String.format("%.2f", overtimeMinutes / 60.0));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//判断归属日的日期类型,首先从排班的信息来获取
|
|
|
|
//判断归属日的日期类型,首先从排班的信息来获取
|
|
|
|
String belongDateType = dateTypeInfoFromBc.getOrDefault(belongDate, "");
|
|
|
|
String belongDateType = dateTypeInfoFromBc.getOrDefault(belongDate, "");
|
|
|
@ -224,6 +240,10 @@ public class OvertimePlanServiceImpl extends Service implements OvertimePlanServ
|
|
|
|
//判断该加班类型考勤项目是否被该人员使用,且考勤项目的绑定的日期类型是否包含归属日期类型
|
|
|
|
//判断该加班类型考勤项目是否被该人员使用,且考勤项目的绑定的日期类型是否包含归属日期类型
|
|
|
|
if (kqxmSetIds.contains(Util.null2String(attendanceItemInfo.get("id")))
|
|
|
|
if (kqxmSetIds.contains(Util.null2String(attendanceItemInfo.get("id")))
|
|
|
|
&& Util.null2String(attendanceItemInfo.get("bddrqlx")).contains(belongDateType)) {
|
|
|
|
&& Util.null2String(attendanceItemInfo.get("bddrqlx")).contains(belongDateType)) {
|
|
|
|
|
|
|
|
//非休息班次,加班区间完全处于休息班段内时,在匹配加班类型时避开勾选了“是否扣除时间区间内的就餐时长”的加班类型
|
|
|
|
|
|
|
|
if (onlyInRestPeriod && "1".equals(Util.null2String(attendanceItemInfo.get("zdkcjcxxsc")))) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
detailItem.put("jblx", Util.null2String(attendanceItemInfo.get("id")));
|
|
|
|
detailItem.put("jblx", Util.null2String(attendanceItemInfo.get("id")));
|
|
|
|
detailItem.put("jblxName", Util.null2String(attendanceItemInfo.get("mc")));
|
|
|
|
detailItem.put("jblxName", Util.null2String(attendanceItemInfo.get("mc")));
|
|
|
|
matchItemInfo = attendanceItemInfo;
|
|
|
|
matchItemInfo = attendanceItemInfo;
|
|
|
@ -237,6 +257,22 @@ public class OvertimePlanServiceImpl extends Service implements OvertimePlanServ
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
log.info(Util.null2String(empIdToNameInfo.get(empId)) + "在日期" + date + "的加班计划匹配到:" + Util.null2String(matchItemInfo.get("mc")));
|
|
|
|
log.info(Util.null2String(empIdToNameInfo.get(empId)) + "在日期" + date + "的加班计划匹配到:" + Util.null2String(matchItemInfo.get("mc")));
|
|
|
|
|
|
|
|
//20240816需求变更,根据zdkcjcxxsc字段设置,即“是否扣除时间区间内的就餐时长”需要去除重叠的休息班次中的休息时段时长
|
|
|
|
|
|
|
|
String removeRestSc = Util.null2String(matchItemInfo.get("zdkcjcxxsc"));
|
|
|
|
|
|
|
|
int restOverLapMinutes = 0;
|
|
|
|
|
|
|
|
if (beforeDayRestBc && beforeDayOverLap && "1".equals(removeRestSc)) {
|
|
|
|
|
|
|
|
restOverLapMinutes = restOverLapMinutes
|
|
|
|
|
|
|
|
+ countRestOverLapMinutes(beforeDayBcId, adjustInfo.get("startWithAdjust"), adjustInfo.get("endWithAdjust"), DateUtil.beforeDay(date, 1));
|
|
|
|
|
|
|
|
} else if (currentDayRestBc && currentDayOverLap && "1".equals(removeRestSc)) {
|
|
|
|
|
|
|
|
restOverLapMinutes = restOverLapMinutes
|
|
|
|
|
|
|
|
+ countRestOverLapMinutes(currentDayBcId, adjustInfo.get("startWithAdjust"), adjustInfo.get("endWithAdjust"), date);
|
|
|
|
|
|
|
|
} else if (nextDayRestBc && nextDayOverLap && "1".equals(removeRestSc)) {
|
|
|
|
|
|
|
|
restOverLapMinutes = restOverLapMinutes
|
|
|
|
|
|
|
|
+ countRestOverLapMinutes(nextDayBcId, adjustInfo.get("startWithAdjust"), adjustInfo.get("endWithAdjust"), DateUtil.AfterDay(date, 1));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
overtimeMinutes = overtimeMinutes - restOverLapMinutes;
|
|
|
|
|
|
|
|
detailItem.put("jbsc", String.format("%.2f", overtimeMinutes / 60.0));
|
|
|
|
|
|
|
|
//单条明细的最小加班分钟数校验
|
|
|
|
String minMinutes = Util.null2String(matchItemInfo.get("jbqsfzs"));
|
|
|
|
String minMinutes = Util.null2String(matchItemInfo.get("jbqsfzs"));
|
|
|
|
if (!"".equals(minMinutes) && Integer.parseInt(minMinutes) > overtimeMinutes) {
|
|
|
|
if (!"".equals(minMinutes) && Integer.parseInt(minMinutes) > overtimeMinutes) {
|
|
|
|
//最小加班分钟数大于单条明细的加班时长分钟数
|
|
|
|
//最小加班分钟数大于单条明细的加班时长分钟数
|
|
|
@ -329,18 +365,21 @@ public class OvertimePlanServiceImpl extends Service implements OvertimePlanServ
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 目标区间和日期所在班次的休息时段重叠的分钟数
|
|
|
|
* 目标区间和日期所在班次的休息时段重叠的分钟数
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private int countRestOverLapMinutes(String nextDayBcId, String startTime, String endTime, String date) {
|
|
|
|
private int countRestOverLapMinutes(String dayBcId, String startTime, String endTime, String date) {
|
|
|
|
List<String> countBdlxList = new ArrayList<>();
|
|
|
|
List<String> countBdlxList = new ArrayList<>();
|
|
|
|
countBdlxList.add(ClassSegmentTypeEnum.REST_AND_DINE.getKey());
|
|
|
|
countBdlxList.add(ClassSegmentTypeEnum.REST_AND_DINE.getKey());
|
|
|
|
countBdlxList.add(ClassSegmentTypeEnum.REST_PERIOD.getKey());
|
|
|
|
countBdlxList.add(ClassSegmentTypeEnum.REST_PERIOD.getKey());
|
|
|
|
countBdlxList.add(ClassSegmentTypeEnum.DINING_PERIOD.getKey());
|
|
|
|
countBdlxList.add(ClassSegmentTypeEnum.DINING_PERIOD.getKey());
|
|
|
|
String sql = "select id, bdlx, gsrq, kssj as dtkssj, jssj as dtjssj from uf_jcl_kq_bcxx_dt1 where mainid = " + nextDayBcId;
|
|
|
|
String sql = "select id, bdlx, gsrq, kssj as dtkssj, jssj as dtjssj from uf_jcl_kq_bcxx_dt1 where mainid = " + dayBcId;
|
|
|
|
List<Map<String, Object>> bcDetailData = DbTools.getSqlToList(sql);
|
|
|
|
List<Map<String, Object>> bcDetailData = DbTools.getSqlToList(sql);
|
|
|
|
bcDetailData = bcDetailData.stream().filter(e -> countBdlxList.contains(Util.null2String(e.get("bdlx")))).collect(Collectors.toList());
|
|
|
|
bcDetailData = bcDetailData.stream().filter(e -> countBdlxList.contains(Util.null2String(e.get("bdlx")))).collect(Collectors.toList());
|
|
|
|
//获取需要累计的班段时长区间和目标区间存在交集的分钟数
|
|
|
|
//获取需要累计的班段时长区间和目标区间存在交集的分钟数
|
|
|
|
return Utils.removeTime(startTime, endTime, bcDetailData, date);
|
|
|
|
return Utils.removeTime(startTime, endTime, bcDetailData, date);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 加班区间和非休息班次出现重叠时,自动调整加班区间的开始/结束时间
|
|
|
|
|
|
|
|
*/
|
|
|
|
private Map<String, String> doAdjust(Map<String, String> adjustInfo, String bcStartTime, String bcEndTime) {
|
|
|
|
private Map<String, String> doAdjust(Map<String, String> adjustInfo, String bcStartTime, String bcEndTime) {
|
|
|
|
String startWithAdjust = adjustInfo.get("startWithAdjust");
|
|
|
|
String startWithAdjust = adjustInfo.get("startWithAdjust");
|
|
|
|
String endWithAdjust = adjustInfo.get("endWithAdjust");
|
|
|
|
String endWithAdjust = adjustInfo.get("endWithAdjust");
|
|
|
@ -348,12 +387,15 @@ public class OvertimePlanServiceImpl extends Service implements OvertimePlanServ
|
|
|
|
if (bcStartTime.compareTo(startWithAdjust) > 0 && bcEndTime.compareTo(endWithAdjust) < 0) {
|
|
|
|
if (bcStartTime.compareTo(startWithAdjust) > 0 && bcEndTime.compareTo(endWithAdjust) < 0) {
|
|
|
|
startWithAdjust = bcEndTime;
|
|
|
|
startWithAdjust = bcEndTime;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
//加班区间与部分班次区间重叠时
|
|
|
|
//加班区间与部分班次区间重叠时,此处可能出现加班区间完全被班次区间包含情况,从而导致加班开始时间晚于加班结束时间
|
|
|
|
startWithAdjust = bcStartTime.compareTo(startWithAdjust) <= 0 && bcEndTime.compareTo(startWithAdjust) > 0
|
|
|
|
startWithAdjust = bcStartTime.compareTo(startWithAdjust) <= 0 && bcEndTime.compareTo(startWithAdjust) > 0
|
|
|
|
? bcEndTime : startWithAdjust;
|
|
|
|
? bcEndTime : startWithAdjust;
|
|
|
|
endWithAdjust = bcStartTime.compareTo(endWithAdjust) < 0 && bcEndTime.compareTo(endWithAdjust) >= 0
|
|
|
|
endWithAdjust = bcStartTime.compareTo(endWithAdjust) < 0 && bcEndTime.compareTo(endWithAdjust) >= 0
|
|
|
|
? bcStartTime : endWithAdjust;
|
|
|
|
? bcStartTime : endWithAdjust;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//当加班开始时间晚于加班结束时间时
|
|
|
|
|
|
|
|
endWithAdjust = startWithAdjust.compareTo(endWithAdjust) > 0 ? startWithAdjust : endWithAdjust;
|
|
|
|
|
|
|
|
|
|
|
|
adjustInfo.put("startWithAdjust", startWithAdjust);
|
|
|
|
adjustInfo.put("startWithAdjust", startWithAdjust);
|
|
|
|
adjustInfo.put("endWithAdjust", endWithAdjust);
|
|
|
|
adjustInfo.put("endWithAdjust", endWithAdjust);
|
|
|
|
adjustInfo.put("startDate", startWithAdjust.split(" ")[0]);
|
|
|
|
adjustInfo.put("startDate", startWithAdjust.split(" ")[0]);
|
|
|
@ -363,6 +405,22 @@ public class OvertimePlanServiceImpl extends Service implements OvertimePlanServ
|
|
|
|
return adjustInfo;
|
|
|
|
return adjustInfo;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 判断请假区间是否完全处于班次中的休息时段内
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private boolean overtimeOnlyInRestRange(String bcId, String startTime, String endTime, String date) {
|
|
|
|
|
|
|
|
int overRangeMinutes = DateUtil.getBetWeenMinutes(startTime, endTime);
|
|
|
|
|
|
|
|
List<String> countBdlxList = new ArrayList<>();
|
|
|
|
|
|
|
|
countBdlxList.add(ClassSegmentTypeEnum.REST_AND_DINE.getKey());
|
|
|
|
|
|
|
|
countBdlxList.add(ClassSegmentTypeEnum.REST_PERIOD.getKey());
|
|
|
|
|
|
|
|
countBdlxList.add(ClassSegmentTypeEnum.DINING_PERIOD.getKey());
|
|
|
|
|
|
|
|
String sql = "select id, bdlx, gsrq, kssj as dtkssj, jssj as dtjssj from uf_jcl_kq_bcxx_dt1 where mainid = " + bcId;
|
|
|
|
|
|
|
|
List<Map<String, Object>> bcDetailData = DbTools.getSqlToList(sql);
|
|
|
|
|
|
|
|
bcDetailData = bcDetailData.stream().filter(e -> countBdlxList.contains(Util.null2String(e.get("bdlx")))).collect(Collectors.toList());
|
|
|
|
|
|
|
|
//获取需要累计的班段时长区间和目标区间存在交集的分钟数,并与请假区间内的分钟数最比较
|
|
|
|
|
|
|
|
return overRangeMinutes == Utils.removeTime(startTime, endTime, bcDetailData, date);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private boolean checkRestBc(String bcId) {
|
|
|
|
private boolean checkRestBc(String bcId) {
|
|
|
|
boolean restSign = false;
|
|
|
|
boolean restSign = false;
|
|
|
|
if (!"".equals(bcId)) {
|
|
|
|
if (!"".equals(bcId)) {
|
|
|
|