|
@@ -2326,13 +2326,13 @@ public class DingDingServiceImpl implements DingDingService {
|
|
|
}
|
|
|
}
|
|
|
if (onDutyEarleast == null) {
|
|
|
- //再尝试获取最早的下班打卡,作为上班时间,但是要在13:30之前
|
|
|
+ //再尝试获取最早的下班打卡,作为上班时间,但是要在15:00之前
|
|
|
find = oneDayTimes.stream().filter(p->"OffDuty".equals(p.getCheckType())).min(comparator);
|
|
|
if (find.isPresent()) {
|
|
|
DdingCardTimeItem time = find.get();
|
|
|
LocalDateTime sLt = LocalDateTime.ofEpochSecond(time.getUserCheckTime()/1000, 0, ZoneOffset.ofHours(8));
|
|
|
String checkTime = hmFormat.format(sLt);
|
|
|
- if (checkTime.compareTo("13:30") < 0) {
|
|
|
+ if (checkTime.compareTo("15:00") < 0) {
|
|
|
onDutyEarleast = time;
|
|
|
}
|
|
|
}
|
|
@@ -2378,6 +2378,20 @@ public class DingDingServiceImpl implements DingDingService {
|
|
|
if (SysConstant.ZhengBeiCompIds.contains(dingding.getCompanyId())) {
|
|
|
//休息时间段:苏州正北-午休12:00-13:00, 晚修:17:30-18:00
|
|
|
double workHours = ExcelParserService.calculateZhengBeiWorkHours(timeItem.getStartTime(), timeItem.getEndTime());
|
|
|
+ //如果工作时长大于8小时,需要检查是否有当天的请假,有的话得减去请假的时长
|
|
|
+ if (workHours >= 8.0) {
|
|
|
+ List<LeaveSheet> leaveSheets = leaveSheetMapper.selectList(new QueryWrapper<LeaveSheet>()
|
|
|
+ .eq("owner_id", timeItem.getUserId()).eq("company_id", timeItem.getCompanyId())
|
|
|
+ .eq("start_date", dateTimeFormatter.format(timeItem.getWorkDate()))
|
|
|
+ .eq("end_date", dateTimeFormatter.format(timeItem.getWorkDate())));
|
|
|
+ if (leaveSheets.size() > 0) {
|
|
|
+ double sum = leaveSheets.stream().mapToDouble(LeaveSheet::getTimeHours).sum();
|
|
|
+ workHours -= sum;
|
|
|
+ if (workHours < 0) {
|
|
|
+ workHours = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
timeItem.setWorkHours((float)workHours);
|
|
|
} else {
|
|
|
long seconds = (offDutyLatest.getUserCheckTime() - onDutyEarleast.getUserCheckTime())/1000;
|
|
@@ -2387,6 +2401,10 @@ public class DingDingServiceImpl implements DingDingService {
|
|
|
//对比,看看之前是否已经存了
|
|
|
Optional<UserDingdingTime> findOld = oldList.stream().filter(old->old.getUserId().equals(timeItem.getUserId()) && old.getWorkDate().isEqual(timeItem.getWorkDate())).findFirst();
|
|
|
if (findOld.isPresent()) {
|
|
|
+ //被手动修改过了,则不覆盖
|
|
|
+ if (findOld.get().getModifiedByAdmin()) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
timeItem.setId(findOld.get().getId());
|
|
|
}
|
|
|
if (timeItem.getWorkHours() > 0) {
|