提交 e0d360cd authored 作者: douxy's avatar douxy

CP计划小程序改造,修改飞书时间计算逻辑

上级 3f0571d6
...@@ -458,7 +458,7 @@ public class ActivityToFeishuSheetServiceImpl implements ActivityToFeishuSheetSe ...@@ -458,7 +458,7 @@ public class ActivityToFeishuSheetServiceImpl implements ActivityToFeishuSheetSe
*/ */
private String calculateWorkDuration(TemporaryActivityClockDO clockDo) { private String calculateWorkDuration(TemporaryActivityClockDO clockDo) {
// 基础校验:上班/下班时间为空,直接返回0 // 基础校验:上班/下班时间为空,直接返回0
if (Objects.isNull(clockDo.getClockInTime())) { if (Objects.isNull(clockDo)||Objects.isNull(clockDo.getClockInTime()) || Objects.isNull(clockDo.getClockOutTime())) {
return "0"; return "0";
} }
...@@ -477,18 +477,13 @@ public class ActivityToFeishuSheetServiceImpl implements ActivityToFeishuSheetSe ...@@ -477,18 +477,13 @@ public class ActivityToFeishuSheetServiceImpl implements ActivityToFeishuSheetSe
boolean isNoonCardMissing = Objects.isNull(noonClockOut) || Objects.isNull(noonClockIn); boolean isNoonCardMissing = Objects.isNull(noonClockOut) || Objects.isNull(noonClockIn);
if (isNoonCardMissing) { if (isNoonCardMissing) {
// 午休缺卡:直接计算上班→下班的总时长 // 午休缺卡:直接计算上班→下班的总时长
totalMinutes = DateUtil.between(clockIn, clockOut, DateUnit.MINUTE); totalMinutes += DateUtil.between(clockIn, clockOut, DateUnit.MINUTE);
} else { } else {
// 午休不缺卡:两段时长相加(上午段 + 下午段) // 午休不缺卡:两段时长相加(上午段 + 下午段)
// 上班→午休下班 // 上班→午休下班
long morningMinutes = DateUtil.between(clockIn, noonClockOut, DateUnit.MINUTE); long morningMinutes = DateUtil.between(clockIn, noonClockOut, DateUnit.MINUTE);
// 午休上班→下班 long afternoonMinutes= DateUtil.between(noonClockIn, clockOut, DateUnit.MINUTE);
long afternoonMinutes;
if (Objects.isNull(clockDo.getClockOutTime())){
afternoonMinutes = 0 ;
}else {
afternoonMinutes = DateUtil.between(noonClockIn, clockOut, DateUnit.MINUTE);
}
totalMinutes = morningMinutes + afternoonMinutes; totalMinutes = morningMinutes + afternoonMinutes;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论